From 08e47913a7a5ba3bad9797675651708e92a92e49 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 09:09:33 +0000 Subject: [PATCH 1/6] build(deps-dev): bump squizlabs/php_codesniffer from 3.13.2 to 3.13.4 Bumps [squizlabs/php_codesniffer](https://github.com/PHPCSStandards/PHP_CodeSniffer) from 3.13.2 to 3.13.4. - [Release notes](https://github.com/PHPCSStandards/PHP_CodeSniffer/releases) - [Changelog](https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/CHANGELOG.md) - [Commits](https://github.com/PHPCSStandards/PHP_CodeSniffer/compare/3.13.2...3.13.4) --- updated-dependencies: - dependency-name: squizlabs/php_codesniffer dependency-version: 3.13.4 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index 1e9156c5..d10e1627 100644 --- a/composer.lock +++ b/composer.lock @@ -2347,16 +2347,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.13.2", + "version": "3.13.4", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c" + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5b5e3821314f947dd040c70f7992a64eac89025c", - "reference": "5b5e3821314f947dd040c70f7992a64eac89025c", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/ad545ea9c1b7d270ce0fc9cbfb884161cd706119", + "reference": "ad545ea9c1b7d270ce0fc9cbfb884161cd706119", "shasum": "" }, "require": { @@ -2427,7 +2427,7 @@ "type": "thanks_dev" } ], - "time": "2025-06-17T22:17:01+00:00" + "time": "2025-09-05T05:47:09+00:00" }, { "name": "symfony/polyfill-php73", From 2a3cb6c0a44121e4b9a76f1ab84ef3d0847bc66d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 09:21:13 +0000 Subject: [PATCH 2/6] chore(deps-dev): bump szepeviktor/phpstan-wordpress from 2.0.2 to 2.0.3 Bumps [szepeviktor/phpstan-wordpress](https://github.com/szepeviktor/phpstan-wordpress) from 2.0.2 to 2.0.3. - [Release notes](https://github.com/szepeviktor/phpstan-wordpress/releases) - [Commits](https://github.com/szepeviktor/phpstan-wordpress/compare/v2.0.2...v2.0.3) --- updated-dependencies: - dependency-name: szepeviktor/phpstan-wordpress dependency-version: 2.0.3 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/composer.lock b/composer.lock index 595bf547..2510ce85 100644 --- a/composer.lock +++ b/composer.lock @@ -634,16 +634,16 @@ }, { "name": "php-stubs/wordpress-stubs", - "version": "v6.8.1", + "version": "v6.8.2", "source": { "type": "git", "url": "https://github.com/php-stubs/wordpress-stubs.git", - "reference": "92e444847d94f7c30f88c60004648f507688acd5" + "reference": "9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/92e444847d94f7c30f88c60004648f507688acd5", - "reference": "92e444847d94f7c30f88c60004648f507688acd5", + "url": "https://api.github.com/repos/php-stubs/wordpress-stubs/zipball/9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8", + "reference": "9c8e22e437463197c1ec0d5eaa9ddd4a0eb6d7f8", "shasum": "" }, "conflict": { @@ -651,7 +651,7 @@ }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "nikic/php-parser": "^5.4", + "nikic/php-parser": "^5.5", "php": "^7.4 || ^8.0", "php-stubs/generator": "^0.8.3", "phpdocumentor/reflection-docblock": "^5.4.1", @@ -679,9 +679,9 @@ ], "support": { "issues": "https://github.com/php-stubs/wordpress-stubs/issues", - "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.8.1" + "source": "https://github.com/php-stubs/wordpress-stubs/tree/v6.8.2" }, - "time": "2025-05-02T12:33:34+00:00" + "time": "2025-07-16T06:41:00+00:00" }, { "name": "php-stubs/wp-cli-stubs", @@ -904,11 +904,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.30", + "version": "2.1.31", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a4a7f159927983dd4f7c8020ed227d80b7f39d7d", - "reference": "a4a7f159927983dd4f7c8020ed227d80b7f39d7d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96", + "reference": "ead89849d879fe203ce9292c6ef5e7e76f867b96", "shasum": "" }, "require": { @@ -953,7 +953,7 @@ "type": "github" } ], - "time": "2025-10-02T16:07:52+00:00" + "time": "2025-10-10T14:14:11+00:00" }, { "name": "phpunit/php-code-coverage", @@ -2426,16 +2426,16 @@ }, { "name": "szepeviktor/phpstan-wordpress", - "version": "v2.0.2", + "version": "v2.0.3", "source": { "type": "git", "url": "https://github.com/szepeviktor/phpstan-wordpress.git", - "reference": "963887b04c21fe7ac78e61c1351f8b00fff9f8f8" + "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/963887b04c21fe7ac78e61c1351f8b00fff9f8f8", - "reference": "963887b04c21fe7ac78e61c1351f8b00fff9f8f8", + "url": "https://api.github.com/repos/szepeviktor/phpstan-wordpress/zipball/aa722f037b2d034828cd6c55ebe9e5c74961927e", + "reference": "aa722f037b2d034828cd6c55ebe9e5c74961927e", "shasum": "" }, "require": { @@ -2445,6 +2445,7 @@ }, "require-dev": { "composer/composer": "^2.1.14", + "composer/semver": "^3.4", "dealerdirect/phpcodesniffer-composer-installer": "^1.0", "php-parallel-lint/php-parallel-lint": "^1.1", "phpstan/phpstan-strict-rules": "^2.0", @@ -2482,9 +2483,9 @@ ], "support": { "issues": "https://github.com/szepeviktor/phpstan-wordpress/issues", - "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.2" + "source": "https://github.com/szepeviktor/phpstan-wordpress/tree/v2.0.3" }, - "time": "2025-02-12T18:43:37+00:00" + "time": "2025-09-14T02:58:22+00:00" }, { "name": "theseer/tokenizer", From dee48e18ad9a6e3d98ea4f0d76c0ef249ba08058 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 09:23:50 +0000 Subject: [PATCH 3/6] chore(deps-dev): bump phpstan/phpstan from 2.1.30 to 2.1.31 --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-version: 2.1.31 dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.lock b/composer.lock index 595bf547..8be9cf88 100644 --- a/composer.lock +++ b/composer.lock @@ -904,11 +904,11 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.30", + "version": "2.1.31", "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/a4a7f159927983dd4f7c8020ed227d80b7f39d7d", - "reference": "a4a7f159927983dd4f7c8020ed227d80b7f39d7d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ead89849d879fe203ce9292c6ef5e7e76f867b96", + "reference": "ead89849d879fe203ce9292c6ef5e7e76f867b96", "shasum": "" }, "require": { @@ -953,7 +953,7 @@ "type": "github" } ], - "time": "2025-10-02T16:07:52+00:00" + "time": "2025-10-10T14:14:11+00:00" }, { "name": "phpunit/php-code-coverage", From 00fa96b4e85dbe6b1397f45aac63a5e68c129c49 Mon Sep 17 00:00:00 2001 From: selul Date: Fri, 31 Oct 2025 22:22:04 +0200 Subject: [PATCH 4/6] Fix localization errors and add phpcs sniffer to prevent misconfigured localization --- .../parts/connected/dashboard/index.js | 9 +-- .../parts/connected/settings/FilterControl.js | 2 +- assets/src/global.d.ts | 1 + inc/admin.php | 16 +++-- inc/dashboard_widget.php | 2 +- inc/rest.php | 64 ------------------- phpcs.xml | 8 +++ 7 files changed, 23 insertions(+), 79 deletions(-) diff --git a/assets/src/dashboard/parts/connected/dashboard/index.js b/assets/src/dashboard/parts/connected/dashboard/index.js index 968d6c88..cf784cc2 100644 --- a/assets/src/dashboard/parts/connected/dashboard/index.js +++ b/assets/src/dashboard/parts/connected/dashboard/index.js @@ -172,14 +172,7 @@ const Dashboard = () => { const visitorsLimitPercent = ( ( userData.visitors / userData.visitors_limit ) * 100 ).toFixed( 0 ); const renewalDate = useMemo( () => { - const timestamp = userData.renews_on; - - if ( ! timestamp ) { - return 'N/A'; - } - - const date = new Date( timestamp * 1000 ); - return date.toLocaleDateString( undefined, { year: 'numeric', month: 'short', day: 'numeric' }); + return userData.renews_on_formatted; }, [ userData.renews_on ]); const formatMetric = ( type, value ) => { diff --git a/assets/src/dashboard/parts/connected/settings/FilterControl.js b/assets/src/dashboard/parts/connected/settings/FilterControl.js index c3bcc6c5..afad28be 100644 --- a/assets/src/dashboard/parts/connected/settings/FilterControl.js +++ b/assets/src/dashboard/parts/connected/settings/FilterControl.js @@ -275,7 +275,7 @@ const FilterControl = ({ ) : ( diff --git a/assets/src/global.d.ts b/assets/src/global.d.ts index 4ddd9111..8eb9c54d 100644 --- a/assets/src/global.d.ts +++ b/assets/src/global.d.ts @@ -577,6 +577,7 @@ export interface UserData { is_cname_assigned: string extra_visits: boolean renews_on: number + renews_on_formatted: string can_use_offloading: boolean domain_dns: string } diff --git a/inc/admin.php b/inc/admin.php index 807994b3..4b98437f 100755 --- a/inc/admin.php +++ b/inc/admin.php @@ -1392,6 +1392,10 @@ private function localize_dashboard_app() { if ( ! empty( $service_data ) ) { $service_data['domain_dns'] = $this->settings->get_cdn_url(); } + if ( isset( $service_data['renews_on'] ) ) { + $service_data['renews_on_formatted'] = date_i18n( get_option( 'date_format' ), $service_data['renews_on'] ); + + } return [ 'strings' => $this->get_dashboard_strings(), 'assets_url' => OPTML_URL . 'assets/', @@ -1569,7 +1573,7 @@ public function get_bf_notices() { /* translators: number of days left */ 'urgency' => sprintf( __( 'Hurry up! only %s left', 'optimole-wp' ), human_time_diff( $end, $now ) ), /* translators: private sale */ - 'title' => sprintf( __( 'Black Friday %s', 'optimole-wp' ), '' . __( 'private sale' ) . '' ), + 'title' => sprintf( __( 'Black Friday %s', 'optimole-wp' ), '' . __( 'private sale', 'optimole-wp' ) . '' ), 'subtitle' => sprintf( /* translators: 1 is the promo code, 2 is the discount amount ('25 off') */ __( 'Use coupon code %1$s for an instant %2$s on Optimole yearly plans', 'optimole-wp' ), @@ -1601,7 +1605,7 @@ private function get_dashboard_strings() { 'dashboard_title' => __( 'Image Optimization Overview', 'optimole-wp' ), 'banner_title' => __( 'All images are automatically optimized!', 'optimole-wp' ), 'banner_description' => __( 'Optimole is handling all your images in real-time with our CloudFront CDN (450+ locations worldwide)', 'optimole-wp' ), - 'quick_action_title' => __( 'Quick Actions' ), + 'quick_action_title' => __( 'Quick Actions', 'optimole-wp' ), 'connect_btn' => __( 'Connect to Optimole', 'optimole-wp' ), 'disconnect_btn' => __( 'Disconnect', 'optimole-wp' ), 'select' => __( 'Select', 'optimole-wp' ), @@ -1621,6 +1625,8 @@ private function get_dashboard_strings() { 'keep_connected' => __( 'Ok, keep me connected', 'optimole-wp' ), 'cloud_library' => __( 'Cloud Library', 'optimole-wp' ), 'image_storage' => __( 'Image Storage', 'optimole-wp' ), + 'word' => __( 'word', 'optimole-wp' ), + 'path' => __( 'path', 'optimole-wp' ), 'disconnect_title' => __( 'You are about to disconnect from the Optimole API', 'optimole-wp' ), 'disconnect_desc' => __( 'Please note that disconnecting your site from the Optimole API will impact your website performance. @@ -2265,9 +2271,9 @@ private function get_dashboard_strings() { 'contact_support' => [ // translators: %s is the email main subject. 'title_prefix' => __( '[Lazy Load Issue] %s', 'optimole-wp' ), - 'disable_lazy_load_scaling' => __( 'Disable Lazy Load & Scaling' ), - 'disable_image_scaling' => __( 'Disable Image Scaling' ), - 'enable_native_lazy_load' => __( 'Enable Native Lazy Load' ), + 'disable_lazy_load_scaling' => __( 'Disable Lazy Load & Scaling', 'optimole-wp' ), + 'disable_image_scaling' => __( 'Disable Image Scaling', 'optimole-wp' ), + 'enable_native_lazy_load' => __( 'Enable Native Lazy Load', 'optimole-wp' ), ], // translators: %s is the date of the renewal. 'renew_date' => __( 'Renews %s', 'optimole-wp' ), diff --git a/inc/dashboard_widget.php b/inc/dashboard_widget.php index 37c3739c..d804717a 100644 --- a/inc/dashboard_widget.php +++ b/inc/dashboard_widget.php @@ -35,7 +35,7 @@ public function add_dashboard_widget() { return; } - wp_add_dashboard_widget( $this->handle, sprintf( 'Optimole - %s', __( 'Image Optimization Stats', 'optimole' ) ), [ $this, 'render_widget' ] ); + wp_add_dashboard_widget( $this->handle, sprintf( 'Optimole - %s', __( 'Image Optimization Stats', 'optimole-wp' ) ), [ $this, 'render_widget' ] ); } /** diff --git a/inc/rest.php b/inc/rest.php index f2a24aaa..fd5363d6 100644 --- a/inc/rest.php +++ b/inc/rest.php @@ -43,7 +43,6 @@ class Optml_Rest { 'service_routes' => [ 'update_option' => 'POST', 'request_update' => 'GET', - 'check_redirects' => 'POST_PUT_PATCH', 'connect' => [ 'POST', 'args' => [ @@ -814,69 +813,6 @@ public function update_option( WP_REST_Request $request ) { return $this->response( $sanitized ); } - /** - * Update options method. - * - * @param WP_REST_Request $request option update rest request. - * @phpstan-param WP_REST_Request, ignoredUrls?: int}>}> $request - * - * @return WP_REST_Response - */ - public function check_redirects( WP_REST_Request $request ) { - if ( empty( $request->get_param( 'images' ) ) ) { - return $this->response( __( 'No images available on the current page.' ), 'noImagesFound' ); - } - // 'ok' if no issues found, 'log' is there are issues we need to notify, 'deactivated' if the user's account is disabled - $status = 'ok'; - $result = ''; - foreach ( $request->get_param( 'images' ) as $domain => $value ) { - $args = [ - 'method' => 'GET', - 'redirection' => 0, - ]; - $processed_images = 0; - if ( isset( $value['src'] ) ) { - $processed_images = count( $value['src'] ); - } - if ( isset( $value['ignoredUrls'] ) && $value['ignoredUrls'] > $processed_images ) { - $result .= '
  • ❌ ' . sprintf( /* translators: 1 is the domain name, 2 is starting anchor tag, 3 is the ending anchor tag. */__( 'The images from: %1$s are not optimized by Optimole. If you would like to do so, you can follow this: %2$sWhy Optimole does not optimize all the images from my site?%3$s.', 'optimole-wp' ), $domain, '', '' ) . '
  • '; - $status = 'log'; - continue; - } - - if ( $processed_images > 0 ) { - $response = wp_remote_get( $value['src'][ rand( 0, $processed_images - 1 ) ], $args ); - if ( ! is_wp_error( $response ) ) { - $headers = $response['headers']; // array of http header lines - $status_code = $response['response']['code']; - if ( $status_code === 301 ) { - $status = 'deactivated'; - $result = '
  • ❌ ' . sprintf( /* translators: 1 is starting anchor tag, 2 is the ending anchor tag. */ __( 'Your account is currently disabled due to exceeding quota and Optimole is no longer able to optimize the images. In order to fix this you will need to %1$supgrade%2$s.', 'optimole-wp' ), '', '' ) . '
  • '; - break; - } - if ( $status_code === 302 ) { - if ( isset( $headers['x-redirect-o'] ) ) { - $optimole_code = (int) $headers['x-redirect-o']; - if ( $optimole_code === 1 ) { - $status = 'log'; - $result .= '
  • ❌ ' . sprintf( /* translators: 1 is the domain, 2 is starting anchor tag, 3 is the ending anchor tag. */ __( 'The domain: %1$s is not allowed to optimize images using your Optimole account. You can add this to the allowed list %2$shere%3$s.', 'optimole-wp' ), '' . $domain . '', '', '' ) . '
  • '; - } - if ( $optimole_code === 4 ) { - $status = 'log'; - $result .= '
  • ❌ ' . sprintf( /* translators: 1 is the domain, 2 is starting anchor tag, 3 is the ending anchor tag. */ __( 'We are not able to download the images from %1$s. Please check %2$sthis%3$s document for a more advanced guide on how to solve this.', 'optimole-wp' ), '' . $domain . '', '', '' ) . '
    ' . '
  • '; - } - } - } - } - } - } - if ( $result === '' ) { - $result = __( 'No issues detected, everything is running smoothly.', 'optimole-wp' ); - } - - return $this->response( '
      ' . $result . '
    ', $status ); - } - /** * Get total number of images. * diff --git a/phpcs.xml b/phpcs.xml index 1e0f080e..8fd379d5 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -52,7 +52,15 @@ + + + + + + + + 0 From 970e9f8a24eeb85033bf728cdac7fab297e258d1 Mon Sep 17 00:00:00 2001 From: selul Date: Fri, 31 Oct 2025 22:25:34 +0200 Subject: [PATCH 5/6] remove leftovers --- assets/src/global.d.ts | 1 - tests/test-rest.php | 137 ----------------------------------------- 2 files changed, 138 deletions(-) delete mode 100644 tests/test-rest.php diff --git a/assets/src/global.d.ts b/assets/src/global.d.ts index 8eb9c54d..df811f82 100644 --- a/assets/src/global.d.ts +++ b/assets/src/global.d.ts @@ -528,7 +528,6 @@ export interface AvailableApp { export interface Routes { update_option: string request_update: string - check_redirects: string connect: string select_application: string register_service: string diff --git a/tests/test-rest.php b/tests/test-rest.php deleted file mode 100644 index fd9d1794..00000000 --- a/tests/test-rest.php +++ /dev/null @@ -1,137 +0,0 @@ -server = $wp_rest_server = new \WP_REST_Server; - wp_set_current_user( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); - Optml_Main::instance(); - do_action( 'rest_api_init' ); - - } - public function test_register_route() { - $routes = $this->server->get_routes(); - $this->assertArrayHasKey( $this->namespaced_route, $routes ); - } - public function test_endpoint_config() { - $the_route = $this->namespaced_route; - $routes = $this->server->get_routes(); - foreach( $routes as $route => $route_config ) { - if( 0 === strpos( $the_route, $route ) ) { - $this->assertTrue( is_array( $route_config ) ); - foreach( $route_config as $endpoint ) { - $this->assertArrayHasKey( 'callback', $endpoint ); - $this->assertArrayHasKey( 0, $endpoint[ 'callback' ] ); - $this->assertArrayHasKey( 1, $endpoint[ 'callback' ] ); - $this->assertTrue( is_callable( array( $endpoint[ 'callback' ][0], $endpoint[ 'callback' ][1] ) ) ); - } - } - } - } - public function test_response_is_log () { - $request_body = array ( - 'images' => - array ( - 'image.shutterstock.com' => - array ( - 'ignoredUrls' => 1, - ), - 'images.pexels.com' => - array ( - 'src' => - array ( - 0 => 'https://mlj0r5i75kb0.i.optimole.com/w:auto/h:auto/q:mauto/f:best/https://images.pexels.com/photos/19118634/pexels-photo-19118634/free-photo-of-arhitect-arhitectura-turism-calatorie.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - 1 => 'https://mlj0r5i75kb0.i.optimole.com/w:auto/h:auto/q:mauto/f:best/https://images.pexels.com/photos/13644908/pexels-photo-13644908.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - ), - ), - 'odd-octopus-v7m5j.instawp.xyz' => - array ( - 'ignoredUrls' => 2, - 'src' => - array ( - 0 => 'https://mlj0r5i75kb0.i.optimole.com/w:703/h:1024/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/szm-4-b0o_zO9fkeI-unsplash.jpg', - 1 => 'https://mlj0r5i75kb0.i.optimole.com/w:1024/h:683/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/wesley-tingey-kVmc07SPm_A-unsplash.jpg', - 2 => 'https://mlj0r5i75kb0.i.optimole.com/w:724/h:1024/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/simone-hutsch-5oYbG-sEImY-unsplash.jpg' - ), - ), - 'media.gettyimages.com' => - array ( - 'ignoredUrls' => 1, - ), - ), - ); - - $request_body = json_encode($request_body); - $request = new WP_REST_Request( 'POST', $this->namespaced_route ); - $request->set_header( 'X-WP-Nonce' , wp_create_nonce( 'wp_rest' ) ); - $request->set_header( 'Content-Type' ,'application/json' ); - - $request->set_body( $request_body ); - - $response = $this->server->dispatch( $request ); - - $this->assertEquals( 200, $response->get_status() ); - $data = $response->get_data(); - $this->assertArrayHasKey( 'data', $data ); - $this->assertArrayHasKey( 'code', $data ); - $this->assertEquals( 'log', $data[ 'code' ] ); - $this->assertMatchesRegularExpression( '/media.gettyimages.com/' , $data ['data'] ); - $this->assertMatchesRegularExpression( '/image.shutterstock.com/', $data ['data'] ); - } - public function test_response_is_ok () { - $request_body = array ( - 'images' => - array ( - 'images.pexels.com' => - array ( - 'src' => - array ( - 0 => 'https://mlj0r5i75kb0.i.optimole.com/w:auto/h:auto/q:mauto/f:best/https://images.pexels.com/photos/19118634/pexels-photo-19118634/free-photo-of-arhitect-arhitectura-turism-calatorie.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - 1 => 'https://mlj0r5i75kb0.i.optimole.com/w:auto/h:auto/q:mauto/f:best/https://images.pexels.com/photos/13644908/pexels-photo-13644908.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', - ), - ), - 'odd-octopus-v7m5j.instawp.xyz' => - array ( - 'ignoredUrls' => 2, - 'src' => - array ( - 0 => 'https://mlj0r5i75kb0.i.optimole.com/w:703/h:1024/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/szm-4-b0o_zO9fkeI-unsplash.jpg', - 1 => 'https://mlj0r5i75kb0.i.optimole.com/w:1024/h:683/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/wesley-tingey-kVmc07SPm_A-unsplash.jpg', - 2 => 'https://mlj0r5i75kb0.i.optimole.com/w:724/h:1024/q:mauto/f:best/https://odd-octopus-v7m5j.instawp.xyz/wp-content/uploads/2023/11/simone-hutsch-5oYbG-sEImY-unsplash.jpg' - ), - ), - ), - ); - $request_body = json_encode($request_body); - $request = new WP_REST_Request( 'POST', $this->namespaced_route ); - $request->set_header( 'X-WP-Nonce' , wp_create_nonce( 'wp_rest' ) ); - $request->set_header( 'Content-Type' ,'application/json' ); - $request->set_body( $request_body ); - - $response = $this->server->dispatch( $request ); - - $this->assertEquals( 200, $response->get_status() ); - $data = $response->get_data(); - $this->assertArrayHasKey( 'data', $data ); - $this->assertArrayHasKey( 'code', $data ); - $this->assertEquals( 'ok', $data[ 'code' ] ); - } -} From 063d888073c33eba841291fee147e4113200953c Mon Sep 17 00:00:00 2001 From: Soare Robert Daniel Date: Wed, 5 Nov 2025 16:35:32 +0200 Subject: [PATCH 6/6] fix: Black Friday for 2025 (#997) - Modified the Black Friday logic to use the SDK flag for detection. - Modified the messages. - Added monthly to yearly update path vis support contact. - Added unit tests. --- .../src/dashboard/parts/connected/Sidebar.js | 2 +- assets/src/dashboard/parts/connected/index.js | 2 +- inc/admin.php | 117 ++++-- phpstan-baseline.neon | 6 - tests/test-admin.php | 336 ++++++++++++++++++ 5 files changed, 420 insertions(+), 43 deletions(-) create mode 100644 tests/test-admin.php diff --git a/assets/src/dashboard/parts/connected/Sidebar.js b/assets/src/dashboard/parts/connected/Sidebar.js index fb624245..ea7bb8b5 100644 --- a/assets/src/dashboard/parts/connected/Sidebar.js +++ b/assets/src/dashboard/parts/connected/Sidebar.js @@ -103,7 +103,7 @@ const Sidebar = ({ settings, setSettings, setCanSave, setTab }) => {