Page Visit Counter - Version 4.0.8

Version Description

  • 25-05-2018 =
  • minor bug fixed.
Download this release

Release Info

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

Code changes from version 4.0.7 to 4.0.8

README.txt CHANGED
@@ -4,10 +4,10 @@ Plugin URI: http://multidots.com/
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots, ketuchetan, chiragpatel, jitendrabanjara1991
7
- Stable tag: 4.0.7
8
  Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
9
  Requires at least: 2.1
10
- Tested up to: 4.9.4
11
  Donate link:
12
  Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
@@ -115,6 +115,9 @@ Automatic updates should work great for you. As always, though, we recommend ba
115
 
116
  == Changelog ==
117
 
 
 
 
118
  = 4.0.7 - 11-05-2018 =
119
  * minor bug fixed.
120
 
@@ -214,6 +217,4 @@ Automatic updates should work great for you. As always, though, we recommend ba
214
  * Tweak - Remote request handles on activate.
215
 
216
  = 1.1 - 07.11.2015 =
217
- * Tweak - Class file added for admin settings page output.
218
-
219
-
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots, ketuchetan, chiragpatel, jitendrabanjara1991
7
+ Stable tag: 4.0.8
8
  Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
9
  Requires at least: 2.1
10
+ Tested up to: 4.9.6
11
  Donate link:
12
  Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
115
 
116
  == Changelog ==
117
 
118
+ = 4.0.8 - 25-05-2018 =
119
+ * minor bug fixed.
120
+
121
  = 4.0.7 - 11-05-2018 =
122
  * minor bug fixed.
123
 
217
  * Tweak - Remote request handles on activate.
218
 
219
  = 1.1 - 07.11.2015 =
220
+ * Tweak - Class file added for admin settings page output.
 
 
admin/class-page-visit-counter-admin.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * The admin-specific functionality of the plugin.
4
  *
@@ -83,9 +87,7 @@ class page_visit_counter_Admin
83
  wp_enqueue_style('datatable-style', plugin_dir_url(__FILE__) . 'css/jquery.dataTables.css');
84
  wp_enqueue_style('jquery-style', plugin_dir_url(__FILE__) . 'css/jquery-ui.css');
85
  wp_enqueue_style('chosen-style', plugin_dir_url(__FILE__) . 'css/chosen.css');
86
- //wp_enqueue_style('fancy-box-style', plugin_dir_url( __FILE__ ) . 'css/jquery.fancybox-1.3.4.css');
87
  wp_enqueue_style('color-box-style', plugin_dir_url(__FILE__) . 'css/colorbox.css');
88
- //wp_enqueue_style('color-picker', plugin_dir_url( __FILE__ ) . 'css/color-picker.min.css');
89
  wp_enqueue_style('wp-color-picker');
90
  wp_enqueue_style('wp-pointer');
91
  }
@@ -113,16 +115,11 @@ class page_visit_counter_Admin
113
  wp_enqueue_script('jquery-ui-core');
114
  wp_enqueue_script('jquery-ui-tabs');
115
  wp_enqueue_script('jquery-ui-datepicker');
116
- //wp_deregister_style( 'wp-jquery-ui-dialog' );
117
- //wp_enqueue_script( 'wp-jquery-ui-dialog' );
118
  wp_enqueue_script('jquery-ui-dialog');
119
 
120
  //enqueue script for notice pointer
121
  wp_enqueue_script('wp-pointer');
122
 
123
- // if ( ! empty( $_GET['page'] ) && $_GET['page'] != '' && $_GET['page'] == 'page-visit-counter-about' ) {
124
- // wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
125
- // }
126
  if (isset($_GET['page'])) {
127
  if (!empty($_GET['page']) && $_GET['page'] != '' || ($_GET['page'] == 'page_visit_settings ' || $_GET['page'] == 'page-visit-counter-about' || $_GET['page'] == 'page_visit_counter')) {
128
  wp_enqueue_script('one', plugin_dir_url(__FILE__) . 'js/custom.js', array('jquery'), $this->version, false);
@@ -130,8 +127,6 @@ class page_visit_counter_Admin
130
  }
131
  wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/jquery.dataTables.min.js', array('jquery'), $this->version, false);
132
 
133
- //wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
134
-
135
  wp_enqueue_script('chosen-jquery', plugin_dir_url(__FILE__) . 'js/chosen.jquery.js', array('jquery'), $this->version, false);
136
  wp_enqueue_script('chosen-proto', plugin_dir_url(__FILE__) . 'js/chosen.proto.js', array('jquery'), $this->version, false);
137
  wp_enqueue_script('color-box', plugin_dir_url(__FILE__) . 'js/jquery.colorbox.js', array('jquery'), $this->version, false);
@@ -254,7 +249,7 @@ class page_visit_counter_Admin
254
  <h2 id="woo-extra-cost-tab-wrapper" class="nav-tab-wrapper">
255
  <?php
256
  foreach ($setting_tabs_wc as $name => $label) {
257
- echo '<a href="' . home_url('wp-admin/index.php?page=page-visit-counter-about&tab=' . $name) . '" class="nav-tab ' . ($current_tab_wc == $name ? 'nav-tab-active' : '') . '">' . $label . '</a>';
258
  }
259
  ?>
260
  </h2>
@@ -270,7 +265,7 @@ class page_visit_counter_Admin
270
  ?>
271
  <hr/>
272
  <div class="return-to-dashboard">
273
- <a href="<?php echo home_url('/wp-admin/admin.php?page=page_visit_settings'); ?>"><?php _e('Go to Page Visit Counter Settings', 'page-visit-counter'); ?></a>
274
  </div>
275
  </div>
276
  <?php
@@ -308,51 +303,51 @@ class page_visit_counter_Admin
308
  <div class="wc-feature feature-section col three-col">
309
  <div>
310
  <p class="page_visit_overview"><?php _e('This 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. Plugin provide search by page title and search by page published date facilities. Settings are required for page counter. Plugin provide to select specific post type to include in post /pages counter. Plugin also provide to exclude specific IP/s and specific register user to exude from post/pages counter.', 'page-visit-counter'); ?></p>
311
- <p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
312
  <div class="Page_Counter_Settings_Content_ul">
313
  <ul>
314
- <li>In these options you can do different setting for page visit counter.</li>
315
- <li>Short Code: There are two shortcuts that you can use to manually add page view count
316
  to any content on admin or post/page template created by your theme or plugin that's
317
- creating its own display content in a page / post.
318
  </li>
319
- <li>Post Type: You can select the post type from the drop down menu for which post views
320
  will be counted. If you leave blank on post type, then all pages or all past type
321
- posts will be counted.
322
  </li>
323
- <li>Exclude IPs (Ip Address): Enter the IP addresses which you want to be excluded from
324
- post views count.
325
  </li>
326
- <li>Exclude Users: Select users from your project/system to be excluded from post view
327
- count.
328
  </li>
329
- <li>Show front view counter: Check the box if you want to display counter view on front
330
- end.
331
  </li>
332
- <li>Choose color for the front end view: select color from color picker to choose the
333
- color for display visit pages text on front side as well as in the shortcode.
334
  </li>
335
  </ul>
336
  </div>
337
 
338
- <p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
339
 
340
- <p class="page_visit_overview">In this option you can see all pages listing within Page ID, Page
341
  Title and Total Count. It will display all pages of your site. If you excluded particular
342
  post type from page visit counter then also it will display that post type, posts pages on
343
- table but it will not count those pages and "total count" will be "0" for excluded post
344
- type, post pages.</p>
345
 
346
  <div class="Page_Counter_Settings_Content_ul">
347
  <ul>
348
- <li>Search facility: This provides you the extra facility to search pages by title and
349
- search page by its crated date.
350
  </li>
351
- <li>Sharing facility: This provides you to share specific page on Facebook, Twitter and
352
- Google Plus.
353
  </li>
354
- <li>Reports: This provides you the specific page vise reports like Top browsers, Top 10
355
- IP address, Top referer, weekly report and Monthly report using chart.
356
  </li>
357
  </ul>
358
  </div>
@@ -365,7 +360,7 @@ class page_visit_counter_Admin
365
  </div>
366
  <?php
367
  if (!get_option('pvcp_plugin_notice_shown')) {
368
- 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>';
369
  }
370
  }
371
 
@@ -397,16 +392,15 @@ class page_visit_counter_Admin
397
 
398
  <div class="plug-containter">
399
  <div class="paid_plugin">
