WP-Paginate - Version 1.1.2

Version Description

  • Fixed comment pagination bug (nested comments caused blank page)
  • Enabled HTML for Pagination Label, Previous Page, and Next Page
  • Localization changes were made, Translations need to be updated
Download this release

Release Info

Developer emartin24
Plugin Icon 128x128 WP-Paginate
Version 1.1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.1.2

Files changed (5) hide show
  1. I18n/readme.txt +1 -1
  2. I18n/wp-paginate.pot +54 -54
  3. readme.txt +15 -10
  4. screenshot-2.png +0 -0
  5. wp-paginate.php +53 -37
I18n/readme.txt CHANGED
@@ -11,6 +11,6 @@ So for an Italian translation, the file name would be wp-paginate-it_IT.mo
11
 
12
  Please *do not* translate URL's or placeholders, such as %s.
13
 
14
- Please send the translated file to eric@ericmmartin.com.
15
 
16
  Thanks!
11
 
12
  Please *do not* translate URL's or placeholders, such as %s.
13
 
14
+ I can no longer maintain the translations, so please place the file on your site or somewhere online and send me an email (eric@ericmmartin.com) with the location of the file. You can also leave a comment on my release blog post with the same information.
15
 
16
  Thanks!
I18n/wp-paginate.pot CHANGED
@@ -1,169 +1,169 @@
1
- # POT file for WP-Paginate.
2
- # Copyright (C) 2009 Eric Martin
3
  # This file is distributed under the same license as the WP-Paginate package.
4
- # Eric Martin <eric@ericmmartin.com>, 2009.
5
  #
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: 1.1\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-paginate\n"
11
- "POT-Creation-Date: 2009-09-10 03:50+0000\n"
12
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "MIME-Version: 1.0\n"
16
- "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
- #: wp-paginate.php:253
20
  msgid "Settings"
21
  msgstr ""
22
 
23
- #: wp-paginate.php:278
24
  msgid "Success! Your changes were successfully saved!"
25
  msgstr ""
26
 
27
- #: wp-paginate.php:281
28
  msgid "Whoops! There was a problem with the data you posted. Please try again."
29
  msgstr ""
30
 
31
- #: wp-paginate.php:293
32
- msgid "Pagination Text:"
33
  msgstr ""
34
 
35
- #: wp-paginate.php:295
36
- msgid "The text to display before the list of pages."
37
  msgstr ""
38
 
39
- #: wp-paginate.php:298
40
- msgid "Previous Page Text:"
41
  msgstr ""
42
 
43
- #: wp-paginate.php:300
44
- msgid "The text to display for the previous page link."
45
  msgstr ""
46
 
47
- #: wp-paginate.php:303
48
- msgid "Next Page Text:"
49
  msgstr ""
50
 
51
- #: wp-paginate.php:305
52
- msgid "The text to display for the next page link."
53
  msgstr ""
54
 
55
- #: wp-paginate.php:309
56
  msgid "Advanced Settings"
57
  msgstr ""
58
 
59
- #: wp-paginate.php:312
60
  msgid "Before Markup:"
61
  msgstr ""
62
 
63
- #: wp-paginate.php:314
64
  msgid "The HTML markup to display before the pagination code."
65
  msgstr ""
66
 
67
- #: wp-paginate.php:317
68
  msgid "After Markup:"
69
  msgstr ""
70
 
71
- #: wp-paginate.php:319
72
  msgid "The HTML markup to display after the pagination code."
73
  msgstr ""
74
 
75
- #: wp-paginate.php:322
76
  msgid "Markup Display:"
77
  msgstr ""
78
 
79
- #: wp-paginate.php:324
80
- msgid "Always show Markup, even when the page list is empty?"
81
  msgstr ""
82
 
83
- #: wp-paginate.php:327
84
- msgid "CSS File:"
85
  msgstr ""
86
 
87
- #: wp-paginate.php:329
88
- msgid "Deselect this option to prevent loading wp-paginate.css."
89
  msgstr ""
90
 
91
- #: wp-paginate.php:332
92
  msgid "Page Range:"
