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.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 +54 -57 2.2.62.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,29 +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['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();
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();
179 201
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 202 /**
186 203 * Initialize integration classes for the frontend web site.
187 204 *
188 205 * @since 1.9.6
@@ -191,16 +208,17 @@
191 208
192 209 }
193 210
194 211 /**
195 - * Runs the Plugin's update routine, which checks if
212 + * Runs the Plugin's initialization and update routines, which checks if
196 213 * the Plugin has just been updated to a newer version,
197 214 * and if so runs any specific processes that might be needed.
198 215 *
199 216 * @since 1.9.7.4
200 217 */
201 - public function update() {
218 + public function setup() {
202 219
220 + $this->get_class( 'setup' )->initialize();
203 221 $this->get_class( 'setup' )->update();
204 222
205 223 }
206 224
@@ -220,15 +238,15 @@
220 238 }
221 239
222 240 // Pro.
223 241 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
224 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
242 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
225 243 return true;
226 244 }
227 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
245 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
228 246 return true;
229 247 }
230 - 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 ) {
231 249 return true;
232 250 }
233 251 }
234 252
@@ -260,9 +278,9 @@
260 278 return true;
261 279 }
262 280
263 281 // Elementor.
264 - 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' ) {
265 283 return true;
266 284 }
267 285
268 286 // Kallyas.
@@ -290,9 +308,9 @@
290 308 return true;
291 309 }
292 310
293 311 // Zion Builder.
294 - 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' ) {
295 313 return true;
296 314 }
297 315
298 316 // Assume we're not in the Administration interface.
@@ -344,34 +362,13 @@
344 362 * @return bool Is WP CRON Request
345 363 */
346 364 public function is_cron() {
347 365
348 - if ( ! defined( 'DOING_CRON' ) ) {
349 - return false;
350 - }
351 - if ( ! DOING_CRON ) {
352 - return false;
353 - }
366 + return wp_doing_cron();
354 367
355 - return true;
356 -
357 368 }
358 369
359 370 /**
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 371 * Returns the given class
375 372 *
376 373 * @since 1.9.6
377 374 *
@@ -387,9 +384,9 @@
387 384 $error = new WP_Error(
388 385 'convertkit_get_class',
389 386 sprintf(
390 387 /* translators: %1$s: PHP class name */
391 - __( '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' ),
392 389 $name
393 390 )
394 391 );
395 392
@@ -397,9 +394,9 @@
397 394 // Admin UI.
398 395 if ( is_admin() ) {
399 396 wp_die(
400 397 esc_attr( $error->get_error_message() ),
401 - esc_html__( 'ConvertKit Error', 'convertkit' ),
398 + esc_html__( 'Kit Error', 'convertkit' ),
402 399 array(
403 400 'back_link' => true,
404 401 )
405 402 );