From 9f3d07d7f8ca2b1c982ec6b53f08deee4d5bcd5e Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 01:54:01 +1100 Subject: [PATCH 01/40] add PHP 8 polyfill;bump deps --- composer.json | 1 + composer.lock | 126 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 107 insertions(+), 20 deletions(-) diff --git a/composer.json b/composer.json index cd5d2b0a..ad95c621 100644 --- a/composer.json +++ b/composer.json @@ -26,6 +26,7 @@ "php": ">=7.4", "wa72/url": "^0.7.1", "leonstafford/wp2staticguzzle": "^7.2.0", + "symfony/polyfill-php80": "^1.27.0", "ext-mbstring": "*", "ext-simplexml": "*", "lib-libxml": "*" diff --git a/composer.lock b/composer.lock index ee159219..497ff34c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7316e9fdacf5afa5df610fc114420f9f", + "content-hash": "d0614914f2b6ccbf97f270efbfc50da2", "packages": [ { "name": "leonstafford/wp2staticguzzle", @@ -364,6 +364,89 @@ }, "time": "2019-03-08T08:55:37+00:00" }, + { + "name": "symfony/polyfill-php80", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, { "name": "wa72/url", "version": "v0.7.1", @@ -511,35 +594,38 @@ }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.7.2", + "version": "v1.0.0", "source": { "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + "url": "https://github.com/PHPCSStandards/composer-installer.git", + "reference": "4be43904336affa5c2f70744a348312336afd0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", - "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "url": "https://api.github.com/repos/PHPCSStandards/composer-installer/zipball/4be43904336affa5c2f70744a348312336afd0da", + "reference": "4be43904336affa5c2f70744a348312336afd0da", "shasum": "" }, "require": { "composer-plugin-api": "^1.0 || ^2.0", - "php": ">=5.3", + "php": ">=5.4", "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" }, "require-dev": { "composer/composer": "*", + "ext-json": "*", + "ext-zip": "*", "php-parallel-lint/php-parallel-lint": "^1.3.1", - "phpcompatibility/php-compatibility": "^9.0" + "phpcompatibility/php-compatibility": "^9.0", + "yoast/phpunit-polyfills": "^1.0" }, "type": "composer-plugin", "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + "class": "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" }, "autoload": { "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + "PHPCSStandards\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -555,7 +641,7 @@ }, { "name": "Contributors", - "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + "homepage": "https://github.com/PHPCSStandards/composer-installer/graphs/contributors" } ], "description": "PHP_CodeSniffer Standards Composer Installer Plugin", @@ -579,10 +665,10 @@ "tests" ], "support": { - "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", - "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + "issues": "https://github.com/PHPCSStandards/composer-installer/issues", + "source": "https://github.com/PHPCSStandards/composer-installer" }, - "time": "2022-02-04T12:51:07+00:00" + "time": "2023-01-05T11:28:13+00:00" }, { "name": "doctrine/instantiator", @@ -1222,16 +1308,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.6", + "version": "1.9.9", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e" + "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", - "reference": "ef38a25950e5d0e6c95eedf49d8a784272f8dc5e", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", + "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", "shasum": "" }, "require": { @@ -1261,7 +1347,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.6" + "source": "https://github.com/phpstan/phpstan/tree/1.9.9" }, "funding": [ { @@ -1277,7 +1363,7 @@ "type": "tidelift" } ], - "time": "2023-01-03T13:40:32+00:00" + "time": "2023-01-11T14:39:22+00:00" }, { "name": "phpunit/php-code-coverage", From 64e7d6adb16546a287a4e07c098c84bcfc04d0be Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 02:03:17 +1100 Subject: [PATCH 02/40] rm unused diagnostics page placeholder - was preventing admin notice from displaying only on this page, serves no purpose, so removed --- views/diagnostics-page.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/views/diagnostics-page.php b/views/diagnostics-page.php index 8c26a681..9c84dfea 100755 --- a/views/diagnostics-page.php +++ b/views/diagnostics-page.php @@ -178,15 +178,4 @@ class="dashicons - -
- TODO: load add-on diagnostics here, via filter - - ie - -

PHP DOMDocument library available

- $view['domDocumentAvailable'] = class_exists( 'DOMDocument' ); -

You're missing a required PHP library (DOMDocument)

-

This is a library that is used to parse the HTML documents when WP2Static crawls your site. It's usually an easy fix to get this working. You can try Googling "DOMDocument missing", along with the name of the environment you are using to run your WordPress site. This may be something like DigitalOcean, GoDaddy or LAMP, MAMP, WAMP for your webserver on your local computer. If you're still having trouble, the developer of this plugin is eager to help you get up and running. Please ask for help on our forum.

-
From 762906074cb438a150ac56ad77660e6278d24973 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 02:05:21 +1100 Subject: [PATCH 03/40] WIP show default admin notice --- css/admin/style.css | 8 ++++++++ src/AdminNotices.php | 39 +++++++++++++++++++++++++++++++++++++++ src/ViewRenderer.php | 2 ++ src/WordPressAdmin.php | 11 +++++++++++ 4 files changed, 60 insertions(+) create mode 100755 src/AdminNotices.php diff --git a/css/admin/style.css b/css/admin/style.css index c719176c..ffada755 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -8,3 +8,11 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { color: #FB4247; font-weight: bold; } + +.wp2static-admin-notice { + margin-left: 2px; + margin-right: 36px; + margin-top: 20px; + margin-bottom: -7px; + padding-top: 10px; +} diff --git a/src/AdminNotices.php b/src/AdminNotices.php new file mode 100755 index 00000000..29953204 --- /dev/null +++ b/src/AdminNotices.php @@ -0,0 +1,39 @@ +%2$s

%3$s

', + esc_attr( $class ), + esc_html( $title ), + esc_html( $message ) + ); + } +} + diff --git a/src/ViewRenderer.php b/src/ViewRenderer.php index b64488fa..7ca5574e 100644 --- a/src/ViewRenderer.php +++ b/src/ViewRenderer.php @@ -27,6 +27,8 @@ public static function renderAdvancedOptionsPage() : void { } public static function renderDiagnosticsPage() : void { + CoreOptions::init(); + $view = []; $view['memoryLimit'] = ini_get( 'memory_limit' ); $view['coreOptions'] = array_values( CoreOptions::getAll() ); diff --git a/src/WordPressAdmin.php b/src/WordPressAdmin.php index d56428d0..da76d703 100755 --- a/src/WordPressAdmin.php +++ b/src/WordPressAdmin.php @@ -341,6 +341,17 @@ public static function registerHooks( string $bootstrap_file ) : void { 10, 2 ); + + // show admin notices on WP2Static pages if rules are met + if ( str_contains( URLHelper::getCurrent(), 'page=wp2static' ) ) { + error_log('WP2Static page'); + + add_action( + 'admin_notices', + [ AdminNotices::class, 'showAdminNotices' ], + 0 + ); + } } /** From c2a6f4bbd8db5d42e5e843f33f45457bd1b273c8 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 02:14:49 +1100 Subject: [PATCH 04/40] add CTA buttons to admin notice --- css/admin/style.css | 6 ++++++ src/AdminNotices.php | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/css/admin/style.css b/css/admin/style.css index ffada755..1544b1f1 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -15,4 +15,10 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { margin-top: 20px; margin-bottom: -7px; padding-top: 10px; + +} + +.wp2static-admin-notice a .button-primary { + margin-bottom: 10px; + margin-right: 10px; } diff --git a/src/AdminNotices.php b/src/AdminNotices.php index 29953204..4a288d29 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -29,10 +29,17 @@ public static function showAdminNotices() : void { $secondary_button_url = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; printf( - '
%2$s

%3$s

', + '
%2$s

%3$s

' . + '' . + '' . + '
', esc_attr( $class ), esc_html( $title ), - esc_html( $message ) + esc_html( $message ), + esc_html( $primary_button_url ), + esc_html( $primary_button_title ), + esc_html( $secondary_button_url ), + esc_html( $secondary_button_title ) ); } } From 96e62ef78c931463fc61717c7596ecbc237e4598 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 02:20:53 +1100 Subject: [PATCH 05/40] phpcs tidy up --- src/AdminNotices.php | 12 +++++++++--- src/WordPressAdmin.php | 2 -- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index 4a288d29..af51971e 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -2,7 +2,7 @@ /* AdminNotices - Displays admin notices in WP2Static screens according to rules + Displays admin notices in WP2Static screens according to rules */ namespace WP2Static; @@ -21,16 +21,22 @@ public function __construct() { */ public static function showAdminNotices() : void { $class = 'notice notice-error is-dismissable wp2static-admin-notice'; - $title = 'Super charge your static website using Strattic by Elementor!'; - $message = "Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!"; + $title = + 'Super charge your static website using Strattic by Elementor!'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $message = 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!'; $primary_button_title = 'Start my trial'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded $primary_button_url = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; $secondary_button_title = 'Learn more'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded $secondary_button_url = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; printf( '
%2$s

%3$s

' . + // phpcs:disable Generic.Files.LineLength.TooLong '' . + // phpcs:disable Generic.Files.LineLength.TooLong '' . '
', esc_attr( $class ), diff --git a/src/WordPressAdmin.php b/src/WordPressAdmin.php index da76d703..f75a95cb 100755 --- a/src/WordPressAdmin.php +++ b/src/WordPressAdmin.php @@ -344,8 +344,6 @@ public static function registerHooks( string $bootstrap_file ) : void { // show admin notices on WP2Static pages if rules are met if ( str_contains( URLHelper::getCurrent(), 'page=wp2static' ) ) { - error_log('WP2Static page'); - add_action( 'admin_notices', [ AdminNotices::class, 'showAdminNotices' ], From d6e30cc168e21fa3272e54dc9243ee6a4eed4910 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Thu, 12 Jan 2023 02:27:52 +1100 Subject: [PATCH 06/40] rm redundant lines --- css/admin/style.css | 1 - src/ViewRenderer.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/css/admin/style.css b/css/admin/style.css index 1544b1f1..5ec82677 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -15,7 +15,6 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { margin-top: 20px; margin-bottom: -7px; padding-top: 10px; - } .wp2static-admin-notice a .button-primary { diff --git a/src/ViewRenderer.php b/src/ViewRenderer.php index 7ca5574e..b64488fa 100644 --- a/src/ViewRenderer.php +++ b/src/ViewRenderer.php @@ -27,8 +27,6 @@ public static function renderAdvancedOptionsPage() : void { } public static function renderDiagnosticsPage() : void { - CoreOptions::init(); - $view = []; $view['memoryLimit'] = ini_get( 'memory_limit' ); $view['coreOptions'] = array_values( CoreOptions::getAll() ); From b0d42bcbdabf387a7a18eaa939606f30329d294c Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Mon, 16 Jan 2023 22:04:56 +1100 Subject: [PATCH 07/40] limit notices to upload_plugins capability --- src/AdminNotices.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index af51971e..c917d612 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -9,17 +9,14 @@ class AdminNotices { - /** - * AdminNotices constructor - */ - public function __construct() { - - } - /** * Displays WP2Static admin notices */ - public static function showAdminNotices() : void { + public function showAdminNotices() : void { + if ( ! self::userAllowedToSeeNotices() ) { + return; + } + $class = 'notice notice-error is-dismissable wp2static-admin-notice'; $title = 'Super charge your static website using Strattic by Elementor!'; @@ -48,5 +45,12 @@ public static function showAdminNotices() : void { esc_html( $secondary_button_title ) ); } + + /** + * Determine if a user should user see any notices + */ + public function userAllowedToSeeNotices() : bool { + return current_user_can( 'upload_plugins' ); + } } From 322ce46d8c1cf45951cfef30af54056a34abfc7b Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Mon, 16 Jan 2023 22:57:40 +1100 Subject: [PATCH 08/40] WIP notify backend of notice dismissal --- css/admin/style.css | 6 ++++++ js/admin/override-menu-style.js | 9 +++++++++ src/AdminNotices.php | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/css/admin/style.css b/css/admin/style.css index 5ec82677..1c054a76 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -21,3 +21,9 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { margin-bottom: 10px; margin-right: 10px; } + +#wp2static-admin-notice-dismiss-generic { + display: block; + float: right; + margin-top: 10px; +} diff --git a/js/admin/override-menu-style.js b/js/admin/override-menu-style.js index 82e3a077..363cb40c 100644 --- a/js/admin/override-menu-style.js +++ b/js/admin/override-menu-style.js @@ -12,4 +12,13 @@ document.addEventListener("DOMContentLoaded", function(event) { // set a custom external href for the submenu item try1ClickPublish.href = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_content=sidebar'; + // send admin notice dismissal events to backend + const wp2staticAdminNotice = document.querySelector('.wp2static-admin-notice'); + + wp2staticAdminNotice.addEventListener('click', function (e) { + if (e.target.className === 'wp2static-admin-notice-dismiss') { + // notify backend which admin notice was dismissed by user + console.log(e.target.id); + } + }); }); diff --git a/src/AdminNotices.php b/src/AdminNotices.php index c917d612..d34d76d3 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -17,7 +17,7 @@ public function showAdminNotices() : void { return; } - $class = 'notice notice-error is-dismissable wp2static-admin-notice'; + $class = 'notice notice-error wp2static-admin-notice'; $title = 'Super charge your static website using Strattic by Elementor!'; // phpcs:disable Generic.Files.LineLength.MaxExceeded @@ -35,6 +35,7 @@ public function showAdminNotices() : void { '' . // phpcs:disable Generic.Files.LineLength.TooLong '' . + 'Don\'t show this again' . '', esc_attr( $class ), esc_html( $title ), From 7f5e903ee966a0faa0c9c091bf10071831ed42ec Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Mon, 16 Jan 2023 23:30:04 +1100 Subject: [PATCH 09/40] WIP notify backend of notice dismissal --- css/admin/style.css | 4 ++++ js/admin/override-menu-style.js | 27 +++++++++++++++++++++++++-- src/AdminNotices.php | 11 +++++++++++ src/WordPressAdmin.php | 7 +++++++ 4 files changed, 47 insertions(+), 2 deletions(-) diff --git a/css/admin/style.css b/css/admin/style.css index 1c054a76..7c0cc82f 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -27,3 +27,7 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { float: right; margin-top: 10px; } + +#wp2static-admin-notice-nonce { + display: none; +} diff --git a/js/admin/override-menu-style.js b/js/admin/override-menu-style.js index 363cb40c..f3da7f91 100644 --- a/js/admin/override-menu-style.js +++ b/js/admin/override-menu-style.js @@ -1,4 +1,4 @@ -document.addEventListener("DOMContentLoaded", function(event) { +jQuery(document).ready(function($){ // locate the submenu item by partial match of its href value const try1ClickPublish = document.querySelector('a[href*="wp2static-try-1-click-publish"]'); @@ -18,7 +18,30 @@ document.addEventListener("DOMContentLoaded", function(event) { wp2staticAdminNotice.addEventListener('click', function (e) { if (e.target.className === 'wp2static-admin-notice-dismiss') { // notify backend which admin notice was dismissed by user - console.log(e.target.id); + dismissedAdminNotice = e.target.id.replace('wp2static-admin-notice-dismiss-', '') + + adminNoticeNonce = + document.querySelector('#wp2static-admin-notice-nonce').textContent; + + const ajax_data = { + action: 'wp2static_admin_notice_dismissal', + security: adminNoticeNonce, + dismissedNotice: dismissedAdminNotice, + }; + + $.ajax({ + url: ajaxurl, + type: 'POST', + data: ajax_data, + timeout: 0, + success: function() { + // hide the admin notice once backend has handled it + wp2staticAdminNotice.remove(); + }, + error: function() { + alert('Couldn\'t dismiss WP2Static admin notice. Please try again.'); +} + }); } }); }); diff --git a/src/AdminNotices.php b/src/AdminNotices.php index d34d76d3..f8f68270 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -36,6 +36,8 @@ public function showAdminNotices() : void { // phpcs:disable Generic.Files.LineLength.TooLong '' . 'Don\'t show this again' . + '
' . + wp_create_nonce( 'wp2static-admin-notice' ) . '
' . '', esc_attr( $class ), esc_html( $title ), @@ -45,6 +47,7 @@ public function showAdminNotices() : void { esc_html( $secondary_button_url ), esc_html( $secondary_button_title ) ); + $run_nonce = wp_create_nonce( 'wp2static-run-page' ); } /** @@ -53,5 +56,13 @@ public function showAdminNotices() : void { public function userAllowedToSeeNotices() : bool { return current_user_can( 'upload_plugins' ); } + + public function handleDismissedNotice( string $dismissed_notice ) : void { + check_ajax_referer( 'wp2static-admin-notice', 'security' ); + + error_log( filter_input( INPUT_POST, 'dismissedNotice' ) ); + + wp_die(); + } } diff --git a/src/WordPressAdmin.php b/src/WordPressAdmin.php index f75a95cb..3a3e9885 100755 --- a/src/WordPressAdmin.php +++ b/src/WordPressAdmin.php @@ -342,6 +342,13 @@ public static function registerHooks( string $bootstrap_file ) : void { 2 ); + add_action( + 'wp_ajax_wp2static_admin_notice_dismissal', + [ AdminNotices::class, 'handleDismissedNotice' ], + 10, + 1 + ); + // show admin notices on WP2Static pages if rules are met if ( str_contains( URLHelper::getCurrent(), 'page=wp2static' ) ) { add_action( From 2c4d1560b90bad868e108a928bc650959390eba1 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Tue, 17 Jan 2023 00:41:22 +1100 Subject: [PATCH 10/40] log display/dismissal of admin notices --- css/admin/style.css | 2 +- js/admin/override-menu-style.js | 65 ++++++++++++++++++--------------- src/AdminNotices.php | 48 ++++++++++++++++++++++-- src/Controller.php | 1 + 4 files changed, 83 insertions(+), 33 deletions(-) diff --git a/css/admin/style.css b/css/admin/style.css index 7c0cc82f..ad0946cb 100644 --- a/css/admin/style.css +++ b/css/admin/style.css @@ -28,6 +28,6 @@ a[href*="wp2static-try-1-click-publish"], .try-1-click-publish-menu-item { margin-top: 10px; } -#wp2static-admin-notice-nonce { +#wp2static-admin-notice-nonce, #wp2static-admin-notice-user-id { display: none; } diff --git a/js/admin/override-menu-style.js b/js/admin/override-menu-style.js index f3da7f91..69e76e70 100644 --- a/js/admin/override-menu-style.js +++ b/js/admin/override-menu-style.js @@ -15,33 +15,40 @@ jQuery(document).ready(function($){ // send admin notice dismissal events to backend const wp2staticAdminNotice = document.querySelector('.wp2static-admin-notice'); - wp2staticAdminNotice.addEventListener('click', function (e) { - if (e.target.className === 'wp2static-admin-notice-dismiss') { - // notify backend which admin notice was dismissed by user - dismissedAdminNotice = e.target.id.replace('wp2static-admin-notice-dismiss-', '') - - adminNoticeNonce = - document.querySelector('#wp2static-admin-notice-nonce').textContent; - - const ajax_data = { - action: 'wp2static_admin_notice_dismissal', - security: adminNoticeNonce, - dismissedNotice: dismissedAdminNotice, - }; - - $.ajax({ - url: ajaxurl, - type: 'POST', - data: ajax_data, - timeout: 0, - success: function() { - // hide the admin notice once backend has handled it - wp2staticAdminNotice.remove(); - }, - error: function() { - alert('Couldn\'t dismiss WP2Static admin notice. Please try again.'); -} - }); - } - }); + if ( wp2staticAdminNotice ) { + wp2staticAdminNotice.addEventListener('click', function (e) { + if (e.target.className === 'wp2static-admin-notice-dismiss') { + // notify backend which admin notice was dismissed by user + dismissedAdminNotice = e.target.id.replace('wp2static-admin-notice-dismiss-', '') + + adminNoticeNonce = + document.querySelector('#wp2static-admin-notice-nonce').textContent; + + adminNoticeUserID = + document.querySelector('#wp2static-admin-notice-user-id').textContent; + + const ajax_data = { + action: 'wp2static_admin_notice_dismissal', + security: adminNoticeNonce, + dismissedNotice: dismissedAdminNotice, + userID: adminNoticeUserID, + }; + + $.ajax({ + url: ajaxurl, + type: 'POST', + data: ajax_data, + timeout: 0, + success: function() { + // hide the admin notice once backend has handled it + wp2staticAdminNotice.remove(); + }, + error: function() { + alert('Couldn\'t dismiss WP2Static admin notice. Please try again.'); + } + }); + } + }); + + } }); diff --git a/src/AdminNotices.php b/src/AdminNotices.php index f8f68270..d0f45696 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -9,6 +9,26 @@ class AdminNotices { + public static function createTable() : void { + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_notices'; + + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE $table_name ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + name VARCHAR(191) NOT NULL, + user_id bigint(20) NOT NULL, + action VARCHAR(191) NOT NULL, + timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (id) + ) $charset_collate;"; + + require_once ABSPATH . 'wp-admin/includes/upgrade.php'; + dbDelta( $sql ); + } + /** * Displays WP2Static admin notices */ @@ -17,6 +37,8 @@ public function showAdminNotices() : void { return; } + self::logNoticeAction( 'generic', 'displayed' ); + $class = 'notice notice-error wp2static-admin-notice'; $title = 'Super charge your static website using Strattic by Elementor!'; @@ -38,6 +60,8 @@ public function showAdminNotices() : void { 'Don\'t show this again' . '
' . wp_create_nonce( 'wp2static-admin-notice' ) . '
' . + '
' . + get_current_user_id() . '
' . '', esc_attr( $class ), esc_html( $title ), @@ -47,7 +71,6 @@ public function showAdminNotices() : void { esc_html( $secondary_button_url ), esc_html( $secondary_button_title ) ); - $run_nonce = wp_create_nonce( 'wp2static-run-page' ); } /** @@ -57,12 +80,31 @@ public function userAllowedToSeeNotices() : bool { return current_user_can( 'upload_plugins' ); } - public function handleDismissedNotice( string $dismissed_notice ) : void { + public function handleDismissedNotice() : void { check_ajax_referer( 'wp2static-admin-notice', 'security' ); - error_log( filter_input( INPUT_POST, 'dismissedNotice' ) ); + $dismissed_notice = strval( filter_input( INPUT_POST, 'dismissedNotice' ) ); + + self::logNoticeAction( $dismissed_notice, 'dismissed' ); wp_die(); } + + public function logNoticeAction( string $notice_name, string $action ) : void { + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_notices'; + + $current_user_id = get_current_user_id(); + + $wpdb->insert( + $table_name, + [ + 'name' => $notice_name, + 'user_id' => $current_user_id, + 'action' => $action, + ] + ); + } } diff --git a/src/Controller.php b/src/Controller.php index c1f5bf54..8304487a 100755 --- a/src/Controller.php +++ b/src/Controller.php @@ -109,6 +109,7 @@ public static function activateForSingleSite() : void { DeployCache::createTable(); JobQueue::createTable(); Addons::createTable(); + AdminNotices::createTable(); } public static function activate( bool $network_wide = null ) : void { From fc2fdc78111d2e80b59089855e84d90005bc0246 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Tue, 17 Jan 2023 19:08:14 +1100 Subject: [PATCH 11/40] restrict to manage_options capability vs upload_plugins --- src/AdminNotices.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index d0f45696..671f80f4 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -77,7 +77,7 @@ public function showAdminNotices() : void { * Determine if a user should user see any notices */ public function userAllowedToSeeNotices() : bool { - return current_user_can( 'upload_plugins' ); + return current_user_can( 'manage_options' ); } public function handleDismissedNotice() : void { From a5374b3bce3b5dd14f1a9ccee9a27b3e82d3da3f Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Tue, 17 Jan 2023 19:21:37 +1100 Subject: [PATCH 12/40] WIP rules based notice showing --- src/AdminNotices.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index 671f80f4..24d5f9d5 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -37,6 +37,12 @@ public function showAdminNotices() : void { return; } + $notice_to_display = self::getNoticeBasedOnRules(); + + if ( ! $notice_to_display ) { + return; + } + self::logNoticeAction( 'generic', 'displayed' ); $class = 'notice notice-error wp2static-admin-notice'; @@ -106,5 +112,14 @@ public function logNoticeAction( string $notice_name, string $action ) : void { ] ); } + + /** + * Apply rules to determine which, if any, notice to show + * + * @return object|null + */ + public function getNoticeBasedOnRules() { + return null; + } } From 04792eff19f6e0dfb665e41c4f82b620982f087d Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Tue, 17 Jan 2023 20:10:28 +1100 Subject: [PATCH 13/40] don't show already dismissed notice --- src/AdminNotices.php | 74 +++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index 24d5f9d5..736bb55a 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -43,19 +43,7 @@ public function showAdminNotices() : void { return; } - self::logNoticeAction( 'generic', 'displayed' ); - - $class = 'notice notice-error wp2static-admin-notice'; - $title = - 'Super charge your static website using Strattic by Elementor!'; - // phpcs:disable Generic.Files.LineLength.MaxExceeded - $message = 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!'; - $primary_button_title = 'Start my trial'; - // phpcs:disable Generic.Files.LineLength.MaxExceeded - $primary_button_url = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; - $secondary_button_title = 'Learn more'; - // phpcs:disable Generic.Files.LineLength.MaxExceeded - $secondary_button_url = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + self::logNoticeAction( $notice_to_display['name'], 'displayed' ); printf( '
%2$s

%3$s

' . @@ -63,19 +51,20 @@ public function showAdminNotices() : void { '' . // phpcs:disable Generic.Files.LineLength.TooLong '' . + // phpcs:disable Generic.Files.LineLength.MaxExceeded 'Don\'t show this again' . '
' . wp_create_nonce( 'wp2static-admin-notice' ) . '
' . '
' . get_current_user_id() . '
' . '
', - esc_attr( $class ), - esc_html( $title ), - esc_html( $message ), - esc_html( $primary_button_url ), - esc_html( $primary_button_title ), - esc_html( $secondary_button_url ), - esc_html( $secondary_button_title ) + esc_attr( $notice_to_display['class'] ), + esc_html( $notice_to_display['title'] ), + esc_html( $notice_to_display['message'] ), + esc_html( $notice_to_display['primary_button_url'] ), + esc_html( $notice_to_display['primary_button_title'] ), + esc_html( $notice_to_display['secondary_button_url'] ), + esc_html( $notice_to_display['secondary_button_title'] ) ); } @@ -116,10 +105,51 @@ public function logNoticeAction( string $notice_name, string $action ) : void { /** * Apply rules to determine which, if any, notice to show * - * @return object|null + * @return string[]|null */ public function getNoticeBasedOnRules() { - return null; + // don't show if no publish history (empty CrawlCache) + if ( CrawlCache::getTotal() === 0 ) { + return null; + } + + $notice = [ + 'name' => 'generic', + 'class' => 'notice notice-error wp2static-admin-notice', + 'title' => + 'Super charge your static website using Strattic by Elementor!', + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'message' => 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!', + 'primary_button_title' => 'Start my trial', + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'primary_button_url' => 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner', + 'secondary_button_title' => 'Learn more', + // phpcs:disable Generic.Files.LineLength.MaxExceeded + 'secondary_button_url' => 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner', + ]; + + // don't show if same notice has been dismissed by this user + $current_user_id = get_current_user_id(); + + // query for notice matching name, user id and 'dismissed' action + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_notices'; + + $sql = $wpdb->prepare( + "SELECT count(*) FROM $table_name WHERE" . + ' name = %s AND user_id = %s AND action = "dismissed"', + $notice['name'], + $current_user_id + ); + + $already_dismissed = $wpdb->get_var( $sql ); + + if ( $already_dismissed != 0 ) { + return null; + } + + return $notice; } } From cd9d1af13b72c89223538001cd78f3f5f8994bfd Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Tue, 17 Jan 2023 20:20:09 +1100 Subject: [PATCH 14/40] WIP apply notice conditional logic --- src/AdminNotices.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index 736bb55a..aeda8028 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -113,21 +113,24 @@ public function getNoticeBasedOnRules() { return null; } + // common notice properties $notice = [ 'name' => 'generic', 'class' => 'notice notice-error wp2static-admin-notice', - 'title' => - 'Super charge your static website using Strattic by Elementor!', - // phpcs:disable Generic.Files.LineLength.MaxExceeded - 'message' => 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!', 'primary_button_title' => 'Start my trial', - // phpcs:disable Generic.Files.LineLength.MaxExceeded - 'primary_button_url' => 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner', 'secondary_button_title' => 'Learn more', - // phpcs:disable Generic.Files.LineLength.MaxExceeded - 'secondary_button_url' => 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner', ]; + // if no other notices to be shown, fall back to this generic one + $notice['title'] = + 'Super charge your static website using Strattic by Elementor!'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['message'] = 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['primary_button_url'] = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['secondary_button_url'] = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + // don't show if same notice has been dismissed by this user $current_user_id = get_current_user_id(); From ae20dfda213fca00e974e82687af439c2ab81c1f Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Sun, 22 Jan 2023 14:05:53 +1100 Subject: [PATCH 15/40] WIP detect CF7/GF plugins --- src/AdminNotices.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/AdminNotices.php b/src/AdminNotices.php index aeda8028..72b1751e 100755 --- a/src/AdminNotices.php +++ b/src/AdminNotices.php @@ -121,15 +121,32 @@ public function getNoticeBasedOnRules() { 'secondary_button_title' => 'Learn more', ]; - // if no other notices to be shown, fall back to this generic one - $notice['title'] = - 'Super charge your static website using Strattic by Elementor!'; + // show notice if Contact Form 7 active + if ( defined( 'WPCF7_VERSION' ) || defined( 'GRAVITY_FORMS' ) ) { + $activated_form_plugin = + defined( 'GRAVITY_FORMS' ) ? 'Gravity Forms' : 'Contact Form 7'; + + $notice['title'] = + 'Want integrated forms on your static site, out-of-the-box?'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['message'] = "Strattic by Elementor lets you use $activated_form_plugin on your static site, without implementing any extra configurations. Get it, plus secure and simple WordPress static hosting. Start a 14 days free trial today, no credit card required!"; // phpcs:disable Generic.Files.LineLength.MaxExceeded - $notice['message'] = 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!'; - // phpcs:disable Generic.Files.LineLength.MaxExceeded - $notice['primary_button_url'] = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; - // phpcs:disable Generic.Files.LineLength.MaxExceeded - $notice['secondary_button_url'] = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + $notice['primary_button_url'] = 'https://www.strattic.com/static-tools/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=plugin-form&utm_content=wp-notification-banner'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['secondary_button_url'] = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=plugin-form&utm_content=wp-notification-banner'; + + } else { + // if no other notices to be shown, fall back to this generic one + $notice['title'] = + 'Super charge your static website using Strattic by Elementor!'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['message'] = 'Enjoy blindingly fast, secure and simple WordPress static hosting, with dozens of dynamic features. Get 14 days for free. No credit card required!'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['primary_button_url'] = 'https://www.strattic.com/pricing/?utm_campaign=start-trial&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + // phpcs:disable Generic.Files.LineLength.MaxExceeded + $notice['secondary_button_url'] = 'https://www.strattic.com/static-tools/?utm_campaign=learn-more&utm_source=wp2static&utm_medium=wp-dash&utm_term=general&utm_content=wp-notification-banner'; + } + // don't show if same notice has been dismissed by this user $current_user_id = get_current_user_id(); From e31ab79b4aa8a062aaff2d57449df39d2f9466c2 Mon Sep 17 00:00:00 2001 From: Leon Stafford Date: Sun, 22 Jan 2023 14:17:42 +1100 Subject: [PATCH 16/40] suppresss wpcs trim() warning - WPCS won't play nicely with PHP 8 until their 3.0 release --- composer.lock | 64 ++++++++++++++++++++++++------------------------- tools/phpcs.xml | 5 ++++ 2 files changed, 37 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index 497ff34c..b06c6391 100644 --- a/composer.lock +++ b/composer.lock @@ -672,30 +672,30 @@ }, { "name": "doctrine/instantiator", - "version": "1.5.0", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b" + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/0a0fa9780f5d4e507415a065172d26a98d02047b", - "reference": "0a0fa9780f5d4e507415a065172d26a98d02047b", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", + "reference": "c6222283fa3f4ac679f8b9ced9a4e23f163e80d0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^8.1" }, "require-dev": { - "doctrine/coding-standard": "^9 || ^11", + "doctrine/coding-standard": "^11", "ext-pdo": "*", "ext-phar": "*", - "phpbench/phpbench": "^0.16 || ^1", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-phpunit": "^1", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "vimeo/psalm": "^4.30 || ^5.4" + "phpbench/phpbench": "^1.2", + "phpstan/phpstan": "^1.9.4", + "phpstan/phpstan-phpunit": "^1.3", + "phpunit/phpunit": "^9.5.27", + "vimeo/psalm": "^5.4" }, "type": "library", "autoload": { @@ -722,7 +722,7 @@ ], "support": { "issues": "https://github.com/doctrine/instantiator/issues", - "source": "https://github.com/doctrine/instantiator/tree/1.5.0" + "source": "https://github.com/doctrine/instantiator/tree/2.0.0" }, "funding": [ { @@ -738,7 +738,7 @@ "type": "tidelift" } ], - "time": "2022-12-30T00:15:36+00:00" + "time": "2022-12-30T00:23:10+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -975,16 +975,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.2", + "version": "v4.15.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc" + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", - "reference": "f59bbe44bf7d96f24f3e2b4ddc21cd52c1d2adbc", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/570e980a201d8ed0236b0a62ddf2c9cbb2034039", + "reference": "570e980a201d8ed0236b0a62ddf2c9cbb2034039", "shasum": "" }, "require": { @@ -1025,9 +1025,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.3" }, - "time": "2022-11-12T15:38:23+00:00" + "time": "2023-01-16T22:05:37+00:00" }, { "name": "phar-io/manifest", @@ -1308,16 +1308,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.9.9", + "version": "1.9.14", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d" + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", - "reference": "f68d7cc3d0638a01bc6321cb826e4cae7fa6884d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e5fcc96289cf737304286a9b505fbed091f02e58", + "reference": "e5fcc96289cf737304286a9b505fbed091f02e58", "shasum": "" }, "require": { @@ -1347,7 +1347,7 @@ ], "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.9.9" + "source": "https://github.com/phpstan/phpstan/tree/1.9.14" }, "funding": [ { @@ -1363,7 +1363,7 @@ "type": "tidelift" } ], - "time": "2023-01-11T14:39:22+00:00" + "time": "2023-01-19T10:47:09+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1685,20 +1685,20 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.27", + "version": "9.5.28", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38" + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a2bc7ffdca99f92d959b3f2270529334030bba38", - "reference": "a2bc7ffdca99f92d959b3f2270529334030bba38", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/954ca3113a03bf780d22f07bf055d883ee04b65e", + "reference": "954ca3113a03bf780d22f07bf055d883ee04b65e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.3.1", + "doctrine/instantiator": "^1.3.1 || ^2", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", @@ -1767,7 +1767,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.27" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.28" }, "funding": [ { @@ -1783,7 +1783,7 @@ "type": "tidelift" } ], - "time": "2022-12-09T07:31:23+00:00" + "time": "2023-01-14T12:32:24+00:00" }, { "name": "sebastian/cli-parser", diff --git a/tools/phpcs.xml b/tools/phpcs.xml index b841067b..7ce577fc 100755 --- a/tools/phpcs.xml +++ b/tools/phpcs.xml @@ -2,6 +2,11 @@ WP2Static Project Coding Standard + +