Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 2 | /** |
| 3 | * CodeIgniter |
| 4 | * |
Greg Aker | 741de1c | 2010-11-10 14:52:57 -0600 | [diff] [blame] | 5 | * An open source application development framework for PHP 5.1.6 or newer |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 6 | * |
| 7 | * @package CodeIgniter |
| 8 | * @author ExpressionEngine Dev Team |
Greg Aker | 0711dc8 | 2011-01-05 10:49:40 -0600 | [diff] [blame] | 9 | * @copyright Copyright (c) 2008 - 2011, EllisLab, Inc. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 10 | * @license http://codeigniter.com/user_guide/license.html |
| 11 | * @link http://codeigniter.com |
| 12 | * @since Version 1.0 |
| 13 | * @filesource |
| 14 | */ |
| 15 | |
| 16 | // ------------------------------------------------------------------------ |
| 17 | |
| 18 | /** |
| 19 | * Pagination Class |
| 20 | * |
| 21 | * @package CodeIgniter |
| 22 | * @subpackage Libraries |
| 23 | * @category Pagination |
| 24 | * @author ExpressionEngine Dev Team |
| 25 | * @link http://codeigniter.com/user_guide/libraries/pagination.html |
| 26 | */ |
| 27 | class CI_Pagination { |
| 28 | |
| 29 | var $base_url = ''; // The page we are linking to |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 30 | var $prefix = ''; // A custom prefix added to the path. |
| 31 | var $suffix = ''; // A custom suffix added to the path. |
| 32 | |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 33 | var $total_rows = 0; // Total number of items (database results) |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 34 | var $per_page = 10; // Max number of items you want shown per page |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 35 | var $num_links = 2; // Number of "digit" links to show before/after the currently viewed page |
| 36 | var $cur_page = 0; // The current page being viewed |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 37 | var $use_page_numbers = FALSE; // Use page number for segment instead of offset |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 38 | var $first_link = '‹ First'; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 39 | var $next_link = '>'; |
| 40 | var $prev_link = '<'; |
| 41 | var $last_link = 'Last ›'; |
| 42 | var $uri_segment = 3; |
| 43 | var $full_tag_open = ''; |
| 44 | var $full_tag_close = ''; |
| 45 | var $first_tag_open = ''; |
| 46 | var $first_tag_close = ' '; |
| 47 | var $last_tag_open = ' '; |
| 48 | var $last_tag_close = ''; |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 49 | var $first_url = ''; // Alternative URL for the First Page. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 50 | var $cur_tag_open = ' <strong>'; |
| 51 | var $cur_tag_close = '</strong>'; |
| 52 | var $next_tag_open = ' '; |
| 53 | var $next_tag_close = ' '; |
| 54 | var $prev_tag_open = ' '; |
| 55 | var $prev_tag_close = ''; |
| 56 | var $num_tag_open = ' '; |
| 57 | var $num_tag_close = ''; |
| 58 | var $page_query_string = FALSE; |
| 59 | var $query_string_segment = 'per_page'; |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 60 | var $display_pages = TRUE; |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 61 | var $anchor_class = ''; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 62 | |
| 63 | /** |
| 64 | * Constructor |
| 65 | * |
| 66 | * @access public |
| 67 | * @param array initialization parameters |
| 68 | */ |
Greg Aker | a926328 | 2010-11-10 15:26:43 -0600 | [diff] [blame] | 69 | public function __construct($params = array()) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 70 | { |
| 71 | if (count($params) > 0) |
| 72 | { |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 73 | $this->initialize($params); |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 74 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 75 | |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 76 | if ($this->anchor_class != '') |
| 77 | { |
| 78 | $this->anchor_class = 'class="'.$this->anchor_class.'" '; |
| 79 | } |
| 80 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 81 | log_message('debug', "Pagination Class Initialized"); |
| 82 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 83 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 84 | // -------------------------------------------------------------------- |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 85 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 86 | /** |
| 87 | * Initialize Preferences |
| 88 | * |
| 89 | * @access public |
| 90 | * @param array initialization parameters |
| 91 | * @return void |
| 92 | */ |
| 93 | function initialize($params = array()) |
| 94 | { |
| 95 | if (count($params) > 0) |
| 96 | { |
| 97 | foreach ($params as $key => $val) |
| 98 | { |
| 99 | if (isset($this->$key)) |
| 100 | { |
| 101 | $this->$key = $val; |
| 102 | } |
| 103 | } |
| 104 | } |
| 105 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 106 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 107 | // -------------------------------------------------------------------- |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 108 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 109 | /** |
| 110 | * Generate the pagination links |
| 111 | * |
| 112 | * @access public |
| 113 | * @return string |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 114 | */ |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 115 | function create_links() |
| 116 | { |
| 117 | // If our item count or per-page total is zero there is no need to continue. |
| 118 | if ($this->total_rows == 0 OR $this->per_page == 0) |
| 119 | { |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 120 | return ''; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | // Calculate the total number of pages |
| 124 | $num_pages = ceil($this->total_rows / $this->per_page); |
| 125 | |
| 126 | // Is there only one page? Hm... nothing more to do here then. |
| 127 | if ($num_pages == 1) |
| 128 | { |
| 129 | return ''; |
| 130 | } |
| 131 | |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 132 | // Set the base page index for starting page number |
Aaron Kuzemchak | a5e13f9 | 2011-09-04 16:39:47 -0400 | [diff] [blame^] | 133 | $base_page = ($this->use_page_numbers) ? 1 : 0; |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 134 | |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 135 | // Determine the current page number. |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 136 | $CI =& get_instance(); |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 137 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 138 | if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) |
| 139 | { |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 140 | if ($CI->input->get($this->query_string_segment) != $base_page) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 141 | { |
| 142 | $this->cur_page = $CI->input->get($this->query_string_segment); |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 143 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 144 | // Prep the current page - no funny business! |
| 145 | $this->cur_page = (int) $this->cur_page; |
| 146 | } |
| 147 | } |
| 148 | else |
| 149 | { |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 150 | if ($CI->uri->segment($this->uri_segment) != $base_page) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 151 | { |
| 152 | $this->cur_page = $CI->uri->segment($this->uri_segment); |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 153 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 154 | // Prep the current page - no funny business! |
| 155 | $this->cur_page = (int) $this->cur_page; |
| 156 | } |
| 157 | } |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 158 | |
| 159 | // Set current page to 1 if using page numbers instead of offset |
| 160 | if ($this->use_page_numbers AND $this->cur_page == 0) |
| 161 | { |
| 162 | $this->cur_page = $base_page; |
| 163 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 164 | |
| 165 | $this->num_links = (int)$this->num_links; |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 166 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 167 | if ($this->num_links < 1) |
| 168 | { |
| 169 | show_error('Your number of links must be a positive number.'); |
| 170 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 171 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 172 | if ( ! is_numeric($this->cur_page)) |
| 173 | { |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 174 | $this->cur_page = $base_page; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 175 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 176 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 177 | // Is the page number beyond the result range? |
| 178 | // If so we show the last page |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 179 | if ($this->use_page_numbers) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 180 | { |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 181 | if ($this->cur_page > $num_pages) |
| 182 | { |
| 183 | $this->cur_page = $num_pages; |
| 184 | } |
| 185 | } |
| 186 | else |
| 187 | { |
| 188 | if ($this->cur_page > $this->total_rows) |
| 189 | { |
| 190 | $this->cur_page = ($num_pages - 1) * $this->per_page; |
| 191 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 192 | } |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 193 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 194 | $uri_page_number = $this->cur_page; |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 195 | |
| 196 | if ( ! $this->use_page_numbers) |
| 197 | { |
| 198 | $this->cur_page = floor(($this->cur_page/$this->per_page) + 1); |
| 199 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 200 | |
| 201 | // Calculate the start and end numbers. These determine |
| 202 | // which number to start and end the digit links with |
| 203 | $start = (($this->cur_page - $this->num_links) > 0) ? $this->cur_page - ($this->num_links - 1) : 1; |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 204 | $end = (($this->cur_page + $this->num_links) < $num_pages) ? $this->cur_page + $this->num_links : $num_pages; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 205 | |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 206 | // Is pagination being used over GET or POST? If get, add a per_page query |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 207 | // string. If post, add a trailing slash to the base URL if needed |
| 208 | if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE) |
| 209 | { |
| 210 | $this->base_url = rtrim($this->base_url).'&'.$this->query_string_segment.'='; |
| 211 | } |
| 212 | else |
| 213 | { |
| 214 | $this->base_url = rtrim($this->base_url, '/') .'/'; |
| 215 | } |
| 216 | |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 217 | // And here we go... |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 218 | $output = ''; |
| 219 | |
| 220 | // Render the "First" link |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 221 | if ($this->first_link !== FALSE AND $this->cur_page > ($this->num_links + 1)) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 222 | { |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 223 | $first_url = ($this->first_url == '') ? $this->base_url : $this->first_url; |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 224 | $output .= $this->first_tag_open.'<a '.$this->anchor_class.'href="'.$first_url.'">'.$this->first_link.'</a>'.$this->first_tag_close; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | // Render the "previous" link |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 228 | if ($this->prev_link !== FALSE AND $this->cur_page != 1) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 229 | { |
Aaron Kuzemchak | a5e13f9 | 2011-09-04 16:39:47 -0400 | [diff] [blame^] | 230 | $i = ($this->use_page_numbers) ? $uri_page_number - 1 : $uri_page_number - $this->per_page; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 231 | |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 232 | if ($i == 0 && $this->first_url != '') |
| 233 | { |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 234 | $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 235 | } |
| 236 | else |
| 237 | { |
| 238 | $i = ($i == 0) ? '' : $this->prefix.$i.$this->suffix; |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 239 | $output .= $this->prev_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$i.'">'.$this->prev_link.'</a>'.$this->prev_tag_close; |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 240 | } |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 241 | |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 242 | } |
| 243 | |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 244 | // Render the pages |
| 245 | if ($this->display_pages !== FALSE) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 246 | { |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 247 | // Write the digit links |
| 248 | for ($loop = $start -1; $loop <= $end; $loop++) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 249 | { |
Aaron Kuzemchak | a5e13f9 | 2011-09-04 16:39:47 -0400 | [diff] [blame^] | 250 | $i = ($this->use_page_numbers) ? $loop : ($loop * $this->per_page) - $this->per_page; |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 251 | |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 252 | if ($i >= $base_page) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 253 | { |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 254 | if ($this->cur_page == $loop) |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 255 | { |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 256 | $output .= $this->cur_tag_open.$loop.$this->cur_tag_close; // Current page |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 257 | } |
| 258 | else |
| 259 | { |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 260 | $n = ($i == $base_page) ? '' : $i; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 261 | |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 262 | if ($n == '' && $this->first_url != '') |
| 263 | { |
| 264 | $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->first_url.'">'.$loop.'</a>'.$this->num_tag_close; |
| 265 | } |
| 266 | else |
| 267 | { |
| 268 | $n = ($n == '') ? '' : $this->prefix.$n.$this->suffix; |
Barry Mieny | dd67197 | 2010-10-04 16:33:58 +0200 | [diff] [blame] | 269 | |
Derek Allard | e01fd0f | 2010-07-05 11:06:07 -0400 | [diff] [blame] | 270 | $output .= $this->num_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$n.'">'.$loop.'</a>'.$this->num_tag_close; |
| 271 | } |
Robin Sowell | 2a6c1da | 2010-05-24 12:20:03 -0400 | [diff] [blame] | 272 | } |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 273 | } |
| 274 | } |
| 275 | } |
| 276 | |
| 277 | // Render the "next" link |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 278 | if ($this->next_link !== FALSE AND $this->cur_page < $num_pages) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 279 | { |
Aaron Kuzemchak | a5e13f9 | 2011-09-04 16:39:47 -0400 | [diff] [blame^] | 280 | $i = ($this->use_page_numbers) ? $this->cur_page + 1 : $this->cur_page * $this->per_page; |
Aaron Kuzemchak | 11c5f16 | 2011-09-03 20:59:07 -0400 | [diff] [blame] | 281 | |
| 282 | $output .= $this->next_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->next_link.'</a>'.$this->next_tag_close; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 283 | } |
| 284 | |
| 285 | // Render the "Last" link |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 286 | if ($this->last_link !== FALSE AND ($this->cur_page + $this->num_links) < $num_pages) |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 287 | { |
Aaron Kuzemchak | a5e13f9 | 2011-09-04 16:39:47 -0400 | [diff] [blame^] | 288 | $i = ($this->use_page_numbers) ? $num_pages : ($num_pages * $this->per_page) - $this->per_page; |
| 289 | |
Derek Allard | 96bb75c | 2010-07-05 10:54:30 -0400 | [diff] [blame] | 290 | $output .= $this->last_tag_open.'<a '.$this->anchor_class.'href="'.$this->base_url.$this->prefix.$i.$this->suffix.'">'.$this->last_link.'</a>'.$this->last_tag_close; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 291 | } |
| 292 | |
Derek Jones | 4b9c629 | 2011-07-01 17:40:48 -0500 | [diff] [blame] | 293 | // Kill double slashes. Note: Sometimes we can end up with a double slash |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 294 | // in the penultimate link so we'll kill all double slashes. |
| 295 | $output = preg_replace("#([^:])//+#", "\\1/", $output); |
| 296 | |
| 297 | // Add the wrapper HTML if exists |
| 298 | $output = $this->full_tag_open.$output.$this->full_tag_close; |
Derek Allard | faac15e | 2009-03-07 17:17:58 +0000 | [diff] [blame] | 299 | |
| 300 | return $output; |
Derek Allard | 2067d1a | 2008-11-13 22:59:24 +0000 | [diff] [blame] | 301 | } |
| 302 | } |
| 303 | // END Pagination Class |
| 304 | |
| 305 | /* End of file Pagination.php */ |
Derek Jones | a3ffbbb | 2008-05-11 18:18:29 +0000 | [diff] [blame] | 306 | /* Location: ./system/libraries/Pagination.php */ |