Skip to content

Commit

Permalink
v1.4.8
Browse files Browse the repository at this point in the history
* Compatible Wordpress 6.4.3,
* Update GeoIP Database 20240209,
* Correction phpcs 3.7.2 error,
* Change Google GeoChart by jVectorMap 2.0.5,
* Correction country map to used parameters,
* Correction Use of undefined constant stats4wp_file,
* Add Data OS Ubuntu, Fedora,
* Add Data device pda.
  • Loading branch information
thanatos-vf-2000 committed Feb 11, 2024
1 parent 6305d01 commit 4e054ae
Show file tree
Hide file tree
Showing 62 changed files with 1,032 additions and 583 deletions.
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
Contributors: vanhoucke
Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits, chart, browser, today, yesterday, week, month, year, total, post, page, sidebar, google, live visit, search word, agent, google analytics, webmasters, google webmasters, geoip, location
Requires at least: 5.7
Tested up to: 6.3.1
Tested up to: 6.4.3
Requires PHP: 7.4
Stable tag: 1.4.4
Stable tag: 1.4.8
License: GPLv2

This plugin gives you the complete information on your website's visitors.
Expand Down Expand Up @@ -97,14 +97,17 @@ License: The GNU AGPL is an open-source license
Source: https://jvectormap.com/


### 1.4.5 (2311-SFP1)
*Release Date - 1 November 2023*
###1.4.8 (2402-SFP1)
*Release Date - 11 Febrary 2023*

* Compatible Wordpress 6.3.2,
* Update GeoIP Database 20230929,
* Compatible Wordpress 6.4.3,
* Update GeoIP Database 20240209,
* Correction phpcs 3.7.2 error,
* Change Google GeoChart by jVectorMap 2.0.5,
* Correction country map to used parameters.
* Correction country map to used parameters,
* Correction Use of undefined constant stats4wp_file,
* Add Data OS Ubuntu, Fedora,
* Add Data device pda.