93
  msgstr ""
94
 
95
- #: wp-paginate.php:339
96
  msgid ""
97
  "The number of page links to show before and after the current page. "
98
  "Recommended value: 3"
99
  msgstr ""
100
 
101
- #: wp-paginate.php:342
102
  msgid "Page Anchors:"
103
  msgstr ""
104
 
105
- #: wp-paginate.php:349
106
  msgid ""
107
  "The number of links to always show at beginning and end of pagination. "
108
  "Recommended value: 1"
109
  msgstr ""
110
 
111
- #: wp-paginate.php:352
112
  msgid "Page Gap:"
113
  msgstr ""
114
 
115
- #: wp-paginate.php:359
116
  msgid ""
117
- "The minimum number of pages in a gap before ellipses (...) are added. "
118
  "Recommended value: 3"
119
  msgstr ""
120
 
121
- #: wp-paginate.php:366
122
  msgid "Need Support?"
123
  msgstr ""
124
 
125
- #: wp-paginate.php:367
126
  #, php-format
127
  msgid ""
128
  "For questions, issues or feature requests, please post them in the %s and "
129
  "make sure to tag the post with wp-paginate."
130
  msgstr ""
131
 
132
- #: wp-paginate.php:368
133
  msgid "Like To Contribute?"
134
  msgstr ""
135
 
136
- #: wp-paginate.php:369
137
  msgid ""
138
  "If you would like to contribute, the following is a list of ways you can "
139
  "help:"
140
  msgstr ""
141
 
142
- #: wp-paginate.php:371
143
  msgid "Translate WP-Paginate into your language"
144
  msgstr ""
145
 
146
- #: wp-paginate.php:372
147
  msgid "Blog about or link to WP-Paginate so others can find out about it"
148
  msgstr ""
149
 
150
- #: wp-paginate.php:373
151
  msgid "Report issues, provide feedback, request features, etc."
152
  msgstr ""
153
 
154
- #: wp-paginate.php:374
155
  msgid "Rate WP-Paginate on the WordPress Plugins Page"
156
  msgstr ""
157
 
158
- #: wp-paginate.php:375
159
  msgid "Make a donation"
160
  msgstr ""
161
 
162
- #: wp-paginate.php:377
163
  msgid "Other Links"
164
  msgstr ""
165
 
166
- #. Description of an extension
167
  msgid ""
168
  "A simple and flexible pagination plugin for WordPress posts and comments."
169
  msgstr ""
1
+ # Translation of the WordPress plugin WP-Paginate 1.1.2 by Eric Martin.
2
+ # Copyright (C) 2010 Eric Martin
3
  # This file is distributed under the same license as the WP-Paginate package.
4
+ # Eric Martin <eric@ericmmartin.com>, 2010.
5
  #
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: WP-Paginate 1.1.2\n"
10
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-paginate\n"
11
+ "POT-Creation-Date: 2010-03-27 16:13+0000\n"
12
+ "PO-Revision-Date: 2010-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME \n"
14
+ "Language-Team: LANGUAGE \n"
15
  "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=utf-8\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
+ #: wp-paginate.php:269
20
  msgid "Settings"
21
  msgstr ""
22
 
23
+ #: wp-paginate.php:294
24
  msgid "Success! Your changes were successfully saved!"
25
  msgstr ""
26
 
27
+ #: wp-paginate.php:297
28
  msgid "Whoops! There was a problem with the data you posted. Please try again."
29
  msgstr ""
30
 
31
+ #: wp-paginate.php:309
32
+ msgid "Pagination Label:"
33
  msgstr ""
34
 
35
+ #: wp-paginate.php:311
36
+ msgid "The text/HTML to display before the list of pages."
37
  msgstr ""
38
 
39
+ #: wp-paginate.php:314
40
+ msgid "Previous Page:"
41
  msgstr ""
42
 
43
+ #: wp-paginate.php:316
44
+ msgid "The text/HTML to display for the previous page link."
45
  msgstr ""
46
 
