Version Description
- New: Experimental Fast AJAX counter method (10+ times faster)
Download this release
Release Info
Developer | dfactory |
Plugin | Post Views Counter |
Version | 1.2.13 |
Comparing to | |
See all releases |
Code changes from version 1.2.12 to 1.2.13
- includes/ajax.php +74 -0
- includes/counter.php +31 -4
- includes/frontend.php +21 -7
- includes/settings.php +3 -2
- js/frontend.js +2 -2
- languages/post-views-counter.pot +104 -94
- post-views-counter.php +55 -34
- readme.txt +7 -4
includes/ajax.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
// mimic the actuall admin-ajax
|
3 |
+
define( 'DOING_AJAX', true );
|
4 |
+
|
5 |
+
if ( ! isset( $_POST['action'] ) )
|
6 |
+
die( '-1' );
|
7 |
+
|
8 |
+
// hide errors if any
|
9 |
+
ini_set( 'html_errors', 0 );
|
10 |
+
|
11 |
+
// we need only basics
|
12 |
+
define( 'SHORTINIT', true );
|
13 |
+
|
14 |
+
// get wp-load.php location
|
15 |
+
$path = explode( 'wp-content', __FILE__ );
|
16 |
+
|
17 |
+
if ( is_file( reset( $path ) . 'wp-load.php' ) ) {
|
18 |
+
require_once( reset( $path ) . 'wp-load.php' );
|
19 |
+
} else {
|
20 |
+
die( '-1' );
|
21 |
+
}
|
22 |
+
|
23 |
+
// typical headers
|
24 |
+
header( 'Content-Type: text/html' );
|
25 |
+
send_nosniff_header();
|
26 |
+
|
27 |
+
// disable caching
|
28 |
+
header( 'Cache-Control: no-cache' );
|
29 |
+
header( 'Pragma: no-cache' );
|
30 |
+
|
31 |
+
// include only the files and function we need
|
32 |
+
require_once( ABSPATH . 'wp-config.php' );
|
33 |
+
|
34 |
+
require_once( ABSPATH . WPINC . '/post.php' );
|
35 |
+
require_once( ABSPATH . WPINC . '/formatting.php' );
|
36 |
+
require_once( ABSPATH . WPINC . '/capabilities.php' );
|
37 |
+
require_once( ABSPATH . WPINC . '/query.php' );
|
38 |
+
require_once( ABSPATH . WPINC . '/taxonomy.php' );
|
39 |
+
require_once( ABSPATH . WPINC . '/meta.php' );
|
40 |
+
require_once( ABSPATH . WPINC . '/functions.php' );
|
41 |
+
require_once( ABSPATH . WPINC . '/link-template.php' );
|
42 |
+
require_once( ABSPATH . WPINC . '/class-wp-post.php' );
|
43 |
+
require_once( ABSPATH . WPINC . '/kses.php' );
|
44 |
+
require_once( ABSPATH . WPINC . '/rest-api.php' );
|
45 |
+
// required for wp user
|
46 |
+
require_once( ABSPATH . WPINC . '/user.php' );
|
47 |
+
require_once( ABSPATH . WPINC . '/vars.php' );
|
48 |
+
require_once( ABSPATH . WPINC . '/class-wp-session-tokens.php' );
|
49 |
+
require_once( ABSPATH . WPINC . '/class-wp-user-meta-session-tokens.php' );
|
50 |
+
require_once( ABSPATH . WPINC . '/class-wp-roles.php' );
|
51 |
+
require_once( ABSPATH . WPINC . '/class-wp-role.php' );
|
52 |
+
require_once( ABSPATH . WPINC . '/class-wp-user.php' );
|
53 |
+
require_once( ABSPATH . WPINC . '/pluggable.php' );
|
54 |
+
|
55 |
+
// get constants
|
56 |
+
wp_plugin_directory_constants();
|
57 |
+
wp_cookie_constants();
|
58 |
+
wp_ssl_constants();
|
59 |
+
|
60 |
+
// include Post Views Counter core
|
61 |
+
require_once( WP_PLUGIN_DIR . '/post-views-counter/post-views-counter.php' );
|
62 |
+
|
63 |
+
$action = esc_attr( trim( $_POST['action'] ) );
|
64 |
+
|
65 |
+
// a bit of security
|
66 |
+
$allowed_actions = array(
|
67 |
+
'pvc-check-post'
|
68 |
+
);
|
69 |
+
|
70 |
+
if ( in_array( $action, $allowed_actions ) ) {
|
71 |
+
do_action( 'pvc_ajax_' . $action );
|
72 |
+
} else {
|
73 |
+
die( '-1' );
|
74 |
+
}
|
includes/counter.php
CHANGED
@@ -25,8 +25,9 @@ class Post_Views_Counter_Counter {
|
|
25 |
add_action( 'plugins_loaded', array( $this, 'check_cookie' ), 1 );
|
26 |
add_action( 'deleted_post', array( $this, 'delete_post_views' ) );
|
27 |
add_action( 'wp', array( $this, 'check_post_php' ) );
|
28 |
-
add_action( 'wp_ajax_pvc-check-post', array( $this, '
|
29 |
-
add_action( 'wp_ajax_nopriv_pvc-check-post', array( $this, '
|
|
|
30 |
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
31 |
}
|
32 |
|
@@ -141,9 +142,9 @@ class Post_Views_Counter_Counter {
|
|
141 |
}
|
142 |
|
143 |
/**
|
144 |
-
* Check whether to count visit via
|
145 |
*/
|
146 |
-
public function
|
147 |
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 ) {
|
148 |
|
149 |
// do we use Ajax as counter?
|
@@ -165,6 +166,32 @@ class Post_Views_Counter_Counter {
|
|
165 |
|
166 |
exit;
|
167 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
|
169 |
/**
|
170 |
* Check whether to count visit via REST API request.
|
25 |
add_action( 'plugins_loaded', array( $this, 'check_cookie' ), 1 );
|
26 |
add_action( 'deleted_post', array( $this, 'delete_post_views' ) );
|
27 |
add_action( 'wp', array( $this, 'check_post_php' ) );
|
28 |
+
add_action( 'wp_ajax_pvc-check-post', array( $this, 'check_post_js' ) );
|
29 |
+
add_action( 'wp_ajax_nopriv_pvc-check-post', array( $this, 'check_post_js' ) );
|
30 |
+
add_action( 'pvc_ajax_pvc-check-post', array( $this, 'check_post_ajax' ) );
|
31 |
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
|
32 |
}
|
33 |
|
142 |
}
|
143 |
|
144 |
/**
|
145 |
+
* Check whether to count visit via Javascript(Ajax) request.
|
146 |
*/
|
147 |
+
public function check_post_js() {
|
148 |
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 ) {
|
149 |
|
150 |
// do we use Ajax as counter?
|
166 |
|
167 |
exit;
|
168 |
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* Check whether to count visit via Fast AJAX request.
|
172 |
+
*/
|
173 |
+
public function check_post_ajax() {
|
174 |
+
if ( isset( $_POST['action'], $_POST['id'], $_POST['pvc_nonce'] ) && $_POST['action'] === 'pvc-check-post' && ($post_id = (int) $_POST['id']) > 0 ) {
|
175 |
+
|
176 |
+
// do we use Ajax as counter?
|
177 |
+
if ( Post_Views_Counter()->options['general']['counter_mode'] != 'ajax' )
|
178 |
+
exit;
|
179 |
+
|
180 |
+
// get countable post types
|
181 |
+
$post_types = Post_Views_Counter()->options['general']['post_types_count'];
|
182 |
+
|
183 |
+
// check if post exists
|
184 |
+
$post = get_post( $post_id );
|
185 |
+
|
186 |
+
// whether to count this post type or not
|
187 |
+
if ( empty( $post_types ) || empty( $post ) || ! in_array( $post->post_type, $post_types, true ) )
|
188 |
+
exit;
|
189 |
+
|
190 |
+
$this->check_post( $post_id );
|
191 |
+
}
|
192 |
+
|
193 |
+
exit;
|
194 |
+
}
|
195 |
|
196 |
/**
|
197 |
* Check whether to count visit via REST API request.
|
includes/frontend.php
CHANGED
@@ -164,7 +164,7 @@ class Post_Views_Counter_Frontend {
|
|
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;
|
@@ -174,14 +174,28 @@ class Post_Views_Counter_Frontend {
|
|
174 |
);
|
175 |
|
176 |
wp_enqueue_script( 'post-views-counter-frontend' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
|
178 |
wp_localize_script(
|
179 |
-
'post-views-counter-frontend', 'pvcArgsFrontend',
|
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 |
}
|
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', 'ajax', 'rest_api' ) ) ) {
|
168 |
// whether to count this post type or not
|
169 |
if ( empty( $post_types ) || ! is_singular( $post_types ) )
|
170 |
return;
|
174 |
);
|
175 |
|
176 |
wp_enqueue_script( 'post-views-counter-frontend' );
|
177 |
+
|
178 |
+
$js_args = array(
|
179 |
+
'mode' => $mode,
|
180 |
+
'requestURL' => esc_url_raw( $mode == 'rest_api' ? rest_url( 'post-views-counter/view-post/') : admin_url( 'admin-ajax.php' ) ),
|
181 |
+
'postID' => get_the_ID(),
|
182 |
+
'nonce' => ( $mode == 'rest_api' ? wp_create_nonce( 'wp_rest' ) : wp_create_nonce( 'pvc-check-post' ) )
|
183 |
+
);
|
184 |
+
|
185 |
+
switch ( $mode ) {
|
186 |
+
case 'rest_api' :
|
187 |
+
$js_args['requestURL'] = rest_url( 'post-views-counter/view-post/' );
|
188 |
+
break;
|
189 |
+
case 'ajax' :
|
190 |
+
$js_args['requestURL'] = POST_VIEWS_COUNTER_URL . '/includes/ajax.php';
|
191 |
+
break;
|
192 |
+
default :
|
193 |
+
$js_args['requestURL'] = admin_url( 'admin-ajax.php' );
|
194 |
+
break;
|
195 |
+
}
|
196 |
|
197 |
wp_localize_script(
|
198 |
+
'post-views-counter-frontend', 'pvcArgsFrontend', apply_filters( 'pvc_frontend_script_args', $js_args )
|
|
|
|
|
|
|
|
|
|
|
199 |
);
|
200 |
}
|
201 |
}
|
includes/settings.php
CHANGED
@@ -39,7 +39,8 @@ class Post_Views_Counter_Settings {
|
|
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' ) ) {
|
@@ -306,7 +307,7 @@ class Post_Views_Counter_Settings {
|
|
306 |
}
|
307 |
|
308 |
echo '
|
309 |
-
<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>
|
310 |
</div>';
|
311 |
}
|
312 |
|
39 |
|
40 |
$this->modes = array(
|
41 |
'php' => __( 'PHP', 'post-views-counter' ),
|
42 |
+
'js' => __( 'JavaScript', 'post-views-counter' ),
|
43 |
+
'ajax' => __( 'Fast AJAX', 'post-views-counter' )
|
44 |
);
|
45 |
|
46 |
if ( function_exists( 'register_rest_route' ) ) {
|
307 |
}
|
308 |
|
309 |
echo '
|
310 |
+
<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' ) . '<br />' . __( 'Optionally try the Fast AJAX experimental method, usually 10+ times faster than Javascript or REST API.', 'post-views-counter' ) . '</p>
|
311 |
</div>';
|
312 |
}
|
313 |
|
js/frontend.js
CHANGED
@@ -20,9 +20,9 @@
|
|
20 |
}
|
21 |
} );
|
22 |
|
23 |
-
// admin ajax request
|
24 |
} else {
|
25 |
-
|
26 |
var request = {
|
27 |
action: 'pvc-check-post',
|
28 |
pvc_nonce: pvcArgsFrontend.nonce,
|
20 |
}
|
21 |
} );
|
22 |
|
23 |
+
// admin ajax or fast ajax request
|
24 |
} else {
|
25 |
+
|
26 |
var request = {
|
27 |
action: 'pvc-check-post',
|
28 |
pvc_nonce: pvcArgsFrontend.nonce,
|
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: 2018-
|
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 2.0.
|
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"
|
@@ -42,15 +42,15 @@ msgstr ""
|
|
42 |
msgid "Cancel"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: ../includes/counter.php:
|
46 |
msgid "REST API method is disabled."
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: ../includes/counter.php:
|
50 |
msgid "Invalid post ID."
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: ../includes/counter.php:
|
54 |
msgid "Post type excluded."
|
55 |
msgstr ""
|
56 |
|
@@ -86,104 +86,108 @@ msgstr ""
|
|
86 |
msgid "JavaScript"
|
87 |
msgstr ""
|
88 |
|
89 |
-
#: ../includes/settings.php:
|
|
|
|
|
|
|
|
|
90 |
msgid "REST API"
|
91 |
msgstr ""
|
92 |
|
93 |
-
#: ../includes/settings.php:
|
94 |
msgid "minutes"
|
95 |
msgstr ""
|
96 |
|
97 |
-
#: ../includes/settings.php:
|
98 |
msgid "hours"
|
99 |
msgstr ""
|
100 |
|
101 |
-
#: ../includes/settings.php:
|
102 |
msgid "days"
|
103 |
msgstr ""
|
104 |
|
105 |
-
#: ../includes/settings.php:
|
106 |
msgid "weeks"
|
107 |
msgstr ""
|
108 |
|
109 |
-
#: ../includes/settings.php:
|
110 |
msgid "months"
|
111 |
msgstr ""
|
112 |
|
113 |
-
#: ../includes/settings.php:
|
114 |
msgid "years"
|
115 |
msgstr ""
|
116 |
|
117 |
-
#: ../includes/settings.php:
|
118 |
msgid "robots"
|
119 |
msgstr ""
|
120 |
|
121 |
-
#: ../includes/settings.php:
|
122 |
msgid "logged in users"
|
123 |
msgstr ""
|
124 |
|
125 |
-
#: ../includes/settings.php:
|
126 |
msgid "guests"
|
127 |
msgstr ""
|
128 |
|
129 |
-
#: ../includes/settings.php:
|
130 |
msgid "selected user roles"
|
131 |
msgstr ""
|
132 |
|
133 |
-
#: ../includes/settings.php:
|
134 |
msgid "before the content"
|
135 |
msgstr ""
|
136 |
|
137 |
-
#: ../includes/settings.php:
|
138 |
msgid "after the content"
|
139 |
msgstr ""
|
140 |
|
141 |
-
#: ../includes/settings.php:
|
142 |
msgid "manual"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: ../includes/settings.php:
|
146 |
msgid "icon"
|
147 |
msgstr ""
|
148 |
|
149 |
-
#: ../includes/settings.php:
|
150 |
msgid "label"
|
151 |
msgstr ""
|
152 |
|
153 |
-
#: ../includes/settings.php:
|
154 |
msgid "General"
|
155 |
msgstr ""
|
156 |
|
157 |
-
#: ../includes/settings.php:
|
158 |
msgid "Display"
|
159 |
msgstr ""
|
160 |
|
161 |
-
#: ../includes/settings.php:
|
162 |
msgid "Home"
|
163 |
msgstr ""
|
164 |
|
165 |
-
#: ../includes/settings.php:
|
166 |
msgid "Archives"
|
167 |
msgstr ""
|
168 |
|
169 |
-
#: ../includes/settings.php:
|
170 |
msgid "Single pages"
|
171 |
msgstr ""
|
172 |
|
173 |
-
#: ../includes/settings.php:
|
174 |
msgid "Search results"
|
175 |
msgstr ""
|
176 |
|
177 |
-
#: ../includes/settings.php:
|
178 |
-
#: ../includes/settings.php:
|
179 |
msgid "Post Views Counter"
|
180 |
msgstr ""
|
181 |
|
182 |
-
#: ../includes/settings.php:
|
183 |
msgid "Need support?"
|
184 |
msgstr ""
|
185 |
|
186 |
-
#: ../includes/settings.php:
|
187 |
#, php-format
|
188 |
msgid ""
|
189 |
"If you are having problems with this plugin, please browse it's <a href=\"%s"
|
@@ -191,154 +195,160 @@ msgid ""
|
|
191 |
"\" target=\"_blank\">Support forum</a>"
|
192 |
msgstr ""
|
193 |
|
194 |
-
#: ../includes/settings.php:
|
195 |
msgid "Do you like this plugin?"
|
196 |
msgstr ""
|
197 |
|
198 |
-
#: ../includes/settings.php:
|
199 |
#, php-format
|
200 |
msgid "<a href=\"%s\" target=\"_blank\">Rate it 5</a> on WordPress.org"
|
201 |
msgstr ""
|
202 |
|
203 |
-
#: ../includes/settings.php:
|
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:
|
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:
|
216 |
msgid "Created by"
|
217 |
msgstr ""
|
218 |
|
219 |
-
#: ../includes/settings.php:
|
220 |
msgid "Reset to defaults"
|
221 |
msgstr ""
|
222 |
|
223 |
-
#: ../includes/settings.php:
|
224 |
msgid "General settings"
|
225 |
msgstr ""
|
226 |
|
227 |
-
#: ../includes/settings.php:
|
228 |
msgid "Post Types Count"
|
229 |
msgstr ""
|
230 |
|
231 |
-
#: ../includes/settings.php:
|
232 |
msgid "Counter Mode"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: ../includes/settings.php:
|
236 |
msgid "Post Views Column"
|
237 |
msgstr ""
|
238 |
|
239 |
-
#: ../includes/settings.php:
|
240 |
msgid "Restrict Edit"
|
241 |
msgstr ""
|
242 |
|
243 |
-
#: ../includes/settings.php:
|
244 |
msgid "Count Interval"
|
245 |
msgstr ""
|
246 |
|
247 |
-
#: ../includes/settings.php:
|
248 |
msgid "Reset Data Interval"
|
249 |
msgstr ""
|
250 |
|
251 |
-
#: ../includes/settings.php:
|
252 |
msgid "Flush Object Cache Interval"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: ../includes/settings.php:
|
256 |
msgid "Exclude Visitors"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: ../includes/settings.php:
|
260 |
msgid "Exclude IPs"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: ../includes/settings.php:
|
264 |
msgid "Strict counts"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: ../includes/settings.php:
|
268 |
msgid "Tools"
|
269 |
msgstr ""
|
270 |
|
271 |
-
#: ../includes/settings.php:
|
272 |
msgid "Deactivation"
|
273 |
msgstr ""
|
274 |
|
275 |
-
#: ../includes/settings.php:
|
276 |
msgid "Display settings"
|
277 |
msgstr ""
|
278 |
|
279 |
-
#: ../includes/settings.php:
|
280 |
msgid "Post Views Label"
|
281 |
msgstr ""
|
282 |
|
283 |
-
#: ../includes/settings.php:
|
284 |
msgid "Post Type"
|
285 |
msgstr ""
|
286 |
|
287 |
-
#: ../includes/settings.php:
|
288 |
msgid "Page Type"
|
289 |
msgstr ""
|
290 |
|
291 |
-
#: ../includes/settings.php:
|
292 |
msgid "User Type"
|
293 |
msgstr ""
|
294 |
|
295 |
-
#: ../includes/settings.php:
|
296 |
msgid "Position"
|
297 |
msgstr ""
|
298 |
|
299 |
-
#: ../includes/settings.php:
|
300 |
msgid "Display Style"
|
301 |
msgstr ""
|
302 |
|
303 |
-
#: ../includes/settings.php:
|
304 |
msgid "Icon Class"
|
305 |
msgstr ""
|
306 |
|
307 |
-
#: ../includes/settings.php:
|
308 |
msgid "Enter the label for the post views counter field."
|
309 |
msgstr ""
|
310 |
|
311 |
-
#: ../includes/settings.php:
|
312 |
msgid "Select post types for which post views will be counted."
|
313 |
msgstr ""
|
314 |
|
315 |
-
#: ../includes/settings.php:
|
316 |
msgid "Select post types for which the views count will be displayed."
|
317 |
msgstr ""
|
318 |
|
319 |
-
#: ../includes/settings.php:
|
320 |
msgid ""
|
321 |
"Select the method of collecting post views data. If you are using any of the "
|
322 |
"caching plugins select Javascript or REST API (if available)."
|
323 |
msgstr ""
|
324 |
|
325 |
-
#: ../includes/settings.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
msgid ""
|
327 |
"Enable to display post views count column for each of the selected post "
|
328 |
"types."
|
329 |
msgstr ""
|
330 |
|
331 |
-
#: ../includes/settings.php:
|
332 |
msgid "Enter the time between single user visit count."
|
333 |
msgstr ""
|
334 |
|
335 |
-
#: ../includes/settings.php:
|
336 |
msgid ""
|
337 |
"Delete single day post views data older than specified above. Enter 0 "
|
338 |
"(number zero) if you want to preserve your data regardless of its age."
|
339 |
msgstr ""
|
340 |
|
341 |
-
#: ../includes/settings.php:
|
342 |
msgid ""
|
343 |
"How often to flush cached view counts from the object cache into the "
|
344 |
"database. This feature is used only if a persistent object cache is detected "
|
@@ -350,106 +360,106 @@ msgid ""
|
|
350 |
"interval."
|
351 |
msgstr ""
|
352 |
|
353 |
-
#: ../includes/settings.php:
|
354 |
msgid "Use it to hide the post views counter from selected type of visitors."
|
355 |
msgstr ""
|
356 |
|
357 |
-
#: ../includes/settings.php:
|
358 |
msgid "Use it to hide the post views counter from selected user roles."
|
359 |
msgstr ""
|
360 |
|
361 |
-
#: ../includes/settings.php:
|
362 |
msgid "Remove"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: ../includes/settings.php:
|
366 |
msgid "Add new"
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: ../includes/settings.php:
|
370 |
msgid "Add my current IP"
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: ../includes/settings.php:
|
374 |
msgid "Enter the IP addresses to be excluded from post views count."
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: ../includes/settings.php:
|
378 |
msgid ""
|
379 |
"Enable to prevent bypassing the counts interval (for e.g. using incognito "
|
380 |
"browser window or by clearing cookies)."
|
381 |
msgstr ""
|
382 |
|
383 |
-
#: ../includes/settings.php:
|
384 |
msgid "Import views"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: ../includes/settings.php:
|
388 |
msgid "Override existing views data."
|
389 |
msgstr ""
|
390 |
|
391 |
-
#: ../includes/settings.php:
|
392 |
msgid "Import post views data from WP-PostViews plugin."
|
393 |
msgstr ""
|
394 |
|
395 |
-
#: ../includes/settings.php:
|
396 |
msgid "Delete views"
|
397 |
msgstr ""
|
398 |
|
399 |
-
#: ../includes/settings.php:
|
400 |
msgid "Delete ALL the existing post views data."
|
401 |
msgstr ""
|
402 |
|
403 |
-
#: ../includes/settings.php:
|
404 |
msgid "Enable to restrict post views editing to admins only."
|
405 |
msgstr ""
|
406 |
|
407 |
-
#: ../includes/settings.php:
|
408 |
msgid "Enable to delete all plugin data on deactivation."
|
409 |
msgstr ""
|
410 |
|
411 |
-
#: ../includes/settings.php:
|
412 |
msgid "Select page types where the views count will be displayed."
|
413 |
msgstr ""
|
414 |
|
415 |
-
#: ../includes/settings.php:
|
416 |
msgid ""
|
417 |
"Select where would you like to display the post views counter. Use [post-"
|
418 |
"views] shortcode for manual display."
|
419 |
msgstr ""
|
420 |
|
421 |
-
#: ../includes/settings.php:
|
422 |
msgid "Choose how to display the post views counter."
|
423 |
msgstr ""
|
424 |
|
425 |
-
#: ../includes/settings.php:
|
426 |
#, php-format
|
427 |
msgid ""
|
428 |
"Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
|
429 |
"\">Dashicons</a> classes are available."
|
430 |
msgstr ""
|
431 |
|
432 |
-
#: ../includes/settings.php:
|
433 |
msgid "Post views data imported succesfully."
|
434 |
msgstr ""
|
435 |
|
436 |
-
#: ../includes/settings.php:
|
437 |
msgid "There was no post views data to import."
|
438 |
msgstr ""
|
439 |
|
440 |
-
#: ../includes/settings.php:
|
441 |
msgid "All existing data deleted succesfully."
|
442 |
msgstr ""
|
443 |
|
444 |
-
#: ../includes/settings.php:
|
445 |
msgid "Error occurred. All existing data were not deleted."
|
446 |
msgstr ""
|
447 |
|
448 |
-
#: ../includes/settings.php:
|
449 |
msgid "General settings restored to defaults."
|
450 |
msgstr ""
|
451 |
|
452 |
-
#: ../includes/settings.php:
|
453 |
msgid "Display settings restored to defaults."
|
454 |
msgstr ""
|
455 |
|
@@ -523,18 +533,18 @@ msgstr ""
|
|
523 |
msgid "Thumbnail size"
|
524 |
msgstr ""
|
525 |
|
526 |
-
#: ../post-views-counter.php:
|
527 |
msgid "Are you sure you want to reset these settings to defaults?"
|
528 |
msgstr ""
|
529 |
|
530 |
-
#: ../post-views-counter.php:
|
531 |
msgid "Are you sure you want to delete all existing data?"
|
532 |
msgstr ""
|
533 |
|
534 |
-
#: ../post-views-counter.php:
|
535 |
msgid "Support"
|
536 |
msgstr ""
|
537 |
|
538 |
-
#: ../post-views-counter.php:
|
539 |
msgid "Settings"
|
540 |
msgstr ""
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: Post Views Counter\n"
|
5 |
+
"POT-Creation-Date: 2018-06-11 18:34+0200\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 2.0.8\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"
|
42 |
msgid "Cancel"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: ../includes/counter.php:207 ../includes/counter.php:727
|
46 |
msgid "REST API method is disabled."
|
47 |
msgstr ""
|
48 |
|
49 |
+
#: ../includes/counter.php:215
|
50 |
msgid "Invalid post ID."
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: ../includes/counter.php:221
|
54 |
msgid "Post type excluded."
|
55 |
msgstr ""
|
56 |
|
86 |
msgid "JavaScript"
|
87 |
msgstr ""
|
88 |
|
89 |
+
#: ../includes/settings.php:43
|
90 |
+
msgid "Fast AJAX"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../includes/settings.php:47
|
94 |
msgid "REST API"
|
95 |
msgstr ""
|
96 |
|
97 |
+
#: ../includes/settings.php:51
|
98 |
msgid "minutes"
|
99 |
msgstr ""
|
100 |
|
101 |
+
#: ../includes/settings.php:52
|
102 |
msgid "hours"
|
103 |
msgstr ""
|
104 |
|
105 |
+
#: ../includes/settings.php:53
|
106 |
msgid "days"
|
107 |
msgstr ""
|
108 |
|
109 |
+
#: ../includes/settings.php:54
|
110 |
msgid "weeks"
|
111 |
msgstr ""
|
112 |
|
113 |
+
#: ../includes/settings.php:55
|
114 |
msgid "months"
|
115 |
msgstr ""
|
116 |
|
117 |
+
#: ../includes/settings.php:56
|
118 |
msgid "years"
|
119 |
msgstr ""
|
120 |
|
121 |
+
#: ../includes/settings.php:60
|
122 |
msgid "robots"
|
123 |
msgstr ""
|
124 |
|
125 |
+
#: ../includes/settings.php:61
|
126 |
msgid "logged in users"
|
127 |
msgstr ""
|
128 |
|
129 |
+
#: ../includes/settings.php:62
|
130 |
msgid "guests"
|
131 |
msgstr ""
|
132 |
|
133 |
+
#: ../includes/settings.php:63
|
134 |
msgid "selected user roles"
|
135 |
msgstr ""
|
136 |
|
137 |
+
#: ../includes/settings.php:67
|
138 |
msgid "before the content"
|
139 |
msgstr ""
|
140 |
|
141 |
+
#: ../includes/settings.php:68
|
142 |
msgid "after the content"
|
143 |
msgstr ""
|
144 |
|
145 |
+
#: ../includes/settings.php:69
|
146 |
msgid "manual"
|
147 |
msgstr ""
|
148 |
|
149 |
+
#: ../includes/settings.php:73
|
150 |
msgid "icon"
|
151 |
msgstr ""
|
152 |
|
153 |
+
#: ../includes/settings.php:74
|
154 |
msgid "label"
|
155 |
msgstr ""
|
156 |
|
157 |
+
#: ../includes/settings.php:79
|
158 |
msgid "General"
|
159 |
msgstr ""
|
160 |
|
161 |
+
#: ../includes/settings.php:85
|
162 |
msgid "Display"
|
163 |
msgstr ""
|
164 |
|
165 |
+
#: ../includes/settings.php:95
|
166 |
msgid "Home"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: ../includes/settings.php:96
|
170 |
msgid "Archives"
|
171 |
msgstr ""
|
172 |
|
173 |
+
#: ../includes/settings.php:97
|
174 |
msgid "Single pages"
|
175 |
msgstr ""
|
176 |
|
177 |
+
#: ../includes/settings.php:98
|
178 |
msgid "Search results"
|
179 |
msgstr ""
|
180 |
|
181 |
+
#: ../includes/settings.php:153 ../includes/settings.php:167
|
182 |
+
#: ../includes/settings.php:179
|
183 |
msgid "Post Views Counter"
|
184 |
msgstr ""
|
185 |
|
186 |
+
#: ../includes/settings.php:181
|
187 |
msgid "Need support?"
|
188 |
msgstr ""
|
189 |
|
190 |
+
#: ../includes/settings.php:182
|
191 |
#, php-format
|
192 |
msgid ""
|
193 |
"If you are having problems with this plugin, please browse it's <a href=\"%s"
|
195 |
"\" target=\"_blank\">Support forum</a>"
|
196 |
msgstr ""
|
197 |
|
198 |
+
#: ../includes/settings.php:184
|
199 |
msgid "Do you like this plugin?"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: ../includes/settings.php:185
|
203 |
#, php-format
|
204 |
msgid "<a href=\"%s\" target=\"_blank\">Rate it 5</a> on WordPress.org"
|
205 |
msgstr ""
|
206 |
|
207 |
+
#: ../includes/settings.php:186
|
208 |
#, php-format
|
209 |
msgid ""
|
210 |
"Blog about it & link to the <a href=\"%s\" target=\"_blank\">plugin page</a>."
|
211 |
msgstr ""
|
212 |
|
213 |
+
#: ../includes/settings.php:187
|
214 |
#, php-format
|
215 |
msgid ""
|
216 |
"Check out our other <a href=\"%s\" target=\"_blank\">WordPress plugins</a>."
|
217 |
msgstr ""
|
218 |
|
219 |
+
#: ../includes/settings.php:190
|
220 |
msgid "Created by"
|
221 |
msgstr ""
|
222 |
|
223 |
+
#: ../includes/settings.php:206
|
224 |
msgid "Reset to defaults"
|
225 |
msgstr ""
|
226 |
|
227 |
+
#: ../includes/settings.php:222
|
228 |
msgid "General settings"
|
229 |
msgstr ""
|
230 |
|
231 |
+
#: ../includes/settings.php:223
|
232 |
msgid "Post Types Count"
|
233 |
msgstr ""
|
234 |
|
235 |
+
#: ../includes/settings.php:224
|
236 |
msgid "Counter Mode"
|
237 |
msgstr ""
|
238 |
|
239 |
+
#: ../includes/settings.php:225
|
240 |
msgid "Post Views Column"
|
241 |
msgstr ""
|
242 |
|
243 |
+
#: ../includes/settings.php:226
|
244 |
msgid "Restrict Edit"
|
245 |
msgstr ""
|
246 |
|
247 |
+
#: ../includes/settings.php:227
|
248 |
msgid "Count Interval"
|
249 |
msgstr ""
|
250 |
|
251 |
+
#: ../includes/settings.php:228
|
252 |
msgid "Reset Data Interval"
|
253 |
msgstr ""
|
254 |
|
255 |
+
#: ../includes/settings.php:229
|
256 |
msgid "Flush Object Cache Interval"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: ../includes/settings.php:230
|
260 |
msgid "Exclude Visitors"
|
261 |
msgstr ""
|
262 |
|
263 |
+
#: ../includes/settings.php:231
|
264 |
msgid "Exclude IPs"
|
265 |
msgstr ""
|
266 |
|
267 |
+
#: ../includes/settings.php:232
|
268 |
msgid "Strict counts"
|
269 |
msgstr ""
|
270 |
|
271 |
+
#: ../includes/settings.php:233
|
272 |
msgid "Tools"
|
273 |
msgstr ""
|
274 |
|
275 |
+
#: ../includes/settings.php:234
|
276 |
msgid "Deactivation"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: ../includes/settings.php:238
|
280 |
msgid "Display settings"
|
281 |
msgstr ""
|
282 |
|
283 |
+
#: ../includes/settings.php:239
|
284 |
msgid "Post Views Label"
|
285 |
msgstr ""
|
286 |
|
287 |
+
#: ../includes/settings.php:240
|
288 |
msgid "Post Type"
|
289 |
msgstr ""
|
290 |
|
291 |
+
#: ../includes/settings.php:241
|
292 |
msgid "Page Type"
|
293 |
msgstr ""
|
294 |
|
295 |
+
#: ../includes/settings.php:242
|
296 |
msgid "User Type"
|
297 |
msgstr ""
|
298 |
|
299 |
+
#: ../includes/settings.php:243
|
300 |
msgid "Position"
|
301 |
msgstr ""
|
302 |
|
303 |
+
#: ../includes/settings.php:244
|
304 |
msgid "Display Style"
|
305 |
msgstr ""
|
306 |
|
307 |
+
#: ../includes/settings.php:245
|
308 |
msgid "Icon Class"
|
309 |
msgstr ""
|
310 |
|
311 |
+
#: ../includes/settings.php:256
|
312 |
msgid "Enter the label for the post views counter field."
|
313 |
msgstr ""
|
314 |
|
315 |
+
#: ../includes/settings.php:274
|
316 |
msgid "Select post types for which post views will be counted."
|
317 |
msgstr ""
|
318 |
|
319 |
+
#: ../includes/settings.php:291
|
320 |
msgid "Select post types for which the views count will be displayed."
|
321 |
msgstr ""
|
322 |
|
323 |
+
#: ../includes/settings.php:310
|
324 |
msgid ""
|
325 |
"Select the method of collecting post views data. If you are using any of the "
|
326 |
"caching plugins select Javascript or REST API (if available)."
|
327 |
msgstr ""
|
328 |
|
329 |
+
#: ../includes/settings.php:310
|
330 |
+
msgid ""
|
331 |
+
"Optionally try the Fast AJAX experimental method, usually 10+ times faster "
|
332 |
+
"than Javascript or REST API."
|
333 |
+
msgstr ""
|
334 |
+
|
335 |
+
#: ../includes/settings.php:320
|
336 |
msgid ""
|
337 |
"Enable to display post views count column for each of the selected post "
|
338 |
"types."
|
339 |
msgstr ""
|
340 |
|
341 |
+
#: ../includes/settings.php:340
|
342 |
msgid "Enter the time between single user visit count."
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: ../includes/settings.php:360
|
346 |
msgid ""
|
347 |
"Delete single day post views data older than specified above. Enter 0 "
|
348 |
"(number zero) if you want to preserve your data regardless of its age."
|
349 |
msgstr ""
|
350 |
|
351 |
+
#: ../includes/settings.php:380
|
352 |
msgid ""
|
353 |
"How often to flush cached view counts from the object cache into the "
|
354 |
"database. This feature is used only if a persistent object cache is detected "
|
360 |
"interval."
|
361 |
msgstr ""
|
362 |
|
363 |
+
#: ../includes/settings.php:398 ../includes/settings.php:571
|
364 |
msgid "Use it to hide the post views counter from selected type of visitors."
|
365 |
msgstr ""
|
366 |
|
367 |
+
#: ../includes/settings.php:406 ../includes/settings.php:580
|
368 |
msgid "Use it to hide the post views counter from selected user roles."
|
369 |
msgstr ""
|
370 |
|
371 |
+
#: ../includes/settings.php:426 ../includes/settings.php:432
|
372 |
msgid "Remove"
|
373 |
msgstr ""
|
374 |
|
375 |
+
#: ../includes/settings.php:437
|
376 |
msgid "Add new"
|
377 |
msgstr ""
|
378 |
|
379 |
+
#: ../includes/settings.php:437
|
380 |
msgid "Add my current IP"
|
381 |
msgstr ""
|
382 |
|
383 |
+
#: ../includes/settings.php:438
|
384 |
msgid "Enter the IP addresses to be excluded from post views count."
|
385 |
msgstr ""
|
386 |
|
387 |
+
#: ../includes/settings.php:448
|
388 |
msgid ""
|
389 |
"Enable to prevent bypassing the counts interval (for e.g. using incognito "
|
390 |
"browser window or by clearing cookies)."
|
391 |
msgstr ""
|
392 |
|
393 |
+
#: ../includes/settings.php:459
|
394 |
msgid "Import views"
|
395 |
msgstr ""
|
396 |
|
397 |
+
#: ../includes/settings.php:459
|
398 |
msgid "Override existing views data."
|
399 |
msgstr ""
|
400 |
|
401 |
+
#: ../includes/settings.php:460
|
402 |
msgid "Import post views data from WP-PostViews plugin."
|
403 |
msgstr ""
|
404 |
|
405 |
+
#: ../includes/settings.php:461
|
406 |
msgid "Delete views"
|
407 |
msgstr ""
|
408 |
|
409 |
+
#: ../includes/settings.php:462
|
410 |
msgid "Delete ALL the existing post views data."
|
411 |
msgstr ""
|
412 |
|
413 |
+
#: ../includes/settings.php:473
|
414 |
msgid "Enable to restrict post views editing to admins only."
|
415 |
msgstr ""
|
416 |
|
417 |
+
#: ../includes/settings.php:483
|
418 |
msgid "Enable to delete all plugin data on deactivation."
|
419 |
msgstr ""
|
420 |
|
421 |
+
#: ../includes/settings.php:500
|
422 |
msgid "Select page types where the views count will be displayed."
|
423 |
msgstr ""
|
424 |
|
425 |
+
#: ../includes/settings.php:519
|
426 |
msgid ""
|
427 |
"Select where would you like to display the post views counter. Use [post-"
|
428 |
"views] shortcode for manual display."
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: ../includes/settings.php:538
|
432 |
msgid "Choose how to display the post views counter."
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: ../includes/settings.php:549
|
436 |
#, php-format
|
437 |
msgid ""
|
438 |
"Enter the post views icon class. Any of the <a href=\"%s\" target=\"_blank"
|
439 |
"\">Dashicons</a> classes are available."
|
440 |
msgstr ""
|
441 |
|
442 |
+
#: ../includes/settings.php:609
|
443 |
msgid "Post views data imported succesfully."
|
444 |
msgstr ""
|
445 |
|
446 |
+
#: ../includes/settings.php:611
|
447 |
msgid "There was no post views data to import."
|
448 |
msgstr ""
|
449 |
|
450 |
+
#: ../includes/settings.php:617
|
451 |
msgid "All existing data deleted succesfully."
|
452 |
msgstr ""
|
453 |
|
454 |
+
#: ../includes/settings.php:619
|
455 |
msgid "Error occurred. All existing data were not deleted."
|
456 |
msgstr ""
|
457 |
|
458 |
+
#: ../includes/settings.php:795
|
459 |
msgid "General settings restored to defaults."
|
460 |
msgstr ""
|
461 |
|
462 |
+
#: ../includes/settings.php:799
|
463 |
msgid "Display settings restored to defaults."
|
464 |
msgstr ""
|
465 |
|
533 |
msgid "Thumbnail size"
|
534 |
msgstr ""
|
535 |
|
536 |
+
#: ../post-views-counter.php:384
|
537 |
msgid "Are you sure you want to reset these settings to defaults?"
|
538 |
msgstr ""
|
539 |
|
540 |
+
#: ../post-views-counter.php:385
|
541 |
msgid "Are you sure you want to delete all existing data?"
|
542 |
msgstr ""
|
543 |
|
544 |
+
#: ../post-views-counter.php:435
|
545 |
msgid "Support"
|
546 |
msgstr ""
|
547 |
|
548 |
+
#: ../post-views-counter.php:459
|
549 |
msgid "Settings"
|
550 |
msgstr ""
|
post-views-counter.php
CHANGED
@@ -2,7 +2,7 @@
|
|
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.
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
|
@@ -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 |
|
@@ -81,7 +81,7 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
81 |
'link_to_post' => true,
|
82 |
'icon_class' => 'dashicons-chart-bar'
|
83 |
),
|
84 |
-
'version' => '1.2.
|
85 |
);
|
86 |
|
87 |
/**
|
@@ -109,21 +109,31 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
109 |
|
110 |
self::$instance = new Post_Views_Counter;
|
111 |
self::$instance->define_constants();
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
return self::$instance;
|
129 |
}
|
@@ -134,9 +144,13 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
134 |
* @return void
|
135 |
*/
|
136 |
private function define_constants() {
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
138 |
define( 'POST_VIEWS_COUNTER_PATH', plugin_dir_path( __FILE__ ) );
|
139 |
-
define( 'POST_VIEWS_COUNTER_REL_PATH', dirname( plugin_basename( __FILE__ ) ) . '/' );
|
140 |
}
|
141 |
|
142 |
/**
|
@@ -163,22 +177,29 @@ if ( ! class_exists( 'Post_Views_Counter' ) ) :
|
|
163 |
* @return void
|
164 |
*/
|
165 |
public function __construct() {
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
182 |
}
|
183 |
|
184 |
/**
|
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.13
|
6 |
Author: dFactory
|
7 |
Author URI: http://www.dfactory.eu/
|
8 |
Plugin URI: http://www.dfactory.eu/plugins/post-views-counter/
|
31 |
* Post Views Counter final class.
|
32 |
*
|
33 |
* @class Post_Views_Counter
|
34 |
+
* @version 1.2.13
|
35 |
*/
|
36 |
final class Post_Views_Counter {
|
37 |
|
81 |
'link_to_post' => true,
|
82 |
'icon_class' => 'dashicons-chart-bar'
|
83 |
),
|
84 |
+
'version' => '1.2.13'
|
85 |
);
|
86 |
|
87 |
/**
|
109 |
|
110 |
self::$instance = new Post_Views_Counter;
|
111 |
self::$instance->define_constants();
|
112 |
+
|
113 |
+
// minimal setup for Fast AJAX
|
114 |
+
if ( defined( 'SHORTINIT' ) && SHORTINIT ) {
|
115 |
+
include_once( POST_VIEWS_COUNTER_PATH . 'includes/counter.php' );
|
116 |
+
include_once( POST_VIEWS_COUNTER_PATH . 'includes/crawler-detect.php' );
|
117 |
+
|
118 |
+
self::$instance->counter = new Post_Views_Counter_Counter();
|
119 |
+
self::$instance->crawler_detect = new Post_Views_Counter_Crawler_Detect();
|
120 |
+
// regular setup
|
121 |
+
} else {
|
122 |
+
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
|
123 |
+
|
124 |
+
self::$instance->includes();
|
125 |
+
|
126 |
+
self::$instance->update = new Post_Views_Counter_Update();
|
127 |
+
self::$instance->settings = new Post_Views_Counter_Settings();
|
128 |
+
self::$instance->query = new Post_Views_Counter_Query();
|
129 |
+
self::$instance->cron = new Post_Views_Counter_Cron();
|
130 |
+
self::$instance->counter = new Post_Views_Counter_Counter();
|
131 |
+
self::$instance->columns = new Post_Views_Counter_Columns();
|
132 |
+
self::$instance->crawler_detect = new Post_Views_Counter_Crawler_Detect();
|
133 |
+
self::$instance->frontend = new Post_Views_Counter_Frontend();
|
134 |
+
self::$instance->dashboard = new Post_Views_Counter_Dashboard();
|
135 |
+
self::$instance->widgets = new Post_Views_Counter_Widgets();
|
136 |
+
}
|
137 |
}
|
138 |
return self::$instance;
|
139 |
}
|
144 |
* @return void
|
145 |
*/
|
146 |
private function define_constants() {
|
147 |
+
// fix plugin_basename empty $wp_plugin_paths var
|
148 |
+
if ( ! ( defined( 'SHORTINIT' ) && SHORTINIT ) ) {
|
149 |
+
define( 'POST_VIEWS_COUNTER_URL', plugins_url( '', __FILE__ ) );
|
150 |
+
define( 'POST_VIEWS_COUNTER_REL_PATH', dirname( plugin_basename( __FILE__ ) ) . '/' );
|
151 |
+
}
|
152 |
+
|
153 |
define( 'POST_VIEWS_COUNTER_PATH', plugin_dir_path( __FILE__ ) );
|
|
|
154 |
}
|
155 |
|
156 |
/**
|
177 |
* @return void
|
178 |
*/
|
179 |
public function __construct() {
|
180 |
+
if ( defined( 'SHORTINIT' ) && SHORTINIT ) {
|
181 |
+
$this->options = array(
|
182 |
+
'general' => array_merge( $this->defaults['general'], get_option( 'post_views_counter_settings_general', $this->defaults['general'] ) ),
|
183 |
+
'display' => array_merge( $this->defaults['display'], get_option( 'post_views_counter_settings_display', $this->defaults['display'] ) )
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
register_activation_hook( __FILE__, array( $this, 'multisite_activation' ) );
|
187 |
+
register_deactivation_hook( __FILE__, array( $this, 'multisite_deactivation' ) );
|
188 |
+
|
189 |
+
// settings
|
190 |
+
$this->options = array(
|
191 |
+
'general' => array_merge( $this->defaults['general'], get_option( 'post_views_counter_settings_general', $this->defaults['general'] ) ),
|
192 |
+
'display' => array_merge( $this->defaults['display'], get_option( 'post_views_counter_settings_display', $this->defaults['display'] ) )
|
193 |
+
);
|
194 |
|
195 |
+
// actions
|
196 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
197 |
+
add_action( 'wp_loaded', array( $this, 'load_pluggable_functions' ), 10 );
|
198 |
|
199 |
+
// filters
|
200 |
+
add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
|
201 |
+
add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
|
202 |
+
}
|
203 |
}
|
204 |
|
205 |
/**
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: counter, hits, posts, postviews, post views, views, count, statistics, sta
|
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
Tested up to: 4.9.6
|
8 |
-
Stable tag: 1.2.
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
@@ -20,7 +20,7 @@ For more information, check out plugin page at [dFactory](http://www.dfactory.eu
|
|
20 |
= Features include: =
|
21 |
|
22 |
* Option to select post types for which post views will be counted and displayed.
|
23 |
-
*
|
24 |
* GDPR compatibility with [Cookie Notice](https://wordpress.org/plugins/cookie-notice/) plugin
|
25 |
* Possibility to manually set views count for each post
|
26 |
* Dashboard post views stats widget
|
@@ -62,6 +62,9 @@ No questions yet.
|
|
62 |
|
63 |
== Changelog ==
|
64 |
|
|
|
|
|
|
|
65 |
= 1.2.12 =
|
66 |
* New: GDPR compatibility with Cookie Notice plugin
|
67 |
|
@@ -177,5 +180,5 @@ Initial release
|
|
177 |
|
178 |
== Upgrade Notice ==
|
179 |
|
180 |
-
= 1.2.
|
181 |
-
* New:
|
5 |
Requires at least: 4.0
|
6 |
Requires PHP: 5.2.4
|
7 |
Tested up to: 4.9.6
|
8 |
+
Stable tag: 1.2.13
|
9 |
License: MIT License
|
10 |
License URI: http://opensource.org/licenses/MIT
|
11 |
|
20 |
= Features include: =
|
21 |
|
22 |
* Option to select post types for which post views will be counted and displayed.
|
23 |
+
* 4 methods of collecting post views data: PHP, Javascript, Fast AJAX and REST API for greater flexibility
|
24 |
* GDPR compatibility with [Cookie Notice](https://wordpress.org/plugins/cookie-notice/) plugin
|
25 |
* Possibility to manually set views count for each post
|
26 |
* Dashboard post views stats widget
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 1.2.13 =
|
66 |
+
* New: Experimental Fast AJAX counter method (10+ times faster)
|
67 |
+
|
68 |
= 1.2.12 =
|
69 |
* New: GDPR compatibility with Cookie Notice plugin
|
70 |
|
180 |
|
181 |
== Upgrade Notice ==
|
182 |
|
183 |
+
= 1.2.13 =
|
184 |
+
* New: Experimental Fast AJAX counter method (10+ times faster)
|