See [changelog.txt](https://plugins.svn.wordpress.org/stats4wp/trunk/changelog.txt) for older changelog

Expand Down
31 changes: 31 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,37 @@
This file contains older changelog entries, so we can keep the size of the standard WordPress readme.txt file reasonable.
For the latest changes, please see the "Changelog" section of the [readme.txt file](https://plugins.svn.wordpress.org/stats4wp/trunk/readme.txt).

= 1.4.8 (2402-SFP1) =
*Release Date - 11 Febrary 2023*

* Compatible Wordpress 6.4.3,
* Update GeoIP Database 20240209,
* Correction phpcs 3.7.2 error,
* Change Google GeoChart by jVectorMap 2.0.5,
* Correction country map to used parameters,
* Correction Use of undefined constant stats4wp_file,
* Add Data OS Ubuntu, Fedora,
* Add Data device pda.

= 1.4.7 (2311-SFP3) =
*Release Date - 18 November 2023*

* Compatible Wordpress 6.4.1,
* Update GeoIP Database 20231117,
* Correction phpcs 3.7.2 error,
* Change Google GeoChart by jVectorMap 2.0.5,
* Correction country map to used parameters,
* Correction Use of undefined constant stats4wp_file.

= 1.4.6 (2311-SFP2) =
*Release Date - 11 November 2023*

* Compatible Wordpress 6.4,
* Update GeoIP Database 20231107,
* Correction phpcs 3.7.2 error,
* Change Google GeoChart by jVectorMap 2.0.5,
* Correction country map to used parameters.

= 1.4.5 (2311-SFP1) =
*Release Date - 1 November 2023*

Expand Down
Binary file modified db/GeoLite2-Country.mmdb
Binary file not shown.
40 changes: 20 additions & 20 deletions inc/Api/AdminGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author Franck VANHOUCKE <[email protected]>
* @copyright 2021-2023 Copyright 2023, Inc. All rights reserved.
* @license GNU General Public License version 2 or later
* @version 1.4.5 GIT:https://github.com/thanatos-vf-2000/WordPress
* @version 1.4.6 GIT:https://github.com/thanatos-vf-2000/WordPress
* @link https://ginkgos.net
*/

Expand Down Expand Up @@ -67,7 +67,7 @@ public static function select_date() {
global $wp;
?>
<form method="GET" action="<?php esc_url( admin_url( 'admin.php' ) ); ?>">
<input type="hidden" name="page" value="<?php esc_attr_e( isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'stats4wp_visitors' ); ?>"/>
<input type="hidden" name="page" value="<?php printf( '%s', esc_html( isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'stats4wp_visitors' ) ); ?>"/>
<?php
if ( isset( $_GET['spage'] ) ) {
echo '<input type="hidden" name="spage" value="' . esc_attr( sanitize_text_field( wp_unslash( $_GET['spage'] ) ) ) . '"/>';
Expand All @@ -79,18 +79,18 @@ public static function select_date() {
<th scope="row"><?php esc_html_e( 'From', 'stats4wp' ); ?>: </th>
<td>
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e( 'From: ', 'stats4wp' ); ?></span></legend><label for="date_from">
<input type="date" id="<?php esc_attr_e( self::ARG_FROM ); ?>" name="<?php esc_attr_e( self::ARG_FROM ); ?>" value="<?php esc_attr_e( self::get_var( self::ARG_FROM ) ); ?>" <?php esc_attr_e( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? 'disabled' : '' ); ?> /></label>
<input type="date" id="<?php printf( '%s', esc_html( self::ARG_FROM ) ); ?>" name="<?php printf( '%s', esc_html( self::ARG_FROM ) ); ?>" value="<?php printf( '%s', esc_html( self::get_var( self::ARG_FROM ) ) ); ?>" <?php printf( '%s', esc_html( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? 'disabled' : '' ) ); ?> /></label>
</fieldset>
</td>
<th scope="row"><?php esc_html_e( 'To', 'stats4wp' ); ?>: </th>
<td>
<fieldset><legend class="screen-reader-text"><span><?php esc_html_e( 'To: ', 'stats4wp' ); ?></span></legend><label for="date_to">
<input type="date" id="<?php esc_attr_e( self::ARG_TO ); ?>" name="<?php esc_attr_e( self::ARG_TO ); ?>" value="<?php esc_attr_e( self::get_var( self::ARG_TO ) ); ?>" /></label>
<input type="date" id="<?php printf( '%s', esc_html( self::ARG_TO ) ); ?>" name="<?php printf( '%s', esc_html( self::ARG_TO ) ); ?>" value="<?php printf( '%s', esc_html( self::get_var( self::ARG_TO ) ) ); ?>" /></label>
</fieldset>
</td>
<th scope="row"><?php esc_html_e( 'Day interval', 'stats4wp' ); ?></th>
<td>
<select name="<?php esc_attr_e( self::ARG_INTERVAL ); ?>" id="<?php esc_attr_e( self::ARG_INTERVAL ); ?>" <?php esc_attr_e( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? '' : 'disabled' ); ?>>
<select name="<?php printf( '%s', esc_html( self::ARG_INTERVAL ) ); ?>" id="<?php printf( '%s', esc_html( self::ARG_INTERVAL ) ); ?>" <?php printf( '%s', esc_html( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? '' : 'disabled' ) ); ?>>
<?php
foreach ( self::$date_range as $k => $v ) {
$display_name = stripslashes( $v );
Expand All @@ -103,7 +103,7 @@ public static function select_date() {
}
?>
</select>
<input type="checkbox" id="<?php esc_attr_e( self::ARG_INTERVAL_FLAG ); ?>" name="<?php esc_attr_e( self::ARG_INTERVAL_FLAG ); ?>" value="flag" <?php esc_attr_e( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? 'checked' : '' ); ?> >
<input type="checkbox" id="<?php printf( '%s', esc_html( self::ARG_INTERVAL_FLAG ) ); ?>" name="<?php printf( '%s', esc_html( self::ARG_INTERVAL_FLAG ) ); ?>" value="flag" <?php printf( '%s', esc_html( ( self::get_var( self::ARG_INTERVAL_FLAG ) === true ) ? 'checked' : '' ) ); ?> >
</td>
</tr>
</table>
Expand Down Expand Up @@ -132,38 +132,38 @@ public static function get_var( $var ) {
return 10;
break;
case self::ARG_TO:
return date( 'Y-m-d' );
return gmdate( 'Y-m-d' );
break;
case self::ARG_FROM:
if ( isset( $_GET['page'] ) && sanitize_text_field( wp_unslash( $_GET['page'] ) ) === 'stats4wp_plugin' ) {
switch ( self::get_var( self::ARG_DASHBOARD_DATA ) ) {
case 1:
return date( 'Y-m-d', strtotime( '-14 days' ) );
return gmdate( 'Y-m-d', strtotime( '-14 days' ) );
break;
case 2:
return date( 'Y-m-d', strtotime( '-1 months' ) );
return gmdate( 'Y-m-d', strtotime( '-1 months' ) );
break;
case 3:
return date( 'Y-m-d', strtotime( '-2 months' ) );
return gmdate( 'Y-m-d', strtotime( '-2 months' ) );
break;
case 4:
return date( 'Y-m-d', strtotime( '-3 months' ) );
return gmdate( 'Y-m-d', strtotime( '-3 months' ) );
break;
case 5:
return date( 'Y-m-d', strtotime( '-1 years' ) );
return gmdate( 'Y-m-d', strtotime( '-1 years' ) );
break;
case 6:
return date( 'Y-m-d', strtotime( '-2 years' ) );
return gmdate( 'Y-m-d', strtotime( '-2 years' ) );
break;
case 7;
if ( ! isset( $wpdb->stats4wp_visitor ) ) {
$wpdb->stats4wp_visitor = DB::table( 'visitor' );}
$visitor = $wpdb->get_row( "SELECT min(last_counter) as minimum FROM {$wpdb->stats4wp_visitor}" );
$visitor = $wpdb->get_row( "SELECT min(last_counter) as minimum FROM $wpdb->stats4wp_visitor" );
return $visitor->minimum;
break;
}
} else {
return date( 'Y-m-d', strtotime( '-' . self::get_var( self::ARG_INTERVAL ) . ' days' ) );
return gmdate( 'Y-m-d', strtotime( '-' . self::get_var( self::ARG_INTERVAL ) . ' days' ) );
}
break;
case self::ARG_DASHBOARD_DATA:
Expand All @@ -184,14 +184,14 @@ public static function getdate( $type = 'all' ) {
if ( 'all' === $type ) {
if ( ! isset( $wpdb->stats4wp_visitor ) ) {
$wpdb->stats4wp_visitor = DB::table( 'visitor' );}
$all_date = $wpdb->get_row( "SELECT min(last_counter) as minimum, max(last_counter) as maximum FROM{$wpdb->stats4wp_visitor}" );
$all_date = $wpdb->get_row( "SELECT min(last_counter) as minimum, max(last_counter) as maximum FROM $wpdb->stats4wp_visitor" );
$from = $all_date->minimum;
$to = $all_date->maximum;
} else {
$to = self::get_var( self::ARG_TO );
if ( self::get_var( self::ARG_INTERVAL_FLAG ) ) {
$dt = new \DateTime( $to );
$from = date( 'Y-m-d', strtotime( '-' . self::get_var( self::ARG_INTERVAL ) . ' days', $dt->getTimestamp() ) );
$from = gmdate( 'Y-m-d', strtotime( '-' . self::get_var( self::ARG_INTERVAL ) . ' days', $dt->getTimestamp() ) );
} else {
$from = self::get_var( self::ARG_FROM );
}
Expand Down Expand Up @@ -221,13 +221,13 @@ public static function getdate( $type = 'all' ) {
public static function select_date_dashboard() {
?>
<form method="GET" action="<?php esc_url( admin_url( 'admin.php' ) ); ?>">
<input type="hidden" name="page" value="<?php esc_attr_e( ( isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'stats4wp_visitors' ) ); ?>"/>
<input type="hidden" name="page" value="<?php printf( '%s', esc_html( ( isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : 'stats4wp_visitors' ) ) ); ?>"/>
<?php wp_nonce_field( 'stats4wp-opt', 'stats4wp-verif' ); ?>
<table class="form-table-visitor" role="presentation">
<tr>
<th scope="row"><?php esc_html_e( 'Data last', 'stats4wp' ); ?>: </th>
<td>
<select name="<?php esc_attr_e( self::ARG_DASHBOARD_DATA ); ?>" id="<?php esc_attr_e( self::ARG_DASHBOARD_DATA ); ?>" >
<select name="<?php printf( '%s', esc_html( self::ARG_DASHBOARD_DATA ) ); ?>" id="<?php printf( '%s', esc_html( self::ARG_DASHBOARD_DATA ) ); ?>" >
<?php
foreach ( self::$date_dashboard as $k => $v ) {
$display_name = stripslashes( $v );
Expand All @@ -243,7 +243,7 @@ public static function select_date_dashboard() {
</td>
<th scope="row"><?php esc_html_e( 'Display by', 'stats4wp' ); ?>: </th>
<td>
<select name="<?php esc_attr_e( self::ARG_DASHBOARD_GROUP ); ?>" id="<?php esc_attr_e( self::ARG_DASHBOARD_GROUP ); ?>" >
<select name="<?php printf( '%s', esc_html( self::ARG_DASHBOARD_GROUP ) ); ?>" id="<?php printf( '%s', esc_html( self::ARG_DASHBOARD_GROUP ) ); ?>" >
<?php
foreach ( self::$date_group as $k => $v ) {
$display_name = stripslashes( $v );
Expand Down
4 changes: 2 additions & 2 deletions inc/Api/GeoIP.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.5
* @version 1.4.7
*/
namespace STATS4WP\Api;

Expand All @@ -14,7 +14,7 @@ class GeoIP {
*
* @var string
*/
public static $geoip_date = '20230929';
public static $geoip_date = '20240209';

/**
* Date of database GeoIpLitle User IP
Expand Down
19 changes: 19 additions & 0 deletions inc/Api/TimeZone.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,23 @@ public static function get_current_date( $format = 'Y-m-d H:i:s', $strtotime = n
return date( $format, time() + self::set_timezone() );
}
}

/**
* @param string $format
* @param null $strtotime
* @param null $relative
*
* @return bool|string
*/
public static function get_current_gmdate( $format = 'Y-m-d H:i:s', $strtotime = null, $relative = null ) {
if ( $strtotime ) {
if ( $relative ) {
return gmdate( $format, strtotime( "{$strtotime} day", $relative ) + self::set_timezone() );
} else {
return gmdate( $format, strtotime( "{$strtotime} day" ) + self::set_timezone() );
}
} else {
return gmdate( $format, time() + self::set_timezone() );
}
}
}
4 changes: 2 additions & 2 deletions inc/Core/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function get_table_name( $tbl ) {
public static function exist_table( $tbl_name ) {
global $wpdb;
$wpdb->stats4wp_test = $tbl_name;
return ( $wpdb->get_var( "SHOW TABLES LIKE {$wpdb->stats4wp_test}" ) === $tbl_name );
return ( $wpdb->get_var( "SHOW TABLES LIKE $wpdb->stats4wp_test" ) === $tbl_name );
}

/**
Expand Down Expand Up @@ -130,7 +130,7 @@ public static function exist_row( $tbl ) {
$nbrows = wp_cache_get( 'cpt_' . $tbl );
if ( false === $nbrows ) {
$wpdb->stats4wp_test = self::table( $tbl );
$nbrows = $wpdb->get_row( "SELECT count(*) as nb FROM {$wpdb->stats4wp_test}" );
$nbrows = $wpdb->get_row( "SELECT count(*) as nb FROM $wpdb->stats4wp_test" );
wp_cache_set( 'cpt_' . $tbl, $nbrows );
}
$nb = $nbrows->nb;
Expand Down
2 changes: 1 addition & 1 deletion inc/Core/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static function create_table( $network_wide ) {
global $wpdb;

if ( is_multisite() && $network_wide ) {
$blog_ids = $wpdb->get_col( $wpdb->prepare( 'SELECT `blog_id` FROM %s', $wpdb->blogs ) );
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
self::table_sql();
Expand Down
6 changes: 3 additions & 3 deletions inc/Core/SettingsLinks.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.4
* @version 1.4.7
*/
namespace STATS4WP\Core;

Expand All @@ -22,10 +22,10 @@ public function settings_link( $actions, $stats4wp_file ) {
static $plugin;

if ( ! isset( $plugin ) ) {
$plugin = plugin_basename( stats4wp_file );
$plugin = plugin_basename( STATS4WP_FILE );
}
if ( $plugin === $stats4wp_file ) {
$plugin_data = get_plugin_data( stats4wp_file );
$plugin_data = get_plugin_data( STATS4WP_FILE );
$actions[] = '<a href="admin.php?page=' . esc_attr( STATS4WP_NAME ) . '_settings">' . __( 'Settings' ) . '</a>';
$actions[] = '<a href="' . esc_attr( $plugin_data['PluginURI'] ) . '" target="_blank">' . __( 'Support' ) . '</a>';
$actions[] = '<a href="' . esc_attr( $plugin_data['AuthorURI'] ) . '" target="_blank">' . __( 'all GinkGos plugins ' ) . '</a>';
Expand Down
8 changes: 4 additions & 4 deletions inc/Core/Uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static function uninstall() {

delete_option( STATS4WP_NAME . '_plugin' );
if ( is_multisite() ) {
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" );
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
self::site_removal();
Expand All @@ -35,19 +35,19 @@ public static function site_removal() {
global $wpdb;

if ( is_multisite() && $network_wide ) {
$blog_ids = $wpdb->get_col( "SELECT `blog_id` FROM $wpdb->blogs" );
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
switch_to_blog( $blog_id );
// Drop the tables
foreach ( DB::table() as $tbl ) {
$wpdb->stats4wp_tmp = $tbl;
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->stats4wp_tmp}" );
$wpdb->query( "DROP TABLE IF EXISTS $wpdb->stats4wp_tmp" );
}
restore_current_blog();
} else {
// Drop the tables
foreach ( DB::table() as $tbl ) {
$wpdb->stats4wp_tmp = $tbl;
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->stats4wp_tmp}" );
$wpdb->query( "DROP TABLE IF EXISTS $wpdb->stats4wp_tmp" );
}
}
}
Expand Down
Loading

0 comments on commit 4e054ae

Please sign in to comment.