47
+ #: wp-paginate.php:319
48
+ msgid "Next Page:"
49
  msgstr ""
50
 
51
+ #: wp-paginate.php:321
52
+ msgid "The text/HTML to display for the next page link."
53
  msgstr ""
54
 
55
+ #: wp-paginate.php:325
56
  msgid "Advanced Settings"
57
  msgstr ""
58
 
59
+ #: wp-paginate.php:328
60
  msgid "Before Markup:"
61
  msgstr ""
62
 
63
+ #: wp-paginate.php:330
64
  msgid "The HTML markup to display before the pagination code."
65
  msgstr ""
66
 
67
+ #: wp-paginate.php:333
68
  msgid "After Markup:"
69
  msgstr ""
70
 
71
+ #: wp-paginate.php:335
72
  msgid "The HTML markup to display after the pagination code."
73
  msgstr ""
74
 
75
+ #: wp-paginate.php:338
76
  msgid "Markup Display:"
77
  msgstr ""
78
 
79
+ #: wp-paginate.php:340
80
+ msgid "Show Before Markup and After Markup, even if the page list is empty?"
81
  msgstr ""
82
 
83
+ #: wp-paginate.php:343
84
+ msgid "WP-Paginate CSS File:"
85
  msgstr ""
86
 
87
+ #: wp-paginate.php:345
88
+ msgid "Include the default stylesheet wp-paginate.css?"
89
  msgstr ""
90
 
91
+ #: wp-paginate.php:348
92
  msgid "Page Range:"
93
  msgstr ""
94
 
95
+ #: wp-paginate.php:355
96
  msgid ""
97
  "The number of page links to show before and after the current page. "
98
  "Recommended value: 3"
99
  msgstr ""
100
 
101
+ #: wp-paginate.php:358
102
  msgid "Page Anchors:"
103
  msgstr ""
104
 
105
+ #: wp-paginate.php:365
106
  msgid ""
107
  "The number of links to always show at beginning and end of pagination. "
108
  "Recommended value: 1"
109
  msgstr ""
110
 
111
+ #: wp-paginate.php:368
112
  msgid "Page Gap:"
113
  msgstr ""
114
 
115
+ #: wp-paginate.php:375
116
  msgid ""
117
+ "The minimum number of pages in a gap before an ellipsis (...) is added. "
118
  "Recommended value: 3"
119
  msgstr ""
120
 
121
+ #: wp-paginate.php:382
122
  msgid "Need Support?"
123
  msgstr ""
124
 
125
+ #: wp-paginate.php:383
126
  #, php-format
127
  msgid ""
128
  "For questions, issues or feature requests, please post them in the %s and "
129
  "make sure to tag the post with wp-paginate."
130
  msgstr ""
131
 
132
+ #: wp-paginate.php:384
133
  msgid "Like To Contribute?"
134
  msgstr ""
135
 
136
+ #: wp-paginate.php:385
137
  msgid ""
138
  "If you would like to contribute, the following is a list of ways you can "
139
  "help:"
140
  msgstr ""
141
 
142
+ #: wp-paginate.php:387
143
  msgid "Translate WP-Paginate into your language"
144
  msgstr ""
145
 
146
+ #: wp-paginate.php:388
147
  msgid "Blog about or link to WP-Paginate so others can find out about it"
148
  msgstr ""
149
 
150
+ #: wp-paginate.php:389
151
  msgid "Report issues, provide feedback, request features, etc."
152
  msgstr ""
153
 
154
+ #: wp-paginate.php:390
155
  msgid "Rate WP-Paginate on the WordPress Plugins Page"
156
  msgstr ""
157
 
158
+ #: wp-paginate.php:391
159
  msgid "Make a donation"
160
  msgstr ""
161
 
162
+ #: wp-paginate.php:393
163
  msgid "Other Links"
164
  msgstr ""
165
 
166
+ #. Description of the plugin/theme
167
  msgid ""
168
  "A simple and flexible pagination plugin for WordPress posts and comments."
169
  msgstr ""
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: emartin24
3
  Donate link: http://www.ericmmartin.com/donate/
