Page Visit Counter - Version 1.1.2

Version Description

Automatic updates should work great for you. As always, though, we recommend backing up your site prior to making any updates just to be sure nothing goes wrong.

Download this release

Release Info

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

Code changes from version 1.1.1 to 1.1.2

README.txt CHANGED
@@ -4,10 +4,10 @@ Plugin URI: http://multidots.com/
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots
7
- Stable tag: 1.1.1
8
  Tags: page counter,page visit
9
  Requires at least: 2.1
10
- Tested up to: 4.3.1
11
  Donate link:
12
  Copyright: (c) 2014-2015 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
@@ -49,7 +49,7 @@ In the search field type Page Visit Counter and click Search Plugins. Once you'v
49
 
50
  In which WordPress version this Plugin is compatible?
51
 
52
- It is compatible from 2.1 to 4.3.1 WordPress version.
53
 
54
  == Upgrade Notice ==
55
 
@@ -60,4 +60,7 @@ Automatic updates should work great for you. As always, though, we recommend ba
60
  * Tweak - Class file added for admin settings page output.
61
 
62
  = 1.1.1 - 01.12.2015 =
63
- * Tweak - Remote request handles on activate.
 
 
 
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
  Contributors: dots
7
+ Stable tag: 1.1.2
8
  Tags: page counter,page visit
9
  Requires at least: 2.1
10
+ Tested up to: 4.4
11
  Donate link:
12
  Copyright: (c) 2014-2015 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
49
 
50
  In which WordPress version this Plugin is compatible?
51
 
52
+ It is compatible from 2.1 to 4.4 WordPress version.
53
 
54
  == Upgrade Notice ==
55
 
60
  * Tweak - Class file added for admin settings page output.
61
 
62
  = 1.1.1 - 01.12.2015 =
