PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.1.0
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.1.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 +60 -60 2.2.33.1.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,17 @@
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();
71 86 $this->classes['admin_post'] = new ConvertKit_Admin_Post();
72 87 $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
73 - $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
74 88 $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
75 89 $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
90 + $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
76 91 $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
77 92 $this->classes['admin_setup_wizard_restrict_content'] = new ConvertKit_Admin_Setup_Wizard_Restrict_Content();
78 93 $this->classes['admin_tinymce'] = new ConvertKit_Admin_TinyMCE();
79 - $this->classes['admin_user'] = new ConvertKit_Admin_User();
80 94
81 95 /**
82 96 * Initialize integration classes for the WordPress Administration interface.
83 97 *
@@ -140,10 +154,11 @@
140 154 if ( is_admin() ) {
141 155 return;
142 156 }
143 157
144 - $this->classes['output'] = new ConvertKit_Output();
145 - $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
158 + $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins();
159 + $this->classes['output'] = new ConvertKit_Output();
160 + $this->classes['output_broadcasts'] = new ConvertKit_Output_Broadcasts();
146 161
147 162 /**
148 163 * Initialize integration classes for the frontend web site.
149 164 *
@@ -160,29 +175,34 @@
160 175 * @since 1.9.6
161 176 */
162 177 private function initialize_global() {
163 178
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();
179 + $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
180 + $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
181 + $this->classes['ajax'] = new ConvertKit_AJAX();
182 + $this->classes['blocks_convertkit_broadcasts'] = new ConvertKit_Block_Broadcasts();
183 + $this->classes['blocks_convertkit_content'] = new ConvertKit_Block_Content();
184 + $this->classes['blocks_convertkit_formtrigger'] = new ConvertKit_Block_Form_Trigger();
185 + $this->classes['blocks_convertkit_form'] = new ConvertKit_Block_Form();
186 + $this->classes['blocks_convertkit_form_builder'] = new ConvertKit_Block_Form_Builder();
187 + $this->classes['blocks_convertkit_form_builder_field_email'] = new ConvertKit_Block_Form_Builder_Field_Email();
188 + $this->classes['blocks_convertkit_form_builder_field_name'] = new ConvertKit_Block_Form_Builder_Field_Name();
189 + $this->classes['blocks_convertkit_form_builder_field_custom'] = new ConvertKit_Block_Form_Builder_Field_Custom();
190 + $this->classes['blocks_convertkit_product'] = new ConvertKit_Block_Product();
191 + $this->classes['block_formatter_form_link'] = new ConvertKit_Block_Formatter_Form_Link();
192 + $this->classes['block_formatter_product_link'] = new ConvertKit_Block_Formatter_Product_Link();
193 + $this->classes['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
194 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
195 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
196 + $this->classes['elementor'] = new ConvertKit_Elementor();
197 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
198 + $this->classes['media_library'] = new ConvertKit_Media_Library();
199 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
200 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'Kit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
201 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
202 + $this->classes['setup'] = new ConvertKit_Setup();
203 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
179 204
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 205 /**
186 206 * Initialize integration classes for the frontend web site.
187 207 *
188 208 * @since 1.9.6
@@ -191,16 +211,17 @@
191 211
192 212 }
193 213
194 214 /**
195 - * Runs the Plugin's update routine, which checks if
215 + * Runs the Plugin's initialization and update routines, which checks if
196 216 * the Plugin has just been updated to a newer version,
197 217 * and if so runs any specific processes that might be needed.
198 218 *
199 219 * @since 1.9.7.4
200 220 */
201 - public function update() {
221 + public function setup() {
202 222
223 + $this->get_class( 'setup' )->initialize();
203 224 $this->get_class( 'setup' )->update();
204 225
205 226 }
206 227
@@ -220,15 +241,15 @@
220 241 }
221 242
222 243 // Pro.
223 244 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
224 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
245 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
225 246 return true;
226 247 }
227 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
248 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
228 249 return true;
229 250 }
230 - if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'cornerstone-endpoint' ) !== false ) {
251 + if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'cornerstone-endpoint' ) !== false ) {
231 252 return true;
232 253 }
233 254 }
234 255
@@ -260,9 +281,9 @@
260 281 return true;
261 282 }
262 283
263 284 // Elementor.
264 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'elementor' ) {
285 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'elementor' ) {
265 286 return true;
266 287 }
267 288
268 289 // Kallyas.
@@ -290,9 +311,9 @@
290 311 return true;
291 312 }
292 313
293 314 // Zion Builder.
294 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'zion_builder_active' ) {
315 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'zion_builder_active' ) {
295 316 return true;
296 317 }
297 318
298 319 // Assume we're not in the Administration interface.
@@ -344,34 +365,13 @@
344 365 * @return bool Is WP CRON Request
345 366 */
346 367 public function is_cron() {
347 368
348 - if ( ! defined( 'DOING_CRON' ) ) {
349 - return false;
350 - }
351 - if ( ! DOING_CRON ) {
352 - return false;
353 - }
369 + return wp_doing_cron();
354 370
355 - return true;
356 -
357 371 }
358 372
359 373 /**
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 374 * Returns the given class
375 375 *
376 376 * @since 1.9.6
377 377 *
@@ -387,9 +387,9 @@
387 387 $error = new WP_Error(
388 388 'convertkit_get_class',
389 389 sprintf(
390 390 /* translators: %1$s: PHP class name */
391 - __( 'ConvertKit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
391 + __( 'Kit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
392 392 $name
393 393 )
394 394 );
395 395
@@ -397,9 +397,9 @@
397 397 // Admin UI.
398 398 if ( is_admin() ) {
399 399 wp_die(
400 400 esc_attr( $error->get_error_message() ),
401 - esc_html__( 'ConvertKit Error', 'convertkit' ),
401 + esc_html__( 'Kit Error', 'convertkit' ),
402 402 array(
403 403 'back_link' => true,
404 404 )
405 405 );