400
- <h3>Paid Plugins</h3>
401
  <?php if (!empty($get_other_plugin) || $get_other_plugin != '') { ?>
402
  <?php foreach ($get_other_plugin as $key => $val) {
403
  if ($val['plugindesc'] == 'paid') { ?>
404
 
405
 
406
  <div class="contain-section">
407
- <div class="contain-img"><img src="<?php echo $val['pluginimage']; ?>"></div>
408
- <div class="contain-title"><a target="_blank"
409
- href="<?php echo $val['pluginurl']; ?>"><?php echo $key; ?></a>
410
  </div>
411
  </div>
412
 
@@ -428,12 +422,11 @@ class page_visit_counter_Admin
428
  </div>
429
  <?php if (isset($paid_arry) && !empty($paid_arry)) { ?>
430
  <div class="free_plugin">
431
- <h3>Free Plugins</h3>
432
  <?php foreach ($paid_arry as $key => $val) { ?>
433
  <div class="contain-section">
434
- <div class="contain-img"><img src="<?php echo $val['pluginimage']; ?>"></div>
435
- <div class="contain-title"><a target="_blank"
436
- href="<?php echo $val['pluginurl']; ?>"><?php echo $key; ?></a>
437
  </div>
438
  </div>
439
  <?php }
@@ -519,33 +512,30 @@ class page_visit_counter_Admin
519
  width: 50%;
520
  }
521
  </style>
522
- <div class="back"><h5><a class="button button-primary"
523
- href="<?php echo site_url() ?>/wp-admin/admin.php?page=page_visit_counter">&#x2190;
524
- Back to list</a></h5></div>
525
  <div style="">
526
  <div id="page-vist-fancybox" class="page-counter-fancybox">
527
  <div id="tabs">
528
  <div id="chartContainer-main">
529
- <span>Top Browsers</span>
530
  <div id="chartContainer" style="width: 100%; height: 500px;"></div>
531
  </div>
532
  <div id="chartContainer1-main">
533
- <span>Top 10 IP address</span>
534
  <div id="chartContainer1" style="width: 100%; height: 500px;"></div>
535
  </div>
536
  <div id="chartContainer2-main">
537
- <span>Top referer</span>
538
  <div id="chartContainer2" style="width: 100%; height: 500px;"></div>
539
  </div>
540
  <div id="chartContainer3-main">
541
- <span>Weekly report </span>
542
  <div id="chartContainer3" style="width: 100%; height: 500px;"></div>
543
  </div>
544
  <div id="chartContainer5-main">
545
- <span>Monthly report</span>
546
  <div id="chartContainer5" style="width: 100%; height: 500px;"></div>
547
  </div>
548
- <!--<div id="chartContainer6" style="width: 900px; height: 300px;"></div>-->
549
  </div>
550
  </div>
551
  </div>
@@ -705,7 +695,6 @@ class page_visit_counter_Admin
705
  }),
706
  success: function (data) {
707
  var resultarr = JSON.parse(data);
708
- console.log(resultarr);
709
  if (resultarr != 'novisit') {
710
  topBrowsersArr = resultarr['topBrowserString'];
711
  topIpArr = resultarr['topIpString'];
@@ -922,15 +911,14 @@ class page_visit_counter_Admin
922
  }
923
 
924
  if (!get_option('pvcp_plugin_notice_shown')) {
925
- 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>';
926
  }
927
 
928
  ?>
929
  <div class="main-page-visit-settings">
930
  <div class="page-title-settings">
931
- <form id="pvc_plugin_form_id" method="post" action="<?php echo get_admin_url(); ?>admin-post.php"
932
- enctype="multipart/form-data" novalidate="novalidate">
933
-
934
  <input type="hidden" name="action" value="submit_form_pvc"/>
935
  <input id="action_which" type="hidden" name="action-which" value="add"/>
936
  <div class="set_pvc_containter set_plugin_descriptions">
@@ -980,15 +968,12 @@ class page_visit_counter_Admin
980
  <table border="0" cellpadding="10" cellspacing="0">
981
  <tbody>
982
  <tr>
983
- <th scope="row"><label
984
- for="blogname"><?php echo __('Post Type', 'page-visit-counter'); ?></label>
985
  </th>
986
  <td>
987
- <select id="post_type"
988
- data-placeholder=" <?php echo __('Add Page/Post Type', 'page-visit-counter'); ?>"
989
- name="post_ty[]" multiple="true"
990
- class="chosen-select-post category-select chosen-rtl validate_field1">
991
- <option value=""></option><?php
992
  if (isset($post_types) && !empty($post_types)) {
993
  foreach ($post_types as $cpost) {
994
  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") { ?>
@@ -999,19 +984,14 @@ class page_visit_counter_Admin
999
  } ?>
1000
  </select>
1001
  <p><?php echo __('(Select post types for which post views will be counted.)', 'page-visit-counter'); ?></p>
1002
- <!--<p>(<b><?php //echo __('Note: To start the count of the page/post please select the Cpt (custom post type), page or post from above select box. If you not select any one then it will not start to count.', 'page-visit-counter'); ?></b>)</p>-->
1003
  </td>
1004
  </tr>
1005
 
1006
  <tr class="ipaddress">
1007
- <th scope="row"><label
1008
- for="blogname"><?php echo __('Exclude IPs (Ip Address)', 'page-visit-counter'); ?></label>
1009
  </th>
1010
  <td>
1011
- <select id="ip_address"
1012
- data-placeholder=" <?php echo __('Add IP Address in comma seprated', 'page-visit-counter'); ?>"
1013
- name="ip-basic[]" multiple="true"
1014
- class="chosen-select-ip category-select chosen-rtl validate_field1">
1015
  <option value=""></option><?php
1016
  $get_option_value_ip = json_decode(get_option('ipaddress_visit'));
1017
  if (isset($get_option_value_ip) && !empty($get_option_value_ip)) {
@@ -1026,14 +1006,10 @@ class page_visit_counter_Admin
1026
  </tr>
1027
 
1028
  <tr class="users">
1029
- <th scope="row"><label
1030
- for="blogname"><?php echo __('Exclude Users', 'page-visit-counter'); ?></label>
1031
  </th>
1032
  <td>
1033
- <select id="users_list"
1034
- data-placeholder="<?php echo __('Select Registerd Users', 'page-visit-counter'); ?>"
1035
- name="user-basic[]" multiple="true"
1036
- class="chosen-select category-select chosen-rtl validate_field1">
1037
  <option value=""></option><?php
1038
  $query = "SELECT * FROM $wpdb->users";
1039
  $resultSetsArr = $wpdb->get_results($query);
@@ -1049,8 +1025,7 @@ class page_visit_counter_Admin
1049
  </tr>
1050
 
1051
  <tr class="hidefront">
1052
- <th scope="row"><label
1053
- for="blogname"><?php echo __('Show front view counter', 'page-visit-counter'); ?></label>
1054
  </th>
1055
  <?php
1056
  $hide_show_option = get_option('counter_hide_show_front_vew');
@@ -1060,14 +1035,12 @@ class page_visit_counter_Admin
1060
  $cheked = '';
1061
  } ?>
1062
  <td class="information">
1063
- <input type="checkbox" name="hidefrontview"
1064
- 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'); ?>
1065
  </td>
1066
  </tr>
1067
 
1068
  <tr class="hidefront" style="display:none;">
1069
- <th scope="row"><label
1070
- for="blogname"><?php echo __('Last How many days count you want to display on front end.', 'page-visit-counter'); ?></label>
1071
  </th>
1072
  <td class="information">
1073
  <?php
@@ -1076,19 +1049,15 @@ class page_visit_counter_Admin
1076
  $get_no_of_days = '';
1077
  }
1078
  ?>
1079
- <input type="text" name="no_of_days_to_display" id="no_of_days_to_display"
1080
- value="<?php echo $get_no_of_days; ?>">
1081
  </td>
1082
  </tr>
1083
 
1084
  <tr class="">
1085
- <th scope="row"><label
1086
- for="blogname"><?php echo __('Choose color for the front end view', 'page-visit-counter'); ?></label>
1087
  </th>
1088
  <td class="information">
1089
- <input id="text_color_page_visit" type="text" name="textcolor"
1090
- value="<?php echo $text_color_page_visit; ?>" class="my-color-field"
1091
- data-default-color="<?php echo $text_color_page_visit; ?>"/>
1092
  </td>
1093
  </tr>
1094
  </tbody>
@@ -1096,14 +1065,9 @@ class page_visit_counter_Admin
1096
  </fieldset>
1097
  </div>
1098
  <p class="submit">
1099
- <input type="submit" name="submit" class="button button-primary"
1100
- value="<?php echo __('Save Changes', 'page-visit-counter'); ?>">
1101
- <input type="submit" id="pvc_reset_settings"
1102
- value="<?php echo __('Reset all settings', 'page-visit-counter'); ?>"
1103
- class="button button-primary">
1104
- <input type="submit" id="pvc_reset_counter"
1105
- value="<?php echo __('Reset all pages counts & report ', 'page-visit-counter'); ?>"
1106
- class="button button-primary">
1107
  </p>
1108
  </form>
1109
  </div>
@@ -1161,7 +1125,9 @@ class page_visit_counter_Admin
1161
  global $wpdb;
1162
  $table_name = $wpdb->prefix . "page_visit";
1163
  $html = '';
1164
- $count_visit = $wpdb->get_results("SELECT page_id,id,SUM(page_visit) as c from $table_name group by page_id order by c DESC limit 5");
 
 
1165
  $html .= '<div class="main_custom_dashboard_visit_page">';
1166
  if (!empty($count_visit) && isset($count_visit)) {
1167
  $html .= '<table border="0" cellpadding="5" cellspacing="10">';
@@ -1174,14 +1140,15 @@ class page_visit_counter_Admin
1174
  foreach ($count_visit as $visitpage) {
1175
  $page = get_post($visitpage->page_id);
1176
  $html .= '<tr>';
1177
- $html .= '<td>' . $page->ID . '</td>';
1178
- $html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $page->ID . '&action=edit">' . __($page->post_title, 'page-visit-counter') . '</a></td>';
1179
- $html .= '<td>' . $visitpage->c . '</td>';
 
1180
  $html .= '</tr>';
1181
  }
1182
  $html .= '</table>';
1183
  } else {
1184
- $html .= 'No Page Found.';
1185
  }
1186
  $html .= '</div>';
1187
  echo $html;
@@ -1199,11 +1166,13 @@ class page_visit_counter_Admin
1199
 
1200
  $page_count_option = array();
1201
 
1202
- $getformsumbitaction = !empty($_POST['action']) ? $_POST['action'] : '';
1203
- $getformactiontype = !empty($_POST['action-which']) ? $_POST['action-which'] : '';
1204
 
1205
  if (!empty($getformsumbitaction) && $getformsumbitaction == 'submit_form_pvc' && !empty($getformactiontype) && $getformactiontype == 'add') {
1206
-
 
 
1207
  $type = isset($_POST['post_ty']) ? $_POST['post_ty'] : array();
1208
  $ipAddress = isset($_POST['ip-basic']) ? $_POST['ip-basic'] : array();
1209
  $userList = isset($_POST['user-basic']) ? $_POST['user-basic'] : array();
@@ -1279,7 +1248,7 @@ class page_visit_counter_Admin
1279
  $wpdb->query($query);
1280
  }
1281
 
1282
- wp_safe_redirect(site_url("/wp-admin/admin.php?page=page_visit_settings"));
1283
  exit();
1284
 
1285
  //die();
@@ -1295,8 +1264,8 @@ class page_visit_counter_Admin
1295
  $table_name = $wpdb->prefix . "page_visit";
1296
  $table_post = $wpdb->prefix . "posts";
1297
  $html = '';
1298
- $page_title = isset($_POST['page_name']) ? $_POST['page_name'] : '';
1299
- $page_date = isset($_POST['page_date']) ? $_POST['page_date'] : '';
1300
  $string = '';
1301
  if ($page_date == '' && $page_title == '') {
1302
  $html .= '<table id="example" class="display" cellpadding="0" cellspacing="0">
@@ -1332,10 +1301,12 @@ class page_visit_counter_Admin
1332
  foreach ($result as $results) {
1333
  $counter = $counter + 1;
1334
  $html .= '<tr>';
1335
- $html .= '<td>' . $counter . '</td>';
1336
- $html .= '<td>' . $results->ID . '</td>';
1337
- $html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
1338
- $count_visit = $wpdb->get_results("SELECT SUM(page_visit) as page_visit from $table_name where page_id ='" . $results->ID . "'");
 
 
1339
  $count = 0;
1340
  foreach ($count_visit as $countval) {
1341
  $count = $count + 1;
@@ -1345,16 +1316,16 @@ class page_visit_counter_Admin
1345
  } else {
1346
  $countC = $count_visit[0]->page_visit;
1347
  }
1348
- $html .= '<td>' . $countC . '</td>';
1349
 
1350
  $site_title = get_bloginfo('name');
1351
  $page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
1352
 
1353
  $html .= '<td>
1354
- <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>
1355
- <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>
1356
- <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>';
1357
- $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>';
1358
  $html .= '</tr>';
1359
  }
1360
  }
@@ -1403,18 +1374,19 @@ class page_visit_counter_Admin
1403
  foreach ($notvisit as $results) {
1404
  $counter = $counter + 1;
1405
  $html .= '<tr>';
1406
- $html .= '<td>' . $counter . '</td>';
1407
- $html .= '<td>' . $results->ID . '</td>';
1408
- $html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
 
1409
  $html .= '<td> 0 </td>';
1410
  $site_title = get_bloginfo('name');
1411
  $page_social_content = $results->post_title . ' - Total Visits 0 - ' . $site_title;
1412
 
1413
  $html .= '<td>
1414
- <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>
1415
- <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>
1416
- <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>';
1417
- $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>';
1418
  $html .= '</tr>';
1419
  }
1420
  $html .= '</tbody><tfoot>
@@ -1442,9 +1414,10 @@ class page_visit_counter_Admin
1442
  foreach ($dataquery as $results) {
1443
  $counter = $counter + 1;
1444
  $html .= '<tr>';
1445
- $html .= '<td>' . $counter . '</td>';
1446
- $html .= '<td>' . $results->ID . '</td>';
1447
- $html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
 
1448
  $str = '';
1449
  if ($page_title != '') {
1450
  if ($page_date != '') {
@@ -1481,10 +1454,10 @@ class page_visit_counter_Admin
1481
  $page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
1482
 
1483
  $html .= '<td>
1484
- <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>
1485
- <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>
1486
- <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>';
1487
- $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>';
1488
 
1489
  $html .= '</tr>';
1490
  }
@@ -1540,7 +1513,8 @@ class page_visit_counter_Admin
1540
  global $wpdb, $wp;
1541
  if ($column == 'page_visit_count') {
1542
  $table_name = $wpdb->prefix . "page_visit";
1543
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id");
 
1544
  $total = (int)$pageCount[0]->total;
1545
  echo $total;
1546
  }
@@ -1555,8 +1529,9 @@ class page_visit_counter_Admin
1555
  $enable_page_count_day_wise = get_post_meta($post_id, "enable_page_count_day_wise", true);
1556
 
1557
  $table_name = $wpdb->prefix . "page_visit";
1558
-
1559
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id");
 
1560
 
1561
  $total = (int)$pageCount[0]->total;
1562
  ?>
@@ -1570,23 +1545,21 @@ class page_visit_counter_Admin
1570
  value="no"><?php echo __('No', 'page-visit-counter'); ?>
1571
  <?php } else { ?>
1572
  <input type="radio" <?php if ($enable_page_count == 'yes') { ?> checked="checked" <?php } ?>
1573
- name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
1574
  <input type="radio" <?php if ($enable_page_count == 'no') { ?> checked="checked" <?php } ?>
1575
- name="autoupdate_page_visit" id="autoupdate_page2" value="no">No<?php
1576
  } ?>
1577
  </p>
1578
  <p><?php echo __('Do you want to display today page visits count for this page?', 'page-visit-counter'); ?></p>
1579
  <p>
1580
  <?php if ($enable_page_count_day_wise == '') { ?>
1581
- <input type="radio" checked="checked" name="autoupdate_page_visit_day_wise"
1582
- id="autoupdate_page1_day_wise" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1583
- <input type="radio" name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise"
1584
- value="no"><?php echo __('No', 'page-visit-counter'); ?>
1585
  <?php } else { ?>
1586
  <input type="radio" <?php if ($enable_page_count_day_wise == 'yes') { ?> checked="checked" <?php } ?>
1587
- name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"> Yes
1588
  <input type="radio" <?php if ($enable_page_count_day_wise == 'no') { ?> checked="checked" <?php } ?>
1589
- name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no">No<?php
1590
  } ?>
1591
  </p>
1592
  <p><?php echo __('Do you want to reset all visits count for this page?', 'page-visit-counter'); ?></p>
@@ -1596,7 +1569,7 @@ class page_visit_counter_Admin
1596
  <input type="radio" checked="checked" name="page_visit_reset" id="page_visit_reset_yes"
1597
  value="no"><?php echo __('No', 'page-visit-counter'); ?>
1598
  </p>
1599
- <p><?php echo __('Total visits:', 'page-visit-counter'); ?><?php echo $total; ?></p>
1600
  <?php
1601
  }
1602
  }
@@ -1670,13 +1643,13 @@ class page_visit_counter_Admin
1670
  $table_name = $wpdb->prefix . "page_visit_history";
1671
 
1672
  $pageId = $_REQUEST['page_id'];
1673
-
1674
- $countQuery = "SELECT COUNT(`page_id`) as total FROM $table_name WHERE `page_id` = $pageId";
1675
- $result = $wpdb->get_results($countQuery);
1676
 
1677
  if ((int)$result[0]->total > 0) {
1678
-
1679
- $queryTopBrowser = "SELECT COUNT(`page_id`) as total, `browser_full_name` as browser FROM $table_name WHERE `page_id` = $pageId GROUP BY `browser_full_name`";
1680
 
1681
  $topBrowserArr = $wpdb->get_results($queryTopBrowser);
1682
 
@@ -1690,16 +1663,10 @@ class page_visit_counter_Admin
1690
  }
1691
  }
1692
 
1693
- //$queryTopIpAddress = "SELECT COUNT( `page_id` ) AS total, `ipaddress` AS ipaddress FROM $table_name WHERE `page_id` =$pageId GROUP BY `ipaddress` ORDER BY total DESC LIMIT 10";
1694
- //$queryTopIpAddress = "SELECT COUNT( `page_id` ) AS total, `ipaddress` AS ipaddress FROM $table_name WHERE `page_id` =$pageId AND date > DATE_SUB(NOW(), INTERVAL 1 MONTH) GROUP BY `ipaddress` ORDER BY total DESC LIMIT 10";
1695
- $queryTopIpAddress = "SELECT COUNT( `page_id` ) AS total, `ipaddress` AS ipaddress FROM $table_name WHERE `page_id` =$pageId GROUP BY `ipaddress` ORDER BY total DESC LIMIT 10";
1696
-
1697
- //echo $queryTopIpAddress;
1698
- $topIpArr = $wpdb->get_results($queryTopIpAddress);
1699
 
1700
- // echo '<pre>';
1701
- // print_r($topIpArr);
1702
- // echo '</pre>';
1703
 
1704
  $topIpStringArr = array();
1705
 
@@ -1709,9 +1676,10 @@ class page_visit_counter_Admin
1709
  $topIpStringArr["$topIp->ipaddress"] = (int)$topIp->total;
1710
  }