4
  Tags: paginate, pagination, navigation, page, wp-paginate, comments
5
  Requires at least: 2.2.0 (2.7.0 for comments pagination)
6
- Tested up to: 2.8.4
7
- Stable tag: 1.1.1
8
 
9
  WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site.
10
 
@@ -60,7 +60,7 @@ For comments pagination:
60
 
61
  *Upgrading*
62
 
63
- To 1.1.1:
64
 
65
  * Update WP-Paginate settings, change `Before Markup` to <div class="navigation">
66
  * Update `wp-paginate.css`, change `.wp-paginate ol` to `.wp-paginate`
@@ -71,15 +71,15 @@ To 1.1.1:
71
 
72
  The `wp_paginate()` and `wp_paginate_comments()` functions each takes one optional argument, in query string format, which allows you to override the global settings. The available options are:
73
 
74
- * title - The text to display before the pagination links
75
- * nextpage - The text to use for the next page link
76
- * previouspage - The text to use for the previous page link
77
- * before - The HTML or text to add before the pagination links
78
- * after - The HTML or text to add after the pagination links
79
- * empty - Display the markup code even when the page list is empty
80
  * range - The number of page links to show before and after the current page
81
  * anchor - The number of links to always show at beginning and end of pagination
82
- * gap - The minimum number of pages before a gap is replaced with ellipses (...)
83
 
84
  You can even control the current page and number of pages with:
85
 
