Page Visit Counter - Version 4.0.5

Version Description

  • 11-04-2018 =
  • Solved issue of view reports.
  • minor bug fixing.
  • Compatible with WordPress Version 4.9.4
Download this release

Release Info

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

Code changes from version 4.0.4 to 4.0.5

README.txt CHANGED
@@ -3,11 +3,11 @@ Plugin Name: Page Visit Counter
3
  Plugin URI: http://multidots.com/
4
  Author: Multidots
5
  Author URI: http://multidots.com/
6
- Contributors: dots, ketuchetan, chiragpatel
7
- Stable tag: 4.0.4
8
  Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
9
  Requires at least: 2.1
10
- Tested up to: 4.8
11
  Donate link:
12
  Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
13
  License: GPLv3 or later
@@ -114,6 +114,10 @@ It is compatible from 2.1 to 4.7 WordPress version.
114
  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.
115
 
116
  == Changelog ==
 
 
 
 
117
 
118
  = 4.0.4 - 19-06-2017 =
119
  * Removed Total visit on share post title.
3
  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.5
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
114
  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.
115
 
116
  == Changelog ==
117
+ = 4.0.5 - 11-04-2018 =
118
+ * Solved issue of view reports.
119
+ * minor bug fixing.
120
+ * Compatible with WordPress Version 4.9.4
121
 
122
  = 4.0.4 - 19-06-2017 =
123
  * Removed Total visit on share post title.
admin/class-page-visit-counter-admin.php CHANGED
@@ -116,12 +116,14 @@ class page_visit_counter_Admin {
116
  //enqueue script for notice pointer
117
  wp_enqueue_script( 'wp-pointer' );
118
 
119
- if ( ! empty( $_GET['page'] ) && $_GET['page'] != '' && $_GET['page'] == 'page-visit-counter-about' ) {
120
- wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
121
- }
122
- if ( ! empty( $_GET['page'] ) && $_GET['page'] != '' && $_GET['page'] == 'page_visit_settings' ) {
123
- wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
124
- }
 
 
125
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false );
126
 
127
  //wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
@@ -142,21 +144,49 @@ class page_visit_counter_Admin {
142
  'defaultString' => __( 'Default' ),
143
  'pick' => __( 'Select Color' )
144
  );
145
- wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n );
 
 
 
 
146
 