1711
  }
1712
-
1713
  $queryTopReferer = "SELECT COUNT(`page_id`) as total,SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(REPLACE(LOWER(`http_referer`), 'https://', ''), 'http://', ''), '/', 1), '?', 1) AS domain FROM $table_name WHERe `page_id` = $pageId AND `http_referer` != '' GROUP BY `http_referer` ORDER BY total DESC LIMIT 10";
1714
-
 
1715
  $topRefererArr = $wpdb->get_results($queryTopReferer);
1716
 
1717
  $topRefererStringArr = array();
@@ -1730,8 +1698,6 @@ class page_visit_counter_Admin
1730
  }
1731
 
1732
  $custom_page_visit_history_datatbase_table_name = $wpdb->prefix . "page_visit_history";
1733
- //$queryWeeklyReport = "SELECT SUM(page_id) AS total,DATE_ADD(date, INTERVAL(0-WEEKDAY(date)) DAY) as Week_Start_Date,DATE_ADD(date, INTERVAL(6-WEEKDAY(date)) DAY) as week_end_date,YEARWEEK( DATE, 1 ) AS YearAndWeek FROM $table_name WHERE page_id = $pageId GROUP BY YEARWEEK(date,1) ORDER BY YearAndWeek DESC LIMIT 5";
1734
- //$queryWeeklyReport = "SELECT SUM(page_id) AS total,DATE_ADD(date, INTERVAL(0-WEEKDAY(date)) DAY) as Week_Start_Date,DATE_ADD(date, INTERVAL(6-WEEKDAY(date)) DAY) as week_end_date,YEARWEEK( DATE, 1 ) AS YearAndWeek, YEAR(DATE) as year, WEEK( DATE,1 ) as week FROM $custom_page_visit_history_datatbase_table_name WHERE page_id = 1 GROUP BY YEARWEEK(date,1) ORDER BY YearAndWeek DESC LIMIT 5";
1735
  $queryWeeklyReport = "SELECT COUNT(page_id) AS total,DATE_ADD(date, INTERVAL(0-WEEKDAY(date)) DAY) as Week_Start_Date,DATE_ADD(date, INTERVAL(6-WEEKDAY(date)) DAY) as week_end_date,YEARWEEK( DATE, 1 ) AS YearAndWeek, YEAR(DATE) as yeargroup, WEEK( DATE,1 ) as week FROM $custom_page_visit_history_datatbase_table_name WHERE page_id = $pageId GROUP BY Week_Start_Date,week_end_date,YearAndWeek,yeargroup,week ORDER BY YearAndWeek DESC LIMIT 5";
1736
 
1737
  //echo $queryWeeklyReport;
@@ -1747,9 +1713,7 @@ class page_visit_counter_Admin
1747
  unset($topWeeklyArr);
1748
  }
1749
 
1750
- //$queryMonthlyReport = "SELECT SUM( `page_id` ) AS total, DATE_FORMAT(`date`,'%M %Y') AS month FROM `$table_name` WHERE `page_id` =$pageId AND YEAR( `date` ) = YEAR( CURDATE( ) ) GROUP BY MONTH( `date` ) ORDER BY MONTH( `date` ) ASC LIMIT 5";
1751
  $queryMonthlyReport = "SELECT COUNT( `page_id` ) AS total, DATE_FORMAT(`date`,'%M %Y') AS month FROM `$table_name` WHERE `page_id` =$pageId AND YEAR( `date` ) = YEAR( CURDATE( ) ) GROUP BY month ORDER BY MONTH( `date` ) ASC LIMIT 5";
1752
- //echo $queryMonthlyReport;
1753
  $topMonthlyArr = $wpdb->get_results($queryMonthlyReport);
1754
 
1755
  $topMonthlyStringArr = array();
@@ -1761,8 +1725,9 @@ class page_visit_counter_Admin
1761
  }
1762
  unset($topMonthlyArr);
1763
  }
1764
-
1765
- $queryYearlyReport = "SELECT SUM( `page_id` ) AS total, YEAR( `date` ) AS year FROM `$table_name` WHERE `page_id` =$pageId GROUP BY YEAR( `date` ) ORDER BY YEAR( `date` ) DESC LIMIT 10";
 
1766
 
1767
  $topYearlyArr = $wpdb->get_results($queryYearlyReport);
1768
 
@@ -1784,7 +1749,6 @@ class page_visit_counter_Admin
1784
 
1785
  echo json_encode($resultsArr);
1786
  unset($resultsArr);
1787
- //print_r($topBrowserStringArr);
1788
  } else {
1789
  echo json_encode('novisit');
1790
  }
@@ -1860,7 +1824,10 @@ class My_Widget extends WP_Widget
1860
  if (!empty($title)) {
1861
  $html .= $before_title . $title . $after_title;
1862
  }
1863
- $count_visit = $wpdb->get_results("SELECT page_id,id,SUM(page_visit) as c from $table_name group by page_id order by c DESC limit 5");
 
 
 
