PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.5.5
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.5.5
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 +66 -67 3.3.22.5.5 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
@@ -81,22 +66,18 @@
81 66
82 67 $this->classes['admin_bulk_edit'] = new ConvertKit_Admin_Bulk_Edit();
83 68 $this->classes['admin_cache_plugins'] = new ConvertKit_Admin_Cache_Plugins();
84 69 $this->classes['admin_category'] = new ConvertKit_Admin_Category();
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();
70 + $this->classes['admin_notices'] = new ConvertKit_Admin_Notices();
92 71 $this->classes['admin_post'] = new ConvertKit_Admin_Post();
93 72 $this->classes['admin_quick_edit'] = new ConvertKit_Admin_Quick_Edit();
73 + $this->classes['admin_refresh_resources'] = new ConvertKit_Admin_Refresh_Resources();
94 74 $this->classes['admin_restrict_content'] = new ConvertKit_Admin_Restrict_Content();
95 75 $this->classes['admin_settings'] = new ConvertKit_Admin_Settings();
96 - $this->classes['admin_setup_wizard_landing_page'] = new ConvertKit_Admin_Setup_Wizard_Landing_Page();
97 76 $this->classes['admin_setup_wizard_plugin'] = new ConvertKit_Admin_Setup_Wizard_Plugin();
98 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();
99 80
100 81 /**
101 82 * Initialize integration classes for the WordPress Administration interface.
102 83 *
@@ -159,11 +140,10 @@
159 140 if ( is_admin() ) {
160 141 return;
161 142 }
162 143
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();
144 + $this->classes['cache_plugins'] = new ConvertKit_Cache_Plugins();
145 + $this->classes['output'] = new ConvertKit_Output();
166 146
167 147 /**
168 148 * Initialize integration classes for the frontend web site.
169 149 *
@@ -180,35 +160,34 @@
180 160 * @since 1.9.6
181 161 */
182 162 private function initialize_global() {
183 163
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();
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['pre_publish_action_broadcast_export'] = new ConvertKit_Pre_Publish_Action_Broadcast_Export();
173 + $this->classes['broadcasts_exporter'] = new ConvertKit_Broadcasts_Exporter();
174 + $this->classes['broadcasts_importer'] = new ConvertKit_Broadcasts_Importer();
175 + $this->classes['elementor'] = new ConvertKit_Elementor();
176 + $this->classes['gutenberg'] = new ConvertKit_Gutenberg();
177 + $this->classes['media_library'] = new ConvertKit_Media_Library();
178 + $this->classes['output_restrict_content'] = new ConvertKit_Output_Restrict_Content();
179 + $this->classes['review_request'] = new ConvertKit_Review_Request( 'ConvertKit', 'convertkit', CONVERTKIT_PLUGIN_PATH );
180 + $this->classes['preview_output'] = new ConvertKit_Preview_Output();
181 + $this->classes['setup'] = new ConvertKit_Setup();
182 + $this->classes['shortcodes'] = new ConvertKit_Shortcodes();
183 + $this->classes['widgets'] = new ConvertKit_Widgets();
210 184
185 + // Run the setup's update process on WordPress' init hook.
186 + // Doing this sooner may result in errors with WordPress functions that are not yet
187 + // available to the update routine.
188 + add_action( 'init', array( $this, 'update' ) );
189 +
211 190 /**
212 191 * Initialize integration classes for the frontend web site.
213 192 *
214 193 * @since 1.9.6
@@ -217,17 +196,16 @@
217 196
218 197 }
219 198
220 199 /**
221 - * Runs the Plugin's initialization and update routines, which checks if
200 + * Runs the Plugin's update routine, which checks if
222 201 * the Plugin has just been updated to a newer version,
223 202 * and if so runs any specific processes that might be needed.
224 203 *
225 204 * @since 1.9.7.4
226 205 */
227 - public function setup() {
206 + public function update() {
228 207
229 - $this->get_class( 'setup' )->initialize();
230 208 $this->get_class( 'setup' )->update();
231 209
232 210 }
233 211
@@ -247,15 +225,15 @@
247 225 }
248 226
249 227 // Pro.
250 228 if ( array_key_exists( 'REQUEST_URI', $_SERVER ) ) {
251 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/pro/' ) !== false ) {
229 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/pro/' ) !== false ) {
252 230 return true;
253 231 }
254 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '/x/' ) !== false ) {
232 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), '/x/' ) !== false ) {
255 233 return true;
256 234 }
257 - if ( strpos( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'cornerstone-endpoint' ) !== false ) {
235 + if ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), 'cornerstone-endpoint' ) !== false ) {
258 236 return true;
259 237 }
260 238 }
261 239
@@ -287,9 +265,9 @@
287 265 return true;
288 266 }
289 267
290 268 // Elementor.
291 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'elementor' ) {
269 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'elementor' ) {
292 270 return true;
293 271 }
294 272
295 273 // Kallyas.
@@ -317,9 +295,9 @@
317 295 return true;
318 296 }
319 297
320 298 // Zion Builder.
321 - if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['action'] ) ) === 'zion_builder_active' ) {
299 + if ( array_key_exists( 'action', $_REQUEST ) && sanitize_text_field( $_REQUEST['action'] ) === 'zion_builder_active' ) {
322 300 return true;
323 301 }
324 302
325 303 // Assume we're not in the Administration interface.
@@ -371,13 +349,34 @@
371 349 * @return bool Is WP CRON Request
372 350 */
373 351 public function is_cron() {
374 352
375 - return wp_doing_cron();
353 + if ( ! defined( 'DOING_CRON' ) ) {
354 + return false;
355 + }
356 + if ( ! DOING_CRON ) {
357 + return false;
358 + }
376 359
360 + return true;
361 +
377 362 }
378 363
379 364 /**
365 + * Loads the plugin's translated strings, if available.
366 + *
367 + * @since 1.0.0
368 + */
369 + public function load_language_files() {
370 +
371 + // If the .mo file for a given language is available in WP_LANG_DIR/convertkit
372 + // i.e. it's available as a translation at https://translate.wordpress.org/projects/wp-plugins/convertkit/,
373 + // it will be used instead of the .mo file in convertkit/languages.
374 + load_plugin_textdomain( 'convertkit', false, 'convertkit/languages' );
375 +
376 + }
377 +
378 + /**
380 379 * Returns the given class
381 380 *
382 381 * @since 1.9.6
383 382 *
@@ -393,9 +392,9 @@
393 392 $error = new WP_Error(
394 393 'convertkit_get_class',
395 394 sprintf(
396 395 /* translators: %1$s: PHP class name */
397 - __( 'Kit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
396 + __( 'ConvertKit Error: Could not load Plugin class <strong>%1$s</strong>', 'convertkit' ),
398 397 $name
399 398 )
400 399 );
401 400
@@ -403,9 +402,9 @@
403 402 // Admin UI.
404 403 if ( is_admin() ) {
405 404 wp_die(
406 405 esc_attr( $error->get_error_message() ),
407 - esc_html__( 'Kit Error', 'convertkit' ),
406 + esc_html__( 'ConvertKit Error', 'convertkit' ),
408 407 array(
409 408 'back_link' => true,
410 409 )
411 410 );