Page Visit Counter - Version 4.0

Version Description

  • 30-09-2016 =
  • Check wordpress and woocommerce compatibility
  • Fixies - Shop page and checkout page error handled
  • Fixies - PHP error notice handled.
  • Fixies - Social Sharing issue
  • New - Added Shortcode to display total sites visit counts.
  • New - Added today count display
  • New - Admin Interface changes
  • New - Added responsive for the backend
Download this release

Release Info

Developer dots
Plugin Icon 128x128 Page Visit Counter
Version 4.0
Comparing to
See all releases

Code changes from version 3.0.4 to 4.0

README.txt CHANGED
@@ -4,10 +4,10 @@ Plugin URI: http://multidots.com/
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots
7
- Stable tag: 3.0.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.6
11
  Donate link:
12
  Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
@@ -99,7 +99,7 @@ In the search field type Page Visit Counter and click Search Plugins. Once you'v
99
 
100
  In which WordPress version this Plugin is compatible?
101
 
102
- It is compatible from 2.1 to 4.6 WordPress version.
103
 
104
  == Upgrade Notice ==
105
 
@@ -107,6 +107,16 @@ Automatic updates should work great for you. As always, though, we recommend ba
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
 
 
110
  = 3.0.4 - 26-08-2016 =
111
  * Check wordpress and woocommerce compatibility
112
  * Fixies - Shop page and checkout page error handled
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots
7
+ Stable tag: 4.0
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.6.1
11
  Donate link:
12
  Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
99
 
100
  In which WordPress version this Plugin is compatible?
101
 
102
+ It is compatible from 2.1 to 4.6.1 WordPress version.
103
 
104
  == Upgrade Notice ==
105
 
107
 
108
  == Changelog ==
109
 
110
+ = 4.0 - 30-09-2016 =
111
+ * Check wordpress and woocommerce compatibility
112
+ * Fixies - Shop page and checkout page error handled
113
+ * Fixies - PHP error notice handled.
114
+ * Fixies - Social Sharing issue
115
+ * New - Added Shortcode to display total sites visit counts.
116
+ * New - Added today count display
117
+ * New - Admin Interface changes
118
+ * New - Added responsive for the backend
119
+
120
  = 3.0.4 - 26-08-2016 =
121
  * Check wordpress and woocommerce compatibility
122
  * Fixies - Shop page and checkout page error handled
admin/class-page-visit-counter-admin.php CHANGED
@@ -120,7 +120,7 @@ class page_visit_counter_Admin {
120
 
121
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false );
122
 
123
- wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
124
 
125
  wp_enqueue_script('chosen-jquery', plugin_dir_url( __FILE__ ) . 'js/chosen.jquery.js', array( 'jquery' ), $this->version, false );
126
  wp_enqueue_script('chosen-proto', plugin_dir_url( __FILE__ ) . 'js/chosen.proto.js', array( 'jquery' ), $this->version, false );
@@ -417,123 +417,394 @@ class page_visit_counter_Admin {
417
  */
418
  function extra_page_visit_function_custom($name) {
419
  global $wpdb;
420
- $table_name = $wpdb->prefix."page_visit";
421
- $html ='';
422
- $html .='<div class="main-page-visit">';
423
- $html .='<div class="page-title"><h1>'.__('Page Visit Counter', 'page-visit-counter').'</h1></div>';
424
- $html .='<div style="display:none"><div id="page-vist-fancybox" class="page-counter-fancybox">';
425
- $html .='<div id="tabs">';
426
- $html .='<ul>
427
- <li><a href="#tabs-1">'.__('Top Browsers','page-visit-counter').'</a></li>
428
- <li><a href="#tabs-2">'.__('Top 10 IP address','page-visit-counter').'</a></li>
429
- <li><a href="#tabs-3">'.__('Top referer','page-visit-counter').'</a></li>
430
- <li><a href="#tabs-4">'.__('Weekly report','page-visit-counter').'</a></li>
431
- <li><a href="#tabs-5">'.__('Monthly report','page-visit-counter').'</a></li>
432
- <li style="display:none;"><a href="#tabs-6">'.__('Yearly Visit Report','page-visit-counter').'</a></li>
433
- </ul>';
434
- $html .='<div id="tabs-1"><div id="chartContainer" style="width: 100%; height: 500px;"></div></div>';
435
- $html .='<div id="tabs-2"><div id="chartContainer1" style="width: 100%; height: 500px;"></div></div>';
436
- $html .='<div id="tabs-3"><div id="chartContainer2" style="width: 100%; height: 500px;"></div></div>';
437
- $html .='<div id="tabs-4"><div id="chartContainer3" style="width: 100%; height: 500px;"></div></div>';
438
- $html .='<div id="tabs-5"><div id="chartContainer5" style="width: 100%; height: 500px;"></div></div>';
439
- $html .='<div id="tabs-6" style="display:none;"><div id="chartContainer6" style="width: 900px; height: 300px;"></div></div>';
440
- $html .='</div>';
441
- $html .='</div></div>';
442
-
443
- $temp = array();
444
-
445
- $postperpage = -1;
446
-
447
- // Get all the registered post type
448
- $post_types = get_post_types();
449
- $posts_array = array();
450
- if (isset($post_types) && !empty($post_types)) {
451
- foreach ($post_types as $cpost) {
452
- 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") {
453
- $args = array(
454
- 'post_type' => "$cpost",
455
- 'post_status' => 'publish',
456
- 'order' => 'ASC',
457
- 'posts_per_page' => $postperpage,
458
- );
459
- $posts_array[] = get_posts( $args );
460
- //$temp[] = $posts_array;
461
- }
462
- }
463
  }
464
 
465
- $html .='<div class="page-input-text">';
466
- $html .='<form method="POST">';
467
- $html .='<input type="text" name="pagesearchtext" id="page-search-text" placeholder="'.__('Search by page title', 'page-visit-counter').'"><input type="text" id="MyDate" class="pagedateselect" name="MyDate" value="" placeholder="'.__('Search by page date', 'page-visit-counter').'"/><a href="javascript:void(0);" id="search-submit" class="button">'.__('Search Page', 'page-visit-counter').'</a>';
468
- $html .='</form>';
469
- $html .='</div>';
470
- $html .='<div class="page-visit-summery">';
471
- $html .='<table id="example" class="display" cellpadding="0" cellspacing="0">
472
- <thead>
473
- <tr>
474
- <th width="10%">'.__('No', 'page-visit-counter').'</th>
475
- <th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
476
- <th>'.__('Page Title', 'page-visit-counter').'</th>
477
- <th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
478
- <th width="20%">'.__('Share', 'page-visit-counter').'</th>
479
- <th width="10%">'.__('Report', 'page-visit-counter').'</th>
480
- </tr></thead><tbody>';
481
-
482
- $counter = 0;
483
- foreach ($posts_array as $result){
484
- foreach ($result as $results) {
485
- $counter = $counter + 1;
486
- $html .='<tr>';
487
- $html .='<td>'.$counter.'</td>';
488
- $html .='<td>'.$results->ID.'</td>';
489
- $html .='<td><a href="'.get_admin_url().'post.php?post='.$results->ID.'&action=edit">'.__($results->post_title,'page-visit-counter').'</a></td>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
490
 
491
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $results->ID");
492
-
493
- $total = (int) $pageCount[0]->total;
494
- $site_title = get_bloginfo( 'name' );
495
- $page_social_content = $results->post_title.' - Total Visits '.$total.' - '.$site_title;
496
- $html .='<td>'.$total.'</td>';
497
- $html .='<td>
498
- <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
499
- <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
500
- <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
501
- $html .='<td><a href="#page-vist-fancybox" title="'.__($results->post_title,'page-visit-counter').'" class="page-counter-show" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
502
- $html .='</tr>';
503
- }
504
- }
505
- $html .='</tbody><tfoot>
506
- <tr>
507
- <th width="10%">'.__('No', 'page-visit-counter').'</th>
508
- <th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
509
- <th>'.__('Page Title', 'page-visit-counter', 'page-visit-counter').'</th>
510
- <th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
511
- <th width="20%">'.__('Share', 'page-visit-counter').'</th>
512
- <th width="10%">'.__('Report', 'page-visit-counter').'</th>
513
- </tr></tfoot><tbody></table>';
514
- $html .='</div>';
515
- $html .='</div>';
516
- echo $html; ?>
517
- <!-- Twitter -->
518
- <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
519
 
520
- <!-- Facebook -->
521
- <script>(function(d, s, id) {
522
- var js, fjs = d.getElementsByTagName(s)[0];
523
- if (d.getElementById(id)) return;
524
- js = d.createElement(s); js.id = id;
525
- js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
526
- fjs.parentNode.insertBefore(js, fjs);
527
- }(document, 'script', 'facebook-jssdk'));</script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
528
 
529
- <!-- Google+ -->
530
- <script type="text/javascript">
531
- (function() {
532
- var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
533
- po.src = 'https://apis.google.com/js/platform.js';
534
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
535
- })();
536
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
 
538
  <?php
539
  }
@@ -564,103 +835,141 @@ class page_visit_counter_Admin {
564
  echo '<div id="pvcp_dialog" title="Basic dialog"> <p> Subscribe for latest plugin update and get notified when we update our plugin and launch new products for free! </p> <p><input type="text" id="txt_user_sub_pvcp" class="regular-text" name="txt_user_sub_pvcp" value="'.$current_user->user_email.'"></p></div>';
565
  }
566
 
567
- $html ='';
568
- $html .='<div class="main-page-visit-settings">';
569
- $html .='<div class="page-title-settings"><h1>'. __( 'Page Counter Settings', 'page-visit-counter' ) .'</h1></div>';
570
- $html .='<div class="page-settings-summery">';
571
- $html .='<form method="POST">';
572
- $get_option_value = json_decode(get_option( 'page_count_settings' ));
573
- $input_values = isset( $get_option_value[1] ) ? $get_option_value[1] : array();
574
- $select_values = isset($get_option_value[0] ) ? $get_option_value[0] : array();
575
- $html .='<table border="0" cellpadding="10" cellspacing="0">';
576
- $html .='<tr>
577
- <td>'. __( 'Post Type', 'page-visit-counter' ) .'</td>
578
- <td>
579
- <select id="post_type" data-placeholder="'.__('Add Page/Post Type', 'page-visit-counter').'" name="post_ty[]" multiple="true" class="chosen-select-post category-select chosen-rtl validate_field1">
580
- <option value=""></option>';
581
- if (isset($post_types) && !empty($post_types)) {
582
- foreach ($post_types as $cpost) {
583
- 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") {
584
- $html .='<option value="'.$cpost.'">'.$cpost.'</option>';
585
- }
586
- }
587
- }
588
- $html .='</select><span class="information">'.__('(Select post types for which post views will be counted.)', 'page-visit-counter').'<br>(<b>'.__('Note: If you leave the blank then it will count for all the post/page registered in your theme.', 'page-visit-counter').'</b>)</span>
589
- </td>';
590
- $html .='</tr>';
591
- $html .='<tr class="ipaddress">
592
- <td>'. __( 'Exclude IPs (Ip Address)', 'page-visit-counter' ) .'</td>
593
- <td>
594
- <select id="ip_address" data-placeholder="'.__('Add IP Address in comma seprated', 'page-visit-counter').'" name="ip-basic[]" multiple="true" class="chosen-select-ip category-select chosen-rtl validate_field1">
595
- <option value=""></option>';
596
- $get_option_value_ip = json_decode(get_option( 'ipaddress_visit' ));
597
- if (isset($get_option_value_ip) && !empty($get_option_value_ip)) {
598
- foreach ($get_option_value_ip as $ip) {
599
- $html .='<option value="'.$ip.'">'.$ip.'</option>';
600
- }
601
- }
602
- $html .='</select><span class="information">'.__('(Enter the IP addresses to be excluded from post views count.)','page-visit-counter').'</span>
603
- </td>';
604
- $html .='</tr>';
605
- $html .='<tr>';
606
- $html .='<tr class="users">
607
- <td>'. __( 'Exclude Users', 'page-visit-counter' ) .'</td>
608
- <td>
609
- <select id="users_list" data-placeholder="'.__('Select Registerd Users', 'page-visit-counter').'" name="user-basic[]" multiple="true" class="chosen-select category-select chosen-rtl validate_field1">
610
- <option value=""></option>';
611
- $query = "SELECT * FROM $wpdb->users";
612
- $resultSetsArr = $wpdb->get_results($query);
613
- if (isset($resultSetsArr) && !empty($resultSetsArr)) {
614
- foreach ($resultSetsArr as $value) {
615
- $html .='<option value="'.$value->ID.'">'.$value->user_email.'</option>';
616
- }
617
- }
618
- $html .='</select><span class="information">'.__('(Select the users to be excluded from post views count.)', 'page-visit-counter').'</span>
619
- </td>';
620
- $html .='</tr>';
621
- $html .='<tr class="hidefront">';
622
- $html .='<td>'.__('Show front view counter', 'page-visit-counter').'</td>';
623
- $hide_show_option = get_option('counter_hide_show_front_vew');
624
- if($hide_show_option == 1){
625
- $cheked = 'checked';
626
- } else {
627
- $cheked = '';
628
- }
629
- $html .='<td class="information"><input type="checkbox" name="hidefrontview" id="hide_front_view" '.$cheked.' >'.__('Check the box if you want to display counter view on front end.', 'page-visit-counter').'</td>';
630
- $html .='</tr>';
631
- $html .='<tr class="">';
632
- $html .='<td>'.__('Choose color for the front end view', 'page-visit-counter').'</td>';
633
- $html .='<td class="information"><input id="text_color_page_visit" type="text" value="'.$text_color_page_visit.'" class="my-color-field" data-default-color="'.$text_color_page_visit.'" /></td>';
634
- $html .='</tr>';
635
- /*$html .='<tr class="">';
636
- $html .='<td>'.__('Facebook icon URL:', 'page-visit-counter').'</td>';
637
- $html .='<td class="information"><input id="fb_url_page_visit" type="text" value="" class="" /></td>';
638
- $html .='</tr>';
639
- $html .='<tr class="">';
640
- $html .='<td>'.__('Google+ icon URL:', 'page-visit-counter').'</td>';
641
- $html .='<td class="information"><input id="gplus_url_page_visit" type="text" value="" class="" /></td>';
642
- $html .='</tr>';
643
- $html .='<tr class="">';
644
- $html .='<td>'.__('Twitter icon URL:', 'page-visit-counter').'</td>';
645
- $html .='<td class="information"><input id="twitter_url_page_visit" type="text" value="" class="" /></td>';
646
- $html .='</tr>';*/
647
- $html .='<tr>';
648
- $html .='<td><input type="button" name="submit" class="pagecountsubmit button" value="'.__('Save','page-visit-counter').'"></td>';
649
- $html .='<td class="record-mesage" style="display:none;"><h4 style="color:#075F0E;">'.__('Settings saved Sucessfully.','page-visit-counter').'</h4></td>';
650
- $html .='</tr>';
651
- $html .='<table>';
652
- $html .='</form>';
653
- $html .='<div style="float:left;width:100%">
654
- <h2>'.__('Short Code', 'page-visit-counter', 'page-visit-counter').'</h2>
655
- <p>'.__('There are two shortcodes that you can use to manually add page view count to any content on admin or post/page template created by your theme or plugin thats create it\'s own display content in page/post.', 'page-visit-counter').'</p>
656
- <p style="width: 28%;float: left;">'.__('Use this shortcode to add admin side content on page/post:', 'page-visit-counter').'<pre style="margin-top: 14px;float: left;">'.__(htmlspecialchars('[page_visit_counter_md id="<page_id/post_id>"]'),'page-visit-counter').'</pre><br></p>
657
- <p style="width: 28%;float: left;clear:both;">'.__('Use this shortcode to add page/post template (.php) file of your own template:','page-visit-counter').'<pre style="margin-top: 14px;float: left;">'.__(htmlspecialchars('<?php echo do_shortcode("[page_visit_counter_md id="<page_id/post_id>"]"); ?>'), 'page-visit-counter').'</pre></p>
658
- </div>';
659
- $html .='</div>';
660
- $html .="<br>";
661
- $html .='</div>';
662
-
663
- echo $html;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
  }
