@@ -101,15 +101,6 @@ final class Plugin {
101101 * Plugin_Base constructor.
102102 */
103103 public function __construct () {
104- require_once ABSPATH . 'wp-admin/includes/plugin.php ' ;
105- $ plugin = get_plugin_data ( CLDN_CORE );
106- $ location = $ this ->locate_plugin ();
107- $ this ->slug = ! empty ( $ plugin ['TextDomain ' ] ) ? $ plugin ['TextDomain ' ] : $ location ['dir_basename ' ];
108- $ this ->version = $ plugin ['Version ' ];
109- $ this ->dir_path = $ location ['dir_path ' ];
110- $ this ->template_path = $ this ->dir_path . 'php/templates/ ' ;
111- $ this ->dir_url = $ location ['dir_url ' ];
112- $ this ->plugin_file = pathinfo ( dirname ( CLDN_CORE ), PATHINFO_BASENAME ) . '/ ' . wp_basename ( CLDN_CORE );
113104 $ this ->setup_endpoints ();
114105 spl_autoload_register ( array ( $ this , 'autoload ' ) );
115106 $ this ->register_hooks ();
@@ -122,7 +113,7 @@ public function __construct() {
122113 * after_setup_theme priority 10. This is especially important for plugins
123114 * that extend the Customizer to ensure resources are available in time.
124115 */
125- public function init () {
116+ public function plugins_loaded () {
126117 Cron::get_instance ();
127118 $ this ->components ['admin ' ] = new Admin ( $ this );
128119 $ this ->components ['state ' ] = new State ( $ this );
@@ -279,8 +270,9 @@ public function set_config() {
279270 * Register Hooks for the plugin.
280271 */
281272 public function register_hooks () {
282- add_action ( 'plugins_loaded ' , array ( $ this , 'init ' ), 9 );
273+ add_action ( 'plugins_loaded ' , array ( $ this , 'plugins_loaded ' ), 9 );
283274 add_action ( 'admin_enqueue_scripts ' , array ( $ this , 'register_enqueue_styles ' ), 11 );
275+ add_action ( 'init ' , array ( $ this , 'init ' ) );
284276 // Move to 100 and 200 to allow other plugins/systems to add cloudinary filters and actions that are fired within the init hooks.
285277 add_action ( 'init ' , array ( $ this , 'setup ' ), 100 );
286278 add_action ( 'init ' , array ( $ this , 'register_assets ' ), 200 );
@@ -423,6 +415,23 @@ private function is_notice_component( $component ) {
423415 return $ component instanceof Notice;
424416 }
425417
418+ /**
419+ * Init the plugin properties.
420+ *
421+ * @return void
422+ */
423+ public function init () {
424+ require_once ABSPATH . 'wp-admin/includes/plugin.php ' ;
425+ $ plugin = get_plugin_data ( CLDN_CORE );
426+ $ location = $ this ->locate_plugin ();
427+ $ this ->slug = ! empty ( $ plugin ['TextDomain ' ] ) ? $ plugin ['TextDomain ' ] : $ location ['dir_basename ' ];
428+ $ this ->version = $ plugin ['Version ' ];
429+ $ this ->dir_path = $ location ['dir_path ' ];
430+ $ this ->template_path = $ this ->dir_path . 'php/templates/ ' ;
431+ $ this ->dir_url = $ location ['dir_url ' ];
432+ $ this ->plugin_file = pathinfo ( dirname ( CLDN_CORE ), PATHINFO_BASENAME ) . '/ ' . wp_basename ( CLDN_CORE );
433+ }
434+
426435 /**
427436 * Setup hooks
428437 *
0 commit comments