Version Description
Automatic updates should work great for you. As always, though, we recommend backing up your site prior to making any updates just to be sure nothing goes wrong.
Download this release
Release Info
Developer | dots |
Plugin | Page Visit Counter |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.1 to 2.0.2
- README.txt +9 -1
- admin/class-page-visit-counter-admin.php +50 -7
- admin/css/style.css +2 -1
- admin/js/custom.js +8 -1
- includes/class-page-visit-counter-activator.php +2 -0
- includes/class-page-visit-counter.php +34 -3
- page_visit_counter.php +3 -3
- public/class-page-visit-counter-public.php +82 -51
README.txt
CHANGED
@@ -4,7 +4,7 @@ Plugin URI: http://multidots.com/
|
|
4 |
Author: Multidots
|
5 |
Author URI: http://multidots.com/
|
6 |
Contributors: dots
|
7 |
-
Stable tag: 2.0.
|
8 |
Tags: page counter,page visit
|
9 |
Requires at least: 2.1
|
10 |
Tested up to: 4.4.2
|
@@ -99,3 +99,11 @@ Automatic updates should work great for you. As always, though, we recommend ba
|
|
99 |
= 2.0.1 - 24.02.2016 =
|
100 |
* Fixies - PHP error notice handled.
|
101 |
* New - Remove counter for the homepage.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
Author: Multidots
|
5 |
Author URI: http://multidots.com/
|
6 |
Contributors: dots
|
7 |
+
Stable tag: 2.0.2
|
8 |
Tags: page counter,page visit
|
9 |
Requires at least: 2.1
|
10 |
Tested up to: 4.4.2
|
99 |
= 2.0.1 - 24.02.2016 =
|
100 |
* Fixies - PHP error notice handled.
|
101 |
* New - Remove counter for the homepage.
|
102 |
+
|
103 |
+
= 2.0.2 - 25.02.2016 =
|
104 |
+
* Fixies - PHP error notice handled.
|
105 |
+
* Fixies - Fixed the display issue on WooCommerce single product page.
|
106 |
+
* New - Added global option on plugin settings page to hide the total visits block fron front end.
|
107 |
+
* New - Added counter on the WooCommerce shop page.
|
108 |
+
* New - Added total visit count on single post/page edit view in admin side meta box.
|
109 |
+
* New - Added total visit count on single post/page listing view in admin side.
|
admin/class-page-visit-counter-admin.php
CHANGED
@@ -279,6 +279,16 @@ class page_visit_counter_Admin {
|
|
279 |
$html .='</select><span class="information">(Select the users to be excluded from post views count.)</span>
|
280 |
</td>';
|
281 |
$html .='</tr>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
$html .='<tr>';
|
283 |
$html .='<td><input type="button" name="submit" class="pagecountsubmit button" value="Save"></td>';
|
284 |
$html .='<td class="record-mesage"></td>';
|
@@ -350,6 +360,7 @@ class page_visit_counter_Admin {
|
|
350 |
$type = isset($_POST['selected_posttype']) ? $_POST['selected_posttype'] : '';
|
351 |
$ipAddress = isset($_POST['ipaddress']) ? $_POST['ipaddress'] : '';
|
352 |
$userList = isset($_POST['userlist']) ? $_POST['userlist'] : '';
|
|
|
353 |
|
354 |
delete_option('wfap_post_type');
|
355 |
if (isset($type) && $type != null) {
|
@@ -365,6 +376,9 @@ class page_visit_counter_Admin {
|
|
365 |
if (isset($userList) && $userList != null) {
|
366 |
update_option('userlist_visit',json_encode(array_values($userList)));
|
367 |
}
|
|
|
|
|
|
|
368 |
|
369 |
echo $type;
|
370 |
|
@@ -557,7 +571,7 @@ class page_visit_counter_Admin {
|
|
557 |
if (isset($fetchSelecetedPostTypes) && !empty($fetchSelecetedPostTypes)) {
|
558 |
$i = 0;
|
559 |
foreach ($fetchSelecetedPostTypes as $postsingle) {
|
560 |
-
add_meta_box("header-meta-box-page-visit-$i", "
|
561 |
$i++;
|
562 |
}
|
563 |
} else {
|
@@ -566,28 +580,57 @@ class page_visit_counter_Admin {
|
|
566 |
$post_types = get_post_types();
|
567 |
foreach ($post_types as $cpost) {
|
568 |
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") {
|
569 |
-
add_meta_box("header-meta-box-page-visit-$i", "
|
570 |
$i++;
|
571 |
}
|
572 |
}
|
573 |
}
|
574 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
575 |
function custom_meta_box_markup_page_visit($object) {
|
576 |
global $wp, $wpdb;
|
|
|
577 |
$post_id = get_the_ID();
|
578 |
-
$facebook_auto = get_post_meta($post_id, "get_page_count", true)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
579 |
<input name="pageidvisit" type="hidden" value="<?php echo $post_id; ?>">
|
580 |
-
|
|
|
581 |
<?php if ($facebook_auto == '') { ?>
|
582 |
<input type="radio" checked ="checked" name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
|
583 |
-
<input type="radio" name="autoupdate_page_visit" id="autoupdate_page2" value="no">No
|
584 |
<?php } else { ?>
|
585 |
<input type="radio" <?php if($facebook_auto=='yes'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
|
586 |
-
<input type="radio" <?php if($facebook_auto=='no'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page2" value="no">No
|
587 |
-
}
|
|
|
|
|
588 |
}
|
589 |
}
|
590 |
|
|
|
|
|
591 |
function save_custom_meta_box_page_visit($post_id) {
|
592 |
global $wp, $wpdb, $post;
|
593 |
|
279 |
$html .='</select><span class="information">(Select the users to be excluded from post views count.)</span>
|
280 |
</td>';
|
281 |
$html .='</tr>';
|
282 |
+
$html .='<tr class="hidefront">';
|
283 |
+
$html .='<td>Hide front view counter</td>';
|
284 |
+
$hide_show_option = get_option('counter_hide_show_front_vew');
|
285 |
+
if($hide_show_option == 1){
|
286 |
+
$cheked = 'checked';
|
287 |
+
} else {
|
288 |
+
$cheked = '';
|
289 |
+
}
|
290 |
+
$html .='<td class="information"><input type="checkbox" name="hidefrontview" id="hide_front_view" '.$cheked.' >Uncheck the box if you don\'t want to display counter view on front end.</td>';
|
291 |
+
$html .='</tr>';
|
292 |
$html .='<tr>';
|
293 |
$html .='<td><input type="button" name="submit" class="pagecountsubmit button" value="Save"></td>';
|
294 |
$html .='<td class="record-mesage"></td>';
|
360 |
$type = isset($_POST['selected_posttype']) ? $_POST['selected_posttype'] : '';
|
361 |
$ipAddress = isset($_POST['ipaddress']) ? $_POST['ipaddress'] : '';
|
362 |
$userList = isset($_POST['userlist']) ? $_POST['userlist'] : '';
|
363 |
+
$hidefrontview = isset($_POST['hidefrontview']) ? $_POST['hidefrontview'] :'';
|
364 |
|
365 |
delete_option('wfap_post_type');
|
366 |
if (isset($type) && $type != null) {
|
376 |
if (isset($userList) && $userList != null) {
|
377 |
update_option('userlist_visit',json_encode(array_values($userList)));
|
378 |
}
|
379 |
+
if( isset($hidefrontview) && $hidefrontview != null ){
|
380 |
+
update_option('counter_hide_show_front_vew',$hidefrontview);
|
381 |
+
}
|
382 |
|
383 |
echo $type;
|
384 |
|
571 |
if (isset($fetchSelecetedPostTypes) && !empty($fetchSelecetedPostTypes)) {
|
572 |
$i = 0;
|
573 |
foreach ($fetchSelecetedPostTypes as $postsingle) {
|
574 |
+
add_meta_box("header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$postsingle", "side", "high", null);
|
575 |
$i++;
|
576 |
}
|
577 |
} else {
|
580 |
$post_types = get_post_types();
|
581 |
foreach ($post_types as $cpost) {
|
582 |
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") {
|
583 |
+
add_meta_box("header-meta-box-page-visit-$i", "Page Visit Counter", "custom_meta_box_markup_page_visit", "$cpost", "side", "high", null);
|
584 |
$i++;
|
585 |
}
|
586 |
}
|
587 |
}
|
588 |
|
589 |
+
function add_new_selected_post_columns($columns) {
|
590 |
+
|
591 |
+
return array_merge( $columns,
|
592 |
+
array( 'page_visit_count' => __( 'Total Visits', 'page-visit-counter' ) ) );
|
593 |
+
|
594 |
+
|
595 |
+
}
|
596 |
+
function custom_columns_add_page_visit_count( $column, $post_id ) {
|
597 |
+
global $wpdb, $wp;
|
598 |
+
if ($column == 'page_visit_count'){
|
599 |
+
$table_name = $wpdb->prefix."page_visit";
|
600 |
+
$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id");
|
601 |
+
$total = (int) $pageCount[0]->total;
|
602 |
+
echo $total;
|
603 |
+
}
|
604 |
+
}
|
605 |
function custom_meta_box_markup_page_visit($object) {
|
606 |
global $wp, $wpdb;
|
607 |
+
|
608 |
$post_id = get_the_ID();
|
609 |
+
$facebook_auto = get_post_meta($post_id, "get_page_count", true);
|
610 |
+
|
611 |
+
$table_name = $wpdb->prefix."page_visit";
|
612 |
+
|
613 |
+
$pageCount = $wpdb->get_results("SELECT SUM(page_visit) as total FROM $table_name WHERE `page_id` = $post_id");
|
614 |
+
|
615 |
+
$total = (int) $pageCount[0]->total;
|
616 |
+
?>
|
617 |
<input name="pageidvisit" type="hidden" value="<?php echo $post_id; ?>">
|
618 |
+
<p>Do you want to enable page visits count for this page?</p>
|
619 |
+
<p>
|
620 |
<?php if ($facebook_auto == '') { ?>
|
621 |
<input type="radio" checked ="checked" name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
|
622 |
+
<input type="radio" name="autoupdate_page_visit" id="autoupdate_page2" value="no">No</p>
|
623 |
<?php } else { ?>
|
624 |
<input type="radio" <?php if($facebook_auto=='yes'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page1" value="yes"> Yes
|
625 |
+
<input type="radio" <?php if($facebook_auto=='no'){ ?> checked ="checked" <?php } ?> name="autoupdate_page_visit" id="autoupdate_page2" value="no">No</p><?php
|
626 |
+
} ?>
|
627 |
+
<p>Total visits: <?php echo $total; ?></p>
|
628 |
+
<?php
|
629 |
}
|
630 |
}
|
631 |
|
632 |
+
|
633 |
+
|
634 |
function save_custom_meta_box_page_visit($post_id) {
|
635 |
global $wp, $wpdb, $post;
|
636 |
|
admin/css/style.css
CHANGED
@@ -33,4 +33,5 @@ div.page-visit-summery a#example_next{border-radius: 5px;padding: 5px 10px;backg
|
|
33 |
.main-page-visit .page-input-text input {width: 200px;height: 30px;line-height: 30px;padding-left: 10px;text-transform: capitalize;}
|
34 |
.main-page-visit .page-input-text a#search-submit {margin-left: 10px;margin-top: 2px;text-transform: uppercase;}
|
35 |
.page-settings-summery pre {margin: 0;text-transform: initial;font-weight: bold;white-space: inherit;display: initial;}
|
36 |
-
.page-settings-summery form table tr td span.information {float: left;width: 100%;font-size: 11px;text-transform: none;}
|
|
33 |
.main-page-visit .page-input-text input {width: 200px;height: 30px;line-height: 30px;padding-left: 10px;text-transform: capitalize;}
|
34 |
.main-page-visit .page-input-text a#search-submit {margin-left: 10px;margin-top: 2px;text-transform: uppercase;}
|
35 |
.page-settings-summery pre {margin: 0;text-transform: initial;font-weight: bold;white-space: inherit;display: initial;}
|
36 |
+
.page-settings-summery form table tr td span.information {float: left;width: 100%;font-size: 11px;text-transform: none;}
|
37 |
+
.page-settings-summery form table tr.hidefront td.information {font-size: 11px;}
|
admin/js/custom.js
CHANGED
@@ -169,6 +169,7 @@
|
|
169 |
var ipaddress = [];
|
170 |
var userlist = [];
|
171 |
var postlist = [];
|
|
|
172 |
$('body').on('click',".pagecountsubmit",function() {
|
173 |
|
174 |
if($("#ip_address").val()) {
|
@@ -188,6 +189,11 @@
|
|
188 |
} else {
|
189 |
postlist = [];
|
190 |
}
|
|
|
|
|
|
|
|
|
|
|
191 |
|
192 |
$.ajax({
|
193 |
type: "POST",
|
@@ -197,7 +203,8 @@
|
|
197 |
action:'add_page_count_option',
|
198 |
selected_posttype:unique(postlist),
|
199 |
ipaddress:unique(ipaddress),
|
200 |
-
userlist:unique(userlist)
|
|
|
201 |
}),
|
202 |
success: function(data) {
|
203 |
$("td.record-mesage").empty();
|
169 |
var ipaddress = [];
|
170 |
var userlist = [];
|
171 |
var postlist = [];
|
172 |
+
var hidefrontview ='';
|
173 |
$('body').on('click',".pagecountsubmit",function() {
|
174 |
|
175 |
if($("#ip_address").val()) {
|
189 |
} else {
|
190 |
postlist = [];
|
191 |
}
|
192 |
+
if($('#hide_front_view').attr('checked')) {
|
193 |
+
var checked_val = '1';
|
194 |
+
} else {
|
195 |
+
var checked_val = '0';
|
196 |
+
}
|
197 |
|
198 |
$.ajax({
|
199 |
type: "POST",
|
203 |
action:'add_page_count_option',
|
204 |
selected_posttype:unique(postlist),
|
205 |
ipaddress:unique(ipaddress),
|
206 |
+
userlist:unique(userlist),
|
207 |
+
hidefrontview:checked_val
|
208 |
}),
|
209 |
success: function(data) {
|
210 |
$("td.record-mesage").empty();
|
includes/class-page-visit-counter-activator.php
CHANGED
@@ -44,6 +44,8 @@ class class_Page_Visit_Activator {
|
|
44 |
//add_option( 'contact_db_version', $contact_db_version );
|
45 |
}
|
46 |
|
|
|
|
|
47 |
if( in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins'))) && !is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
|
48 |
$flag = '1';
|
49 |
} else {
|
44 |
//add_option( 'contact_db_version', $contact_db_version );
|
45 |
}
|
46 |
|
47 |
+
update_option('counter_hide_show_front_vew','1');
|
48 |
+
|
49 |
if( in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins'))) && !is_plugin_active_for_network( 'woocommerce/woocommerce.php' ) ) {
|
50 |
$flag = '1';
|
51 |
} else {
|
includes/class-page-visit-counter.php
CHANGED
@@ -104,7 +104,8 @@ class page_visit_counter {
|
|
104 |
* @access private
|
105 |
*/
|
106 |
private function define_admin_hooks() {
|
107 |
-
|
|
|
108 |
$plugin_admin = new page_visit_counter_Admin( $this->get_plugin_name(), $this->get_version() );
|
109 |
|
110 |
$this->loader->add_action( 'admin_enqueue_scripts',$plugin_admin, 'enqueue_styles' );
|
@@ -119,8 +120,37 @@ class page_visit_counter {
|
|
119 |
$this->loader->add_action( 'wp_ajax_nopriv_select_input_page_value', $plugin_admin, 'select_input_page_value' );
|
120 |
|
121 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_custom_meta_box_page_visit' );
|
|
|
122 |
$this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
|
123 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
}
|
125 |
|
126 |
/**
|
@@ -131,7 +161,8 @@ class page_visit_counter {
|
|
131 |
* @access private
|
132 |
*/
|
133 |
private function define_public_hooks() {
|
134 |
-
|
|
|
135 |
$plugin_public = new page_visit_counter_Public( $this->get_plugin_name(), $this->get_version() );
|
136 |
|
137 |
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
@@ -145,7 +176,7 @@ class page_visit_counter {
|
|
145 |
|
146 |
$this->loader->add_action( 'wp', $plugin_public, 'insert_page_visit_counter' );
|
147 |
|
148 |
-
$this->loader->
|
149 |
|
150 |
if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
|
151 |
$this->loader->add_filter( 'woocommerce_paypal_args', $plugin_public, 'paypal_bn_code_filter',99,1 );
|
104 |
* @access private
|
105 |
*/
|
106 |
private function define_admin_hooks() {
|
107 |
+
global $wp, $wpdb;
|
108 |
+
|
109 |
$plugin_admin = new page_visit_counter_Admin( $this->get_plugin_name(), $this->get_version() );
|
110 |
|
111 |
$this->loader->add_action( 'admin_enqueue_scripts',$plugin_admin, 'enqueue_styles' );
|
120 |
$this->loader->add_action( 'wp_ajax_nopriv_select_input_page_value', $plugin_admin, 'select_input_page_value' );
|
121 |
|
122 |
$this->loader->add_action( 'admin_init', $plugin_admin, 'add_custom_meta_box_page_visit' );
|
123 |
+
|
124 |
$this->loader->add_action( 'save_post', $plugin_admin, 'save_custom_meta_box_page_visit' );
|
125 |
|
126 |
+
add_action( 'wp_loaded', function ()
|
127 |
+
{
|
128 |
+
$fetchSelecetedPostTypes = json_decode(get_option('wfap_post_type'));
|
129 |
+
if (isset($fetchSelecetedPostTypes) && !empty($fetchSelecetedPostTypes)) {
|
130 |
+
foreach ($fetchSelecetedPostTypes as $postsingle) {
|
131 |
+
add_filter("manage_edit-".$postsingle."_columns", "add_new_selected_post_columns");
|
132 |
+
add_action("manage_".$postsingle."_posts_custom_column" , "custom_columns_add_page_visit_count",10,2);
|
133 |
+
}
|
134 |
+
} else {
|
135 |
+
// Get all the registered post type
|
136 |
+
global $wp_post_types;
|
137 |
+
$post_types = get_post_types();
|
138 |
+
//$post_types = $wpdb->get_results($query);
|
139 |
+
// foreach ($post_types as $cpost) {
|
140 |
+
// if($cpost->post_type != "attachment" && $cpost->post_type != "revision" && $cpost->post_type != "nav_menu_item" && $cpost->post_type != "product_variation" && $cpost->post_type != "shop_order" && $cpost->post_type != "shop_order_refund" && $cpost->post_type != "shop_coupon" && $cpost->post_type != "shop_webhook" && $cpost->post_type != "scheduled-action" && $cpost->post_type != "shop_subscription"&& $cpost->post_type != "wpcf7_contact_form"&& $cpost->post_type != "mc4wp-form") {
|
141 |
+
// add_filter("manage_edit-".$cpost->post_type."_columns", "add_new_selected_post_columns");
|
142 |
+
// add_action("manage_".$cpost->post_type."_posts_custom_column" , "custom_columns_add_page_visit_count",2,2);
|
143 |
+
// }
|
144 |
+
// }
|
145 |
+
foreach ($post_types as $cpost) {
|
146 |
+
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") {
|
147 |
+
add_filter("manage_edit-".$cpost."_columns", "add_new_selected_post_columns");
|
148 |
+
add_action("manage_".$cpost."_posts_custom_column" , "custom_columns_add_page_visit_count",2,2);
|
149 |
+
}
|
150 |
+
}
|
151 |
+
}
|
152 |
+
});
|
153 |
+
|
154 |
}
|
155 |
|
156 |
/**
|
161 |
* @access private
|
162 |
*/
|
163 |
private function define_public_hooks() {
|
164 |
+
global $wp, $wpdb;
|
165 |
+
|
166 |
$plugin_public = new page_visit_counter_Public( $this->get_plugin_name(), $this->get_version() );
|
167 |
|
168 |
$this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
|
176 |
|
177 |
$this->loader->add_action( 'wp', $plugin_public, 'insert_page_visit_counter' );
|
178 |
|
179 |
+
$this->loader->add_action( 'get_footer', $plugin_public, 'insert_page_visit_counter_total_block',99 );
|
180 |
|
181 |
if (in_array( 'woocommerce/woocommerce.php',apply_filters('active_plugins',get_option('active_plugins')))) {
|
182 |
$this->loader->add_filter( 'woocommerce_paypal_args', $plugin_public, 'paypal_bn_code_filter',99,1 );
|
page_visit_counter.php
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
* Plugin URI: http://www.multidots.com/
|
8 |
* Description: Plugin for show visited page
|
9 |
* Author: Multidots
|
10 |
-
* Version: 2.0.
|
11 |
* Author URI: http://www.multidots.com/
|
12 |
*/
|
13 |
// If this file is called directly, abort.
|
@@ -109,13 +109,13 @@ function display_page_total_count($atts) {
|
|
109 |
$total = (int) $pageCount[0]->total;
|
110 |
|
111 |
if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
|
112 |
-
$html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>total
|
113 |
} else {
|
114 |
$postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
|
115 |
if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
|
116 |
$innerSettings = get_post_meta($pageID,'get_page_count',true);
|
117 |
if ($innerSettings == '' || $innerSettings == 'yes') {
|
118 |
-
$html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>total
|
119 |
}
|
120 |
}
|
121 |
}
|
7 |
* Plugin URI: http://www.multidots.com/
|
8 |
* Description: Plugin for show visited page
|
9 |
* Author: Multidots
|
10 |
+
* Version: 2.0.2
|
11 |
* Author URI: http://www.multidots.com/
|
12 |
*/
|
13 |
// If this file is called directly, abort.
|
109 |
$total = (int) $pageCount[0]->total;
|
110 |
|
111 |
if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
|
112 |
+
$html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>total visits.</p>';
|
113 |
} else {
|
114 |
$postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
|
115 |
if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
|
116 |
$innerSettings = get_post_meta($pageID,'get_page_count',true);
|
117 |
if ($innerSettings == '' || $innerSettings == 'yes') {
|
118 |
+
$html .= '<p id="page-visit-counter-shortcode-block" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span id="shortcode_'.$pageID.'" style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor_shortcode">'.$total.'</span>total visits.</p>';
|
119 |
}
|
120 |
}
|
121 |
}
|
public/class-page-visit-counter-public.php
CHANGED
@@ -90,31 +90,49 @@ class page_visit_counter_Public {
|
|
90 |
|
91 |
//$pageurl = $_POST['pageurl'];
|
92 |
|
93 |
-
|
94 |
// Check the site running on HTTPS. If the site running on HTTPS then we are removing S from HTTPS
|
95 |
if (is_ssl()) {
|
96 |
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
97 |
-
|
|
|
|
|
|
|
|
|
|
|
98 |
} else {
|
99 |
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
101 |
}
|
102 |
|
103 |
-
|
104 |
-
|
|
|
105 |
if ($page == 0) {
|
106 |
-
$
|
107 |
-
if (is_ssl()) {
|
108 |
-
$page = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$current_url));
|
109 |
-
} else {
|
110 |
-
$page = url_to_postid( $current_url );
|
111 |
-
}
|
112 |
if ($page == 0) {
|
113 |
-
$
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
}
|
120 |
}
|
@@ -329,30 +347,34 @@ class page_visit_counter_Public {
|
|
329 |
$pageID = url_to_postid( $pageurl );
|
330 |
}
|
331 |
|
332 |
-
if ($pageID == 0) {
|
333 |
-
$pageID = (int) get_option('page_on_front',true);
|
334 |
-
if (empty($pageID) && !isset($pageID)) {
|
335 |
-
$pageID = (int) get_option('page_for_posts',true);
|
336 |
-
}
|
337 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
338 |
|
339 |
-
if ($pageID == 0) {
|
340 |
-
$
|
341 |
-
if ($page == 'posts') {
|
342 |
-
$args = array(
|
343 |
-
'numberposts' => 1,
|
344 |
-
'orderby' => 'post_date',
|
345 |
-
'order' => 'DESC',
|
346 |
-
'post_type' => 'post',
|
347 |
-
'post_status' => 'publish',
|
348 |
-
'suppress_filters' => true );
|
349 |
-
|
350 |
-
$recent_posts = wp_get_recent_posts( $args, ARRAY_A );
|
351 |
-
foreach( $recent_posts as $recent ){
|
352 |
-
$pageID = (int) $recent["ID"];
|
353 |
-
}
|
354 |
-
}
|
355 |
-
|
356 |
}
|
357 |
|
358 |
$post = get_post($pageID);
|
@@ -371,7 +393,7 @@ class page_visit_counter_Public {
|
|
371 |
|
372 |
}
|
373 |
|
374 |
-
public function insert_page_visit_counter_total_block(
|
375 |
global $wpdb, $wp, $post;
|
376 |
|
377 |
if (is_ssl()) {
|
@@ -382,6 +404,9 @@ class page_visit_counter_Public {
|
|
382 |
$pageID = url_to_postid( $actual_link );
|
383 |
}
|
384 |
|
|
|
|
|
|
|
385 |
// if ($pageID == 0) {
|
386 |
// $pageID = (int) get_option('page_on_front',true);
|
387 |
// if (empty($pageID) && !isset($pageID)) {
|
@@ -421,22 +446,28 @@ class page_visit_counter_Public {
|
|
421 |
$total = (int) $pageCount[0]->total;
|
422 |
|
423 |
$html = '';
|
424 |
-
|
425 |
-
if
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
|
|
|
|
|
|
|
|
433 |
}
|
434 |
}
|
435 |
}
|
436 |
|
437 |
-
return $content.' '.$html;
|
|
|
438 |
} else {
|
439 |
-
return $content;
|
|
|
440 |
}
|
441 |
|
442 |
}
|
90 |
|
91 |
//$pageurl = $_POST['pageurl'];
|
92 |
|
93 |
+
$flag = 0;
|
94 |
// Check the site running on HTTPS. If the site running on HTTPS then we are removing S from HTTPS
|
95 |
if (is_ssl()) {
|
96 |
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
97 |
+
if (strpos($actual_link,'wp-admin') !== false) {
|
98 |
+
$page = 0;
|
99 |
+
$flag = 1;
|
100 |
+
} else {
|
101 |
+
$page = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$actual_link));
|
102 |
+
}
|
103 |
} else {
|
104 |
$actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
|
105 |
+
if (strpos($actual_link,'wp-admin') !== false) {
|
106 |
+
$page = 0;
|
107 |
+
$flag = 1;
|
108 |
+
} else {
|
109 |
+
$page = url_to_postid( $actual_link );
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
+
if ($_SERVER[REQUEST_URI] == '/shop/' && $pageID == 0) {
|
114 |
+
$page = (int) get_option( 'woocommerce_shop_page_id' );
|
115 |
}
|
116 |
|
117 |
+
|
118 |
+
if ($flag == 0) {
|
119 |
+
|
120 |
if ($page == 0) {
|
121 |
+
$page = get_the_ID();
|
|
|
|
|
|
|
|
|
|
|
122 |
if ($page == 0) {
|
123 |
+
$current_url = home_url( $wp->request );
|
124 |
+
if (is_ssl()) {
|
125 |
+
$page = url_to_postid(preg_replace('/^https(?=:\/\/)/i','http',$current_url));
|
126 |
+
} else {
|
127 |
+
$page = url_to_postid( $current_url );
|
128 |
+
}
|
129 |
+
if ($page == 0) {
|
130 |
+
$queried_object = get_queried_object();
|
131 |
+
|
132 |
+
if ( $queried_object ) {
|
133 |
+
$post_id = $queried_object->ID;
|
134 |
+
$page = $post_id;
|
135 |
+
}
|
136 |
}
|
137 |
}
|
138 |
}
|
347 |
$pageID = url_to_postid( $pageurl );
|
348 |
}
|
349 |
|
350 |
+
// if ($pageID == 0) {
|
351 |
+
// $pageID = (int) get_option('page_on_front',true);
|
352 |
+
// if (empty($pageID) && !isset($pageID)) {
|
353 |
+
// $pageID = (int) get_option('page_for_posts',true);
|
354 |
+
// }
|
355 |
+
// }
|
356 |
+
//
|
357 |
+
// if ($pageID == 0) {
|
358 |
+
// $page = get_option('show_on_front',true);
|
359 |
+
// if ($page == 'posts') {
|
360 |
+
// $args = array(
|
361 |
+
// 'numberposts' => 1,
|
362 |
+
// 'orderby' => 'post_date',
|
363 |
+
// 'order' => 'DESC',
|
364 |
+
// 'post_type' => 'post',
|
365 |
+
// 'post_status' => 'publish',
|
366 |
+
// 'suppress_filters' => true );
|
367 |
+
//
|
368 |
+
// $recent_posts = wp_get_recent_posts( $args, ARRAY_A );
|
369 |
+
// foreach( $recent_posts as $recent ){
|
370 |
+
// $pageID = (int) $recent["ID"];
|
371 |
+
// }
|
372 |
+
// }
|
373 |
+
//
|
374 |
+
// }
|
375 |
|
376 |
+
if (strpos($pageurl,'/shop') !== false && $pageID == 0 ) {
|
377 |
+
$pageID = (int) get_option( 'woocommerce_shop_page_id' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
378 |
}
|
379 |
|
380 |
$post = get_post($pageID);
|
393 |
|
394 |
}
|
395 |
|
396 |
+
public function insert_page_visit_counter_total_block() {
|
397 |
global $wpdb, $wp, $post;
|
398 |
|
399 |
if (is_ssl()) {
|
404 |
$pageID = url_to_postid( $actual_link );
|
405 |
}
|
406 |
|
407 |
+
if ($_SERVER[REQUEST_URI] == '/shop/' && $pageID == 0) {
|
408 |
+
$pageID = (int) get_option( 'woocommerce_shop_page_id' );
|
409 |
+
}
|
410 |
// if ($pageID == 0) {
|
411 |
// $pageID = (int) get_option('page_on_front',true);
|
412 |
// if (empty($pageID) && !isset($pageID)) {
|
446 |
$total = (int) $pageCount[0]->total;
|
447 |
|
448 |
$html = '';
|
449 |
+
$hide_show_option = get_option('counter_hide_show_front_vew');
|
450 |
+
if( $hide_show_option == 1 ){
|
451 |
+
if(!is_feed() && !is_home()) {
|
452 |
+
if ($fetchSelecetedPostTypes == '' || $fetchSelecetedPostTypes == null) {
|
453 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>total visits.</p>';
|
454 |
+
} else {
|
455 |
+
$postTypeSelectedEncodeArr = json_decode($fetchSelecetedPostTypes);
|
456 |
+
if (in_array($post->post_type,$postTypeSelectedEncodeArr)) {
|
457 |
+
$innerSettings = get_post_meta($pageID,'get_page_count',true);
|
458 |
+
if ($innerSettings == '' || $innerSettings == 'yes') {
|
459 |
+
$html .= '<p id="default-loop-page-visit-counter" class="page-visit-counter-block"><img src="'.site_url().'/wp-content/plugins/page-visit-counter/images/1456175371_vector_65_14.png" /><span style="margin-left: 5px;margin-right: 5px;" class="page_amount_visitor">'.$total.'</span>total visits.</p>';
|
460 |
+
}
|
461 |
+
}
|
462 |
}
|
463 |
}
|
464 |
}
|
465 |
|
466 |
+
//return $content.' '.$html;
|
467 |
+
echo $html;
|
468 |
} else {
|
469 |
+
//return $content;
|
470 |
+
echo $html;
|
471 |
}
|
472 |
|
473 |
}
|