WP-PostViews - Version 1.66

Version Description

N/A

Download this release

Release Info

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

Code changes from version 1.50 to 1.66

Files changed (9) hide show
  1. postviews-cache.js +1 -0
  2. postviews-options.php +181 -309
  3. readme.html +0 -598
  4. readme.txt +252 -29
  5. screenshot-1.png +0 -0
  6. uninstall.php +35 -0
  7. wp-postviews.mo +0 -0
  8. wp-postviews.php +932 -789
  9. wp-postviews.pot +87 -94
postviews-cache.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery.ajax({type:"GET",url:viewsCacheL10n.admin_ajax_url,data:"postviews_id="+viewsCacheL10n.post_id+"&action=postviews",cache:!1});
postviews-options.php CHANGED
@@ -1,309 +1,181 @@
1
- <?php
2
- /*
3
- +----------------------------------------------------------------+
4
- | |
5
- | WordPress 2.7 Plugin: WP-PostViews 1.50 |
6
- | Copyright (c) 2009 Lester "GaMerZ" Chan |
7
- | |
8
- | File Written By: |
9
- | - Lester "GaMerZ" Chan |
10
- | - http://lesterchan.net |
11
- | |
12
- | File Information: |
13
- | - Post Views Options Page |
14
- | - wp-content/plugins/wp-postviews/postviews-options.php |
15
- | |
16
- +----------------------------------------------------------------+
17
- */
18
-
19
-
20
- ### Variables Variables Variables
21
- $base_name = plugin_basename('wp-postviews/postviews-options.php');
22
- $base_page = 'admin.php?page='.$base_name;
23
- $id = intval($_GET['id']);
24
- $mode = trim($_GET['mode']);
25
- $views_settings = array('views_options', 'widget_views_most_viewed', 'widget_views');
26
- $views_postmetas = array('views');
27
-
28
-
29
- ### Form Processing
30
- // Update Options
31
- if(!empty($_POST['Submit'])) {
32
- $views_options = array();
33
- $views_options['count'] = intval($_POST['views_count']);
34
- $views_options['exclude_bots'] = intval($_POST['views_exclude_bots']);
35
- $views_options['display_home'] = intval($_POST['views_display_home']);
36
- $views_options['display_single'] = intval($_POST['views_display_single']);
37
- $views_options['display_page'] = intval($_POST['views_display_page']);
38
- $views_options['display_archive'] = intval($_POST['views_display_archive']);
39
- $views_options['display_search'] = intval($_POST['views_display_search']);
40
- $views_options['display_other'] = intval($_POST['views_display_other']);
41
- $views_options['template'] = trim($_POST['views_template_template']);
42
- $views_options['most_viewed_template'] = trim($_POST['views_template_most_viewed']);
43
- $update_views_queries = array();
44
- $update_views_text = array();
45
- $update_views_queries[] = update_option('views_options', $views_options);
46
- $update_views_text[] = __('Post Views Options', 'wp-postviews');
47
- $i=0;
48
- $text = '';
49
- foreach($update_views_queries as $update_views_query) {
50
- if($update_views_query) {
51
- $text .= '<font color="green">'.$update_views_text[$i].' '.__('Updated', 'wp-postviews').'</font><br />';
52
- }
53
- $i++;
54
- }
55
- if(empty($text)) {
56
- $text = '<font color="red">'.__('No Post Views Option Updated', 'wp-postviews').'</font>';
57
- }
58
- }
59
- // Decide What To Do
60
- if(!empty($_POST['do'])) {
61
- // Uninstall WP-PostViews
62
- switch($_POST['do']) {
63
- case __('UNINSTALL WP-PostViews', 'wp-postviews') :
64
- if(trim($_POST['uninstall_views_yes']) == 'yes') {
65
- echo '<div id="message" class="updated fade">';
66
- echo '<p>';
67
- foreach($views_settings as $setting) {
68
- $delete_setting = delete_option($setting);
69
- if($delete_setting) {
70
- echo '<font color="green">';
71
- printf(__('Setting Key \'%s\' has been deleted.', 'wp-postviews'), "<strong><em>{$setting}</em></strong>");
72
- echo '</font><br />';
73
- } else {
74
- echo '<font color="red">';
75
- printf(__('Error deleting Setting Key \'%s\'.', 'wp-postviews'), "<strong><em>{$setting}</em></strong>");
76
- echo '</font><br />';
77
- }
78
- }
79
- echo '</p>';
80
- echo '<p>';
81
- foreach($views_postmetas as $postmeta) {
82
- $remove_postmeta = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE meta_key = '$postmeta'");
83
- if($remove_postmeta) {
84
- echo '<font color="green">';
85
- printf(__('Post Meta Key \'%s\' has been deleted.', 'wp-postviews'), "<strong><em>{$postmeta}</em></strong>");
86
- echo '</font><br />';
87
- } else {
88
- echo '<font color="red">';
89
- printf(__('Error deleting Post Meta Key \'%s\'.', 'wp-postviews'), "<strong><em>{$postmeta}</em></strong>");
90
- echo '</font><br />';
91
- }
92
- }
93
- echo '</p>';
94
- echo '</div>';
95
- $mode = 'end-UNINSTALL';
96
- }
97
- break;
98
- }
99
- }
100
-
101
-
102
- ### Determines Which Mode It Is
103
- switch($mode) {
104
- // Deactivating WP-PostViews
105
- case 'end-UNINSTALL':
106
- $deactivate_url = 'plugins.php?action=deactivate&amp;plugin=wp-postviews/wp-postviews.php';
107
- if(function_exists('wp_nonce_url')) {
108
- $deactivate_url = wp_nonce_url($deactivate_url, 'deactivate-plugin_wp-postviews/wp-postviews.php');
109
- }
110
- echo '<div class="wrap">';
111
- echo '<h2>'.__('Uninstall WP-PostViews', 'wp-postviews').'</h2>';
112
- echo '<p><strong>'.sprintf(__('<a href="%s">Click Here</a> To Finish The Uninstallation And WP-PostViews Will Be Deactivated Automatically.', 'wp-postviews'), $deactivate_url).'</strong></p>';
113
- echo '</div>';
114
- break;
115
- // Main Page
116
- default:
117
- $views_options = get_option('views_options');
118
- ?>
119
- <script type="text/javascript">
120
- /* <![CDATA[*/
121
- function views_default_templates(template) {
122
- var default_template;
123
- switch(template) {
124
- case 'template':
125
- default_template = "<?php _e('%VIEW_COUNT% views', 'wp-postviews'); ?>";
126
- break;
127
- case 'most_viewed':
128
- default_template = "<li><a href=\"%POST_URL%\" title=\"%POST_TITLE%\">%POST_TITLE%</a> - %VIEW_COUNT% <?php _e('views', 'wp-postviews'); ?></li>";
129
- break;
130
- }
131
- jQuery("#views_template_" + template).val(default_template);
132
- }
133
- /* ]]> */
134
- </script>
135
- <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
136
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
137
- <div class="wrap">
138
- <?php screen_icon(); ?>
139
- <h2><?php _e('Post Views Options', 'wp-postviews'); ?></h2>
140
- <table class="form-table">
141
- <tr>
142
- <td valign="top" width="30%"><strong><?php _e('Count Views From:', 'wp-postviews'); ?></strong></td>
143
- <td valign="top">
144
- <select name="views_count" size="1">
145
- <option value="0"<?php selected('0', $views_options['count']); ?>><?php _e('Everyone', 'wp-postviews'); ?></option>
146
- <option value="1"<?php selected('1', $views_options['count']); ?>><?php _e('Guests Only', 'wp-postviews'); ?></option>
147
- <option value="2"<?php selected('2', $views_options['count']); ?>><?php _e('Registered Users Only', 'wp-postviews'); ?></option>
148
- </select>
149
- </td>
150
- </tr>
151
- <tr>
152
- <td valign="top" width="30%"><strong><?php _e('Exclude Bot Views:', 'wp-postviews'); ?></strong></td>
153
- <td valign="top">
154
- <select name="views_exclude_bots" size="1">
155
- <option value="0"<?php selected('0', $views_options['exclude_bots']); ?>><?php _e('No', 'wp-postviews'); ?></option>
156
- <option value="1"<?php selected('1', $views_options['exclude_bots']); ?>><?php _e('Yes', 'wp-postviews'); ?></option>
157
- </select>
158
- </td>
159
- </tr>
160
- <tr>
161
- <td valign="top">
162
- <strong><?php _e('Views Template:', 'wp-postviews'); ?></strong><br /><br />
163
- <?php _e('Allowed Variables:', 'wp-postviews'); ?><br />
164
- - %VIEW_COUNT%<br /><br />
165
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-postviews'); ?>" onclick="views_default_templates('template');" class="button" />
166
- </td>
167
- <td valign="top">
168
- <input type="text" id="views_template_template" name="views_template_template" size="70" value="<?php echo htmlspecialchars(stripslashes($views_options['template'])); ?>" />
169
- </td>
170
- </tr>
171
- <tr>
172
- <td valign="top">
173
- <strong><?php _e('Most Viewed Template:', 'wp-postviews'); ?></strong><br /><br />
174
- <?php _e('Allowed Variables:', 'wp-postviews'); ?><br />
175
- - %VIEW_COUNT%<br />
176
- - %POST_TITLE%<br />
177
- - %POST_EXCERPT%<br />
178
- - %POST_CONTENT%<br />
179
- - %POST_URL%<br /><br />
180
- <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-postviews'); ?>" onclick="views_default_templates('most_viewed');" class="button" />
181
- </td>
182
- <td valign="top">
183
- <textarea cols="80" rows="15" id="views_template_most_viewed" name="views_template_most_viewed"><?php echo htmlspecialchars(stripslashes($views_options['most_viewed_template'])); ?></textarea>
184
- </td>
185
- </tr>
186
- </table>
187
- <h3><?php _e('Display Options', 'wp-postviews'); ?></h3>
188
- <p><?php _e('These options specify where the view counts should be displayed and to whom. By default view counts will be displayed to all visitors. Note that the theme files must contain a call to <code>the_views()</code> in order for any view count to be displayed.', 'wp-postviews'); ?></p>
189
- <table class="form-table">
190
- <tr>
191
- <td valign="top"><strong><?php _e('Home Page:', 'wp-postviews'); ?></strong></td>
192
- <td>
193
- <select name="views_display_home" size="1">
194
- <option value="0"<?php selected('0', $views_options['display_home']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
195
- <option value="1"<?php selected('1', $views_options['display_home']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
196
- <option value="2"<?php selected('2', $views_options['display_home']); ?>><?php _e('Don\'t display on home page', 'wp-postviews'); ?></option>
197
- </select>
198
- </td>
199
- </tr>
200
- <tr>
201
- <td valign="top"><strong><?php _e('Singe Posts:', 'wp-postviews'); ?></strong></td>
202
- <td>
203
- <select name="views_display_single" size="1">
204
- <option value="0"<?php selected('0', $views_options['display_single']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
205
- <option value="1"<?php selected('1', $views_options['display_single']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
206
- <option value="2"<?php selected('2', $views_options['display_single']); ?>><?php _e('Don\'t display on single posts', 'wp-postviews'); ?></option>
207
- </select>
208
- </td>
209
- </tr>
210
- <tr>
211
- <td valign="top"><strong><?php _e('Pages:', 'wp-postviews'); ?></strong></td>
212
- <td>
213
- <select name="views_display_page" size="1">
214
- <option value="0"<?php selected('0', $views_options['display_page']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
215
- <option value="1"<?php selected('1', $views_options['display_page']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
216
- <option value="2"<?php selected('2', $views_options['display_page']); ?>><?php _e('Don\'t display on pages', 'wp-postviews'); ?></option>
217
- </select>
218
- </td>
219
- </tr>
220
- <tr>
221
- <td valign="top"><strong><?php _e('Archive Pages:', 'wp-postviews'); ?></strong></td>
222
- <td>
223
- <select name="views_display_archive" size="1">
224
- <option value="0"<?php selected('0', $views_options['display_archive']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
225
- <option value="1"<?php selected('1', $views_options['display_archive']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
226
- <option value="2"<?php selected('2', $views_options['display_archive']); ?>><?php _e('Don\'t display on archive pages', 'wp-postviews'); ?></option>
227
- </select>
228
- </td>
229
- </tr>
230
- <tr>
231
- <td valign="top"><strong><?php _e('Search Pages:', 'wp-postviews'); ?></strong></td>
232
- <td>
233
- <select name="views_display_search" size="1">
234
- <option value="0"<?php selected('0', $views_options['display_search']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
235
- <option value="1"<?php selected('1', $views_options['display_search']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
236
- <option value="2"<?php selected('2', $views_options['display_search']); ?>><?php _e('Don\'t display on search pages', 'wp-postviews'); ?></option>
237
- </select>
238
- </td>
239
- </tr>
240
- <tr>
241
- <td valign="top"><strong><?php _e('Other Pages:', 'wp-postviews'); ?></strong></td>
242
- <td>
243
- <select name="views_display_other" size="1">
244
- <option value="0"<?php selected('0', $views_options['display_other']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
245
- <option value="1"<?php selected('1', $views_options['display_other']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
246
- <option value="2"<?php selected('2', $views_options['display_other']); ?>><?php _e('Don\'t display on other pages', 'wp-postviews'); ?></option>
247
- </select>
248
- </td>
249
- </tr>
250
- </table>
251
- <p class="submit">
252
- <input type="submit" name="Submit" class="button" value="<?php _e('Save Changes', 'wp-postviews'); ?>" />
253
- </p>
254
- </div>
255
- </form>
256
- <p>&nbsp;</p>
257
-
258
- <!-- Uninstall WP-PostViews -->
259
- <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>?page=<?php echo plugin_basename(__FILE__); ?>">
260
- <div class="wrap">
261
- <h3><?php _e('Uninstall WP-PostViews', 'wp-postviews'); ?></h3>
262
- <p>
263
- <?php _e('Deactivating WP-PostViews plugin does not remove any data that may have been created, such as the views data. To completely remove this plugin, you can uninstall it here.', 'wp-postviews'); ?>
264
- </p>
265
- <p style="color: red">
266
- <strong><?php _e('WARNING:', 'wp-postviews'); ?></strong><br />
267
- <?php _e('Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first.', 'wp-postviews'); ?>
268
- </p>
269
- <p style="color: red">
270
- <strong><?php _e('The following WordPress Options/PostMetas will be DELETED:', 'wp-postviews'); ?></strong><br />
271
- </p>
272
- <table class="widefat">
273
- <thead>
274
- <tr>
275
- <th><?php _e('WordPress Options', 'wp-postviews'); ?></th>
276
- <th><?php _e('WordPress PostMetas', 'wp-postviews'); ?></th>
277
- </tr>
278
- </thead>
279
- <tr>
280
- <td valign="top">
281
- <ol>
282
- <?php
283
- foreach($views_settings as $settings) {
284
- echo '<li>'.$settings.'</li>'."\n";
285
- }
286
- ?>
287
- </ol>
288
- </td>
289
- <td valign="top" class="alternate">
290
- <ol>
291
- <?php
292
- foreach($views_postmetas as $postmeta) {
293
- echo '<li>'.$postmeta.'</li>'."\n";
294
- }
295
- ?>
296
- </ol>
297
- </td>
298
- </tr>
299
- </table>
300
- <p>&nbsp;</p>
301
- <p style="text-align: center;">
302
- <input type="checkbox" name="uninstall_views_yes" value="yes" />&nbsp;<?php _e('Yes', 'wp-postviews'); ?><br /><br />
303
- <input type="submit" name="do" value="<?php _e('UNINSTALL WP-PostViews', 'wp-postviews'); ?>" class="button" onclick="return confirm('<?php _e('You Are About To Uninstall WP-PostViews From WordPress.\nThis Action Is Not Reversible.\n\n Choose [Cancel] To Stop, [OK] To Uninstall.', 'wp-postviews'); ?>')" />
304
- </p>
305
- </div>
306
- </form>
307
- <?php
308
- } // End switch($mode)
309
- ?>
1
+ <?php
2
+ ### Variables Variables Variables
3
+ $base_name = plugin_basename('wp-postviews/postviews-options.php');
4
+ $base_page = 'admin.php?page='.$base_name;
5
+ $id = (isset($_GET['id']) ? intval($_GET['id']) : 0);
6
+ $mode = (isset($_GET['mode']) ? trim($_GET['mode']) : '');
7
+ $text = '';
8
+
9
+ ### Form Processing
10
+ if(!empty($_POST['Submit'])) {
11
+ check_admin_referer('wp-postviews_options');
12
+ $views_options = array();
13
+ $views_options['count'] = intval($_POST['views_count']);
14
+ $views_options['exclude_bots'] = intval($_POST['views_exclude_bots']);
15
+ $views_options['display_home'] = intval($_POST['views_display_home']);
16
+ $views_options['display_single'] = intval($_POST['views_display_single']);
17
+ $views_options['display_page'] = intval($_POST['views_display_page']);
18
+ $views_options['display_archive'] = intval($_POST['views_display_archive']);
19
+ $views_options['display_search'] = intval($_POST['views_display_search']);
20
+ $views_options['display_other'] = intval($_POST['views_display_other']);
21
+ $views_options['template'] = trim($_POST['views_template_template']);
22
+ $views_options['most_viewed_template'] = trim($_POST['views_template_most_viewed']);
23
+ $update_views_queries = array();
24
+ $update_views_text = array();
25
+ $update_views_queries[] = update_option('views_options', $views_options);
26
+ $update_views_text[] = __('Post Views Options', 'wp-postviews');
27
+ $i = 0;
28
+
29
+ foreach($update_views_queries as $update_views_query) {
30
+ if($update_views_query) {
31
+ $text .= '<font color="green">'.$update_views_text[$i].' '.__('Updated', 'wp-postviews').'</font><br />';
32
+ }
33
+ $i++;
34
+ }
35
+ if(empty($text)) {
36
+ $text = '<font color="red">'.__('No Post Views Option Updated', 'wp-postviews').'</font>';
37
+ }
38
+ }
39
+
40
+ $views_options = get_option('views_options');
41
+ ?>
42
+ <script type="text/javascript">
43
+ /* <![CDATA[*/
44
+ function views_default_templates(template) {
45
+ var default_template;
46
+ switch(template) {
47
+ case 'template':
48
+ default_template = "<?php _e('%VIEW_COUNT% views', 'wp-postviews'); ?>";
49
+ break;
50
+ case 'most_viewed':
51
+ default_template = "<li><a href=\"%POST_URL%\" title=\"%POST_TITLE%\">%POST_TITLE%</a> - %VIEW_COUNT% <?php _e('views', 'wp-postviews'); ?></li>";
52
+ break;
53
+ }
54
+ jQuery("#views_template_" + template).val(default_template);
55
+ }
56
+ /* ]]> */
57
+ </script>
58
+ <?php if(!empty($text)) { echo '<!-- Last Action --><div id="message" class="updated fade"><p>'.$text.'</p></div>'; } ?>
59
+ <form method="post" action="<?php echo admin_url('admin.php?page='.plugin_basename(__FILE__)); ?>">
60
+ <?php wp_nonce_field('wp-postviews_options'); ?>
61
+ <div class="wrap">
62
+ <?php screen_icon(); ?>
63
+ <h2><?php _e('Post Views Options', 'wp-postviews'); ?></h2>
64
+ <table class="form-table">
65
+ <tr>
66
+ <td valign="top" width="30%"><strong><?php _e('Count Views From:', 'wp-postviews'); ?></strong></td>
67
+ <td valign="top">
68
+ <select name="views_count" size="1">
69
+ <option value="0"<?php selected('0', $views_options['count']); ?>><?php _e('Everyone', 'wp-postviews'); ?></option>
70
+ <option value="1"<?php selected('1', $views_options['count']); ?>><?php _e('Guests Only', 'wp-postviews'); ?></option>
71
+ <option value="2"<?php selected('2', $views_options['count']); ?>><?php _e('Registered Users Only', 'wp-postviews'); ?></option>
72
+ </select>
73
+ </td>
74
+ </tr>
75
+ <tr>
76
+ <td valign="top" width="30%"><strong><?php _e('Exclude Bot Views:', 'wp-postviews'); ?></strong></td>
77
+ <td valign="top">
78
+ <select name="views_exclude_bots" size="1">
79
+ <option value="0"<?php selected('0', $views_options['exclude_bots']); ?>><?php _e('No', 'wp-postviews'); ?></option>
80
+ <option value="1"<?php selected('1', $views_options['exclude_bots']); ?>><?php _e('Yes', 'wp-postviews'); ?></option>
81
+ </select>
82
+ </td>
83
+ </tr>
84
+ <tr>
85
+ <td valign="top">
86
+ <strong><?php _e('Views Template:', 'wp-postviews'); ?></strong><br /><br />
87
+ <?php _e('Allowed Variables:', 'wp-postviews'); ?><br />
88
+ - %VIEW_COUNT%<br /><br />
89
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-postviews'); ?>" onclick="views_default_templates('template');" class="button" />
90
+ </td>
91
+ <td valign="top">
92
+ <input type="text" id="views_template_template" name="views_template_template" size="70" value="<?php echo htmlspecialchars(stripslashes($views_options['template'])); ?>" />
93
+ </td>
94
+ </tr>
95
+ <tr>
96
+ <td valign="top">
97
+ <strong><?php _e('Most Viewed Template:', 'wp-postviews'); ?></strong><br /><br />
98
+ <?php _e('Allowed Variables:', 'wp-postviews'); ?><br />
99
+ - %VIEW_COUNT%<br />
100
+ - %POST_TITLE%<br />
101
+ - %POST_DATE%<br />
102
+ - %POST_TIME%<br />
103
+ - %POST_EXCERPT%<br />
104
+ - %POST_CONTENT%<br />
105
+ - %POST_URL%<br /><br />
106
+ <input type="button" name="RestoreDefault" value="<?php _e('Restore Default Template', 'wp-postviews'); ?>" onclick="views_default_templates('most_viewed');" class="button" />
107
+ </td>
108
+ <td valign="top">
109
+ <textarea cols="80" rows="15" id="views_template_most_viewed" name="views_template_most_viewed"><?php echo htmlspecialchars(stripslashes($views_options['most_viewed_template'])); ?></textarea>
110
+ </td>
111
+ </tr>
112
+ </table>
113
+ <h3><?php _e('Display Options', 'wp-postviews'); ?></h3>
114
+ <p><?php _e('These options specify where the view counts should be displayed and to whom. By default view counts will be displayed to all visitors. Note that the theme files must contain a call to <code>the_views()</code> in order for any view count to be displayed.', 'wp-postviews'); ?></p>
115
+ <table class="form-table">
116
+ <tr>
117
+ <td valign="top"><strong><?php _e('Home Page:', 'wp-postviews'); ?></strong></td>
118
+ <td>
119
+ <select name="views_display_home" size="1">
120
+ <option value="0"<?php selected('0', $views_options['display_home']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
121
+ <option value="1"<?php selected('1', $views_options['display_home']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
122
+ <option value="2"<?php selected('2', $views_options['display_home']); ?>><?php _e('Don\'t display on home page', 'wp-postviews'); ?></option>
123
+ </select>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td valign="top"><strong><?php _e('Singe Posts:', 'wp-postviews'); ?></strong></td>
128
+ <td>
129
+ <select name="views_display_single" size="1">
130
+ <option value="0"<?php selected('0', $views_options['display_single']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
131
+ <option value="1"<?php selected('1', $views_options['display_single']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
132
+ <option value="2"<?php selected('2', $views_options['display_single']); ?>><?php _e('Don\'t display on single posts', 'wp-postviews'); ?></option>
133
+ </select>
134
+ </td>
135
+ </tr>
136
+ <tr>
137
+ <td valign="top"><strong><?php _e('Pages:', 'wp-postviews'); ?></strong></td>
138
+ <td>
139
+ <select name="views_display_page" size="1">
140
+ <option value="0"<?php selected('0', $views_options['display_page']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
141
+ <option value="1"<?php selected('1', $views_options['display_page']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
142
+ <option value="2"<?php selected('2', $views_options['display_page']); ?>><?php _e('Don\'t display on pages', 'wp-postviews'); ?></option>
143
+ </select>
144
+ </td>
145
+ </tr>
146
+ <tr>
147
+ <td valign="top"><strong><?php _e('Archive Pages:', 'wp-postviews'); ?></strong></td>
148
+ <td>
149
+ <select name="views_display_archive" size="1">
150
+ <option value="0"<?php selected('0', $views_options['display_archive']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
151
+ <option value="1"<?php selected('1', $views_options['display_archive']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
152
+ <option value="2"<?php selected('2', $views_options['display_archive']); ?>><?php _e('Don\'t display on archive pages', 'wp-postviews'); ?></option>
153
+ </select>
154
+ </td>
155
+ </tr>
156
+ <tr>
157
+ <td valign="top"><strong><?php _e('Search Pages:', 'wp-postviews'); ?></strong></td>
158
+ <td>
159
+ <select name="views_display_search" size="1">
160
+ <option value="0"<?php selected('0', $views_options['display_search']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
161
+ <option value="1"<?php selected('1', $views_options['display_search']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
162
+ <option value="2"<?php selected('2', $views_options['display_search']); ?>><?php _e('Don\'t display on search pages', 'wp-postviews'); ?></option>
163
+ </select>
164
+ </td>
165
+ </tr>
166
+ <tr>
167
+ <td valign="top"><strong><?php _e('Other Pages:', 'wp-postviews'); ?></strong></td>
168
+ <td>
169
+ <select name="views_display_other" size="1">
170
+ <option value="0"<?php selected('0', $views_options['display_other']); ?>><?php _e('Display to everyone', 'wp-postviews'); ?></option>
171
+ <option value="1"<?php selected('1', $views_options['display_other']); ?>><?php _e('Display to registered users only', 'wp-postviews'); ?></option>
172
+ <option value="2"<?php selected('2', $views_options['display_other']); ?>><?php _e('Don\'t display on other pages', 'wp-postviews'); ?></option>
173
+ </select>
174
+ </td>
175
+ </tr>
176
+ </table>
177
+ <p class="submit">
178
+ <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes', 'wp-postviews'); ?>" />
179
+ </p>
180
+ </div>
181
+ </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.html DELETED
@@ -1,598 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
- <head>
4
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5
- <title>WP-PostViews 1.50 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.50&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>Website:</strong><br />
229
- <strong>&raquo;</strong> <a href="http://lesterchan.net/" title="http://lesterchan.net/">http://lesterchan.net/</a>
230
- </p>
231
- <p>
232
- <strong>Features:</strong><br />
233
- <strong>&raquo;</strong> Enables you to display how many times a post/page had been viewed.
234
- </p>
235
- <p>
236
- <strong>Download:</strong><br />
237
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-postviews.1.50.zip" title="http://downloads.wordpress.org/plugin/wp-postviews.1.50.zip">WP-PostViews 1.50 For WordPress 2.8.x</a><br />
238
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-postviews.1.40.zip" title="http://downloads.wordpress.org/plugin/wp-postviews.1.40.zip">WP-PostViews 1.40 For WordPress 2.7.x</a><br />
239
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-postviews.1.31.zip" title="http://downloads.wordpress.org/plugin/wp-postviews.1.31.zip">WP-PostViews 1.31 For WordPress 2.3.x, 2.5.x And 2.6.x</a><br />
240
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-postviews.1.11.zip" title="http://downloads.wordpress.org/plugin/wp-postviews.1.11.zip">WP-PostViews 1.11 For WordPress 2.1.x And 2.2.x</a><br />
241
- <strong>&raquo;</strong> <a href="http://downloads.wordpress.org/plugin/wp-postviews.1.02.zip" title="http://downloads.wordpress.org/plugin/wp-postviews.1.02.zip">WP-PostViews 1.02 For WordPress 2.0.x</a><br />
242
- </p>
243
- <p>
244
- <strong>Screenshots:</strong><br />
245
- <strong>&raquo;</strong> <a href="http://lesterchan.net/wordpress/screenshots/browse/wp-postviews/" title="http://lesterchan.net/wordpress/screenshots/browse/wp-postviews/">http://lesterchan.net/wordpress/screenshots/browse/wp-postviews/</a>
246
- </p>
247
- <p>
248
- <strong>Demo:</strong><br /><strong>&raquo;</strong> <a href="http://lesterchan.net/wordpress/" title="http://lesterchan.net/wordpress/">http://lesterchan.net/wordpress/</a>
249
- </p>
250
- <p>
251
- <strong>Development:</strong><br />
252
- <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>
253
- </p>
254
- <p>
255
- <strong>Translations:</strong><br />
256
- <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>
257
- </p>
258
- <p>
259
- <strong>Support Forums:</strong><br />
260
- <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>
261
- </p>
262
- <p>
263
- <strong>Credits:</strong><br />
264
- <strong>&raquo;</strong> WP-Cache/WP-SuperCache Compatibility By <a href="http://omninoggin.com/" title="Thaya Kareeson">Thaya Kareeson</a>.<br />
265
- <strong>&raquo;</strong> __ngetext() by <a href="http://hweia.ru/" title="Anna Ozeritskaya">Anna Ozeritskaya</a>.<br />
266
- <strong>&raquo;</strong> Right To Left Language Support by <a href="http://persian-programming.com/" title="Kambiz R. Khojasteh">Kambiz R. Khojasteh</a>.
267
- <strong>&raquo;</strong> Options To Display Views On Certain Places by <a href="http://dpotter.net/Technical/" title="David Potter">David Potter</a>.
268
- </p>
269
- <p>
270
- <strong>Note:</strong><br />
271
- <strong>&raquo;</strong> The <strong>Changelog</strong>, <strong>Installation</strong>, <strong>Upgrade</strong>, <strong>Usage</strong> Tab at the top of the page.
272
- </p>
273
- <p>
274
- <strong>Donations:</strong><br />
275
- <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
276
- <script type="text/javascript">
277
- /* <![CDATA[*/
278
- document.write(' <strong>lesterchan@gmail.com</strong>.');
279
- /* ]]> */
280
- </script>
281
- </p>
282
- </div>
283
-
284
- <!-- Changelog -->
285
- <div id="Changelog" style="display: none;">
286
- <div class="SubTitle">&raquo; Changelog</div>
287
- <ul>
288
- <li>
289
- <strong>Version 1.50 (01-06-2009)</strong>
290
- <ul>
291
- <li>NEW: Works For WordPress 2.8 Only</li>
292
- <li>NEW: Uses jQuery Framework</li>
293
- <li>NEW: Added In Most Viewed Pages To WP-Stats</li>
294
- <li>NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()</li>
295
- <li>FIXED: Uses $_SERVER['PHP_SELF'] With plugin_basename(__FILE__) Instead Of Just $_SERVER['REQUEST_URI']</li>
296
- <li>NEW: Uses New Widget Class From WordPress</li>
297
- <li>NEW: Merge Widget Code To wp-postviews.php And Remove wp-postviews-widget.php</li>
298
- <li>NEW: Added get_most_viewed_tag() And get_least_viewed_tag()</li>
299
- <li>FIXED: Ensure That Post Is Not A Revision</li>
300
- <li>FIXED: Multiple Loops Filtered Not Cleared</li>
301
- </ul>
302
- </li>
303
- <li>
304
- <strong>Version 1.40 (12-12-2008)</strong>
305
- <ul>
306
- <li>NEW: Works For WordPress 2.7 Only</li>
307
- <li>NEW: Options To Display Views On Certain Places by <a href="http://dpotter.net/Technical/" title="http://dpotter.net/Technical/">David Potter</a></li>
308
- <li>NEW: Right To Left Language Support by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
309
- <li>NEW: Output Of the_views() Applied To "the_views" Filter by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a>
310
- <li>NEW: Called postviews_textdomain() In views_init() by <a href="http://persian-programming.com/" title="http://persian-programming.com/">Kambiz R. Khojasteh</a></li>
311
- <li>NEW: Uses plugins_url() And site_url()</li>
312
- <li>NEW: Added get_least_viewed() And get_least_viewed_category() By <a href="http://foo.upc.es/blog/" title="http://foo.upc.es/blog/">JBrinx</li>
313
- <li>FIXED: "views" Custom Field Gets Created Now When Post Is Published</li>
314
- </ul>
315
- </li>
316
- <li>
317
- <strong>Version 1.31 (16-07-2008)</strong>
318
- <ul>
319
- <li>NEW: Works For WordPress 2.6</li>
320
- <li>NEW: Renamed GET Variables sortby To v_sortby And orderby To v_orderby</li>
321
- <li>NEW: Better Translation Using __ngetext() by <a href="http://hweia.ru/" title="http://hweia.ru/">Anna Ozeritskaya</a></li>
322
- <li>FIXED: Able To Use v_sortby And v_orderby in query_posts()</li>
323
- </ul>
324
- </li>
325
- <li>
326
- <strong>Version 1.30 (01-06-2008)</strong>
327
- <ul>
328
- <li>NEW: Uses /wp-postviews/ Folder Instead Of /postviews/</li>
329
- <li>NEW: Uses wp-postviews.php Instead Of postviews.php</li>
330
- <li>NEW: Uses wp-postviews-widget.php Instead Of postviews-widget.php</li>
331
- <li>NEW: Uses number_format_i18n() Instead Of number_format()</li>
332
- <li>NEW: Option To Exclude Bots Views In 'WP-Admin -> Settings -> Post Views'</li>
333
- <li>NEW: Added Most Viewed Template</li>
334
- <li>NEW: Change The Way WP-PostViews Count Views</li>
335
- <li>NEW: Should Work With WP-Cache Or WP-SuperCache</li>
336
- </ul>
337
- </li>
338
- <li>
339
- <strong>Version 1.20 (01-10-2007)</strong>
340
- <ul>
341
- <li>NEW: Works For WordPress 2.3 Only</li>
342
- <li>NEW: Most Viewed Widget Added</li>
343
- <li>NEW: Ability To Uninstall WP-PostViews</li>
344
- <li>NEW: Uses WP-Stats Filter To Add Stats Into WP-Stats Page</li>
345
- </ul>
346
- </li>
347
- <li>
348
- <strong>Version 1.11 (01-06-2007)</strong>
349
- <ul>
350
- <li>FIXED: Wrong URL For Page Under Most Viewed Posts Listing</li>
351
- </ul>
352
- </li>
353
- <li>
354
- <strong>Version 1.10 (01-02-2007)</strong>
355
- <ul>
356
- <li>NEW: Works For WordPress 2.1 Only</li>
357
- <li>NEW: Localization WP-PostViews</li>
358
- <li>NEW: Added Function To Get Most Viewed Post By Category ID</li>
359
- <li>FIXED: Views Not Counting In Some Cases</li>
360
- </ul>
361
- </li>
362
- <li>
363
- <strong>Version 1.02 (01-10-2006)</strong>
364
- <ul>
365
- <li>NEW: Change In get_most_viewed() To Accommodate Latest Version Of WP-Stats</li>
366
- </ul>
367
- </li>
368
- <li>
369
- <strong>Version 1.01 (01-07-2006)</strong>
370
- <ul>
371
- <li>NEW: Added Get Total Views Function</li>
372
- <li>FIXED: Modified Get Most Viewed Post Function</li>
373
- </ul>
374
- </li>
375
- <li>
376
- <strong>Version 1.00 (01-03-2006)</strong>
377
- <ul>
378
- <li>NEW: Initial Release</li>
379
- </ul>
380
- </li>
381
- </ul>
382
- </div>
383
-
384
- <!-- Installation Instructions -->
385
- <div id="Install" style="display: none;">
386
- <div class="SubTitle">&raquo; Installation Instructions</div>
387
- <ol>
388
- <li>
389
- Open <strong>wp-content/plugins</strong> Folder
390
- </li>
391
- <li>
392
- Put:
393
- <blockquote>Folder: wp-postviews</blockquote>
394
- </li>
395
- <li>
396
- <strong>Activate</strong> WP-PostViews Plugin
397
- </li>
398
- <li>
399
- Refer To <strong>Usage</strong> For Further Instructions
400
- </li>
401
- </ol>
402
- </div>
403
-
404
- <!-- Upgrade Instructions -->
405
- <div id="Upgrade" style="display: none;">
406
- <div class="SubTitle">&raquo; Upgrade Instructions</div>
407
- <div class="SubSubTitle">From v1.0x To v1.50</div>
408
- <ol>
409
- <li>
410
- <strong>Deactivate</strong> WP-PostViews Plugin
411
- </li>
412
- <li>
413
- Open <strong>wp-content/plugins</strong> Folder
414
- </li>
415
- <li>
416
- Put/Overwrite:
417
- <blockquote>Folder: wp-postviews</blockquote>
418
- </li>
419
- <li>
420
- Delete this folder if exists:
421
- <blockquote>
422
- Folder: postviews
423
- </blockquote>
424
- </li>
425
- <li>
426
- <strong>Activate</strong> WP-PostViews Plugin
427
- </li>
428
- <li>
429
- Refer To <strong>Usage</strong> For Further Instructions
430
- </li>
431
- </ol>
432
- </div>
433
-
434
- <!-- Usage Instructions -->
435
- <div id="Usage" style="display: none;">
436
- <div class="SubTitle">&raquo; Usage Instructions</div>
437
- <div class="SubSubTitle">General Usage</div>
438
- <ol>
439
- <li>
440
- Open <strong>wp-content/themes/&lt;YOUR THEME NAME&gt;/index.php</strong>
441
- <p>You may place it in <strong>archive.php</strong>, <strong>single.php</strong>, <strong>post.php</strong> or <strong>page.php</strong> also.</p>
442
- </li>
443
- <li>
444
- Find:
445
- <blockquote>
446
- &lt;?php while (have_posts()) : the_post(); ?&gt;
447
- </blockquote>
448
- </li>
449
- <li>
450
- Add Anywhere Below It:
451
- <blockquote>
452
- &lt;?php if(function_exists('the_views')) { the_views(); } ?&gt;
453
- </blockquote>
454
- </li>
455
- <li>
456
- Go to <strong>'WP-Admin -> Settings -> PostViews'</strong> to configure the plugin.
457
- </li>
458
- </ol>
459
- <div class="SubSubTitle">View Stats (With Widgets)</div>
460
- <ol>
461
- <li>
462
- Go to '<strong>WP-Admin -> Appearance -> Widgets</strong>'
463
- </li>
464
- <li>
465
- The widget name is <strong>Views</strong>.
466
- </li>
467
- </ol>
468
- <div class="SubSubTitle">View Stats (Outside WP Loop)</div>
469
- <ul>
470
- <li>
471
- To Display <strong>Least Viewed Posts</strong>
472
- </li>
473
- <li>
474
- Use:
475
- <blockquote>
476
- &lt;?php if (function_exists('get_least_viewed')): ?&gt;<br />
477
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
478
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_least_viewed(); ?&gt;<br />
479
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
480
- &lt;?php endif; ?&gt;
481
- </blockquote>
482
- <p>
483
- The <strong>first value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
484
- The <strong>second value</strong> you pass in is the maximum number of post you want to get.
485
- </p>
486
- <p>Default: get_least_viewed('both', 10);</p>
487
- </li>
488
- <li>
489
- To Display <strong>Most Viewed Posts</strong>
490
- </li>
491
- <li>
492
- Use:
493
- <blockquote>
494
- &lt;?php if (function_exists('get_most_viewed')): ?&gt;<br />
495
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
496
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_most_viewed(); ?&gt;<br />
497
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
498
- &lt;?php endif; ?&gt;
499
- </blockquote>
500
- <p>
501
- The <strong>first value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
502
- The <strong>second value</strong> you pass in is the maximum number of post you want to get.
503
- </p>
504
- <p>Default: get_most_viewed('both', 10);</p>
505
- </li>
506
- <li>
507
- To Display <strong>Least Viewed Posts By Tag</strong>
508
- </li>
509
- <li>
510
- Use:
511
- <blockquote>
512
- &lt;?php if (function_exists('get_least_viewed_tag')): ?&gt;<br />
513
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
514
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_least_viewed_tag(); ?&gt;<br />
515
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
516
- &lt;?php endif; ?&gt;
517
- </blockquote>
518
- <p>
519
- The <strong>first value</strong> you pass in is the tag id.<br />
520
- The <strong>second value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
521
- The <strong>third value</strong> you pass in is the maximum number of post you want to get.</p>
522
- <p>Default: get_least_viewed_tag(1, 'both', 10);</p>
523
- </li>
524
- <li>
525
- To Display <strong>Most Viewed Posts By Tag</strong>
526
- </li>
527
- <li>
528
- Use:
529
- <blockquote>
530
- &lt;?php if (function_exists('get_most_viewed_tag')): ?&gt;<br />
531
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
532
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_most_viewed_tag(); ?&gt;<br />
533
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
534
- &lt;?php endif; ?&gt;
535
- </blockquote>
536
- <p>
537
- The <strong>first value</strong> you pass in is the tag id.<br />
538
- The <strong>second value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
539
- The <strong>third value</strong> you pass in is the maximum number of post you want to get.</p>
540
- <p>Default: get_most_viewed_tag(1, 'both', 10);</p>
541
- </li>
542
- <li>
543
- To Display <strong>Least Viewed Posts For A Category</strong>
544
- </li>
545
- <li>
546
- Use:
547
- <blockquote>
548
- &lt;?php if (function_exists('get_least_viewed_category')): ?&gt;<br />
549
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
550
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_least_viewed_category(); ?&gt;<br />
551
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
552
- &lt;?php endif; ?&gt;
553
- </blockquote>
554
- <p>
555
- The <strong>first value</strong> you pass in is the category id.<br />
556
- The <strong>second value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
557
- The <strong>third value</strong> you pass in is the maximum number of post you want to get.</p>
558
- <p>Default: get_least_viewed_category(1, 'both', 10);</p>
559
- </li>
560
- <li>
561
- To Display <strong>Most Viewed Posts For A Category</strong>
562
- </li>
563
- <li>
564
- Use:
565
- <blockquote>
566
- &lt;?php if (function_exists('get_most_viewed_category')): ?&gt;<br />
567
- &nbsp;&nbsp;&nbsp;&lt;ul&gt;<br />
568
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;?php get_most_viewed_category(); ?&gt;<br />
569
- &nbsp;&nbsp;&nbsp;&lt;/ul&gt;<br />
570
- &lt;?php endif; ?&gt;
571
- </blockquote>
572
- <p>
573
- The <strong>first value</strong> you pass in is the category id.<br />
574
- The <strong>second value</strong> you pass in is what you want to get, 'post', 'page' or 'both'.<br />
575
- The <strong>third value</strong> you pass in is the maximum number of post you want to get.</p>
576
- <p>Default: get_most_viewed_category(1, 'both', 10);</p>
577
- </li>
578
- <li>
579
- To Sort <strong>Most/Least Viewed Posts</strong>
580
- </li>
581
- <li>
582
- You can use:
583
- <blockquote>
584
- &lt;?php query_posts('v_sortby=views&amp;v_orderby=desc') ?&gt;
585
- </blockquote>
586
- <p>Or pass in the variables to the URL:</p>
587
- <blockquote>
588
- http://yoursite.com/?v_sortby=views&amp;v_orderby=desc
589
- </blockquote>
590
- <p>You can replace <strong>desc</strong> with <strong>asc</strong> if you want the least viewed posts.</p>
591
- </li>
592
- </ul>
593
- </div>
594
- </div>
595
- </div>
596
- <p id="Copyright">WP-PostViews 1.50<br />Copyright &copy; 2009 Lester 'GaMerZ' Chan. All Rights Reserved.</p>
597
- </body>
598
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -1,29 +1,252 @@
1
- === WP-PostViews ===
2
- Contributors: GamerZ
3
- Donate link: http://lesterchan.net/wordpress
4
- Tags: views, hits, counter, postviews
5
- Requires at least: 2.8
6
- Stable tag: 1.50
7
-
8
- Enables you to display how many times a post/page had been viewed.
9
-
10
- == Description ==
11
-
12
- All the information (general, changelog, installation, upgrade, usage) you need about this plugin can be found here: [WP-PostViews Readme](http://lesterchan.net/wordpress/readme/wp-postviews.html "WP-PostViews Readme").
13
- It is the exact same readme.html is included in the zip package.
14
-
15
- == Development Blog ==
16
-
17
- [GaMerZ WordPress Plugins Development Blog](http://lesterchan.net/wordpress/ "GaMerZ WordPress Plugins Development Blog")
18
-
19
- == Installation ==
20
-
21
- [WP-PostViews Readme](http://lesterchan.net/wordpress/readme/wp-postviews.html "WP-PostViews Readme") (Installation Tab)
22
-
23
- == Screenshots ==
24
-
25
- [WP-PostViews Screenshots](http://lesterchan.net/wordpress/screenshots/browse/wp-postviews/ "WP-PostViews Screenshots")
26
-
27
- == Frequently Asked Questions ==
28
-
29
- [WP-PostViews Support Forums](http://forums.lesterchan.net/index.php?board=16.0 "WP-PostViews Support Forums")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === WP-PostViews ===
2
+ Contributors: GamerZ
3
+ Donate link: http://lesterchan.net/site/donation/
4
+ Tags: views, hits, counter, postviews
5
+ Requires at least: 2.8
6
+ Tested up to: 3.8
7
+ Stable tag: 1.66
8
+
9
+ Enables you to display how many times a post/page had been viewed.
10
+
11
+ == Description ==
12
+
13
+ = Previous Versions =
14
+ * [WP-PostViews 1.40 For WordPress 2.7.x](http://downloads.wordpress.org/plugin/wp-postviews.1.40.zip "WP-PostViews 1.40 For WordPress 2.7.x")
15
+ * [WP-PostViews 1.31 For WordPress 2.3.x, 2.5.x And 2.6.x](http://downloads.wordpress.org/plugin/wp-postviews.1.31.zip "WP-PostViews 1.31 For WordPress 2.3.x, 2.5.x And 2.6.x")
16
+ * [WP-PostViews 1.11 For WordPress 2.1.x And 2.2.x](http://downloads.wordpress.org/plugin/wp-postviews.1.11.zip "WP-PostViews 1.11 For WordPress 2.1.x And 2.2.x")
17
+ * [WP-PostViews 1.02 For WordPress 2.0.x](http://downloads.wordpress.org/plugin/wp-postviews.1.02.zip "WP-PostViews 1.02 For WordPress 2.0.x")
18
+
19
+ = Development =
20
+ * [http://dev.wp-plugins.org/browser/wp-postviews/](http://dev.wp-plugins.org/browser/wp-postviews/ "http://dev.wp-plugins.org/browser/wp-postviews/")
21
+
22
+ = Translations =
23
+ * [http://dev.wp-plugins.org/browser/wp-postviews/i18n/](http://dev.wp-plugins.org/browser/wp-postviews/i18n/ "http://dev.wp-plugins.org/browser/wp-postviews/i18n/")
24
+
25
+ = Support Forums =
26
+ * [http://forums.lesterchan.net/index.php?board=16.0](http://forums.lesterchan.net/index.php?board=16.0 "http://forums.lesterchan.net/index.php?board=16.0")
27
+
28
+ = Credits =
29
+ * WP-Cache/WP-SuperCache Compatibility By [Thaya Kareeson](http://omninoggin.com/ "Thaya Kareeson")
30
+ * __ngetext() by [Anna Ozeritskaya](http://hweia.ru/ "Anna Ozeritskaya")
31
+ * Right To Left Language Support by [Kambiz R. Khojasteh](http://persian-programming.com/ "Kambiz R. Khojasteh")
32
+ * Options To Display Views On Certain Places by [David Potter](http://dpotter.net/Technical/ "David Potter")
33
+
34
+ = Donations =
35
+ * 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, I will really appericiate it. If not feel free to use it without any obligations.
36
+
37
+ == Changelog ==
38
+ = Version 1.66 =
39
+ * NEW: Supports MultiSite Network Activation
40
+ * NEW: Add %POST_DATE% and %POST_TIME% to template variables
41
+ * NEW: Add China isearch engines bots
42
+ * NEW: Ability to pass in an array of post types for get_most/least_*() functions. Props Leo Plaw.
43
+ * FIXED: Moved uninstall to uninstall.php and hence fix missing nonce. Props Julio Potier.
44
+ * FIXED: Notices and better way to get views from meta. Props daankortenbach.
45
+ * FIXED: No longer needing add_post_meta() if update_post_meta() fails.
46
+
47
+ = Version 1.65 (02-06-2013) =
48
+ * FIXED: Views not showing in WP-Admin if "Display Options" is not set to "Display to everyone"
49
+
50
+ = Version 1.64 (31-05-2013) =
51
+ * NEW: Using Enqueue Script For WP_CACHE Enabled Sites. Props Crowd Favourite
52
+ * FIXED: Viewcounter always display eventhough "display to registered users only" is set
53
+
54
+ = Version 1.63 (07-05-2013) =
55
+ * NEW: Added nonce To PostViews Options Admin Page
56
+
57
+ = Version 1.62 (29-11-2012) =
58
+ * NEW: Add "Views" Column To Manage Pages In WP-Admin
59
+ * NEW: Add Sortable "Views" Column To Manage Posts/Pages In WP-Admin
60
+
61
+ = Version 1.61 (21-05-2012) =
62
+ * FIXED: Move AJAX Request to wp-admin/admin-ajax.php
63
+
64
+ = Version 1.60 (18-02-2011) =
65
+ * NEW: Added Views Count To Edit Posts Screen
66
+ * FIXED: Removed Global $post
67
+
68
+ = Version 1.50 (15-06-2009) =
69
+ * NEW: Works For WordPress 2.8 Only
70
+ * NEW: Uses jQuery Framework
71
+ * NEW: Added In Most Viewed Pages To WP-Stats
72
+ * NEW: Use _n() Instead Of __ngettext() And _n_noop() Instead Of __ngettext_noop()
73
+ * FIXED: Uses $_SERVER['PHP_SELF'] With plugin_basename(__FILE__) Instead Of Just $_SERVER['REQUEST_URI']
74
+ * NEW: Uses New Widget Class From WordPress
75
+ * NEW: Merge Widget Code To wp-postviews.php And Remove wp-postviews-widget.php
76
+ * NEW: Added get_most_viewed_tag() And get_least_viewed_tag()
77
+ * FIXED: Ensure That Post Is Not A Revision
78
+ * FIXED: Multiple Loops Filtered Not Cleared
79
+
80
+ = Version 1.40 (12-12-2008) =
81
+ * NEW: Works For WordPress 2.7 Only
82
+ * NEW: Options To Display Views On Certain Places by David Potter
83
+ * NEW: Right To Left Language Support by Kambiz R. Khojasteh
84
+ * NEW: Output Of the_views() Applied To "the_views" Filter by Kambiz R. Khojasteh
85
+ * NEW: Called postviews_textdomain() In views_init() by Kambiz R. Khojasteh
86
+ * NEW: Uses plugins_url() And site_url()
87
+ * NEW: Added get_least_viewed() And get_least_viewed_category() By JBrinx
88
+ * FIXED: "views" Custom Field Gets Created Now When Post Is Published
89
+
90
+ = Version 1.31 (16-07-2008) =
91
+ * NEW: Works For WordPress 2.6
92
+ * NEW: Renamed GET Variables sortby To v_sortby And orderby To v_orderby
93
+ * NEW: Better Translation Using __ngetext() by Anna Ozeritskaya
94
+ * FIXED: Able To Use v_sortby And v_orderby in query_posts()
95
+
96
+ = Version 1.30 (01-06-2008) =
97
+ * NEW: Uses /wp-postviews/ Folder Instead Of /postviews/
98
+ * NEW: Uses wp-postviews.php Instead Of postviews.php
99
+ * NEW: Uses wp-postviews-widget.php Instead Of postviews-widget.php
100
+ * NEW: Uses number_format_i18n() Instead Of number_format()
101
+ * NEW: Option To Exclude Bots Views In 'WP-Admin -> Settings -> Post Views'
102
+ * NEW: Added Most Viewed Template
103
+ * NEW: Change The Way WP-PostViews Count Views
104
+ * NEW: Should Work With WP-Cache Or WP-SuperCache
105
+
106
+ = Version 1.20 (01-10-2007) =
107
+ * NEW: Works For WordPress 2.3 Only
108
+ * NEW: Most Viewed Widget Added
109
+ * NEW: Ability To Uninstall WP-PostViews
110
+ * NEW: Uses WP-Stats Filter To Add Stats Into WP-Stats Page
111
+
112
+ = Version 1.11 (01-06-2007) =
113
+ * FIXED: Wrong URL For Page Under Most Viewed Posts Listing
114
+
115
+ = Version 1.10 (01-02-2007) =
116
+ * NEW: Works For WordPress 2.1 Only
117
+ * NEW: Localization WP-PostViews
118
+ * NEW: Added Function To Get Most Viewed Post By Category ID
119
+ * FIXED: Views Not Counting In Some Cases
120
+
121
+ = Version 1.02 (01-10-2006) =
122
+ * NEW: Change In get_most_viewed() To Accommodate Latest Version Of WP-Stats
123
+
124
+ = Version 1.01 (01-07-2006) =
125
+ * NEW: Added Get Total Views Function
126
+ * FIXED: Modified Get Most Viewed Post Function
127
+
128
+ = Version 1.00 (01-03-2006) =
129
+ * NEW: Initial Release
130
+
131
+ == Installation ==
132
+
133
+ 1. Open `wp-content/plugins` Folder
134
+ 2. Put: `Folder: wp-postviews`
135
+ 3. Activate `WP-PostViews` Plugin
136
+ 4. Go to `WP-Admin -> Settings -> PostViews` to configure the plugin.
137
+
138
+ = Usage =
139
+ 1. Open `wp-content/themes/<YOUR THEME NAME>/index.php`
140
+ 2. You may place it in archive.php, single.php, post.php or page.php also.
141
+ 3. Find: `<?php while (have_posts()) : the_post(); ?>`
142
+ 4. Add Anywhere Below It (The Place You Want The Views To Show): `<?php if(function_exists('the_views')) { the_views(); } ?>`
143
+
144
+ == Upgrading ==
145
+
146
+ 1. Deactivate `wp-postviews` Plugin
147
+ 2. Open `wp-content/plugins` Folder
148
+ 3. Put/Overwrite: `Folder: wp-postviews`
149
+ 4. Activate `WP-PostViews` Plugin
150
+
151
+ == Upgrade Notice ==
152
+
153
+ N/A
154
+
155
+ == Screenshots ==
156
+
157
+ 1. PostViews
158
+
159
+ == Frequently Asked Questions ==
160
+
161
+ = How To View Stats With Widgets? =
162
+ * Go to `WP-Admin -> Appearance -> Widgets`
163
+ * The widget name is Views.
164
+
165
+ = How To View Stats (Outside WP Loop) =
166
+
167
+ = To Display Least Viewed Posts =
168
+ * Use:
169
+ <code>
170
+ <?php if (function_exists('get_least_viewed')): ?>
171
+ <ul>
172
+ <?php get_least_viewed(); ?>
173
+ </ul>
174
+ <?php endif; ?>
175
+ </code>
176
+ * The first value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
177
+ * The second value you pass in is the maximum number of post you want to get.
178
+ * Default: get_least_viewed('both', 10);
179
+
180
+ = To Display Most Viewed Posts =
181
+ * Use:
182
+ <code>
183
+ <?php if (function_exists('get_most_viewed')): ?>
184
+ <ul>
185
+ <?php get_most_viewed(); ?>
186
+ </ul>
187
+ <?php endif; ?>
188
+ </code>
189
+ * The first value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
190
+ * The second value you pass in is the maximum number of post you want to get.
191
+ * Default: get_most_viewed('both', 10);
192
+
193
+ = To Display Least Viewed Posts By Tag =
194
+ * Use:
195
+ <code>
196
+ <?php if (function_exists('get_least_viewed_tag')): ?>
197
+ <ul>
198
+ <?php get_least_viewed_tag(); ?>
199
+ </ul>
200
+ <?php endif; ?>
201
+ </code>
202
+ * The first value you pass in is the tag id.
203
+ * The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
204
+ * The third value you pass in is the maximum number of post you want to get.
205
+ * Default: get_least_viewed_tag(1, 'both', 10);
206
+
207
+ = To Display Most Viewed Posts By Tag =
208
+ * Use:
209
+ <code>
210
+ <?php if (function_exists('get_most_viewed_tag')): ?>
211
+ <ul>
212
+ <?php get_most_viewed_tag(); ?>
213
+ </ul>
214
+ <?php endif; ?>
215
+ </code>
216
+ * The first value you pass in is the tag id.
217
+ * The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
218
+ * The third value you pass in is the maximum number of post you want to get.
219
+ * Default: get_most_viewed_tag(1, 'both', 10);
220
+
221
+ = To Display Least Viewed Posts For A Category =
222
+ * Use:
223
+ <code>
224
+ <?php if (function_exists('get_least_viewed_category')): ?>
225
+ <ul>
226
+ <?php get_least_viewed_category(); ?>
227
+ </ul>
228
+ <?php endif; ?>
229
+ </code>
230
+ * The first value you pass in is the category id.
231
+ * The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
232
+ * The third value you pass in is the maximum number of post you want to get.
233
+ * Default: get_least_viewed_category(1, 'both', 10);
234
+
235
+ = To Display Most Viewed Posts For A Category =
236
+ * Use:
237
+ <code>
238
+ <?php if (function_exists('get_most_viewed_category')): ?>
239
+ <ul>
240
+ <?php get_most_viewed_category(); ?>
241
+ </ul>
242
+ <?php endif; ?>
243
+ </code>
244
+ * The first value you pass in is the category id.
245
+ * The second value you pass in is the post type that you want. If you want to get every post types, just use 'both'. It also supports PHP array: example `array('post', 'page')`.
246
+ * The third value you pass in is the maximum number of post you want to get.
247
+ * Default: get_most_viewed_category(1, 'both', 10);
248
+
249
+ = To Sort Most/Least Viewed Posts =
250
+ * You can use: `<?php query_posts( array( 'meta_key' => 'views', 'orderby' => 'meta_value_num', 'order' => 'DESC' ) ); ?>`
251
+ * Or pass in the variables to the URL: `http://yoursite.com/?v_sortby=views&v_orderby=desc`
252
+ * You can replace DESC with ASC if you want the least viewed posts.
screenshot-1.png ADDED
Binary file
uninstall.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Uninstall plugin
4
+ */
5
+ if ( !defined( 'WP_UNINSTALL_PLUGIN' ) )
6
+ exit ();
7
+
8
+ if ( is_multisite() ) {
9
+ $ms_sites = wp_get_sites();
10
+
11
+ if( 0 < sizeof( $ms_sites ) ) {
12
+ foreach ( $ms_sites as $ms_site ) {
13
+ switch_to_blog( $ms_site['blog_id'] );
14
+ uninstall();
15
+ }
16
+ }
17
+
18
+ restore_current_blog();
19
+ } else {
20
+ uninstall();
21
+ }
22
+
23
+ function uninstall() {
24
+ global $wpdb;
25
+
26
+ $option_names = array( 'views_options', 'widget_views_most_viewed', 'widget_views' );
27
+
28
+ if( sizeof( $option_names ) > 0 ) {
29
+ foreach( $option_names as $option_name ) {
30
+ delete_option( $option_name );
31
+ }
32
+ }
33
+
34
+ $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key = 'views'" );
35
+ }
wp-postviews.mo DELETED
Binary file
wp-postviews.php CHANGED
@@ -1,790 +1,933 @@
1
- <?php
2
- /*
3
- Plugin Name: WP-PostViews
4
- Plugin URI: http://lesterchan.net/portfolio/programming/php/
5
- Description: Enables you to display how many times a post/page had been viewed. Modified by <a href="http://DPotter.net/Technical/" title="David's Technical Musings">David Potter</a> to include options for when and where to display view counts.
6
- Version: 1.50
7
- Author: Lester 'GaMerZ' Chan
8
- Author URI: http://lesterchan.net
9
- */
10
-
11
-
12
- /*
13
- Copyright 2009 Lester Chan (email : lesterchan@gmail.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
- ### Load WP-Config File If This File Is Called Directly
32
- if (!function_exists('add_action')) {
33
- $wp_root = '../../..';
34
- if (file_exists($wp_root.'/wp-load.php')) {
35
- require_once($wp_root.'/wp-load.php');
36
- } else {
37
- require_once($wp_root.'/wp-config.php');
38
- }
39
- }
40
-
41
-
42
- ### Create Text Domain For Translations
43
- add_action('init', 'postviews_textdomain');
44
- function postviews_textdomain() {
45
- load_plugin_textdomain('wp-postviews', false, 'wp-postviews');
46
- }
47
-
48
-
49
- ### Function: Post Views Option Menu
50
- add_action('admin_menu', 'postviews_menu');
51
- function postviews_menu() {
52
- if (function_exists('add_options_page')) {
53
- add_options_page(__('PostViews', 'wp-postviews'), __('PostViews', 'wp-postviews'), 'manage_options', 'wp-postviews/postviews-options.php') ;
54
- }
55
- }
56
-
57
-
58
- ### Function: Calculate Post Views
59
- add_action('wp_head', 'process_postviews');
60
- function process_postviews() {
61
- global $user_ID, $post;
62
- if(!wp_is_post_revision($post)) {
63
- if(is_single() || is_page()) {
64
- $id = intval($post->ID);
65
- $views_options = get_option('views_options');
66
- $post_views = get_post_custom($id);
67
- $post_views = intval($post_views['views'][0]);
68
- $should_count = false;
69
- switch(intval($views_options['count'])) {
70
- case 0:
71
- $should_count = true;
72
- break;
73
- case 1:
74
- if(empty($_COOKIE[USER_COOKIE]) && intval($user_ID) == 0) {
75
- $should_count = true;
76
- }
77
- break;
78
- case 2:
79
- if(intval($user_ID) > 0) {
80
- $should_count = true;
81
- }
82
- break;
83
- }
84
- if(intval($views_options['exclude_bots']) == 1) {
85
- $bots = array('Google Bot' => 'googlebot', 'Google Bot' => 'google', 'MSN' => 'msnbot', 'Alex' => 'ia_archiver', 'Lycos' => 'lycos', 'Ask Jeeves' => 'jeeves', 'Altavista' => 'scooter', 'AllTheWeb' => 'fast-webcrawler', 'Inktomi' => 'slurp@inktomi', 'Turnitin.com' => 'turnitinbot', 'Technorati' => 'technorati', 'Yahoo' => 'yahoo', 'Findexa' => 'findexa', 'NextLinks' => 'findlinks', 'Gais' => 'gaisbo', 'WiseNut' => 'zyborg', 'WhoisSource' => 'surveybot', 'Bloglines' => 'bloglines', 'BlogSearch' => 'blogsearch', 'PubSub' => 'pubsub', 'Syndic8' => 'syndic8', 'RadioUserland' => 'userland', 'Gigabot' => 'gigabot', 'Become.com' => 'become.com');
86
- $useragent = $_SERVER['HTTP_USER_AGENT'];
87
- foreach ($bots as $name => $lookfor) {
88
- if (stristr($useragent, $lookfor) !== false) {
89
- $should_count = false;
90
- break;
91
- }
92
- }
93
- }
94
- if($should_count) {
95
- if(defined('WP_CACHE') && WP_CACHE) {
96
- echo "\n".'<!-- Start Of Script Generated By WP-PostViews 1.50 -->'."\n";
97
- wp_print_scripts('jquery');
98
- echo '<script type="text/javascript">'."\n";
99
- echo '/* <![CDATA[ */'."\n";
100
- echo "jQuery.ajax({type:'GET',url:'".plugins_url('wp-postviews/wp-postviews.php')."',data:'postviews_id=".$id."',cache:false});";
101
- echo '/* ]]> */'."\n";
102
- echo '</script>'."\n";
103
- echo '<!-- End Of Script Generated By WP-PostViews 1.50 -->'."\n";
104
- } else {
105
- if(!update_post_meta($id, 'views', ($post_views+1))) {
106
- add_post_meta($id, 'views', 1, true);
107
- }
108
- }
109
- }
110
- }
111
- }
112
- }
113
-
114
-
115
- ### Function: Determine If Post Views Should Be Displayed (By: David Potter)
116
- function should_views_be_displayed($views_options = null) {
117
- if ($views_options == null) {
118
- $views_options = get_option('views_options');
119
- }
120
- $display_option = 0;
121
- if (is_home()) {
122
- if (array_key_exists('display_home', $views_options)) {
123
- $display_option = $views_options['display_home'];
124
- }
125
- } elseif (is_single()) {
126
- if (array_key_exists('display_single', $views_options)) {
127
- $display_option = $views_options['display_single'];
128
- }
129
- } elseif (is_page()) {
130
- if (array_key_exists('display_page', $views_options)) {
131
- $display_option = $views_options['display_page'];
132
- }
133
- } elseif (is_archive()) {
134
- if (array_key_exists('display_archive', $views_options)) {
135
- $display_option = $views_options['display_archive'];
136
- }
137
- } elseif (is_search()) {
138
- if (array_key_exists('display_search', $views_options)) {
139
- $display_option = $views_options['display_search'];
140
- }
141
- } else {
142
- if (array_key_exists('display_other', $views_options)) {
143
- $display_option = $views_options['display_other'];
144
- }
145
- }
146
- return (($display_option == 0) || (($display_option == 1) && is_user_logged_in()));
147
- }
148
-
149
-
150
- ### Function: Display The Post Views
151
- function the_views($display = true, $prefix = '', $postfix = '', $always = false) {
152
- $post_views = intval(post_custom('views'));
153
- $views_options = get_option('views_options');
154
- if ($always || should_views_be_displayed($views_options)) {
155
- $output = $prefix.str_replace('%VIEW_COUNT%', number_format_i18n($post_views), $views_options['template']).$postfix;
156
- if($display) {
157
- echo apply_filters('the_views', $output);
158
- } else {
159
- return apply_filters('the_views', $output);
160
- }
161
- }
162
- elseif (!$display) {
163
- return '';
164
- }
165
- }
166
-
167
-
168
- ### Function: Display Least Viewed Page/Post
169
- if(!function_exists('get_least_viewed')) {
170
- function get_least_viewed($mode = '', $limit = 10, $chars = 0, $display = true) {
171
- global $wpdb, $post;
172
- $views_options = get_option('views_options');
173
- $where = '';
174
- $temp = '';
175
- $output = '';
176
- if(!empty($mode) && $mode != 'both') {
177
- $where = "post_type = '$mode'";
178
- } else {
179
- $where = '1=1';
180
- }
181
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $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 ASC LIMIT $limit");
182
- if($most_viewed) {
183
- foreach ($most_viewed as $post) {
184
- $post_views = intval($post->views);
185
- $post_title = get_the_title();
186
- if($chars > 0) {
187
- $post_title = snippet_text($post_title, $chars);
188
- }
189
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
190
- $post_content = get_the_content();
191
- $temp = stripslashes($views_options['most_viewed_template']);
192
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
193
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
194
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
195
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
196
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
197
- $output .= $temp;
198
- }
199
- } else {
200
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
201
- }
202
- if($display) {
203
- echo $output;
204
- } else {
205
- return $output;
206
- }
207
- }
208
- }
209
-
210
-
211
- ### Function: Display Most Viewed Page/Post
212
- if(!function_exists('get_most_viewed')) {
213
- function get_most_viewed($mode = '', $limit = 10, $chars = 0, $display = true) {
214
- global $wpdb, $post;
215
- $views_options = get_option('views_options');
216
- $where = '';
217
- $temp = '';
218
- $output = '';
219
- if(!empty($mode) && $mode != 'both') {
220
- $where = "post_type = '$mode'";
221
- } else {
222
- $where = '1=1';
223
- }
224
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $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");
225
- if($most_viewed) {
226
- foreach ($most_viewed as $post) {
227
- $post_views = intval($post->views);
228
- $post_title = get_the_title();
229
- if($chars > 0) {
230
- $post_title = snippet_text($post_title, $chars);
231
- }
232
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
233
- $post_content = get_the_content();
234
- $temp = stripslashes($views_options['most_viewed_template']);
235
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
236
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
237
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
238
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
239
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
240
- $output .= $temp;
241
- }
242
- } else {
243
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
244
- }
245
- if($display) {
246
- echo $output;
247
- } else {
248
- return $output;
249
- }
250
- }
251
- }
252
-
253
-
254
- ### Function: Display Leased Viewed Page/Post By Category ID
255
- if(!function_exists('get_least_viewed_category')) {
256
- function get_least_viewed_category($category_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
257
- global $wpdb, $post;
258
- $views_options = get_option('views_options');
259
- $where = '';
260
- $temp = '';
261
- $output = '';
262
- if(is_array($category_id)) {
263
- $category_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $category_id).')';
264
- } else {
265
- $category_sql = "$wpdb->term_taxonomy.term_id = $category_id";
266
- }
267
- if(!empty($mode) && $mode != 'both') {
268
- $where = "post_type = '$mode'";
269
- } else {
270
- $where = '1=1';
271
- }
272
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $category_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views ASC LIMIT $limit");
273
- if($most_viewed) {
274
- foreach ($most_viewed as $post) {
275
- $post_views = intval($post->views);
276
- $post_title = get_the_title();
277
- if($chars > 0) {
278
- $post_title = snippet_text($post_title, $chars);
279
- }
280
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
281
- $post_content = get_the_content();
282
- $temp = stripslashes($views_options['most_viewed_template']);
283
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
284
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
285
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
286
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
287
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
288
- $output .= $temp;
289
- }
290
- } else {
291
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
292
- }
293
- if($display) {
294
- echo $output;
295
- } else {
296
- return $output;
297
- }
298
- }
299
- }
300
-
301
-
302
- ### Function: Display Most Viewed Page/Post By Category ID
303
- if(!function_exists('get_most_viewed_category')) {
304
- function get_most_viewed_category($category_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
305
- global $wpdb, $post;
306
- $views_options = get_option('views_options');
307
- $where = '';
308
- $temp = '';
309
- $output = '';
310
- if(is_array($category_id)) {
311
- $category_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $category_id).')';
312
- } else {
313
- $category_sql = "$wpdb->term_taxonomy.term_id = $category_id";
314
- }
315
- if(!empty($mode) && $mode != 'both') {
316
- $where = "post_type = '$mode'";
317
- } else {
318
- $where = '1=1';
319
- }
320
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $category_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
321
- if($most_viewed) {
322
- foreach ($most_viewed as $post) {
323
- $post_views = intval($post->views);
324
- $post_title = get_the_title();
325
- if($chars > 0) {
326
- $post_title = snippet_text($post_title, $chars);
327
- }
328
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
329
- $post_content = get_the_content();
330
- $temp = stripslashes($views_options['most_viewed_template']);
331
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
332
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
333
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
334
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
335
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
336
- $output .= $temp;
337
- }
338
- } else {
339
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
340
- }
341
- if($display) {
342
- echo $output;
343
- } else {
344
- return $output;
345
- }
346
- }
347
- }
348
-
349
-
350
- ### Function: Display Most Viewed Page/Post By Tag ID
351
- if(!function_exists('get_most_viewed_tag')) {
352
- function get_most_viewed_tag($tag_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
353
- global $wpdb, $post;
354
- $views_options = get_option('views_options');
355
- $where = '';
356
- $temp = '';
357
- $output = '';
358
- if(is_array($tag_id)) {
359
- $tag_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $tag_id).')';
360
- } else {
361
- $tag_sql = "$wpdb->term_taxonomy.term_id = $tag_id";
362
- }
363
- if(!empty($mode) && $mode != 'both') {
364
- $where = "post_type = '$mode'";
365
- } else {
366
- $where = '1=1';
367
- }
368
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'post_tag' AND $tag_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
369
- if($most_viewed) {
370
- foreach ($most_viewed as $post) {
371
- $post_views = intval($post->views);
372
- $post_title = get_the_title();
373
- if($chars > 0) {
374
- $post_title = snippet_text($post_title, $chars);
375
- }
376
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
377
- $post_content = get_the_content();
378
- $temp = stripslashes($views_options['most_viewed_template']);
379
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
380
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
381
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
382
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
383
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
384
- $output .= $temp;
385
- }
386
- } else {
387
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
388
- }
389
- if($display) {
390
- echo $output;
391
- } else {
392
- return $output;
393
- }
394
- }
395
- }
396
-
397
-
398
- ### Function: Display Least Viewed Page/Post By Tag ID
399
- if(!function_exists('get_least_viewed_tag')) {
400
- function get_least_viewed_tag($tag_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
401
- global $wpdb, $post;
402
- $views_options = get_option('views_options');
403
- $where = '';
404
- $temp = '';
405
- $output = '';
406
- if(is_array($tag_id)) {
407
- $tag_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $tag_id).')';
408
- } else {
409
- $tag_sql = "$wpdb->term_taxonomy.term_id = $tag_id";
410
- }
411
- if(!empty($mode) && $mode != 'both') {
412
- $where = "post_type = '$mode'";
413
- } else {
414
- $where = '1=1';
415
- }
416
- $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'post_tag' AND $tag_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views ASC LIMIT $limit");
417
- if($most_viewed) {
418
- foreach ($most_viewed as $post) {
419
- $post_views = intval($post->views);
420
- $post_title = get_the_title();
421
- if($chars > 0) {
422
- $post_title = snippet_text($post_title, $chars);
423
- }
424
- $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
425
- $post_content = get_the_content();
426
- $temp = stripslashes($views_options['most_viewed_template']);
427
- $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
428
- $temp = str_replace("%POST_TITLE%", $post_title, $temp);
429
- $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
430
- $temp = str_replace("%POST_CONTENT%", $post_content, $temp);
431
- $temp = str_replace("%POST_URL%", get_permalink(), $temp);
432
- $output .= $temp;
433
- }
434
- } else {
435
- $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
436
- }
437
- if($display) {
438
- echo $output;
439
- } else {
440
- return $output;
441
- }
442
- }
443
- }
444
-
445
-
446
- ### Function: Display Total Views
447
- if(!function_exists('get_totalviews')) {
448
- function get_totalviews($display = true) {
449
- global $wpdb;
450
- $total_views = intval($wpdb->get_var("SELECT SUM(meta_value+0) FROM $wpdb->postmeta WHERE meta_key = 'views'"));
451
- if($display) {
452
- echo $total_views;
453
- } else {
454
- return $total_views;
455
- }
456
- }
457
- }
458
-
459
-
460
- ### Function: Snippet Text
461
- if(!function_exists('snippet_text')) {
462
- function snippet_text($text, $length = 0) {
463
- if (defined('MB_OVERLOAD_STRING')) {
464
- $text = @html_entity_decode($text, ENT_QUOTES, get_option('blog_charset'));
465
- if (mb_strlen($text) > $length) {
466
- return htmlentities(mb_substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...';
467
- } else {
468
- return htmlentities($text, ENT_COMPAT, get_option('blog_charset'));
469
- }
470
- } else {
471
- $text = @html_entity_decode($text, ENT_QUOTES, get_option('blog_charset'));
472
- if (strlen($text) > $length) {
473
- return htmlentities(substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...';
474
- } else {
475
- return htmlentities($text, ENT_COMPAT, get_option('blog_charset'));
476
- }
477
- }
478
- }
479
- }
480
-
481
-
482
- ### Function: Process Post Excerpt, For Some Reasons, The Default get_post_excerpt() Does Not Work As Expected
483
- function views_post_excerpt($post_excerpt, $post_content, $post_password, $chars = 200) {
484
- if(!empty($post_password)) {
485
- if(!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post_password) {
486
- return __('There is no excerpt because this is a protected post.', 'wp-postviews');
487
- }
488
- }
489
- if(empty($post_excerpt)) {
490
- return snippet_text(strip_tags($post_content), $chars);
491
- } else {
492
- return $post_excerpt;
493
- }
494
- }
495
-
496
-
497
- ### Function: Modify Default WordPress Listing To Make It Sorted By Post Views
498
- function views_fields($content) {
499
- global $wpdb;
500
- $content .= ", ($wpdb->postmeta.meta_value+0) AS views";
501
- return $content;
502
- }
503
- function views_join($content) {
504
- global $wpdb;
505
- $content .= " LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID";
506
- return $content;
507
- }
508
- function views_where($content) {
509
- global $wpdb;
510
- $content .= " AND $wpdb->postmeta.meta_key = 'views'";
511
- return $content;
512
- }
513
- function views_orderby($content) {
514
- $orderby = trim(addslashes(get_query_var('v_orderby')));
515
- if(empty($orderby) || ($orderby != 'asc' && $orderby != 'desc')) {
516
- $orderby = 'desc';
517
- }
518
- $content = " views $orderby";
519
- return $content;
520
- }
521
-
522
-
523
- ### Function: Add Views Custom Fields
524
- add_action('publish_post', 'add_views_fields');
525
- add_action('publish_page', 'add_views_fields');
526
- function add_views_fields($post_ID) {
527
- global $wpdb;
528
- if(!wp_is_post_revision($post_ID)) {
529
- add_post_meta($post_ID, 'views', 0, true);
530
- }
531
- }
532
-
533
-
534
- ### Function: Delete Views Custom Fields
535
- add_action('delete_post', 'delete_views_fields');
536
- function delete_views_fields($post_ID) {
537
- global $wpdb;
538
- if(!wp_is_post_revision($post_ID)) {
539
- delete_post_meta($post_ID, 'views');
540
- }
541
- }
542
-
543
-
544
- ### Function: Views Public Variables
545
- add_filter('query_vars', 'views_variables');
546
- function views_variables($public_query_vars) {
547
- $public_query_vars[] = 'v_sortby';
548
- $public_query_vars[] = 'v_orderby';
549
- return $public_query_vars;
550
- }
551
-
552
-
553
- ### Function: Sort Views Posts
554
- add_action('pre_get_posts', 'views_sorting');
555
- function views_sorting($local_wp_query) {
556
- if($local_wp_query->get('v_sortby') == 'views') {
557
- add_filter('posts_fields', 'views_fields');
558
- add_filter('posts_join', 'views_join');
559
- add_filter('posts_where', 'views_where');
560
- add_filter('posts_orderby', 'views_orderby');
561
- } else {
562
- remove_filter('posts_fields', 'views_fields');
563
- remove_filter('posts_join', 'views_join');
564
- remove_filter('posts_where', 'views_where');
565
- remove_filter('posts_orderby', 'views_orderby');
566
- }
567
- }
568
-
569
-
570
- ### Function: Plug Into WP-Stats
571
- if(strpos(get_option('stats_url'), $_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], 'stats-options.php') || strpos($_SERVER['REQUEST_URI'], 'wp-stats/wp-stats.php')) {
572
- add_filter('wp_stats_page_admin_plugins', 'postviews_page_admin_general_stats');
573
- add_filter('wp_stats_page_admin_most', 'postviews_page_admin_most_stats');
574
- add_filter('wp_stats_page_plugins', 'postviews_page_general_stats');
575
- add_filter('wp_stats_page_most', 'postviews_page_most_stats');
576
- }
577
-
578
-
579
- ### Function: Add WP-PostViews General Stats To WP-Stats Page Options
580
- function postviews_page_admin_general_stats($content) {
581
- $stats_display = get_option('stats_display');
582
- if($stats_display['views'] == 1) {
583
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_views" value="views" checked="checked" />&nbsp;&nbsp;<label for="wpstats_views">'.__('WP-PostViews', 'wp-postviews').'</label><br />'."\n";
584
- } else {
585
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_views" value="views" />&nbsp;&nbsp;<label for="wpstats_views">'.__('WP-PostViews', 'wp-postviews').'</label><br />'."\n";
586
- }
587
- return $content;
588
- }
589
-
590
-
591
- ### Function: Add WP-PostViews Top Most/Highest Stats To WP-Stats Page Options
592
- function postviews_page_admin_most_stats($content) {
593
- $stats_display = get_option('stats_display');
594
- $stats_mostlimit = intval(get_option('stats_mostlimit'));
595
- if($stats_display['viewed_most_post'] == 1) {
596
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_post" value="viewed_most_post" checked="checked" />&nbsp;&nbsp;<label for="wpstats_viewed_most_post">'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
597
- } else {
598
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_post" value="viewed_most_post" />&nbsp;&nbsp;<label for="wpstats_viewed_most_post">'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
599
- }
600
- if($stats_display['viewed_most_page'] == 1) {
601
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_page" value="viewed_most_page" checked="checked" />&nbsp;&nbsp;<label for="wpstats_viewed_most_page">'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
602
- } else {
603
- $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_page" value="viewed_most_page" />&nbsp;&nbsp;<label for="wpstats_viewed_most_page">'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
604
- }
605
- return $content;
606
- }
607
-
608
-
609
- ### Function: Add WP-PostViews General Stats To WP-Stats Page
610
- function postviews_page_general_stats($content) {
611
- $stats_display = get_option('stats_display');
612
- if($stats_display['views'] == 1) {
613
- $content .= '<p><strong>'.__('WP-PostViews', 'wp-postviews').'</strong></p>'."\n";
614
- $content .= '<ul>'."\n";
615
- $content .= '<li>'.sprintf(_n('<strong>%s</strong> view was generated.', '<strong>%s</strong> views were generated.', get_totalviews(false), 'wp-postviews'), number_format_i18n(get_totalviews(false))).'</li>'."\n";
616
- $content .= '</ul>'."\n";
617
- }
618
- return $content;
619
- }
620
-
621
-
622
- ### Function: Add WP-PostViews Top Most/Highest Stats To WP-Stats Page
623
- function postviews_page_most_stats($content) {
624
- $stats_display = get_option('stats_display');
625
- $stats_mostlimit = intval(get_option('stats_mostlimit'));
626
- if($stats_display['viewed_most_post'] == 1) {
627
- $content .= '<p><strong>'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</strong></p>'."\n";
628
- $content .= '<ul>'."\n";
629
- $content .= get_most_viewed('post', $stats_mostlimit, 0, false);
630
- $content .= '</ul>'."\n";
631
- }
632
- if($stats_display['viewed_most_page'] == 1) {
633
- $content .= '<p><strong>'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</strong></p>'."\n";
634
- $content .= '<ul>'."\n";
635
- $content .= get_most_viewed('page', $stats_mostlimit, 0, false);
636
- $content .= '</ul>'."\n";
637
- }
638
- return $content;
639
- }
640
-
641
-
642
- ### Function: Increment Post Views
643
- increment_views();
644
- function increment_views() {
645
- global $wpdb;
646
- $post_id = intval($_GET['postviews_id']);
647
- if($post_id > 0 && defined('WP_CACHE') && WP_CACHE) {
648
- $post_views = get_post_custom($post_id);
649
- $post_views = intval($post_views['views'][0]);
650
- if(!update_post_meta($post_id, 'views', ($post_views+1))) {
651
- add_post_meta($post_id, 'views', 1, true);
652
- }
653
- }
654
- }
655
-
656
-
657
- ### Class: WP-PostViews Widget
658
- class WP_Widget_PostViews extends WP_Widget {
659
- // Constructor
660
- function WP_Widget_PostViews() {
661
- $widget_ops = array('description' => __('WP-PostViews views statistics', 'wp-postviews'));
662
- $this->WP_Widget('views', __('Views', 'wp-postviews'), $widget_ops);
663
- }
664
-
665
- // Display Widget
666
- function widget($args, $instance) {
667
- extract($args);
668
- $title = apply_filters('widget_title', esc_attr($instance['title']));
669
- $type = esc_attr($instance['type']);
670
- $mode = esc_attr($instance['mode']);
671
- $limit = intval($instance['limit']);
672
- $chars = intval($instance['chars']);
673
- $cat_ids = explode(',', esc_attr($instance['cat_ids']));
674
- echo $before_widget.$before_title.$title.$after_title;
675
- echo '<ul>'."\n";
676
- switch($type) {
677
- case 'least_viewed':
678
- get_least_viewed($mode, $limit, $chars);
679
- break;
680
- case 'most_viewed':
681
- get_most_viewed($mode, $limit, $chars);
682
- break;
683
- case 'most_viewed_category':
684
- get_most_viewed_category($cat_ids, $mode, $limit, $chars);
685
- break;
686
- case 'least_viewed_category':
687
- get_least_viewed_category($cat_ids, $mode, $limit, $chars);
688
- break;
689
- }
690
- echo '</ul>'."\n";
691
- echo $after_widget;
692
- }
693
-
694
- // When Widget Control Form Is Posted
695
- function update($new_instance, $old_instance) {
696
- if (!isset($new_instance['submit'])) {
697
- return false;
698
- }
699
- $instance = $old_instance;
700
- $instance['title'] = strip_tags($new_instance['title']);
701
- $instance['type'] = strip_tags($new_instance['type']);
702
- $instance['mode'] = strip_tags($new_instance['mode']);
703
- $instance['limit'] = intval($new_instance['limit']);
704
- $instance['chars'] = intval($new_instance['chars']);
705
- $instance['cat_ids'] = strip_tags($new_instance['cat_ids']);
706
- return $instance;
707
- }
708
-
709
- // DIsplay Widget Control Form
710
- function form($instance) {
711
- global $wpdb;
712
- $instance = wp_parse_args((array) $instance, array('title' => __('Views', 'wp-postviews'), 'type' => 'most_viewed', 'mode' => 'both', 'limit' => 10, 'chars' => 200, 'cat_ids' => '0'));
713
- $title = esc_attr($instance['title']);
714
- $type = esc_attr($instance['type']);
715
- $mode = esc_attr($instance['mode']);
716
- $limit = intval($instance['limit']);
717
- $chars = intval($instance['chars']);
718
- $cat_ids = esc_attr($instance['cat_ids']);
719
- ?>
720
- <p>
721
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>
722
- </p>
723
- <p>
724
- <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Statistics Type:', 'wp-postviews'); ?>
725
- <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>" class="widefat">
726
- <option value="least_viewed"<?php selected('least_viewed', $type); ?>><?php _e('Least Viewed', 'wp-postviews'); ?></option>
727
- <option value="least_viewed_category"<?php selected('least_viewed_category', $type); ?>><?php _e('Least Viewed By Category', 'wp-postviews'); ?></option>
728
- <optgroup>&nbsp;</optgroup>
729
- <option value="most_viewed"<?php selected('most_viewed', $type); ?>><?php _e('Most Viewed', 'wp-postviews'); ?></option>
730
- <option value="most_viewed_category"<?php selected('most_viewed_category', $type); ?>><?php _e('Most Viewed By Category', 'wp-postviews'); ?></option>
731
- </select>
732
- </label>
733
- </p>
734
- <p>
735
- <label for="<?php echo $this->get_field_id('mode'); ?>"><?php _e('Include Views From:', 'wp-postviews'); ?>
736
- <select name="<?php echo $this->get_field_name('mode'); ?>" id="<?php echo $this->get_field_id('mode'); ?>" class="widefat">
737
- <option value="both"<?php selected('both', $mode); ?>><?php _e('Posts &amp; Pages', 'wp-postviews'); ?></option>
738
- <option value="post"<?php selected('post', $mode); ?>><?php _e('Posts Only', 'wp-postviews'); ?></option>
739
- <option value="page"<?php selected('page', $mode); ?>><?php _e('Pages Only', 'wp-postviews'); ?></option>
740
- </select>
741
- </label>
742
- </p>
743
- <p>
744
- <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('No. Of Records To Show:', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label>
745
- </p>
746
- <p>
747
- <label for="<?php echo $this->get_field_id('chars'); ?>"><?php _e('Maximum Post Title Length (Characters):', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('chars'); ?>" name="<?php echo $this->get_field_name('chars'); ?>" type="text" value="<?php echo $chars; ?>" /></label><br />
748
- <small><?php _e('<strong>0</strong> to disable.', 'wp-postviews'); ?></small>
749
- </p>
750
- <p>
751
- <label for="<?php echo $this->get_field_id('cat_ids'); ?>"><?php _e('Category IDs:', 'wp-postviews'); ?> <span style="color: red;">*</span> <input class="widefat" id="<?php echo $this->get_field_id('cat_ids'); ?>" name="<?php echo $this->get_field_name('cat_ids'); ?>" type="text" value="<?php echo $cat_ids; ?>" /></label><br />
752
- <small><?php _e('Seperate mutiple categories with commas.', 'wp-postviews'); ?></small>
753
- </p>
754
- <p style="color: red;">
755
- <small><?php _e('* If you are not using any category statistics, you can ignore it.', 'wp-postviews'); ?></small>
756
- <p>
757
- <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" />
758
- <?php
759
- }
760
- }
761
-
762
-
763
- ### Function: Init WP-PostViews Widget
764
- add_action('widgets_init', 'widget_views_init');
765
- function widget_views_init() {
766
- register_widget('WP_Widget_PostViews');
767
- }
768
-
769
-
770
- ### Function: Post Views Options
771
- add_action('activate_wp-postviews/wp-postviews.php', 'views_init');
772
- function views_init() {
773
- postviews_textdomain();
774
- // Add Options
775
- $views_options = array();
776
- $views_options['count'] = 1;
777
- $views_options['exclude_bots'] = 0;
778
- $views_options['display_home'] = 0;
779
- $views_options['display_single'] = 0;
780
- $views_options['display_page'] = 0;
781
- $views_options['display_archive'] = 0;
782
- $views_options['display_search'] = 0;
783
- $views_options['display_other'] = 0;
784
- $views_options['template'] = __('%VIEW_COUNT% views', 'wp-postviews');
785
- $views_options['most_viewed_template'] = '<li><a href="%POST_URL%" title="%POST_TITLE%">%POST_TITLE%</a> - %VIEW_COUNT% '.__('views', 'wp-postviews').'</li>';
786
- add_option('views_options', $views_options, 'Post Views Options');
787
- // Veersion 1.50 Upgrade
788
- delete_option('widget_views_most_viewed');
789
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
790
  ?>
1
+ <?php
2
+ /*
3
+ Plugin Name: WP-PostViews
4
+ Plugin URI: http://lesterchan.net/portfolio/programming/php/
5
+ Description: Enables you to display how many times a post/page had been viewed.
6
+ Version: 1.66
7
+ Author: Lester 'GaMerZ' Chan
8
+ Author URI: http://lesterchan.net
9
+ Text Domain: wp-postviews
10
+ */
11
+
12
+
13
+ /*
14
+ Copyright 2014 Lester Chan (email : lesterchan@gmail.com)
15
+
16
+ This program is free software; you can redistribute it and/or modify
17
+ it under the terms of the GNU General Public License as published by
18
+ the Free Software Foundation; either version 2 of the License, or
19
+ (at your option) any later version.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29
+ */
30
+
31
+
32
+ ### Create Text Domain For Translations
33
+ add_action( 'plugins_loaded', 'postviews_textdomain' );
34
+ function postviews_textdomain() {
35
+ load_plugin_textdomain( 'wp-postviews', false, dirname( plugin_basename( __FILE__ ) ) );
36
+ }
37
+
38
+
39
+ ### Function: Post Views Option Menu
40
+ add_action('admin_menu', 'postviews_menu');
41
+ function postviews_menu() {
42
+ if (function_exists('add_options_page')) {
43
+ add_options_page(__('PostViews', 'wp-postviews'), __('PostViews', 'wp-postviews'), 'manage_options', 'wp-postviews/postviews-options.php') ;
44
+ }
45
+ }
46
+
47
+
48
+ ### Function: Calculate Post Views
49
+ add_action('wp_head', 'process_postviews');
50
+ function process_postviews() {
51
+ global $user_ID, $post;
52
+ if(is_int($post)) {
53
+ $post = get_post($post);
54
+ }
55
+ if(!wp_is_post_revision($post)) {
56
+ if(is_single() || is_page()) {
57
+ $id = intval($post->ID);
58
+ $views_options = get_option('views_options');
59
+ if ( ! $post_views = get_post_meta( $post->ID, 'views', true ) )
60
+ $post_views = 0;
61
+ $should_count = false;
62
+ switch(intval($views_options['count'])) {
63
+ case 0:
64
+ $should_count = true;
65
+ break;
66
+ case 1:
67
+ if(empty($_COOKIE[USER_COOKIE]) && intval($user_ID) == 0) {
68
+ $should_count = true;
69
+ }
70
+ break;
71
+ case 2:
72
+ if(intval($user_ID) > 0) {
73
+ $should_count = true;
74
+ }
75
+ break;
76
+ }
77
+ if(intval($views_options['exclude_bots']) == 1) {
78
+ $bots = array
79
+ (
80
+ 'Google Bot' => 'googlebot'
81
+ , 'Google Bot' => 'google'
82
+ , 'MSN' => 'msnbot'
83
+ , 'Alex' => 'ia_archiver'
84
+ , 'Lycos' => 'lycos'
85
+ , 'Ask Jeeves' => 'jeeves'
86
+ , 'Altavista' => 'scooter'
87
+ , 'AllTheWeb' => 'fast-webcrawler'
88
+ , 'Inktomi' => 'slurp@inktomi'
89
+ , 'Turnitin.com' => 'turnitinbot'
90
+ , 'Technorati' => 'technorati'
91
+ , 'Yahoo' => 'yahoo'
92
+ , 'Findexa' => 'findexa'
93
+ , 'NextLinks' => 'findlinks'
94
+ , 'Gais' => 'gaisbo'
95
+ , 'WiseNut' => 'zyborg'
96
+ , 'WhoisSource' => 'surveybot'
97
+ , 'Bloglines' => 'bloglines'
98
+ , 'BlogSearch' => 'blogsearch'
99
+ , 'PubSub' => 'pubsub'
100
+ , 'Syndic8' => 'syndic8'
101
+ , 'RadioUserland' => 'userland'
102
+ , 'Gigabot' => 'gigabot'
103
+ , 'Become.com' => 'become.com'
104
+ , 'Baidu' => 'baiduspider'
105
+ , 'so.com' => '360spider'
106
+ , 'Sogou' => 'spider'
107
+ , 'soso.com' => 'sosospider'
108
+ , 'Yandex' => 'yandex'
109
+ );
110
+ $useragent = $_SERVER['HTTP_USER_AGENT'];
111
+ foreach ($bots as $name => $lookfor) {
112
+ if (stristr($useragent, $lookfor) !== false) {
113
+ $should_count = false;
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ if($should_count && (!defined('WP_CACHE') || !WP_CACHE)) {
119
+ update_post_meta($id, 'views', ($post_views + 1));
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+
126
+ ### Function: Calculate Post Views With WP_CACHE Enabled
127
+ add_action('wp_enqueue_scripts', 'wp_postview_cache_count_enqueue');
128
+ function wp_postview_cache_count_enqueue() {
129
+ global $user_ID, $post;
130
+ if (!wp_is_post_revision($post) && (is_single() || is_page())) {
131
+ $views_options = get_option('views_options');
132
+ $should_count = false;
133
+ switch(intval($views_options['count'])) {
134
+ case 0:
135
+ $should_count = true;
136
+ break;
137
+ case 1:
138
+ if (empty($_COOKIE[USER_COOKIE]) && intval($user_ID) == 0) {
139
+ $should_count = true;
140
+ }
141
+ break;
142
+ case 2:
143
+ if (intval($user_ID) > 0) {
144
+ $should_count = true;
145
+ }
146
+ break;
147
+ }
148
+ if ($should_count && defined('WP_CACHE') && WP_CACHE) {
149
+ // Enqueue and localize script here
150
+ wp_enqueue_script('wp-postviews-cache', plugins_url('postviews-cache.js', __FILE__), array('jquery'), '1.64', true);
151
+ wp_localize_script('wp-postviews-cache', 'viewsCacheL10n', array('admin_ajax_url' => admin_url('admin-ajax.php', (is_ssl() ? 'https' : 'http')), 'post_id' => intval($post->ID)));
152
+ }
153
+ }
154
+ }
155
+
156
+
157
+ ### Function: Determine If Post Views Should Be Displayed (By: David Potter)
158
+ function should_views_be_displayed($views_options = null) {
159
+ if ($views_options == null) {
160
+ $views_options = get_option('views_options');
161
+ }
162
+ $display_option = 0;
163
+ if (is_home()) {
164
+ if (array_key_exists('display_home', $views_options)) {
165
+ $display_option = $views_options['display_home'];
166
+ }
167
+ } elseif (is_single()) {
168
+ if (array_key_exists('display_single', $views_options)) {
169
+ $display_option = $views_options['display_single'];
170
+ }
171
+ } elseif (is_page()) {
172
+ if (array_key_exists('display_page', $views_options)) {
173
+ $display_option = $views_options['display_page'];
174
+ }
175
+ } elseif (is_archive()) {
176
+ if (array_key_exists('display_archive', $views_options)) {
177
+ $display_option = $views_options['display_archive'];
178
+ }
179
+ } elseif (is_search()) {
180
+ if (array_key_exists('display_search', $views_options)) {
181
+ $display_option = $views_options['display_search'];
182
+ }
183
+ } else {
184
+ if (array_key_exists('display_other', $views_options)) {
185
+ $display_option = $views_options['display_other'];
186
+ }
187
+ }
188
+ return (($display_option == 0) || (($display_option == 1) && is_user_logged_in()));
189
+ }
190
+
191
+
192
+ ### Function: Display The Post Views
193
+ function the_views($display = true, $prefix = '', $postfix = '', $always = false) {
194
+ $post_views = intval(post_custom('views'));
195
+ $views_options = get_option('views_options');
196
+ if ($always || should_views_be_displayed($views_options)) {
197
+ $output = $prefix.str_replace('%VIEW_COUNT%', number_format_i18n($post_views), $views_options['template']).$postfix;
198
+ if($display) {
199
+ echo apply_filters('the_views', $output);
200
+ } else {
201
+ return apply_filters('the_views', $output);
202
+ }
203
+ }
204
+ elseif (!$display) {
205
+ return '';
206
+ }
207
+ }
208
+
209
+
210
+ ### Function: Display Least Viewed Page/Post
211
+ if(!function_exists('get_least_viewed')) {
212
+ function get_least_viewed($mode = '', $limit = 10, $chars = 0, $display = true) {
213
+ global $wpdb;
214
+ $views_options = get_option('views_options');
215
+ $where = '';
216
+ $temp = '';
217
+ $output = '';
218
+ if(!empty($mode) && $mode != 'both') {
219
+ if(is_array($mode)) {
220
+ $mode = implode("','",$mode);
221
+ $where = "post_type IN ('".$mode."')";
222
+ } else {
223
+ $where = "post_type = '$mode'";
224
+ }
225
+ } else {
226
+ $where = '1=1';
227
+ }
228
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $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 ASC LIMIT $limit");
229
+ if($most_viewed) {
230
+ foreach ($most_viewed as $post) {
231
+ $post_views = intval($post->views);
232
+ $post_title = get_the_title($post);
233
+ if($chars > 0) {
234
+ $post_title = snippet_text($post_title, $chars);
235
+ }
236
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
237
+ $temp = stripslashes($views_options['most_viewed_template']);
238
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
239
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
240
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
241
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
242
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
243
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
244
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
245
+ $output .= $temp;
246
+ }
247
+ } else {
248
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
249
+ }
250
+ if($display) {
251
+ echo $output;
252
+ } else {
253
+ return $output;
254
+ }
255
+ }
256
+ }
257
+
258
+
259
+ ### Function: Display Most Viewed Page/Post
260
+ if(!function_exists('get_most_viewed')) {
261
+ function get_most_viewed($mode = '', $limit = 10, $chars = 0, $display = true) {
262
+ global $wpdb;
263
+ $views_options = get_option('views_options');
264
+ $where = '';
265
+ $temp = '';
266
+ $output = '';
267
+ if(!empty($mode) && $mode != 'both') {
268
+ if(is_array($mode)) {
269
+ $mode = implode("','",$mode);
270
+ $where = "post_type IN ('".$mode."')";
271
+ } else {
272
+ $where = "post_type = '$mode'";
273
+ }
274
+ } else {
275
+ $where = '1=1';
276
+ }
277
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $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");
278
+ if($most_viewed) {
279
+ foreach ($most_viewed as $post) {
280
+ $post_views = intval($post->views);
281
+ $post_title = get_the_title($post);
282
+ if($chars > 0) {
283
+ $post_title = snippet_text($post_title, $chars);
284
+ }
285
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
286
+ $temp = stripslashes($views_options['most_viewed_template']);
287
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
288
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
289
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
290
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
291
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
292
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
293
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
294
+ $output .= $temp;
295
+ }
296
+ } else {
297
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
298
+ }
299
+ if($display) {
300
+ echo $output;
301
+ } else {
302
+ return $output;
303
+ }
304
+ }
305
+ }
306
+
307
+
308
+ ### Function: Display Leased Viewed Page/Post By Category ID
309
+ if(!function_exists('get_least_viewed_category')) {
310
+ function get_least_viewed_category($category_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
311
+ global $wpdb;
312
+ $views_options = get_option('views_options');
313
+ $where = '';
314
+ $temp = '';
315
+ $output = '';
316
+ if(is_array($category_id)) {
317
+ $category_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $category_id).')';
318
+ } else {
319
+ $category_sql = "$wpdb->term_taxonomy.term_id = $category_id";
320
+ }
321
+ if(!empty($mode) && $mode != 'both') {
322
+ if(is_array($mode)) {
323
+ $mode = implode("','",$mode);
324
+ $where = "post_type IN ('".$mode."')";
325
+ } else {
326
+ $where = "post_type = '$mode'";
327
+ }
328
+ } else {
329
+ $where = '1=1';
330
+ }
331
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $category_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views ASC LIMIT $limit");
332
+ if($most_viewed) {
333
+ foreach ($most_viewed as $post) {
334
+ $post_views = intval($post->views);
335
+ $post_title = get_the_title($post);
336
+ if($chars > 0) {
337
+ $post_title = snippet_text($post_title, $chars);
338
+ }
339
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
340
+ $temp = stripslashes($views_options['most_viewed_template']);
341
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
342
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
343
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
344
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
345
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
346
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
347
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
348
+ $output .= $temp;
349
+ }
350
+ } else {
351
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
352
+ }
353
+ if($display) {
354
+ echo $output;
355
+ } else {
356
+ return $output;
357
+ }
358
+ }
359
+ }
360
+
361
+
362
+ ### Function: Display Most Viewed Page/Post By Category ID
363
+ if(!function_exists('get_most_viewed_category')) {
364
+ function get_most_viewed_category($category_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
365
+ global $wpdb;
366
+ $views_options = get_option('views_options');
367
+ $where = '';
368
+ $temp = '';
369
+ $output = '';
370
+ if(is_array($category_id)) {
371
+ $category_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $category_id).')';
372
+ } else {
373
+ $category_sql = "$wpdb->term_taxonomy.term_id = $category_id";
374
+ }
375
+ if(!empty($mode) && $mode != 'both') {
376
+ if(is_array($mode)) {
377
+ $mode = implode("','",$mode);
378
+ $where = "post_type IN ('".$mode."')";
379
+ } else {
380
+ $where = "post_type = '$mode'";
381
+ }
382
+ } else {
383
+ $where = '1=1';
384
+ }
385
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'category' AND $category_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
386
+ if($most_viewed) {
387
+ foreach ($most_viewed as $post) {
388
+ $post_views = intval($post->views);
389
+ $post_title = get_the_title($post);
390
+ if($chars > 0) {
391
+ $post_title = snippet_text($post_title, $chars);
392
+ }
393
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
394
+ $temp = stripslashes($views_options['most_viewed_template']);
395
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
396
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
397
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
398
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
399
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
400
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
401
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
402
+ $output .= $temp;
403
+ }
404
+ } else {
405
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
406
+ }
407
+ if($display) {
408
+ echo $output;
409
+ } else {
410
+ return $output;
411
+ }
412
+ }
413
+ }
414
+
415
+
416
+ ### Function: Display Most Viewed Page/Post By Tag ID
417
+ if(!function_exists('get_most_viewed_tag')) {
418
+ function get_most_viewed_tag($tag_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
419
+ global $wpdb;
420
+ $views_options = get_option('views_options');
421
+ $where = '';
422
+ $temp = '';
423
+ $output = '';
424
+ if(is_array($tag_id)) {
425
+ $tag_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $tag_id).')';
426
+ } else {
427
+ $tag_sql = "$wpdb->term_taxonomy.term_id = $tag_id";
428
+ }
429
+ if(!empty($mode) && $mode != 'both') {
430
+ if(is_array($mode)) {
431
+ $mode = implode("','",$mode);
432
+ $where = "post_type IN ('".$mode."')";
433
+ } else {
434
+ $where = "post_type = '$mode'";
435
+ }
436
+ } else {
437
+ $where = '1=1';
438
+ }
439
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'post_tag' AND $tag_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views DESC LIMIT $limit");
440
+ if($most_viewed) {
441
+ foreach ($most_viewed as $post) {
442
+ $post_views = intval($post->views);
443
+ $post_title = get_the_title($post);
444
+ if($chars > 0) {
445
+ $post_title = snippet_text($post_title, $chars);
446
+ }
447
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
448
+ $temp = stripslashes($views_options['most_viewed_template']);
449
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
450
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
451
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
452
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
453
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
454
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
455
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
456
+ $output .= $temp;
457
+ }
458
+ } else {
459
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
460
+ }
461
+ if($display) {
462
+ echo $output;
463
+ } else {
464
+ return $output;
465
+ }
466
+ }
467
+ }
468
+
469
+
470
+ ### Function: Display Least Viewed Page/Post By Tag ID
471
+ if(!function_exists('get_least_viewed_tag')) {
472
+ function get_least_viewed_tag($tag_id = 0, $mode = '', $limit = 10, $chars = 0, $display = true) {
473
+ global $wpdb;
474
+ $views_options = get_option('views_options');
475
+ $where = '';
476
+ $temp = '';
477
+ $output = '';
478
+ if(is_array($tag_id)) {
479
+ $tag_sql = "$wpdb->term_taxonomy.term_id IN (".join(',', $tag_id).')';
480
+ } else {
481
+ $tag_sql = "$wpdb->term_taxonomy.term_id = $tag_id";
482
+ }
483
+ if(!empty($mode) && $mode != 'both') {
484
+ if(is_array($mode)) {
485
+ $mode = implode("','",$mode);
486
+ $where = "post_type IN ('".$mode."')";
487
+ } else {
488
+ $where = "post_type = '$mode'";
489
+ }
490
+ } else {
491
+ $where = '1=1';
492
+ }
493
+ $most_viewed = $wpdb->get_results("SELECT DISTINCT $wpdb->posts.*, (meta_value+0) AS views FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID INNER JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id) INNER JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE post_date < '".current_time('mysql')."' AND $wpdb->term_taxonomy.taxonomy = 'post_tag' AND $tag_sql AND $where AND post_status = 'publish' AND meta_key = 'views' AND post_password = '' ORDER BY views ASC LIMIT $limit");
494
+ if($most_viewed) {
495
+ foreach ($most_viewed as $post) {
496
+ $post_views = intval($post->views);
497
+ $post_title = get_the_title($post);
498
+ if($chars > 0) {
499
+ $post_title = snippet_text($post_title, $chars);
500
+ }
501
+ $post_excerpt = views_post_excerpt($post->post_excerpt, $post->post_content, $post->post_password, $chars);
502
+ $temp = stripslashes($views_options['most_viewed_template']);
503
+ $temp = str_replace("%VIEW_COUNT%", number_format_i18n($post_views), $temp);
504
+ $temp = str_replace("%POST_TITLE%", $post_title, $temp);
505
+ $temp = str_replace("%POST_EXCERPT%", $post_excerpt, $temp);
506
+ $temp = str_replace("%POST_CONTENT%", $post->post_content, $temp);
507
+ $temp = str_replace("%POST_URL%", get_permalink($post), $temp);
508
+ $temp = str_replace("%POST_DATE%", get_the_time(get_option('date_format'), $post), $temp);
509
+ $temp = str_replace("%POST_TIME%", get_the_time(get_option('time_format'), $post), $temp);
510
+ $output .= $temp;
511
+ }
512
+ } else {
513
+ $output = '<li>'.__('N/A', 'wp-postviews').'</li>'."\n";
514
+ }
515
+ if($display) {
516
+ echo $output;
517
+ } else {
518
+ return $output;
519
+ }
520
+ }
521
+ }
522
+
523
+
524
+ ### Function: Display Total Views
525
+ if(!function_exists('get_totalviews')) {
526
+ function get_totalviews($display = true) {
527
+ global $wpdb;
528
+ $total_views = intval($wpdb->get_var("SELECT SUM(meta_value+0) FROM $wpdb->postmeta WHERE meta_key = 'views'"));
529
+ if($display) {
530
+ echo number_format_i18n($total_views);
531
+ } else {
532
+ return $total_views;
533
+ }
534
+ }
535
+ }
536
+
537
+
538
+ ### Function: Snippet Text
539
+ if(!function_exists('snippet_text')) {
540
+ function snippet_text($text, $length = 0) {
541
+ if (defined('MB_OVERLOAD_STRING')) {
542
+ $text = @html_entity_decode($text, ENT_QUOTES, get_option('blog_charset'));
543
+ if (mb_strlen($text) > $length) {
544
+ return htmlentities(mb_substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...';
545
+ } else {
546
+ return htmlentities($text, ENT_COMPAT, get_option('blog_charset'));
547
+ }
548
+ } else {
549
+ $text = @html_entity_decode($text, ENT_QUOTES, get_option('blog_charset'));
550
+ if (strlen($text) > $length) {
551
+ return htmlentities(substr($text,0,$length), ENT_COMPAT, get_option('blog_charset')).'...';
552
+ } else {
553
+ return htmlentities($text, ENT_COMPAT, get_option('blog_charset'));
554
+ }
555
+ }
556
+ }
557
+ }
558
+
559
+
560
+ ### Function: Process Post Excerpt, For Some Reasons, The Default get_post_excerpt() Does Not Work As Expected
561
+ function views_post_excerpt($post_excerpt, $post_content, $post_password, $chars = 200) {
562
+ if(!empty($post_password)) {
563
+ if(!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post_password) {
564
+ return __('There is no excerpt because this is a protected post.', 'wp-postviews');
565
+ }
566
+ }
567
+ if(empty($post_excerpt)) {
568
+ return snippet_text(strip_tags($post_content), $chars);
569
+ } else {
570
+ return $post_excerpt;
571
+ }
572
+ }
573
+
574
+
575
+ ### Function: Modify Default WordPress Listing To Make It Sorted By Post Views
576
+ function views_fields($content) {
577
+ global $wpdb;
578
+ $content .= ", ($wpdb->postmeta.meta_value+0) AS views";
579
+ return $content;
580
+ }
581
+ function views_join($content) {
582
+ global $wpdb;
583
+ $content .= " LEFT JOIN $wpdb->postmeta ON $wpdb->postmeta.post_id = $wpdb->posts.ID";
584
+ return $content;
585
+ }
586
+ function views_where($content) {
587
+ global $wpdb;
588
+ $content .= " AND $wpdb->postmeta.meta_key = 'views'";
589
+ return $content;
590
+ }
591
+ function views_orderby($content) {
592
+ $orderby = trim(addslashes(get_query_var('v_orderby')));
593
+ if(empty($orderby) || ($orderby != 'asc' && $orderby != 'desc')) {
594
+ $orderby = 'desc';
595
+ }
596
+ $content = " views $orderby";
597
+ return $content;
598
+ }
599
+
600
+
601
+ ### Function: Add Views Custom Fields
602
+ add_action('publish_post', 'add_views_fields');
603
+ add_action('publish_page', 'add_views_fields');
604
+ function add_views_fields($post_ID) {
605
+ global $wpdb;
606
+ if(!wp_is_post_revision($post_ID)) {
607
+ add_post_meta($post_ID, 'views', 0, true);
608
+ }
609
+ }
610
+
611
+
612
+ ### Function: Delete Views Custom Fields
613
+ add_action('delete_post', 'delete_views_fields');
614
+ function delete_views_fields($post_ID) {
615
+ global $wpdb;
616
+ if(!wp_is_post_revision($post_ID)) {
617
+ delete_post_meta($post_ID, 'views');
618
+ }
619
+ }
620
+
621
+
622
+ ### Function: Views Public Variables
623
+ add_filter('query_vars', 'views_variables');
624
+ function views_variables($public_query_vars) {
625
+ $public_query_vars[] = 'v_sortby';
626
+ $public_query_vars[] = 'v_orderby';
627
+ return $public_query_vars;
628
+ }
629
+
630
+
631
+ ### Function: Sort Views Posts
632
+ add_action('pre_get_posts', 'views_sorting');
633
+ function views_sorting($local_wp_query) {
634
+ if($local_wp_query->get('v_sortby') == 'views') {
635
+ add_filter('posts_fields', 'views_fields');
636
+ add_filter('posts_join', 'views_join');
637
+ add_filter('posts_where', 'views_where');
638
+ add_filter('posts_orderby', 'views_orderby');
639
+ } else {
640
+ remove_filter('posts_fields', 'views_fields');
641
+ remove_filter('posts_join', 'views_join');
642
+ remove_filter('posts_where', 'views_where');
643
+ remove_filter('posts_orderby', 'views_orderby');
644
+ }
645
+ }
646
+
647
+
648
+ ### Function: Plug Into WP-Stats
649
+ add_action('wp','postviews_wp_stats');
650
+ function postviews_wp_stats() {
651
+ if(function_exists('stats_page')) {
652
+ if(strpos(get_option('stats_url'), $_SERVER['REQUEST_URI']) || strpos($_SERVER['REQUEST_URI'], 'stats-options.php') || strpos($_SERVER['REQUEST_URI'], 'wp-stats/wp-stats.php')) {
653
+ add_filter('wp_stats_page_admin_plugins', 'postviews_page_admin_general_stats');
654
+ add_filter('wp_stats_page_admin_most', 'postviews_page_admin_most_stats');
655
+ add_filter('wp_stats_page_plugins', 'postviews_page_general_stats');
656
+ add_filter('wp_stats_page_most', 'postviews_page_most_stats');
657
+ }
658
+ }
659
+ }
660
+
661
+
662
+ ### Function: Add WP-PostViews General Stats To WP-Stats Page Options
663
+ function postviews_page_admin_general_stats($content) {
664
+ $stats_display = get_option('stats_display');
665
+ if($stats_display['views'] == 1) {
666
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_views" value="views" checked="checked" />&nbsp;&nbsp;<label for="wpstats_views">'.__('WP-PostViews', 'wp-postviews').'</label><br />'."\n";
667
+ } else {
668
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_views" value="views" />&nbsp;&nbsp;<label for="wpstats_views">'.__('WP-PostViews', 'wp-postviews').'</label><br />'."\n";
669
+ }
670
+ return $content;
671
+ }
672
+
673
+
674
+ ### Function: Add WP-PostViews Top Most/Highest Stats To WP-Stats Page Options
675
+ function postviews_page_admin_most_stats($content) {
676
+ $stats_display = get_option('stats_display');
677
+ $stats_mostlimit = intval(get_option('stats_mostlimit'));
678
+ if($stats_display['viewed_most_post'] == 1) {
679
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_post" value="viewed_most_post" checked="checked" />&nbsp;&nbsp;<label for="wpstats_viewed_most_post">'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
680
+ } else {
681
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_post" value="viewed_most_post" />&nbsp;&nbsp;<label for="wpstats_viewed_most_post">'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
682
+ }
683
+ if($stats_display['viewed_most_page'] == 1) {
684
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_page" value="viewed_most_page" checked="checked" />&nbsp;&nbsp;<label for="wpstats_viewed_most_page">'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
685
+ } else {
686
+ $content .= '<input type="checkbox" name="stats_display[]" id="wpstats_viewed_most_page" value="viewed_most_page" />&nbsp;&nbsp;<label for="wpstats_viewed_most_page">'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</label><br />'."\n";
687
+ }
688
+ return $content;
689
+ }
690
+
691
+
692
+ ### Function: Add WP-PostViews General Stats To WP-Stats Page
693
+ function postviews_page_general_stats($content) {
694
+ $stats_display = get_option('stats_display');
695
+ if($stats_display['views'] == 1) {
696
+ $content .= '<p><strong>'.__('WP-PostViews', 'wp-postviews').'</strong></p>'."\n";
697
+ $content .= '<ul>'."\n";
698
+ $content .= '<li>'.sprintf(_n('<strong>%s</strong> view was generated.', '<strong>%s</strong> views were generated.', get_totalviews(false), 'wp-postviews'), number_format_i18n(get_totalviews(false))).'</li>'."\n";
699
+ $content .= '</ul>'."\n";
700
+ }
701
+ return $content;
702
+ }
703
+
704
+
705
+ ### Function: Add WP-PostViews Top Most/Highest Stats To WP-Stats Page
706
+ function postviews_page_most_stats($content) {
707
+ $stats_display = get_option('stats_display');
708
+ $stats_mostlimit = intval(get_option('stats_mostlimit'));
709
+ if($stats_display['viewed_most_post'] == 1) {
710
+ $content .= '<p><strong>'.sprintf(_n('%s Most Viewed Post', '%s Most Viewed Posts', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</strong></p>'."\n";
711
+ $content .= '<ul>'."\n";
712
+ $content .= get_most_viewed('post', $stats_mostlimit, 0, false);
713
+ $content .= '</ul>'."\n";
714
+ }
715
+ if($stats_display['viewed_most_page'] == 1) {
716
+ $content .= '<p><strong>'.sprintf(_n('%s Most Viewed Page', '%s Most Viewed Pages', $stats_mostlimit, 'wp-postviews'), number_format_i18n($stats_mostlimit)).'</strong></p>'."\n";
717
+ $content .= '<ul>'."\n";
718
+ $content .= get_most_viewed('page', $stats_mostlimit, 0, false);
719
+ $content .= '</ul>'."\n";
720
+ }
721
+ return $content;
722
+ }
723
+
724
+
725
+ ### Function: Increment Post Views
726
+ add_action('wp_ajax_postviews', 'increment_views');
727
+ add_action('wp_ajax_nopriv_postviews', 'increment_views');
728
+ function increment_views() {
729
+ global $wpdb;
730
+ if(!empty($_GET['postviews_id']))
731
+ {
732
+ $post_id = intval($_GET['postviews_id']);
733
+ if($post_id > 0 && defined('WP_CACHE') && WP_CACHE) {
734
+ $post_views = get_post_custom($post_id);
735
+ $post_views = intval($post_views['views'][0]);
736
+ update_post_meta($post_id, 'views', ($post_views + 1));
737
+ echo ($post_views + 1);
738
+ }
739
+ }
740
+ exit();
741
+ }
742
+
743
+ ### Function Show Post Views Column in WP-Admin
744
+ add_action('manage_posts_custom_column', 'add_postviews_column_content');
745
+ add_filter('manage_posts_columns', 'add_postviews_column');
746
+ add_action('manage_pages_custom_column', 'add_postviews_column_content');
747
+ add_filter('manage_pages_columns', 'add_postviews_column');
748
+ function add_postviews_column($defaults) {
749
+ $defaults['views'] = __( 'Views', 'wp-postviews' );
750
+ return $defaults;
751
+ }
752
+
753
+
754
+ ### Functions Fill In The Views Count
755
+ function add_postviews_column_content($column_name) {
756
+ if($column_name == 'views') {
757
+ if(function_exists('the_views')) { the_views(true, '', '', true); }
758
+ }
759
+ }
760
+
761
+
762
+ ### Function Sort Columns
763
+ add_filter('manage_edit-post_sortable_columns', 'sort_postviews_column');
764
+ add_filter('manage_edit-page_sortable_columns', 'sort_postviews_column');
765
+ function sort_postviews_column($defaults)
766
+ {
767
+ $defaults['views'] = 'views';
768
+ return $defaults;
769
+ }
770
+ add_action('pre_get_posts', 'sort_postviews');
771
+ function sort_postviews($query) {
772
+ if(!is_admin())
773
+ return;
774
+ $orderby = $query->get('orderby');
775
+ if('views' == $orderby) {
776
+ $query->set('meta_key', 'views');
777
+ $query->set('orderby', 'meta_value_num');
778
+ }
779
+ }
780
+
781
+
782
+ ### Class: WP-PostViews Widget
783
+ class WP_Widget_PostViews extends WP_Widget {
784
+ // Constructor
785
+ function WP_Widget_PostViews() {
786
+ $widget_ops = array('description' => __('WP-PostViews views statistics', 'wp-postviews'));
787
+ $this->WP_Widget('views', __('Views', 'wp-postviews'), $widget_ops);
788
+ }
789
+
790
+ // Display Widget
791
+ function widget($args, $instance) {
792
+ extract($args);
793
+ $title = apply_filters('widget_title', esc_attr($instance['title']));
794
+ $type = esc_attr($instance['type']);
795
+ $mode = esc_attr($instance['mode']);
796
+ $limit = intval($instance['limit']);
797
+ $chars = intval($instance['chars']);
798
+ $cat_ids = explode(',', esc_attr($instance['cat_ids']));
799
+ echo $before_widget.$before_title.$title.$after_title;
800
+ echo '<ul>'."\n";
801
+ switch($type) {
802
+ case 'least_viewed':
803
+ get_least_viewed($mode, $limit, $chars);
804
+ break;
805
+ case 'most_viewed':
806
+ get_most_viewed($mode, $limit, $chars);
807
+ break;
808
+ case 'most_viewed_category':
809
+ get_most_viewed_category($cat_ids, $mode, $limit, $chars);
810
+ break;
811
+ case 'least_viewed_category':
812
+ get_least_viewed_category($cat_ids, $mode, $limit, $chars);
813
+ break;
814
+ }
815
+ echo '</ul>'."\n";
816
+ echo $after_widget;
817
+ }
818
+
819
+ // When Widget Control Form Is Posted
820
+ function update($new_instance, $old_instance) {
821
+ if (!isset($new_instance['submit'])) {
822
+ return false;
823
+ }
824
+ $instance = $old_instance;
825
+ $instance['title'] = strip_tags($new_instance['title']);
826
+ $instance['type'] = strip_tags($new_instance['type']);
827
+ $instance['mode'] = strip_tags($new_instance['mode']);
828
+ $instance['limit'] = intval($new_instance['limit']);
829
+ $instance['chars'] = intval($new_instance['chars']);
830
+ $instance['cat_ids'] = strip_tags($new_instance['cat_ids']);
831
+ return $instance;
832
+ }
833
+
834
+ // DIsplay Widget Control Form
835
+ function form($instance) {
836
+ global $wpdb;
837
+ $instance = wp_parse_args((array) $instance, array('title' => __('Views', 'wp-postviews'), 'type' => 'most_viewed', 'mode' => 'both', 'limit' => 10, 'chars' => 200, 'cat_ids' => '0'));
838
+ $title = esc_attr($instance['title']);
839
+ $type = esc_attr($instance['type']);
840
+ $mode = esc_attr($instance['mode']);
841
+ $limit = intval($instance['limit']);
842
+ $chars = intval($instance['chars']);
843
+ $cat_ids = esc_attr($instance['cat_ids']);
844
+ ?>
845
+ <p>
846
+ <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></label>
847
+ </p>
848
+ <p>
849
+ <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e('Statistics Type:', 'wp-postviews'); ?>
850
+ <select name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>" class="widefat">
851
+ <option value="least_viewed"<?php selected('least_viewed', $type); ?>><?php _e('Least Viewed', 'wp-postviews'); ?></option>
852
+ <option value="least_viewed_category"<?php selected('least_viewed_category', $type); ?>><?php _e('Least Viewed By Category', 'wp-postviews'); ?></option>
853
+ <optgroup>&nbsp;</optgroup>
854
+ <option value="most_viewed"<?php selected('most_viewed', $type); ?>><?php _e('Most Viewed', 'wp-postviews'); ?></option>
855
+ <option value="most_viewed_category"<?php selected('most_viewed_category', $type); ?>><?php _e('Most Viewed By Category', 'wp-postviews'); ?></option>
856
+ </select>
857
+ </label>
858
+ </p>
859
+ <p>
860
+ <label for="<?php echo $this->get_field_id('mode'); ?>"><?php _e('Include Views From:', 'wp-postviews'); ?>
861
+ <select name="<?php echo $this->get_field_name('mode'); ?>" id="<?php echo $this->get_field_id('mode'); ?>" class="widefat">
862
+ <option value="both"<?php selected('both', $mode); ?>><?php _e('Posts &amp; Pages', 'wp-postviews'); ?></option>
863
+ <option value="post"<?php selected('post', $mode); ?>><?php _e('Posts Only', 'wp-postviews'); ?></option>
864
+ <option value="page"<?php selected('page', $mode); ?>><?php _e('Pages Only', 'wp-postviews'); ?></option>
865
+ </select>
866
+ </label>
867
+ </p>
868
+ <p>
869
+ <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('No. Of Records To Show:', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="text" value="<?php echo $limit; ?>" /></label>
870
+ </p>
871
+ <p>
872
+ <label for="<?php echo $this->get_field_id('chars'); ?>"><?php _e('Maximum Post Title Length (Characters):', 'wp-postviews'); ?> <input class="widefat" id="<?php echo $this->get_field_id('chars'); ?>" name="<?php echo $this->get_field_name('chars'); ?>" type="text" value="<?php echo $chars; ?>" /></label><br />
873
+ <small><?php _e('<strong>0</strong> to disable.', 'wp-postviews'); ?></small>
874
+ </p>
875
+ <p>
876
+ <label for="<?php echo $this->get_field_id('cat_ids'); ?>"><?php _e('Category IDs:', 'wp-postviews'); ?> <span style="color: red;">*</span> <input class="widefat" id="<?php echo $this->get_field_id('cat_ids'); ?>" name="<?php echo $this->get_field_name('cat_ids'); ?>" type="text" value="<?php echo $cat_ids; ?>" /></label><br />
877
+ <small><?php _e('Seperate mutiple categories with commas.', 'wp-postviews'); ?></small>
878
+ </p>
879
+ <p style="color: red;">
880
+ <small><?php _e('* If you are not using any category statistics, you can ignore it.', 'wp-postviews'); ?></small>
881
+ <p>
882
+ <input type="hidden" id="<?php echo $this->get_field_id('submit'); ?>" name="<?php echo $this->get_field_name('submit'); ?>" value="1" />
883
+ <?php
884
+ }
885
+ }
886
+
887
+
888
+ ### Function: Init WP-PostViews Widget
889
+ add_action( 'widgets_init', 'widget_views_init' );
890
+ function widget_views_init() {
891
+ register_widget( 'WP_Widget_PostViews' );
892
+ }
893
+
894
+
895
+ ### Function: Post Views Options
896
+ register_activation_hook( __FILE__, 'views_activation' );
897
+ function views_activation( $network_wide ) {
898
+ // Add Options
899
+ $option_name = 'views_options';
900
+ $option = array(
901
+ 'count' => 1
902
+ , 'exclude_bots' => 0
903
+ , 'display_home' => 0
904
+ , 'display_single' => 0
905
+ , 'display_page' => 0
906
+ , 'display_archive' => 0
907
+ , 'display_search' => 0
908
+ , 'display_other' => 0
909
+ , 'template' => __('%VIEW_COUNT% views', 'wp-postviews')
910
+ , 'most_viewed_template' => '<li><a href="%POST_URL%" title="%POST_TITLE%">%POST_TITLE%</a> - %VIEW_COUNT% '.__('views', 'wp-postviews').'</li>'
911
+ );
912
+
913
+ if ( is_multisite() && $network_wide )
914
+ {
915
+ $ms_sites = wp_get_sites();
916
+
917
+ if( 0 < sizeof( $ms_sites ) )
918
+ {
919
+ foreach ( $ms_sites as $ms_site )
920
+ {
921
+ switch_to_blog( $ms_site['blog_id'] );
922
+ add_option( $option_name, $option );
923
+ }
924
+ }
925
+
926
+ restore_current_blog();
927
+ }
928
+ else
929
+ {
930
+ add_option( $option_name, $option );
931
+ }
932
+ }
933
  ?>
wp-postviews.pot CHANGED
@@ -1,23 +1,18 @@
 
 
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: WP-PostViews 1.50\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2009-06-12 19:08+0800\n"
6
- "PO-Revision-Date: 2009-06-12 19:08+0800\n"
7
- "Last-Translator: Lester Chan <lesterchan@gmail.com>\n"
8
- "Language-Team: Lester Chan <lesterchan@gmail.com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-Language: English\n"
13
- "X-Poedit-Country: SINGAPORE\n"
14
- "X-Poedit-KeywordsList: __;_e;_n:1,2;__ngettext_noop:1,2\n"
15
- "X-Poedit-Basepath: .\n"
16
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
17
- "X-Poedit-SearchPath-0: .\n"
18
-
19
- #: postviews-options.php:46
20
- #: postviews-options.php:139
21
  msgid "Post Views Options"
22
  msgstr ""
23
 
@@ -29,48 +24,41 @@ msgstr ""
29
  msgid "No Post Views Option Updated"
30
  msgstr ""
31
 
32
- #: postviews-options.php:63
33
- #: postviews-options.php:303
34
  msgid "UNINSTALL WP-PostViews"
35
  msgstr ""
36
 
37
  #: postviews-options.php:71
38
- #, php-format
39
  msgid "Setting Key '%s' has been deleted."
40
  msgstr ""
41
 
42
  #: postviews-options.php:75
43
- #, php-format
44
  msgid "Error deleting Setting Key '%s'."
45
  msgstr ""
46
 
47
  #: postviews-options.php:85
48
- #, php-format
49
  msgid "Post Meta Key '%s' has been deleted."
50
  msgstr ""
51
 
52
  #: postviews-options.php:89
53
- #, php-format
54
  msgid "Error deleting Post Meta Key '%s'."
55
  msgstr ""
56
 
57
- #: postviews-options.php:111
58
- #: postviews-options.php:261
59
  msgid "Uninstall WP-PostViews"
60
  msgstr ""
61
 
62
  #: postviews-options.php:112
63
- #, php-format
64
- msgid "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-PostViews Will Be Deactivated Automatically."
 
65
  msgstr ""
66
 
67
- #: postviews-options.php:125
68
- #: wp-postviews.php:784
69
  msgid "%VIEW_COUNT% views"
70
  msgstr ""
71
 
72
- #: postviews-options.php:128
73
- #: wp-postviews.php:785
74
  msgid "views"
75
  msgstr ""
76
 
@@ -98,8 +86,7 @@ msgstr ""
98
  msgid "No"
99
  msgstr ""
100
 
101
- #: postviews-options.php:156
102
- #: postviews-options.php:302
103
  msgid "Yes"
104
  msgstr ""
105
 
@@ -107,13 +94,11 @@ msgstr ""
107
  msgid "Views Template:"
108
  msgstr ""
109
 
110
- #: postviews-options.php:163
111
- #: postviews-options.php:174
112
  msgid "Allowed Variables:"
113
  msgstr ""
114
 
115
- #: postviews-options.php:165
116
- #: postviews-options.php:180
117
  msgid "Restore Default Template"
118
  msgstr ""
119
 
@@ -126,28 +111,26 @@ msgid "Display Options"
126
  msgstr ""
127
 
128
  #: postviews-options.php:188
129
- msgid "These options specify where the view counts should be displayed and to whom. \tBy default view counts will be displayed to all visitors. Note that the theme files must contain a call to <code>the_views()</code> in order for any view count to be displayed."
 
 
 
 
130
  msgstr ""
131
 
132
  #: postviews-options.php:191
133
  msgid "Home Page:"
134
  msgstr ""
135
 
136
- #: postviews-options.php:194
137
- #: postviews-options.php:204
138
- #: postviews-options.php:214
139
- #: postviews-options.php:224
140
- #: postviews-options.php:234
141
- #: postviews-options.php:244
142
  msgid "Display to everyone"
143
  msgstr ""
144
 
145
- #: postviews-options.php:195
146
- #: postviews-options.php:205
147
- #: postviews-options.php:215
148
- #: postviews-options.php:225
149
- #: postviews-options.php:235
150
- #: postviews-options.php:245
151
  msgid "Display to registered users only"
152
  msgstr ""
153
 
@@ -200,7 +183,10 @@ msgid "Save Changes"
200
  msgstr ""
201
 
202
  #: postviews-options.php:263
203
- msgid "Deactivating WP-PostViews plugin does not remove any data that may have been created, such as the views data. To completely remove this plugin, you can uninstall it here."
 
 
 
204
  msgstr ""
205
 
206
  #: postviews-options.php:266
@@ -208,7 +194,9 @@ msgid "WARNING:"
208
  msgstr ""
209
 
210
  #: postviews-options.php:267
211
- msgid "Once uninstalled, this cannot be undone. You should use a Database Backup plugin of WordPress to back up all the data first."
 
 
212
  msgstr ""
213
 
214
  #: postviews-options.php:270
@@ -225,130 +213,135 @@ msgstr ""
225
 
226
  #: postviews-options.php:303
227
  msgid ""
228
- "You Are About To Uninstall WP-PostViews From WordPress.\\n"
229
- "This Action Is Not Reversible.\\n"
230
- "\\n"
231
- " Choose [Cancel] To Stop, [OK] To Uninstall."
232
  msgstr ""
233
 
234
- #: wp-postviews.php:53
235
  msgid "PostViews"
236
  msgstr ""
237
 
238
- #: wp-postviews.php:200
239
- #: wp-postviews.php:243
240
- #: wp-postviews.php:291
241
- #: wp-postviews.php:339
242
- #: wp-postviews.php:387
243
- #: wp-postviews.php:435
244
  msgid "N/A"
245
  msgstr ""
246
 
247
- #: wp-postviews.php:486
248
  msgid "There is no excerpt because this is a protected post."
249
  msgstr ""
250
 
251
- #: wp-postviews.php:583
252
- #: wp-postviews.php:585
253
- #: wp-postviews.php:613
254
  msgid "WP-PostViews"
255
  msgstr ""
256
 
257
- #: wp-postviews.php:596
258
- #: wp-postviews.php:598
259
- #: wp-postviews.php:627
260
- #, php-format
261
  msgid "%s Most Viewed Post"
262
  msgid_plural "%s Most Viewed Posts"
263
  msgstr[0] ""
264
  msgstr[1] ""
265
 
266
- #: wp-postviews.php:601
267
- #: wp-postviews.php:603
268
- #: wp-postviews.php:633
269
- #, php-format
270
  msgid "%s Most Viewed Page"
271
  msgid_plural "%s Most Viewed Pages"
272
  msgstr[0] ""
273
  msgstr[1] ""
274
 
275
- #: wp-postviews.php:615
276
- #, php-format
277
  msgid "<strong>%s</strong> view was generated."
278
  msgid_plural "<strong>%s</strong> views were generated."
279
  msgstr[0] ""
280
  msgstr[1] ""
281
 
282
- #: wp-postviews.php:661
283
  msgid "WP-PostViews views statistics"
284
  msgstr ""
285
 
286
- #: wp-postviews.php:662
287
- #: wp-postviews.php:712
288
  msgid "Views"
289
  msgstr ""
290
 
291
- #: wp-postviews.php:721
292
  msgid "Title:"
293
  msgstr ""
294
 
295
- #: wp-postviews.php:724
296
  msgid "Statistics Type:"
297
  msgstr ""
298
 
299
- #: wp-postviews.php:726
300
  msgid "Least Viewed"
301
  msgstr ""
302
 
303
- #: wp-postviews.php:727
304
  msgid "Least Viewed By Category"
305
  msgstr ""
306
 
307
- #: wp-postviews.php:729
308
  msgid "Most Viewed"
309
  msgstr ""
310
 
311
- #: wp-postviews.php:730
312
  msgid "Most Viewed By Category"
313
  msgstr ""
314
 
315
- #: wp-postviews.php:735
316
  msgid "Include Views From:"
317
  msgstr ""
318
 
319
- #: wp-postviews.php:737
320
  msgid "Posts &amp; Pages"
321
  msgstr ""
322
 
323
- #: wp-postviews.php:738
324
  msgid "Posts Only"
325
  msgstr ""
326
 
327
- #: wp-postviews.php:739
328
  msgid "Pages Only"
329
  msgstr ""
330
 
331
- #: wp-postviews.php:744
332
  msgid "No. Of Records To Show:"
333
  msgstr ""
334
 
335
- #: wp-postviews.php:747
336
  msgid "Maximum Post Title Length (Characters):"
337
  msgstr ""
338
 
339
- #: wp-postviews.php:748
340
  msgid "<strong>0</strong> to disable."
341
  msgstr ""
342
 
343
- #: wp-postviews.php:751
344
  msgid "Category IDs:"
345
  msgstr ""
346
 
347
- #: wp-postviews.php:752
348
  msgid "Seperate mutiple categories with commas."
349
  msgstr ""
350
 
351
- #: wp-postviews.php:755
352
  msgid "* If you are not using any category statistics, you can ignore it."
353
  msgstr ""
354
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012 WP-PostViews
2
+ # This file is distributed under the same license as the WP-PostViews package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP-PostViews 1.61\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-postviews\n"
7
+ "POT-Creation-Date: 2012-05-22 00:48:11+00:00\n"
 
 
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2012-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: postviews-options.php:46 postviews-options.php:139
 
 
 
 
16
  msgid "Post Views Options"
17
  msgstr ""
18
 
24
  msgid "No Post Views Option Updated"
25
  msgstr ""
26
 
27
+ #: postviews-options.php:63 postviews-options.php:303
 
28
  msgid "UNINSTALL WP-PostViews"
29
  msgstr ""
30
 
31
  #: postviews-options.php:71
 
32
  msgid "Setting Key '%s' has been deleted."
33
  msgstr ""
34
 
35
  #: postviews-options.php:75
 
36
  msgid "Error deleting Setting Key '%s'."
37
  msgstr ""
38
 
39
  #: postviews-options.php:85
 
40
  msgid "Post Meta Key '%s' has been deleted."
41
  msgstr ""
42
 
43
  #: postviews-options.php:89
 
44
  msgid "Error deleting Post Meta Key '%s'."
45
  msgstr ""
46
 
47
+ #: postviews-options.php:111 postviews-options.php:261
 
48
  msgid "Uninstall WP-PostViews"
49
  msgstr ""
50
 
51
  #: postviews-options.php:112
52
+ msgid ""
53
+ "<a href=\"%s\">Click Here</a> To Finish The Uninstallation And WP-PostViews "
54
+ "Will Be Deactivated Automatically."
55
  msgstr ""
56
 
57
+ #: postviews-options.php:125 wp-postviews.php:797
 
58
  msgid "%VIEW_COUNT% views"
59
  msgstr ""
60
 
61
+ #: postviews-options.php:128 wp-postviews.php:798
 
62
  msgid "views"
63
  msgstr ""
64
 
86
  msgid "No"
87
  msgstr ""
88
 
89
+ #: postviews-options.php:156 postviews-options.php:302
 
90
  msgid "Yes"
91
  msgstr ""
92
 
94
  msgid "Views Template:"
95
  msgstr ""
96
 
97
+ #: postviews-options.php:163 postviews-options.php:174
 
98
  msgid "Allowed Variables:"
99
  msgstr ""
100
 
101
+ #: postviews-options.php:165 postviews-options.php:180
 
102
  msgid "Restore Default Template"
103
  msgstr ""
104
 
111
  msgstr ""
112
 
113
  #: postviews-options.php:188
114
+ msgid ""
115
+ "These options specify where the view counts should be displayed and to whom. "
116
+ "\tBy default view counts will be displayed to all visitors. Note that the "
117
+ "theme files must contain a call to <code>the_views()</code> in order for any "
118
+ "view count to be displayed."
119
  msgstr ""
120
 
121
  #: postviews-options.php:191
122
  msgid "Home Page:"
123
  msgstr ""
124
 
125
+ #: postviews-options.php:194 postviews-options.php:204
126
+ #: postviews-options.php:214 postviews-options.php:224
127
+ #: postviews-options.php:234 postviews-options.php:244
 
 
 
128
  msgid "Display to everyone"
129
  msgstr ""
130
 
131
+ #: postviews-options.php:195 postviews-options.php:205
132
+ #: postviews-options.php:215 postviews-options.php:225
133
+ #: postviews-options.php:235 postviews-options.php:245
 
 
 
134
  msgid "Display to registered users only"
135
  msgstr ""
136
 
183
  msgstr ""
184
 
185
  #: postviews-options.php:263
186
+ msgid ""
187
+ "Deactivating WP-PostViews plugin does not remove any data that may have been "
188
+ "created, such as the views data. To completely remove this plugin, you can "
189
+ "uninstall it here."
190
  msgstr ""
191
 
192
  #: postviews-options.php:266
194
  msgstr ""
195
 
196
  #: postviews-options.php:267
197
+ msgid ""
198
+ "Once uninstalled, this cannot be undone. You should use a Database Backup "
199
+ "plugin of WordPress to back up all the data first."
200
  msgstr ""
201
 
202
  #: postviews-options.php:270
213
 
214
  #: postviews-options.php:303
215
  msgid ""
216
+ "You Are About To Uninstall WP-PostViews From WordPress.\\nThis Action Is Not "
217
+ "Reversible.\\n\\n Choose [Cancel] To Stop, [OK] To Uninstall."
 
 
218
  msgstr ""
219
 
220
+ #: wp-postviews.php:42
221
  msgid "PostViews"
222
  msgstr ""
223
 
224
+ #: wp-postviews.php:191 wp-postviews.php:233 wp-postviews.php:280
225
+ #: wp-postviews.php:327 wp-postviews.php:374 wp-postviews.php:421
 
 
 
 
226
  msgid "N/A"
227
  msgstr ""
228
 
229
+ #: wp-postviews.php:472
230
  msgid "There is no excerpt because this is a protected post."
231
  msgstr ""
232
 
233
+ #. #-#-#-#-# plugin.pot (WP-PostViews 1.61) #-#-#-#-#
234
+ #. Plugin Name of the plugin/theme
235
+ #: wp-postviews.php:574 wp-postviews.php:576 wp-postviews.php:604
236
  msgid "WP-PostViews"
237
  msgstr ""
238
 
239
+ #: wp-postviews.php:587 wp-postviews.php:589 wp-postviews.php:618
 
 
 
240
  msgid "%s Most Viewed Post"
241
  msgid_plural "%s Most Viewed Posts"
242
  msgstr[0] ""
243
  msgstr[1] ""
244
 
245
+ #: wp-postviews.php:592 wp-postviews.php:594 wp-postviews.php:624
 
 
 
246
  msgid "%s Most Viewed Page"
247
  msgid_plural "%s Most Viewed Pages"
248
  msgstr[0] ""
249
  msgstr[1] ""
250
 
251
+ #: wp-postviews.php:606
 
252
  msgid "<strong>%s</strong> view was generated."
253
  msgid_plural "<strong>%s</strong> views were generated."
254
  msgstr[0] ""
255
  msgstr[1] ""
256
 
257
+ #: wp-postviews.php:674
258
  msgid "WP-PostViews views statistics"
259
  msgstr ""
260
 
261
+ #: wp-postviews.php:675 wp-postviews.php:725
 
262
  msgid "Views"
263
  msgstr ""
264
 
265
+ #: wp-postviews.php:734
266
  msgid "Title:"
267
  msgstr ""
268
 
269
+ #: wp-postviews.php:737
270
  msgid "Statistics Type:"
271
  msgstr ""
272
 
273
+ #: wp-postviews.php:739
274
  msgid "Least Viewed"
275
  msgstr ""
276
 
277
+ #: wp-postviews.php:740
278
  msgid "Least Viewed By Category"
279
  msgstr ""
280
 
281
+ #: wp-postviews.php:742
282
  msgid "Most Viewed"
283
  msgstr ""
284
 
285
+ #: wp-postviews.php:743
286
  msgid "Most Viewed By Category"
287
  msgstr ""
288
 
289
+ #: wp-postviews.php:748
290
  msgid "Include Views From:"
291
  msgstr ""
292
 
293
+ #: wp-postviews.php:750
294
  msgid "Posts &amp; Pages"
295
  msgstr ""
296
 
297
+ #: wp-postviews.php:751
298
  msgid "Posts Only"
299
  msgstr ""
300
 
301
+ #: wp-postviews.php:752
302
  msgid "Pages Only"
303
  msgstr ""
304
 
305
+ #: wp-postviews.php:757
306
  msgid "No. Of Records To Show:"
307
  msgstr ""
308
 
309
+ #: wp-postviews.php:760
310
  msgid "Maximum Post Title Length (Characters):"
311
  msgstr ""
312
 
313
+ #: wp-postviews.php:761
314
  msgid "<strong>0</strong> to disable."
315
  msgstr ""
316
 
317
+ #: wp-postviews.php:764
318
  msgid "Category IDs:"
319
  msgstr ""
320
 
321
+ #: wp-postviews.php:765
322
  msgid "Seperate mutiple categories with commas."
323
  msgstr ""
324
 
325
+ #: wp-postviews.php:768
326
  msgid "* If you are not using any category statistics, you can ignore it."
327
  msgstr ""
328
 
329
+ #. Plugin URI of the plugin/theme
330
+ msgid "http://lesterchan.net/portfolio/programming/php/"
331
+ msgstr ""
332
+
333
+ #. Description of the plugin/theme
334
+ msgid ""
335
+ "Enables you to display how many times a post/page had been viewed. Modified "
336
+ "by <a href=\"http://DPotter.net/Technical/\" title=\"David's Technical "
337
+ "Musings\">David Potter</a> to include options for when and where to display "
338
+ "view counts."
339
+ msgstr ""
340
+
341
+ #. Author of the plugin/theme
342
+ msgid "Lester 'GaMerZ' Chan"
343
+ msgstr ""
344
+
345
+ #. Author URI of the plugin/theme
346
+ msgid "http://lesterchan.net"
347
+ msgstr ""