| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | * @since 1.9.6 |
| 21 | 21 | * |
| 22 | 22 | * @var object |
| 23 | 23 | */ |
| 24 | - private static $instance; | |
| 24 | + public static $instance; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Holds singleton initialized classes that include |
| 28 | 28 | * action and filter hooks. |
| @@ -63,21 +63,17 @@ | ||
| 63 | 63 | if ( ! is_admin() ) { |
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit(); | |
| 68 | - $this->classes['admin_cache_plugins'] = new ConvertKit_Admin_Cache_Plugins(); | |
| 69 | - $this->classes['admin_category'] = new ConvertKit_Admin_Category(); | |
| 70 | - $this->classes['admin_notices'] = new ConvertKit_Admin_Notices(); | |
| 71 | - $this->classes['admin_post'] = new ConvertKit_Admin_Post(); | |
| 72 | - $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit(); | |
| 73 | - $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources(); | |
| 74 | - $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content(); | |
| 75 | - $this->classes['admin_settings'] = new ConvertKit_Admin_Settings(); | |
| 76 | - $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin(); | |
| 77 | - $this->classes['admin_setup_wizard_restrict_content'] = new ConvertKit_Admin_Setup_Wizard_Restrict_Content(); | |
| 78 | - $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE(); | |
| 79 | - $this->classes['admin_user'] = new ConvertKit_Admin_User(); | |
| 67 | + $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit(); | |
| 68 | + $this->classes['admin_category'] = new ConvertKit_Admin_Category(); | |
| 69 | + $this->classes['admin_post'] = new ConvertKit_Admin_Post(); | |
| 70 | + $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit(); | |
| 71 | + $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources(); | |
| 72 | + $this->classes['admin_settings'] = new ConvertKit_Admin_Settings(); | |
| 73 | + $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin(); | |
| 74 | + $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE(); | |
| 75 | + $this->classes['admin_user'] = new ConvertKit_Admin_User(); | |
| 80 | 76 | |
| 81 | 77 | /** |
| 82 | 78 | * Initialize integration classes for the WordPress Administration interface. |
| 83 | 79 | * |
| @@ -140,10 +136,9 @@ | ||
| 140 | 136 | if ( is_admin() ) { |
| 141 | 137 | return; |
| 142 | 138 | } |
| 143 | 139 | |
| 144 | - $this->classes['output'] = new ConvertKit_Output(); | |
| 145 | - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content(); | |
| 140 | + $this->classes['output'] = new ConvertKit_Output(); | |
| 146 | 141 | |
| 147 | 142 | /** |
| 148 | 143 | * Initialize integration classes for the frontend web site. |
| 149 | 144 | * |
| @@ -160,23 +155,21 @@ | ||
| 160 | 155 | * @since 1.9.6 |
| 161 | 156 | */ |
| 162 | 157 | private function initialize_global() { |
| 163 | 158 | |
| 164 | - $this->classes['ajax'] = new ConvertKit_AJAX(); | |
| 165 | - $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts(); | |
| 166 | - $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content(); | |
| 167 | - $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger(); | |
| 168 | - $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form(); | |
| 169 | - $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product(); | |
| 170 | - $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link(); | |
| 171 | - $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link(); | |
| 172 | - $this->classes['elementor'] = new ConvertKit_Elementor(); | |
| 173 | - $this->classes['gutenberg'] = new ConvertKit_Gutenberg(); | |
| 174 | - $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH ); | |
| 175 | - $this->classes['preview_output'] = new ConvertKit_Preview_Output(); | |
| 176 | - $this->classes['setup'] = new ConvertKit_Setup(); | |
| 177 | - $this->classes['shortcodes'] = new ConvertKit_Shortcodes(); | |
| 178 | - $this->classes['widgets'] = new ConvertKit_Widgets(); | |
| 159 | + $this->classes['ajax'] = new ConvertKit_AJAX(); | |
| 160 | + $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts(); | |
| 161 | + $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content(); | |
| 162 | + $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product(); | |
| 163 | + $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form(); | |
| 164 | + $this->classes['elementor'] = new ConvertKit_Elementor(); | |
| 165 | + $this->classes['gutenberg'] = new ConvertKit_Gutenberg(); | |
| 166 | + $this->classes['post_type_product'] = new ConvertKit_Post_Type_Product(); | |
| 167 | + $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH ); | |
| 168 | + $this->classes['preview_output'] = new ConvertKit_Preview_Output(); | |
| 169 | + $this->classes['setup'] = new ConvertKit_Setup(); | |
| 170 | + $this->classes['shortcodes'] = new ConvertKit_Shortcodes(); | |
| 171 | + $this->classes['widgets'] = new ConvertKit_Widgets(); | |
| 179 | 172 | |
| 180 | 173 | // Run the setup's update process on WordPress' init hook. |
| 181 | 174 | // Doing this sooner may result in errors with WordPress functions that are not yet |
| 182 | 175 | // available to the update routine. |
| @@ -356,18 +349,15 @@ | ||
| 356 | 349 | |
| 357 | 350 | } |
| 358 | 351 | |
| 359 | 352 | /** |
| 360 | - * Loads the plugin's translated strings, if available. | |
| 353 | + * Loads plugin textdomain | |
| 361 | 354 | * |
| 362 | 355 | * @since 1.0.0 |
| 363 | 356 | */ |
| 364 | 357 | public function load_language_files() { |
| 365 | 358 | |
| 366 | - // If the .mo file for a given language is available in WP_LANG_DIR/convertkit | |
| 367 | - // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/, | |
| 368 | - // it will be used instead of the .mo file in convertkit/languages. | |
| 369 | - load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' ); | |
| 359 | + load_plugin_textdomain( 'convertkit', false, basename( dirname( CONVERTKIT_PLUGIN_FILE ) ) . '/languages/' ); // @phpstan-ignore-line. | |
| 370 | 360 | |
| 371 | 361 | } |
| 372 | 362 | |
| 373 | 363 | /** |
| @@ -422,9 +412,9 @@ | ||
| 422 | 412 | * @return object Class. |
| 423 | 413 | */ |
| 424 | 414 | public static function get_instance() { |
| 425 | 415 | |
| 426 | - if ( null === self::$instance ) { | |
| 416 | + if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { // @phpstan-ignore-line. | |
| 427 | 417 | self::$instance = new self(); |
| 428 | 418 | } |
| 429 | 419 | |
| 430 | 420 | return self::$instance; |