1864
  foreach ($count_visit as $visitpage) {
1865
  $page = get_post($visitpage->page_id);
1866
  $html .= '<h6 style="font-size: 14px;font-weight: normal;line-height: 14px;">' . $page->post_title . '</h6>';
@@ -1875,9 +1842,9 @@ class My_Widget extends WP_Widget
1875
  $instance = wp_parse_args((array)$instance, array('title' => ''));
1876
  $title = $instance['title'];
1877
  $html = '';
1878
- $html .= '<p> <label for="' . $this->get_field_id("title") . '">Title:
1879
- <input class="widefat" id="' . $this->get_field_id("title") . '"
1880
- name="' . $this->get_field_name("title") . '" type="text"
1881
  value="' . attribute_escape($title) . '" /></label></p>';
1882
  echo $html;
1883
  }
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * The admin-specific functionality of the plugin.
8
  *
87
  wp_enqueue_style('datatable-style', plugin_dir_url(__FILE__) . 'css/jquery.dataTables.css');
88
  wp_enqueue_style('jquery-style', plugin_dir_url(__FILE__) . 'css/jquery-ui.css');
89
  wp_enqueue_style('chosen-style', plugin_dir_url(__FILE__) . 'css/chosen.css');
 
90
  wp_enqueue_style('color-box-style', plugin_dir_url(__FILE__) . 'css/colorbox.css');
 
91
  wp_enqueue_style('wp-color-picker');
92
  wp_enqueue_style('wp-pointer');
93
  }
115
  wp_enqueue_script('jquery-ui-core');
116
  wp_enqueue_script('jquery-ui-tabs');
117
  wp_enqueue_script('jquery-ui-datepicker');
 
 
118
  wp_enqueue_script('jquery-ui-dialog');
119
 
120
  //enqueue script for notice pointer
121
  wp_enqueue_script('wp-pointer');
