Version Description
- 10-08-2018 =
- minor bug fixed.
Download this release
Release Info
Developer | dots |
Plugin | Page Visit Counter |
Version | 4.7 |
Comparing to | |
See all releases |
Code changes from version 4.6 to 4.7
- README.txt +4 -1
- page_visit_counter.php +1 -1
- public/class-page-visit-counter-public.php +536 -542
README.txt
CHANGED
@@ -4,7 +4,7 @@ Plugin URI: http://multidots.com/
|
|
4 |
Author: Multidots
|
5 |
Author URI: http://multidots.com/
|
6 |
Contributors: dots, ketuchetan, chiragpatel, jitendrabanjara1991, thedotstore
|
7 |
-
Stable tag: 4.
|
8 |
Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
|
9 |
Requires at least: 2.1
|
10 |
Tested up to: 4.9.6
|
@@ -115,6 +115,9 @@ Automatic updates should work great for you. As always, though, we recommend ba
|
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
118 |
= 4.6 - 14-06-2018 =
|
119 |
* Fixed language issue.
|
120 |
|
4 |
Author: Multidots
|
5 |
Author URI: http://multidots.com/
|
6 |
Contributors: dots, ketuchetan, chiragpatel, jitendrabanjara1991, thedotstore
|
7 |
+
Stable tag: 4.7
|
8 |
Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
|
9 |
Requires at least: 2.1
|
10 |
Tested up to: 4.9.6
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 4.7 - 10-08-2018 =
|
119 |
+
* minor bug fixed.
|
120 |
+
|
121 |
= 4.6 - 14-06-2018 =
|
122 |
* Fixed language issue.
|
123 |
|
page_visit_counter.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Plugin URI: http://www.multidots.com/
|
8 |
* Description: This plugin will count the total visits of your sites pages.
|
9 |
* Author: Multidots
|
10 |
-
* Version: 4.
|
11 |
* Author URI: http://www.multidots.com/
|
12 |
*/
|
13 |
// If this file is called directly, abort.
|
7 |
* Plugin URI: http://www.multidots.com/
|
8 |
* Description: This plugin will count the total visits of your sites pages.
|
9 |
* Author: Multidots
|
10 |
+
* Version: 4.7
|
11 |
* Author URI: http://www.multidots.com/
|
12 |
*/
|
13 |
// If this file is called directly, abort.
|
public/class-page-visit-counter-public.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
// If this file is called directly, abort.
|
3 |
-
if ( !defined( 'ABSPATH' ) ) {
|
4 |
-
|
5 |
}
|
6 |
/**
|
7 |
* The admin-specific functionality of the plugin.
|
@@ -25,559 +25,553 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
25 |
*/
|
26 |
class page_visit_counter_Public {
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
|
|
|
|
|
|
|
|
430 |
|
431 |
-
|
432 |
-
|
433 |
-
if (isset($text_color_page_visit) && $text_color_page_visit != null) {
|
434 |
-
$text_color_page_visit = 'style="color: '.$text_color_page_visit.';"';
|
435 |
-
} else {
|
436 |
-
$text_color_page_visit = 'style="color: #000000;"';
|
437 |
-
}
|
438 |
-
|
439 |
-
$enableToday = '';
|
440 |
-
$enableToday = get_post_meta($pageID,'enable_page_count_day_wise',true);
|
441 |
-
|
442 |
-
$table_name = $wpdb->prefix."page_visit";
|
443 |
-
$table_name_history = $wpdb->prefix."page_visit_history";
|
444 |
|
445 |
-
|
446 |
-
|
447 |
|
448 |
-
|
449 |
-
|
450 |
|
451 |
-
$total = (int) $pageCount[0]->total;
|
452 |
-
$totalToday = (int) $pageCountToday[0]->total;
|
453 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
|
460 |
-
if ('yes' === $enableToday || '' === $enableToday) {
|
461 |
-
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(plugins_url('images/1456175371_vector_65_14.png', dirname(__FILE__) )).'" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.esc_attr($total).'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.esc_attr($totalToday).'</span>'.__('visits today','page-visit-counter').'</p>';
|
462 |
-
} else {
|
463 |
-
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(plugins_url('images/1456175371_vector_65_14.png', dirname(__FILE__) )).'" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.esc_attr($total).'</span>'.__('total visits.','page-visit-counter').'</p>';
|
464 |
-
}
|
465 |
-
} else {
|
466 |
-
$postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
|
467 |
-
if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
|
468 |
-
$innerSettings = get_post_meta($pageID,'enable_page_count',true);
|
469 |
-
if ($innerSettings == '' || $innerSettings == 'yes') {
|
470 |
-
if ('yes' === $enableToday || '' === $enableToday) {
|
471 |
-
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(plugins_url('images/1456175371_vector_65_14.png', dirname(__FILE__) )).'" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.esc_attr($total).'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.esc_attr($totalToday).'</span>'.__('visits today','page-visit-counter').'</p>';
|
472 |
-
} else {
|
473 |
-
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(plugins_url('images/1456175371_vector_65_14.png', dirname(__FILE__) )).'" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.esc_attr($total).'</span>'.__('total visits.','page-visit-counter').'</p>';
|
474 |
-
}
|
475 |
-
}
|
476 |
-
}
|
477 |
-
}
|
478 |
-
}
|
479 |
-
}
|
480 |
|
481 |
-
|
482 |
-
} else {
|
483 |
-
echo $content; // WPCS: XSS OK.
|
484 |
-
}
|
485 |
|
486 |
-
|
|
|
487 |
|
488 |
-
|
489 |
-
|
|
|
490 |
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
496 |
-
$pageID = url_to_postid( esc_url($actual_link) );
|
497 |
-
}
|
498 |
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
|
|
512 |
|
513 |
// echo esc_attr($text_color_page_visit1);
|
514 |
// sanitize_text_field(wp_unslash($text_color_page_visit));
|
515 |
-
|
516 |
-
|
517 |
// sanitize_text_field(wp_unslash($text_color_page_visit));
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
|
|
|
|
583 |
}
|
1 |
<?php
|
2 |
// If this file is called directly, abort.
|
3 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
+
exit;
|
5 |
}
|
6 |
/**
|
7 |
* The admin-specific functionality of the plugin.
|
25 |
*/
|
26 |
class page_visit_counter_Public {
|
27 |
|
28 |
+
/**
|
29 |
+
* The ID of this plugin.
|
30 |
+
*
|
31 |
+
* @since 1.0.0
|
32 |
+
* @access private
|
33 |
+
* @var string $plugin_name The ID of this plugin.
|
34 |
+
*/
|
35 |
+
private $plugin_name;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* The version of this plugin.
|
39 |
+
*
|
40 |
+
* @since 1.0.0
|
41 |
+
* @access private
|
42 |
+
* @var string $version The current version of this plugin.
|
43 |
+
*/
|
44 |
+
private $version;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* Initialize the class and set its properties.
|
48 |
+
*
|
49 |
+
* @since 1.0.0
|
50 |
+
*
|
51 |
+
* @param string $plugin_name The name of this plugin.
|
52 |
+
* @param string $version The version of this plugin.
|
53 |
+
*/
|
54 |
+
public function __construct( $plugin_name, $version ) {
|
55 |
+
|
56 |
+
$this->plugin_name = $plugin_name;
|
57 |
+
$this->version = $version;
|
58 |
+
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Register the stylesheets for the admin area.
|
63 |
+
*
|
64 |
+
* @since 1.0.0
|
65 |
+
*/
|
66 |
+
public function enqueue_styles() {
|
67 |
+
global $wp;
|
68 |
+
|
69 |
+
wp_enqueue_style( 'counter-style', plugin_dir_url( __FILE__ ) . 'css/counter-style.css' );
|
70 |
+
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Register the JavaScript for the admin area.
|
75 |
+
*
|
76 |
+
* @since 1.0.0
|
77 |
+
*/
|
78 |
+
public function enqueue_scripts() {
|
79 |
+
global $wp;
|
80 |
+
wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
|
81 |
+
$current_url = home_url( $wp->request );
|
82 |
+
wp_localize_script( 'one', 'pagevisit', array(
|
83 |
+
'ajaxurl' => admin_url( 'admin-ajax.php' ),
|
84 |
+
'pageurl' => $current_url,
|
85 |
+
) );
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* action use in call header
|
91 |
+
* Insert_page_visit_counter function use insert the page data
|
92 |
+
* pageid,Currentdate,Ipaddress,pagecount add in database.
|
93 |
+
*/
|
94 |
+
|
95 |
+
public function insert_page_visit_counter() {
|
96 |
+
global $wpdb, $wp, $post, $wp_query;
|
97 |
+
|
98 |
+
$flag = 0;
|
99 |
+
// Check the site running on HTTPS. If the site running on HTTPS then we are removing S from HTTPS
|
100 |
+
if ( is_ssl() ) {
|
101 |
+
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
102 |
+
if ( strpos( $actual_link, 'wp-admin' ) !== false ) {
|
103 |
+
$page = 0;
|
104 |
+
$flag = 1;
|
105 |
+
} else {
|
106 |
+
$page = url_to_postid( preg_replace( '/^https(?=:\/\/)/i', 'http', esc_url( $actual_link ) ) );
|
107 |
+
}
|
108 |
+
} else {
|
109 |
+
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
110 |
+
if ( strpos( $actual_link, 'wp-admin' ) !== false ) {
|
111 |
+
$page = 0;
|
112 |
+
$flag = 1;
|
113 |
+
} else {
|
114 |
+
$page = url_to_postid( esc_url( $actual_link ) );
|
115 |
+
}
|
116 |
+
}
|
117 |
+
$pageID = $page;
|
118 |
+
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
|
119 |
+
if ( is_shop() ) {
|
120 |
+
$page = (int) get_option( 'woocommerce_shop_page_id' );
|
121 |
+
}
|
122 |
+
if ( is_cart() ) {
|
123 |
+
$page = (int) get_option( 'woocommerce_cart_page_id' );
|
124 |
+
}
|
125 |
+
if ( is_checkout() ) {
|
126 |
+
$page = (int) get_option( 'woocommerce_checkout_page_id' );
|
127 |
+
|
128 |
+
}
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
if ( $flag == 0 ) {
|
133 |
+
|
134 |
+
if ( $page == 0 ) {
|
135 |
+
$page = get_the_ID();
|
136 |
+
if ( $page == 0 ) {
|
137 |
+
$current_url = home_url( $wp->request );
|
138 |
+
if ( is_ssl() ) {
|
139 |
+
$page = url_to_postid( preg_replace( '/^https(?=:\/\/)/i', 'http', $current_url ) );
|
140 |
+
} else {
|
141 |
+
$page = url_to_postid( $current_url );
|
142 |
+
}
|
143 |
+
if ( $page == 0 ) {
|
144 |
+
$queried_object = get_queried_object();
|
145 |
+
|
146 |
+
if ( $queried_object ) {
|
147 |
+
$post_id = $queried_object->ID;
|
148 |
+
$page = $post_id;
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
+
if ( $page != 0 ) {
|
156 |
+
|
157 |
+
|
158 |
+
$table_name = $wpdb->prefix . "page_visit";
|
159 |
+
$table_name_history = $wpdb->prefix . "page_visit_history";
|
160 |
+
$last_date = '';
|
161 |
+
$page_contet = get_post( $page );
|
162 |
+
|
163 |
+
$currentdate = date( "Y-m-d" );
|
164 |
+
$ipaddress = $_SERVER['REMOTE_ADDR'];
|
165 |
+
|
166 |
+
$fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
|
167 |
+
if ( $fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null ) {
|
168 |
+
$post_types = get_post_types();
|
169 |
+
$postArr = array();
|
170 |
+
if ( isset( $post_types ) && ! empty( $post_types ) ) {
|
171 |
+
foreach ( $post_types as $cpost ) {
|
172 |
+
if ( $cpost != "attachment" && $cpost != "revision" && $cpost != "nav_menu_item" && $cpost != "product_variation" && $cpost != "shop_order" && $cpost != "shop_order_refund" && $cpost != "shop_coupon" && $cpost != "shop_webhook" && $cpost != "scheduled-action" && $cpost != "shop_subscription" && $cpost != "wpcf7_contact_form" && $cpost != "mc4wp-form" ) {
|
173 |
+
$postArr[] = $cpost;
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
|
178 |
+
delete_option( 'wfap_post_type' );
|
179 |
+
if ( isset( $postArr ) && $postArr != null ) {
|
180 |
+
update_option( 'wfap_post_type', json_encode( array_values( $postArr ) ) );
|
181 |
+
}
|
182 |
+
$fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
|
183 |
+
}
|
184 |
+
|
185 |
+
$postTypeSelectedDecodeArr = ! empty( $fetchSelecetedPostTypes ) ? $fetchSelecetedPostTypes : json_encode( array() );
|
186 |
+
|
187 |
+
|
188 |
+
$fetchSelecetedIpAddress = get_option( 'ipaddress_visit' );
|
189 |
+
$optionsIpAddressDecodedArr = ! empty( $fetchSelecetedIpAddress ) ? $fetchSelecetedIpAddress : json_encode( array() );
|
190 |
+
|
191 |
+
|
192 |
+
$fetchSelecetedUserId = get_option( 'userlist_visit' );
|
193 |
+
$optionsUserIdDecodedArr = ! empty( $fetchSelecetedUserId ) ? $fetchSelecetedUserId : json_encode( array() );
|
194 |
+
|
195 |
+
$pageCount_limit = intval( 1 );
|
196 |
+
$pageCount_qry = $wpdb->prepare( 'SELECT * FROM ' . $table_name . ' WHERE page_id=%d AND ipaddress=%s AND date=%s LIMIT %d', $page, $ipaddress, $currentdate, $pageCount_limit );
|
197 |
+
$pageCount = $wpdb->get_results( $pageCount_qry );
|
198 |
+
|
199 |
+
$getPageSetting = get_post_meta( $page, 'enable_page_count', true );
|
200 |
+
|
201 |
+
$u_agent = $_SERVER['HTTP_USER_AGENT'];
|
202 |
+
|
203 |
+
$bname = 'Unknown';
|
204 |
+
$platform = 'Unknown';
|
205 |
+
$version = "";
|
206 |
+
$ub = "";
|
207 |
+
|
208 |
+
//First get the platform?
|
209 |
+
if ( preg_match( '/linux/i', $u_agent ) ) {
|
210 |
+
$platform = 'linux';
|
211 |
+
} elseif ( preg_match( '/macintosh|mac os x/i', $u_agent ) ) {
|
212 |
+
$platform = 'mac';
|
213 |
+
} elseif ( preg_match( '/windows|win32/i', $u_agent ) ) {
|
214 |
+
$platform = 'windows';
|
215 |
+
}
|
216 |
+
|
217 |
+
// Next get the name of the useragent yes seperately and for good reason
|
218 |
+
if ( preg_match( '/MSIE/i', $u_agent ) && ! preg_match( '/Opera/i', $u_agent ) ) {
|
219 |
+
$bname = 'Internet Explorer';
|
220 |
+
$ub = "MSIE";
|
221 |
+
} elseif ( preg_match( '/Firefox/i', $u_agent ) ) {
|
222 |
+
$bname = 'Mozilla Firefox';
|
223 |
+
$ub = "Firefox";
|
224 |
+
} elseif ( preg_match( '/Chrome/i', $u_agent ) ) {
|
225 |
+
$bname = 'Google Chrome';
|
226 |
+
$ub = "Chrome";
|
227 |
+
} elseif ( preg_match( '/Safari/i', $u_agent ) ) {
|
228 |
+
$bname = 'Apple Safari';
|
229 |
+
$ub = "Safari";
|
230 |
+
} elseif ( preg_match( '/Opera/i', $u_agent ) ) {
|
231 |
+
$bname = 'Opera';
|
232 |
+
$ub = "Opera";
|
233 |
+
} elseif ( preg_match( '/Netscape/i', $u_agent ) ) {
|
234 |
+
$bname = 'Netscape';
|
235 |
+
$ub = "Netscape";
|
236 |
+
}
|
237 |
+
|
238 |
+
|
239 |
+
// finally get the correct version number
|
240 |
+
$known = array( 'Version', $ub, 'other' );
|
241 |
+
$pattern = '#(?<browser>' . join( '|', $known ) .
|
242 |
+
')[/ ]+(?<version>[0-9.|a-zA-Z.]*)#';
|
243 |
+
if ( ! preg_match_all( $pattern, $u_agent, $matches ) ) {
|
244 |
+
// we have no matching number just continue
|
245 |
+
}
|
246 |
+
|
247 |
+
// see how many we have
|
248 |
+
$i = count( $matches['browser'] );
|
249 |
+
if ( $i != 1 ) {
|
250 |
+
//we will have two since we are not using 'other' argument yet
|
251 |
+
//see if version is before or after the name
|
252 |
+
if ( strripos( $u_agent, "Version" ) < strripos( $u_agent, $ub ) ) {
|
253 |
+
$version = $matches['version'][0];
|
254 |
+
} else {
|
255 |
+
$version = isset( $matches['version'][1] ) ? $matches['version'][1] : null;;
|
256 |
+
}
|
257 |
+
} else {
|
258 |
+
$version = isset( $matches['version'][0] ) ? $matches['version'][0] : null;;
|
259 |
+
}
|
260 |
+
|
261 |
+
// check if we have a number
|
262 |
+
if ( $version == null || $version == "" ) {
|
263 |
+
$version = "?";
|
264 |
+
}
|
265 |
+
|
266 |
+
$http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
|
267 |
+
|
268 |
+
// old version plugin
|
269 |
+
if ( $fetchSelecetedPostTypes != '' ) {
|
270 |
+
|
271 |
+
$postTypeSelectedEncodeArr = json_decode( $postTypeSelectedDecodeArr );
|
272 |
+
$getPageSetting = get_post_meta( $page, 'enable_page_count', true );
|
273 |
+
|
274 |
+
// Check current page/post type exist in settings page array
|
275 |
+
if ( in_array( $page_contet->post_type, $postTypeSelectedEncodeArr ) ) {
|
276 |
+
|
277 |
+
// Check current page/post metabox settings is blank OR selected value is yes
|
278 |
+
if ( $getPageSetting == '' || $getPageSetting == 'yes' ) {
|
279 |
+
|
280 |
+
// Check IP Address set in settings page if yes
|
281 |
+
if ( isset( $fetchSelecetedIpAddress ) && ! empty( $fetchSelecetedIpAddress ) ) {
|
282 |
+
|
283 |
+
$optionsIpAddressEncodeArr = json_decode( $optionsIpAddressDecodedArr );
|
284 |
+
// Check IP Address not listed in settings page then go ahed
|
285 |
+
if ( ! in_array( $ipaddress, $optionsIpAddressEncodeArr ) ) {
|
286 |
+
|
287 |
+
// Check users set in settings page if yes
|
288 |
+
if ( isset( $fetchSelecetedUserId ) && ! empty( $fetchSelecetedUserId ) ) {
|
289 |
+
|
290 |
+
$optionsUserIdEncodeArr = json_decode( $optionsUserIdDecodedArr );
|
291 |
+
$user_id = get_current_user_id();
|
292 |
+
|
293 |
+
// Check user not listed in settings page then go ahed
|
294 |
+
if ( ! in_array( $user_id, $optionsUserIdEncodeArr ) ) {
|
295 |
+
|
296 |
+
if ( isset( $pageCount ) && ! empty( $pageCount ) ) {
|
297 |
+
$existingtotal = (int) $pageCount[0]->page_visit;
|
298 |
+
$totalFinal = $existingtotal + 1;
|
299 |
+
$update_Query = $wpdb->query( "UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='" . $page . "' AND ipaddress='$ipaddress' AND date = '$currentdate'" );
|
300 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
301 |
+
} else {
|
302 |
+
$insert_Query = $wpdb->query( "INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')" );
|
303 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
304 |
+
}
|
305 |
+
}
|
306 |
+
} else {
|
307 |
+
if ( isset( $pageCount ) && ! empty( $pageCount ) ) {
|
308 |
+
$existingtotal = (int) $pageCount[0]->page_visit;
|
309 |
+
$totalFinal = $existingtotal + 1;
|
310 |
+
$update_Query = $wpdb->query( "UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='" . $page . "' AND ipaddress='$ipaddress' AND date = '$currentdate'" );
|
311 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
312 |
+
} else {
|
313 |
+
$insert_Query = $wpdb->query( "INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')" );
|
314 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
315 |
+
}
|
316 |
+
}
|
317 |
+
}
|
318 |
+
} else {
|
319 |
+
// Check users set in settings page if yes
|
320 |
+
if ( isset( $fetchSelecetedUserId ) && ! empty( $fetchSelecetedUserId ) ) {
|
321 |
+
|
322 |
+
$optionsUserIdEncodeArr = json_decode( $optionsUserIdDecodedArr );
|
323 |
+
$user_id = get_current_user_id();
|
324 |
+
|
325 |
+
// Check user not listed in settings page then go ahed
|
326 |
+
if ( ! in_array( $user_id, $optionsUserIdEncodeArr ) ) {
|
327 |
+
|
328 |
+
if ( isset( $pageCount ) && ! empty( $pageCount ) ) {
|
329 |
+
$existingtotal = (int) $pageCount[0]->page_visit;
|
330 |
+
$totalFinal = $existingtotal + 1;
|
331 |
+
$update_Query = $wpdb->query( "UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='" . $page . "' AND ipaddress='$ipaddress' AND date = '$currentdate'" );
|
332 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
333 |
+
} else {
|
334 |
+
$insert_Query = $wpdb->query( "INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')" );
|
335 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
336 |
+
}
|
337 |
+
}
|
338 |
+
} else {
|
339 |
+
if ( isset( $pageCount ) && ! empty( $pageCount ) ) {
|
340 |
+
$existingtotal = (int) $pageCount[0]->page_visit;
|
341 |
+
$totalFinal = $existingtotal + 1;
|
342 |
+
$update_Query = $wpdb->query( "UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='" . $page . "' AND ipaddress='$ipaddress' AND date = '$currentdate'" );
|
343 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
344 |
+
} else {
|
345 |
+
$insert_Query = $wpdb->query( "INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')" );
|
346 |
+
$insert_Query_history = $wpdb->query( "INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')" );
|
347 |
+
}
|
348 |
+
}
|
349 |
+
}
|
350 |
+
}
|
351 |
+
}
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
}
|
356 |
+
|
357 |
+
public function display_page_visit_counter_ajax() {
|
358 |
+
global $wpdb, $wp, $post;
|
359 |
+
|
360 |
+
$pageurl = sanitize_text_field( wp_unslash( $_POST['pageurl'] ) );
|
361 |
+
|
362 |
+
if ( is_ssl() ) {
|
363 |
+
$pageID = url_to_postid( preg_replace( '/^https(?=:\/\/)/i', 'http', $pageurl ) );
|
364 |
+
} else {
|
365 |
+
$pageID = url_to_postid( $pageurl );
|
366 |
+
}
|
367 |
+
|
368 |
+
if ( strpos( $pageurl, '/shop' ) !== false && $pageID == 0 ) {
|
369 |
+
$pageID = (int) get_option( 'woocommerce_shop_page_id' );
|
370 |
+
}
|
371 |
+
|
372 |
+
$post = get_post( $pageID );
|
373 |
+
|
374 |
+
$fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
|
375 |
+
|
376 |
+
$table_name = $wpdb->prefix . "page_visit";
|
377 |
+
|
378 |
+
$pageCount_qry = $wpdb->prepare( 'SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID );
|
379 |
+
$pageCount = $wpdb->get_results( $pageCount_qry );
|
380 |
+
|
381 |
+
$table_name_history = $wpdb->prefix . "page_visit_history";
|
382 |
+
|
383 |
+
$pageCountToday_qry = $wpdb->prepare( 'SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID );
|
384 |
+
$pageCountToday = $wpdb->get_results( $pageCountToday_qry );
|
385 |
+
|
386 |
+
$total = (int) $pageCount[0]->total;
|
387 |
+
|
388 |
+
$totalToday = (int) $pageCountToday[0]->total;
|
389 |
+
|
390 |
+
$temp = array();
|
391 |
+
|
392 |
+
$temp['today'] = $totalToday;
|
393 |
+
$temp['total'] = $total;
|
394 |
+
|
395 |
+
echo json_encode( $temp );
|
396 |
+
|
397 |
+
die();
|
398 |
+
|
399 |
+
}
|
400 |
+
|
401 |
+
public function insert_page_visit_counter_total_block_shop_page( $content ) {
|
402 |
+
global $wpdb, $wp, $post;
|
403 |
+
|
404 |
+
if ( is_ssl() ) {
|
405 |
+
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
406 |
+
$pageID = url_to_postid( preg_replace( '/^https(?=:\/\/)/i', 'http', $actual_link ) );
|
407 |
+
} else {
|
408 |
+
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
409 |
+
$pageID = url_to_postid( $actual_link );
|
410 |
+
}
|
411 |
+
|
412 |
+
if ( ( $_SERVER['REQUEST_URI'] == '/shop/' || strpos( $_SERVER['REQUEST_URI'], '/shop/' ) !== false ) && $pageID == 0 ) {
|
413 |
+
$pageID = (int) get_option( 'woocommerce_shop_page_id' );
|
414 |
+
}
|
415 |
+
|
416 |
+
if ( $pageID != 0 ) {
|
417 |
+
$post = get_post( $pageID );
|
418 |
+
|
419 |
+
$fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
|
420 |
+
|
421 |
+
$text_color_page_visit = get_option( 'text_color_page_visit' );
|
422 |
+
|
423 |
+
if ( isset( $text_color_page_visit ) && $text_color_page_visit != null ) {
|
424 |
+
$text_color_page_visit = 'style="color: ' . $text_color_page_visit . ';"';
|
425 |
+
} else {
|
426 |
+
$text_color_page_visit = 'style="color: #000000;"';
|
427 |
+
}
|
428 |
+
|
429 |
+
$enableToday = '';
|
430 |
+
$enableToday = get_post_meta( $pageID, 'enable_page_count_day_wise', true );
|
431 |
+
|
432 |
+
$table_name = $wpdb->prefix . "page_visit";
|
433 |
+
$table_name_history = $wpdb->prefix . "page_visit_history";
|
434 |
|
435 |
+
$pageCount_qry = $wpdb->prepare( 'SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID );
|
436 |
+
$pageCount = $wpdb->get_results( $pageCount_qry );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
437 |
|
438 |
+
$pageCountToday_qry = $wpdb->prepare( 'SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID );
|
439 |
+
$pageCountToday = $wpdb->get_results( $pageCountToday_qry );
|
440 |
|
441 |
+
$total = (int) $pageCount[0]->total;
|
442 |
+
$totalToday = (int) $pageCountToday[0]->total;
|
443 |
|
|
|
|
|
444 |
|
445 |
+
$html = '';
|
446 |
+
$hide_show_option = get_option( 'counter_hide_show_front_vew' );
|
447 |
+
if ( $hide_show_option == 'on' ) {
|
448 |
+
if ( ! is_feed() && ! is_home() ) {
|
449 |
+
if ( $fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null ) {
|
450 |
+
if ( 'yes' === $enableToday || '' === $enableToday ) {
|
451 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits,', 'page-visit-counter' ) . '<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">' . esc_attr( $totalToday ) . '</span>' . __( 'visits today', 'page-visit-counter' ) . '</p>';
|
452 |
+
} else {
|
453 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits.', 'page-visit-counter' ) . '</p>';
|
454 |
+
}
|
455 |
+
} else {
|
456 |
+
$postTypeSelectedEncodeArr = json_decode( $fetchSelecetedPostTypes );
|
457 |
+
if ( in_array( $post->post_type, $postTypeSelectedEncodeArr ) ) {
|
458 |
+
$innerSettings = get_post_meta( $pageID, 'enable_page_count', true );
|
459 |
+
if ( $innerSettings == '' || $innerSettings == 'yes' ) {
|
460 |
+
if ( 'yes' === $enableToday || '' === $enableToday ) {
|
461 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits,', 'page-visit-counter' ) . '<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">' . esc_attr( $totalToday ) . '</span>' . __( 'visits today', 'page-visit-counter' ) . '</p>';
|
462 |
+
} else {
|
463 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits.', 'page-visit-counter' ) . '</p>';
|
464 |
+
}
|
465 |
+
}
|
466 |
+
}
|
467 |
+
}
|
468 |
+
}
|
469 |
+
}
|
470 |
|
471 |
+
echo $content . ' ' . $html; // WPCS: XSS OK.
|
472 |
+
} else {
|
473 |
+
echo $content; // WPCS: XSS OK.
|
474 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
+
}
|
|
|
|
|
|
|
477 |
|
478 |
+
public function insert_page_visit_counter_total_block( $content ) {
|
479 |
+
global $wpdb, $wp, $post;
|
480 |
|
481 |
+
if ( is_ssl() ) {
|
482 |
+
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
483 |
+
$pageID = url_to_postid( preg_replace( '/^https(?=:\/\/)/i', 'http', esc_url( $actual_link ) ) );
|
484 |
|
485 |
+
} else {
|
486 |
+
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
487 |
+
$pageID = url_to_postid( esc_url( $actual_link ) );
|
488 |
+
}
|
|
|
|
|
|
|
489 |
|
490 |
+
if ( ( $_SERVER['REQUEST_URI'] == '/shop/' || strpos( $_SERVER['REQUEST_URI'], '/shop/' ) !== false ) && $pageID == 0 ) {
|
491 |
+
$pageID = (int) get_option( 'woocommerce_shop_page_id' );
|
492 |
+
}
|
493 |
+
|
494 |
+
if ( $pageID != 0 ) {
|
495 |
+
// $post = get_post( $pageID );
|
496 |
+
global $post;
|
497 |
+
//
|
498 |
+
$fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
|
499 |
+
|
500 |
+
$text_color_page_visit = get_option( 'text_color_page_visit' );
|
501 |
+
|
502 |
+
if ( isset( $text_color_page_visit ) && $text_color_page_visit != null ) {
|
503 |
+
$text_color_page_visit1 = 'style="color: ' . esc_attr( $text_color_page_visit ) . ';"';
|
504 |
|
505 |
// echo esc_attr($text_color_page_visit1);
|
506 |
// sanitize_text_field(wp_unslash($text_color_page_visit));
|
507 |
+
} else {
|
508 |
+
$text_color_page_visit1 = 'style="color: #000000;"';
|
509 |
// sanitize_text_field(wp_unslash($text_color_page_visit));
|
510 |
+
}
|
511 |
+
|
512 |
+
$enableToday = '';
|
513 |
+
$enableToday = get_post_meta( $pageID, 'enable_page_count_day_wise', true );
|
514 |
+
|
515 |
+
$table_name = $wpdb->prefix . "page_visit";
|
516 |
+
$table_name_history = $wpdb->prefix . "page_visit_history";
|
517 |
+
|
518 |
+
$pageCount_qry = $wpdb->prepare( 'SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID );
|
519 |
+
$pageCount = $wpdb->get_results( $pageCount_qry );
|
520 |
+
|
521 |
+
$pageCountToday_qry = $wpdb->prepare( 'SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID );
|
522 |
+
$pageCountToday = $wpdb->get_results( $pageCountToday_qry );
|
523 |
+
|
524 |
+
$total = (int) $pageCount[0]->total;
|
525 |
+
$totalToday = (int) $pageCountToday[0]->total;
|
526 |
+
|
527 |
+
$html = '';
|
528 |
+
$hide_show_option = get_option( 'counter_hide_show_front_vew' );
|
529 |
+
if ( $hide_show_option == 'on' ) {
|
530 |
+
if ( ! is_feed() && ! is_home() ) {
|
531 |
+
if ( $fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null ) {
|
532 |
+
if ( 'yes' === $enableToday || '' === $enableToday ) {
|
533 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit1 . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits,', 'page-visit-counter' ) . '<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">' . esc_attr( $totalToday ) . '</span>' . __( 'visits today', 'page-visit-counter' ) . '</p>';
|
534 |
+
} else {
|
535 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit1 . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits.', 'page-visit-counter' ) . '</p>';
|
536 |
+
}
|
537 |
+
} else {
|
538 |
+
$postTypeSelectedEncodeArr = json_decode( $fetchSelecetedPostTypes );
|
539 |
+
if ( in_array( $post->post_type, $postTypeSelectedEncodeArr ) ) {
|
540 |
+
$innerSettings = get_post_meta( $pageID, 'enable_page_count', true );
|
541 |
+
if ( $innerSettings == '' || $innerSettings == 'yes' ) {
|
542 |
+
if ( 'yes' === $enableToday || '' === $enableToday ) {
|
543 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit1 . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits,', 'page-visit-counter' ) . '<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">' . esc_attr( $totalToday ) . '</span>' . __( 'visits today', 'page-visit-counter' ) . '</p>';
|
544 |
+
} else {
|
545 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" ' . $text_color_page_visit1 . '><img src="' . esc_url( plugins_url( 'images/1456175371_vector_65_14.png', dirname( __FILE__ ) ) ) . '" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">' . esc_attr( $total ) . '</span>' . __( 'total visits.', 'page-visit-counter' ) . '</p>';
|
546 |
+
}
|
547 |
+
}
|
548 |
+
}
|
549 |
+
}
|
550 |
+
}
|
551 |
+
}
|
552 |
+
$get_no_of_days = get_option( 'no_of_days_to_display' );
|
553 |
+
if ( $get_no_of_days == '' ) {
|
554 |
+
$get_no_of_days = 6;
|
555 |
+
} else {
|
556 |
+
$get_no_of_days = (int) $get_no_of_days + 1;
|
557 |
+
}
|
558 |
+
$query = "SELECT `page_id`, COUNT(`page_id`) as count,`date` FROM wp_page_visit_history Where DATE(`lastdate`) > DATE_SUB(CURDATE(), INTERVAL $get_no_of_days DAY) AND DATE(`lastdate`) < CURDATE() AND `page_id` = $pageID GROUP BY `lastdate`";
|
559 |
+
|
560 |
+
return $content . ' ' . $html;
|
561 |
+
} else {
|
562 |
+
return $content;
|
563 |
+
}
|
564 |
+
|
565 |
+
}
|
566 |
+
|
567 |
+
|
568 |
+
/**
|
569 |
+
* BN code added
|
570 |
+
*/
|
571 |
+
|
572 |
+
function paypal_bn_code_filter( $paypal_args ) {
|
573 |
+
$paypal_args['bn'] = 'Multidots_SP';
|
574 |
+
|
575 |
+
return $paypal_args;
|
576 |
+
}
|
577 |
}
|