Skip to content

Commit

Permalink
stats4wp - v1.4.1
Browse files Browse the repository at this point in the history
= 1.4.1 (2303-SFP1) =
*Release Date - 23 March 2023*

* Compatible Wordpress 6.2,
* Sanitized Data, Escaped, and Validated (used sanitize_text_field),
* change Data agent sort by browser and usages,
* change Data os sort by OS and usages,
* change Data device sort by device and usages,
* OS and navigator data add percent bar.
  • Loading branch information
thanatos-vf-2000 committed Mar 23, 2023
1 parent 9e13ac3 commit b8d337a
Show file tree
Hide file tree
Showing 20 changed files with 91 additions and 89 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits,
Requires at least: 5.7
Tested up to: 6.2
Requires PHP: 7.4
Stable tag: 1.4.0
Stable tag: 1.4.1
License: GPLv2

This plugin gives you the complete information on your website's visitors.
Expand Down Expand Up @@ -96,15 +96,15 @@ GeoChart
Source: https://developers.google.com/chart/interactive/docs/gallery/geochart


### 1.4.0 (2300-SFP1)
*Release Date - 22 March 2023*
### 1.4.1 (2303-SFP1)
*Release Date - 23 March 2023*

* Compatible Wordpress 6.2,
* Delete cdn charjs Option,
* Sanitized Data, Escaped, and Validated (used sanitize_text_field),
* Variables and options must be escaped,
* Update ChartJS 4.2.0 to 4.2.1,
* Update GeoIP Database 20230321.
* change Data agent sort by browser and usages,
* change Data os sort by OS and usages,
* change Data device sort by device and usages,
* OS and navigator data add percent bar.

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

Expand Down
14 changes: 0 additions & 14 deletions assets/js/chart..js

This file was deleted.

10 changes: 10 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
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.1 (2303-SFP1) =
*Release Date - 23 March 2023*

* Compatible Wordpress 6.2,
* Sanitized Data, Escaped, and Validated (used sanitize_text_field),
* change Data agent sort by browser and usages,
* change Data os sort by OS and usages,
* change Data device sort by device and usages,
* OS and navigator data add percent bar.

= 1.4.0 (2303-SFP1) =
*Release Date - 22 March 2023*

Expand Down
7 changes: 4 additions & 3 deletions inc/Api/AdminGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @link https://ginkgos.net/
* @author VANHOUCKE Franck <[email protected]>
* @license GPLv2 or later
* @version 1.4.0
* @version 1.4.1
*/

namespace STATS4WP\Api;
Expand Down Expand Up @@ -116,12 +116,13 @@ public static function get_var($var)
global $wpdb;
if ($var == self::ARG_INTERVAL_FLAG) {
if (isset($_GET[self::ARG_INTERVAL_FLAG])) {
return ($_GET[self::ARG_INTERVAL_FLAG] = "flag") ? true : false;
$flag = sanitize_text_field($_GET[self::ARG_INTERVAL_FLAG]);
return ($flag = "flag") ? true : false;
}
return false;
}
if (isset($_GET[$var])) {
return $_GET[$var];
return sanitize_text_field($_GET[$var]);
}
switch ($var) {
case self::ARG_INTERVAL:
Expand Down
4 changes: 2 additions & 2 deletions inc/Core/Args.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/
namespace STATS4WP\Core;

Expand All @@ -16,6 +16,6 @@ class Args
*/
public static function getARGValue($key, $default, $valid = null)
{
return (!empty($_GET[$key]) && ($valid == null || $valid($_GET[$key]))) ? $_GET[$key] : $default;
return (!empty($_GET[$key]) && ($valid == null || $valid($_GET[$key]))) ? sanitize_text_field($_GET[$key]) : $default;
}
}
12 changes: 6 additions & 6 deletions inc/Ui/CSVExport.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/

namespace STATS4WP\Ui;
Expand Down Expand Up @@ -32,21 +32,21 @@ public function register()

$this->separator = ';';
if (isset($_GET['report'])) {
$csv = $this->generate_csv($_GET['report']);
$csv = $this->generate_csv(sanitize_text_field($_GET['report']));

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: application/octet-stream");
if (isset($_GET['year'])) {
header("Content-Disposition: attachment; filename=\"Export_" . $_GET['report'] . "_" . $_GET['year'] . ".csv\";");
header("Content-Disposition: attachment; filename=\"Export_" . sanitize_text_field($_GET['report']) . "_" . sanitize_text_field($_GET['year']) . ".csv\";");
} else {
header("Content-Disposition: attachment; filename=\"Export_" . $_GET['report'] . ".csv\";");
header("Content-Disposition: attachment; filename=\"Export_" . sanitize_text_field($_GET['report']) . ".csv\";");
}
header("Content-Transfer-Encoding: binary");

echo $csv;
_e($csv);
exit;
}
}
Expand Down Expand Up @@ -95,7 +95,7 @@ public function generate_csv($table)
$csv_output .= "\n";