665
  }
666
 
@@ -737,54 +1046,90 @@ class page_visit_counter_Admin {
737
 
738
  $page_count_option = array();
739
 
740
- $type = isset($_POST['selected_posttype']) ? $_POST['selected_posttype'] : '';
741
- $ipAddress = isset($_POST['ipaddress']) ? $_POST['ipaddress'] : '';
742
- $userList = isset($_POST['userlist']) ? $_POST['userlist'] : '';
743
- $hidefrontview = isset($_POST['hidefrontview']) ? $_POST['hidefrontview'] : '';
744
- $text_color_page_visit = isset($_POST['text_color_page_visit']) ? $_POST['text_color_page_visit'] : '';
745
-
746
- $twitter_url_page_visit = isset($_POST['twitter_url_page_visit']) ? $_POST['twitter_url_page_visit'] : '';
747
- $gplus_url_page_visit = isset($_POST['gplus_url_page_visit']) ? $_POST['gplus_url_page_visit'] : '';
748
- $fb_url_page_visit = isset($_POST['fb_url_page_visit']) ? $_POST['fb_url_page_visit'] : '';
749
-
750
- delete_option('wfap_post_type');
751
- if (isset($type) && $type != null) {
752
- update_option('wfap_post_type',json_encode(array_values($type)));
753
- }
754
-
755
- delete_option('ipaddress_visit');
756
- if (isset($ipAddress) && $ipAddress != null) {
757
- update_option('ipaddress_visit',json_encode(array_values($ipAddress)));
758
- }
759
-
760
- delete_option('userlist_visit');
761
- if (isset($userList) && $userList != null) {
762
- update_option('userlist_visit',json_encode(array_values($userList)));
763
- }
764
 
765
- if( isset($hidefrontview) && $hidefrontview != null ){
766
- update_option('counter_hide_show_front_vew',$hidefrontview);
767
- }
768
-
769
- if( isset($text_color_page_visit) && $text_color_page_visit != null ){
770
- update_option('text_color_page_visit',$text_color_page_visit);
771
- }
772
 
773
- if( isset($twitter_url_page_visit) && $twitter_url_page_visit != null ){
774
- update_option('twitter_url_page_visit',$twitter_url_page_visit);
775
- }
776
-
777
- if( isset($gplus_url_page_visit) && $gplus_url_page_visit != null ){
778
- update_option('gplus_url_page_visit',$gplus_url_page_visit);
779
- }
780
-
781
- if( isset($fb_url_page_visit) && $fb_url_page_visit != null ){
782
- update_option('fb_url_page_visit',$fb_url_page_visit);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
783
  }
784
 
785
- echo $type;
 
786
 
787
- die();
788
  }
789
 
790
  /**
@@ -855,7 +1200,7 @@ class page_visit_counter_Admin {
855
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
856
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
857
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
858
- $html .='<td><a href="#page-vist-fancybox" title="'.__($results->post_title,'page-visit-counter').'" class="page-counter-show" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
859
  $html .='</tr>';
860
  }
861
  }
@@ -915,7 +1260,7 @@ class page_visit_counter_Admin {
915
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
916
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
917
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
918
- $html .='<td><a href="#page-vist-fancybox" title="'.__($results->post_title,'page-visit-counter').'" class="page-counter-show" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
919
  $html .='</tr>';
920
  }
921
  $html .='</tbody><tfoot>
@@ -985,7 +1330,7 @@ class page_visit_counter_Admin {
985
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
986
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
987
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
988
- $html .='<td><a href="#page-vist-fancybox" title="'.__($results->post_title,'page-visit-counter').'" class="page-counter-show" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
989
 
990
  $html .='</tr>';
991
  }
@@ -1046,7 +1391,8 @@ class page_visit_counter_Admin {
1046
  global $wp, $wpdb;
1047
 
1048
  $post_id = get_the_ID();
1049
- $facebook_auto = get_post_meta($post_id, "get_page_count", true);
 
1050
 
1051
  $table_name = $wpdb->prefix."page_visit";
1052
 
@@ -1057,13 +1403,29 @@ class page_visit_counter_Admin {
1057
  <input name="pageidvisit" type="hidden" value="<?php echo $post_id; ?>">
1058
  <p><?php echo __('Do you want to enable page visits count for this page?', 'page-visit-counter'); ?></p>
1059
  <p>
1060
- <?php if ($facebook_auto == '') { ?>
1061
- <input type="radio" checked ="checked" name="autoupdate_page_visit" id="autoupdate_page1" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1062
- <input type="radio" name="autoupdate_page_visit" id="autoupdate_page2" value="no"><?php echo __('No', 'page-visit-counter'); ?></p>
1063
- <?php } else { ?>
1064
- <input type="radio" <?php if($facebook_auto=='yes'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
1065
- <input type="radio" <?php if($facebook_auto=='no'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page2" value="no">No</p><?php
1066
- } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1067
  <p><?php echo __('Total visits:','page-visit-counter'); ?> <?php echo $total; ?></p>
1068
  <?php
1069
  }
@@ -1084,8 +1446,26 @@ class page_visit_counter_Admin {
1084
 
1085
  if(isset($_POST["autoupdate_page_visit"]))
1086
  {
1087
- update_post_meta($post_id, "get_page_count",$_POST["autoupdate_page_visit"]);
1088
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1089
 
1090
  }
1091
 
120
 
121
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false );
122
 
123
+ //wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
124
 
125
  wp_enqueue_script('chosen-jquery', plugin_dir_url( __FILE__ ) . 'js/chosen.jquery.js', array( 'jquery' ), $this->version, false );
126
  wp_enqueue_script('chosen-proto', plugin_dir_url( __FILE__ ) . 'js/chosen.proto.js', array( 'jquery' ), $this->version, false );
417
  */
