WP-PageNavi - Version 2.03

Version Description

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-PageNavi
Version 2.03
Comparing to
See all releases

Version 2.03

Files changed (2) hide show
  1. pagenavi.php +108 -0
  2. readme.html +300 -0
pagenavi.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-PageNavi
4
+ Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
+ Description: Adds a more advanced page navigation to Wordpress.
6
+ Version: 2.03
7
+ Author: GaMerZ
8
+ Author URI: http://www.lesterchan.net
9
+ */
10
+
11
+
12
+ /* Copyright 2006 Lester Chan (email : gamerz84@hotmail.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
16
+ the Free Software Foundation; either version 2 of the License, or
17
+ (at your option) any later version.
18
+
19
+ This program is distributed in the hope that it will be useful,
20
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
+ GNU General Public License for more details.
23
+
24
+ You should have received a copy of the GNU General Public License
25
+ along with this program; if not, write to the Free Software
26
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27
+ */
28
+
29
+
30
+ ### Function: Page Navigation: Normal Paging
31
+ function wp_pagenavi($before=' ', $after=' ', $prelabel='&laquo;', $nxtlabel='&raquo;') {
32
+ global $request, $posts_per_page, $wpdb, $paged;
33
+ $pages_to_show = 5;
34
+ $half_pages_to_show = round($pages_to_show/2);
35
+ if (!is_single()) {
36
+ if (get_query_var('what_to_show') == 'posts') {
37
+ preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
38
+ //preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
39
+ $fromwhere = $matches[1];
40
+ $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
41
+ $max_page = ceil($numposts /$posts_per_page);
42
+ } else {
43
+ $max_page = 999999;
44
+ }
45
+ if(empty($paged)) {
46
+ $paged = 1;
47
+ }
48
+ if($max_page > 1) {
49
+ echo "$before Pages ($max_page): <b>";
50
+ if ($paged >= ($pages_to_show-1)) {
51
+ echo '<a href="'.get_pagenum_link().'">&laquo; First</a> ... ';
52
+ }
53
+ previous_posts_link($prelabel);
54
+ for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
55
+ if ($i >= 1 && $i <= $max_page) {
56
+ if($i == $paged) {
57
+ echo "[$i]";
58
+ } else {
59
+ echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
60
+ }
61
+ }
62
+ }
63
+ next_posts_link($nxtlabel, $max_page);
64
+ if (($paged+$half_pages_to_show) < ($max_page)) {
65
+ echo ' ... <a href="'.get_pagenum_link($max_page).'">Last &raquo;</a>';
66
+ }
67
+ echo "$after</b>";
68
+ }
69
+ }
70
+ }
71
+
72
+
73
+ ### Function: Page Navigation: Drop Down Menu
74
+ function wp_pagenavi_dropdown() {
75
+ global $request, $posts_per_page, $wpdb, $paged;
76
+ if (!is_single()) {
77
+ if (get_query_var('what_to_show') == 'posts') {
78
+ preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
79
+ //preg_match('#FROM\s(.*)\sORDER BY#siU', $request, $matches);
80
+ $fromwhere = $matches[1];
81
+ $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
82
+ $max_page = ceil($numposts /$posts_per_page);
83
+ } else {
84
+ $max_page = 999999;
85
+ }
86
+ if(empty($paged)) {
87
+ $paged = 1;
88
+ }
89
+ if($max_page > 1) {
90
+ echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF']).'" method="get">'."\n";
91
+ echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n";
92
+ for($i = 1; $i <= $max_page; $i++) {
93
+ $page_num = $i;
94
+ if($page_num == 1) {
95
+ $page_num = 0;
96
+ }
97
+ if($i == $paged) {
98
+ echo "<option value=\"".get_pagenum_link($page_num)."\" selected=\"selected\">Page: $i</option>\n";
99
+ } else {
100
+ echo "<option value=\"".get_pagenum_link($page_num)."\">Page: $i</option>\n";
101
+ }
102
+ }
103
+ echo "</select>\n";
104
+ echo "</form>\n";
105
+ }
106
+ }
107
+ }
108
+ ?>
readme.html ADDED
@@ -0,0 +1,300 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
+ <title>WP-PageNavi 2.03 Readme</title>
6
+ <style type="text/css" media="screen">
7
+ /* Default Style */
8
+ BODY {
9
+ font-family: Verdana, Arial;
10
+ font-size: 12px;
11
+ color: #000000;
12
+ background: #FFFFFF;
13
+ }
14
+ P {
15
+ padding-left: 10px;
16
+ }
17
+ BLOCKQUOTE {
18
+ margin: 10px 20px 0px 20px;
19
+ padding: 10px;
20
+ border: 1px solid #8d8d8d;
21
+ background-color: #f5f5f5;
22
+ }
23
+ LI {
24
+ margin-top: 20px;
25
+ }
26
+ UL LI UL LI {
27
+ margin-top: 10px;
28
+ }
29
+ A, A:active, A:link, A:visited {
30
+ color: #2d3a4c;
31
+ text-decoration: none;
32
+ }
33
+ A:hover {
34
+ color: #5577a5;
35
+ text-decoration: underline;
36
+ }
37
+ /* Place Holder Style */
38
+ #Container {
39
+ width: 780px;
40
+ margin-left: auto;
41
+ margin-right: auto;
42
+ }
43
+ #Content {
44
+ background-color: #fafafa;
45
+ border: 1px solid #a2b6cb;
46
+ padding: 10px;
47
+ margin-top: -13px;
48
+ }
49
+ /* Title Style */
50
+ #Title {
51
+ font-family: Verdana, Arial;
52
+ font-size: 22px;
53
+ font-weight: bold;
54
+ color: #389aff;
55
+ border-bottom: 1px solid #389aff;
56
+ margin-bottom: 10px;
57
+ }
58
+ .SubTitle {
59
+ font-family: Verdana, Arial;
60
+ font-size: 18px;
61
+ font-weight: bold;
62
+ color: #5b87b4;
63
+ }
64
+ .SubSubTitle {
65
+ font-family: Verdana, Arial;
66
+ font-size: 14px;
67
+ font-weight: bold;
68
+ color: #73a4d6;
69
+ }
70
+ /* Tabs */
71
+ UL#Tabs {
72
+ font-family: Verdana, Arial;
73
+ font-size: 12px;
74
+ font-weight: bold;
75
+ list-style-type: none;
76
+ padding-bottom: 28px;
77
+ border-bottom: 1px solid #a2b6cb;
78
+ margin-bottom: 12px;
79
+ z-index: 1;
80
+ }
81
+ #Tabs LI.Tab {
82
+ float: right;
83
+ height: 25px;
84
+ background-color: #deedfb;
85
+ margin: 2px 0px 0px 5px;
86
+ border: 1px solid #a2b6cb;
87
+ }
88
+ #Tabs LI.Tab A {
89
+ float: left;
90
+ display: block;
91
+ color: #666666;
92
+ text-decoration: none;
93
+ padding: 5px;
94
+ }
95
+ #Tabs LI.Tab A:hover {
96
+ background-color: #bfe0fe;
97
+ border-bottom: 1px solid #bfe0fe;
98
+ }
99
+ /* Selected Tab */
100
+ #Tabs LI.SelectedTab {
101
+ float: right;
102
+ height: 25px;
103
+ background-color: #fafafa;
104
+ margin: 2px 0px 0px 5px;
105
+ border-top: 1px solid #a2b6cb;
106
+ border-right: 1px solid #a2b6cb;
107
+ border-bottom: 1px solid #fafafa;
108
+ border-left: 1px solid #a2b6cb;
109
+ }
110
+ #Tabs LI.SelectedTab A {
111
+ float: left;
112
+ display: block;
113
+ color: #666666;
114
+ text-decoration: none;
115
+ padding: 5px;
116
+ cursor: default;
117
+ }
118
+ /* Copyright */
119
+ #Copyright {
120
+ text-align: center;
121
+ }
122
+ </style>
123
+ <script type="text/javascript">
124
+ // Index Page
125
+ function index() {
126
+ // Tab
127
+ document.getElementById('IndexTab').className = 'SelectedTab';
128
+ document.getElementById('InstallTab').className = 'Tab';
129
+ document.getElementById('UpgradeTab').className = 'Tab';
130
+ document.getElementById('UsageTab').className = 'Tab';
131
+ // Page
132
+ document.getElementById('Index').style.display= 'block';
133
+ document.getElementById('IndexTab').className = 'SelectedTab';
134
+ document.getElementById('Install').style.display = 'none';
135
+ document.getElementById('Upgrade').style.display = 'none';
136
+ document.getElementById('Usage').style.display = 'none';
137
+ }
138
+ // Installation Page
139
+ function install() {
140
+ // Tab
141
+ document.getElementById('IndexTab').className = 'Tab';
142
+ document.getElementById('InstallTab').className = 'SelectedTab';
143
+ document.getElementById('UpgradeTab').className = 'Tab';
144
+ document.getElementById('UsageTab').className = 'Tab';
145
+ // Page
146
+ document.getElementById('Index').style.display= 'none';
147
+ document.getElementById('Install').style.display = 'block';
148
+ document.getElementById('Upgrade').style.display = 'none';
149
+ document.getElementById('Usage').style.display = 'none';
150
+ }
151
+ // Upgrade Page
152
+ function upgrade() {
153
+ // Tab
154
+ document.getElementById('IndexTab').className = 'Tab';
155
+ document.getElementById('InstallTab').className = 'Tab';
156
+ document.getElementById('UpgradeTab').className = 'SelectedTab';
157
+ document.getElementById('UpgradeTab').href = 'Tab';
158
+ document.getElementById('UsageTab').className = 'Tab';
159
+ // Page
160
+ document.getElementById('Index').style.display= 'none';
161
+ document.getElementById('Install').style.display = 'none';
162
+ document.getElementById('Upgrade').style.display = 'block';
163
+ document.getElementById('Usage').style.display = 'none';
164
+ }
165
+ // Usage Page
166
+ function usage() {
167
+ // Tab
168
+ document.getElementById('IndexTab').className = 'Tab';
169
+ document.getElementById('InstallTab').className = 'Tab';
170
+ document.getElementById('UpgradeTab').className = 'Tab';
171
+ document.getElementById('UsageTab').className = 'SelectedTab';
172
+ // Page
173
+ document.getElementById('Index').style.display= 'none';
174
+ document.getElementById('Install').style.display = 'none';
175
+ document.getElementById('Upgrade').style.display = 'none';
176
+ document.getElementById('Usage').style.display = 'block';
177
+ }
178
+ </script>
179
+ </head>
180
+ <body>
181
+ <div id="Container">
182
+ <!-- Title -->
183
+ <div id="Title">WP-PageNavi 2.03&nbsp;&nbsp;&nbsp;<span style="color: #aaaaaa;">Readme</span></div>
184
+
185
+ <!-- Tabs -->
186
+ <ul id="Tabs">
187
+ <li id="UsageTab" class="Tab"><a href="#Usage" onclick="usage(); return false;" title="Usage Instructions">Usage</a></li>
188
+ <li id="UpgradeTab" class="Tab"><a href="#Upgrade" onclick="upgrade(); return false;" title="Upgrade Instructions">Upgrade</a></li>
189
+ <li id="InstallTab" class="Tab"><a href="#Installation" onclick="install(); return false;" title="Installation Instructions">Installation</a></li>
190
+ <li id="IndexTab" class="SelectedTab"><a href="#Index" onclick="index(); return false;" title="Index Instructions">Index</a></li>
191
+ </ul>
192
+
193
+ <!-- Content -->
194
+ <div id="Content">
195
+ <!-- Index -->
196
+ <div id="Index">
197
+ <div class="SubTitle">&raquo; Index</div>
198
+ <div class="SubSubTitle">Plugin Information</div>
199
+ <p><b>Author</b><br /><b>&raquo;</b> Lester 'GaMerZ' Chan</p>
200
+ <p>
201
+ <b>EMail:</b><br /><b>&raquo;</b>
202
+ <script type="text/javascript">
203
+ /* <![CDATA[*/
204
+ document.write(' <a href="mailto:gamerz84@hotmail.com?Subject=WP-PageNavi%202.03%20Support" title="EMail To gamerz84@hotmail.com">gamerz84@hotmail.com</a>');
205
+ /* ]]> */
206
+ </script>
207
+ </p>
208
+ <p><b>Website:</b><br /><b>&raquo;</b> <a href="http://www.lesterchan.net/" title="http://www.lesterchan.net/">http://www.lesterchan.net/</a></p>
209
+ <p><b>Demo:</b><br /><b>&raquo;</b> <a href="http://www.lesterchan.net/blogs" title="http://www.lesterchan.net/blogs">http://www.lesterchan.net/blogs</a></p>
210
+ <p><b>Documentation:</b><br /><b>&raquo;</b> <a href="http://dev.wp-plugins.org/wiki/wp-pagenavi" title="http://dev.wp-plugins.org/wiki/wp-pagenavi">http://dev.wp-plugins.org/wiki/wp-pagenavi</a></p>
211
+ <p><b>Development:</b><br /><b>&raquo;</b> <a href="http://dev.wp-plugins.org/browser/wp-pagenavi/" title="http://dev.wp-plugins.org/browser/wp-pagenavi/">http://dev.wp-plugins.org/browser/wp-pagenavi/</a></p>
212
+ <p><b>Support Forums:</b><br /><b>&raquo;</b> <a href="http://forums.lesterchan.net/viewforum.php?f=9" title="http://forums.lesterchan.net/viewforum.php?f=9">http://forums.lesterchan.net/viewforum.php?f=9</a></p>
213
+ <p><b>Updated:</b><br /><b>&raquo;</b> 1st October 2006</p>
214
+ <div class="SubSubTitle">Changelog</div>
215
+ <ul>
216
+ <li>
217
+ <b>Version 2.03 (01-10-2006)</b>
218
+ <ul>
219
+ <li>FIXED: Now Compatible With WordPress 2.1</li>
220
+ </ul>
221
+ </li>
222
+ <li>
223
+ <b>Version 2.02 (01-06-2006)</b>
224
+ <ul>
225
+ <li>NEW: Added Drop Down Menu Style Of Page Navigation</li>
226
+ </ul>
227
+ </li>
228
+ <li>
229
+ <b>Version 2.01 (01-03-2006)</b>
230
+ <ul>
231
+ <li>FIXED: Paging Show If There Is Only 1 Page</li>
232
+ </ul>
233
+ </li>
234
+ <li>
235
+ <b>Version 2.00 (01-01-2006)</b>
236
+ <ul>
237
+ <li>NEW: Compatible With WordPress 2.0</li>
238
+ <li>FIXED: Space Issues</li>
239
+ </ul>
240
+ </li>
241
+ </ul>
242
+ </div>
243
+
244
+ <!-- Installation Instructions -->
245
+ <div id="Install" style="display: none;">
246
+ <div class="SubTitle">&raquo; Installation Instructions</div>
247
+ <ol>
248
+ <li>
249
+ Open <b>wp-content/plugins</b> Folder
250
+ </li>
251
+ <li>
252
+ Put:
253
+ <blockquote>File: pagenavi.php</blockquote>
254
+ </li>
255
+ <li>
256
+ <b>Activate</b> WP-PageNavi Plugin
257
+ </li>
258
+ <li>
259
+ Refer To <b>Usage</b> For Further Instructions
260
+ </li>
261
+ </ol>
262
+ </div>
263
+
264
+ <!-- Upgrade Instructions -->
265
+ <div id="Upgrade" style="display: none;">
266
+ <div class="SubTitle">&raquo; Upgrade Instructions</div>
267
+ <div class="SubSubTitle">From v1.0x To v2.03</div>
268
+ <ol>
269
+ <li>
270
+ Open <b>wp-content/plugins</b> Folder
271
+ </li>
272
+ <li>
273
+ Overwrite:
274
+ <blockquote>File: pagenavi.php</blockquote>
275
+ </li>
276
+ </ol>
277
+ </div>
278
+
279
+ <!-- Usage Instructions -->
280
+ <div id="Usage" style="display: none;">
281
+ <div class="SubTitle">&raquo; Usage Instructions</div>
282
+ <div class="SubSubTitle">General Usage</div>
283
+ <ol>
284
+ <li>
285
+ Open <b>wp-content/themes/&lt;YOUR THEME NAME&gt;/footer.php</b>
286
+ </li>
287
+ <li>
288
+ Add Anywhere:
289
+ <blockquote>
290
+ &lt;?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?&gt;
291
+ </blockquote>
292
+ <p>If you want a drop down menu style of page navigation, just replace <b>wp_pagenavi()</b> with <b>wp_pagenavi_dropdown()</b>.</p>
293
+ </li>
294
+ </ol>
295
+ </div>
296
+ </div>
297
+ </div>
298
+ <p id="Copyright">WP-PageNavi 2.03<br />Copyright &copy; 2006 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
299
+ </body>
300
+ </html>