Skip to content

Commit ccb2723

Browse files
committed
Release new version 2.7.0
* This release changes the daily views reset from fixed GMT = 00 to use the timezone that is set in the site's WordPress General Settings. * Feature - Use the timezone from WordPress General Settings as the reset time for daily views counter. * Tweak - Test for compatibility with WordPress 6.2
1 parent af52f86 commit ccb2723

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

admin/plugin-init.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function a3_pvc_plugin_init() {
6969
add_action( 'pvc_empty_daily_table_daily_event_hook', 'pvc_empty_daily_table_do_daily' );
7070
function pvc_empty_daily_table_do_daily() {
7171
global $wpdb;
72-
$wpdb->query("DELETE FROM " . $wpdb->prefix . "pvc_daily WHERE time <= '".date('Y-m-d', strtotime('-2 days'))."'");
72+
$wpdb->query("DELETE FROM " . $wpdb->prefix . "pvc_daily WHERE time <= '".wp_date('Y-m-d', strtotime('-2 days'))."'");
7373
}
7474

7575
$pvc_settings = get_option( 'pvc_settings', array( 'position' => 'bottom' ) );
@@ -98,7 +98,7 @@ function pvc_lite_upgrade_plugin () {
9898
if(version_compare(get_option('a3_pvc_version'), '1.3.5') === -1){
9999
update_option('a3_pvc_version', '1.3.5');
100100

101-
wp_schedule_event( strtotime( date('Y-m-d'). ' 00:00:00' ), 'daily', 'pvc_empty_daily_table_daily_event_hook' );
101+
wp_schedule_event( strtotime( wp_date('Y-m-d'). ' 00:00:00' ), 'daily', 'pvc_empty_daily_table_daily_event_hook' );
102102
global $wpdb;
103103
$sql = "ALTER TABLE ". $wpdb->prefix . "pvc_daily CHANGE `id` `id` BIGINT NOT NULL AUTO_INCREMENT";
104104
$wpdb->query($sql);

page-views-count.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
Plugin Name: Page Views Count
44
Description: Show front end users all time views and views today on posts, pages, index pages and custom post types with the Page Views Count Plugin. Use the Page Views Count function to add page views to any content type or object created by your theme or plugins.
5-
Version: 2.6.3
5+
Version: 2.7.0
66
Requires at least: 5.6
77
Tested up to: 6.2
88
Author: a3rev Software
@@ -23,7 +23,7 @@
2323

2424
define( 'A3_PVC_KEY', 'a3_page_view_count' );
2525
define( 'A3_PVC_PREFIX', 'wp_pvc_' );
26-
define( 'A3_PVC_VERSION', '2.6.3' );
26+
define( 'A3_PVC_VERSION', '2.7.0' );
2727
define( 'A3_PVC_G_FONTS', false );
2828

2929
use \A3Rev\PageViewsCount\FrameWork;

readme.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Contributors: a3rev, a3rev Software, nguyencongtuan
33
Tags: wordpress page view, page view count , post views, post view count, gutenberg
44
Requires at least: 5.6
55
Tested up to: 6.2
6-
Stable tag: 2.6.3
6+
Stable tag: 2.7.0
77
License: GPLv3
88
License URI: http://www.gnu.org/licenses/gpl-3.0.html
99

@@ -102,6 +102,11 @@ The manual installation method involves down loading our plugin and uploading it
102102

103103
== Changelog ==
104104

105+
= 2.7.0 - 2023/04/08 =
106+
* This release changes the daily views reset from fixed GMT = 00 to use the timezone that is set in the site's WordPress General Settings.
107+
* Feature - Use the timezone from WordPress General Settings as the reset time for daily views counter.
108+
* Tweak - Test for compatibility with WordPress 6.2
109+
105110
= 2.6.3 - 2023/02/25 =
106111
* This maintenance release had 2 performance tweaks for the page view count loading icon.
107112
* Tweak - Upgrade loading icon to a larger one for improved display on mobile retina
@@ -554,6 +559,9 @@ The manual installation method involves down loading our plugin and uploading it
554559

555560
== Upgrade Notice ==
556561

562+
= 2.7.0 =
563+
This release changes the daily views reset from fixed GMT = 00 to use the timezone that is set in the site's WordPress General Settings.
564+
557565
= 2.6.3 =
558566
This maintenance release had 2 performance tweaks for the page view count loading icon.
559567

src/pvc_class.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static function install_database(){
4545

4646
public static function pvc_fetch_posts_stats( $post_ids ) {
4747
global $wpdb;
48-
$nowisnow = date('Y-m-d');
48+
$nowisnow = wp_date('Y-m-d');
4949

5050
if ( !is_array( $post_ids ) ) $post_ids = array( $post_ids );
5151
$post_ids = array_map( function( $value ) {
@@ -89,7 +89,7 @@ public static function pvc_fetch_post_total( $post_id ) {
8989

9090
public static function pvc_fetch_post_today( $post_id ) {
9191
global $wpdb;
92-
$nowisnow = date('Y-m-d');
92+
$nowisnow = wp_date('Y-m-d');
9393

9494
$sql = $wpdb->prepare( "SELECT postcount AS today FROM ". $wpdb->prefix . "pvc_daily
9595
WHERE postnum = %s AND time = %s", $post_id, $nowisnow );
@@ -100,7 +100,7 @@ public static function pvc_stats_update($post_id) {
100100
global $wpdb;
101101

102102
// get the local time based off WordPress setting
103-
$nowisnow = date('Y-m-d');
103+
$nowisnow = wp_date('Y-m-d');
104104

105105
// first try and update the existing total post counter
106106
$results = $wpdb->query( $wpdb->prepare( "UPDATE ". $wpdb->prefix . "pvc_total SET postcount = postcount+1 WHERE postnum = '%s' LIMIT 1", $post_id ) );
@@ -126,7 +126,7 @@ public static function pvc_stats_manual_update( $post_id, $new_total_views, $new
126126
global $wpdb;
127127

128128
// get the local time based off WordPress setting
129-
$nowisnow = date('Y-m-d');
129+
$nowisnow = wp_date('Y-m-d');
130130

131131
// if it doesn't exist, then insert new record
132132
// one in the total views

0 commit comments

Comments
 (0)