if (isset($_GET['year'])) {
$y = " where YEAR(" . $field . ")=".$_GET['year'];
$y = " where YEAR(" . $field . ")=".sanitize_text_field($_GET['year']);
} else {
$y="";
}
Expand Down
6 changes: 3 additions & 3 deletions inc/Widgets/CptVisitors.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/
namespace STATS4WP\Widgets;

Expand Down Expand Up @@ -51,7 +51,7 @@ public function widget($args, $instance)
{

global $wpdb;
echo $args['before_widget'];
_e($args['before_widget']);
//title
if ($instance[ 'title' ] <>'') {
echo '<h5 class="widget-title">'.__('Number of visitors', 'stats4wp'). '</h5>';
Expand Down Expand Up @@ -145,7 +145,7 @@ public function form($instance)
?>
<p>
<input type="checkbox" id="<?php echo $this->get_field_id($value); ?>" name="<?php echo $this->get_field_name($value); ?>" value="checked" <?php echo $checked; ?> >
<label for="scales"><?php echo $value; ?></label>
<label for="scales"><?php esc_html($value); ?></label>
</p>
<?php
}
Expand Down
14 changes: 7 additions & 7 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: analytics, wordpress analytics, stats, statistics, visit, visitors, hits,
Requires at least: 5.2
Tested up to: 6.2
Requires PHP: 7.4
Stable tag: 1.4.0
Stable tag: 1.4.1
License: GPLv2

This plugin gives you the complete information on your website's visitors.
Expand Down Expand Up @@ -101,15 +101,15 @@ Source: https://developers.google.com/chart/interactive/docs/gallery/geochart

== Changelog ==

= 1.4.0 (2303-SFP1) =
*Release Date - 22 March 2023*
= 1.4.1 (2303-SFP1) =
*Release Date - 23 March 2023*

* Compatible Wordpress 6.2,
* Delete cdn charjs Option,
* Sanitized Data, Escaped, and Validated (used sanitize_text_field),
* Variables and options must be escaped,
* Update ChartJS 4.2.0 to 4.2.1,
* Update GeoIP Database 20230321.
* change Data agent sort by browser and usages,
* change Data os sort by OS and usages,
* change Data device sort by device and usages,
* OS and navigator data add percent bar.

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

Expand Down
4 changes: 2 additions & 2 deletions stats4wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: stats4wp
Plugin URI: https://ginkgos.net/plugin/stats4wp/
Description: Statistics For WorPress.
Version: 1.4.0
Version: 1.4.1
Requires at least: 5.2
Tested up to: 6.2
Requires PHP: 7.4
Expand Down Expand Up @@ -40,7 +40,7 @@
/**
* Plugin variable information
*/
define('STATS4WP_VERSION', '1.4.0');
define('STATS4WP_VERSION', '1.4.1');
define('STATS4WP_NAME', 'stats4wp');
define('STATS4WP_FILE', __FILE__);
define('STATS4WP_PATH', plugin_dir_path(STATS4WP_FILE));
Expand Down
16 changes: 9 additions & 7 deletions templates-part/dashboard/country-maps.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*
* Desciption: Contry Maps
*/
Expand All @@ -24,8 +24,10 @@
<div class="inside">
<?php

if (isset($script_js)) {unset($script_js);}
$script_js = '
if (isset($script_js)) {
unset($script_js);
}
$script_js = '
google.charts.load("current", {
"packages":["geochart"],
});
Expand All @@ -36,9 +38,9 @@ function drawRegionsMap() {
["Country", "' . __("Users", "stats4wp") . '"], ';

foreach ($locations as $location) {
$script_js .= '[\'' . esc_html($location->location) . '\', '. esc_html($location->nb) .'],';
$script_js .= '[\'' . esc_html($location->location) . '\', '. esc_html($location->nb) .'],';
}
$script_js .= '
$script_js .= '
]);
var options = {};
Expand All @@ -48,8 +50,8 @@ function drawRegionsMap() {
chart.draw(data, options);
}
';
wp_add_inline_script('google-loader', $script_js, 'after');
?>
wp_add_inline_script('google-loader', $script_js, 'after');
?>
<div id="regions_div" style="width: 100%"></div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions templates-part/visitor/agent.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/

