Version Description
- New: REST API counter mode
- New: Adjust dashboard chart colors to admin color scheme
- Tweak: Dashboard chart query optimization
- Tweak: post_views database table optimization
- Tweak: Added plugin documentation link
Download this release
Release Info
Developer | dfactory |
Plugin | Post Views Counter |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.2.5
- includes/counter.php +126 -34
- includes/cron.php +10 -3
- includes/dashboard.php +137 -38
- includes/frontend.php +13 -14
- includes/functions.php +209 -19
- includes/settings.php +42 -32
- includes/update.php +87 -3
- js/admin-settings.js +5 -0
- js/frontend.js +36 -6
- languages/post-views-counter.pot +184 -137
- post-views-counter.php +58 -29
- readme.txt +19 -10
includes/counter.php
CHANGED
@@ -27,21 +27,7 @@ class Post_Views_Counter_Counter {
|
|
27 |
add_action( 'wp', array( $this, 'check_post_php' ) );
|
28 |
add_action( 'wp_ajax_pvc-check-post', array( $this, 'check_post_ajax' ) );
|
29 |
add_action( 'wp_ajax_nopriv_pvc-check-post', array( $this, 'check_post_ajax' ) );
|
30 |
-
|
31 |
-
|
32 |
-
/**
|
33 |
-
* Check if IPv4 is in range.
|
34 |
-
*
|
35 |
-
* @param string $ip IP address
|
36 |
-
* @param string $range IP range
|
37 |
-
* @return boolean Whether IP is in range
|
38 |
-
*/
|
39 |
-
function ipv4_in_range( $ip, $range ) {
|
40 |
-
$start = str_replace( '*', '0', $range );
|
41 |
-
$end = str_replace( '*', '255', $range );
|
42 |
-
$ip = (float) sprintf( "%u", ip2long( $ip ) );
|
43 |
-
|
44 |
-
return ( $ip >= (float) sprintf( "%u", ip2long( $start ) ) && $ip <= (float) sprintf( "%u", ip2long( $end ) ) );
|
45 |
}
|
46 |
|
47 |
/**
|
@@ -52,6 +38,9 @@ class Post_Views_Counter_Counter {
|
|
52 |
public function check_post( $id = 0 ) {
|
53 |
// get post id
|
54 |
$id = (int) ( empty( $id ) ? get_the_ID() : $id );
|
|
|
|
|
|
|
55 |
|
56 |
// empty id?
|
57 |
if ( empty( $id ) )
|
@@ -78,12 +67,12 @@ class Post_Views_Counter_Counter {
|
|
78 |
$groups = Post_Views_Counter()->options['general']['exclude']['groups'];
|
79 |
|
80 |
// whether to count this user
|
81 |
-
if (
|
82 |
// exclude logged in users?
|
83 |
if ( in_array( 'users', $groups, true ) )
|
84 |
return;
|
85 |
// exclude specific roles?
|
86 |
-
elseif ( in_array( 'roles', $groups, true ) && $this->is_user_role_excluded( Post_Views_Counter()->options['general']['exclude']['roles'] ) )
|
87 |
return;
|
88 |
}
|
89 |
// exclude guests?
|
@@ -113,7 +102,9 @@ class Post_Views_Counter_Counter {
|
|
113 |
|
114 |
// count visit
|
115 |
if ( $count_visit )
|
116 |
-
$this->count_visit( $id );
|
|
|
|
|
117 |
}
|
118 |
|
119 |
/**
|
@@ -121,7 +112,7 @@ class Post_Views_Counter_Counter {
|
|
121 |
*/
|
122 |
public function check_post_php() {
|
123 |
// do not count admin entries
|
124 |
-
if ( is_admin() && ! (defined( 'DOING_AJAX' ) && DOING_AJAX) )
|
125 |
return;
|
126 |
|
127 |
// do we use PHP as counter?
|
@@ -141,7 +132,7 @@ class Post_Views_Counter_Counter {
|
|
141 |
* Check whether to count visit via AJAX request.
|
142 |
*/
|
143 |
public function check_post_ajax() {
|
144 |
-
if ( isset( $_POST['action'], $_POST['
|
145 |
|
146 |
// do we use Ajax as counter?
|
147 |
if ( Post_Views_Counter()->options['general']['counter_mode'] != 'js' )
|
@@ -150,11 +141,11 @@ class Post_Views_Counter_Counter {
|
|
150 |
// get countable post types
|
151 |
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
152 |
|
153 |
-
//
|
154 |
-
$
|
155 |
|
156 |
// whether to count this post type or not
|
157 |
-
if ( empty( $post_types ) || empty( $
|
158 |
exit;
|
159 |
|
160 |
$this->check_post( $post_id );
|
@@ -163,6 +154,36 @@ class Post_Views_Counter_Counter {
|
|
163 |
exit;
|
164 |
}
|
165 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
/**
|
167 |
* Initialize cookie session.
|
168 |
*/
|
@@ -283,7 +304,7 @@ class Post_Views_Counter_Counter {
|
|
283 |
*
|
284 |
* @global object $wpdb
|
285 |
* @param int $id
|
286 |
-
* @return
|
287 |
*/
|
288 |
private function count_visit( $id ) {
|
289 |
global $wpdb;
|
@@ -321,7 +342,7 @@ class Post_Views_Counter_Counter {
|
|
321 |
|
322 |
do_action( 'pvc_after_count_visit', $id );
|
323 |
|
324 |
-
return
|
325 |
}
|
326 |
|
327 |
/**
|
@@ -354,7 +375,7 @@ class Post_Views_Counter_Counter {
|
|
354 |
'years' => 946080000
|
355 |
);
|
356 |
|
357 |
-
return ( $timestamp ? current_time( 'timestamp', true ) : 0 ) + $number * $converter[$type];
|
358 |
}
|
359 |
|
360 |
/**
|
@@ -479,11 +500,11 @@ class Post_Views_Counter_Counter {
|
|
479 |
}
|
480 |
|
481 |
return $wpdb->query(
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
);
|
488 |
}
|
489 |
|
@@ -493,8 +514,8 @@ class Post_Views_Counter_Counter {
|
|
493 |
* @param string $option
|
494 |
* @return bool
|
495 |
*/
|
496 |
-
public function is_user_role_excluded( $option ) {
|
497 |
-
$user =
|
498 |
|
499 |
if ( empty( $user ) )
|
500 |
return false;
|
@@ -510,5 +531,76 @@ class Post_Views_Counter_Counter {
|
|
510 |
|
511 |
return false;
|
512 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
|
514 |
-
}
|
27 |
add_action( 'wp', array( $this, 'check_post_php' ) );
|
28 |
add_action( 'wp_ajax_pvc-check-post', array( $this, 'check_post_ajax' ) );
|
29 |
add_action( 'wp_ajax_nopriv_pvc-check-post', array( $this, 'check_post_ajax' ) );
|
30 |
+
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
}
|
32 |
|
33 |
/**
|
38 |
public function check_post( $id = 0 ) {
|
39 |
// get post id
|
40 |
$id = (int) ( empty( $id ) ? get_the_ID() : $id );
|
41 |
+
|
42 |
+
// get user id, from current user or static var in rest api request
|
43 |
+
$user_id = get_current_user_id();
|
44 |
|
45 |
// empty id?
|
46 |
if ( empty( $id ) )
|
67 |
$groups = Post_Views_Counter()->options['general']['exclude']['groups'];
|
68 |
|
69 |
// whether to count this user
|
70 |
+
if ( ! empty( $user_id ) ) {
|
71 |
// exclude logged in users?
|
72 |
if ( in_array( 'users', $groups, true ) )
|
73 |
return;
|
74 |
// exclude specific roles?
|
75 |
+
elseif ( in_array( 'roles', $groups, true ) && $this->is_user_role_excluded( $user_id, Post_Views_Counter()->options['general']['exclude']['roles'] ) )
|
76 |
return;
|
77 |
}
|
78 |
// exclude guests?
|
102 |
|
103 |
// count visit
|
104 |
if ( $count_visit )
|
105 |
+
return $this->count_visit( $id );
|
106 |
+
else
|
107 |
+
return;
|
108 |
}
|
109 |
|
110 |
/**
|
112 |
*/
|
113 |
public function check_post_php() {
|
114 |
// do not count admin entries
|
115 |
+
if ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) )
|
116 |
return;
|
117 |
|
118 |
// do we use PHP as counter?
|
132 |
* Check whether to count visit via AJAX request.
|
133 |
*/
|
134 |
public function check_post_ajax() {
|
135 |
+
if ( isset( $_POST['action'], $_POST['id'], $_POST['pvc_nonce'] ) && $_POST['action'] === 'pvc-check-post' && ($post_id = (int) $_POST['id']) > 0 && wp_verify_nonce( $_POST['pvc_nonce'], 'pvc-check-post' ) !== false ) {
|
136 |
|
137 |
// do we use Ajax as counter?
|
138 |
if ( Post_Views_Counter()->options['general']['counter_mode'] != 'js' )
|
141 |
// get countable post types
|
142 |
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
143 |
|
144 |
+
// check if post exists
|
145 |
+
$post = get_post( $post_id );
|
146 |
|
147 |
// whether to count this post type or not
|
148 |
+
if ( empty( $post_types ) || empty( $post ) || $post->post_type !== $_POST['post_type'] || ! in_array( $post->post_type, $post_types, true ) )
|
149 |
exit;
|
150 |
|
151 |
$this->check_post( $post_id );
|
154 |
exit;
|
155 |
}
|
156 |
|
157 |
+
/**
|
158 |
+
* Check whether to count visit via REST API request.
|
159 |
+
*
|
160 |
+
* @param array $request
|
161 |
+
* @return int|bool
|
162 |
+
*/
|
163 |
+
public function check_post_rest_api( $request ) {
|
164 |
+
$post_id = absint( $request['id'] );
|
165 |
+
|
166 |
+
// do we use REST API as counter?
|
167 |
+
if ( Post_Views_Counter()->options['general']['counter_mode'] != 'rest_api' )
|
168 |
+
return new WP_Error( 'pvc_rest_api_disabled', __( 'REST API method is disabled.', 'post-views-counter' ), array( 'status' => 404 ) );
|
169 |
+
|
170 |
+
// @todo: get current user id in direct api endpoint calls
|
171 |
+
|
172 |
+
// check if post exists
|
173 |
+
$post = get_post( $post_id );
|
174 |
+
|
175 |
+
if ( ! $post )
|
176 |
+
return new WP_Error( 'pvc_post_invalid_id', __( 'Invalid post ID.', 'post-views-counter' ), array( 'status' => 404 ) );
|
177 |
+
|
178 |
+
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
179 |
+
|
180 |
+
// whether to count this post type
|
181 |
+
if ( empty( $post_types ) || ! in_array( $post->post_type, $post_types ) )
|
182 |
+
return new WP_Error( 'pvc_post_type_excluded', __( 'Post type excluded.', 'post-views-counter' ), array( 'status' => 404 ) );
|
183 |
+
|
184 |
+
return $this->check_post( $post_id );
|
185 |
+
}
|
186 |
+
|
187 |
/**
|
188 |
* Initialize cookie session.
|
189 |
*/
|
304 |
*
|
305 |
* @global object $wpdb
|
306 |
* @param int $id
|
307 |
+
* @return int $id
|
308 |
*/
|
309 |
private function count_visit( $id ) {
|
310 |
global $wpdb;
|
342 |
|
343 |
do_action( 'pvc_after_count_visit', $id );
|
344 |
|
345 |
+
return $id;
|
346 |
}
|
347 |
|
348 |
/**
|
375 |
'years' => 946080000
|
376 |
);
|
377 |
|
378 |
+
return (int) ( ( $timestamp ? current_time( 'timestamp', true ) : 0 ) + $number * $converter[$type] );
|
379 |
}
|
380 |
|
381 |
/**
|
500 |
}
|
501 |
|
502 |
return $wpdb->query(
|
503 |
+
$wpdb->prepare( "
|
504 |
+
INSERT INTO " . $wpdb->prefix . "post_views (id, type, period, count)
|
505 |
+
VALUES (%d, %d, %s, %d)
|
506 |
+
ON DUPLICATE KEY UPDATE count = count + %d", $id, $type, $period, $count, $count
|
507 |
+
)
|
508 |
);
|
509 |
}
|
510 |
|
514 |
* @param string $option
|
515 |
* @return bool
|
516 |
*/
|
517 |
+
public function is_user_role_excluded( $user_id, $option ) {
|
518 |
+
$user = get_user_by( 'id', $user_id );
|
519 |
|
520 |
if ( empty( $user ) )
|
521 |
return false;
|
531 |
|
532 |
return false;
|
533 |
}
|
534 |
+
|
535 |
+
/**
|
536 |
+
* Check if IPv4 is in range.
|
537 |
+
*
|
538 |
+
* @param string $ip IP address
|
539 |
+
* @param string $range IP range
|
540 |
+
* @return boolean Whether IP is in range
|
541 |
+
*/
|
542 |
+
function ipv4_in_range( $ip, $range ) {
|
543 |
+
$start = str_replace( '*', '0', $range );
|
544 |
+
$end = str_replace( '*', '255', $range );
|
545 |
+
$ip = (float) sprintf( "%u", ip2long( $ip ) );
|
546 |
+
|
547 |
+
return ( $ip >= (float) sprintf( "%u", ip2long( $start ) ) && $ip <= (float) sprintf( "%u", ip2long( $end ) ) );
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Register REST API endpoints.
|
552 |
+
*
|
553 |
+
* @return void
|
554 |
+
*/
|
555 |
+
public function rest_api_init() {
|
556 |
+
// view post route
|
557 |
+
register_rest_route( 'post-views-counter', '/view-post/', array(
|
558 |
+
'methods' => array( 'GET', 'POST' ),
|
559 |
+
'callback' => array( $this, 'check_post_rest_api' ),
|
560 |
+
'args' => array(
|
561 |
+
'id' => array(
|
562 |
+
'default' => 0,
|
563 |
+
'sanitize_callback' => 'absint'
|
564 |
+
)
|
565 |
+
)
|
566 |
+
) );
|
567 |
+
// get views route
|
568 |
+
register_rest_route( 'post-views-counter', '/get-post-views/', array(
|
569 |
+
'methods' => array( 'GET', 'POST' ),
|
570 |
+
'callback' => array( $this, 'get_post_views_rest_api' ),
|
571 |
+
'permission_callback' => array( $this, 'get_post_views_permissions_check' ),
|
572 |
+
'args' => array(
|
573 |
+
'id' => array(
|
574 |
+
'default' => 0
|
575 |
+
)
|
576 |
+
)
|
577 |
+
) );
|
578 |
+
}
|
579 |
+
|
580 |
+
/**
|
581 |
+
* Get post views via REST API request.
|
582 |
+
*
|
583 |
+
* @param array $request
|
584 |
+
* @return int
|
585 |
+
*/
|
586 |
+
public function get_post_views_rest_api( $request ) {
|
587 |
+
$post_id = is_array( $request['id'] ) ? array_map( 'absint', $request['id'] ) : absint( $request['id'] );
|
588 |
+
|
589 |
+
// do we use REST API as counter?
|
590 |
+
if ( Post_Views_Counter()->options['general']['counter_mode'] != 'rest_api' )
|
591 |
+
return new WP_Error( 'pvc_rest_api_disabled', __( 'REST API method is disabled.', 'post-views-counter' ), array( 'status' => 404 ) );
|
592 |
+
|
593 |
+
return pvc_get_post_views( $post_id );
|
594 |
+
}
|
595 |
+
|
596 |
+
/**
|
597 |
+
* Check if a given request has access to get views
|
598 |
+
*
|
599 |
+
* @param WP_REST_Request $request Full data about the request.
|
600 |
+
* @return WP_Error|bool
|
601 |
+
*/
|
602 |
+
public function get_post_views_permissions_check( $request ) {
|
603 |
+
return (bool) apply_filters( 'pvc_rest_api_get_post_views_check', current_user_can( 'read_posts' ), $request );
|
604 |
+
}
|
605 |
|
606 |
+
}
|
includes/cron.php
CHANGED
@@ -28,7 +28,14 @@ class Post_Views_Counter_Cron {
|
|
28 |
public function reset_counts() {
|
29 |
global $wpdb;
|
30 |
|
31 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
|
34 |
/**
|
@@ -50,7 +57,7 @@ class Post_Views_Counter_Cron {
|
|
50 |
*/
|
51 |
public function cron_time_intervals( $schedules ) {
|
52 |
$schedules['post_views_counter_interval'] = array(
|
53 |
-
'interval' =>
|
54 |
'display' => __( 'Post Views Counter reset daily counts interval', 'post-views-counter' )
|
55 |
);
|
56 |
|
@@ -89,7 +96,7 @@ class Post_Views_Counter_Cron {
|
|
89 |
}
|
90 |
|
91 |
// set schedule
|
92 |
-
wp_schedule_event(
|
93 |
}
|
94 |
} else {
|
95 |
// remove schedule
|
28 |
public function reset_counts() {
|
29 |
global $wpdb;
|
30 |
|
31 |
+
$counter = array(
|
32 |
+
'days' => 1,
|
33 |
+
'weeks' => 7,
|
34 |
+
'months' => 30,
|
35 |
+
'years' => 365
|
36 |
+
);
|
37 |
+
|
38 |
+
$wpdb->query( 'DELETE FROM ' . $wpdb->prefix . 'post_views WHERE type = 0 AND CAST( period AS SIGNED ) < CAST( ' . date( 'Ymd', strtotime( '-' . ( (int) ( $counter[Post_Views_Counter()->options['general']['reset_counts']['type']] * Post_Views_Counter()->options['general']['reset_counts']['number'] ) ) . ' days' ) ) . ' AS SIGNED)' );
|
39 |
}
|
40 |
|
41 |
/**
|
57 |
*/
|
58 |
public function cron_time_intervals( $schedules ) {
|
59 |
$schedules['post_views_counter_interval'] = array(
|
60 |
+
'interval' => 86400,
|
61 |
'display' => __( 'Post Views Counter reset daily counts interval', 'post-views-counter' )
|
62 |
);
|
63 |
|
96 |
}
|
97 |
|
98 |
// set schedule
|
99 |
+
wp_schedule_event( current_time( 'timestamp', true ) + 86400, 'post_views_counter_interval', 'pvc_reset_counts' );
|
100 |
}
|
101 |
} else {
|
102 |
// remove schedule
|
includes/dashboard.php
CHANGED
@@ -55,6 +55,7 @@ class Post_Views_Counter_Dashboard {
|
|
55 |
/**
|
56 |
* Dashboard widget chart data function.
|
57 |
*
|
|
|
58 |
* @return mixed
|
59 |
*/
|
60 |
public function dashboard_widget_chart() {
|
@@ -65,7 +66,7 @@ class Post_Views_Counter_Dashboard {
|
|
65 |
if ( ! check_ajax_referer( 'dashboard-chart', 'nonce' ) )
|
66 |
wp_die( __( 'You do not have permission to access this page.', 'post-views-counter' ) );
|
67 |
|
68 |
-
$period = isset( $_REQUEST['period'] ) ? esc_attr( $_REQUEST['period'] ) : 'this_month';
|
69 |
|
70 |
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
71 |
|
@@ -80,12 +81,21 @@ class Post_Views_Counter_Dashboard {
|
|
80 |
);
|
81 |
|
82 |
// set range
|
83 |
-
$
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
// set chart labels
|
87 |
switch ( $range ) {
|
88 |
-
case 'this_week'
|
89 |
$data = array(
|
90 |
'text' => array(
|
91 |
'xAxes' => date_i18n( 'F Y' ),
|
@@ -104,20 +114,19 @@ class Post_Views_Counter_Dashboard {
|
|
104 |
}
|
105 |
break;
|
106 |
|
107 |
-
case '
|
108 |
-
default :
|
109 |
$data = array(
|
110 |
'text' => array(
|
111 |
-
'xAxes' =>
|
112 |
'yAxes' => __( 'Post Views', 'post-views-counter' ),
|
113 |
),
|
114 |
'design' => array(
|
115 |
'fill' => true,
|
116 |
-
'backgroundColor' => 'rgba(
|
117 |
-
'borderColor' => 'rgba(
|
118 |
-
'borderWidth' => 2,
|
119 |
'borderDash' => array(),
|
120 |
-
'pointBorderColor' => 'rgba(
|
121 |
'pointBackgroundColor' => 'rgba(255, 255, 255, 1)',
|
122 |
'pointBorderWidth' => 1.2
|
123 |
)
|
@@ -131,54 +140,121 @@ class Post_Views_Counter_Dashboard {
|
|
131 |
// reindex post types
|
132 |
$post_types = array_combine( range( 1, count( $post_types ) ), array_values( $post_types ) );
|
133 |
|
|
|
|
|
134 |
foreach ( $post_types as $id => $post_type ) {
|
135 |
$empty_post_type_views[$post_type] = 0;
|
136 |
$post_type_obj = get_post_type_object( $post_type );
|
137 |
|
138 |
$data['data']['datasets'][$id]['label'] = $post_type_obj->labels->name;
|
139 |
$data['data']['datasets'][$id]['data'] = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
}
|
141 |
|
142 |
-
|
143 |
-
$rev_post_types = array_flip( $post_types );
|
144 |
|
145 |
-
|
146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
-
|
149 |
|
150 |
-
|
|
|
151 |
|
152 |
-
|
153 |
-
|
154 |
|
155 |
-
|
156 |
-
foreach ( $query->posts as $index => $post ) {
|
157 |
-
$post_type_views[$post->post_type] += $post->post_views;
|
158 |
-
}
|
159 |
-
}
|
160 |
-
} else {
|
161 |
|
162 |
-
|
|
|
|
|
163 |
|
164 |
-
|
165 |
-
|
166 |
-
}
|
167 |
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
-
|
172 |
-
$data['data']['labels'][] = ( $i % 2 === 0 ? '' : $i );
|
173 |
-
$data['data']['dates'][] = date_i18n( get_option( 'date_format' ), strtotime( date( 'Y' ) . '-' . date( 'n' ) . '-' . str_pad( $i, 2, '0', STR_PAD_LEFT ) ) );
|
174 |
-
$data['data']['datasets'][0]['data'][] = $query->total_views;
|
175 |
|
176 |
-
|
177 |
-
foreach ( $
|
178 |
-
|
|
|
|
|
179 |
}
|
180 |
}
|
181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
break;
|
183 |
}
|
184 |
|
@@ -228,4 +304,27 @@ class Post_Views_Counter_Dashboard {
|
|
228 |
);
|
229 |
}
|
230 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
231 |
}
|
55 |
/**
|
56 |
* Dashboard widget chart data function.
|
57 |
*
|
58 |
+
* @global $_wp_admin_css_colors
|
59 |
* @return mixed
|
60 |
*/
|
61 |
public function dashboard_widget_chart() {
|
66 |
if ( ! check_ajax_referer( 'dashboard-chart', 'nonce' ) )
|
67 |
wp_die( __( 'You do not have permission to access this page.', 'post-views-counter' ) );
|
68 |
|
69 |
+
// $period = isset( $_REQUEST['period'] ) ? esc_attr( $_REQUEST['period'] ) : 'this_month';
|
70 |
|
71 |
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
72 |
|
81 |
);
|
82 |
|
83 |
// set range
|
84 |
+
$this_month = 'this_year';
|
85 |
+
|
86 |
+
// $now = getdate( current_time( 'timestamp', get_option( 'gmt_offset' ) ) );
|
87 |
+
$now = getdate( current_time( 'timestamp', get_option( 'gmt_offset' ) ) - 2592000 );
|
88 |
+
|
89 |
+
// get admin color scheme
|
90 |
+
global $_wp_admin_css_colors;
|
91 |
+
|
92 |
+
$admin_color = get_user_option( 'admin_color' );
|
93 |
+
$colors = $_wp_admin_css_colors[$admin_color]->colors;
|
94 |
+
$color = $this->hex2rgb( $colors[2] );
|
95 |
|
96 |
// set chart labels
|
97 |
switch ( $range ) {
|
98 |
+
case 'this_week':
|
99 |
$data = array(
|
100 |
'text' => array(
|
101 |
'xAxes' => date_i18n( 'F Y' ),
|
114 |
}
|
115 |
break;
|
116 |
|
117 |
+
case 'this_year':
|
|
|
118 |
$data = array(
|
119 |
'text' => array(
|
120 |
+
'xAxes' => __( 'Year', 'post-views-counter' ) . date( ' Y' ),
|
121 |
'yAxes' => __( 'Post Views', 'post-views-counter' ),
|
122 |
),
|
123 |
'design' => array(
|
124 |
'fill' => true,
|
125 |
+
'backgroundColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 0.2)',
|
126 |
+
'borderColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 1)',
|
127 |
+
'borderWidth' => 1.2,
|
128 |
'borderDash' => array(),
|
129 |
+
'pointBorderColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 1)',
|
130 |
'pointBackgroundColor' => 'rgba(255, 255, 255, 1)',
|
131 |
'pointBorderWidth' => 1.2
|
132 |
)
|
140 |
// reindex post types
|
141 |
$post_types = array_combine( range( 1, count( $post_types ) ), array_values( $post_types ) );
|
142 |
|
143 |
+
$post_type_data = array();
|
144 |
+
|
145 |
foreach ( $post_types as $id => $post_type ) {
|
146 |
$empty_post_type_views[$post_type] = 0;
|
147 |
$post_type_obj = get_post_type_object( $post_type );
|
148 |
|
149 |
$data['data']['datasets'][$id]['label'] = $post_type_obj->labels->name;
|
150 |
$data['data']['datasets'][$id]['data'] = array();
|
151 |
+
|
152 |
+
// get month views
|
153 |
+
$post_type_data[$id] = array_values(
|
154 |
+
pvc_get_views(
|
155 |
+
array(
|
156 |
+
'fields' => 'date=>views',
|
157 |
+
'post_type' => $post_type,
|
158 |
+
'views_query' => array(
|
159 |
+
'year' => date( 'Y' ),
|
160 |
+
'month' => '',
|
161 |
+
'week' => '',
|
162 |
+
'day' => ''
|
163 |
+
)
|
164 |
+
)
|
165 |
+
)
|
166 |
+
);
|
167 |
}
|
168 |
|
169 |
+
$sum = array();
|
|
|
170 |
|
171 |
+
foreach ( $post_type_data as $post_type_id => $post_views ) {
|
172 |
+
foreach ( $post_views as $id => $views ) {
|
173 |
+
// generate chart data for specific post types
|
174 |
+
$data['data']['datasets'][$post_type_id]['data'][] = $views;
|
175 |
+
$sum[$id] += $views;
|
176 |
+
}
|
177 |
+
}
|
178 |
+
|
179 |
+
// this month all days
|
180 |
+
for ( $i = 1; $i <= 12; $i ++ ) {
|
181 |
+
// generate chart data
|
182 |
+
$data['data']['labels'][] = $i;
|
183 |
+
$data['data']['dates'][] = date_i18n( 'F Y', strtotime( date( 'Y' ) . '-' . str_pad( $i, 2, '0', STR_PAD_LEFT ) . '-01' ) );
|
184 |
+
$data['data']['datasets'][0]['data'][] = $sum[$i - 1];
|
185 |
+
}
|
186 |
+
break;
|
187 |
+
|
188 |
+
case 'this_month':
|
189 |
+
default :
|
190 |
+
$data = array(
|
191 |
+
'text' => array(
|
192 |
+
'xAxes' => date_i18n( 'F Y' ),
|
193 |
+
'yAxes' => __( 'Post Views', 'post-views-counter' ),
|
194 |
+
),
|
195 |
+
'design' => array(
|
196 |
+
'fill' => true,
|
197 |
+
'backgroundColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 0.2)',
|
198 |
+
'borderColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 1)',
|
199 |
+
'borderWidth' => 1.2,
|
200 |
+
'borderDash' => array(),
|
201 |
+
'pointBorderColor' => 'rgba(' . $color['r'] . ',' . $color['g'] . ',' . $color['b'] . ', 1)',
|
202 |
+
'pointBackgroundColor' => 'rgba(255, 255, 255, 1)',
|
203 |
+
'pointBorderWidth' => 1.2
|
204 |
+
)
|
205 |
+
);
|
206 |
|
207 |
+
$data['data']['datasets'][0]['label'] = __( 'Total Views', 'post-views-counter' );
|
208 |
|
209 |
+
// get data for specific post types
|
210 |
+
$empty_post_type_views = array();
|
211 |
|
212 |
+
// reindex post types
|
213 |
+
$post_types = array_combine( range( 1, count( $post_types ) ), array_values( $post_types ) );
|
214 |
|
215 |
+
$post_type_data = array();
|
|
|
|
|
|
|
|
|
|
|
216 |
|
217 |
+
foreach ( $post_types as $id => $post_type ) {
|
218 |
+
$empty_post_type_views[$post_type] = 0;
|
219 |
+
$post_type_obj = get_post_type_object( $post_type );
|
220 |
|
221 |
+
$data['data']['datasets'][$id]['label'] = $post_type_obj->labels->name;
|
222 |
+
$data['data']['datasets'][$id]['data'] = array();
|
|
|
223 |
|
224 |
+
// get month views
|
225 |
+
$post_type_data[$id] = array_values(
|
226 |
+
pvc_get_views(
|
227 |
+
array(
|
228 |
+
'fields' => 'date=>views',
|
229 |
+
'post_type' => $post_type,
|
230 |
+
'views_query' => array(
|
231 |
+
'year' => date( 'Y' ),
|
232 |
+
'month' => date( 'm' ),
|
233 |
+
'week' => '',
|
234 |
+
'day' => ''
|
235 |
+
)
|
236 |
+
)
|
237 |
+
)
|
238 |
+
);
|
239 |
+
}
|
240 |
|
241 |
+
$sum = array();
|
|
|
|
|
|
|
242 |
|
243 |
+
foreach ( $post_type_data as $post_type_id => $post_views ) {
|
244 |
+
foreach ( $post_views as $id => $views ) {
|
245 |
+
// generate chart data for specific post types
|
246 |
+
$data['data']['datasets'][$post_type_id]['data'][] = $views;
|
247 |
+
$sum[$id] += $views;
|
248 |
}
|
249 |
}
|
250 |
|
251 |
+
// this month all days
|
252 |
+
for ( $i = 1; $i <= date( 't' ); $i ++ ) {
|
253 |
+
// generate chart data
|
254 |
+
$data['data']['labels'][] = ( $i % 2 === 0 ? '' : $i );
|
255 |
+
$data['data']['dates'][] = date_i18n( get_option( 'date_format' ), strtotime( date( 'Y' ) . '-' . date( 'm' ) . '-' . str_pad( $i, 2, '0', STR_PAD_LEFT ) ) );
|
256 |
+
$data['data']['datasets'][0]['data'][] = $sum[$i - 1];
|
257 |
+
}
|
258 |
break;
|
259 |
}
|
260 |
|
304 |
);
|
305 |
}
|
306 |
|
307 |
+
/**
|
308 |
+
* Convert hex to rgb color.
|
309 |
+
*
|
310 |
+
* @param type $color
|
311 |
+
* @return boolean
|
312 |
+
*/
|
313 |
+
public function hex2rgb( $color ) {
|
314 |
+
if ( $color[0] == '#' ) {
|
315 |
+
$color = substr( $color, 1 );
|
316 |
+
}
|
317 |
+
if ( strlen( $color ) == 6 ) {
|
318 |
+
list( $r, $g, $b ) = array( $color[0] . $color[1], $color[2] . $color[3], $color[4] . $color[5] );
|
319 |
+
} elseif ( strlen( $color ) == 3 ) {
|
320 |
+
list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
|
321 |
+
} else {
|
322 |
+
return false;
|
323 |
+
}
|
324 |
+
$r = hexdec( $r );
|
325 |
+
$g = hexdec( $g );
|
326 |
+
$b = hexdec( $b );
|
327 |
+
return array( 'r' => $r, 'g' => $g, 'b' => $b );
|
328 |
+
}
|
329 |
+
|
330 |
}
|
includes/frontend.php
CHANGED
@@ -13,7 +13,7 @@ class Post_Views_Counter_Frontend {
|
|
13 |
public function __construct() {
|
14 |
// actions
|
15 |
add_action( 'after_setup_theme', array( $this, 'register_shortcode' ) );
|
16 |
-
add_action( 'wp_enqueue_scripts', array( $this, '
|
17 |
add_action( 'wp', array( $this, 'run' ) );
|
18 |
}
|
19 |
|
@@ -152,37 +152,36 @@ class Post_Views_Counter_Frontend {
|
|
152 |
/**
|
153 |
* Enqueue frontend scripts and styles.
|
154 |
*/
|
155 |
-
public function
|
156 |
-
$
|
|
|
157 |
|
158 |
if ( (bool) apply_filters( 'pvc_enqueue_styles', true ) === true ) {
|
159 |
// load dashicons
|
160 |
wp_enqueue_style( 'dashicons' );
|
161 |
|
162 |
// load style
|
163 |
-
wp_enqueue_style( 'post-views-counter-frontend', POST_VIEWS_COUNTER_URL . '/css/frontend.css' );
|
164 |
}
|
165 |
|
166 |
-
if (
|
167 |
-
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
168 |
-
|
169 |
// whether to count this post type or not
|
170 |
if ( empty( $post_types ) || ! is_singular( $post_types ) )
|
171 |
return;
|
172 |
|
173 |
wp_register_script(
|
174 |
-
|
175 |
);
|
176 |
|
177 |
wp_enqueue_script( 'post-views-counter-frontend' );
|
178 |
|
179 |
wp_localize_script(
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
);
|
187 |
}
|
188 |
}
|
13 |
public function __construct() {
|
14 |
// actions
|
15 |
add_action( 'after_setup_theme', array( $this, 'register_shortcode' ) );
|
16 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) );
|
17 |
add_action( 'wp', array( $this, 'run' ) );
|
18 |
}
|
19 |
|
152 |
/**
|
153 |
* Enqueue frontend scripts and styles.
|
154 |
*/
|
155 |
+
public function wp_enqueue_scripts() {
|
156 |
+
$mode = Post_Views_Counter()->options['general']['counter_mode'];
|
157 |
+
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
158 |
|
159 |
if ( (bool) apply_filters( 'pvc_enqueue_styles', true ) === true ) {
|
160 |
// load dashicons
|
161 |
wp_enqueue_style( 'dashicons' );
|
162 |
|
163 |
// load style
|
164 |
+
wp_enqueue_style( 'post-views-counter-frontend', POST_VIEWS_COUNTER_URL . '/css/frontend.css', array(), Post_Views_Counter()->defaults['version'] );
|
165 |
}
|
166 |
|
167 |
+
if ( in_array( $mode, array( 'js', 'rest_api' ) ) ) {
|
|
|
|
|
168 |
// whether to count this post type or not
|
169 |
if ( empty( $post_types ) || ! is_singular( $post_types ) )
|
170 |
return;
|
171 |
|
172 |
wp_register_script(
|
173 |
+
'post-views-counter-frontend', POST_VIEWS_COUNTER_URL . '/js/frontend.js', array( 'jquery' ), Post_Views_Counter()->defaults['version'], true
|
174 |
);
|
175 |
|
176 |
wp_enqueue_script( 'post-views-counter-frontend' );
|
177 |
|
178 |
wp_localize_script(
|
179 |
+
'post-views-counter-frontend', 'pvcArgsFrontend', array(
|
180 |
+
'mode' => $mode,
|
181 |
+
'requestURL' => esc_url_raw( $mode == 'rest_api' ? rest_url( 'post-views-counter/view-post/') : admin_url( 'admin-ajax.php' ) ),
|
182 |
+
'postID' => get_the_ID(),
|
183 |
+
'nonce' => ( $mode == 'rest_api' ? wp_create_nonce( 'wp_rest' ) : wp_create_nonce( 'pvc-check-post' ) )
|
184 |
+
)
|
185 |
);
|
186 |
}
|
187 |
}
|
includes/functions.php
CHANGED
@@ -15,8 +15,9 @@ if ( ! defined( 'ABSPATH' ) )
|
|
15 |
/**
|
16 |
* Get post views for a post or array of posts.
|
17 |
*
|
|
|
18 |
* @param int|array $post_id
|
19 |
-
* @return
|
20 |
*/
|
21 |
if ( ! function_exists( 'pvc_get_post_views' ) ) {
|
22 |
|
@@ -31,17 +32,202 @@ if ( ! function_exists( 'pvc_get_post_views' ) ) {
|
|
31 |
|
32 |
global $wpdb;
|
33 |
|
34 |
-
$
|
35 |
-
SELECT SUM(count) AS views
|
36 |
FROM " . $wpdb->prefix . "post_views
|
37 |
-
WHERE id IN (" . $post_id . ") AND type = 4"
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
|
40 |
return apply_filters( 'pvc_get_post_views', $post_views, $post_id );
|
41 |
}
|
42 |
|
43 |
}
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
/**
|
46 |
* Display post views for a given post.
|
47 |
*
|
@@ -58,17 +244,21 @@ if ( ! function_exists( 'pvc_post_views' ) ) {
|
|
58 |
$options = Post_Views_Counter()->options['display'];
|
59 |
$views = pvc_get_post_views( $post_id );
|
60 |
|
61 |
-
//
|
62 |
-
$label = apply_filters( 'pvc_post_views_label', (function_exists( 'icl_t' ) ? icl_t( 'Post Views Counter', 'Post Views Label', $options['label'] ) : $options['label'] ), $post_id );
|
63 |
-
|
64 |
-
$
|
|
|
|
|
|
|
|
|
65 |
|
66 |
$html = apply_filters(
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
);
|
73 |
|
74 |
if ( $echo )
|
@@ -89,11 +279,11 @@ if ( ! function_exists( 'pvc_get_most_viewed_posts' ) ) {
|
|
89 |
|
90 |
function pvc_get_most_viewed_posts( $args = array() ) {
|
91 |
$args = array_merge(
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
);
|
98 |
|
99 |
$args = apply_filters( 'pvc_get_most_viewed_posts_args', $args );
|
15 |
/**
|
16 |
* Get post views for a post or array of posts.
|
17 |
*
|
18 |
+
* @global $wpdb
|
19 |
* @param int|array $post_id
|
20 |
+
* @return int
|
21 |
*/
|
22 |
if ( ! function_exists( 'pvc_get_post_views' ) ) {
|
23 |
|
32 |
|
33 |
global $wpdb;
|
34 |
|
35 |
+
$query = "SELECT SUM(count) AS views
|
|
|
36 |
FROM " . $wpdb->prefix . "post_views
|
37 |
+
WHERE id IN (" . $post_id . ") AND type = 4";
|
38 |
+
|
39 |
+
// get cached data
|
40 |
+
$post_views = wp_cache_get( md5( $query ), 'pvc-get_post_views' );
|
41 |
+
|
42 |
+
// cached data not found?
|
43 |
+
if ( $post_views === false ) {
|
44 |
+
$post_views = (int) $wpdb->get_var( $query );
|
45 |
+
|
46 |
+
wp_cache_add( md5( $query ), $post_views, 'pvc-get_post_views' );
|
47 |
+
}
|
48 |
|
49 |
return apply_filters( 'pvc_get_post_views', $post_views, $post_id );
|
50 |
}
|
51 |
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Get views query.
|
56 |
+
*
|
57 |
+
* @global $wpdb
|
58 |
+
* @param array $args
|
59 |
+
* @return int|array
|
60 |
+
*/
|
61 |
+
if ( ! function_exists( 'pvc_get_views' ) ) {
|
62 |
+
|
63 |
+
function pvc_get_views( $args = array() ) {
|
64 |
+
$range = array();
|
65 |
+
$defaults = array(
|
66 |
+
'fields' => 'views',
|
67 |
+
'post_type' => 'post',
|
68 |
+
'views_query' => array(
|
69 |
+
'year' => '',
|
70 |
+
'month' => '',
|
71 |
+
'week' => '',
|
72 |
+
'day' => ''
|
73 |
+
)
|
74 |
+
);
|
75 |
+
|
76 |
+
$args = apply_filters( 'pvc_get_views_args', array_merge( $defaults, $args ) );
|
77 |
+
|
78 |
+
// check post type
|
79 |
+
if ( empty( $args['post_type'] ) )
|
80 |
+
$args['post_type'] = $defaults['post_type'];
|
81 |
+
|
82 |
+
// check fields
|
83 |
+
if ( ! in_array( $args['fields'], array( 'views', 'date=>views' ), true ) )
|
84 |
+
$args['fields'] = $defaults['fields'];
|
85 |
+
|
86 |
+
// check views query
|
87 |
+
if ( ! is_array( $args['views_query'] ) )
|
88 |
+
$args['views_query'] = $defaults['views_query'];
|
89 |
+
|
90 |
+
// check views query year
|
91 |
+
if ( ! empty( $args['views_query']['year'] ) )
|
92 |
+
$year = str_pad( (int) $args['views_query']['year'], 4, 0, STR_PAD_LEFT );
|
93 |
+
|
94 |
+
// check views query month
|
95 |
+
if ( ! empty( $args['views_query']['month'] ) )
|
96 |
+
$month = str_pad( (int) $args['views_query']['month'], 2, 0, STR_PAD_LEFT );
|
97 |
+
|
98 |
+
// check views query week
|
99 |
+
if ( ! empty( $args['views_query']['week'] ) )
|
100 |
+
$week = str_pad( (int) $args['views_query']['week'], 2, 0, STR_PAD_LEFT );
|
101 |
+
|
102 |
+
// check views query day
|
103 |
+
if ( ! empty( $args['views_query']['day'] ) )
|
104 |
+
$day = str_pad( (int) $args['views_query']['day'], 2, 0, STR_PAD_LEFT );
|
105 |
+
|
106 |
+
// year
|
107 |
+
if ( isset( $year ) ) {
|
108 |
+
// year, week
|
109 |
+
if ( isset( $week ) ) {
|
110 |
+
if ( $args['fields'] === 'date=>views' ) {
|
111 |
+
// create date based on week number
|
112 |
+
$date = new DateTime( $year . 'W' . $week );
|
113 |
+
|
114 |
+
// get monday
|
115 |
+
$monday = $date->format( 'd' );
|
116 |
+
|
117 |
+
// get month of monday
|
118 |
+
$monday_month = $date->format( 'm' );
|
119 |
+
|
120 |
+
// prepare range
|
121 |
+
for( $i = 1; $i <= 6; $i++ ) {
|
122 |
+
$range[(string) ( $date->format( 'Y' ) . $date->format( 'm' ) . $date->format( 'd' ) )] = 0;
|
123 |
+
|
124 |
+
$date->modify( '+1days' );
|
125 |
+
}
|
126 |
+
|
127 |
+
$range[(string) ( $date->format( 'Y' ) . $date->format( 'm' ) . $date->format( 'd' ) )] = 0;
|
128 |
+
|
129 |
+
// get month of sunday
|
130 |
+
$sunday_month = $date->format( 'm' );
|
131 |
+
|
132 |
+
$query = " AND pvc.type = 0 AND pvc.period >= '" . $year . $monday_month . $monday . "' AND pvc.period <= " . $date->format( 'Y' ) . $sunday_month . $date->format( 'd' );
|
133 |
+
} else
|
134 |
+
$query = " AND pvc.type = 1 AND pvc.period = '" . $year . $week . "'";
|
135 |
+
// year, month
|
136 |
+
} elseif ( isset( $month ) ) {
|
137 |
+
// year, month, day
|
138 |
+
if ( isset( $day ) ) {
|
139 |
+
if ( $args['fields'] === 'date=>views' )
|
140 |
+
// prepare range
|
141 |
+
$range[(string) ( $year . $month . $day )] = 0;
|
142 |
+
|
143 |
+
$query = " AND pvc.type = 0 AND pvc.period = '" . $year . $month . $day . "'";
|
144 |
+
// year, month
|
145 |
+
} else {
|
146 |
+
if ( $args['fields'] === 'date=>views' ) {
|
147 |
+
// create date
|
148 |
+
$date = new DateTime( $year . '-' . $month . '-01' );
|
149 |
+
|
150 |
+
// get last day
|
151 |
+
$last = $date->format( 't' );
|
152 |
+
|
153 |
+
// prepare range
|
154 |
+
for( $i = 1; $i <= $last; $i++ ) {
|
155 |
+
$range[(string) ( $year . $month . str_pad( $i, 2, 0, STR_PAD_LEFT ) )] = 0;
|
156 |
+
}
|
157 |
+
|
158 |
+
$query = " AND pvc.type = 0 AND pvc.period >= '" . $year . $month . "01' AND pvc.period <= " . $year . $month . $last;
|
159 |
+
} else
|
160 |
+
$query = " AND pvc.type = 2 AND pvc.period = '" . $year . $month . "'";
|
161 |
+
}
|
162 |
+
// year
|
163 |
+
} else {
|
164 |
+
if ( $args['fields'] === 'date=>views' ) {
|
165 |
+
// prepare range
|
166 |
+
for( $i = 1; $i <= 12; $i++ ) {
|
167 |
+
$range[(string) ( $year . str_pad( $i, 2, 0, STR_PAD_LEFT ) )] = 0;
|
168 |
+
}
|
169 |
+
|
170 |
+
// create date
|
171 |
+
$date = new DateTime( $year . '-12-01' );
|
172 |
+
|
173 |
+
$query = " AND pvc.type = 2 AND pvc.period >= '" . $year . "01' AND pvc.period <= " . $year . "12";
|
174 |
+
} else
|
175 |
+
$query = " AND pvc.type = 3 AND pvc.period = '" . $year . "'";
|
176 |
+
}
|
177 |
+
// month
|
178 |
+
} elseif ( isset( $month ) ) {
|
179 |
+
// month, day
|
180 |
+
if ( isset( $day ) ) {
|
181 |
+
$query = " AND pvc.type = 0 AND RIGHT( pvc.period, 4 ) = '" . $month . $day . "'";
|
182 |
+
// month
|
183 |
+
} else {
|
184 |
+
$query = " AND pvc.type = 2 AND RIGHT( pvc.period, 2 ) = '" . $month . "'";
|
185 |
+
}
|
186 |
+
// week
|
187 |
+
} elseif ( isset( $week ) ) {
|
188 |
+
$query = " AND pvc.type = 1 AND RIGHT( pvc.period, 2 ) = '" . $week . "'";
|
189 |
+
// day
|
190 |
+
} elseif ( isset( $day ) ) {
|
191 |
+
$query = " AND pvc.type = 0 AND RIGHT( pvc.period, 2 ) = '" . $day . "'";
|
192 |
+
}
|
193 |
+
|
194 |
+
global $wpdb;
|
195 |
+
|
196 |
+
$query = "SELECT " . ( $args['fields'] === 'date=>views' ? 'pvc.period, ' : '' ) . "SUM( IFNULL( pvc.count, 0 ) ) AS post_views
|
197 |
+
FROM " . $wpdb->prefix . "posts wpp
|
198 |
+
LEFT JOIN wp_post_views pvc ON pvc.id = wpp.ID " . $query . "
|
199 |
+
WHERE wpp.post_type = '" . $args['post_type'] . "'
|
200 |
+
GROUP BY pvc.period
|
201 |
+
HAVING post_views > 0";
|
202 |
+
|
203 |
+
// get cached data
|
204 |
+
$post_views = wp_cache_get( md5( $query ), 'pvc-get_views' );
|
205 |
+
|
206 |
+
// cached data not found?
|
207 |
+
if ( $post_views === false ) {
|
208 |
+
if ( $args['fields'] === 'date=>views' && ! empty( $range ) ) {
|
209 |
+
$results = $wpdb->get_results( $query );
|
210 |
+
|
211 |
+
if ( ! empty( $results ) ) {
|
212 |
+
foreach( $results as $row ) {
|
213 |
+
$range[$row->period] = (int) $row->post_views;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
|
217 |
+
$post_views = $range;
|
218 |
+
} else {
|
219 |
+
$post_views = (int) $wpdb->get_var( $query );
|
220 |
+
}
|
221 |
+
|
222 |
+
// cache results
|
223 |
+
wp_cache_add( md5( $query ), $post_views, 'pvc-get_views' );
|
224 |
+
}
|
225 |
+
|
226 |
+
return apply_filters( 'pvc_get_views', $post_views );
|
227 |
+
}
|
228 |
+
|
229 |
+
}
|
230 |
+
|
231 |
/**
|
232 |
* Display post views for a given post.
|
233 |
*
|
244 |
$options = Post_Views_Counter()->options['display'];
|
245 |
$views = pvc_get_post_views( $post_id );
|
246 |
|
247 |
+
// prepare display
|
248 |
+
$label = apply_filters( 'pvc_post_views_label', ( function_exists( 'icl_t' ) ? icl_t( 'Post Views Counter', 'Post Views Label', $options['label'] ) : $options['label'] ), $post_id );
|
249 |
+
// get icon
|
250 |
+
$icon_class = ( $options['icon_class'] !== '' ? esc_attr( $options['icon_class'] ) : '' );
|
251 |
+
// add dashicons class if needed
|
252 |
+
$icon_class = strpos( $icon_class, 'dashicons' ) === 0 ? 'dashicons ' . $icon_class : $icon_class;
|
253 |
+
|
254 |
+
$icon = apply_filters( 'pvc_post_views_icon', '<span class="post-views-icon ' . $icon_class . '"></span>', $post_id );
|
255 |
|
256 |
$html = apply_filters(
|
257 |
+
'pvc_post_views_html', '<div class="post-views post-' . $post_id . ' entry-meta">
|
258 |
+
' . ($options['display_style']['icon'] && $icon_class !== '' ? $icon : '') . '
|
259 |
+
' . ($options['display_style']['text'] ? '<span class="post-views-label">' . $label . ' </span>' : '') . '
|
260 |
+
<span class="post-views-count">' . number_format_i18n( $views ) . '</span>
|
261 |
+
</div>', $post_id, $views, $label, $icon
|
262 |
);
|
263 |
|
264 |
if ( $echo )
|
279 |
|
280 |
function pvc_get_most_viewed_posts( $args = array() ) {
|
281 |
$args = array_merge(
|
282 |
+
array(
|
283 |
+
'posts_per_page' => 10,
|
284 |
+
'order' => 'desc',
|
285 |
+
'post_type' => 'post'
|
286 |
+
), $args
|
287 |
);
|
288 |
|
289 |
$args = apply_filters( 'pvc_get_most_viewed_posts_args', $args );
|
includes/settings.php
CHANGED
@@ -38,9 +38,13 @@ class Post_Views_Counter_Settings {
|
|
38 |
return;
|
39 |
|
40 |
$this->modes = array(
|
41 |
-
'php'
|
42 |
-
'js'
|
43 |
);
|
|
|
|
|
|
|
|
|
44 |
|
45 |
$this->time_types = array(
|
46 |
'minutes' => __( 'minutes', 'post-views-counter' ),
|
@@ -174,13 +178,13 @@ class Post_Views_Counter_Settings {
|
|
174 |
<h3 class="hndle">' . __( 'Post Views Counter', 'post-views-counter' ) . ' ' . Post_Views_Counter()->defaults['version'] . '</h3>
|
175 |
<div class="inside">
|
176 |
<h4 class="inner">' . __( 'Need support?', 'post-views-counter' ) . '</h4>
|
177 |
-
<p class="inner">' . __( 'If you are having problems with this plugin, please talk about them in the', 'post-views-counter' )
|
178 |
<hr />
|
179 |
<h4 class="inner">' . __( 'Do you like this plugin?', 'post-views-counter' ) . '</h4>
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
<hr />
|
185 |
<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>
|
186 |
</div>
|
@@ -224,7 +228,7 @@ class Post_Views_Counter_Settings {
|
|
224 |
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' );
|
225 |
add_settings_field( 'pvc_exclude', __( 'Exclude Visitors', 'post-views-counter' ), array( $this, 'exclude' ), 'post_views_counter_settings_general', 'post_views_counter_settings_general' );
|
226 |
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' );
|
227 |
-
add_settings_field( 'pvc_wp_postviews', __( '
|
228 |
add_settings_field( 'pvc_deactivation_delete', __( 'Deactivation', 'post-views-counter' ), array( $this, 'deactivation_delete' ), 'post_views_counter_settings_general', 'post_views_counter_settings_general' );
|
229 |
|
230 |
// display options
|
@@ -247,7 +251,7 @@ class Post_Views_Counter_Settings {
|
|
247 |
<div id="pvc_post_views_label">
|
248 |
<fieldset>
|
249 |
<input type="text" class="large-text" name="post_views_counter_settings_display[label]" value="' . esc_attr( Post_Views_Counter()->options['display']['label'] ) . '" />
|
250 |
-
<p class="description">' .
|
251 |
</fieldset>
|
252 |
</div>';
|
253 |
}
|
@@ -265,7 +269,7 @@ class Post_Views_Counter_Settings {
|
|
265 |
}
|
266 |
|
267 |
echo '
|
268 |
-
<p class="description">' .
|
269 |
</div>';
|
270 |
}
|
271 |
|
@@ -282,7 +286,7 @@ class Post_Views_Counter_Settings {
|
|
282 |
}
|
283 |
|
284 |
echo '
|
285 |
-
<p class="description">' .
|
286 |
</div>';
|
287 |
}
|
288 |
|
@@ -301,7 +305,7 @@ class Post_Views_Counter_Settings {
|
|
301 |
}
|
302 |
|
303 |
echo '
|
304 |
-
<p class="description">' .
|
305 |
</div>';
|
306 |
}
|
307 |
|
@@ -311,7 +315,7 @@ class Post_Views_Counter_Settings {
|
|
311 |
public function post_views_column() {
|
312 |
echo '
|
313 |
<div id="pvc_post_views_column">
|
314 |
-
<label class="cb-checkbox"><input id="pvc-post-views-column-enable" type="checkbox" name="post_views_counter_settings_general[post_views_column]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['post_views_column'], false ) . ' />' .
|
315 |
</div>';
|
316 |
}
|
317 |
|
@@ -331,7 +335,7 @@ class Post_Views_Counter_Settings {
|
|
331 |
|
332 |
echo '
|
333 |
</select>
|
334 |
-
<p class="description">' .
|
335 |
</div>';
|
336 |
}
|
337 |
|
@@ -344,14 +348,14 @@ class Post_Views_Counter_Settings {
|
|
344 |
<input size="4" type="text" name="post_views_counter_settings_general[reset_counts][number]" value="' . esc_attr( Post_Views_Counter()->options['general']['reset_counts']['number'] ) . '" />
|
345 |
<select class="pvc-chosen-short" name="post_views_counter_settings_general[reset_counts][type]">';
|
346 |
|
347 |
-
foreach ( $this->time_types as $type => $type_name ) {
|
348 |
echo '
|
349 |
<option value="' . esc_attr( $type ) . '" ' . selected( $type, Post_Views_Counter()->options['general']['reset_counts']['type'], false ) . '>' . esc_html( $type_name ) . '</option>';
|
350 |
}
|
351 |
|
352 |
echo '
|
353 |
</select>
|
354 |
-
<p class="description">' .
|
355 |
</div>';
|
356 |
}
|
357 |
|
@@ -389,7 +393,7 @@ class Post_Views_Counter_Settings {
|
|
389 |
}
|
390 |
|
391 |
echo '
|
392 |
-
<p class="description">' .
|
393 |
<div class="pvc_user_roles"' . (in_array( 'roles', Post_Views_Counter()->options['general']['exclude']['groups'], true ) ? '' : ' style="display: none;"') . '>';
|
394 |
|
395 |
foreach ( $this->user_roles as $role => $role_name ) {
|
@@ -397,7 +401,7 @@ class Post_Views_Counter_Settings {
|
|
397 |
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[exclude][roles][' . $role . ']" value="1" ' . checked( in_array( $role, Post_Views_Counter()->options['general']['exclude']['roles'], true ), true, false ) . '>' . esc_html( $role_name ) . '</label>';
|
398 |
}
|
399 |
|
400 |
-
echo ' <p class="description">' .
|
401 |
</div>
|
402 |
</fieldset>
|
403 |
</div>';
|
@@ -429,7 +433,7 @@ class Post_Views_Counter_Settings {
|
|
429 |
|
430 |
echo '
|
431 |
<p><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'] ) . '" /></p>
|
432 |
-
<p class="description">' .
|
433 |
</div>';
|
434 |
}
|
435 |
|
@@ -440,9 +444,10 @@ class Post_Views_Counter_Settings {
|
|
440 |
echo '
|
441 |
<div id="pvc_wp_postviews">
|
442 |
<fieldset>
|
443 |
-
|
444 |
-
|
445 |
-
|
|
|
446 |
</fieldset>
|
447 |
</div>';
|
448 |
}
|
@@ -453,7 +458,7 @@ class Post_Views_Counter_Settings {
|
|
453 |
public function restrict_edit_views() {
|
454 |
echo '
|
455 |
<div id="pvc_restrict_edit_views">
|
456 |
-
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[restrict_edit_views]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['restrict_edit_views'], false ) . ' />' .
|
457 |
</div>';
|
458 |
}
|
459 |
|
@@ -463,7 +468,7 @@ class Post_Views_Counter_Settings {
|
|
463 |
public function deactivation_delete() {
|
464 |
echo '
|
465 |
<div id="pvc_deactivation_delete">
|
466 |
-
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[deactivation_delete]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['deactivation_delete'], false ) . ' />' .
|
467 |
</div>';
|
468 |
}
|
469 |
|
@@ -480,7 +485,7 @@ class Post_Views_Counter_Settings {
|
|
480 |
}
|
481 |
|
482 |
echo '
|
483 |
-
<p class="description">' .
|
484 |
</div>';
|
485 |
}
|
486 |
|
@@ -499,7 +504,7 @@ class Post_Views_Counter_Settings {
|
|
499 |
|
500 |
echo '
|
501 |
</select>
|
502 |
-
<p class="description">' .
|
503 |
</div>';
|
504 |
}
|
505 |
|
@@ -518,7 +523,7 @@ class Post_Views_Counter_Settings {
|
|
518 |
}
|
519 |
|
520 |
echo '
|
521 |
-
<p class="description">' .
|
522 |
</div>';
|
523 |
}
|
524 |
|
@@ -551,7 +556,7 @@ class Post_Views_Counter_Settings {
|
|
551 |
}
|
552 |
|
553 |
echo '
|
554 |
-
<p class="description">' .
|
555 |
<div class="pvc_user_roles"' . (in_array( 'roles', Post_Views_Counter()->options['display']['restrict_display']['groups'], true ) ? '' : ' style="display: none;"') . '>';
|
556 |
|
557 |
foreach ( $this->user_roles as $role => $role_name ) {
|
@@ -560,7 +565,7 @@ class Post_Views_Counter_Settings {
|
|
560 |
}
|
561 |
|
562 |
echo '
|
563 |
-
<p class="description">' .
|
564 |
</div>
|
565 |
</fieldset>
|
566 |
</div>';
|
@@ -575,9 +580,7 @@ class Post_Views_Counter_Settings {
|
|
575 |
|
576 |
$meta_key = esc_attr( apply_filters( 'pvc_import_meta_key', 'views' ) );
|
577 |
|
578 |
-
$views = $wpdb->get_results(
|
579 |
-
"SELECT post_id, meta_value FROM " . $wpdb->postmeta . " WHERE meta_key = '" . $meta_key . "'", ARRAY_A, 0
|
580 |
-
);
|
581 |
|
582 |
if ( ! empty( $views ) ) {
|
583 |
$input = Post_Views_Counter()->defaults['general'];
|
@@ -595,6 +598,13 @@ class Post_Views_Counter_Settings {
|
|
595 |
} else {
|
596 |
add_settings_error( 'wp_postviews_import', 'wp_postviews_import', __( 'There was no post views data to import.', 'post-views-counter' ), 'updated' );
|
597 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
598 |
} elseif ( isset( $_POST['save_pvc_general'] ) ) {
|
599 |
// post types count
|
600 |
if ( isset( $input['post_types_count'] ) ) {
|
38 |
return;
|
39 |
|
40 |
$this->modes = array(
|
41 |
+
'php' => __( 'PHP', 'post-views-counter' ),
|
42 |
+
'js' => __( 'JavaScript', 'post-views-counter' )
|
43 |
);
|
44 |
+
|
45 |
+
if ( function_exists( 'register_rest_route' ) ) {
|
46 |
+
$this->modes['rest_api'] = __( 'REST API', 'post-views-counter' );
|
47 |
+
}
|
48 |
|
49 |
$this->time_types = array(
|
50 |
'minutes' => __( 'minutes', 'post-views-counter' ),
|
178 |
<h3 class="hndle">' . __( 'Post Views Counter', 'post-views-counter' ) . ' ' . Post_Views_Counter()->defaults['version'] . '</h3>
|
179 |
<div class="inside">
|
180 |
<h4 class="inner">' . __( 'Need support?', 'post-views-counter' ) . '</h4>
|
181 |
+
<p class="inner">' . sprintf( __( 'If you are having problems with this plugin, please browse it\'s <a href="%s" target="_blank">Documentation</a> or talk about them in the <a href="%s" target="_blank">Support forum</a>', 'post-views-counter' ), 'https://www.dfactory.eu/docs/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=docs', 'https://www.dfactory.eu/support/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=support' ) . '</p>
|
182 |
<hr />
|
183 |
<h4 class="inner">' . __( 'Do you like this plugin?', 'post-views-counter' ) . '</h4>
|
184 |
+
<p class="inner">' . sprintf( __( '<a href="%s" target="_blank">Rate it 5</a> on WordPress.org', 'post-views-counter' ), 'https://wordpress.org/support/plugin/post-views-counter/reviews/?filter=5' ) . '<br />' .
|
185 |
+
sprintf( __( 'Blog about it & link to the <a href="%s" target="_blank">plugin page</a>.', 'post-views-counter' ), 'https://dfactory.eu/plugins/post-views-counter/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=blog-about' ) . '<br />' .
|
186 |
+
sprintf( __( 'Check out our other <a href="%s" target="_blank">WordPress plugins</a>.', 'post-views-counter' ), 'https://dfactory.eu/plugins/?utm_source=post-views-counter-settings&utm_medium=link&utm_campaign=other-plugins' ) . '
|
187 |
+
</p>
|
188 |
<hr />
|
189 |
<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>
|
190 |
</div>
|
228 |
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' );
|
229 |
add_settings_field( 'pvc_exclude', __( 'Exclude Visitors', 'post-views-counter' ), array( $this, 'exclude' ), 'post_views_counter_settings_general', 'post_views_counter_settings_general' );
|
230 |
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' );
|
231 |
+
add_settings_field( 'pvc_wp_postviews', __( 'Tools', 'post-views-counter' ), array( $this, 'wp_postviews' ), 'post_views_counter_settings_general', 'post_views_counter_settings_general' );
|
232 |
add_settings_field( 'pvc_deactivation_delete', __( 'Deactivation', 'post-views-counter' ), array( $this, 'deactivation_delete' ), 'post_views_counter_settings_general', 'post_views_counter_settings_general' );
|
233 |
|
234 |
// display options
|
251 |
<div id="pvc_post_views_label">
|
252 |
<fieldset>
|
253 |
<input type="text" class="large-text" name="post_views_counter_settings_display[label]" value="' . esc_attr( Post_Views_Counter()->options['display']['label'] ) . '" />
|
254 |
+
<p class="description">' . __( 'Enter the label for the post views counter field.', 'post-views-counter' ) . '</p>
|
255 |
</fieldset>
|
256 |
</div>';
|
257 |
}
|
269 |
}
|
270 |
|
271 |
echo '
|
272 |
+
<p class="description">' . __( 'Select post types for which post views will be counted.', 'post-views-counter' ) . '</p>
|
273 |
</div>';
|
274 |
}
|
275 |
|
286 |
}
|
287 |
|
288 |
echo '
|
289 |
+
<p class="description">' . __( 'Select post types for which the views count will be displayed.', 'post-views-counter' ) . '</p>
|
290 |
</div>';
|
291 |
}
|
292 |
|
305 |
}
|
306 |
|
307 |
echo '
|
308 |
+
<p class="description">' . __( 'Select the method of collecting post views data. If you are using any of the caching plugins select Javascript or REST API (if available).', 'post-views-counter' ) . '</p>
|
309 |
</div>';
|
310 |
}
|
311 |
|
315 |
public function post_views_column() {
|
316 |
echo '
|
317 |
<div id="pvc_post_views_column">
|
318 |
+
<label class="cb-checkbox"><input id="pvc-post-views-column-enable" type="checkbox" name="post_views_counter_settings_general[post_views_column]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['post_views_column'], false ) . ' />' . __( 'Enable to display post views count column for each of the selected post types.', 'post-views-counter' ) . '</label>
|
319 |
</div>';
|
320 |
}
|
321 |
|
335 |
|
336 |
echo '
|
337 |
</select>
|
338 |
+
<p class="description">' . __( 'Enter the time between single user visit count.', 'post-views-counter' ) . '</p>
|
339 |
</div>';
|
340 |
}
|
341 |
|
348 |
<input size="4" type="text" name="post_views_counter_settings_general[reset_counts][number]" value="' . esc_attr( Post_Views_Counter()->options['general']['reset_counts']['number'] ) . '" />
|
349 |
<select class="pvc-chosen-short" name="post_views_counter_settings_general[reset_counts][type]">';
|
350 |
|
351 |
+
foreach ( array_slice( $this->time_types, 2, null, true ) as $type => $type_name ) {
|
352 |
echo '
|
353 |
<option value="' . esc_attr( $type ) . '" ' . selected( $type, Post_Views_Counter()->options['general']['reset_counts']['type'], false ) . '>' . esc_html( $type_name ) . '</option>';
|
354 |
}
|
355 |
|
356 |
echo '
|
357 |
</select>
|
358 |
+
<p class="description">' . __( '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' ) . '</p>
|
359 |
</div>';
|
360 |
}
|
361 |
|
393 |
}
|
394 |
|
395 |
echo '
|
396 |
+
<p class="description">' . __( 'Use it to hide the post views counter from selected type of visitors.', 'post-views-counter' ) . '</p>
|
397 |
<div class="pvc_user_roles"' . (in_array( 'roles', Post_Views_Counter()->options['general']['exclude']['groups'], true ) ? '' : ' style="display: none;"') . '>';
|
398 |
|
399 |
foreach ( $this->user_roles as $role => $role_name ) {
|
401 |
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[exclude][roles][' . $role . ']" value="1" ' . checked( in_array( $role, Post_Views_Counter()->options['general']['exclude']['roles'], true ), true, false ) . '>' . esc_html( $role_name ) . '</label>';
|
402 |
}
|
403 |
|
404 |
+
echo ' <p class="description">' . __( 'Use it to hide the post views counter from selected user roles.', 'post-views-counter' ) . '</p>
|
405 |
</div>
|
406 |
</fieldset>
|
407 |
</div>';
|
433 |
|
434 |
echo '
|
435 |
<p><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'] ) . '" /></p>
|
436 |
+
<p class="description">' . __( 'Enter the IP addresses to be excluded from post views count.', 'post-views-counter' ) . '</p>
|
437 |
</div>';
|
438 |
}
|
439 |
|
444 |
echo '
|
445 |
<div id="pvc_wp_postviews">
|
446 |
<fieldset>
|
447 |
+
<input type="submit" class="button button-secondary" name="post_views_counter_import_wp_postviews" value="' . __( 'Import views', 'post-views-counter' ) . '"/> <label class="cb-checkbox"><input id="pvc-wp-postviews" type="checkbox" name="post_views_counter_import_wp_postviews_override" value="1" />' . __( 'Override existing views data.', 'post-views-counter' ) . '</label>
|
448 |
+
<p class="description">' . __( 'Import post views data from WP-PostViews plugin.', 'post-views-counter' ) . '</p>
|
449 |
+
<input type="submit" class="button button-secondary" name="post_views_counter_reset_views" value="' . __( 'Delete views', 'post-views-counter' ) . '"/>
|
450 |
+
<p class="description">' . __( 'Delete ALL the existing post views data.', 'post-views-counter' ) . '</p>
|
451 |
</fieldset>
|
452 |
</div>';
|
453 |
}
|
458 |
public function restrict_edit_views() {
|
459 |
echo '
|
460 |
<div id="pvc_restrict_edit_views">
|
461 |
+
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[restrict_edit_views]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['restrict_edit_views'], false ) . ' />' . __( 'Enable to restrict post views editing to admins only.', 'post-views-counter' ) . '</label>
|
462 |
</div>';
|
463 |
}
|
464 |
|
468 |
public function deactivation_delete() {
|
469 |
echo '
|
470 |
<div id="pvc_deactivation_delete">
|
471 |
+
<label class="cb-checkbox"><input type="checkbox" name="post_views_counter_settings_general[deactivation_delete]" value="1" ' . checked( true, Post_Views_Counter()->options['general']['deactivation_delete'], false ) . ' />' . __( 'Enable to delete all plugin data on deactivation.', 'post-views-counter' ) . '</label>
|
472 |
</div>';
|
473 |
}
|
474 |
|
485 |
}
|
486 |
|
487 |
echo '
|
488 |
+
<p class="description">' . __( 'Select page types where the views count will be displayed.', 'post-views-counter' ) . '</p>
|
489 |
</div>';
|
490 |
}
|
491 |
|
504 |
|
505 |
echo '
|
506 |
</select>
|
507 |
+
<p class="description">' . __( 'Select where would you like to display the post views counter. Use [post-views] shortcode for manual display.', 'post-views-counter' ) . '</p>
|
508 |
</div>';
|
509 |
}
|
510 |
|
523 |
}
|
524 |
|
525 |
echo '
|
526 |
+
<p class="description">' . __( 'Choose how to display the post views counter.', 'post-views-counter' ) . '</p>
|
527 |
</div>';
|
528 |
}
|
529 |
|
556 |
}
|
557 |
|
558 |
echo '
|
559 |
+
<p class="description">' . __( 'Use it to hide the post views counter from selected type of visitors.', 'post-views-counter' ) . '</p>
|
560 |
<div class="pvc_user_roles"' . (in_array( 'roles', Post_Views_Counter()->options['display']['restrict_display']['groups'], true ) ? '' : ' style="display: none;"') . '>';
|
561 |
|
562 |
foreach ( $this->user_roles as $role => $role_name ) {
|
565 |
}
|
566 |
|
567 |
echo '
|
568 |
+
<p class="description">' . __( 'Use it to hide the post views counter from selected user roles.', 'post-views-counter' ) . '</p>
|
569 |
</div>
|
570 |
</fieldset>
|
571 |
</div>';
|
580 |
|
581 |
$meta_key = esc_attr( apply_filters( 'pvc_import_meta_key', 'views' ) );
|
582 |
|
583 |
+
$views = $wpdb->get_results( "SELECT post_id, meta_value FROM " . $wpdb->postmeta . " WHERE meta_key = '" . $meta_key . "'", ARRAY_A, 0 );
|
|
|
|
|
584 |
|
585 |
if ( ! empty( $views ) ) {
|
586 |
$input = Post_Views_Counter()->defaults['general'];
|
598 |
} else {
|
599 |
add_settings_error( 'wp_postviews_import', 'wp_postviews_import', __( 'There was no post views data to import.', 'post-views-counter' ), 'updated' );
|
600 |
}
|
601 |
+
} elseif ( isset( $_POST['post_views_counter_reset_views'] ) ) {
|
602 |
+
global $wpdb;
|
603 |
+
|
604 |
+
if ( $wpdb->query( 'TRUNCATE TABLE ' . $wpdb->prefix . 'post_views' ) )
|
605 |
+
add_settings_error( 'reset_post_views', 'reset_post_views', __( 'All existing data deleted succesfully.', 'post-views-counter' ), 'updated' );
|
606 |
+
else
|
607 |
+
add_settings_error( 'reset_post_views', 'reset_post_views', __( 'Error occurred. All existing data were not deleted.', 'post-views-counter' ), 'error' );
|
608 |
} elseif ( isset( $_POST['save_pvc_general'] ) ) {
|
609 |
// post types count
|
610 |
if ( isset( $input['post_types_count'] ) ) {
|
includes/update.php
CHANGED
@@ -25,11 +25,95 @@ class Post_Views_Counter_Update {
|
|
25 |
// get current database version
|
26 |
$current_db_version = get_option( 'post_views_counter_version', '1.0.0' );
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
// new version?
|
29 |
if ( version_compare( $current_db_version, Post_Views_Counter()->defaults['version'], '<' ) ) {
|
30 |
-
// update
|
31 |
-
|
|
|
|
|
|
|
|
|
32 |
}
|
33 |
}
|
34 |
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
// get current database version
|
26 |
$current_db_version = get_option( 'post_views_counter_version', '1.0.0' );
|
27 |
|
28 |
+
// update 1.2.4+
|
29 |
+
if ( version_compare( $current_db_version, '1.2.4', '<=' ) ) {
|
30 |
+
$general = Post_Views_Counter()->options['general'];
|
31 |
+
|
32 |
+
if ( $general['reset_counts']['number'] > 0 ) {
|
33 |
+
// unsupported data reset in minutes/hours
|
34 |
+
if ( in_array( $general['reset_counts']['type'], array( 'minutes', 'hours' ), true ) ) {
|
35 |
+
// set type to date
|
36 |
+
$general['reset_counts']['type'] = 'days';
|
37 |
+
|
38 |
+
// new number of days
|
39 |
+
if ( $general['reset_counts']['type'] === 'minutes' )
|
40 |
+
$general['reset_counts']['number'] = $general['reset_counts']['number'] * 60;
|
41 |
+
else
|
42 |
+
$general['reset_counts']['number'] = $general['reset_counts']['number'] * 3600;
|
43 |
+
|
44 |
+
// how many days?
|
45 |
+
$general['reset_counts']['number'] = (int) round( ceil( $general['reset_counts']['number'] / 86400 ) );
|
46 |
+
|
47 |
+
// force cron to update
|
48 |
+
$general['cron_run'] = true;
|
49 |
+
$general['cron_update'] = true;
|
50 |
+
|
51 |
+
// update settings
|
52 |
+
update_option( 'post_views_counter_settings_general', $general );
|
53 |
+
|
54 |
+
// update general options
|
55 |
+
Post_Views_Counter()->options['general'] = $general;
|
56 |
+
}
|
57 |
+
|
58 |
+
// update cron job for all users
|
59 |
+
Post_Views_Counter()->cron->check_cron();
|
60 |
+
}
|
61 |
+
}
|
62 |
+
|
63 |
+
if ( isset( $_POST['post_view_counter_update'], $_POST['post_view_counter_number'] ) ) {
|
64 |
+
if ( $_POST['post_view_counter_number'] === 'update_1' ) {
|
65 |
+
$this->update_1();
|
66 |
+
|
67 |
+
// update plugin version
|
68 |
+
update_option( 'post_views_counter_version', Post_Views_Counter()->defaults['version'], false );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
$update_1_html = '
|
73 |
+
<form action="" method="post">
|
74 |
+
<input type="hidden" name="post_view_counter_number" value="update_1"/>
|
75 |
+
<p>' . __( '<strong>Post Views Counter</strong> - this version requires a database update. Make sure to back up your database first.', 'post-views-counter' ) . '</p>
|
76 |
+
<p><input type="submit" class="button button-primary" name="post_view_counter_update" value="' . __( 'Run the Update', 'post-views-counter' ) . '"/></p>
|
77 |
+
</form>';
|
78 |
+
|
79 |
+
// get current database version
|
80 |
+
$current_db_version = get_option( 'post_views_counter_version', '1.0.0' );
|
81 |
+
|
82 |
// new version?
|
83 |
if ( version_compare( $current_db_version, Post_Views_Counter()->defaults['version'], '<' ) ) {
|
84 |
+
// is update 1 required?
|
85 |
+
if ( version_compare( $current_db_version, '1.2.4', '<=' ) )
|
86 |
+
Post_Views_Counter()->add_notice( $update_1_html, 'notice notice-info' );
|
87 |
+
else
|
88 |
+
// update plugin version
|
89 |
+
update_option( 'post_views_counter_version', Post_Views_Counter()->defaults['version'], false );
|
90 |
}
|
91 |
}
|
92 |
|
93 |
+
/**
|
94 |
+
* Database update for 1.2.4 and below.
|
95 |
+
*/
|
96 |
+
public function update_1() {
|
97 |
+
global $wpdb;
|
98 |
+
|
99 |
+
// get index
|
100 |
+
$old_index = $wpdb->query( "SHOW INDEX FROM `" . $wpdb->prefix . "post_views` WHERE Key_name = 'id_period'" );
|
101 |
+
|
102 |
+
// check whether index already exists
|
103 |
+
if ( $old_index > 0 ) {
|
104 |
+
// drop unwanted index which prevented saving views with indentical weeks and months
|
105 |
+
$wpdb->query( "ALTER TABLE `" . $wpdb->prefix . "post_views` DROP INDEX id_period" );
|
106 |
+
}
|
107 |
+
|
108 |
+
// get index
|
109 |
+
$new_index = $wpdb->query( "SHOW INDEX FROM `" . $wpdb->prefix . "post_views` WHERE Key_name = 'id_type_period_count'" );
|
110 |
+
|
111 |
+
// check whether index already exists
|
112 |
+
if ( $new_index === 0 ) {
|
113 |
+
// create new index for better performance of SQL queries
|
114 |
+
$wpdb->query( 'ALTER TABLE `' . $wpdb->prefix . 'post_views` ADD UNIQUE INDEX `id_type_period_count` (`id`, `type`, `period`, `count`) USING BTREE' );
|
115 |
+
}
|
116 |
+
|
117 |
+
Post_Views_Counter()->add_notice( __( 'Thank you! Datebase was succesfully updated.', 'post-views-counter' ), 'updated', true );
|
118 |
+
}
|
119 |
+
}
|
js/admin-settings.js
CHANGED
@@ -13,6 +13,11 @@
|
|
13 |
return confirm( pvcArgsSettings.resetToDefaults );
|
14 |
} );
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
// remove ip box
|
17 |
$( document ).on( 'click', '.remove-exclude-ip', function ( e ) {
|
18 |
e.preventDefault();
|
13 |
return confirm( pvcArgsSettings.resetToDefaults );
|
14 |
} );
|
15 |
|
16 |
+
// ask whether to reset views
|
17 |
+
$( document ).on( 'click', 'input[name="post_views_counter_reset_views"]', function () {
|
18 |
+
return confirm( pvcArgsSettings.resetViews );
|
19 |
+
} );
|
20 |
+
|
21 |
// remove ip box
|
22 |
$( document ).on( 'click', '.remove-exclude-ip', function ( e ) {
|
23 |
e.preventDefault();
|
js/frontend.js
CHANGED
@@ -1,13 +1,43 @@
|
|
1 |
( function ( $ ) {
|
2 |
|
3 |
$( document ).ready( function () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
} );
|
13 |
|
1 |
( function ( $ ) {
|
2 |
|
3 |
$( document ).ready( function () {
|
4 |
+
|
5 |
+
// rest api request
|
6 |
+
if ( pvcArgsFrontend.mode == 'rest_api' ) {
|
7 |
+
|
8 |
+
var request = {
|
9 |
+
id: pvcArgsFrontend.postID
|
10 |
+
};
|
11 |
|
12 |
+
$.ajax( {
|
13 |
+
url: pvcArgsFrontend.requestURL + '?id=' + pvcArgsFrontend.postID,
|
14 |
+
type: 'post',
|
15 |
+
async: true,
|
16 |
+
cache: false,
|
17 |
+
data: request,
|
18 |
+
beforeSend: function ( xhr ) {
|
19 |
+
xhr.setRequestHeader( 'X-WP-Nonce', pvcArgsFrontend.nonce );
|
20 |
+
}
|
21 |
+
} );
|
22 |
+
|
23 |
+
// admin ajax request
|
24 |
+
} else {
|
25 |
+
|
26 |
+
var request = {
|
27 |
+
action: 'pvc-check-post',
|
28 |
+
pvc_nonce: pvcArgsFrontend.nonce,
|
29 |
+
id: pvcArgsFrontend.postID
|
30 |
+
};
|
31 |
+
|
32 |
+
$.ajax( {
|
33 |
+
url: pvcArgsFrontend.requestURL,
|
34 |
+
type: 'post',
|
35 |
+
async: true,
|
36 |
+
cache: false,
|
37 |
+
data: request
|
38 |
+
} );
|
39 |
+
|
40 |
+
}
|
41 |
|
42 |
} );
|
43 |
|
languages/post-views-counter.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Post Views Counter\n"
|
5 |
-
"POT-Creation-Date:
|
6 |
"PO-Revision-Date: 2015-04-08 18:59+0100\n"
|
7 |
"Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
|
8 |
"Language-Team: dFactory <info@dfactory.eu>\n"
|
@@ -10,7 +10,7 @@ msgstr ""
|
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
-
"X-Generator: Poedit 1.8.
|
14 |
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
|
15 |
"esc_html__;esc_html_e\n"
|
16 |
"X-Poedit-Basepath: .\n"
|
@@ -18,310 +18,323 @@ msgstr ""
|
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
-
#: ../includes/columns.php:
|
22 |
-
#: ../includes/columns.php:
|
23 |
-
#: ../includes/dashboard.php:
|
24 |
-
#: ../includes/dashboard.php:
|
|
|
25 |
msgid "Post Views"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: ../includes/columns.php:
|
29 |
msgid "Edit"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: ../includes/columns.php:
|
33 |
msgid "Adjust the views count for this post."
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: ../includes/columns.php:
|
37 |
msgid "OK"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: ../includes/columns.php:
|
41 |
msgid "Cancel"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: ../includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
msgid "Post Views Counter reset daily counts interval"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: ../includes/cron.php:
|
49 |
msgid "Post Views Counter cache flush interval"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: ../includes/dashboard.php:
|
53 |
msgid "You do not have permission to access this page."
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: ../includes/dashboard.php:
|
|
|
|
|
|
|
|
|
57 |
msgid "Total Views"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: ../includes/functions.php:
|
61 |
msgid "No Posts"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: ../includes/settings.php:
|
65 |
msgid "PHP"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: ../includes/settings.php:
|
69 |
msgid "JavaScript"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: ../includes/settings.php:
|
|
|
|
|
|
|
|
|
73 |
msgid "minutes"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: ../includes/settings.php:
|
77 |
msgid "hours"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: ../includes/settings.php:
|
81 |
msgid "days"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: ../includes/settings.php:
|
85 |
msgid "weeks"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: ../includes/settings.php:
|
89 |
msgid "months"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: ../includes/settings.php:
|
93 |
msgid "years"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: ../includes/settings.php:
|
97 |
msgid "robots"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: ../includes/settings.php:
|
101 |
msgid "logged in users"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: ../includes/settings.php:
|
105 |
msgid "guests"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: ../includes/settings.php:
|
109 |
msgid "selected user roles"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: ../includes/settings.php:
|
113 |
msgid "before the content"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: ../includes/settings.php:
|
117 |
msgid "after the content"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: ../includes/settings.php:
|
121 |
msgid "manual"
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: ../includes/settings.php:
|
125 |
msgid "icon"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: ../includes/settings.php:
|
129 |
msgid "label"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: ../includes/settings.php:
|
133 |
msgid "General"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: ../includes/settings.php:
|
137 |
msgid "Display"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../includes/settings.php:
|
141 |
msgid "Home"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: ../includes/settings.php:
|
145 |
msgid "Archives"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: ../includes/settings.php:
|
149 |
msgid "Single pages"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: ../includes/settings.php:
|
153 |
msgid "Search results"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: ../includes/settings.php:
|
157 |
-
#: ../includes/settings.php:
|
158 |
msgid "Post Views Counter"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: ../includes/settings.php:
|
162 |
msgid "Need support?"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: ../includes/settings.php:
|
|
|
166 |
msgid ""
|
167 |
-
"If you are having problems with this plugin, please
|
168 |
-
|
169 |
-
|
170 |
-
#: ../includes/settings.php:164
|
171 |
-
msgid "Support forum"
|
172 |
msgstr ""
|
173 |
|
174 |
-
#: ../includes/settings.php:
|
175 |
msgid "Do you like this plugin?"
|
176 |
msgstr ""
|
177 |
|
178 |
-
#: ../includes/settings.php:
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
#: ../includes/settings.php:167
|
183 |
-
msgid "on WordPress.org"
|
184 |
-
msgstr ""
|
185 |
-
|
186 |
-
#: ../includes/settings.php:168
|
187 |
-
msgid "Blog about it & link to the"
|
188 |
-
msgstr ""
|
189 |
-
|
190 |
-
#: ../includes/settings.php:168
|
191 |
-
msgid "plugin page"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: ../includes/settings.php:
|
195 |
-
|
|
|
|
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: ../includes/settings.php:
|
199 |
-
|
|
|
|
|
200 |
msgstr ""
|
201 |
|
202 |
-
#: ../includes/settings.php:
|
203 |
msgid "Created by"
|
204 |
msgstr ""
|
205 |
|
206 |
-
#: ../includes/settings.php:
|
207 |
msgid "Reset to defaults"
|
208 |
msgstr ""
|
209 |
|
210 |
-
#: ../includes/settings.php:
|
211 |
msgid "General settings"
|
212 |
msgstr ""
|
213 |
|
214 |
-
#: ../includes/settings.php:
|
215 |
msgid "Post Types Count"
|
216 |
msgstr ""
|
217 |
|
218 |
-
#: ../includes/settings.php:
|
219 |
msgid "Counter Mode"
|
220 |
msgstr ""
|
221 |
|
222 |
-
#: ../includes/settings.php:
|
223 |
msgid "Post Views Column"
|
224 |
msgstr ""
|
225 |
|
226 |
-
#: ../includes/settings.php:
|
227 |
msgid "Restrict Edit"
|
228 |
msgstr ""
|
229 |
|
230 |
-
#: ../includes/settings.php:
|
231 |
-
msgid "
|
232 |
msgstr ""
|
233 |
|
234 |
-
#: ../includes/settings.php:
|
235 |
msgid "Reset Data Interval"
|
236 |
msgstr ""
|
237 |
|
238 |
-
#: ../includes/settings.php:
|
239 |
msgid "Flush Object Cache Interval"
|
240 |
msgstr ""
|
241 |
|
242 |
-
#: ../includes/settings.php:
|
243 |
msgid "Exclude Visitors"
|
244 |
msgstr ""
|
245 |
|
246 |
-
#: ../includes/settings.php:
|
247 |
msgid "Exclude IPs"
|
248 |
msgstr ""
|
249 |
|
250 |
-
#: ../includes/settings.php:
|
251 |
-
msgid "
|
252 |
msgstr ""
|
253 |
|
254 |
-
#: ../includes/settings.php:
|
255 |
msgid "Deactivation"
|
256 |
msgstr ""
|
257 |
|
258 |
-
#: ../includes/settings.php:
|
259 |
msgid "Display settings"
|
260 |
msgstr ""
|
261 |
|
262 |
-
#: ../includes/settings.php:
|
263 |
msgid "Post Views Label"
|
264 |
msgstr ""
|
265 |
|
266 |
-
#: ../includes/settings.php:
|
267 |
msgid "Post Type"
|
268 |
msgstr ""
|
269 |
|
270 |
-
#: ../includes/settings.php:
|
271 |
msgid "Page Type"
|
272 |
msgstr ""
|
273 |
|
274 |
-
#: ../includes/settings.php:
|
275 |
msgid "User Type"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: ../includes/settings.php:
|
279 |
msgid "Position"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: ../includes/settings.php:
|
283 |
msgid "Display Style"
|
284 |
msgstr ""
|
285 |
|
286 |
-
#: ../includes/settings.php:
|
287 |
msgid "Icon Class"
|
288 |
msgstr ""
|
289 |
|
290 |
-
#: ../includes/settings.php:
|
291 |
msgid "Enter the label for the post views counter field."
|
292 |
msgstr ""
|
293 |
|
294 |
-
#: ../includes/settings.php:
|
295 |
msgid "Select post types for which post views will be counted."
|
296 |
msgstr ""
|
297 |
|
298 |
-
#: ../includes/settings.php:
|
299 |
msgid "Select post types for which the views count will be displayed."
|
300 |
msgstr ""
|
301 |
|
302 |
-
#: ../includes/settings.php:
|
303 |
msgid ""
|
304 |
"Select the method of collecting post views data. If you are using any of the "
|
305 |
-
"caching plugins select Javascript."
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: ../includes/settings.php:
|
309 |
msgid ""
|
310 |
"Enable to display post views count column for each of the selected post "
|
311 |
"types."
|
312 |
msgstr ""
|
313 |
|
314 |
-
#: ../includes/settings.php:
|
315 |
msgid "Enter the time between single user visit count."
|
316 |
msgstr ""
|
317 |
|
318 |
-
#: ../includes/settings.php:
|
319 |
msgid ""
|
320 |
"Delete single day post views data older than specified above. Enter 0 "
|
321 |
"(number zero) if you want to preserve your data regardless of its age."
|
322 |
msgstr ""
|
323 |
|
324 |
-
#: ../includes/settings.php:
|
325 |
msgid ""
|
326 |
"How often to flush cached view counts from the object cache into the "
|
327 |
"database. This feature is used only if a persistent object cache is detected "
|
@@ -333,151 +346,185 @@ msgid ""
|
|
333 |
"interval."
|
334 |
msgstr ""
|
335 |
|
336 |
-
#: ../includes/settings.php:
|
337 |
msgid "Use it to hide the post views counter from selected type of visitors."
|
338 |
msgstr ""
|
339 |
|
340 |
-
#: ../includes/settings.php:
|
341 |
msgid "Use it to hide the post views counter from selected user roles."
|
342 |
msgstr ""
|
343 |
|
344 |
-
#: ../includes/settings.php:
|
345 |
msgid "Remove"
|
346 |
msgstr ""
|
347 |
|
348 |
-
#: ../includes/settings.php:
|
349 |
msgid "Add new"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: ../includes/settings.php:
|
353 |
msgid "Add my current IP"
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: ../includes/settings.php:
|
357 |
msgid "Enter the IP addresses to be excluded from post views count."
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: ../includes/settings.php:
|
361 |
-
msgid "Import"
|
|
|
|
|
|
|
|
|
362 |
msgstr ""
|
363 |
|
364 |
-
#: ../includes/settings.php:
|
365 |
msgid "Import post views data from WP-PostViews plugin."
|
366 |
msgstr ""
|
367 |
|
368 |
-
#: ../includes/settings.php:
|
369 |
-
msgid "
|
|
|
|
|
|
|
|
|
370 |
msgstr ""
|
371 |
|
372 |
-
#: ../includes/settings.php:
|
373 |
msgid "Enable to restrict post views editing to admins only."
|
374 |
msgstr ""
|
375 |
|
376 |
-
#: ../includes/settings.php:
|
377 |
msgid "Enable to delete all plugin data on deactivation."
|
378 |
msgstr ""
|
379 |
|
380 |
-
#: ../includes/settings.php:
|
381 |
msgid "Select page types where the views count will be displayed."
|
382 |
msgstr ""
|
383 |
|
384 |
-
#: ../includes/settings.php:
|
385 |
msgid ""
|
386 |
"Select where would you like to display the post views counter. Use [post-"
|
387 |
"views] shortcode for manual display."
|
388 |
msgstr ""
|
389 |
|
390 |
-
#: ../includes/settings.php:
|
391 |
msgid "Choose how to display the post views counter."
|
392 |
msgstr ""
|
393 |
|
394 |
-
#: ../includes/settings.php:
|
395 |
#, php-format
|
396 |
msgid ""
|
397 |
"Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
|
398 |
"\">Dashicons</a> classes are available."
|
399 |
msgstr ""
|
400 |
|
401 |
-
#: ../includes/settings.php:
|
402 |
msgid "Post views data imported succesfully."
|
403 |
msgstr ""
|
404 |
|
405 |
-
#: ../includes/settings.php:
|
406 |
msgid "There was no post views data to import."
|
407 |
msgstr ""
|
408 |
|
409 |
-
#: ../includes/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
msgid "General settings restored to defaults."
|
411 |
msgstr ""
|
412 |
|
413 |
-
#: ../includes/settings.php:
|
414 |
msgid "Display settings restored to defaults."
|
415 |
msgstr ""
|
416 |
|
417 |
-
#: ../includes/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
418 |
msgid "Most Viewed Posts"
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: ../includes/widgets.php:
|
422 |
msgid "Displays a list of the most viewed posts"
|
423 |
msgstr ""
|
424 |
|
425 |
-
#: ../includes/widgets.php:
|
426 |
msgid "No Posts found"
|
427 |
msgstr ""
|
428 |
|
429 |
-
#: ../includes/widgets.php:
|
430 |
msgid "Ascending"
|
431 |
msgstr ""
|
432 |
|
433 |
-
#: ../includes/widgets.php:
|
434 |
msgid "Descending"
|
435 |
msgstr ""
|
436 |
|
437 |
-
#: ../includes/widgets.php:
|
438 |
msgid "Title"
|
439 |
msgstr ""
|
440 |
|
441 |
-
#: ../includes/widgets.php:
|
442 |
msgid "Post Types"
|
443 |
msgstr ""
|
444 |
|
445 |
-
#: ../includes/widgets.php:
|
446 |
msgid "Number of posts to show"
|
447 |
msgstr ""
|
448 |
|
449 |
-
#: ../includes/widgets.php:
|
450 |
msgid "No posts message"
|
451 |
msgstr ""
|
452 |
|
453 |
-
#: ../includes/widgets.php:
|
454 |
msgid "Order"
|
455 |
msgstr ""
|
456 |
|
457 |
-
#: ../includes/widgets.php:
|
458 |
msgid "Display post views?"
|
459 |
msgstr ""
|
460 |
|
461 |
-
#: ../includes/widgets.php:
|
462 |
msgid "Display post excerpt?"
|
463 |
msgstr ""
|
464 |
|
465 |
-
#: ../includes/widgets.php:
|
466 |
msgid "Display post thumbnail?"
|
467 |
msgstr ""
|
468 |
|
469 |
-
#: ../includes/widgets.php:
|
470 |
msgid "Thumbnail size"
|
471 |
msgstr ""
|
472 |
|
473 |
-
#: ../post-views-counter.php:
|
474 |
msgid "Are you sure you want to reset these settings to defaults?"
|
475 |
msgstr ""
|
476 |
|
477 |
-
#: ../post-views-counter.php:
|
|
|
|
|
|
|
|
|
478 |
msgid "Support"
|
479 |
msgstr ""
|
480 |
|
481 |
-
#: ../post-views-counter.php:
|
482 |
msgid "Settings"
|
483 |
msgstr ""
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Post Views Counter\n"
|
5 |
+
"POT-Creation-Date: 2017-01-31 21:22+0100\n"
|
6 |
"PO-Revision-Date: 2015-04-08 18:59+0100\n"
|
7 |
"Last-Translator: Bartosz Arendt <info@dfactory.eu>\n"
|
8 |
"Language-Team: dFactory <info@dfactory.eu>\n"
|
10 |
"MIME-Version: 1.0\n"
|
11 |
"Content-Type: text/plain; charset=UTF-8\n"
|
12 |
"Content-Transfer-Encoding: 8bit\n"
|
13 |
+
"X-Generator: Poedit 1.8.11\n"
|
14 |
"X-Poedit-KeywordsList: gettext;gettext_noop;__;_e;esc_attr__;esc_attr_e;"
|
15 |
"esc_html__;esc_html_e\n"
|
16 |
"X-Poedit-Basepath: .\n"
|
18 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19 |
"X-Poedit-SearchPath-0: ..\n"
|
20 |
|
21 |
+
#: ../includes/columns.php:50 ../includes/columns.php:185
|
22 |
+
#: ../includes/columns.php:191 ../includes/columns.php:243
|
23 |
+
#: ../includes/dashboard.php:30 ../includes/dashboard.php:102
|
24 |
+
#: ../includes/dashboard.php:112 ../includes/dashboard.php:121
|
25 |
+
#: ../includes/dashboard.php:193
|
26 |
msgid "Post Views"
|
27 |
msgstr ""
|
28 |
|
29 |
+
#: ../includes/columns.php:59
|
30 |
msgid "Edit"
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: ../includes/columns.php:63
|
34 |
msgid "Adjust the views count for this post."
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: ../includes/columns.php:67
|
38 |
msgid "OK"
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: ../includes/columns.php:68
|
42 |
msgid "Cancel"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: ../includes/counter.php:168 ../includes/counter.php:591
|
46 |
+
msgid "REST API method is disabled."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../includes/counter.php:176
|
50 |
+
msgid "Invalid post ID."
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../includes/counter.php:182
|
54 |
+
msgid "Post type excluded."
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../includes/cron.php:61
|
58 |
msgid "Post Views Counter reset daily counts interval"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: ../includes/cron.php:66
|
62 |
msgid "Post Views Counter cache flush interval"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: ../includes/dashboard.php:64 ../includes/dashboard.php:67
|
66 |
msgid "You do not have permission to access this page."
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: ../includes/dashboard.php:120
|
70 |
+
msgid "Year"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: ../includes/dashboard.php:135 ../includes/dashboard.php:207
|
74 |
msgid "Total Views"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: ../includes/functions.php:323
|
78 |
msgid "No Posts"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: ../includes/settings.php:41
|
82 |
msgid "PHP"
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: ../includes/settings.php:42
|
86 |
msgid "JavaScript"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: ../includes/settings.php:46
|
90 |
+
msgid "REST API"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../includes/settings.php:50
|
94 |
msgid "minutes"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: ../includes/settings.php:51
|
98 |
msgid "hours"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: ../includes/settings.php:52
|
102 |
msgid "days"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: ../includes/settings.php:53
|
106 |
msgid "weeks"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: ../includes/settings.php:54
|
110 |
msgid "months"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: ../includes/settings.php:55
|
114 |
msgid "years"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: ../includes/settings.php:59
|
118 |
msgid "robots"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: ../includes/settings.php:60
|
122 |
msgid "logged in users"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: ../includes/settings.php:61
|
126 |
msgid "guests"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: ../includes/settings.php:62
|
130 |
msgid "selected user roles"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: ../includes/settings.php:66
|
134 |
msgid "before the content"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: ../includes/settings.php:67
|
138 |
msgid "after the content"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: ../includes/settings.php:68
|
142 |
msgid "manual"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: ../includes/settings.php:72
|
146 |
msgid "icon"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: ../includes/settings.php:73
|
150 |
msgid "label"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: ../includes/settings.php:78
|
154 |
msgid "General"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: ../includes/settings.php:84
|
158 |
msgid "Display"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: ../includes/settings.php:94
|
162 |
msgid "Home"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: ../includes/settings.php:95
|
166 |
msgid "Archives"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: ../includes/settings.php:96
|
170 |
msgid "Single pages"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: ../includes/settings.php:97
|
174 |
msgid "Search results"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: ../includes/settings.php:152 ../includes/settings.php:166
|
178 |
+
#: ../includes/settings.php:178
|
179 |
msgid "Post Views Counter"
|
180 |
msgstr ""
|
181 |
|
182 |
+
#: ../includes/settings.php:180
|
183 |
msgid "Need support?"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: ../includes/settings.php:181
|
187 |
+
#, php-format
|
188 |
msgid ""
|
189 |
+
"If you are having problems with this plugin, please browse it's <a href=\"%s"
|
190 |
+
"\" target=\"_blank\">Documentation</a> or talk about them in the <a href=\"%s"
|
191 |
+
"\" target=\"_blank\">Support forum</a>"
|
|
|
|
|
192 |
msgstr ""
|
193 |
|
194 |
+
#: ../includes/settings.php:183
|
195 |
msgid "Do you like this plugin?"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: ../includes/settings.php:184
|
199 |
+
#, php-format
|
200 |
+
msgid "<a href=\"%s\" target=\"_blank\">Rate it 5</a> on WordPress.org"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
msgstr ""
|
202 |
|
203 |
+
#: ../includes/settings.php:185
|
204 |
+
#, php-format
|
205 |
+
msgid ""
|
206 |
+
"Blog about it & link to the <a href=\"%s\" target=\"_blank\">plugin page</a>."
|
207 |
msgstr ""
|
208 |
|
209 |
+
#: ../includes/settings.php:186
|
210 |
+
#, php-format
|
211 |
+
msgid ""
|
212 |
+
"Check out our other <a href=\"%s\" target=\"_blank\">WordPress plugins</a>."
|
213 |
msgstr ""
|
214 |
|
215 |
+
#: ../includes/settings.php:189
|
216 |
msgid "Created by"
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: ../includes/settings.php:205
|
220 |
msgid "Reset to defaults"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: ../includes/settings.php:221
|
224 |
msgid "General settings"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: ../includes/settings.php:222
|
228 |
msgid "Post Types Count"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: ../includes/settings.php:223
|
232 |
msgid "Counter Mode"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: ../includes/settings.php:224
|
236 |
msgid "Post Views Column"
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: ../includes/settings.php:225
|
240 |
msgid "Restrict Edit"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: ../includes/settings.php:226
|
244 |
+
msgid "Count Interval"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: ../includes/settings.php:227
|
248 |
msgid "Reset Data Interval"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: ../includes/settings.php:228
|
252 |
msgid "Flush Object Cache Interval"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: ../includes/settings.php:229
|
256 |
msgid "Exclude Visitors"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: ../includes/settings.php:230
|
260 |
msgid "Exclude IPs"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: ../includes/settings.php:231
|
264 |
+
msgid "Tools"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: ../includes/settings.php:232
|
268 |
msgid "Deactivation"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: ../includes/settings.php:236
|
272 |
msgid "Display settings"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: ../includes/settings.php:237
|
276 |
msgid "Post Views Label"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: ../includes/settings.php:238
|
280 |
msgid "Post Type"
|
281 |
msgstr ""
|
282 |
|
283 |
+
#: ../includes/settings.php:239
|
284 |
msgid "Page Type"
|
285 |
msgstr ""
|
286 |
|
287 |
+
#: ../includes/settings.php:240
|
288 |
msgid "User Type"
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: ../includes/settings.php:241
|
292 |
msgid "Position"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: ../includes/settings.php:242
|
296 |
msgid "Display Style"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: ../includes/settings.php:243
|
300 |
msgid "Icon Class"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: ../includes/settings.php:254
|
304 |
msgid "Enter the label for the post views counter field."
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: ../includes/settings.php:272
|
308 |
msgid "Select post types for which post views will be counted."
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: ../includes/settings.php:289
|
312 |
msgid "Select post types for which the views count will be displayed."
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: ../includes/settings.php:308
|
316 |
msgid ""
|
317 |
"Select the method of collecting post views data. If you are using any of the "
|
318 |
+
"caching plugins select Javascript or REST API (if available)."
|
319 |
msgstr ""
|
320 |
|
321 |
+
#: ../includes/settings.php:318
|
322 |
msgid ""
|
323 |
"Enable to display post views count column for each of the selected post "
|
324 |
"types."
|
325 |
msgstr ""
|
326 |
|
327 |
+
#: ../includes/settings.php:338
|
328 |
msgid "Enter the time between single user visit count."
|
329 |
msgstr ""
|
330 |
|
331 |
+
#: ../includes/settings.php:358
|
332 |
msgid ""
|
333 |
"Delete single day post views data older than specified above. Enter 0 "
|
334 |
"(number zero) if you want to preserve your data regardless of its age."
|
335 |
msgstr ""
|
336 |
|
337 |
+
#: ../includes/settings.php:378
|
338 |
msgid ""
|
339 |
"How often to flush cached view counts from the object cache into the "
|
340 |
"database. This feature is used only if a persistent object cache is detected "
|
346 |
"interval."
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: ../includes/settings.php:396 ../includes/settings.php:559
|
350 |
msgid "Use it to hide the post views counter from selected type of visitors."
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: ../includes/settings.php:404 ../includes/settings.php:568
|
354 |
msgid "Use it to hide the post views counter from selected user roles."
|
355 |
msgstr ""
|
356 |
|
357 |
+
#: ../includes/settings.php:424 ../includes/settings.php:430
|
358 |
msgid "Remove"
|
359 |
msgstr ""
|
360 |
|
361 |
+
#: ../includes/settings.php:435
|
362 |
msgid "Add new"
|
363 |
msgstr ""
|
364 |
|
365 |
+
#: ../includes/settings.php:435
|
366 |
msgid "Add my current IP"
|
367 |
msgstr ""
|
368 |
|
369 |
+
#: ../includes/settings.php:436
|
370 |
msgid "Enter the IP addresses to be excluded from post views count."
|
371 |
msgstr ""
|
372 |
|
373 |
+
#: ../includes/settings.php:447
|
374 |
+
msgid "Import views"
|
375 |
+
msgstr ""
|
376 |
+
|
377 |
+
#: ../includes/settings.php:447
|
378 |
+
msgid "Override existing views data."
|
379 |
msgstr ""
|
380 |
|
381 |
+
#: ../includes/settings.php:448
|
382 |
msgid "Import post views data from WP-PostViews plugin."
|
383 |
msgstr ""
|
384 |
|
385 |
+
#: ../includes/settings.php:449
|
386 |
+
msgid "Delete views"
|
387 |
+
msgstr ""
|
388 |
+
|
389 |
+
#: ../includes/settings.php:450
|
390 |
+
msgid "Delete ALL the existing post views data."
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: ../includes/settings.php:461
|
394 |
msgid "Enable to restrict post views editing to admins only."
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: ../includes/settings.php:471
|
398 |
msgid "Enable to delete all plugin data on deactivation."
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: ../includes/settings.php:488
|
402 |
msgid "Select page types where the views count will be displayed."
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: ../includes/settings.php:507
|
406 |
msgid ""
|
407 |
"Select where would you like to display the post views counter. Use [post-"
|
408 |
"views] shortcode for manual display."
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: ../includes/settings.php:526
|
412 |
msgid "Choose how to display the post views counter."
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: ../includes/settings.php:537
|
416 |
#, php-format
|
417 |
msgid ""
|
418 |
"Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
|
419 |
"\">Dashicons</a> classes are available."
|
420 |
msgstr ""
|
421 |
|
422 |
+
#: ../includes/settings.php:597
|
423 |
msgid "Post views data imported succesfully."
|
424 |
msgstr ""
|
425 |
|
426 |
+
#: ../includes/settings.php:599
|
427 |
msgid "There was no post views data to import."
|
428 |
msgstr ""
|
429 |
|
430 |
+
#: ../includes/settings.php:605
|
431 |
+
msgid "All existing data deleted succesfully."
|
432 |
+
msgstr ""
|
433 |
+
|
434 |
+
#: ../includes/settings.php:607
|
435 |
+
msgid "Error occurred. All existing data were not deleted."
|
436 |
+
msgstr ""
|
437 |
+
|
438 |
+
#: ../includes/settings.php:780
|
439 |
msgid "General settings restored to defaults."
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: ../includes/settings.php:784
|
443 |
msgid "Display settings restored to defaults."
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: ../includes/update.php:75
|
447 |
+
msgid ""
|
448 |
+
"<strong>Post Views Counter</strong> - this version requires a database "
|
449 |
+
"update. Make sure to back up your database first."
|
450 |
+
msgstr ""
|
451 |
+
|
452 |
+
#: ../includes/update.php:76
|
453 |
+
msgid "Run the Update"
|
454 |
+
msgstr ""
|
455 |
+
|
456 |
+
#: ../includes/update.php:117
|
457 |
+
msgid "Thank you! Datebase was succesfully updated."
|
458 |
+
msgstr ""
|
459 |
+
|
460 |
+
#: ../includes/widgets.php:41 ../includes/widgets.php:47
|
461 |
msgid "Most Viewed Posts"
|
462 |
msgstr ""
|
463 |
|
464 |
+
#: ../includes/widgets.php:42
|
465 |
msgid "Displays a list of the most viewed posts"
|
466 |
msgstr ""
|
467 |
|
468 |
+
#: ../includes/widgets.php:55
|
469 |
msgid "No Posts found"
|
470 |
msgstr ""
|
471 |
|
472 |
+
#: ../includes/widgets.php:59
|
473 |
msgid "Ascending"
|
474 |
msgstr ""
|
475 |
|
476 |
+
#: ../includes/widgets.php:60
|
477 |
msgid "Descending"
|
478 |
msgstr ""
|
479 |
|
480 |
+
#: ../includes/widgets.php:106
|
481 |
msgid "Title"
|
482 |
msgstr ""
|
483 |
|
484 |
+
#: ../includes/widgets.php:110
|
485 |
msgid "Post Types"
|
486 |
msgstr ""
|
487 |
|
488 |
+
#: ../includes/widgets.php:122
|
489 |
msgid "Number of posts to show"
|
490 |
msgstr ""
|
491 |
|
492 |
+
#: ../includes/widgets.php:126
|
493 |
msgid "No posts message"
|
494 |
msgstr ""
|
495 |
|
496 |
+
#: ../includes/widgets.php:130
|
497 |
msgid "Order"
|
498 |
msgstr ""
|
499 |
|
500 |
+
#: ../includes/widgets.php:142
|
501 |
msgid "Display post views?"
|
502 |
msgstr ""
|
503 |
|
504 |
+
#: ../includes/widgets.php:144
|
505 |
msgid "Display post excerpt?"
|
506 |
msgstr ""
|
507 |
|
508 |
+
#: ../includes/widgets.php:146
|
509 |
msgid "Display post thumbnail?"
|
510 |
msgstr ""
|
511 |
|
512 |
+
#: ../includes/widgets.php:149
|
513 |
msgid "Thumbnail size"
|
514 |
msgstr ""
|
515 |
|
516 |
+
#: ../post-views-counter.php:299
|
517 |
msgid "Are you sure you want to reset these settings to defaults?"
|
518 |
msgstr ""
|
519 |
|
520 |
+
#: ../post-views-counter.php:300
|
521 |
+
msgid "Are you sure you want to delete all existing data?"
|
522 |
+
msgstr ""
|
523 |
+
|
524 |
+
#: ../post-views-counter.php:347
|
525 |
msgid "Support"
|
526 |
msgstr ""
|
527 |
|
528 |
+
#: ../post-views-counter.php:371
|
529 |
msgid "Settings"
|
530 |
msgstr ""
|
post-views-counter.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Post Views Counter
|
4 |
-
Description:
|
5 |
-
Version: 1.2.
|
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-
|
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 |
|
@@ -31,7 +31,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
31 |
* Post Views Counter final class.
|
32 |
*
|
33 |
* @class Post_Views_Counter
|
34 |
-
* @version 1.2.
|
35 |
*/
|
36 |
final class Post_Views_Counter {
|
37 |
|
@@ -80,7 +80,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
80 |
'link_to_post' => true,
|
81 |
'icon_class' => 'dashicons-chart-bar'
|
82 |
),
|
83 |
-
'version' => '1.2.
|
84 |
);
|
85 |
|
86 |
/**
|
@@ -105,12 +105,14 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
105 |
*/
|
106 |
public static function instance() {
|
107 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Post_Views_Counter ) ) {
|
|
|
108 |
self::$instance = new Post_Views_Counter;
|
109 |
self::$instance->define_constants();
|
110 |
|
111 |
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
112 |
|
113 |
self::$instance->includes();
|
|
|
114 |
self::$instance->update = new Post_Views_Counter_Update();
|
115 |
self::$instance->settings = new Post_Views_Counter_Settings();
|
116 |
self::$instance->query = new Post_Views_Counter_Query();
|
@@ -170,12 +172,12 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
170 |
);
|
171 |
|
172 |
// actions
|
173 |
-
add_action( 'admin_enqueue_scripts', array( $this, '
|
174 |
add_action( 'wp_loaded', array( $this, 'load_pluggable_functions' ), 10 );
|
175 |
|
176 |
// filters
|
177 |
-
add_filter( 'plugin_row_meta', array( $this, '
|
178 |
-
add_filter( 'plugin_action_links', array( $this, '
|
179 |
}
|
180 |
|
181 |
/**
|
@@ -189,15 +191,15 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
189 |
|
190 |
// create post views table
|
191 |
dbDelta( '
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
);
|
202 |
|
203 |
// add default options
|
@@ -270,21 +272,21 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
270 |
* @global string $post_type
|
271 |
* @param string $page
|
272 |
*/
|
273 |
-
public function
|
274 |
wp_register_style(
|
275 |
-
|
276 |
);
|
277 |
|
278 |
wp_register_script(
|
279 |
-
|
280 |
);
|
281 |
|
282 |
wp_register_script(
|
283 |
-
|
284 |
);
|
285 |
|
286 |
wp_register_script(
|
287 |
-
|
288 |
);
|
289 |
|
290 |
// load on PVC settings page
|
@@ -293,9 +295,10 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
293 |
wp_enqueue_script( 'pvc-admin-settings' );
|
294 |
|
295 |
wp_localize_script(
|
296 |
-
|
297 |
-
|
298 |
-
|
|
|
299 |
);
|
300 |
|
301 |
wp_enqueue_style( 'pvc-admin' );
|
@@ -324,7 +327,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
324 |
wp_enqueue_script( 'pvc-admin-quick-edit' );
|
325 |
}
|
326 |
}
|
327 |
-
|
328 |
/**
|
329 |
* Add links to plugin support forum.
|
330 |
*
|
@@ -332,7 +335,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
332 |
* @param string $file
|
333 |
* @return array
|
334 |
*/
|
335 |
-
public function
|
336 |
|
337 |
if ( ! current_user_can( 'install_plugins' ) )
|
338 |
return $links;
|
@@ -341,7 +344,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
341 |
|
342 |
if ( $file == $plugin ) {
|
343 |
return array_merge(
|
344 |
-
|
345 |
);
|
346 |
}
|
347 |
|
@@ -356,7 +359,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
356 |
* @param string $file
|
357 |
* @return array
|
358 |
*/
|
359 |
-
public function
|
360 |
if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
|
361 |
return $links;
|
362 |
|
@@ -373,6 +376,32 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
373 |
return $links;
|
374 |
}
|
375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
376 |
}
|
377 |
|
378 |
endif; // end if class_exists check
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Post Views Counter
|
4 |
+
Description: Post Views Counter allows you to display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
|
5 |
+
Version: 1.2.5
|
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-2017, 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 |
|
31 |
* Post Views Counter final class.
|
32 |
*
|
33 |
* @class Post_Views_Counter
|
34 |
+
* @version 1.2.5
|
35 |
*/
|
36 |
final class Post_Views_Counter {
|
37 |
|
80 |
'link_to_post' => true,
|
81 |
'icon_class' => 'dashicons-chart-bar'
|
82 |
),
|
83 |
+
'version' => '1.2.5'
|
84 |
);
|
85 |
|
86 |
/**
|
105 |
*/
|
106 |
public static function instance() {
|
107 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Post_Views_Counter ) ) {
|
108 |
+
|
109 |
self::$instance = new Post_Views_Counter;
|
110 |
self::$instance->define_constants();
|
111 |
|
112 |
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
113 |
|
114 |
self::$instance->includes();
|
115 |
+
|
116 |
self::$instance->update = new Post_Views_Counter_Update();
|
117 |
self::$instance->settings = new Post_Views_Counter_Settings();
|
118 |
self::$instance->query = new Post_Views_Counter_Query();
|
172 |
);
|
173 |
|
174 |
// actions
|
175 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
176 |
add_action( 'wp_loaded', array( $this, 'load_pluggable_functions' ), 10 );
|
177 |
|
178 |
// filters
|
179 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
180 |
+
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
|
181 |
}
|
182 |
|
183 |
/**
|
191 |
|
192 |
// create post views table
|
193 |
dbDelta( '
|
194 |
+
CREATE TABLE IF NOT EXISTS ' . $wpdb->prefix . 'post_views (
|
195 |
+
id bigint unsigned NOT NULL,
|
196 |
+
type tinyint(1) unsigned NOT NULL,
|
197 |
+
period varchar(8) NOT NULL,
|
198 |
+
count bigint unsigned NOT NULL,
|
199 |
+
PRIMARY KEY (type, period, id),
|
200 |
+
UNIQUE INDEX id_type_period_count (id, type, period, count) USING BTREE,
|
201 |
+
INDEX type_period_count (type, period, count) USING BTREE
|
202 |
+
) ' . $charset_collate . ';'
|
203 |
);
|
204 |
|
205 |
// add default options
|
272 |
* @global string $post_type
|
273 |
* @param string $page
|
274 |
*/
|
275 |
+
public function admin_enqueue_scripts( $page ) {
|
276 |
wp_register_style(
|
277 |
+
'pvc-admin', POST_VIEWS_COUNTER_URL . '/css/admin.css'
|
278 |
);
|
279 |
|
280 |
wp_register_script(
|
281 |
+
'pvc-admin-settings', POST_VIEWS_COUNTER_URL . '/js/admin-settings.js', array( 'jquery' ), $this->defaults['version']
|
282 |
);
|
283 |
|
284 |
wp_register_script(
|
285 |
+
'pvc-admin-post', POST_VIEWS_COUNTER_URL . '/js/admin-post.js', array( 'jquery' ), $this->defaults['version']
|
286 |
);
|
287 |
|
288 |
wp_register_script(
|
289 |
+
'pvc-admin-quick-edit', POST_VIEWS_COUNTER_URL . '/js/admin-quick-edit.js', array( 'jquery', 'inline-edit-post' ), $this->defaults['version']
|
290 |
);
|
291 |
|
292 |
// load on PVC settings page
|
295 |
wp_enqueue_script( 'pvc-admin-settings' );
|
296 |
|
297 |
wp_localize_script(
|
298 |
+
'pvc-admin-settings', 'pvcArgsSettings', array(
|
299 |
+
'resetToDefaults' => __( 'Are you sure you want to reset these settings to defaults?', 'post-views-counter' ),
|
300 |
+
'resetViews' => __( 'Are you sure you want to delete all existing data?', 'post-views-counter' )
|
301 |
+
)
|
302 |
);
|
303 |
|
304 |
wp_enqueue_style( 'pvc-admin' );
|
327 |
wp_enqueue_script( 'pvc-admin-quick-edit' );
|
328 |
}
|
329 |
}
|
330 |
+
|
331 |
/**
|
332 |
* Add links to plugin support forum.
|
333 |
*
|
335 |
* @param string $file
|
336 |
* @return array
|
337 |
*/
|
338 |
+
public function plugin_row_meta( $links, $file ) {
|
339 |
|
340 |
if ( ! current_user_can( 'install_plugins' ) )
|
341 |
return $links;
|
344 |
|
345 |
if ( $file == $plugin ) {
|
346 |
return array_merge(
|
347 |
+
$links, array( sprintf( '<a href="http://www.dfactory.eu/support/forum/post-views-counter/" target="_blank">%s</a>', __( 'Support', 'post-views-counter' ) ) )
|
348 |
);
|
349 |
}
|
350 |
|
359 |
* @param string $file
|
360 |
* @return array
|
361 |
*/
|
362 |
+
public function plugin_action_links( $links, $file ) {
|
363 |
if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
|
364 |
return $links;
|
365 |
|
376 |
return $links;
|
377 |
}
|
378 |
|
379 |
+
/**
|
380 |
+
* Add admin notices.
|
381 |
+
*/
|
382 |
+
public function add_notice( $html = '', $status = '', $paragraph = false ) {
|
383 |
+
$this->notices[] = array(
|
384 |
+
'html' => $html,
|
385 |
+
'status' => $status,
|
386 |
+
'paragraph' => $paragraph
|
387 |
+
);
|
388 |
+
|
389 |
+
add_action( 'admin_notices', array( $this, 'display_notice' ) );
|
390 |
+
}
|
391 |
+
|
392 |
+
/**
|
393 |
+
* Print admin notices.
|
394 |
+
*/
|
395 |
+
public function display_notice() {
|
396 |
+
foreach ( $this->notices as $notice ) {
|
397 |
+
echo '
|
398 |
+
<div class="post-views-counter ' . $notice['status'] . '">
|
399 |
+
' . ( $notice['paragraph'] ? '<p>' : '' ) . '
|
400 |
+
' . $notice['html'] . '
|
401 |
+
' . ( $notice['paragraph'] ? '</p>' : '' ) . '
|
402 |
+
</div>';
|
403 |
+
}
|
404 |
+
}
|
405 |
}
|
406 |
|
407 |
endif; // end if class_exists check
|
readme.txt
CHANGED
@@ -1,14 +1,14 @@
|
|
1 |
=== Post Views Counter ===
|
2 |
Contributors: dfactory
|
3 |
Donate link: http://www.dfactory.eu/
|
4 |
-
Tags: counter, hits, postviews, post views, views, count
|
5 |
-
Requires at least: 4.0
|
6 |
-
Tested up to: 4.7
|
7 |
-
Stable tag: 1.2.
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
11 |
-
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -19,11 +19,12 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
|
|
19 |
= Features include: =
|
20 |
|
21 |
* Option to select post types for which post views will be counted and displayed.
|
22 |
-
* 2 methods of collecting post views data: PHP
|
23 |
* Possibility to manually set views count for each post
|
24 |
* Dashboard post views stats widget
|
25 |
* Capability to query posts according to its views count
|
26 |
-
*
|
|
|
27 |
* Excluding counts from visitors: bots, logged in users, selected user roles
|
28 |
* Excluding users by IPs
|
29 |
* Restricting display by user roles
|
@@ -58,6 +59,13 @@ No questions yet.
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 1.2.4 =
|
62 |
* New: Advanced crawler detection
|
63 |
* Tweak: Chart.js script update to 2.4.0
|
@@ -140,6 +148,7 @@ Initial release
|
|
140 |
|
141 |
== Upgrade Notice ==
|
142 |
|
143 |
-
= 1.2.
|
144 |
-
* New:
|
145 |
-
*
|
|
1 |
=== Post Views Counter ===
|
2 |
Contributors: dfactory
|
3 |
Donate link: http://www.dfactory.eu/
|
4 |
+
Tags: counter, hits, posts, postviews, post views, views, count, statistics, stats, analytics, pageviews, tracking
|
5 |
+
Requires at least: 4.0
|
6 |
+
Tested up to: 4.7.2
|
7 |
+
Stable tag: 1.2.5
|
8 |
License: MIT License
|
9 |
License URI: http://opensource.org/licenses/MIT
|
10 |
|
11 |
+
Post Views Counter allows you to display how many times a post, page or custom post type had been viewed in a simple, fast and reliable way.
|
12 |
|
13 |
== Description ==
|
14 |
|
19 |
= Features include: =
|
20 |
|
21 |
* Option to select post types for which post views will be counted and displayed.
|
22 |
+
* 2 methods of collecting post views data: PHP, Javascript or REST API for greater flexibility
|
23 |
* Possibility to manually set views count for each post
|
24 |
* Dashboard post views stats widget
|
25 |
* Capability to query posts according to its views count
|
26 |
+
* Custom REST API endpoints
|
27 |
+
* Option to set counts interval
|
28 |
* Excluding counts from visitors: bots, logged in users, selected user roles
|
29 |
* Excluding users by IPs
|
30 |
* Restricting display by user roles
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 1.2.5 =
|
63 |
+
* New: REST API counter mode
|
64 |
+
* New: Adjust dashboard chart colors to admin color scheme
|
65 |
+
* Tweak: Dashboard chart query optimization
|
66 |
+
* Tweak: post_views database table optimization
|
67 |
+
* Tweak: Added plugin documentation link
|
68 |
+
|
69 |
= 1.2.4 =
|
70 |
* New: Advanced crawler detection
|
71 |
* Tweak: Chart.js script update to 2.4.0
|
148 |
|
149 |
== Upgrade Notice ==
|
150 |
|
151 |
+
= 1.2.5 =
|
152 |
+
* New: REST API counter mode
|
153 |
+
* New: Adjust dashboard chart colors to admin color scheme
|
154 |
+
* Tweak: Dashboard chart query optimization
|