From a360c00ff4bb284843ad8938d27b3a3a8380294a Mon Sep 17 00:00:00 2001 From: Nurul Umbhiya Date: Mon, 29 Jan 2024 18:33:50 +0600 Subject: [PATCH 1/3] fix: prevent fatal error if used with old version of Appsero Client --- src/Client.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Client.php b/src/Client.php index 0dc3a1e..1a7e48d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -127,6 +127,26 @@ public function insights() { return $this->insights; } + /** + * Initialize plugin/theme updater + * + * @return void + */ + public function updater() { + // do not show update notice on ajax request and rest api request + if ( wp_doing_ajax() || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) ) { + return; + } + + // show deprecated notice + _deprecated_function( __CLASS__ . '::updater', '2.0', '\Appsero\Updater::init, for more details please visit: https://app.getwemail.io/campaigns/94eef570-bc95-448f-9178-1386f009b2d9' ); + + // initialize the new updater + if ( method_exists( '\Appsero\Updater', 'init' ) ) { + \Appsero\Updater::init( $this ); + } + } + /** * Initialize license checker * From 596fb63b6c5a60fe34dccbf5ba5ac546f8529520 Mon Sep 17 00:00:00 2001 From: Nurul Umbhiya Date: Tue, 30 Jan 2024 08:21:02 +0600 Subject: [PATCH 2/3] Update Client.php included Appsero\Updater repository link on deprecated notice --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index 1a7e48d..d32460b 100644 --- a/src/Client.php +++ b/src/Client.php @@ -139,7 +139,7 @@ public function updater() { } // show deprecated notice - _deprecated_function( __CLASS__ . '::updater', '2.0', '\Appsero\Updater::init, for more details please visit: https://app.getwemail.io/campaigns/94eef570-bc95-448f-9178-1386f009b2d9' ); + _deprecated_function( __CLASS__ . '::updater', '2.0', '\Appsero\Updater::init($client);, for more details please visit: https://github.com/Appsero/updater' ); // initialize the new updater if ( method_exists( '\Appsero\Updater', 'init' ) ) { From 4d24dbcf8883dedb376801fb7dbb99f42e70afb8 Mon Sep 17 00:00:00 2001 From: Nurul Umbhiya Date: Tue, 30 Jan 2024 11:50:05 +0600 Subject: [PATCH 3/3] Update Client.php update: changed doc url --- src/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.php b/src/Client.php index d32460b..7e1c64a 100644 --- a/src/Client.php +++ b/src/Client.php @@ -139,7 +139,7 @@ public function updater() { } // show deprecated notice - _deprecated_function( __CLASS__ . '::updater', '2.0', '\Appsero\Updater::init($client);, for more details please visit: https://github.com/Appsero/updater' ); + _deprecated_function( __CLASS__ . '::updater', '2.0', '\Appsero\Updater::init($client);, for more details please visit: https://appsero.com/docs/appsero-developers-guide/appsero-client/appsero-sdk-updater-changes/' ); // initialize the new updater if ( method_exists( '\Appsero\Updater', 'init' ) ) {