div_name = "pagebar"; $this->paged = $page; $this->max_page = $max_page; $this->wp_query = $wp_query; $this->pbOptions = $pbOptions; // load options $this->init($this->pbOptions); // initialize } //function __construct() function Basebar($page, $max_page) { $this->__construct($page, $max_page); } // ------------------------------------------------------------------------- function create_link($page) { return get_pagenum_link($page); } // ----------------------------------------------------------------------------- function tagReplace($text,$page) { $text = str_replace ( "{page}", $page, $text ); $text = str_replace ( "{current}", $page, $text ); $text = str_replace ( "{total}", $this->max_page, $text ); //if (strpos($text, '{img:') !== false) // $text = pb_insertImage($text, $page); return $text; } // ------------------------------------------------------------------------- function previousPage($paged) { if ($this->pbOptions ["pdisplay"] == "never") return; if (($this->paged == 1) && ($this->pbOptions ["pdisplay"] == "auto")) return; $text = $this->tagReplace($this->pbOptions ["prev"], $this->paged); echo ($this->paged == 1) ? '' . $text . "\n" : 'tooltip ($this->paged - 1 ) . '>' . $text . "\n"; } // ----------------------------------------------------------------------------- function thisPage($page) { echo '' . $this->tagReplace($this->replaceFirstLast ( $page ), $page) . "\n"; } // ----------------------------------------------------------------------------- function nextPage($page,$max_page) { if ($this->pbOptions ["pdisplay"] == "never") return; if (($this->paged == $max_page) && ($this->pbOptions ["ndisplay"] == "auto")) return; $text = $this->tagReplace($this->pbOptions ["next"], $page); echo ($this->paged == $max_page) ? '' . $text . "\n" : 'tooltip ( $this->paged + 1 ) . '>' . $text . "\n"; } // ----------------------------------------------------------------------------- function transit($place) { if ($place > 0) echo ''; echo $this->pbOptions["connect"] !== "" ? $this->pbOptions["connect"] : '...'; echo ''; } // ----------------------------------------------------------------------------- function replaceFirstLast($page) { switch ( $page) { case 1 : return $this->pbOptions ['first']; case $this->max_page : return $this->pbOptions ['last']; case $this->paged: return $this->pbOptions['current']; default : return $this->pbOptions['standard']; } } // ----------------------------------------------------------------------------- function page($page) { $link = $this->create_link($page); echo 'tooltip($page) . '>' . $this->TagReplace($this->replaceFirstLast($page), $page) . "\n"; } // ----------------------------------------------------------------------------- function tooltip($page) { if ($this->pbOptions ["tooltips"]) return ' title="' . $this->tagReplace ( $this->pbOptions ["tooltipText"], $page ) . '"'; return ""; } // ----------------------------------------------------------------------------- function leave() { if (is_singular()) return 1; if ($this->max_page <= 1) // only one page -> don't display pagebar return 1; }//leave() // ----------------------------------------------------------------------------- function div_start() { echo '