418
  function extra_page_visit_function_custom($name) {
419
  global $wpdb;
420
+
421
+ if ( ! class_exists( 'WP_List_Table' ) ) {
422
+ require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
423
  }
424
 
425
+ require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-tt-pvc-list-table.php';
426
+
427
+ // Create an instance of our package class.
428
+ $test_list_table = new TT_Example_List_Table();
429
+ // Fetch, prepare, sort, and filter our data.
430
+ $test_list_table->prepare_items();
431
+
432
+ $table_name = $wpdb->prefix."page_visit";
433
+ ?>
434
+
435
+
436
+ <div class="main-page-visit set_pvc_containter">
437
+ <div class="page-title">
438
+ <h1><?php echo __('Page Visit Counter', 'page-visit-counter'); ?></h1>
439
+ </div>
440
+
441
+ <?php
442
+ if (isset($_REQUEST['id']) && !empty($_REQUEST['id'])) { ?>
443
+ <style type="text/css">
444
+ .tabs div#chartContainer-main {float:left;width:50%;}
445
+ .tabs div#chartContainer1-main {float:left;width:50%;}
446
+ .tabs div#chartContainer2-main {float:left;width:50%;}
447
+ .tabs div#chartContainer3-main {float:left;width:50%;}
448
+ .tabs div#chartContainer5-main {float:left;width:50%;}
449
+ </style>
450
+ <div class="back"><h5><a class="button button-primary" href="/wp-admin/admin.php?page=page_visit_counter">&#x2190; Back to list</a></h5></div>
451
+ <div style="">
452
+ <div id="page-vist-fancybox" class="page-counter-fancybox">
453
+ <div id="tabs">
454
+ <div id="chartContainer-main">
455
+ <span>Top Browsers</span>
456
+ <div id="chartContainer" style="width: 100%; height: 500px;"></div>
457
+ </div>
458
+ <div id="chartContainer1-main">
459
+ <span>Top 10 IP address</span>
460
+ <div id="chartContainer1" style="width: 100%; height: 500px;"></div>
461
+ </div>
462
+ <div id="chartContainer2-main">
463
+ <span>Top referer</span>
464
+ <div id="chartContainer2" style="width: 100%; height: 500px;"></div>
465
+ </div>
466
+ <div id="chartContainer3-main">
467
+ <span>Weekly report </span>
468
+ <div id="chartContainer3" style="width: 100%; height: 500px;"></div>
469
+ </div>
470
+ <div id="chartContainer5-main">
471
+ <span>Monthly report</span>
472
+ <div id="chartContainer5" style="width: 100%; height: 500px;"></div>
473
+ </div>
474
+ <!--<div id="chartContainer6" style="width: 900px; height: 300px;"></div>-->
475
+ </div>
476
+ </div>
477
+ </div>
478
+ <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
479
+ <script type="text/javascript">
480
 
481
+ google.charts.load('current', {'packages':['corechart','bar']});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
482
 
483
+ var chartBrowsers = '';
484
+ var chartIP = '';
485
+ var chartReferer = '';
486
+ var chartWeekly = '';
487
+ var chartMonthly = '';
488
+ var chartYearly = '';
489
+
490
+ var dataBrowsers = '';
491
+ var dataIp = '';
492
+ var dataReferer = '';
493
+ var dataWeekly = '';
494
+ var dataMonthly = '';
495
+ var dataYearly = '';
496
+ var view = '';
497
+
498
+ //jQuery.getScript('https://www.gstatic.com/charts/loader.js');
499
+ var resultarr = '';
500
+ var toparr = [];
501
+ var dataPointsTopBrowsers = [];
502
+ var dataPointsIp = [];
503
+ var dataPointsReferer = [];
504
+ var dataPointsMonthly = [];
505
+ var dataPointsWeekly = [];
506
+ var dataPointsYearly = [];
507
+
508
+ var optionsBrowsers = '';
509
+ var optionschartIP = '';
510
+ var optionschartReferer = '';
511
+ var optionschartWeekly = '';
512
+ var optionschartMonthly = '';
513
+ var optionschartYearly = '';
514
+
515
+
516
+
517
+ jQuery(window).load(function() {
518
+ setTimeout(function() {
519
+
520
+
521
+ optionsBrowsers = {
522
+ title: '',
523
+ // pieHole: 0.4,
524
+ // is3D: true,
525
+ // chartArea:{left:20,top:20,width:'100%',height:'100%'},
526
+ };
527
+
528
+ optionschartIP = {
529
+ title: '',
530
+ chartArea:{width:"80%",height:"50%"},
531
+ bar: {groupWidth: "50%"},
532
+ legend: { position: "none" },
533
+ hAxis: {
534
+ title: 'Total Visits',
535
+ minValue: 0,
536
+ textStyle: {
537
+ bold: true,
538
+ fontSize: 12,
539
+ color: '#4d4d4d'
540
+ }
541
+ },
542
+ };
543
+
544
+ optionschartReferer = {
545
+ title: '',
546
+ chartArea:{left:100,width:"80%",height:"50%"},
547
+ bar: {groupWidth: "20%"},
548
+ legend: { position: "none" },
549
+ hAxis: {
550
+ title: 'Referer Domain',
551
+ minValue: 0,
552
+ textStyle: {
553
+ bold: true,
554
+ fontSize: 12,
555
+ color: '#4d4d4d'
556
+ }
557
+ },
558
+ vAxis: {
559
+ title: 'Total Visits',
560
+ textStyle: {
561
+ fontSize: 14,
562
+ bold: true,
563
+ color: '#848484'
564
+ }
565
+ }
566
+ };
567
+
568
+ optionschartWeekly = {
569
+ title: '',
570
+ chartArea:{left:100,width:"80%",height:"50%"},
571
+ bar: {groupWidth: "20%"},
572
+ legend: { position: "none" },
573
+ hAxis: {
574
+ title: 'Year - Month',
575
+ minValue: 0,
576
+ textStyle: {
577
+ bold: true,
578
+ fontSize: 12,
579
+ color: '#4d4d4d'
580
+ }
581
+ },
582
+ vAxis: {
583
+ title: 'Total Visits',
584
+ textStyle: {
585
+ fontSize: 14,
586
+ bold: true,
587
+ color: '#848484'
588
+ }
589
+ },
590
+ };
591
+
592
+ optionschartMonthly = {
593
+ title: '',
594
+ chartArea:{left:100,width:"80%",height:"50%"},
595
+ bar: {groupWidth: "20%"},
596
+ legend: { position: "none" },
597
+ hAxis: {
598
+ title: 'Month - Week',
599
+ minValue: 0,
600
+ textStyle: {
601
+ bold: true,
602
+ fontSize: 12,
603
+ color: '#4d4d4d'
604
+ }
605
+ },
606
+ vAxis: {
607
+ title: 'Total Visits',
608
+ textStyle: {
609
+ fontSize: 14,
610
+ bold: true,
611
+ color: '#848484'
612
+ }
613
+ }
614
+ };
615
+
616
+ optionschartYearly = {
617
+ title: '',
618
+ chartArea:{width:"80%",height:"50%"},
619
+ bar: {groupWidth: "20%"},
620
+ legend: { position: "none" },
621
+
622
+ };
623
+
624
+ var page_id = <?php echo $_REQUEST['id']; ?>;
625
+
626
+ jQuery.ajax({
627
+ type: "POST",
628
+ url: pagevisit.ajaxurl,
629
+ async:true,
630
+ data: ({
631
+ action: 'get_page_visit_record_report',
632
+ page_id:page_id
633
+ }),
634
+ success: function(data) {
635
+ var resultarr = JSON.parse(data);
636
+ console.log(resultarr);
637
+ if(resultarr != 'novisit') {
638
+ topBrowsersArr = resultarr['topBrowserString'];
639
+ topIpArr = resultarr['topIpString'];
640
+ topRefererArr = resultarr['topRefererString'];
641
+ topWeeklyArr = resultarr['topWeeklyString'];
642
+ topMonthlyArr = resultarr['topMonthlyString'];
643
+ topYearlyArr = resultarr['topYearlyString'];
644
+
645
+ jQuery( "#chartContainer" ).html('');
646
+ jQuery( "#chartContainer1" ).html('');
647
+ jQuery( "#chartContainer2" ).html('');
648
+ jQuery( "#chartContainer3" ).html('');
649
+ jQuery( "#chartContainer5" ).html('');
650
+ jQuery( "#chartContainer6" ).html('');
651
+
652
+ for(var i in topBrowsersArr) {
653
+ dataPointsTopBrowsers.push([i, topBrowsersArr [i]]);
654
+ }
655
+
656
+ dataBrowsers = google.visualization.arrayToDataTable(dataPointsTopBrowsers);
657
+
658
+ for(var j in topIpArr) {
659
+ dataPointsIp.push([j, topIpArr [j]]);
660
+ }
661
+
662
+ dataIp = google.visualization.arrayToDataTable(dataPointsIp);
663
+
664
+ for(var k in topRefererArr) {
665
+ dataPointsReferer.push([k, topRefererArr [k]]);
666
+ }
667
+
668
+ dataReferer = google.visualization.arrayToDataTable(dataPointsReferer);
669
+
670
+ for(var l in topWeeklyArr) {
671
+ dataPointsWeekly.push([l, topWeeklyArr [l]]);
672
+ }
673
+
674
+ dataWeekly = google.visualization.arrayToDataTable(dataPointsWeekly);
675
+
676
+ for(var m in topMonthlyArr) {
677
+ dataPointsMonthly.push([m, topMonthlyArr [m]]);
678
+ }
679
+
680
+ dataMonthly = google.visualization.arrayToDataTable(dataPointsMonthly);
681
+
682
+ for(var n in topYearlyArr) {
683
+ dataPointsYearly.push([n, topYearlyArr [n]]);
684
+ }
685
+
686
+ dataYearly = google.visualization.arrayToDataTable(dataPointsYearly);
687
+
688
+ jQuery(".page-counter-show").colorbox({inline:true, width:"38%"});
689
+
690
+ //$( "#tabs" ).tabs();
691
+
692
+ //$('body #ui-id-2').trigger('click');
693
+
694
+ chartBrowsers = new google.visualization.PieChart(document.getElementById('chartContainer'));
695
+ chartBrowsers.draw(dataBrowsers, optionsBrowsers);
696
+
697
+ view = new google.visualization.DataView(dataIp);
698
+ view.setColumns([0, 1,
699
+ { calc: "stringify",
700
+ sourceColumn: 1,
701
+ type: "string",
702
+ role: "annotation" },
703
+ ]);
704
+
705
+ chartIP = new google.visualization.BarChart(document.getElementById('chartContainer1'));
706
+ //var chartIP = google.charts.Bar(document.getElementById('chartContainer1'));
707
+ chartIP.draw(view, optionschartIP);
708
+
709
+
710
+ chartReferer = new google.visualization.ColumnChart(document.getElementById('chartContainer2'));
711
+ chartReferer.draw(dataReferer, optionschartReferer);
712
+
713
+ chartWeekly = new google.visualization.ColumnChart(document.getElementById('chartContainer3'));
714
+ chartWeekly.draw(dataWeekly, optionschartWeekly);
715
+
716
+ chartMonthly = new google.visualization.ColumnChart(document.getElementById('chartContainer5'));
717
+ chartMonthly.draw(dataMonthly, optionschartMonthly);
718
+
719
+ //chartYearly = new google.visualization.ColumnChart(document.getElementById('chartContainer6'));
720
+ //chartYearly.draw(dataYearly, optionschartYearly);
721
+
722
+ jQuery( window ).resize(function() {
723
+ console.log('resize');
724
+ chartBrowsers.draw(dataBrowsers, optionsBrowsers);
725
+ chartIP.draw(view, optionschartIP);
726
+ chartReferer.draw(dataReferer, optionschartReferer);
727
+ chartWeekly.draw(dataWeekly, optionschartWeekly);
728
+ chartMonthly.draw(dataMonthly, optionschartMonthly);
729
+ //chartYearly.draw(dataYearly, optionschartYearly);
730
+ });
731
+
732
+
733
+ } else {
734
+ jQuery(".page-counter-show").colorbox({inline:true, width:"38%"});
735
+
736
+ //jQuery( "#tabs" ).tabs();
737
+
738
+
739
+ // setTimeout(function(){
740
+ // jQuery('body #ui-id-1').trigger('click');
741
+ // },500);
742
+
743
+ jQuery( "#chartContainer" ).html('No Visitor Found.');
744
+ jQuery( "#chartContainer1" ).html('No Visitor Found.');
745
+ jQuery( "#chartContainer2" ).html('No Visitor Found.');
746
+ jQuery( "#chartContainer3" ).html('No Visitor Found.');
747
+ jQuery( "#chartContainer5" ).html('No Visitor Found.');
748
+ jQuery( "#chartContainer6" ).html('No Visitor Found.');
749
+
750
+ }
751
+ }
752
+
753
+ });
754
+ }, 1000);
755
+ });
756
+
757
+ jQuery( window ).resize(function() {
758
+ console.log('resize');
759
+ chartBrowsers.draw(dataBrowsers, optionsBrowsers);
760
+ chartIP.draw(view, optionschartIP);
761
+ chartReferer.draw(dataReferer, optionschartReferer);
762
+ chartWeekly.draw(dataWeekly, optionschartWeekly);
763
+ chartMonthly.draw(dataMonthly, optionschartMonthly);
764
+ //chartYearly.draw(dataYearly, optionschartYearly);
765
+ });
766
+
767
+
768
+
769
+ </script>
770
+ <?php
771
+ } else { ?>
772
+ <form id="movies-filter" method="get">
773
+ <?php
774
+ $test_list_table->search_box( __( 'Search' ), 'page-visit-counter' );
775
+ foreach ($_GET as $key => $value) { // http://stackoverflow.com/a/8763624/1287812
776
+ if( 's' !== $key ) // don't include the search query
777
+ echo("<input type='hidden' name='$key' value='$value' />");
778
+ }
779
+ $test_list_table->display();
780
+ ?>
781
+ </form>
782
+
783
+ <!-- Twitter -->
784
+ <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
785
 
786
+ <!-- Facebook -->
787
+ <script>(function(d, s, id) {
788
+ var js, fjs = d.getElementsByTagName(s)[0];
789
+ if (d.getElementById(id)) return;
790
+ js = d.createElement(s); js.id = id;
791
+ js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
792
+ fjs.parentNode.insertBefore(js, fjs);
793
+ }(document, 'script', 'facebook-jssdk'));</script>
794
+
795
+ <!-- Google+ -->
796
+ <script type="text/javascript">
797
+ (function() {
798
+ var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
799
+ po.src = 'https://apis.google.com/js/platform.js';
800
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
801
+ })();
802
+ </script>
803
+
804
+ <?php
805
+ } ?>
806
+
807
+ </div>
808
 
809
  <?php
810
  }
835
  echo '<div id="pvcp_dialog" title="Basic dialog"> <p> Subscribe for latest plugin update and get notified when we update our plugin and launch new products for free! </p> <p><input type="text" id="txt_user_sub_pvcp" class="regular-text" name="txt_user_sub_pvcp" value="'.$current_user->user_email.'"></p></div>';
836
  }
837
 
838
+ ?>
839
+ <div class="main-page-visit-settings">
840
+ <div class="page-title-settings">
841
+ <form id="pvc_plugin_form_id" method="post" action="<?php echo get_admin_url();?>admin-post.php" enctype="multipart/form-data" novalidate="novalidate">
842
+
843
+ <input type="hidden" name="action" value= "submit_form_pvc" />
844
+ <input id="action_which" type="hidden" name="action-which" value="add" />
845
+ <div class="set_pvc_containter set_plugin_descriptions">
846
+ <h3><?php echo __( 'Page Counter Settings','page-visit-counter' ); ?></h3>
847
+ <p><?php echo __('Page Visit Counter plugin use for front side post and pages counter. After activation of plugin it will automatically add page counts on bottom of all pages. So, that all visitors can see page counts for entire site pages.','page-visit-counter'); ?></p>
848
+ <ul style="list-style-type: disc;padding: 3px 2px 2px 34px;">
849
+ <li><p><?php echo __('Specific page vise reports like Top browsers, Top 10 IP address, Top referer, weekly report and Monthly report using chart.','page-visit-counter'); ?></p></li>
850
+ <li><p><?php echo __('Search facility: search pages by title and search page by its created date.','page-visit-counter'); ?></p></li>
851
+ <li><p><?php echo __('Sharing facility: share specific page on Facebook, Twitter and Google Plus.','page-visit-counter'); ?></p></li>
852
+ </ul>
853
+ </div>
854
+
855
+ <div class="set_pvc_containter set_plugin_descriptions_shortcode">
856
+ <fieldset>
857
+ <legend><?php echo __( 'Short Code','page-visit-counter' ); ?></legend>
858
+ <p><?php echo __('There are two shortcodes that you can use to manually add page view count to any content on admin or post/page template created by your theme or plugin thats create it\'s own display content in page/post.','page-visit-counter'); ?></p>
859
+ <p><?php echo __('Use this shortcode to add admin side content on page/post:', 'page-visit-counter'); ?> <b><?php echo __(htmlspecialchars('[page_visit_counter_md id="<page_id/post_id>"]'),'page-visit-counter'); ?></b></p>
860
+ <p><?php echo __('Use this shortcode to display total sites visit to add admin side content on page/post:', 'page-visit-counter'); ?> <b><?php echo __(htmlspecialchars('[page_visit_counter_md_total_sites_visit backgroundcolor="#ff0000" countboxcolor="#000000" fontcolor="#FFFFFF" bordercolor="#ff0000"]'),'page-visit-counter'); ?></b></p>
861
+ <p><?php echo __('Use this shortcode to add page/post template (.php) file of your own template:','page-visit-counter'); ?> <b><?php echo __(htmlspecialchars('<?php echo do_shortcode("[page_visit_counter_md id="<page_id/post_id>"]"); ?>'),'page-visit-counter'); ?></b></p>
862
+ <p><?php echo __('Use this shortcode to display total sites visit to add page/post template (.php) file of your own template:','page-visit-counter'); ?> <b><?php echo __(htmlspecialchars('<?php echo do_shortcode("[page_visit_counter_md_total_sites_visit backgroundcolor="#ff0000" countboxcolor="#000000" fontcolor="#FFFFFF" bordercolor="#ff0000"]"); ?>'),'page-visit-counter'); ?></b></p>
863
+ </fieldset>
864
+ </div>
865
+
866
+ <div class="set_pvc_containter set_plugin_descriptions">
867
+ <fieldset>
868
+ <legend><?php echo __('Basic Configuration settings', 'page-visit-counter'); ?></legend>
869
+ <?php
870
+ $get_option_value = json_decode(get_option( 'page_count_settings' ));
871
+ $input_values = isset( $get_option_value[1] ) ? $get_option_value[1] : array();
872
+ $select_values = isset($get_option_value[0] ) ? $get_option_value[0] : array();
873
+ ?>
874
+ <table border="0" cellpadding="10" cellspacing="0">
875
+ <tbody>
876
+ <tr>
877
+ <th scope="row"><label for="blogname"><?php echo __( 'Post Type', 'page-visit-counter' );?></label></th>
878
+ <td>
879
+ <select id="post_type" data-placeholder=" <?php echo __('Add Page/Post Type', 'page-visit-counter');?>" name="post_ty[]" multiple="true" class="chosen-select-post category-select chosen-rtl validate_field1">
880
+ <option value=""></option><?php
881
+ if (isset($post_types) && !empty($post_types)) {
882
+ foreach ($post_types as $cpost) {
883
+ 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") { ?>
884
+ <option value="<?php echo $cpost; ?>"><?php echo $cpost; ?></option><?php
885
+ }
886
+ }
887
+ } ?>
888
+ </select>
889
+ <p><?php echo __('(Select post types for which post views will be counted.)', 'page-visit-counter');?></p>
890
+ <p>(<b><?php echo __('Note: If you leave the blank then it will count for all the post/page registered in your theme.', 'page-visit-counter'); ?></b>)</p>
891
+ </td>
892
+ </tr>
893
+
894
+ <tr class="ipaddress">
895
+ <th scope="row"><label for="blogname"><?php echo __( 'Exclude IPs (Ip Address)', 'page-visit-counter' );?></label></th>
896
+ <td>
897
+ <select id="ip_address" data-placeholder=" <?php echo __('Add IP Address in comma seprated', 'page-visit-counter'); ?>" name="ip-basic[]" multiple="true" class="chosen-select-ip category-select chosen-rtl validate_field1">
898
+ <option value=""></option><?php
899
+ $get_option_value_ip = json_decode(get_option( 'ipaddress_visit' ));
900
+ if (isset($get_option_value_ip) && !empty($get_option_value_ip)) {
901
+ foreach ($get_option_value_ip as $ip) { ?>
902
+ <option value="<?php echo $ip; ?>"><?php echo $ip; ?></option><?php
903
+ }
904
+ } ?>
905
+ </select>
906
+ <p><?php echo __('(Enter the IP addresses to be excluded from post views count.)','page-visit-counter'); ?></p>
907
+ </td>
908
+ </tr>
909
+
910
+ <tr class="users">
911
+ <th scope="row"><label for="blogname"><?php echo __( 'Exclude Users', 'page-visit-counter' );?></label></th>
912
+ <td>
913
+ <select id="users_list" data-placeholder="<?php echo __('Select Registerd Users', 'page-visit-counter'); ?>" name="user-basic[]" multiple="true" class="chosen-select category-select chosen-rtl validate_field1">
914
+ <option value=""></option><?php
915
+ $query = "SELECT * FROM $wpdb->users";
916
+ $resultSetsArr = $wpdb->get_results($query);
917
+ if (isset($resultSetsArr) && !empty($resultSetsArr)) {
918
+ foreach ($resultSetsArr as $value) { ?>
919
+ <option value="<?php echo $value->ID; ?>"><?php echo $value->user_email; ?></option><?php
920
+ }
921
+ } ?>
922
+ </select>
923
+ <p><?php echo __('(Select the users to be excluded from post views count.)', 'page-visit-counter'); ?></p>
924
+ </td>
925
+ </tr>
926
+
927
+ <tr class="hidefront">
928
+ <th scope="row"><label for="blogname"><?php echo __( 'Show front view counter', 'page-visit-counter' );?></label></th>
929
+ <?php
930
+ $hide_show_option = get_option('counter_hide_show_front_vew');
931
+ if($hide_show_option == 'on'){
932
+ $cheked = 'checked';
933
+ } else {
934
+ $cheked = '';
935
+ } ?>
936
+ <td class="information">
937
+ <input type="checkbox" name="hidefrontview" id="hide_front_view" <?php echo $cheked; ?>><?php echo __('Check the box if you want to display counter view on front end.', 'page-visit-counter'); ?>
938
+ </td>
939
+ </tr>
940
+
941
+ <tr class="hidefront" style="display:none;">
942
+ <th scope="row"><label for="blogname"><?php echo __( 'Last How many days count you want to display on front end.', 'page-visit-counter' );?></label></th>
943
+ <td class="information">
944
+ <?php
945
+ $get_no_of_days = get_option('no_of_days_to_display');
946
+ if ($get_no_of_days == '') {
947
+ $get_no_of_days = '';
948
+ }
949
+ ?>
950
+ <input type="text" name="no_of_days_to_display" id="no_of_days_to_display" value="<?php echo $get_no_of_days; ?>">
951
+ </td>
952
+ </tr>
953
+
954
+ <tr class="">
955
+ <th scope="row"><label for="blogname"><?php echo __( 'Choose color for the front end view', 'page-visit-counter' );?></label></th>
956
+ <td class="information">
957
+ <input id="text_color_page_visit" type="text" name="textcolor" value="<?php echo $text_color_page_visit; ?>" class="my-color-field" data-default-color="<?php echo $text_color_page_visit; ?>" />
958
+ </td>
959
+ </tr>
960
+ </tbody>
961
+ </table>
962
+ </fieldset>
963
+ </div>
964
+ <p class="submit">
965
+ <input type="submit" name="submit" class="button button-primary" value="<?php echo __('Save Changes','page-visit-counter'); ?>">
966
+ <input type="submit" id="pvc_reset_settings" value="<?php echo __('Reset all settings', 'page-visit-counter'); ?>" class="button button-primary">
967
+ <input type="submit" id="pvc_reset_counter" value="<?php echo __('Reset all pages counts & report ', 'page-visit-counter'); ?>" class="button button-primary">
968
+ </p>
969
+ </form>
970
+ </div>
971
+ </div>
972
+ <?php
973
  }
