From 2a4ae19e76a5b12b33aebf1235d950a7b218585f Mon Sep 17 00:00:00 2001 From: eug-L Date: Mon, 25 Nov 2024 12:01:59 +0800 Subject: [PATCH 1/3] fix warning translation loaded too early --- tawkto/tawkto.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tawkto/tawkto.php b/tawkto/tawkto.php index 29277f1..fd67985 100644 --- a/tawkto/tawkto.php +++ b/tawkto/tawkto.php @@ -71,7 +71,8 @@ public function __construct() { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } - $plugin_data = get_plugin_data( __FILE__ ); + // TODO: Move to proper lifecycle hook. + $plugin_data = get_plugin_data( __FILE__, false, false ); $this->plugin_ver = $plugin_data['Version']; } From ebfa3031777cac48480f398a78a070dc16a3ba5f Mon Sep 17 00:00:00 2001 From: eug-L Date: Mon, 25 Nov 2024 12:49:37 +0800 Subject: [PATCH 2/3] fix workflow docker compose command --- .github/workflows/ui-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml index d555ac2..15ac356 100644 --- a/.github/workflows/ui-tests.yml +++ b/.github/workflows/ui-tests.yml @@ -63,7 +63,7 @@ jobs: - name: Start docker services and setup WordPress run: | - docker-compose -f ./tests/docker/docker-compose.yml up -d; + docker compose -f ./tests/docker/docker-compose.yml up -d; docker attach wordpress-cli; - name: cached dependencies From b2a81a1cdc37223c00ac0938da91bad1f6e3915e Mon Sep 17 00:00:00 2001 From: eug-L Date: Tue, 26 Nov 2024 10:41:41 +0800 Subject: [PATCH 3/3] move `get_plugin_data` to `wp_loaded` hook --- tawkto/tawkto.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tawkto/tawkto.php b/tawkto/tawkto.php index fd67985..89a0d44 100644 --- a/tawkto/tawkto.php +++ b/tawkto/tawkto.php @@ -59,20 +59,27 @@ public function __construct() { update_option( 'tawkto-visibility-options', $visibility ); } + add_action( 'wp_loaded', array( &$this, 'init' ) ); add_action( 'admin_init', array( &$this, 'admin_init' ) ); add_action( 'admin_menu', array( &$this, 'add_menu' ) ); add_action( 'wp_ajax_tawkto_setwidget', array( &$this, 'action_setwidget' ) ); add_action( 'wp_ajax_tawkto_removewidget', array( &$this, 'action_removewidget' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'tawk_settings_assets' ) ); add_action( 'admin_notices', array( $this, 'tawk_admin_notice' ) ); + } + /** + * Initializes the plugin data + * + * @return void + */ + public function init() { if ( is_admin() ) { if ( false === function_exists( 'get_plugin_data' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } - // TODO: Move to proper lifecycle hook. - $plugin_data = get_plugin_data( __FILE__, false, false ); + $plugin_data = get_plugin_data( __FILE__ ); $this->plugin_ver = $plugin_data['Version']; }