__construct(); } /** * Main constructor - Does nothing. * Call create_navigation() method when you need a navigation. * */ function __construct() { return; } /** * nggNavigation::create_navigation() * * @param mixed $page * @param integer $totalElement * @param integer $maxElement * @return string pagination content */ function create_navigation($page, $totalElement, $maxElement = 0) { global $nggRewrite; $prev_symbol = apply_filters('ngg_prev_symbol', '◄'); $next_symbol = apply_filters('ngg_prev_symbol', '►'); if ($maxElement > 0) { $total = $totalElement; // create navigation if ( $total > $maxElement ) { $total_pages = ceil( $total / $maxElement ); $r = ''; if ( 1 < $page ) { $args['nggpage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; $previous = $args['nggpage']; if (FALSE == $args['nggpage']) { $previous = 1; } $this->prev = $nggRewrite->get_permalink ( $args ); $r .= '' . $prev_symbol . ''; } $total_pages = ceil( $total / $maxElement ); if ( $total_pages > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) { if ( $page == $page_num ) { $r .= '' . $page_num . ''; } else { $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) { $args['nggpage'] = ( 1 == $page_num ) ? FALSE : $page_num; $r .= '' . ( $page_num ) . ''; $in = true; } elseif ( $in == true ) { $r .= '...'; $in = false; } } } } if ( ( $page ) * $maxElement < $total || -1 == $total ) { $args['nggpage'] = $page + 1; $this->next = $nggRewrite->get_permalink ( $args ); $r .= '' . $next_symbol . ''; } $this->output = "
"; } else { $this->output = ""."\n"; } } return $this->output; } } ?>