PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.7.5
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.7.5
3.4.6 3.4.5 3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 All 199 releases
← All changes | includes/class-wp-convertkit.php +68 -66 3.3.7 → 2.7.5 View file →
@@ -39,27 +39,9 @@
39 39 * @since 1.9.6
40 40 */
41 41 public function __construct() {
42 42
43 - // Initialize classes that have hooks prior to the `init` hook.
44 - // Divi Theme requires us to do this, although the Divi Builder Plugin works fine when loading
45 - // our integration on `init`.
46 - $this->classes['divi'] = new ConvertKit_Divi();
47 - $this->classes['widgets'] = new ConvertKit_Widgets();
48 -
49 - // Initialize Plugin classes on init, so the `_load_textdomain_just_in_time` warning isn't triggered.
50 - add_action( 'init', array( $this, 'initialize' ), 1 );
51 - add_action( 'init', array( $this, 'setup' ), 2 );
52 -
53 - }
54 -
55 - /**
56 - * Initialize classes.
57 - *
58 - * @since 2.7.7
59 - */
60 - public function initialize() {
61 -
43 + // Initialize class(es) to register hooks.
62 44 $this->initialize_admin();
63 45 $this->initialize_admin_or_frontend_editor();
64 46 $this->initialize_cli_cron();
65 47 $this->initialize_frontend();
@@ -64,8 +46,11 @@
64 46 $this->initialize_cli_cron();
65 47 $this->initialize_frontend();
66 48 $this->initialize_global();
67 49
50 + // Load language files.
51 + add_action( 'init', array( $this, 'load_language_files' ) );
52 +
68 53 }
69 54
70 55 /**
71 56 * Initialize classes for the WordPress Administration interface
@@ -78,26 +63,23 @@
78 63 if ( ! is_admin() ) {
79 64 return;
80 65 }
81 66
82 - $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit();
83 - $this->classes['admin_cache_plugins'] = new ConvertKit_Admin_Cache_Plugins();
84 - $this->classes['admin_category'] = new ConvertKit_Admin_Category();
85 - $this->classes['admin_landing_page'] = new ConvertKit_Admin_Landing_Page();
86 - $this->classes['admin_importer_activecampaign'] = new ConvertKit_Admin_Importer_ActiveCampaign();
87 - $this->classes['admin_importer_aweber'] = new ConvertKit_Admin_Importer_AWeber();
88 - $this->classes['admin_importer_campaignmonitor'] = new ConvertKit_Admin_Importer_CampaignMonitor();
89 - $this->classes['admin_importer_convertkit_legacy_forms'] = new ConvertKit_Admin_Importer_ConvertKit_Legacy_Forms();
90 - $this->classes['admin_importer_mc4wp'] = new ConvertKit_Admin_Importer_MC4WP();
91 - $this->classes['admin_importer_mailpoet'] = new ConvertKit_Admin_Importer_Mailpoet();
92 - $this->classes['admin_importer_newsletter'] = new ConvertKit_Admin_Importer_Newsletter();
93 - $this->classes['admin_post'] = new ConvertKit_Admin_Post();
94 - $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
95 - $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
96 - $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
97 - $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
98 - $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
99 - $this->classes['admin_setup_wizard_restrict_content'] = new ConvertKit_Admin_Setup_Wizard_Restrict_Content();
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_landing_page'] = new ConvertKit_Admin_Landing_Page();
71 + $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
72 + $this->classes['admin_post'] = new ConvertKit_Admin_Post();
73 + $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
74 + $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
75 + $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
76 + $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
77 + $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
78 + $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
79 + $this->classes['admin_setup_wizard_restrict_content'] = new ConvertKit_Admin_Setup_Wizard_Restrict_Content();
80 + $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
81 + $this->classes['admin_user'] = new ConvertKit_Admin_User();
100 82
101 83 /**
102 84 * Initialize integration classes for the WordPress Administration interface.
103 85 *
@@ -181,36 +163,35 @@
181 163 * @since 1.9.6
182 164 */
183 165 private function initialize_global() {
184 166
185 - $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
186 - $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
187 - $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
188 - $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
189 - $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
190 - $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
191 - $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
192 - $this->classes['blocks_convertkit_form_builder'] = new ConvertKit_Block_Form_Builder();
193 - $this->classes['blocks_convertkit_form_builder_field_email'] = new ConvertKit_Block_Form_Builder_Field_Email();
194 - $this->classes['blocks_convertkit_form_builder_field_name'] = new ConvertKit_Block_Form_Builder_Field_Name();
195 - $this->classes['blocks_convertkit_form_builder_field_custom'] = new ConvertKit_Block_Form_Builder_Field_Custom();
196 - $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
197 - $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
198 - $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
199 - $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
200 - $this->classes['plugin_sidebar_post_settings'] = new ConvertKit_Plugin_Sidebar_Post_Settings();
201 - $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
202 - $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
203 - $this->classes['elementor'] = new ConvertKit_Elementor();
204 - $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
205 - $this->classes['media_library'] = new ConvertKit_Media_Library();
206 - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
207 - $this->classes['restrict_content_cache'] = new ConvertKit_Restrict_Content_Cache();
208 - $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
209 - $this->classes['preview_output'] = new ConvertKit_Preview_Output();
210 - $this->classes['setup'] = new ConvertKit_Setup();
211 - $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
167 + $this->classes['ajax'] = new ConvertKit_AJAX();
168 + $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
169 + $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
170 + $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
171 + $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
172 + $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
173 + $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
174 + $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
175 + $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
176 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
177 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
178 + $this->classes['divi'] = new ConvertKit_Divi();
179 + $this->classes['elementor'] = new ConvertKit_Elementor();
180 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
181 + $this->classes['media_library'] = new ConvertKit_Media_Library();
182 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
183 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
184 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
185 + $this->classes['setup'] = new ConvertKit_Setup();
186 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
187 + $this->classes['widgets'] = new ConvertKit_Widgets();
212 188
189 + // Run the setup's update process on WordPress' init hook.
190 + // Doing this sooner may result in errors with WordPress functions that are not yet
191 + // available to the update routine.
192 + add_action( 'init', array( $this, 'init' ) );
193 +
213 194 /**
214 195 * Initialize integration classes for the frontend web site.
215 196 *
216 197 * @since 1.9.6
@@ -225,9 +206,9 @@
225 206 * and if so runs any specific processes that might be needed.
226 207 *
227 208 * @since 1.9.7.4
228 209 */
229 - public function setup() {
210 + public function init() {
230 211
231 212 $this->get_class( 'setup' )->initialize();
232 213 $this->get_class( 'setup' )->update();
233 214
@@ -373,9 +354,30 @@
373 354 * @return bool Is WP CRON Request
374 355 */
375 356 public function is_cron() {
376 357
377 - return wp_doing_cron();
358 + if ( ! defined( 'DOING_CRON' ) ) {
359 + return false;
360 + }
361 + if ( ! DOING_CRON ) {
362 + return false;
363 + }
364 +
365 + return true;
366 +
367 + }
368 +
369 + /**
370 + * Loads the plugin's translated strings, if available.
371 + *
372 + * @since 1.0.0
373 + */
374 + public function load_language_files() {
375 +
376 + // If the .mo file for a given language is available in WP_LANG_DIR/convertkit
377 + // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/,
378 + // it will be used instead of the .mo file in convertkit/languages.
379 + load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' );
378 380
379 381 }
380 382
381 383 /**