@@ -107,6 +107,11 @@ This allows you to use the `.wp-paginate-comments` styles, already in `wp-pagina
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
110
  = 1.1.1 =
111
  * Changed output to include `wp-paginate` and `wp-paginate-comments` class names on the `ol` element
112
  * Changed the `before` option from `<div class="wp-paginate">` to `<div class="navigation">`
3
  Donate link: http://www.ericmmartin.com/donate/
4
  Tags: paginate, pagination, navigation, page, wp-paginate, comments
5
  Requires at least: 2.2.0 (2.7.0 for comments pagination)
6
+ Tested up to: 2.9.2
7
+ Stable tag: 1.1.2
8
 
9
  WP-Paginate is a simple and flexible pagination plugin which provides users with better navigation on your WordPress site.
10
 
60
 
61
  *Upgrading*
62
 
63
+ To 1.1.1+:
64
 
65
  * Update WP-Paginate settings, change `Before Markup` to <div class="navigation">
66
  * Update `wp-paginate.css`, change `.wp-paginate ol` to `.wp-paginate`
71
 
72
  The `wp_paginate()` and `wp_paginate_comments()` functions each takes one optional argument, in query string format, which allows you to override the global settings. The available options are:
73
 
74
+ * title - The text/HTML to display before the pagination links
75
+ * nextpage - The text/HTML to use for the next page link
76
+ * previouspage - The text/HTML to use for the previous page link
77
+ * before - The text/HTML to add before the pagination links
78
+ * after - The text/HTML to add after the pagination links
79
+ * empty - Display before markup and after markup code even when the page list is empty
80
  * range - The number of page links to show before and after the current page
81
  * anchor - The number of links to always show at beginning and end of pagination
82
+ * gap - The minimum number of pages before a gap is replaced with an ellipsis (...)
83
 
84
  You can even control the current page and number of pages with:
85
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.1.2 =
111
+ * Fixed comment pagination bug (nested comments caused blank page)
112
+ * Enabled HTML for Pagination Label, Previous Page, and Next Page
113
+ * Localization changes were made, Translations need to be updated
114
+
115
  = 1.1.1 =
116
  * Changed output to include `wp-paginate` and `wp-paginate-comments` class names on the `ol` element
117
  * Changed the `before` option from `<div class="wp-paginate">` to `<div class="navigation">`
screenshot-2.png CHANGED
Binary file
wp-paginate.php CHANGED
@@ -4,12 +4,12 @@ Plugin Name: WP-Paginate
4
  Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/
5
  Description: A simple and flexible pagination plugin for WordPress posts and comments.
6
  Author: Eric Martin
7
- Version: 1.1.1
8
  Author URI: http://www.ericmmartin.com
9
- Revision: $Id: wp-paginate.php 153537 2009-09-10 13:26:24Z emartin24 $
10
  */
11
 
12
- /* Copyright 2009 Eric Martin (eric@ericmmartin.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
@@ -40,7 +40,10 @@ if (!defined('WP_PLUGIN_DIR') )
40
 
41
  if (!class_exists('WPPaginate')) {
42
  class WPPaginate {
43
- var $version = '1.1.1';
 
 
 
44
 
45
  /**
46
  * @var string The options string name for this plugin
@@ -57,15 +60,15 @@ if (!class_exists('WPPaginate')) {
57
  */
58
  var $pluginurl = '';
59
  /**
60
- * @var string $pluginpath The path to this plugin
61
- */
62
  var $pluginpath = '';
63
 
64
  /**
65
  * @var array $options Stores the options for this plugin
66
  */
67
  var $options = array();
68
-
69
  var $type = 'posts';
70
 
71
  /**
@@ -91,7 +94,7 @@ if (!class_exists('WPPaginate')) {
91
 
92
  //Actions
93
  add_action('admin_menu', array(&$this, 'admin_menu_link'));
94
-
95
  if ($this->options['css'])
96
  add_action('wp_print_styles', array(&$this, 'wp_paginate_css'));
97
  }
@@ -108,16 +111,28 @@ if (!class_exists('WPPaginate')) {
108
 
109
  if (!isset($page) && !isset($pages)) {
110
  global $wp_query;
111
-
112
  if ($this->type === 'posts') {
113
  $page = get_query_var('paged');
114
  $posts_per_page = intval(get_query_var('posts_per_page'));
115
  $pages = intval(ceil($wp_query->found_posts / $posts_per_page));
116
  }
117
  else {
 
 
 
 
 
 
 
 
 
 
 
 
118
  $page = get_query_var('cpage');
119
- $posts_per_page = get_option('comments_per_page');
120
- $pages = intval(ceil($wp_query->comment_count / $posts_per_page));
121
  }
122
  $page = !empty($page) ? intval($page) : 1;
123
  }
@@ -128,23 +143,23 @@ if (!class_exists('WPPaginate')) {
128
  $nextlink = ($this->type === 'posts')
129
  ? get_pagenum_link($page + 1)
130
  : get_comments_pagenum_link($page + 1);
131
-
132
  $output = stripslashes($before);
133
  if ($pages > 1) {
134
  $output .= sprintf('<ol class="wp-paginate%s">', ($this->type === 'posts') ? '' : ' wp-paginate-comments');
135
- $output .= "<li><span class='title'>$title</span></li>";
136
  $ellipsis = "<li><span class='gap'>...</span></li>";
137
-
138
  if ($page > 1 && !empty($previouspage)) {
139
- $output .= "<li><a href='$prevlink' class='prev'>$previouspage</a></li>";
140
  }
141
-
142
  $min_links = $range * 2 + 1;
143
  $block_min = min($page - $range, $pages - $min_links);
144
  $block_high = max($page + $range, $min_links);
145
  $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
146
  $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;
147
-
148
  if ($left_gap && !$right_gap) {
149
  $output .= sprintf('%s%s%s',
150
  $this->paginate_loop(1, $anchor),
@@ -171,19 +186,19 @@ if (!class_exists('WPPaginate')) {
171
  else {
172
  $output .= $this->paginate_loop(1, $pages, $page);
173
  }
174
-
175
  if ($page < $pages && !empty($nextpage)) {
176
- $output .= "<li><a href='$nextlink' class='next'>$nextpage</a></li>";
177
  }
178
  $output .= "</ol>";
179
  }
180
  $output .= stripslashes($after);
181
-
182
  if ($pages > 1 || $empty) {
183
  echo $output;
184
  }
185
  }
186
-
187
  /**
188
  * Helper function for pagination which builds the page links.
189
  */
@@ -197,7 +212,7 @@ if (!class_exists('WPPaginate')) {
197
  }
198
  return $output;
199
  }
200
-
201
  function wp_paginate_css() {
202
  $css = "";
203
  $name = "wp-paginate.css";
@@ -273,9 +288,9 @@ if (!class_exists('WPPaginate')) {
273
  $this->options['range'] = intval($_POST['range']);
274
  $this->options['anchor'] = intval($_POST['anchor']);
275
  $this->options['gap'] = intval($_POST['gap']);
276
-
277
  $this->save_admin_options();
278
-
279
  echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', $this->localizationDomain) . '</p></div>';
280
  }
281
  else {
@@ -291,19 +306,19 @@ if (!class_exists('WPPaginate')) {
291
  <?php wp_nonce_field('wp-paginate-update-options'); ?>
292
  <table class="form-table">
293
  <tr valign="top">
294
- <th scope="row"><?php _e('Pagination Text:', $this->localizationDomain); ?></th>
295
- <td><input name="title" type="text" id="title" size="40" value="<?php echo htmlspecialchars($this->options['title']); ?>"/>
296
- <span class="description"><?php _e('The text to display before the list of pages.', $this->localizationDomain); ?></span></td>
297
  </tr>
298
  <tr valign="top">
299
- <th scope="row"><?php _e('Previous Page Text:', $this->localizationDomain); ?></th>
300
- <td><input name="previouspage" type="text" id="previouspage" size="40" value="<?php echo htmlspecialchars($this->options['previouspage']); ?>"/>
301
- <span class="description"><?php _e('The text to display for the previous page link.', $this->localizationDomain); ?></span></td>
302
  </tr>
303
  <tr valign="top">
304
- <th scope="row"><?php _e('Next Page Text:', $this->localizationDomain); ?></th>
305
- <td><input name="nextpage" type="text" id="nextpage" size="40" value="<?php echo htmlspecialchars($this->options['nextpage']); ?>"/>
306
- <span class="description"><?php _e('The text to display for the next page link.', $this->localizationDomain); ?></span></td>
307
  </tr>
308
  </table>
309
  <p>&nbsp;</p>
@@ -322,12 +337,12 @@ if (!class_exists('WPPaginate')) {
322
  <tr valign="top">
323
  <th scope="row"><?php _e('Markup Display:', $this->localizationDomain); ?></th>
324
  <td><label for="empty">
325
- <input type="checkbox" id="empty" name="empty" <?php echo ($this->options['empty'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Always show Markup, even when the page list is empty?', $this->localizationDomain); ?></label></td>
326
  </tr>
327
  <tr valign="top">
328
- <th scope="row"><?php _e('CSS File:', $this->localizationDomain); ?></th>
329
  <td><label for="css">
330
- <input type="checkbox" id="css" name="css" <?php echo ($this->options['css'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Deselect this option to prevent loading wp-paginate.css.', $this->localizationDomain); ?></label></td>
331
  </tr>
332
  <tr valign="top">
333
  <th scope="row"><?php _e('Page Range:', $this->localizationDomain); ?></th>
@@ -357,7 +372,7 @@ if (!class_exists('WPPaginate')) {
357
  <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['gap']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
358
  <?php endfor; ?>
359
  </select>
360
- <span class="description"><?php _e('The minimum number of pages in a gap before ellipses (...) are added. Recommended value: 3', $this->localizationDomain); ?></span></td>
361
  </tr>
362
  </table>
363
  <p class="submit">
@@ -380,6 +395,7 @@ if (!class_exists('WPPaginate')) {
380
  <li>&raquo; <a href="http://twitter.com/ericmmartin">@ericmmartin</a> on Twitter</li>
381
  <li>&raquo; <a href="http://www.ericmmartin.com">EricMMartin.com</a></li>
382
  <li>&raquo; <a href="http://www.ericmmartin.com/projects/smcf/">SimpleModal Contact Form (SMCF) - WordPress Plugin</a></li>
 
383
  </ul>
384
  </div>
385
 
4
  Plugin URI: http://www.ericmmartin.com/projects/wp-paginate/
5
  Description: A simple and flexible pagination plugin for WordPress posts and comments.
6
  Author: Eric Martin
7
+ Version: 1.1.2
8
  Author URI: http://www.ericmmartin.com
9
+ Revision: $Id: wp-paginate.php 222066 2010-03-27 15:07:41Z emartin24 $
10
  */
11
 
12
+ /* Copyright 2010 Eric Martin (eric@ericmmartin.com)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License as published by
40
 
41
  if (!class_exists('WPPaginate')) {
42
  class WPPaginate {
43
+ /**
44
+ * @var string The plugin version
45
+ */
46
+ var $version = '1.1.2';
47
 
48
  /**
49
  * @var string The options string name for this plugin
60
  */
61
  var $pluginurl = '';
62
  /**
63
+ * @var string $pluginpath The path to this plugin
64
+ */
65
  var $pluginpath = '';
66
 
67
  /**
68
  * @var array $options Stores the options for this plugin
69
  */
70
  var $options = array();
71
+
72
  var $type = 'posts';
73
 
74
  /**
94
 
95
  //Actions
96
  add_action('admin_menu', array(&$this, 'admin_menu_link'));
97
+
98
  if ($this->options['css'])
99
  add_action('wp_print_styles', array(&$this, 'wp_paginate_css'));
100
  }
111
 
112
  if (!isset($page) && !isset($pages)) {
113
  global $wp_query;
114
+
115
  if ($this->type === 'posts') {
116
  $page = get_query_var('paged');
117
  $posts_per_page = intval(get_query_var('posts_per_page'));
118
  $pages = intval(ceil($wp_query->found_posts / $posts_per_page));
119
  }
120
  else {
121
+ global $post, $wpdb;
122
+ /*
123
+ * Do not include nested comments
124
+ * Thanks to jeffreyalew for the patch
125
+ */
126
+ $comments = $wpdb->get_var("
127
+ SELECT COUNT(*)
128
+ FROM $wpdb->comments
129
+ WHERE comment_approved = '1'
130
+ AND comment_parent = '0'
131
+ AND comment_post_ID = $post->ID
132
+ ");
133
  $page = get_query_var('cpage');
134
+ $comments_per_page = get_option('comments_per_page');
135
+ $pages = intval(ceil($comments / $comments_per_page));
136
  }
137
  $page = !empty($page) ? intval($page) : 1;
138
  }
143
  $nextlink = ($this->type === 'posts')
144
  ? get_pagenum_link($page + 1)
145
  : get_comments_pagenum_link($page + 1);
146
+
147
  $output = stripslashes($before);
148
  if ($pages > 1) {
149
  $output .= sprintf('<ol class="wp-paginate%s">', ($this->type === 'posts') ? '' : ' wp-paginate-comments');
150
+ $output .= sprintf('<li><span class="title">%s</span></li>', stripslashes($title));
151
  $ellipsis = "<li><span class='gap'>...</span></li>";
152
+
153
  if ($page > 1 && !empty($previouspage)) {
154
+ $output .= sprintf('<li><a href="%s" class="prev">%s</a></li>', $prevlink, stripslashes($previouspage));
155
  }
156
+
157
  $min_links = $range * 2 + 1;
158
  $block_min = min($page - $range, $pages - $min_links);
159
  $block_high = max($page + $range, $min_links);
160
  $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false;
161
  $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false;
162
+
163
  if ($left_gap && !$right_gap) {
164
  $output .= sprintf('%s%s%s',
165
  $this->paginate_loop(1, $anchor),
186
  else {
187
  $output .= $this->paginate_loop(1, $pages, $page);
188
  }
189
+
190
  if ($page < $pages && !empty($nextpage)) {
191
+ $output .= sprintf('<li><a href="%s" class="next">%s</a></li>', $nextlink, stripslashes($nextpage));
192
  }
193
  $output .= "</ol>";
194
  }
195
  $output .= stripslashes($after);
196
+
197
  if ($pages > 1 || $empty) {
198
  echo $output;
199
  }
200
  }
201
+
202
  /**
203
  * Helper function for pagination which builds the page links.
204
  */
212
  }
213
  return $output;
214
  }
215
+
216
  function wp_paginate_css() {
217
  $css = "";
218
  $name = "wp-paginate.css";
288
  $this->options['range'] = intval($_POST['range']);
289
  $this->options['anchor'] = intval($_POST['anchor']);
290
  $this->options['gap'] = intval($_POST['gap']);
291
+
292
  $this->save_admin_options();
293
+
294
  echo '<div class="updated"><p>' . __('Success! Your changes were successfully saved!', $this->localizationDomain) . '</p></div>';
295
  }
296
  else {
306
  <?php wp_nonce_field('wp-paginate-update-options'); ?>
307
  <table class="form-table">
308
  <tr valign="top">
309
+ <th scope="row"><?php _e('Pagination Label:', $this->localizationDomain); ?></th>
310
+ <td><input name="title" type="text" id="title" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['title'])); ?>"/>
311
+ <span class="description"><?php _e('The text/HTML to display before the list of pages.', $this->localizationDomain); ?></span></td>
312
  </tr>
313
  <tr valign="top">
314
+ <th scope="row"><?php _e('Previous Page:', $this->localizationDomain); ?></th>
315
+ <td><input name="previouspage" type="text" id="previouspage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['previouspage'])); ?>"/>
316
+ <span class="description"><?php _e('The text/HTML to display for the previous page link.', $this->localizationDomain); ?></span></td>
317
  </tr>
318
  <tr valign="top">
319
+ <th scope="row"><?php _e('Next Page:', $this->localizationDomain); ?></th>
320
+ <td><input name="nextpage" type="text" id="nextpage" size="40" value="<?php echo stripslashes(htmlspecialchars($this->options['nextpage'])); ?>"/>
321
+ <span class="description"><?php _e('The text/HTML to display for the next page link.', $this->localizationDomain); ?></span></td>
322
  </tr>
323
  </table>
324
  <p>&nbsp;</p>
337
  <tr valign="top">
338
  <th scope="row"><?php _e('Markup Display:', $this->localizationDomain); ?></th>
339
  <td><label for="empty">
340
+ <input type="checkbox" id="empty" name="empty" <?php echo ($this->options['empty'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Show Before Markup and After Markup, even if the page list is empty?', $this->localizationDomain); ?></label></td>
341
  </tr>
342
  <tr valign="top">
343
+ <th scope="row"><?php _e('WP-Paginate CSS File:', $this->localizationDomain); ?></th>
344
  <td><label for="css">
345
+ <input type="checkbox" id="css" name="css" <?php echo ($this->options['css'] === true) ? "checked='checked'" : ""; ?>/> <?php _e('Include the default stylesheet wp-paginate.css?', $this->localizationDomain); ?></label></td>
346
  </tr>
347
  <tr valign="top">
348
  <th scope="row"><?php _e('Page Range:', $this->localizationDomain); ?></th>
372
  <option value="<?php echo $i; ?>" <?php echo ($i == $this->options['gap']) ? "selected='selected'" : ""; ?>><?php echo $i; ?></option>
373
  <?php endfor; ?>
374
  </select>
375
+ <span class="description"><?php _e('The minimum number of pages in a gap before an ellipsis (...) is added. Recommended value: 3', $this->localizationDomain); ?></span></td>
376
  </tr>
377
  </table>
378
  <p class="submit">
395
  <li>&raquo; <a href="http://twitter.com/ericmmartin">@ericmmartin</a> on Twitter</li>
396
  <li>&raquo; <a href="http://www.ericmmartin.com">EricMMartin.com</a></li>
397
  <li>&raquo; <a href="http://www.ericmmartin.com/projects/smcf/">SimpleModal Contact Form (SMCF) - WordPress Plugin</a></li>
398
+ <li>&raquo; <a href="http://www.ericmmartin.com/projects/simplemodal-login/">SimpleModal Login - WordPress Plugin</a></li>
399
  </ul>
400
  </div>
401