63
+ * Tweak - Remote request handles on activate.
64
+
65
+ = 1.1.2 - 14.12.2015 =
66
+ * Fixes - PHP error notice handled.
admin/class-page-visit-counter-admin.php CHANGED
@@ -101,9 +101,7 @@ class page_visit_counter_Admin {
101
 
102
  wp_enqueue_script('one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
103
 
104
- wp_localize_script( 'one', 'pagevisit', array(
105
- 'ajaxurl' => admin_url( 'admin-ajax.php', $this->protocol ),
106
- ) );
107
  }
108
  /**
109
  * admin menu page fnction
@@ -168,10 +166,7 @@ class page_visit_counter_Admin {
168
  <th width="20%">Total Count</th>
169
  </tr></tfoot><tbody></table>';
170
  $html .='</div>';
171
- $html .='</div>';
172
- ?>
173
-
174
- <?php
175
  echo $html;
176
  }
177
  /**
@@ -289,7 +284,7 @@ class page_visit_counter_Admin {
289
  $page_date = isset( $_POST['page_date'] ) ? $_POST['page_date'] : '';
290
  $string ='';
291
  if( $page_date == '' && $page_title =='' ){
292
- $html .='<table id="example" class="display" cellpadding="8" cellspacing="2">
293
  <thead>
294
  <tr>
295
  <th width="10%">No</th>
@@ -322,7 +317,13 @@ class page_visit_counter_Admin {
322
  $html .='<td>'.$count.'</td>';
323
  $html .='</tr>';
324
  }
325
- $html .='</tbody></table>';
 
 
 
 
 
 
326
  echo $html;
327
  }else {
328
  if( $page_title != '' ){
@@ -367,7 +368,7 @@ class page_visit_counter_Admin {
367
  <th width="10%">Page ID</th>
368
  <th>Page Title</th>
369
  <th width="20%">Total Count</th>
370
- </tr></tfoot</table>';
371
  echo $html;
372
  }else if( $dataquery != '' ){
373
  $html .='<table id="example" class="display" cellpadding="0" cellspacing="0">
@@ -430,9 +431,9 @@ class page_visit_counter_Admin {
430
  *
431
  */
432
  class My_Widget extends WP_Widget {
433
- public function __construct() {
434
  $widget_ops = array('classname' => 'My_Widget', 'description' => 'Most Visited Pages' );
435
- $this->WP_Widget('My_Widget', 'Recent Most Visit page', $widget_ops);
436
  }
437
 
438
  function widget($args, $instance) {
101
 
102
  wp_enqueue_script('one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
103
 
104
+ wp_localize_script( 'one', 'pagevisit', array('ajaxurl' => admin_url( 'admin-ajax.php')));
 
 
105
  }
106
  /**
107
  * admin menu page fnction
166
  <th width="20%">Total Count</th>
167
  </tr></tfoot><tbody></table>';
168
  $html .='</div>';
169
+ $html .='</div>';
 
 
 
170
  echo $html;
171
  }
172
  /**
284
  $page_date = isset( $_POST['page_date'] ) ? $_POST['page_date'] : '';
285
  $string ='';
286
  if( $page_date == '' && $page_title =='' ){
287
+ $html .='<table id="example" class="display" cellpadding="0" cellspacing="0">
288
  <thead>
289
  <tr>
290
  <th width="10%">No</th>
317
  $html .='<td>'.$count.'</td>';
318
  $html .='</tr>';
319
  }
320
+ $html .='</tbody>
321
+ <tfoot><tr>
322
+ <th width="10%">No</th>
323
+ <th width="10%">Page ID</th>
324
+ <th>Page Title</th>
325
+ <th width="20%">Total Count</th>
326
+ </tr></tfoot></table>';
327
  echo $html;
328
  }else {
329
  if( $page_title != '' ){
368
  <th width="10%">Page ID</th>
369
  <th>Page Title</th>
370
  <th width="20%">Total Count</th>
371
+ </tr></tfoot></table>';
372
  echo $html;
373
  }else if( $dataquery != '' ){
374
  $html .='<table id="example" class="display" cellpadding="0" cellspacing="0">
431
  *
432
  */
433
  class My_Widget extends WP_Widget {
434
+ public function __construct() {
435
  $widget_ops = array('classname' => 'My_Widget', 'description' => 'Most Visited Pages' );
436
+ parent::__construct('My_Widget', 'Recent Most Visit page', $widget_ops);
437
  }
438
 
439
  function widget($args, $instance) {
admin/class-page-visit-counter-html-output.php CHANGED
@@ -1,6 +1,4 @@
1
  <?php
2
-
3
-
4
  class Page_Visit_Count_Html_output {
5
 
6
  /**
@@ -454,4 +452,4 @@ class Page_Visit_Count_Html_output {
454
 
455
  }
456
 
457
- Page_Visit_Count_Html_output::init();
1
  <?php
 
 
2
  class Page_Visit_Count_Html_output {
3
 
4
  /**
452
 
453
  }
454
 
455
+ Page_Visit_Count_Html_output::init();
admin/js/custom.js CHANGED
@@ -1,5 +1,4 @@
1
  (function( $ ) {
2
-
3
  $( document ).ready(function() {
4
 
5
  $('#MyDate').datepicker({dateFormat : 'yy-mm-dd'});
@@ -86,8 +85,5 @@
86
  return false;
87
  }
88
  });
89
-
90
-
91
  });
92
-
93
  })( jQuery );
1
  (function( $ ) {
 
2
  $( document ).ready(function() {
3
 
4
  $('#MyDate').datepicker({dateFormat : 'yy-mm-dd'});
85
  return false;
86
  }
87
  });
 
 
88
  });
 
89
  })( jQuery );
includes/class-page-visit-counter-activator.php CHANGED
@@ -41,7 +41,7 @@ class class_Page_Visit_Activator {
41
  );";
42
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
43
  dbDelta( $sql );
44
- add_option( 'contact_db_version', $contact_db_version );
45
  }
46
  $log_url = $_SERVER['HTTP_HOST'];
47
  $log_plugin_id = 6;
41
  );";
42
  require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
43
  dbDelta( $sql );
44
+ //add_option( 'contact_db_version', $contact_db_version );
45
  }
46
  $log_url = $_SERVER['HTTP_HOST'];
47
  $log_plugin_id = 6;
includes/class-page-visit-counter-deactivator.php CHANGED
@@ -33,5 +33,4 @@ class class_Page_visit_Deactivator {
33
  wp_remote_request('http://mdstore.projectsmd.in/webservice-deactivate.php?log_url='.$log_url.'&plugin_id='.$log_plugin_id.'&activation_status='.$log_activation_status.'&activation_date='.$cur_dt);
34
 
35
  }
36
-
37
  }
33
  wp_remote_request('http://mdstore.projectsmd.in/webservice-deactivate.php?log_url='.$log_url.'&plugin_id='.$log_plugin_id.'&activation_status='.$log_activation_status.'&activation_date='.$cur_dt);
34
 
35
  }
 
36
  }
includes/class-page-visit-counter-loder.php CHANGED
@@ -123,7 +123,5 @@ class page_visit_counter_Loader {
123
  foreach ( $this->actions as $hook ) {
124
  add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125
  }
126
-
127
  }
128
-
129
  }
123
  foreach ( $this->actions as $hook ) {
124
  add_action( $hook['hook'], array( $hook['component'], $hook['callback'] ), $hook['priority'], $hook['accepted_args'] );
125
  }
 
126
  }
 
127
  }
page_visit_counter.php CHANGED
@@ -7,7 +7,7 @@
7
  * Plugin URI: http://www.multidots.com/
8
  * Description: Plugin for show visited page
9
  * Author: Multidots
10
- * Version: 1.1.1
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: Plugin for show visited page
9
  * Author: Multidots
10
+ * Version: 1.1.2
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
public/class-page-visit-counter-public.php CHANGED
@@ -70,7 +70,7 @@ class page_visit_counter_Public {
70
  wp_enqueue_script('one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
71
  $current_url = home_url( $wp->request );
72
  wp_localize_script( 'one', 'pagevisit', array(
73
- 'ajaxurl' => admin_url( 'admin-ajax.php', $this->protocol ),
74
  'pageurl' => $current_url,
75
  ) );
76
 
@@ -89,6 +89,7 @@ class page_visit_counter_Public {
89
  $table_name = $wpdb->prefix."page_visit";
90
  $last_date = '';
91
  $page_contet = get_post( $page );
 
92
  $get_option_value = json_decode(get_option( 'page_count_settings' ));
93
  $option_value = $get_option_value[0];
94
  $count_value = $get_option_value[1];
@@ -101,9 +102,10 @@ class page_visit_counter_Public {
101
  if( $option_value == 'day' ) {
102
  $day = $count_value;
103
  $get_last_date = date('Y-m-d', strtotime("+".$day." days"));
104
- if( $page_contet->post_type == 'page' ){
 
105
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
106
- $last_date = $last_date[0]->lastdate;
107
  $currentdate= date("Y-m-d");
108
  $ipaddress = $_SERVER['REMOTE_ADDR'];
109
  if( $last_date != $currentdate ){
@@ -122,12 +124,13 @@ class page_visit_counter_Public {
122
  }
123
  }
124
  //check option value is week
125
- } else if( $option_value == 'week' ){
126
- $day = $count_value;
127
  $get_last_date = date('Y-m-d', strtotime("+".$day." week"));
128
- if( $page_contet->post_type == 'page' ){
 
129
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
130
- $last_date = $last_date[0]->lastdate;
131
  $currentdate= date("Y-m-d");
132
  $ipaddress = $_SERVER['REMOTE_ADDR'];
133
  if( $last_date != $currentdate ){
@@ -150,9 +153,10 @@ class page_visit_counter_Public {
150
  } else if( $option_value == 'month' ){
151
  $day = $count_value;
152
  $get_last_date = date('Y-m-d', strtotime("+".$day." month"));
153
- if( $page_contet->post_type == 'page' ){
 
154
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
155
- $last_date = $last_date[0]->lastdate;
156
  $currentdate= date("Y-m-d");
157
  $ipaddress = $_SERVER['REMOTE_ADDR'];
158
  if( $last_date != $currentdate ){
@@ -174,9 +178,10 @@ class page_visit_counter_Public {
174
  } else if( $option_value == 'year' ){
175
  $day = $count_value;
176
  $get_last_date = date('Y-m-d', strtotime("+".$day." year"));
177
- if( $page_contet->post_type == 'page' ){
 
178
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
179
- $last_date = $last_date[0]->lastdate;
180
  $currentdate= date("Y-m-d");
181
  $ipaddress = $_SERVER['REMOTE_ADDR'];
182
  if( $last_date != $currentdate ){
70
  wp_enqueue_script('one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
71
  $current_url = home_url( $wp->request );
72
  wp_localize_script( 'one', 'pagevisit', array(
73
+ 'ajaxurl' => admin_url( 'admin-ajax.php' ),
74
  'pageurl' => $current_url,
75
  ) );
76
 
89
  $table_name = $wpdb->prefix."page_visit";
90
  $last_date = '';
91
  $page_contet = get_post( $page );
92
+ $check_page_content = isset( $page_contet->post_type)? $page_contet->post_type :'';
93
  $get_option_value = json_decode(get_option( 'page_count_settings' ));
94
  $option_value = $get_option_value[0];
95
  $count_value = $get_option_value[1];
102
  if( $option_value == 'day' ) {
103
  $day = $count_value;
104
  $get_last_date = date('Y-m-d', strtotime("+".$day." days"));
105
+ //if( $page_contet->post_type == 'page' ){
106
+ if( $check_page_content == 'page' ){
107
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
108
+ $last_date = isset($last_date[0]->lastdate) ? $last_date[0]->lastdate : '';
109
  $currentdate= date("Y-m-d");
110
  $ipaddress = $_SERVER['REMOTE_ADDR'];
111
  if( $last_date != $currentdate ){
124
  }
125
  }
126
  //check option value is week
127
+ } else if( $option_value == 'week' ) {
128
+ $day = $count_value;
129
  $get_last_date = date('Y-m-d', strtotime("+".$day." week"));
130
+ //if( $page_contet->post_type == 'page' ){
131
+ if( $check_page_content == 'page' ){
132
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
133
+ $last_date = isset($last_date[0]->lastdate) ? $last_date[0]->lastdate : '';
134
  $currentdate= date("Y-m-d");
135
  $ipaddress = $_SERVER['REMOTE_ADDR'];
136
  if( $last_date != $currentdate ){
153
  } else if( $option_value == 'month' ){
154
  $day = $count_value;
155
  $get_last_date = date('Y-m-d', strtotime("+".$day." month"));
156
+ //if( $page_contet->post_type == 'page' ){
157
+ if( $check_page_content == 'page' ){
158
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
159
+ $last_date = isset($last_date[0]->lastdate) ? $last_date[0]->lastdate : '';
160
  $currentdate= date("Y-m-d");
161
  $ipaddress = $_SERVER['REMOTE_ADDR'];
162
  if( $last_date != $currentdate ){
178
  } else if( $option_value == 'year' ){
179
  $day = $count_value;
180
  $get_last_date = date('Y-m-d', strtotime("+".$day." year"));
181
+ //if( $page_contet->post_type == 'page' ){
182
+ if( $check_page_content == 'page' ){
183
  $last_date = $wpdb->get_results("SELECT * from $table_name where page_id='".$page."' ORDER BY date DESC LIMIT 1");
184
+ $last_date = isset($last_date[0]->lastdate) ? $last_date[0]->lastdate : '';
185
  $currentdate= date("Y-m-d");
186
  $ipaddress = $_SERVER['REMOTE_ADDR'];
187
  if( $last_date != $currentdate ){