← All changes
|
includes/Admin/EmailKitEditor/EmailKitEditorInit.php
+21
-2
1.6.2
→
1.6.9
View file →
| @@ -30,9 +30,17 @@ | ||
| 30 | 30 | add_action('init', function () use($post_id) { |
| 31 | 31 | $dep = \EmailKit\Admin\Dependency::check(get_post_meta($post_id,'emailkit_email_type', true)); |
| 32 | 32 | |
| 33 | 33 | if(true !== $dep){ |
| 34 | - wp_die("Need to " . esc_html($dep['label']??'') . "<a href='" . esc_url($dep['url']??'') . "'> Check here </a>", 'Need to activate plugin'); | |
| 34 | + wp_die( | |
| 35 | + sprintf( | |
| 36 | + /* translators: 1: dependency action label, e.g. "Install WooCommerce". 2: "Check here" link to the plugin page. */ | |
| 37 | + esc_html__( 'Need to %1$s %2$s', 'emailkit' ), | |
| 38 | + esc_html( $dep['label'] ?? '' ), | |
| 39 | + "<a href='" . esc_url( $dep['url'] ?? '' ) . "'>" . esc_html__( 'Check here', 'emailkit' ) . "</a>" | |
| 40 | + ), | |
| 41 | + esc_html__( 'Need to activate plugin', 'emailkit' ) | |
| 42 | + ); | |
| 35 | 43 | } |
| 36 | 44 | }); |
| 37 | 45 | |
| 38 | 46 | new StyleLoad(); |
| @@ -61,9 +69,20 @@ | ||
| 61 | 69 | <meta name="viewport" content="width=device-width" /> |
| 62 | 70 | <meta name="next-head-count" content="2" /> |
| 63 | 71 | </head> |
| 64 | 72 | |
| 65 | - <body class="<?php body_class(['post-'.get_the_ID()]); ?>"> | |
| 73 | + <body class="<?php | |
| 74 | + // Temporarily remove all body_class filters so third-party plugins that call | |
| 75 | + // admin-only functions (e.g. get_current_screen) cannot cause fatal errors | |
| 76 | + // in this custom editor context. WordPress core classes are still applied. | |
| 77 | + global $wp_filter; | |
| 78 | + $saved_body_class_filter = isset( $wp_filter['body_class'] ) ? clone $wp_filter['body_class'] : null; | |
| 79 | + remove_all_filters( 'body_class' ); | |
| 80 | + body_class( [ 'post-' . get_the_ID() ] ); | |
| 81 | + if ( $saved_body_class_filter !== null ) { | |
| 82 | + $wp_filter['body_class'] = $saved_body_class_filter; | |
| 83 | + } | |
| 84 | + ?>"> | |
| 66 | 85 | |
| 67 | 86 | <?php |
| 68 | 87 | require_once EMAILKIT_PATH . '/dist/editor.php'; |
| 69 | 88 | wp_footer(); |