From d9b3c97e4061f235554deae0a10cf038eb4076f3 Mon Sep 17 00:00:00 2001
From: Lai Power
Date: Mon, 5 Jun 2023 11:21:32 +0000
Subject: [PATCH] updated plugin `WP-Matomo Integration` version 1.0.28
---
.../plugins/wp-piwik/classes/WP_Piwik.php | 11 ++-
.../classes/WP_Piwik/Admin/Settings.php | 14 +--
.../classes/WP_Piwik/Admin/Statistics.php | 1 -
.../wp-piwik/classes/WP_Piwik/Settings.php | 2 +
.../classes/WP_Piwik/TrackingCode.php | 11 ++-
.../classes/WP_Piwik/Widget/Ecommerce.php | 86 ++++++++++---------
wp-content/plugins/wp-piwik/readme.txt | 12 ++-
wp-content/plugins/wp-piwik/wp-piwik.php | 2 +-
8 files changed, 82 insertions(+), 57 deletions(-)
diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik.php
index ee370040..1eddaa9c 100644
--- a/wp-content/plugins/wp-piwik/classes/WP_Piwik.php
+++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik.php
@@ -10,7 +10,7 @@ use WP_Piwik\Widget\Post;
*/
class WP_Piwik {
- private static $revisionId = 2022020701, $version = '1.0.27', $blog_id, $pluginBasename = NULL, $logger, $settings, $request, $optionsPageId;
+ private static $revisionId = 2023052101, $version = '1.0.28', $blog_id, $pluginBasename = NULL, $logger, $settings, $request, $optionsPageId;
/**
* Constructor class to configure and register all WP-Piwik components
@@ -1152,7 +1152,12 @@ class WP_Piwik {
'urls' => $isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl,
'siteName' => urlencode( $isCurrent ? get_bloginfo ( 'name' ) : get_blog_details ( $blogId )->blogname )
) );
- $result = (int) $this->request ( $id );
+ $result = $this->request ( $id );
+ if ( is_array( $result ) && isset( $result['value'] ) ) {
+ $result = (int) $result['value'];
+ } else {
+ $result = (int) $result;
+ }
self::$logger->log ( 'Create Matomo ID: WordPress site ' . ($isCurrent ? get_bloginfo ( 'url' ) : get_blog_details ( $blogId )->siteurl) . ' = Matomo ID ' . $result );
if (empty ( $result ))
return null;
@@ -1319,7 +1324,7 @@ class WP_Piwik {
* Get option value, choose method depending on network mode
*
* @param string $option option key
- * @return string option value
+ * @return string|array option value
*/
private function getWordPressOption($option, $default = null) {
return ($this->isNetworkMode () ? get_site_option ( $option, $default ) : get_option ( $option, $default ));
diff --git a/wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Settings.php b/wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Settings.php
index 3cb19b92..d06f5a1a 100644
--- a/wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Settings.php
+++ b/wp-content/plugins/wp-piwik/classes/WP_Piwik/Admin/Settings.php
@@ -260,7 +260,13 @@ class Settings extends \WP_Piwik\Admin {
$this->showInput ( 'add_download_extensions', __ ( 'Add new file types for download tracking', 'wp-piwik' ), __ ( 'Add file extensions for download tracking, divided by a vertical bar (|).', 'wp-piwik' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '', '' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
- $this->showCheckbox ( 'disable_cookies', __ ( 'Disable cookies', 'wp-piwik' ), __ ( 'Disable all tracking cookies for a visitor.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
+ $this->showSelect ( 'require_consent', __ ( 'Tracking or cookie consent', 'wp-piwik' ), array (
+ 'disabled' => __ ( 'Disabled', 'wp-piwik' ),
+ 'consent' => __ ( 'Require consent', 'wp-piwik' ),
+ 'cookieconsent' => __ ( 'Require cookie consent', 'wp-piwik' )
+ ), __ ( 'Enable support for consent managers.' ) . ' ' . sprintf ( __ ( 'See %sMatomo documentation%s.', 'wp-piwik' ), '', '' ), '', $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
+
+ $this->showCheckbox ( 'disable_cookies', __ ( 'Disable cookies', 'wp-piwik' ), __ ( 'Disable all tracking cookies for a visitor.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup );
$this->showCheckbox ( 'limit_cookies', __ ( 'Limit cookie lifetime', 'wp-piwik' ), __ ( 'You can limit the cookie lifetime to avoid tracking your users over a longer period as necessary.', 'wp-piwik' ), $isNotGeneratedTracking, $fullGeneratedTrackingGroup, true, 'jQuery(\'tr.wp-piwik-cookielifetime-option\').toggleClass(\'wp-piwik-hidden\');' );
@@ -526,9 +532,6 @@ class Settings extends \WP_Piwik\Admin {
-
-
-
'.__('Currently shown stats:').' '.get_bloginfo('name').'.'.' Show site overview.
';
- echo ''."\n";
}
echo '