Skip to content

Commit 146554f

Browse files
committed
Update version to support WordPress 6.6.2
1 parent e96622d commit 146554f

29 files changed

+354
-177
lines changed

config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"TESTED_UP_TO": "6.6.1",
3-
"STABLE_TAG": "1.25"
2+
"TESTED_UP_TO": "6.6.2",
3+
"STABLE_TAG": "1.26"
44
}

readme.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Contributors: simpleanalytics
44
Donate link: https://simpleanalytics.com
55
Tags: privacy-first, privacy-friendly, free analytics, website analytics, simple analytics, analytics, statistics
66
Requires at least: 5.2
7-
Tested up to: 6.6.1
7+
Tested up to: 6.6.2
88
Requires PHP: 7.2.0
9-
Stable tag: 1.25
9+
Stable tag: 1.26
1010
License: GPLv2 or later
1111
License URI: http://www.gnu.org/licenses/gpl-2.0.html
1212

@@ -74,6 +74,10 @@ No changes needed for upgrades.
7474

7575
== Changelog ==
7676

77+
= 1.26 =
78+
* 2024-09-13
79+
* Upgraded to WordPress 6.6.2
80+
7781
= 1.25 =
7882
* 2024-07-30
7983
* Upgraded to WordPress 6.6.1

simple-analytics.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22
/*
33
* Plugin Name: Simple Analytics Official
4-
* Version: 1.25
4+
* Version: 1.26
55
* Plugin URI: https://docs.simpleanalytics.com/install-simple-analytics-on-wordpress
66
* Description: Embed Simple Analytics script in your WordPress website
77
* Author: Simple Analytics
88
* Author URI: https://simpleanalytics.com/
99
* Requires at least: 5.2.0
10-
* Tested up to: 6.6.1
10+
* Tested up to: 6.6.2
1111
*
1212
* Text Domain: simple-analytics
1313
* Domain Path: /lang/

src/Actions/AddInactiveComment.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ class AddInactiveComment
66
{
77
use Action;
88

9-
protected string $hook = 'wp_footer';
9+
/**
10+
* @var string
11+
*/
12+
protected $hook = 'wp_footer';
1013

