From a2a251630b29c7b475e2c510cb0e8534bb5d5afa Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 26 Feb 2024 15:56:42 -0700 Subject: [PATCH] Use Html::encodeJsVar (#116) --- CHANGELOG.md | 4 ++++ extension.json | 4 ++-- includes/MatomoAnalyticsHooks.php | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b05ea4e..913d9ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## ChangeLog for MatomoAnalytics +### 1.1.3 (26-02-2024) +* Replace deprecated Xml::encodeJsVar with Html::encodeJsVar +* Now requires MediaWiki 1.41.0 or later + ### 1.1.2 (04-02-2023) * Add a CleanupMatomos maintenance script * Add requireExtension() to all maintenance scripts diff --git a/extension.json b/extension.json index c1844ed..f546f84 100644 --- a/extension.json +++ b/extension.json @@ -6,12 +6,12 @@ "Universal Omega" ], "url": "https://github.com/miraheze/MatomoAnalytics", - "version": "1.1.2", + "version": "1.1.3", "descriptionmsg": "matomoanalytics-desc", "license-name": "GPL-3.0-or-later", "type": "specialpage", "requires": { - "MediaWiki": ">= 1.39.0" + "MediaWiki": ">= 1.41.0" }, "AvailableRights": [ "noanalytics" diff --git a/includes/MatomoAnalyticsHooks.php b/includes/MatomoAnalyticsHooks.php index d14d836..0979303 100644 --- a/includes/MatomoAnalyticsHooks.php +++ b/includes/MatomoAnalyticsHooks.php @@ -1,5 +1,6 @@ get( 'MatomoAnalyticsServerURL' ); $title = $skin->getRelevantTitle(); - $jstitle = Xml::encodeJsVar( $title->getPrefixedText() ); - $dbname = Xml::encodeJsVar( $config->get( 'DBname' ) ); + $jstitle = Html::encodeJsVar( $title->getPrefixedText() ); + $dbname = Html::encodeJsVar( $config->get( 'DBname' ) ); $urltitle = $title->getPrefixedURL(); $userType = $user->isRegistered() ? 'User' : 'Anonymous'; $cookieDisable = (int)$config->get( 'MatomoAnalyticsDisableCookie' );