974
  }
975
 
1046
 
1047
  $page_count_option = array();
1048
 
1049
+ $getformsumbitaction = !empty( $_POST['action'] ) ? $_POST['action']:'';
1050
+ $getformactiontype = !empty( $_POST['action-which'] ) ? $_POST['action-which']:'';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
 
1052
+ if( !empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'add' ) {
 
 
 
 
 
 
1053
 
1054
+ $type = isset($_POST['post_ty']) ? $_POST['post_ty'] : array();
1055
+ $ipAddress = isset($_POST['ip-basic']) ? $_POST['ip-basic'] : array();
1056
+ $userList = isset($_POST['user-basic']) ? $_POST['user-basic'] : array();
1057
+ $hidefrontview = isset($_POST['hidefrontview']) ? $_POST['hidefrontview'] : '';
1058
+ $text_color_page_visit = isset($_POST['textcolor']) ? $_POST['textcolor'] : '';
1059
+
1060
+ $twitter_url_page_visit = isset($_POST['twitter_url_page_visit']) ? $_POST['twitter_url_page_visit'] : '';
1061
+ $gplus_url_page_visit = isset($_POST['gplus_url_page_visit']) ? $_POST['gplus_url_page_visit'] : '';
1062
+ $fb_url_page_visit = isset($_POST['fb_url_page_visit']) ? $_POST['fb_url_page_visit'] : '';
1063
+ $no_of_days_to_display = isset($_POST['no_of_days_to_display']) ? $_POST['no_of_days_to_display'] : '';
1064
+
1065
+ delete_option('wfap_post_type');
1066
+ if (isset($type) && $type != null) {
1067
+ update_option('wfap_post_type',json_encode(array_values($type)));
1068
+ }
1069
+
1070
+ delete_option('ipaddress_visit');
1071
+ if (isset($ipAddress) && $ipAddress != null) {
1072
+ update_option('ipaddress_visit',json_encode(array_values($ipAddress)));
1073
+ }
1074
+
1075
+ delete_option('userlist_visit');
1076
+ if (isset($userList) && $userList != null) {
1077
+ update_option('userlist_visit',json_encode(array_values($userList)));
1078
+ }
1079
+
1080
+ if( isset($hidefrontview) && $hidefrontview != null ){
1081
+ update_option('counter_hide_show_front_vew',$hidefrontview);
1082
+ } else {
1083
+ update_option('counter_hide_show_front_vew','');
1084
+ }
1085
+
1086
+ if( isset($no_of_days_to_display) && $no_of_days_to_display != null ){
1087
+ update_option('no_of_days_to_display',$no_of_days_to_display);
1088
+ } else {
1089
+ update_option('no_of_days_to_display','');
1090
+ }
1091
+
1092
+ if( isset($text_color_page_visit) && $text_color_page_visit != null ){
1093
+ update_option('text_color_page_visit',$text_color_page_visit);
1094
+ }
1095
+
1096
+ if( isset($twitter_url_page_visit) && $twitter_url_page_visit != null ){
1097
+ update_option('twitter_url_page_visit',$twitter_url_page_visit);
1098
+ }
1099
+
1100
+ if( isset($gplus_url_page_visit) && $gplus_url_page_visit != null ){
1101
+ update_option('gplus_url_page_visit',$gplus_url_page_visit);
1102
+ }
1103
+
1104
+ if( isset($fb_url_page_visit) && $fb_url_page_visit != null ){
1105
+ update_option('fb_url_page_visit',$fb_url_page_visit);
1106
+ }
1107
+ } else if (!empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'reset') {
1108
+ delete_option('wfap_post_type');
1109
+ delete_option('ipaddress_visit');
1110
+ delete_option('userlist_visit');
1111
+ update_option('no_of_days_to_display','');
1112
+ update_option('counter_hide_show_front_vew','');
1113
+ update_option('text_color_page_visit','');
1114
+ update_option('twitter_url_page_visit','');
1115
+ update_option('gplus_url_page_visit','');
1116
+ update_option('fb_url_page_visit','');
1117
+ } else if (!empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'resetcount') {
1118
+
1119
+ $table_name = $wpdb->prefix."page_visit";
1120
+
1121
+ $query = "TRUNCATE TABLE $table_name";
1122
+ $wpdb->query($query);
1123
+
1124
+ $table_name = $wpdb->prefix . "page_visit_history";
1125
+ $query = "TRUNCATE TABLE $table_name";
1126
+ $wpdb->query($query);
1127
  }
1128
 
1129
+ wp_safe_redirect(site_url("/wp-admin/admin.php?page=page_visit_settings"));
1130
+ exit();
1131
 
1132
+ //die();
1133
  }
1134
 
