From a832451759d4ec5ba19650e7e19a2fd758255897 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Dec 2025 10:40:34 +0000 Subject: [PATCH 01/22] chore(deps): bump codeinwp/themeisle-sdk from 3.3.49 to 3.3.50 Bumps [codeinwp/themeisle-sdk](https://github.com/Codeinwp/themeisle-sdk) from 3.3.49 to 3.3.50. - [Release notes](https://github.com/Codeinwp/themeisle-sdk/releases) - [Changelog](https://github.com/Codeinwp/themeisle-sdk/blob/v3.3.50/CHANGELOG.md) - [Commits](https://github.com/Codeinwp/themeisle-sdk/compare/v3.3.49...v3.3.50) --- updated-dependencies: - dependency-name: codeinwp/themeisle-sdk dependency-version: 3.3.50 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 18aefafa..2ea1c186 100644 --- a/composer.lock +++ b/composer.lock @@ -64,16 +64,16 @@ }, { "name": "codeinwp/themeisle-sdk", - "version": "3.3.49", + "version": "3.3.50", "source": { "type": "git", "url": "https://github.com/Codeinwp/themeisle-sdk.git", - "reference": "605f78bbbd8526f7597a89077791043d9ecc8c20" + "reference": "3c1f8dfc2390e667bbc086c5d660900a7985efa6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/605f78bbbd8526f7597a89077791043d9ecc8c20", - "reference": "605f78bbbd8526f7597a89077791043d9ecc8c20", + "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/3c1f8dfc2390e667bbc086c5d660900a7985efa6", + "reference": "3c1f8dfc2390e667bbc086c5d660900a7985efa6", "shasum": "" }, "require-dev": { @@ -99,9 +99,9 @@ ], "support": { "issues": "https://github.com/Codeinwp/themeisle-sdk/issues", - "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.49" + "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.50" }, - "time": "2025-09-18T13:41:05+00:00" + "time": "2025-11-25T19:36:35+00:00" }, { "name": "enshrined/svg-sanitize", From f4bf311bf5b3d66c3db05077759a106e7c76d1e7 Mon Sep 17 00:00:00 2001 From: abaicus Date: Thu, 4 Dec 2025 20:41:09 +0200 Subject: [PATCH 02/22] fix: compatibility with otter blocks background images defined in CSS files [closes Codeinwp/optimole-service#1594] --- inc/compatibilities/otter_blocks.php | 39 +++++++++++++++++++++++++++- phpstan-baseline.neon | 6 +++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/inc/compatibilities/otter_blocks.php b/inc/compatibilities/otter_blocks.php index 81dfecdb..b24e95d5 100644 --- a/inc/compatibilities/otter_blocks.php +++ b/inc/compatibilities/otter_blocks.php @@ -7,7 +7,6 @@ */ class Optml_otter_blocks extends Optml_compatibility { - /** * Should we load the integration logic. * @@ -39,5 +38,43 @@ function ( $all_watchers ) { // Replace the image URL with the optimized one in Otter-generated CSS. add_filter( 'otter_apply_dynamic_image', [ Optml_Main::instance()->manager->url_replacer, 'build_url' ], 99 ); + + // Ensure replacer is initialized for Otter REST API routes (where register_hooks isn't called). + add_filter( 'rest_pre_dispatch', [ $this, 'maybe_init_replacer_for_rest' ], 10, 3 ); + } + + /** + * Initialize replacer for Otter REST API routes. + * + * @param mixed $result Response to replace the requested version with. + * @param \WP_REST_Server $server Server instance. + * @param \WP_REST_Request $request Request used to generate the response. + * @return mixed Unmodified result. + */ + public function maybe_init_replacer_for_rest( $result, \WP_REST_Server $server, \WP_REST_Request $request ) { + $route = $request->get_route(); + + // Only initialize for Otter styles REST routes. + if ( strpos( $route, '/otter/v1/post_styles' ) === false + && strpos( $route, '/otter/v1/widget_styles' ) === false + && strpos( $route, '/otter/v1/block_styles' ) === false + ) { + return $result; + } + + if ( ! did_action( 'optml_replacer_setup' ) ) { + do_action( 'optml_replacer_setup' ); + } + + return $result; + } + + /** + * Should we early load the compatibility? + * + * @return bool Whether to load the compatibility early. + */ + public function should_load_early() { + return true; } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index a002da25..e60e4248 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1020,6 +1020,12 @@ parameters: count: 1 path: inc/compatibilities/metaslider.php + - + message: '#^Method Optml_otter_blocks\:\:maybe_init_replacer_for_rest\(\) has parameter \$request with generic class WP_REST_Request but does not specify its types\: T$#' + identifier: missingType.generics + count: 1 + path: inc/compatibilities/otter_blocks.php + - message: '#^Method Optml_otter_blocks\:\:register\(\) has no return type specified\.$#' identifier: missingType.return From 26aa59fc594bcf7b7727d1ed6900b82fb383f6ab Mon Sep 17 00:00:00 2001 From: abaicus Date: Tue, 9 Dec 2025 11:02:32 +0200 Subject: [PATCH 03/22] enh: adds Hummingbird compatibility [ref Codeinwp/optimole-service#1595] --- inc/compatibilities/hummingbird.php | 48 +++++++++++++++++++++++++++++ inc/manager.php | 1 + 2 files changed, 49 insertions(+) create mode 100644 inc/compatibilities/hummingbird.php diff --git a/inc/compatibilities/hummingbird.php b/inc/compatibilities/hummingbird.php new file mode 100644 index 00000000..b9bb7801 --- /dev/null +++ b/inc/compatibilities/hummingbird.php @@ -0,0 +1,48 @@ + Date: Tue, 9 Dec 2025 11:26:43 +0200 Subject: [PATCH 04/22] enh: adds Aruba Hispeed Cache compatibility [ref Codeinwp/optimole-service#1595] --- inc/compatibilities/aruba_hsc.php | 54 +++++++++++++++++++++++++++++++ inc/manager.php | 1 + 2 files changed, 55 insertions(+) create mode 100644 inc/compatibilities/aruba_hsc.php diff --git a/inc/compatibilities/aruba_hsc.php b/inc/compatibilities/aruba_hsc.php new file mode 100644 index 00000000..bf578700 --- /dev/null +++ b/inc/compatibilities/aruba_hsc.php @@ -0,0 +1,54 @@ +setPurger( AHSC_PURGER ); + $purge->purgeAll(); + } +} diff --git a/inc/manager.php b/inc/manager.php index f44f34e0..ddd76a7e 100644 --- a/inc/manager.php +++ b/inc/manager.php @@ -111,6 +111,7 @@ final class Optml_Manager { 'rocketnet', 'speedycache', 'hummingbird', + 'aruba_hsc', ]; /** * The current state of the buffer. From 28f1b0022b91f865d30057bf9732d66194562c92 Mon Sep 17 00:00:00 2001 From: abaicus Date: Tue, 9 Dec 2025 11:39:42 +0200 Subject: [PATCH 05/22] enh: adds Cache Enabler compatibility [ref Codeinwp/optimole-service#1595] --- inc/compatibilities/cache_enabler.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/inc/compatibilities/cache_enabler.php b/inc/compatibilities/cache_enabler.php index 4dd046c0..8a7ed94a 100644 --- a/inc/compatibilities/cache_enabler.php +++ b/inc/compatibilities/cache_enabler.php @@ -26,12 +26,17 @@ public function register() { add_filter( 'cache_enabler_page_contents_before_store', [ Optml_Main::instance()->manager, 'replace_content' ], PHP_INT_MAX, 1 ); - add_action( - 'optml_settings_updated', - function () { - do_action( 'cache_enabler_clear_site_cache' ); - } - ); + add_action( 'optml_settings_updated', [ $this, 'add_clear_cache_action' ] ); + add_action( 'optml_clear_cache', [ $this, 'add_clear_cache_action' ] ); + } + + /** + * Clear cache for Cache Enabler. + * + * @return void + */ + public function add_clear_cache_action() { + do_action( 'cache_enabler_clear_site_cache' ); } /** From ae1492e8f674fbc14cc8428387070cac2628576f Mon Sep 17 00:00:00 2001 From: abaicus Date: Tue, 9 Dec 2025 16:06:04 +0200 Subject: [PATCH 06/22] enh: adds Super Page Cache compatibility [ref Codeinwp/optimole-service#1595] --- inc/compatibilities/spc.php | 54 +++++++++++++++++++++++++++++++++++++ inc/manager.php | 1 + 2 files changed, 55 insertions(+) create mode 100644 inc/compatibilities/spc.php diff --git a/inc/compatibilities/spc.php b/inc/compatibilities/spc.php new file mode 100644 index 00000000..e8fd786d --- /dev/null +++ b/inc/compatibilities/spc.php @@ -0,0 +1,54 @@ + Date: Tue, 9 Dec 2025 18:43:50 +0200 Subject: [PATCH 07/22] enh: ensure single url cache is bust when a single path is invalidated --- inc/compatibilities/aruba_hsc.php | 18 +++++++++++++++-- inc/compatibilities/cache_enabler.php | 20 ++++++++++++++---- inc/compatibilities/hummingbird.php | 29 +++++++++++++++++++++++++-- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/inc/compatibilities/aruba_hsc.php b/inc/compatibilities/aruba_hsc.php index bf578700..52df8baf 100644 --- a/inc/compatibilities/aruba_hsc.php +++ b/inc/compatibilities/aruba_hsc.php @@ -40,15 +40,29 @@ public function should_load_early() { /** * Clear cache for Aruba Hispeed Cache. * + * @param string|bool $location The location to clear the cache for. If true, clear the cache globally. If a string, clear the cache for a particular url. * @return void */ - public function add_clear_cache_action() { + public function add_clear_cache_action( $location ) { if ( ! class_exists( '\ArubaSPA\HiSpeedCache\Purger\WpPurger' ) || ! defined( 'AHSC_PURGER' ) ) { return; } + // Initialize the purger. $purge = new \ArubaSPA\HiSpeedCache\Purger\WpPurger(); $purge->setPurger( AHSC_PURGER ); - $purge->purgeAll(); + + // Purge all cache when no location is provided. + if ( $location === true && method_exists( $purge, 'purgeAll' ) ) { + $purge->purgeAll(); + return; + } + + // Purge single URL based on the location parameter. + if ( ! method_exists( $purge, 'purgeUrl' ) ) { + return; + } + + $purge->purgeUrl( $location ); } } diff --git a/inc/compatibilities/cache_enabler.php b/inc/compatibilities/cache_enabler.php index 8a7ed94a..11c80991 100644 --- a/inc/compatibilities/cache_enabler.php +++ b/inc/compatibilities/cache_enabler.php @@ -26,17 +26,29 @@ public function register() { add_filter( 'cache_enabler_page_contents_before_store', [ Optml_Main::instance()->manager, 'replace_content' ], PHP_INT_MAX, 1 ); - add_action( 'optml_settings_updated', [ $this, 'add_clear_cache_action' ] ); + add_action( + 'optml_settings_updated', + function () { + do_action( 'cache_enabler_clear_site_cache' ); + } + ); + add_action( 'optml_clear_cache', [ $this, 'add_clear_cache_action' ] ); } /** - * Clear cache for Cache Enabler. + * Clear cache for Super Page Cache for Cloudflare. * + * @param string|bool $location The location to clear the cache for. If true, clear the cache globally. If a string, clear the cache for a particular url. * @return void */ - public function add_clear_cache_action() { - do_action( 'cache_enabler_clear_site_cache' ); + public function add_clear_cache_action( $location ) { + if ( $location === true ) { + do_action( 'cache_enabler_clear_site_cache' ); + return; + } + + do_action( 'cache_enabler_clear_page_cache_by_url', $location ); } /** diff --git a/inc/compatibilities/hummingbird.php b/inc/compatibilities/hummingbird.php index b9bb7801..878ea6ea 100644 --- a/inc/compatibilities/hummingbird.php +++ b/inc/compatibilities/hummingbird.php @@ -40,9 +40,34 @@ public function should_load_early() { /** * Clear cache for Hummingbird. * + * @param string|bool $location The location to clear the cache for. If true, clear the cache globally. If a string, clear the cache for a particular url. * @return void */ - public function add_clear_cache_action() { - do_action( 'wphb_clear_page_cache' ); + public function add_clear_cache_action( $location ) { + if ( ! class_exists( '\Hummingbird\Core\Utils' ) || ! method_exists( '\Hummingbird\Core\Utils', 'get_module' ) ) { + return; + } + + $page_cache = \Hummingbird\Core\Utils::get_module( 'page_cache' ); + + if ( ! $page_cache ) { + return; + } + + // Clear all cache + if ( true === $location ) { + $page_cache->clear_cache(); + return; + } + + // Clear specific URL + if ( ! is_string( $location ) || empty( $location ) ) { + return; + } + + $url_path = wp_parse_url( $location, PHP_URL_PATH ); + if ( $url_path ) { + $page_cache->clear_cache( trailingslashit( $url_path ), true ); + } } } From a1adc3efd9625165410de39c74a0857437db0a08 Mon Sep 17 00:00:00 2001 From: abaicus Date: Wed, 10 Dec 2025 11:47:56 +0200 Subject: [PATCH 08/22] chore: fix phpstan --- inc/compatibilities/hummingbird.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/inc/compatibilities/hummingbird.php b/inc/compatibilities/hummingbird.php index 878ea6ea..1b19327d 100644 --- a/inc/compatibilities/hummingbird.php +++ b/inc/compatibilities/hummingbird.php @@ -44,7 +44,8 @@ public function should_load_early() { * @return void */ public function add_clear_cache_action( $location ) { - if ( ! class_exists( '\Hummingbird\Core\Utils' ) || ! method_exists( '\Hummingbird\Core\Utils', 'get_module' ) ) { + // @phpstan-ignore-next-line - we need to check that method exists explicitly as it might change in the future. + if ( ! class_exists( '\Hummingbird\Core\Utils' ) || ! method_exists( '\Hummingbird\Core\Utils', 'get_module' ) ) { // @phpstan-ignore-line return; } From 9b26d49da802429dd3e9decc046e958d3904f22d Mon Sep 17 00:00:00 2001 From: abaicus Date: Wed, 10 Dec 2025 16:32:53 +0200 Subject: [PATCH 09/22] enh: adds kadence blocks compatibility with bg lazyload [ref Codeinwp/optimole-service#1602] --- inc/compatibilities/kadence_blocks.php | 37 ++++++++++++++++++++++++++ inc/manager.php | 1 + 2 files changed, 38 insertions(+) create mode 100644 inc/compatibilities/kadence_blocks.php diff --git a/inc/compatibilities/kadence_blocks.php b/inc/compatibilities/kadence_blocks.php new file mode 100644 index 00000000..975c6636 --- /dev/null +++ b/inc/compatibilities/kadence_blocks.php @@ -0,0 +1,37 @@ + Date: Wed, 10 Dec 2025 18:32:28 +0200 Subject: [PATCH 10/22] enh: enhance elementor compatibility with bg lazyload [ref Codeinwp/optimole-service#1602] --- inc/compatibilities/elementor_builder.php | 5 +++++ inc/lazyload_replacer.php | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/inc/compatibilities/elementor_builder.php b/inc/compatibilities/elementor_builder.php index a910dec7..891e6acd 100644 --- a/inc/compatibilities/elementor_builder.php +++ b/inc/compatibilities/elementor_builder.php @@ -33,6 +33,11 @@ public function register() { function ( $all_watchers ) { $all_watchers[] = '.elementor-widget-container'; $all_watchers[] = '.elementor-background-slideshow__slide__image'; + $all_watchers[] = '.elementor-section[data-settings*="background_background"]'; + $all_watchers[] = '.elementor-column[data-settings*="background_background"] > .elementor-widget-wrap'; + $all_watchers[] = '.elementor-element[data-settings*="background_background"]'; + $all_watchers[] = '.elementor-section > .elementor-background-overlay'; + return $all_watchers; } ); diff --git a/inc/lazyload_replacer.php b/inc/lazyload_replacer.php index 1284a71e..bf5114dd 100644 --- a/inc/lazyload_replacer.php +++ b/inc/lazyload_replacer.php @@ -125,9 +125,6 @@ public static function get_background_lazyload_selectors() { return self::$background_lazyload_selectors; } $default_watchers = [ - '.elementor-section[data-settings*="background_background"]', - '.elementor-column[data-settings*="background_background"] > .elementor-widget-wrap', - '.elementor-section > .elementor-background-overlay', '[class*="wp-block-cover"][style*="background-image"]', '[style*="background-image:url("]', '[style*="background-image: url("]', '[style*="background:url("]', '[style*="background: url("]', From feabd6901492f9df6b983d5b427f30c1755aa251 Mon Sep 17 00:00:00 2001 From: abaicus Date: Wed, 10 Dec 2025 20:06:37 +0200 Subject: [PATCH 11/22] enh: enhance Beaver Builder compatibility with bg lazyload [ref Codeinwp/optimole-service#1602] --- inc/compatibilities/beaver_builder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/inc/compatibilities/beaver_builder.php b/inc/compatibilities/beaver_builder.php index ffc400b8..82fe3bd9 100644 --- a/inc/compatibilities/beaver_builder.php +++ b/inc/compatibilities/beaver_builder.php @@ -28,6 +28,7 @@ public function register() { function ( $all_watchers ) { $all_watchers[] = '.fl-col-content'; $all_watchers[] = '.fl-row-bg-photo > .fl-row-content-wrap'; + $all_watchers[] = '.fl-module-box'; return $all_watchers; } From e65ab2515e207d402867c006c51dd287c129c2f6 Mon Sep 17 00:00:00 2001 From: abaicus Date: Wed, 10 Dec 2025 20:55:01 +0200 Subject: [PATCH 12/22] enh: enhance Spectra compatibility with bg lazyload [ref Codeinwp/optimole-service#1602] --- inc/compatibilities/spectra.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inc/compatibilities/spectra.php b/inc/compatibilities/spectra.php index 43518c1c..8addfb45 100644 --- a/inc/compatibilities/spectra.php +++ b/inc/compatibilities/spectra.php @@ -14,7 +14,8 @@ class Optml_spectra extends Optml_compatibility { */ public function should_load() { include_once ABSPATH . 'wp-admin/includes/plugin.php'; - return is_plugin_active( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ) && 'enabled' === get_option( '_uagb_allow_file_generation', 'enabled' ); + + return is_plugin_active( 'ultimate-addons-for-gutenberg/ultimate-addons-for-gutenberg.php' ); } /** @@ -22,6 +23,15 @@ public function should_load() { */ public function register() { add_filter( 'uagb_block_attributes_for_css_and_js', [ $this, 'optimize_src' ], PHP_INT_MAX, 2 ); + + add_filter( + 'optml_lazyload_bg_selectors', + function ( $all_watchers ) { + $all_watchers[] = '.wp-block-uagb-container'; + + return $all_watchers; + } + ); } /** From 1b58ed9d0d075e4ee177e7bd95e85b27050cb02e Mon Sep 17 00:00:00 2001 From: abaicus Date: Thu, 11 Dec 2025 00:16:58 +0200 Subject: [PATCH 13/22] enh: Essential Blocks plugin compatibility with bg lazyload [ref Codeinwp/optimole-service#1602] --- inc/compatibilities/essential_blocks.php | 35 ++++++++++++++++++++++++ inc/manager.php | 1 + 2 files changed, 36 insertions(+) create mode 100644 inc/compatibilities/essential_blocks.php diff --git a/inc/compatibilities/essential_blocks.php b/inc/compatibilities/essential_blocks.php new file mode 100644 index 00000000..2c560e0c --- /dev/null +++ b/inc/compatibilities/essential_blocks.php @@ -0,0 +1,35 @@ + Date: Thu, 11 Dec 2025 09:28:48 +0200 Subject: [PATCH 14/22] chore: fixes phpstan issues --- inc/compatibilities/essential_blocks.php | 2 ++ inc/compatibilities/kadence_blocks.php | 2 ++ 2 files changed, 4 insertions(+) diff --git a/inc/compatibilities/essential_blocks.php b/inc/compatibilities/essential_blocks.php index 2c560e0c..835fc4c7 100644 --- a/inc/compatibilities/essential_blocks.php +++ b/inc/compatibilities/essential_blocks.php @@ -20,6 +20,8 @@ public function should_load() { /** * Register integration details. + * + * @return void */ public function register() { add_filter( diff --git a/inc/compatibilities/kadence_blocks.php b/inc/compatibilities/kadence_blocks.php index 975c6636..bf7926c3 100644 --- a/inc/compatibilities/kadence_blocks.php +++ b/inc/compatibilities/kadence_blocks.php @@ -21,6 +21,8 @@ public function should_load() { /** * Register integration details. + * + * @return void */ public function register() { add_filter( From e4c582db36a41206581ce46f38bda41fb8616d95 Mon Sep 17 00:00:00 2001 From: abaicus Date: Thu, 11 Dec 2025 11:11:00 +0200 Subject: [PATCH 15/22] chore: update visit limit notice text [closes Codeinwp/optimole-service#1581] --- inc/admin.php | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/inc/admin.php b/inc/admin.php index 0b5b705c..aa1df98a 100755 --- a/inc/admin.php +++ b/inc/admin.php @@ -635,22 +635,17 @@ public function add_notice_upgrade() { } ?>
+ style="background-color: #577BF9; color:white; border: none !important; display: flex; align-items: center;">
- '> + '>
-
+

', - number_format_i18n( 2000 ), - '', - '', - '', - '

' + /* translators: 1 - visits limit */ + __( 'You\'re nearing your %1$s-visit monthly cap on Optimole. If you exceed it, we\'ll serve original (unoptimized) images - expect slower pages.', 'optimole-wp' ), + '' . number_format_i18n( 2000 ) . '' ); ?>

