Post Views Counter - Version 1.0.6

Version Description

  • New: Object cache support, thanks to Tomas Trkulja
  • New: Hebrew translation, thanks to Ahrale Shrem
Download this release

Release Info

Developer dfactory
Plugin Icon 128x128 Post Views Counter
Version 1.0.6
Comparing to
See all releases

Code changes from version 1.0.5 to 1.0.6

includes/columns.php CHANGED
@@ -3,28 +3,24 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Columns();
5
 
6
- class Post_Views_Counter_Columns
7
- {
8
- public function __construct()
9
- {
10
  // actions
11
  add_action('current_screen', array(&$this, 'register_new_column'));
12
  }
13
 
14
-
15
  /**
16
- *
17
  */
18
- public function register_new_column()
19
- {
20
  $screen = get_current_screen();
21
 
22
- if(Post_Views_Counter()->get_attribute('options', 'general', 'post_views_column') && ($screen->base == 'edit' && in_array($screen->post_type, Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count'))))
23
- {
24
- foreach(Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count') as $post_type)
25
- {
26
- if($post_type === 'page' && $screen->post_type === 'page')
27
- {
28
  // actions
29
  add_action('manage_pages_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
30
 
@@ -32,8 +28,7 @@ class Post_Views_Counter_Columns
32
  add_filter('manage_pages_columns', array(&$this, 'add_new_column'));
33
  add_filter('manage_edit-page_sortable_columns', array(&$this, 'register_sortable_custom_column'));
34
  }
35
- elseif($post_type === 'post' && $screen->post_type === 'post')
36
- {
37
  // actions
38
  add_action('manage_posts_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
39
 
@@ -41,8 +36,7 @@ class Post_Views_Counter_Columns
41
  add_filter('manage_posts_columns', array(&$this, 'add_new_column'));
42
  add_filter('manage_edit-post_sortable_columns', array(&$this, 'register_sortable_custom_column'));
43
  }
44
- elseif($screen->post_type === $post_type)
45
- {
46
  // actions
47
  add_action('manage_'.$post_type.'_posts_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
48
 
@@ -50,70 +44,43 @@ class Post_Views_Counter_Columns
50
  add_filter('manage_'.$post_type.'_posts_columns', array(&$this, 'add_new_column'));
51
  add_filter('manage_edit-'.$post_type.'_sortable_columns', array(&$this, 'register_sortable_custom_column'));
52
  }
 
53
  }
54
  }
55
  }
56
 
57
-
58
  /**
59
- * Registers sortable column
60
  */
61
- public function register_sortable_custom_column($columns)
62
- {
63
- // adds new sortable column
64
  $columns['post_views'] = 'post_views';
65
 
66
  return $columns;
67
  }
68
-
69
-
70
  /**
71
- * Adds new content to specific column
72
  */
73
- public function add_new_column_content($column_name, $id)
74
- {
75
- if($column_name === 'post_views')
76
- {
77
- global $wpdb;
78
-
79
- // gets post views
80
- $views = $wpdb->get_var(
81
- $wpdb->prepare("
82
- SELECT count
83
- FROM ".$wpdb->prefix."post_views
84
- WHERE id = %d AND type = 4",
85
- $id
86
- )
87
- );
88
-
89
- echo (int)$views;
90
- }
91
- }
92
-
93
-
94
- public function add_new_column($columns)
95
- {
96
  $offset = 0;
97
 
98
- if(isset($columns['date']))
99
  $offset++;
100
 
101
- if(isset($columns['comments']))
102
  $offset++;
103
 
104
- if($offset > 0)
105
- {
106
  $date = array_slice($columns, -$offset, $offset, true);
107
 
108
- foreach($date as $column => $name)
109
- {
110
  unset($columns[$column]);
111
  }
112
 
113
  $columns['post_views'] = __('Post Views', 'post-views-counter');
114
 
115
- foreach($date as $column => $name)
116
- {
117
  $columns[$column] = $name;
118
  }
119
  }
@@ -122,5 +89,28 @@ class Post_Views_Counter_Columns
122
 
123
  return $columns;
124
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
125
  }
126
  ?>
3
 
4
  new Post_Views_Counter_Columns();
5
 
6
+ class Post_Views_Counter_Columns {
7
+
8
+ public function __construct() {
 
9
  // actions
10
  add_action('current_screen', array(&$this, 'register_new_column'));
11
  }
12
 
 
13
  /**
14
+ * Register post views column for specific post types
15
  */
16
+ public function register_new_column() {
 
17
  $screen = get_current_screen();
18
 
19
+ if (Post_Views_Counter()->get_attribute('options', 'general', 'post_views_column') && ($screen->base == 'edit' && in_array($screen->post_type, Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count')))) {
20
+
21
+ foreach (Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count') as $post_type) {
22
+
23
+ if ($post_type === 'page' && $screen->post_type === 'page') {
 
24
  // actions
25
  add_action('manage_pages_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
26
 
28
  add_filter('manage_pages_columns', array(&$this, 'add_new_column'));
29
  add_filter('manage_edit-page_sortable_columns', array(&$this, 'register_sortable_custom_column'));
30
  }
31
+ elseif ($post_type === 'post' && $screen->post_type === 'post') {
 
32
  // actions
33
  add_action('manage_posts_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
34
 
36
  add_filter('manage_posts_columns', array(&$this, 'add_new_column'));
37
  add_filter('manage_edit-post_sortable_columns', array(&$this, 'register_sortable_custom_column'));
38
  }
39
+ elseif ($screen->post_type === $post_type) {
 
40
  // actions
41
  add_action('manage_'.$post_type.'_posts_custom_column', array(&$this, 'add_new_column_content'), 10, 2);
42
 
44
  add_filter('manage_'.$post_type.'_posts_columns', array(&$this, 'add_new_column'));
45
  add_filter('manage_edit-'.$post_type.'_sortable_columns', array(&$this, 'register_sortable_custom_column'));
46
  }
47
+
48
  }
49
  }
50
  }
51
 
 
52
  /**
53
+ * Register sortable post views column
54
  */
55
+ public function register_sortable_custom_column($columns) {
56
+ // add new sortable column
 
57
  $columns['post_views'] = 'post_views';
58
 
59
  return $columns;
60
  }
61
+
 
62
  /**
63
+ * Add post views column
64
  */
65
+ public function add_new_column($columns) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  $offset = 0;
67
 
68
+ if (isset($columns['date']))
69
  $offset++;
70
 
71
+ if (isset($columns['comments']))
72
  $offset++;
73
 
74
+ if ($offset > 0) {
 
75
  $date = array_slice($columns, -$offset, $offset, true);
76
 
77
+ foreach ($date as $column => $name) {
 
78
  unset($columns[$column]);
79
  }
80
 
81
  $columns['post_views'] = __('Post Views', 'post-views-counter');
82
 
83
+ foreach ($date as $column => $name) {
 
84
  $columns[$column] = $name;
85
  }
86
  }
89
 
90
  return $columns;
91
  }
92
+
93
+ /**
94
+ * Add post views column content
95
+ */
96
+ public function add_new_column_content($column_name, $id) {
97
+
98
+ if ($column_name === 'post_views') {
99
+
100
+ global $wpdb;
101
+
102
+ // get total post views
103
+ $views = $wpdb->get_var(
104
+ $wpdb->prepare("
105
+ SELECT count
106
+ FROM ".$wpdb->prefix."post_views
107
+ WHERE id = %d AND type = 4",
108
+ $id
109
+ )
110
+ );
111
+
112
+ echo (int)$views;
113
+ }
114
+ }
115
  }
116
  ?>
includes/counter.php CHANGED
@@ -3,18 +3,20 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Counter();
5
 
6
- class Post_Views_Counter_Counter
7
- {
 
 
 
 
8
  private $cookie = array(
9
  'exists' => false,
10
  'visited_posts' => array(),
11
  'expiration' => 0
12
  );
13
 
14
-
15
- public function __construct()
16
- {
17
- // sets instance
18
  Post_Views_Counter()->add_instance('counter', $this);
19
 
20
  // actions
@@ -25,35 +27,29 @@ class Post_Views_Counter_Counter
25
  add_action('wp_ajax_nopriv_pvc-check-post', array(&$this, 'check_post_ajax'));
26
  }
27
 
28
-
29
  /**
30
- * Removes post views from database when post is deleted
31
  */
32
- public function delete_post_views($post_id)
33
- {
34
  global $wpdb;
35
 
36
  $wpdb->delete($wpdb->prefix.'post_views', array('id' => $post_id), array('%d'));
37
  }
38
 
39
-
40
  /**
41
- * Checks whether user has excluded roles
42
  */
43
- public function is_user_roles_excluded($option)
44
- {
45
  $user = wp_get_current_user();
46
 
47
- if(empty($user))
48
  return false;
49
 
50
  $roles = (array)$user->roles;
51
 
52
- if(!empty($roles))
53
- {
54
- foreach($roles as $role)
55
- {
56
- if(in_array($role, $option, true))
57
  return true;
58
  }
59
  }
@@ -61,12 +57,10 @@ class Post_Views_Counter_Counter
61
  return false;
62
  }
63
 
64
-
65
  /**
66
- * Gets timestamp convertion
67
  */
68
- public function get_timestamp($type, $number, $timestamp = true)
69
- {
70
  $converter = array(
71
  'minutes' => 60,
72
  'hours' => 3600,
@@ -79,58 +73,52 @@ class Post_Views_Counter_Counter
79
  return ($timestamp ? current_time('timestamp', true) : 0) + $number * $converter[$type];
80
  }
81
 
82
-
83
  /**
84
- * Checks whether to count visit via AJAX request
85
  */
86
- public function check_post_ajax()
87
- {
88
- if(isset($_POST['action'], $_POST['post_id'], $_POST['pvc_nonce'], $_POST['post_type']) && $_POST['action'] === 'pvc-check-post' && ($post_id = (int)$_POST['post_id']) > 0 && wp_verify_nonce($_POST['pvc_nonce'], 'pvc-check-post') !== false && Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'js')
89
- {
90
- // gets countable post types
91
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
92
 
93
- // gets post type
94
  $post_type = get_post_type($post_id);
95
 
96
- // whether to count this post type
97
- if(empty($post_types) || empty($post_type) || $post_type !== $_POST['post_type'] || !in_array($post_type, $post_types, true))
98
  exit;
99
 
100
- // gets excluded ips
101
  $excluded_ips = Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips');
102
 
103
- // whether to count this ip
104
- if(!empty($excluded_ips) && filter_var(preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP) && in_array($_SERVER['REMOTE_ADDR'], $excluded_ips, true))
105
  exit;
106
 
107
- // gets groups to check them faster
108
  $groups = Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups');
109
 
110
  // whether to count this user
111
- if(is_user_logged_in())
112
- {
113
  // exclude logged in users?
114
- if(in_array('users', $groups, true))
115
  exit;
116
  // exclude specific roles?
117
- elseif(in_array('roles', $groups, true) && $this->is_user_roles_excluded(Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles')))
118
  exit;
119
  }
120
  // exclude guests?
121
- elseif(in_array('guests', $groups, true))
122
  exit;
123
 
124
  // whether to count robots
125
- if($this->is_robot())
126
  exit;
127
 
128
  // cookie already existed?
129
- if($this->cookie['exists'])
130
- {
131
  // post already viewed but not expired?
132
- if(in_array($post_id, array_keys($this->cookie['visited_posts']), true) && current_time('timestamp', true) < $this->cookie['visited_posts'][$post_id])
133
- {
134
  // updates cookie but do not count visit
135
  $this->save_cookie($post_id, $this->cookie, false);
136
 
@@ -139,10 +127,10 @@ class Post_Views_Counter_Counter
139
  else
140
  // updates cookie
141
  $this->save_cookie($post_id, $this->cookie);
142
- }
143
- else
144
- // sets new cookie
145
  $this->save_cookie($post_id);
 
146
 
147
  // count visit
148
  $this->count_visit($post_id);
@@ -151,72 +139,66 @@ class Post_Views_Counter_Counter
151
  exit;
152
  }
153
 
154
-
155
  /**
156
- *
157
  */
158
- public function check_post()
159
- {
160
  // do not count admin entries
161
- if(is_admin())
162
  return;
163
 
164
  // do we use PHP as counter?
165
- if(Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'php')
166
- {
167
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
168
 
169
  // whether to count this post type
170
- if(empty($post_types) || !is_singular($post_types))
171
  return;
172
 
173
  $ips = Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips');
174
 
175
  // whether to count this ip
176
- if(!empty($ips) && filter_var(preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP) && in_array($_SERVER['REMOTE_ADDR'], $ips, true))
177
  return;
178
 
179
- // gets groups to check them faster
180
  $groups = Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups');
181
 
182
  // whether to count this user
183
- if(is_user_logged_in())
184
- {
185
  // exclude logged in users?
186
- if(in_array('users', $groups, true))
187
  return;
188
  // exclude specific roles?
189
- elseif(in_array('roles', $groups, true) && $this->is_user_roles_excluded(Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles')))
190
  return;
191
  }
192
  // exclude guests?
193
- elseif(in_array('guests', $groups, true))
194
  return;
195
 
196
  // whether to count robots
197
- if($this->is_robot())
198
  return;
199
 
200
- // gets post id
201
  $id = get_the_ID();
202
 
203
  // cookie already existed?
204
- if($this->cookie['exists'])
205
- {
206
  // post already viewed but not expired?
207
- if(in_array($id, array_keys($this->cookie['visited_posts']), true) && current_time('timestamp', true) < $this->cookie['visited_posts'][$id])
208
- {
209
- // updates cookie but do not count visit
210
  $this->save_cookie($id, $this->cookie, false);
211
 
212
  return;
213
  }
214
  else
215
- // updates cookie
216
  $this->save_cookie($id, $this->cookie);
217
  }
218
  else
219
- // sets new cookie
220
  $this->save_cookie($id);
221
 
222
  // count visit
@@ -224,32 +206,26 @@ class Post_Views_Counter_Counter
224
  }
225
  }
226
 
227
-
228
  /**
229
- * Initializes cookie session
230
  */
231
- public function check_cookie()
232
- {
233
- // do not run in admin except ajax requests
234
- if(is_admin() && !(defined('DOING_AJAX') && DOING_AJAX))
235
  return;
236
 
237
  // is cookie set?
238
- if(isset($_COOKIE['pvc_visits']) && !empty($_COOKIE['pvc_visits']))
239
- {
240
  $visited_posts = $expirations = array();
241
 
242
- foreach($_COOKIE['pvc_visits'] as $content)
243
- {
244
- // valid cookie?
245
- if(preg_match('/^(([0-9]+b[0-9]+a?)+)$/', $content) === 1)
246
- {
247
- // gets single id with expiration
248
  $expiration_ids = explode('a', $content);
249
 
250
- // checks every expiration => id pair
251
- foreach($expiration_ids as $pair)
252
- {
253
  $pair = explode('b', $pair);
254
  $expirations[] = (int)$pair[0];
255
  $visited_posts[(int)$pair[1]] = (int)$pair[0];
@@ -265,106 +241,110 @@ class Post_Views_Counter_Counter
265
  }
266
  }
267
 
268
-
269
  /**
270
- *
271
  */
272
- private function save_cookie($id, $cookie = array(), $expired = true)
273
- {
274
  $expiration = $this->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'number'));
275
 
276
- // is it a new cookie?
277
- if(empty($cookie))
278
- {
279
- // sets cookie
280
  setcookie('pvc_visits[0]', $expiration.'b'.$id, $expiration, COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? true : false), true);
281
- }
282
- else
283
- {
284
- if($expired)
285
- {
286
- // adds new id or changes expiration date if id already exists
287
  $cookie['visited_posts'][$id] = $expiration;
288
  }
289
 
290
- // creates copy for better foreach performance
291
  $visited_posts_expirations = $cookie['visited_posts'];
292
 
293
- // gets current gmt time
294
  $time = current_time('timestamp', true);
295
 
296
- // checks whether viewed id has expired - no need to keep it in cookie (less size)
297
- foreach($visited_posts_expirations as $post_id => $post_expiration)
298
- {
299
- if($time > $post_expiration)
300
  unset($cookie['visited_posts'][$post_id]);
301
  }
302
 
303
- // sets new last expiration date if needed
304
  $cookie['expiration'] = max($cookie['visited_posts']);
305
 
306
  $cookies = $imploded = array();
307
 
308
- // creates pairs
309
- foreach($cookie['visited_posts'] as $id => $exp)
310
- {
311
  $imploded[] = $exp.'b'.$id;
312
  }
313
 
314
- // splits cookie into chunks (4000 bytes to make sure it is safe for every browser)
315
  $chunks = str_split(implode('a', $imploded), 4000);
316
 
317
  // more then one chunk?
318
- if(count($chunks) > 1)
319
- {
320
  $last_id = '';
321
 
322
- foreach($chunks as $chunk_id => $chunk)
323
- {
324
  // new chunk
325
  $chunk_c = $last_id.$chunk;
326
 
327
  // is it full-length chunk?
328
- if(strlen($chunk) === 4000)
329
- {
330
- // gets last part
331
  $last_part = strrchr($chunk_c, 'a');
332
 
333
- // gets last id
334
  $last_id = substr($last_part, 1);
335
 
336
- // adds new full-lenght chunk
337
  $cookies[$chunk_id] = substr($chunk_c, 0, strlen($chunk_c) - strlen($last_part));
338
- }
339
- else
340
- // adds last chunk
341
  $cookies[$chunk_id] = $chunk_c;
 
342
  }
343
- }
344
- else
345
  // only one chunk
346
  $cookies[] = $chunks[0];
 
347
 
348
- foreach($cookies as $key => $value)
349
- {
350
- // sets cookie
351
  setcookie('pvc_visits['.$key.']', $value, $cookie['expiration'], COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? true : false), true);
352
  }
353
  }
354
  }
355
 
356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
357
  /**
358
- *
359
  */
360
- private function count_visit($id)
361
- {
362
  global $wpdb;
363
 
 
 
 
364
  // gets day, week, month and year
365
  $date = explode('-', date('W-d-m-Y', current_time('timestamp')));
366
 
367
- foreach(array(
368
  0 => $date[3].$date[2].$date[1], // day like 20140324
369
  1 => $date[3].$date[0], // week like 201439
370
  2 => $date[3].$date[2], // month like 201405
@@ -372,38 +352,146 @@ class Post_Views_Counter_Counter
372
  4 => 'total' // total views
373
  ) as $type => $period)
374
  {
375
- // updates views
376
- $wpdb->query(
377
- $wpdb->prepare("
378
- INSERT INTO ".$wpdb->prefix."post_views (id, type, period, count)
379
- VALUES (%d, %d, %s, 1)
380
- ON DUPLICATE KEY UPDATE count = count + 1",
381
- $id,
382
- $type,
383
- $period
384
- )
385
- );
386
  }
387
-
 
 
 
 
 
388
  do_action('pvc_after_count_visit', $id);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  /**
393
  * Checks whether visitor is a bot
394
  */
395
- private function is_robot()
396
- {
397
- if(!isset($_SERVER['HTTP_USER_AGENT']) || (isset($_SERVER['HTTP_USER_AGENT']) && trim($_SERVER['HTTP_USER_AGENT']) === ''))
398
  return false;
399
 
400
  $robots = array(
401
  'bot', 'b0t', 'Acme.Spider', 'Ahoy! The Homepage Finder', 'Alkaline', 'Anthill', 'Walhello appie', 'Arachnophilia', 'Arale', 'Araneo', 'ArchitextSpider', 'Aretha', 'ARIADNE', 'arks', 'AskJeeves', 'ASpider (Associative Spider)', 'ATN Worldwide', 'AURESYS', 'BackRub', 'Bay Spider', 'Big Brother', 'Bjaaland', 'BlackWidow', 'Die Blinde Kuh', 'Bloodhound', 'BSpider', 'CACTVS Chemistry Spider', 'Calif', 'Cassandra', 'Digimarc Marcspider/CGI', 'ChristCrawler.com', 'churl', 'cIeNcIaFiCcIoN.nEt', 'CMC/0.01', 'Collective', 'Combine System', 'Web Core / Roots', 'Cusco', 'CyberSpyder Link Test', 'CydralSpider', 'Desert Realm Spider', 'DeWeb(c) Katalog/Index', 'DienstSpider', 'Digger', 'Direct Hit Grabber', 'DownLoad Express', 'DWCP (Dridus\' Web Cataloging Project)', 'e-collector', 'EbiNess', 'Emacs-w3 Search Engine', 'ananzi', 'esculapio', 'Esther', 'Evliya Celebi', 'FastCrawler', 'Felix IDE', 'Wild Ferret Web Hopper #1, #2, #3', 'FetchRover', 'fido', 'KIT-Fireball', 'Fish search', 'Fouineur', 'Freecrawl', 'FunnelWeb', 'gammaSpider, FocusedCrawler', 'gazz', 'GCreep', 'GetURL', 'Golem', 'Grapnel/0.01 Experiment', 'Griffon', 'Gromit', 'Northern Light Gulliver', 'Harvest', 'havIndex', 'HI (HTML Index) Search', 'Hometown Spider Pro', 'ht://Dig', 'HTMLgobble', 'Hyper-Decontextualizer', 'IBM_Planetwide', 'Popular Iconoclast', 'Ingrid', 'Imagelock', 'IncyWincy', 'Informant', 'Infoseek Sidewinder', 'InfoSpiders', 'Inspector Web', 'IntelliAgent', 'Iron33', 'Israeli-search', 'JavaBee', 'JCrawler', 'Jeeves', 'JumpStation', 'image.kapsi.net', 'Katipo', 'KDD-Explorer', 'Kilroy', 'LabelGrabber', 'larbin', 'legs', 'Link Validator', 'LinkScan', 'LinkWalker', 'Lockon', 'logo.gif Crawler', 'Lycos', 'Mac WWWWorm', 'Magpie', 'marvin/infoseek', 'Mattie', 'MediaFox', 'MerzScope', 'NEC-MeshExplorer', 'MindCrawler', 'mnoGoSearch search engine software', 'moget', 'MOMspider', 'Monster', 'Motor', 'Muncher', 'Muninn', 'Muscat Ferret', 'Mwd.Search', 'Internet Shinchakubin', 'NDSpider', 'Nederland.zoek', 'NetCarta WebMap Engine', 'NetMechanic', 'NetScoop', 'newscan-online', 'NHSE Web Forager', 'Nomad', 'nzexplorer', 'ObjectsSearch', 'Occam', 'HKU WWW Octopus', 'OntoSpider', 'Openfind data gatherer', 'Orb Search', 'Pack Rat', 'PageBoy', 'ParaSite', 'Patric', 'pegasus', 'The Peregrinator', 'PerlCrawler 1.0', 'Phantom', 'PhpDig', 'PiltdownMan', 'Pioneer', 'html_analyzer', 'Portal Juice Spider', 'PGP Key Agent', 'PlumtreeWebAccessor', 'Poppi', 'PortalB Spider', 'GetterroboPlus Puu', 'Raven Search', 'RBSE Spider', 'RoadHouse Crawling System', 'ComputingSite Robi/1.0', 'RoboCrawl Spider', 'RoboFox', 'Robozilla', 'RuLeS', 'Scooter', 'Sleek', 'Search.Aus-AU.COM', 'SearchProcess', 'Senrigan', 'SG-Scout', 'ShagSeeker', 'Shai\'Hulud', 'Sift', 'Site Valet', 'SiteTech-Rover', 'Skymob.com', 'SLCrawler', 'Inktomi Slurp', 'Smart Spider', 'Snooper', 'Spanner', 'Speedy Spider', 'spider_monkey', 'Spiderline Crawler', 'SpiderMan', 'SpiderView(tm)', 'Site Searcher', 'Suke', 'suntek search engine', 'Sven', 'Sygol', 'TACH Black Widow', 'Tarantula', 'tarspider', 'Templeton', 'TeomaTechnologies', 'TITAN', 'TitIn', 'TLSpider', 'UCSD Crawl', 'UdmSearch', 'URL Check', 'URL Spider Pro', 'Valkyrie', 'Verticrawl', 'Victoria', 'vision-search', 'Voyager', 'W3M2', 'WallPaper (alias crawlpaper)', 'the World Wide Web Wanderer', 'w@pSpider by wap4.com', 'WebBandit Web Spider', 'WebCatcher', 'WebCopy', 'webfetcher', 'Webinator', 'weblayers', 'WebLinker', 'WebMirror', 'The Web Moose', 'WebQuest', 'Digimarc MarcSpider', 'WebReaper', 'webs', 'Websnarf', 'WebSpider', 'WebVac', 'webwalk', 'WebWalker', 'WebWatch', 'Wget', 'whatUseek Winona', 'Wired Digital', 'Weblog Monitor', 'w3mir', 'WebStolperer', 'The Web Wombat', 'The World Wide Web Worm', 'WWWC Ver 0.2.5', 'WebZinger', 'XGET'
402
  );
403
 
404
- foreach($robots as $robot)
405
- {
406
- if(stripos($_SERVER['HTTP_USER_AGENT'], $robot) !== false)
407
  return true;
408
  }
409
 
3
 
4
  new Post_Views_Counter_Counter();
5
 
6
+ class Post_Views_Counter_Counter {
7
+
8
+ const GROUP = 'pvc';
9
+ const NAME_ALLKEYS = 'cached_key_names';
10
+ const CACHE_KEY_SEPARATOR = '.';
11
+
12
  private $cookie = array(
13
  'exists' => false,
14
  'visited_posts' => array(),
15
  'expiration' => 0
16
  );
17
 
18
+ public function __construct() {
19
+ // set instance
 
 
20
  Post_Views_Counter()->add_instance('counter', $this);
21
 
22
  // actions
27
  add_action('wp_ajax_nopriv_pvc-check-post', array(&$this, 'check_post_ajax'));
28
  }
29
 
 
30
  /**
31
+ * Remove post views from database when post is deleted
32
  */
33
+ public function delete_post_views($post_id) {
 
34
  global $wpdb;
35
 
36
  $wpdb->delete($wpdb->prefix.'post_views', array('id' => $post_id), array('%d'));
37
  }
38
 
 
39
  /**
40
+ * Check whether user has excluded roles
41
  */
42
+ public function is_user_roles_excluded($option) {
 
43
  $user = wp_get_current_user();
44
 
45
+ if (empty($user))
46
  return false;
47
 
48
  $roles = (array)$user->roles;
49
 
50
+ if (!empty($roles)) {
51
+ foreach ($roles as $role) {
52
+ if (in_array($role, $option, true))
 
 
53
  return true;
54
  }
55
  }
57
  return false;
58
  }
59
 
 
60
  /**
61
+ * Get timestamp convertion
62
  */
63
+ public function get_timestamp($type, $number, $timestamp = true) {
 
64
  $converter = array(
65
  'minutes' => 60,
66
  'hours' => 3600,
73
  return ($timestamp ? current_time('timestamp', true) : 0) + $number * $converter[$type];
74
  }
75
 
 
76
  /**
77
+ * Check whether to count visit via AJAX request
78
  */
79
+ public function check_post_ajax() {
80
+ if (isset($_POST['action'], $_POST['post_id'], $_POST['pvc_nonce'], $_POST['post_type']) && $_POST['action'] === 'pvc-check-post' && ($post_id = (int)$_POST['post_id']) > 0 && wp_verify_nonce($_POST['pvc_nonce'], 'pvc-check-post') !== false && Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'js') {
81
+ // get countable post types
 
 
82
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
83
 
84
+ // get post type
85
  $post_type = get_post_type($post_id);
86
 
87
+ // whether to count this post type or not
88
+ if (empty($post_types) || empty($post_type) || $post_type !== $_POST['post_type'] || !in_array($post_type, $post_types, true))
89
  exit;
90
 
91
+ // get excluded ips
92
  $excluded_ips = Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips');
93
 
94
+ // whether to count this ip or not
95
+ if (!empty($excluded_ips) && filter_var(preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP) && in_array($_SERVER['REMOTE_ADDR'], $excluded_ips, true))
96
  exit;
97
 
98
+ // get groups to check them faster
99
  $groups = Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups');
100
 
101
  // whether to count this user
102
+ if (is_user_logged_in()) {
 
103
  // exclude logged in users?
104
+ if (in_array('users', $groups, true))
105
  exit;
106
  // exclude specific roles?
107
+ elseif (in_array('roles', $groups, true) && $this->is_user_roles_excluded(Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles')))
108
  exit;
109
  }
110
  // exclude guests?
111
+ elseif (in_array('guests', $groups, true))
112
  exit;
113
 
114
  // whether to count robots
115
+ if ($this->is_robot())
116
  exit;
117
 
118
  // cookie already existed?
119
+ if ($this->cookie['exists']) {
 
120
  // post already viewed but not expired?
121
+ if(in_array($post_id, array_keys($this->cookie['visited_posts']), true) && current_time('timestamp', true) < $this->cookie['visited_posts'][$post_id]) {
 
122
  // updates cookie but do not count visit
123
  $this->save_cookie($post_id, $this->cookie, false);
124
 
127
  else
128
  // updates cookie
129
  $this->save_cookie($post_id, $this->cookie);
130
+ } else {
131
+ // set new cookie
 
132
  $this->save_cookie($post_id);
133
+ }
134
 
135
  // count visit
136
  $this->count_visit($post_id);
139
  exit;
140
  }
141
 
 
142
  /**
143
+ * Check whether to count visit
144
  */
145
+ public function check_post() {
 
146
  // do not count admin entries
147
+ if (is_admin())
148
  return;
149
 
150
  // do we use PHP as counter?
151
+ if (Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'php') {
 
152
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
153
 
154
  // whether to count this post type
155
+ if (empty($post_types) || !is_singular($post_types))
156
  return;
157
 
158
  $ips = Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips');
159
 
160
  // whether to count this ip
161
+ if (!empty($ips) && filter_var(preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']), FILTER_VALIDATE_IP) && in_array($_SERVER['REMOTE_ADDR'], $ips, true))
162
  return;
163
 
164
+ // get groups to check them faster
165
  $groups = Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups');
166
 
167
  // whether to count this user
168
+ if (is_user_logged_in()) {
 
169
  // exclude logged in users?
170
+ if (in_array('users', $groups, true))
171
  return;
172
  // exclude specific roles?
173
+ elseif (in_array('roles', $groups, true) && $this->is_user_roles_excluded(Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles')))
174
  return;
175
  }
176
  // exclude guests?
177
+ elseif (in_array('guests', $groups, true))
178
  return;
179
 
180
  // whether to count robots
181
+ if ($this->is_robot())
182
  return;
183
 
184
+ // get post id
185
  $id = get_the_ID();
186
 
187
  // cookie already existed?
188
+ if ($this->cookie['exists']) {
 
189
  // post already viewed but not expired?
190
+ if (in_array($id, array_keys($this->cookie['visited_posts']), true) && current_time('timestamp', true) < $this->cookie['visited_posts'][$id]) {
191
+ // update cookie but do not count visit
 
192
  $this->save_cookie($id, $this->cookie, false);
193
 
194
  return;
195
  }
196
  else
197
+ // update cookie
198
  $this->save_cookie($id, $this->cookie);
199
  }
200
  else
201
+ // set new cookie
202
  $this->save_cookie($id);
203
 
204
  // count visit
206
  }
207
  }
208
 
 
209
  /**
210
+ * Initialize cookie session
211
  */
212
+ public function check_cookie() {
213
+ // do not run in admin except for ajax requests
214
+ if (is_admin() && !(defined('DOING_AJAX') && DOING_AJAX))
 
215
  return;
216
 
217
  // is cookie set?
218
+ if (isset($_COOKIE['pvc_visits']) && !empty($_COOKIE['pvc_visits'])) {
 
219
  $visited_posts = $expirations = array();
220
 
221
+ foreach ($_COOKIE['pvc_visits'] as $content) {
222
+ // is cookie valid?
223
+ if (preg_match('/^(([0-9]+b[0-9]+a?)+)$/', $content) === 1) {
224
+ // get single id with expiration
 
 
225
  $expiration_ids = explode('a', $content);
226
 
227
+ // check every expiration => id pair
228
+ foreach ($expiration_ids as $pair) {
 
229
  $pair = explode('b', $pair);
230
  $expirations[] = (int)$pair[0];
231
  $visited_posts[(int)$pair[1]] = (int)$pair[0];
241
  }
242
  }
243
 
 
244
  /**
245
+ * Save cookie function
246
  */
247
+ private function save_cookie($id, $cookie = array(), $expired = true) {
 
248
  $expiration = $this->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'number'));
249
 
250
+ // is this a new cookie?
251
+ if (empty($cookie)) {
252
+ // set cookie
 
253
  setcookie('pvc_visits[0]', $expiration.'b'.$id, $expiration, COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? true : false), true);
254
+ } else {
255
+ if ($expired) {
256
+ // add new id or chang expiration date if id already exists
 
 
 
257
  $cookie['visited_posts'][$id] = $expiration;
258
  }
259
 
260
+ // create copy for better foreach performance
261
  $visited_posts_expirations = $cookie['visited_posts'];
262
 
263
+ // get current gmt time
264
  $time = current_time('timestamp', true);
265
 
266
+ // check whether viewed id has expired - no need to keep it in cookie (less size)
267
+ foreach ($visited_posts_expirations as $post_id => $post_expiration) {
268
+ if ($time > $post_expiration)
 
269
  unset($cookie['visited_posts'][$post_id]);
270
  }
271
 
272
+ // set new last expiration date if needed
273
  $cookie['expiration'] = max($cookie['visited_posts']);
274
 
275
  $cookies = $imploded = array();
276
 
277
+ // create pairs
278
+ foreach ($cookie['visited_posts'] as $id => $exp) {
 
279
  $imploded[] = $exp.'b'.$id;
280
  }
281
 
282
+ // split cookie into chunks (4000 bytes to make sure it is safe for every browser)
283
  $chunks = str_split(implode('a', $imploded), 4000);
284
 
285
  // more then one chunk?
286
+ if (count($chunks) > 1) {
 
287
  $last_id = '';
288
 
289
+ foreach ($chunks as $chunk_id => $chunk) {
 
290
  // new chunk
291
  $chunk_c = $last_id.$chunk;
292
 
293
  // is it full-length chunk?
294
+ if (strlen($chunk) === 4000) {
295
+ // get last part
 
296
  $last_part = strrchr($chunk_c, 'a');
297
 
298
+ // get last id
299
  $last_id = substr($last_part, 1);
300
 
301
+ // add new full-lenght chunk
302
  $cookies[$chunk_id] = substr($chunk_c, 0, strlen($chunk_c) - strlen($last_part));
303
+ } else {
304
+ // add last chunk
 
305
  $cookies[$chunk_id] = $chunk_c;
306
+ }
307
  }
308
+
309
+ } else {
310
  // only one chunk
311
  $cookies[] = $chunks[0];
312
+ }
313
 
314
+ foreach ($cookies as $key => $value) {
315
+ // set cookie
 
316
  setcookie('pvc_visits['.$key.']', $value, $cookie['expiration'], COOKIEPATH, COOKIE_DOMAIN, (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? true : false), true);
317
  }
318
  }
319
  }
320
 
321
 
322
+ public function using_object_cache($using = null) {
323
+ $using = wp_using_ext_object_cache( $using );
324
+
325
+ if ( $using ) {
326
+ // Check if explicitly disabled by flush_interval setting/option <= 0
327
+ $flush_interval_number = Post_Views_Counter()->get_attribute('options', 'general', 'flush_interval', 'number');
328
+ $using = ( $flush_interval_number <= 0 ) ? false : true;
329
+ }
330
+
331
+ return $using;
332
+ }
333
+
334
+
335
  /**
336
+ *
337
  */
338
+ private function count_visit($id) {
 
339
  global $wpdb;
340
 
341
+ $cache_key_names = array();
342
+ $using_object_cache = $this->using_object_cache();
343
+
344
  // gets day, week, month and year
345
  $date = explode('-', date('W-d-m-Y', current_time('timestamp')));
346
 
347
+ foreach (array(
348
  0 => $date[3].$date[2].$date[1], // day like 20140324
349
  1 => $date[3].$date[0], // week like 201439
350
  2 => $date[3].$date[2], // month like 201405
352
  4 => 'total' // total views
353
  ) as $type => $period)
354
  {
355
+ if ( $using_object_cache ) {
356
+ $cache_key = $id . self::CACHE_KEY_SEPARATOR . $type . self::CACHE_KEY_SEPARATOR . $period;
357
+ wp_cache_add( $cache_key, 0, self::GROUP );
358
+ wp_cache_incr( $cache_key, 1, self::GROUP );
359
+ $cache_key_names[] = $cache_key;
360
+ } else {
361
+ // Hit the db directly
362
+ // TODO: investigate queueing these queries on the 'shutdown' hook instead instead of running them instantly?
363
+ $this->db_insert($id, $type, $period, 1);
364
+ }
 
365
  }
366
+
367
+ // Update the list of cache keys to be flushed
368
+ if ( $using_object_cache && ! empty( $cache_key_names ) ) {
369
+ $this->update_cached_keys_list_if_needed( $cache_key_names );
370
+ }
371
+
372
  do_action('pvc_after_count_visit', $id);
373
+
374
+ return true;
375
+ }
376
+
377
+
378
+ /**
379
+ * Updates the single cache key which holds a list of all the cache keys
380
+ * that need to be flushed to the db.
381
+ *
382
+ * The value of that special cache key is a giant string containing key names separated with the `|` character.
383
+ * Each such key name then consists of 3 elements: $id, $type, $period (separated by a `.` character).
384
+ * Examples:
385
+ * 62053.0.20150327|62053.1.201513|62053.2.201503|62053.3.2015|62053.4.total|62180.0.20150327|62180.1.201513|62180.2.201503|62180.3.2015|62180.4.total
386
+ * A single key is `62053.0.20150327` and that key's data is: $id = 62053, $type = 0, $period = 20150327
387
+ *
388
+ * This data format proved more efficient (avoids the (un)serialization overhead completely + duplicates filtering is a string search now)
389
+ */
390
+ private function update_cached_keys_list_if_needed($key_names = array()) {
391
+ $existing_list = wp_cache_get( self::NAME_ALLKEYS, self::GROUP );
392
+ if ( ! $existing_list ) {
393
+ $existing_list = '';
394
+ }
395
+
396
+ $list_modified = false;
397
+
398
+ // Modifying the list contents if/when needed
399
+ if ( empty( $existing_list ) ) {
400
+ // The simpler case of an empty initial list where we just
401
+ // transform the specified key names into a string
402
+ $existing_list = implode( '|', $key_names );
403
+ $list_modified = true;
404
+ } else {
405
+ // Searching each specified key name and appending it if it's not found
406
+ foreach ( $key_names as $key_name ) {
407
+ if ( false === strpos( $existing_list, $key_name ) ) {
408
+ $existing_list .= '|' . $key_name;
409
+ $list_modified = true;
410
+ }
411
+ }
412
+ }
413
+
414
+ // save modified list back in cache
415
+ if ( $list_modified ) {
416
+ wp_cache_set( self::NAME_ALLKEYS, $existing_list, self::GROUP );
417
+ }
418
+ }
419
+
420
+
421
+ /**
422
+ * Flushes views data stored in the persistent object cache into
423
+ * our custom table and clears the object cache keys when done
424
+ */
425
+ public function flush_cache_to_db() {
426
+ global $wpdb;
427
+
428
+ $key_names = wp_cache_get( self::NAME_ALLKEYS, self::GROUP );
429
+
430
+ if ( ! $key_names ) {
431
+ $key_names = array();
432
+ } else {
433
+ // create an array out of a string that's stored in the cache
434
+ $key_names = explode( '|', $key_names );
435
+ }
436
+
437
+ foreach ( $key_names as $key_name ) {
438
+ // Get values stored within the key name itself
439
+ list( $id, $type, $period ) = explode( self::CACHE_KEY_SEPARATOR, $key_name );
440
+ // Get the cached count value
441
+ $count = wp_cache_get( $key_name, self::GROUP );
442
+
443
+ // Store cached value in the db
444
+ $this->db_insert($id, $type, $period, $count);
445
+
446
+ // Clear the cache key we just flushed
447
+ wp_cache_delete( $key_name, self::GROUP );
448
+ }
449
+
450
+ // Delete the key holding the list itself after we've successfully flushed it
451
+ if ( ! empty( $key_names ) ) {
452
+ wp_cache_delete( self::NAME_ALLKEYS, self::GROUP );
453
+ }
454
+
455
+ return true;
456
  }
457
 
458
 
459
+ private function db_insert($id, $type, $period, $count = 1) {
460
+ global $wpdb;
461
+
462
+ $count = (int) $count;
463
+
464
+ if ( ! $count ) {
465
+ $count = 1;
466
+ }
467
+
468
+ return $wpdb->query(
469
+ $wpdb->prepare("
470
+ INSERT INTO " . $wpdb->prefix . "post_views (id, type, period, count)
471
+ VALUES (%d, %d, %s, %d)
472
+ ON DUPLICATE KEY UPDATE count = count + %d",
473
+ $id,
474
+ $type,
475
+ $period,
476
+ $count,
477
+ $count
478
+ )
479
+ );
480
+ }
481
+
482
  /**
483
  * Checks whether visitor is a bot
484
  */
485
+ private function is_robot() {
486
+ if (!isset($_SERVER['HTTP_USER_AGENT']) || (isset($_SERVER['HTTP_USER_AGENT']) && trim($_SERVER['HTTP_USER_AGENT']) === ''))
 
487
  return false;
488
 
489
  $robots = array(
490
  'bot', 'b0t', 'Acme.Spider', 'Ahoy! The Homepage Finder', 'Alkaline', 'Anthill', 'Walhello appie', 'Arachnophilia', 'Arale', 'Araneo', 'ArchitextSpider', 'Aretha', 'ARIADNE', 'arks', 'AskJeeves', 'ASpider (Associative Spider)', 'ATN Worldwide', 'AURESYS', 'BackRub', 'Bay Spider', 'Big Brother', 'Bjaaland', 'BlackWidow', 'Die Blinde Kuh', 'Bloodhound', 'BSpider', 'CACTVS Chemistry Spider', 'Calif', 'Cassandra', 'Digimarc Marcspider/CGI', 'ChristCrawler.com', 'churl', 'cIeNcIaFiCcIoN.nEt', 'CMC/0.01', 'Collective', 'Combine System', 'Web Core / Roots', 'Cusco', 'CyberSpyder Link Test', 'CydralSpider', 'Desert Realm Spider', 'DeWeb(c) Katalog/Index', 'DienstSpider', 'Digger', 'Direct Hit Grabber', 'DownLoad Express', 'DWCP (Dridus\' Web Cataloging Project)', 'e-collector', 'EbiNess', 'Emacs-w3 Search Engine', 'ananzi', 'esculapio', 'Esther', 'Evliya Celebi', 'FastCrawler', 'Felix IDE', 'Wild Ferret Web Hopper #1, #2, #3', 'FetchRover', 'fido', 'KIT-Fireball', 'Fish search', 'Fouineur', 'Freecrawl', 'FunnelWeb', 'gammaSpider, FocusedCrawler', 'gazz', 'GCreep', 'GetURL', 'Golem', 'Grapnel/0.01 Experiment', 'Griffon', 'Gromit', 'Northern Light Gulliver', 'Harvest', 'havIndex', 'HI (HTML Index) Search', 'Hometown Spider Pro', 'ht://Dig', 'HTMLgobble', 'Hyper-Decontextualizer', 'IBM_Planetwide', 'Popular Iconoclast', 'Ingrid', 'Imagelock', 'IncyWincy', 'Informant', 'Infoseek Sidewinder', 'InfoSpiders', 'Inspector Web', 'IntelliAgent', 'Iron33', 'Israeli-search', 'JavaBee', 'JCrawler', 'Jeeves', 'JumpStation', 'image.kapsi.net', 'Katipo', 'KDD-Explorer', 'Kilroy', 'LabelGrabber', 'larbin', 'legs', 'Link Validator', 'LinkScan', 'LinkWalker', 'Lockon', 'logo.gif Crawler', 'Lycos', 'Mac WWWWorm', 'Magpie', 'marvin/infoseek', 'Mattie', 'MediaFox', 'MerzScope', 'NEC-MeshExplorer', 'MindCrawler', 'mnoGoSearch search engine software', 'moget', 'MOMspider', 'Monster', 'Motor', 'Muncher', 'Muninn', 'Muscat Ferret', 'Mwd.Search', 'Internet Shinchakubin', 'NDSpider', 'Nederland.zoek', 'NetCarta WebMap Engine', 'NetMechanic', 'NetScoop', 'newscan-online', 'NHSE Web Forager', 'Nomad', 'nzexplorer', 'ObjectsSearch', 'Occam', 'HKU WWW Octopus', 'OntoSpider', 'Openfind data gatherer', 'Orb Search', 'Pack Rat', 'PageBoy', 'ParaSite', 'Patric', 'pegasus', 'The Peregrinator', 'PerlCrawler 1.0', 'Phantom', 'PhpDig', 'PiltdownMan', 'Pioneer', 'html_analyzer', 'Portal Juice Spider', 'PGP Key Agent', 'PlumtreeWebAccessor', 'Poppi', 'PortalB Spider', 'GetterroboPlus Puu', 'Raven Search', 'RBSE Spider', 'RoadHouse Crawling System', 'ComputingSite Robi/1.0', 'RoboCrawl Spider', 'RoboFox', 'Robozilla', 'RuLeS', 'Scooter', 'Sleek', 'Search.Aus-AU.COM', 'SearchProcess', 'Senrigan', 'SG-Scout', 'ShagSeeker', 'Shai\'Hulud', 'Sift', 'Site Valet', 'SiteTech-Rover', 'Skymob.com', 'SLCrawler', 'Inktomi Slurp', 'Smart Spider', 'Snooper', 'Spanner', 'Speedy Spider', 'spider_monkey', 'Spiderline Crawler', 'SpiderMan', 'SpiderView(tm)', 'Site Searcher', 'Suke', 'suntek search engine', 'Sven', 'Sygol', 'TACH Black Widow', 'Tarantula', 'tarspider', 'Templeton', 'TeomaTechnologies', 'TITAN', 'TitIn', 'TLSpider', 'UCSD Crawl', 'UdmSearch', 'URL Check', 'URL Spider Pro', 'Valkyrie', 'Verticrawl', 'Victoria', 'vision-search', 'Voyager', 'W3M2', 'WallPaper (alias crawlpaper)', 'the World Wide Web Wanderer', 'w@pSpider by wap4.com', 'WebBandit Web Spider', 'WebCatcher', 'WebCopy', 'webfetcher', 'Webinator', 'weblayers', 'WebLinker', 'WebMirror', 'The Web Moose', 'WebQuest', 'Digimarc MarcSpider', 'WebReaper', 'webs', 'Websnarf', 'WebSpider', 'WebVac', 'webwalk', 'WebWalker', 'WebWatch', 'Wget', 'whatUseek Winona', 'Wired Digital', 'Weblog Monitor', 'w3mir', 'WebStolperer', 'The Web Wombat', 'The World Wide Web Worm', 'WWWC Ver 0.2.5', 'WebZinger', 'XGET'
491
  );
492
 
493
+ foreach ($robots as $robot) {
494
+ if (stripos($_SERVER['HTTP_USER_AGENT'], $robot) !== false)
 
495
  return true;
496
  }
497
 
includes/cron.php CHANGED
@@ -3,16 +3,16 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Cron();
5
 
6
- class Post_Views_Counter_Cron
7
- {
8
- public function __construct()
9
- {
10
- // sets instance
11
  Post_Views_Counter()->add_instance('cron', $this);
12
 
13
  // actions
14
  add_action('init', array(&$this, 'check_cron'));
15
  add_action('pvc_reset_counts', array(&$this, 'reset_counts'));
 
16
 
17
  // filters
18
  add_filter('cron_schedules', array(&$this, 'cron_time_intervals'));
@@ -20,10 +20,9 @@ class Post_Views_Counter_Cron
20
 
21
 
22
  /**
23
- * Resets daily counts
24
  */
25
- public function reset_counts()
26
- {
27
  global $wpdb;
28
 
29
  $wpdb->query('DELETE FROM '.$wpdb->prefix.'post_views WHERE type = 0');
@@ -31,54 +30,67 @@ class Post_Views_Counter_Cron
31
 
32
 
33
  /**
34
- * Adds new cron interval from settings
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  */
36
- public function cron_time_intervals($schedules)
37
- {
38
  $schedules['post_views_counter_interval'] = array(
39
  'interval' => Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number'), false),
40
  'display' => __('Post Views Counter reset daily counts interval', 'post-views-counter')
41
  );
42
 
 
 
 
 
 
43
  return $schedules;
44
  }
45
 
46
 
47
  /**
48
- * Checks whether WP Cron needs to add new task
49
  */
50
- public function check_cron()
51
- {
52
- if(!is_admin())
53
  return;
54
 
55
  // sets wp cron task
56
- if(Post_Views_Counter()->get_attribute('options', 'general', 'cron_run'))
57
- {
58
  // not set or need to be updated?
59
- if(!wp_next_scheduled('pvc_reset_counts') || Post_Views_Counter()->get_attribute('options', 'general', 'cron_update'))
60
- {
61
  // task is added but need to be updated
62
- if(Post_Views_Counter()->get_attribute('options', 'general', 'cron_update'))
63
- {
64
- // removes old schedule
65
  wp_clear_scheduled_hook('pvc_reset_counts');
66
 
67
- // sets update to false
68
  $general = Post_Views_Counter()->get_attribute('options', 'general');
69
  $general['cron_update'] = false;
70
 
71
- // updates settings
72
  update_option('post_views_counter_settings_general', $general);
73
  }
74
 
75
- // sets schedule
76
  wp_schedule_event(Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number')), 'post_views_counter_interval', 'pvc_reset_counts');
77
  }
78
- }
79
- else
80
- {
81
- // removes schedule
82
  wp_clear_scheduled_hook('pvc_reset_counts');
83
  remove_action('pvc_reset_counts', array(&$this, 'reset_counts'));
84
  }
3
 
4
  new Post_Views_Counter_Cron();
5
 
6
+ class Post_Views_Counter_Cron {
7
+
8
+ public function __construct() {
9
+ // set instance
 
10
  Post_Views_Counter()->add_instance('cron', $this);
11
 
12
  // actions
13
  add_action('init', array(&$this, 'check_cron'));
14
  add_action('pvc_reset_counts', array(&$this, 'reset_counts'));
15
+ add_action('pvc_flush_cached_counts', array(&$this, 'flush_cached_counts'));
16
 
17
  // filters
18
  add_filter('cron_schedules', array(&$this, 'cron_time_intervals'));
20
 
21
 
22
  /**
23
+ * Reset daily counts
24
  */
25
+ public function reset_counts() {
 
26
  global $wpdb;
27
 
28
  $wpdb->query('DELETE FROM '.$wpdb->prefix.'post_views WHERE type = 0');
30
 
31
 
32
  /**
33
+ * Call Post_Views_Counter_Counter::flush_cache_to_db()
34
+ * This is (un)scheduled on plugin activation/deactivation
35
+ */
36
+ public function flush_cached_counts() {
37
+ $counter = Post_Views_Counter()->get_instance('counter');
38
+
39
+ if ( $counter && $counter->using_object_cache() ) {
40
+ $counter->flush_cache_to_db();
41
+ }
42
+ }
43
+
44
+
45
+ /**
46
+ * Add new cron interval from settings
47
  */
48
+ public function cron_time_intervals($schedules) {
 
49
  $schedules['post_views_counter_interval'] = array(
50
  'interval' => Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number'), false),
51
  'display' => __('Post Views Counter reset daily counts interval', 'post-views-counter')
52
  );
53
 
54
+ $schedules['post_views_counter_flush_interval'] = array(
55
+ 'interval' => Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'flush_interval', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'flush_interval', 'number'), false),
56
+ 'display' => __('Post Views Counter cache flush interval', 'post-views-counter')
57
+ );
58
+
59
  return $schedules;
60
  }
61
 
62
 
63
  /**
64
+ * Check whether WP Cron needs to add new task
65
  */
66
+ public function check_cron() {
67
+ if (!is_admin())
 
68
  return;
69
 
70
  // sets wp cron task
71
+ if (Post_Views_Counter()->get_attribute('options', 'general', 'cron_run')) {
72
+
73
  // not set or need to be updated?
74
+ if (!wp_next_scheduled('pvc_reset_counts') || Post_Views_Counter()->get_attribute('options', 'general', 'cron_update')) {
75
+
76
  // task is added but need to be updated
77
+ if (Post_Views_Counter()->get_attribute('options', 'general', 'cron_update')) {
78
+ // remove old schedule
 
79
  wp_clear_scheduled_hook('pvc_reset_counts');
80
 
81
+ // set update to false
82
  $general = Post_Views_Counter()->get_attribute('options', 'general');
83
  $general['cron_update'] = false;
84
 
85
+ // update settings
86
  update_option('post_views_counter_settings_general', $general);
87
  }
88
 
89
+ // set schedule
90
  wp_schedule_event(Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number')), 'post_views_counter_interval', 'pvc_reset_counts');
91
  }
92
+ } else {
93
+ // remove schedule
 
 
94
  wp_clear_scheduled_hook('pvc_reset_counts');
95
  remove_action('pvc_reset_counts', array(&$this, 'reset_counts'));
96
  }
includes/frontend.php CHANGED
@@ -3,10 +3,9 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Frontend();
5
 
6
- class Post_Views_Counter_Frontend
7
- {
8
- public function __construct()
9
- {
10
  // actions
11
  add_action('wp_loaded', array(&$this, 'register_shortcode'));
12
  add_action('wp_enqueue_scripts', array(&$this, 'frontend_scripts_styles'));
@@ -16,21 +15,17 @@ class Post_Views_Counter_Frontend
16
  add_filter('the_excerpt', array(&$this, 'remove_post_views_count'));
17
  }
18
 
19
-
20
  /**
21
- *
22
  */
23
- public function register_shortcode()
24
- {
25
  add_shortcode('post-views', array(&$this, 'post_views_shortcode'));
26
  }
27
 
28
-
29
  /**
30
- *
31
  */
32
- public function post_views_shortcode($args)
33
- {
34
  $defaults = array(
35
  'id' => get_the_ID()
36
  );
@@ -40,20 +35,17 @@ class Post_Views_Counter_Frontend
40
  return pvc_post_views($args['id'], false);
41
  }
42
 
43
-
44
  /**
45
- *
46
  */
47
- public function add_post_views_count($content)
48
- {
49
- if(is_singular() && in_array(get_post_type(), Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display'), true))
50
- {
51
- // gets groups to check it faster
52
  $groups = Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'groups');
53
 
54
  // whether to display views
55
- if(is_user_logged_in())
56
- {
57
  // exclude logged in users?
58
  if(in_array('users', $groups, true))
59
  return $content;
@@ -62,11 +54,10 @@ class Post_Views_Counter_Frontend
62
  return $content;
63
  }
64
  // exclude guests?
65
- elseif(in_array('guests', $groups, true))
66
  return $content;
67
 
68
- switch(Post_Views_Counter()->get_attribute('options', 'display', 'position'))
69
- {
70
  case 'after':
71
  return $content.'[post-views]';
72
 
@@ -82,26 +73,22 @@ class Post_Views_Counter_Frontend
82
  return $content;
83
  }
84
 
85
-
86
  /**
87
  * Remove post views shortcode from excerpt
88
  */
89
- public function remove_post_views_count($excerpt)
90
- {
91
  remove_shortcode('post-views');
92
  $excerpt = preg_replace ('/\[post-views[^\]]*\]/', '', $excerpt);
93
  return $excerpt;
94
  }
95
 
96
-
97
  /**
98
- *
99
  */
100
- public function frontend_scripts_styles()
101
- {
102
  $post_types = Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display');
103
 
104
- // loads dashicons
105
  wp_enqueue_style('dashicons');
106
 
107
  wp_register_style(
@@ -111,12 +98,11 @@ class Post_Views_Counter_Frontend
111
 
112
  wp_enqueue_style('post-views-counter-frontend');
113
 
114
- if(Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'js')
115
- {
116
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
117
 
118
- // whether to count this post type
119
- if(empty($post_types) || !is_singular($post_types))
120
  return;
121
 
122
  wp_register_script(
3
 
4
  new Post_Views_Counter_Frontend();
5
 
6
+ class Post_Views_Counter_Frontend {
7
+
8
+ public function __construct() {
 
9
  // actions
10
  add_action('wp_loaded', array(&$this, 'register_shortcode'));
11
  add_action('wp_enqueue_scripts', array(&$this, 'frontend_scripts_styles'));
15
  add_filter('the_excerpt', array(&$this, 'remove_post_views_count'));
16
  }
17
 
 
18
  /**
19
+ * Register post-views shortcode function
20
  */
21
+ public function register_shortcode() {
 
22
  add_shortcode('post-views', array(&$this, 'post_views_shortcode'));
23
  }
24
 
 
25
  /**
26
+ * Post views shortcode function
27
  */
28
+ public function post_views_shortcode($args) {
 
29
  $defaults = array(
30
  'id' => get_the_ID()
31
  );
35
  return pvc_post_views($args['id'], false);
36
  }
37
 
 
38
  /**
39
+ * Add post views counter to content
40
  */
41
+ public function add_post_views_count($content) {
42
+ if (is_singular() && in_array(get_post_type(), Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display'), true)) {
43
+
44
+ // get groups to check it faster
 
45
  $groups = Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'groups');
46
 
47
  // whether to display views
48
+ if (is_user_logged_in()) {
 
49
  // exclude logged in users?
50
  if(in_array('users', $groups, true))
51
  return $content;
54
  return $content;
55
  }
56
  // exclude guests?
57
+ elseif (in_array('guests', $groups, true))
58
  return $content;
59
 
60
+ switch (Post_Views_Counter()->get_attribute('options', 'display', 'position')) {
 
61
  case 'after':
62
  return $content.'[post-views]';
63
 
73
  return $content;
74
  }
75
 
 
76
  /**
77
  * Remove post views shortcode from excerpt
78
  */
79
+ public function remove_post_views_count($excerpt) {
 
80
  remove_shortcode('post-views');
81
  $excerpt = preg_replace ('/\[post-views[^\]]*\]/', '', $excerpt);
82
  return $excerpt;
83
  }
84
 
 
85
  /**
86
+ * Enqueue frontend scripts and styles
87
  */
88
+ public function frontend_scripts_styles() {
 
89
  $post_types = Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display');
90
 
91
+ // load dashicons
92
  wp_enqueue_style('dashicons');
93
 
94
  wp_register_style(
98
 
99
  wp_enqueue_style('post-views-counter-frontend');
100
 
101
+ if (Post_Views_Counter()->get_attribute('options', 'general', 'counter_mode') === 'js') {
 
102
  $post_types = Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count');
103
 
104
+ // whether to count this post type or not
105
+ if (empty($post_types) || !is_singular($post_types))
106
  return;
107
 
108
  wp_register_script(
includes/functions.php CHANGED
@@ -6,20 +6,23 @@
6
  *
7
  * @author Digital Factory
8
  * @package Post Views Counter
9
- * @version 1.0.0
10
  */
11
 
12
- if(!defined('ABSPATH')) exit;
13
 
14
- // Get post views for a post or array of posts
15
- if(!function_exists('pvc_get_post_views'))
16
- {
17
- function pvc_get_post_views($post_id = 0)
18
- {
19
- if(empty($post_id))
 
 
 
20
  $post_id = get_the_ID();
21
 
22
- if(is_array($post_id))
23
  $post_id = implode(',', array_map('intval', $post_id));
24
  else
25
  $post_id = (int)$post_id;
@@ -36,12 +39,15 @@ if(!function_exists('pvc_get_post_views'))
36
  }
37
  }
38
 
39
-
40
- // Display post views for a given post
41
- if(!function_exists('pvc_post_views'))
42
- {
43
- function pvc_post_views($post_id = 0, $display = true)
44
- {
 
 
 
45
  // get all data
46
  $post_id = (int)(empty($post_id) ? get_the_ID() : $post_id);
47
  $options = Post_Views_Counter()->get_attribute('options', 'display');
@@ -65,19 +71,21 @@ if(!function_exists('pvc_post_views'))
65
  $icon
66
  );
67
 
68
- if($display)
69
  echo $html;
70
  else
71
  return $html;
72
  }
73
  }
74
 
75
-
76
- // Get most viewed posts
77
- if(!function_exists('pvc_get_most_viewed_posts'))
78
- {
79
- function pvc_get_most_viewed_posts($args = array())
80
- {
 
 
81
  $args = array_merge(
82
  array(
83
  'posts_per_page' => 10,
@@ -97,12 +105,15 @@ if(!function_exists('pvc_get_most_viewed_posts'))
97
  }
98
  }
99
 
100
-
101
- // Display a list of most viewed posts
102
- if(!function_exists('pvc_most_viewed_posts'))
103
- {
104
- function pvc_most_viewed_posts($args = array(), $display = true)
105
- {
 
 
 
106
  $defaults = array(
107
  'number_of_posts' => 5,
108
  'post_types' => array('post'),
@@ -121,30 +132,24 @@ if(!function_exists('pvc_most_viewed_posts'))
121
  $args['show_post_excerpt'] = (bool)$args['show_post_excerpt'];
122
 
123
  $posts = pvc_get_most_viewed_posts(
124
- apply_filters(
125
- 'pvc_get_most_viewed_posts_args',
126
- array(
127
- 'posts_per_page' => (isset($args['number_of_posts']) ? (int)$args['number_of_posts'] : $defaults['number_of_posts']),
128
- 'order' => (isset($args['order']) ? $args['order'] : $defaults['order']),
129
- 'post_type' => (isset($args['post_types']) ? $args['post_types'] : $defaults['post_types'])
130
- )
131
  )
132
  );
133
 
134
- if(!empty($posts))
135
- {
136
  $html = '
137
  <ul>';
138
 
139
- foreach($posts as $post)
140
- {
141
  setup_postdata($post);
142
 
143
  $html .= '
144
  <li>';
145
 
146
- if($args['show_post_thumbnail'] && has_post_thumbnail($post->ID))
147
- {
148
  $html .= '
149
  <span class="post-thumbnail">
150
  '.get_the_post_thumbnail($post->ID, $args['thumbnail_size']).'
@@ -156,8 +161,7 @@ if(!function_exists('pvc_most_viewed_posts'))
156
 
157
  $excerpt = '';
158
 
159
- if($args['show_post_excerpt'])
160
- {
161
  if(empty($post->post_excerpt))
162
  $text = $post->post_content;
163
  else
6
  *
7
  * @author Digital Factory
8
  * @package Post Views Counter
9
+ * @since 1.0.0
10
  */
11
 
12
+ if (!defined('ABSPATH')) exit;
13
 
14
+ /**
15
+ * Get post views for a post or array of posts
16
+ *
17
+ * @param int|array $post_id
18
+ * @return int
19
+ */
20
+ if (!function_exists('pvc_get_post_views')) {
21
+ function pvc_get_post_views($post_id = 0) {
22
+ if (empty($post_id))
23
  $post_id = get_the_ID();
24
 
25
+ if (is_array($post_id))
26
  $post_id = implode(',', array_map('intval', $post_id));
27
  else
28
  $post_id = (int)$post_id;
39
  }
40
  }
41
 
42
+ /**
43
+ * Display post views for a given post
44
+ *
45
+ * @param int|array $post_id
46
+ * @param bool $display
47
+ * @return mixed
48
+ */
49
+ if (!function_exists('pvc_post_views')) {
50
+ function pvc_post_views($post_id = 0, $display = true) {
51
  // get all data
52
  $post_id = (int)(empty($post_id) ? get_the_ID() : $post_id);
53
  $options = Post_Views_Counter()->get_attribute('options', 'display');
71
  $icon
72
  );
73
 
74
+ if ($display)
75
  echo $html;
76
  else
77
  return $html;
78
  }
79
  }
80
 
81
+ /**
82
+ * Get most viewed posts
83
+ *
84
+ * @param array $args
85
+ * @return array
86
+ */
87
+ if(!function_exists('pvc_get_most_viewed_posts')) {
88
+ function pvc_get_most_viewed_posts($args = array()) {
89
  $args = array_merge(
90
  array(
91
  'posts_per_page' => 10,
105
  }
106
  }
107
 
108
+ /**
109
+ * Display a list of most viewed posts
110
+ *
111
+ * @param array $post_id
112
+ * @param bool $display
113
+ * @return mixed
114
+ */
115
+ if(!function_exists('pvc_most_viewed_posts')) {
116
+ function pvc_most_viewed_posts($args = array(), $display = true) {
117
  $defaults = array(
118
  'number_of_posts' => 5,
119
  'post_types' => array('post'),
132
  $args['show_post_excerpt'] = (bool)$args['show_post_excerpt'];
133
 
134
  $posts = pvc_get_most_viewed_posts(
135
+ array(
136
+ 'posts_per_page' => (isset($args['number_of_posts']) ? (int)$args['number_of_posts'] : $defaults['number_of_posts']),
137
+ 'order' => (isset($args['order']) ? $args['order'] : $defaults['order']),
138
+ 'post_type' => (isset($args['post_types']) ? $args['post_types'] : $defaults['post_types'])
 
 
 
139
  )
140
  );
141
 
142
+ if(!empty($posts)) {
 
143
  $html = '
144
  <ul>';
145
 
146
+ foreach($posts as $post) {
 
147
  setup_postdata($post);
148
 
149
  $html .= '
150
  <li>';
151
 
152
+ if($args['show_post_thumbnail'] && has_post_thumbnail($post->ID)) {
 
153
  $html .= '
154
  <span class="post-thumbnail">
155
  '.get_the_post_thumbnail($post->ID, $args['thumbnail_size']).'
161
 
162
  $excerpt = '';
163
 
164
+ if($args['show_post_excerpt']) {
 
165
  if(empty($post->post_excerpt))
166
  $text = $post->post_content;
167
  else
includes/query.php CHANGED
@@ -3,10 +3,9 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Query();
5
 
6
- class Post_Views_Counter_Query
7
- {
8
- public function __construct()
9
- {
10
  // actions
11
  add_action('pre_get_posts', array(&$this, 'extend_pre_query'), 9);
12
 
@@ -18,25 +17,22 @@ class Post_Views_Counter_Query
18
 
19
 
20
  /**
21
- *
22
  */
23
- public function extend_pre_query($query)
24
- {
25
- // adds new parameter
26
- if(isset($query->query_vars['orderby']) && $query->query_vars['orderby'] === 'post_views')
27
  $query->order_by_post_views = true;
28
  }
29
 
30
 
31
  /**
32
- *
33
  */
34
- public function posts_join($join, $query)
35
- {
36
  global $wpdb;
37
 
38
  // is it sorted by post views?
39
- if(isset($query->order_by_post_views) && $query->order_by_post_views)
40
  $join .= " LEFT JOIN ".$wpdb->prefix."post_views pvc ON pvc.id = ".$wpdb->prefix."posts.ID AND pvc.type = 4";
41
 
42
  return $join;
@@ -44,14 +40,13 @@ class Post_Views_Counter_Query
44
 
45
 
46
  /**
47
- *
48
  */
49
- public function posts_groupby($groupby, $query)
50
- {
51
  global $wpdb;
52
 
53
  // is it sorted by post views?
54
- if(isset($query->order_by_post_views) && $query->order_by_post_views)
55
  $groupby = (trim($groupby) !== '' ? $groupby.', ' : '').$wpdb->prefix.'posts.ID';
56
 
57
  return $groupby;
@@ -59,15 +54,13 @@ class Post_Views_Counter_Query
59
 
60
 
61
  /**
62
- *
63
  */
64
- public function posts_orderby($orderby, $query)
65
- {
66
  global $wpdb;
67
 
68
  // is it sorted by post views?
69
- if(isset($query->order_by_post_views) && $query->order_by_post_views)
70
- {
71
  $order = $query->get('order');
72
  $orderby = 'pvc.count '.$order.', '.$wpdb->prefix.'posts.ID '.$order;
73
  }
3
 
4
  new Post_Views_Counter_Query();
5
 
6
+ class Post_Views_Counter_Query {
7
+
8
+ public function __construct() {
 
9
  // actions
10
  add_action('pre_get_posts', array(&$this, 'extend_pre_query'), 9);
11
 
17
 
18
 
19
  /**
20
+ * Extend query with post_views orderby parameter
21
  */
22
+ public function extend_pre_query($query) {
23
+ if (isset($query->query_vars['orderby']) && $query->query_vars['orderby'] === 'post_views')
 
 
24
  $query->order_by_post_views = true;
25
  }
26
 
27
 
28
  /**
29
+ * Modify the db query to use post_views parameter
30
  */
31
+ public function posts_join($join, $query) {
 
32
  global $wpdb;
33
 
34
  // is it sorted by post views?
35
+ if (isset($query->order_by_post_views) && $query->order_by_post_views)
36
  $join .= " LEFT JOIN ".$wpdb->prefix."post_views pvc ON pvc.id = ".$wpdb->prefix."posts.ID AND pvc.type = 4";
37
 
38
  return $join;
40
 
41
 
42
  /**
43
+ * Group posts using the post ID
44
  */
45
+ public function posts_groupby($groupby, $query) {
 
46
  global $wpdb;
47
 
48
  // is it sorted by post views?
49
+ if (isset($query->order_by_post_views) && $query->order_by_post_views)
50
  $groupby = (trim($groupby) !== '' ? $groupby.', ' : '').$wpdb->prefix.'posts.ID';
51
 
52
  return $groupby;
54
 
55
 
56
  /**
57
+ * Order posts by post views
58
  */
59
+ public function posts_orderby($orderby, $query) {
 
60
  global $wpdb;
61
 
62
  // is it sorted by post views?
63
+ if (isset($query->order_by_post_views) && $query->order_by_post_views) {
 
64
  $order = $query->get('order');
65
  $orderby = 'pvc.count '.$order.', '.$wpdb->prefix.'posts.ID '.$order;
66
  }
includes/settings.php CHANGED
@@ -3,8 +3,7 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Settings();
5
 
6
- class Post_Views_Counter_Settings
7
- {
8
  private $tabs;
9
  private $choices;
10
  private $modes;
@@ -15,10 +14,8 @@ class Post_Views_Counter_Settings
15
  private $display_styles;
16
  public $post_types;
17
 
18
-
19
- public function __construct()
20
- {
21
- // sets instance
22
  Post_Views_Counter()->add_instance('settings', $this);
23
 
24
  // actions
@@ -31,12 +28,10 @@ class Post_Views_Counter_Settings
31
  add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
32
  }
33
 
34
-
35
  /**
36
- *
37
  */
38
- public function load_defaults()
39
- {
40
  $this->choices = array(
41
  'yes' => __('Enable', 'post-views-counter'),
42
  'no' => __('Disable', 'post-views-counter')
@@ -89,48 +84,41 @@ class Post_Views_Counter_Settings
89
  )
90
  );
91
 
92
- $this->user_roles = $this->get_users_roles();
93
  }
94
 
95
-
96
  /**
97
- *
98
  */
99
- public function load_post_types()
100
- {
101
  $post_types = array();
102
 
103
  // built in public post types
104
- foreach(get_post_types(array('_builtin' => true, 'public' => true), 'objects', 'and') as $key => $post_type)
105
- {
106
  if($key !== 'attachment')
107
  $post_types[$key] = $post_type->labels->name;
108
  }
109
 
110
  // public custom post types
111
- foreach(get_post_types(array('_builtin' => false, 'public' => true), 'objects', 'and') as $key => $post_type)
112
- {
113
  $post_types[$key] = $post_type->labels->name;
114
  }
115
 
116
- // sorts post types alphabetically with their keys
117
  asort($post_types, SORT_STRING);
118
 
119
  $this->post_types = $post_types;
120
  }
121
 
122
-
123
  /**
124
- * Gets all users roles
125
  */
126
- public function get_users_roles()
127
- {
128
  global $wp_roles;
129
 
130
  $roles = array();
131
 
132
- foreach(apply_filters('editable_roles', $wp_roles->roles) as $role => $details)
133
- {
134
  $roles[$role] = translate_user_role($details['name']);
135
  }
136
 
@@ -139,12 +127,10 @@ class Post_Views_Counter_Settings
139
  return $roles;
140
  }
141
 
142
-
143
  /**
144
- * Adds options page
145
  */
146
- public function admin_menu_options()
147
- {
148
  add_options_page(
149
  __('Post Views Counter', 'post-views-counter'),
150
  __('Post Views Counter', 'post-views-counter'),
@@ -154,12 +140,10 @@ class Post_Views_Counter_Settings
154
  );
155
  }
156
 
157
-
158
  /**
159
- *
160
  */
161
- public function options_page()
162
- {
163
  $tab_key = (isset($_GET['tab']) ? $_GET['tab'] : 'general');
164
 
165
  echo '
@@ -167,8 +151,7 @@ class Post_Views_Counter_Settings
167
  <h2>'.__('Post Views Counter', 'post-views-counter').'</h2>
168
  <h2 class="nav-tab-wrapper">';
169
 
170
- foreach($this->tabs as $key => $name)
171
- {
172
  echo '
173
  <a class="nav-tab '.($tab_key == $key ? 'nav-tab-active' : '').'" href="'.esc_url(admin_url('options-general.php?page=post-views-counter&tab='.$key)).'">'.$name['name'].'</a>';
174
  }
@@ -183,10 +166,10 @@ class Post_Views_Counter_Settings
183
  <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'post-views-counter').' <a href="http://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'post-views-counter').'">'.__('Support forum', 'post-views-counter').'</a></p>
184
  <hr />
185
  <h4 class="inner">'.__('Do you like this plugin?', 'post-views-counter').'</h4>
186
- <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
187
  __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
188
  __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
189
- </p>
190
  <hr />
191
  <p class="df-link inner">'.__('Created by', 'post-views-counter').' <a href="http://www.dfactory.eu/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.POST_VIEWS_COUNTER_URL.'/images/logo-dfactory.png'.'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
192
  </div>
@@ -200,11 +183,11 @@ class Post_Views_Counter_Settings
200
  echo '
201
  <p class="submit">';
202
 
203
- submit_button('', 'primary', $this->tabs[$tab_key]['submit'], FALSE);
204
 
205
  echo ' ';
206
 
207
- submit_button(__('Reset to defaults', 'post-views-counter'), 'secondary reset_pvc_settings', $this->tabs[$tab_key]['reset'], FALSE);
208
 
209
  echo '
210
  </p>
@@ -216,10 +199,9 @@ class Post_Views_Counter_Settings
216
 
217
 
218
  /**
219
- *
220
  */
221
- public function register_settings()
222
- {
223
  // general options
224
  register_setting('post_views_counter_settings_general', 'post_views_counter_settings_general', array(&$this, 'validate_settings'));
225
  add_settings_section('post_views_counter_settings_general', __('General settings', 'post-views-counter'), '', 'post_views_counter_settings_general');
@@ -227,7 +209,8 @@ class Post_Views_Counter_Settings
227
  add_settings_field('pvc_counter_mode', __('Counter Mode', 'post-views-counter'), array(&$this, 'counter_mode'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
228
  add_settings_field('pvc_post_views_column', __('Post Views Column', 'post-views-counter'), array(&$this, 'post_views_column'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
229
  add_settings_field('pvc_time_between_counts', __('Time Between Counts', 'post-views-counter'), array(&$this, 'time_between_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
230
- add_settings_field('pvc_reset_counts', __('Reset Data', 'post-views-counter'), array(&$this, 'reset_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
 
231
  add_settings_field('pvc_exclude', __('Exclude Visitors', 'post-views-counter'), array(&$this, 'exclude'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
232
  add_settings_field('pvc_exclude_ips', __('Exclude IPs', 'post-views-counter'), array(&$this, 'exclude_ips'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
233
  add_settings_field('pvc_wp_postviews', __('WP-PostViews', 'post-views-counter'), array(&$this, 'wp_postviews'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
@@ -246,10 +229,9 @@ class Post_Views_Counter_Settings
246
 
247
 
248
  /**
249
- *
250
  */
251
- public function post_views_label()
252
- {
253
  echo '
254
  <div id="pvc_post_views_label">
255
  <fieldset>
@@ -262,17 +244,15 @@ class Post_Views_Counter_Settings
262
 
263
 
264
  /**
265
- *
266
  */
267
- public function post_types_count()
268
- {
269
  echo '
270
  <div id="pvc_post_types_count">
271
  <fieldset>
272
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select post types', 'post-views-counter').'" name="post_views_counter_settings_general[post_types_count][]" multiple="multiple">';
273
 
274
- foreach($this->post_types as $post_type => $post_type_name)
275
- {
276
  echo '
277
  <option value="'.esc_attr($post_type).'" '.selected(in_array($post_type, Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count'), true), true, false).'>'.esc_html($post_type_name).'</option>';
278
  }
@@ -287,17 +267,15 @@ class Post_Views_Counter_Settings
287
 
288
 
289
  /**
290
- *
291
  */
292
- public function post_types_display()
293
- {
294
  echo '
295
  <div id="pvc_post_types_display">
296
  <fieldset>
297
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_display[post_types_display][]" multiple="multiple">';
298
 
299
- foreach($this->post_types as $post_type => $post_type_name)
300
- {
301
  echo '
302
  <option value="'.esc_attr($post_type).'" '.selected(in_array($post_type, Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display'), true), true, false).'>'.esc_html($post_type_name).'</option>';
303
  }
@@ -311,16 +289,14 @@ class Post_Views_Counter_Settings
311
  }
312
 
313
  /**
314
- *
315
  */
316
- public function counter_mode()
317
- {
318
  echo '
319
  <div id="pvc_counter_mode">
320
  <fieldset>';
321
 
322
- foreach($this->modes as $key => $value)
323
- {
324
  $key = esc_attr($key);
325
 
326
  echo '
@@ -334,18 +310,15 @@ class Post_Views_Counter_Settings
334
  </div>';
335
  }
336
 
337
-
338
  /**
339
- *
340
  */
341
- public function post_views_column()
342
- {
343
  echo '
344
  <div id="pvc_post_views_column">
345
  <fieldset>';
346
 
347
- foreach($this->choices as $key => $value)
348
- {
349
  $key = esc_attr($key);
350
 
351
  echo '
@@ -359,20 +332,17 @@ class Post_Views_Counter_Settings
359
  </div>';
360
  }
361
 
362
-
363
  /**
364
- *
365
  */
366
- public function time_between_counts()
367
- {
368
  echo '
369
  <div id="pvc_time_between_counts">
370
  <fieldset>
371
  <input size="4" type="text" name="post_views_counter_settings_general[time_between_counts][number]" value="'.esc_attr(Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'number')).'" />
372
  <select class="pvc-chosen-short" name="post_views_counter_settings_general[time_between_counts][type]">';
373
 
374
- foreach($this->time_types as $type => $type_name)
375
- {
376
  echo '
377
  <option value="'.esc_attr($type).'" '.selected($type, Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'type'), false).'>'.esc_html($type_name).'</option>';
378
  }
@@ -385,9 +355,8 @@ class Post_Views_Counter_Settings
385
  </div>';
386
  }
387
 
388
-
389
  /**
390
- *
391
  */
392
  public function reset_counts()
393
  {
@@ -397,8 +366,7 @@ class Post_Views_Counter_Settings
397
  <input size="4" type="text" name="post_views_counter_settings_general[reset_counts][number]" value="'.esc_attr(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number')).'" />
398
  <select class="pvc-chosen-short" name="post_views_counter_settings_general[reset_counts][type]">';
399
 
400
- foreach($this->time_types as $type => $type_name)
401
- {
402
  echo '
403
  <option value="'.esc_attr($type).'" '.selected($type, Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), false).'>'.esc_html($type_name).'</option>';
404
  }
@@ -411,19 +379,39 @@ class Post_Views_Counter_Settings
411
  </div>';
412
  }
413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
414
 
415
  /**
416
- *
417
  */
418
- public function exclude()
419
- {
420
  echo '
421
  <div id="pvc_exclude">
422
  <fieldset>
423
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_general[exclude][groups][]" multiple="multiple">';
424
 
425
- foreach($this->groups as $type => $type_name)
426
- {
427
  echo '
428
  <option value="'.esc_attr($type).'" '.selected(in_array($type, Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups'), true), true, false).'>'.esc_html($type_name).'</option>';
429
  }
@@ -434,8 +422,7 @@ class Post_Views_Counter_Settings
434
  <div class="pvc_user_roles"'.(in_array('roles', Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups'), true) ? '' : ' style="display: none;"').'>
435
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select user roles', 'post-views-counter').'" name="post_views_counter_settings_general[exclude][roles][]" multiple="multiple">';
436
 
437
- foreach($this->user_roles as $role => $role_name)
438
- {
439
  echo '
440
  <option value="'.esc_attr($role).'" '.selected(in_array($role, Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles'), true), true, false).'>'.esc_html($role_name).'</option>';
441
  }
@@ -449,18 +436,15 @@ class Post_Views_Counter_Settings
449
  </div>';
450
  }
451
 
452
-
453
  /**
454
- *
455
  */
456
- public function exclude_ips()
457
- {
458
  echo '
459
  <div id="pvc_exclude_ips">
460
  <fieldset>';
461
 
462
- foreach(Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips') as $key => $ip)
463
- {
464
  echo '
465
  <div class="ip-box">
466
  <input type="text" name="post_views_counter_settings_general[exclude_ips][]" value="'.esc_attr($ip).'" /> <input type="button" class="button button-secondary remove-exclude-ip" value="'.esc_attr__('Remove', 'post-views-counter').'" />
@@ -479,12 +463,10 @@ class Post_Views_Counter_Settings
479
  </div>';
480
  }
481
 
482
-
483
  /**
484
- *
485
  */
486
- public function wp_postviews()
487
- {
488
  echo '
489
  <div id="pvc_wp_postviews">
490
  <fieldset>
@@ -496,18 +478,15 @@ class Post_Views_Counter_Settings
496
  </div>';
497
  }
498
 
499
-
500
  /**
501
- *
502
  */
503
- public function deactivation_delete()
504
- {
505
  echo '
506
  <div id="pvc_deactivation_delete">
507
  <fieldset>';
508
 
509
- foreach($this->choices as $key => $value)
510
- {
511
  $key = esc_attr($key);
512
 
513
  echo '
@@ -521,19 +500,16 @@ class Post_Views_Counter_Settings
521
  </div>';
522
  }
523
 
524
-
525
  /**
526
- *
527
  */
528
- public function position()
529
- {
530
  echo '
531
  <div id="pvc_position">
532
  <fieldset>
533
  <select class="pvc-chosen-short" name="post_views_counter_settings_display[position]">';
534
 
535
- foreach($this->positions as $position => $position_name)
536
- {
537
  echo '
538
  <option value="'.esc_attr($position).'" '.selected($position, Post_Views_Counter()->get_attribute('options', 'display', 'position'), false).'>'.esc_html($position_name).'</option>';
539
  }
@@ -546,18 +522,15 @@ class Post_Views_Counter_Settings
546
  </div>';
547
  }
548
 
549
-
550
  /**
551
- *
552
  */
553
- public function display_style()
554
- {
555
  echo '
556
  <div id="pvc_display_style">
557
  <fieldset>';
558
 
559
- foreach($this->display_styles as $display => $style)
560
- {
561
  $display = esc_attr($display);
562
 
563
  echo '
@@ -571,12 +544,10 @@ class Post_Views_Counter_Settings
571
  </div>';
572
  }
573
 
574
-
575
  /**
576
- *
577
  */
578
- public function icon_class()
579
- {
580
  echo '
581
  <div id="pvc_icon_class">
582
  <fieldset>
@@ -589,18 +560,17 @@ class Post_Views_Counter_Settings
589
 
590
 
591
  /**
592
- *
593
  */
594
- public function restrict_display()
595
- {
596
  echo '
597
  <div id="pvc_restrict_display">
598
  <fieldset>
599
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][groups][]" multiple="multiple">';
600
 
601
- foreach($this->groups as $type => $type_name)
602
- {
603
- if($type === 'robots')
604
  continue;
605
 
606
  echo '
@@ -613,8 +583,7 @@ class Post_Views_Counter_Settings
613
  <div class="pvc_user_roles"'.(in_array('roles', Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'groups'), true) ? '' : ' style="display: none;"').'>
614
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select user roles', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][roles][]" multiple="multiple">';
615
 
616
- foreach($this->user_roles as $role => $role_name)
617
- {
618
  echo '
619
  <option value="'.esc_attr($role).'" '.selected(in_array($role, Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'roles'), true), true, false).'>'.esc_html($role_name).'</option>';
620
  }
@@ -630,12 +599,10 @@ class Post_Views_Counter_Settings
630
 
631
 
632
  /**
633
- * Validates general settings
634
  */
635
- public function validate_settings($input)
636
- {
637
- if(isset($_POST['post_views_counter_import_wp_postviews']))
638
- {
639
  global $wpdb;
640
 
641
  $views = $wpdb->get_results(
@@ -644,37 +611,30 @@ class Post_Views_Counter_Settings
644
  0
645
  );
646
 
647
- if(!empty($views))
648
- {
649
  $input = Post_Views_Counter()->get_attribute('defaults', 'general');
650
  $input['wp_postviews_import'] = true;
651
 
652
  $sql = '';
653
 
654
- foreach($views as $view)
655
- {
656
  $sql[] = "(".$view['post_id'].", 4, 'total', ".$view['meta_value'].")";
657
  }
658
 
659
  $wpdb->query("INSERT INTO ".$wpdb->prefix."post_views(id, type, period, count) VALUES ".implode(',', $sql)." ON DUPLICATE KEY UPDATE count = ".(isset($_POST['post_views_counter_import_wp_postviews_override']) ? '' : 'count + ')."VALUES(count)");
660
 
661
  add_settings_error('wp_postviews_import', 'wp_postviews_import', __('WP-PostViews data imported succesfully.', 'post-views-counter'), 'updated');
662
- }
663
- else
664
- {
665
  add_settings_error('wp_postviews_import', 'wp_postviews_import', __('There was no data to import.', 'post-views-counter'), 'updated');
666
  }
667
  }
668
- elseif(isset($_POST['save_pvc_general']))
669
- {
670
  // post types count
671
- if(isset($input['post_types_count']))
672
- {
673
  $post_types = array();
674
 
675
- foreach($input['post_types_count'] as $post_type)
676
- {
677
- if(isset($this->post_types[$post_type]))
678
  $post_types[] = $post_type;
679
  }
680
 
@@ -693,6 +653,21 @@ class Post_Views_Counter_Settings
693
  $input['time_between_counts']['number'] = (int)(isset($input['time_between_counts']['number']) ? $input['time_between_counts']['number'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'time_between_counts', 'number'));
694
  $input['time_between_counts']['type'] = (isset($input['time_between_counts']['type'], $this->time_types[$input['time_between_counts']['type']]) ? $input['time_between_counts']['type'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'time_between_counts', 'type'));
695
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
696
  // reset counts
697
  $input['reset_counts']['number'] = (int)(isset($input['reset_counts']['number']) ? $input['reset_counts']['number'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'reset_counts', 'number'));
698
  $input['reset_counts']['type'] = (isset($input['reset_counts']['type'], $this->time_types[$input['reset_counts']['type']]) ? $input['reset_counts']['type'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'reset_counts', 'type'));
@@ -702,43 +677,37 @@ class Post_Views_Counter_Settings
702
  $input['cron_update'] = ($input['cron_run'] && (Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number') !== $input['reset_counts']['number'] || Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type') !== $input['reset_counts']['type']) ? true : false);
703
 
704
  // exclude
705
- if(isset($input['exclude']['groups']))
706
- {
707
  $groups = array();
708
 
709
- foreach($input['exclude']['groups'] as $group)
710
- {
711
- if(isset($this->groups[$group]))
712
  $groups[] = $group;
713
  }
714
 
715
  $input['exclude']['groups'] = array_unique($groups);
716
- }
717
- else
718
  $input['exclude']['groups'] = array();
719
 
720
- if(in_array('roles', $input['exclude']['groups'], true) && isset($input['exclude']['roles']))
721
- {
722
  $roles = array();
723
 
724
- foreach($input['exclude']['roles'] as $role)
725
  {
726
- if(isset($this->user_roles[$role]))
727
  $roles[] = $role;
728
  }
729
 
730
  $input['exclude']['roles'] = array_unique($roles);
731
- }
732
- else
733
  $input['exclude']['roles'] = array();
734
 
735
  // exclude ips
736
- if(isset($input['exclude_ips']))
737
- {
738
  $ips = array();
739
 
740
- foreach($input['exclude_ips'] as $ip)
741
- {
742
  if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
743
  $ips[] = $ip;
744
  }
@@ -748,13 +717,13 @@ class Post_Views_Counter_Settings
748
 
749
  // deactivation delete
750
  $input['deactivation_delete'] = (isset($input['deactivation_delete'], $this->choices[$input['deactivation_delete']]) ? ($input['deactivation_delete'] === 'yes' ? true : false) : Post_Views_Counter()->get_attribute('defaults', 'general', 'deactivation_delete'));
751
- }
752
- elseif(isset($_POST['save_pvc_display']))
753
- {
754
  // post views label
755
  $input['label'] = (isset($input['label']) ? $input['label'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'label'));
756
 
757
- if(function_exists('icl_register_string'))
758
  icl_register_string('Post Views Counter', 'Post Views Label', $input['label']);
759
 
760
  // position
@@ -771,8 +740,7 @@ class Post_Views_Counter_Settings
771
  $input['icon_class'] = (isset($input['icon_class']) ? trim($input['icon_class']) : Post_Views_Counter()->get_attribute('defaults', 'general', 'icon_class'));
772
 
773
  // post types display
774
- if(isset($input['post_types_display']))
775
- {
776
  $post_types = array();
777
 
778
  foreach($input['post_types_display'] as $post_type)
@@ -782,52 +750,41 @@ class Post_Views_Counter_Settings
782
  }
783
 
784
  $input['post_types_display'] = array_unique($post_types);
785
- }
786
- else
787
  $input['post_types_display'] = array();
788
 
789
  // restrict display
790
- if(isset($input['restrict_display']['groups']))
791
- {
792
  $groups = array();
793
 
794
- foreach($input['restrict_display']['groups'] as $group)
795
- {
796
- if($group === 'robots')
797
  continue;
798
 
799
- if(isset($this->groups[$group]))
800
  $groups[] = $group;
801
  }
802
 
803
  $input['restrict_display']['groups'] = array_unique($groups);
804
- }
805
- else
806
  $input['restrict_display']['groups'] = array();
807
 
808
- if(in_array('roles', $input['restrict_display']['groups'], true) && isset($input['restrict_display']['roles']))
809
- {
810
  $roles = array();
811
 
812
- foreach($input['restrict_display']['roles'] as $role)
813
- {
814
- if(isset($this->user_roles[$role]))
815
  $roles[] = $role;
816
  }
817
 
818
  $input['restrict_display']['roles'] = array_unique($roles);
819
- }
820
- else
821
  $input['restrict_display']['roles'] = array();
822
- }
823
- elseif(isset($_POST['reset_pvc_general']))
824
- {
825
  $input = Post_Views_Counter()->get_attribute('defaults', 'general');
826
 
827
  add_settings_error('reset_general_settings', 'settings_reset', __('General settings restored to defaults.', 'post-views-counter'), 'updated');
828
- }
829
- elseif(isset($_POST['reset_pvc_display']))
830
- {
831
  $input = Post_Views_Counter()->get_attribute('defaults', 'display');
832
 
833
  add_settings_error('reset_general_settings', 'settings_reset', __('Display settings restored to defaults.', 'post-views-counter'), 'updated');
@@ -838,17 +795,16 @@ class Post_Views_Counter_Settings
838
 
839
 
840
  /**
841
- * Adds links to Support Forum
842
  */
843
- public function plugin_extend_links($links, $file)
844
- {
845
- if(!current_user_can('install_plugins'))
846
  return $links;
847
 
848
  $plugin = plugin_basename(__FILE__);
849
 
850
- if($file == $plugin)
851
- {
852
  return array_merge(
853
  $links,
854
  array(sprintf('<a href="http://www.dfactory.eu/support/forum/post-views-counter/" target="_blank">%s</a>', __('Support', 'post-views-counter')))
3
 
4
  new Post_Views_Counter_Settings();
5
 
6
+ class Post_Views_Counter_Settings {
 
7
  private $tabs;
8
  private $choices;
9
  private $modes;
14
  private $display_styles;
15
  public $post_types;
16
 
17
+ public function __construct() {
18
+ // set instance
 
 
19
  Post_Views_Counter()->add_instance('settings', $this);
20
 
21
  // actions
28
  add_filter('plugin_row_meta', array(&$this, 'plugin_extend_links'), 10, 2);
29
  }
30
 
 
31
  /**
32
+ * Load default settings
33
  */
34
+ public function load_defaults() {
 
35
  $this->choices = array(
36
  'yes' => __('Enable', 'post-views-counter'),
37
  'no' => __('Disable', 'post-views-counter')
84
  )
85
  );
86
 
87
+ $this->user_roles = $this->get_user_roles();
88
  }
89
 
 
90
  /**
91
+ * Get post types avaiable for counting
92
  */
93
+ public function load_post_types() {
 
94
  $post_types = array();
95
 
96
  // built in public post types
97
+ foreach (get_post_types(array('_builtin' => true, 'public' => true), 'objects', 'and') as $key => $post_type) {
 
98
  if($key !== 'attachment')
99
  $post_types[$key] = $post_type->labels->name;
100
  }
101
 
102
  // public custom post types
103
+ foreach (get_post_types(array('_builtin' => false, 'public' => true), 'objects', 'and') as $key => $post_type) {
 
104
  $post_types[$key] = $post_type->labels->name;
105
  }
106
 
107
+ // sort post types alphabetically with their keys
108
  asort($post_types, SORT_STRING);
109
 
110
  $this->post_types = $post_types;
111
  }
112
 
 
113
  /**
114
+ * Get all user roles
115
  */
116
+ public function get_user_roles() {
 
117
  global $wp_roles;
118
 
119
  $roles = array();
120
 
121
+ foreach (apply_filters('editable_roles', $wp_roles->roles) as $role => $details) {
 
122
  $roles[$role] = translate_user_role($details['name']);
123
  }
124
 
127
  return $roles;
128
  }
129
 
 
130
  /**
131
+ * Add options page
132
  */
133
+ public function admin_menu_options() {
 
134
  add_options_page(
135
  __('Post Views Counter', 'post-views-counter'),
136
  __('Post Views Counter', 'post-views-counter'),
140
  );
141
  }
142
 
 
143
  /**
144
+ * Options page callback
145
  */
146
+ public function options_page() {
 
147
  $tab_key = (isset($_GET['tab']) ? $_GET['tab'] : 'general');
148
 
149
  echo '
151
  <h2>'.__('Post Views Counter', 'post-views-counter').'</h2>
152
  <h2 class="nav-tab-wrapper">';
153
 
154
+ foreach ($this->tabs as $key => $name) {
 
155
  echo '
156
  <a class="nav-tab '.($tab_key == $key ? 'nav-tab-active' : '').'" href="'.esc_url(admin_url('options-general.php?page=post-views-counter&tab='.$key)).'">'.$name['name'].'</a>';
157
  }
166
  <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'post-views-counter').' <a href="http://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'post-views-counter').'">'.__('Support forum', 'post-views-counter').'</a></p>
167
  <hr />
168
  <h4 class="inner">'.__('Do you like this plugin?', 'post-views-counter').'</h4>
169
+ <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'post-views-counter').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
170
  __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
171
  __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
172
+ </p>
173
  <hr />
174
  <p class="df-link inner">'.__('Created by', 'post-views-counter').' <a href="http://www.dfactory.eu/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.POST_VIEWS_COUNTER_URL.'/images/logo-dfactory.png'.'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
175
  </div>
183
  echo '
184
  <p class="submit">';
185
 
186
+ submit_button('', 'primary', $this->tabs[$tab_key]['submit'], false);
187
 
188
  echo ' ';
189
 
190
+ submit_button(__('Reset to defaults', 'post-views-counter'), 'secondary reset_pvc_settings', $this->tabs[$tab_key]['reset'], false);
191
 
192
  echo '
193
  </p>
199
 
200
 
201
  /**
202
+ * Register settings callback
203
  */
204
+ public function register_settings() {
 
205
  // general options
206
  register_setting('post_views_counter_settings_general', 'post_views_counter_settings_general', array(&$this, 'validate_settings'));
207
  add_settings_section('post_views_counter_settings_general', __('General settings', 'post-views-counter'), '', 'post_views_counter_settings_general');
209
  add_settings_field('pvc_counter_mode', __('Counter Mode', 'post-views-counter'), array(&$this, 'counter_mode'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
210
  add_settings_field('pvc_post_views_column', __('Post Views Column', 'post-views-counter'), array(&$this, 'post_views_column'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
211
  add_settings_field('pvc_time_between_counts', __('Time Between Counts', 'post-views-counter'), array(&$this, 'time_between_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
212
+ add_settings_field('pvc_reset_counts', __('Reset Data Interval', 'post-views-counter'), array(&$this, 'reset_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
213
+ add_settings_field('pvc_flush_interval', __('Flush Object Cache Interval', 'post-views-counter'), array(&$this, 'flush_interval'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
214
  add_settings_field('pvc_exclude', __('Exclude Visitors', 'post-views-counter'), array(&$this, 'exclude'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
215
  add_settings_field('pvc_exclude_ips', __('Exclude IPs', 'post-views-counter'), array(&$this, 'exclude_ips'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
216
  add_settings_field('pvc_wp_postviews', __('WP-PostViews', 'post-views-counter'), array(&$this, 'wp_postviews'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
229
 
230
 
231
  /**
232
+ * Post views label option
233
  */
234
+ public function post_views_label() {
 
235
  echo '
236
  <div id="pvc_post_views_label">
237
  <fieldset>
244
 
245
 
246
  /**
247
+ * Post types to count option
248
  */
249
+ public function post_types_count() {
 
250
  echo '
251
  <div id="pvc_post_types_count">
252
  <fieldset>
253
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select post types', 'post-views-counter').'" name="post_views_counter_settings_general[post_types_count][]" multiple="multiple">';
254
 
255
+ foreach ($this->post_types as $post_type => $post_type_name) {
 
256
  echo '
257
  <option value="'.esc_attr($post_type).'" '.selected(in_array($post_type, Post_Views_Counter()->get_attribute('options', 'general', 'post_types_count'), true), true, false).'>'.esc_html($post_type_name).'</option>';
258
  }
267
 
268
 
269
  /**
270
+ * Post types to display option
271
  */
272
+ public function post_types_display() {
 
273
  echo '
274
  <div id="pvc_post_types_display">
275
  <fieldset>
276
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_display[post_types_display][]" multiple="multiple">';
277
 
278
+ foreach ($this->post_types as $post_type => $post_type_name) {
 
279
  echo '
280
  <option value="'.esc_attr($post_type).'" '.selected(in_array($post_type, Post_Views_Counter()->get_attribute('options', 'display', 'post_types_display'), true), true, false).'>'.esc_html($post_type_name).'</option>';
281
  }
289
  }
290
 
291
  /**
292
+ * Counter mode option
293
  */
294
+ public function counter_mode() {
 
295
  echo '
296
  <div id="pvc_counter_mode">
297
  <fieldset>';
298
 
299
+ foreach ($this->modes as $key => $value) {
 
300
  $key = esc_attr($key);
301
 
302
  echo '
310
  </div>';
311
  }
312
 
 
313
  /**
314
+ * Post views column option
315
  */
316
+ public function post_views_column() {
 
317
  echo '
318
  <div id="pvc_post_views_column">
319
  <fieldset>';
320
 
321
+ foreach($this->choices as $key => $value) {
 
322
  $key = esc_attr($key);
323
 
324
  echo '
332
  </div>';
333
  }
334
 
 
335
  /**
336
+ * Time between counts option
337
  */
338
+ public function time_between_counts() {
 
339
  echo '
340
  <div id="pvc_time_between_counts">
341
  <fieldset>
342
  <input size="4" type="text" name="post_views_counter_settings_general[time_between_counts][number]" value="'.esc_attr(Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'number')).'" />
343
  <select class="pvc-chosen-short" name="post_views_counter_settings_general[time_between_counts][type]">';
344
 
345
+ foreach($this->time_types as $type => $type_name) {
 
346
  echo '
347
  <option value="'.esc_attr($type).'" '.selected($type, Post_Views_Counter()->get_attribute('options', 'general', 'time_between_counts', 'type'), false).'>'.esc_html($type_name).'</option>';
348
  }
355
  </div>';
356
  }
357
 
 
358
  /**
359
+ * Reset counts option
360
  */
361
  public function reset_counts()
362
  {
366
  <input size="4" type="text" name="post_views_counter_settings_general[reset_counts][number]" value="'.esc_attr(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number')).'" />
367
  <select class="pvc-chosen-short" name="post_views_counter_settings_general[reset_counts][type]">';
368
 
369
+ foreach ($this->time_types as $type => $type_name) {
 
370
  echo '
371
  <option value="'.esc_attr($type).'" '.selected($type, Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), false).'>'.esc_html($type_name).'</option>';
372
  }
379
  </div>';
380
  }
381
 
382
+ /**
383
+ * Flush interval option
384
+ */
385
+ public function flush_interval() {
386
+ echo '
387
+ <div id="pvc_flush_interval">
388
+ <fieldset>
389
+ <input size="4" type="text" name="post_views_counter_settings_general[flush_interval][number]" value="'.esc_attr(Post_Views_Counter()->get_attribute('options', 'general', 'flush_interval', 'number')).'" />
390
+ <select class="pvc-chosen-short" name="post_views_counter_settings_general[flush_interval][type]">';
391
+
392
+ foreach ($this->time_types as $type => $type_name) {
393
+ echo '
394
+ <option value="'.esc_attr($type).'" '.selected($type, Post_Views_Counter()->get_attribute('options', 'general', 'flush_interval', 'type'), false).'>'.esc_html($type_name).'</option>';
395
+ }
396
+
397
+ echo '
398
+ </select>
399
+ <br/>
400
+ <span class="description">'.__('How often to flush cached view counts from the object cache into the database. This feature is used only if a persistent object cache is detected and the interval is greater than 0 (number zero)). When used, view counts will be collected and stored in the object cache instead of the database and will then be asynchronously flushed to the database according to the specified interval.<br /><strong>Notice:</strong> Potential data loss may occur if the object cache is cleared/unavailable for the duration of the interval.', 'post-views-counter').'</span>
401
+ </fieldset>
402
+ </div>';
403
+ }
404
 
405
  /**
406
+ * Exlude user groups option
407
  */
408
+ public function exclude() {
 
409
  echo '
410
  <div id="pvc_exclude">
411
  <fieldset>
412
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_general[exclude][groups][]" multiple="multiple">';
413
 
414
+ foreach ($this->groups as $type => $type_name) {
 
415
  echo '
416
  <option value="'.esc_attr($type).'" '.selected(in_array($type, Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups'), true), true, false).'>'.esc_html($type_name).'</option>';
417
  }
422
  <div class="pvc_user_roles"'.(in_array('roles', Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'groups'), true) ? '' : ' style="display: none;"').'>
423
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select user roles', 'post-views-counter').'" name="post_views_counter_settings_general[exclude][roles][]" multiple="multiple">';
424
 
425
+ foreach ($this->user_roles as $role => $role_name) {
 
426
  echo '
427
  <option value="'.esc_attr($role).'" '.selected(in_array($role, Post_Views_Counter()->get_attribute('options', 'general', 'exclude', 'roles'), true), true, false).'>'.esc_html($role_name).'</option>';
428
  }
436
  </div>';
437
  }
438
 
 
439
  /**
440
+ * Exclude IPs option
441
  */
442
+ public function exclude_ips() {
 
443
  echo '
444
  <div id="pvc_exclude_ips">
445
  <fieldset>';
446
 
447
+ foreach (Post_Views_Counter()->get_attribute('options', 'general', 'exclude_ips') as $key => $ip) {
 
448
  echo '
449
  <div class="ip-box">
450
  <input type="text" name="post_views_counter_settings_general[exclude_ips][]" value="'.esc_attr($ip).'" /> <input type="button" class="button button-secondary remove-exclude-ip" value="'.esc_attr__('Remove', 'post-views-counter').'" />
463
  </div>';
464
  }
465
 
 
466
  /**
467
+ * WP-PostViews import option
468
  */
469
+ public function wp_postviews() {
 
470
  echo '
471
  <div id="pvc_wp_postviews">
472
  <fieldset>
478
  </div>';
479
  }
480
 
 
481
  /**
482
+ * Plugin deactivation option
483
  */
484
+ public function deactivation_delete() {
 
485
  echo '
486
  <div id="pvc_deactivation_delete">
487
  <fieldset>';
488
 
489
+ foreach ($this->choices as $key => $value) {
 
490
  $key = esc_attr($key);
491
 
492
  echo '
500
  </div>';
501
  }
502
 
 
503
  /**
504
+ * Counter position option
505
  */
506
+ public function position() {
 
507
  echo '
508
  <div id="pvc_position">
509
  <fieldset>
510
  <select class="pvc-chosen-short" name="post_views_counter_settings_display[position]">';
511
 
512
+ foreach ($this->positions as $position => $position_name) {
 
513
  echo '
514
  <option value="'.esc_attr($position).'" '.selected($position, Post_Views_Counter()->get_attribute('options', 'display', 'position'), false).'>'.esc_html($position_name).'</option>';
515
  }
522
  </div>';
523
  }
524
 
 
525
  /**
526
+ * Counter style option
527
  */
528
+ public function display_style() {
 
529
  echo '
530
  <div id="pvc_display_style">
531
  <fieldset>';
532
 
533
+ foreach ($this->display_styles as $display => $style) {
 
534
  $display = esc_attr($display);
535
 
536
  echo '
544
  </div>';
545
  }
546
 
 
547
  /**
548
+ * Counter icon class option
549
  */
550
+ public function icon_class() {
 
551
  echo '
552
  <div id="pvc_icon_class">
553
  <fieldset>
560
 
561
 
562
  /**
563
+ * Restrict display option
564
  */
565
+ public function restrict_display() {
 
566
  echo '
567
  <div id="pvc_restrict_display">
568
  <fieldset>
569
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][groups][]" multiple="multiple">';
570
 
571
+ foreach ($this->groups as $type => $type_name) {
572
+
573
+ if ($type === 'robots')
574
  continue;
575
 
576
  echo '
583
  <div class="pvc_user_roles"'.(in_array('roles', Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'groups'), true) ? '' : ' style="display: none;"').'>
584
  <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select user roles', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][roles][]" multiple="multiple">';
585
 
586
+ foreach ($this->user_roles as $role => $role_name) {
 
587
  echo '
588
  <option value="'.esc_attr($role).'" '.selected(in_array($role, Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'roles'), true), true, false).'>'.esc_html($role_name).'</option>';
589
  }
599
 
600
 
601
  /**
602
+ * Validate general settings
603
  */
604
+ public function validate_settings($input) {
605
+ if (isset($_POST['post_views_counter_import_wp_postviews'])) {
 
 
606
  global $wpdb;
607
 
608
  $views = $wpdb->get_results(
611
  0
612
  );
613
 
614
+ if (!empty($views)) {
 
615
  $input = Post_Views_Counter()->get_attribute('defaults', 'general');
616
  $input['wp_postviews_import'] = true;
617
 
618
  $sql = '';
619
 
620
+ foreach($views as $view) {
 
621
  $sql[] = "(".$view['post_id'].", 4, 'total', ".$view['meta_value'].")";
622
  }
623
 
624
  $wpdb->query("INSERT INTO ".$wpdb->prefix."post_views(id, type, period, count) VALUES ".implode(',', $sql)." ON DUPLICATE KEY UPDATE count = ".(isset($_POST['post_views_counter_import_wp_postviews_override']) ? '' : 'count + ')."VALUES(count)");
625
 
626
  add_settings_error('wp_postviews_import', 'wp_postviews_import', __('WP-PostViews data imported succesfully.', 'post-views-counter'), 'updated');
627
+ } else {
 
 
628
  add_settings_error('wp_postviews_import', 'wp_postviews_import', __('There was no data to import.', 'post-views-counter'), 'updated');
629
  }
630
  }
631
+ elseif (isset($_POST['save_pvc_general'])) {
 
632
  // post types count
633
+ if (isset($input['post_types_count'])) {
 
634
  $post_types = array();
635
 
636
+ foreach ($input['post_types_count'] as $post_type) {
637
+ if (isset($this->post_types[$post_type]))
 
638
  $post_types[] = $post_type;
639
  }
640
 
653
  $input['time_between_counts']['number'] = (int)(isset($input['time_between_counts']['number']) ? $input['time_between_counts']['number'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'time_between_counts', 'number'));
654
  $input['time_between_counts']['type'] = (isset($input['time_between_counts']['type'], $this->time_types[$input['time_between_counts']['type']]) ? $input['time_between_counts']['type'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'time_between_counts', 'type'));
655
 
656
+ // flush interval
657
+ $input['flush_interval']['number'] = (int)(isset($input['flush_interval']['number']) ? $input['flush_interval']['number'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'flush_interval', 'number'));
658
+ $input['flush_interval']['type'] = (isset($input['flush_interval']['type'], $this->time_types[$input['flush_interval']['type']]) ? $input['flush_interval']['type'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'flush_interval', 'type'));
659
+
660
+ // Since the settings are about to be saved and cache flush interval could've changed,
661
+ // we want to make sure that any changes done on the settings page are in effect immediately
662
+ // (instead of having to wait for the previous schedule to occur).
663
+ // We achieve that by making sure to clear any previous cache flush schedules and
664
+ // schedule the new one if the specified interval is > 0
665
+ Post_Views_Counter()->remove_cache_flush();
666
+
667
+ if ( $input['flush_interval']['number'] > 0 ) {
668
+ Post_Views_Counter()->schedule_cache_flush();
669
+ }
670
+
671
  // reset counts
672
  $input['reset_counts']['number'] = (int)(isset($input['reset_counts']['number']) ? $input['reset_counts']['number'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'reset_counts', 'number'));
673
  $input['reset_counts']['type'] = (isset($input['reset_counts']['type'], $this->time_types[$input['reset_counts']['type']]) ? $input['reset_counts']['type'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'reset_counts', 'type'));
677
  $input['cron_update'] = ($input['cron_run'] && (Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number') !== $input['reset_counts']['number'] || Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type') !== $input['reset_counts']['type']) ? true : false);
678
 
679
  // exclude
680
+ if (isset($input['exclude']['groups'])) {
 
681
  $groups = array();
682
 
683
+ foreach ($input['exclude']['groups'] as $group) {
684
+ if (isset($this->groups[$group]))
 
685
  $groups[] = $group;
686
  }
687
 
688
  $input['exclude']['groups'] = array_unique($groups);
689
+ } else
 
690
  $input['exclude']['groups'] = array();
691
 
692
+ if (in_array('roles', $input['exclude']['groups'], true) && isset($input['exclude']['roles'])) {
 
693
  $roles = array();
694
 
695
+ foreach ($input['exclude']['roles'] as $role)
696
  {
697
+ if (isset($this->user_roles[$role]))
698
  $roles[] = $role;
699
  }
700
 
701
  $input['exclude']['roles'] = array_unique($roles);
702
+ } else
 
703
  $input['exclude']['roles'] = array();
704
 
705
  // exclude ips
706
+ if(isset($input['exclude_ips'])) {
707
+
708
  $ips = array();
709
 
710
+ foreach($input['exclude_ips'] as $ip) {
 
711
  if(filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4))
712
  $ips[] = $ip;
713
  }
717
 
718
  // deactivation delete
719
  $input['deactivation_delete'] = (isset($input['deactivation_delete'], $this->choices[$input['deactivation_delete']]) ? ($input['deactivation_delete'] === 'yes' ? true : false) : Post_Views_Counter()->get_attribute('defaults', 'general', 'deactivation_delete'));
720
+
721
+ } elseif (isset($_POST['save_pvc_display'])) {
722
+
723
  // post views label
724
  $input['label'] = (isset($input['label']) ? $input['label'] : Post_Views_Counter()->get_attribute('defaults', 'general', 'label'));
725
 
726
+ if (function_exists('icl_register_string'))
727
  icl_register_string('Post Views Counter', 'Post Views Label', $input['label']);
728
 
729
  // position
740
  $input['icon_class'] = (isset($input['icon_class']) ? trim($input['icon_class']) : Post_Views_Counter()->get_attribute('defaults', 'general', 'icon_class'));
741
 
742
  // post types display
743
+ if (isset($input['post_types_display'])) {
 
744
  $post_types = array();
745
 
746
  foreach($input['post_types_display'] as $post_type)
750
  }
751
 
752
  $input['post_types_display'] = array_unique($post_types);
753
+ } else
 
754
  $input['post_types_display'] = array();
755
 
756
  // restrict display
757
+ if (isset($input['restrict_display']['groups'])) {
 
758
  $groups = array();
759
 
760
+ foreach ($input['restrict_display']['groups'] as $group) {
761
+ if ($group === 'robots')
 
762
  continue;
763
 
764
+ if (isset($this->groups[$group]))
765
  $groups[] = $group;
766
  }
767
 
768
  $input['restrict_display']['groups'] = array_unique($groups);
769
+ } else
 
770
  $input['restrict_display']['groups'] = array();
771
 
772
+ if (in_array('roles', $input['restrict_display']['groups'], true) && isset($input['restrict_display']['roles'])) {
 
773
  $roles = array();
774
 
775
+ foreach ($input['restrict_display']['roles'] as $role) {
776
+ if (isset($this->user_roles[$role]))
 
777
  $roles[] = $role;
778
  }
779
 
780
  $input['restrict_display']['roles'] = array_unique($roles);
781
+ } else
 
782
  $input['restrict_display']['roles'] = array();
783
+ } elseif (isset($_POST['reset_pvc_general'])) {
 
 
784
  $input = Post_Views_Counter()->get_attribute('defaults', 'general');
785
 
786
  add_settings_error('reset_general_settings', 'settings_reset', __('General settings restored to defaults.', 'post-views-counter'), 'updated');
787
+ } elseif (isset($_POST['reset_pvc_display'])) {
 
 
788
  $input = Post_Views_Counter()->get_attribute('defaults', 'display');
789
 
790
  add_settings_error('reset_general_settings', 'settings_reset', __('Display settings restored to defaults.', 'post-views-counter'), 'updated');
795
 
796
 
797
  /**
798
+ * Add links to plugin support forum
799
  */
800
+ public function plugin_extend_links($links, $file) {
801
+
802
+ if (!current_user_can('install_plugins'))
803
  return $links;
804
 
805
  $plugin = plugin_basename(__FILE__);
806
 
807
+ if ($file == $plugin) {
 
808
  return array_merge(
809
  $links,
810
  array(sprintf('<a href="http://www.dfactory.eu/support/forum/post-views-counter/" target="_blank">%s</a>', __('Support', 'post-views-counter')))
includes/update.php CHANGED
@@ -3,30 +3,26 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Update();
5
 
6
- class Post_Views_Counter_Update
7
- {
8
- public function __construct()
9
- {
10
  // actions
11
  add_action('init', array(&$this, 'check_update'));
12
  }
13
 
14
-
15
  /**
16
- *
17
  */
18
- public function check_update()
19
- {
20
  if(!current_user_can('manage_options'))
21
  return;
22
 
23
- // gets current database version
24
  $current_db_version = get_option('post_views_counter_version', '1.0.0');
25
 
26
  // new version?
27
- if(version_compare($current_db_version, Post_Views_Counter()->get_attribute('defaults', 'version'), '<'))
28
- {
29
- // updates plugin version
30
  update_option('post_views_counter_version', Post_Views_Counter()->get_attribute('defaults', 'version'));
31
  }
32
  }
3
 
4
  new Post_Views_Counter_Update();
5
 
6
+ class Post_Views_Counter_Update {
7
+
8
+ public function __construct() {
 
9
  // actions
10
  add_action('init', array(&$this, 'check_update'));
11
  }
12
 
 
13
  /**
14
+ * Check if there's a db update required
15
  */
16
+ public function check_update() {
 
17
  if(!current_user_can('manage_options'))
18
  return;
19
 
20
+ // get current database version
21
  $current_db_version = get_option('post_views_counter_version', '1.0.0');
22
 
23
  // new version?
24
+ if(version_compare($current_db_version, Post_Views_Counter()->get_attribute('defaults', 'version'), '<')) {
25
+ // update plugin version
 
26
  update_option('post_views_counter_version', Post_Views_Counter()->get_attribute('defaults', 'version'));
27
  }
28
  }
includes/widgets.php CHANGED
@@ -3,36 +3,30 @@ if(!defined('ABSPATH')) exit;
3
 
4
  new Post_Views_Counter_Widgets();
5
 
6
- class Post_Views_Counter_Widgets
7
- {
8
- public function __construct()
9
- {
10
  // actions
11
  add_action('widgets_init', array(&$this, 'register_widgets'));
12
  }
13
 
14
-
15
  /**
16
- *
17
  */
18
- public function register_widgets()
19
- {
20
  register_widget('Post_Views_Counter_List_Widget');
21
  }
22
  }
23
 
24
-
25
- class Post_Views_Counter_List_Widget extends WP_Widget
26
- {
27
  private $pvc_options;
28
  private $pvc_defaults;
29
  private $pvc_post_types;
30
  private $pvc_order_types;
31
  private $pvc_image_sizes;
32
 
33
-
34
- public function __construct()
35
- {
36
  parent::__construct(
37
  'Post_Views_Counter_List_Widget',
38
  __('Most Viewed Posts', 'post-views-counter'),
@@ -64,27 +58,23 @@ class Post_Views_Counter_List_Widget extends WP_Widget
64
 
65
  $this->pvc_image_sizes = array_merge(array('full'), get_intermediate_image_sizes());
66
 
67
- // sorts image sizes ascending by name
68
  sort($this->pvc_image_sizes, SORT_STRING);
69
 
70
  add_action('wp_loaded', array(&$this, 'load_post_types'));
71
  }
72
 
73
-
74
  /**
75
- *
76
  */
77
- public function load_post_types()
78
- {
79
  $this->pvc_post_types = Post_Views_Counter()->get_instance('settings')->post_types;
80
  }
81
 
82
-
83
  /**
84
- *
85
  */
86
- public function widget($args, $instance)
87
- {
88
  $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
89
 
90
  $html = $args['before_widget'].(!empty($instance['title']) ? $args['before_title'].$instance['title'].$args['after_title'] : '');
@@ -94,22 +84,19 @@ class Post_Views_Counter_List_Widget extends WP_Widget
94
  echo $html;
95
  }
96
 
97
-
98
  /**
99
- *
100
  */
101
- public function form($instance)
102
- {
103
  $html = '
104
  <p>
105
  <label for="'.$this->get_field_id('title').'">'.__('Title', 'post-views-counter').':</label>
106
  <input id="'.$this->get_field_id('title').'" class="widefat" name="'.$this->get_field_name('title').'" type="text" value="'.esc_attr(isset($instance['title']) ? $instance['title'] : $this->pvc_defaults['title']).'" />
107
  </p>
108
  <p>
109
- <label>'.__('Post types', 'post-views-counter').':</label><br />';
110
 
111
- foreach($this->pvc_post_types as $post_type => $post_type_name)
112
- {
113
  $html .= '
114
  <input id="'.$this->get_field_id('post_types').'-'.$post_type.'" type="checkbox" name="'.$this->get_field_name('post_types').'[]" value="'.$post_type.'" '.checked((!isset($instance['post_types']) ? true : in_array($post_type, $instance['post_types'], true)), true, false).'><label for="'.$this->get_field_id('post_types').'-'.$post_type.'">'.esc_html($post_type_name).'</label>';
115
  }
@@ -131,8 +118,7 @@ class Post_Views_Counter_List_Widget extends WP_Widget
131
  <label for="'.$this->get_field_id('order').'">'.__('Order', 'post-views-counter').':</label>
132
  <select id="'.$this->get_field_id('order').'" name="'.$this->get_field_name('order').'">';
133
 
134
- foreach($this->pvc_order_types as $id => $order)
135
- {
136
  $html .= '
137
  <option value="'.esc_attr($id).'" '.selected($id, (isset($instance['order']) ? $instance['order'] : $this->pvc_defaults['order']), false).'>'.$order.'</option>';
138
  }
@@ -153,8 +139,7 @@ class Post_Views_Counter_List_Widget extends WP_Widget
153
 
154
  $size_type = (isset($instance['thumbnail_size']) ? $instance['thumbnail_size'] : $this->pvc_defaults['thumbnail_size']);
155
 
156
- foreach($this->pvc_image_sizes as $size)
157
- {
158
  $html .= '
159
  <option value="'.esc_attr($size).'" '.selected($size, $size_type, false).'>'.$size.'</option>';
160
  }
@@ -166,13 +151,11 @@ class Post_Views_Counter_List_Widget extends WP_Widget
166
  echo $html;
167
  }
168
 
169
-
170
  /**
171
- *
172
  */
173
- public function update($new_instance, $old_instance)
174
- {
175
- // number of events
176
  $old_instance['number_of_posts'] = (int)(isset($new_instance['number_of_posts']) ? $new_instance['number_of_posts'] : $this->pvc_defaults['number_of_posts']);
177
 
178
  // order
@@ -191,13 +174,11 @@ class Post_Views_Counter_List_Widget extends WP_Widget
191
  $old_instance['no_posts_message'] = sanitize_text_field(isset($new_instance['no_posts_message']) ? $new_instance['no_posts_message'] : $this->pvc_defaults['no_posts_message']);
192
 
193
  // post types
194
- if(isset($new_instance['post_types']))
195
- {
196
  $post_types = array();
197
 
198
- foreach($new_instance['post_types'] as $post_type)
199
- {
200
- if(isset($this->pvc_post_types[$post_type]))
201
  $post_types[] = $post_type;
202
  }
203
 
3
 
4
  new Post_Views_Counter_Widgets();
5
 
6
+ class Post_Views_Counter_Widgets {
7
+
8
+ public function __construct() {
 
9
  // actions
10
  add_action('widgets_init', array(&$this, 'register_widgets'));
11
  }
12
 
 
13
  /**
14
+ * Register PVC widget
15
  */
16
+ public function register_widgets() {
 
17
  register_widget('Post_Views_Counter_List_Widget');
18
  }
19
  }
20
 
21
+ class Post_Views_Counter_List_Widget extends WP_Widget {
22
+
 
23
  private $pvc_options;
24
  private $pvc_defaults;
25
  private $pvc_post_types;
26
  private $pvc_order_types;
27
  private $pvc_image_sizes;
28
 
29
+ public function __construct() {
 
 
30
  parent::__construct(
31
  'Post_Views_Counter_List_Widget',
32
  __('Most Viewed Posts', 'post-views-counter'),
58
 
59
  $this->pvc_image_sizes = array_merge(array('full'), get_intermediate_image_sizes());
60
 
61
+ // sort image sizes by name, ascending
62
  sort($this->pvc_image_sizes, SORT_STRING);
63
 
64
  add_action('wp_loaded', array(&$this, 'load_post_types'));
65
  }
66
 
 
67
  /**
68
+ * Get selected post types
69
  */
70
+ public function load_post_types() {
 
71
  $this->pvc_post_types = Post_Views_Counter()->get_instance('settings')->post_types;
72
  }
73
 
 
74
  /**
75
+ * Display widget function
76
  */
77
+ public function widget($args, $instance) {
 
78
  $instance['title'] = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
79
 
80
  $html = $args['before_widget'].(!empty($instance['title']) ? $args['before_title'].$instance['title'].$args['after_title'] : '');
84
  echo $html;
85
  }
86
 
 
87
  /**
88
+ * Admin widget function
89
  */
90
+ public function form($instance) {
 
91
  $html = '
92
  <p>
93
  <label for="'.$this->get_field_id('title').'">'.__('Title', 'post-views-counter').':</label>
94
  <input id="'.$this->get_field_id('title').'" class="widefat" name="'.$this->get_field_name('title').'" type="text" value="'.esc_attr(isset($instance['title']) ? $instance['title'] : $this->pvc_defaults['title']).'" />
95
  </p>
96
  <p>
97
+ <label>'.__('Post Types', 'post-views-counter').':</label><br />';
98
 
99
+ foreach ($this->pvc_post_types as $post_type => $post_type_name) {
 
100
  $html .= '
101
  <input id="'.$this->get_field_id('post_types').'-'.$post_type.'" type="checkbox" name="'.$this->get_field_name('post_types').'[]" value="'.$post_type.'" '.checked((!isset($instance['post_types']) ? true : in_array($post_type, $instance['post_types'], true)), true, false).'><label for="'.$this->get_field_id('post_types').'-'.$post_type.'">'.esc_html($post_type_name).'</label>';
102
  }
118
  <label for="'.$this->get_field_id('order').'">'.__('Order', 'post-views-counter').':</label>
119
  <select id="'.$this->get_field_id('order').'" name="'.$this->get_field_name('order').'">';
120
 
121
+ foreach ($this->pvc_order_types as $id => $order) {
 
122
  $html .= '
123
  <option value="'.esc_attr($id).'" '.selected($id, (isset($instance['order']) ? $instance['order'] : $this->pvc_defaults['order']), false).'>'.$order.'</option>';
124
  }
139
 
140
  $size_type = (isset($instance['thumbnail_size']) ? $instance['thumbnail_size'] : $this->pvc_defaults['thumbnail_size']);
141
 
142
+ foreach ($this->pvc_image_sizes as $size) {
 
143
  $html .= '
144
  <option value="'.esc_attr($size).'" '.selected($size, $size_type, false).'>'.$size.'</option>';
145
  }
151
  echo $html;
152
  }
153
 
 
154
  /**
155
+ * Save widget function
156
  */
157
+ public function update($new_instance, $old_instance) {
158
+ // number of posts
 
159
  $old_instance['number_of_posts'] = (int)(isset($new_instance['number_of_posts']) ? $new_instance['number_of_posts'] : $this->pvc_defaults['number_of_posts']);
160
 
161
  // order
174
  $old_instance['no_posts_message'] = sanitize_text_field(isset($new_instance['no_posts_message']) ? $new_instance['no_posts_message'] : $this->pvc_defaults['no_posts_message']);
175
 
176
  // post types
177
+ if (isset($new_instance['post_types'])) {
 
178
  $post_types = array();
179
 
180
+ foreach ($new_instance['post_types'] as $post_type) {
181
+ if (isset($this->pvc_post_types[$post_type]))
 
182
  $post_types[] = $post_type;
183
  }
184
 
js/admin.js CHANGED
@@ -1,94 +1,99 @@
1
- jQuery(document).ready(function($) {
2
 
3
- // default chosen
4
- $('.pvc-chosen').chosen({
5
- disable_search_threshold: 8,
6
- display_selected_options: false,
7
- search_contains: true,
8
- width: '300px'
9
- });
10
 
 
 
 
 
 
 
 
11
 
12
- // time types and position
13
- $('.pvc-chosen-short').chosen({
14
- disable_search_threshold: 8,
15
- width: '200px'
16
- });
17
 
 
 
 
 
 
18
 
19
- // ask whether reset options to defaults
20
- $(document).on('click', '.reset_pvc_settings', function() {
21
- return confirm(pvcArgsSettings.resetToDefaults);
22
- });
23
 
 
 
 
 
24
 
25
- // removes ip box
26
- $(document).on('click', '.remove-exclude-ip', function() {
27
- var parent = $(this).parent(),
28
- nextParent = parent.parent(),
29
- addButton = parent.find('.add-exclude-ip').hide(),
30
- addCurrentIPButton = parent.find('.add-current-ip').hide();
31
 
32
- // removes ip box
33
- parent.remove();
 
 
 
 
34
 
35
- var children = nextParent.find('div');
 
36
 
37
- // was there add button?
38
- if(addButton.length === 1) {
39
- children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
40
- // children.last().append();
41
- }
42
 
43
- // only one ip box left?
44
- if(children.length === 1) {
45
- children.find('.remove-exclude-ip').hide();
46
- }
47
- });
48
 
 
 
 
 
 
49
 
50
- // adds ip box
51
- $(document).on('click', '.add-exclude-ip', function() {
52
- var parent = $(this).parent(),
53
- newBox = parent.clone().hide();
54
 
55
- // clears value
56
- newBox.find('input').first().val('');
 
 
57
 
58
- // removes add buttons
59
- $(this).remove();
60
- parent.find('.add-current-ip').remove();
61
 
62
- // adds and displays new ip box
63
- parent.after(newBox.show());
 
64
 
65
- parent.parent().find('.remove-exclude-ip').show();
66
- });
67
 
 
 
68
 
69
- // adds current ip
70
- $(document).on('click', '.add-current-ip', function() {
71
- // fills input with user's current ip
72
- $(this).parent().find('input').first().val($(this).attr('data-rel'));
73
- });
74
 
 
 
 
 
 
75
 
76
- // displays user roles if needed
77
- $(document).on('change', '.pvc-chosen-groups', function() {
78
- var foundRoles = false;
79
 
80
- // checks whether roles are selected
81
- $(this).find(':selected').each(function(i, item) {
82
- if(item.value === 'roles') {
83
- foundRoles = true;
84
- }
85
- });
86
 
87
- // are roles selected?
88
- if(foundRoles) {
89
- $(this).parent().find('.pvc_user_roles').fadeIn(300);
90
- } else {
91
- $(this).parent().find('.pvc_user_roles').fadeOut(300);
92
- }
93
- });
94
- });
 
 
 
 
 
 
 
 
 
 
1
+ (function ($) {
2
 
3
+ $(document).ready(function () {
 
 
 
 
 
 
4
 
5
+ // default chosen
6
+ $('.pvc-chosen').chosen({
7
+ disable_search_threshold: 8,
8
+ display_selected_options: false,
9
+ search_contains: true,
10
+ width: '300px'
11
+ });
12
 
 
 
 
 
 
13
 
14
+ // time types and position
15
+ $('.pvc-chosen-short').chosen({
16
+ disable_search_threshold: 8,
17
+ width: '200px'
18
+ });
19
 
 
 
 
 
20
 
21
+ // ask whether to reset options to defaults
22
+ $(document).on('click', '.reset_pvc_settings', function () {
23
+ return confirm(pvcArgsSettings.resetToDefaults);
24
+ });
25
 
 
 
 
 
 
 
26
 
27
+ // remove ip box
28
+ $(document).on('click', '.remove-exclude-ip', function () {
29
+ var parent = $(this).parent(),
30
+ nextParent = parent.parent(),
31
+ addButton = parent.find('.add-exclude-ip').hide(),
32
+ addCurrentIPButton = parent.find('.add-current-ip').hide();
33
 
34
+ // remove ip box
35
+ parent.remove();
36
 
37
+ var children = nextParent.find('div');
 
 
 
 
38
 
39
+ // was there add button?
40
+ if (addButton.length === 1) {
41
+ children.last().append(addButton.show(), ' ', addCurrentIPButton.show());
42
+ // children.last().append();
43
+ }
44
 
45
+ // only one ip box left?
46
+ if (children.length === 1) {
47
+ children.find('.remove-exclude-ip').hide();
48
+ }
49
+ });
50
 
 
 
 
 
51
 
52
+ // add ip box
53
+ $(document).on('click', '.add-exclude-ip', function () {
54
+ var parent = $(this).parent(),
55
+ newBox = parent.clone().hide();
56
 
57
+ // clear value
58
+ newBox.find('input').first().val('');
 
59
 
60
+ // remove add buttons
61
+ $(this).remove();
62
+ parent.find('.add-current-ip').remove();
63
 
64
+ // add and display new ip box
65
+ parent.after(newBox.show());
66
 
67
+ parent.parent().find('.remove-exclude-ip').show();
68
+ });
69
 
 
 
 
 
 
70
 
71
+ // add current ip
72
+ $(document).on('click', '.add-current-ip', function () {
73
+ // fills input with user's current ip
74
+ $(this).parent().find('input').first().val($(this).attr('data-rel'));
75
+ });
76
 
 
 
 
77
 
78
+ // display user roles if needed
79
+ $(document).on('change', '.pvc-chosen-groups', function () {
80
+ var foundRoles = false;
 
 
 
81
 
82
+ // check whether roles are selected
83
+ $(this).find(':selected').each(function (i, item) {
84
+ if (item.value === 'roles') {
85
+ foundRoles = true;
86
+ }
87
+ });
88
+
89
+ // are roles selected?
90
+ if (foundRoles) {
91
+ $(this).parent().find('.pvc_user_roles').fadeIn(300);
92
+ } else {
93
+ $(this).parent().find('.pvc_user_roles').fadeOut(300);
94
+ }
95
+ });
96
+
97
+ });
98
+
99
+ })(jQuery);
js/frontend.js CHANGED
@@ -1,9 +1,14 @@
1
- jQuery(document).ready(function($) {
2
-
3
- $.post(pvcArgsFrontend.ajaxURL, {
4
- action: 'pvc-check-post',
5
- pvc_nonce: pvcArgsFrontend.nonce,
6
- post_id: pvcArgsFrontend.postID,
7
- post_type: pvcArgsFrontend.postType
8
- });
9
- });
 
 
 
 
 
1
+ (function ($) {
2
+
3
+ $(document).ready(function () {
4
+
5
+ $.post(pvcArgsFrontend.ajaxURL, {
6
+ action: 'pvc-check-post',
7
+ pvc_nonce: pvcArgsFrontend.nonce,
8
+ post_id: pvcArgsFrontend.postID,
9
+ post_type: pvcArgsFrontend.postType
10
+ });
11
+
12
+ });
13
+
14
+ })(jQuery);
languages/post-views-counter-he_IL.mo ADDED
Binary file
languages/post-views-counter-he_IL.po ADDED
@@ -0,0 +1,703 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file was generated by WPML
2
+ # WPML is a WordPress plugin that can turn any WordPress or WordPressMU site into a full featured multilingual content management system.
3
+ # http://wpml.org
4
+ msgid ""
5
+ msgstr ""
6
+ "Content-Type: text/plain; charset=UTF-8\n"
7
+ "Content-Transfer-Encoding: 8bit\n"
8
+ "Project-Id-Version: post-views-counter\n"
9
+ "POT-Creation-Date: \n"
10
+ "PO-Revision-Date: \n"
11
+ "Last-Translator: Ahrale <contact@atar4u.com>\n"
12
+ "Language-Team: Ahrale, Atar4U.com <contact@atar4u.com>\n"
13
+ "MIME-Version: 1.0\n"
14
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
15
+ "Language: he\n"
16
+ "X-Generator: Poedit 1.7.4\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+
19
+ # else
20
+ # $columns['post_views'] = __('Post Views', 'post-views-counter');
21
+ #
22
+ # wpml-name: 2b6878c42c03e731668a0a8c2cc8bf3c
23
+ msgid "Post Views"
24
+ msgstr "צפיות בפוסט"
25
+
26
+ # </div>
27
+ # <span class="description">'.esc_html__('Use it to hide the post views counter from selected type of visitors.', 'post-views-counter').'</span>
28
+ # </fieldset>
29
+ # wpml-name: e134543051875cd191a9bfb3c5db64db
30
+ msgid "Use it to hide the post views counter from selected type of visitors."
31
+ msgstr "השתמש בזה כדי להסתיר את מונה הצפיות מסוג מסוים של מבקרים."
32
+
33
+ # <br/>
34
+ # <span class="description">'.esc_html__('Choose how to display the post views counter.', 'post-views-counter').'</span>
35
+ # </fieldset>
36
+ # wpml-name: 828bb1097dfb85166bb5c3cc85a4ba13
37
+ msgid "Choose how to display the post views counter."
38
+ msgstr "בחר כיצד להציג את מונה הצפיות בפוסט."
39
+
40
+ # <br/>
41
+ # <span class="description">'.esc_html__('Select where would you like to display the post views counter. Use [post-views] shortcode for manual display.', 'post-views-counter').'</span>
42
+ # </fieldset>
43
+ # wpml-name: 494fa9ed65214ea4e4f2d7f970f37de2
44
+ msgid "Select where would you like to display the post views counter. Use [post-views] shortcode for manual display."
45
+ msgstr "בחר היכן להציג את מונה הצפיות. השתמש ב קיצור הקוד [post-views] להצגה ידנית."
46
+
47
+ # <br/>
48
+ # <span class="description">'.esc_html__('Enable to delete all plugin data on deactivation.', 'post-views-counter').'</span>
49
+ # </fieldset>
50
+ # wpml-name: 44994fd8973f0fc0914ecb643862133e
51
+ msgid "Enable to delete all plugin data on deactivation."
52
+ msgstr "הפעל כדי למחוק את כל נתוני התוסף עם כיבויו."
53
+
54
+ # <p class="description">'.esc_html__('Import post views data from WP-PostViews plugin.', 'post-views-counter').'</p>
55
+ # <input id="pvc-wp-postviews" type="checkbox" name="post_views_counter_import_wp_postviews_override"/><label for="pvc-wp-postviews">'.esc_html__('Override existing Post Views Counter data.', 'post-views-counter').'</label>
56
+ # </fieldset>
57
+ # wpml-name: d6c1aff79a1db97816fae722d2eeafe8
58
+ msgid "Override existing Post Views Counter data."
59
+ msgstr "דורס את הנתונים הקיימים של מספר הצפיות."
60
+
61
+ # <br/>
62
+ # <p class="description">'.esc_html__('Import post views data from WP-PostViews plugin.', 'post-views-counter').'</p>
63
+ # <input id="pvc-wp-postviews" type="checkbox" name="post_views_counter_import_wp_postviews_override"/><label for="pvc-wp-postviews">'.esc_html__('Override existing Post Views Counter data.', 'post-views-counter').'</label>
64
+ # wpml-name: e9dd64b2d3139d4439393bf867d7fa3d
65
+ msgid "Import post views data from WP-PostViews plugin."
66
+ msgstr "יבוא נתוני צפיה מתוסף WP-PostViews"
67
+
68
+ # </div>
69
+ # <span class="description">'.esc_html__('Enter the IP addresses to be excluded from post views count.', 'post-views-counter').'</span>
70
+ # </fieldset>
71
+ # wpml-name: 23c93f02d9e3869862860ef5e8fc17c1
72
+ msgid "Enter the IP addresses to be excluded from post views count."
73
+ msgstr "הזן כתובת IP שלא תיכלל בספירת הצפיות."
74
+
75
+ # </div>
76
+ # <span class="description">'.esc_html__('Select the type of visitors to be excluded from post views count.', 'post-views-counter').'</span>
77
+ # </fieldset>
78
+ # wpml-name: c1679cb7d80e659e49d9885da6721990
79
+ msgid "Select the type of visitors to be excluded from post views count."
80
+ msgstr "בחר את סוג המבקרים שלא ייכללו בספירת הצפיות."
81
+
82
+ # <br/>
83
+ # <span class="description">'.esc_html__('Delete single day post views data older than specified above. Enter 0 (number zero) if you want to preserve your data regardless of its age.', 'post-views-counter').'</span>
84
+ # </fieldset>
85
+ # wpml-name: d84f512e9cc007df5f01e00098438331
86
+ msgid "Delete single day post views data older than specified above. Enter 0 (number zero) if you want to preserve your data regardless of its age."
87
+ msgstr "מחק נתוני צפיה ישנים מ. הזן 0 (מספר אפס) אם אתה רוצה לשמור את הנתונים שלך ללא קשר לגיל שלהם."
88
+
89
+ # <br/>
90
+ # <span class="description">'.esc_html__('Enter the time between single user visit count.', 'post-views-counter').'</span>
91
+ # </fieldset>
92
+ # wpml-name: 9f171231826c3b4225f0c4f299a948a2
93
+ msgid "Enter the time between single user visit count."
94
+ msgstr "הזן את הזמן שבין צפיות של ביקורי משתמש יחיד."
95
+
96
+ # <br/>
97
+ # <span class="description">'.esc_html__('Enable to display post views count column for each of the selected post types.', 'post-views-counter').'</span>
98
+ # </fieldset>
99
+ # wpml-name: a5499ed05290eeed883e694d8533883a
100
+ msgid "Enable to display post views count column for each of the selected post types."
101
+ msgstr "הפעל הצגת עמודת מונה צפיות עבור כל סוגי הפוסט הנבחרים."
102
+
103
+ # <br/>
104
+ # <span class="description">'.esc_html__('Select the method of collecting post views data. If you are using any of the caching plugins select Javascript.', 'post-views-counter').'</span>
105
+ # </fieldset>
106
+ # wpml-name: e6268e04c188295373cb30eac4191949
107
+ msgid "Select the method of collecting post views data. If you are using any of the caching plugins select Javascript."
108
+ msgstr "בחירת השיטה לאיסוף נתוני הצפיה בפוסט. אם אתה משתמש בסוג כלשהו של תוסף מטמון בחר Javascript."
109
+
110
+ # <br/>
111
+ # <span class="description">'.esc_html__('Select post types for which post views will be displayed.', 'post-views-counter').'</span>
112
+ # </fieldset>
113
+ # wpml-name: 7eeb807af1c2e460d37dc3d9ad705e4e
114
+ msgid "Select post types for which post views will be displayed."
115
+ msgstr "בחירת סוגי פוסט בהם יוצג מונה הצפיות."
116
+
117
+ # <br/>
118
+ # <span class="description">'.esc_html__('Select post types for which post views will be counted.', 'post-views-counter').'</span>
119
+ # </fieldset>
120
+ # wpml-name: 7da415ac443cf55627617c0fb706415c
121
+ msgid "Select post types for which post views will be counted."
122
+ msgstr "בחירת סוגי פוסט בהן יימנו הצפיות."
123
+
124
+ # <br/>
125
+ # <span class="description">'.esc_html__('Enter the label for the post views counter field.', 'post-views-counter').'</span>
126
+ # </fieldset>
127
+ # wpml-name: a02f387f8aa11eb418b3fdc4182ad4a2
128
+ msgid "Enter the label for the post views counter field."
129
+ msgstr "הזן את התווית עבור שדה מונה הצפיות בפוסט."
130
+
131
+ # <div class="ip-box">
132
+ # <input type="text" name="post_views_counter_settings_general[exclude_ips][]" value="" /> <input type="button" class="button button-secondary remove-exclude-ip" value="'.esc_attr__('Remove', 'post-views-counter').'"'.(empty($ips) ? ' style="display: none;"' : '').' /> <input type="button" class="button button-secondary add-exclude-ip" value="'.esc_attr__('Add new', 'post-views-counter').'" /> <input type="button" class="button button-secondary add-current-ip" value="'.esc_attr__('Add my current IP', 'post-views-counter').'" data-rel="'.esc_attr($_SERVER['REMOTE_ADDR']).'" />
133
+ # </div>
134
+ # wpml-name: 732f60ecf863c8ec5e4e385fa97974cf
135
+ msgid "Add my current IP"
136
+ msgstr "הוסף את כתובת ה IP הנוכחית שלי"
137
+
138
+ # <div class="ip-box">
139
+ # <input type="text" name="post_views_counter_settings_general[exclude_ips][]" value="" /> <input type="button" class="button button-secondary remove-exclude-ip" value="'.esc_attr__('Remove', 'post-views-counter').'"'.(empty($ips) ? ' style="display: none;"' : '').' /> <input type="button" class="button button-secondary add-exclude-ip" value="'.esc_attr__('Add new', 'post-views-counter').'" /> <input type="button" class="button button-secondary add-current-ip" value="'.esc_attr__('Add my current IP', 'post-views-counter').'" data-rel="'.esc_attr($_SERVER['REMOTE_ADDR']).'" />
140
+ # </div>
141
+ # wpml-name: ef61fb324d729c341ea8ab9901e23566
142
+ msgid "Add new"
143
+ msgstr "הוספה"
144
+
145
+ # <div class="ip-box">
146
+ # <input type="text" name="post_views_counter_settings_general[exclude_ips][]" value="" /> <input type="button" class="button button-secondary remove-exclude-ip" value="'.esc_attr__('Remove', 'post-views-counter').'"'.(empty($ips) ? ' style="display: none;"' : '').' /> <input type="button" class="button button-secondary add-exclude-ip" value="'.esc_attr__('Add new', 'post-views-counter').'" /> <input type="button" class="button button-secondary add-current-ip" value="'.esc_attr__('Add my current IP', 'post-views-counter').'" data-rel="'.esc_attr($_SERVER['REMOTE_ADDR']).'" />
147
+ # </div>
148
+ # wpml-name: 1063e38cb53d94d386f21227fcd84717
149
+ msgid "Remove"
150
+ msgstr "הסרה"
151
+
152
+ # <div class="pvc_user_roles"'.(in_array('roles', Post_Views_Counter()->get_attribute('options', 'display', 'restrict_display', 'groups'), true) ? '' : ' style="display: none;"').'>
153
+ # <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select user roles', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][roles][]" multiple="multiple">';
154
+ #
155
+ # wpml-name: 1f9b43f781151210d10ce5a0c3f320c7
156
+ msgid "Select user roles"
157
+ msgstr "בחירת תפקידי משתמש"
158
+
159
+ # <fieldset>
160
+ # <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select groups', 'post-views-counter').'" name="post_views_counter_settings_display[restrict_display][groups][]" multiple="multiple">';
161
+ #
162
+ # wpml-name: bbd0c249ee2dc65d91a569a39c4a486c
163
+ msgid "Select groups"
164
+ msgstr "בחירת קבוצות"
165
+
166
+ # <fieldset>
167
+ # <select class="pvc-chosen" data-placeholder="'.esc_attr__('Select post types', 'post-views-counter').'" name="post_views_counter_settings_general[post_types_count][]" multiple="multiple">';
168
+ #
169
+ # wpml-name: ac707beaaf56ab21015d9a5dfc3dfdf5
170
+ msgid "Select post types"
171
+ msgstr "בחירת סוגי פוסט"
172
+
173
+ # $links,
174
+ # array(sprintf('<a href="http://www.dfactory.eu/support/forum/post-views-counter/" target="_blank">%s</a>', __('Support', 'post-views-counter')))
175
+ # );
176
+ # wpml-name: db5eb84117d06047c97c9a0191b5fffe
177
+ msgid "Support"
178
+ msgstr "תמיכה"
179
+
180
+ #
181
+ # add_settings_error('reset_general_settings', 'settings_reset', __('Display settings restored to defaults.', 'post-views-counter'), 'updated');
182
+ # }
183
+ # wpml-name: 0a7ee2a5083333b447560afabe8d44e2
184
+ msgid "Display settings restored to defaults."
185
+ msgstr "הגדרות התצוגה שוחזרו לברירת המחדל."
186
+
187
+ #
188
+ # add_settings_error('reset_general_settings', 'settings_reset', __('General settings restored to defaults.', 'post-views-counter'), 'updated');
189
+ # }
190
+ # wpml-name: ccce0bd36389d2b3f2f9b2921686bf48
191
+ msgid "General settings restored to defaults."
192
+ msgstr "ההגדרות הכלליות שוחזרו לברירת המחדל."
193
+
194
+ # {
195
+ # add_settings_error('wp_postviews_import', 'wp_postviews_import', __('There was no data to import.', 'post-views-counter'), 'updated');
196
+ # }
197
+ # wpml-name: bc9eb397f21a6553daeffa63c9000343
198
+ msgid "There was no data to import."
199
+ msgstr "לא היו נתונים ליבוא."
200
+
201
+ #
202
+ # add_settings_error('wp_postviews_import', 'wp_postviews_import', __('WP-PostViews data imported succesfully.', 'post-views-counter'), 'updated');
203
+ # }
204
+ # wpml-name: 38781501cd41a58f7b25220d4126faee
205
+ msgid "WP-PostViews data imported succesfully."
206
+ msgstr "נתוני WP-PostViews יובאו בהצלחה."
207
+
208
+ # <br/>
209
+ # <span class="description">'.sprintf(__('Enter the post views icon class. Any of the <a href="%s" target="_blank">Dashicons</a> classes are available.', 'post-views-counter'), 'http://melchoyce.github.io/dashicons/').'</span>
210
+ # </fieldset>
211
+ # wpml-name: 3392aa71f4cbce0990d55248c82ba7a1
212
+ msgid "Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank\">Dashicons</a> classes are available."
213
+ msgstr "הזן את מחלקת צלמית הצפיות בפוסט. כל אחת ממחלקות ה <a href=\"%s\" target=\"_blank\">Dashicons</a> זמינה."
214
+
215
+ # <fieldset>
216
+ # <input type="submit" class="button button-secondary" name="post_views_counter_import_wp_postviews" value="'.__('Import', 'post-views-counter').'"/>
217
+ # <br/>
218
+ # wpml-name: 72d6d7a1885885bb55a565fd1070581a
219
+ msgid "Import"
220
+ msgstr "יבוא"
221
+
222
+ # add_settings_field('pvc_display_style', __('Display Style', 'post-views-counter'), array(&$this, 'display_style'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
223
+ # add_settings_field('pvc_icon_class', __('Icon Class', 'post-views-counter'), array(&$this, 'icon_class'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
224
+ # }
225
+ # wpml-name: 9aa857ff4d8501f17b950717ebbcc24b
226
+ msgid "Icon Class"
227
+ msgstr "מחלקת צחמית"
228
+
229
+ # add_settings_field('pvc_position', __('Position', 'post-views-counter'), array(&$this, 'position'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
230
+ # add_settings_field('pvc_display_style', __('Display Style', 'post-views-counter'), array(&$this, 'display_style'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
231
+ # add_settings_field('pvc_icon_class', __('Icon Class', 'post-views-counter'), array(&$this, 'icon_class'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
232
+ # wpml-name: 449bd71d9342884cbca84bdbbec5012b
233
+ msgid "Display Style"
234
+ msgstr "עיצוב תצוגה"
235
+
236
+ # add_settings_field('pvc_restrict_display', __('Restrict Display', 'post-views-counter'), array(&$this, 'restrict_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
237
+ # add_settings_field('pvc_position', __('Position', 'post-views-counter'), array(&$this, 'position'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
238
+ # add_settings_field('pvc_display_style', __('Display Style', 'post-views-counter'), array(&$this, 'display_style'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
239
+ # wpml-name: 52f5e0bc3859bc5f5e25130b6c7e8881
240
+ msgid "Position"
241
+ msgstr "מיקום"
242
+
243
+ # add_settings_field('pvc_post_types_display', __('Post Types Display', 'post-views-counter'), array(&$this, 'post_types_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
244
+ # add_settings_field('pvc_restrict_display', __('Restrict Display', 'post-views-counter'), array(&$this, 'restrict_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
245
+ # add_settings_field('pvc_position', __('Position', 'post-views-counter'), array(&$this, 'position'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
246
+ # wpml-name: bf2b654eddbcab98f6d988f11c933b7c
247
+ msgid "Restrict Display"
248
+ msgstr "הגבלת תצוגה"
249
+
250
+ # add_settings_field('pvc_post_views_label', __('Post Views Label', 'post-views-counter'), array(&$this, 'post_views_label'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
251
+ # add_settings_field('pvc_post_types_display', __('Post Types Display', 'post-views-counter'), array(&$this, 'post_types_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
252
+ # add_settings_field('pvc_restrict_display', __('Restrict Display', 'post-views-counter'), array(&$this, 'restrict_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
253
+ # wpml-name: 399b2524574ff7ec701478749a9919a1
254
+ msgid "Post Types Display"
255
+ msgstr "תצוגת סוגי פוסט"
256
+
257
+ # add_settings_section('post_views_counter_settings_display', __('Display settings', 'post-views-counter'), '', 'post_views_counter_settings_display');
258
+ # add_settings_field('pvc_post_views_label', __('Post Views Label', 'post-views-counter'), array(&$this, 'post_views_label'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
259
+ # add_settings_field('pvc_post_types_display', __('Post Types Display', 'post-views-counter'), array(&$this, 'post_types_display'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
260
+ # wpml-name: 5b08eda1f261d38497f24bbdb1888e42
261
+ msgid "Post Views Label"
262
+ msgstr "תווית מונה הצפיות"
263
+
264
+ # register_setting('post_views_counter_settings_display', 'post_views_counter_settings_display', array(&$this, 'validate_settings'));
265
+ # add_settings_section('post_views_counter_settings_display', __('Display settings', 'post-views-counter'), '', 'post_views_counter_settings_display');
266
+ # add_settings_field('pvc_post_views_label', __('Post Views Label', 'post-views-counter'), array(&$this, 'post_views_label'), 'post_views_counter_settings_display', 'post_views_counter_settings_display');
267
+ # wpml-name: 9dc0b7bdd32d5e30f4d71eb5abb6b8d4
268
+ msgid "Display settings"
269
+ msgstr "הגדרות התצוגה"
270
+
271
+ # add_settings_field('pvc_wp_postviews', __('WP-PostViews', 'post-views-counter'), array(&$this, 'wp_postviews'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
272
+ # add_settings_field('pvc_deactivation_delete', __('Deactivation', 'post-views-counter'), array(&$this, 'deactivation_delete'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
273
+ #
274
+ # wpml-name: 142b518220d1a501f6ebc72daf0c218d
275
+ msgid "Deactivation"
276
+ msgstr "כיבוי"
277
+
278
+ # add_settings_field('pvc_exclude_ips', __('Exclude IPs', 'post-views-counter'), array(&$this, 'exclude_ips'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
279
+ # add_settings_field('pvc_wp_postviews', __('WP-PostViews', 'post-views-counter'), array(&$this, 'wp_postviews'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
280
+ # add_settings_field('pvc_deactivation_delete', __('Deactivation', 'post-views-counter'), array(&$this, 'deactivation_delete'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
281
+ # wpml-name: 37fa3e87ca4867433be0441263f56bc7
282
+ msgid "WP-PostViews"
283
+ msgstr "WP-PostViews"
284
+
285
+ # add_settings_field('pvc_exclude', __('Exclude Visitors', 'post-views-counter'), array(&$this, 'exclude'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
286
+ # add_settings_field('pvc_exclude_ips', __('Exclude IPs', 'post-views-counter'), array(&$this, 'exclude_ips'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
287
+ # add_settings_field('pvc_wp_postviews', __('WP-PostViews', 'post-views-counter'), array(&$this, 'wp_postviews'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
288
+ # wpml-name: 50e03fbc1b209b9efad9d5a40f26ef53
289
+ msgid "Exclude IPs"
290
+ msgstr "אל תכלול כתובות IP"
291
+
292
+ # add_settings_field('pvc_reset_counts', __('Reset Data', 'post-views-counter'), array(&$this, 'reset_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
293
+ # add_settings_field('pvc_exclude', __('Exclude Visitors', 'post-views-counter'), array(&$this, 'exclude'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
294
+ # add_settings_field('pvc_exclude_ips', __('Exclude IPs', 'post-views-counter'), array(&$this, 'exclude_ips'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
295
+ # wpml-name: 893f67c38741dcbb510673bbea43df02
296
+ msgid "Exclude Visitors"
297
+ msgstr "אל תכלול מבקרים"
298
+
299
+ # add_settings_field('pvc_time_between_counts', __('Time Between Counts', 'post-views-counter'), array(&$this, 'time_between_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
300
+ # add_settings_field('pvc_reset_counts', __('Reset Data', 'post-views-counter'), array(&$this, 'reset_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
301
+ # add_settings_field('pvc_exclude', __('Exclude Visitors', 'post-views-counter'), array(&$this, 'exclude'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
302
+ # wpml-name: b8fafd4d55f19ac7d8e0df60849def54
303
+ msgid "Reset Data"
304
+ msgstr "איפוס נתונים"
305
+
306
+ # add_settings_field('pvc_post_views_column', __('Post Views Column', 'post-views-counter'), array(&$this, 'post_views_column'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
307
+ # add_settings_field('pvc_time_between_counts', __('Time Between Counts', 'post-views-counter'), array(&$this, 'time_between_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
308
+ # add_settings_field('pvc_reset_counts', __('Reset Data', 'post-views-counter'), array(&$this, 'reset_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
309
+ # wpml-name: 68cc8321958192ab646d438dac2a0e01
310
+ msgid "Time Between Counts"
311
+ msgstr "הזמן שבין הספירות"
312
+
313
+ # add_settings_field('pvc_counter_mode', __('Counter Mode', 'post-views-counter'), array(&$this, 'counter_mode'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
314
+ # add_settings_field('pvc_post_views_column', __('Post Views Column', 'post-views-counter'), array(&$this, 'post_views_column'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
315
+ # add_settings_field('pvc_time_between_counts', __('Time Between Counts', 'post-views-counter'), array(&$this, 'time_between_counts'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
316
+ # wpml-name: f45b80816475ecbf9fcbd07627f18f31
317
+ msgid "Post Views Column"
318
+ msgstr "עמודת מונה צפיות"
319
+
320
+ # add_settings_field('pvc_post_types_count', __('Post Types Count', 'post-views-counter'), array(&$this, 'post_types_count'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
321
+ # add_settings_field('pvc_counter_mode', __('Counter Mode', 'post-views-counter'), array(&$this, 'counter_mode'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
322
+ # add_settings_field('pvc_post_views_column', __('Post Views Column', 'post-views-counter'), array(&$this, 'post_views_column'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
323
+ # wpml-name: 2e0e0814e94100bd17e4805612f30062
324
+ msgid "Counter Mode"
325
+ msgstr "מצב מונה"
326
+
327
+ # add_settings_section('post_views_counter_settings_general', __('General settings', 'post-views-counter'), '', 'post_views_counter_settings_general');
328
+ # add_settings_field('pvc_post_types_count', __('Post Types Count', 'post-views-counter'), array(&$this, 'post_types_count'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
329
+ # add_settings_field('pvc_counter_mode', __('Counter Mode', 'post-views-counter'), array(&$this, 'counter_mode'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
330
+ # wpml-name: 5df1e366edb804b67e7ce03316d7a59f
331
+ msgid "Post Types Count"
332
+ msgstr "מונה סוג פוסט"
333
+
334
+ # register_setting('post_views_counter_settings_general', 'post_views_counter_settings_general', array(&$this, 'validate_settings'));
335
+ # add_settings_section('post_views_counter_settings_general', __('General settings', 'post-views-counter'), '', 'post_views_counter_settings_general');
336
+ # add_settings_field('pvc_post_types_count', __('Post Types Count', 'post-views-counter'), array(&$this, 'post_types_count'), 'post_views_counter_settings_general', 'post_views_counter_settings_general');
337
+ # wpml-name: de62775a71fc2bf7a13d7530ae24a7ed
338
+ msgid "General settings"
339
+ msgstr "הגדרות כלליות"
340
+
341
+ #
342
+ # submit_button(__('Reset to defaults', 'post-views-counter'), 'secondary reset_pvc_settings', $this->tabs[$tab_key]['reset'], FALSE);
343
+ #
344
+ # wpml-name: 21e2bb42873eddcb9b476b8eafbe0c18
345
+ msgid "Reset to defaults"
346
+ msgstr "איפוס לברירות המחדל"
347
+
348
+ # <hr />
349
+ # <p class="df-link inner">'.__('Created by', 'post-views-counter').' <a href="http://www.dfactory.eu/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=created-by" target="_blank" title="dFactory - Quality plugins for WordPress"><img src="'.POST_VIEWS_COUNTER_URL.'/images/logo-dfactory.png'.'" title="dFactory - Quality plugins for WordPress" alt="dFactory - Quality plugins for WordPress" /></a></p>
350
+ # </div>
351
+ # wpml-name: c8e6a7ed1489c036564b6bc24c92cca4
352
+ msgid "Created by"
353
+ msgstr "נוצר על-ידי"
354
+
355
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
356
+ # __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
357
+ # </p>
358
+ # wpml-name: b5f7ccb06aac73d562f608432419984f
359
+ msgid "WordPress plugins"
360
+ msgstr "תוספי וורדפרס"
361
+
362
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
363
+ # __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
364
+ # </p>
365
+ # wpml-name: d441f42d18b3436b5dced81f65942cb3
366
+ msgid "Check out our other"
367
+ msgstr "בדקו את יתר"
368
+
369
+ # <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
370
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
371
+ # __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
372
+ # wpml-name: aea33adedbe687186a07d5eeb8f7532d
373
+ msgid "plugin page"
374
+ msgstr "עמוד תוסף"
375
+
376
+ # <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
377
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
378
+ # __('Check out our other', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins" target="_blank" title="'.__('WordPress plugins', 'post-views-counter').'">'.__('WordPress plugins', 'post-views-counter').'</a>
379
+ # wpml-name: 12c59d2144988f54887561fd5d07bd15
380
+ msgid "Blog about it & link to the"
381
+ msgstr "פרסם וקשר ל"
382
+
383
+ # <h4 class="inner">'.__('Do you like this plugin?', 'post-views-counter').'</h4>
384
+ # <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
385
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
386
+ # wpml-name: a56dc830655cfe3ea6ec18bed27290b2
387
+ msgid "on WordPress.org"
388
+ msgstr "ב WordPress.org"
389
+
390
+ # <h4 class="inner">'.__('Do you like this plugin?', 'post-views-counter').'</h4>
391
+ # <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
392
+ # __('Blog about it & link to the', 'post-views-counter').' <a href="http://www.dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about" target="_blank" title="'.__('plugin page', 'post-views-counter').'">'.__('plugin page', 'post-views-counter').'</a><br/>'.
393
+ # wpml-name: b9933f69a39bb5385a7533195b9ddb1c
394
+ msgid "Rate it 5"
395
+ msgstr "תן לזה דירוג 5"
396
+
397
+ # <hr />
398
+ # <h4 class="inner">'.__('Do you like this plugin?', 'post-views-counter').'</h4>
399
+ # <p class="inner"><a href="http://wordpress.org/support/view/plugin-reviews/post-views-counter" target="_blank" title="'.__('Rate it 5', 'events-maker').'">'.__('Rate it 5', 'post-views-counter').'</a> '.__('on WordPress.org', 'post-views-counter').'<br />'.
400
+ # wpml-name: acee3a6f37049e783fd1a4f32d91ecf2
401
+ msgid "Do you like this plugin?"
402
+ msgstr "אוהב את התוסף הזה?"
403
+
404
+ # <h4 class="inner">'.__('Need support?', 'post-views-counter').'</h4>
405
+ # <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'post-views-counter').' <a href="http://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'post-views-counter').'">'.__('Support forum', 'post-views-counter').'</a></p>
406
+ # <hr />
407
+ # wpml-name: cc1f1c9c830fc864d17ca868906b9888
408
+ msgid "Support forum"
409
+ msgstr "פורום תמיכה"
410
+
411
+ # <h4 class="inner">'.__('Need support?', 'post-views-counter').'</h4>
412
+ # <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'post-views-counter').' <a href="http://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'post-views-counter').'">'.__('Support forum', 'post-views-counter').'</a></p>
413
+ # <hr />
414
+ # wpml-name: 59f672d449c7bf54a3bc0a52a15bb1ef
415
+ msgid "If you are having problems with this plugin, please talk about them in the"
416
+ msgstr "אם יש לך בעיות עם התוסף, אנא דבר עליהם ב"
417
+
418
+ # <div class="inside">
419
+ # <h4 class="inner">'.__('Need support?', 'post-views-counter').'</h4>
420
+ # <p class="inner">'.__('If you are having problems with this plugin, please talk about them in the', 'post-views-counter').' <a href="http://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support" target="_blank" title="'.__('Support forum', 'post-views-counter').'">'.__('Support forum', 'post-views-counter').'</a></p>
421
+ # wpml-name: 1ce6a536b250322c39855d2bc9196576
422
+ msgid "Need support?"
423
+ msgstr "זקוק לתמיכה?"
424
+
425
+ # <div class="df-credits">
426
+ # <h3 class="hndle">'.__('Post Views Counter', 'post-views-counter').' '.Post_Views_Counter()->get_attribute('defaults', 'version').'</h3>
427
+ # <div class="inside">
428
+ # wpml-name: cd8ba40c9423078b48cc0f2d81a21c15
429
+ msgid "Post Views Counter"
430
+ msgstr "מונה הצפיות בפוסט Post Views Counter"
431
+
432
+ # 'display' => array(
433
+ # 'name' => __('Display', 'post-views-counter'),
434
+ # 'key' => 'post_views_counter_settings_display',
435
+ # wpml-name: b9987a246a537f4fe86f1f2e3d10dbdb
436
+ msgid "Display"
437
+ msgstr "הצג"
438
+
439
+ # 'general' => array(
440
+ # 'name' => __('General', 'post-views-counter'),
441
+ # 'key' => 'post_views_counter_settings_general',
442
+ # wpml-name: 0db377921f4ce762c62526131097968f
443
+ msgid "General"
444
+ msgstr "כללי"
445
+
446
+ # 'icon' => __('icon', 'post-views-counter'),
447
+ # 'text' => __('label', 'post-views-counter')
448
+ # );
449
+ # wpml-name: d304ba20e96d87411588eeabac850e34
450
+ msgid "label"
451
+ msgstr "תווית"
452
+
453
+ # $this->display_styles = array(
454
+ # 'icon' => __('icon', 'post-views-counter'),
455
+ # 'text' => __('label', 'post-views-counter')
456
+ # wpml-name: baec6461b0d69dde1b861aefbe375d8a
457
+ msgid "icon"
458
+ msgstr "צלמית"
459
+
460
+ # 'after' => __('after the content', 'post-views-counter'),
461
+ # 'manual' => __('manual', 'post-views-counter')
462
+ # );
463
+ # wpml-name: 3c78b35502b2693fefdfc51cba3a53a5
464
+ msgid "manual"
465
+ msgstr "הדרכה"
466
+
467
+ # 'before' => __('before the content', 'post-views-counter'),
468
+ # 'after' => __('after the content', 'post-views-counter'),
469
+ # 'manual' => __('manual', 'post-views-counter')
470
+ # wpml-name: 09baf53047da18c7d39ab35549cdd031
471
+ msgid "after the content"
472
+ msgstr "אחרי התוכן"
473
+
474
+ # $this->positions = array(
475
+ # 'before' => __('before the content', 'post-views-counter'),
476
+ # 'after' => __('after the content', 'post-views-counter'),
477
+ # wpml-name: fe2f7b4fd22be7dc41b8a3f38f0123bd
478
+ msgid "before the content"
479
+ msgstr "לפני התוכן"
480
+
481
+ # 'guests' => __('guests', 'post-views-counter'),
482
+ # 'roles' => __('selected user roles', 'post-views-counter')
483
+ # );
484
+ # wpml-name: 038c5d67b28d574ea23ff5eae263e202
485
+ msgid "selected user roles"
486
+ msgstr "תפקידי משתמש נבחרים"
487
+
488
+ # 'users' => __('logged in users', 'post-views-counter'),
489
+ # 'guests' => __('guests', 'post-views-counter'),
490
+ # 'roles' => __('selected user roles', 'post-views-counter')
491
+ # wpml-name: 9366a2751ef2a1c1d4d98cc377d61e8c
492
+ msgid "guests"
493
+ msgstr "אורחים"
494
+
495
+ # 'robots' => __('robots', 'post-views-counter'),
496
+ # 'users' => __('logged in users', 'post-views-counter'),
497
+ # 'guests' => __('guests', 'post-views-counter'),
498
+ # wpml-name: 8cbfac015c4118d010a7e718935aa921
499
+ msgid "logged in users"
500
+ msgstr "משתמשים מחוברים"
501
+
502
+ # $this->groups = array(
503
+ # 'robots' => __('robots', 'post-views-counter'),
504
+ # 'users' => __('logged in users', 'post-views-counter'),
505
+ # wpml-name: 27f5e15b6af3223f1176293cd015771d
506
+ msgid "robots"
507
+ msgstr "רובוטים"
508
+
509
+ # 'months' => __('months', 'post-views-counter'),
510
+ # 'years' => __('years', 'post-views-counter')
511
+ # );
512
+ # wpml-name: 75aeb98e5241592ad6a6c2c4c78a16ef
513
+ msgid "years"
514
+ msgstr "שנים"
515
+
516
+ # 'weeks' => __('weeks', 'post-views-counter'),
517
+ # 'months' => __('months', 'post-views-counter'),
518
+ # 'years' => __('years', 'post-views-counter')
519
+ # wpml-name: da36cfaf48b9e19896e23e1207040d1e
520
+ msgid "months"
521
+ msgstr "חודשים"
522
+
523
+ # 'days' => __('days', 'post-views-counter'),
524
+ # 'weeks' => __('weeks', 'post-views-counter'),
525
+ # 'months' => __('months', 'post-views-counter'),
526
+ # wpml-name: ae60f11ab51860bdb22794a943335a34
527
+ msgid "weeks"
528
+ msgstr "שבועות"
529
+
530
+ # 'hours' => __('hours', 'post-views-counter'),
531
+ # 'days' => __('days', 'post-views-counter'),
532
+ # 'weeks' => __('weeks', 'post-views-counter'),
533
+ # wpml-name: 44fdec47036f482b68b748f9d786801b
534
+ msgid "days"
535
+ msgstr "ימים"
536
+
537
+ # 'minutes' => __('minutes', 'post-views-counter'),
538
+ # 'hours' => __('hours', 'post-views-counter'),
539
+ # 'days' => __('days', 'post-views-counter'),
540
+ # wpml-name: 73cdddd7730abfc13a55efb9f5685a3b
541
+ msgid "hours"
542
+ msgstr "שעות"
543
+
544
+ # $this->time_types = array(
545
+ # 'minutes' => __('minutes', 'post-views-counter'),
546
+ # 'hours' => __('hours', 'post-views-counter'),
547
+ # wpml-name: 640fd0cc0ffa0316ae087652871f4486
548
+ msgid "minutes"
549
+ msgstr "דקות"
550
+
551
+ # 'php' => __('PHP', 'post-views-counter'),
552
+ # 'js' => __('JavaScript', 'post-views-counter')
553
+ # );
554
+ # wpml-name: 686155af75a60a0f6e9d80c1f7edd3e9
555
+ msgid "JavaScript"
556
+ msgstr "JavaScript"
557
+
558
+ # $this->modes = array(
559
+ # 'php' => __('PHP', 'post-views-counter'),
560
+ # 'js' => __('JavaScript', 'post-views-counter')
561
+ # wpml-name: 2fec392304a5c23ac138da22847f9b7c
562
+ msgid "PHP"
563
+ msgstr "PHP"
564
+
565
+ # 'yes' => __('Enable', 'post-views-counter'),
566
+ # 'no' => __('Disable', 'post-views-counter')
567
+ # );
568
+ # wpml-name: bcfaccebf745acfd5e75351095a5394a
569
+ msgid "Disable"
570
+ msgstr "כיבוי"
571
+
572
+ # $this->choices = array(
573
+ # 'yes' => __('Enable', 'post-views-counter'),
574
+ # 'no' => __('Disable', 'post-views-counter')
575
+ # wpml-name: 2faec1f9f8cc7f8f40d521c4dd574f49
576
+ msgid "Enable"
577
+ msgstr "הפעלה"
578
+
579
+ # 'interval' => Post_Views_Counter()->get_instance('counter')->get_timestamp(Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'type'), Post_Views_Counter()->get_attribute('options', 'general', 'reset_counts', 'number'), false),
580
+ # 'display' => __('Post Views Counter reset daily counts interval', 'post-views-counter')
581
+ # );
582
+ # wpml-name: 7dbe86da6c183d44027ee8966f6ebe51
583
+ msgid "Post Views Counter reset daily counts interval"
584
+ msgstr "מרווח ספירה יומי של מונה צפיות הפוסט"
585
+
586
+ # <p class="em-event-thumbnail-size"'.($show_post_thumbnail ? '' : ' style="display: none;"').'>
587
+ # <label for="'.$this->get_field_id('thumbnail_size').'">'.__('Thumbnail size', 'post-views-counter').':</label>
588
+ # <select id="'.$this->get_field_id('thumbnail_size').'" name="'.$this->get_field_name('thumbnail_size').'">';
589
+ # wpml-name: e64e8bc8063f61b3ea70ba74d3266806
590
+ msgid "Thumbnail size"
591
+ msgstr "גודל התמונה הממוזערת"
592
+
593
+ # <br />
594
+ # <input id="'.$this->get_field_id('show_post_thumbnail').'" class="em-show-event-thumbnail" type="checkbox" name="'.$this->get_field_name('show_post_thumbnail').'" '.checked(true, $show_post_thumbnail, false).' /> <label for="'.$this->get_field_id('show_post_thumbnail').'">'.__('Display post thumbnail?', 'post-views-counter').'</label>
595
+ # </p>
596
+ # wpml-name: 7d8813e3d270bec3f6825684e8677703
597
+ msgid "Display post thumbnail?"
598
+ msgstr "להציג תמונה ממוזערת של הפוסט?"
599
+
600
+ # <br />
601
+ # <input id="'.$this->get_field_id('show_post_excerpt').'" type="checkbox" name="'.$this->get_field_name('show_post_excerpt').'" '.checked(true, (isset($instance['show_post_excerpt']) ? $instance['show_post_excerpt'] : $this->pvc_defaults['show_post_excerpt']), false).' /> <label for="'.$this->get_field_id('show_post_excerpt').'">'.__('Display post excerpt?', 'post-views-counter').'</label>
602
+ # <br />
603
+ # wpml-name: 85d12d6c482d10e4e3ebf2967591cb69
604
+ msgid "Display post excerpt?"
605
+ msgstr "להציג את מובאת הפוסט?"
606
+
607
+ # <p>
608
+ # <input id="'.$this->get_field_id('show_post_views').'" type="checkbox" name="'.$this->get_field_name('show_post_views').'" '.checked(true, (isset($instance['show_post_views']) ? $instance['show_post_views'] : $this->pvc_defaults['show_post_views']), false).' /> <label for="'.$this->get_field_id('show_post_views').'">'.__('Display post views?', 'post-views-counter').'</label>
609
+ # <br />
610
+ # wpml-name: 916183b7aa3c702ad6dbe98339af6862
611
+ msgid "Display post views?"
612
+ msgstr "להציג את הצפיות בפוסט?"
613
+
614
+ # <p>
615
+ # <label for="'.$this->get_field_id('order').'">'.__('Order', 'post-views-counter').':</label>
616
+ # <select id="'.$this->get_field_id('order').'" name="'.$this->get_field_name('order').'">';
617
+ # wpml-name: a240fa27925a635b08dc28c9e4f9216d
618
+ msgid "Order"
619
+ msgstr "סדר"
620
+
621
+ # <p>
622
+ # <label for="'.$this->get_field_id('no_posts_message').'">'.__('No posts message', 'post-views-counter').':</label>
623
+ # <input id="'.$this->get_field_id('no_posts_message').'" class="widefat" type="text" name="'.$this->get_field_name('no_posts_message').'" value="'.esc_attr(isset($instance['no_posts_message']) ? $instance['no_posts_message'] : $this->pvc_defaults['no_posts_message']).'" />
624
+ # wpml-name: 8ca6d1ea2781e2a1cc55a2b04a7daa49
625
+ msgid "No posts message"
626
+ msgstr "אין הודעת פוסטים"
627
+
628
+ # <p>
629
+ # <label for="'.$this->get_field_id('number_of_posts').'">'.__('Number of posts to show', 'post-views-counter').':</label>
630
+ # <input id="'.$this->get_field_id('number_of_posts').'" name="'.$this->get_field_name('number_of_posts').'" type="text" size="3" value="'.esc_attr(isset($instance['number_of_posts']) ? $instance['number_of_posts'] : $this->pvc_defaults['number_of_posts']).'" />
631
+ # wpml-name: 6f433f4a921abe8f10e10bec25edc819
632
+ msgid "Number of posts to show"
633
+ msgstr "מספר הפוסטים להצגה"
634
+
635
+ # <p>
636
+ # <label>'.__('Post types', 'post-views-counter').':</label><br />';
637
+ #
638
+ # wpml-name: b9489ecd53ee4a441377840fa418060f
639
+ msgid "Post types"
640
+ msgstr "סוגי פוסט"
641
+
642
+ # <p>
643
+ # <label for="'.$this->get_field_id('title').'">'.__('Title', 'post-views-counter').':</label>
644
+ # <input id="'.$this->get_field_id('title').'" class="widefat" name="'.$this->get_field_name('title').'" type="text" value="'.esc_attr(isset($instance['title']) ? $instance['title'] : $this->pvc_defaults['title']).'" />
645
+ # wpml-name: b78a3223503896721cca1303f776159b
646
+ msgid "Title"
647
+ msgstr "כותרת"
648
+
649
+ # 'asc' => __('Ascending', 'post-views-counter'),
650
+ # 'desc' => __('Descending', 'post-views-counter')
651
+ # );
652
+ # wpml-name: e3cf5ac19407b1a62c6fccaff675a53b
653
+ msgid "Descending"
654
+ msgstr "סדר יורד"
655
+
656
+ # $this->pvc_order_types = array(
657
+ # 'asc' => __('Ascending', 'post-views-counter'),
658
+ # 'desc' => __('Descending', 'post-views-counter')
659
+ # wpml-name: cf3fb1ff52ea1eed3347ac5401ee7f0c
660
+ msgid "Ascending"
661
+ msgstr "סדר עולה"
662
+
663
+ # 'show_post_excerpt' => false,
664
+ # 'no_posts_message' => __('No Posts found', 'post-views-counter')
665
+ # );
666
+ # wpml-name: 429af42ddf1f1137c83acdfa4c026a8f
667
+ msgid "No Posts found"
668
+ msgstr "לא נמצאו פוסטים"
669
+
670
+ # array(
671
+ # 'description' => __('Displays a list of the most viewed posts', 'post-views-counter')
672
+ # )
673
+ # wpml-name: f9259d2718724e98e5532a3e63729744
674
+ msgid "Displays a list of the most viewed posts"
675
+ msgstr "מציג רשימה של הפוסטים הנצפים ביותר"
676
+
677
+ # $this->pvc_defaults = array(
678
+ # 'title' => __('Most Viewed Posts', 'post-views-counter'),
679
+ # 'number_of_posts' => 5,
680
+ # wpml-name: c595cf11c65cd5109ed5207dcb57a2a7
681
+ msgid "Most Viewed Posts"
682
+ msgstr "הכי נצפים"
683
+
684
+ # 'show_post_excerpt' => false,
685
+ # 'no_posts_message' => __('No Posts', 'post-views-counter')
686
+ # );
687
+ # wpml-name: ff721db755ed02dec43cdf42b9b6d32f
688
+ msgid "No Posts"
689
+ msgstr "אין פוסטים"
690
+
691
+ # {
692
+ # $settings_link = sprintf('<a href="%s">%s</a>', admin_url('options-general.php').'?page=post-views-counter', __('Settings', 'post-views-counter'));
693
+ #
694
+ # wpml-name: f4f70727dc34561dfde1a3c529b6205c
695
+ msgid "Settings"
696
+ msgstr "הגדרות"
697
+
698
+ # array(
699
+ # 'resetToDefaults' => __('Are you sure you want to reset these settings to defaults?', 'post-views-counter')
700
+ # )
701
+ # wpml-name: 52aeab346895416e7ababa964b135420
702
+ msgid "Are you sure you want to reset these settings to defaults?"
703
+ msgstr "בטוח שרוצה לאפס את ההגדרות האלו לברירת המחדל?"
languages/post-views-counter-pl_PL.mo CHANGED
Binary file
languages/post-views-counter-pl_PL.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
- "POT-Creation-Date: 2014-07-03 15:24+0100\n"
5
- "PO-Revision-Date: 2014-07-03 15:27+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.6.5\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "esc_html__;esc_html_e\n"
15
  "X-Poedit-Basepath: .\n"
@@ -17,247 +17,255 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
- #: ../includes/columns.php:113 ../includes/columns.php:121
21
  msgid "Post Views"
22
  msgstr "Odwiedziny"
23
 
24
- #: ../includes/cron.php:40
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
27
  "Odstęp czasu po jakim resetowane będą dzienne dane o liczbie odwiedzin."
28
 
29
- #: ../includes/functions.php:114
 
 
 
 
30
  msgid "No Posts"
31
  msgstr "Brak wpisów"
32
 
33
- #: ../includes/settings.php:41
34
  msgid "Enable"
35
  msgstr "Włącz"
36
 
37
- #: ../includes/settings.php:42
38
  msgid "Disable"
39
  msgstr "Wyłącz"
40
 
41
- #: ../includes/settings.php:46
42
  msgid "PHP"
43
  msgstr "PHP"
44
 
45
- #: ../includes/settings.php:47
46
  msgid "JavaScript"
47
  msgstr "JavaScript"
48
 
49
- #: ../includes/settings.php:51
50
  msgid "minutes"
51
  msgstr "minuty"
52
 
53
- #: ../includes/settings.php:52
54
  msgid "hours"
55
  msgstr "godziny"
56
 
57
- #: ../includes/settings.php:53
58
  msgid "days"
59
  msgstr "dni"
60
 
61
- #: ../includes/settings.php:54
62
  msgid "weeks"
63
  msgstr "tygodnie"
64
 
65
- #: ../includes/settings.php:55
66
  msgid "months"
67
  msgstr "miesiące"
68
 
69
- #: ../includes/settings.php:56
70
  msgid "years"
71
  msgstr "lata"
72
 
73
- #: ../includes/settings.php:60
74
  msgid "robots"
75
  msgstr "roboty"
76
 
77
- #: ../includes/settings.php:61
78
  msgid "logged in users"
79
  msgstr "zalogowani użytkownicy"
80
 
81
- #: ../includes/settings.php:62
82
  msgid "guests"
83
  msgstr "goście"
84
 
85
- #: ../includes/settings.php:63
86
  msgid "selected user roles"
87
  msgstr "wybrane role użytkowników"
88
 
89
- #: ../includes/settings.php:67
90
  msgid "before the content"
91
  msgstr "przed treścią"
92
 
93
- #: ../includes/settings.php:68
94
  msgid "after the content"
95
  msgstr "po treści"
96
 
97
- #: ../includes/settings.php:69
98
  msgid "manual"
99
  msgstr "ręcznie"
100
 
101
- #: ../includes/settings.php:73
102
  msgid "icon"
103
  msgstr "ikona"
104
 
105
- #: ../includes/settings.php:74
106
  msgid "label"
107
  msgstr "etykieta"
108
 
109
- #: ../includes/settings.php:79
110
  msgid "General"
111
  msgstr "Ogólne"
112
 
113
- #: ../includes/settings.php:85
114
  msgid "Display"
115
  msgstr "Wyświetlanie"
116
 
117
- #: ../includes/settings.php:149 ../includes/settings.php:150
118
- #: ../includes/settings.php:167 ../includes/settings.php:180
119
  msgid "Post Views Counter"
120
  msgstr "Licznik odwiedzin"
121
 
122
- #: ../includes/settings.php:182
123
  msgid "Need support?"
124
  msgstr "Potrzebujesz pomocy?"
125
 
126
- #: ../includes/settings.php:183
127
  msgid ""
128
  "If you are having problems with this plugin, please talk about them in the"
129
  msgstr "Jeśli masz jakieś problemy z tą wtyczką, powiedz o nich"
130
 
131
- #: ../includes/settings.php:183
132
  msgid "Support forum"
133
  msgstr "Forum pomocy"
134
 
135
- #: ../includes/settings.php:185
136
  msgid "Do you like this plugin?"
137
  msgstr "Lubisz tę wtyczkę?"
138
 
139
- #: ../includes/settings.php:186
140
  msgid "Rate it 5"
141
  msgstr "Oceń ją na 5"
142
 
143
- #: ../includes/settings.php:186
144
  msgid "on WordPress.org"
145
  msgstr "na WordPress.org"
146
 
147
- #: ../includes/settings.php:187
148
  msgid "Blog about it & link to the"
149
  msgstr "Napisz o niej i dodaj link"
150
 
151
- #: ../includes/settings.php:187
152
  msgid "plugin page"
153
  msgstr "do strony wtyczki"
154
 
155
- #: ../includes/settings.php:188
156
  msgid "Check out our other"
157
  msgstr "Sprawdż nasze inne"
158
 
159
- #: ../includes/settings.php:188
160
  msgid "WordPress plugins"
161
  msgstr "wtyczki do WordPressa"
162
 
163
- #: ../includes/settings.php:191
164
  msgid "Created by"
165
  msgstr "Stworzone przez"
166
 
167
- #: ../includes/settings.php:207
168
  msgid "Reset to defaults"
169
  msgstr "Resetuj do domyślnych"
170
 
171
- #: ../includes/settings.php:225
172
  msgid "General settings"
173
  msgstr "Ustawienia ogólne"
174
 
175
- #: ../includes/settings.php:226
176
  msgid "Post Types Count"
177
  msgstr "Własne typy wpisów"
178
 
179
- #: ../includes/settings.php:227
180
  msgid "Counter Mode"
181
  msgstr "Tryb pracy licznika"
182
 
183
- #: ../includes/settings.php:228
184
  msgid "Post Views Column"
185
  msgstr "Kolumna z liczbą odwiedzin"
186
 
187
- #: ../includes/settings.php:229
188
  msgid "Time Between Counts"
189
  msgstr "Czas między zliczaniem"
190
 
191
- #: ../includes/settings.php:230
192
- msgid "Reset Data"
193
- msgstr "Resetowanie danych"
 
 
 
 
194
 
195
- #: ../includes/settings.php:231
196
  msgid "Exclude Visitors"
197
  msgstr "Wykluczanie odwiedzających"
198
 
199
- #: ../includes/settings.php:232
200
  msgid "Exclude IPs"
201
  msgstr "Wykluczanie IP"
202
 
203
- #: ../includes/settings.php:233
204
  msgid "WP-PostViews"
205
  msgstr "WP-PostViews"
206
 
207
- #: ../includes/settings.php:234
208
  msgid "Deactivation"
209
  msgstr "Deaktywacja wtyczki"
210
 
211
- #: ../includes/settings.php:238
212
  msgid "Display settings"
213
  msgstr "Ustawienia wyświetlania"
214
 
215
- #: ../includes/settings.php:239
216
  msgid "Post Views Label"
217
  msgstr "Etykieta licznika"
218
 
219
- #: ../includes/settings.php:240
220
  msgid "Post Types Display"
221
  msgstr "Wyświetlanie licznika"
222
 
223
- #: ../includes/settings.php:241
224
  msgid "Restrict Display"
225
  msgstr "Ograniczenia wyświetlania"
226
 
227
- #: ../includes/settings.php:242
228
  msgid "Position"
229
  msgstr "Pozycja"
230
 
231
- #: ../includes/settings.php:243
232
  msgid "Display Style"
233
  msgstr "Styl wyświetlania"
234
 
235
- #: ../includes/settings.php:244
236
  msgid "Icon Class"
237
  msgstr "Klasa ikony"
238
 
239
- #: ../includes/settings.php:258
240
  msgid "Enter the label for the post views counter field."
241
  msgstr "Wpisz etykietę jaka będzie wyświetlana w liczniku odwiedzin wpisu."
242
 
243
- #: ../includes/settings.php:272
244
  msgid "Select post types"
245
  msgstr "Wybierz typy wpisów"
246
 
247
- #: ../includes/settings.php:283
248
  msgid "Select post types for which post views will be counted."
249
  msgstr "Wybierz typy wpisów dla których będzie włączone zliczanie."
250
 
251
- #: ../includes/settings.php:297 ../includes/settings.php:423
252
- #: ../includes/settings.php:599
253
  msgid "Select groups"
254
  msgstr "Wybierz grupy"
255
 
256
- #: ../includes/settings.php:308
257
  msgid "Select post types for which post views will be displayed."
258
  msgstr "Wybierz typy wpisów dla których licznik będzie wyświetlony."
259
 
260
- #: ../includes/settings.php:332
261
  msgid ""
262
  "Select the method of collecting post views data. If you are using any of the "
263
  "caching plugins select Javascript."
@@ -265,17 +273,17 @@ msgstr ""
265
  "Wybierz metodę gromadzenia danych. Jeśli używaż jakiejkolwiek wtyczki do "
266
  "cachowania wybierz Javascript."
267
 
268
- #: ../includes/settings.php:357
269
  msgid ""
270
  "Enable to display post views count column for each of the selected post "
271
  "types."
272
  msgstr "Włącz aby wyświetlić kolumnę z liczbą odsłon."
273
 
274
- #: ../includes/settings.php:383
275
  msgid "Enter the time between single user visit count."
276
  msgstr "Określ czas pomiędzy zliczaniem wizyt poszczególnego użytkownika."
277
 
278
- #: ../includes/settings.php:409
279
  msgid ""
280
  "Delete single day post views data older than specified above. Enter 0 "
281
  "(number zero) if you want to preserve your data regardless of its age."
@@ -283,47 +291,66 @@ msgstr ""
283
  "Usuwanie dziennych danych o liczbie wpisów po określonym powyżej czasie. "
284
  "Wpisz 0 jeśli chcesz przetrzymywać te dane bez ograniczeń."
285
 
286
- #: ../includes/settings.php:435 ../includes/settings.php:614
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
287
  msgid "Select user roles"
288
  msgstr "Wybierz role użytkowników"
289
 
290
- #: ../includes/settings.php:447
291
  msgid "Select the type of visitors to be excluded from post views count."
292
  msgstr "Wybierz typy użytkowników wyłączonych z działania licznika."
293
 
294
- #: ../includes/settings.php:466 ../includes/settings.php:475
295
  msgid "Remove"
296
  msgstr "Usuń"
297
 
298
- #: ../includes/settings.php:475
299
  msgid "Add new"
300
  msgstr "Dodaj nowy"
301
 
302
- #: ../includes/settings.php:475
303
  msgid "Add my current IP"
304
  msgstr "Dodaj mój aktualny IP"
305
 
306
- #: ../includes/settings.php:477
307
  msgid "Enter the IP addresses to be excluded from post views count."
308
  msgstr "Wpisz adresy IP, któe mają być wyłączone z działania licznika."
309
 
310
- #: ../includes/settings.php:491
311
  msgid "Import"
312
  msgstr "Importuj"
313
 
314
- #: ../includes/settings.php:493
315
  msgid "Import post views data from WP-PostViews plugin."
316
  msgstr "Importuj dane o liczbie odwiedzin z wtyczki WP-PostViews."
317
 
318
- #: ../includes/settings.php:494
319
  msgid "Override existing Post Views Counter data."
320
  msgstr "Nadpisz istniejące dane Licznika odwiedzin."
321
 
322
- #: ../includes/settings.php:519
323
  msgid "Enable to delete all plugin data on deactivation."
324
  msgstr "Włącz aby usunąć wszystkie dane wtyczki podczas deaktywacji"
325
 
326
- #: ../includes/settings.php:544
327
  msgid ""
328
  "Select where would you like to display the post views counter. Use [post-"
329
  "views] shortcode for manual display."
@@ -331,11 +358,11 @@ msgstr ""
331
  "Wybierz w którym miejscu chcesz wyświetlać licznik odwiedzin. Użyj skrótu "
332
  "[post-views] aby wyświetlić licznik ręcznie."
333
 
334
- #: ../includes/settings.php:569
335
  msgid "Choose how to display the post views counter."
336
  msgstr "Wybierz w jaki sposób chcesz wyświetlać licznik."
337
 
338
- #: ../includes/settings.php:585
339
  #, php-format
340
  msgid ""
341
  "Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
@@ -344,96 +371,102 @@ msgstr ""
344
  "Wpisz klasę CSS ikony. Każda z ikond typu <a href=\"%s\" target=\"_blank"
345
  "\">Dashicons</a> może być tutaj zastosowana."
346
 
347
- #: ../includes/settings.php:626
348
  msgid "Use it to hide the post views counter from selected type of visitors."
349
  msgstr ""
350
  "Użyj tego aby ograniczyć wyświetlanie licznika do określonych typów "
351
  "użytkowników."
352
 
353
- #: ../includes/settings.php:661
354
  msgid "WP-PostViews data imported succesfully."
355
  msgstr "Dane z wtyczki WP-PostViews zostały zaimportowane pomyślnie."
356
 
357
- #: ../includes/settings.php:665
358
  msgid "There was no data to import."
359
  msgstr "Niestety, nie znaleziono danych do zaimportowania."
360
 
361
- #: ../includes/settings.php:827
362
  msgid "General settings restored to defaults."
363
  msgstr "Ustawienia zostały przywrócone do domyślnych."
364
 
365
- #: ../includes/settings.php:833
366
  msgid "Display settings restored to defaults."
367
  msgstr "Ustawienia wyświetlania została przywrócone do domyślnych."
368
 
369
- #: ../includes/settings.php:854
370
  msgid "Support"
371
  msgstr "Forum pomocy"
372
 
373
- #: ../includes/widgets.php:38 ../includes/widgets.php:49
374
  msgid "Most Viewed Posts"
375
  msgstr "Najczęściej oglądane wpisy"
376
 
377
- #: ../includes/widgets.php:40
378
  msgid "Displays a list of the most viewed posts"
379
  msgstr "Wyświetla listę najczęściej oglądanych wpisów"
380
 
381
- #: ../includes/widgets.php:57
382
  msgid "No Posts found"
383
  msgstr "Brak wpisów"
384
 
385
- #: ../includes/widgets.php:61
386
  msgid "Ascending"
387
  msgstr "Rosnąco"
388
 
389
- #: ../includes/widgets.php:62
390
  msgid "Descending"
391
  msgstr "Malejąco"
392
 
393
- #: ../includes/widgets.php:105
394
  msgid "Title"
395
  msgstr "Tytuł"
396
 
397
- #: ../includes/widgets.php:109
398
- msgid "Post types"
399
  msgstr "Typy wpisów"
400
 
401
- #: ../includes/widgets.php:123
402
  msgid "Number of posts to show"
403
  msgstr "Liczba wpisów do wyświetlenia"
404
 
405
- #: ../includes/widgets.php:127
406
  msgid "No posts message"
407
  msgstr "Treść braku wpisów"
408
 
409
- #: ../includes/widgets.php:131
410
  msgid "Order"
411
  msgstr "Kolejność"
412
 
413
- #: ../includes/widgets.php:144
414
  msgid "Display post views?"
415
  msgstr "Wyświetlanie liczby odsłon?"
416
 
417
- #: ../includes/widgets.php:146
418
  msgid "Display post excerpt?"
419
  msgstr "Wyświetlanie wypisu?"
420
 
421
- #: ../includes/widgets.php:148
422
  msgid "Display post thumbnail?"
423
  msgstr "WYświetlanie miniatury?"
424
 
425
- #: ../includes/widgets.php:151
426
  msgid "Thumbnail size"
427
  msgstr "WIelkość miniatury"
428
 
429
- #: ../post-views-counter.php:260
430
  msgid "Are you sure you want to reset these settings to defaults?"
431
  msgstr "Czy jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
432
 
433
- #: ../post-views-counter.php:294
434
  msgid "Settings"
435
  msgstr "Ustawienia"
436
 
 
 
 
 
 
 
437
  #~ msgid "text"
438
  #~ msgstr "tekst"
439
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
+ "POT-Creation-Date: 2015-04-07 21:48+0100\n"
5
+ "PO-Revision-Date: 2015-04-07 21:52+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: pl_PL\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.5\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "esc_html__;esc_html_e\n"
15
  "X-Poedit-Basepath: .\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
+ #: ../includes/columns.php:81 ../includes/columns.php:88
21
  msgid "Post Views"
22
  msgstr "Odwiedziny"
23
 
24
+ #: ../includes/cron.php:51
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
27
  "Odstęp czasu po jakim resetowane będą dzienne dane o liczbie odwiedzin."
28
 
29
+ #: ../includes/cron.php:56
30
+ msgid "Post Views Counter cache flush interval"
31
+ msgstr "Czas czyszczenia danych o odsłonach z cache"
32
+
33
+ #: ../includes/functions.php:125
34
  msgid "No Posts"
35
  msgstr "Brak wpisów"
36
 
37
+ #: ../includes/settings.php:36
38
  msgid "Enable"
39
  msgstr "Włącz"
40
 
41
+ #: ../includes/settings.php:37
42
  msgid "Disable"
43
  msgstr "Wyłącz"
44
 
45
+ #: ../includes/settings.php:41
46
  msgid "PHP"
47
  msgstr "PHP"
48
 
49
+ #: ../includes/settings.php:42
50
  msgid "JavaScript"
51
  msgstr "JavaScript"
52
 
53
+ #: ../includes/settings.php:46
54
  msgid "minutes"
55
  msgstr "minuty"
56
 
57
+ #: ../includes/settings.php:47
58
  msgid "hours"
59
  msgstr "godziny"
60
 
61
+ #: ../includes/settings.php:48
62
  msgid "days"
63
  msgstr "dni"
64
 
65
+ #: ../includes/settings.php:49
66
  msgid "weeks"
67
  msgstr "tygodnie"
68
 
69
+ #: ../includes/settings.php:50
70
  msgid "months"
71
  msgstr "miesiące"
72
 
73
+ #: ../includes/settings.php:51
74
  msgid "years"
75
  msgstr "lata"
76
 
77
+ #: ../includes/settings.php:55
78
  msgid "robots"
79
  msgstr "roboty"
80
 
81
+ #: ../includes/settings.php:56
82
  msgid "logged in users"
83
  msgstr "zalogowani użytkownicy"
84
 
85
+ #: ../includes/settings.php:57
86
  msgid "guests"
87
  msgstr "goście"
88
 
89
+ #: ../includes/settings.php:58
90
  msgid "selected user roles"
91
  msgstr "wybrane role użytkowników"
92
 
93
+ #: ../includes/settings.php:62
94
  msgid "before the content"
95
  msgstr "przed treścią"
96
 
97
+ #: ../includes/settings.php:63
98
  msgid "after the content"
99
  msgstr "po treści"
100
 
101
+ #: ../includes/settings.php:64
102
  msgid "manual"
103
  msgstr "ręcznie"
104
 
105
+ #: ../includes/settings.php:68
106
  msgid "icon"
107
  msgstr "ikona"
108
 
109
+ #: ../includes/settings.php:69
110
  msgid "label"
111
  msgstr "etykieta"
112
 
113
+ #: ../includes/settings.php:74
114
  msgid "General"
115
  msgstr "Ogólne"
116
 
117
+ #: ../includes/settings.php:80
118
  msgid "Display"
119
  msgstr "Wyświetlanie"
120
 
121
+ #: ../includes/settings.php:135 ../includes/settings.php:136
122
+ #: ../includes/settings.php:151 ../includes/settings.php:163
123
  msgid "Post Views Counter"
124
  msgstr "Licznik odwiedzin"
125
 
126
+ #: ../includes/settings.php:165
127
  msgid "Need support?"
128
  msgstr "Potrzebujesz pomocy?"
129
 
130
+ #: ../includes/settings.php:166
131
  msgid ""
132
  "If you are having problems with this plugin, please talk about them in the"
133
  msgstr "Jeśli masz jakieś problemy z tą wtyczką, powiedz o nich"
134
 
135
+ #: ../includes/settings.php:166
136
  msgid "Support forum"
137
  msgstr "Forum pomocy"
138
 
139
+ #: ../includes/settings.php:168
140
  msgid "Do you like this plugin?"
141
  msgstr "Lubisz tę wtyczkę?"
142
 
143
+ #: ../includes/settings.php:169
144
  msgid "Rate it 5"
145
  msgstr "Oceń ją na 5"
146
 
147
+ #: ../includes/settings.php:169
148
  msgid "on WordPress.org"
149
  msgstr "na WordPress.org"
150
 
151
+ #: ../includes/settings.php:170
152
  msgid "Blog about it & link to the"
153
  msgstr "Napisz o niej i dodaj link"
154
 
155
+ #: ../includes/settings.php:170
156
  msgid "plugin page"
157
  msgstr "do strony wtyczki"
158
 
159
+ #: ../includes/settings.php:171
160
  msgid "Check out our other"
161
  msgstr "Sprawdż nasze inne"
162
 
163
+ #: ../includes/settings.php:171
164
  msgid "WordPress plugins"
165
  msgstr "wtyczki do WordPressa"
166
 
167
+ #: ../includes/settings.php:174
168
  msgid "Created by"
169
  msgstr "Stworzone przez"
170
 
171
+ #: ../includes/settings.php:190
172
  msgid "Reset to defaults"
173
  msgstr "Resetuj do domyślnych"
174
 
175
+ #: ../includes/settings.php:207
176
  msgid "General settings"
177
  msgstr "Ustawienia ogólne"
178
 
179
+ #: ../includes/settings.php:208
180
  msgid "Post Types Count"
181
  msgstr "Własne typy wpisów"
182
 
183
+ #: ../includes/settings.php:209
184
  msgid "Counter Mode"
185
  msgstr "Tryb pracy licznika"
186
 
187
+ #: ../includes/settings.php:210
188
  msgid "Post Views Column"
189
  msgstr "Kolumna z liczbą odwiedzin"
190
 
191
+ #: ../includes/settings.php:211
192
  msgid "Time Between Counts"
193
  msgstr "Czas między zliczaniem"
194
 
195
+ #: ../includes/settings.php:212
196
+ msgid "Reset Data Interval"
197
+ msgstr "Czas resetowania danych"
198
+
199
+ #: ../includes/settings.php:213
200
+ msgid "Flush Object Cache Interval"
201
+ msgstr "Czas czyszczenia cache"
202
 
203
+ #: ../includes/settings.php:214
204
  msgid "Exclude Visitors"
205
  msgstr "Wykluczanie odwiedzających"
206
 
207
+ #: ../includes/settings.php:215
208
  msgid "Exclude IPs"
209
  msgstr "Wykluczanie IP"
210
 
211
+ #: ../includes/settings.php:216
212
  msgid "WP-PostViews"
213
  msgstr "WP-PostViews"
214
 
215
+ #: ../includes/settings.php:217
216
  msgid "Deactivation"
217
  msgstr "Deaktywacja wtyczki"
218
 
219
+ #: ../includes/settings.php:221
220
  msgid "Display settings"
221
  msgstr "Ustawienia wyświetlania"
222
 
223
+ #: ../includes/settings.php:222
224
  msgid "Post Views Label"
225
  msgstr "Etykieta licznika"
226
 
227
+ #: ../includes/settings.php:223
228
  msgid "Post Types Display"
229
  msgstr "Wyświetlanie licznika"
230
 
231
+ #: ../includes/settings.php:224
232
  msgid "Restrict Display"
233
  msgstr "Ograniczenia wyświetlania"
234
 
235
+ #: ../includes/settings.php:225
236
  msgid "Position"
237
  msgstr "Pozycja"
238
 
239
+ #: ../includes/settings.php:226
240
  msgid "Display Style"
241
  msgstr "Styl wyświetlania"
242
 
243
+ #: ../includes/settings.php:227
244
  msgid "Icon Class"
245
  msgstr "Klasa ikony"
246
 
247
+ #: ../includes/settings.php:240
248
  msgid "Enter the label for the post views counter field."
249
  msgstr "Wpisz etykietę jaka będzie wyświetlana w liczniku odwiedzin wpisu."
250
 
251
+ #: ../includes/settings.php:253
252
  msgid "Select post types"
253
  msgstr "Wybierz typy wpisów"
254
 
255
+ #: ../includes/settings.php:263
256
  msgid "Select post types for which post views will be counted."
257
  msgstr "Wybierz typy wpisów dla których będzie włączone zliczanie."
258
 
259
+ #: ../includes/settings.php:276 ../includes/settings.php:412
260
+ #: ../includes/settings.php:569
261
  msgid "Select groups"
262
  msgstr "Wybierz grupy"
263
 
264
+ #: ../includes/settings.php:286
265
  msgid "Select post types for which post views will be displayed."
266
  msgstr "Wybierz typy wpisów dla których licznik będzie wyświetlony."
267
 
268
+ #: ../includes/settings.php:308
269
  msgid ""
270
  "Select the method of collecting post views data. If you are using any of the "
271
  "caching plugins select Javascript."
273
  "Wybierz metodę gromadzenia danych. Jeśli używaż jakiejkolwiek wtyczki do "
274
  "cachowania wybierz Javascript."
275
 
276
+ #: ../includes/settings.php:330
277
  msgid ""
278
  "Enable to display post views count column for each of the selected post "
279
  "types."
280
  msgstr "Włącz aby wyświetlić kolumnę z liczbą odsłon."
281
 
282
+ #: ../includes/settings.php:353
283
  msgid "Enter the time between single user visit count."
284
  msgstr "Określ czas pomiędzy zliczaniem wizyt poszczególnego użytkownika."
285
 
286
+ #: ../includes/settings.php:377
287
  msgid ""
288
  "Delete single day post views data older than specified above. Enter 0 "
289
  "(number zero) if you want to preserve your data regardless of its age."
291
  "Usuwanie dziennych danych o liczbie wpisów po określonym powyżej czasie. "
292
  "Wpisz 0 jeśli chcesz przetrzymywać te dane bez ograniczeń."
293
 
294
+ #: ../includes/settings.php:400
295
+ msgid ""
296
+ "How often to flush cached view counts from the object cache into the "
297
+ "database. This feature is used only if a persistent object cache is detected "
298
+ "and the interval is greater than 0 (number zero)). When used, view counts "
299
+ "will be collected and stored in the object cache instead of the database and "
300
+ "will then be asynchronously flushed to the database according to the "
301
+ "specified interval.<br /><strong>Notice:</strong> Potential data loss may "
302
+ "occur if the object cache is cleared/unavailable for the duration of the "
303
+ "interval."
304
+ msgstr ""
305
+ "Jak często powinno odbywać się przenoszenie danych z cache do bazy danych. "
306
+ "Ta funkcja jest używana tylko gdy włączone jest cachowanie obiektowe a "
307
+ "przedział jest większy niż 0. Jeśli jest włączona, zebrane dane będą "
308
+ "przechowywane w cache i przenoszone do bazy danych w określonych odstę[ach "
309
+ "czasu.<br /><strong>Uwaga:</strong> Może nastąpić ustrata części danych "
310
+ "jeśli cachowanie obiektowe nie będzie dostępne lub cache zostanie "
311
+ "wyczyszczony w trakcie trwania wybranego okresu."
312
+
313
+ #: ../includes/settings.php:423 ../includes/settings.php:584
314
  msgid "Select user roles"
315
  msgstr "Wybierz role użytkowników"
316
 
317
+ #: ../includes/settings.php:434
318
  msgid "Select the type of visitors to be excluded from post views count."
319
  msgstr "Wybierz typy użytkowników wyłączonych z działania licznika."
320
 
321
+ #: ../includes/settings.php:450 ../includes/settings.php:459
322
  msgid "Remove"
323
  msgstr "Usuń"
324
 
325
+ #: ../includes/settings.php:459
326
  msgid "Add new"
327
  msgstr "Dodaj nowy"
328
 
329
+ #: ../includes/settings.php:459
330
  msgid "Add my current IP"
331
  msgstr "Dodaj mój aktualny IP"
332
 
333
+ #: ../includes/settings.php:461
334
  msgid "Enter the IP addresses to be excluded from post views count."
335
  msgstr "Wpisz adresy IP, któe mają być wyłączone z działania licznika."
336
 
337
+ #: ../includes/settings.php:473
338
  msgid "Import"
339
  msgstr "Importuj"
340
 
341
+ #: ../includes/settings.php:475
342
  msgid "Import post views data from WP-PostViews plugin."
343
  msgstr "Importuj dane o liczbie odwiedzin z wtyczki WP-PostViews."
344
 
345
+ #: ../includes/settings.php:476
346
  msgid "Override existing Post Views Counter data."
347
  msgstr "Nadpisz istniejące dane Licznika odwiedzin."
348
 
349
+ #: ../includes/settings.php:498
350
  msgid "Enable to delete all plugin data on deactivation."
351
  msgstr "Włącz aby usunąć wszystkie dane wtyczki podczas deaktywacji"
352
 
353
+ #: ../includes/settings.php:520
354
  msgid ""
355
  "Select where would you like to display the post views counter. Use [post-"
356
  "views] shortcode for manual display."
358
  "Wybierz w którym miejscu chcesz wyświetlać licznik odwiedzin. Użyj skrótu "
359
  "[post-views] aby wyświetlić licznik ręcznie."
360
 
361
+ #: ../includes/settings.php:542
362
  msgid "Choose how to display the post views counter."
363
  msgstr "Wybierz w jaki sposób chcesz wyświetlać licznik."
364
 
365
+ #: ../includes/settings.php:556
366
  #, php-format
367
  msgid ""
368
  "Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
371
  "Wpisz klasę CSS ikony. Każda z ikond typu <a href=\"%s\" target=\"_blank"
372
  "\">Dashicons</a> może być tutaj zastosowana."
373
 
374
+ #: ../includes/settings.php:595
375
  msgid "Use it to hide the post views counter from selected type of visitors."
376
  msgstr ""
377
  "Użyj tego aby ograniczyć wyświetlanie licznika do określonych typów "
378
  "użytkowników."
379
 
380
+ #: ../includes/settings.php:626
381
  msgid "WP-PostViews data imported succesfully."
382
  msgstr "Dane z wtyczki WP-PostViews zostały zaimportowane pomyślnie."
383
 
384
+ #: ../includes/settings.php:628
385
  msgid "There was no data to import."
386
  msgstr "Niestety, nie znaleziono danych do zaimportowania."
387
 
388
+ #: ../includes/settings.php:786
389
  msgid "General settings restored to defaults."
390
  msgstr "Ustawienia zostały przywrócone do domyślnych."
391
 
392
+ #: ../includes/settings.php:790
393
  msgid "Display settings restored to defaults."
394
  msgstr "Ustawienia wyświetlania została przywrócone do domyślnych."
395
 
396
+ #: ../includes/settings.php:810
397
  msgid "Support"
398
  msgstr "Forum pomocy"
399
 
400
+ #: ../includes/widgets.php:32 ../includes/widgets.php:43
401
  msgid "Most Viewed Posts"
402
  msgstr "Najczęściej oglądane wpisy"
403
 
404
+ #: ../includes/widgets.php:34
405
  msgid "Displays a list of the most viewed posts"
406
  msgstr "Wyświetla listę najczęściej oglądanych wpisów"
407
 
408
+ #: ../includes/widgets.php:51
409
  msgid "No Posts found"
410
  msgstr "Brak wpisów"
411
 
412
+ #: ../includes/widgets.php:55
413
  msgid "Ascending"
414
  msgstr "Rosnąco"
415
 
416
+ #: ../includes/widgets.php:56
417
  msgid "Descending"
418
  msgstr "Malejąco"
419
 
420
+ #: ../includes/widgets.php:93
421
  msgid "Title"
422
  msgstr "Tytuł"
423
 
424
+ #: ../includes/widgets.php:97
425
+ msgid "Post Types"
426
  msgstr "Typy wpisów"
427
 
428
+ #: ../includes/widgets.php:110
429
  msgid "Number of posts to show"
430
  msgstr "Liczba wpisów do wyświetlenia"
431
 
432
+ #: ../includes/widgets.php:114
433
  msgid "No posts message"
434
  msgstr "Treść braku wpisów"
435
 
436
+ #: ../includes/widgets.php:118
437
  msgid "Order"
438
  msgstr "Kolejność"
439
 
440
+ #: ../includes/widgets.php:130
441
  msgid "Display post views?"
442
  msgstr "Wyświetlanie liczby odsłon?"
443
 
444
+ #: ../includes/widgets.php:132
445
  msgid "Display post excerpt?"
446
  msgstr "Wyświetlanie wypisu?"
447
 
448
+ #: ../includes/widgets.php:134
449
  msgid "Display post thumbnail?"
450
  msgstr "WYświetlanie miniatury?"
451
 
452
+ #: ../includes/widgets.php:137
453
  msgid "Thumbnail size"
454
  msgstr "WIelkość miniatury"
455
 
456
+ #: ../post-views-counter.php:278
457
  msgid "Are you sure you want to reset these settings to defaults?"
458
  msgstr "Czy jesteś pewny, że chcesz zresetować ustawienia do domyślnych?"
459
 
460
+ #: ../post-views-counter.php:310
461
  msgid "Settings"
462
  msgstr "Ustawienia"
463
 
464
+ #~ msgid "Reset Data"
465
+ #~ msgstr "Resetowanie danych"
466
+
467
+ #~ msgid "Post types"
468
+ #~ msgstr "Typy wpisów"
469
+
470
  #~ msgid "text"
471
  #~ msgstr "tekst"
472
 
languages/post-views-counter.pot CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
- "POT-Creation-Date: 2014-07-03 01:05+0100\n"
5
- "PO-Revision-Date: 2014-07-03 01:05+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: en\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.6.5\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "esc_html__;esc_html_e\n"
15
  "X-Poedit-Basepath: .\n"
@@ -17,408 +17,428 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
- #: ../includes/columns.php:113 ../includes/columns.php:121
21
  msgid "Post Views"
22
  msgstr ""
23
 
24
- #: ../includes/cron.php:40
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
27
 
28
- #: ../includes/functions.php:114
 
 
 
 
29
  msgid "No Posts"
30
  msgstr ""
31
 
32
- #: ../includes/settings.php:41
33
  msgid "Enable"
34
  msgstr ""
35
 
36
- #: ../includes/settings.php:42
37
  msgid "Disable"
38
  msgstr ""
39
 
40
- #: ../includes/settings.php:46
41
  msgid "PHP"
42
  msgstr ""
43
 
44
- #: ../includes/settings.php:47
45
  msgid "JavaScript"
46
  msgstr ""
47
 
48
- #: ../includes/settings.php:51
49
  msgid "minutes"
50
  msgstr ""
51
 
52
- #: ../includes/settings.php:52
53
  msgid "hours"
54
  msgstr ""
55
 
56
- #: ../includes/settings.php:53
57
  msgid "days"
58
  msgstr ""
59
 
60
- #: ../includes/settings.php:54
61
  msgid "weeks"
62
  msgstr ""
63
 
64
- #: ../includes/settings.php:55
65
  msgid "months"
66
  msgstr ""
67
 
68
- #: ../includes/settings.php:56
69
  msgid "years"
70
  msgstr ""
71
 
72
- #: ../includes/settings.php:60
73
  msgid "robots"
74
  msgstr ""
75
 
76
- #: ../includes/settings.php:61
77
  msgid "logged in users"
78
  msgstr ""
79
 
80
- #: ../includes/settings.php:62
81
  msgid "guests"
82
  msgstr ""
83
 
84
- #: ../includes/settings.php:63
85
  msgid "selected user roles"
86
  msgstr ""
87
 
88
- #: ../includes/settings.php:67
89
  msgid "before the content"
90
  msgstr ""
91
 
92
- #: ../includes/settings.php:68
93
  msgid "after the content"
94
  msgstr ""
95
 
96
- #: ../includes/settings.php:69
97
  msgid "manual"
98
  msgstr ""
99
 
100
- #: ../includes/settings.php:73
101
  msgid "icon"
102
  msgstr ""
103
 
104
- #: ../includes/settings.php:74
105
  msgid "label"
106
  msgstr ""
107
 
108
- #: ../includes/settings.php:79
109
  msgid "General"
110
  msgstr ""
111
 
112
- #: ../includes/settings.php:85
113
  msgid "Display"
114
  msgstr ""
115
 
116
- #: ../includes/settings.php:149 ../includes/settings.php:150
117
- #: ../includes/settings.php:167 ../includes/settings.php:180
118
  msgid "Post Views Counter"
119
  msgstr ""
120
 
121
- #: ../includes/settings.php:182
122
  msgid "Need support?"
123
  msgstr ""
124
 
125
- #: ../includes/settings.php:183
126
  msgid ""
127
  "If you are having problems with this plugin, please talk about them in the"
128
  msgstr ""
129
 
130
- #: ../includes/settings.php:183
131
  msgid "Support forum"
132
  msgstr ""
133
 
134
- #: ../includes/settings.php:185
135
  msgid "Do you like this plugin?"
136
  msgstr ""
137
 
138
- #: ../includes/settings.php:186
139
  msgid "Rate it 5"
140
  msgstr ""
141
 
142
- #: ../includes/settings.php:186
143
  msgid "on WordPress.org"
144
  msgstr ""
145
 
146
- #: ../includes/settings.php:187
147
  msgid "Blog about it & link to the"
148
  msgstr ""
149
 
150
- #: ../includes/settings.php:187
151
  msgid "plugin page"
152
  msgstr ""
153
 
154
- #: ../includes/settings.php:188
155
  msgid "Check out our other"
156
  msgstr ""
157
 
158
- #: ../includes/settings.php:188
159
  msgid "WordPress plugins"
160
  msgstr ""
161
 
162
- #: ../includes/settings.php:191
163
  msgid "Created by"
164
  msgstr ""
165
 
166
- #: ../includes/settings.php:207
167
  msgid "Reset to defaults"
168
  msgstr ""
169
 
170
- #: ../includes/settings.php:225
171
  msgid "General settings"
172
  msgstr ""
173
 
174
- #: ../includes/settings.php:226
175
  msgid "Post Types Count"
176
  msgstr ""
177
 
178
- #: ../includes/settings.php:227
179
  msgid "Counter Mode"
180
  msgstr ""
181
 
182
- #: ../includes/settings.php:228
183
  msgid "Post Views Column"
184
  msgstr ""
185
 
186
- #: ../includes/settings.php:229
187
  msgid "Time Between Counts"
188
  msgstr ""
189
 
190
- #: ../includes/settings.php:230
191
- msgid "Reset Data"
192
  msgstr ""
193
 
194
- #: ../includes/settings.php:231
 
 
 
 
195
  msgid "Exclude Visitors"
196
  msgstr ""
197
 
198
- #: ../includes/settings.php:232
199
  msgid "Exclude IPs"
200
  msgstr ""
201
 
202
- #: ../includes/settings.php:233
203
  msgid "WP-PostViews"
204
  msgstr ""
205
 
206
- #: ../includes/settings.php:234
207
  msgid "Deactivation"
208
  msgstr ""
209
 
210
- #: ../includes/settings.php:238
211
  msgid "Display settings"
212
  msgstr ""
213
 
214
- #: ../includes/settings.php:239
215
  msgid "Post Views Label"
216
  msgstr ""
217
 
218
- #: ../includes/settings.php:240
219
  msgid "Post Types Display"
220
  msgstr ""
221
 
222
- #: ../includes/settings.php:241
223
  msgid "Restrict Display"
224
  msgstr ""
225
 
226
- #: ../includes/settings.php:242
227
  msgid "Position"
228
  msgstr ""
229
 
230
- #: ../includes/settings.php:243
231
  msgid "Display Style"
232
  msgstr ""
233
 
234
- #: ../includes/settings.php:244
235
  msgid "Icon Class"
236
  msgstr ""
237
 
238
- #: ../includes/settings.php:258
239
  msgid "Enter the label for the post views counter field."
240
  msgstr ""
241
 
242
- #: ../includes/settings.php:272
243
  msgid "Select post types"
244
  msgstr ""
245
 
246
- #: ../includes/settings.php:283
247
  msgid "Select post types for which post views will be counted."
248
  msgstr ""
249
 
250
- #: ../includes/settings.php:297 ../includes/settings.php:423
251
- #: ../includes/settings.php:599
252
  msgid "Select groups"
253
  msgstr ""
254
 
255
- #: ../includes/settings.php:308
256
  msgid "Select post types for which post views will be displayed."
257
  msgstr ""
258
 
259
- #: ../includes/settings.php:332
260
  msgid ""
261
  "Select the method of collecting post views data. If you are using any of the "
262
  "caching plugins select Javascript."
263
  msgstr ""
264
 
265
- #: ../includes/settings.php:357
266
  msgid ""
267
  "Enable to display post views count column for each of the selected post "
268
  "types."
269
  msgstr ""
270
 
271
- #: ../includes/settings.php:383
272
  msgid "Enter the time between single user visit count."
273
  msgstr ""
274
 
275
- #: ../includes/settings.php:409
276
  msgid ""
277
  "Delete single day post views data older than specified above. Enter 0 "
278
  "(number zero) if you want to preserve your data regardless of its age."
279
  msgstr ""
280
 
281
- #: ../includes/settings.php:435 ../includes/settings.php:614
 
 
 
 
 
 
 
 
 
 
 
 
282
  msgid "Select user roles"
283
  msgstr ""
284
 
285
- #: ../includes/settings.php:447
286
  msgid "Select the type of visitors to be excluded from post views count."
287
  msgstr ""
288
 
289
- #: ../includes/settings.php:466 ../includes/settings.php:475
290
  msgid "Remove"
291
  msgstr ""
292
 
293
- #: ../includes/settings.php:475
294
  msgid "Add new"
295
  msgstr ""
296
 
297
- #: ../includes/settings.php:475
298
  msgid "Add my current IP"
299
  msgstr ""
300
 
301
- #: ../includes/settings.php:477
302
  msgid "Enter the IP addresses to be excluded from post views count."
303
  msgstr ""
304
 
305
- #: ../includes/settings.php:491
306
  msgid "Import"
307
  msgstr ""
308
 
309
- #: ../includes/settings.php:493
310
  msgid "Import post views data from WP-PostViews plugin."
311
  msgstr ""
312
 
313
- #: ../includes/settings.php:494
314
  msgid "Override existing Post Views Counter data."
315
  msgstr ""
316
 
317
- #: ../includes/settings.php:519
318
  msgid "Enable to delete all plugin data on deactivation."
319
  msgstr ""
320
 
321
- #: ../includes/settings.php:544
322
  msgid ""
323
  "Select where would you like to display the post views counter. Use [post-"
324
  "views] shortcode for manual display."
325
  msgstr ""
326
 
327
- #: ../includes/settings.php:569
328
  msgid "Choose how to display the post views counter."
329
  msgstr ""
330
 
331
- #: ../includes/settings.php:585
332
  #, php-format
333
  msgid ""
334
  "Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
335
  "\">Dashicons</a> classes are available."
336
  msgstr ""
337
 
338
- #: ../includes/settings.php:626
339
  msgid "Use it to hide the post views counter from selected type of visitors."
340
  msgstr ""
341
 
342
- #: ../includes/settings.php:661
343
  msgid "WP-PostViews data imported succesfully."
344
  msgstr ""
345
 
346
- #: ../includes/settings.php:665
347
  msgid "There was no data to import."
348
  msgstr ""
349
 
350
- #: ../includes/settings.php:827
351
  msgid "General settings restored to defaults."
352
  msgstr ""
353
 
354
- #: ../includes/settings.php:833
355
  msgid "Display settings restored to defaults."
356
  msgstr ""
357
 
358
- #: ../includes/settings.php:854
359
  msgid "Support"
360
  msgstr ""
361
 
362
- #: ../includes/widgets.php:38 ../includes/widgets.php:49
363
  msgid "Most Viewed Posts"
364
  msgstr ""
365
 
366
- #: ../includes/widgets.php:40
367
  msgid "Displays a list of the most viewed posts"
368
  msgstr ""
369
 
370
- #: ../includes/widgets.php:57
371
  msgid "No Posts found"
372
  msgstr ""
373
 
374
- #: ../includes/widgets.php:61
375
  msgid "Ascending"
376
  msgstr ""
377
 
378
- #: ../includes/widgets.php:62
379
  msgid "Descending"
380
  msgstr ""
381
 
382
- #: ../includes/widgets.php:105
383
  msgid "Title"
384
  msgstr ""
385
 
386
- #: ../includes/widgets.php:109
387
- msgid "Post types"
388
  msgstr ""
389
 
390
- #: ../includes/widgets.php:123
391
  msgid "Number of posts to show"
392
  msgstr ""
393
 
394
- #: ../includes/widgets.php:127
395
  msgid "No posts message"
396
  msgstr ""
397
 
398
- #: ../includes/widgets.php:131
399
  msgid "Order"
400
  msgstr ""
401
 
402
- #: ../includes/widgets.php:144
403
  msgid "Display post views?"
404
  msgstr ""
405
 
406
- #: ../includes/widgets.php:146
407
  msgid "Display post excerpt?"
408
  msgstr ""
409
 
410
- #: ../includes/widgets.php:148
411
  msgid "Display post thumbnail?"
412
  msgstr ""
413
 
414
- #: ../includes/widgets.php:151
415
  msgid "Thumbnail size"
416
  msgstr ""
417
 
418
- #: ../post-views-counter.php:251
419
  msgid "Are you sure you want to reset these settings to defaults?"
420
  msgstr ""
421
 
422
- #: ../post-views-counter.php:285
423
  msgid "Settings"
424
  msgstr ""
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Post Views Counter\n"
4
+ "POT-Creation-Date: 2015-04-07 21:47+0100\n"
5
+ "PO-Revision-Date: 2015-04-07 21:47+0100\n"
6
  "Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
7
  "Language-Team: dFactory <info@dfactory.eu>\n"
8
  "Language: en\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.7.5\n"
13
  "X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
14
  "esc_html__;esc_html_e\n"
15
  "X-Poedit-Basepath: .\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: ..\n"
19
 
20
+ #: ../includes/columns.php:81 ../includes/columns.php:88
21
  msgid "Post Views"
22
  msgstr ""
23
 
24
+ #: ../includes/cron.php:51
25
  msgid "Post Views Counter reset daily counts interval"
26
  msgstr ""
27
 
28
+ #: ../includes/cron.php:56
29
+ msgid "Post Views Counter cache flush interval"
30
+ msgstr ""
31
+
32
+ #: ../includes/functions.php:125
33
  msgid "No Posts"
34
  msgstr ""
35
 
36
+ #: ../includes/settings.php:36
37
  msgid "Enable"
38
  msgstr ""
39
 
40
+ #: ../includes/settings.php:37
41
  msgid "Disable"
42
  msgstr ""
43
 
44
+ #: ../includes/settings.php:41
45
  msgid "PHP"
46
  msgstr ""
47
 
48
+ #: ../includes/settings.php:42
49
  msgid "JavaScript"
50
  msgstr ""
51
 
52
+ #: ../includes/settings.php:46
53
  msgid "minutes"
54
  msgstr ""
55
 
56
+ #: ../includes/settings.php:47
57
  msgid "hours"
58
  msgstr ""
59
 
60
+ #: ../includes/settings.php:48
61
  msgid "days"
62
  msgstr ""
63
 
64
+ #: ../includes/settings.php:49
65
  msgid "weeks"
66
  msgstr ""
67
 
68
+ #: ../includes/settings.php:50
69
  msgid "months"
70
  msgstr ""
71
 
72
+ #: ../includes/settings.php:51
73
  msgid "years"
74
  msgstr ""
75
 
76
+ #: ../includes/settings.php:55
77
  msgid "robots"
78
  msgstr ""
79
 
80
+ #: ../includes/settings.php:56
81
  msgid "logged in users"
82
  msgstr ""
83
 
84
+ #: ../includes/settings.php:57
85
  msgid "guests"
86
  msgstr ""
87
 
88
+ #: ../includes/settings.php:58
89
  msgid "selected user roles"
90
  msgstr ""
91
 
92
+ #: ../includes/settings.php:62
93
  msgid "before the content"
94
  msgstr ""
95
 
96
+ #: ../includes/settings.php:63
97
  msgid "after the content"
98
  msgstr ""
99
 
100
+ #: ../includes/settings.php:64
101
  msgid "manual"
102
  msgstr ""
103
 
104
+ #: ../includes/settings.php:68
105
  msgid "icon"
106
  msgstr ""
107
 
108
+ #: ../includes/settings.php:69
109
  msgid "label"
110
  msgstr ""
111
 
112
+ #: ../includes/settings.php:74
113
  msgid "General"
114
  msgstr ""
115
 
116
+ #: ../includes/settings.php:80
117
  msgid "Display"
118
  msgstr ""
119
 
120
+ #: ../includes/settings.php:135 ../includes/settings.php:136
121
+ #: ../includes/settings.php:151 ../includes/settings.php:163
122
  msgid "Post Views Counter"
123
  msgstr ""
124
 
125
+ #: ../includes/settings.php:165
126
  msgid "Need support?"
127
  msgstr ""
128
 
129
+ #: ../includes/settings.php:166
130
  msgid ""
131
  "If you are having problems with this plugin, please talk about them in the"
132
  msgstr ""
133
 
134
+ #: ../includes/settings.php:166
135
  msgid "Support forum"
136
  msgstr ""
137
 
138
+ #: ../includes/settings.php:168
139
  msgid "Do you like this plugin?"
140
  msgstr ""
141
 
142
+ #: ../includes/settings.php:169
143
  msgid "Rate it 5"
144
  msgstr ""
145
 
146
+ #: ../includes/settings.php:169
147
  msgid "on WordPress.org"
148
  msgstr ""
149
 
150
+ #: ../includes/settings.php:170
151
  msgid "Blog about it & link to the"
152
  msgstr ""
153
 
154
+ #: ../includes/settings.php:170
155
  msgid "plugin page"
156
  msgstr ""
157
 
158
+ #: ../includes/settings.php:171
159
  msgid "Check out our other"
160
  msgstr ""
161
 
162
+ #: ../includes/settings.php:171
163
  msgid "WordPress plugins"
164
  msgstr ""
165
 
166
+ #: ../includes/settings.php:174
167
  msgid "Created by"
168
  msgstr ""
169
 
170
+ #: ../includes/settings.php:190
171
  msgid "Reset to defaults"
172
  msgstr ""
173
 
174
+ #: ../includes/settings.php:207
175
  msgid "General settings"
176
  msgstr ""
177
 
178
+ #: ../includes/settings.php:208
179
  msgid "Post Types Count"
180
  msgstr ""
181
 
182
+ #: ../includes/settings.php:209
183
  msgid "Counter Mode"
184
  msgstr ""
185
 
186
+ #: ../includes/settings.php:210
187
  msgid "Post Views Column"
188
  msgstr ""
189
 
190
+ #: ../includes/settings.php:211
191
  msgid "Time Between Counts"
192
  msgstr ""
193
 
194
+ #: ../includes/settings.php:212
195
+ msgid "Reset Data Interval"
196
  msgstr ""
197
 
198
+ #: ../includes/settings.php:213
199
+ msgid "Flush Object Cache Interval"
200
+ msgstr ""
201
+
202
+ #: ../includes/settings.php:214
203
  msgid "Exclude Visitors"
204
  msgstr ""
205
 
206
+ #: ../includes/settings.php:215
207
  msgid "Exclude IPs"
208
  msgstr ""
209
 
210
+ #: ../includes/settings.php:216
211
  msgid "WP-PostViews"
212
  msgstr ""
213
 
214
+ #: ../includes/settings.php:217
215
  msgid "Deactivation"
216
  msgstr ""
217
 
218
+ #: ../includes/settings.php:221
219
  msgid "Display settings"
220
  msgstr ""
221
 
222
+ #: ../includes/settings.php:222
223
  msgid "Post Views Label"
224
  msgstr ""
225
 
226
+ #: ../includes/settings.php:223
227
  msgid "Post Types Display"
228
  msgstr ""
229
 
230
+ #: ../includes/settings.php:224
231
  msgid "Restrict Display"
232
  msgstr ""
233
 
234
+ #: ../includes/settings.php:225
235
  msgid "Position"
236
  msgstr ""
237
 
238
+ #: ../includes/settings.php:226
239
  msgid "Display Style"
240
  msgstr ""
241
 
242
+ #: ../includes/settings.php:227
243
  msgid "Icon Class"
244
  msgstr ""
245
 
246
+ #: ../includes/settings.php:240
247
  msgid "Enter the label for the post views counter field."
248
  msgstr ""
249
 
250
+ #: ../includes/settings.php:253
251
  msgid "Select post types"
252
  msgstr ""
253
 
254
+ #: ../includes/settings.php:263
255
  msgid "Select post types for which post views will be counted."
256
  msgstr ""
257
 
258
+ #: ../includes/settings.php:276 ../includes/settings.php:412
259
+ #: ../includes/settings.php:569
260
  msgid "Select groups"
261
  msgstr ""
262
 
263
+ #: ../includes/settings.php:286
264
  msgid "Select post types for which post views will be displayed."
265
  msgstr ""
266
 
267
+ #: ../includes/settings.php:308
268
  msgid ""
269
  "Select the method of collecting post views data. If you are using any of the "
270
  "caching plugins select Javascript."
271
  msgstr ""
272
 
273
+ #: ../includes/settings.php:330
274
  msgid ""
275
  "Enable to display post views count column for each of the selected post "
276
  "types."
277
  msgstr ""
278
 
279
+ #: ../includes/settings.php:353
280
  msgid "Enter the time between single user visit count."
281
  msgstr ""
282
 
283
+ #: ../includes/settings.php:377
284
  msgid ""
285
  "Delete single day post views data older than specified above. Enter 0 "
286
  "(number zero) if you want to preserve your data regardless of its age."
287
  msgstr ""
288
 
289
+ #: ../includes/settings.php:400
290
+ msgid ""
291
+ "How often to flush cached view counts from the object cache into the "
292
+ "database. This feature is used only if a persistent object cache is detected "
293
+ "and the interval is greater than 0 (number zero)). When used, view counts "
294
+ "will be collected and stored in the object cache instead of the database and "
295
+ "will then be asynchronously flushed to the database according to the "
296
+ "specified interval.<br /><strong>Notice:</strong> Potential data loss may "
297
+ "occur if the object cache is cleared/unavailable for the duration of the "
298
+ "interval."
299
+ msgstr ""
300
+
301
+ #: ../includes/settings.php:423 ../includes/settings.php:584
302
  msgid "Select user roles"
303
  msgstr ""
304
 
305
+ #: ../includes/settings.php:434
306
  msgid "Select the type of visitors to be excluded from post views count."
307
  msgstr ""
308
 
309
+ #: ../includes/settings.php:450 ../includes/settings.php:459
310
  msgid "Remove"
311
  msgstr ""
312
 
313
+ #: ../includes/settings.php:459
314
  msgid "Add new"
315
  msgstr ""
316
 
317
+ #: ../includes/settings.php:459
318
  msgid "Add my current IP"
319
  msgstr ""
320
 
321
+ #: ../includes/settings.php:461
322
  msgid "Enter the IP addresses to be excluded from post views count."
323
  msgstr ""
324
 
325
+ #: ../includes/settings.php:473
326
  msgid "Import"
327
  msgstr ""
328
 
329
+ #: ../includes/settings.php:475
330
  msgid "Import post views data from WP-PostViews plugin."
331
  msgstr ""
332
 
333
+ #: ../includes/settings.php:476
334
  msgid "Override existing Post Views Counter data."
335
  msgstr ""
336
 
337
+ #: ../includes/settings.php:498
338
  msgid "Enable to delete all plugin data on deactivation."
339
  msgstr ""
340
 
341
+ #: ../includes/settings.php:520
342
  msgid ""
343
  "Select where would you like to display the post views counter. Use [post-"
344
  "views] shortcode for manual display."
345
  msgstr ""
346
 
347
+ #: ../includes/settings.php:542
348
  msgid "Choose how to display the post views counter."
349
  msgstr ""
350
 
351
+ #: ../includes/settings.php:556
352
  #, php-format
353
  msgid ""
354
  "Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
355
  "\">Dashicons</a> classes are available."
356
  msgstr ""
357
 
358
+ #: ../includes/settings.php:595
359
  msgid "Use it to hide the post views counter from selected type of visitors."
360
  msgstr ""
361
 
362
+ #: ../includes/settings.php:626
363
  msgid "WP-PostViews data imported succesfully."
364
  msgstr ""
365
 
366
+ #: ../includes/settings.php:628
367
  msgid "There was no data to import."
368
  msgstr ""
369
 
370
+ #: ../includes/settings.php:786
371
  msgid "General settings restored to defaults."
372
  msgstr ""
373
 
374
+ #: ../includes/settings.php:790
375
  msgid "Display settings restored to defaults."
376
  msgstr ""
377
 
378
+ #: ../includes/settings.php:810
379
  msgid "Support"
380
  msgstr ""
381
 
382
+ #: ../includes/widgets.php:32 ../includes/widgets.php:43
383
  msgid "Most Viewed Posts"
384
  msgstr ""
385
 
386
+ #: ../includes/widgets.php:34
387
  msgid "Displays a list of the most viewed posts"
388
  msgstr ""
389
 
390
+ #: ../includes/widgets.php:51
391
  msgid "No Posts found"
392
  msgstr ""
393
 
394
+ #: ../includes/widgets.php:55
395
  msgid "Ascending"
396
  msgstr ""
397
 
398
+ #: ../includes/widgets.php:56
399
  msgid "Descending"
400
  msgstr ""
401
 
402
+ #: ../includes/widgets.php:93
403
  msgid "Title"
404
  msgstr ""
405
 
406
+ #: ../includes/widgets.php:97
407
+ msgid "Post Types"
408
  msgstr ""
409
 
410
+ #: ../includes/widgets.php:110
411
  msgid "Number of posts to show"
412
  msgstr ""
413
 
414
+ #: ../includes/widgets.php:114
415
  msgid "No posts message"
416
  msgstr ""
417
 
418
+ #: ../includes/widgets.php:118
419
  msgid "Order"
420
  msgstr ""
421
 
422
+ #: ../includes/widgets.php:130
423
  msgid "Display post views?"
424
  msgstr ""
425
 
426
+ #: ../includes/widgets.php:132
427
  msgid "Display post excerpt?"
428
  msgstr ""
429
 
430
+ #: ../includes/widgets.php:134
431
  msgid "Display post thumbnail?"
432
  msgstr ""
433
 
434
+ #: ../includes/widgets.php:137
435
  msgid "Thumbnail size"
436
  msgstr ""
437
 
438
+ #: ../post-views-counter.php:278
439
  msgid "Are you sure you want to reset these settings to defaults?"
440
  msgstr ""
441
 
442
+ #: ../post-views-counter.php:310
443
  msgid "Settings"
444
  msgstr ""
post-views-counter.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
- Version: 1.0.5
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
@@ -12,7 +12,7 @@ Text Domain: post-views-counter
12
  Domain Path: /languages
13
 
14
  Post Views Counter
15
- Copyright (C) 2014, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
@@ -21,7 +21,7 @@ The above copyright notice and this permission notice shall be included in all c
21
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
  */
23
 
24
-
25
  if(!defined('ABSPATH')) exit;
26
 
27
  define('POST_VIEWS_COUNTER_URL', plugins_url('', __FILE__));
@@ -37,9 +37,13 @@ include_once(POST_VIEWS_COUNTER_PATH.'includes/columns.php');
37
  include_once(POST_VIEWS_COUNTER_PATH.'includes/frontend.php');
38
  include_once(POST_VIEWS_COUNTER_PATH.'includes/widgets.php');
39
 
40
-
41
- class Post_Views_Counter
42
- {
 
 
 
 
43
  private static $_instance;
44
  private $instances;
45
  private $options;
@@ -56,6 +60,10 @@ class Post_Views_Counter
56
  'number' => 30,
57
  'type' => 'days'
58
  ),
 
 
 
 
59
  'exclude' => array(
60
  'groups' => array(),
61
  'roles' => array()
@@ -80,12 +88,11 @@ class Post_Views_Counter
80
  'link_to_post' => true,
81
  'icon_class' => 'dashicons-visibility'
82
  ),
83
- 'version' => '1.0.5'
84
  );
85
 
86
 
87
- public static function instance()
88
- {
89
  if(self::$_instance === null)
90
  self::$_instance = new self();
91
 
@@ -97,8 +104,7 @@ class Post_Views_Counter
97
  private function __wakeup() {}
98
 
99
 
100
- private function __construct()
101
- {
102
  register_activation_hook(__FILE__, array(&$this, 'activation'));
103
  register_deactivation_hook(__FILE__, array(&$this, 'deactivation'));
104
 
@@ -121,14 +127,13 @@ class Post_Views_Counter
121
  /**
122
  * Execution of plugin activation function
123
  */
124
- public function activation()
125
- {
126
  global $wpdb, $charset_collate;
127
 
128
  // required for dbdelta
129
  require_once(ABSPATH.'wp-admin/includes/upgrade.php');
130
 
131
- // creates post views table
132
  dbDelta('
133
  CREATE TABLE IF NOT EXISTS '.$wpdb->prefix.'post_views (
134
  id bigint unsigned NOT NULL,
@@ -141,77 +146,90 @@ class Post_Views_Counter
141
  ) '.$charset_collate.';'
142
  );
143
 
144
- // adds default options
145
  add_option('post_views_counter_settings_general', $this->defaults['general'], '', 'no');
146
  add_option('post_views_counter_settings_display', $this->defaults['display'], '', 'no');
147
  add_option('post_views_counter_version', $this->defaults['version'], '', 'no');
 
 
 
148
  }
149
 
150
 
151
  /**
152
  * Execution of plugin deactivation function
153
  */
154
- public function deactivation()
155
- {
156
- // deletes default options
157
- if($this->options['general']['deactivation_delete'])
158
- {
159
  delete_option('post_views_counter_settings_general');
160
  delete_option('post_views_counter_settings_display');
161
  }
162
 
163
- // removes schedule
164
  wp_clear_scheduled_hook('pvc_reset_counts');
165
  remove_action('pvc_reset_counts', array(Post_Views_Counter()->get_instance('cron'), 'reset_counts'));
 
 
166
  }
167
 
 
 
 
 
 
 
 
 
168
 
169
  /**
170
- * Loads text domain
 
 
 
 
 
 
 
 
 
171
  */
172
- public function load_textdomain()
173
- {
174
  load_plugin_textdomain('post-views-counter', false, POST_VIEWS_COUNTER_REL_PATH.'languages/');
175
  }
176
-
177
-
178
  /**
179
  * Load pluggable template functions
180
  */
181
- public function load_pluggable_functions()
182
- {
183
  include_once(POST_VIEWS_COUNTER_PATH.'includes/functions.php');
184
  }
185
 
186
 
187
  /**
188
- * Sets instance of class
189
  */
190
- public function add_instance($name, $instance)
191
- {
192
  $this->instances[$name] = $instance;
193
  }
194
 
195
 
196
  /**
197
- * Gets instance of class
198
  */
199
- public function get_instance($name)
200
- {
201
  if(in_array($name, array('counter', 'settings'), true))
202
  return $this->instances[$name];
203
  }
204
 
205
 
206
  /**
207
- * Gets allowed attribute
208
  */
209
- public function get_attribute($attribute)
210
- {
211
- if(in_array($attribute, array('options', 'defaults'), true))
212
- {
213
- switch(func_num_args())
214
- {
215
  case 1:
216
  return $this->{$attribute};
217
 
@@ -231,23 +249,23 @@ class Post_Views_Counter
231
 
232
 
233
  /**
234
- * Enqueues admin scripts and styles
235
  */
236
- public function admin_scripts_styles($page)
237
- {
238
- // loads only for settings page
239
- if($page === 'settings_page_post-views-counter')
240
- {
241
  wp_register_script(
242
  'post-views-counter-admin-chosen',
243
  POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.jquery.min.js',
244
- array('jquery')
 
245
  );
246
 
247
  wp_register_script(
248
  'post-views-counter-admin',
249
  POST_VIEWS_COUNTER_URL.'/js/admin.js',
250
- array('jquery', 'post-views-counter-admin-chosen')
 
251
  );
252
 
253
  wp_enqueue_script('post-views-counter-admin-chosen');
@@ -278,19 +296,17 @@ class Post_Views_Counter
278
 
279
 
280
  /**
281
- * Adds link to settings page
282
  */
283
- public function plugin_settings_link($links, $file)
284
- {
285
- if(!is_admin() || !current_user_can('manage_options'))
286
  return $links;
287
 
288
  static $plugin;
289
 
290
  $plugin = plugin_basename(__FILE__);
291
 
292
- if($file == $plugin)
293
- {
294
  $settings_link = sprintf('<a href="%s">%s</a>', admin_url('options-general.php').'?page=post-views-counter', __('Settings', 'post-views-counter'));
295
 
296
  array_unshift($links, $settings_link);
@@ -300,13 +316,14 @@ class Post_Views_Counter
300
  }
301
  }
302
 
303
-
304
- function Post_Views_Counter()
305
- {
 
306
  static $instance;
307
 
308
  // first call to instance() initializes the plugin
309
- if($instance === null || !($instance instanceof Post_Views_Counter))
310
  $instance = Post_Views_Counter::instance();
311
 
312
  return $instance;
2
  /*
3
  Plugin Name: Post Views Counter
4
  Description: Forget WP-PostViews. Display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
5
+ Version: 1.0.6
6
  Author: dFactory
7
  Author URI: http://www.dfactory.eu/
8
  Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
12
  Domain Path: /languages
13
 
14
  Post Views Counter
15
+ Copyright (C) 2014-2015, Digital Factory - info@digitalfactory.pl
16
 
17
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
18
 
21
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
  */
23
 
24
+ // Exit if accessed directly
25
  if(!defined('ABSPATH')) exit;
26
 
27
  define('POST_VIEWS_COUNTER_URL', plugins_url('', __FILE__));
37
  include_once(POST_VIEWS_COUNTER_PATH.'includes/frontend.php');
38
  include_once(POST_VIEWS_COUNTER_PATH.'includes/widgets.php');
39
 
40
+ /**
41
+ * Post Views Counter class
42
+ *
43
+ * @class Post_Views_Counter
44
+ * @version 1.0.6
45
+ */
46
+ class Post_Views_Counter {
47
  private static $_instance;
48
  private $instances;
49
  private $options;
60
  'number' => 30,
61
  'type' => 'days'
62
  ),
63
+ 'flush_interval' => array(
64
+ 'number' => 0,
65
+ 'type' => 'minutes'
66
+ ),
67
  'exclude' => array(
68
  'groups' => array(),
69
  'roles' => array()
88
  'link_to_post' => true,
89
  'icon_class' => 'dashicons-visibility'
90
  ),
91
+ 'version' => '1.0.6'
92
  );
93
 
94
 
95
+ public static function instance() {
 
96
  if(self::$_instance === null)
97
  self::$_instance = new self();
98
 
104
  private function __wakeup() {}
105
 
106
 
107
+ private function __construct() {
 
108
  register_activation_hook(__FILE__, array(&$this, 'activation'));
109
  register_deactivation_hook(__FILE__, array(&$this, 'deactivation'));
110
 
127
  /**
128
  * Execution of plugin activation function
129
  */
130
+ public function activation() {
 
131
  global $wpdb, $charset_collate;
132
 
133
  // required for dbdelta
134
  require_once(ABSPATH.'wp-admin/includes/upgrade.php');
135
 
136
+ // create post views table
137
  dbDelta('
138
  CREATE TABLE IF NOT EXISTS '.$wpdb->prefix.'post_views (
139
  id bigint unsigned NOT NULL,
146
  ) '.$charset_collate.';'
147
  );
148
 
149
+ // add default options
150
  add_option('post_views_counter_settings_general', $this->defaults['general'], '', 'no');
151
  add_option('post_views_counter_settings_display', $this->defaults['display'], '', 'no');
152
  add_option('post_views_counter_version', $this->defaults['version'], '', 'no');
153
+
154
+ // schedule cache flush
155
+ $this->schedule_cache_flush();
156
  }
157
 
158
 
159
  /**
160
  * Execution of plugin deactivation function
161
  */
162
+ public function deactivation() {
163
+ // delete default options
164
+ if ($this->options['general']['deactivation_delete']) {
 
 
165
  delete_option('post_views_counter_settings_general');
166
  delete_option('post_views_counter_settings_display');
167
  }
168
 
169
+ // remove schedule
170
  wp_clear_scheduled_hook('pvc_reset_counts');
171
  remove_action('pvc_reset_counts', array(Post_Views_Counter()->get_instance('cron'), 'reset_counts'));
172
+
173
+ $this->remove_cache_flush();
174
  }
175
 
176
+ /**
177
+ * Schedule cache flushing if it's not already scheduled
178
+ */
179
+ public function schedule_cache_flush($forced = true) {
180
+ if ( $forced || ! wp_next_scheduled( 'pvc_flush_cached_counts' ) ) {
181
+ wp_schedule_event( time(), 'post_views_counter_flush_interval', 'pvc_flush_cached_counts' );
182
+ }
183
+ }
184
 
185
  /**
186
+ * Remove scheduled cache flush and the corresponding action
187
+ */
188
+ public function remove_cache_flush() {
189
+ wp_clear_scheduled_hook( 'pvc_flush_cached_counts' );
190
+ remove_action( 'pvc_flush_cached_counts', array( Post_Views_Counter()->get_instance('cron'), 'flush_cached_counts' ) );
191
+ }
192
+
193
+
194
+ /**
195
+ * Load text domain
196
  */
197
+ public function load_textdomain() {
 
198
  load_plugin_textdomain('post-views-counter', false, POST_VIEWS_COUNTER_REL_PATH.'languages/');
199
  }
200
+
201
+
202
  /**
203
  * Load pluggable template functions
204
  */
205
+ public function load_pluggable_functions() {
 
206
  include_once(POST_VIEWS_COUNTER_PATH.'includes/functions.php');
207
  }
208
 
209
 
210
  /**
211
+ * Set instance of class
212
  */
213
+ public function add_instance($name, $instance) {
 
214
  $this->instances[$name] = $instance;
215
  }
216
 
217
 
218
  /**
219
+ * Get instance of a class
220
  */
221
+ public function get_instance($name) {
 
222
  if(in_array($name, array('counter', 'settings'), true))
223
  return $this->instances[$name];
224
  }
225
 
226
 
227
  /**
228
+ * Get allowed attribute
229
  */
230
+ public function get_attribute($attribute) {
231
+ if (in_array($attribute, array('options', 'defaults'), true)) {
232
+ switch(func_num_args()) {
 
 
 
233
  case 1:
234
  return $this->{$attribute};
235
 
249
 
250
 
251
  /**
252
+ * Enqueue admin scripts and styles
253
  */
254
+ public function admin_scripts_styles($page) {
255
+ // load on PVC settings page only
256
+ if ($page === 'settings_page_post-views-counter') {
 
 
257
  wp_register_script(
258
  'post-views-counter-admin-chosen',
259
  POST_VIEWS_COUNTER_URL.'/assets/chosen/chosen.jquery.min.js',
260
+ array('jquery'),
261
+ $this->defaults['version']
262
  );
263
 
264
  wp_register_script(
265
  'post-views-counter-admin',
266
  POST_VIEWS_COUNTER_URL.'/js/admin.js',
267
+ array('jquery', 'post-views-counter-admin-chosen'),
268
+ $this->defaults['version']
269
  );
270
 
271
  wp_enqueue_script('post-views-counter-admin-chosen');
296
 
297
 
298
  /**
299
+ * Add link to settings page
300
  */
301
+ public function plugin_settings_link($links, $file) {
302
+ if (!is_admin() || !current_user_can('manage_options'))
 
303
  return $links;
304
 
305
  static $plugin;
306
 
307
  $plugin = plugin_basename(__FILE__);
308
 
309
+ if ($file == $plugin) {
 
310
  $settings_link = sprintf('<a href="%s">%s</a>', admin_url('options-general.php').'?page=post-views-counter', __('Settings', 'post-views-counter'));
311
 
312
  array_unshift($links, $settings_link);
316
  }
317
  }
318
 
319
+ /**
320
+ * Initialise Post Views Counter
321
+ */
322
+ function Post_Views_Counter() {
323
  static $instance;
324
 
325
  // first call to instance() initializes the plugin
326
+ if ($instance === null || !($instance instanceof Post_Views_Counter))
327
  $instance = Post_Views_Counter::instance();
328
 
329
  return $instance;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.dfactory.eu/
4
  Tags: counter, hits, postviews, post views, views, count
5
  Requires at least: 3.8.0
6
  Tested up to: 4.1.1
7
- Stable tag: 1.0.5
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -31,9 +31,14 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
31
  * .pot file for translations included
32
 
33
  = Translations: =
 
34
  * Polish - by Bartosz Arendt
35
  * Russian - by moonkir
36
 
 
 
 
 
37
 
38
  == Installation ==
39
 
@@ -52,6 +57,10 @@ No questions yet.
52
 
53
  == Changelog ==
54
 
 
 
 
 
55
  = 1.0.5 =
56
  * Tweak: Added number_format_i18n for displayed views count
57
  * Tweak: Additional action hook for developers
@@ -71,6 +80,6 @@ Initial release
71
 
72
  == Upgrade Notice ==
73
 
74
- = 1.0.5 =
75
- * Tweak: Added number_format_i18n for displayed views count
76
- * Tweak: Additional action hook for developers
4
  Tags: counter, hits, postviews, post views, views, count
5
  Requires at least: 3.8.0
6
  Tested up to: 4.1.1
7
+ Stable tag: 1.0.6
8
  License: MIT License
9
  License URI: http://opensource.org/licenses/MIT
10
 
31
  * .pot file for translations included
32
 
33
  = Translations: =
34
+ * Hebrew - by [Ahrale Shrem](http://atar4u.com/)
35
  * Polish - by Bartosz Arendt
36
  * Russian - by moonkir
37
 
38
+ = Get involved =
39
+
40
+ Feel free to contribute to the source code on the [dFactory GitHub Repository](https://github.com/dfactoryplugins).
41
+
42
 
43
  == Installation ==
44
 
57
 
58
  == Changelog ==
59
 
60
+ = 1.0.6 =
61
+ * New: Object cache support, thanks to [Tomas Trkulja](http://zytzagoo.net/blog/)
62
+ * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)
63
+
64
  = 1.0.5 =
65
  * Tweak: Added number_format_i18n for displayed views count
66
  * Tweak: Additional action hook for developers
80
 
81
  == Upgrade Notice ==
82
 
83
+ = 1.0.6 =
84
+ * New: Object cache support, thanks to [Tomas Trkulja](http://zytzagoo.net/blog/)
85
+ * New: Hebrew translation, thanks to [Ahrale Shrem](http://atar4u.com/)