WP-PageNavi - Version 2.02

Version Description

Download this release

Release Info

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

Version 2.02

Files changed (2) hide show
  1. pagenavi.php +100 -0
  2. readme.html +294 -0
pagenavi.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.02
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
+ $fromwhere = $matches[1];
39
+ $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
40
+ $max_page = ceil($numposts /$posts_per_page);
41
+ } else {
42
+ $max_page = 999999;
43
+ }
44
+ if(empty($paged)) {
45
+ $paged = 1;
46
+ }
47
+ if($max_page > 1) {
48
+ echo "$before Pages ($max_page): <b>";
49
+ if ($paged >= ($pages_to_show-1)) {
50
+ echo '<a href="'.get_pagenum_link().'">&laquo; First</a> ... ';
51
+ }
52
+ previous_posts_link($prelabel);
53
+ for($i = $paged - $half_pages_to_show; $i <= $paged + $half_pages_to_show; $i++) {
54
+ if ($i >= 1 && $i <= $max_page) {
55
+ if($i == $paged) {
56
+ echo "[$i]";
57
+ } else {
58
+ echo ' <a href="'.get_pagenum_link($i).'">'.$i.'</a> ';
59
+ }
60
+ }
61
+ }
62
+ next_posts_link($nxtlabel, $max_page);
63
+ if (($paged+$half_pages_to_show) < ($max_page)) {
64
+ echo ' ... <a href="'.get_pagenum_link($max_page).'">Last &raquo;</a>';
65
+ }
66
+ echo "$after</b>";
67
+ }
68
+ }
69
+ }
70
+
71
+
72
+ ### Function: Page Navigation: Drop Down Menu
73
+ function wp_pagenavi_dropdown() {
74
+ global $request, $posts_per_page, $wpdb, $paged;
75
+ if (!is_single()) {
76
+ if (get_query_var('what_to_show') == 'posts') {
77
+ preg_match('#FROM\s(.*)\sGROUP BY#siU', $request, $matches);
78
+ $fromwhere = $matches[1];
79
+ $numposts = $wpdb->get_var("SELECT COUNT(DISTINCT ID) FROM $fromwhere");
80
+ $max_page = ceil($numposts /$posts_per_page);
81
+ } else {
82
+ $max_page = 999999;
83
+ }
84
+ if(empty($paged)) {
85
+ $paged = 1;
86
+ }
87
+ echo '<form action="'.htmlspecialchars($_SERVER['PHP_SELF']).'" method="get">'."\n";
88
+ echo '<select size="1" onchange="document.location.href = this.options[this.selectedIndex].value;">'."\n";
89
+ for($i = 1; $i <= $max_page; $i++) {
90
+ if($i == $paged) {
91
+ echo "<option value=\"".get_pagenum_link($i)."\" selected=\"selected\">Page: $i</option>\n";
92
+ } else {
93
+ echo "<option value=\"".get_pagenum_link($i)."\">Page: $i</option>\n";
94
+ }
95
+ }
96
+ echo "</select>\n";
97
+ echo "</form>\n";
98
+ }
99
+ }
100
+ ?>
readme.html ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.02 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.02&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.02%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 June 2006</p>
214
+ <div class="SubSubTitle">Changelog</div>
215
+ <ul>
216
+ <li>
217
+ <b>Version 2.02 (01-06-2006)</b>
218
+ <ul>
219
+ <li>NEW: Added Drop Down Menu Style Of Page Navigation</li>
220
+ </ul>
221
+ </li>
222
+ <li>
223
+ <b>Version 2.01 (01-03-2006)</b>
224
+ <ul>
225
+ <li>FIXED: Paging Show If There Is Only 1 Page</li>
226
+ </ul>
227
+ </li>
228
+ <li>
229
+ <b>Version 2.00 (01-01-2006)</b>
230
+ <ul>
231
+ <li>NEW: Compatible With WordPress 2.0</li>
232
+ <li>FIXED: Space Issues</li>
233
+ </ul>
234
+ </li>
235
+ </ul>
236
+ </div>
237
+
238
+ <!-- Installation Instructions -->
239
+ <div id="Install" style="display: none;">
240
+ <div class="SubTitle">&raquo; Installation Instructions</div>
241
+ <ol>
242
+ <li>
243
+ Open <b>wp-content/plugins</b> Folder
244
+ </li>
245
+ <li>
246
+ Put:
247
+ <blockquote>File: pagenavi.php</blockquote>
248
+ </li>
249
+ <li>
250
+ <b>Activate</b> WP-PageNavi Plugin
251
+ </li>
252
+ <li>
253
+ Refer To <b>Usage</b> For Further Instructions
254
+ </li>
255
+ </ol>
256
+ </div>
257
+
258
+ <!-- Upgrade Instructions -->
259
+ <div id="Upgrade" style="display: none;">
260
+ <div class="SubTitle">&raquo; Upgrade Instructions</div>
261
+ <div class="SubSubTitle">From v1.0x To v2.02</div>
262
+ <ol>
263
+ <li>
264
+ Open <b>wp-content/plugins</b> Folder
265
+ </li>
266
+ <li>
267
+ Overwrite:
268
+ <blockquote>File: pagenavi.php</blockquote>
269
+ </li>
270
+ </ol>
271
+ </div>
272
+
273
+ <!-- Usage Instructions -->
274
+ <div id="Usage" style="display: none;">
275
+ <div class="SubTitle">&raquo; Usage Instructions</div>
276
+ <div class="SubSubTitle">General Usage</div>
277
+ <ol>
278
+ <li>
279
+ Open <b>wp-content/themes/&lt;YOUR THEME NAME&gt;/footer.php</b>
280
+ </li>
281
+ <li>
282
+ Add Anywhere:
283
+ <blockquote>
284
+ &lt;?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?&gt;
285
+ </blockquote>
286
+ <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>
287
+ </li>
288
+ </ol>
289
+ </div>
290
+ </div>
291
+ </div>
292
+ <p id="Copyright">WP-PageNavi 2.02<br />Copyright &copy; 2006 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
293
+ </body>
294
+ </html>