PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.8.6
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.8.6
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 +54 -59 2.2.9 → 2.8.6 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,8 +81,9 @@
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();
85 + $this->classes['admin_landing_page'] = new ConvertKit_Admin_Landing_Page();
70 86 $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
71 87 $this->classes['admin_post'] = new ConvertKit_Admin_Post();
72 88 $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
73 89 $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
@@ -72,8 +88,9 @@
72 88 $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
73 89 $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
74 90 $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
75 91 $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
92 + $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
76 93 $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
77 94 $this->classes['admin_setup_wizard_restrict_content'] = new ConvertKit_Admin_Setup_Wizard_Restrict_Content();
78 95 $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
79 96 $this->classes['admin_user'] = new ConvertKit_Admin_User();
@@ -140,10 +157,11 @@
140 157 if ( is_admin() ) {
141 158 return;
142 159 }
143 160
144 - $this->classes['output'] = new ConvertKit_Output();
145 - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
161 + $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins();
162 + $this->classes['output'] = new ConvertKit_Output();
163 + $this->classes['output_broadcasts'] = new ConvertKit_Output_Broadcasts();
146 164
147 165 /**
148 166 * Initialize integration classes for the frontend web site.
149 167 *
@@ -160,31 +178,28 @@
160 178 * @since 1.9.6
161 179 */
162 180 private function initialize_global() {
163 181
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['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
173 - $this->classes['elementor'] = new ConvertKit_Elementor();
174 - $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
175 - $this->classes['media_library'] = new ConvertKit_Media_Library();
176 - $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
177 - $this->classes['preview_output'] = new ConvertKit_Preview_Output();
178 - $this->classes['setup'] = new ConvertKit_Setup();
179 - $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
180 - $this->classes['widgets'] = new ConvertKit_Widgets();
182 + $this->classes['ajax'] = new ConvertKit_AJAX();
183 + $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
184 + $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
185 + $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
186 + $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
187 + $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
188 + $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
189 + $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
190 + $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
191 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
192 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
193 + $this->classes['elementor'] = new ConvertKit_Elementor();
194 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
195 + $this->classes['media_library'] = new ConvertKit_Media_Library();
196 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
197 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
198 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
199 + $this->classes['setup'] = new ConvertKit_Setup();
200 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
181 201
182 - // Run the setup's update process on WordPress' init hook.
183 - // Doing this sooner may result in errors with WordPress functions that are not yet
184 - // available to the update routine.
185 - add_action( 'init', array( $this, 'update' ) );
186 -
187 202 /**
188 203 * Initialize integration classes for the frontend web site.
189 204 *
190 205 * @since 1.9.6
@@ -193,16 +208,17 @@
193 208
194 209 }
195 210
196 211 /**
197 - * Runs the Plugin's update routine, which checks if
212 + * Runs the Plugin's initialization and update routines, which checks if
198 213 * the Plugin has just been updated to a newer version,
199 214 * and if so runs any specific processes that might be needed.
200 215 *
201 216 * @since 1.9.7.4
202 217 */
203 - public function update() {
218 + public function setup() {
204 219
220 + $this->get_class( 'setup' )->initialize();
205 221 $this->get_class( 'setup' )->update();
206 222
207 223 }
208 224
@@ -222,15 +238,15 @@
222 238 }
223 239
224 240 // Pro.
225 241 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
226 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
242 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
227 243 return true;
228 244 }
229 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
245 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
230 246 return true;
231 247 }
232 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'cornerstone-endpoint' ) !== false ) {
248 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'cornerstone-endpoint' ) !== false ) {
233 249 return true;
234 250 }
235 251 }
236 252
@@ -262,9 +278,9 @@
262 278 return true;
263 279 }
264 280
265 281 // Elementor.
266 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'elementor' ) {
282 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'elementor' ) {
267 283 return true;
268 284 }
269 285
270 286 // Kallyas.
@@ -292,9 +308,9 @@
292 308 return true;
293 309 }
294 310
295 311 // Zion Builder.
296 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'zion_builder_active' ) {
312 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'zion_builder_active' ) {
297 313 return true;
298 314 }
299 315
300 316 // Assume we're not in the Administration interface.
@@ -346,34 +362,13 @@
346 362 * @return bool Is WP CRON Request
347 363 */
348 364 public function is_cron() {
349 365
350 - if ( ! defined( 'DOING_CRON' ) ) {
351 - return false;
352 - }
353 - if ( ! DOING_CRON ) {
354 - return false;
355 - }
366 + return wp_doing_cron();
356 367
357 - return true;
358 -
359 368 }
360 369
361 370 /**
362 - * Loads the plugin's translated strings, if available.
363 - *
364 - * @since 1.0.0
365 - */
366 - public function load_language_files() {
367 -
368 - // If the .mo file for a given language is available in WP_LANG_DIR/convertkit
369 - // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/,
370 - // it will be used instead of the .mo file in convertkit/languages.
371 - load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' );
372 -
373 - }
374 -
375 - /**
376 371 * Returns the given class
377 372 *
378 373 * @since 1.9.6
379 374 *
@@ -389,9 +384,9 @@
389 384 $error = new WP_Error(
390 385 'convertkit_get_class',
391 386 sprintf(
392 387 /* translators: %1$s: PHP class name */
393 - __( 'ConvertKit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
388 + __( 'Kit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
394 389 $name
395 390 )
396 391 );
397 392
@@ -399,9 +394,9 @@
399 394 // Admin UI.
400 395 if ( is_admin() ) {
401 396 wp_die(
402 397 esc_attr( $error->get_error_message() ),
403 - esc_html__( 'ConvertKit Error', 'convertkit' ),
398 + esc_html__( 'Kit Error', 'convertkit' ),
404 399 array(
405 400 'back_link' => true,
406 401 )
407 402 );