PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.4.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.4.0
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 2.2.9 2.3.0 2.3.1 All 196 releases
← All changes | includes/class-wp-convertkit.php +74 -79 3.3.92.4.0 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,27 +63,21 @@
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_legacy_resource_notice'] = new ConvertKit_Admin_Legacy_Resource_Notice();
87 - $this->classes['admin_importer_activecampaign'] = new ConvertKit_Admin_Importer_ActiveCampaign();
88 - $this->classes['admin_importer_aweber'] = new ConvertKit_Admin_Importer_AWeber();
89 - $this->classes['admin_importer_campaignmonitor'] = new ConvertKit_Admin_Importer_CampaignMonitor();
90 - $this->classes['admin_importer_convertkit_legacy_forms'] = new ConvertKit_Admin_Importer_ConvertKit_Legacy_Forms();
91 - $this->classes['admin_importer_mc4wp'] = new ConvertKit_Admin_Importer_MC4WP();
92 - $this->classes['admin_importer_mailpoet'] = new ConvertKit_Admin_Importer_Mailpoet();
93 - $this->classes['admin_importer_newsletter'] = new ConvertKit_Admin_Importer_Newsletter();
94 - $this->classes['admin_post'] = new ConvertKit_Admin_Post();
95 - $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
96 - $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
97 - $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
98 - $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
99 - $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
100 - $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_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();
101 80
102 81 /**
103 82 * Initialize integration classes for the WordPress Administration interface.
104 83 *
@@ -161,11 +140,9 @@
161 140 if ( is_admin() ) {
162 141 return;
163 142 }
164 143
165 - $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins();
166 - $this->classes['output'] = new ConvertKit_Output();
167 - $this->classes['output_broadcasts'] = new ConvertKit_Output_Broadcasts();
144 + $this->classes['output'] = new ConvertKit_Output();
168 145
169 146 /**
170 147 * Initialize integration classes for the frontend web site.
171 148 *
@@ -182,36 +159,34 @@
182 159 * @since 1.9.6
183 160 */
184 161 private function initialize_global() {
185 162
186 - $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
187 - $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
188 - $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
189 - $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
190 - $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
191 - $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
192 - $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
193 - $this->classes['blocks_convertkit_form_builder'] = new ConvertKit_Block_Form_Builder();
194 - $this->classes['blocks_convertkit_form_builder_field_email'] = new ConvertKit_Block_Form_Builder_Field_Email();
195 - $this->classes['blocks_convertkit_form_builder_field_name'] = new ConvertKit_Block_Form_Builder_Field_Name();
196 - $this->classes['blocks_convertkit_form_builder_field_custom'] = new ConvertKit_Block_Form_Builder_Field_Custom();
197 - $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
198 - $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
199 - $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
200 - $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
201 - $this->classes['plugin_sidebar_post_settings'] = new ConvertKit_Plugin_Sidebar_Post_Settings();
202 - $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
203 - $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
204 - $this->classes['elementor'] = new ConvertKit_Elementor();
205 - $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
206 - $this->classes['media_library'] = new ConvertKit_Media_Library();
207 - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
208 - $this->classes['restrict_content_cache'] = new ConvertKit_Restrict_Content_Cache();
209 - $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
210 - $this->classes['preview_output'] = new ConvertKit_Preview_Output();
211 - $this->classes['setup'] = new ConvertKit_Setup();
212 - $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
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_formtrigger'] = 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['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
172 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
173 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
174 + $this->classes['elementor'] = new ConvertKit_Elementor();
175 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
176 + $this->classes['media_library'] = new ConvertKit_Media_Library();
177 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
178 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
179 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
180 + $this->classes['setup'] = new ConvertKit_Setup();
181 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
182 + $this->classes['widgets'] = new ConvertKit_Widgets();
213 183
184 + // Run the setup's update process on WordPress' init hook.
185 + // Doing this sooner may result in errors with WordPress functions that are not yet
186 + // available to the update routine.
187 + add_action( 'init', array( $this, 'update' ) );
188 +
214 189 /**
215 190 * Initialize integration classes for the frontend web site.
216 191 *
217 192 * @since 1.9.6
@@ -220,17 +195,16 @@
220 195
221 196 }
222 197
223 198 /**
224 - * Runs the Plugin's initialization and update routines, which checks if
199 + * Runs the Plugin's update routine, which checks if
225 200 * the Plugin has just been updated to a newer version,
226 201 * and if so runs any specific processes that might be needed.
227 202 *
228 203 * @since 1.9.7.4
229 204 */
230 - public function setup() {
205 + public function update() {
231 206
232 - $this->get_class( 'setup' )->initialize();
233 207 $this->get_class( 'setup' )->update();
234 208
235 209 }
236 210
@@ -250,15 +224,15 @@
250 224 }
251 225
252 226 // Pro.
253 227 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
254 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
228 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
255 229 return true;
256 230 }
257 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
231 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
258 232 return true;
259 233 }
260 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'cornerstone-endpoint' ) !== false ) {
234 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'cornerstone-endpoint' ) !== false ) {
261 235 return true;
262 236 }
263 237 }
264 238
@@ -290,9 +264,9 @@
290 264 return true;
291 265 }
292 266
293 267 // Elementor.
294 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'elementor' ) {
268 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'elementor' ) {
295 269 return true;
296 270 }
297 271
298 272 // Kallyas.
@@ -320,9 +294,9 @@
320 294 return true;
321 295 }
322 296
323 297 // Zion Builder.
324 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'zion_builder_active' ) {
298 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'zion_builder_active' ) {
325 299 return true;
326 300 }
327 301
328 302 // Assume we're not in the Administration interface.
@@ -374,13 +348,34 @@
374 348 * @return bool Is WP CRON Request
375 349 */
376 350 public function is_cron() {
377 351
378 - return wp_doing_cron();
352 + if ( ! defined( 'DOING_CRON' ) ) {
353 + return false;
354 + }
355 + if ( ! DOING_CRON ) {
356 + return false;
357 + }
379 358
359 + return true;
360 +
380 361 }
381 362
382 363 /**
364 + * Loads the plugin's translated strings, if available.
365 + *
366 + * @since 1.0.0
367 + */
368 + public function load_language_files() {
369 +
370 + // If the .mo file for a given language is available in WP_LANG_DIR/convertkit
371 + // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/,
372 + // it will be used instead of the .mo file in convertkit/languages.
373 + load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' );
374 +
375 + }
376 +
377 + /**
383 378 * Returns the given class
384 379 *
385 380 * @since 1.9.6
386 381 *
@@ -396,9 +391,9 @@
396 391 $error = new WP_Error(
397 392 'convertkit_get_class',
398 393 sprintf(
399 394 /* translators: %1$s: PHP class name */
400 - __( 'Kit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
395 + __( 'ConvertKit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
401 396 $name
402 397 )
403 398 );
404 399
@@ -406,9 +401,9 @@
406 401 // Admin UI.
407 402 if ( is_admin() ) {
408 403 wp_die(
409 404 esc_attr( $error->get_error_message() ),
410 - esc_html__( 'Kit Error', 'convertkit' ),
405 + esc_html__( 'ConvertKit Error', 'convertkit' ),
411 406 array(
412 407 'back_link' => true,
413 408 )
414 409 );