Version Description
- 19-06-2017 =
- Removed Total visit on share post title.
- Compatible with WordPress Version 4.87
Download this release
Release Info
Developer | dots |
Plugin | Page Visit Counter |
Version | 4.0.4 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.4
- README.txt +19 -13
- admin/class-page-visit-counter-admin.php +1452 -1340
- admin/js/custom.js +344 -338
- includes/class-page-visit-counter.php +2 -4
- page_visit_counter.php +1 -1
- public/class-page-visit-counter-public.php +1 -41
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
|
7 |
-
Stable tag: 4.0.
|
8 |
Tags: page counter,page visit, post counter, post visit, wordpress post view, wordpress page view, page visit graph, post visit graph,
|
9 |
Requires at least: 2.1
|
10 |
-
Tested up to: 4.
|
11 |
Donate link:
|
12 |
Copyright: (c) 2014-2016 Multidots Solutions PVT LTD (info@multidots.com)
|
13 |
License: GPLv3 or later
|
@@ -58,17 +58,19 @@ We always welcome user suggestions. Let us know what you think about this plugin
|
|
58 |
|
59 |
= You can check our other plugins: =
|
60 |
|
61 |
-
1. <a href ="
|
62 |
-
2. <a href ="
|
63 |
-
3. <a href ="https://store.multidots.com/go/
|
64 |
-
4. <a href ="https://store.multidots.com/go/dotstore-
|
65 |
-
5. <a href ="https://store.multidots.com/go/dotstore-
|
66 |
-
6. <a href ="https://store.multidots.com/go/dotstore-woo-
|
67 |
-
7. <a href ="https://store.multidots.com/go/dotstore-
|
68 |
-
8. <a href ="https://store.multidots.com/go/dotstore-woo-
|
69 |
-
9. <a href ="https://store.multidots.com/go/
|
70 |
-
10. <a href ="https://store.multidots.com/go/
|
71 |
-
11. <a href ="https://store.multidots.com/go/
|
|
|
|
|
72 |
|
73 |
== Installation ==
|
74 |
|
@@ -113,6 +115,10 @@ Automatic updates should work great for you. As always, though, we recommend ba
|
|
113 |
|
114 |
== Changelog ==
|
115 |
|
|
|
|
|
|
|
|
|
116 |
= 4.0.3 - 24-12-2016 =
|
117 |
* Fixies - Fixed the shortcode issues.
|
118 |
* Compatible with WordPress Version 4.7
|
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
|
58 |
|
59 |
= You can check our other plugins: =
|
60 |
|
61 |
+
1. <a href ="http://bit.ly/2FrC4id">Emporos - Responsive WooCommerce Theme</a>
|
62 |
+
2. <a href ="http://bit.ly/2kq5Tqt">Onepage Studio - Multipurpose Landing Page with Page Builder</a>
|
63 |
+
3. <a href ="https://store.multidots.com/go/flat-rate">Advance Flat Rate Shipping Method For WooCommerce</a>
|
64 |
+
4. <a href ="https://store.multidots.com/go/dotstore-woocommerce-blocker">WooCommerce Blocker - Prevent Fake Orders And Blacklist Fraud Customers</a>
|
65 |
+
5. <a href ="https://store.multidots.com/go/dotstore-enhanced-ecommerce-tracking">WooCommerce Enhanced Ecommerce Analytics Integration With Conversion Tracking</a>
|
66 |
+
6. <a href ="https://store.multidots.com/go/dotstore-woo-category-banner">Woocommerce Category Banner Management</a>
|
67 |
+
7. <a href ="https://store.multidots.com/go/dotstore-woo-extra-fees">Woocommerce Conditional Extra Fees</a>
|
68 |
+
8. <a href ="https://store.multidots.com/go/dotstore-woo-product-sizechart">Woocommerce Advanced Product Size Charts</a>
|
69 |
+
9. <a href ="https://store.multidots.com/go/dotstore-admenumanager-wp">Advance Menu Manager for WordPress</a>
|
70 |
+
10. <a href ="https://store.multidots.com/go/dotstore-woo-savefor-later">Woocommerce Save For Later Cart Enhancement</a>
|
71 |
+
11. <a href ="https://store.multidots.com/go/brandagency">Brand Agency- One Page HTML Template For Agency,Startup And Business</a>
|
72 |
+
12. <a href ="https://store.multidots.com/go/Meraki">Meraki One Page HTML Resume Template</a>
|
73 |
+
13. <a href ="https://store.multidots.com/go/dotstore-aapify-theme">Appify - Multipurpose One Page Mobile App landing page HTML</a>
|
74 |
|
75 |
== Installation ==
|
76 |
|
115 |
|
116 |
== Changelog ==
|
117 |
|
118 |
+
= 4.0.4 - 19-06-2017 =
|
119 |
+
* Removed Total visit on share post title.
|
120 |
+
* Compatible with WordPress Version 4.87
|
121 |
+
|
122 |
= 4.0.3 - 24-12-2016 =
|
123 |
* Fixies - Fixed the shortcode issues.
|
124 |
* Compatible with WordPress Version 4.7
|
admin/class-page-visit-counter-admin.php
CHANGED
@@ -26,7 +26,7 @@ class page_visit_counter_Admin {
|
|
26 |
*
|
27 |
* @since 1.0.0
|
28 |
* @access private
|
29 |
-
* @var string
|
30 |
*/
|
31 |
private $plugin_name;
|
32 |
|
@@ -35,7 +35,7 @@ class page_visit_counter_Admin {
|
|
35 |
*
|
36 |
* @since 1.0.0
|
37 |
* @access private
|
38 |
-
* @var string
|
39 |
*/
|
40 |
private $version;
|
41 |
|
@@ -43,13 +43,14 @@ class page_visit_counter_Admin {
|
|
43 |
* Initialize the class and set its properties.
|
44 |
*
|
45 |
* @since 1.0.0
|
46 |
-
*
|
47 |
-
* @param string
|
|
|
48 |
*/
|
49 |
public function __construct( $plugin_name, $version ) {
|
50 |
|
51 |
$this->plugin_name = $plugin_name;
|
52 |
-
$this->version
|
53 |
|
54 |
}
|
55 |
|
@@ -60,7 +61,7 @@ class page_visit_counter_Admin {
|
|
60 |
*/
|
61 |
|
62 |
public function enqueue_styles() {
|
63 |
-
|
64 |
/**
|
65 |
* This function is provided for demonstration purposes only.
|
66 |
*
|
@@ -72,27 +73,27 @@ class page_visit_counter_Admin {
|
|
72 |
* between the defined hooks and the functions defined in this
|
73 |
* class.
|
74 |
*/
|
75 |
-
|
76 |
//wp_enqueue_style("jquery-ui-tabs");
|
77 |
-
|
78 |
-
wp_enqueue_style('custom-style', plugin_dir_url( __FILE__ ) . 'css/style.css');
|
79 |
-
wp_enqueue_style('datatable-style', plugin_dir_url( __FILE__ ) . 'css/jquery.dataTables.css');
|
80 |
-
wp_enqueue_style('jquery-style', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.css');
|
81 |
-
wp_enqueue_style('chosen-style', plugin_dir_url( __FILE__ ) . 'css/chosen.css');
|
82 |
//wp_enqueue_style('fancy-box-style', plugin_dir_url( __FILE__ ) . 'css/jquery.fancybox-1.3.4.css');
|
83 |
-
wp_enqueue_style('color-box-style', plugin_dir_url( __FILE__ ) . 'css/colorbox.css');
|
84 |
//wp_enqueue_style('color-picker', plugin_dir_url( __FILE__ ) . 'css/color-picker.min.css');
|
85 |
wp_enqueue_style( 'wp-color-picker' );
|
86 |
wp_enqueue_style( 'wp-pointer' );
|
87 |
}
|
88 |
-
|
89 |
/**
|
90 |
* Register the JavaScript for the admin area.
|
91 |
*
|
92 |
* @since 1.0.0
|
93 |
*/
|
94 |
public function enqueue_scripts() {
|
95 |
-
|
96 |
/**
|
97 |
* This function is provided for demonstration purposes only.
|
98 |
*
|
@@ -104,902 +105,1001 @@ class page_visit_counter_Admin {
|
|
104 |
* between the defined hooks and the functions defined in this
|
105 |
* class.
|
106 |
*/
|
107 |
-
|
108 |
-
wp_enqueue_script('jquery-ui-core');
|
109 |
-
wp_enqueue_script('jquery-ui-tabs');
|
110 |
-
wp_enqueue_script('jquery-ui-datepicker');
|
111 |
//wp_deregister_style( 'wp-jquery-ui-dialog' );
|
112 |
//wp_enqueue_script( 'wp-jquery-ui-dialog' );
|
113 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
114 |
-
|
115 |
//enqueue script for notice pointer
|
116 |
wp_enqueue_script( 'wp-pointer' );
|
117 |
-
|
118 |
-
if (!empty($_GET['page']) && $_GET['page'] != '' && $_GET['page'] == '
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/jquery.dataTables.min.js', array( 'jquery' ), $this->version, false );
|
125 |
|
126 |
//wp_enqueue_script('google-chart', 'https://www.gstatic.com/charts/loader.js', array( 'jquery' ), $this->version);
|
127 |
-
|
128 |
-
wp_enqueue_script('chosen-jquery', plugin_dir_url( __FILE__ ) . 'js/chosen.jquery.js', array( 'jquery' ), $this->version, false );
|
129 |
-
wp_enqueue_script('chosen-proto', plugin_dir_url( __FILE__ ) . 'js/chosen.proto.js', array( 'jquery' ), $this->version, false );
|
130 |
-
wp_enqueue_script('color-box', plugin_dir_url( __FILE__ ) . 'js/jquery.colorbox.js', array( 'jquery' ), $this->version, false );
|
131 |
-
|
132 |
-
wp_enqueue_script('iris', admin_url('js/iris.min.js'),array(
|
133 |
-
|
134 |
-
|
135 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n );
|
137 |
-
|
138 |
-
wp_localize_script( 'one', 'pagevisit', array('ajaxurl' => admin_url( 'admin-ajax.php')));
|
139 |
-
|
140 |
-
$fetchSelecetedPostTypes = get_option('wfap_post_type');
|
141 |
-
$options
|
142 |
-
wp_localize_script( 'one', 'get_post_option', array('optionsarray' => $options));
|
143 |
-
|
144 |
-
$fetchSelecetedIpAddress = get_option('ipaddress_visit');
|
145 |
-
$optionsIpAddress
|
146 |
-
wp_localize_script( 'one', 'get_ip_option', array('ipaddressarray' => $optionsIpAddress));
|
147 |
-
|
148 |
-
$fetchSelecetedUserId = get_option('userlist_visit');
|
149 |
-
$optionsUserId
|
150 |
-
wp_localize_script( 'one', 'get_user_option', array('usersarray' => $optionsUserId));
|
151 |
-
|
152 |
}
|
153 |
-
|
154 |
-
|
155 |
public function welcome_page_visit_counter_screen_do_activation_redirect() {
|
156 |
// if no activation redirect
|
157 |
-
if (!get_transient('_welcome_screen_page_visitor_activation_redirect_data')) {
|
158 |
return;
|
159 |
}
|
160 |
|
161 |
// Delete the redirect transient
|
162 |
-
delete_transient('_welcome_screen_page_visitor_activation_redirect_data');
|
163 |
|
164 |
// if activating from network, or bulk
|
165 |
-
if (is_network_admin() || isset($_GET['activate-multi'])) {
|
166 |
return;
|
167 |
}
|
168 |
// Redirect to extra cost welcome page
|
169 |
-
wp_safe_redirect(add_query_arg(array('page' => 'page-visit-counter-about&tab=about'), admin_url('index.php')));
|
170 |
}
|
171 |
-
|
172 |
public function welcome_pages_screen_page_visit_counter() {
|
173 |
add_dashboard_page(
|
174 |
-
|
|
|
|
|
|
|
175 |
);
|
176 |
}
|
177 |
-
|
178 |
public function admin_css() {
|
179 |
-
wp_enqueue_style($this->plugin_name . 'welcome-page', plugin_dir_url(__FILE__) . 'css/style.css', array(), $this->version, 'all');
|
180 |
}
|
181 |
-
|
182 |
public function welcome_screen_content_page_visit_counter() {
|
183 |
-
|
184 |
<div class="wrap about-wrap">
|
185 |
-
<h1 style="font-size: 2.1em;"><?php printf(__('Welcome to Page Visit Counter', 'page-visit-counter')); ?></h1>
|
186 |
|
187 |
<div class="about-text woocommerce-about-text">
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
<img class="version_logo_img"
|
|
|
193 |
</div>
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
|
|
|
|
|
|
200 |
<h2 id="woo-extra-cost-tab-wrapper" class="nav-tab-wrapper">
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
|
|
205 |
</h2>
|
206 |
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
<hr
|
217 |
<div class="return-to-dashboard">
|
218 |
-
<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>
|
219 |
</div>
|
220 |
</div>
|
221 |
-
|
222 |
}
|
223 |
-
|
224 |
/**
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
public function page_visit_counter_about() {
|
229 |
//do_action('my_own');
|
230 |
$current_user = wp_get_current_user();
|
231 |
|
232 |
-
|
233 |
<div class="changelog">
|
234 |
-
|
235 |
</br>
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
<div class="changelog about-integrations">
|
240 |
<div class="wc-feature feature-section col three-col">
|
241 |
<div>
|
242 |
-
<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>
|
243 |
-
<p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
|
244 |
<div class="Page_Counter_Settings_Content_ul">
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
</div>
|
255 |
-
|
256 |
-
<p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
|
257 |
-
|
258 |
-
<p class="page_visit_overview">In this option you can see all pages listing within Page ID, Page
|
259 |
-
|
|
|
|
|
|
|
|
|
260 |
<div class="Page_Counter_Settings_Content_ul">
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
266 |
</div>
|
267 |
-
|
268 |
-
|
269 |
</div>
|
270 |
-
|
271 |
</div>
|
272 |
</div>
|
273 |
</div>
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
?>
|
279 |
-
|
280 |
-
|
281 |
-
<script type="text/javascript">
|
282 |
-
|
283 |
-
jQuery( document ).ready(function() {
|
284 |
-
jQuery( "#pvcp_dialog" ).dialog({
|
285 |
-
modal: true, title: 'Subscribe Now', zIndex: 10000, autoOpen: true,
|
286 |
-
width: '500', resizable: false,
|
287 |
-
position: {my: "center", at:"center", of: window },
|
288 |
-
dialogClass: 'dialogButtons',
|
289 |
-
buttons: {
|
290 |
-
Yes: function () {
|
291 |
-
// $(obj).removeAttr('onclick');
|
292 |
-
// $(obj).parents('.Parent').remove();
|
293 |
-
var email_id = jQuery('#txt_user_sub_pvcp').val();
|
294 |
-
var data = {
|
295 |
-
'action': 'add_plugin_user_pvcp',
|
296 |
-
'email_id': email_id
|
297 |
-
};
|
298 |
-
|
299 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
300 |
-
jQuery.post(ajaxurl, data, function(response) {
|
301 |
-
jQuery('#pvcp_dialog').html('<h2>You have been successfully subscribed');
|
302 |
-
jQuery(".ui-dialog-buttonpane").remove();
|
303 |
-
});
|
304 |
-
|
305 |
-
|
306 |
-
},
|
307 |
-
No: function () {
|
308 |
-
var email_id = jQuery('#txt_user_sub_pvcp').val();
|
309 |
-
|
310 |
-
var data = {
|
311 |
-
'action': 'hide_subscribe_pvcpfn',
|
312 |
-
'email_id': email_id
|
313 |
-
};
|
314 |
-
|
315 |
-
// since 2.8 ajaxurl is always defined in the admin header and points to admin-ajax.php
|
316 |
-
jQuery.post(ajaxurl, data, function(response) {
|
317 |
-
|
318 |
-
});
|
319 |
-
|
320 |
-
jQuery(this).dialog("close");
|
321 |
-
|
322 |
-
}
|
323 |
-
},
|
324 |
-
close: function (event, ui) {
|
325 |
-
jQuery(this).remove();
|
326 |
-
}
|
327 |
-
});
|
328 |
-
jQuery("div.dialogButtons .ui-dialog-buttonset button").addClass("button-primary woocommerce-save-button");
|
329 |
-
jQuery("div.dialogButtons .ui-dialog-buttonpane .ui-button").css("width","80px");
|
330 |
-
});
|
331 |
-
</script>
|
332 |
-
<?php
|
333 |
-
|
334 |
-
}
|
335 |
}
|
336 |
|
337 |
/**
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
public function page_visit_counter_other_plugins() {
|
342 |
global $wpdb;
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
$
|
356 |
-
|
|
|
|
|
357 |
$paid_arr = array();
|
358 |
?>
|
359 |
|
360 |
<div class="plug-containter">
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
396 |
</div>
|
397 |
|
398 |
-
|
399 |
}
|
400 |
|
401 |
/**
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
public function welcome_screen_remove_menus() {
|
406 |
-
remove_submenu_page('index.php', 'page-visit-counter-about');
|
407 |
}
|
408 |
-
|
409 |
/**
|
410 |
* admin menu page fnction
|
411 |
* add menu in admin menubar.
|
412 |
*
|
413 |
*/
|
414 |
public function page_visit_counter_menu() {
|
415 |
-
add_menu_page( __('Page-Visit-Counter','page-visit-counter'),__('PageVisitCounter','page-visit-counter'), 'manage_options','page_visit_counter', 'extra_page_visit_function_custom',plugins_url('page-visit-counter/admin/images/icon.png'));
|
416 |
-
add_submenu_page('page_visit_counter',__('Counter-Settings','page-visit-counter'),__('Settings','page-visit-counter'),'manage_options','page_visit_settings','custom_page_visit_settings');
|
417 |
/**
|
418 |
* extra_page_visit_function_custom use the menu callback function
|
419 |
* $name pass the arguments
|
420 |
*/
|
421 |
-
function extra_page_visit_function_custom($name) {
|
422 |
global $wpdb;
|
423 |
-
|
424 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
425 |
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
426 |
}
|
427 |
-
|
428 |
require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-tt-pvc-list-table.php';
|
429 |
-
|
430 |
// Create an instance of our package class.
|
431 |
$test_list_table = new TT_Example_List_Table();
|
432 |
// Fetch, prepare, sort, and filter our data.
|
433 |
$test_list_table->prepare_items();
|
434 |
-
|
435 |
-
$table_name = $wpdb->prefix."page_visit";
|
436 |
?>
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
<?php
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
-
|
561 |
-
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
585 |
-
|
586 |
-
|
587 |
-
|
588 |
-
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
|
598 |
-
|
599 |
-
|
600 |
-
|
601 |
-
|
602 |
-
|
603 |
-
|
604 |
-
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
655 |
-
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
-
|
660 |
-
|
661 |
-
|
662 |
-
|
663 |
-
|
664 |
-
|
665 |
-
|
666 |
-
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
-
|
675 |
-
|
676 |
-
|
677 |
-
|
678 |
-
|
679 |
-
|
680 |
-
|
681 |
-
|
682 |
-
|
683 |
-
|
684 |
-
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
694 |
-
|
695 |
-
|
696 |
-
|
697 |
-
|
698 |
-
|
699 |
-
|
700 |
-
|
701 |
-
|
702 |
-
|
703 |
-
|
704 |
-
|
705 |
-
|
706 |
-
|
707 |
-
|
708 |
-
|
709 |
-
|
710 |
-
|
711 |
-
|
712 |
-
|
713 |
-
|
714 |
-
|
715 |
-
|
716 |
-
|
717 |
-
|
718 |
-
|
719 |
-
|
720 |
-
|
721 |
-
|
722 |
-
|
723 |
-
|
724 |
-
|
725 |
-
|
726 |
-
|
727 |
-
|
728 |
-
|
729 |
-
|
730 |
-
|
731 |
-
|
732 |
-
|
733 |
-
|
734 |
-
|
735 |
-
|
736 |
-
|
737 |
-
|
738 |
-
|
739 |
-
|
740 |
-
|
741 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
// setTimeout(function(){
|
743 |
// jQuery('body #ui-id-1').trigger('click');
|
744 |
// },500);
|
745 |
-
|
746 |
-
|
747 |
-
|
748 |
-
|
749 |
-
|
750 |
-
|
751 |
-
|
752 |
-
|
753 |
-
|
754 |
-
|
755 |
-
|
756 |
-
|
757 |
-
|
758 |
-
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
|
763 |
-
|
764 |
-
|
765 |
-
|
766 |
-
|
767 |
-
|
768 |
-
|
769 |
-
|
770 |
-
|
771 |
-
|
772 |
-
|
773 |
-
|
774 |
-
|
775 |
-
<form id="movies-filter" method="get">
|
776 |
-
<?php
|
777 |
-
$test_list_table->search_box( __( 'Search' ), 'page-visit-counter' );
|
778 |
-
foreach ($_GET as $key => $value) { // http://stackoverflow.com/a/8763624/1287812
|
779 |
-
if( 's' !== $key ) // don't include the search query
|
780 |
-
echo("<input type='hidden' name='$key' value='$value' />");
|
781 |
-
}
|
782 |
-
$test_list_table->display();
|
783 |
-
?>
|
784 |
-
</form>
|
785 |
-
|
786 |
-
<!-- Twitter -->
|
787 |
-
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
788 |
-
|
789 |
-
<!-- Facebook -->
|
790 |
-
<script>(function(d, s, id) {
|
791 |
-
var js, fjs = d.getElementsByTagName(s)[0];
|
792 |
-
if (d.getElementById(id)) return;
|
793 |
-
js = d.createElement(s); js.id = id;
|
794 |
-
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
|
795 |
-
fjs.parentNode.insertBefore(js, fjs);
|
796 |
-
}(document, 'script', 'facebook-jssdk'));</script>
|
797 |
-
|
798 |
-
<!-- Google+ -->
|
799 |
-
<script type="text/javascript">
|
800 |
-
(function() {
|
801 |
-
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
802 |
-
po.src = 'https://apis.google.com/js/platform.js';
|
803 |
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
804 |
-
})();
|
805 |
-
</script>
|
806 |
-
|
807 |
<?php
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
812 |
<?php
|
813 |
}
|
|
|
814 |
/**
|
815 |
* function use to page settings
|
816 |
* $args is pass the arguments
|
817 |
*/
|
818 |
function custom_page_visit_settings( $args ) {
|
819 |
-
|
820 |
global $wpdb;
|
821 |
$current_user = wp_get_current_user();
|
822 |
// Get all the registered post type
|
823 |
$post_types = get_post_types();
|
824 |
-
|
825 |
// Get all the post type selected in settings page
|
826 |
$post_list = array();
|
827 |
-
$post
|
828 |
-
$post_list
|
829 |
-
|
830 |
-
$text_color_page_visit = get_option('text_color_page_visit');
|
831 |
-
if (isset($text_color_page_visit) && $text_color_page_visit != null) {
|
832 |
$text_color_page_visit = $text_color_page_visit;
|
833 |
} else {
|
834 |
$text_color_page_visit = '#000000';
|
835 |
}
|
836 |
-
|
837 |
-
if (!get_option('pvcp_plugin_notice_shown')) {
|
838 |
-
|
839 |
}
|
840 |
-
|
841 |
?>
|
842 |
-
|
843 |
-
|
844 |
-
|
845 |
-
|
846 |
-
|
847 |
-
|
848 |
-
|
849 |
-
|
850 |
-
|
851 |
-
|
852 |
-
|
853 |
-
|
854 |
-
|
855 |
-
|
856 |
-
|
857 |
-
|
858 |
-
|
859 |
-
|
860 |
-
|
861 |
-
|
862 |
-
|
863 |
-
|
864 |
-
|
865 |
-
|
866 |
-
|
867 |
-
|
868 |
-
|
869 |
-
|
870 |
-
|
871 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
872 |
<?php
|
873 |
-
$get_option_value = json_decode(get_option( 'page_count_settings' ));
|
874 |
-
$input_values
|
875 |
-
$select_values
|
876 |
?>
|
877 |
-
|
878 |
-
|
879 |
-
|
880 |
-
|
881 |
-
|
882 |
-
|
883 |
-
|
884 |
-
|
885 |
-
|
886 |
-
|
887 |
-
|
888 |
-
|
|
|
|
|
|
|
|
|
|
|
889 |
}
|
890 |
-
|
891 |
-
|
892 |
-
|
893 |
-
|
894 |
-
|
895 |
-
|
896 |
-
|
897 |
-
|
898 |
-
|
899 |
-
|
900 |
-
|
901 |
-
|
902 |
-
|
903 |
-
|
904 |
-
|
905 |
-
|
906 |
-
|
907 |
-
|
908 |
-
|
909 |
-
|
910 |
-
|
911 |
-
|
912 |
-
|
913 |
-
|
914 |
-
|
915 |
-
|
916 |
-
|
917 |
-
|
918 |
-
|
919 |
-
|
920 |
-
|
921 |
-
|
922 |
-
|
923 |
-
|
924 |
-
|
925 |
-
|
926 |
-
|
927 |
-
|
928 |
-
|
929 |
-
|
930 |
-
|
931 |
-
|
932 |
-
|
933 |
-
|
934 |
-
|
935 |
-
|
936 |
-
|
937 |
-
|
938 |
-
|
939 |
-
|
940 |
-
|
941 |
-
|
942 |
-
|
943 |
-
|
944 |
-
|
945 |
-
|
946 |
-
|
947 |
-
|
948 |
-
|
949 |
-
|
950 |
-
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
-
|
959 |
-
|
960 |
-
|
961 |
-
|
962 |
-
|
963 |
-
|
964 |
-
|
965 |
-
|
966 |
-
|
967 |
-
|
968 |
-
|
969 |
-
|
970 |
-
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
975 |
<?php
|
976 |
-
}
|
977 |
}
|
978 |
-
|
979 |
-
|
980 |
-
public function wp_add_plugin_userfn() {
|
981 |
-
|
982 |
-
|
983 |
-
|
984 |
-
|
985 |
-
|
986 |
-
|
987 |
-
|
988 |
-
|
989 |
-
|
990 |
-
|
991 |
-
|
992 |
-
|
993 |
-
|
994 |
-
|
995 |
-
|
996 |
-
|
997 |
-
|
998 |
-
|
999 |
-
|
1000 |
-
|
1001 |
-
|
1002 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1003 |
/**
|
1004 |
* function create dashboad widget.
|
1005 |
* view most visited page in dashboard.
|
@@ -1007,477 +1107,485 @@ class page_visit_counter_Admin {
|
|
1007 |
*/
|
1008 |
function my_custom_dashboard_widgets() {
|
1009 |
global $wp_meta_boxes;
|
1010 |
-
wp_add_dashboard_widget('custom_help_widget', __('Most Visited Page', 'page-visit-counter'), 'custom_dashboard_help');
|
1011 |
function custom_dashboard_help() {
|
1012 |
global $wpdb;
|
1013 |
-
$table_name
|
1014 |
-
$html
|
1015 |
-
$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");
|
1016 |
-
$html
|
1017 |
-
if (!empty($count_visit) && isset($count_visit)) {
|
1018 |
-
|
1019 |
-
$html .='<tr>';
|
1020 |
-
|
1021 |
-
|
1022 |
-
|
1023 |
-
$html .='</tr>';
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
|
1029 |
-
|
1030 |
-
|
1031 |
-
|
1032 |
-
}
|
1033 |
-
$html .='</table>';
|
1034 |
-
} else {
|
1035 |
-
$html .='No Page Found.';
|
1036 |
}
|
1037 |
-
|
|
|
|
|
|
|
|
|
1038 |
echo $html;
|
1039 |
}
|
1040 |
}
|
1041 |
-
|
1042 |
/**
|
1043 |
* this function use to page settings submit callback function
|
1044 |
-
* add option by option table
|
1045 |
-
* add page count option and duration.
|
1046 |
*/
|
1047 |
-
public function add_page_count_option(){
|
1048 |
global $wpdb;
|
1049 |
-
|
1050 |
$page_count_option = array();
|
1051 |
-
|
1052 |
-
$getformsumbitaction = !empty( $_POST['action'] ) ? $_POST['action']:'';
|
1053 |
-
$getformactiontype
|
1054 |
-
|
1055 |
-
if( !empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'add' ) {
|
1056 |
-
|
1057 |
-
$type
|
1058 |
-
$ipAddress
|
1059 |
-
$userList
|
1060 |
-
$hidefrontview
|
1061 |
-
$text_color_page_visit = isset($_POST['textcolor']) ? $_POST['textcolor'] : '';
|
1062 |
-
|
1063 |
-
$twitter_url_page_visit = isset($_POST['twitter_url_page_visit']) ? $_POST['twitter_url_page_visit'] : '';
|
1064 |
-
$gplus_url_page_visit
|
1065 |
-
$fb_url_page_visit
|
1066 |
-
$no_of_days_to_display
|
1067 |
-
|
1068 |
-
delete_option('wfap_post_type');
|
1069 |
-
if (isset($type) && $type != null) {
|
1070 |
-
update_option('wfap_post_type',json_encode(array_values($type)));
|
1071 |
}
|
1072 |
-
|
1073 |
-
delete_option('ipaddress_visit');
|
1074 |
-
if (isset($ipAddress) && $ipAddress != null) {
|
1075 |
-
update_option('ipaddress_visit',json_encode(array_values($ipAddress)));
|
1076 |
}
|
1077 |
-
|
1078 |
-
delete_option('userlist_visit');
|
1079 |
-
if (isset($userList) && $userList != null) {
|
1080 |
-
update_option('userlist_visit',json_encode(array_values($userList)));
|
1081 |
}
|
1082 |
-
|
1083 |
-
if( isset($hidefrontview) && $hidefrontview != null ){
|
1084 |
-
update_option('counter_hide_show_front_vew'
|
1085 |
} else {
|
1086 |
-
update_option('counter_hide_show_front_vew','');
|
1087 |
}
|
1088 |
-
|
1089 |
-
if( isset($no_of_days_to_display) && $no_of_days_to_display != null ){
|
1090 |
-
update_option('no_of_days_to_display'
|
1091 |
} else {
|
1092 |
-
update_option('no_of_days_to_display','');
|
1093 |
}
|
1094 |
-
|
1095 |
-
if( isset($text_color_page_visit) && $text_color_page_visit != null ){
|
1096 |
-
update_option('text_color_page_visit'
|
1097 |
}
|
1098 |
-
|
1099 |
-
if( isset($twitter_url_page_visit) && $twitter_url_page_visit != null ){
|
1100 |
-
update_option('twitter_url_page_visit'
|
1101 |
}
|
1102 |
-
|
1103 |
-
if( isset($gplus_url_page_visit) && $gplus_url_page_visit != null ){
|
1104 |
-
update_option('gplus_url_page_visit'
|
1105 |
}
|
1106 |
-
|
1107 |
-
if( isset($fb_url_page_visit) && $fb_url_page_visit != null ){
|
1108 |
-
update_option('fb_url_page_visit'
|
1109 |
}
|
1110 |
-
} else if (!empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'reset') {
|
1111 |
-
delete_option('wfap_post_type');
|
1112 |
-
delete_option('ipaddress_visit');
|
1113 |
-
delete_option('userlist_visit');
|
1114 |
-
update_option('no_of_days_to_display','');
|
1115 |
-
update_option('counter_hide_show_front_vew','');
|
1116 |
-
update_option('text_color_page_visit','');
|
1117 |
-
update_option('twitter_url_page_visit','');
|
1118 |
-
update_option('gplus_url_page_visit','');
|
1119 |
-
update_option('fb_url_page_visit','');
|
1120 |
-
} else if (!empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && !empty( $getformactiontype ) && $getformactiontype == 'resetcount') {
|
1121 |
-
|
1122 |
-
$table_name = $wpdb->prefix."page_visit";
|
1123 |
-
|
1124 |
$query = "TRUNCATE TABLE $table_name";
|
1125 |
-
$wpdb->query($query);
|
1126 |
-
|
1127 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1128 |
-
$query
|
1129 |
-
$wpdb->query($query);
|
1130 |
}
|
1131 |
-
|
1132 |
-
wp_safe_redirect(site_url("/wp-admin/admin.php?page=page_visit_settings"));
|
1133 |
exit();
|
1134 |
-
|
1135 |
-
//die();
|
1136 |
}
|
1137 |
-
|
1138 |
/**
|
1139 |
* select_input_page_value use in ajax callback function
|
1140 |
* handle the date and page title on change event.
|
1141 |
*/
|
1142 |
public function select_input_page_value() {
|
1143 |
global $wpdb;
|
1144 |
-
$table_name = $wpdb->prefix."page_visit";
|
1145 |
-
$table_post = $wpdb->prefix."posts";
|
1146 |
-
$html
|
1147 |
$page_title = isset( $_POST['page_name'] ) ? $_POST['page_name'] : '';
|
1148 |
-
$page_date
|
1149 |
-
$string
|
1150 |
-
if( $page_date == '' && $page_title =='' ) {
|
1151 |
-
$html
|
1152 |
<thead>
|
1153 |
<tr>
|
1154 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1155 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1156 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1157 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1158 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1159 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1160 |
</tr>
|
1161 |
</thead>
|
1162 |
<tbody>';
|
1163 |
-
|
1164 |
-
|
1165 |
-
|
1166 |
-
|
1167 |
-
|
1168 |
-
|
1169 |
-
|
1170 |
-
|
1171 |
-
|
1172 |
-
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
}
|
1177 |
}
|
1178 |
-
}
|
1179 |
-
$counter = 0;
|
1180 |
-
foreach ( $posts_array as $result ) {
|
1181 |
-
foreach ($result as $results) {
|
1182 |
-
$counter = $counter + 1;
|
1183 |
-
$html .='<tr>';
|
1184 |
-
$html .='<td>'.$counter.'</td>';
|
1185 |
-
$html .='<td>'.$results->ID.'</td>';
|
1186 |
-
$html .='<td><a href="'.get_admin_url().'post.php?post='.$results->ID.'&action=edit">'.__($results->post_title,'page-visit-counter').'</a></td>';
|
1187 |
-
$count_visit = $wpdb->get_results("SELECT SUM(page_visit) as page_visit from $table_name where page_id ='".$results->ID."'");
|
1188 |
-
$count = 0;
|
1189 |
-
foreach ( $count_visit as $countval) {
|
1190 |
-
$count = $count + 1;
|
1191 |
-
}
|
1192 |
-
if ($count_visit[0]->page_visit == '') {
|
1193 |
-
$countC = 0;
|
1194 |
-
} else {
|
1195 |
-
$countC = $count_visit[0]->page_visit;
|
1196 |
-
}
|
1197 |
-
$html .='<td>'.$countC.'</td>';
|
1198 |
-
|
1199 |
-
$site_title = get_bloginfo( 'name' );
|
1200 |
-
$page_social_content = $results->post_title.' - Total Visits '.$countC.' - '.$site_title;
|
1201 |
-
|
1202 |
-
$html .='<td>
|
1203 |
-
<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>
|
1204 |
-
<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>
|
1205 |
-
<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>';
|
1206 |
-
$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>';
|
1207 |
-
$html .='</tr>';
|
1208 |
-
}
|
1209 |
}
|
1210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1211 |
<tfoot><tr>
|
1212 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1213 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1214 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1215 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1216 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1217 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1218 |
</tr></tfoot></table>';
|
1219 |
echo $html;
|
1220 |
} else {
|
1221 |
-
if( $page_title != '' ){
|
1222 |
-
if($page_date){
|
1223 |
$string .= "wposts.post_title LIKE '$page_title%' AND ";
|
1224 |
-
}else{
|
1225 |
$string .= "wposts.post_title LIKE '$page_title%' ";
|
1226 |
}
|
1227 |
}
|
1228 |
-
if( $page_date != '' ){
|
1229 |
-
if( $page_title ){
|
1230 |
-
$string .= "$table_name.date = '"
|
1231 |
-
}else{
|
1232 |
-
$string .= "$table_name.date = '"
|
1233 |
}
|
1234 |
}
|
1235 |
-
$clean
|
1236 |
-
$querySet
|
1237 |
-
$dataquery
|
1238 |
-
if(empty( $dataquery ) || $dataquery == ''){
|
1239 |
-
$QUERY
|
1240 |
-
$notvisit = $wpdb->get_results($QUERY);
|
1241 |
-
$html
|
1242 |
<thead>
|
1243 |
<tr>
|
1244 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1245 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1246 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1247 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1248 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1249 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1250 |
</tr></thead><tbody>';
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
<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>
|
1264 |
-
<a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='
|
1265 |
-
<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>';
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
$html .='</tbody><tfoot>
|
1270 |
<tr>
|
1271 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1272 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1273 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1274 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1275 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1276 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1277 |
</tr></tfoot></table>';
|
1278 |
echo $html;
|
1279 |
-
}else if( $dataquery != '' ){
|
1280 |
-
$html
|
1281 |
<thead>
|
1282 |
<tr>
|
1283 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1284 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1285 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1286 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1287 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1288 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1289 |
</tr></thead><tbody>';
|
1290 |
$counter = 0;
|
1291 |
-
foreach ( $dataquery as $results ){
|
1292 |
$counter = $counter + 1;
|
1293 |
-
|
1294 |
-
|
1295 |
-
|
1296 |
-
|
1297 |
-
$str
|
1298 |
-
if( $page_title != '' ){
|
1299 |
-
if( $page_date != '' ){
|
1300 |
-
$str .="page_id ='"
|
1301 |
-
}else{
|
1302 |
-
$str .="page_id ='"
|
1303 |
}
|
1304 |
}
|
1305 |
-
|
1306 |
-
if($page_date != ''){
|
1307 |
-
if( $page_title != '' ){
|
1308 |
-
$str .="date ='"
|
1309 |
-
}else{
|
1310 |
-
$str .="date ='"
|
1311 |
}
|
1312 |
}
|
1313 |
-
$remove = rtrim($str," AND ");
|
1314 |
-
if($page_date != '' && $page_title != '' ){
|
1315 |
-
$count_visit = $wpdb->get_results("SELECT * from $table_name where $remove");
|
1316 |
-
} elseif ($page_title != '' ) {
|
1317 |
-
$count_visit = $wpdb->get_results("SELECT SUM(page_visit) as page_visit from $table_name where $remove");
|
1318 |
-
} elseif ($page_date != '' ) {
|
1319 |
-
$count_visit = $wpdb->get_results("SELECT * from $table_name where page_id=$results->ID AND $remove");
|
1320 |
}
|
1321 |
-
if ($count_visit[0]->page_visit == '') {
|
1322 |
$countC = 0;
|
1323 |
} else {
|
1324 |
$countC = $count_visit[0]->page_visit;
|
1325 |
}
|
1326 |
-
|
1327 |
-
$html .='<td>'
|
1328 |
-
|
1329 |
-
$site_title
|
1330 |
-
$page_social_content = $results->post_title.' - Total Visits '
|
1331 |
-
|
1332 |
-
$html .='<td>
|
1333 |
-
<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>
|
1334 |
-
<a target="_blank" style="margin-right: 5px;" href="https://twitter.com/intent/tweet?text='
|
1335 |
-
<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>';
|
1336 |
-
$html .='<td><a href="'.site_url().'/wp-admin/admin.php?page=page_visit_counter&id='
|
1337 |
-
|
1338 |
-
$html .='</tr>';
|
1339 |
}
|
1340 |
-
$html .='</tbody><tfoot>
|
1341 |
<tr>
|
1342 |
-
<th width="10%">'.__('No', 'page-visit-counter').'</th>
|
1343 |
-
<th width="10%">'.__('Page ID', 'page-visit-counter').'</th>
|
1344 |
-
<th>'.__('Page Title', 'page-visit-counter').'</th>
|
1345 |
-
<th width="20%">'.__('Total Count', 'page-visit-counter').'</th>
|
1346 |
-
<th width="20%">'.__('Share', 'page-visit-counter').'</th>
|
1347 |
-
<th width="10%">'.__('Report', 'page-visit-counter').'</th>
|
1348 |
-
</tr></tfoot</table>';
|
1349 |
-
echo $html;
|
1350 |
}
|
1351 |
}
|
1352 |
die();
|
1353 |
}
|
1354 |
-
|
1355 |
public function add_custom_meta_box_page_visit() {
|
1356 |
global $wpdb;
|
1357 |
-
|
1358 |
-
$fetchSelecetedPostTypes = json_decode(get_option('wfap_post_type'));
|
1359 |
-
if (isset($fetchSelecetedPostTypes) && !empty($fetchSelecetedPostTypes)) {
|
1360 |
$i = 0;
|
1361 |
-
foreach ($fetchSelecetedPostTypes as $postsingle) {
|
1362 |
-
add_meta_box("header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$postsingle", "side", "high", null);
|
1363 |
-
$i++;
|
1364 |
}
|
1365 |
} else {
|
1366 |
$i = 0;
|
1367 |
// Get all the registered post type
|
1368 |
$post_types = get_post_types();
|
1369 |
-
foreach ($post_types as $cpost) {
|
1370 |
-
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") {
|
1371 |
-
add_meta_box("header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$cpost", "side", "high", null);
|
1372 |
-
$i++;
|
1373 |
}
|
1374 |
}
|
1375 |
}
|
1376 |
-
|
1377 |
-
function add_new_selected_post_columns($columns) {
|
1378 |
-
|
1379 |
-
|
1380 |
-
|
1381 |
-
|
1382 |
-
|
1383 |
}
|
|
|
1384 |
function custom_columns_add_page_visit_count( $column, $post_id ) {
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
}
|
1392 |
}
|
1393 |
-
|
|
|
|
|
1394 |
global $wp, $wpdb;
|
1395 |
-
|
1396 |
-
$post_id
|
1397 |
-
$enable_page_count
|
1398 |
-
$enable_page_count_day_wise = get_post_meta($post_id, "enable_page_count_day_wise", true);
|
1399 |
-
|
1400 |
-
$table_name = $wpdb->prefix."page_visit";
|
1401 |
-
|
1402 |
-
$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id");
|
1403 |
-
|
1404 |
$total = (int) $pageCount[0]->total;
|
1405 |
?>
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1433 |
<?php
|
1434 |
}
|
1435 |
}
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
if(isset($_POST["page_visit_reset"]) && 'yes' === $_POST["page_visit_reset"])
|
1461 |
-
{
|
1462 |
-
$table_name = $wpdb->prefix."page_visit";
|
1463 |
-
|
1464 |
-
$query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
|
1465 |
-
|
1466 |
-
$pageCount = $wpdb->query($query);
|
1467 |
-
|
1468 |
-
$table_name = $wpdb->prefix . "page_visit_history";
|
1469 |
$query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
|
|
|
|
|
|
|
|
|
|
1473 |
}
|
1474 |
|
1475 |
-
|
1476 |
function check_page_visit_history_table_exisit() {
|
1477 |
global $wpdb, $wp;
|
1478 |
-
|
1479 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1480 |
-
if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
1481 |
$sql = "CREATE TABLE $table_name (
|
1482 |
id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
1483 |
page_id int(11) NOT NULL,
|
@@ -1490,241 +1598,245 @@ class page_visit_counter_Admin {
|
|
1490 |
os varchar(255) NOT NULL,
|
1491 |
http_referer varchar(255) NOT NULL,
|
1492 |
PRIMARY KEY (id)
|
1493 |
-
);";
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
}
|
1498 |
-
|
1499 |
}
|
1500 |
-
|
1501 |
function get_page_visit_record_report() {
|
1502 |
global $wpdb;
|
1503 |
-
|
1504 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1505 |
-
|
1506 |
$pageId = $_REQUEST['page_id'];
|
1507 |
-
|
1508 |
$countQuery = "SELECT COUNT(`page_id`) as total FROM $table_name WHERE `page_id` = $pageId";
|
1509 |
-
$result
|
1510 |
-
|
1511 |
-
if ( (int) $result[0]->total > 0) {
|
1512 |
-
|
1513 |
$queryTopBrowser = "SELECT COUNT(`page_id`) as total, `browser_full_name` as browser FROM $table_name WHERE `page_id` = $pageId GROUP BY `browser_full_name`";
|
1514 |
-
|
1515 |
-
$topBrowserArr = $wpdb->get_results($queryTopBrowser);
|
1516 |
-
|
1517 |
$topBrowserStringArr = array();
|
1518 |
-
|
1519 |
-
|
1520 |
$topBrowserStringArr['Browsers'] = 'Total Visits';
|
1521 |
-
if ( (int) $result[0]->total > 0) {
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
}
|
1526 |
-
|
1527 |
//$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";
|
1528 |
$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";
|
1529 |
-
|
1530 |
-
$topIpArr = $wpdb->get_results($queryTopIpAddress);
|
1531 |
-
|
1532 |
$topIpStringArr = array();
|
1533 |
-
|
1534 |
$topIpStringArr["IP Address"] = 'Total Visits';
|
1535 |
-
if ( (int) $result[0]->total > 0) {
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
}
|
1540 |
-
|
1541 |
$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";
|
1542 |
-
|
1543 |
-
$topRefererArr = $wpdb->get_results($queryTopReferer);
|
1544 |
-
|
1545 |
$topRefererStringArr = array();
|
1546 |
-
|
1547 |
$topRefererStringArr["Domain"] = 'Total Visits';
|
1548 |
-
if ( (int) $result[0]->total > 0) {
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
|
|
1555 |
}
|
|
|
1556 |
}
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
$custom_page_visit_history_datatbase_table_name = $wpdb->prefix."page_visit_history";
|
1561 |
//$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";
|
1562 |
$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";
|
1563 |
-
|
1564 |
-
$topWeeklyArr = $wpdb->get_results($queryWeeklyReport);
|
1565 |
-
|
1566 |
$topWeeklyStringArr = array();
|
1567 |
-
|
1568 |
$topWeeklyStringArr["Week Year"] = 'Total Visits';
|
1569 |
-
if ( (int) $result[0]->total > 0) {
|
1570 |
-
|
1571 |
-
|
1572 |
-
|
1573 |
-
|
1574 |
}
|
1575 |
-
|
1576 |
$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";
|
1577 |
-
|
1578 |
-
$topMonthlyArr = $wpdb->get_results($queryMonthlyReport);
|
1579 |
-
|
1580 |
$topMonthlyStringArr = array();
|
1581 |
-
|
1582 |
$topMonthlyStringArr["Month"] = "Total Visits";
|
1583 |
-
if ( (int) $result[0]->total > 0) {
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
}
|
1589 |
-
|
1590 |
$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";
|
1591 |
-
|
1592 |
-
$topYearlyArr = $wpdb->get_results($queryYearlyReport);
|
1593 |
-
|
1594 |
$topYearlyStringArr = array();
|
1595 |
-
|
1596 |
-
foreach ($topYearlyArr as $topYearly) {
|
1597 |
$topYearlyStringArr["$topYearly->year"] = $topYearly->total;
|
1598 |
}
|
1599 |
-
unset($topYearlyArr);
|
1600 |
-
|
1601 |
$resultsArr = array();
|
1602 |
-
|
1603 |
$resultsArr['topBrowserString'] = $topBrowserStringArr;
|
1604 |
-
$resultsArr['topIpString']
|
1605 |
$resultsArr['topRefererString'] = $topRefererStringArr;
|
1606 |
-
$resultsArr['topWeeklyString']
|
1607 |
$resultsArr['topMonthlyString'] = $topMonthlyStringArr;
|
1608 |
-
$resultsArr['topYearlyString']
|
1609 |
-
|
1610 |
-
echo json_encode( $resultsArr );
|
1611 |
-
unset($resultsArr);
|
1612 |
//print_r($topBrowserStringArr);
|
1613 |
} else {
|
1614 |
-
echo json_encode('novisit');
|
1615 |
}
|
1616 |
-
|
1617 |
die();
|
1618 |
-
}
|
1619 |
-
|
1620 |
-
|
1621 |
public function custom_admin_pointers_footer() {
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
1633 |
-
|
1634 |
-
|
1635 |
-
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
|
1640 |
-
|
1641 |
-
|
1642 |
-
|
1643 |
-
|
1644 |
-
|
1645 |
-
|
1646 |
-
|
1647 |
-
|
1648 |
-
|
1649 |
-
|
1650 |
-
|
1651 |
-
|
1652 |
-
}
|
1653 |
-
|
1654 |
-
|
1655 |
/**
|
1656 |
* Function For display pointer in admin side
|
1657 |
-
*
|
1658 |
*/
|
1659 |
-
|
1660 |
-
|
1661 |
-
|
1662 |
}
|
1663 |
-
|
1664 |
/**
|
1665 |
* The Widget functionality for this plugin.
|
1666 |
* widget provide Most visited page.
|
1667 |
*
|
1668 |
*/
|
1669 |
-
class My_Widget extends WP_Widget {
|
1670 |
-
|
1671 |
-
|
1672 |
-
|
1673 |
-
|
1674 |
-
|
1675 |
-
|
1676 |
-
|
1677 |
-
|
1678 |
-
|
1679 |
-
|
1680 |
-
|
1681 |
-
|
1682 |
-
|
1683 |
-
|
1684 |
-
$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");
|
1685 |
-
foreach ($count_visit as $visitpage ){
|
1686 |
-
$page = get_post($visitpage->page_id);
|
1687 |
-
$html .='<h6 style="font-size: 14px;font-weight: normal;line-height: 14px;">'.$page->post_title.'</h6>';
|
1688 |
-
$html .="<br>";
|
1689 |
}
|
1690 |
-
|
1691 |
-
|
1692 |
-
|
1693 |
-
|
1694 |
-
|
1695 |
-
|
1696 |
-
|
1697 |
-
|
1698 |
-
|
1699 |
-
|
1700 |
-
|
1701 |
-
|
1702 |
-
|
1703 |
-
|
1704 |
-
|
1705 |
-
|
1706 |
-
|
1707 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1708 |
}
|
1709 |
-
|
1710 |
-
|
1711 |
-
|
1712 |
-
|
1713 |
-
|
1714 |
-
|
1715 |
-
|
1716 |
-
|
1717 |
-
|
1718 |
-
|
1719 |
-
|
1720 |
-
|
1721 |
-
|
1722 |
-
|
1723 |
-
|
1724 |
-
|
1725 |
-
|
1726 |
-
|
1727 |
-
|
1728 |
-
|
1729 |
-
|
1730 |
-
|
|
26 |
*
|
27 |
* @since 1.0.0
|
28 |
* @access private
|
29 |
+
* @var string $plugin_name The ID of this plugin.
|
30 |
*/
|
31 |
private $plugin_name;
|
32 |
|
35 |
*
|
36 |
* @since 1.0.0
|
37 |
* @access private
|
38 |
+
* @var string $version The current version of this plugin.
|
39 |
*/
|
40 |
private $version;
|
41 |
|
43 |
* Initialize the class and set its properties.
|
44 |
*
|
45 |
* @since 1.0.0
|
46 |
+
*
|
47 |
+
* @param string $plugin_name The name of this plugin.
|
48 |
+
* @param string $version The version of this plugin.
|
49 |
*/
|
50 |
public function __construct( $plugin_name, $version ) {
|
51 |
|
52 |
$this->plugin_name = $plugin_name;
|
53 |
+
$this->version = $version;
|
54 |
|
55 |
}
|
56 |
|
61 |
*/
|
62 |
|
63 |
public function enqueue_styles() {
|
64 |
+
|
65 |
/**
|
66 |
* This function is provided for demonstration purposes only.
|
67 |
*
|
73 |
* between the defined hooks and the functions defined in this
|
74 |
* class.
|
75 |
*/
|
76 |
+
|
77 |
//wp_enqueue_style("jquery-ui-tabs");
|
78 |
+
|
79 |
+
wp_enqueue_style( 'custom-style', plugin_dir_url( __FILE__ ) . 'css/style.css' );
|
80 |
+
wp_enqueue_style( 'datatable-style', plugin_dir_url( __FILE__ ) . 'css/jquery.dataTables.css' );
|
81 |
+
wp_enqueue_style( 'jquery-style', plugin_dir_url( __FILE__ ) . 'css/jquery-ui.css' );
|
82 |
+
wp_enqueue_style( 'chosen-style', plugin_dir_url( __FILE__ ) . 'css/chosen.css' );
|
83 |
//wp_enqueue_style('fancy-box-style', plugin_dir_url( __FILE__ ) . 'css/jquery.fancybox-1.3.4.css');
|
84 |
+
wp_enqueue_style( 'color-box-style', plugin_dir_url( __FILE__ ) . 'css/colorbox.css' );
|
85 |
//wp_enqueue_style('color-picker', plugin_dir_url( __FILE__ ) . 'css/color-picker.min.css');
|
86 |
wp_enqueue_style( 'wp-color-picker' );
|
87 |
wp_enqueue_style( 'wp-pointer' );
|
88 |
}
|
89 |
+
|
90 |
/**
|
91 |
* Register the JavaScript for the admin area.
|
92 |
*
|
93 |
* @since 1.0.0
|
94 |
*/
|
95 |
public function enqueue_scripts() {
|
96 |
+
|
97 |
/**
|
98 |
* This function is provided for demonstration purposes only.
|
99 |
*
|
105 |
* between the defined hooks and the functions defined in this
|
106 |
* class.
|
107 |
*/
|
108 |
+
|
109 |
+
wp_enqueue_script( 'jquery-ui-core' );
|
110 |
+
wp_enqueue_script( 'jquery-ui-tabs' );
|
111 |
+
wp_enqueue_script( 'jquery-ui-datepicker' );
|
112 |
//wp_deregister_style( 'wp-jquery-ui-dialog' );
|
113 |
//wp_enqueue_script( 'wp-jquery-ui-dialog' );
|
114 |
wp_enqueue_script( 'jquery-ui-dialog' );
|
115 |
+
|
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);
|
128 |
+
|
129 |
+
wp_enqueue_script( 'chosen-jquery', plugin_dir_url( __FILE__ ) . 'js/chosen.jquery.js', array( 'jquery' ), $this->version, false );
|
130 |
+
wp_enqueue_script( 'chosen-proto', plugin_dir_url( __FILE__ ) . 'js/chosen.proto.js', array( 'jquery' ), $this->version, false );
|
131 |
+
wp_enqueue_script( 'color-box', plugin_dir_url( __FILE__ ) . 'js/jquery.colorbox.js', array( 'jquery' ), $this->version, false );
|
132 |
+
|
133 |
+
wp_enqueue_script( 'iris', admin_url( 'js/iris.min.js' ), array(
|
134 |
+
'jquery-ui-draggable',
|
135 |
+
'jquery-ui-slider',
|
136 |
+
'jquery-touch-punch'
|
137 |
+
), false, 1 );
|
138 |
+
wp_enqueue_script( 'wp-color-picker', admin_url( 'js/color-picker.min.js' ), array( 'iris' ), false, 1 );
|
139 |
+
|
140 |
+
$colorpicker_l10n = array(
|
141 |
+
'clear' => __( 'Clear' ),
|
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 |
+
|
163 |
+
|
164 |
public function welcome_page_visit_counter_screen_do_activation_redirect() {
|
165 |
// if no activation redirect
|
166 |
+
if ( ! get_transient( '_welcome_screen_page_visitor_activation_redirect_data' ) ) {
|
167 |
return;
|
168 |
}
|
169 |
|
170 |
// Delete the redirect transient
|
171 |
+
delete_transient( '_welcome_screen_page_visitor_activation_redirect_data' );
|
172 |
|
173 |
// if activating from network, or bulk
|
174 |
+
if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) {
|
175 |
return;
|
176 |
}
|
177 |
// Redirect to extra cost welcome page
|
178 |
+
wp_safe_redirect( add_query_arg( array( 'page' => 'page-visit-counter-about&tab=about' ), admin_url( 'index.php' ) ) );
|
179 |
}
|
180 |
+
|
181 |
public function welcome_pages_screen_page_visit_counter() {
|
182 |
add_dashboard_page(
|
183 |
+
'Page Visit counter Dashboard', 'Page Visit counter Dashboard', 'read', 'page-visit-counter-about', array(
|
184 |
+
&$this,
|
185 |
+
'welcome_screen_content_page_visit_counter'
|
186 |
+
)
|
187 |
);
|
188 |
}
|
189 |
+
|
190 |
public function admin_css() {
|
191 |
+
wp_enqueue_style( $this->plugin_name . 'welcome-page', plugin_dir_url( __FILE__ ) . 'css/style.css', array(), $this->version, 'all' );
|
192 |
}
|
193 |
+
|
194 |
public function welcome_screen_content_page_visit_counter() {
|
195 |
+
?>
|
196 |
<div class="wrap about-wrap">
|
197 |
+
<h1 style="font-size: 2.1em;"><?php printf( __( 'Welcome to Page Visit Counter', 'page-visit-counter' ) ); ?></h1>
|
198 |
|
199 |
<div class="about-text woocommerce-about-text">
|
200 |
+
<?php
|
201 |
+
$message = '';
|
202 |
+
printf( __( '%s This plugin will count the total visits of your sites pages.', 'page-visit-counter' ), $message, $this->version );
|
203 |
+
?>
|
204 |
+
<img class="version_logo_img"
|
205 |
+
src="<?php echo plugin_dir_url( __FILE__ ) . 'images/page_visit_counter.png'; ?>">
|
206 |
</div>
|
207 |
|
208 |
+
<?php
|
209 |
+
$setting_tabs_wc = apply_filters( 'page_visit_counter_setting_tab', array(
|
210 |
+
"about" => "Overview",
|
211 |
+
"other_plugins" => "Checkout our other plugins"
|
212 |
+
) );
|
213 |
+
$current_tab_wc = ( isset( $_GET['tab'] ) ) ? $_GET['tab'] : 'general';
|
214 |
+
$aboutpage = isset( $_GET['page'] )
|
215 |
+
?>
|
216 |
<h2 id="woo-extra-cost-tab-wrapper" class="nav-tab-wrapper">
|
217 |
+
<?php
|
218 |
+
foreach ( $setting_tabs_wc as $name => $label ) {
|
219 |
+
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>';
|
220 |
+
}
|
221 |
+
?>
|
222 |
</h2>
|
223 |
|
224 |
+
<?php
|
225 |
+
foreach ( $setting_tabs_wc as $setting_tabkey_wc => $setting_tabvalue ) {
|
226 |
+
switch ( $setting_tabkey_wc ) {
|
227 |
+
case $current_tab_wc:
|
228 |
+
do_action( 'page_visit_counter_' . $current_tab_wc );
|
229 |
+
break;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
?>
|
233 |
+
<hr/>
|
234 |
<div class="return-to-dashboard">
|
235 |
+
<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>
|
236 |
</div>
|
237 |
</div>
|
238 |
+
<?php
|
239 |
}
|
240 |
+
|
241 |
/**
|
242 |
+
* Extra flate rate overview welcome page content function
|
243 |
+
*
|
244 |
+
*/
|
245 |
public function page_visit_counter_about() {
|
246 |
//do_action('my_own');
|
247 |
$current_user = wp_get_current_user();
|
248 |
|
249 |
+
?>
|
250 |
<div class="changelog">
|
251 |
+
|
252 |
</br>
|
253 |
+
<style type="text/css">
|
254 |
+
p.page_visit_overview {
|
255 |
+
max-width: 100% !important;
|
256 |
+
margin-left: auto;
|
257 |
+
margin-right: auto;
|
258 |
+
font-size: 15px;
|
259 |
+
line-height: 1.5;
|
260 |
+
}
|
261 |
+
|
262 |
+
.Page_Counter_Settings_Content_ul ul li {
|
263 |
+
margin-left: 3%;
|
264 |
+
list-style: initial;
|
265 |
+
line-height: 23px;
|
266 |
+
}
|
267 |
+
</style>
|
268 |
<div class="changelog about-integrations">
|
269 |
<div class="wc-feature feature-section col three-col">
|
270 |
<div>
|
271 |
+
<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>
|
272 |
+
<p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
|
273 |
<div class="Page_Counter_Settings_Content_ul">
|
274 |
+
<ul>
|
275 |
+
<li>In these options you can do different setting for page visit counter.</li>
|
276 |
+
<li>Short Code: There are two shortcuts that you can use to manually add page view count
|
277 |
+
to any content on admin or post/page template created by your theme or plugin that's
|
278 |
+
creating its own display content in a page / post.
|
279 |
+
</li>
|
280 |
+
<li>Post Type: You can select the post type from the drop down menu for which post views
|
281 |
+
will be counted. If you leave blank on post type, then all pages or all past type
|
282 |
+
posts will be counted.
|
283 |
+
</li>
|
284 |
+
<li>Exclude IPs (Ip Address): Enter the IP addresses which you want to be excluded from
|
285 |
+
post views count.
|
286 |
+
</li>
|
287 |
+
<li>Exclude Users: Select users from your project/system to be excluded from post view
|
288 |
+
count.
|
289 |
+
</li>
|
290 |
+
<li>Show front view counter: Check the box if you want to display counter view on front
|
291 |
+
end.
|
292 |
+
</li>
|
293 |
+
<li>Choose color for the front end view: select color from color picker to choose the
|
294 |
+
color for display visit pages text on front side as well as in the shortcode.
|
295 |
+
</li>
|
296 |
+
</ul>
|
297 |
</div>
|
298 |
+
|
299 |
+
<p class="page_visit_overview"><strong>Page Counter Settings: </strong></p>
|
300 |
+
|
301 |
+
<p class="page_visit_overview">In this option you can see all pages listing within Page ID, Page
|
302 |
+
Title and Total Count. It will display all pages of your site. If you excluded particular
|
303 |
+
post type from page visit counter then also it will display that post type, posts pages on
|
304 |
+
table but it will not count those pages and "total count" will be "0" for excluded post
|
305 |
+
type, post pages.</p>
|
306 |
+
|
307 |
<div class="Page_Counter_Settings_Content_ul">
|
308 |
+
<ul>
|
309 |
+
<li>Search facility: This provides you the extra facility to search pages by title and
|
310 |
+
search page by its crated date.
|
311 |
+
</li>
|
312 |
+
<li>Sharing facility: This provides you to share specific page on Facebook, Twitter and
|
313 |
+
Google Plus.
|
314 |
+
</li>
|
315 |
+
<li>Reports: This provides you the specific page vise reports like Top browsers, Top 10
|
316 |
+
IP address, Top referer, weekly report and Monthly report using chart.
|
317 |
+
</li>
|
318 |
+
</ul>
|
319 |
</div>
|
320 |
+
|
321 |
+
|
322 |
</div>
|
323 |
+
|
324 |
</div>
|
325 |
</div>
|
326 |
</div>
|
327 |
+
<?php
|
328 |
+
if ( ! get_option( 'pvcp_plugin_notice_shown' ) ) {
|
329 |
+
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>';
|
330 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
331 |
}
|
332 |
|
333 |
/**
|
334 |
+
* Extra flate rate other plugin welcome page content function
|
335 |
+
*
|
336 |
+
*/
|
337 |
+
public function page_visit_counter_other_plugins() {
|
338 |
global $wpdb;
|
339 |
+
$url = 'http://www.multidots.com/store/wp-content/themes/business-hub-child/API/checkout_other_plugin.php';
|
340 |
+
$response = wp_remote_post( $url, array(
|
341 |
+
'method' => 'POST',
|
342 |
+
'timeout' => 45,
|
343 |
+
'redirection' => 5,
|
344 |
+
'httpversion' => '1.0',
|
345 |
+
'blocking' => true,
|
346 |
+
'headers' => array(),
|
347 |
+
'body' => array( 'plugin' => 'advance-flat-rate-shipping-method-for-woocommerce' ),
|
348 |
+
'cookies' => array()
|
349 |
+
) );
|
350 |
+
|
351 |
+
$response_new = array();
|
352 |
+
$response_new = json_decode( $response['body'] );
|
353 |
+
$get_other_plugin = maybe_unserialize( $response_new );
|
354 |
+
|
355 |
$paid_arr = array();
|
356 |
?>
|
357 |
|
358 |
<div class="plug-containter">
|
359 |
+
<div class="paid_plugin">
|
360 |
+
<h3>Paid Plugins</h3>
|
361 |
+
<?php foreach ( $get_other_plugin as $key => $val ) {
|
362 |
+
if ( $val['plugindesc'] == 'paid' ) { ?>
|
363 |
+
|
364 |
+
|
365 |
+
<div class="contain-section">
|
366 |
+
<div class="contain-img"><img src="<?php echo $val['pluginimage']; ?>"></div>
|
367 |
+
<div class="contain-title"><a target="_blank"
|
368 |
+
href="<?php echo $val['pluginurl']; ?>"><?php echo $key; ?></a>
|
369 |
+
</div>
|
370 |
+
</div>
|
371 |
+
|
372 |
+
|
373 |
+
<?php } else {
|
374 |
+
|
375 |
+
$paid_arry[ $key ]['plugindesc'] = $val['plugindesc'];
|
376 |
+
$paid_arry[ $key ]['pluginimage'] = $val['pluginimage'];
|
377 |
+
$paid_arry[ $key ]['pluginurl'] = $val['pluginurl'];
|
378 |
+
$paid_arry[ $key ]['pluginname'] = $val['pluginname'];
|
379 |
+
|
380 |
+
?>
|
381 |
+
|
382 |
+
|
383 |
+
<?php }
|
384 |
+
} ?>
|
385 |
+
</div>
|
386 |
+
<?php if ( isset( $paid_arry ) && ! empty( $paid_arry ) ) { ?>
|
387 |
+
<div class="free_plugin">
|
388 |
+
<h3>Free Plugins</h3>
|
389 |
+
<?php foreach ( $paid_arry as $key => $val ) { ?>
|
390 |
+
<div class="contain-section">
|
391 |
+
<div class="contain-img"><img src="<?php echo $val['pluginimage']; ?>"></div>
|
392 |
+
<div class="contain-title"><a target="_blank"
|
393 |
+
href="<?php echo $val['pluginurl']; ?>"><?php echo $key; ?></a>
|
394 |
+
</div>
|
395 |
+
</div>
|
396 |
+
<?php }
|
397 |
+
} ?>
|
398 |
+
</div>
|
399 |
+
|
400 |
</div>
|
401 |
|
402 |
+
<?php
|
403 |
}
|
404 |
|
405 |
/**
|
406 |
+
* Remove the Extra flate rate menu in dashboard
|
407 |
+
*
|
408 |
+
*/
|
409 |
public function welcome_screen_remove_menus() {
|
410 |
+
remove_submenu_page( 'index.php', 'page-visit-counter-about' );
|
411 |
}
|
412 |
+
|
413 |
/**
|
414 |
* admin menu page fnction
|
415 |
* add menu in admin menubar.
|
416 |
*
|
417 |
*/
|
418 |
public function page_visit_counter_menu() {
|
419 |
+
add_menu_page( __( 'Page-Visit-Counter', 'page-visit-counter' ), __( 'PageVisitCounter', 'page-visit-counter' ), 'manage_options', 'page_visit_counter', 'extra_page_visit_function_custom', plugins_url( 'page-visit-counter/admin/images/icon.png' ) );
|
420 |
+
add_submenu_page( 'page_visit_counter', __( 'Counter-Settings', 'page-visit-counter' ), __( 'Settings', 'page-visit-counter' ), 'manage_options', 'page_visit_settings', 'custom_page_visit_settings' );
|
421 |
/**
|
422 |
* extra_page_visit_function_custom use the menu callback function
|
423 |
* $name pass the arguments
|
424 |
*/
|
425 |
+
function extra_page_visit_function_custom( $name ) {
|
426 |
global $wpdb;
|
427 |
+
|
428 |
if ( ! class_exists( 'WP_List_Table' ) ) {
|
429 |
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
|
430 |
}
|
431 |
+
|
432 |
require plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-tt-pvc-list-table.php';
|
433 |
+
|
434 |
// Create an instance of our package class.
|
435 |
$test_list_table = new TT_Example_List_Table();
|
436 |
// Fetch, prepare, sort, and filter our data.
|
437 |
$test_list_table->prepare_items();
|
438 |
+
|
439 |
+
$table_name = $wpdb->prefix . "page_visit";
|
440 |
?>
|
441 |
+
|
442 |
+
|
443 |
+
<div class="main-page-visit set_pvc_containter">
|
444 |
+
<div class="page-title">
|
445 |
+
<h1><?php echo __( 'Page Visit Counter', 'page-visit-counter' ); ?></h1>
|
446 |
+
</div>
|
447 |
+
|
448 |
<?php
|
449 |
+
if ( isset( $_REQUEST['id'] ) && ! empty( $_REQUEST['id'] ) ) { ?>
|
450 |
+
<style type="text/css">
|
451 |
+
.tabs div#chartContainer-main {
|
452 |
+
float: left;
|
453 |
+
width: 50%;
|
454 |
+
}
|
455 |
+
|
456 |
+
.tabs div#chartContainer1-main {
|
457 |
+
float: left;
|
458 |
+
width: 50%;
|
459 |
+
}
|
460 |
+
|
461 |
+
.tabs div#chartContainer2-main {
|
462 |
+
float: left;
|
463 |
+
width: 50%;
|
464 |
+
}
|
465 |
+
|
466 |
+
.tabs div#chartContainer3-main {
|
467 |
+
float: left;
|
468 |
+
width: 50%;
|
469 |
+
}
|
470 |
+
|
471 |
+
.tabs div#chartContainer5-main {
|
472 |
+
float: left;
|
473 |
+
width: 50%;
|
474 |
+
}
|
475 |
+
</style>
|
476 |
+
<div class="back"><h5><a class="button button-primary"
|
477 |
+
href="<?php echo site_url() ?>/wp-admin/admin.php?page=page_visit_counter">←
|
478 |
+
Back to list</a></h5></div>
|
479 |
+
<div style="">
|
480 |
+
<div id="page-vist-fancybox" class="page-counter-fancybox">
|
481 |
+
<div id="tabs">
|
482 |
+
<div id="chartContainer-main">
|
483 |
+
<span>Top Browsers</span>
|
484 |
+
<div id="chartContainer" style="width: 100%; height: 500px;"></div>
|
485 |
+
</div>
|
486 |
+
<div id="chartContainer1-main">
|
487 |
+
<span>Top 10 IP address</span>
|
488 |
+
<div id="chartContainer1" style="width: 100%; height: 500px;"></div>
|
489 |
+
</div>
|
490 |
+
<div id="chartContainer2-main">
|
491 |
+
<span>Top referer</span>
|
492 |
+
<div id="chartContainer2" style="width: 100%; height: 500px;"></div>
|
493 |
+
</div>
|
494 |
+
<div id="chartContainer3-main">
|
495 |
+
<span>Weekly report </span>
|
496 |
+
<div id="chartContainer3" style="width: 100%; height: 500px;"></div>
|
497 |
+
</div>
|
498 |
+
<div id="chartContainer5-main">
|
499 |
+
<span>Monthly report</span>
|
500 |
+
<div id="chartContainer5" style="width: 100%; height: 500px;"></div>
|
501 |
+
</div>
|
502 |
+
<!--<div id="chartContainer6" style="width: 900px; height: 300px;"></div>-->
|
503 |
+
</div>
|
504 |
+
</div>
|
505 |
+
</div>
|
506 |
+
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
|
507 |
+
<script type="text/javascript">
|
508 |
+
|
509 |
+
google.charts.load('current', {'packages': ['corechart', 'bar']});
|
510 |
+
|
511 |
+
var chartBrowsers = '';
|
512 |
+
var chartIP = '';
|
513 |
+
var chartReferer = '';
|
514 |
+
var chartWeekly = '';
|
515 |
+
var chartMonthly = '';
|
516 |
+
var chartYearly = '';
|
517 |
+
|
518 |
+
var dataBrowsers = '';
|
519 |
+
var dataIp = '';
|
520 |
+
var dataReferer = '';
|
521 |
+
var dataWeekly = '';
|
522 |
+
var dataMonthly = '';
|
523 |
+
var dataYearly = '';
|
524 |
+
var view = '';
|
525 |
+
|
526 |
+
//jQuery.getScript('https://www.gstatic.com/charts/loader.js');
|
527 |
+
var resultarr = '';
|
528 |
+
var toparr = [];
|
529 |
+
var dataPointsTopBrowsers = [];
|
530 |
+
var dataPointsIp = [];
|
531 |
+
var dataPointsReferer = [];
|
532 |
+
var dataPointsMonthly = [];
|
533 |
+
var dataPointsWeekly = [];
|
534 |
+
var dataPointsYearly = [];
|
535 |
+
|
536 |
+
var optionsBrowsers = '';
|
537 |
+
var optionschartIP = '';
|
538 |
+
var optionschartReferer = '';
|
539 |
+
var optionschartWeekly = '';
|
540 |
+
var optionschartMonthly = '';
|
541 |
+
var optionschartYearly = '';
|
542 |
+
|
543 |
+
|
544 |
+
jQuery(window).load(function () {
|
545 |
+
setTimeout(function () {
|
546 |
+
|
547 |
+
|
548 |
+
optionsBrowsers = {
|
549 |
+
title: '',
|
550 |
+
// pieHole: 0.4,
|
551 |
+
// is3D: true,
|
552 |
+
// chartArea:{left:20,top:20,width:'100%',height:'100%'},
|
553 |
+
};
|
554 |
+
|
555 |
+
optionschartIP = {
|
556 |
+
title: '',
|
557 |
+
chartArea: {width: "80%", height: "50%"},
|
558 |
+
bar: {groupWidth: "50%"},
|
559 |
+
legend: {position: "none"},
|
560 |
+
hAxis: {
|
561 |
+
title: 'Total Visits',
|
562 |
+
minValue: 0,
|
563 |
+
textStyle: {
|
564 |
+
bold: true,
|
565 |
+
fontSize: 12,
|
566 |
+
color: '#4d4d4d'
|
567 |
+
}
|
568 |
+
},
|
569 |
+
};
|
570 |
+
|
571 |
+
optionschartReferer = {
|
572 |
+
title: '',
|
573 |
+
chartArea: {left: 100, width: "80%", height: "50%"},
|
574 |
+
bar: {groupWidth: "20%"},
|
575 |
+
legend: {position: "none"},
|
576 |
+
hAxis: {
|
577 |
+
title: 'Referer Domain',
|
578 |
+
minValue: 0,
|
579 |
+
textStyle: {
|
580 |
+
bold: true,
|
581 |
+
fontSize: 12,
|
582 |
+
color: '#4d4d4d'
|
583 |
+
}
|
584 |
+
},
|
585 |
+
vAxis: {
|
586 |
+
title: 'Total Visits',
|
587 |
+
textStyle: {
|
588 |
+
fontSize: 14,
|
589 |
+
bold: true,
|
590 |
+
color: '#848484'
|
591 |
+
}
|
592 |
+
}
|
593 |
+
};
|
594 |
+
|
595 |
+
optionschartWeekly = {
|
596 |
+
title: '',
|
597 |
+
chartArea: {left: 100, width: "80%", height: "50%"},
|
598 |
+
bar: {groupWidth: "20%"},
|
599 |
+
legend: {position: "none"},
|
600 |
+
hAxis: {
|
601 |
+
title: 'Year - Month',
|
602 |
+
minValue: 0,
|
603 |
+
textStyle: {
|
604 |
+
bold: true,
|
605 |
+
fontSize: 12,
|
606 |
+
color: '#4d4d4d'
|
607 |
+
}
|
608 |
+
},
|
609 |
+
vAxis: {
|
610 |
+
title: 'Total Visits',
|
611 |
+
textStyle: {
|
612 |
+
fontSize: 14,
|
613 |
+
bold: true,
|
614 |
+
color: '#848484'
|
615 |
+
}
|
616 |
+
},
|
617 |
+
};
|
618 |
+
|
619 |
+
optionschartMonthly = {
|
620 |
+
title: '',
|
621 |
+
chartArea: {left: 100, width: "80%", height: "50%"},
|
622 |
+
bar: {groupWidth: "20%"},
|
623 |
+
legend: {position: "none"},
|
624 |
+
hAxis: {
|
625 |
+
title: 'Month - Week',
|
626 |
+
minValue: 0,
|
627 |
+
textStyle: {
|
628 |
+
bold: true,
|
629 |
+
fontSize: 12,
|
630 |
+
color: '#4d4d4d'
|
631 |
+
}
|
632 |
+
},
|
633 |
+
vAxis: {
|
634 |
+
title: 'Total Visits',
|
635 |
+
textStyle: {
|
636 |
+
fontSize: 14,
|
637 |
+
bold: true,
|
638 |
+
color: '#848484'
|
639 |
+
}
|
640 |
+
}
|
641 |
+
};
|
642 |
+
|
643 |
+
optionschartYearly = {
|
644 |
+
title: '',
|
645 |
+
chartArea: {width: "80%", height: "50%"},
|
646 |
+
bar: {groupWidth: "20%"},
|
647 |
+
legend: {position: "none"},
|
648 |
+
|
649 |
+
};
|
650 |
+
|
651 |
+
var page_id = <?php echo $_REQUEST['id']; ?>;
|
652 |
+
|
653 |
+
jQuery.ajax({
|
654 |
+
type: "POST",
|
655 |
+
url: pagevisit.ajaxurl,
|
656 |
+
async: true,
|
657 |
+
data: ({
|
658 |
+
action: 'get_page_visit_record_report',
|
659 |
+
page_id: page_id
|
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'];
|
667 |
+
topRefererArr = resultarr['topRefererString'];
|
668 |
+
topWeeklyArr = resultarr['topWeeklyString'];
|
669 |
+
topMonthlyArr = resultarr['topMonthlyString'];
|
670 |
+
topYearlyArr = resultarr['topYearlyString'];
|
671 |
+
|
672 |
+
jQuery("#chartContainer").html('');
|
673 |
+
jQuery("#chartContainer1").html('');
|
674 |
+
jQuery("#chartContainer2").html('');
|
675 |
+
jQuery("#chartContainer3").html('');
|
676 |
+
jQuery("#chartContainer5").html('');
|
677 |
+
jQuery("#chartContainer6").html('');
|
678 |
+
|
679 |
+
for (var i in topBrowsersArr) {
|
680 |
+
dataPointsTopBrowsers.push([i, topBrowsersArr [i]]);
|
681 |
+
}
|
682 |
+
|
683 |
+
dataBrowsers = google.visualization.arrayToDataTable(dataPointsTopBrowsers);
|
684 |
+
|
685 |
+
for (var j in topIpArr) {
|
686 |
+
dataPointsIp.push([j, topIpArr [j]]);
|
687 |
+
}
|
688 |
+
|
689 |
+
dataIp = google.visualization.arrayToDataTable(dataPointsIp);
|
690 |
+
|
691 |
+
for (var k in topRefererArr) {
|
692 |
+
dataPointsReferer.push([k, topRefererArr [k]]);
|
693 |
+
}
|
694 |
+
|
695 |
+
dataReferer = google.visualization.arrayToDataTable(dataPointsReferer);
|
696 |
+
|
697 |
+
for (var l in topWeeklyArr) {
|
698 |
+
dataPointsWeekly.push([l, topWeeklyArr [l]]);
|
699 |
+
}
|
700 |
+
|
701 |
+
dataWeekly = google.visualization.arrayToDataTable(dataPointsWeekly);
|
702 |
+
|
703 |
+
for (var m in topMonthlyArr) {
|
704 |
+
dataPointsMonthly.push([m, topMonthlyArr [m]]);
|
705 |
+
}
|
706 |
+
|
707 |
+
dataMonthly = google.visualization.arrayToDataTable(dataPointsMonthly);
|
708 |
+
|
709 |
+
for (var n in topYearlyArr) {
|
710 |
+
dataPointsYearly.push([n, topYearlyArr [n]]);
|
711 |
+
}
|
712 |
+
|
713 |
+
dataYearly = google.visualization.arrayToDataTable(dataPointsYearly);
|
714 |
+
|
715 |
+
jQuery(".page-counter-show").colorbox({inline: true, width: "38%"});
|
716 |
+
|
717 |
+
//$( "#tabs" ).tabs();
|
718 |
+
|
719 |
+
//$('body #ui-id-2').trigger('click');
|
720 |
+
|
721 |
+
chartBrowsers = new google.visualization.PieChart(document.getElementById('chartContainer'));
|
722 |
+
chartBrowsers.draw(dataBrowsers, optionsBrowsers);
|
723 |
+
|
724 |
+
view = new google.visualization.DataView(dataIp);
|
725 |
+
view.setColumns([0, 1,
|
726 |
+
{
|
727 |
+
calc: "stringify",
|
728 |
+
sourceColumn: 1,
|
729 |
+
type: "string",
|
730 |
+
role: "annotation"
|
731 |
+
},
|
732 |
+
]);
|
733 |
+
|
734 |
+
chartIP = new google.visualization.BarChart(document.getElementById('chartContainer1'));
|
735 |
+
//var chartIP = google.charts.Bar(document.getElementById('chartContainer1'));
|
736 |
+
chartIP.draw(view, optionschartIP);
|
737 |
+
|
738 |
+
|
739 |
+
chartReferer = new google.visualization.ColumnChart(document.getElementById('chartContainer2'));
|
740 |
+
chartReferer.draw(dataReferer, optionschartReferer);
|
741 |
+
|
742 |
+
chartWeekly = new google.visualization.ColumnChart(document.getElementById('chartContainer3'));
|
743 |
+
chartWeekly.draw(dataWeekly, optionschartWeekly);
|
744 |
+
|
745 |
+
chartMonthly = new google.visualization.ColumnChart(document.getElementById('chartContainer5'));
|
746 |
+
chartMonthly.draw(dataMonthly, optionschartMonthly);
|
747 |
+
|
748 |
+
//chartYearly = new google.visualization.ColumnChart(document.getElementById('chartContainer6'));
|
749 |
+
//chartYearly.draw(dataYearly, optionschartYearly);
|
750 |
+
|
751 |
+
jQuery(window).resize(function () {
|
752 |
+
console.log('resize');
|
753 |
+
chartBrowsers.draw(dataBrowsers, optionsBrowsers);
|
754 |
+
chartIP.draw(view, optionschartIP);
|
755 |
+
chartReferer.draw(dataReferer, optionschartReferer);
|
756 |
+
chartWeekly.draw(dataWeekly, optionschartWeekly);
|
757 |
+
chartMonthly.draw(dataMonthly, optionschartMonthly);
|
758 |
+
//chartYearly.draw(dataYearly, optionschartYearly);
|
759 |
+
});
|
760 |
+
|
761 |
+
|
762 |
+
} else {
|
763 |
+
jQuery(".page-counter-show").colorbox({inline: true, width: "38%"});
|
764 |
+
|
765 |
+
//jQuery( "#tabs" ).tabs();
|
766 |
+
|
767 |
+
|
768 |
// setTimeout(function(){
|
769 |
// jQuery('body #ui-id-1').trigger('click');
|
770 |
// },500);
|
771 |
+
|
772 |
+
jQuery("#chartContainer").html('No Visitor Found.');
|
773 |
+
jQuery("#chartContainer1").html('No Visitor Found.');
|
774 |
+
jQuery("#chartContainer2").html('No Visitor Found.');
|
775 |
+
jQuery("#chartContainer3").html('No Visitor Found.');
|
776 |
+
jQuery("#chartContainer5").html('No Visitor Found.');
|
777 |
+
jQuery("#chartContainer6").html('No Visitor Found.');
|
778 |
+
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
+
});
|
783 |
+
}, 1000);
|
784 |
+
});
|
785 |
+
|
786 |
+
jQuery(window).resize(function () {
|
787 |
+
console.log('resize');
|
788 |
+
chartBrowsers.draw(dataBrowsers, optionsBrowsers);
|
789 |
+
chartIP.draw(view, optionschartIP);
|
790 |
+
chartReferer.draw(dataReferer, optionschartReferer);
|
791 |
+
chartWeekly.draw(dataWeekly, optionschartWeekly);
|
792 |
+
chartMonthly.draw(dataMonthly, optionschartMonthly);
|
793 |
+
//chartYearly.draw(dataYearly, optionschartYearly);
|
794 |
+
});
|
795 |
+
|
796 |
+
|
797 |
+
</script>
|
798 |
+
<?php
|
799 |
+
} else { ?>
|
800 |
+
<form id="movies-filter" method="get">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
<?php
|
802 |
+
$test_list_table->search_box( __( 'Search' ), 'page-visit-counter' );
|
803 |
+
foreach ( $_GET as $key => $value ) { // http://stackoverflow.com/a/8763624/1287812
|
804 |
+
if ( 's' !== $key ) // don't include the search query
|
805 |
+
{
|
806 |
+
echo( "<input type='hidden' name='$key' value='$value' />" );
|
807 |
+
}
|
808 |
+
}
|
809 |
+
$test_list_table->display();
|
810 |
+
?>
|
811 |
+
</form>
|
812 |
+
|
813 |
+
<!-- Twitter -->
|
814 |
+
<script>!function (d, s, id) {
|
815 |
+
var js, fjs = d.getElementsByTagName(s)[0],
|
816 |
+
p = /^http:/.test(d.location) ? 'http' : 'https';
|
817 |
+
if (!d.getElementById(id)) {
|
818 |
+
js = d.createElement(s);
|
819 |
+
js.id = id;
|
820 |
+
js.src = p + '://platform.twitter.com/widgets.js';
|
821 |
+
fjs.parentNode.insertBefore(js, fjs);
|
822 |
+
}
|
823 |
+
}(document, 'script', 'twitter-wjs');</script>
|
824 |
+
|
825 |
+
<!-- Facebook -->
|
826 |
+
<script>(function (d, s, id) {
|
827 |
+
var js, fjs = d.getElementsByTagName(s)[0];
|
828 |
+
if (d.getElementById(id)) return;
|
829 |
+
js = d.createElement(s);
|
830 |
+
js.id = id;
|
831 |
+
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
|
832 |
+
fjs.parentNode.insertBefore(js, fjs);
|
833 |
+
}(document, 'script', 'facebook-jssdk'));</script>
|
834 |
+
|
835 |
+
<!-- Google+ -->
|
836 |
+
<script type="text/javascript">
|
837 |
+
(function () {
|
838 |
+
var po = document.createElement('script');
|
839 |
+
po.type = 'text/javascript';
|
840 |
+
po.async = true;
|
841 |
+
po.src = 'https://apis.google.com/js/platform.js';
|
842 |
+
var s = document.getElementsByTagName('script')[0];
|
843 |
+
s.parentNode.insertBefore(po, s);
|
844 |
+
})();
|
845 |
+
</script>
|
846 |
+
|
847 |
+
<?php
|
848 |
+
} ?>
|
849 |
+
|
850 |
+
</div>
|
851 |
+
|
852 |
<?php
|
853 |
}
|
854 |
+
|
855 |
/**
|
856 |
* function use to page settings
|
857 |
* $args is pass the arguments
|
858 |
*/
|
859 |
function custom_page_visit_settings( $args ) {
|
860 |
+
|
861 |
global $wpdb;
|
862 |
$current_user = wp_get_current_user();
|
863 |
// Get all the registered post type
|
864 |
$post_types = get_post_types();
|
865 |
+
|
866 |
// Get all the post type selected in settings page
|
867 |
$post_list = array();
|
868 |
+
$post = json_decode( get_option( 'wfap_post_type' ) );
|
869 |
+
$post_list = $post;
|
870 |
+
|
871 |
+
$text_color_page_visit = get_option( 'text_color_page_visit' );
|
872 |
+
if ( isset( $text_color_page_visit ) && $text_color_page_visit != null ) {
|
873 |
$text_color_page_visit = $text_color_page_visit;
|
874 |
} else {
|
875 |
$text_color_page_visit = '#000000';
|
876 |
}
|
877 |
+
|
878 |
+
if ( ! get_option( 'pvcp_plugin_notice_shown' ) ) {
|
879 |
+
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>';
|
880 |
}
|
881 |
+
|
882 |
?>
|
883 |
+
<div class="main-page-visit-settings">
|
884 |
+
<div class="page-title-settings">
|
885 |
+
<form id="pvc_plugin_form_id" method="post" action="<?php echo get_admin_url(); ?>admin-post.php"
|
886 |
+
enctype="multipart/form-data" novalidate="novalidate">
|
887 |
+
|
888 |
+
<input type="hidden" name="action" value="submit_form_pvc"/>
|
889 |
+
<input id="action_which" type="hidden" name="action-which" value="add"/>
|
890 |
+
<div class="set_pvc_containter set_plugin_descriptions">
|
891 |
+
<h3><?php echo __( 'Page Counter Settings', 'page-visit-counter' ); ?></h3>
|
892 |
+
<p><?php echo __( 'Page Visit Counter plugin use for front side post and pages counter. After activation of plugin it will automatically add page counts on bottom of all pages. So, that all visitors can see page counts for entire site pages.', 'page-visit-counter' ); ?></p>
|
893 |
+
<ul style="list-style-type: disc;padding: 3px 2px 2px 34px;">
|
894 |
+
<li>
|
895 |
+
<p><?php echo __( 'Specific page vise reports like Top browsers, Top 10 IP address, Top referer, weekly report and Monthly report using chart.', 'page-visit-counter' ); ?></p>
|
896 |
+
</li>
|
897 |
+
<li>
|
898 |
+
<p><?php echo __( 'Search facility: search pages by title and search page by its created date.', 'page-visit-counter' ); ?></p>
|
899 |
+
</li>
|
900 |
+
<li>
|
901 |
+
<p><?php echo __( 'Sharing facility: share specific page on Facebook, Twitter and Google Plus.', 'page-visit-counter' ); ?></p>
|
902 |
+
</li>
|
903 |
+
</ul>
|
904 |
+
</div>
|
905 |
+
|
906 |
+
<div class="set_pvc_containter set_plugin_descriptions_shortcode">
|
907 |
+
<fieldset>
|
908 |
+
<legend><?php echo __( 'Short Code', 'page-visit-counter' ); ?></legend>
|
909 |
+
<p><?php echo __( 'There are two shortcodes that you can use to manually add page view count to any content on admin or post/page template created by your theme or plugin thats create it\'s own display content in page/post.', 'page-visit-counter' ); ?></p>
|
910 |
+
<p><?php echo __( 'Use this shortcode to add admin side content on page/post:', 'page-visit-counter' ); ?>
|
911 |
+
<b><?php echo __( htmlspecialchars( '[page_visit_counter_md id="<page_id/post_id>"]' ), 'page-visit-counter' ); ?></b>
|
912 |
+
</p>
|
913 |
+
<p><?php echo __( 'Use this shortcode to display total sites visit to add admin side content on page/post:', 'page-visit-counter' ); ?>
|
914 |
+
<b><?php echo __( htmlspecialchars( '[page_visit_counter_md_total_sites_visit backgroundcolor="#ff0000" countboxcolor="#000000" fontcolor="#FFFFFF" bordercolor="#ff0000"]' ), 'page-visit-counter' ); ?></b>
|
915 |
+
</p>
|
916 |
+
<p><?php echo __( 'Use this shortcode to add page/post template (.php) file of your own template:', 'page-visit-counter' ); ?>
|
917 |
+
<b> <?php echo "<?php echo do_shortcode('[page_visit_counter_md id='page_id/post_id']');?>" ?></b>
|
918 |
+
</p>
|
919 |
+
<p><?php echo __( 'Use this shortcode to display total sites visit to add page/post template (.php) file of your own template:', 'page-visit-counter' ); ?>
|
920 |
+
<br><b> <?php echo do_shortcode('[page_visit_counter_md_total_sites_visit
|
921 |
+
backgroundcolor='#ff0000' countboxcolor='#000000' fontcolor='#FFFFFF'
|
922 |
+
bordercolor='#ff0000']');?> </b></p>
|
923 |
+
</fieldset>
|
924 |
+
</div>
|
925 |
+
|
926 |
+
<div class="set_pvc_containter set_plugin_descriptions">
|
927 |
+
<fieldset>
|
928 |
+
<legend><?php echo __( 'Basic Configuration settings', 'page-visit-counter' ); ?></legend>
|
929 |
<?php
|
930 |
+
$get_option_value = json_decode( get_option( 'page_count_settings' ) );
|
931 |
+
$input_values = isset( $get_option_value[1] ) ? $get_option_value[1] : array();
|
932 |
+
$select_values = isset( $get_option_value[0] ) ? $get_option_value[0] : array();
|
933 |
?>
|
934 |
+
<table border="0" cellpadding="10" cellspacing="0">
|
935 |
+
<tbody>
|
936 |
+
<tr>
|
937 |
+
<th scope="row"><label
|
938 |
+
for="blogname"><?php echo __( 'Post Type', 'page-visit-counter' ); ?></label>
|
939 |
+
</th>
|
940 |
+
<td>
|
941 |
+
<select id="post_type"
|
942 |
+
data-placeholder=" <?php echo __( 'Add Page/Post Type', 'page-visit-counter' ); ?>"
|
943 |
+
name="post_ty[]" multiple="true"
|
944 |
+
class="chosen-select-post category-select chosen-rtl validate_field1">
|
945 |
+
<option value=""></option><?php
|
946 |
+
if ( isset( $post_types ) && ! empty( $post_types ) ) {
|
947 |
+
foreach ( $post_types as $cpost ) {
|
948 |
+
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" ) { ?>
|
949 |
+
<option
|
950 |
+
value="<?php echo $cpost; ?>"><?php echo $cpost; ?></option><?php
|
951 |
}
|
952 |
+
}
|
953 |
+
} ?>
|
954 |
+
</select>
|
955 |
+
<p><?php echo __( '(Select post types for which post views will be counted.)', 'page-visit-counter' ); ?></p>
|
956 |
+
<!--<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>-->
|
957 |
+
</td>
|
958 |
+
</tr>
|
959 |
+
|
960 |
+
<tr class="ipaddress">
|
961 |
+
<th scope="row"><label
|
962 |
+
for="blogname"><?php echo __( 'Exclude IPs (Ip Address)', 'page-visit-counter' ); ?></label>
|
963 |
+
</th>
|
964 |
+
<td>
|
965 |
+
<select id="ip_address"
|
966 |
+
data-placeholder=" <?php echo __( 'Add IP Address in comma seprated', 'page-visit-counter' ); ?>"
|
967 |
+
name="ip-basic[]" multiple="true"
|
968 |
+
class="chosen-select-ip category-select chosen-rtl validate_field1">
|
969 |
+
<option value=""></option><?php
|
970 |
+
$get_option_value_ip = json_decode( get_option( 'ipaddress_visit' ) );
|
971 |
+
if ( isset( $get_option_value_ip ) && ! empty( $get_option_value_ip ) ) {
|
972 |
+
foreach ( $get_option_value_ip as $ip ) { ?>
|
973 |
+
<option
|
974 |
+
value="<?php echo $ip; ?>"><?php echo $ip; ?></option><?php
|
975 |
+
}
|
976 |
+
} ?>
|
977 |
+
</select>
|
978 |
+
<p><?php echo __( '(Enter the IP addresses to be excluded from post views count.)', 'page-visit-counter' ); ?></p>
|
979 |
+
</td>
|
980 |
+
</tr>
|
981 |
+
|
982 |
+
<tr class="users">
|
983 |
+
<th scope="row"><label
|
984 |
+
for="blogname"><?php echo __( 'Exclude Users', 'page-visit-counter' ); ?></label>
|
985 |
+
</th>
|
986 |
+
<td>
|
987 |
+
<select id="users_list"
|
988 |
+
data-placeholder="<?php echo __( 'Select Registerd Users', 'page-visit-counter' ); ?>"
|
989 |
+
name="user-basic[]" multiple="true"
|
990 |
+
class="chosen-select category-select chosen-rtl validate_field1">
|
991 |
+
<option value=""></option><?php
|
992 |
+
$query = "SELECT * FROM $wpdb->users";
|
993 |
+
$resultSetsArr = $wpdb->get_results( $query );
|
994 |
+
if ( isset( $resultSetsArr ) && ! empty( $resultSetsArr ) ) {
|
995 |
+
foreach ( $resultSetsArr as $value ) { ?>
|
996 |
+
<option
|
997 |
+
value="<?php echo $value->ID; ?>"><?php echo $value->user_email; ?></option><?php
|
998 |
+
}
|
999 |
+
} ?>
|
1000 |
+
</select>
|
1001 |
+
<p><?php echo __( '(Select the users to be excluded from post views count.)', 'page-visit-counter' ); ?></p>
|
1002 |
+
</td>
|
1003 |
+
</tr>
|
1004 |
+
|
1005 |
+
<tr class="hidefront">
|
1006 |
+
<th scope="row"><label
|
1007 |
+
for="blogname"><?php echo __( 'Show front view counter', 'page-visit-counter' ); ?></label>
|
1008 |
+
</th>
|
1009 |
+
<?php
|
1010 |
+
$hide_show_option = get_option( 'counter_hide_show_front_vew' );
|
1011 |
+
if ( $hide_show_option == 'on' ) {
|
1012 |
+
$cheked = 'checked';
|
1013 |
+
} else {
|
1014 |
+
$cheked = '';
|
1015 |
+
} ?>
|
1016 |
+
<td class="information">
|
1017 |
+
<input type="checkbox" name="hidefrontview"
|
1018 |
+
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' ); ?>
|
1019 |
+
</td>
|
1020 |
+
</tr>
|
1021 |
+
|
1022 |
+
<tr class="hidefront" style="display:none;">
|
1023 |
+
<th scope="row"><label
|
1024 |
+
for="blogname"><?php echo __( 'Last How many days count you want to display on front end.', 'page-visit-counter' ); ?></label>
|
1025 |
+
</th>
|
1026 |
+
<td class="information">
|
1027 |
+
<?php
|
1028 |
+
$get_no_of_days = get_option( 'no_of_days_to_display' );
|
1029 |
+
if ( $get_no_of_days == '' ) {
|
1030 |
+
$get_no_of_days = '';
|
1031 |
+
}
|
1032 |
+
?>
|
1033 |
+
<input type="text" name="no_of_days_to_display" id="no_of_days_to_display"
|
1034 |
+
value="<?php echo $get_no_of_days; ?>">
|
1035 |
+
</td>
|
1036 |
+
</tr>
|
1037 |
+
|
1038 |
+
<tr class="">
|
1039 |
+
<th scope="row"><label
|
1040 |
+
for="blogname"><?php echo __( 'Choose color for the front end view', 'page-visit-counter' ); ?></label>
|
1041 |
+
</th>
|
1042 |
+
<td class="information">
|
1043 |
+
<input id="text_color_page_visit" type="text" name="textcolor"
|
1044 |
+
value="<?php echo $text_color_page_visit; ?>" class="my-color-field"
|
1045 |
+
data-default-color="<?php echo $text_color_page_visit; ?>"/>
|
1046 |
+
</td>
|
1047 |
+
</tr>
|
1048 |
+
</tbody>
|
1049 |
+
</table>
|
1050 |
+
</fieldset>
|
1051 |
+
</div>
|
1052 |
+
<p class="submit">
|
1053 |
+
<input type="submit" name="submit" class="button button-primary"
|
1054 |
+
value="<?php echo __( 'Save Changes', 'page-visit-counter' ); ?>">
|
1055 |
+
<input type="submit" id="pvc_reset_settings"
|
1056 |
+
value="<?php echo __( 'Reset all settings', 'page-visit-counter' ); ?>"
|
1057 |
+
class="button button-primary">
|
1058 |
+
<input type="submit" id="pvc_reset_counter"
|
1059 |
+
value="<?php echo __( 'Reset all pages counts & report ', 'page-visit-counter' ); ?>"
|
1060 |
+
class="button button-primary">
|
1061 |
+
</p>
|
1062 |
+
</form>
|
1063 |
+
</div>
|
1064 |
+
</div>
|
1065 |
<?php
|
1066 |
+
}
|
1067 |
}
|
1068 |
+
|
1069 |
+
|
1070 |
+
public function wp_add_plugin_userfn() {
|
1071 |
+
$email_id = ( isset( $_POST["email_id"] ) && ! empty( $_POST["email_id"] ) ) ? $_POST["email_id"] : '';
|
1072 |
+
$log_url = ! empty( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : '';
|
1073 |
+
$cur_date = date( 'Y-m-d' );
|
1074 |
+
$request_url = 'https://store.multidots.com/wp-content/themes/business-hub-child/API/wp-add-plugin-users.php';
|
1075 |
+
if ( ! empty( $email_id ) ) {
|
1076 |
+
$response_args = array(
|
1077 |
+
'method' => 'POST',
|
1078 |
+
'timeout' => 45,
|
1079 |
+
'redirection' => 5,
|
1080 |
+
'httpversion' => '1.0',
|
1081 |
+
'blocking' => true,
|
1082 |
+
'headers' => array(),
|
1083 |
+
'body' => array(
|
1084 |
+
'user' => array(
|
1085 |
+
'plugin_id' => '6',
|
1086 |
+
'user_email' => $email_id,
|
1087 |
+
'plugin_site' => $log_url,
|
1088 |
+
'status' => 1,
|
1089 |
+
'activation_date' => $cur_date
|
1090 |
+
)
|
1091 |
+
),
|
1092 |
+
'cookies' => array()
|
1093 |
+
);
|
1094 |
+
$request_response = wp_remote_post( $request_url, $response_args );
|
1095 |
+
if ( ! is_wp_error( $request_response ) ) {
|
1096 |
+
update_option( 'pvcp_plugin_notice_shown', 'true' );
|
1097 |
+
}
|
1098 |
+
}
|
1099 |
+
wp_die();
|
1100 |
+
}
|
1101 |
+
|
1102 |
+
|
1103 |
/**
|
1104 |
* function create dashboad widget.
|
1105 |
* view most visited page in dashboard.
|
1107 |
*/
|
1108 |
function my_custom_dashboard_widgets() {
|
1109 |
global $wp_meta_boxes;
|
1110 |
+
wp_add_dashboard_widget( 'custom_help_widget', __( 'Most Visited Page', 'page-visit-counter' ), 'custom_dashboard_help' );
|
1111 |
function custom_dashboard_help() {
|
1112 |
global $wpdb;
|
1113 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1114 |
+
$html = '';
|
1115 |
+
$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" );
|
1116 |
+
$html .= '<div class="main_custom_dashboard_visit_page">';
|
1117 |
+
if ( ! empty( $count_visit ) && isset( $count_visit ) ) {
|
1118 |
+
$html .= '<table border="0" cellpadding="5" cellspacing="10">';
|
1119 |
+
$html .= '<tr>';
|
1120 |
+
$html .= '<th>' . __( 'Page id', 'page-visit-counter' ) . '</th>';
|
1121 |
+
$html .= '<th>' . __( 'Page Name', 'page-visit-counter' ) . '</th>';
|
1122 |
+
$html .= '<th>' . __( 'Total Count', 'page-visit-counter' ) . '</th>';
|
1123 |
+
$html .= '</tr>';
|
1124 |
+
|
1125 |
+
foreach ( $count_visit as $visitpage ) {
|
1126 |
+
$page = get_post( $visitpage->page_id );
|
1127 |
+
$html .= '<tr>';
|
1128 |
+
$html .= '<td>' . $page->ID . '</td>';
|
1129 |
+
$html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $page->ID . '&action=edit">' . __( $page->post_title, 'page-visit-counter' ) . '</a></td>';
|
1130 |
+
$html .= '<td>' . $visitpage->c . '</td>';
|
1131 |
+
$html .= '</tr>';
|
|
|
|
|
|
|
|
|
1132 |
}
|
1133 |
+
$html .= '</table>';
|
1134 |
+
} else {
|
1135 |
+
$html .= 'No Page Found.';
|
1136 |
+
}
|
1137 |
+
$html .= '</div>';
|
1138 |
echo $html;
|
1139 |
}
|
1140 |
}
|
1141 |
+
|
1142 |
/**
|
1143 |
* this function use to page settings submit callback function
|
1144 |
+
* add option by option table
|
1145 |
+
* add page count option and duration.
|
1146 |
*/
|
1147 |
+
public function add_page_count_option() {
|
1148 |
global $wpdb;
|
1149 |
+
|
1150 |
$page_count_option = array();
|
1151 |
+
|
1152 |
+
$getformsumbitaction = ! empty( $_POST['action'] ) ? $_POST['action'] : '';
|
1153 |
+
$getformactiontype = ! empty( $_POST['action-which'] ) ? $_POST['action-which'] : '';
|
1154 |
+
|
1155 |
+
if ( ! empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && ! empty( $getformactiontype ) && $getformactiontype == 'add' ) {
|
1156 |
+
|
1157 |
+
$type = isset( $_POST['post_ty'] ) ? $_POST['post_ty'] : array();
|
1158 |
+
$ipAddress = isset( $_POST['ip-basic'] ) ? $_POST['ip-basic'] : array();
|
1159 |
+
$userList = isset( $_POST['user-basic'] ) ? $_POST['user-basic'] : array();
|
1160 |
+
$hidefrontview = isset( $_POST['hidefrontview'] ) ? $_POST['hidefrontview'] : '';
|
1161 |
+
$text_color_page_visit = isset( $_POST['textcolor'] ) ? $_POST['textcolor'] : '';
|
1162 |
+
|
1163 |
+
$twitter_url_page_visit = isset( $_POST['twitter_url_page_visit'] ) ? $_POST['twitter_url_page_visit'] : '';
|
1164 |
+
$gplus_url_page_visit = isset( $_POST['gplus_url_page_visit'] ) ? $_POST['gplus_url_page_visit'] : '';
|
1165 |
+
$fb_url_page_visit = isset( $_POST['fb_url_page_visit'] ) ? $_POST['fb_url_page_visit'] : '';
|
1166 |
+
$no_of_days_to_display = isset( $_POST['no_of_days_to_display'] ) ? $_POST['no_of_days_to_display'] : '';
|
1167 |
+
|
1168 |
+
delete_option( 'wfap_post_type' );
|
1169 |
+
if ( isset( $type ) && $type != null ) {
|
1170 |
+
update_option( 'wfap_post_type', json_encode( array_values( $type ) ) );
|
1171 |
}
|
1172 |
+
|
1173 |
+
delete_option( 'ipaddress_visit' );
|
1174 |
+
if ( isset( $ipAddress ) && $ipAddress != null ) {
|
1175 |
+
update_option( 'ipaddress_visit', json_encode( array_values( $ipAddress ) ) );
|
1176 |
}
|
1177 |
+
|
1178 |
+
delete_option( 'userlist_visit' );
|
1179 |
+
if ( isset( $userList ) && $userList != null ) {
|
1180 |
+
update_option( 'userlist_visit', json_encode( array_values( $userList ) ) );
|
1181 |
}
|
1182 |
+
|
1183 |
+
if ( isset( $hidefrontview ) && $hidefrontview != null ) {
|
1184 |
+
update_option( 'counter_hide_show_front_vew', $hidefrontview );
|
1185 |
} else {
|
1186 |
+
update_option( 'counter_hide_show_front_vew', '' );
|
1187 |
}
|
1188 |
+
|
1189 |
+
if ( isset( $no_of_days_to_display ) && $no_of_days_to_display != null ) {
|
1190 |
+
update_option( 'no_of_days_to_display', $no_of_days_to_display );
|
1191 |
} else {
|
1192 |
+
update_option( 'no_of_days_to_display', '' );
|
1193 |
}
|
1194 |
+
|
1195 |
+
if ( isset( $text_color_page_visit ) && $text_color_page_visit != null ) {
|
1196 |
+
update_option( 'text_color_page_visit', $text_color_page_visit );
|
1197 |
}
|
1198 |
+
|
1199 |
+
if ( isset( $twitter_url_page_visit ) && $twitter_url_page_visit != null ) {
|
1200 |
+
update_option( 'twitter_url_page_visit', $twitter_url_page_visit );
|
1201 |
}
|
1202 |
+
|
1203 |
+
if ( isset( $gplus_url_page_visit ) && $gplus_url_page_visit != null ) {
|
1204 |
+
update_option( 'gplus_url_page_visit', $gplus_url_page_visit );
|
1205 |
}
|
1206 |
+
|
1207 |
+
if ( isset( $fb_url_page_visit ) && $fb_url_page_visit != null ) {
|
1208 |
+
update_option( 'fb_url_page_visit', $fb_url_page_visit );
|
1209 |
}
|
1210 |
+
} else if ( ! empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && ! empty( $getformactiontype ) && $getformactiontype == 'reset' ) {
|
1211 |
+
delete_option( 'wfap_post_type' );
|
1212 |
+
delete_option( 'ipaddress_visit' );
|
1213 |
+
delete_option( 'userlist_visit' );
|
1214 |
+
update_option( 'no_of_days_to_display', '' );
|
1215 |
+
update_option( 'counter_hide_show_front_vew', '' );
|
1216 |
+
update_option( 'text_color_page_visit', '' );
|
1217 |
+
update_option( 'twitter_url_page_visit', '' );
|
1218 |
+
update_option( 'gplus_url_page_visit', '' );
|
1219 |
+
update_option( 'fb_url_page_visit', '' );
|
1220 |
+
} else if ( ! empty( $getformsumbitaction ) && $getformsumbitaction == 'submit_form_pvc' && ! empty( $getformactiontype ) && $getformactiontype == 'resetcount' ) {
|
1221 |
+
|
1222 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1223 |
+
|
1224 |
$query = "TRUNCATE TABLE $table_name";
|
1225 |
+
$wpdb->query( $query );
|
1226 |
+
|
1227 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1228 |
+
$query = "TRUNCATE TABLE $table_name";
|
1229 |
+
$wpdb->query( $query );
|
1230 |
}
|
1231 |
+
|
1232 |
+
wp_safe_redirect( site_url( "/wp-admin/admin.php?page=page_visit_settings" ) );
|
1233 |
exit();
|
1234 |
+
|
1235 |
+
//die();
|
1236 |
}
|
1237 |
+
|
1238 |
/**
|
1239 |
* select_input_page_value use in ajax callback function
|
1240 |
* handle the date and page title on change event.
|
1241 |
*/
|
1242 |
public function select_input_page_value() {
|
1243 |
global $wpdb;
|
1244 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1245 |
+
$table_post = $wpdb->prefix . "posts";
|
1246 |
+
$html = '';
|
1247 |
$page_title = isset( $_POST['page_name'] ) ? $_POST['page_name'] : '';
|
1248 |
+
$page_date = isset( $_POST['page_date'] ) ? $_POST['page_date'] : '';
|
1249 |
+
$string = '';
|
1250 |
+
if ( $page_date == '' && $page_title == '' ) {
|
1251 |
+
$html .= '<table id="example" class="display" cellpadding="0" cellspacing="0">
|
1252 |
<thead>
|
1253 |
<tr>
|
1254 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1255 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1256 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1257 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1258 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1259 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1260 |
</tr>
|
1261 |
</thead>
|
1262 |
<tbody>';
|
1263 |
+
$postperpage = - 1;
|
1264 |
+
$post_types = get_post_types();
|
1265 |
+
$posts_array = array();
|
1266 |
+
if ( isset( $post_types ) && ! empty( $post_types ) ) {
|
1267 |
+
foreach ( $post_types as $cpost ) {
|
1268 |
+
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" ) {
|
1269 |
+
$args = array(
|
1270 |
+
'post_type' => "$cpost",
|
1271 |
+
'post_status' => 'publish',
|
1272 |
+
'order' => 'ASC',
|
1273 |
+
'posts_per_page' => $postperpage,
|
1274 |
+
);
|
1275 |
+
$posts_array[] = get_posts( $args );
|
|
|
1276 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1277 |
}
|
1278 |
+
}
|
1279 |
+
$counter = 0;
|
1280 |
+
foreach ( $posts_array as $result ) {
|
1281 |
+
foreach ( $result as $results ) {
|
1282 |
+
$counter = $counter + 1;
|
1283 |
+
$html .= '<tr>';
|
1284 |
+
$html .= '<td>' . $counter . '</td>';
|
1285 |
+
$html .= '<td>' . $results->ID . '</td>';
|
1286 |
+
$html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __( $results->post_title, 'page-visit-counter' ) . '</a></td>';
|
1287 |
+
$count_visit = $wpdb->get_results( "SELECT SUM(page_visit) as page_visit from $table_name where page_id ='" . $results->ID . "'" );
|
1288 |
+
$count = 0;
|
1289 |
+
foreach ( $count_visit as $countval ) {
|
1290 |
+
$count = $count + 1;
|
1291 |
+
}
|
1292 |
+
if ( $count_visit[0]->page_visit == '' ) {
|
1293 |
+
$countC = 0;
|
1294 |
+
} else {
|
1295 |
+
$countC = $count_visit[0]->page_visit;
|
1296 |
+
}
|
1297 |
+
$html .= '<td>' . $countC . '</td>';
|
1298 |
+
|
1299 |
+
$site_title = get_bloginfo( 'name' );
|
1300 |
+
$page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
|
1301 |
+
|
1302 |
+
$html .= '<td>
|
1303 |
+
<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>
|
1304 |
+
<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>
|
1305 |
+
<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>';
|
1306 |
+
$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>';
|
1307 |
+
$html .= '</tr>';
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
$html .= '</tbody>
|
1311 |
<tfoot><tr>
|
1312 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1313 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1314 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1315 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1316 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1317 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1318 |
</tr></tfoot></table>';
|
1319 |
echo $html;
|
1320 |
} else {
|
1321 |
+
if ( $page_title != '' ) {
|
1322 |
+
if ( $page_date ) {
|
1323 |
$string .= "wposts.post_title LIKE '$page_title%' AND ";
|
1324 |
+
} else {
|
1325 |
$string .= "wposts.post_title LIKE '$page_title%' ";
|
1326 |
}
|
1327 |
}
|
1328 |
+
if ( $page_date != '' ) {
|
1329 |
+
if ( $page_title ) {
|
1330 |
+
$string .= "$table_name.date = '" . $page_date . "' AND";
|
1331 |
+
} else {
|
1332 |
+
$string .= "$table_name.date = '" . $page_date . "'";
|
1333 |
}
|
1334 |
}
|
1335 |
+
$clean = rtrim( $string, " AND " );
|
1336 |
+
$querySet = "SELECT DISTINCT wposts.* FROM $table_post wposts INNER JOIN $table_name ON (wposts.ID = $table_name.page_id) WHERE $clean";
|
1337 |
+
$dataquery = $wpdb->get_results( $querySet );
|
1338 |
+
if ( empty( $dataquery ) || $dataquery == '' ) {
|
1339 |
+
$QUERY = "SELECT * from $table_post where post_title LIKE '$page_title%' AND post_status='publish'";
|
1340 |
+
$notvisit = $wpdb->get_results( $QUERY );
|
1341 |
+
$html .= '<table id="example" class="display" cellpadding="0" cellspacing="0">
|
1342 |
<thead>
|
1343 |
<tr>
|
1344 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1345 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1346 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1347 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1348 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1349 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1350 |
</tr></thead><tbody>';
|
1351 |
+
$counter = 0;
|
1352 |
+
foreach ( $notvisit as $results ) {
|
1353 |
+
$counter = $counter + 1;
|
1354 |
+
$html .= '<tr>';
|
1355 |
+
$html .= '<td>' . $counter . '</td>';
|
1356 |
+
$html .= '<td>' . $results->ID . '</td>';
|
1357 |
+
$html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __( $results->post_title, 'page-visit-counter' ) . '</a></td>';
|
1358 |
+
$html .= '<td> 0 </td>';
|
1359 |
+
$site_title = get_bloginfo( 'name' );
|
1360 |
+
$page_social_content = $results->post_title . ' - Total Visits 0 - ' . $site_title;
|
1361 |
+
|
1362 |
+
$html .= '<td>
|
1363 |
+
<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>
|
1364 |
+
<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>
|
1365 |
+
<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>';
|
1366 |
+
$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>';
|
1367 |
+
$html .= '</tr>';
|
1368 |
+
}
|
1369 |
+
$html .= '</tbody><tfoot>
|
1370 |
<tr>
|
1371 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1372 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1373 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1374 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1375 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1376 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1377 |
</tr></tfoot></table>';
|
1378 |
echo $html;
|
1379 |
+
} else if ( $dataquery != '' ) {
|
1380 |
+
$html .= '<table id="example" class="display" cellpadding="0" cellspacing="0">
|
1381 |
<thead>
|
1382 |
<tr>
|
1383 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1384 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1385 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1386 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1387 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1388 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1389 |
</tr></thead><tbody>';
|
1390 |
$counter = 0;
|
1391 |
+
foreach ( $dataquery as $results ) {
|
1392 |
$counter = $counter + 1;
|
1393 |
+
$html .= '<tr>';
|
1394 |
+
$html .= '<td>' . $counter . '</td>';
|
1395 |
+
$html .= '<td>' . $results->ID . '</td>';
|
1396 |
+
$html .= '<td><a href="' . get_admin_url() . 'post.php?post=' . $results->ID . '&action=edit">' . __( $results->post_title, 'page-visit-counter' ) . '</a></td>';
|
1397 |
+
$str = '';
|
1398 |
+
if ( $page_title != '' ) {
|
1399 |
+
if ( $page_date != '' ) {
|
1400 |
+
$str .= "page_id ='" . $results->ID . "' AND ";
|
1401 |
+
} else {
|
1402 |
+
$str .= "page_id ='" . $results->ID . "'";
|
1403 |
}
|
1404 |
}
|
1405 |
+
|
1406 |
+
if ( $page_date != '' ) {
|
1407 |
+
if ( $page_title != '' ) {
|
1408 |
+
$str .= "date ='" . $page_date . "' AND ";
|
1409 |
+
} else {
|
1410 |
+
$str .= "date ='" . $page_date . "' ";
|
1411 |
}
|
1412 |
}
|
1413 |
+
$remove = rtrim( $str, " AND " );
|
1414 |
+
if ( $page_date != '' && $page_title != '' ) {
|
1415 |
+
$count_visit = $wpdb->get_results( "SELECT * from $table_name where $remove" );
|
1416 |
+
} elseif ( $page_title != '' ) {
|
1417 |
+
$count_visit = $wpdb->get_results( "SELECT SUM(page_visit) as page_visit from $table_name where $remove" );
|
1418 |
+
} elseif ( $page_date != '' ) {
|
1419 |
+
$count_visit = $wpdb->get_results( "SELECT * from $table_name where page_id=$results->ID AND $remove" );
|
1420 |
}
|
1421 |
+
if ( $count_visit[0]->page_visit == '' ) {
|
1422 |
$countC = 0;
|
1423 |
} else {
|
1424 |
$countC = $count_visit[0]->page_visit;
|
1425 |
}
|
1426 |
+
|
1427 |
+
$html .= '<td>' . $countC . '</td>';
|
1428 |
+
|
1429 |
+
$site_title = get_bloginfo( 'name' );
|
1430 |
+
$page_social_content = $results->post_title . ' - Total Visits ' . $countC . ' - ' . $site_title;
|
1431 |
+
|
1432 |
+
$html .= '<td>
|
1433 |
+
<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>
|
1434 |
+
<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>
|
1435 |
+
<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>';
|
1436 |
+
$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>';
|
1437 |
+
|
1438 |
+
$html .= '</tr>';
|
1439 |
}
|
1440 |
+
$html .= '</tbody><tfoot>
|
1441 |
<tr>
|
1442 |
+
<th width="10%">' . __( 'No', 'page-visit-counter' ) . '</th>
|
1443 |
+
<th width="10%">' . __( 'Page ID', 'page-visit-counter' ) . '</th>
|
1444 |
+
<th>' . __( 'Page Title', 'page-visit-counter' ) . '</th>
|
1445 |
+
<th width="20%">' . __( 'Total Count', 'page-visit-counter' ) . '</th>
|
1446 |
+
<th width="20%">' . __( 'Share', 'page-visit-counter' ) . '</th>
|
1447 |
+
<th width="10%">' . __( 'Report', 'page-visit-counter' ) . '</th>
|
1448 |
+
</tr></tfoot</table>';
|
1449 |
+
echo $html;
|
1450 |
}
|
1451 |
}
|
1452 |
die();
|
1453 |
}
|
1454 |
+
|
1455 |
public function add_custom_meta_box_page_visit() {
|
1456 |
global $wpdb;
|
1457 |
+
|
1458 |
+
$fetchSelecetedPostTypes = json_decode( get_option( 'wfap_post_type' ) );
|
1459 |
+
if ( isset( $fetchSelecetedPostTypes ) && ! empty( $fetchSelecetedPostTypes ) ) {
|
1460 |
$i = 0;
|
1461 |
+
foreach ( $fetchSelecetedPostTypes as $postsingle ) {
|
1462 |
+
add_meta_box( "header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$postsingle", "side", "high", null );
|
1463 |
+
$i ++;
|
1464 |
}
|
1465 |
} else {
|
1466 |
$i = 0;
|
1467 |
// Get all the registered post type
|
1468 |
$post_types = get_post_types();
|
1469 |
+
foreach ( $post_types as $cpost ) {
|
1470 |
+
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" ) {
|
1471 |
+
add_meta_box( "header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$cpost", "side", "high", null );
|
1472 |
+
$i ++;
|
1473 |
}
|
1474 |
}
|
1475 |
}
|
1476 |
+
|
1477 |
+
function add_new_selected_post_columns( $columns ) {
|
1478 |
+
|
1479 |
+
return array_merge( $columns,
|
1480 |
+
array( 'page_visit_count' => __( 'Total Visits', 'page-visit-counter' ) ) );
|
1481 |
+
|
1482 |
+
|
1483 |
}
|
1484 |
+
|
1485 |
function custom_columns_add_page_visit_count( $column, $post_id ) {
|
1486 |
+
global $wpdb, $wp;
|
1487 |
+
if ( $column == 'page_visit_count' ) {
|
1488 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1489 |
+
$pageCount = $wpdb->get_results( "SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id" );
|
1490 |
+
$total = (int) $pageCount[0]->total;
|
1491 |
+
echo $total;
|
|
|
1492 |
}
|
1493 |
+
}
|
1494 |
+
|
1495 |
+
function custom_meta_box_markup_page_visit( $object ) {
|
1496 |
global $wp, $wpdb;
|
1497 |
+
|
1498 |
+
$post_id = get_the_ID();
|
1499 |
+
$enable_page_count = get_post_meta( $post_id, "enable_page_count", true );
|
1500 |
+
$enable_page_count_day_wise = get_post_meta( $post_id, "enable_page_count_day_wise", true );
|
1501 |
+
|
1502 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1503 |
+
|
1504 |
+
$pageCount = $wpdb->get_results( "SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id" );
|
1505 |
+
|
1506 |
$total = (int) $pageCount[0]->total;
|
1507 |
?>
|
1508 |
+
<input name="pageidvisit" type="hidden" value="<?php echo $post_id; ?>">
|
1509 |
+
<p><?php echo __( 'Do you want to enable page visits count for this page?', 'page-visit-counter' ); ?></p>
|
1510 |
+
<p>
|
1511 |
+
<?php if ( $enable_page_count == '' ) { ?>
|
1512 |
+
<input type="radio" checked="checked" name="autoupdate_page_visit" id="autoupdate_page1"
|
1513 |
+
value="yes"><?php echo __( 'Yes', 'page-visit-counter' ); ?>
|
1514 |
+
<input type="radio" name="autoupdate_page_visit" id="autoupdate_page2"
|
1515 |
+
value="no"><?php echo __( 'No', 'page-visit-counter' ); ?>
|
1516 |
+
<?php } else { ?>
|
1517 |
+
<input type="radio" <?php if ( $enable_page_count == 'yes' ) { ?> checked="checked" <?php } ?>
|
1518 |
+
name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
|
1519 |
+
<input type="radio" <?php if ( $enable_page_count == 'no' ) { ?> checked="checked" <?php } ?>
|
1520 |
+
name="autoupdate_page_visit" id="autoupdate_page2" value="no">No<?php
|
1521 |
+
} ?>
|
1522 |
+
</p>
|
1523 |
+
<p><?php echo __( 'Do you want to display today page visits count for this page?', 'page-visit-counter' ); ?></p>
|
1524 |
+
<p>
|
1525 |
+
<?php if ( $enable_page_count_day_wise == '' ) { ?>
|
1526 |
+
<input type="radio" checked="checked" name="autoupdate_page_visit_day_wise"
|
1527 |
+
id="autoupdate_page1_day_wise" value="yes"><?php echo __( 'Yes', 'page-visit-counter' ); ?>
|
1528 |
+
<input type="radio" name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise"
|
1529 |
+
value="no"><?php echo __( 'No', 'page-visit-counter' ); ?>
|
1530 |
+
<?php } else { ?>
|
1531 |
+
<input type="radio" <?php if ( $enable_page_count_day_wise == 'yes' ) { ?> checked="checked" <?php } ?>
|
1532 |
+
name="autoupdate_page_visit_day_wise" id="autoupdate_page1_day_wise" value="yes"> Yes
|
1533 |
+
<input type="radio" <?php if ( $enable_page_count_day_wise == 'no' ) { ?> checked="checked" <?php } ?>
|
1534 |
+
name="autoupdate_page_visit_day_wise" id="autoupdate_page2_day_wise" value="no">No<?php
|
1535 |
+
} ?>
|
1536 |
+
</p>
|
1537 |
+
<p><?php echo __( 'Do you want to reset all visits count for this page?', 'page-visit-counter' ); ?></p>
|
1538 |
+
<p>
|
1539 |
+
<input type="radio" name="page_visit_reset" id="page_visit_reset_yes"
|
1540 |
+
value="yes"><?php echo __( 'Yes', 'page-visit-counter' ); ?>
|
1541 |
+
<input type="radio" checked="checked" name="page_visit_reset" id="page_visit_reset_yes"
|
1542 |
+
value="no"><?php echo __( 'No', 'page-visit-counter' ); ?>
|
1543 |
+
</p>
|
1544 |
+
<p><?php echo __( 'Total visits:', 'page-visit-counter' ); ?><?php echo $total; ?></p>
|
1545 |
<?php
|
1546 |
}
|
1547 |
}
|
1548 |
+
|
1549 |
+
|
1550 |
+
function save_custom_meta_box_page_visit( $post_id ) {
|
1551 |
+
global $wp, $wpdb, $post;
|
1552 |
+
|
1553 |
+
if ( ! current_user_can( "edit_post", $post_id ) ) {
|
1554 |
+
return $post_id;
|
1555 |
+
}
|
1556 |
+
|
1557 |
+
if ( defined( "DOING_AUTOSAVE" ) && DOING_AUTOSAVE ) {
|
1558 |
+
return $post_id;
|
1559 |
+
}
|
1560 |
+
|
1561 |
+
if ( isset( $_POST["autoupdate_page_visit"] ) ) {
|
1562 |
+
update_post_meta( $post_id, "enable_page_count", $_POST["autoupdate_page_visit"] );
|
1563 |
+
}
|
1564 |
+
|
1565 |
+
if ( isset( $_POST["autoupdate_page_visit_day_wise"] ) ) {
|
1566 |
+
update_post_meta( $post_id, "enable_page_count_day_wise", $_POST["autoupdate_page_visit_day_wise"] );
|
1567 |
+
}
|
1568 |
+
|
1569 |
+
if ( isset( $_POST["page_visit_reset"] ) && 'yes' === $_POST["page_visit_reset"] ) {
|
1570 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1571 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1572 |
$query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
|
1573 |
+
|
1574 |
+
$pageCount = $wpdb->query( $query );
|
1575 |
+
|
1576 |
+
$table_name = $wpdb->prefix . "page_visit_history";
|
1577 |
+
$query = "DELETE FROM $table_name WHERE `page_id` = $post_id";
|
1578 |
+
$wpdb->query( $query );
|
1579 |
+
}
|
1580 |
+
|
1581 |
}
|
1582 |
|
1583 |
+
|
1584 |
function check_page_visit_history_table_exisit() {
|
1585 |
global $wpdb, $wp;
|
1586 |
+
|
1587 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1588 |
+
if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) {
|
1589 |
$sql = "CREATE TABLE $table_name (
|
1590 |
id int(11) unsigned NOT NULL AUTO_INCREMENT,
|
1591 |
page_id int(11) NOT NULL,
|
1598 |
os varchar(255) NOT NULL,
|
1599 |
http_referer varchar(255) NOT NULL,
|
1600 |
PRIMARY KEY (id)
|
1601 |
+
);";
|
1602 |
+
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
1603 |
+
dbDelta( $sql );
|
1604 |
+
//add_option( 'contact_db_version', $contact_db_version );
|
1605 |
}
|
1606 |
+
|
1607 |
}
|
1608 |
+
|
1609 |
function get_page_visit_record_report() {
|
1610 |
global $wpdb;
|
1611 |
+
|
1612 |
$table_name = $wpdb->prefix . "page_visit_history";
|
1613 |
+
|
1614 |
$pageId = $_REQUEST['page_id'];
|
1615 |
+
|
1616 |
$countQuery = "SELECT COUNT(`page_id`) as total FROM $table_name WHERE `page_id` = $pageId";
|
1617 |
+
$result = $wpdb->get_results( $countQuery );
|
1618 |
+
|
1619 |
+
if ( (int) $result[0]->total > 0 ) {
|
1620 |
+
|
1621 |
$queryTopBrowser = "SELECT COUNT(`page_id`) as total, `browser_full_name` as browser FROM $table_name WHERE `page_id` = $pageId GROUP BY `browser_full_name`";
|
1622 |
+
|
1623 |
+
$topBrowserArr = $wpdb->get_results( $queryTopBrowser );
|
1624 |
+
|
1625 |
$topBrowserStringArr = array();
|
1626 |
+
|
1627 |
+
|
1628 |
$topBrowserStringArr['Browsers'] = 'Total Visits';
|
1629 |
+
if ( (int) $result[0]->total > 0 ) {
|
1630 |
+
foreach ( $topBrowserArr as $topBrowser ) {
|
1631 |
+
$topBrowserStringArr[ $topBrowser->browser ] = (int) $topBrowser->total;
|
1632 |
+
}
|
1633 |
}
|
1634 |
+
|
1635 |
//$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";
|
1636 |
$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";
|
1637 |
+
|
1638 |
+
$topIpArr = $wpdb->get_results( $queryTopIpAddress );
|
1639 |
+
|
1640 |
$topIpStringArr = array();
|
1641 |
+
|
1642 |
$topIpStringArr["IP Address"] = 'Total Visits';
|
1643 |
+
if ( (int) $result[0]->total > 0 ) {
|
1644 |
+
foreach ( $topIpArr as $topIp ) {
|
1645 |
+
$topIpStringArr["$topIp->ipaddress"] = (int) $topIp->total;
|
1646 |
+
}
|
1647 |
}
|
1648 |
+
|
1649 |
$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";
|
1650 |
+
|
1651 |
+
$topRefererArr = $wpdb->get_results( $queryTopReferer );
|
1652 |
+
|
1653 |
$topRefererStringArr = array();
|
1654 |
+
|
1655 |
$topRefererStringArr["Domain"] = 'Total Visits';
|
1656 |
+
if ( (int) $result[0]->total > 0 ) {
|
1657 |
+
foreach ( $topRefererArr as $topReferer ) {
|
1658 |
+
if ( ! array_key_exists( "$topReferer->domain", $topRefererStringArr ) ) {
|
1659 |
+
$topRefererStringArr["$topReferer->domain"] = (int) $topReferer->total;
|
1660 |
+
} else {
|
1661 |
+
$val = (int) $topRefererStringArr["$topReferer->domain"];
|
1662 |
+
$topRefererStringArr["$topReferer->domain"] = $val + (int) $topReferer->total;
|
1663 |
+
}
|
1664 |
}
|
1665 |
+
unset( $topRefererArr );
|
1666 |
}
|
1667 |
+
|
1668 |
+
$custom_page_visit_history_datatbase_table_name = $wpdb->prefix . "page_visit_history";
|
|
|
|
|
1669 |
//$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";
|
1670 |
$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";
|
1671 |
+
|
1672 |
+
$topWeeklyArr = $wpdb->get_results( $queryWeeklyReport );
|
1673 |
+
|
1674 |
$topWeeklyStringArr = array();
|
1675 |
+
|
1676 |
$topWeeklyStringArr["Week Year"] = 'Total Visits';
|
1677 |
+
if ( (int) $result[0]->total > 0 ) {
|
1678 |
+
foreach ( array_reverse( $topWeeklyArr ) as $topWeekly ) {
|
1679 |
+
$topWeeklyStringArr["$topWeekly->year - $topWeekly->week"] = (int) $topWeekly->total;
|
1680 |
+
}
|
1681 |
+
unset( $topWeeklyArr );
|
1682 |
}
|
1683 |
+
|
1684 |
$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";
|
1685 |
+
|
1686 |
+
$topMonthlyArr = $wpdb->get_results( $queryMonthlyReport );
|
1687 |
+
|
1688 |
$topMonthlyStringArr = array();
|
1689 |
+
|
1690 |
$topMonthlyStringArr["Month"] = "Total Visits";
|
1691 |
+
if ( (int) $result[0]->total > 0 ) {
|
1692 |
+
foreach ( $topMonthlyArr as $topMonthly ) {
|
1693 |
+
$topMonthlyStringArr["$topMonthly->month"] = (int) $topMonthly->total;
|
1694 |
+
}
|
1695 |
+
unset( $topMonthlyArr );
|
1696 |
}
|
1697 |
+
|
1698 |
$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";
|
1699 |
+
|
1700 |
+
$topYearlyArr = $wpdb->get_results( $queryYearlyReport );
|
1701 |
+
|
1702 |
$topYearlyStringArr = array();
|
1703 |
+
|
1704 |
+
foreach ( $topYearlyArr as $topYearly ) {
|
1705 |
$topYearlyStringArr["$topYearly->year"] = $topYearly->total;
|
1706 |
}
|
1707 |
+
unset( $topYearlyArr );
|
1708 |
+
|
1709 |
$resultsArr = array();
|
1710 |
+
|
1711 |
$resultsArr['topBrowserString'] = $topBrowserStringArr;
|
1712 |
+
$resultsArr['topIpString'] = $topIpStringArr;
|
1713 |
$resultsArr['topRefererString'] = $topRefererStringArr;
|
1714 |
+
$resultsArr['topWeeklyString'] = $topWeeklyStringArr;
|
1715 |
$resultsArr['topMonthlyString'] = $topMonthlyStringArr;
|
1716 |
+
$resultsArr['topYearlyString'] = $topYearlyStringArr;
|
1717 |
+
|
1718 |
+
echo json_encode( $resultsArr );
|
1719 |
+
unset( $resultsArr );
|
1720 |
//print_r($topBrowserStringArr);
|
1721 |
} else {
|
1722 |
+
echo json_encode( 'novisit' );
|
1723 |
}
|
1724 |
+
|
1725 |
die();
|
1726 |
+
}
|
1727 |
+
|
1728 |
+
|
1729 |
public function custom_admin_pointers_footer() {
|
1730 |
+
$admin_pointers = custom_admin_pointers();
|
1731 |
+
?>
|
1732 |
+
<script type="text/javascript">
|
1733 |
+
/* <![CDATA[ */
|
1734 |
+
(function ($) {
|
1735 |
+
<?php
|
1736 |
+
foreach ( $admin_pointers as $pointer => $array ) {
|
1737 |
+
if ( $array['active'] ) {
|
1738 |
+
?>
|
1739 |
+
$('<?php echo $array['anchor_id']; ?>').pointer({
|
1740 |
+
content: '<?php echo $array['content']; ?>',
|
1741 |
+
position: {
|
1742 |
+
edge: '<?php echo $array['edge']; ?>',
|
1743 |
+
align: '<?php echo $array['align']; ?>'
|
1744 |
+
},
|
1745 |
+
close: function () {
|
1746 |
+
$.post(ajaxurl, {
|
1747 |
+
pointer: '<?php echo $pointer; ?>',
|
1748 |
+
action: 'dismiss-wp-pointer'
|
1749 |
+
});
|
1750 |
+
}
|
1751 |
+
}).pointer('open');
|
1752 |
+
<?php
|
1753 |
+
}
|
1754 |
+
}
|
1755 |
+
?>
|
1756 |
+
})(jQuery);
|
1757 |
+
/* ]]> */
|
1758 |
+
</script>
|
1759 |
+
<?php
|
1760 |
+
}
|
1761 |
+
|
1762 |
+
|
1763 |
/**
|
1764 |
* Function For display pointer in admin side
|
1765 |
+
*
|
1766 |
*/
|
1767 |
+
|
1768 |
+
|
|
|
1769 |
}
|
1770 |
+
|
1771 |
/**
|
1772 |
* The Widget functionality for this plugin.
|
1773 |
* widget provide Most visited page.
|
1774 |
*
|
1775 |
*/
|
1776 |
+
class My_Widget extends WP_Widget {
|
1777 |
+
public function __construct() {
|
1778 |
+
$widget_ops = array( 'classname' => 'My_Widget', 'description' => 'Most Visited Pages' );
|
1779 |
+
parent::__construct( 'My_Widget', 'Recent Most Visit page', $widget_ops );
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
function widget( $args, $instance ) {
|
1783 |
+
global $wpdb;
|
1784 |
+
$table_name = $wpdb->prefix . "page_visit";
|
1785 |
+
$html = '';
|
1786 |
+
extract( $args, EXTR_SKIP );
|
1787 |
+
$title = empty( $instance['title'] ) ? ' ' : apply_filters( 'widget_title', $instance['title'] );
|
1788 |
+
$html .= ( isset( $before_widget ) ? $before_widget : '' );
|
1789 |
+
if ( ! empty( $title ) ) {
|
1790 |
+
$html .= $before_title . $title . $after_title;
|
|
|
|
|
|
|
|
|
|
|
1791 |
}
|
1792 |
+
$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" );
|
1793 |
+
foreach ( $count_visit as $visitpage ) {
|
1794 |
+
$page = get_post( $visitpage->page_id );
|
1795 |
+
$html .= '<h6 style="font-size: 14px;font-weight: normal;line-height: 14px;">' . $page->post_title . '</h6>';
|
1796 |
+
$html .= "<br>";
|
1797 |
+
}
|
1798 |
+
$html .= ( isset( $after_widget ) ? $after_widget : '' );
|
1799 |
+
echo $html;
|
1800 |
+
}
|
1801 |
+
|
1802 |
+
public function form( $instance ) {
|
1803 |
+
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
|
1804 |
+
$title = $instance['title'];
|
1805 |
+
$html = '';
|
1806 |
+
$html .= '<p> <label for="' . $this->get_field_id( "title" ) . '">Title:
|
1807 |
+
<input class="widefat" id="' . $this->get_field_id( "title" ) . '"
|
1808 |
+
name="' . $this->get_field_name( "title" ) . '" type="text"
|
1809 |
+
value="' . attribute_escape( $title ) . '" /></label></p>';
|
1810 |
+
echo $html;
|
1811 |
+
}
|
1812 |
+
|
1813 |
+
function update( $new_instance, $old_instance ) {
|
1814 |
+
$instance = $old_instance;
|
1815 |
+
$instance['title'] = $new_instance['title'];
|
1816 |
+
|
1817 |
+
return $instance;
|
1818 |
+
}
|
1819 |
}
|
1820 |
+
|
1821 |
+
add_action( 'widgets_init', create_function( '', 'return register_widget("My_Widget");' ) );
|
1822 |
+
|
1823 |
+
function custom_admin_pointers() {
|
1824 |
+
|
1825 |
+
$dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
|
1826 |
+
$version = '1_0'; // replace all periods in 1.0 with an underscore
|
1827 |
+
$prefix = 'custom_admin_pointers' . $version . '_';
|
1828 |
+
|
1829 |
+
$new_pointer_content = '<h3>' . __( 'Page Visit Counter' ) . '</h3>';
|
1830 |
+
$new_pointer_content .= '<p>' . __( 'This plugin will count the total visits of your sites pages.' ) . '</p>';
|
1831 |
+
|
1832 |
+
return array(
|
1833 |
+
$prefix . 'page_visit_counter_notice_view' => array(
|
1834 |
+
'content' => $new_pointer_content,
|
1835 |
+
'anchor_id' => '#toplevel_page_page_visit_counter',
|
1836 |
+
'edge' => 'left',
|
1837 |
+
'align' => 'left',
|
1838 |
+
'active' => ( ! in_array( $prefix . 'page_visit_counter_notice_view', $dismissed ) )
|
1839 |
+
)
|
1840 |
+
);
|
1841 |
+
|
1842 |
+
}
|
admin/js/custom.js
CHANGED
@@ -1,338 +1,344 @@
|
|
1 |
-
(function(
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
//
|
249 |
-
//
|
250 |
-
// if($("#
|
251 |
-
//
|
252 |
-
// } else {
|
253 |
-
//
|
254 |
-
// }
|
255 |
-
//
|
256 |
-
// if($("#
|
257 |
-
//
|
258 |
-
// } else {
|
259 |
-
//
|
260 |
-
// }
|
261 |
-
//
|
262 |
-
//
|
263 |
-
//
|
264 |
-
//
|
265 |
-
//
|
266 |
-
//
|
267 |
-
// if($(
|
268 |
-
//
|
269 |
-
// } else {
|
270 |
-
//
|
271 |
-
// }
|
272 |
-
//
|
273 |
-
// if($("#
|
274 |
-
//
|
275 |
-
// } else {
|
276 |
-
//
|
277 |
-
// }
|
278 |
-
//
|
279 |
-
// if($("#
|
280 |
-
//
|
281 |
-
// } else {
|
282 |
-
//
|
283 |
-
// }
|
284 |
-
//
|
285 |
-
// if($("#
|
286 |
-
//
|
287 |
-
// } else {
|
288 |
-
//
|
289 |
-
// }
|
290 |
-
//
|
291 |
-
//
|
292 |
-
//
|
293 |
-
//
|
294 |
-
//
|
295 |
-
//
|
296 |
-
//
|
297 |
-
//
|
298 |
-
//
|
299 |
-
//
|
300 |
-
//
|
301 |
-
//
|
302 |
-
//
|
303 |
-
//
|
304 |
-
//
|
305 |
-
//
|
306 |
-
//
|
307 |
-
//
|
308 |
-
//
|
309 |
-
//
|
310 |
-
//
|
311 |
-
// }
|
312 |
-
//
|
313 |
-
//
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
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);
|
includes/class-page-visit-counter.php
CHANGED
@@ -146,8 +146,7 @@ class page_visit_counter {
|
|
146 |
$this->loader->add_action( 'wp_ajax_nopriv_select_input_page_value', $plugin_admin, 'select_input_page_value' );
|
147 |
|
148 |
$this->loader->add_action( 'wp_ajax_add_plugin_user_pvcp', $plugin_admin, 'wp_add_plugin_userfn' );
|
149 |
-
|
150 |
-
|
151 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_custom_meta_box_page_visit' );
|
152 |
|
153 |
$this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
|
@@ -223,8 +222,7 @@ class page_visit_counter {
|
|
223 |
$this->loader->add_action( 'the_content', $plugin_public, 'insert_page_visit_counter_total_block',99 );
|
224 |
//$this->loader->add_action( 'wp_loaded', $plugin_public, 'insert_page_visit_counter_total_block',99 );
|
225 |
//$this->loader->add_action( 'get_footer', $plugin_public, 'insert_page_visit_counter_total_block',99 );
|
226 |
-
|
227 |
-
$this->loader->add_action( 'wp_head', $plugin_public, 'add_meta_tags_page_visit',10);
|
228 |
//add_action( 'wp_head', 'add_meta_tags_page_visit',1);
|
229 |
|
230 |
if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
|
146 |
$this->loader->add_action( 'wp_ajax_nopriv_select_input_page_value', $plugin_admin, 'select_input_page_value' );
|
147 |
|
148 |
$this->loader->add_action( 'wp_ajax_add_plugin_user_pvcp', $plugin_admin, 'wp_add_plugin_userfn' );
|
149 |
+
|
|
|
150 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_custom_meta_box_page_visit' );
|
151 |
|
152 |
$this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
|
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')))) {
|
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.
|
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.4
|
11 |
* Author URI: http://www.multidots.com/
|
12 |
*/
|
13 |
// If this file is called directly, abort.
|
public/class-page-visit-counter-public.php
CHANGED
@@ -737,47 +737,7 @@ class page_visit_counter_Public {
|
|
737 |
}
|
738 |
|
739 |
}
|
740 |
-
|
741 |
-
public function add_meta_tags_page_visit() {
|
742 |
-
global $wpdb, $wp, $post;
|
743 |
-
$page_title = get_the_title();
|
744 |
-
$page_id = get_the_ID();
|
745 |
-
|
746 |
-
if ($page_id == '') {
|
747 |
-
if (is_ssl()) {
|
748 |
-
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
749 |
-
$page_id = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$actual_link));
|
750 |
-
} else {
|
751 |
-
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
752 |
-
$page_id = url_to_postid( $actual_link );
|
753 |
-
}
|
754 |
-
|
755 |
-
if (($_SERVER['REQUEST_URI'] == '/shop/' || strpos($_SERVER['REQUEST_URI'], '/shop/') !== false ) && $pageID == 0) {
|
756 |
-
$page_id = (int) get_option( 'woocommerce_shop_page_id' );
|
757 |
-
}
|
758 |
-
}
|
759 |
-
|
760 |
-
$site_title = get_bloginfo( 'name' );
|
761 |
-
|
762 |
-
$table_name = $wpdb->prefix."page_visit";
|
763 |
-
$pageCount = '';
|
764 |
-
if ( !empty( $page_id ) && $page_id !='' ) {
|
765 |
-
//$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM `$table_name` WHERE `page_id` = $page_id");
|
766 |
-
$pageCount = $wpdb->get_results("SELECT SUM(`page_visit`) as total FROM `$table_name` WHERE `page_id` = $page_id");
|
767 |
-
}
|
768 |
-
|
769 |
-
$total = (int) isset( $pageCount[0]->total ) ? $pageCount[0]->total : 0;
|
770 |
-
$page_social_content = $page_title.' | Total Visits '.$total.' | '.$site_title;
|
771 |
-
$current_page_url = get_page_link($page_id);
|
772 |
-
echo '<meta property="og:locale" content="en_US" />
|
773 |
-
<meta property="og:title" content="'.$page_social_content.'" />
|
774 |
-
<meta property="og:url" content="'.$current_page_url.'" />
|
775 |
-
<meta property="og:site_name" content="'.$site_title.'" />
|
776 |
-
<meta name="twitter:card" content="summary_large_image"/>
|
777 |
-
<meta name="twitter:title" content="'.$page_social_content.'"/>
|
778 |
-
';
|
779 |
-
|
780 |
-
}
|
781 |
|
782 |
/**
|
783 |
* BN code added
|
737 |
}
|
738 |
|
739 |
}
|
740 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
|
742 |
/**
|
743 |
* BN code added
|