本文整理汇总了PHP中WPSEO_Utils::get_language方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::get_language方法的具体用法?PHP WPSEO_Utils::get_language怎么用?PHP WPSEO_Utils::get_language使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Utils
的用法示例。
在下文中一共展示了WPSEO_Utils::get_language方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: config_page_scripts
/**
* 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', $this->localize_admin_script());
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();
}
}
示例2: scripts_to_be_registered
/**
* Returns the scripts that need to be registered.
*
* @TODO data format is not self-documenting. Needs explanation inline. R.
*
* @return array scripts that need to be registered.
*/
private function scripts_to_be_registered()
{
return array(array('name' => 'admin-script', 'src' => 'wp-seo-admin-340', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar', self::PREFIX . 'select2', self::PREFIX . 'select2-translations')), array('name' => 'admin-media', 'src' => 'wp-seo-admin-media-320', 'deps' => array('jquery', 'jquery-ui-core')), array('name' => 'bulk-editor', 'src' => 'wp-seo-bulk-editor-340', 'deps' => array('jquery')), array('name' => 'dismissible', 'src' => 'wp-seo-dismissible-330', 'deps' => array('jquery')), array('name' => 'admin-global-script', 'src' => 'wp-seo-admin-global-340', 'deps' => array('jquery')), array('name' => 'metabox', 'src' => 'wp-seo-metabox-340', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-autocomplete', self::PREFIX . 'select2', self::PREFIX . 'select2-translations'), 'in_footer' => false), array('name' => 'featured-image', 'src' => 'wp-seo-featured-image-330', 'deps' => array('jquery')), array('name' => 'admin-gsc', 'src' => 'wp-seo-admin-gsc-340', 'deps' => array(), 'in_footer' => false), array('name' => 'post-scraper', 'src' => 'wp-seo-post-scraper-340', 'deps' => array(self::PREFIX . 'replacevar-plugin', self::PREFIX . 'shortcode-plugin', 'wp-util')), array('name' => 'term-scraper', 'src' => 'wp-seo-term-scraper-340', 'deps' => array(self::PREFIX . 'replacevar-plugin')), array('name' => 'replacevar-plugin', 'src' => 'wp-seo-replacevar-plugin-330'), array('name' => 'shortcode-plugin', 'src' => 'wp-seo-shortcode-plugin-340'), array('name' => 'recalculate', 'src' => 'wp-seo-recalculate-340', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar')), array('name' => 'primary-category', 'src' => 'wp-seo-metabox-category-340', 'deps' => array('jquery', 'wp-util')), array('name' => 'select2', 'src' => 'select2/select2', 'suffix' => '.min', 'deps' => array('jquery'), 'version' => '4.0.1'), array('name' => 'select2-translations', 'src' => 'select2/i18n/' . WPSEO_Utils::get_language(get_locale()), 'deps' => array('jquery', self::PREFIX . 'select2'), 'version' => '4.0.1', 'suffix' => ''));
}
示例3: enqueue
/**
* 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);
}
}
}
示例4: scripts_to_be_registered
/**
* Returns the scripts that need to be registered.
*
* @TODO data format is not self-documenting. Needs explanation inline. R.
*
* @return array scripts that need to be registered.
*/
private function scripts_to_be_registered()
{
$select2_language = 'en';
$locale = get_locale();
$language = WPSEO_Utils::get_language($locale);
if (file_exists(WPSEO_PATH . "js/dist/select2/i18n/{$locale}.js")) {
$select2_language = $locale;
// Chinese and some others use full locale.
} elseif (file_exists(WPSEO_PATH . "js/dist/select2/i18n/{$language}.js")) {
$select2_language = $language;
}
return array(array('name' => 'admin-script', 'src' => 'wp-seo-admin-380', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar', self::PREFIX . 'select2', self::PREFIX . 'select2-translations')), array('name' => 'admin-media', 'src' => 'wp-seo-admin-media-350', 'deps' => array('jquery', 'jquery-ui-core')), array('name' => 'bulk-editor', 'src' => 'wp-seo-bulk-editor-350', 'deps' => array('jquery')), array('name' => 'dismissible', 'src' => 'wp-seo-dismissible-350', 'deps' => array('jquery')), array('name' => 'admin-global-script', 'src' => 'wp-seo-admin-global-390', 'deps' => array('jquery')), array('name' => 'metabox', 'src' => 'wp-seo-metabox-390', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-autocomplete', self::PREFIX . 'select2', self::PREFIX . 'select2-translations'), 'in_footer' => false), array('name' => 'featured-image', 'src' => 'wp-seo-featured-image-350', 'deps' => array('jquery')), array('name' => 'admin-gsc', 'src' => 'wp-seo-admin-gsc-350', 'deps' => array(), 'in_footer' => false), array('name' => 'post-scraper', 'src' => 'wp-seo-post-scraper-390', 'deps' => array(self::PREFIX . 'replacevar-plugin', self::PREFIX . 'shortcode-plugin', 'wp-util')), array('name' => 'term-scraper', 'src' => 'wp-seo-term-scraper-390', 'deps' => array(self::PREFIX . 'replacevar-plugin')), array('name' => 'replacevar-plugin', 'src' => 'wp-seo-replacevar-plugin-380'), array('name' => 'shortcode-plugin', 'src' => 'wp-seo-shortcode-plugin-350'), array('name' => 'recalculate', 'src' => 'wp-seo-recalculate-390', 'deps' => array('jquery', 'jquery-ui-core', 'jquery-ui-progressbar')), array('name' => 'primary-category', 'src' => 'wp-seo-metabox-category-380', 'deps' => array('jquery', 'wp-util')), array('name' => 'select2', 'src' => 'select2/select2', 'suffix' => '.min', 'deps' => array('jquery'), 'version' => '4.0.3'), array('name' => 'select2-translations', 'src' => 'select2/i18n/' . $select2_language, 'deps' => array('jquery', self::PREFIX . 'select2'), 'version' => '4.0.3', 'suffix' => ''), array('name' => 'configuration-wizard', 'src' => 'configuration-wizard-380', 'deps' => array('jquery')));
}
示例5: admin_enqueue_scripts
/**
* 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')));
}
}