147
  wp_localize_script( 'one', 'pagevisit', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
148
 
149
  $fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
150
- $options = ! empty( $fetchSelecetedPostTypes ) ? $fetchSelecetedPostTypes : json_encode( array() );
151
- wp_localize_script( 'one', 'get_post_option', array( 'optionsarray' => $options ) );
152
-
153
- $fetchSelecetedIpAddress = get_option( 'ipaddress_visit' );
154
- $optionsIpAddress = ! empty( $fetchSelecetedIpAddress ) ? $fetchSelecetedIpAddress : json_encode( array() );
155
- wp_localize_script( 'one', 'get_ip_option', array( 'ipaddressarray' => $optionsIpAddress ) );
156
-
157
- $fetchSelecetedUserId = get_option( 'userlist_visit' );
158
- $optionsUserId = ! empty( $fetchSelecetedUserId ) ? $fetchSelecetedUserId : json_encode( array() );
159
- wp_localize_script( 'one', 'get_user_option', array( 'usersarray' => $optionsUserId ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  }
162
 
@@ -649,7 +679,6 @@ class page_visit_counter_Admin {
649
  };
650
 
651
  var page_id = <?php echo $_REQUEST['id']; ?>;
652
-
653
  jQuery.ajax({
654
  type: "POST",
655
  url: pagevisit.ajaxurl,
@@ -660,7 +689,6 @@ class page_visit_counter_Admin {
660
  }),
661
  success: function (data) {
662
  var resultarr = JSON.parse(data);
663
- console.log(resultarr);
664
  if (resultarr != 'novisit') {
665
  topBrowsersArr = resultarr['topBrowserString'];
666
  topIpArr = resultarr['topIpString'];
116
  //enqueue script for notice pointer
117
  wp_enqueue_script( 'wp-pointer' );
118
 
119
+ // if ( ! empty( $_GET['page'] ) && $_GET['page'] != '' && $_GET['page'] == 'page-visit-counter-about' ) {
120
+ // wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
121
+ // }
122
+ if (isset($_GET['page'])) {
123
+ if ( !empty( $_GET['page'] ) && $_GET['page'] != '' || ($_GET['page'] == 'page_visit_settings ' || $_GET['page'] == 'page-visit-counter-about' || $_GET['page'] == 'page_visit_counter') ) {
124
+ wp_enqueue_script( 'one', plugin_dir_url( __FILE__ ) . 'js/custom.js', array( 'jquery' ), $this->version, false );
125
+ }
126
+ }
127
  wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false );
128
 
129
  //wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
144
  'defaultString' => __( 'Default' ),
145
  'pick' => __( 'Select Color' )
146
  );
147
+ if (!empty($colorpicker_l10n) || $colorpicker_l10n != "") {
148
+ wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n );
149
+ } else {
150
+ wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', '' );
151
+ }
152
 
153
  wp_localize_script( 'one', 'pagevisit', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
154
 
155
  $fetchSelecetedPostTypes = get_option( 'wfap_post_type' );
156
+ if (!empty($fetchSelecetedPostTypes) || $fetchSelecetedPostTypes != "") {
157
+ $options = ! empty( $fetchSelecetedPostTypes ) ? $fetchSelecetedPostTypes : json_encode( array() );
158
+ if (!empty($options) || $options != "") {
159
+ wp_localize_script( 'one', 'get_post_option', array( 'optionsarray' => $options ) );
160
+ } else{
161
+ wp_localize_script( 'one', 'get_post_option', array( 'optionsarray' => '' ) );
162
+ }
163
+ } else {
164
+ wp_localize_script( 'one', 'get_post_option', array( 'optionsarray' => '' ) );
165
+ }
166
+
167
+ $fetchSelecetedIpAddress = get_option( 'ipaddress_visit' );
168
+ if (!empty($fetchSelecetedIpAddress) || $fetchSelecetedIpAddress != "") {
169
+ $optionsIpAddress = ! empty( $fetchSelecetedIpAddress ) ? $fetchSelecetedIpAddress : json_encode( array() );
170
+ if (!empty($optionsIpAddress) || $optionsIpAddress != "") {
171
+ wp_localize_script( 'one', 'get_ip_option', array( 'ipaddressarray' => $optionsIpAddress ) );
172
+ } else{
173
+ wp_localize_script( 'one', 'get_ip_option', array( 'ipaddressarray' => '' ) );
174
+ }
175
+ } else {
176
+ wp_localize_script( 'one', 'get_ip_option', array( 'ipaddressarray' => '' ) );
177
+ }
178
+
179
+ $fetchSelecetedUserId = get_option( 'userlist_visit' );
180
+ if (!empty($fetchSelecetedUserId) || $fetchSelecetedUserId != "") {
181
+ $optionsUserId = ! empty( $fetchSelecetedUserId ) ? $fetchSelecetedUserId : json_encode( array() );
182
+ if (!empty($optionsUserId) || $optionsUserId != "") {
183
+ wp_localize_script( 'one', 'get_user_option', array( 'usersarray' => $optionsUserId ) );
184
+ } else{
185
+ wp_localize_script( 'one', 'get_user_option', array( 'usersarray' => '' ) );
186
+ }
187
+ } else {
188
+ wp_localize_script( 'one', 'get_user_option', array( 'usersarray' => '' ) );
189
+ }
190
 
191
  }
192
 
679
  };
680
 
681
  var page_id = <?php echo $_REQUEST['id']; ?>;
 
682
  jQuery.ajax({
683
  type: "POST",
684
  url: pagevisit.ajaxurl,
689
  }),
690
  success: function (data) {
691
  var resultarr = JSON.parse(data);
 
692
  if (resultarr != 'novisit') {
693
  topBrowsersArr = resultarr['topBrowserString'];
694
  topIpArr = resultarr['topIpString'];
admin/js/custom.js CHANGED
@@ -1,344 +1,357 @@
1
- (function ($) {
2
- $(window).load(function () {
3
-
4
- jQuery("#pvcp_dialog").dialog({
5
-
6
- modal: true, title: 'Subscribe Now', zIndex: 10000, autoOpen: true,
7
- width: '500', resizable: false,
8
- position: {my: "center", at: "center", of: window},
9
- dialogClass: 'dialogButtons',
10
- buttons: {
11
- Yes: function () {
12
- // $(obj).removeAttr('onclick');
13
- // $(obj).parents('.Parent').remove();
14
- var email_id = jQuery('#txt_user_sub_pvcp').val();
15
-
16
- var data = {
17
- 'action': 'add_plugin_user_pvcp',
18
- 'email_id': email_id
19
- };
20
-
21
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
22
- jQuery.post(ajaxurl, data, function (response) {
23
- jQuery('#pvcp_dialog').html('<h2>You have been successfully subscribed');
24
- jQuery(".ui-dialog-buttonpane").remove();
25
- });
26
-
27
-
28
- },
29
- No: function () {
30
- var email_id = jQuery('#txt_user_sub_pvcp').val();
31
-
32
- var data = {
33
- 'action': 'hide_subscribe_pvcp',
34
- 'email_id': email_id
35
- };
36
-
37
- // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
38
- jQuery.post(ajaxurl, data, function (response) {
39
-
40
- });
41
-
42
- jQuery(this).dialog("close");
43
-
44
- }
45
  },
46
- close: function (event, ui) {
47
- jQuery(this).remove();
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
- });
50
- jQuery("div.dialogButtons .ui-dialog-buttonset button").removeClass('ui-state-default');
51
- jQuery("div.dialogButtons .ui-dialog-buttonset button").addClass("button-primary woocommerce-save-button");
52
- jQuery("div.dialogButtons .ui-dialog-buttonpane .ui-button").css("width", "80px");
 
 
 
 
53
 
54
 
55
- $('#MyDate').datepicker({dateFormat: 'yy-mm-dd'});
56
- $('#example').DataTable({
57
- "iDisplayLength": 10,
58
- "sPaginationType": "full_numbers",
59
- "oLanguage": {"sEmptyTable": "No Page Found."}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
  });
61
- $('#example_filter').css("display", "none");
62
- $('#example_length').css("display", "none");
63
-
64
-
65
- $('body').on('click', "#search-submit", function () {
66
-
67
- var pagename = $("#page-search-text").val();
68
- var pagedate = $(".pagedateselect").val();
69
- $.ajax({
70
- type: "POST",
71
- url: pagevisit.ajaxurl,
72
- async: false,
73
- data: ({
74
- action: 'select_input_page_value',
75
- page_name: pagename,
76
- page_date: pagedate
77
- }),
78
- success: function (data) {
79
- $(".page-visit-summery").empty();
80
- $(".page-visit-summery").append(data);
81
- $('#example').DataTable({
82
- "iDisplayLength": 10,
83
- "sPaginationType": "full_numbers",
84
- "oLanguage": {"sEmptyTable": "No Page Found."}
85
- });
86
- $('#example_filter').css("display", "none");
87
- $('#example_length').css("display", "none");
88
- }
89
- });
90
 
91
- });
92
 
93
- $("#ui-datepicker-div").css("display", "none");
94
 
 
 
95
  var selectedPostArray = JSON.parse(get_post_option.optionsarray);
96
  var selectedPostglobalarr = [];
97
  for (var p in selectedPostArray) {
98
  selectedPostglobalarr.push(selectedPostArray[p]);
99
  }
100
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  var selecteduserArray = JSON.parse(get_user_option.usersarray);
102
  var selectedUserglobalarr = [];
103
  for (var u in selecteduserArray) {
104
  selectedUserglobalarr.push(selecteduserArray[u]);
105
  }
106
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  var selectedIpArray = JSON.parse(get_ip_option.ipaddressarray);
108
  var selectedIpglobalarr = [];
109
  for (var i in selectedIpArray) {
110
  selectedIpglobalarr.push(selectedIpArray[i]);
111
  }
112
 
113
- var userString = '';
114
- userString = selectedUserglobalarr.join(",");
115
-
116
  var ipString = '';
117
  ipString = selectedIpglobalarr.join(",");
118
 
119
- var postString = '';
120
- postString = selectedPostglobalarr.join(",");
121
-
122
- $('body').on('change', '.posttype', function () {
123
- var page_id = this.id
124
- if ($('#' + page_id).is(":checked")) {
125
- selectedPostglobalarr.push(page_id);
126
- } else {
127
- selectedPostglobalarr.indexOf(page_id);
128
- var index = selectedPostglobalarr.indexOf(page_id);
129
- if (index > -1) {
130
- selectedPostglobalarr.splice(index, 1);
131
- }
132
- }
133
-
134
- });
135
-
136
- var config = {
137
- '.chosen-select': {},
138
- '.chosen-select-deselect': {allow_single_deselect: true},
139
- '.chosen-select-no-single': {disable_search_threshold: 10},
140
- '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
141
- '.chosen-select-width': {width: "95%"}
142
- }
143
- for (var selector in config) {
144
- $(selector).chosen(config[selector]);
145
  }
 
146
 
147
 
148
- var configip = {
149
- '.chosen-select-ip': {},
150
- '.chosen-select-deselect': {allow_single_deselect: true},
151
- '.chosen-select-no-single': {disable_search_threshold: 10},
152
- '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
153
- '.chosen-select-width': {width: "95%"}
154
- }
155
- for (var selectorip in configip) {
156
- $(selectorip).chosen(configip[selectorip]);
 
157
  }
158
 
159
- var configpost = {
160
- '.chosen-select-post': {},
161
- '.chosen-select-deselect': {allow_single_deselect: true},
162
- '.chosen-select-no-single': {disable_search_threshold: 10},
163
- '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
164
- '.chosen-select-width': {width: "95%"}
165
- }
166
- for (var selectorpost in configpost) {
167
- $(selectorpost).chosen(configpost[selectorpost]);
168
- }
169
 
170
- if (postString != '') {
171
- $.each(postString.split(","), function (p, r) {
172
- $("#post_type option[value='" + r + "']").prop("selected", true);
173
- $('#post_type').trigger('chosen:updated');
174
- });
175
- }
 
 
 
 
176
 
177
- if (ipString != '') {
178
- $.each(ipString.split(","), function (i, e) {
179
- $("#ip_address option[value='" + e + "']").prop("selected", true);
180
- $('#ip_address').trigger('chosen:updated');
181
- });
182
- }
183
 
184
- if (userString != '') {
185
- $.each(userString.split(","), function (j, k) {
186
- $("#users_list option[value='" + k + "']").prop("selected", true);
187
- $('#users_list').trigger('chosen:updated');
188
- });
189
- }
 
 
 
 
190
 
 
 
 
 
 
 
 
 
 
 
191
 
192
- $('body').on('keyup', '#ip_address_chosen ul.chosen-choices li.search-field input', function (evt) {
193
- var c = evt.keyCode;
194
-
195
- if (c == 188 || c == 13 || c == 59 || c == 186) {
196
- if (c == 13) {
197
- var ip = $(this).val();
198
- }
199
- if (c == 186) {
200
- var ip = $(this).val().replace(";", "");
201
- }
202
- if (c == 59) {
203
- var ip = $(this).val().replace(";", "");
204
- }
205
- if (c == 188) {
206
- var ip = $(this).val().replace(",", "");
207
- }
208
- var valid = ValidateIPaddress(ip);
209
- if (valid == 'yes') {
210
- $('#ip_address').append('<option value="' + ip + '">' + ip + '</option>');
211
- $("#ip_address option[value='" + ip + "']").prop("selected", true);
212
- $('#ip_address').trigger('chosen:updated');
213
- }
214
- }
215
- });
216
 
217
- //$.getScript('https://www.gstatic.com/charts/loader.js');
218
- //google.charts.load('current', {'packages':['corechart']});
219
 
220
- $('body').on('click', '.page-counter-show', function () {
221
 
222
- });
223
 
224
 
225
- $('body').on('blur', '#ip_address_chosen ul.chosen-choices li.search-field input', function () {
226
- var id = $(this).val().replace(",", "");
227
 
228
- var valid = ValidateIPaddress(id);
 
 
 
 
 
 
 
 
 
 
 
 
 
229
  if (valid == 'yes') {
230
- $('#ip_address').append('<option value="' + id + '">' + id + '</option>');
231
- $("#ip_address option[value='" + id + "']").prop("selected", true);
232
  $('#ip_address').trigger('chosen:updated');
233
  }
234
- });
 
235
 
236
- var ipaddress = [];
237
- var userlist = [];
238
- var postlist = [];
239
- var hidefrontview = '';
240
- var text_color_page_visit = '';
241
- $('body').on('click', "#pvc_reset_settings", function () {
242
- $('#action_which').val('reset');
243
- });
244
 
245
- $('body').on('click', "#pvc_reset_counter", function () {
246
- $('#action_which').val('resetcount');
247
- });
248
- // $('body').on('click',".pagecountsubmit",function() {
249
- //
250
- // if($("#ip_address").val()) {
251
- // ipaddress = $("#ip_address").val();
252
- // } else {
253
- // ipaddress = [];
254
- // }
255
- //
256
- // if($("#users_list").val()) {
257
- // userlist = $("#users_list").val();
258
- // } else {
259
- // userlist = [];
260
- // }
261
- //
262
- // if($("#post_type").val()) {
263
- // postlist = $("#post_type").val();
264
- // } else {
265
- // postlist = [];
266
- // }
267
- // if($('#hide_front_view').attr('checked')) {
268
- // var checked_val = '1';
269
- // } else {
270
- // var checked_val = '0';
271
- // }
272
- //
273
- // if($("#text_color_page_visit").val()) {
274
- // text_color_page_visit = $("#text_color_page_visit").val();
275
- // } else {
276
- // text_color_page_visit = '';
277
- // }
278
- //
279
- // if($("#fb_url_page_visit").val()) {
280
- // fb_url_page_visit = $("#fb_url_page_visit").val();
281
- // } else {
282
- // fb_url_page_visit = '';
283
- // }
284
- //
285
- // if($("#gplus_url_page_visit").val()) {
286
- // gplus_url_page_visit = $("#gplus_url_page_visit").val();
287
- // } else {
288
- // gplus_url_page_visit = '';
289
- // }
290
- //
291
- // if($("#twitter_url_page_visit").val()) {
292
- // twitter_url_page_visit = $("#twitter_url_page_visit").val();
293
- // } else {
294
- // twitter_url_page_visit = '';
295
- // }
296
- //
297
- // $.ajax({
298
- // type: "POST",
299
- // url: pagevisit.ajaxurl,
300
- // async:false,
301
- // data: ({
302
- // action:'add_page_count_option',
303
- // selected_posttype:unique(postlist),
304
- // ipaddress:unique(ipaddress),
305
- // userlist:unique(userlist),
306
- // hidefrontview:checked_val,
307
- // text_color_page_visit:text_color_page_visit,
308
- // twitter_url_page_visit:twitter_url_page_visit,
309
- // gplus_url_page_visit:gplus_url_page_visit,
310
- // fb_url_page_visit:fb_url_page_visit
311
- // }),
312
- // success: function(data) {
313
- // //$("td.record-mesage").empty();
314
- // //$("td.record-mesage").html("<h4 style='color:#075F0E;'>Settings saved Sucessfully.</h4>");
315
- // $("td.record-mesage").css('display','block');
316
- // setInterval(function(){ $("td.record-mesage").fadeOut(); }, 3000);
317
- // }
318
- // });
319
- // });
320
 
321
  });
322
 
323
- $(document).ready(function () {
324
- $('.my-color-field').wpColorPicker();
 
 
 
 
 
 
 
 
325
  });
326
 
327
- function unique(globalarr) {
328
- var result = [];
329
- $.each(globalarr, function (i, e) {
330
- if ($.inArray(e, result) == -1) result.push(e);
331
- });
332
- return result;
333
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
- function ValidateIPaddress(ipaddress) {
336
 
337
- var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
338
- if (ipaddress.match(ipformat)) {
339
- return 'yes';
340
- } else {
341
- return 'no';
342
- }
343
  }
344
- })(jQuery);
 
1
+ (function($) {
2
+ $(window).load(function() {
3
+
4
+ jQuery("#pvcp_dialog").dialog({
5
+ modal: true, title: 'Subscribe Now', zIndex: 10000, autoOpen: true,
6
+ width: '500', resizable: false,
7
+ position: {my: "center", at: "center", of: window},
8
+ dialogClass: 'dialogButtons',
9
+ buttons: {
10
+ Yes: function() {
11
+ // $(obj).removeAttr('onclick');
12
+ // $(obj).parents('.Parent').remove();
13
+ var email_id = jQuery('#txt_user_sub_pvcp').val();
14
+
15
+ var data = {
16
+ 'action': 'add_plugin_user_pvcp',
17
+ 'email_id': email_id
18
+ };
19
+
20
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
21
+ jQuery.post(ajaxurl, data, function(response) {
22
+ jQuery('#pvcp_dialog').html('<h2>You have been successfully subscribed');
23
+ jQuery(".ui-dialog-buttonpane").remove();
24
+ });
25
+
26
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  },
28
+ No: function() {
29
+ var email_id = jQuery('#txt_user_sub_pvcp').val();
30
+
31
+ var data = {
32
+ 'action': 'hide_subscribe_pvcp',
33
+ 'email_id': email_id
34
+ };
35
+
36
+ // since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
37
+ jQuery.post(ajaxurl, data, function(response) {
38
+
39
+ });
40
+
41
+ jQuery(this).dialog("close");
42
+
43
  }
44
+ },
45
+ close: function(event, ui) {
46
+ jQuery(this).remove();
47
+ }
48
+ });
49
+ jQuery("div.dialogButtons .ui-dialog-buttonset button").removeClass('ui-state-default');
50
+ jQuery("div.dialogButtons .ui-dialog-buttonset button").addClass("button-primary woocommerce-save-button");
51
+ jQuery("div.dialogButtons .ui-dialog-buttonpane .ui-button").css("width", "80px");
52
 
53
 
54
+ $('#MyDate').datepicker({dateFormat: 'yy-mm-dd'});
55
+ $('#example').DataTable({
56
+ "iDisplayLength": 10,
57
+ "sPaginationType": "full_numbers",
58
+ "oLanguage": {"sEmptyTable": "No Page Found."}
59
+ });
60
+ $('#example_filter').css("display", "none");
61
+ $('#example_length').css("display", "none");
62
+
63
+
64
+ $('body').on('click', "#search-submit", function() {
65
+
66
+ var pagename = $("#page-search-text").val();
67
+ var pagedate = $(".pagedateselect").val();
68
+ $.ajax({
69
+ type: "POST",
70
+ url: pagevisit.ajaxurl,
71
+ async: false,
72
+ data: ({
73
+ action: 'select_input_page_value',
74
+ page_name: pagename,
75
+ page_date: pagedate
76
+ }),
77
+ success: function(data) {
78
+ $(".page-visit-summery").empty();
79
+ $(".page-visit-summery").append(data);
80
+ $('#example').DataTable({
81
+ "iDisplayLength": 10,
82
+ "sPaginationType": "full_numbers",
83
+ "oLanguage": {"sEmptyTable": "No Page Found."}
84
+ });
85
+ $('#example_filter').css("display", "none");
86
+ $('#example_length').css("display", "none");
87
+ }
88
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
90
+ });
91
 
92
+ $("#ui-datepicker-div").css("display", "none");
93
 
94
+ var get_post_option_data = get_post_option.optionsarray;
95
+ if (get_post_option_data != '') {
96
  var selectedPostArray = JSON.parse(get_post_option.optionsarray);
97
  var selectedPostglobalarr = [];
98
  for (var p in selectedPostArray) {
99
  selectedPostglobalarr.push(selectedPostArray[p]);
100
  }
101
 
102
+ var postString = '';
103
+ postString = selectedPostglobalarr.join(",");
104
+
105
+
106
+ if (postString != '') {
107
+ $.each(postString.split(","), function(p, r) {
108
+ $("#post_type option[value='" + r + "']").prop("selected", true);
109
+ $('#post_type').trigger('chosen:updated');
110
+ });
111
+ }
112
+ }
113
+ var get_user_option_data = get_user_option.usersarray;
114
+ if (get_user_option_data != '') {
115
  var selecteduserArray = JSON.parse(get_user_option.usersarray);
116
  var selectedUserglobalarr = [];
117
  for (var u in selecteduserArray) {
118
  selectedUserglobalarr.push(selecteduserArray[u]);
119
  }
120
 
121
+ var userString = '';
122
+ userString = selectedUserglobalarr.join(",");
123
+
124
+ if (userString != '') {
125
+ $.each(userString.split(","), function(j, k) {
126
+ $("#users_list option[value='" + k + "']").prop("selected", true);
127
+ $('#users_list').trigger('chosen:updated');
128
+ });
129
+ }
130
+ }
131
+ var get_ip_option_data = get_ip_option.ipaddressarray;
132
+ if (get_ip_option_data != '') {
133
  var selectedIpArray = JSON.parse(get_ip_option.ipaddressarray);
134
  var selectedIpglobalarr = [];
135
  for (var i in selectedIpArray) {
136
  selectedIpglobalarr.push(selectedIpArray[i]);
137
  }
138
 
 
 
 
139
  var ipString = '';
140
  ipString = selectedIpglobalarr.join(",");
141
 
142
+ if (ipString != '') {
143
+ $.each(ipString.split(","), function(i, e) {
144
+ $("#ip_address option[value='" + e + "']").prop("selected", true);
145
+ $('#ip_address').trigger('chosen:updated');
146
+ });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  }
148
+ }
149
 
150
 
151
+ $('body').on('change', '.posttype', function() {
152
+ var page_id = this.id
153
+ if ($('#' + page_id).is(":checked")) {
154
+ selectedPostglobalarr.push(page_id);
155
+ } else {
156
+ selectedPostglobalarr.indexOf(page_id);
157
+ var index = selectedPostglobalarr.indexOf(page_id);
158
+ if (index > -1) {
159
+ selectedPostglobalarr.splice(index, 1);
160
+ }
161
  }
162
 
163
+ });
 
 
 
 
 
 
 
 
 
164
 
165
+ var config = {
166
+ '.chosen-select': {},
167
+ '.chosen-select-deselect': {allow_single_deselect: true},
168
+ '.chosen-select-no-single': {disable_search_threshold: 10},
169
+ '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
170
+ '.chosen-select-width': {width: "95%"}
171
+ }
172
+ for (var selector in config) {
173
+ $(selector).chosen(config[selector]);
174
+ }
175
 
 
 
 
 
 
 
176
 
177
+ var configip = {
178
+ '.chosen-select-ip': {},
179
+ '.chosen-select-deselect': {allow_single_deselect: true},
180
+ '.chosen-select-no-single': {disable_search_threshold: 10},
181
+ '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
182
+ '.chosen-select-width': {width: "95%"}
183
+ }
184
+ for (var selectorip in configip) {
185
+ $(selectorip).chosen(configip[selectorip]);
186
+ }
187
 
188
+ var configpost = {
189
+ '.chosen-select-post': {},
190
+ '.chosen-select-deselect': {allow_single_deselect: true},
191
+ '.chosen-select-no-single': {disable_search_threshold: 10},
192
+ '.chosen-select-no-results': {no_results_text: 'Oops, nothing found!'},
193
+ '.chosen-select-width': {width: "95%"}
194
+ }
195
+ for (var selectorpost in configpost) {
196
+ $(selectorpost).chosen(configpost[selectorpost]);
197
+ }
198
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
199
 
 
 
200
 
 
201
 
 
202
 
203
 
204
+ $('body').on('keyup', '#ip_address_chosen ul.chosen-choices li.search-field input', function(evt) {
205
+ var c = evt.keyCode;
206
 
207
+ if (c == 188 || c == 13 || c == 59 || c == 186) {
208
+ if (c == 13) {
209
+ var ip = $(this).val();
210
+ }
211
+ if (c == 186) {
212
+ var ip = $(this).val().replace(";", "");
213
+ }
214
+ if (c == 59) {
215
+ var ip = $(this).val().replace(";", "");
216
+ }
217
+ if (c == 188) {
218
+ var ip = $(this).val().replace(",", "");
219
+ }
220
+ var valid = ValidateIPaddress(ip);
221
  if (valid == 'yes') {
222
+ $('#ip_address').append('<option value="' + ip + '">' + ip + '</option>');
223
+ $("#ip_address option[value='" + ip + "']").prop("selected", true);
224
  $('#ip_address').trigger('chosen:updated');
225
  }
226
+ }
227
+ });
228
 
229
+ //$.getScript('https://www.gstatic.com/charts/loader.js');
230
+ //google.charts.load('current', {'packages':['corechart']});
 
 
 
 
 
 
231
 
232
+ $('body').on('click', '.page-counter-show', function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
  });
235
 
236
+
237
+ $('body').on('blur', '#ip_address_chosen ul.chosen-choices li.search-field input', function() {
238
+ var id = $(this).val().replace(",", "");
239
+
240
+ var valid = ValidateIPaddress(id);
241
+ if (valid == 'yes') {
242
+ $('#ip_address').append('<option value="' + id + '">' + id + '</option>');
243
+ $("#ip_address option[value='" + id + "']").prop("selected", true);
244
+ $('#ip_address').trigger('chosen:updated');
245
+ }
246
  });
247
 
248
+ var ipaddress = [];
249
+ var userlist = [];
250
+ var postlist = [];
251
+ var hidefrontview = '';
252
+ var text_color_page_visit = '';
253
+ $('body').on('click', "#pvc_reset_settings", function() {
254
+ $('#action_which').val('reset');
255
+ });
256
+
257
+ $('body').on('click', "#pvc_reset_counter", function() {
258
+ $('#action_which').val('resetcount');
259
+ });
260
+ // $('body').on('click',".pagecountsubmit",function() {
261
+ //
262
+ // if($("#ip_address").val()) {
263
+ // ipaddress = $("#ip_address").val();
264
+ // } else {
265
+ // ipaddress = [];
266
+ // }
267
+ //
268
+ // if($("#users_list").val()) {
269
+ // userlist = $("#users_list").val();
270
+ // } else {
271
+ // userlist = [];
272
+ // }
273
+ //
274
+ // if($("#post_type").val()) {
275
+ // postlist = $("#post_type").val();
276
+ // } else {
277
+ // postlist = [];
278
+ // }
279
+ // if($('#hide_front_view').attr('checked')) {
280
+ // var checked_val = '1';
281
+ // } else {
282
+ // var checked_val = '0';
283
+ // }
284
+ //
285
+ // if($("#text_color_page_visit").val()) {
286
+ // text_color_page_visit = $("#text_color_page_visit").val();
287
+ // } else {
288
+ // text_color_page_visit = '';
289
+ // }
290
+ //
291
+ // if($("#fb_url_page_visit").val()) {
292
+ // fb_url_page_visit = $("#fb_url_page_visit").val();
293
+ // } else {
294
+ // fb_url_page_visit = '';
295
+ // }
296
+ //
297
+ // if($("#gplus_url_page_visit").val()) {
298
+ // gplus_url_page_visit = $("#gplus_url_page_visit").val();
299
+ // } else {
300
+ // gplus_url_page_visit = '';
301
+ // }
302
+ //
303
+ // if($("#twitter_url_page_visit").val()) {
304
+ // twitter_url_page_visit = $("#twitter_url_page_visit").val();
305
+ // } else {
306
+ // twitter_url_page_visit = '';
307
+ // }
308
+ //
309
+ // $.ajax({
310
+ // type: "POST",
311
+ // url: pagevisit.ajaxurl,
312
+ // async:false,
313
+ // data: ({
314
+ // action:'add_page_count_option',
315
+ // selected_posttype:unique(postlist),
316
+ // ipaddress:unique(ipaddress),
317
+ // userlist:unique(userlist),
318
+ // hidefrontview:checked_val,
319
+ // text_color_page_visit:text_color_page_visit,
320
+ // twitter_url_page_visit:twitter_url_page_visit,
321
+ // gplus_url_page_visit:gplus_url_page_visit,
322
+ // fb_url_page_visit:fb_url_page_visit
323
+ // }),
324
+ // success: function(data) {
325
+ // //$("td.record-mesage").empty();
326
+ // //$("td.record-mesage").html("<h4 style='color:#075F0E;'>Settings saved Sucessfully.</h4>");
327
+ // $("td.record-mesage").css('display','block');
328
+ // setInterval(function(){ $("td.record-mesage").fadeOut(); }, 3000);
329
+ // }
330
+ // });
331
+ // });
332
+
333
+ });
334
+
335
+ $(document).ready(function() {
336
+ $('.my-color-field').wpColorPicker();
337
+ });
338
+
339
+ function unique(globalarr) {
340
+ var result = [];
341
+ $.each(globalarr, function(i, e) {
342
+ if ($.inArray(e, result) == -1)
343
+ result.push(e);
344
+ });
345
+ return result;
346
+ }
347
 
348
+ function ValidateIPaddress(ipaddress) {
349
 
350
+ var ipformat = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
351
+ if (ipaddress.match(ipformat)) {
352
+ return 'yes';
353
+ } else {
354
+ return 'no';
 
355
  }
356
+ }
357
+ })(jQuery);
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.4
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.
7
  * Plugin URI: http://www.multidots.com/
8
  * Description: This plugin will count the total visits of your sites pages.
9
  * Author: Multidots
10
+ * Version: 4.0.5
11
  * Author URI: http://www.multidots.com/
12
  */
13
  // If this file is called directly, abort.