1135
  /**
1200
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
1201
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
1202
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
1203
+ $html .='<td><a href="'.site_url().'/wp-admin/admin.php?page=page_visit_counter&id='.$results->ID.'" title="'.__($results->post_title,'page-visit-counter').'" class="" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
1204
  $html .='</tr>';
1205
  }
1206
  }
1260
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
1261
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
1262
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
1263
+ $html .='<td><a href="'.site_url().'/wp-admin/admin.php?page=page_visit_counter&id='.$results->ID.'" title="'.__($results->post_title,'page-visit-counter').'" class="" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
1264
  $html .='</tr>';
1265
  }
1266
  $html .='</tbody><tfoot>
1330
  <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a>
1331
  <a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a>
1332
  <a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a></td>';
1333
+ $html .='<td><a href="'.site_url().'/wp-admin/admin.php?page=page_visit_counter&id='.$results->ID.'" title="'.__($results->post_title,'page-visit-counter').'" class="" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a></td>';
1334
 
1335
  $html .='</tr>';
1336
  }
1391
  global $wp, $wpdb;
1392
 
1393
  $post_id = get_the_ID();
1394
+ $enable_page_count = get_post_meta($post_id, "enable_page_count", true);
1395
+ $enable_page_count_day_wise = get_post_meta($post_id, "enable_page_count_day_wise", true);
1396
 
1397
  $table_name = $wpdb->prefix."page_visit";
1398
 
1403
  <input name="pageidvisit" type="hidden" value="<?php echo $post_id; ?>">
1404
  <p><?php echo __('Do you want to enable page visits count for this page?', 'page-visit-counter'); ?></p>
1405
  <p>
1406
+ <?php if ($enable_page_count == '') { ?>
1407
+ <input type="radio" checked ="checked" name="autoupdate_page_visit" id="autoupdate_page1" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1408
+ <input type="radio" name="autoupdate_page_visit" id="autoupdate_page2" value="no"><?php echo __('No', 'page-visit-counter'); ?>
1409
+ <?php } else { ?>
1410
+ <input type="radio" <?php if($enable_page_count=='yes'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
1411
+ <input type="radio" <?php if($enable_page_count=='no'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page2" value="no">No<?php
1412
+ } ?>
1413
+ </p>
1414
+ <p><?php echo __('Do you want to display today page visits count for this page?', 'page-visit-counter'); ?></p>
1415
+ <p>
1416
+ <?php if ($enable_page_count_day_wise == '') { ?>
1417
+ <input type="radio" checked ="checked" name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1418
+ <input type="radio" name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no"><?php echo __('No', 'page-visit-counter'); ?>
1419
+ <?php } else { ?>
1420
+ <input type="radio" <?php if($enable_page_count_day_wise=='yes'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"> Yes
1421
+ <input type="radio" <?php if($enable_page_count_day_wise=='no'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no">No<?php
1422
+ } ?>
1423
+ </p>
1424
+ <p><?php echo __('Do you want to reset all visits count for this page?', 'page-visit-counter'); ?></p>
1425
+ <p>
1426
+ <input type="radio" name="page_visit_reset" id="page_visit_reset_yes" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1427
+ <input type="radio" checked ="checked" name="page_visit_reset" id="page_visit_reset_yes" value="no"><?php echo __('No', 'page-visit-counter'); ?>
1428
+ </p>
1429
  <p><?php echo __('Total visits:','page-visit-counter'); ?> <?php echo $total; ?></p>
1430
  <?php
1431
  }
1446
 
1447
  if(isset($_POST["autoupdate_page_visit"]))
1448
  {
1449
+ update_post_meta($post_id, "enable_page_count",$_POST["autoupdate_page_visit"]);
1450
+ }
1451
+
1452
+ if(isset($_POST["autoupdate_page_visit_day_wise"]))
1453
+ {
1454
+ update_post_meta($post_id, "enable_page_count_day_wise",$_POST["autoupdate_page_visit_day_wise"]);
1455
+ }
1456
+
1457
+ if(isset($_POST["page_visit_reset"]) && 'yes' === $_POST["page_visit_reset"])
1458
+ {
1459
+ $table_name = $wpdb->prefix."page_visit";
1460
+
1461
+ $query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
1462
+
1463
+ $pageCount = $wpdb->query($query);
1464
+
1465
+ $table_name = $wpdb->prefix . "page_visit_history";
1466
+ $query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
1467
+ $wpdb->query($query);
1468
+ }
1469
 
1470
  }
1471
 
admin/css/style.css CHANGED
@@ -30,6 +30,7 @@ div.page-visit-summery a#example_next{border-radius: 5px;padding: 5px 10px;backg
30
  #example_wrapper {float: left;width: 100%;padding: 0;margin: 0;}
31
  .paging_full_numbers a.paginate_active {background-color: #99B3FF;}
32
  .paging_full_numbers a.paginate_button {background-color: #FFF !important;}
 
33
  .main-page-visit .page-input-text input {width: 200px;height: 30px;line-height: 30px;padding-left: 10px;text-transform: capitalize;}
34
  .main-page-visit .page-input-text a#search-submit {margin-left: 10px;margin-top: 2px;text-transform: uppercase;}
35
  .page-settings-summery pre {margin: 0;text-transform: initial;font-weight: bold;white-space: inherit;display: initial;}
@@ -125,7 +126,7 @@ p.welocme-page-content {
125
  cursor: pointer
126
  }
127
  .version_logo_img {
128
- position: absolute;
129
  right: 0;
130
  top: 0;
131
  }
@@ -152,4 +153,98 @@ p.welocme-page-content {
152
  .free_plugin h3 {
153
  padding-bottom: 20px;
154
  border-bottom: 1px solid #ccc;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
30
  #example_wrapper {float: left;width: 100%;padding: 0;margin: 0;}
31
  .paging_full_numbers a.paginate_active {background-color: #99B3FF;}
32
  .paging_full_numbers a.paginate_button {background-color: #FFF !important;}
33
+ .main-page-visit {float:left;}
34
  .main-page-visit .page-input-text input {width: 200px;height: 30px;line-height: 30px;padding-left: 10px;text-transform: capitalize;}
35
  .main-page-visit .page-input-text a#search-submit {margin-left: 10px;margin-top: 2px;text-transform: uppercase;}
36
  .page-settings-summery pre {margin: 0;text-transform: initial;font-weight: bold;white-space: inherit;display: initial;}
126
  cursor: pointer
127
  }
128
  .version_logo_img {
129
+ position: absolute;
130
  right: 0;
131
  top: 0;
132
  }
153
  .free_plugin h3 {
154
  padding-bottom: 20px;
155
  border-bottom: 1px solid #ccc;
156
+ }
157
+
158
+ .set_pvc_containter {border-radius: 10px;box-shadow: 0 0 30px rgba(0, 0, 0, 0.28);margin: 20px 0;padding: 20px;width: 95%;}
159
+ .set_pvc_containter h3 {border-left: 5px solid #ddd;font-size: 20px;line-height: 30px;padding-left: 20px;}
160
+ .set_pvc_containter fieldset {border: 1px solid #ccc;margin-bottom: 30px;padding: 20px;}
161
+ .set_pvc_containter fieldset legend {background-color: #e7e7e7;border: 1px solid #ccc;padding: 5px 10px;font-weight: bold;font-size: 15px;}
162
+ .set_pvc_containter fieldset table tbody tr th {text-align: left;font-weight: bold;vertical-align: top;}
163
+ .set_plugin_descriptions_shortcode p {line-height: 30px;}
164
+ .tabs div#chartContainer-main {float:left;width:50%;}
165
+ .tabs div#chartContainer1-main {float:left;width:50%;}
166
+ .tabs div#chartContainer2-main {float:left;width:50%;}
167
+ .tabs div#chartContainer3-main {float:left;width:50%;}
168
+ .tabs div#chartContainer5-main {float:left;width:50%;}
169
+
170
+
171
+
172
+ /*28-09-2016*/
173
+ .main-page-visit.set_pvc_containter .page-counter-fancybox {display: inline-block; width: 100%;}
174
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer-main {display: inline-block;width: 49%;margin-bottom: 20px;background-color: #fff;margin-right: 20px;}
175
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer1-main {display: inline-block; width: 49%; margin-bottom: 20px; background-color: #fff;}
176
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer2-main {display: inline-block;width: 49%;margin-bottom: 20px;background-color: #fff;margin-right: 20px;}
177
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer3-main {display: inline-block; width: 49%; margin-bottom: 20px; background-color: #fff;}
178
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer5-main {display: inline-block;width: 49%;margin-bottom: 20px;background-color: #fff;margin-right: 20px;}
179
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer-main span, .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer1-main span, .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer2-main span, .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer3-main span, .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer4-main span, .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer5-main span {display: inline-block; width: 100%; padding: 7px 10px; background-color: #dce7f6; box-sizing: border-box; color: #657f97 !important; font-size: 13px !important; font-weight: bold !important;}
180
+
181
+ /*30-09-2016*/
182
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer-main rect {fill: transparent;}
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+ /*media Query*/
192
+ @media screen and (max-width: 1410px )
193
+ {
194
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer-main{width: 48%;}
195
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer1-main{width: 48%;}
196
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer2-main{width: 48%;}
197
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer3-main{width: 48%;}
198
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer5-main{width: 48%;}
199
+
200
+ }
201
+
202
+ @media screen and (max-width: 1200px ) {
203
+ .main-page-visit-settings {width: 99%;display: inline-block;}
204
+ }
205
+
206
+ @media screen and (max-width: 1024px ) {
207
+ .main-page-visit-settings {width: 98%;display: inline-block;}
208
+ }
209
+
210
+ @media screen and (max-width: 768px ) {
211
+ .main-page-visit-settings {width: 97%;display: inline-block;}
212
+
213
+ /*30-09-2016*/
214
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer-main {width: 100%;}
215
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer1-main{width: 100%;}
216
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer2-main{width: 100%;}
217
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer3-main{width: 100%;}
218
+ .main-page-visit.set_pvc_containter .page-counter-fancybox #chartContainer5-main{width: 100%;}
219
+ }
220
+
221
+ @media screen and (max-width: 600px ) {
222
+ .main-page-visit-settings {width: 95%;display: inline-block;}
223
+
224
+ /*30-09-2016*/
225
+ body.wp-admin.wp-core-ui.js.pagevisitcounter_page_page_visit_settings .main-page-visit-settings .page-title-settings .set_pvc_containter.set_plugin_descriptions table tr th {display: block; width: 100%;}
226
+ body.wp-admin.wp-core-ui.js.pagevisitcounter_page_page_visit_settings .main-page-visit-settings .page-title-settings .set_pvc_containter.set_plugin_descriptions table tr td {display: block; width: 100%;}
227
+
228
+
229
+ }
230
+
231
+ @media screen and (max-width: 500px ) {
232
+ .main-page-visit-settings {width: 92%;display: inline-block;}
233
+
234
+
235
+ }
236
+
237
+ @media screen and (max-width: 400px ) {
238
+ .main-page-visit-settings {width: 90%;display: inline-block;}
239
+
240
+ /*30-09-2016*/
241
+ body.wp-admin.wp-core-ui.js.pagevisitcounter_page_page_visit_settings .main-page-visit-settings form#pvc_plugin_form_id .set_pvc_containter fieldset {padding: 0; border: 0;}
242
+ }
243
+
244
+ @media screen and (max-width: 350px ) {
245
+ .main-page-visit-settings {width: 88%;display: inline-block;}
246
+ }
247
+
248
+ @media screen and (max-width: 300px ) {
249
+ .main-page-visit-settings {width: 86%;display: inline-block;}
250
  }
admin/js/custom.js CHANGED
@@ -209,322 +209,9 @@
209
 
210
  //$.getScript('https://www.gstatic.com/charts/loader.js');
211
  //google.charts.load('current', {'packages':['corechart']});
212
- google.charts.load('current', {'packages':['corechart','bar']});
213
 
214
- var chartBrowsers = '';
215
- var chartIP = '';
216
- var chartReferer = '';
217
- var chartWeekly = '';
218
- var chartMonthly = '';
219
- var chartYearly = '';
220
-
221
- var dataBrowsers = '';
222
- var dataIp = '';
223
- var dataReferer = '';
224
- var dataWeekly = '';
225
- var dataMonthly = '';
226
- var dataYearly = '';
227
- var view = '';
228
  $('body').on('click','.page-counter-show',function() {
229
 
230
- //$.getScript('https://www.gstatic.com/charts/loader.js');
231
- var resultarr = '';
232
- var toparr = [];
233
- var dataPointsTopBrowsers = [];
234
- var dataPointsIp = [];
235
- var dataPointsReferer = [];
236
- var dataPointsMonthly = [];
237
- var dataPointsWeekly = [];
238
- var dataPointsYearly = [];
239
-
240
- var optionsBrowsers = {
241
- title: '',
242
- // pieHole: 0.4,
243
- // is3D: true,
244
- // chartArea:{left:20,top:20,width:'100%',height:'100%'},
245
- };
246
-
247
- var optionschartIP = {
248
- title: '',
249
- chartArea:{width:"80%",height:"50%"},
250
- bar: {groupWidth: "50%"},
251
- legend: { position: "none" },
252
- hAxis: {
253
- title: 'Total Visits',
254
- minValue: 0,
255
- textStyle: {
256
- bold: true,
257
- fontSize: 12,
258
- color: '#4d4d4d'
259
- }
260
- },
261
- };
262
-
263
- var optionschartReferer = {
264
- title: '',
265
- chartArea:{left:100,width:"80%",height:"50%"},
266
- bar: {groupWidth: "20%"},
267
- legend: { position: "none" },
268
- hAxis: {
269
- title: 'Referer Domain',
270
- minValue: 0,
271
- textStyle: {
272
- bold: true,
273
- fontSize: 12,
274
- color: '#4d4d4d'
275
- }
276
- },
277
- vAxis: {
278
- title: 'Total Visits',
279
- textStyle: {
280
- fontSize: 14,
281
- bold: true,
282
- color: '#848484'
283
- }
284
- }
285
- };
286
-
287
- var optionschartWeekly = {
288
- title: '',
289
- chartArea:{left:100,width:"80%",height:"50%"},
290
- bar: {groupWidth: "20%"},
291
- legend: { position: "none" },
292
- hAxis: {
293
- title: 'Year - Month',
294
- minValue: 0,
295
- textStyle: {
296
- bold: true,
297
- fontSize: 12,
298
- color: '#4d4d4d'
299
- }
300
- },
301
- vAxis: {
302
- title: 'Total Visits',
303
- textStyle: {
304
- fontSize: 14,
305
- bold: true,
306
- color: '#848484'
307
- }
308
- },
309
- };
310
-
311
- var optionschartMonthly = {
312
- title: '',
313
- chartArea:{left:100,width:"80%",height:"50%"},
314
- bar: {groupWidth: "20%"},
315
- legend: { position: "none" },
316
- hAxis: {
317
- title: 'Month - Week',
318
- minValue: 0,
319
- textStyle: {
320
- bold: true,
321
- fontSize: 12,
322
- color: '#4d4d4d'
323
- }
324
- },
325
- vAxis: {
326
- title: 'Total Visits',
327
- textStyle: {
328
- fontSize: 14,
329
- bold: true,
330
- color: '#848484'
331
- }
332
- }
333
- };
334
-
335
- var optionschartYearly = {
336
- title: '',
337
- chartArea:{width:"80%",height:"50%"},
338
- bar: {groupWidth: "20%"},
339
- legend: { position: "none" },
340
-
341
- };
342
-
343
- var page_id = this.id;
344
-
345
- $.ajax({
346
- type: "POST",
347
- url: pagevisit.ajaxurl,
348
- async:false,
349
- data: ({
350
- action: 'get_page_visit_record_report',
351
- page_id:this.id
352
- }),
353
- success: function(data) {
354
- var resultarr = JSON.parse(data);
355
- console.log(resultarr);
356
- if(resultarr != 'novisit') {
357
- topBrowsersArr = resultarr['topBrowserString'];
358
- topIpArr = resultarr['topIpString'];
359
- topRefererArr = resultarr['topRefererString'];
360
- topWeeklyArr = resultarr['topWeeklyString'];
361
- topMonthlyArr = resultarr['topMonthlyString'];
362
- topYearlyArr = resultarr['topYearlyString'];
363
-
364
- $( "#chartContainer" ).html('');
365
- $( "#chartContainer1" ).html('');
366
- $( "#chartContainer2" ).html('');
367
- $( "#chartContainer3" ).html('');
368
- $( "#chartContainer5" ).html('');
369
- $( "#chartContainer6" ).html('');
370
-
371
- for(var i in topBrowsersArr) {
372
- dataPointsTopBrowsers.push([i, topBrowsersArr [i]]);
373
- }
374
-
375
- dataBrowsers = google.visualization.arrayToDataTable(dataPointsTopBrowsers);
376
-
377
- for(var j in topIpArr) {
378
- dataPointsIp.push([j, topIpArr [j]]);
379
- }
380
-
381
- dataIp = google.visualization.arrayToDataTable(dataPointsIp);
382
-
383
- for(var k in topRefererArr) {
384
- dataPointsReferer.push([k, topRefererArr [k]]);
385
- }
386
-
387
- dataReferer = google.visualization.arrayToDataTable(dataPointsReferer);
388
-
389
- for(var l in topWeeklyArr) {
390
- dataPointsWeekly.push([l, topWeeklyArr [l]]);
391
- }
392
-
393
- dataWeekly = google.visualization.arrayToDataTable(dataPointsWeekly);
394
-
395
- for(var m in topMonthlyArr) {
396
- dataPointsMonthly.push([m, topMonthlyArr [m]]);
397
- }
398
-
399
- dataMonthly = google.visualization.arrayToDataTable(dataPointsMonthly);
400
-
401
- for(var n in topYearlyArr) {
402
- dataPointsYearly.push([n, topYearlyArr [n]]);
403
- }
404
-
405
- dataYearly = google.visualization.arrayToDataTable(dataPointsYearly);
406
-
407
- $(".page-counter-show").colorbox({inline:true, width:"38%"});
408
-
409
- $( "#tabs" ).tabs();
410
-
411
- //$('body #ui-id-2').trigger('click');
412
-
413
- chartBrowsers = new google.visualization.PieChart(document.getElementById('chartContainer'));
414
- chartBrowsers.draw(dataBrowsers, optionsBrowsers);
415
-
416
- view = new google.visualization.DataView(dataIp);
417
- view.setColumns([0, 1,
418
- { calc: "stringify",
419
- sourceColumn: 1,
420
- type: "string",
421
- role: "annotation" },
422
- ]);
423
-
424
- chartIP = new google.visualization.BarChart(document.getElementById('chartContainer1'));
425
- //var chartIP = google.charts.Bar(document.getElementById('chartContainer1'));
426
- chartIP.draw(view, optionschartIP);
427
-
428
-
429
- chartReferer = new google.visualization.ColumnChart(document.getElementById('chartContainer2'));
430
- chartReferer.draw(dataReferer, optionschartReferer);
431
-
432
- chartWeekly = new google.visualization.ColumnChart(document.getElementById('chartContainer3'));
433
- chartWeekly.draw(dataWeekly, optionschartWeekly);
434
-
435
- chartMonthly = new google.visualization.ColumnChart(document.getElementById('chartContainer5'));
436
- chartMonthly.draw(dataMonthly, optionschartMonthly);
437
-
438
- chartYearly = new google.visualization.ColumnChart(document.getElementById('chartContainer6'));
439
- chartYearly.draw(dataYearly, optionschartYearly);
440
-
441
-
442
-
443
- setTimeout(function(){
444
- $('body #ui-id-1').trigger('click');
445
- },500);
446
-
447
- $( window ).resize(function() {
448
- chartBrowsers.draw(dataBrowsers, optionsBrowsers);
449
- chartIP.draw(view, optionschartIP);
450
- chartReferer.draw(dataReferer, optionschartReferer);
451
- chartWeekly.draw(dataWeekly, optionschartWeekly);
452
- chartMonthly.draw(dataMonthly, optionschartMonthly);
453
- chartYearly.draw(dataYearly, optionschartYearly);
454
- });
455
-
456
- $('body').on('click','#ui-id-1',function() {
457
- chartBrowsers.draw(dataBrowsers, optionsBrowsers);
458
- });
459
-
460
- $('body').on('click','#ui-id-2',function() {
461
- chartIP.draw(view, optionschartIP);
462
- });
463
-
464
- $('body').on('click','#ui-id-3',function() {
465
- chartReferer.draw(dataReferer, optionschartReferer);
466
- });
467
-
468
- $('body').on('click','#ui-id-4',function() {
469
- chartWeekly.draw(dataWeekly, optionschartWeekly);
470
- });
471
-
472
- $('body').on('click','#ui-id-5',function() {
473
- chartMonthly.draw(dataMonthly, optionschartMonthly);
474
- });
475
- } else {
476
- $(".page-counter-show").colorbox({inline:true, width:"38%"});
477
-
478
- $( "#tabs" ).tabs();
479
-
480
-
481
- setTimeout(function(){
482
- $('body #ui-id-1').trigger('click');
483
- },500);
484
-
485
- $( "#chartContainer" ).html('No Visitor Found.');
486
- $( "#chartContainer1" ).html('No Visitor Found.');
487
- $( "#chartContainer2" ).html('No Visitor Found.');
488
- $( "#chartContainer3" ).html('No Visitor Found.');
489
- $( "#chartContainer5" ).html('No Visitor Found.');
490
- $( "#chartContainer6" ).html('No Visitor Found.');
491
-
492
- }
493
- }
494
-
495
- });
496
-
497
-
498
- // $( window ).resize(function() {
499
- // chartBrowsers.draw(dataBrowsers, optionsBrowsers);
500
- // chartIP.draw(view, optionschartIP);
501
- // chartReferer.draw(dataReferer, optionschartReferer);
502
- // chartWeekly.draw(dataWeekly, optionschartWeekly);
503
- // chartMonthly.draw(dataMonthly, optionschartMonthly);
504
- // chartYearly.draw(dataYearly, optionschartYearly);
505
- // });
506
- //
507
- // $('body').on('click','#ui-id-1',function() {
508
- // chartBrowsers.draw(dataBrowsers, optionsBrowsers);
509
- // });
510
- //
511
- // $('body').on('click','#ui-id-2',function() {
512
- // chartIP.draw(view, optionschartIP);
513
- // });
514
- //
515
- // $('body').on('click','#ui-id-3',function() {
516
- // chartReferer.draw(dataReferer, optionschartReferer);
517
- // });
518
- //
519
- // $('body').on('click','#ui-id-4',function() {
520
- // chartWeekly.draw(dataWeekly, optionschartWeekly);
521
- // });
522
- //
523
- // $('body').on('click','#ui-id-5',function() {
524
- // chartMonthly.draw(dataMonthly, optionschartMonthly);
525
- // });
526
-
527
-
528
  });
529
 
530
 
@@ -545,78 +232,85 @@
545
  var postlist = [];
546
  var hidefrontview ='';
547
  var text_color_page_visit ='';
548
- $('body').on('click',".pagecountsubmit",function() {
549
-
550
- if($("#ip_address").val()) {
551
- ipaddress = $("#ip_address").val();
552
- } else {
553
- ipaddress = [];
554
- }
555
-
556
- if($("#users_list").val()) {
557
- userlist = $("#users_list").val();
558
- } else {
559
- userlist = [];
560
- }
561
-
562
- if($("#post_type").val()) {
563
- postlist = $("#post_type").val();
564
- } else {
565
- postlist = [];
566
- }
567
- if($('#hide_front_view').attr('checked')) {
568
- var checked_val = '1';
569
- } else {
570
- var checked_val = '0';
571
- }
572
-
573
- if($("#text_color_page_visit").val()) {
574
- text_color_page_visit = $("#text_color_page_visit").val();
575
- } else {
576
- text_color_page_visit = '';
577
- }
578
-
579
- if($("#fb_url_page_visit").val()) {
580
- fb_url_page_visit = $("#fb_url_page_visit").val();
581
- } else {
582
- fb_url_page_visit = '';
583
- }
584
-
585
- if($("#gplus_url_page_visit").val()) {
586
- gplus_url_page_visit = $("#gplus_url_page_visit").val();
587
- } else {
588
- gplus_url_page_visit = '';
589
- }
590
-
591
- if($("#twitter_url_page_visit").val()) {
592
- twitter_url_page_visit = $("#twitter_url_page_visit").val();
593
- } else {
594
- twitter_url_page_visit = '';
595
- }
596
-
597
- $.ajax({
598
- type: "POST",
599
- url: pagevisit.ajaxurl,
600
- async:false,
601
- data: ({
602
- action:'add_page_count_option',
603
- selected_posttype:unique(postlist),
604
- ipaddress:unique(ipaddress),
605
- userlist:unique(userlist),
606
- hidefrontview:checked_val,
607
- text_color_page_visit:text_color_page_visit,
608
- twitter_url_page_visit:twitter_url_page_visit,
609
- gplus_url_page_visit:gplus_url_page_visit,
610
- fb_url_page_visit:fb_url_page_visit
611
- }),
612
- success: function(data) {
613
- //$("td.record-mesage").empty();
614
- //$("td.record-mesage").html("<h4 style='color:#075F0E;'>Settings saved Sucessfully.</h4>");
615
- $("td.record-mesage").css('display','block');
616
- setInterval(function(){ $("td.record-mesage").fadeOut(); }, 3000);
617
- }
618
- });
619
- });
 
 
 
 
 
 
 
620
 
621
  });
622
 
209
 
210
  //$.getScript('https://www.gstatic.com/charts/loader.js');
211
  //google.charts.load('current', {'packages':['corechart']});
 
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  $('body').on('click','.page-counter-show',function() {
214
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  });
216
 
217
 
232
  var postlist = [];
233
  var hidefrontview ='';
234
  var text_color_page_visit ='';
235
+ $('body').on('click',"#pvc_reset_settings",function() {
236
+ $('#action_which').val('reset');
237
+ });
238
+
239
+ $('body').on('click',"#pvc_reset_counter",function() {
240
+ $('#action_which').val('resetcount');
241
+ });
242
+ // $('body').on('click',".pagecountsubmit",function() {
243
+ //
244
+ // if($("#ip_address").val()) {
245
+ // ipaddress = $("#ip_address").val();
246
+ // } else {
247
+ // ipaddress = [];
248
+ // }
249
+ //
250
+ // if($("#users_list").val()) {
251
+ // userlist = $("#users_list").val();
252
+ // } else {
253
+ // userlist = [];
254
+ // }
255
+ //
256
+ // if($("#post_type").val()) {
257
+ // postlist = $("#post_type").val();
258
+ // } else {
259
+ // postlist = [];
260
+ // }
261
+ // if($('#hide_front_view').attr('checked')) {
262
+ // var checked_val = '1';
263
+ // } else {
264
+ // var checked_val = '0';
265
+ // }
266
+ //
267
+ // if($("#text_color_page_visit").val()) {
268
+ // text_color_page_visit = $("#text_color_page_visit").val();
269
+ // } else {
270
+ // text_color_page_visit = '';
271
+ // }
272
+ //
273
+ // if($("#fb_url_page_visit").val()) {
274
+ // fb_url_page_visit = $("#fb_url_page_visit").val();
275
+ // } else {
276
+ // fb_url_page_visit = '';
277
+ // }
278
+ //
279
+ // if($("#gplus_url_page_visit").val()) {
280
+ // gplus_url_page_visit = $("#gplus_url_page_visit").val();
281
+ // } else {
282
+ // gplus_url_page_visit = '';
283
+ // }
284
+ //
285
+ // if($("#twitter_url_page_visit").val()) {
286
+ // twitter_url_page_visit = $("#twitter_url_page_visit").val();
287
+ // } else {
288
+ // twitter_url_page_visit = '';
289
+ // }
290
+ //
291
+ // $.ajax({
292
+ // type: "POST",
293
+ // url: pagevisit.ajaxurl,
294
+ // async:false,
295
+ // data: ({
296
+ // action:'add_page_count_option',
297
+ // selected_posttype:unique(postlist),
298
+ // ipaddress:unique(ipaddress),
299
+ // userlist:unique(userlist),
300
+ // hidefrontview:checked_val,
301
+ // text_color_page_visit:text_color_page_visit,
302
+ // twitter_url_page_visit:twitter_url_page_visit,
303
+ // gplus_url_page_visit:gplus_url_page_visit,
304
+ // fb_url_page_visit:fb_url_page_visit
305
+ // }),
306
+ // success: function(data) {
307
+ // //$("td.record-mesage").empty();
308
+ // //$("td.record-mesage").html("<h4 style='color:#075F0E;'>Settings saved Sucessfully.</h4>");
309
+ // $("td.record-mesage").css('display','block');
310
+ // setInterval(function(){ $("td.record-mesage").fadeOut(); }, 3000);
311
+ // }
312
+ // });
313
+ // });
314
 
315
  });
316
 
images/Thumbs.db ADDED
Binary file
includes/class-page-visit-counter.php CHANGED
@@ -136,8 +136,8 @@ class page_visit_counter {
136
  $this->loader->add_action( 'admin_menu',$plugin_admin, 'page_visit_counter_menu' );
137
  $this->loader->add_action( 'wp_dashboard_setup',$plugin_admin, 'my_custom_dashboard_widgets' );
138
 
139
- $this->loader->add_action( 'wp_ajax_add_page_count_option', $plugin_admin, 'add_page_count_option' );
140
- $this->loader->add_action( 'wp_ajax_nopriv_add_page_count_option', $plugin_admin, 'add_page_count_option' );
141
 
142
  $this->loader->add_action( 'wp_ajax_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
143
  $this->loader->add_action( 'wp_ajax_nopriv_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
@@ -162,7 +162,8 @@ class page_visit_counter {
162
 
163
  $this->loader->add_action('admin_print_footer_scripts', $plugin_admin, 'custom_admin_pointers_footer');
164
 
165
-
 
166
 
167
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'check_page_visit_history_table_exisit' );
168
 
@@ -220,6 +221,7 @@ class page_visit_counter {
220
  $this->loader->add_action( 'wp', $plugin_public, 'insert_page_visit_counter' );
221
 
222
  $this->loader->add_action( 'the_content', $plugin_public, 'insert_page_visit_counter_total_block',99 );
 
223
  //$this->loader->add_action( 'get_footer', $plugin_public, 'insert_page_visit_counter_total_block',99 );
224
 
225
  $this->loader->add_action( 'wp_head', $plugin_public, 'add_meta_tags_page_visit',10);
@@ -227,6 +229,8 @@ class page_visit_counter {
227
 
228
  if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
229
  $this->loader->add_filter( 'woocommerce_paypal_args', $plugin_public, 'paypal_bn_code_filter',99,1 );
 
 
230
  }
231
 
232
  }
136
  $this->loader->add_action( 'admin_menu',$plugin_admin, 'page_visit_counter_menu' );
137
  $this->loader->add_action( 'wp_dashboard_setup',$plugin_admin, 'my_custom_dashboard_widgets' );
138
 
139
+ //$this->loader->add_action( 'wp_ajax_add_page_count_option', $plugin_admin, 'add_page_count_option' );
140
+ //$this->loader->add_action( 'wp_ajax_nopriv_add_page_count_option', $plugin_admin, 'add_page_count_option' );
141
 
142
  $this->loader->add_action( 'wp_ajax_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
143
  $this->loader->add_action( 'wp_ajax_nopriv_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
162
 
163
  $this->loader->add_action('admin_print_footer_scripts', $plugin_admin, 'custom_admin_pointers_footer');
164
 
165
+ $this->loader->add_action( 'admin_post_submit_form_pvc',$plugin_admin, 'add_page_count_option');
166
+ $this->loader->add_action( 'admin_post_nopriv_submit_form_pvc',$plugin_admin, 'add_page_count_option');
167
 
168
  $this->loader->add_action( 'plugins_loaded', $plugin_admin, 'check_page_visit_history_table_exisit' );
169
 
221
  $this->loader->add_action( 'wp', $plugin_public, 'insert_page_visit_counter' );
222
 
223
  $this->loader->add_action( 'the_content', $plugin_public, 'insert_page_visit_counter_total_block',99 );
224
+ //$this->loader->add_action( 'wp_loaded', $plugin_public, 'insert_page_visit_counter_total_block',99 );
225
  //$this->loader->add_action( 'get_footer', $plugin_public, 'insert_page_visit_counter_total_block',99 );
226
 
227
  $this->loader->add_action( 'wp_head', $plugin_public, 'add_meta_tags_page_visit',10);
229
 
230
  if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
231
  $this->loader->add_filter( 'woocommerce_paypal_args', $plugin_public, 'paypal_bn_code_filter',99,1 );
232
+ $this->loader->add_action( 'woocommerce_after_shop_loop', $plugin_public, 'insert_page_visit_counter_total_block_shop_page',99 );
233
+ $this->loader->add_action( 'woocommerce_single_product_summary', $plugin_public, 'insert_page_visit_counter_total_block_shop_page',99 );
234
  }
235
 
236
  }
includes/class-tt-pvc-list-table.php ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WP List Table Example class
4
+ *
5
+ * @package WPListTableExample
6
+ * @author Matt van Andel
7
+ * @copyright 2016 Matthew van Andel
8
+ * @license GPL-2.0+
9
+ */
10
+ /**
11
+ * Example List Table Child Class
12
+ *
13
+ * Create a new list table package that extends the core WP_List_Table class.
14
+ * WP_List_Table contains most of the framework for generating the table, but we
15
+ * need to define and override some methods so that our data can be displayed
16
+ * exactly the way we need it to be.
17
+ *
18
+ * To display this example on a page, you will first need to instantiate the class,
19
+ * then call $yourInstance->prepare_items() to handle any data manipulation, then
20
+ * finally call $yourInstance->display() to render the table to the page.
21
+ *
22
+ * Our topic for this list table is going to be movies.
23
+ *
24
+ * @package WPListTableExample
25
+ * @author Matt van Andel
26
+ */
27
+ class TT_Example_List_Table extends WP_List_Table {
28
+
29
+
30
+ /**
31
+ * Prepare the items for the table to process
32
+ *
33
+ * @return Void
34
+ */
35
+ public function prepare_items()
36
+ {
37
+ $columns = $this->get_columns();
38
+ $hidden = $this->get_hidden_columns();
39
+ $sortable = $this->get_sortable_columns();
40
+ $data = $this->table_data();
41
+ usort( $data, array( &$this, 'sort_data' ) );
42
+ $perPage = 15;
43
+ $currentPage = $this->get_pagenum();
44
+ $totalItems = count($data);
45
+ $this->set_pagination_args( array(
46
+ 'total_items' => $totalItems,
47
+ 'per_page' => $perPage
48
+ ) );
49
+ $data = array_slice($data,(($currentPage-1)*$perPage),$perPage);
50
+ $this->_column_headers = array($columns, $hidden, $sortable);
51
+ $this->items = $data;
52
+ }
53
+
54
+ /**
55
+ * Override the parent columns method. Defines the columns to use in your listing table
56
+ *
57
+ * @return Array
58
+ */
59
+ public function get_columns()
60
+ {
61
+ $columns = array(
62
+ 'id' => 'Page/Post ID',
63
+ 'title' => 'Page Title',
64
+ 'count' => 'Total Count',
65
+ 'share' => 'Share',
66
+ 'report' => 'Report'
67
+ );
68
+ return $columns;
69
+ }
70
+
71
+ /**
72
+ * Define which columns are hidden
73
+ *
74
+ * @return Array
75
+ */
76
+ public function get_hidden_columns()
77
+ {
78
+ return array();
79
+ }
80
+
81
+ /**
82
+ * Define the sortable columns
83
+ *
84
+ * @return Array
85
+ */
86
+ public function get_sortable_columns()
87
+ {
88
+ return array();
89
+
90
+ // return array(
91
+ // 'count' => array('count', false),
92
+ // 'id' => array('id', false),
93
+ // 'title' => array('title', false)
94
+ // );
95
+ }
96
+
97
+ /**
98
+ * Get the table data
99
+ *
100
+ * @return Array
101
+ */
102
+ private function table_data()
103
+ {
104
+ global $wpdb;
105
+
106
+ $table_name = $wpdb->prefix."page_visit";
107
+ $temp = array();
108
+
109
+ $postperpage = -1;
110
+
111
+ // Get all the registered post type
112
+ $post_types = get_post_types();
113
+ $posts_array = array();
114
+ if (isset($post_types) && !empty($post_types)) {
115
+ foreach ($post_types as $cpost) {
116
+ 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") {
117
+
118
+ $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : false;
119
+
120
+ if ($search == false) {
121
+ $args = array(
122
+ 'post_type' => "$cpost",
123
+ 'post_status' => 'publish',
124
+ 'order' => 'ASC',
125
+ 'posts_per_page' => $postperpage,
126
+ );
127
+ } else if ($_REQUEST['s'] == '' ) {
128
+ $args = array(
129
+ 'post_type' => "$cpost",
130
+ 'post_status' => 'publish',
131
+ 'order' => 'ASC',
132
+ 'posts_per_page' => $postperpage,
133
+ );
134
+ } else {
135
+ $args = array(
136
+ 'post_type' => "$cpost",
137
+ 'post_status' => 'publish',
138
+ 'order' => 'ASC',
139
+ 's' => $search,
140
+ 'posts_per_page' => $postperpage,
141
+ );
142
+ }
143
+ if ($search != false) {
144
+ $query = new WP_Query($args);
145
+ } else {
146
+ $query = new WP_Query($args);
147
+ }
148
+ $posts_array[] = $query->get_posts();
149
+ //$temp[] = $posts_array;
150
+ }
151
+ }
152
+ }
153
+
154
+ $data = array();
155
+ $counter = 0;
156
+ foreach ($posts_array as $result){
157
+
158
+ foreach ($result as $results) {
159
+ $counter = $counter + 1;
160
+
161
+ $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $results->ID");
162
+
163
+ $total = (int) $pageCount[0]->total;
164
+ $site_title = get_bloginfo( 'name' );
165
+ $page_social_content = $results->post_title.' - Total Visits '.$total.' - '.$site_title;
166
+
167
+ $data[] = array(
168
+ 'id' => $results->ID,
169
+ 'title' => '<a href="'.get_admin_url().'post.php?post='.$results->ID.'&action=edit">'.__($results->post_title,'page-visit-counter').'</a>',
170
+ 'count' => $total,
171
+ 'share' => '<a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Facebook.png', dirname(__FILE__) ) . '" /></a><a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='.$page_social_content.'&url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/twitter.png', dirname(__FILE__) ) . '" /></a><a target="_blank" href="https://plus.google.com/share?url='.esc_url( get_permalink($results->ID) ).'"><img src="' . plugins_url( 'images/Google_Plus.png', dirname(__FILE__) ) . '" /></a>',
172
+ 'report' => '<a href="'.site_url().'/wp-admin/admin.php?page=page_visit_counter&id='.$results->ID.'" title="'.__($results->post_title,'page-visit-counter').'" class="" id="'.$results->ID.'">'.__('View Report','page-visit-counter').'</a>'
173
+ );
174
+ }
175
+ }
176
+
177
+ return $data;
178
+ }
179
+
180
+ /**
181
+ * Define what data to show on each column of the table
182
+ *
183
+ * @param Array $item Data
184
+ * @param String $column_name - Current column name
185
+ *
186
+ * @return Mixed
187
+ */
188
+ public function column_default( $item, $column_name )
189
+ {
190
+ switch( $column_name ) {
191
+ case 'id':
192
+ case 'title':
193
+ case 'count':
194
+ case 'share':
195
+ case 'report':
196
+ return $item[ $column_name ];
197
+ default:
198
+ return print_r( $item, true ) ;
199
+ }
200
+ }
201
+
202
+ /**
203
+ * Allows you to sort the data by the variables set in the $_GET
204
+ *
205
+ * @return Mixed
206
+ */
207
+ private function sort_data( $a, $b )
208
+ {
209
+ // Set defaults
210
+ $orderby = 'title';
211
+ $order = 'asc';
212
+ // If orderby is set, use this as the sort column
213
+ if(!empty($_GET['orderby']))
214
+ {
215
+ $orderby = $_GET['orderby'];
216
+ }
217
+ // If order is set use this as the order
218
+ if(!empty($_GET['order']))
219
+ {
220
+ $order = $_GET['order'];
221
+ }
222
+ $result = strcmp( $a[$orderby], $b[$orderby] );
223
+ if($order === 'asc')
224
+ {
225
+ return $result;
226
+ }
227
+ return -$result;
228
+ }
229
+ }
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: 3.0.4
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
@@ -121,7 +121,7 @@ function display_page_total_count($atts) {
121
  } else {
122
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
123
  if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
124
- $innerSettings = get_post_meta($pageID,'get_page_count',true);
125
  if ($innerSettings == '' || $innerSettings == 'yes') {
126
  $html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
127
  }
@@ -141,5 +141,70 @@ function display_page_total_count($atts) {
141
  }
142
  add_shortcode('page_visit_counter_md','display_page_total_count');
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  run_page_visit_counter();
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.0
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
121
  } else {
122
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
123
  if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
124
+ $innerSettings = get_post_meta($pageID,'enable_page_count',true);
125
  if ($innerSettings == '' || $innerSettings == 'yes') {
126
  $html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
127
  }
141
  }
142
  add_shortcode('page_visit_counter_md','display_page_total_count');
143
 
144
+ function page_visit_counter_md_total_sites_visit($atts) {
145
+ global $wpdb;
146
+
147
+ $backgroundcolor = trim($atts['backgroundcolor']);
148
+
149
+ if (isset($backgroundcolor) && !empty($backgroundcolor)) {
150
+ $backgroundcolor = $backgroundcolor;
151
+ } else {
152
+ $backgroundcolor = '#ff0000';
153
+ }
154
+
155
+ $countboxcolor = trim($atts['countboxcolor']);
156
+ if (isset($countboxcolor) && !empty($countboxcolor)) {
157
+ $countboxcolor = $countboxcolor;
158
+ } else {
159
+ $countboxcolor = '#000';
160
+ }
161
+
162
+
163
+ $fontcolor = trim($atts['fontcolor']);
164
+ if (isset($fontcolor) && !empty($fontcolor)) {
165
+ $fontcolor = $fontcolor;
166
+ } else {
167
+ $fontcolor = '#FFF';
168
+ }
169
+
170
+ $bordercolor = trim($atts['bordercolor']);
171
+ if (isset($bordercolor) && !empty($bordercolor)) {
172
+ $bordercolor = $bordercolor;
173
+ } else {
174
+ $fontcolor = '#ff0000';
175
+ }
176
+
177
+ $table_name = $wpdb->prefix."page_visit_history";
178
+
179
+ $query = "SELECT COUNT(id) as total FROM $table_name";
180
+ $totalCountResult = $wpdb->get_results($query);
181
+
182
+ $totalCount = (int) $totalCountResult[0]->total;
183
+
184
+ $array = str_split($totalCount);
185
+
186
+ $text_color_page_visit = get_option('text_color_page_visit');
187
+
188
+ if (isset($text_color_page_visit) && $text_color_page_visit != null) {
189
+ $text_color_page_visit = 'style="color: '.$text_color_page_visit.';"';
190
+ } else {
191
+ $text_color_page_visit = 'style="color: #000000;"';
192
+ }
193
+
194
+ $totalVisitsHtml = '';
195
+
196
+ $totalVisitsHtml .= '<div class="md-pvc-total-reports">';
197
+ $totalVisitsHtml .= '<div class="md-pvc-total-reports-sub" style="background:'.$backgroundcolor.';">';
198
+ foreach ($array as $number) {
199
+ $totalVisitsHtml .= '<span style="border: 1px solid '.$bordercolor.';color:'.$fontcolor.';background:'.$countboxcolor.';">'.$number.'</span>';
200
+ }
201
+ $totalVisitsHtml .= '<span class="text" style="border: 1px solid '.$bordercolor.';color:'.$fontcolor.';background:'.$countboxcolor.';">total sites visits.</span>';
202
+ $totalVisitsHtml .= '</div>';
203
+ $totalVisitsHtml .= '</div>';
204
+
205
+ echo $totalVisitsHtml;
206
+ }
207
+ add_shortcode('page_visit_counter_md_total_sites_visit','page_visit_counter_md_total_sites_visit');
208
+
209
 
210
  run_page_visit_counter();
public/class-page-visit-counter-public.php CHANGED
@@ -197,7 +197,7 @@ class page_visit_counter_Public {
197
 
198
  $pageCount = $wpdb->get_results("SELECT * from $table_name where page_id=$page AND ipaddress = '$ipaddress' AND date = '$currentdate' LIMIT 1");
199
 
200
- $getPageSetting = get_post_meta($page,'get_page_count',true);
201
 
202
 
203
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
@@ -205,6 +205,7 @@ class page_visit_counter_Public {
205
  $bname = 'Unknown';
206
  $platform = 'Unknown';
207
  $version= "";
 
208
 
209
  //First get the platform?
210
  if (preg_match('/linux/i', $u_agent)) {
@@ -267,11 +268,11 @@ class page_visit_counter_Public {
267
  $version= $matches['version'][0];
268
  }
269
  else {
270
- $version= $matches['version'][1];
271
  }
272
  }
273
  else {
274
- $version= $matches['version'][0];
275
  }
276
 
277
  // check if we have a number
@@ -280,85 +281,85 @@ class page_visit_counter_Public {
280
  $http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] :'';
281
 
282
  // old version plugin
283
- if ($fetchSelecetedPostTypes == '') {
284
 
285
  // Check current page/post metabox settings is blank OR selected value is yes
286
- if ($getPageSetting == '' || $getPageSetting == 'yes') {
287
-
288
- // Check IP Address set in settings page if yes
289
- if (isset($fetchSelecetedIpAddress) && !empty($fetchSelecetedIpAddress)) {
290
- $optionsIpAddressEncodeArr = json_decode($optionsIpAddressDecodedArr);
291
- // Check IP Address not listed in settings page then go ahed
292
- if (!in_array($ipaddress,$optionsIpAddressEncodeArr)) {
293
-
294
- // Check users set in settings page if yes
295
- if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
296
-
297
- $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
298
- $user_id = get_current_user_id();
299
-
300
- // Check user not listed in settings page then go ahed
301
- if (!in_array($user_id,$optionsUserIdEncodeArr)) {
302
-
303
- if (isset($pageCount) && !empty($pageCount)) {
304
- $existingtotal = (int) $pageCount[0]->page_visit;
305
- $totalFinal = $existingtotal + 1;
306
- $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
307
- $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')");
308
- } else {
309
- $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
310
- $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')");
311
- }
312
- }
313
- } else {
314
- if (isset($pageCount) && !empty($pageCount)) {
315
- $existingtotal = (int) $pageCount[0]->page_visit;
316
- $totalFinal = $existingtotal + 1;
317
- $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
318
- $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')");
319
- } else {
320
- $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
321
- $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')");
322
- }
323
- }
324
- }
325
- } else {
326
- if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
327
-
328
- $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
329
- $user_id = get_current_user_id();
330
-
331
- // Check user not listed in settings page then go ahed
332
- if (!in_array($user_id,$optionsUserIdEncodeArr)) {
333
-
334
- if (isset($pageCount) && !empty($pageCount)) {
335
- $existingtotal = (int) $pageCount[0]->page_visit;
336
- $totalFinal = $existingtotal + 1;
337
- $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
338
- $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')");
339
- } else {
340
- $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
341
- $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')");
342
- }
343
- }
344
- } else {
345
- if (isset($pageCount) && !empty($pageCount)) {
346
- $existingtotal = (int) $pageCount[0]->page_visit;
347
- $totalFinal = $existingtotal + 1;
348
- $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
349
- $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')");
350
- } else {
351
- $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
352
- $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')");
353
- }
354
- }
355
- }
356
- }
357
 
358
- } else {
359
 
360
  $postTypeSelectedEncodeArr = json_decode($postTypeSelectedDecodeArr);
361
- $getPageSetting = get_post_meta($page,'get_page_count',true);
362
 
363
  // Check current page/post type exist in settings page array
364
  if (in_array($page_contet->post_type,$postTypeSelectedEncodeArr)) {
@@ -440,6 +441,7 @@ class page_visit_counter_Public {
440
  }
441
  }
442
  }
 
443
  }
444
 
445
  public function display_page_visit_counter_ajax() {
@@ -491,15 +493,26 @@ class page_visit_counter_Public {
491
 
492
  $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
493
 
 
 
 
 
494
  $total = (int) $pageCount[0]->total;
 
 
 
 
 
 
 
495
 
496
- echo $total;
497
 
498
  die();
499
 
500
  }
501
 
502
- public function insert_page_visit_counter_total_block($content) {
503
  global $wpdb, $wp, $post;
504
 
505
  if (is_ssl()) {
@@ -510,7 +523,7 @@ class page_visit_counter_Public {
510
  $pageID = url_to_postid( $actual_link );
511
  }
512
 
513
- if ($_SERVER['REQUEST_URI'] == '/shop/' && $pageID == 0) {
514
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
515
  }
516
  // if ($pageID == 0) {
@@ -552,29 +565,154 @@ class page_visit_counter_Public {
552
  $text_color_page_visit = 'style="color: #000000;"';
553
  }
554
 
 
 
 
555
  $table_name = $wpdb->prefix."page_visit";
 
556
 
557
  $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
558
 
 
 
559
  $total = (int) $pageCount[0]->total;
 
 
 
560
  $html = '';
561
  $hide_show_option = get_option('counter_hide_show_front_vew');
562
- if( $hide_show_option == 1 ){
563
  if(!is_feed() && !is_home()) {
564
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
565
- $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
 
 
 
 
566
  } else {
567
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
568
  if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
569
- $innerSettings = get_post_meta($pageID,'get_page_count',true);
570
  if ($innerSettings == '' || $innerSettings == 'yes') {
571
- $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
 
 
 
 
572
  }
573
  }
574
  }
575
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
576
  }
577
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
578
  return $content.' '.$html;
579
  //echo $html;
580
  } else {
@@ -588,13 +726,28 @@ class page_visit_counter_Public {
588
  global $wpdb, $wp, $post;
589
  $page_title = get_the_title();
590
  $page_id = get_the_ID();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
591
  $site_title = get_bloginfo( 'name' );
592
 
593
  $table_name = $wpdb->prefix."page_visit";
594
  $pageCount = '';
595
  if ( !empty( $page_id ) && $page_id !='' ) {
596
  //$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM `$table_name` WHERE `page_id` = $page_id");
597
- $pageCount = $wpdb->get_results("SELECT SUM(`page_visit`) FROM `$table_name` WHERE `page_id` = $page_id");
598
  }
599
 
600
  $total = (int) isset( $pageCount[0]->total ) ? $pageCount[0]->total : 0;
197
 
198
  $pageCount = $wpdb->get_results("SELECT * from $table_name where page_id=$page AND ipaddress = '$ipaddress' AND date = '$currentdate' LIMIT 1");
199
 
200
+ $getPageSetting = get_post_meta($page,'enable_page_count',true);
201
 
202
 
203
  $u_agent = $_SERVER['HTTP_USER_AGENT'];
205
  $bname = 'Unknown';
206
  $platform = 'Unknown';
207
  $version= "";
208
+ $ub= "";
209
 
210
  //First get the platform?
211
  if (preg_match('/linux/i', $u_agent)) {
268
  $version= $matches['version'][0];
269
  }
270
  else {
271
+ $version= isset($matches['version'][1]) ? $matches['version'][1] : null;;
272
  }
273
  }
274
  else {
275
+ $version= isset($matches['version'][0]) ? $matches['version'][0] : null;;
276
  }
277
 
278
  // check if we have a number
281
  $http_referer = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] :'';
282
 
283
  // old version plugin
284
+ if ($fetchSelecetedPostTypes != '') {
285
 
286
  // Check current page/post metabox settings is blank OR selected value is yes
287
+ // if ($getPageSetting == '' || $getPageSetting == 'yes') {
288
+ //
289
+ // // Check IP Address set in settings page if yes
290
+ // if (isset($fetchSelecetedIpAddress) && !empty($fetchSelecetedIpAddress)) {
291
+ // $optionsIpAddressEncodeArr = json_decode($optionsIpAddressDecodedArr);
292
+ // // Check IP Address not listed in settings page then go ahed
293
+ // if (!in_array($ipaddress,$optionsIpAddressEncodeArr)) {
294
+ //
295
+ // // Check users set in settings page if yes
296
+ // if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
297
+ //
298
+ // $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
299
+ // $user_id = get_current_user_id();
300
+ //
301
+ // // Check user not listed in settings page then go ahed
302
+ // if (!in_array($user_id,$optionsUserIdEncodeArr)) {
303
+ //
304
+ // if (isset($pageCount) && !empty($pageCount)) {
305
+ // $existingtotal = (int) $pageCount[0]->page_visit;
306
+ // $totalFinal = $existingtotal + 1;
307
+ // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
308
+ // $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')");
309
+ // } else {
310
+ // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
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
+ // }
313
+ // }
314
+ // } else {
315
+ // if (isset($pageCount) && !empty($pageCount)) {
316
+ // $existingtotal = (int) $pageCount[0]->page_visit;
317
+ // $totalFinal = $existingtotal + 1;
318
+ // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
319
+ // $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')");
320
+ // } else {
321
+ // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
322
+ // $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')");
323
+ // }
324
+ // }
325
+ // }
326
+ // } else {
327
+ // if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
328
+ //
329
+ // $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
330
+ // $user_id = get_current_user_id();
331
+ //
332
+ // // Check user not listed in settings page then go ahed
333
+ // if (!in_array($user_id,$optionsUserIdEncodeArr)) {
334
+ //
335
+ // if (isset($pageCount) && !empty($pageCount)) {
336
+ // $existingtotal = (int) $pageCount[0]->page_visit;
337
+ // $totalFinal = $existingtotal + 1;
338
+ // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
339
+ // $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')");
340
+ // } else {
341
+ // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
342
+ // $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')");
343
+ // }
344
+ // }
345
+ // } else {
346
+ // if (isset($pageCount) && !empty($pageCount)) {
347
+ // $existingtotal = (int) $pageCount[0]->page_visit;
348
+ // $totalFinal = $existingtotal + 1;
349
+ // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
350
+ // $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')");
351
+ // } else {
352
+ // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
353
+ // $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')");
354
+ // }
355
+ // }
356
+ // }
357
+ // }
358
 
359
+ //} else {
360
 
361
  $postTypeSelectedEncodeArr = json_decode($postTypeSelectedDecodeArr);
362
+ $getPageSetting = get_post_meta($page,'enable_page_count',true);
363
 
364
  // Check current page/post type exist in settings page array
365
  if (in_array($page_contet->post_type,$postTypeSelectedEncodeArr)) {
441
  }
442
  }
443
  }
444
+
445
  }
