| @@ -20,9 +20,9 @@ | ||
| 20 | 20 | * @since 1.9.6 |
| 21 | 21 | * |
| 22 | 22 | * @var object |
| 23 | 23 | */ |
| 24 | - public static $instance; | |
| 24 | + private static $instance; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Holds singleton initialized classes that include |
| 28 | 28 | * action and filter hooks. |
| @@ -64,8 +64,9 @@ | ||
| 64 | 64 | return; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit(); |
| 68 | + $this->classes['admin_cache_plugins'] = new ConvertKit_Admin_Cache_Plugins(); | |
| 68 | 69 | $this->classes['admin_category'] = new ConvertKit_Admin_Category(); |
| 69 | 70 | $this->classes['admin_notices'] = new ConvertKit_Admin_Notices(); |
| 70 | 71 | $this->classes['admin_post'] = new ConvertKit_Admin_Post(); |
| 71 | 72 | $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit(); |
| @@ -139,10 +140,10 @@ | ||
| 139 | 140 | if ( is_admin() ) { |
| 140 | 141 | return; |
| 141 | 142 | } |
| 142 | 143 | |
| 143 | - $this->classes['output'] = new ConvertKit_Output(); | |
| 144 | - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content(); | |
| 144 | + $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins(); | |
| 145 | + $this->classes['output'] = new ConvertKit_Output(); | |
| 145 | 146 | |
| 146 | 147 | /** |
| 147 | 148 | * Initialize integration classes for the frontend web site. |
| 148 | 149 | * |
| @@ -159,23 +160,28 @@ | ||
| 159 | 160 | * @since 1.9.6 |
| 160 | 161 | */ |
| 161 | 162 | private function initialize_global() { |
| 162 | 163 | |
| 163 | - $this->classes['ajax'] = new ConvertKit_AJAX(); | |
| 164 | - $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts(); | |
| 165 | - $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content(); | |
| 166 | - $this->classes['blocks_convertkit_form_trigger'] = new ConvertKit_Block_Form_Trigger(); | |
| 167 | - $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form(); | |
| 168 | - $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product(); | |
| 169 | - $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link(); | |
| 170 | - $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link(); | |
| 171 | - $this->classes['elementor'] = new ConvertKit_Elementor(); | |
| 172 | - $this->classes['gutenberg'] = new ConvertKit_Gutenberg(); | |
| 173 | - $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH ); | |
| 174 | - $this->classes['preview_output'] = new ConvertKit_Preview_Output(); | |
| 175 | - $this->classes['setup'] = new ConvertKit_Setup(); | |
| 176 | - $this->classes['shortcodes'] = new ConvertKit_Shortcodes(); | |
| 177 | - $this->classes['widgets'] = new ConvertKit_Widgets(); | |
| 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['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export(); | |
| 173 | + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter(); | |
| 174 | + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer(); | |
| 175 | + $this->classes['elementor'] = new ConvertKit_Elementor(); | |
| 176 | + $this->classes['gutenberg'] = new ConvertKit_Gutenberg(); | |
| 177 | + $this->classes['media_library'] = new ConvertKit_Media_Library(); | |
| 178 | + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content(); | |
| 179 | + $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH ); | |
| 180 | + $this->classes['preview_output'] = new ConvertKit_Preview_Output(); | |
| 181 | + $this->classes['setup'] = new ConvertKit_Setup(); | |
| 182 | + $this->classes['shortcodes'] = new ConvertKit_Shortcodes(); | |
| 183 | + $this->classes['widgets'] = new ConvertKit_Widgets(); | |
| 178 | 184 | |
| 179 | 185 | // Run the setup's update process on WordPress' init hook. |
| 180 | 186 | // Doing this sooner may result in errors with WordPress functions that are not yet |
| 181 | 187 | // available to the update routine. |
| @@ -355,15 +361,18 @@ | ||
| 355 | 361 | |
| 356 | 362 | } |
| 357 | 363 | |
| 358 | 364 | /** |
| 359 | - * Loads plugin textdomain | |
| 365 | + * Loads the plugin's translated strings, if available. | |
| 360 | 366 | * |
| 361 | 367 | * @since 1.0.0 |
| 362 | 368 | */ |
| 363 | 369 | public function load_language_files() { |
| 364 | 370 | |
| 365 | - load_plugin_textdomain( 'convertkit', false, basename( dirname( CONVERTKIT_PLUGIN_FILE ) ) . '/languages/' ); // @phpstan-ignore-line. | |
| 371 | + // If the .mo file for a given language is available in WP_LANG_DIR/convertkit | |
| 372 | + // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/, | |
| 373 | + // it will be used instead of the .mo file in convertkit/languages. | |
| 374 | + load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' ); | |
| 366 | 375 | |
| 367 | 376 | } |
| 368 | 377 | |
| 369 | 378 | /** |
| @@ -418,9 +427,9 @@ | ||
| 418 | 427 | * @return object Class. |
| 419 | 428 | */ |
| 420 | 429 | public static function get_instance() { |
| 421 | 430 | |
| 422 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof self ) ) { // @phpstan-ignore-line. | |
| 431 | + if ( null === self::$instance ) { | |
| 423 | 432 | self::$instance = new self(); |
| 424 | 433 | } |
| 425 | 434 | |
| 426 | 435 | return self::$instance; |