WP-PostViews - Version 1.11

Version Description

Download this release

Release Info

Developer GamerZ
Plugin Icon WP-PostViews
Version 1.11
Comparing to
See all releases

Code changes from version 1.00beta to 1.11

postviews.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-PostViews
4
- Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
- Description: Enables You To Display How Many Time A Post Had Been Viewed.
6
- Version: 1.00
7
- Author: GaMerZ
8
- Author URI: http://www.lesterchan.net
9
- */
10
-
11
-
12
- /* Copyright 2005 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: Calculate Post Views
31
- add_action('loop_start', 'process_postviews');
32
- function process_postviews() {
33
- global $id;
34
- $post_views = intval(get_post_meta($id, 'views', true));
35
- if(empty($_COOKIE[USER_COOKIE])) {
36
- if(is_single() || is_page()) {
37
- if($post_views > 0) {
38
- update_post_meta($id, 'views', ($post_views+1));
39
- } else {
40
- add_post_meta($id, 'views', 1);
41
- }
42
- }
43
- }
44
- }
45
-
46
-
47
- ### Function: Display The Post Views
48
- function the_views($text_views = 'Views', $display = true) {
49
- global $id;
50
- $post_views = intval(get_post_meta($id, 'views', true));
51
- if($display) {
52
- echo $post_views.' '.$text_views;
53
- } else {
54
- return $post_views;
55
- }
56
- }
57
-
58
-
59
- ### Function: Display Most Viewed Page/Post
60
- function get_most_viewed($mode = '', $limit = 10) {
61
- global $wpdb, $post;
62
- $where = '';
63
- if($mode == 'post') {
64
- $where = 'post_status = \'publish\'';
65
- } elseif($mode == 'page') {
66
- $where = 'post_status = \'static\'';
67
- } else {
68
- $where = '(post_status = \'publish\' OR post_status = \'static\')';
69
- }
70
- $most_viewed = $wpdb->get_results("SELECT $wpdb->posts.ID, post_title, post_name, post_status, post_date, CAST(meta_value AS UNSIGNED) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $where AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
71
- if($most_viewed) {
72
- foreach ($most_viewed as $post) {
73
- $post_title = htmlspecialchars(stripslashes($post->post_title));
74
- $post_views = intval($post->views);
75
- echo "- <a href=\"".get_permalink()."\">$post_title</a> ($post_views ".__('Views').")<br />";
76
- }
77
- } else {
78
- _e('N/A');
79
- }
80
- }
81
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
postviews/postviews.php ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-PostViews
4
+ Plugin URI: http://www.lesterchan.net/portfolio/programming.php
5
+ Description: Enables you to display how many times a post/page had been viewed. It will not count registered member views, but that can be changed easily.
6
+ Version: 1.11
7
+ Author: Lester 'GaMerZ' Chan
8
+ Author URI: http://www.lesterchan.net
9
+ */
10
+
11
+
12
+ /*
13
+ Copyright 2007 Lester Chan (email : gamerz84@hotmail.com)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 2 of the License, or
18
+ (at your option) any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
+ */
29
+
30
+
31
+ ### Create Text Domain For Translation
32
+ load_plugin_textdomain('wp-postviews', 'wp-content/plugins/postviews');
33
+
34
+
35
+ ### Function: Calculate Post Views
36
+ add_action('loop_start', 'process_postviews');
37
+ function process_postviews() {
38
+ global $id;
39
+ $post_views = get_post_custom($post_id);
40
+ $post_views = intval($post_views['views'][0]);
41
+ if(empty($_COOKIE[USER_COOKIE])) {
42
+ if(is_single() || is_page()) {
43
+ if(!update_post_meta($id, 'views', ($post_views+1))) {
44
+ add_post_meta($id, 'views', 1, true);
45
+ }
46
+ remove_action('loop_start', 'process_postviews');
47
+ }
48
+ }
49
+ }
50
+
51
+
52
+ ### Function: Display The Post Views
53
+ function the_views($text_views = '', $display = true) {
54
+ if(empty($text_views)) {
55
+ $text_views = __('Views', 'wp-postviews');
56
+ }
57
+ $post_views = intval(post_custom('views'));
58
+ if($display) {
59
+ echo number_format($post_views).' '.$text_views;
60
+ } else {
61
+ return $post_views;
62
+ }
63
+ }
64
+
65
+
66
+ ### Function: Display Most Viewed Page/Post
67
+ if(!function_exists('get_most_viewed')) {
68
+ function get_most_viewed($mode = '', $limit = 10, $chars = 0, $display = true) {
69
+ global $wpdb, $post;
70
+ $where = '';
71
+ $temp = '';
72
+ if(!empty($mode) && $mode != 'both') {
73
+ $where = "post_type = '$mode'";
74
+ } else {
75
+ $where = '1=1';
76
+ }
77
+ $most_viewed = $wpdb->get_results("SELECT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
78
+ if($most_viewed) {
79
+ if($chars > 0) {
80
+ foreach ($most_viewed as $post) {
81
+ $post_title = get_the_title();
82
+ $post_views = intval($post->views);
83
+ $post_views = number_format($post_views);
84
+ $temp .= "<li><a href=\"".get_permalink()."\">".snippet_chars($post_title, $chars)."</a> - $post_views ".__('Views', 'wp-postviews')."</li>\n";
85
+ }
86
+ } else {
87
+ foreach ($most_viewed as $post) {
88
+ $post_title = get_the_title();
89
+ $post_views = intval($post->views);
90
+ $post_views = number_format($post_views);
91
+ $temp .= "<li><a href=\"".get_permalink()."\">$post_title</a> - $post_views ".__('Views', 'wp-postviews')."</li>\n";
92
+ }
93
+ }
94
+ } else {
95
+ $temp = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
96
+ }
97
+ if($display) {
98
+ echo $temp;
99
+ } else {
100
+ return $temp;
101
+ }
102
+ }
103
+ }
104
+
105
+
106
+ ### Function: Display Most Viewed Page/Post By Category ID
107
+ if(!function_exists('get_most_viewed_category')) {
108
+ function get_most_viewed_category($category_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
109
+ global $wpdb, $post;
110
+ $where = '';
111
+ $temp = '';
112
+ if(!empty($mode) && $mode != 'both') {
113
+ $where = "post_type = '$mode'";
114
+ } else {
115
+ $where = '1=1';
116
+ }
117
+ $most_viewed = $wpdb->get_results("SELECT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID LEFT JOIN $wpdb->post2cat ON $wpdb->post2cat.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $wpdb->post2cat.category_id = $category_id AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
118
+ if($most_viewed) {
119
+ if($chars > 0) {
120
+ foreach ($most_viewed as $post) {
121
+ $post_title = htmlspecialchars(stripslashes($post->post_title));
122
+ $post_views = intval($post->views);
123
+ $post_views = number_format($post_views);
124
+ $temp .= "<li><a href=\"".get_permalink()."\">".snippet_chars($post_title, $chars)."</a> - $post_views ".__('Views', 'wp-postviews')."</li>\n";
125
+ }
126
+ } else {
127
+ foreach ($most_viewed as $post) {
128
+ $post_title = htmlspecialchars(stripslashes($post->post_title));
129
+ $post_views = intval($post->views);
130
+ $post_views = number_format($post_views);
131
+ $temp .= "<li><a href=\"".get_permalink()."\">$post_title</a> - $post_views ".__('Views', 'wp-postviews')."</li>\n";
132
+ }
133
+ }
134
+ } else {
135
+ $temp = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
136
+ }
137
+ if($display) {
138
+ echo $temp;
139
+ } else {
140
+ return $temp;
141
+ }
142
+ }
143
+ }
144
+
145
+
146
+ ### Function: Get TimeSpan Most Viewed - Added by Paolo Tagliaferri (http://www.vortexmind.net - webmaster@vortexmind.net)
147
+ function get_timespan_most_viewed($mode = '', $limit = 10, $days = 7, $display = true) {
148
+ global $wpdb, $post;
149
+ $limit_date = current_time('timestamp') - ($days*86400);
150
+ $limit_date = date("Y-m-d H:i:s",$limit_date);
151
+ $where = '';
152
+ $temp = '';
153
+ if(!empty($mode) && $mode != 'both') {
154
+ $where = "post_type = '$mode'";
155
+ } else {
156
+ $where = '1=1';
157
+ }
158
+ $most_viewed = $wpdb->get_results("SELECT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND post_date > '".$limit_date."' AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
159
+ if($most_viewed) {
160
+ foreach ($most_viewed as $post) {
161
+ $post_title = get_the_title();
162
+ $post_views = intval($post->views);
163
+ $post_views = number_format($post_views);
164
+ $temp .= "<li><a href=\"".get_permalink()."\">$post_title</a> - $post_views ".__('Views', 'wp-postviews')."</li>";
165
+ }
166
+ } else {
167
+ $temp = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
168
+ }
169
+ if($display) {
170
+ echo $temp;
171
+ } else {
172
+ return $temp;
173
+ }
174
+ }
175
+
176
+
177
+ ### Function: Get TimeSpan Most Viewed By Category
178
+ function get_timespan_most_viewed_cat($category_id = 0, $mode = '', $limit = 10, $days = 7, $display = true) {
179
+ global $wpdb, $post;
180
+ $limit_date = current_time('timestamp') - ($days*86400);
181
+ $limit_date = date("Y-m-d H:i:s",$limit_date);
182
+ $where = '';
183
+ $temp = '';
184
+ if(!empty($mode) && $mode != 'both') {
185
+ $where = "post_type = '$mode'";
186
+ } else {
187
+ $where = '1=1';
188
+ }
189
+ $most_viewed = $wpdb->get_results("SELECT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID LEFT JOIN $wpdb->post2cat ON $wpdb->post2cat.post_id = $wpdb->posts.ID WHERE post_date < '".current_time('mysql')."' AND $wpdb->post2cat.category_id = $category_id AND post_date > '".$limit_date."' AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
190
+ if($most_viewed) {
191
+ foreach ($most_viewed as $post) {
192
+ $post_title = get_the_title();
193
+ $post_views = intval($post->views);
194
+ $post_views = number_format($post_views);
195
+ $temp .= "<li><a href=\"".get_permalink()."\">$post_title</a> - $post_views ".__('Views', 'wp-postviews')."</li>";
196
+ }
197
+ } else {
198
+ $temp = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
199
+ }
200
+ if($display) {
201
+ echo $temp;
202
+ } else {
203
+ return $temp;
204
+ }
205
+ }
206
+
207
+
208
+ ### Function: Display Total Views
209
+ if(!function_exists('get_totalviews')) {
210
+ function get_totalviews($display = true) {
211
+ global $wpdb;
212
+ $total_views = $wpdb->get_var("SELECT SUM(meta_value+0) FROM $wpdb->postmeta WHERE meta_key = 'views'");
213
+ if($display) {
214
+ echo number_format($total_views);
215
+ } else {
216
+ return number_format($total_views);
217
+ }
218
+ }
219
+ }
220
+
221
+
222
+ ### Function: Snippet Text
223
+ if(!function_exists('snippet_chars')) {
224
+ function snippet_chars($text, $length = 0) {
225
+ $text = htmlspecialchars_decode($text);
226
+ if (strlen($text) > $length){
227
+ return htmlspecialchars(substr($text,0,$length)).'...';
228
+ } else {
229
+ return htmlspecialchars($text);
230
+ }
231
+ }
232
+ }
233
+
234
+
235
+ ### Function: HTML Special Chars Decode
236
+ if (!function_exists('htmlspecialchars_decode')) {
237
+ function htmlspecialchars_decode($text) {
238
+ return strtr($text, array_flip(get_html_translation_table(HTML_SPECIALCHARS)));
239
+ }
240
+ }
241
+
242
+
243
+ ### Function: Modify Default WordPress Listing To Make It Sorted By Post Views
244
+ function views_fields($content) {
245
+ global $wpdb;
246
+ $content .= ", ($wpdb->postmeta.meta_value+0) AS views";
247
+ return $content;
248
+ }
249
+ function views_join($content) {
250
+ global $wpdb;
251
+ $content .= " LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID";
252
+ return $content;
253
+ }
254
+ function views_where($content) {
255
+ global $wpdb;
256
+ $content .= " AND $wpdb->postmeta.meta_key = 'views'";
257
+ return $content;
258
+ }
259
+ function views_orderby($content) {
260
+ $orderby = trim(addslashes($_GET['orderby']));
261
+ if(empty($orderby) && ($orderby != 'asc' || $orderby != 'desc')) {
262
+ $orderby = 'desc';
263
+ }
264
+ $content = " views $orderby";
265
+ return $content;
266
+ }
267
+
268
+
269
+ ### Process The Sorting
270
+ /*
271
+ if($_GET['sortby'] == 'views') {
272
+ add_filter('posts_fields', 'views_fields');
273
+ add_filter('posts_join', 'views_join');
274
+ add_filter('posts_where', 'views_where');
275
+ add_filter('posts_orderby', 'views_orderby');
276
+ }
277
+ */
278
+ ?>
postviews/wp-postviews.mo ADDED
Binary file
postviews/wp-postviews.pot ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP-PostViews 1.11\n"
4
+ "POT-Creation-Date: \n"
5
+ "PO-Revision-Date: 2007-06-07 15:23+0800\n"
6
+ "Last-Translator: Lester 'GaMerZ' Chan <gamerz84@hotmail.com>\n"
7
+ "Language-Team: Lester Chan <gamerz84@hotmail.com>\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=utf-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "X-Poedit-Language: English\n"
12
+ "X-Poedit-Country: SINGAPORE\n"
13
+ "X-Poedit-KeywordsList: __;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SearchPath-0: .\n"
16
+
17
+ #: postviews.php:55
18
+ #: postviews.php:84
19
+ #: postviews.php:91
20
+ #: postviews.php:124
21
+ #: postviews.php:131
22
+ #: postviews.php:164
23
+ #: postviews.php:195
24
+ msgid "Views"
25
+ msgstr ""
26
+
27
+ #: postviews.php:95
28
+ #: postviews.php:135
29
+ #: postviews.php:167
30
+ #: postviews.php:198
31
+ msgid "N/A"
32
+ msgstr ""
33
+
readme-install.txt DELETED
@@ -1,51 +0,0 @@
1
- -> Installation Instructions
2
- --------------------------------------------------
3
- // Open wp-content/plugins folder
4
-
5
- Put:
6
- ------------------------------------------------------------------
7
- postviews.php
8
- ------------------------------------------------------------------
9
-
10
-
11
- // Activate the WP-PostViews plugin
12
-
13
-
14
-
15
-
16
-
17
- -> Usage Instructions
18
- --------------------------------------------------
19
- // Open wp-content/themes/<YOUR THEME NAME>/index.php OR single.php OR page.php
20
-
21
- Find:
22
- ------------------------------------------------------------------
23
- <?php while (have_posts()) : the_post(); ?>
24
- ------------------------------------------------------------------
25
- Add Anywhere Below It:
26
- ------------------------------------------------------------------
27
- <?php if(function_exists('the_views')) { the_views(); } ?>
28
- ------------------------------------------------------------------
29
- Note:
30
- ------------------------------------------------------------------
31
- The first value you pass in is the text for views.
32
- Default: the_views('Views');
33
- ------------------------------------------------------------------
34
-
35
-
36
- // Post Views Stats (You can place it anywhere outside the WP Loop)
37
-
38
- // To Get Most Viewed Post
39
-
40
- Use:
41
- ------------------------------------------------------------------
42
- <?php if (function_exists('get_most_viewed')): ?>
43
- <?php get_most_viewed(); ?>
44
- <?php endif; ?>
45
- ------------------------------------------------------------------
46
- Note:
47
- ------------------------------------------------------------------
48
- The first value you pass in is what you want to get, 'post', 'page' or 'both'.
49
- The second value you pass in is the number of post you want to get.
50
- Default: get_most_viewed('both', 10);
51
- ------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.html ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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-PostViews 1.11 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
+ /* <![CDATA[*/
125
+ // Index Page
126
+ function index() {
127
+ // Tab
128
+ document.getElementById('IndexTab').className = 'SelectedTab';
129
+ document.getElementById('ChangelogTab').className = 'Tab';
130
+ document.getElementById('InstallTab').className = 'Tab';
131
+ document.getElementById('UpgradeTab').className = 'Tab';
132
+ document.getElementById('UsageTab').className = 'Tab';
133
+ // Page
134
+ document.getElementById('Index').style.display= 'block';
135
+ document.getElementById('Changelog').style.display = 'none';
136
+ document.getElementById('Install').style.display = 'none';
137
+ document.getElementById('Upgrade').style.display = 'none';
138
+ document.getElementById('Usage').style.display = 'none';
139
+ }
140
+ // Changelog Page
141
+ function changelog() {
142
+ // Tab
143
+ document.getElementById('IndexTab').className = 'Tab';
144
+ document.getElementById('ChangelogTab').className = 'SelectedTab';
145
+ document.getElementById('InstallTab').className = 'Tab';
146
+ document.getElementById('UpgradeTab').className = 'Tab';
147
+ document.getElementById('UsageTab').className = 'Tab';
148
+ // Page
149
+ document.getElementById('Index').style.display = 'none';
150
+ document.getElementById('Changelog').style.display = 'block';
151
+ document.getElementById('Install').style.display = 'none';
152
+ document.getElementById('Upgrade').style.display = 'none';
153
+ document.getElementById('Usage').style.display = 'none';
154
+ }
155
+ // Installation Page
156
+ function install() {
157
+ // Tab
158
+ document.getElementById('IndexTab').className = 'Tab';
159
+ document.getElementById('ChangelogTab').className = 'Tab';
160
+ document.getElementById('InstallTab').className = 'SelectedTab';
161
+ document.getElementById('UpgradeTab').className = 'Tab';
162
+ document.getElementById('UsageTab').className = 'Tab';
163
+ // Page
164
+ document.getElementById('Index').style.display= 'none';
165
+ document.getElementById('Changelog').style.display = 'none';
166
+ document.getElementById('Install').style.display = 'block';
167
+ document.getElementById('Upgrade').style.display = 'none';
168
+ document.getElementById('Usage').style.display = 'none';
169
+ }
170
+ // Upgrade Page
171
+ function upgrade() {
172
+ // Tab
173
+ document.getElementById('IndexTab').className = 'Tab';
174
+ document.getElementById('ChangelogTab').className = 'Tab';
175
+ document.getElementById('InstallTab').className = 'Tab';
176
+ document.getElementById('UpgradeTab').className = 'SelectedTab';
177
+ document.getElementById('UsageTab').className = 'Tab';
178
+ // Page
179
+ document.getElementById('Index').style.display= 'none';
180
+ document.getElementById('Changelog').style.display = 'none';
181
+ document.getElementById('Install').style.display = 'none';
182
+ document.getElementById('Upgrade').style.display = 'block';
183
+ document.getElementById('Usage').style.display = 'none';
184
+ }
185
+ // Usage Page
186
+ function usage() {
187
+ // Tab
188
+ document.getElementById('IndexTab').className = 'Tab';
189
+ document.getElementById('ChangelogTab').className = 'Tab';
190
+ document.getElementById('InstallTab').className = 'Tab';
191
+ document.getElementById('UpgradeTab').className = 'Tab';
192
+ document.getElementById('UsageTab').className = 'SelectedTab';
193
+ // Page
194
+ document.getElementById('Index').style.display= 'none';
195
+ document.getElementById('Changelog').style.display = 'none';
196
+ document.getElementById('Install').style.display = 'none';
197
+ document.getElementById('Upgrade').style.display = 'none';
198
+ document.getElementById('Usage').style.display = 'block';
199
+ }
200
+ /* ]]> */
201
+ </script>
202
+ </head>
203
+ <body>
204
+ <div id="Container">
205
+ <!-- Title -->
206
+ <div id="Title">WP-PostViews 1.11&nbsp;&nbsp;&nbsp;<span style="color: #aaaaaa;">Readme</span></div>
207
+
208
+ <!-- Tabs -->
209
+ <ul id="Tabs">
210
+ <li id="UsageTab" class="Tab"><a href="#Usage" onclick="usage(); return false;" title="Usage Instructions">Usage</a></li>
211
+ <li id="UpgradeTab" class="Tab"><a href="#Upgrade" onclick="upgrade(); return false;" title="Upgrade Instructions">Upgrade</a></li>
212
+ <li id="InstallTab" class="Tab"><a href="#Installation" onclick="install(); return false;" title="Installation Instructions">Installation</a></li>
213
+ <li id="ChangelogTab" class="Tab"><a href="#Changelog" onclick="changelog(); return false;" title="Changelog">Changelog</a></li>
214
+ <li id="IndexTab" class="SelectedTab"><a href="#Index" onclick="index(); return false;" title="Index Instructions">Index</a></li>
215
+ </ul>
216
+
217
+ <!-- Content -->
218
+ <div id="Content">
219
+ <!-- Index -->
220
+ <div id="Index">
221
+ <div class="SubTitle">&raquo; Index</div>
222
+ <div class="SubSubTitle">Plugin Information</div>
223
+ <p>
224
+ <strong>Author:</strong><br />
225
+ <strong>&raquo;</strong> Lester 'GaMerZ' Chan
226
+ </p>
227
+ <p>
228
+ <strong>EMail:</strong><br />
229
+ <strong>&raquo;</strong>
230
+ <script type="text/javascript">
231
+ /* <![CDATA[*/
232
+ document.write(' <a href="mailto:gamerz84@hotmail.com?Subject=WP-PostViews%201.11%20Support" title="EMail To gamerz84@hotmail.com">gamerz84@hotmail.com</a>');
233
+ /* ]]> */
234
+ </script>
235
+ </p>
236
+ <p>
237
+ <strong>Website:</strong><br />
238
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/" title="http://www.lesterchan.net/">http://www.lesterchan.net/</a>
239
+ </p>
240
+ <p>
241
+ <strong>Features:</strong><br />
242
+ <strong>&raquo;</strong> Enables you to display how many times a post/page had been viewed. It will not count registered member views, but that can be changed easily.
243
+ </p>
244
+ <p>
245
+ <strong>Download:</strong><br />
246
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/others/downloads.php?id=19" title="http://www.lesterchan.net/others/downloads.php?id=19">WP-PostViews 1.11 For WordPress 2.1.x And Above</a><br />
247
+ <strong>&raquo;</strong> <a href="http://www.lesterchan.net/others/downloads/wp-postviews102.zip" title="http://www.lesterchan.net/others/downloads/wp-postviews102.zip">WP-PostViews 1.02 For WordPress 2.0.x</a><br />
248
+ </p>
249
+ <p>
250
+ <strong>Demo:</strong><br /><strong>&raquo;</strong> <a href="http://www.lesterchan.net/wordpress/" title="http://www.lesterchan.net/wordpress/">http://www.lesterchan.net/wordpress/</a>
251
+ </p>
252
+ <p>
253
+ <strong>Development:</strong><br />
254
+ <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-postviews/" title="http://dev.wp-plugins.org/browser/wp-postviews/">http://dev.wp-plugins.org/browser/wp-postviews/</a>
255
+ </p>
256
+ <p>
257
+ <strong>Translations:</strong><br />
258
+ <strong>&raquo;</strong> <a href="http://dev.wp-plugins.org/browser/wp-postviews/i18n/" title="http://dev.wp-plugins.org/browser/wp-postviews/i18n/">http://dev.wp-plugins.org/browser/wp-postviews/i18n/</a>
259
+ </p>
260
+ <p>
261
+ <strong>Support Forums:</strong><br />
262
+ <strong>&raquo;</strong> <a href="http://forums.lesterchan.net/index.php?board=16.0" title="http://forums.lesterchan.net/index.php?board=16.0">http://forums.lesterchan.net/index.php?board=16.0</a>
263
+ </p>
264
+ <p>
265
+ <strong>Updated:</strong><br />
266
+ <strong>&raquo;</strong> 1st June 2007
267
+ </p>
268
+ <p>
269
+ <strong>Note:</strong><br />
270
+ <strong>&raquo;</strong> The <strong>Changelog</strong>, <strong>Installation</strong>, <strong>Upgrade</strong>, <strong>Usage</strong> Tab at the top of the page.
271
+ </p>
272
+ <p>
273
+ <strong>Donations:</strong><br />
274
+ <strong>&raquo;</strong> I spent most of my free time creating, updating, maintaining and supporting these plugins, if you really love my plugins and could spare me a couple of bucks as my school allowance, I will really appericiate it. If not feel free to use it without any obligations. Thank You. My Paypal account is
275
+ <script type="text/javascript">
276
+ /* <![CDATA[*/
277
+ document.write(' <strong>gamerz84@hotmail.com</strong>.');
278
+ /* ]]> */
279
+ </script>
280
+ </p>
281
+ </div>
282
+
283
+ <!-- Changelog -->
284
+ <div id="Changelog" style="display: none;">
285
+ <div class="SubTitle">&raquo; Changelog</div>
286
+ <ul>
287
+ <li>
288
+ <strong>Version 1.11 (01-06-2007)</strong>
289
+ <ul>
290
+ <li>FIXED: Wrong URL For Page Under Most Viewed Posts Listing</li>
291
+ </ul>
292
+ </li>
293
+ <li>
294
+ <strong>Version 1.10 (01-02-2007)</strong>
295
+ <ul>
296
+ <li>NEW: Works For WordPress 2.1 Only</li>
297
+ <li>NEW: Localization WP-PostViews</li>
298
+ <li>NEW: Added Function To Get Most Viewed Post By Category ID</li>
299
+ <li>FIXED: Views Not Counting In Some Cases</li>
300
+ </ul>
301
+ </li>
302
+ <li>
303
+ <strong>Version 1.02 (01-10-2006)</strong>
304
+ <ul>
305
+ <li>NEW: Change In get_most_viewed() To Accommodate Latest Version Of WP-Stats</li>
306
+ </ul>
307
+ </li>
308
+ <li>
309
+ <strong>Version 1.01 (01-07-2006)</strong>
310
+ <ul>
311
+ <li>NEW: Added Get Total Views Function</li>
312
+ <li>FIXED: Modified Get Most Viewed Post Function</li>
313
+ </ul>
314
+ </li>
315
+ <li>
316
+ <strong>Version 1.00 (01-03-2006)</strong>
317
+ <ul>
318
+ <li>NEW: Initial Release</li>
319
+ </ul>
320
+ </li>
321
+ </ul>
322
+ </div>
323
+
324
+ <!-- Installation Instructions -->
325
+ <div id="Install" style="display: none;">
326
+ <div class="SubTitle">&raquo; Installation Instructions</div>
327
+ <ol>
328
+ <li>
329
+ Open <strong>wp-content/plugins</strong> Folder
330
+ </li>
331
+ <li>
332
+ Put:
333
+ <blockquote>Folder: postviews</blockquote>
334
+ </li>
335
+ <li>
336
+ <strong>Activate</strong> WP-PostViews Plugin
337
+ </li>
338
+ <li>
339
+ Refer To <strong>Usage</strong> For Further Instructions
340
+ </li>
341
+ </ol>
342
+ </div>
343
+
344
+ <!-- Upgrade Instructions -->
345
+ <div id="Upgrade" style="display: none;">
346
+ <div class="SubTitle">&raquo; Upgrade Instructions</div>
347
+ <div class="SubSubTitle">From v1.0x To v1.11</div>
348
+ <ol>
349
+ <li>
350
+ <strong>Deactivate</strong> WP-PostViews Plugin
351
+ </li>
352
+ <li>
353
+ Open <strong>wp-content/plugins</strong> Folder
354
+ </li>
355
+ <li>
356
+ Put/Overwrite:
357
+ <blockquote>Folder: postviews</blockquote>
358
+ </li>
359
+ <li>
360
+ Delete:
361
+ <blockquote>File: postviews.php</blockquote>
362
+ </li>
363
+ <li>
364
+ <strong>Activate</strong> WP-PostViews Plugin
365
+ </li>
366
+ <li>
367
+ Refer To <strong>Usage</strong> For Further Instructions
368
+ </li>
369
+ </ol>
370
+ </div>
371
+
372
+ <!-- Usage Instructions -->
373
+ <div id="Usage" style="display: none;">
374
+ <div class="SubTitle">&raquo; Usage Instructions</div>
375
+ <div class="SubSubTitle">General Usage</div>
376
+ <ol>
377
+ <li>
378
+ Open <strong>wp-content/themes/&lt;YOUR THEME NAME&gt;/index.php</strong>
379
+ <p>You may place it in <strong>single.php</strong>, <strong>post.php</strong> or <strong>page.php</strong> also.</p>
380
+ </li>
381
+ <li>
382
+ Find:
383
+ <blockquote>
384
+ &lt;?php while (have_posts()) : the_post(); ?&gt;
385
+ </blockquote>
386
+ </li>
387
+ <li>
388
+ Add Anywhere Below It:
389
+ <blockquote>
390
+ &lt;?php if(function_exists('the_views')) { the_views(); } ?&gt;
391
+ </blockquote>
392
+ <p>The <strong>first value</strong> you pass in is the text for views.</p>
393
+ <p>Default: the_views('Views');</p>
394
+ </li>
395
+ </ol>
396
+ <div class="SubSubTitle">View Stats (Outside WP Loop)</div>
397
+ <ul>
398
+ <li>
399
+ To Display <strong>Most Viewed Post</strong>
400
+ </li>
401
+ <li>
402
+ Use:
403
+ <blockquote>
404
+ &lt;?php if (function_exists('get_most_viewed')): ?&gt;<br />
405
+ &nbsp;&nbsp;&nbsp;&lt;?php get_most_viewed(); ?&gt;<br />
406
+ &lt;?php endif; ?&gt;
407
+ </blockquote>
408
+ <p>
409
+ The <strong>first value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
410
+ The <strong>second value</strong> you pass in is the maximum number of post you want to get.
411
+ </p>
412
+ <p>Default: get_most_viewed('both', 10);</p>
413
+ </li>
414
+ <li>
415
+ To Display <strong>Most Viewed Post For A Category</strong>
416
+ </li>
417
+ <li>
418
+ Use:
419
+ <blockquote>
420
+ &lt;?php if (function_exists('get_most_viewed_category')): ?&gt;<br />
421
+ &nbsp;&nbsp;&nbsp;&lt;?php get_most_viewed_category(); ?&gt;<br />
422
+ &lt;?php endif; ?&gt;
423
+ </blockquote>
424
+ <p>
425
+ The <strong>first value</strong> you pass in is the category id.<br />
426
+ The <strong>second value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
427
+ The <strong>third value</strong> you pass in is the maximum number of post you want to get.</p>
428
+ <p>Default: get_most_viewed_category(1, 'both', 10);</p>
429
+ </li>
430
+ </ul>
431
+ </div>
432
+ </div>
433
+ </div>
434
+ <p id="Copyright">WP-PostViews 1.11<br />Copyright &copy; 2007 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
435
+ </body>
436
+ </html>
readme.txt CHANGED
@@ -1,14 +1,31 @@
1
- -> Post Views Plugin For WordPress 2.0
2
- --------------------------------------------------
3
- Author -> Lester 'GaMerZ' Chan
4
- Email -> gamerz84@hotmail.com
5
- Website -> http://www.lesterchan.net/
6
- Demo -> http://www.lesterchan.net/wordpress/
7
- Documentation -> http://dev.wp-plugins.org/wiki/wp-postviews
8
- Development -> http://dev.wp-plugins.org/browser/wp-postviews/
9
- Updated -> 1st March 2006
10
- --------------------------------------------------
11
-
12
-
13
- // Version 1.00 (01-03-2006)
14
- - NEW: Initial Release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP-PostViews ===
2
+ Contributors: GamerZ
3
+ Donate link: http://www.lesterchan.net/wordpress
4
+ Tags: views, hits, counter, postviews
5
+ Requires at least: 2.1.0
6
+ Stable tag: 1.11
7
+
8
+ Enables you to display how many times a post/page had been viewed.
9
+
10
+ == Description ==
11
+
12
+ It will not count registered member views, but that can be changed easily.
13
+
14
+ All the information (general, changelog, installation, upgrade, usage) you need about this plugin can be found here: [WP-PostViews Readme](http://www.lesterchan.net/wordpress/readme/wp-postviews.html "WP-PostViews Readme").
15
+ It is the exact same readme.html is included in the zip package.
16
+
17
+ == Development Blog ==
18
+
19
+ [GaMerZ WordPress Plugins Development Blog](http://www.lesterchan.net/wordpress/ "GaMerZ WordPress Plugins Development Blog")
20
+
21
+ == Installation ==
22
+
23
+ [WP-PostViews Readme](http://www.lesterchan.net/wordpress/readme/wp-postviews.html "WP-PostViews Readme") (Installation Tab)
24
+
25
+ == Screenshots ==
26
+
27
+ [GaMerZ WordPress Plugins Screenshots](http://www.lesterchan.net/wordpress/screenshots/ "GaMerZ WordPress Plugins Screenshots")
28
+
29
+ == Frequently Asked Questions ==
30
+
31
+ You will need [GaMerZ WordPress Plugins Support Forums](http://forums.lesterchan.net/ "GaMerZ WordPress Plugins Support Forums")