446
 
447
  public function display_page_visit_counter_ajax() {
493
 
494
  $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
495
 
496
+ $table_name_history = $wpdb->prefix."page_visit_history";
497
+
498
+ $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
499
+
500
  $total = (int) $pageCount[0]->total;
501
+
502
+ $totalToday = (int) $pageCountToday[0]->total;
503
+
504
+ $temp = array();
505
+
506
+ $temp['today'] = $totalToday;
507
+ $temp['total'] = $total;
508
 
509
+ echo json_encode($temp);
510
 
511
  die();
512
 
513
  }
514
 
515
+ public function insert_page_visit_counter_total_block_shop_page($content) {
516
  global $wpdb, $wp, $post;
517
 
518
  if (is_ssl()) {
523
  $pageID = url_to_postid( $actual_link );
524
  }
525
 
526
+ if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
527
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
528
  }
529
  // if ($pageID == 0) {
565
  $text_color_page_visit = 'style="color: #000000;"';
566
  }
567
 
568
+ $enableToday = '';
569
+ $enableToday = get_post_meta($pageID,'enable_page_count_day_wise',true);
570
+
571
  $table_name = $wpdb->prefix."page_visit";
572
+ $table_name_history = $wpdb->prefix."page_visit_history";
573
 
574
  $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
