%s is replaced with
%s
and replaced again in the javascript with the actual variable. public static get_translated_texts ( ) : array | ||
리턴 | array | Translated text strings for the help center. |
/** * Loads the required scripts for the config page. */ function config_page_scripts() { $this->asset_manager->enqueue_script('admin-script'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts()); wp_enqueue_script('dashboard'); wp_enqueue_script('thickbox'); $page = filter_input(INPUT_GET, 'page'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale())); if (in_array($page, array('wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER))) { wp_enqueue_media(); $this->asset_manager->enqueue_script('admin-media'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script()); } if ('wpseo_tools' === $page) { $this->enqueue_tools_scripts(); } }
/** * Enqueues all the needed JS and CSS. * * @todo [JRF => whomever] create css/metabox-mp6.css file and add it to the below allowed colors array when done */ public function enqueue() { global $pagenow; $asset_manager = new WPSEO_Admin_Asset_Manager(); $is_editor = self::is_post_overview($pagenow) || self::is_post_edit($pagenow); /* Filter 'wpseo_always_register_metaboxes_on_admin' documented in wpseo-main.php */ if (!$is_editor && apply_filters('wpseo_always_register_metaboxes_on_admin', false) === false || $this->is_metabox_hidden() === true) { return; } if (self::is_post_overview($pagenow)) { $asset_manager->enqueue_style('edit-page'); } else { if (0 != get_queried_object_id()) { wp_enqueue_media(array('post' => get_queried_object_id())); // Enqueue files needed for upload functionality. } $asset_manager->enqueue_style('metabox-css'); $asset_manager->enqueue_style('scoring'); $asset_manager->enqueue_style('snippet'); $asset_manager->enqueue_style('select2'); $asset_manager->enqueue_style('kb-search'); $asset_manager->enqueue_script('metabox'); $asset_manager->enqueue_script('admin-media'); $asset_manager->enqueue_script('post-scraper'); $asset_manager->enqueue_script('replacevar-plugin'); $asset_manager->enqueue_script('shortcode-plugin'); wp_enqueue_script('jquery-ui-autocomplete'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper', 'wpseoPostScraperL10n', $this->localize_post_scraper_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'shortcode-plugin', 'wpseoShortcodePluginL10n', $this->localize_shortcode_plugin_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale())); if (post_type_supports(get_post_type(), 'thumbnail')) { $asset_manager->enqueue_style('featured-image'); $asset_manager->enqueue_script('featured-image'); $featured_image_l10 = array('featured_image_notice' => __('The featured image should be at least 200x200 pixels to be picked up by Facebook and other social media sites.', 'wordpress-seo')); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoFeaturedImageL10n', $featured_image_l10); } } }
/** * Queue assets for taxonomy screens. * * @since 1.5.0 */ public function admin_enqueue_scripts() { $pagenow = $GLOBALS['pagenow']; if (!(self::is_term_edit($pagenow) || self::is_term_overview($pagenow))) { return; } $asset_manager = new WPSEO_Admin_Asset_Manager(); $asset_manager->enqueue_style('scoring'); $tag_id = filter_input(INPUT_GET, 'tag_ID'); if (self::is_term_edit($pagenow) && !empty($tag_id)) { wp_enqueue_media(); // Enqueue files needed for upload functionality. $asset_manager->enqueue_style('metabox-css'); $asset_manager->enqueue_style('snippet'); $asset_manager->enqueue_style('scoring'); $asset_manager->enqueue_script('metabox'); $asset_manager->enqueue_script('term-scraper'); $asset_manager->enqueue_style('kb-search'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper', 'wpseoTermScraperL10n', $this->localize_term_scraper_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'replacevar-plugin', 'wpseoReplaceVarsL10n', $this->localize_replace_vars_script()); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale())); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'metabox', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts()); $asset_manager->enqueue_script('admin-media'); wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', array('choose_image' => __('Use Image', 'wordpress-seo'))); } }