WP Page Numbers - Version 0.2

Version Description

Download this release

Release Info

Developer Jenst
Plugin Icon wp plugin WP Page Numbers
Version 0.2
Comparing to
See all releases

Version 0.2

classic/Thumbs.db ADDED
Binary file
classic/preview.gif ADDED
Binary file
classic/wp-page-numbers.css ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wp_page_numbers ul, #wp_page_numbers li, #wp_page_numbers a {
2
+ background: white;
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ text-decoration: none;
7
+ font-weight: normal;
8
+ font-style: normal;
9
+ list-style: none;
10
+ text-transform: none;
11
+ text-indent: 0px;
12
+ font-variant: normal;
13
+ text-align: left;
14
+ line-height: 12px;
15
+ letter-spacing: 0px;
16
+ word-spacing: 0px;
17
+ font-size: 11px;
18
+ font-family: Arial;
19
+ }
20
+
21
+ #wp_page_numbers {
22
+ margin-top: 10px;
23
+ width: 100%;
24
+ background: white;
25
+ }
26
+ #wp_page_numbers ul {
27
+ width: 100%;
28
+ }
29
+ #wp_page_numbers li {
30
+ float: left;
31
+ display: block;
32
+ margin-bottom: 2px;
33
+ }
34
+
35
+ #wp_page_numbers a {
36
+ padding: 3px;
37
+ padding-left: 5px;
38
+ padding-right: 5px;
39
+ margin-left: 2px;
40
+ margin-right: 2px;
41
+ display: block;
42
+ color: #333;
43
+ border: 1px solid #bfbfbf;
44
+ }
45
+
46
+ #wp_page_numbers li a:hover {
47
+ border-color: #ff8000;
48
+ }
49
+
50
+ #wp_page_numbers li.space {
51
+ padding: 6px;
52
+ padding-left: 2px;
53
+ padding-right: 2px;
54
+ }
55
+
56
+ #wp_page_numbers li.first_last_page {
57
+ font-style: italic;
58
+ }
59
+
60
+ #wp_page_numbers li.active_page a {
61
+ border-color: #46daff;
62
+ }
63
+ #wp_page_numbers li.active_page a:hover {
64
+ color: black; /* IE fix */
65
+ text-decoration: underline;
66
+ border-color: #ff8000;
67
+ }
68
+
69
+ #wp_page_numbers li.page_info {
70
+ float: left;
71
+ display: block;
72
+ padding: 3px;
73
+ padding-left: 5px;
74
+ padding-right: 5px;
75
+ margin-right: 2px;
76
+ color: #666;
77
+ font-size: 11px;
78
+ border: 1px solid #bfbfbf;
79
+ }
default/Thumbs.db ADDED
Binary file
default/preview.gif ADDED
Binary file
default/wp-page-numbers.css ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wp_page_numbers ul, #wp_page_numbers li, #wp_page_numbers a {
2
+ background: #fff;
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ text-decoration: none;
7
+ font-weight: normal;
8
+ font-style: normal;
9
+ list-style: none;
10
+ text-transform: none;
11
+ text-indent: 0px;
12
+ font-variant: normal;
13
+ text-align: left;
14
+ line-height: 12px;
15
+ letter-spacing: 0px;
16
+ word-spacing: 0px;
17
+ }
18
+
19
+ #wp_page_numbers {
20
+ margin-top: 10px;
21
+ width: 100%;
22
+ background: #fff;
23
+ }
24
+ #wp_page_numbers ul {
25
+ border-top: 1px solid #ccc;
26
+ width: 100%;
27
+ }
28
+ #wp_page_numbers li {
29
+ float: left;
30
+ display: block;
31
+ }
32
+
33
+ #wp_page_numbers a {
34
+ padding: 3px;
35
+ padding-left: 5px;
36
+ padding-right: 5px;
37
+ display: block;
38
+ color: #aaa;
39
+ font-family: Arial;
40
+ font-size: 12px;
41
+ border-top: 2px solid #fff;
42
+ border-bottom: 2px solid #fff;
43
+ }
44
+
45
+ #wp_page_numbers li a:hover {
46
+ color: #ff00a4;
47
+ border-top: 2px solid #ff00a4;
48
+ border-bottom: 2px solid #f1f1f1;
49
+ }
50
+
51
+ #wp_page_numbers li.space {
52
+ font-size: 12px;
53
+ font-family: Arial;
54
+ color: #aaa;
55
+ padding: 3px;
56
+ padding-left: 5px;
57
+ padding-right: 5px;
58
+ border-top: 2px solid #fff;
59
+ border-bottom: 2px solid #fff;
60
+ }
61
+
62
+ #wp_page_numbers li.first_last_page {
63
+ font-style: italic;
64
+ }
65
+
66
+ #wp_page_numbers li.active_page a {
67
+ color: #fff;
68
+ background: #45b9f6;
69
+ border-top: 2px solid #45b9f6;
70
+ border-bottom: 2px solid #45b9f6;
71
+
72
+ }
73
+ #wp_page_numbers li.active_page a:hover {
74
+ color: #fff; /* IE fix */
75
+ border-top: 2px solid #00679d;
76
+ border-bottom: 2px solid #45b9f6;
77
+ }
78
+
79
+ #wp_page_numbers li.page_info {
80
+ float: left;
81
+ font-size: 12px;
82
+ font-family: Arial;
83
+ color: #aaa;
84
+ display: block;
85
+ padding: 3px;
86
+ padding-right: 5px;
87
+ border-top: 2px solid #fff;
88
+ border-bottom: 2px solid #fff;
89
+ }
panther/Thumbs.db ADDED
Binary file
panther/preview.gif ADDED
Binary file
panther/wp-page-numbers.css ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wp_page_numbers ul, #wp_page_numbers li, #wp_page_numbers a {
2
+ background: #4f4f4f;
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ text-decoration: none;
7
+ font-weight: normal;
8
+ font-style: normal;
9
+ list-style: none;
10
+ text-transform: none;
11
+ text-indent: 0px;
12
+ font-variant: normal;
13
+ text-align: left;
14
+ line-height: 12px;
15
+ letter-spacing: 0px;
16
+ word-spacing: 0px;
17
+ font-size: 12px;
18
+ font-family: Arial;
19
+ color: white;
20
+ }
21
+
22
+ #wp_page_numbers {
23
+ margin-top: 10px;
24
+ width: 100%;
25
+ background: #4f4f4f;
26
+ border-top: 2px solid black;
27
+ }
28
+ #wp_page_numbers ul {
29
+
30
+ width: 100%;
31
+ }
32
+ #wp_page_numbers li {
33
+ float: left;
34
+ display: block;
35
+ }
36
+
37
+ #wp_page_numbers a {
38
+ padding: 6px;
39
+ padding-left: 4px;
40
+ padding-right: 4px;
41
+ display: block;
42
+ color: #ddd;
43
+ }
44
+
45
+ #wp_page_numbers li a:hover {
46
+ text-decoration: underline;
47
+ }
48
+
49
+ #wp_page_numbers li.space {
50
+ padding: 6px;
51
+ padding-left: 8px;
52
+ padding-right: 8px;
53
+ }
54
+
55
+ #wp_page_numbers li.first_last_page {
56
+ font-style: italic;
57
+ }
58
+
59
+ #wp_page_numbers li.active_page a {
60
+ background: black;
61
+ padding: 6px;
62
+ padding-left: 8px;
63
+ padding-right: 8px;
64
+ color: white;
65
+ }
66
+ #wp_page_numbers li.active_page a:hover {
67
+ color: #fff; /* IE fix */
68
+ }
69
+
70
+ #wp_page_numbers li.page_info {
71
+ float: left;
72
+ display: block;
73
+ padding: 6px;
74
+ padding-right: 8px;
75
+ color: #ddd;
76
+ font-size: 11px;
77
+ }
readme.txt ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP Page Numbers ===
2
+ Tags: navigation, paging, page, numbers, archive, categories, plugin, seo
3
+ Requires at least: 2.3
4
+ Tested up to: 2.8
5
+ Stable tag: 0.3
6
+
7
+ A simple paging navigation plugin for users and search engines. Instead of next and previous page it shows numbers and arrows. Settings available.
8
+
9
+ == Description ==
10
+
11
+ = User friendly navigation =
12
+ With page numbers instead of next and previous links users can easily navigate much quicker to the page they want. It is good for SEO (Search Engine Optimization) as well, because it creates a tighter inner link structure. Works with all well known browsers (Internet Explorer, Firefox, Opera and Safari).
13
+
14
+ = Updates 0.3 =
15
+ * Changed get_settings (deprecated) to get_bloginfo (bugfix)
16
+ * Added missing echos, which should fix the URLs to the preview images in admin
17
+
18
+ = Updates 0.2 =
19
+ * 5 page numbers themes - See <a href="http://wordpress.org/extend/plugins/wp-page-numbers/screenshots/">screenshots</a> for a preview!
20
+ * Put some "reset"-code in the themes to make it look the same on all themes
21
+
22
+ = Settings / Options =
23
+
24
+ * Custom texts and arrows
25
+ * Maximum number of pages to show at the same time
26
+ * Custom stylesheet folder (else default is used)
27
+ * Turn stylesheet off
28
+ * Turn off page information (page 3 of 5)
29
+ * Turn off next and previous page
30
+ * Turn off the first and end page numbers
31
+ * Turn off the numbers
32
+
33
+ <a href="http://www.jenst.se/category/blogg">Live demo (at the bottom)!</a>
34
+
35
+ == Installation ==
36
+
37
+ 1. Upload the FOLDER 'wp-page-numbers' to the /wp-content/plugins/
38
+ 2. Activate the plugin 'WP Page Numbers' through the 'Plugins' menu in admin
39
+ 3. Go to 'Options' or 'Settings' and then 'WP Page Numbers' to change the options
40
+
41
+ = Usage =
42
+
43
+ Replace the the 'next_posts_link()' and 'previous_posts_link()' with the code below in your theme (archive.php, index.php or search.php).<br />
44
+
45
+ <code><?php if(function_exists('wp_page_numbers')) { wp_page_numbers(); } ?></code>
46
+
47
+ == Frequently Asked Questions ==
48
+
49
+ = How do I report a bug? =
50
+
51
+ Contact me <a href="http://www.jenst.se/2008/03/29/wp-page-numbers">here</a>. Describe the problem as good as you can, your plugin version, Wordpress version and possible conflicting plugins and so on.
52
+
53
+ = How can I support this plugin? =
54
+
55
+ Spread the word, report bugs and give med feedback.
56
+
57
+ == Screenshots ==
58
+
59
+ 1. This is what the page numbers looks like in default mode.
screenshot-1.gif ADDED
Binary file
stylish/Thumbs.db ADDED
Binary file
stylish/img/Thumbs.db ADDED
Binary file
stylish/img/bkg.gif ADDED
Binary file
stylish/img/bkg_active.gif ADDED
Binary file
stylish/preview.gif ADDED
Binary file
stylish/wp-page-numbers.css ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wp_page_numbers ul, #wp_page_numbers li, #wp_page_numbers a {
2
+ background: url('img/bkg.gif') center left repeat-x;
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ text-decoration: none;
7
+ font-weight: normal;
8
+ font-style: normal;
9
+ list-style: none;
10
+ text-transform: none;
11
+ text-indent: 0px;
12
+ font-variant: normal;
13
+ text-align: left;
14
+ line-height: 12px;
15
+ letter-spacing: 0px;
16
+ word-spacing: 0px;
17
+ font-size: 12px;
18
+ font-family: Arial;
19
+ color: white;
20
+ font-weight: bold;
21
+ }
22
+
23
+ #wp_page_numbers {
24
+ margin-top: 10px;
25
+ width: 100%;
26
+ border: 1px solid #3e89a2;
27
+ background: url('img/bkg.gif') center left repeat-x;
28
+ }
29
+ #wp_page_numbers ul {
30
+ width: 100%;
31
+ }
32
+ #wp_page_numbers li {
33
+ float: left;
34
+ display: block;
35
+ }
36
+
37
+ #wp_page_numbers a {
38
+ padding: 6px;
39
+ padding-left: 4px;
40
+ padding-right: 4px;
41
+ display: block;
42
+ }
43
+
44
+ #wp_page_numbers li a:hover {
45
+ text-decoration: underline;
46
+ background: #95c9da;
47
+ color: #000;
48
+ }
49
+
50
+ #wp_page_numbers li.space {
51
+ padding: 6px;
52
+ }
53
+
54
+ #wp_page_numbers li.active_page a {
55
+ background: url('img/bkg_active.gif') center left repeat-x;
56
+ padding: 6px;
57
+ padding-left: 8px;
58
+ padding-right: 8px;
59
+ color: white;
60
+ }
61
+ #wp_page_numbers li.active_page a:hover {
62
+ color: #fff; /* IE fix */
63
+ }
64
+
65
+ #wp_page_numbers li.page_info {
66
+ float: left;
67
+ display: block;
68
+ padding: 6px;
69
+ padding-right: 8px;
70
+ font-size: 11px;
71
+ }
tiny/Thumbs.db ADDED
Binary file
tiny/preview.gif ADDED
Binary file
tiny/wp-page-numbers.css ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #wp_page_numbers ul, #wp_page_numbers li, #wp_page_numbers a {
2
+ background: #f1f1f1;
3
+ padding: 0;
4
+ margin: 0;
5
+ border: none;
6
+ text-decoration: none;
7
+ font-weight: normal;
8
+ font-style: normal;
9
+ list-style: none;
10
+ text-transform: none;
11
+ text-indent: 0px;
12
+ font-variant: normal;
13
+ text-align: left;
14
+ line-height: 12px;
15
+ letter-spacing: 0px;
16
+ word-spacing: 0px;
17
+ font-size: 9px;
18
+ font-family: Verdana;
19
+ }
20
+
21
+ #wp_page_numbers {
22
+ margin-top: 10px;
23
+ width: 100%;
24
+ background: #f1f1f1;
25
+ border: 1px solid #bfbfbf;
26
+ }
27
+ #wp_page_numbers ul {
28
+ width: 100%;
29
+ }
30
+ #wp_page_numbers li {
31
+ float: left;
32
+ display: block;
33
+ }
34
+
35
+ #wp_page_numbers a {
36
+
37
+ margin-top: 2px;
38
+ margin-bottom: 2px;
39
+
40
+ padding: 2px;
41
+ padding-left: 2px;
42
+ padding-right: 2px;
43
+ margin-left: 1px;
44
+ margin-right: 1px;
45
+ display: block;
46
+ color: #333;
47
+ border: 1px solid #f1f1f1;
48
+ }
49
+
50
+ #wp_page_numbers li a:hover {
51
+ border-color: #999;
52
+ }
53
+
54
+ #wp_page_numbers li.space {
55
+ margin-top: 2px;
56
+ margin-bottom: 2px;
57
+ border: 1px solid #f1f1f1;
58
+ padding-top: 2px;
59
+ }
60
+
61
+ #wp_page_numbers li.first_last_page {
62
+ font-style: italic;
63
+ }
64
+
65
+ #wp_page_numbers li.active_page a {
66
+ border: 1px solid #bfbfbf;
67
+ background: white;
68
+ padding-left: 4px;
69
+ padding-right: 4px;
70
+ }
71
+ #wp_page_numbers li.active_page a:hover {
72
+ color: black; /* IE fix */
73
+ }
74
+
75
+ #wp_page_numbers li.page_info {
76
+ margin-top: 2px;
77
+ margin-bottom: 2px;
78
+
79
+ padding-top: 2px;
80
+
81
+ margin-right: 2px;
82
+ padding-left: 2px;
83
+ color: #666;
84
+ border: 1px solid #f1f1f1;
85
+ }
wp-page-numbers.php ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP Page Numbers
4
+ Plugin URI: http://www.jenst.se/2008/03/29/wp-page-numbers
5
+ Description: Show pages numbers instead of "Next page" and "Previous Page".
6
+ Version: 0.2
7
+ Author: Jens T&ouml;rnell
8
+ Author URI: http://www.jenst.se
9
+ */
10
+
11
+ function wp_page_numbers_stylesheet()
12
+ {
13
+ $settings = get_option('wp_page_numbers_array');
14
+ $head_stylesheet = $settings["head_stylesheetsheet"];
15
+ $head_stylesheet_folder_name = $settings["head_stylesheetsheet_folder_name"];
16
+ $style_theme = $settings["style_theme"];
17
+
18
+ if($head_stylesheet == "on" || $head_stylesheet == "" && (is_archive() || is_search() || is_home() ||is_page()))
19
+ {
20
+ echo '<link rel="stylesheet" href="'.get_settings('siteurl') . '/wp-content/plugins/wp-page-numbers/';
21
+ if($head_stylesheet_folder_name == "")
22
+ {
23
+ if($style_theme == "default")
24
+ echo 'default';
25
+ elseif($style_theme == "classic")
26
+ echo 'classic';
27
+ elseif($style_theme == "tiny")
28
+ echo 'tiny';
29
+ elseif($style_theme == "panther")
30
+ echo 'panther';
31
+ elseif($style_theme == "stylish")
32
+ echo 'stylish';
33
+ else
34
+ echo 'default';
35
+ }
36
+ else
37
+ echo $head_stylesheet_folder_name;
38
+ echo '/wp-page-numbers.css" type="text/css" media="screen" />';
39
+ }
40
+ }
41
+ add_action('wp_head', 'wp_page_numbers_stylesheet');
42
+
43
+ function wp_page_numbers_check_num($num)
44
+ {
45
+ return ($num%2) ? true : false;
46
+ }
47
+
48
+ function wp_page_numbers_page_of_page($max_page, $paged, $page_of_page_text, $page_of_of)
49
+ {
50
+ $pagingString = "";
51
+ if ( $max_page > 1)
52
+ {
53
+ $pagingString .= '<li class="page_info">';
54
+ if($page_of_page_text == "")
55
+ $pagingString .= 'Page ';
56
+ else
57
+ $pagingString .= $page_of_page_text . ' ';
58
+
59
+ if ( $paged != "" )
60
+ $pagingString .= $paged;
61
+ else
62
+ $pagingString .= 1;
63
+
64
+ if($page_of_of == "")
65
+ $pagingString .= ' of ';
66
+ else
67
+ $pagingString .= ' ' . $page_of_of . ' ';
68
+ $pagingString .= floor($max_page).'</li>';
69
+ }
70
+ return $pagingString;
71
+ }
72
+
73
+ function wp_page_numbers_prevpage($paged, $max_page, $prevpage)
74
+ {
75
+ if( $max_page > 1 && $paged > 1 )
76
+ $pagingString = '<li><a href="'.get_pagenum_link($paged-1). '">'.$prevpage.'</a></li>';
77
+ return $pagingString;
78
+ }
79
+
80
+ function wp_page_numbers_left_side($max_page, $limit_pages, $paged, $pagingString)
81
+ {
82
+ $pagingString = "";
83
+ $page_check_max = false;
84
+ $page_check_min = false;
85
+ if($max_page > 1)
86
+ {
87
+ for($i=1; $i<($max_page+1); $i++)
88
+ {
89
+ if( $i <= $limit_pages )
90
+ {
91
+ if ($paged == $i || ($paged == "" && $i == 1))
92
+ $pagingString .= '<li class="active_page"><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
93
+ else
94
+ $pagingString .= '<li><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
95
+ if ($i == 1)
96
+ $page_check_min = true;
97
+ if ($max_page == $i)
98
+ $page_check_max = true;
99
+ }
100
+ }
101
+ return array($pagingString, $page_check_max, $page_check_min);
102
+ }
103
+ }
104
+
105
+ function wp_page_numbers_middle_side($max_page, $paged, $limit_pages_left, $limit_pages_right)
106
+ {
107
+ $pagingString = "";
108
+ $page_check_max = false;
109
+ $page_check_min = false;
110
+ for($i=1; $i<($max_page+1); $i++)
111
+ {
112
+ if($paged-$i <= $limit_pages_left && $paged+$limit_pages_right >= $i)
113
+ {
114
+ if ($paged == $i)
115
+ $pagingString .= '<li class="active_page"><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
116
+ else
117
+ $pagingString .= '<li><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
118
+
119
+ if ($i == 1)
120
+ $page_check_min = true;
121
+ if ($max_page == $i)
122
+ $page_check_max = true;
123
+ }
124
+ }
125
+ return array($pagingString, $page_check_max, $page_check_min);
126
+ }
127
+
128
+ function wp_page_numbers_right_side($max_page, $limit_pages, $paged, $pagingString)
129
+ {
130
+ $pagingString = "";
131
+ $page_check_max = false;
132
+ $page_check_min = false;
133
+ for($i=1; $i<($max_page+1); $i++)
134
+ {
135
+ if( ($max_page + 1 - $i) <= $limit_pages )
136
+ {
137
+ if ($paged == $i)
138
+ $pagingString .= '<li class="active_page"><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
139
+ else
140
+ $pagingString .= '<li><a href="'.get_pagenum_link($i). '">'.$i.'</a></li>'."\n";
141
+
142
+ if ($i == 1)
143
+ $page_check_min = true;
144
+ }
145
+ if ($max_page == $i)
146
+ $page_check_max = true;
147
+
148
+ }
149
+ return array($pagingString, $page_check_max, $page_check_min);
150
+ }
151
+
152
+ function wp_page_numbers_nextpage($paged, $max_page, $nextpage)
153
+ {
154
+ if( $paged != "" && $paged < $max_page)
155
+ $pagingString = '<li><a href="'.get_pagenum_link($paged+1). '">'.$nextpage.'</a></li>'."\n";
156
+ return $pagingString;
157
+ }
158
+
159
+ function wp_page_numbers()
160
+ {
161
+ global $wp_query;
162
+ global $max_page;
163
+ global $paged;
164
+ if ( !$max_page ) { $max_page = $wp_query->max_num_pages; }
165
+ if ( !$paged ) { $paged = 1; }
166
+
167
+ $settings = get_option('wp_page_numbers_array');
168
+ $page_of_page = $settings["page_of_page"];
169
+ $page_of_page_text = $settings["page_of_page_text"];
170
+ $page_of_of = $settings["page_of_of"];
171
+
172
+ $next_prev_text = $settings["next_prev_text"];
173
+ $show_start_end_numbers = $settings["show_start_end_numbers"];
174
+ $show_page_numbers = $settings["show_page_numbers"];
175
+
176
+ $limit_pages = $settings["limit_pages"];
177
+ $nextpage = $settings["nextpage"];
178
+ $prevpage = $settings["prevpage"];
179
+ $startspace = $settings["startspace"];
180
+ $endspace = $settings["endspace"];
181
+
182
+ if( $nextpage == "" ) { $nextpage = "&gt;"; }
183
+ if( $prevpage == "" ) { $prevpage = "&lt;"; }
184
+ if( $startspace == "" ) { $startspace = "..."; }
185
+ if( $endspace == "" ) { $endspace = "..."; }
186
+
187
+ if($limit_pages == "") { $limit_pages = "10"; }
188
+ elseif ( $limit_pages == "0" ) { $limit_pages = $max_page; }
189
+
190
+ if(wp_page_numbers_check_num($limit_pages) == true)
191
+ {
192
+ $limit_pages_left = ($limit_pages-1)/2;
193
+ $limit_pages_right = ($limit_pages-1)/2;
194
+ }
195
+ else
196
+ {
197
+ $limit_pages_left = $limit_pages/2;
198
+ $limit_pages_right = ($limit_pages/2)-1;
199
+ }
200
+
201
+ if( $max_page <= $limit_pages ) { $limit_pages = $max_page; }
202
+
203
+ $pagingString = "<div id='wp_page_numbers'>\n";
204
+ $pagingString .= '<ul>';
205
+
206
+ if($page_of_page != "no")
207
+ $pagingString .= wp_page_numbers_page_of_page($max_page, $paged, $page_of_page_text, $page_of_of);
208
+
209
+ if( ($paged) <= $limit_pages_left )
210
+ {
211
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_left_side($max_page, $limit_pages, $paged, $pagingString);
212
+ $pagingMiddleString .= $value1;
213
+ }
214
+ elseif( ($max_page+1 - $paged) <= $limit_pages_right )
215
+ {
216
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_right_side($max_page, $limit_pages, $paged, $pagingString);
217
+ $pagingMiddleString .= $value1;
218
+ }
219
+ else
220
+ {
221
+ list ($value1, $value2, $page_check_min) = wp_page_numbers_middle_side($max_page, $paged, $limit_pages_left, $limit_pages_right);
222
+ $pagingMiddleString .= $value1;
223
+ }
224
+ if($next_prev_text != "no")
225
+ $pagingString .= wp_page_numbers_prevpage($paged, $max_page, $prevpage);
226
+
227
+ if ($page_check_min == false && $show_start_end_numbers != "no")
228
+ {
229
+ $pagingString .= "<li class=\"first_last_page\">";
230
+ $pagingString .= "<a href=\"" . get_pagenum_link(1) . "\">1</a>";
231
+ $pagingString .= "</li>\n<li class=\"space\">".$startspace."</li>\n";
232
+ }
233
+
234
+ if($show_page_numbers != "no")
235
+ $pagingString .= $pagingMiddleString;
236
+
237
+ if ($value2 == false && $show_start_end_numbers != "no")
238
+ {
239
+ $pagingString .= "<li class=\"space\">".$endspace."</li>\n";
240
+ $pagingString .= "<li class=\"first_last_page\">";
241
+ $pagingString .= "<a href=\"" . get_pagenum_link($max_page) . "\">" . $max_page . "</a>";
242
+ $pagingString .= "</li>\n";
243
+ }
244
+
245
+ if($next_prev_text != "no")
246
+ $pagingString .= wp_page_numbers_nextpage($paged, $max_page, $nextpage);
247
+
248
+ $pagingString .= "</ul>\n";
249
+
250
+ $pagingString .= "<div style='float: none; clear: both;'></div>\n";
251
+ $pagingString .= "</div>\n";
252
+
253
+ if($max_page != 1)
254
+ echo $pagingString;
255
+ }
256
+
257
+ function wp_page_numbers_settings()
258
+ {
259
+ if(isset($_POST['submitted']))
260
+ {
261
+ if($_POST["head_stylesheetsheet"] == "")
262
+ $_POST["head_stylesheetsheet"] = "no";
263
+ if($_POST["page_of_page"] == "")
264
+ $_POST["page_of_page"] = "no";
265
+ if($_POST["next_prev_text"] == "")
266
+ $_POST["next_prev_text"] = "no";
267
+ if($_POST["show_start_end_numbers"] == "")
268
+ $_POST["show_start_end_numbers"] = "no";
269
+ if($_POST["show_page_numbers"] == "")
270
+ $_POST["show_page_numbers"] = "no";
271
+ if($_POST["style_theme"] == "")
272
+ $_POST["style_theme"] = "default";
273
+
274
+ $settings = array (
275
+ "head_stylesheetsheet" => $_POST["head_stylesheetsheet"],
276
+ "head_stylesheetsheet_folder_name" => $_POST["head_stylesheetsheet_folder_name"],
277
+ "page_of_page" => $_POST["page_of_page"],
278
+ "page_of_page_text" => $_POST["page_of_page_text"],
279
+ "page_of_of" => $_POST["page_of_of"],
280
+ "next_prev_text" => $_POST["next_prev_text"],
281
+ "show_start_end_numbers" => $_POST["show_start_end_numbers"],
282
+ "show_page_numbers" => $_POST["show_page_numbers"],
283
+ "limit_pages" => $_POST["limit_pages"],
284
+ "nextpage" => $_POST["nextpage"],
285
+ "prevpage" => $_POST["prevpage"],
286
+ "startspace" => $_POST["startspace"],
287
+ "endspace" => $_POST["endspace"],
288
+ "style_theme" => $_POST["style_theme"],
289
+ );
290
+ update_option('wp_page_numbers_array', $settings);
291
+
292
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>WP Page Numbers plugin options updated.</strong></p></div>";
293
+ }
294
+
295
+ $settings = get_option('wp_page_numbers_array');
296
+
297
+ $style_theme = $settings["style_theme"];
298
+
299
+ $head_stylesheet = $settings["head_stylesheetsheet"];
300
+ $head_stylesheet_folder_name = $settings["head_stylesheetsheet_folder_name"];
301
+ $page_of_page = $settings["page_of_page"];
302
+ $page_of_page_text = $settings["page_of_page_text"];
303
+ $page_of_of = $settings["page_of_of"];
304
+
305
+ $next_prev_text = $settings["next_prev_text"];
306
+ $show_start_end_numbers = $settings["show_start_end_numbers"];
307
+ $show_page_numbers = $settings["show_page_numbers"];
308
+
309
+ $limit_pages = $settings["limit_pages"];
310
+
311
+ $nextpage = $settings["nextpage"];
312
+ $prevpage = $settings["prevpage"];
313
+ $startspace = $settings["startspace"];
314
+ $endspace = $settings["endspace"];
315
+
316
+ ?>
317
+ <form method="post" name="options" target="_self">
318
+
319
+ <div class="wrap">
320
+ <h2>Page Number Themes</h2>
321
+ <table style="width: 100%;" border="0">
322
+ <tr>
323
+ <td><strong>Use themes?</strong></td>
324
+ <td>
325
+ <input type="checkbox" name="head_stylesheetsheet" <?php
326
+ if($head_stylesheet == "on" || $head_stylesheet == "")
327
+ {
328
+ echo 'checked="checked"';
329
+ }
330
+ ?>/> Include theme stylesheet for page numbers
331
+ </td>
332
+ </tr>
333
+ <tr>
334
+ <td style="width: 400px;"><strong>Modern</strong></td>
335
+ <td style="padding-top: 5px; padding-bottom: 5px;">
336
+ <input type="radio" name="style_theme" value="default" <?php
337
+ if( ( $style_theme == "default" || $style_theme == "" ) && $head_stylesheet_folder_name == "" )
338
+ {
339
+ echo 'checked="checked"';
340
+ }
341
+ ?>/>
342
+ <img src="<?php get_settings('siteurl'); ?>/wp-content/plugins/wp-page-numbers/default/preview.gif" alt="" />
343
+ </td>
344
+ </tr>
345
+ <tr>
346
+ <td><strong>Classic</strong></td>
347
+ <td style="padding-top: 5px; padding-bottom: 5px;">
348
+ <input type="radio" name="style_theme" value="classic" <?php
349
+ if($style_theme == "classic" && $head_stylesheet_folder_name == "")
350
+ {
351
+ echo 'checked="checked"';
352
+ }
353
+ ?>/>
354
+ <img src="<?php get_settings('siteurl'); ?>/wp-content/plugins/wp-page-numbers/classic/preview.gif" alt="" />
355
+ </td>
356
+ </tr>
357
+ <tr>
358
+ <td><strong>Tiny</strong></td>
359
+ <td style="padding-top: 5px; padding-bottom: 5px;">
360
+ <input type="radio" name="style_theme" value="tiny" <?php
361
+ if($style_theme == "tiny" && $head_stylesheet_folder_name == "")
362
+ {
363
+ echo 'checked="checked"';
364
+ }
365
+ ?>/>
366
+ <img src="<?php get_settings('siteurl'); ?>/wp-content/plugins/wp-page-numbers/tiny/preview.gif" alt="" />
367
+ </td>
368
+ </tr>
369
+ <tr>
370
+ <td><strong>Panther</strong></td>
371
+ <td style="padding-top: 5px; padding-bottom: 5px;">
372
+ <input type="radio" name="style_theme" value="panther" <?php
373
+ if($style_theme == "panther" && $head_stylesheet_folder_name == "")
374
+ {
375
+ echo 'checked="checked"';
376
+ }
377
+ ?>/>
378
+ <img src="<?php get_settings('siteurl'); ?>/wp-content/plugins/wp-page-numbers/panther/preview.gif" alt="" />
379
+ </td>
380
+ </tr>
381
+ <tr>
382
+ <td><strong>Stylish</strong></td>
383
+ <td style="padding-top: 5px; padding-bottom: 5px;">
384
+ <input type="radio" name="style_theme" value="stylish" <?php
385
+ if($style_theme == "stylish" && $head_stylesheet_folder_name == "")
386
+ {
387
+ echo 'checked="checked"';
388
+ }
389
+ ?>/>
390
+ <img src="<?php get_settings('siteurl'); ?>/wp-content/plugins/wp-page-numbers/stylish/preview.gif" alt="" />
391
+ </td>
392
+ </tr>
393
+ <tr>
394
+ <td><strong>Theme folder name: </strong><span style="color: red;">OVERRIDE</span> settings above</td>
395
+ <td colspan="3">
396
+ <input name="head_stylesheetsheet_folder_name" type="text" style="width:100%;" value="<?php echo $head_stylesheet_folder_name; ?>" />
397
+ </td>
398
+ </tr>
399
+
400
+ <tr>
401
+ <td></td>
402
+ <td colspan="2">
403
+ - Have you create a cool WP Page Numbers theme?<br />
404
+ - Want to share it to the rest of the world? <a href="http://www.jenst.se/2000/01/01/kontakt">Contact me</a>.
405
+ </td>
406
+ </tr>
407
+ </table>
408
+ </div>
409
+
410
+ <div class="wrap">
411
+ <h2>Settings - Text</h2>
412
+ <table style="width: 100%;" border="0">
413
+
414
+ <tr>
415
+ <td style="width: 400px;"><strong>Default text: </strong>Page</td>
416
+ <td colspan="3">
417
+ <input name="page_of_page_text" type="text" style="width:100%;" value="<?php echo $page_of_page_text; ?>" />
418
+ </td>
419
+ </tr>
420
+
421
+ <tr>
422
+ <td><strong>Default text: </strong>of</td>
423
+ <td colspan="3">
424
+ <input name="page_of_of" type="text" style="width:100%;" value="<?php echo $page_of_of; ?>" />
425
+ </td>
426
+ </tr>
427
+
428
+ <tr>
429
+ <td><strong>Default text: </strong>&lt;</td>
430
+ <td colspan="3">
431
+ <input name="prevpage" type="text" style="width:100%;" value="<?php echo $prevpage; ?>" />
432
+ </td>
433
+ </tr>
434
+
435
+ <tr>
436
+ <td><strong>Default text: </strong>...</td>
437
+ <td colspan="3">
438
+ <input name="startspace" type="text" style="width:100%;" value="<?php echo $startspace; ?>" />
439
+ </td>
440
+ </tr>
441
+
442
+ <tr>
443
+ <td><strong>Default text: </strong>...</td>
444
+ <td colspan="3">
445
+ <input name="endspace" type="text" style="width:100%;" value="<?php echo $endspace; ?>" />
446
+ </td>
447
+ </tr>
448
+
449
+ <tr>
450
+ <td><strong>Default text: </strong>&gt;</td>
451
+ <td colspan="3">
452
+ <input name="nextpage" type="text" style="width:100%;" value="<?php echo $nextpage; ?>" />
453
+ </td>
454
+ </tr>
455
+ </table>
456
+ </div>
457
+
458
+ <div class="wrap">
459
+ <h2>Settings - show / hide</h2>
460
+ <table style="width: 100%;" border="0">
461
+
462
+ <tr>
463
+ <td style="width: 400px;"><strong>Show page info</strong></td>
464
+ <td>
465
+ <input type="checkbox" name="page_of_page" <?php
466
+ if($page_of_page == "on" || $page_of_page == "")
467
+ {
468
+ echo 'checked="checked"';
469
+ }
470
+ ?>/> Page 3 of 5
471
+ </td>
472
+ </tr>
473
+
474
+ <tr>
475
+ <td><strong>Show next / previous page text</td>
476
+ <td>
477
+ <input type="checkbox" name="next_prev_text" <?php
478
+ if($next_prev_text == "on" || $next_prev_text == "")
479
+ {
480
+ echo 'checked="checked"';
481
+ }
482
+ ?>/> &lt; &gt;
483
+ </td>
484
+ </tr>
485
+
486
+ <tr>
487
+ <td><strong>Show start and end numbers</td>
488
+ <td>
489
+ <input type="checkbox" name="show_start_end_numbers" <?php
490
+ if($show_start_end_numbers == "on" || $show_start_end_numbers == "")
491
+ {
492
+ echo 'checked="checked"';
493
+ }
494
+ ?>/> 1... ...5
495
+ </td>
496
+ </tr>
497
+
498
+ <tr>
499
+ <td><strong>Show page numbers</td>
500
+ <td>
501
+ <input type="checkbox" name="show_page_numbers" <?php
502
+ if($show_page_numbers == "on" || $show_page_numbers == "")
503
+ {
504
+ echo 'checked="checked"';
505
+ }
506
+ ?>/> 34567
507
+ </td>
508
+ </tr>
509
+ </table>
510
+ </div>
511
+
512
+ <div class="wrap">
513
+ <h2>Settings - Misc</h2>
514
+ <table style="width: 100%;" border="0">
515
+ <tr>
516
+ <td style="width: 400px;"><strong>Number of pages to show: </strong>10 (0 = unlimited)</td>
517
+ <td colspan="3">
518
+ <input name="limit_pages" type="text" style="width:100%;" value="<?php echo $limit_pages; ?>" />
519
+ </td>
520
+ </tr>
521
+ </table>
522
+ </div>
523
+
524
+ <div class="wrap">
525
+ <h2>Instructions</h2>
526
+ <p>Most of the settings are already set to a default value if blank.</p>
527
+ <table>
528
+ <tr>
529
+ <td><strong>Text options</strong></td>
530
+ </tr>
531
+ <tr>
532
+ <td>You can set all the texts to what ever you like, except the numbers. They will still be numbers.<br /><br /></td>
533
+ </tr>
534
+
535
+ <tr>
536
+ <td><strong>Number of pages to show</strong></td>
537
+ </tr>
538
+ <tr>
539
+ <td>This will limit your paging menu. Set a of maximum amount of pages to be displayed at the same time. If the textfield is blank, 10 is set by default. If 0 is set, it will not limit the paging.<br /><br /></td>
540
+ </tr>
541
+ <tr>
542
+ <td><strong>Theme folder name</strong></td>
543
+ </tr>
544
+ <tr>
545
+ <td>
546
+ <ol>
547
+ <li>Copy one of the theme folders</li>
548
+ <li>Edit the '<strong>wp-page-numbers.css</strong>' to make your changes</li>
549
+ <li>Rename your folder copy to a theme name</li>
550
+ <li>Upload your folder into '<strong>wp-content/plugins/wp-page-numbers/</strong>'</li>
551
+ <li>Set your '<strong>Theme folder name</strong>' in admin '<strong>Settings / WP Page Numbers</strong>'</li>
552
+ <li>'<strong>Update settings</strong>'. Done!</li>
553
+ </ol>
554
+ </td>
555
+ </tr>
556
+ </table>
557
+
558
+ <p class="submit">
559
+ <input name="submitted" type="hidden" value="yes" />
560
+ <input type="submit" name="Submit" value="Update Settings &raquo;" />
561
+ </p>
562
+ </form>
563
+ </div><?php
564
+ }
565
+
566
+ function wp_page_numbers_add_to_menu() {
567
+ add_submenu_page('options-general.php', 'WP Page Numbers Options', 'Page Numbers', 10, __FILE__, 'wp_page_numbers_settings');
568
+ }
569
+ add_action('admin_menu', 'wp_page_numbers_add_to_menu');
570
+ ?>