575
 
576
+ $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
577
+
578
  $total = (int) $pageCount[0]->total;
579
+ $totalToday = (int) $pageCountToday[0]->total;
580
+
581
+
582
  $html = '';
583
  $hide_show_option = get_option('counter_hide_show_front_vew');
584
+ if( $hide_show_option == 'on' ){
585
  if(!is_feed() && !is_home()) {
586
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
587
+ if ('yes' === $enableToday || '' === $enableToday) {
588
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.$totalToday.'</span>'.__('visits today','page-visit-counter').'</p>';
589
+ } else {
590
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
591
+ }
592
  } else {
593
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
594
  if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
595
+ $innerSettings = get_post_meta($pageID,'enable_page_count',true);
596
  if ($innerSettings == '' || $innerSettings == 'yes') {
597
+ if ('yes' === $enableToday || '' === $enableToday) {
598
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.$totalToday.'</span>'.__('visits today','page-visit-counter').'</p>';
599
+ } else {
600
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
601
+ }
602
  }
603
  }
604
  }
605
  }
606
+ }
607
+
608
+ echo $content.' '.$html;
609
+ //echo $html;
610
+ } else {
611
+ echo $content;
612
+ //echo $html;
613
+ }
614
+
615
+ }
616
+
617
+ public function insert_page_visit_counter_total_block($content) {
618
+ global $wpdb, $wp, $post;
619
+
620
+ if (is_ssl()) {
621
+ $actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
622
+ $pageID = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$actual_link));
623
+ } else {
624
+ $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
625
+ $pageID = url_to_postid( $actual_link );
626
+ }
627
+
628
+ if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
629
+ $pageID = (int) get_option( 'woocommerce_shop_page_id' );
630
+ }
631
+ // if ($pageID == 0) {
632
+ // $pageID = (int) get_option('page_on_front',true);
633
+ // if (empty($pageID) && !isset($pageID)) {
634
+ // $pageID = (int) get_option('page_for_posts',true);
635
+ // }
636
+ // }
637
+ //
638
+ // if ($pageID == 0) {
639
+ // $page = get_option('show_on_front',true);
640
+ // if ($page == 'posts') {
641
+ // $args = array(
642
+ // 'numberposts' => 1,
643
+ // 'orderby' => 'post_date',
644
+ // 'order' => 'DESC',
645
+ // 'post_type' => 'post',
646
+ // 'post_status' => 'publish',
647
+ // 'suppress_filters' => true );
648
+ //
649
+ // $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
650
+ // foreach( $recent_posts as $recent ){
651
+ // $pageID = (int) $recent["ID"];
652
+ // }
653
+ // }
654
+ //
655
+ // }
656
+
657
+ if ($pageID != 0) {
658
+ $post = get_post($pageID);
659
+
660
+ $fetchSelecetedPostTypes = get_option('wfap_post_type');
661
+
662
+ $text_color_page_visit = get_option('text_color_page_visit');
663
+
664
+ if (isset($text_color_page_visit) && $text_color_page_visit != null) {
665
+ $text_color_page_visit = 'style="color: '.$text_color_page_visit.';"';
666
+ } else {
667
+ $text_color_page_visit = 'style="color: #000000;"';
668
  }
669
 
670
+ $enableToday = '';
671
+ $enableToday = get_post_meta($pageID,'enable_page_count_day_wise',true);
672
+
673
+ $table_name = $wpdb->prefix."page_visit";
674
+ $table_name_history = $wpdb->prefix."page_visit_history";
675
+
676
+ $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
677
+
678
+ $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
679
+
680
+ $total = (int) $pageCount[0]->total;
681
+ $totalToday = (int) $pageCountToday[0]->total;
682
+
683
+ $html = '';
684
+ $hide_show_option = get_option('counter_hide_show_front_vew');
685
+ if( $hide_show_option == 'on' ){
686
+ if(!is_feed() && !is_home()) {
687
+ if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
688
+ if ('yes' === $enableToday || '' === $enableToday) {
689
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.$totalToday.'</span>'.__('visits today','page-visit-counter').'</p>';
690
+ } else {
691
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
692
+ }
693
+ } else {
694
+ $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
695
+ if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
696
+ $innerSettings = get_post_meta($pageID,'enable_page_count',true);
697
+ if ($innerSettings == '' || $innerSettings == 'yes') {
698
+ if ('yes' === $enableToday || '' === $enableToday) {
699
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.$totalToday.'</span>'.__('visits today','page-visit-counter').'</p>';
700
+ } else {
701
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>'.__('total visits.','page-visit-counter').'</p>';
702
+ }
703
+ }
704
+ }
705
+ }
706
+ }
707
+ }
708
+ // SELECT `page_id`, COUNT(`page_id`) as count,`date` FROM wp_page_visit_history Where date >= DATE(NOW()) - INTERVAL 7 DAY AND `page_id` = 1 GROUP BY date
709
+ $get_no_of_days = get_option('no_of_days_to_display');
710
+ if ($get_no_of_days == '') {
711
+ $get_no_of_days = 6;
712
+ } else {
713
+ $get_no_of_days = (int) $get_no_of_days + 1;
714
+ }
715
+ $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`";
716
  return $content.' '.$html;
717
  //echo $html;
718
  } else {
726
  global $wpdb, $wp, $post;
727
  $page_title = get_the_title();
728
  $page_id = get_the_ID();
729
+
730
+ if ($page_id == '') {
731
+ if (is_ssl()) {
732
+ $actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
733
+ $page_id = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$actual_link));
734
+ } else {
735
+ $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
736
+ $page_id = url_to_postid( $actual_link );
737
+ }
738
+
739
+ if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
740
+ $page_id = (int) get_option( 'woocommerce_shop_page_id' );
741
+ }
742
+ }
743
+
744
  $site_title = get_bloginfo( 'name' );
745
 
746
  $table_name = $wpdb->prefix."page_visit";
747
  $pageCount = '';
748
  if ( !empty( $page_id ) && $page_id !='' ) {
749
  //$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM `$table_name` WHERE `page_id` = $page_id");
750
+ $pageCount = $wpdb->get_results("SELECT SUM(`page_visit`) as total FROM `$table_name` WHERE `page_id` = $page_id");
751
  }
752
 
753
  $total = (int) isset( $pageCount[0]->total ) ? $pageCount[0]->total : 0;
public/css/counter-style.css CHANGED
@@ -2,3 +2,7 @@
2
  .counter-block h3 {margin: 0 !important;}
3
  .counter-block p {margin: 0;}
4
  .counter-block span {font-size: 10px;}
 
 
 
 
2
  .counter-block h3 {margin: 0 !important;}
3
  .counter-block p {margin: 0;}
4
  .counter-block span {font-size: 10px;}
5
+ .md-pvc-total-reports {float: left;width: 100%;}
6
+ .md-pvc-total-reports .md-pvc-total-reports-sub {float: left;width: auto;background: red;text-align: center;vertical-align: middle;top: 0;bottom: 0;left: 0;right: 0;border-radius: 5px;}
7
+ .md-pvc-total-reports .md-pvc-total-reports-sub span {float: left;padding: 5px;border: 1px solid #000;border-radius: 6px;width: 25px;text-align: center;margin: 5px;color: #fff;background: #000;}
8
+ .md-pvc-total-reports .md-pvc-total-reports-sub span.text {width: auto !important;}
public/js/custom.js CHANGED
@@ -3,18 +3,18 @@
3
  $(window).bind("load", function() {
4
  //$( document ).ready(function() {
5
  //var pageurl = '2';
6
- $.ajax({
7
- type: 'POST',
8
- url: pagevisit.ajaxurl,
9
- async : false,
10
- data: {
11
- action : 'insert_page_visit_counter',
12
- pageurl : pagevisit.pageurl
13
- },
14
- success: function( data ) {
15
-
16
- }
17
- });
18
 
19
  $.ajax({
20
  type: 'POST',
@@ -25,9 +25,13 @@
25
  pageurl : pagevisit.pageurl
26
  },
27
  success: function( data ) {
 
28
  if ($('#default-loop-page-visit-counter').length){
29
- if(data != '') {
30
- $('#default-loop-page-visit-counter .page_amount_visitor').text(data);
 
 
 
31
  }
32
  }
33
  }
3
  $(window).bind("load", function() {
4
  //$( document ).ready(function() {
5
  //var pageurl = '2';
6
+ // $.ajax({
7
+ // type: 'POST',
8
+ // url: pagevisit.ajaxurl,
9
+ // async : false,
10
+ // data: {
11
+ // action : 'insert_page_visit_counter',
12
+ // pageurl : pagevisit.pageurl
13
+ // },
14
+ // success: function( data ) {
15
+ //
16
+ // }
17
+ // });
18
 
19
  $.ajax({
20
  type: 'POST',
25
  pageurl : pagevisit.pageurl
26
  },
27
  success: function( data ) {
28
+ var obj = jQuery.parseJSON(data);
29
  if ($('#default-loop-page-visit-counter').length){
30
+ if(obj.total != '') {
31
+ $('#default-loop-page-visit-counter .page_amount_visitor').text(obj.total);
32
+ }
33
+ if(obj.today != '') {
34
+ $('#default-loop-page-visit-counter .page_amount_visitor_today').text(obj.today);
35
  }
36
  }
37
  }