1114
public function handle(): void
1215
{

src/Actions/AddNoScriptTag.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ class AddNoScriptTag
99
{
1010
use Action;
1111

12-
protected string $hook = 'wp_footer';
12+
/**
13+
* @var string
14+
*/
15+
protected $hook = 'wp_footer';
1316

1417
public function handle(): void
1518
{

src/Actions/AddPluginSettingsLink.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ class AddPluginSettingsLink
1111
{
1212
use Action;
1313

14-
protected string $hook = 'plugin_action_links_' . PLUGIN_BASENAME;
14+
/**
15+
* @var string
16+
*/
17+
protected $hook = 'plugin_action_links_' . PLUGIN_BASENAME;
1518

1619
public function handle($links): array
1720
{

src/Plugin.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ final class Plugin
1414
{
1515
use PluginLifecycle;
1616

17-
#[\Override]
1817
protected function onBoot(): void
1918
{
2019
if (is_admin()) {
@@ -23,29 +22,23 @@ protected function onBoot(): void
2322
}
2423
}
2524

26-
#[\Override]
2725
public function onActivation(): void
2826
{
2927
$this->addOptions();
3028
}
3129

32-
#[\Override]
3330
public function onUninstall(): void
3431
{
3532
$this->deleteOptions();
3633
}
3734

38-
#[\Override]
3935
public function onInit(): void
4036
{
4137
$shouldCollect = (new TrackingPolicy)->shouldCollectAnalytics();
42-
4338
$this->addScripts($shouldCollect);
44-
4539
if (! $shouldCollect) {
4640
AddInactiveComment::register();
4741
}
48-
4942
if ($shouldCollect && Setting::boolean(SettingName::NOSCRIPT)) {
5043
AddNoScriptTag::register();
5144
}
@@ -121,7 +114,9 @@ protected function defineAdminPage(): void
121114
$tab->callout('IP and role exclusion only works when there is no page caching.');
122115

123116
$tab->multiCheckbox(SettingName::EXCLUDED_ROLES, 'Exclude User Roles')
124-
->options(fn() => wp_roles()->get_names());
117+
->options(function () {
118+
return wp_roles()->get_names();
119+
});
125120

126121
$tab->ipList(SettingName::EXCLUDED_IP_ADDRESSES, 'Exclude IP Addresses')
127122
->placeholder("127.0.0.1\n192.168.0.1")

src/PluginLifecycle.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ trait PluginLifecycle
77
public function boot(): void
88
{
99
$this->onBoot();
10-
add_action('init', $this->onInit(...));
11-
register_activation_hook(ENTRYPOINT_FILE, $this->onActivation(...));
12-
register_deactivation_hook(ENTRYPOINT_FILE, $this->onUninstall(...));
10+
add_action('init', \Closure::fromCallable([$this, 'onInit']));
11+
register_activation_hook(ENTRYPOINT_FILE, \Closure::fromCallable([$this, 'onActivation']));
12+
register_deactivation_hook(ENTRYPOINT_FILE, \Closure::fromCallable([$this, 'onUninstall']));
1313
}
1414

1515
/** @internal */

src/ScriptManager.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@
1111
*/
1212
final class ScriptManager
1313
{
14-
public function __construct(
14+
private $scripts = [];
15+
public function __construct($scripts = [])
16+
{
1517
/** @var Script[] */
16-
private $scripts = []
17-
) {
18+
$this->scripts = $scripts;
1819
}
1920

2021
public function add(Script $script): void
@@ -45,7 +46,7 @@ protected function enqueueScripts(): void
4546
*/
4647
protected function addAttributes(): void
4748
{
48-
add_filter('wp_script_attributes', $this->addAttributesFilter(...), 10, 2);
49+
add_filter('wp_script_attributes', \Closure::fromCallable([$this, 'addAttributesFilter']), 10, 2);
4950
}
5051

5152
protected function addAttributesFilter($attributes)
@@ -55,7 +56,7 @@ protected function addAttributesFilter($attributes)
5556
$script instanceof HasAttributes &&
5657
$script->handle() . '-js' === $attributes['id']
5758
) {
58-
return [...$attributes, ...$script->attributes()];
59+
return array_merge(is_array($attributes) ? $attributes : iterator_to_array($attributes), $script->attributes());
5960
}
6061
}
6162

@@ -64,7 +65,7 @@ protected function addAttributesFilter($attributes)
6465

6566
protected function removeIds(): void
6667
{
67-
add_filter('script_loader_tag', $this->removeIdsFilter(...), 10, 2);
68+
add_filter('script_loader_tag', \Closure::fromCallable([$this, 'removeIdsFilter']), 10, 2);
6869
}
6970

7071
protected function removeIdsFilter($tag, $handle): string

src/Scripts/AnalyticsScript.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@
1010

1111
class AnalyticsScript implements Script, HasAttributes, HideScriptId
1212
{
13-
#[\Override]
1413
public function path(): string
1514
{
16-
return sprintf(
17-
"https://%s/latest.js",
18-
Setting::get(SettingName::CUSTOM_DOMAIN, 'scripts.simpleanalyticscdn.com'),
19-
);
15+
return sprintf("https://%s/latest.js", Setting::get(SettingName::CUSTOM_DOMAIN, 'scripts.simpleanalyticscdn.com'));
2016
}
2117

22-
#[\Override]
2318
public function handle(): string
2419
{
2520
return 'simpleanalytics';
2621
}
2722

28-
#[\Override]
2923
public function attributes(): array
3024
{
3125
return array_filter([

0 commit comments

Comments
 (0)