use STATS4WP\Core\DB;
Expand Down Expand Up @@ -179,7 +179,7 @@
FROM ". DB::table('visitor') ."
WHERE device !='bot'
AND last_counter BETWEEN '". $param['from'] ."' AND '". $param['to'] ."'
GROUP BY 1,2 ORDER BY 1,2 ASC ");
GROUP BY 1,2 ORDER BY 1,3 DESC ");
$agents_total = array_sum(array_column($agents_version, 'nb'));
$agents_nb=1;
$agent_local='';
Expand All @@ -196,7 +196,7 @@
echo '<tr><th colspan="3">'. esc_html($agent_version->agent).'</th></tr>';
}
$percent = round($agent_version->nb * 100 / $agents_total, 2);
echo '<tr><td>' . $agents_nb . '</td><td>' . esc_html(substr($agent_version->version, 0, 50)) . '</td><td>' . esc_html($percent) . '%</td><td>' . esc_html(number_format($agent_version->nb, 0, ',', ' ')). '</td></tr>' ;
echo '<tr><td>' . $agents_nb . '</td><td>' . esc_html(substr($agent_version->version, 0, 50)) . '</td><td>' . esc_html(number_format($agent_version->nb, 0, ',', ' ')). '</td><td class="stats4wp-left stats4wp-nowrap"><div class="stats4wp-percent" style="width:' . esc_attr($percent) . '%;"></div>' . esc_html($percent) . '%</td></tr>' ;
$agent_local = $agent_version->agent;
$agents_nb++;
}
Expand Down
10 changes: 6 additions & 4 deletions templates-part/visitor/bots-maps.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*
* Desciption: Location Maps
*/
Expand Down Expand Up @@ -32,8 +32,10 @@
</div>
<div class="inside">
<?php
if (isset($script_js)) {unset($script_js);}
$script_js = '
if (isset($script_js)) {
unset($script_js);
}
$script_js = '
google.charts.load("current", {
"packages":["geochart"],
});
Expand All @@ -43,7 +45,7 @@ function drawRegionsMap() {
var data = google.visualization.arrayToDataTable([
["Country", "' . __("Bots", "stats4wp") .'"],';
foreach ($locations as $location) {
$script_js .= '[\'' . esc_html($location->location) . '\', '. esc_html($location->nb) .'],';
$script_js .= '[\'' . esc_html($location->location) . '\', '. esc_html($location->nb) .'],';
}
$script_js .= '
]);
Expand Down
4 changes: 2 additions & 2 deletions templates-part/visitor/device.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/

use STATS4WP\Core\DB;
Expand Down Expand Up @@ -160,7 +160,7 @@
FROM ". DB::table('visitor') ."
WHERE device NOT in ('bot','')
AND last_counter BETWEEN '". $param['from'] ."' AND '". $param['to'] ."'
GROUP BY 1,2 ORDER BY 1,2 ASC ");
GROUP BY 1,2 ORDER BY 1,3 DESC ");
$device_total = array_sum(array_column($devices_version, 'nb'));
$device_nb=1;
$device_local='';
Expand Down
14 changes: 8 additions & 6 deletions templates-part/visitor/lang-maps.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*
* Desciption: Location Maps
*/
Expand Down Expand Up @@ -32,8 +32,10 @@
</div>
<div class="inside">
<?php
if (isset($script_js)) {unset($script_js);}
$script_js = '
if (isset($script_js)) {
unset($script_js);
}
$script_js = '
google.charts.load("current", {
"packages":["geochart"],
});
Expand All @@ -44,7 +46,7 @@ function drawRegionsMap() {
["Country", "'. __("Users", "stats4wp") . '"],';

foreach ($languages as $language) {
$script_js .= '[\'' . esc_html($language->language) . '\', '. esc_html($language->nb) .'],';
$script_js .= '[\'' . esc_html($language->language) . '\', '. esc_html($language->nb) .'],';
}

$script_js .= '
Expand All @@ -57,8 +59,8 @@ function drawRegionsMap() {
chart.draw(data, options);
}
';
wp_add_inline_script('google-loader', $script_js, 'after');
?>
wp_add_inline_script('google-loader', $script_js, 'after');
?>
<div id="regions_div" style="width: 450px; height: 250px;" class="stats4wp-maps"></div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions templates-part/visitor/lang.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* @package STATS4WPPlugin
* @version 1.4.0
* @version 1.4.1
*/

use STATS4WP\Core\DB;
Expand Down Expand Up @@ -97,7 +97,7 @@
</div>
<div class="stats4wp-inline width46">
<div class="stats4wp-language">
<?php echo $language_list; ?>
<?php _e($language_list); ?>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit b8d337a

Please sign in to comment.