PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.3.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.3.0
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 2.3.2 All 195 releases
← All changes | includes/class-wp-convertkit.php +67 -61 2.2.83.3.0 View file →
@@ -39,9 +39,27 @@
39 39 * @since 1.9.6
40 40 */
41 41 public function __construct() {
42 42
43 - // Initialize class(es) to register hooks.
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 +
44 62 $this->initialize_admin();
45 63 $this->initialize_admin_or_frontend_editor();
46 64 $this->initialize_cli_cron();
47 65 $this->initialize_frontend();
@@ -46,11 +64,8 @@
46 64 $this->initialize_cli_cron();
47 65 $this->initialize_frontend();
48 66 $this->initialize_global();
49 67
50 - // Load language files.
51 - add_action( 'init', array( $this, 'load_language_files' ) );
52 -
53 68 }
54 69
55 70 /**
56 71 * Initialize classes for the WordPress Administration interface
@@ -66,18 +81,22 @@
66 81
67 82 $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit();
68 83 $this->classes['admin_cache_plugins'] = new ConvertKit_Admin_Cache_Plugins();
69 84 $this->classes['admin_category'] = new ConvertKit_Admin_Category();
70 - $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
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_mc4wp'] = new ConvertKit_Admin_Importer_MC4WP();
90 + $this->classes['admin_importer_mailpoet'] = new ConvertKit_Admin_Importer_Mailpoet();
91 + $this->classes['admin_importer_newsletter'] = new ConvertKit_Admin_Importer_Newsletter();
71 92 $this->classes['admin_post'] = new ConvertKit_Admin_Post();
72 93 $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
73 - $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
74 94 $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
75 95 $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
96 + $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
76 97 $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
77 98 $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();
80 99
81 100 /**
82 101 * Initialize integration classes for the WordPress Administration interface.
83 102 *
@@ -140,10 +159,11 @@
140 159 if ( is_admin() ) {
141 160 return;
142 161 }
143 162
144 - $this->classes['output'] = new ConvertKit_Output();
145 - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
163 + $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins();
164 + $this->classes['output'] = new ConvertKit_Output();
165 + $this->classes['output_broadcasts'] = new ConvertKit_Output_Broadcasts();
146 166
147 167 /**
148 168 * Initialize integration classes for the frontend web site.
149 169 *
@@ -160,29 +180,35 @@
160 180 * @since 1.9.6
161 181 */
162 182 private function initialize_global() {
163 183
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();
184 + $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
185 + $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
186 + $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
187 + $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
188 + $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
189 + $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
190 + $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
191 + $this->classes['blocks_convertkit_form_builder'] = new ConvertKit_Block_Form_Builder();
192 + $this->classes['blocks_convertkit_form_builder_field_email'] = new ConvertKit_Block_Form_Builder_Field_Email();
193 + $this->classes['blocks_convertkit_form_builder_field_name'] = new ConvertKit_Block_Form_Builder_Field_Name();
194 + $this->classes['blocks_convertkit_form_builder_field_custom'] = new ConvertKit_Block_Form_Builder_Field_Custom();
195 + $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
196 + $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
197 + $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
198 + $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
199 + $this->classes['plugin_sidebar_post_settings'] = new ConvertKit_Plugin_Sidebar_Post_Settings();
200 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
201 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
202 + $this->classes['elementor'] = new ConvertKit_Elementor();
203 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
204 + $this->classes['media_library'] = new ConvertKit_Media_Library();
205 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
206 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
207 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
208 + $this->classes['setup'] = new ConvertKit_Setup();
209 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
179 210
180 - // Run the setup's update process on WordPress' init hook.
181 - // Doing this sooner may result in errors with WordPress functions that are not yet
182 - // available to the update routine.
183 - add_action( 'init', array( $this, 'update' ) );
184 -
185 211 /**
186 212 * Initialize integration classes for the frontend web site.
187 213 *
188 214 * @since 1.9.6
@@ -191,16 +217,17 @@
191 217
192 218 }
193 219
194 220 /**
195 - * Runs the Plugin's update routine, which checks if
221 + * Runs the Plugin's initialization and update routines, which checks if
196 222 * the Plugin has just been updated to a newer version,
197 223 * and if so runs any specific processes that might be needed.
198 224 *
199 225 * @since 1.9.7.4
200 226 */
201 - public function update() {
227 + public function setup() {
202 228
229 + $this->get_class( 'setup' )->initialize();
203 230 $this->get_class( 'setup' )->update();
204 231
205 232 }
206 233
@@ -220,15 +247,15 @@
220 247 }
221 248
222 249 // Pro.
223 250 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
224 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
251 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
225 252 return true;
226 253 }
227 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
254 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
228 255 return true;
229 256 }
230 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'cornerstone-endpoint' ) !== false ) {
257 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'cornerstone-endpoint' ) !== false ) {
231 258 return true;
232 259 }
233 260 }
234 261
@@ -260,9 +287,9 @@
260 287 return true;
261 288 }
262 289
263 290 // Elementor.
264 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'elementor' ) {
291 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'elementor' ) {
265 292 return true;
266 293 }
267 294
268 295 // Kallyas.
@@ -290,9 +317,9 @@
290 317 return true;
291 318 }
292 319
293 320 // Zion Builder.
294 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'zion_builder_active' ) {
321 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'zion_builder_active' ) {
295 322 return true;
296 323 }
297 324
298 325 // Assume we're not in the Administration interface.
@@ -344,34 +371,13 @@
344 371 * @return bool Is WP CRON Request
345 372 */
346 373 public function is_cron() {
347 374
348 - if ( ! defined( 'DOING_CRON' ) ) {
349 - return false;
350 - }
351 - if ( ! DOING_CRON ) {
352 - return false;
353 - }
375 + return wp_doing_cron();
354 376
355 - return true;
356 -
357 377 }
358 378
359 379 /**
360 - * Loads the plugin's translated strings, if available.
361 - *
362 - * @since 1.0.0
363 - */
364 - public function load_language_files() {
365 -
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' );
370 -
371 - }
372 -
373 - /**
374 380 * Returns the given class
375 381 *
376 382 * @since 1.9.6
377 383 *
@@ -387,9 +393,9 @@
387 393 $error = new WP_Error(
388 394 'convertkit_get_class',
389 395 sprintf(
390 396 /* translators: %1$s: PHP class name */
391 - __( 'ConvertKit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
397 + __( 'Kit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
392 398 $name
393 399 )
394 400 );
395 401
@@ -397,9 +403,9 @@
397 403 // Admin UI.
398 404 if ( is_admin() ) {
399 405 wp_die(
400 406 esc_attr( $error->get_error_message() ),
401 - esc_html__( 'ConvertKit Error', 'convertkit' ),
407 + esc_html__( 'Kit Error', 'convertkit' ),
402 408 array(
403 409 'back_link' => true,
404 410 )
405 411 );