@@ -59,20 +59,27 @@ public function __construct() {
5959 update_option ( 'tawkto-visibility-options ' , $ visibility );
6060 }
6161
62+ add_action ( 'wp_loaded ' , array ( &$ this , 'init ' ) );
6263 add_action ( 'admin_init ' , array ( &$ this , 'admin_init ' ) );
6364 add_action ( 'admin_menu ' , array ( &$ this , 'add_menu ' ) );
6465 add_action ( 'wp_ajax_tawkto_setwidget ' , array ( &$ this , 'action_setwidget ' ) );
6566 add_action ( 'wp_ajax_tawkto_removewidget ' , array ( &$ this , 'action_removewidget ' ) );
6667 add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'tawk_settings_assets ' ) );
6768 add_action ( 'admin_notices ' , array ( $ this , 'tawk_admin_notice ' ) );
69+ }
6870
71+ /**
72+ * Initializes the plugin data
73+ *
74+ * @return void
75+ */
76+ public function init () {
6977 if ( is_admin () ) {
7078 if ( false === function_exists ( 'get_plugin_data ' ) ) {
7179 require_once ABSPATH . 'wp-admin/includes/plugin.php ' ;
7280 }
7381
74- // TODO: Move to proper lifecycle hook.
75- $ plugin_data = get_plugin_data ( __FILE__ , false , false );
82+ $ plugin_data = get_plugin_data ( __FILE__ );
7683
7784 $ this ->plugin_ver = $ plugin_data ['Version ' ];
7885 }
0 commit comments