| @@ -38,9 +38,9 @@ | ||
| 38 | 38 | $yaymail_platform = \YayMail\Platform\PlatformRegistry::get( 'yaymail' ); |
| 39 | 39 | if ( $yaymail_platform ) { |
| 40 | 40 | $this->yaymail_hook_surfix = $yaymail_platform->hook_suffix(); |
| 41 | 41 | } |
| 42 | - $wp_platform = \YayMail\Platform\PlatformRegistry::get( 'email-builder' ); | |
| 42 | + $wp_platform = \YayMail\Platform\PlatformRegistry::get( 'yaymagic-email-builder' ); | |
| 43 | 43 | if ( $wp_platform ) { |
| 44 | 44 | $this->yay_wp_hook_surfix = $wp_platform->hook_suffix(); |
| 45 | 45 | } |
| 46 | 46 | add_action( 'admin_enqueue_scripts', [ $this, 'admin_enqueue_scripts' ], 30 ); |
| @@ -59,8 +59,15 @@ | ||
| 59 | 59 | /** |
| 60 | 60 | * Enqueue scripts using in settings page |
| 61 | 61 | */ |
| 62 | 62 | public function register_wp_editor_plugins_script( $plugin_array ) { |
| 63 | + // mce_external_plugins also runs on the frontend (e.g. Avada Live Builder | |
| 64 | + // calling _WP_Editors::editor_settings() from wp_footer). get_current_screen() | |
| 65 | + // is admin-only and is not defined there. | |
| 66 | + if ( ! function_exists( 'get_current_screen' ) ) { | |
| 67 | + return $plugin_array; | |
| 68 | + } | |
| 69 | + | |
| 63 | 70 | $plugin_url = YAYMAIL_PLUGIN_URL; |
| 64 | 71 | $screen = get_current_screen(); |
| 65 | 72 | $yaymail_platform = \YayMail\Platform\PlatformRegistry::get( 'yaymail' ); |
| 66 | 73 | if ( ( ! $yaymail_platform || ! $screen || $screen->id !== $yaymail_platform->hook_suffix() ) && defined( 'YAYWP_PLUGIN_URL' ) ) { |
| @@ -183,9 +190,9 @@ | ||
| 183 | 190 | 'revision_limit' => RevisionController::YAYMAIL_TEMPLATE_REVISION_LIMIT, |
| 184 | 191 | // Two compiled JS bundles still read global_headers_footers as a single |
| 185 | 192 | // legacy { global_header_elements, global_footer_elements } object rather |
| 186 | 193 | // than the per-language array Localize::get_global_headers_footers() |
| 187 | - // returns: (1) the "email-builder" (WP core mail) bundle -- confirmed | |
| 194 | + // returns: (1) the "yaymagic-email-builder" (WP core mail) bundle -- confirmed | |
| 188 | 195 | // byte-identical to the free "yaymail" lite bundle, it never received the |
| 189 | 196 | // multi-language upgrade -- and (2) the "yaymail" lite bundle itself when |
| 190 | 197 | // YAYMAIL_LITE_LEGACY_GHF_SHAPE is set. The paid yaymail-pro / |
| 191 | 198 | // email-customizer-for-woocommerce variants already expect the array. |
| @@ -195,9 +202,9 @@ | ||
| 195 | 202 | // to an array-expecting bundle breaks it with "global_headers_footers.find |
| 196 | 203 | // is not a function". Keep both conditions -- don't collapse into version |
| 197 | 204 | // checks, they gate an unrelated concern (see YAYWP_HOSTS_CORE above). |
| 198 | 205 | 'global_headers_footers' => ( $current_platform && ( |
| 199 | - 'email-builder' === $current_platform->key() | |
| 206 | + 'yaymagic-email-builder' === $current_platform->key() | |
| 200 | 207 | || ( 'yaymail' === $current_platform->key() && defined( 'YAYMAIL_LITE_LEGACY_GHF_SHAPE' ) && YAYMAIL_LITE_LEGACY_GHF_SHAPE ) |
| 201 | 208 | ) ) |
| 202 | 209 | ? \YayMail\Models\TemplateModel::get_global_header_and_footer( '', $current_platform->ghf_option_key() ) |
| 203 | 210 | : Localize::get_global_headers_footers( |
| @@ -207,12 +214,12 @@ | ||
| 207 | 214 | 'patterns' => PatternService::get_instance()->get_list_data(), |
| 208 | 215 | ], |
| 209 | 216 | 'colors' => [ |
| 210 | 217 | 'default_background_color' => YAYMAIL_COLOR_BACKGROUND_DEFAULT, |
| 211 | - 'default_text_link_color' => ( $current_platform && 'email-builder' === $current_platform->key() ) ? YAYMAIL_COLOR_WP_DEFAULT : YAYMAIL_COLOR_WC_DEFAULT, | |
| 218 | + 'default_text_link_color' => ( $current_platform && 'yaymagic-email-builder' === $current_platform->key() ) ? YAYMAIL_COLOR_WP_DEFAULT : YAYMAIL_COLOR_WC_DEFAULT, | |
| 212 | 219 | 'default_content_background_color' => YAYMAIL_COLOR_CONTENT_BACKGROUND_DEFAULT, |
| 213 | 220 | 'default_content_text_color' => YAYMAIL_COLOR_CONTENT_TEXT_DEFAULT, |
| 214 | - 'default_title_color' => ( $current_platform && 'email-builder' === $current_platform->key() ) ? YAYMAIL_COLOR_WP_DEFAULT : YAYMAIL_COLOR_TITLE_DEFAULT, | |
| 221 | + 'default_title_color' => ( $current_platform && 'yaymagic-email-builder' === $current_platform->key() ) ? YAYMAIL_COLOR_WP_DEFAULT : YAYMAIL_COLOR_TITLE_DEFAULT, | |
| 215 | 222 | ], |
| 216 | 223 | 'smtp' => [ |
| 217 | 224 | 'link_detail' => self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=yaysmtp§ion=description&TB_iframe=true&width=600&height=800' ), |
| 218 | 225 | 'setting' => admin_url( 'admin.php?page=yaysmtp' ), |
| @@ -230,8 +237,9 @@ | ||
| 230 | 237 | 'show_multi_select_notice' => get_option( 'yaymail_show_multi_select_notice', 'yes' ), |
| 231 | 238 | 'viewed_new_elements' => ! empty( get_option( 'yaymail_viewed_new_elements', [] ) ) ? get_option( 'yaymail_viewed_new_elements' ) : [], |
| 232 | 239 | 'ghf_disallowed_element_types' => yaymail_get_ghf_disallowed_element_types(), |
| 233 | 240 | 'platform' => $current_platform ? $current_platform->key() : 'yaymail', |
| 241 | + 'version' => yaymail_version(), | |
| 234 | 242 | 'woocommerce_email_styles' => $this->get_scoped_woocommerce_email_styles(), |
| 235 | 243 | ], |
| 236 | 244 | apply_filters( 'yaymail_additional_localized_variables', [] ) |
| 237 | 245 | ) |