122
 
 
 
 
123
  if (isset($_GET['page'])) {
124
  if (!empty($_GET['page']) && $_GET['page'] != '' || ($_GET['page'] == 'page_visit_settings ' || $_GET['page'] == 'page-visit-counter-about' || $_GET['page'] == 'page_visit_counter')) {
125
  wp_enqueue_script('one', plugin_dir_url(__FILE__) . 'js/custom.js', array('jquery'), $this->version, false);
127
  }
128
  wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/jquery.dataTables.min.js', array('jquery'), $this->version, false);
129
 
 
 
130
  wp_enqueue_script('chosen-jquery', plugin_dir_url(__FILE__) . 'js/chosen.jquery.js', array('jquery'), $this->version, false);
131
  wp_enqueue_script('chosen-proto', plugin_dir_url(__FILE__) . 'js/chosen.proto.js', array('jquery'), $this->version, false);
132
  wp_enqueue_script('color-box', plugin_dir_url(__FILE__) . 'js/jquery.colorbox.js', array('jquery'), $this->version, false);
249
  <h2 id="woo-extra-cost-tab-wrapper" class="nav-tab-wrapper">
250
  <?php
251
  foreach ($setting_tabs_wc as $name => $label) {
252
+ echo '<a href="' . esc_url(home_url('wp-admin/index.php?page=page-visit-counter-about&tab=' . $name)) . '" class="nav-tab ' . ($current_tab_wc == $name ? 'nav-tab-active' : '') . '">' . esc_html($label) . '</a>';
253
  }
254
  ?>
255
  </h2>
265
  ?>
266
  <hr/>
267
  <div class="return-to-dashboard">
268
+ <a href="<?php echo esc_url(home_url('/wp-admin/admin.php?page=page_visit_settings')); ?>"><?php _e('Go to Page Visit Counter Settings', 'page-visit-counter'); ?></a>
269
  </div>
270
  </div>
271
  <?php
303
  <div class="wc-feature feature-section col three-col">
304
  <div>
305
  <p class="page_visit_overview"><?php _e('This 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. Plugin provide search by page title and search by page published date facilities. Settings are required for page counter. Plugin provide to select specific post type to include in post /pages counter. Plugin also provide to exclude specific IP/s and specific register user to exude from post/pages counter.', 'page-visit-counter'); ?></p>
306
+ <p class="page_visit_overview"><strong><?php _e('Page Counter Settings:', 'page-visit-counter');?> </strong></p>
307
  <div class="Page_Counter_Settings_Content_ul">
308
  <ul>
309
+ <li><?php _e("In these options you can do different setting for page visit counter.', 'page-visit-counter');?></li>
310
+ <li><?php _e('Short Code: There are two shortcuts that you can use to manually add page view count
311
  to any content on admin or post/page template created by your theme or plugin that's
312
+ creating its own display content in a page / post.", 'page-visit-counter');?>
313
  </li>
314
+ <li><?php _e("Post Type: You can select the post type from the drop down menu for which post views
315
  will be counted. If you leave blank on post type, then all pages or all past type
316
+ posts will be counted.", 'page-visit-counter');?>
317
  </li>
318
+ <li><?php _e("Exclude IPs (Ip Address): Enter the IP addresses which you want to be excluded from
319
+ post views count.", 'page-visit-counter');?>
320
  </li>
321
+ <li><?php _e("Exclude Users: Select users from your project/system to be excluded from post view
322
+ count.", 'page-visit-counter');?>
323
  </li>
324
+ <li><?php _e("Show front view counter: Check the box if you want to display counter view on front
325
+ end.", 'page-visit-counter');?>
326
  </li>
327
+ <li><?php _e("Choose color for the front end view: select color from color picker to choose the
328
+ color for display visit pages text on front side as well as in the shortcode.", 'page-visit-counter');?>
329
  </li>
330
  </ul>
331
  </div>
332
 
333
+ <p class="page_visit_overview"><strong><?php _e("Page Counter Settings:", 'page-visit-counter');?> </strong></p>
334
 
335
+ <p class="page_visit_overview"><?php _e("In this option you can see all pages listing within Page ID, Page
336
  Title and Total Count. It will display all pages of your site. If you excluded particular
337
  post type from page visit counter then also it will display that post type, posts pages on
338
+ table but it will not count those pages and 'total count' will be '0' for excluded post
339
+ type, post pages.</p>", 'page-visit-counter');?>
340
 
341
  <div class="Page_Counter_Settings_Content_ul">
342
  <ul>
343
+ <li><?php _e('Search facility: This provides you the extra facility to search pages by title and
344
+ search page by its crated date.', 'page-visit-counter');?>
345
  </li>
346
+ <li><?php _e('Sharing facility: This provides you to share specific page on Facebook, Twitter and
347
+ Google Plus.', 'page-visit-counter');?>
348
  </li>
349
+ <li><?php _e('Reports: This provides you the specific page vise reports like Top browsers, Top 10
350
+ IP address, Top referer, weekly report and Monthly report using chart.', 'page-visit-counter');?>
351
  </li>
352
  </ul>
353
  </div>
360
  </div>
361
  <?php
362
  if (!get_option('pvcp_plugin_notice_shown')) {
363
+ echo '<div id="pvcp_dialog" title="Basic dialog"> <p>'._e('Subscribe for latest plugin update and get notified when we update our plugin and launch new products for free!', 'page-visit-counter').' </p> <p><input type="text" id="txt_user_sub_pvcp" class="regular-text" name="txt_user_sub_pvcp" value="' . esc_attr($current_user->user_email) . '"></p></div>';
364
  }
365
  }
366
 
392
 
393
  <div class="plug-containter">
394
  <div class="paid_plugin">
395
+ <h3><?php _e('Paid Plugins', 'page-visit-counter');?></h3>
396
  <?php if (!empty($get_other_plugin) || $get_other_plugin != '') { ?>
397
  <?php foreach ($get_other_plugin as $key => $val) {
398
  if ($val['plugindesc'] == 'paid') { ?>
399
 
400
 
401
  <div class="contain-section">
402
+ <div class="contain-img"><img src="<?php echo esc_url($val['pluginimage']); ?>"></div>
403
+ <div class="contain-title"><a target="_blank" href="<?php echo esc_url($val['pluginurl']); ?>"><?php echo esc_attr($key); ?></a>
 
404
  </div>
405
  </div>
406
 
422
  </div>
423
  <?php if (isset($paid_arry) && !empty($paid_arry)) { ?>
424
  <div class="free_plugin">
425
+ <h3><?php _e('Free Plugins', 'page-visit-counter');?></h3>
426
  <?php foreach ($paid_arry as $key => $val) { ?>
427
  <div class="contain-section">
428
+ <div class="contain-img"><img src="<?php echo esc_url($val['pluginimage']); ?>"></div>
429
+ <div class="contain-title"><a target="_blank" href="<?php echo esc_url($val['pluginurl']); ?>"><?php echo esc_attr($key); ?></a>
 
430
  </div>
431
  </div>
432
  <?php }
512
  width: 50%;
513
  }
514
  </style>
515
+ <div class="back"><h5><a class="button button-primary" href="<?php echo esc_url(site_url().'/wp-admin/admin.php?page=page_visit_counter');?>">&#x2190;<?php echo _e('Back to list', 'page-visit-counter'); ?></a></h5></div>
 
 
516
  <div style="">
517
  <div id="page-vist-fancybox" class="page-counter-fancybox">
518
  <div id="tabs">
519
  <div id="chartContainer-main">
520
+ <span><?php echo _e('Top Browsers', 'page-visit-counter'); ?></span>
521
  <div id="chartContainer" style="width: 100%; height: 500px;"></div>
522
  </div>
523
  <div id="chartContainer1-main">
524
+ <span><?php echo _e('Top 10 IP address', 'page-visit-counter'); ?></span>
525
  <div id="chartContainer1" style="width: 100%; height: 500px;"></div>
526
  </div>
527
  <div id="chartContainer2-main">
528
+ <span><?php echo _e('Top referer', 'page-visit-counter'); ?></span>
529
  <div id="chartContainer2" style="width: 100%; height: 500px;"></div>
530
  </div>
531
  <div id="chartContainer3-main">
532
+ <span><?php echo _e('Weekly report', 'page-visit-counter'); ?> </span>
533
  <div id="chartContainer3" style="width: 100%; height: 500px;"></div>
534
  </div>
535
  <div id="chartContainer5-main">
536
+ <span><?php echo _e('Monthly report', 'page-visit-counter'); ?></span>
537
  <div id="chartContainer5" style="width: 100%; height: 500px;"></div>
538
  </div>
 
539
  </div>
540
  </div>
541
  </div>
695
  }),
696
  success: function (data) {
697
  var resultarr = JSON.parse(data);
 
698
  if (resultarr != 'novisit') {
699
  topBrowsersArr = resultarr['topBrowserString'];
700
  topIpArr = resultarr['topIpString'];
911
  }
912
 
913
  if (!get_option('pvcp_plugin_notice_shown')) {
914
+ echo '<div id="pvcp_dialog" title="Basic dialog"> <p>'._e('Subscribe for latest plugin update and get notified when we update our plugin and launch new products for free!', 'page-visit-counter').'</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>';
915
  }
916
 
917
  ?>
918
  <div class="main-page-visit-settings">
919
  <div class="page-title-settings">
920
+ <form id="pvc_plugin_form_id" method="post" action="<?php echo esc_url(get_admin_url() .'admin-post.php'); ?>" enctype="multipart/form-data" novalidate="novalidate">
921
+ <?php wp_nonce_field(basename(__FILE__), 'pvc_setting'); ?>
 
922
  <input type="hidden" name="action" value="submit_form_pvc"/>
923
  <input id="action_which" type="hidden" name="action-which" value="add"/>
924
  <div class="set_pvc_containter set_plugin_descriptions">
968
  <table border="0" cellpadding="10" cellspacing="0">
969
  <tbody>
970
  <tr>
971
+ <th scope="row"><label for="blogname"><?php echo __('Post Type', 'page-visit-counter'); ?></label>
 
972
  </th>
973
  <td>
974
+ <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">
975
+ <option value=""></option>
976
+ <?php
 
 
977
  if (isset($post_types) && !empty($post_types)) {
978
  foreach ($post_types as $cpost) {
979
  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") { ?>
984
  } ?>
985
  </select>
986
  <p><?php echo __('(Select post types for which post views will be counted.)', 'page-visit-counter'); ?></p>
 
987
  </td>
988
  </tr>
989
 
990
  <tr class="ipaddress">
991
+ <th scope="row"><label for="blogname"><?php echo __('Exclude IPs (Ip Address)', 'page-visit-counter'); ?></label>
 
992
  </th>
993
  <td>
994
+ <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">
 
 
 
995
  <option value=""></option><?php
996
  $get_option_value_ip = json_decode(get_option('ipaddress_visit'));
997
  if (isset($get_option_value_ip) && !empty($get_option_value_ip)) {
1006
  </tr>
1007
 
1008
  <tr class="users">
1009
+ <th scope="row"><label for="blogname"><?php echo __('Exclude Users', 'page-visit-counter'); ?></label>
 
1010
  </th>
1011
  <td>
1012
+ <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">
 
 
 
1013
  <option value=""></option><?php
1014
  $query = "SELECT * FROM $wpdb->users";
1015
  $resultSetsArr = $wpdb->get_results($query);
1025
  </tr>
1026
 
1027
  <tr class="hidefront">
1028
+ <th scope="row"><label for="blogname"><?php echo __('Show front view counter', 'page-visit-counter'); ?></label>
 
1029
  </th>
1030
  <?php
1031
  $hide_show_option = get_option('counter_hide_show_front_vew');
1035
  $cheked = '';
1036
  } ?>
1037
  <td class="information">
1038
+ <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'); ?>
 
1039
  </td>
1040
  </tr>
1041
 
1042
  <tr class="hidefront" style="display:none;">
1043
+ <th scope="row"><label for="blogname"><?php echo __('Last How many days count you want to display on front end.', 'page-visit-counter'); ?></label>
 
1044
  </th>
1045
  <td class="information">
1046
  <?php
1049
  $get_no_of_days = '';
1050
  }
1051
  ?>
1052
+ <input type="text" name="no_of_days_to_display" id="no_of_days_to_display" value="<?php echo $get_no_of_days; ?>">
 
1053
  </td>
1054
  </tr>
1055
 
1056
  <tr class="">
1057
+ <th scope="row"><label for="blogname"><?php echo __('Choose color for the front end view', 'page-visit-counter'); ?></label>
 
1058
  </th>
1059
  <td class="information">
1060
+ <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; ?>"/>
 
 
1061
  </td>
1062
  </tr>
1063
  </tbody>
1065
  </fieldset>
1066
  </div>
1067
  <p class="submit">
1068
+ <input type="submit" name="submit" class="button button-primary" value="<?php echo __('Save Changes', 'page-visit-counter'); ?>">
1069
+ <input type="submit" id="pvc_reset_settings" value="<?php echo __('Reset all settings', 'page-visit-counter'); ?>" class="button button-primary">
1070
+ <input type="submit" id="pvc_reset_counter" value="<?php echo __('Reset all pages counts & report ', 'page-visit-counter'); ?>" class="button button-primary">
 
 
 
 
 
1071
  </p>
1072
  </form>
1073
  </div>
1125
  global $wpdb;
1126
  $table_name = $wpdb->prefix . "page_visit";
1127
  $html = '';
1128
+ $limit = intval('5');
1129
+ $sel_qry = $wpdb->prepare('SELECT page_id,id,SUM(page_visit) as c FROM ' . $table_name . ' group by page_id order by c DESC LIMIT %d', $limit);
1130
+ $count_visit = $wpdb->get_results($sel_qry);
1131
  $html .= '<div class="main_custom_dashboard_visit_page">';
1132
  if (!empty($count_visit) && isset($count_visit)) {
1133
  $html .= '<table border="0" cellpadding="5" cellspacing="10">';
1140
  foreach ($count_visit as $visitpage) {
1141
  $page = get_post($visitpage->page_id);
1142
  $html .= '<tr>';
1143
+ $html .= '<td>' . esc_attr($page->ID) . '</td>';
1144
+ $edit_url = get_admin_url() . 'post.php?post=' . esc_attr($page->ID) . '&action=edit';
1145
+ $html .= '<td><a href="' . esc_url($edit_url).'">' . esc_html($page->post_title) . '</a></td>';
1146
+ $html .= '<td>' . esc_attr($visitpage->c) . '</td>';
1147
  $html .= '</tr>';
1148
  }
1149
  $html .= '</table>';
1150
  } else {
1151
+ $html .= __('No Page Found.', 'page-visit-counter');
1152
  }
1153
  $html .= '</div>';
1154
  echo $html;
1166
 
1167
  $page_count_option = array();
1168
 
1169
+ $getformsumbitaction = !empty($_POST['action']) ? sanitize_text_field(wp_unslash($_POST['action'])) : '';
1170
+ $getformactiontype = !empty($_POST['action-which']) ? sanitize_text_field(wp_unslash($_POST['action-which'])) : '';
1171
 
1172
  if (!empty($getformsumbitaction) && $getformsumbitaction == 'submit_form_pvc' && !empty($getformactiontype) && $getformactiontype == 'add') {
1173
+ if (!isset($_POST['pvc_setting']) || !wp_verify_nonce($_POST['pvc_setting'], basename(__FILE__))) {
1174
+ die('Failed security check');
1175
+ }
1176
  $type = isset($_POST['post_ty']) ? $_POST['post_ty'] : array();
1177
  $ipAddress = isset($_POST['ip-basic']) ? $_POST['ip-basic'] : array();
1178
  $userList = isset($_POST['user-basic']) ? $_POST['user-basic'] : array();
1248
  $wpdb->query($query);
1249
  }
1250
 
1251
+ wp_safe_redirect(esc_url(site_url("/wp-admin/admin.php?page=page_visit_settings")));
1252
  exit();
1253
 
1254
  //die();
1264
  $table_name = $wpdb->prefix . "page_visit";
1265
  $table_post = $wpdb->prefix . "posts";
1266
  $html = '';
1267
+ $page_title = isset($_POST['page_name']) ? sanitize_text_field(wp_unslash($_POST['page_name'])) : '';
1268
+ $page_date = isset($_POST['page_date']) ? sanitize_text_field(wp_unslash($_POST['page_date'])) : '';
1269
  $string = '';
1270
  if ($page_date == '' && $page_title == '') {
1271
  $html .= '<table id="example" class="display" cellpadding="0" cellspacing="0">
1301
  foreach ($result as $results) {
1302
  $counter = $counter + 1;
1303
  $html .= '<tr>';
1304
+ $html .= '<td>' . esc_attr($counter) . '</td>';
1305
+ $html .= '<td>' . esc_attr($results->ID) . '</td>';
1306
+ $edit_url = get_admin_url() . 'post.php?post=' . esc_attr($results->ID) . '&action=edit';
1307
+ $html .= '<td><a href="' . esc_url($edit_url) . '">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
1308
+ $sel_qry = $wpdb->prepare('SELECT SUM(page_visit) as page_visit from ' . $table_name . ' where page_id=%d', $results->ID);
1309
+ $count_visit = $wpdb->get_results($sel_qry);
1310
  $count = 0;
1311
  foreach ($count_visit as $countval) {
1312
  $count = $count + 1;
1316
  } else {
1317
  $countC = $count_visit[0]->page_visit;
1318
  }
1319
+ $html .= '<td>' . esc_attr($countC) . '</td>';
1320
 
1321
  $site_title = get_bloginfo('name');
1322
  $page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
1323
 
1324
  $html .= '<td>
1325
+ <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Facebook.png', dirname(__FILE__))) . '" /></a>
1326
+ <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="' . esc_url(plugins_url('images/twitter.png', dirname(__FILE__))) . '" /></a>
1327
+ <a target="_blank" href="https://plus.google.com/share?url=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Google_Plus.png', dirname(__FILE__))) . '" /></a></td>';
1328
+ $html .= '<td><a href="' . esc_url(site_url() . '/wp-admin/admin.php?page=page_visit_counter&id=' . $results->ID) . '" title="' . __($results->post_title, 'page-visit-counter') . '" class="" id="' . esc_attr($results->ID) . '">' . __('View Report', 'page-visit-counter') . '</a></td>';
1329
  $html .= '</tr>';
1330
  }
1331
  }
1374
  foreach ($notvisit as $results) {
1375
  $counter = $counter + 1;
1376
  $html .= '<tr>';
1377
+ $html .= '<td>' . esc_attr($counter) . '</td>';
1378
+ $html .= '<td>' . esc_attr($results->ID) . '</td>';
1379
+ $edit_url = get_admin_url() . 'post.php?post=' . esc_attr($results->ID) . '&action=edit';
1380
+ $html .= '<td><a href="' . esc_url($edit_url) . '">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
1381
  $html .= '<td> 0 </td>';
1382
  $site_title = get_bloginfo('name');
1383
  $page_social_content = $results->post_title . ' - Total Visits 0 - ' . $site_title;
1384
 
1385
  $html .= '<td>
1386
+ <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Facebook.png', dirname(__FILE__))) . '" /></a>
1387
+ <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="' . esc_url(plugins_url('images/twitter.png', dirname(__FILE__))) . '" /></a>
1388
+ <a target="_blank" href="https://plus.google.com/share?url=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Google_Plus.png', dirname(__FILE__))) . '" /></a></td>';
1389
+ $html .= '<td><a href="' . esc_url(site_url() . '/wp-admin/admin.php?page=page_visit_counter&id=' . $results->ID) . '" title="' . __($results->post_title, 'page-visit-counter') . '" class="" id="' . esc_attr($results->ID) . '">' . __('View Report', 'page-visit-counter') . '</a></td>';
1390
  $html .= '</tr>';
1391
  }
1392
  $html .= '</tbody><tfoot>
1414
  foreach ($dataquery as $results) {
1415
  $counter = $counter + 1;
1416
  $html .= '<tr>';
1417
+ $html .= '<td>' . esc_attr($counter) . '</td>';
1418
+ $html .= '<td>' . esc_attr($results->ID) . '</td>';
1419
+ $edit_url = get_admin_url() . 'post.php?post=' . esc_attr($results->ID) . '&action=edit';
1420
+ $html .= '<td><a href="' . esc_url($edit_url) . '">' . __($results->post_title, 'page-visit-counter') . '</a></td>';
1421
  $str = '';
1422
  if ($page_title != '') {
1423
  if ($page_date != '') {
1454
  $page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
1455
 
1456
  $html .= '<td>
1457
+ <a target="_blank" style="margin-right: 5px;" href="https://www.facebook.com/sharer/sharer.php?u=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Facebook.png', dirname(__FILE__))) . '" /></a>
1458
+ <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="' . esc_url(plugins_url('images/twitter.png', dirname(__FILE__))) . '" /></a>
1459
+ <a target="_blank" href="https://plus.google.com/share?url=' . esc_url(get_permalink($results->ID)) . '"><img src="' . esc_url(plugins_url('images/Google_Plus.png', dirname(__FILE__))) . '" /></a></td>';
1460
+ $html .= '<td><a href="' . esc_url(site_url() . '/wp-admin/admin.php?page=page_visit_counter&id=' . $results->ID). '" title="' . __($results->post_title, 'page-visit-counter') . '" class="" id="' . esc_attr($results->ID) . '">' . __('View Report', 'page-visit-counter') . '</a></td>';
1461
 
1462
  $html .= '</tr>';
1463
  }
1513
  global $wpdb, $wp;
1514
  if ($column == 'page_visit_count') {
1515
  $table_name = $wpdb->prefix . "page_visit";
1516
+ $get_qry = $wpdb->prepare('SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $post_id);
1517
+ $pageCount = $wpdb->get_results($get_qry);
1518
  $total = (int)$pageCount[0]->total;
1519
  echo $total;
1520
  }
1529
  $enable_page_count_day_wise = get_post_meta($post_id, "enable_page_count_day_wise", true);
1530
 
1531
  $table_name = $wpdb->prefix . "page_visit";
1532
+
1533
+ $get_qry = $wpdb->prepare('SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $post_id);
1534
+ $pageCount = $wpdb->get_results($get_qry);
1535
 
1536
  $total = (int)$pageCount[0]->total;
1537
  ?>
1545
  value="no"><?php echo __('No', 'page-visit-counter'); ?>
1546
  <?php } else { ?>
1547
  <input type="radio" <?php if ($enable_page_count == 'yes') { ?> checked="checked" <?php } ?>
1548
+ name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> <?php echo __('Yes', 'page-visit-counter'); ?>
1549
  <input type="radio" <?php if ($enable_page_count == 'no') { ?> checked="checked" <?php } ?>
1550
+ name="autoupdate_page_visit" id="autoupdate_page2" value="no"> <?php echo __('No', 'page-visit-counter'); ?><?php
1551
  } ?>
1552
  </p>
1553
  <p><?php echo __('Do you want to display today page visits count for this page?', 'page-visit-counter'); ?></p>
1554
  <p>
1555
  <?php if ($enable_page_count_day_wise == '') { ?>
1556
+ <input type="radio" checked="checked" name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"><?php echo __('Yes', 'page-visit-counter'); ?>
1557
+ <input type="radio" name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no"><?php echo __('No', 'page-visit-counter'); ?>
 
 
1558
  <?php } else { ?>
1559
  <input type="radio" <?php if ($enable_page_count_day_wise == 'yes') { ?> checked="checked" <?php } ?>
1560
+ name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"> <?php echo __('Yes', 'page-visit-counter'); ?>
1561
  <input type="radio" <?php if ($enable_page_count_day_wise == 'no') { ?> checked="checked" <?php } ?>
1562
+ name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no"><?php echo __('No', 'page-visit-counter'); ?><?php
1563
  } ?>
1564
  </p>
1565
  <p><?php echo __('Do you want to reset all visits count for this page?', 'page-visit-counter'); ?></p>
1569
  <input type="radio" checked="checked" name="page_visit_reset" id="page_visit_reset_yes"
1570
  value="no"><?php echo __('No', 'page-visit-counter'); ?>
1571
  </p>
1572
+ <p><?php echo __('Total visits:', 'page-visit-counter'); ?><?php echo esc_attr($total); ?></p>
1573
  <?php
1574
  }
1575
  }
1643
  $table_name = $wpdb->prefix . "page_visit_history";
1644
 
1645
  $pageId = $_REQUEST['page_id'];
1646
+
1647
+ $countQuery_qry = $wpdb->prepare('SELECT COUNT(`page_id`) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageId);
1648
+ $result = $wpdb->get_results($countQuery_qry);
1649
 
1650
  if ((int)$result[0]->total > 0) {
1651
+
1652
+ $queryTopBrowser = $wpdb->prepare('SELECT COUNT(`page_id`) as total, `browser_full_name` as browser FROM ' . $table_name . ' WHERE page_id=%d GROUP BY `browser_full_name`', $pageId);
1653
 
1654
  $topBrowserArr = $wpdb->get_results($queryTopBrowser);
1655
 
1663
  }
1664
  }
1665
 
1666
+ $queryTopIpAddressLimit = '10';
1667
+ $queryTopIpAddress = $wpdb->prepare('SELECT COUNT( `page_id` ) AS total, `ipaddress` AS ipaddress FROM ' . $table_name . ' WHERE page_id=%d GROUP BY `ipaddress` ORDER BY total DESC LIMIT %d', $pageId, $queryTopIpAddressLimit);
 
 
 
 
1668
 
1669
+ $topIpArr = $wpdb->get_results($queryTopIpAddress);
 
 
1670
 
1671
  $topIpStringArr = array();
1672
 
1676
  $topIpStringArr["$topIp->ipaddress"] = (int)$topIp->total;
1677
  }
1678
  }
1679
+
1680
  $queryTopReferer = "SELECT COUNT(`page_id`) as total,SUBSTRING_INDEX(SUBSTRING_INDEX(REPLACE(REPLACE(LOWER(`http_referer`), 'https://', ''), 'http://', ''), '/', 1), '?', 1) AS domain FROM $table_name WHERe `page_id` = $pageId AND `http_referer` != '' GROUP BY `http_referer` ORDER BY total DESC LIMIT 10";
1681
+ // echo "CALL ".$queryTopReferer;
1682
+ // exit();
1683
  $topRefererArr = $wpdb->get_results($queryTopReferer);
1684
 
1685
  $topRefererStringArr = array();
1698
  }
1699
 
1700
  $custom_page_visit_history_datatbase_table_name = $wpdb->prefix . "page_visit_history";
 
 
1701
  $queryWeeklyReport = "SELECT COUNT(page_id) AS total,DATE_ADD(date, INTERVAL(0-WEEKDAY(date)) DAY) as Week_Start_Date,DATE_ADD(date, INTERVAL(6-WEEKDAY(date)) DAY) as week_end_date,YEARWEEK( DATE, 1 ) AS YearAndWeek, YEAR(DATE) as yeargroup, WEEK( DATE,1 ) as week FROM $custom_page_visit_history_datatbase_table_name WHERE page_id = $pageId GROUP BY Week_Start_Date,week_end_date,YearAndWeek,yeargroup,week ORDER BY YearAndWeek DESC LIMIT 5";
1702
 
1703
  //echo $queryWeeklyReport;
1713
  unset($topWeeklyArr);
1714
  }
1715
 
 
1716
  $queryMonthlyReport = "SELECT COUNT( `page_id` ) AS total, DATE_FORMAT(`date`,'%M %Y') AS month FROM `$table_name` WHERE `page_id` =$pageId AND YEAR( `date` ) = YEAR( CURDATE( ) ) GROUP BY month ORDER BY MONTH( `date` ) ASC LIMIT 5";
 
1717
  $topMonthlyArr = $wpdb->get_results($queryMonthlyReport);
1718
 
1719
  $topMonthlyStringArr = array();
1725
  }
1726
  unset($topMonthlyArr);
1727
  }
1728
+
1729
+ $queryYearlyReportLimit = '10';
1730
+ $queryYearlyReport = $wpdb->prepare('SELECT SUM( `page_id` ) AS total, YEAR( `date` ) AS year FROM ' . $table_name . ' WHERE page_id=%d GROUP BY YEAR( `date` ) ORDER BY YEAR( `date` ) DESC LIMIT %d', $pageId, $queryYearlyReportLimit);
1731
 
1732
  $topYearlyArr = $wpdb->get_results($queryYearlyReport);
1733
 
1749
 
1750
  echo json_encode($resultsArr);
1751
  unset($resultsArr);
 
1752
  } else {
1753
  echo json_encode('novisit');
1754
  }
1824
  if (!empty($title)) {
1825
  $html .= $before_title . $title . $after_title;
1826
  }
1827
+
1828
+ $count_visit_limit = '5';
1829
+ $count_visit = $wpdb->prepare('SELECT page_id,id,SUM(page_visit) as c from' . $table_name . ' group by page_id order by c DESC limit %d', $count_visit_limit);
1830
+ $count_visit = $wpdb->get_results($count_visit);
1831
  foreach ($count_visit as $visitpage) {
1832
  $page = get_post($visitpage->page_id);
1833
  $html .= '<h6 style="font-size: 14px;font-weight: normal;line-height: 14px;">' . $page->post_title . '</h6>';
1842
  $instance = wp_parse_args((array)$instance, array('title' => ''));
1843
  $title = $instance['title'];
1844
  $html = '';
1845
+ $html .= '<p> <label for="' . esc_attr($this->get_field_id("title")) . '">Title:
1846
+ <input class="widefat" id="' . esc_attr($this->get_field_id("title")) . '"
1847
+ name="' . esc_attr($this->get_field_name("title")) . '" type="text"
1848
  value="' . attribute_escape($title) . '" /></label></p>';
1849
  echo $html;
1850
  }
admin/class-page-visit-counter-html-output.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  class Page_Visit_Count_Html_output {
3
 
4
  /**
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  class Page_Visit_Count_Html_output {
7
 
8
  /**
includes/class-page-visit-counter-activator.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * Fired during plugin activation
4
  *
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * Fired during plugin activation
8
  *
includes/class-page-visit-counter-deactivator.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * Fired during plugin deactivation
4
  *
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * Fired during plugin deactivation
8
  *
includes/class-page-visit-counter-i18n.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * Define the internationalization functionality.
4
  *
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * Define the internationalization functionality.
8
  *
includes/class-page-visit-counter-loder.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * Register all actions and filters for the plugin
4
  *
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * Register all actions and filters for the plugin
8
  *
includes/class-page-visit-counter.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * The file that defines the core plugin class
4
  *
@@ -135,10 +139,7 @@ class page_visit_counter {
135
 
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' );
144
 
@@ -151,7 +152,6 @@ class page_visit_counter {
151
 
152
  $this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
153
 
154
- //$this->loader->add_action('admin_body_class', $plugin_admin, 'extra_flat_rate_add_body_class', 10, 1);
155
  $this->loader->add_action('admin_init', $plugin_admin, 'welcome_page_visit_counter_screen_do_activation_redirect');
156
  //admin menu intilization hooks
157
  $this->loader->add_action('admin_menu', $plugin_admin, 'welcome_pages_screen_page_visit_counter');
@@ -178,13 +178,7 @@ class page_visit_counter {
178
  // Get all the registered post type
179
  global $wp_post_types;
180
  $post_types = get_post_types();
181
- //$post_types = $wpdb->get_results($query);
182
- // foreach ($post_types as $cpost) {
183
- // if($cpost->post_type != "attachment" && $cpost->post_type != "revision" && $cpost->post_type != "nav_menu_item" && $cpost->post_type != "product_variation" && $cpost->post_type != "shop_order" && $cpost->post_type != "shop_order_refund" && $cpost->post_type != "shop_coupon" && $cpost->post_type != "shop_webhook" && $cpost->post_type != "scheduled-action" && $cpost->post_type != "shop_subscription"&& $cpost->post_type != "wpcf7_contact_form"&& $cpost->post_type != "mc4wp-form") {
184
- // add_filter("manage_edit-".$cpost->post_type."_columns", "add_new_selected_post_columns");
185
- // add_action("manage_".$cpost->post_type."_posts_custom_column" , "custom_columns_add_page_visit_count",2,2);
186
- // }
187
- // }
188
  foreach ($post_types as $cpost) {
189
  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") {
190
  add_filter("manage_edit-".$cpost."_columns", "add_new_selected_post_columns");
@@ -210,20 +204,13 @@ class page_visit_counter {
210
 
211
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
212
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
213
-
214
- //$this->loader->add_action( 'wp_ajax_insert_page_visit_counter', $plugin_public, 'insert_page_visit_counter' );
215
- //$this->loader->add_action( 'wp_ajax_nopriv_insert_page_visit_counter', $plugin_public, 'insert_page_visit_counter' );
216
-
217
  $this->loader->add_action( 'wp_ajax_display_page_visit_counter_ajax', $plugin_public, 'display_page_visit_counter_ajax' );
218
  $this->loader->add_action( 'wp_ajax_nopriv_display_page_visit_counter_ajax', $plugin_public, 'display_page_visit_counter_ajax' );
219
 
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( 'wp_loaded', $plugin_public, 'insert_page_visit_counter_total_block',99 );
224
- //$this->loader->add_action( 'get_footer', $plugin_public, 'insert_page_visit_counter_total_block',99 );
225
-
226
- //add_action( 'wp_head', 'add_meta_tags_page_visit',1);
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 );
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * The file that defines the core plugin class
8
  *
139
 
140
  $this->loader->add_action( 'admin_menu',$plugin_admin, 'page_visit_counter_menu' );
141
  $this->loader->add_action( 'wp_dashboard_setup',$plugin_admin, 'my_custom_dashboard_widgets' );
142
+
 
 
 
143
  $this->loader->add_action( 'wp_ajax_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
144
  $this->loader->add_action( 'wp_ajax_nopriv_get_page_visit_record_report', $plugin_admin, 'get_page_visit_record_report' );
145
 
152
 
153
  $this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
154
 
 
155
  $this->loader->add_action('admin_init', $plugin_admin, 'welcome_page_visit_counter_screen_do_activation_redirect');
156
  //admin menu intilization hooks
157
  $this->loader->add_action('admin_menu', $plugin_admin, 'welcome_pages_screen_page_visit_counter');
178
  // Get all the registered post type
179
  global $wp_post_types;
180
  $post_types = get_post_types();
181
+
 
 
 
 
 
 
182
  foreach ($post_types as $cpost) {
183
  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") {
184
  add_filter("manage_edit-".$cpost."_columns", "add_new_selected_post_columns");
204
 
205
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
206
  $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
207
+
 
 
 
208
  $this->loader->add_action( 'wp_ajax_display_page_visit_counter_ajax', $plugin_public, 'display_page_visit_counter_ajax' );
209
  $this->loader->add_action( 'wp_ajax_nopriv_display_page_visit_counter_ajax', $plugin_public, 'display_page_visit_counter_ajax' );
210
 
211
  $this->loader->add_action( 'wp', $plugin_public, 'insert_page_visit_counter' );
212
 
213
  $this->loader->add_action( 'the_content', $plugin_public, 'insert_page_visit_counter_total_block',99 );
 
 
 
 
214
 
215
  if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
216
  $this->loader->add_filter( 'woocommerce_paypal_args', $plugin_public, 'paypal_bn_code_filter',99,1 );
includes/class-tt-pvc-list-table.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * WP List Table Example class
4
  *
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * WP List Table Example class
8
  *
page_visit_counter.php CHANGED
@@ -7,7 +7,7 @@
7
  * Plugin URI: http://www.multidots.com/
8
  * Description: This plugin will count the total visits of your sites pages.
9
  * Author: Multidots
10
- * Version: 4.0.7
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
7
  * Plugin URI: http://www.multidots.com/
8
  * Description: This plugin will count the total visits of your sites pages.
9
  * Author: Multidots
10
+ * Version: 4.0.8
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
public/class-page-visit-counter-public.php CHANGED
@@ -1,4 +1,8 @@
1
  <?php
 
 
 
 
2
  /**
3
  * The admin-specific functionality of the plugin.
4
  *
@@ -146,32 +150,6 @@ class page_visit_counter_Public {
146
  }
147
  }
148
 
149
- // if ($page == 0) {
150
- // $page = (int) get_option('page_on_front',true);
151
- // if (empty($page) && !isset($page)) {
152
- // $page = (int) get_option('page_for_posts',true);
153
- // }
154
- // }
155
- //
156
- // if ($page == 0) {
157
- // $page = get_option('show_on_front',true);
158
- // if ($page == 'posts') {
159
- // $args = array(
160
- // 'numberposts' => 1,
161
- // 'orderby' => 'post_date',
162
- // 'order' => 'DESC',
163
- // 'post_type' => 'post',
164
- // 'post_status' => 'publish',
165
- // 'suppress_filters' => true );
166
- //
167
- // $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
168
- // foreach( $recent_posts as $recent ){
169
- // $page = (int) $recent["ID"];
170
- // }
171
- // }
172
- //
173
- // }
174
-
175
  if ($page != 0) {
176
 
177
 
@@ -299,81 +277,6 @@ class page_visit_counter_Public {
299
  // old version plugin
300
  if ($fetchSelecetedPostTypes != '') {
301
 
302
- // Check current page/post metabox settings is blank OR selected value is yes
303
- // if ($getPageSetting == '' || $getPageSetting == 'yes') {
304
- //
305
- // // Check IP Address set in settings page if yes
306
- // if (isset($fetchSelecetedIpAddress) && !empty($fetchSelecetedIpAddress)) {
307
- // $optionsIpAddressEncodeArr = json_decode($optionsIpAddressDecodedArr);
308
- // // Check IP Address not listed in settings page then go ahed
309
- // if (!in_array($ipaddress,$optionsIpAddressEncodeArr)) {
310
- //
311
- // // Check users set in settings page if yes
312
- // if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
313
- //
314
- // $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
315
- // $user_id = get_current_user_id();
316
- //
317
- // // Check user not listed in settings page then go ahed
318
- // if (!in_array($user_id,$optionsUserIdEncodeArr)) {
319
- //
320
- // if (isset($pageCount) && !empty($pageCount)) {
321
- // $existingtotal = (int) $pageCount[0]->page_visit;
322
- // $totalFinal = $existingtotal + 1;
323
- // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
324
- // $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')");
325
- // } else {
326
- // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
327
- // $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')");
328
- // }
329
- // }
330
- // } else {
331
- // if (isset($pageCount) && !empty($pageCount)) {
332
- // $existingtotal = (int) $pageCount[0]->page_visit;
333
- // $totalFinal = $existingtotal + 1;
334
- // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
335
- // $insert_Query_history = $wpdb->query("INSERT into $table_name_history (`page_id`, `date`, `lastdate`, `ipaddress`, `browser_full_name`, `browser_short_name`, `browser_version`, `os`, `http_referer`) VALUES($page,NOW(),NOW(),'$ipaddress','$bname','$ub','$version','$platform','$http_referer')");
336
- // } else {
337
- // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
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
- // }
340
- // }
341
- // }
342
- // } else {
343
- // if (isset($fetchSelecetedUserId) && !empty($fetchSelecetedUserId)) {
344
- //
345
- // $optionsUserIdEncodeArr = json_decode($optionsUserIdDecodedArr);
346
- // $user_id = get_current_user_id();
347
- //
348
- // // Check user not listed in settings page then go ahed
349
- // if (!in_array($user_id,$optionsUserIdEncodeArr)) {
350
- //
351
- // if (isset($pageCount) && !empty($pageCount)) {
352
- // $existingtotal = (int) $pageCount[0]->page_visit;
353
- // $totalFinal = $existingtotal + 1;
354
- // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
355
- // $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')");
356
- // } else {
357
- // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
358
- // $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')");
359
- // }
360
- // }
361
- // } else {
362
- // if (isset($pageCount) && !empty($pageCount)) {
363
- // $existingtotal = (int) $pageCount[0]->page_visit;
364
- // $totalFinal = $existingtotal + 1;
365
- // $update_Query = $wpdb->query("UPDATE $table_name SET page_visit = $totalFinal WHERE page_id='".$page."' AND ipaddress='$ipaddress' AND date = '$currentdate'");
366
- // $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')");
367
- // } else {
368
- // $insert_Query = $wpdb->query("INSERT into $table_name (`page_id`,`page_visit`,`date`,`lastdate`,`ipaddress`) VALUES($page,1,NOW(),NOW(),'$ipaddress')");
369
- // $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')");
370
- // }
371
- // }
372
- // }
373
- // }
374
-
375
- //} else {
376
-
377
  $postTypeSelectedEncodeArr = json_decode($postTypeSelectedDecodeArr);
378
  $getPageSetting = get_post_meta($page,'enable_page_count',true);
379
 
@@ -471,32 +374,6 @@ class page_visit_counter_Public {
471
  $pageID = url_to_postid( $pageurl );
472
  }
473
 
474
- // if ($pageID == 0) {
475
- // $pageID = (int) get_option('page_on_front',true);
476
- // if (empty($pageID) && !isset($pageID)) {
477
- // $pageID = (int) get_option('page_for_posts',true);
478
- // }
479
- // }
480
- //
481
- // if ($pageID == 0) {
482
- // $page = get_option('show_on_front',true);
483
- // if ($page == 'posts') {
484
- // $args = array(
485
- // 'numberposts' => 1,
486
- // 'orderby' => 'post_date',
487
- // 'order' => 'DESC',
488
- // 'post_type' => 'post',
489
- // 'post_status' => 'publish',
490
- // 'suppress_filters' => true );
491
- //
492
- // $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
493
- // foreach( $recent_posts as $recent ){
494
- // $pageID = (int) $recent["ID"];
495
- // }
496
- // }
497
- //
498
- // }
499
-
500
  if (strpos($pageurl,'/shop') !== false && $pageID == 0 ) {
501
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
502
  }
@@ -506,12 +383,14 @@ class page_visit_counter_Public {
506
  $fetchSelecetedPostTypes = get_option('wfap_post_type');
507
 
508
  $table_name = $wpdb->prefix."page_visit";
509
-
510
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
 
511
 
512
  $table_name_history = $wpdb->prefix."page_visit_history";
513
 
514
- $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
 
515
 
516
  $total = (int) $pageCount[0]->total;
517
 
@@ -542,31 +421,6 @@ class page_visit_counter_Public {
542
  if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
543
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
544
  }
545
- // if ($pageID == 0) {
546
- // $pageID = (int) get_option('page_on_front',true);
547
- // if (empty($pageID) && !isset($pageID)) {
548
- // $pageID = (int) get_option('page_for_posts',true);
549
- // }
550
- // }
551
- //
552
- // if ($pageID == 0) {
553
- // $page = get_option('show_on_front',true);
554
- // if ($page == 'posts') {
555
- // $args = array(
556
- // 'numberposts' => 1,
557
- // 'orderby' => 'post_date',
558
- // 'order' => 'DESC',
559
- // 'post_type' => 'post',
560
- // 'post_status' => 'publish',
561
- // 'suppress_filters' => true );
562
- //
563
- // $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
564
- // foreach( $recent_posts as $recent ){
565
- // $pageID = (int) $recent["ID"];
566
- // }
567
- // }
568
- //
569
- // }
570
 
571
  if ($pageID != 0) {
572
  $post = get_post($pageID);
@@ -586,10 +440,12 @@ class page_visit_counter_Public {
586
 
587
  $table_name = $wpdb->prefix."page_visit";
588
  $table_name_history = $wpdb->prefix."page_visit_history";
589
-
590
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
 
591
 
592
- $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
 
593
 
594
  $total = (int) $pageCount[0]->total;
595
  $totalToday = (int) $pageCountToday[0]->total;
@@ -601,9 +457,9 @@ class page_visit_counter_Public {
601
  if(!is_feed() && !is_home()) {
602
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
603
  if ('yes' === $enableToday || '' === $enableToday) {
604
- $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>';
605
  } else {
606
- $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>';
607
  }
608
  } else {
609
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
@@ -611,9 +467,9 @@ class page_visit_counter_Public {
611
  $innerSettings = get_post_meta($pageID,'enable_page_count',true);
612
  if ($innerSettings == '' || $innerSettings == 'yes') {
613
  if ('yes' === $enableToday || '' === $enableToday) {
614
- $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>';
615
  } else {
616
- $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>';
617
  }
618
  }
619
  }
@@ -622,10 +478,8 @@ class page_visit_counter_Public {
622
  }
623
 
624
  echo $content.' '.$html;
625
- //echo $html;
626
  } else {
627
  echo $content;
628
- //echo $html;
629
  }
630
 
631
  }
@@ -644,31 +498,6 @@ class page_visit_counter_Public {
644
  if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
645
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
646
  }
647
- // if ($pageID == 0) {
648
- // $pageID = (int) get_option('page_on_front',true);
649
- // if (empty($pageID) && !isset($pageID)) {
650
- // $pageID = (int) get_option('page_for_posts',true);
651
- // }
652
- // }
653
- //
654
- // if ($pageID == 0) {
655
- // $page = get_option('show_on_front',true);
656
- // if ($page == 'posts') {
657
- // $args = array(
658
- // 'numberposts' => 1,
659
- // 'orderby' => 'post_date',
660
- // 'order' => 'DESC',
661
- // 'post_type' => 'post',
662
- // 'post_status' => 'publish',
663
- // 'suppress_filters' => true );
664
- //
665
- // $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
666
- // foreach( $recent_posts as $recent ){
667
- // $pageID = (int) $recent["ID"];
668
- // }
669
- // }
670
- //
671
- // }
672
 
673
  if ($pageID != 0) {
674
  $post = get_post($pageID);
@@ -689,9 +518,11 @@ class page_visit_counter_Public {
689
  $table_name = $wpdb->prefix."page_visit";
690
  $table_name_history = $wpdb->prefix."page_visit_history";
691
 
692
- $pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $pageID");
 
693
 
694
- $pageCountToday = $wpdb->get_results("SELECT COUNT(page_id) as total FROM $table_name_history WHERE `page_id` = $pageID AND DATE(`date`) = CURDATE()");
 
695
 
696
  $total = (int) $pageCount[0]->total;
697
  $totalToday = (int) $pageCountToday[0]->total;
@@ -702,9 +533,9 @@ class page_visit_counter_Public {
702
  if(!is_feed() && !is_home()) {
703
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
704
  if ('yes' === $enableToday || '' === $enableToday) {
705
- $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>';
706
  } else {
707
- $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>';
708
  }
709
  } else {
710
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
@@ -712,16 +543,15 @@ class page_visit_counter_Public {
712
  $innerSettings = get_post_meta($pageID,'enable_page_count',true);
713
  if ($innerSettings == '' || $innerSettings == 'yes') {
714
  if ('yes' === $enableToday || '' === $enableToday) {
715
- $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>';
716
  } else {
717
- $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>';
718
  }
719
  }
720
  }
721
  }
722
  }
723
  }
724
- // 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
725
  $get_no_of_days = get_option('no_of_days_to_display');
726
  if ($get_no_of_days == '') {
727
  $get_no_of_days = 6;
@@ -730,10 +560,8 @@ class page_visit_counter_Public {
730
  }
731
  $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`";
732
  return $content.' '.$html;
733
- //echo $html;
734
  } else {
735
  return $content;
736
- //echo $html;
737
  }
738
 
739
  }
1
  <?php
2
+ // If this file is called directly, abort.
3
+ if ( !defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
  /**
7
  * The admin-specific functionality of the plugin.
8
  *
150
  }
151
  }
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
  if ($page != 0) {
154
 
155
 
277
  // old version plugin
278
  if ($fetchSelecetedPostTypes != '') {
279
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
280
  $postTypeSelectedEncodeArr = json_decode($postTypeSelectedDecodeArr);
281
  $getPageSetting = get_post_meta($page,'enable_page_count',true);
282
 
374
  $pageID = url_to_postid( $pageurl );
375
  }
376
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
377
  if (strpos($pageurl,'/shop') !== false && $pageID == 0 ) {
378
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
379
  }
383
  $fetchSelecetedPostTypes = get_option('wfap_post_type');
384
 
385
  $table_name = $wpdb->prefix."page_visit";
386
+
387
+ $pageCount_qry = $wpdb->prepare('SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID);
388
+ $pageCount = $wpdb->get_results($pageCount_qry);
389
 
390
  $table_name_history = $wpdb->prefix."page_visit_history";
391
 
392
+ $pageCountToday_qry = $wpdb->prepare('SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID);
393
+ $pageCountToday = $wpdb->get_results($pageCountToday_qry);
394
 
395
  $total = (int) $pageCount[0]->total;
396
 
421
  if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
422
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
423
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
424
 
425
  if ($pageID != 0) {
426
  $post = get_post($pageID);
440
 
441
  $table_name = $wpdb->prefix."page_visit";
442
  $table_name_history = $wpdb->prefix."page_visit_history";
443
+
444
+ $pageCount_qry = $wpdb->prepare('SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID);
445
+ $pageCount = $wpdb->get_results($pageCount_qry);
446
 
447
+ $pageCountToday_qry = $wpdb->prepare('SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID);
448
+ $pageCountToday = $wpdb->get_results($pageCountToday_qry);
449
 
450
  $total = (int) $pageCount[0]->total;
451
  $totalToday = (int) $pageCountToday[0]->total;
457
  if(!is_feed() && !is_home()) {
458
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
459
  if ('yes' === $enableToday || '' === $enableToday) {
460
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(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>';
461
  } else {
462
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(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>';
463
  }
464
  } else {
465
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
467
  $innerSettings = get_post_meta($pageID,'enable_page_count',true);
468
  if ($innerSettings == '' || $innerSettings == 'yes') {
469
  if ('yes' === $enableToday || '' === $enableToday) {
470
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(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>';
471
  } else {
472
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.$text_color_page_visit.'><img src="'.esc_url(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>';
473
  }
474
  }
475
  }
478
  }
479
 
480
  echo $content.' '.$html;
 
481
  } else {
482
  echo $content;
 
483
  }
484
 
485
  }
498
  if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
499
  $pageID = (int) get_option( 'woocommerce_shop_page_id' );
500
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
 
502
  if ($pageID != 0) {
503
  $post = get_post($pageID);
518
  $table_name = $wpdb->prefix."page_visit";
519
  $table_name_history = $wpdb->prefix."page_visit_history";
520
 
521
+ $pageCount_qry = $wpdb->prepare('SELECT SUM(page_visit) as total FROM ' . $table_name . ' WHERE page_id=%d', $pageID);
522
+ $pageCount = $wpdb->get_results($pageCount_qry);
523
 
524
+ $pageCountToday_qry = $wpdb->prepare('SELECT COUNT(page_id) as total FROM ' . $table_name_history . ' WHERE page_id=%d AND DATE(`date`) = CURDATE()', $pageID);
525
+ $pageCountToday = $wpdb->get_results($pageCountToday_qry);
526
 
527
  $total = (int) $pageCount[0]->total;
528
  $totalToday = (int) $pageCountToday[0]->total;
533
  if(!is_feed() && !is_home()) {
534
  if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
535
  if ('yes' === $enableToday || '' === $enableToday) {
536
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.esc_attr($text_color_page_visit).'><img src="'.esc_url(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">'.esc_attr($total).'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.esc_attr($totalToday).'</span>'.__('visits today','page-visit-counter').'</p>';
537
  } else {
538
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.esc_attr($text_color_page_visit).'><img src="'.esc_url(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">'.esc_attr($total).'</span>'.__('total visits.','page-visit-counter').'</p>';
539
  }
540
  } else {
541
  $postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
543
  $innerSettings = get_post_meta($pageID,'enable_page_count',true);
544
  if ($innerSettings == '' || $innerSettings == 'yes') {
545
  if ('yes' === $enableToday || '' === $enableToday) {
546
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.esc_attr($text_color_page_visit).'><img src="'.esc_url(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">'.esc_attr($total).'</span>'.__('total visits,','page-visit-counter').'<span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_today">'.esc_attr($totalToday).'</span>'.__('visits today','page-visit-counter').'</p>';
547
  } else {
548
+ $html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block" '.esc_attr($text_color_page_visit).'><img src="'.esc_url(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">'.esc_attr($total).'</span>'.__('total visits.','page-visit-counter').'</p>';
549
  }
550
  }
551
  }
552
  }
553
  }
554
  }
 
555
  $get_no_of_days = get_option('no_of_days_to_display');
556
  if ($get_no_of_days == '') {
557
  $get_no_of_days = 6;
560
  }
561
  $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`";
562
  return $content.' '.$html;
 
563
  } else {
564
  return $content;
 
565
  }
566
 
567
  }