From 58789dcc13b4d8eb08a36a88e1d7d6cee1087c52 Mon Sep 17 00:00:00 2001 From: abaicus Date: Thu, 11 Dec 2025 16:37:10 +0200 Subject: [PATCH 16/22] chore: update view all stats link [closes Codeinwp/optimole-service#1586] --- assets/src/widget/components/WidgetFooter.js | 5 +++-- inc/dashboard_widget.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/src/widget/components/WidgetFooter.js b/assets/src/widget/components/WidgetFooter.js index 14753ee1..b399fd02 100644 --- a/assets/src/widget/components/WidgetFooter.js +++ b/assets/src/widget/components/WidgetFooter.js @@ -1,7 +1,7 @@ import { Icon, external } from '@wordpress/icons'; export default function WidgetFooter() { - const { i18n, dashboardURL, adminPageURL } = optimoleDashboardWidget; + const { i18n, dashboardURL, dashboardMetricsURL } = optimoleDashboardWidget; return (
@@ -10,8 +10,9 @@ export default function WidgetFooter() { Optimole - + { i18n.viewAllStats } +
); diff --git a/inc/dashboard_widget.php b/inc/dashboard_widget.php index d804717a..2c7756ad 100644 --- a/inc/dashboard_widget.php +++ b/inc/dashboard_widget.php @@ -114,7 +114,7 @@ private function get_script_localization() { 'billingURL' => tsdk_translate_link( 'https://dashboard.optimole.com/settings/billing', 'query' ), 'serviceData' => $this->get_service_data(), 'assetsURL' => OPTML_URL . 'assets/', - 'adminPageURL' => esc_url( admin_url( 'admin.php?page=optimole' ) ), + 'dashboardMetricsURL' => esc_url( 'https://dashboard.optimole.com/metrics' ), 'dashboardURL' => esc_url( tsdk_translate_link( 'https://dashboard.optimole.com' ) ), ]; } From b127fe8f1aaa8153a85f397424cbb73607c0fe76 Mon Sep 17 00:00:00 2001 From: abaicus Date: Thu, 11 Dec 2025 23:21:15 +0200 Subject: [PATCH 17/22] fix: strings consistency & issues [closes Codeinwp/optimole-service#1643] --- CHANGELOG.md | 2 +- README.md | 6 +++--- .../parts/connected/dashboard/LastImages.js | 4 ++-- .../parts/connected/settings/Compression.js | 2 +- assets/src/dashboard/utils/api.js | 8 ++++---- assets/src/global.d.ts | 7 +++---- inc/admin.php | 11 ++++++----- readme.txt | 13 ++++++------- 8 files changed, 26 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 336b0ce6..b0b3541d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -992,7 +992,7 @@ Fix edge cases for auto allowing domain on site migration. **Documentation** -* improve readme description of the OptiMole service ([e020300](https://github.com/Codeinwp/optimole-wp/commit/e020300)) +* improve readme description of the Optimole service ([e020300](https://github.com/Codeinwp/optimole-wp/commit/e020300)) diff --git a/README.md b/README.md index d442af2c..a7b791f1 100644 --- a/README.md +++ b/README.md @@ -260,12 +260,12 @@ Discover how to make the most of Optimole with our detailed and user-friendly [d ## Installation ## -The following are the steps to install the OptiMole plugin +The following are the steps to install the Optimole plugin 1. In your WordPress Administration Panels, click on Add New option under Plugins from the menu. Click on upload at the top. -2. Browse the location and select the OptiMole Plugin and click install now. -3. Go to Media -> OptiMole and follow in the instructions on how to enable the service. +2. Browse the location and select the Optimole Plugin and click install now. +3. Go to Media -> Optimole and follow in the instructions on how to enable the service. ## Frequently Asked Questions ## diff --git a/assets/src/dashboard/parts/connected/dashboard/LastImages.js b/assets/src/dashboard/parts/connected/dashboard/LastImages.js index 83ac6773..82e6d845 100644 --- a/assets/src/dashboard/parts/connected/dashboard/LastImages.js +++ b/assets/src/dashboard/parts/connected/dashboard/LastImages.js @@ -55,7 +55,7 @@ const Image = ({ } } ref={ squareRef } /> -

{ getSize() }% { optimoleDashboardApp.strings.latest_images.saved }

+

{ optimoleDashboardApp.strings.latest_images.percentage_saved.replace( '{ratio}', getSize() ) }

); }; @@ -136,7 +136,7 @@ const LastImages = () => { return (
-

{ optimoleDashboardApp.strings.latest_images.last } { optimoleDashboardApp.strings.latest_images.optimized_images }

+

{ optimoleDashboardApp.strings.latest_images.last_optimized_images }

{ ( isInitialLoading && ! isLoaded ) && (
diff --git a/assets/src/dashboard/parts/connected/settings/Compression.js b/assets/src/dashboard/parts/connected/settings/Compression.js index a55ac899..b44dc63c 100644 --- a/assets/src/dashboard/parts/connected/settings/Compression.js +++ b/assets/src/dashboard/parts/connected/settings/Compression.js @@ -352,7 +352,7 @@ const Compression = ({ { ( sampleImages.id && 0 < sampleImages.original_size ) && (
{ 0 < getCompressionRatio() ? ( -

{ 100 - getCompressionRatio() }% { optimoleDashboardApp.strings.latest_images.smaller }

+

{ optimoleDashboardApp.strings.latest_images.percentage_smaller.replace( '{ratio}', 100 - getCompressionRatio() ) }

) : (

{ optimoleDashboardApp.strings.latest_images.same_size }

) } diff --git a/assets/src/dashboard/utils/api.js b/assets/src/dashboard/utils/api.js index e8933225..63f7dfd8 100644 --- a/assets/src/dashboard/utils/api.js +++ b/assets/src/dashboard/utils/api.js @@ -153,7 +153,7 @@ export const connectAccount = ( data, callback = () => {}) => { sendOnboardingImages(); toggleDashboardSidebarSubmenu( true ); - console.log( '%c OptiMole API connection successful.', 'color: #59B278' ); + console.log( '%c Optimole API connection successful.', 'color: #59B278' ); } else { setHasValidKey( false ); @@ -195,7 +195,7 @@ export const disconnectAccount = () => { sethasDashboardLoaded( false ); setShowDisconnect( false ); toggleDashboardSidebarSubmenu( false ); - console.log( '%c Disconnected from OptiMole API.', 'color: #59B278' ); + console.log( '%c Disconnected from Optimole API.', 'color: #59B278' ); } else { console.error( response ); } @@ -221,7 +221,7 @@ export const selectDomain = ( data, callback = () => {}) => { setAPIKey( response.data.api_key ); setUserData( response.data ); setAvailableApps( response.data ); - console.log( '%c OptiMole API connection successful.', 'color: #59B278' ); + console.log( '%c Optimole API connection successful.', 'color: #59B278' ); } else { setHasValidKey( false ); console.log( '%c Invalid API Key.', 'color: #E7602A' ); @@ -271,7 +271,7 @@ export const requestStatsUpdate = () => { if ( 'disconnected' === response.code ) { setIsConnected( false ); sethasDashboardLoaded( false ); - console.log( '%c Disconnected from OptiMole API.', 'color: #59B278' ); + console.log( '%c Disconnected from Optimole API.', 'color: #59B278' ); } }); }; diff --git a/assets/src/global.d.ts b/assets/src/global.d.ts index df811f82..541e9aea 100644 --- a/assets/src/global.d.ts +++ b/assets/src/global.d.ts @@ -481,10 +481,9 @@ export interface LatestImages { no_images_found: string compression: string loading_latest_images: string - last: string - saved: string - smaller: string - optimized_images: string + last_optimized_images: string + percentage_saved: string + percentage_smaller: string same_size: string small_optimization: string medium_optimization: string diff --git a/inc/admin.php b/inc/admin.php index aa1df98a..1ca0dd71 100755 --- a/inc/admin.php +++ b/inc/admin.php @@ -859,7 +859,7 @@ public function add_notice() {

+ class="button button-primary button-hero"> @@ -2281,10 +2281,11 @@ private function get_dashboard_strings() { 'no_images_found' => sprintf( /* translators: 1 is the starting anchor tag, 2 is the ending anchor tag */ __( 'We are currently optimizing your images. Meanwhile you can visit your %1$shomepage%2$s and check how our plugin performs.', 'optimole-wp' ), '', '' ), 'compression' => __( 'Optimization', 'optimole-wp' ), 'loading_latest_images' => __( 'Loading your optimized images...', 'optimole-wp' ), - 'last' => __( 'Last', 'optimole-wp' ), - 'saved' => __( 'Saved', 'optimole-wp' ), - 'smaller' => __( 'smaller', 'optimole-wp' ), - 'optimized_images' => __( 'optimized images', 'optimole-wp' ), + 'last_optimized_images' => __( 'Last optimized images', 'optimole-wp' ), + // translators: %s is the percentage (e.g. 10%). + 'percentage_saved' => sprintf( __( '%s Saved', 'optimole-wp' ), '{ratio}%' ), + // translators: %s is the percentage (e.g. 10%). + 'percentage_smaller' => sprintf( __( '%s smaller', 'optimole-wp' ), '{ratio}%' ), 'same_size' => __( '🙉 We couldn\'t do better, this image is already optimized at maximum.', 'optimole-wp' ), 'small_optimization' => __( '😬 Not that much, just {ratio} smaller.', 'optimole-wp' ), 'medium_optimization' => __( '🤓 We are on the right track, {ratio} squeezed.', 'optimole-wp' ), diff --git a/readme.txt b/readme.txt index 882c1959..2811ba1c 100755 --- a/readme.txt +++ b/readme.txt @@ -70,8 +70,7 @@ Optimize your entire media library with a single click. Optimole processes your #### 🚀 One-Click Image Offloading [PRO] -Free up valuable server space by offloading your entire media library to Optimole's secure cloud storage. All your images are safely stored and delivered from our optimized CDN, reducing your hosting costs and server load. Need your images back on your server? Our seamless one-click restoration process makes it easy to transfer everything back -whenever you want, giving you complete flexibility and control over your media assets. +Free up valuable server space by offloading your entire media library to Optimole's secure cloud storage. All your images are safely stored and delivered from our optimized CDN, reducing your hosting costs and server load. Need your images back on your server? Our seamless one-click restoration process makes it easy to transfer everything back whenever you want, giving you complete flexibility and control over your media assets. #### 🌎 CDN @@ -260,12 +259,12 @@ Discover how to make the most of Optimole with our detailed and user-friendly [d == Installation == -The following are the steps to install the OptiMole plugin +The following are the steps to install the Optimole plugin -1. In your WordPress Administration Panels, click on Add New option under Plugins from the menu. +1. In your WordPress Dashboard, click on Add New option under Plugins from the menu. Click on upload at the top. -2. Browse the location and select the OptiMole Plugin and click install now. -3. Go to Media -> OptiMole and follow in the instructions on how to enable the service. +2. Browse the location, select the Optimole plugin and click "Install now". +3. Go to Media -> Optimole and follow in the instructions on how to enable the service. == Frequently Asked Questions == @@ -305,7 +304,7 @@ We use your original images as sources when deliver the optimized images. Unless A higher compression might result in a small loss of image quality. Selecting the auto level will let Optimole choose the minimum size with no loss in the quality of your picture. -= I used Kraken, Shortpixel, Optimus, EWWW or WP Smush, Imagify will Optimole further optimize my images? = += I used Kraken, Shortpixel, Optimus, EWWW or WP Smush, Imagify. Will Optimole further optimize my images? = Yes, Optimole will also take care of serving your image at the RIGHT size for your visitors and optimize them to the best possible format for their browser. From 1079168d5f4c4df70bf2c83e403d768eb0dc28fb Mon Sep 17 00:00:00 2001 From: abaicus Date: Fri, 12 Dec 2025 10:30:53 +0200 Subject: [PATCH 18/22] chore: adds diff translations workflow --- .github/workflows/diff-translations.yml | 53 +++++++++++++++++++++++++ .gitignore | 1 + inc/cli/cli_setting.php | 10 ++--- package.json | 3 +- 4 files changed, 60 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/diff-translations.yml diff --git a/.github/workflows/diff-translations.yml b/.github/workflows/diff-translations.yml new file mode 100644 index 00000000..6b8e0d71 --- /dev/null +++ b/.github/workflows/diff-translations.yml @@ -0,0 +1,53 @@ +name: Translations Diff + +on: + pull_request_review: + pull_request: + types: [opened, edited, synchronize, ready_for_review] + branches: + - development + - master + +jobs: + translation: + runs-on: ubuntu-latest + steps: + - name: Checkout Base Branch + uses: actions/checkout@v4 + with: + ref: ${{ github.base_ref }} + path: optimole-base + - name: Setup node 16 + uses: actions/setup-node@v4 + with: + node-version: 16.x + - name: Build POT for Base Branch + run: | + cd optimole-base + composer install --no-dev --prefer-dist --no-progress --no-suggest + npm ci + npm run build + # TODO: when is merged to master, switch to npm run build:make-pot + docker run --user root --rm --volume \"$(pwd):/var/www/html/optimole-wp\" wordpress:cli bash -c 'php -d memory_limit=512M \"$(which wp)\" --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp' + ls languages/ + - name: Checkout PR Branch (Head) + uses: actions/checkout@v4 + with: + path: optimole-head + - name: Build POT for PR Branch + run: | + cd optimole-head + composer install --no-dev --prefer-dist --no-progress --no-suggest + npm ci + npm run build + npm run build:make-pot + ls languages/ + - name: Compare POT files + uses: Codeinwp/action-i18n-string-reviewer@main + with: + fail-on-changes: 'true' + openrouter-key: ${{ secrets.OPEN_ROUTER_API_KEY }} + openrouter-model: 'google/gemini-2.5-flash' + base-pot-file: 'optimole-base/languages/optimole-wp.pot' + target-pot-file: 'optimole-head/languages/optimole-wp.pot' + github-token: ${{ secrets.BOT_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 98897f47..2a3d29e1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ assets/build test-results tests/assets/filestash coverage +languages \ No newline at end of file diff --git a/inc/cli/cli_setting.php b/inc/cli/cli_setting.php index 2ef670ff..48ef6564 100644 --- a/inc/cli/cli_setting.php +++ b/inc/cli/cli_setting.php @@ -32,12 +32,10 @@ public function connect( $args ) { if ( $data === false || is_wp_error( $data ) ) { $extra = ''; if ( is_wp_error( $data ) ) { - /** - * Error from api. - * - * @var WP_Error $data Error object. - */ - $extra = sprintf( /* translators: errors details */ __( '. ERROR details: %s', 'optimole-wp' ), $data->get_error_message() ); + $extra = sprintf( + /* translators: Error details */ + __( '. ERROR details: %s', 'optimole-wp' ), + $data->get_error_message() ); } return \WP_CLI::error( __( 'Can not connect to Optimole service', 'optimole-wp' ) . $extra ); diff --git a/package.json b/package.json index da3cd8ae..53fd4976 100755 --- a/package.json +++ b/package.json @@ -45,7 +45,8 @@ "release": "semantic-release --debug", "e2e:open": "playwright test --ui", "e2e:run": "playwright test", - "dist": "./bin/dist.sh" + "dist": "./bin/dist.sh", + "build:make-pot": "docker run --user root --rm --volume \"$(pwd):/var/www/html/optimole-wp\" wordpress:cli bash -c 'php -d memory_limit=512M \"$(which wp)\" --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'" }, "devDependencies": { "@playwright/test": "^1.50.1", From ac927fbaa3a3ba78fd62f7647afe8e92a9407356 Mon Sep 17 00:00:00 2001 From: abaicus Date: Fri, 12 Dec 2025 10:46:14 +0200 Subject: [PATCH 19/22] chore: fix formatting issues --- inc/cli/cli_setting.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/cli/cli_setting.php b/inc/cli/cli_setting.php index 48ef6564..743d7dd6 100644 --- a/inc/cli/cli_setting.php +++ b/inc/cli/cli_setting.php @@ -32,10 +32,11 @@ public function connect( $args ) { if ( $data === false || is_wp_error( $data ) ) { $extra = ''; if ( is_wp_error( $data ) ) { - $extra = sprintf( + $extra = sprintf( /* translators: Error details */ - __( '. ERROR details: %s', 'optimole-wp' ), - $data->get_error_message() ); + __( '. ERROR details: %s', 'optimole-wp' ), + $data->get_error_message() + ); } return \WP_CLI::error( __( 'Can not connect to Optimole service', 'optimole-wp' ) . $extra ); From 61bfd7ba5b53144d008d1484fad32b49c5fa39aa Mon Sep 17 00:00:00 2001 From: abaicus Date: Fri, 12 Dec 2025 11:28:21 +0200 Subject: [PATCH 20/22] fix: translation diff action docker commands --- .github/workflows/diff-translations.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/diff-translations.yml b/.github/workflows/diff-translations.yml index 6b8e0d71..5f08cfa6 100644 --- a/.github/workflows/diff-translations.yml +++ b/.github/workflows/diff-translations.yml @@ -28,7 +28,7 @@ jobs: npm ci npm run build # TODO: when is merged to master, switch to npm run build:make-pot - docker run --user root --rm --volume \"$(pwd):/var/www/html/optimole-wp\" wordpress:cli bash -c 'php -d memory_limit=512M \"$(which wp)\" --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp' + docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp' ls languages/ - name: Checkout PR Branch (Head) uses: actions/checkout@v4 diff --git a/package.json b/package.json index 53fd4976..6131f4ae 100755 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "e2e:open": "playwright test --ui", "e2e:run": "playwright test", "dist": "./bin/dist.sh", - "build:make-pot": "docker run --user root --rm --volume \"$(pwd):/var/www/html/optimole-wp\" wordpress:cli bash -c 'php -d memory_limit=512M \"$(which wp)\" --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'" + "build:make-pot": "docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'" }, "devDependencies": { "@playwright/test": "^1.50.1", From 9b519fce99d6a4bf44a56f385b2dcf894eb55a2c Mon Sep 17 00:00:00 2001 From: abaicus Date: Fri, 12 Dec 2025 12:55:08 +0200 Subject: [PATCH 21/22] chore: remove spaces and redundant placeholders [ref Codeinwp/optimole-service#1643] --- optimole-wp.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/optimole-wp.php b/optimole-wp.php index 748d7a22..dadeda96 100644 --- a/optimole-wp.php +++ b/optimole-wp.php @@ -58,14 +58,12 @@ function optml_php_notice() { ', '7.4', '', '', - '', - '', '', '', '

' From 188c9b8b1ff8af7f4b42581b62baf42f39a25fc9 Mon Sep 17 00:00:00 2001 From: abaicus Date: Fri, 12 Dec 2025 16:54:55 +0200 Subject: [PATCH 22/22] chore: do not include make-pot task on build --- .github/workflows/diff-translations.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/diff-translations.yml b/.github/workflows/diff-translations.yml index 5f08cfa6..f0ce5a58 100644 --- a/.github/workflows/diff-translations.yml +++ b/.github/workflows/diff-translations.yml @@ -27,7 +27,7 @@ jobs: composer install --no-dev --prefer-dist --no-progress --no-suggest npm ci npm run build - # TODO: when is merged to master, switch to npm run build:make-pot + # TODO: when is merged to master, switch to npm run make-pot docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp' ls languages/ - name: Checkout PR Branch (Head) @@ -40,7 +40,7 @@ jobs: composer install --no-dev --prefer-dist --no-progress --no-suggest npm ci npm run build - npm run build:make-pot + npm run make-pot ls languages/ - name: Compare POT files uses: Codeinwp/action-i18n-string-reviewer@main diff --git a/package.json b/package.json index 6131f4ae..38351e25 100755 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "e2e:open": "playwright test --ui", "e2e:run": "playwright test", "dist": "./bin/dist.sh", - "build:make-pot": "docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'" + "make-pot": "docker run --user root --rm --volume $(pwd):/var/www/html/optimole-wp wordpress:cli bash -c 'php -d memory_limit=512M $(which wp) --version --allow-root && wp i18n make-pot optimole-wp ./optimole-wp/languages/optimole-wp.pot --include=inc,assets/src --allow-root --domain=optimole-wp'" }, "devDependencies": { "@playwright/test": "^1.50.1",