当前位置: 首页>>代码示例>>PHP>>正文


PHP get_user_locale函数代码示例

本文整理汇总了PHP中get_user_locale函数的典型用法代码示例。如果您正苦于以下问题:PHP get_user_locale函数的具体用法?PHP get_user_locale怎么用?PHP get_user_locale使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_user_locale函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export_preview_data

    /**
     * Communicates the sidebars that appeared on the page at the very end of the page,
     * and at the very end of the wp_footer,
     *
     * @since 3.9.0
     * @access public
     *
     * @global array $wp_registered_sidebars
     * @global array $wp_registered_widgets
     */
    public function export_preview_data()
    {
        global $wp_registered_sidebars, $wp_registered_widgets;
        $switched_locale = switch_to_locale(get_user_locale());
        $l10n = array('widgetTooltip' => __('Shift-click to edit this widget.'));
        if ($switched_locale) {
            restore_previous_locale();
        }
        // Prepare Customizer settings to pass to JavaScript.
        $settings = array('renderedSidebars' => array_fill_keys(array_unique($this->rendered_sidebars), true), 'renderedWidgets' => array_fill_keys(array_keys($this->rendered_widgets), true), 'registeredSidebars' => array_values($wp_registered_sidebars), 'registeredWidgets' => $wp_registered_widgets, 'l10n' => $l10n, 'selectiveRefreshableWidgets' => $this->get_selective_refreshable_widgets());
        foreach ($settings['registeredWidgets'] as &$registered_widget) {
            unset($registered_widget['callback']);
            // may not be JSON-serializeable
        }
        ?>
		<script type="text/javascript">
			var _wpWidgetCustomizerPreviewSettings = <?php 
        echo wp_json_encode($settings);
        ?>
;
		</script>
		<?php 
    }
开发者ID:CompositeUK,项目名称:clone.WordPress-Core,代码行数:33,代码来源:class-wp-customize-widgets.php

示例2: switch_to_locale

 /**
  * Switches the translations according to the given locale.
  *
  * @since 4.7.0
  *
  * @param string $locale The locale to switch to.
  * @return bool True on success, false on failure.
  */
 public function switch_to_locale($locale)
 {
     $current_locale = is_admin() ? get_user_locale() : get_locale();
     if ($current_locale === $locale) {
         return false;
     }
     if (!in_array($locale, $this->available_languages, true)) {
         return false;
     }
     $this->locales[] = $locale;
     $this->change_locale($locale);
     /**
      * Fires when the locale is switched.
      *
      * @since 4.7.0
      *
      * @param string $locale The new locale.
      */
     do_action('switch_locale', $locale);
     return true;
 }
开发者ID:johnpbloch,项目名称:wordpress,代码行数:29,代码来源:class-wp-locale-switcher.php

示例3: html


//.........这里部分代码省略.........
        wp_enqueue_script('press-this');
        wp_enqueue_script('json2');
        wp_enqueue_script('editor');
        $supports_formats = false;
        $post_format = 0;
        if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
            $supports_formats = true;
            if (!($post_format = get_post_format($post_ID))) {
                $post_format = 0;
            }
        }
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_enqueue_scripts', 'press-this.php');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_print_styles-press-this.php');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_print_styles');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_print_scripts-press-this.php');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_print_scripts');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_head-press-this.php');
        /** This action is documented in wp-admin/admin-header.php */
        do_action('admin_head');
        ?>
</head>
<?php 
        $admin_body_class = 'press-this';
        $admin_body_class .= is_rtl() ? ' rtl' : '';
        $admin_body_class .= ' branch-' . str_replace(array('.', ','), '-', floatval($wp_version));
        $admin_body_class .= ' version-' . str_replace('.', '-', preg_replace('/^([.0-9]+).*/', '$1', $wp_version));
        $admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh');
        $admin_body_class .= ' locale-' . sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
        /** This filter is documented in wp-admin/admin-header.php */
        $admin_body_classes = apply_filters('admin_body_class', '');
        ?>
<body class="wp-admin wp-core-ui <?php 
        echo $admin_body_classes . ' ' . $admin_body_class;
        ?>
">
	<div id="adminbar" class="adminbar">
		<h1 id="current-site" class="current-site">
			<a class="current-site-link" href="<?php 
        echo esc_url(home_url('/'));
        ?>
" target="_blank" rel="home">
				<span class="dashicons dashicons-wordpress"></span>
				<span class="current-site-name"><?php 
        bloginfo('name');
        ?>
</span>
			</a>
		</h1>
		<button type="button" class="options button-link closed">
			<span class="dashicons dashicons-tag on-closed"></span>
			<span class="screen-reader-text on-closed"><?php 
        _e('Show post options');
        ?>
</span>
			<span aria-hidden="true" class="on-open"><?php 
        _e('Done');
        ?>
</span>
			<span class="screen-reader-text on-open"><?php 
        _e('Hide post options');
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:67,代码来源:class-wp-press-this.php

示例4: export_preview_data

 /**
  * Exports data in preview after it has finished rendering so that partials can be added at runtime.
  *
  * @since 4.5.0
  * @access public
  */
 public function export_preview_data()
 {
     $partials = array();
     foreach ($this->partials() as $partial) {
         if ($partial->check_capabilities()) {
             $partials[$partial->id] = $partial->json();
         }
     }
     $switched_locale = switch_to_locale(get_user_locale());
     $l10n = array('shiftClickToEdit' => __('Shift-click to edit this element.'), 'clickEditMenu' => __('Click to edit this menu.'), 'clickEditWidget' => __('Click to edit this widget.'), 'clickEditTitle' => __('Click to edit the site title.'), 'clickEditMisc' => __('Click to edit this element.'), 'badDocumentWrite' => sprintf(__('%s is forbidden'), 'document.write()'));
     if ($switched_locale) {
         restore_previous_locale();
     }
     $exports = array('partials' => $partials, 'renderQueryVar' => self::RENDER_QUERY_VAR, 'l10n' => $l10n);
     // Export data to JS.
     echo sprintf('<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode($exports));
 }
开发者ID:CompositeUK,项目名称:clone.WordPress-Core,代码行数:23,代码来源:class-wp-customize-selective-refresh.php

示例5: test_user_locale_is_same_across_network

 public function test_user_locale_is_same_across_network()
 {
     if (!is_multisite()) {
         $this->markTestSkipped(__METHOD__ . ' requires multisite');
     }
     $user_locale = get_user_locale();
     switch_to_blog(self::factory()->blog->create());
     $user_locale_2 = get_user_locale();
     restore_current_blog();
     $this->assertSame('de_DE', $user_locale);
     $this->assertSame($user_locale, $user_locale_2);
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:12,代码来源:getUserLocale.php

示例6: wp_credits

/**
 * Retrieve the contributor credits.
 *
 * @since 3.2.0
 *
 * @return array|false A list of all of the contributors, or false on error.
 */
function wp_credits()
{
    $wp_version = get_bloginfo('version');
    $locale = get_user_locale();
    $results = get_site_transient('wordpress_credits_' . $locale);
    if (!is_array($results) || false !== strpos($wp_version, '-') || isset($results['data']['version']) && strpos($wp_version, $results['data']['version']) !== 0) {
        $response = wp_remote_get("http://api.wordpress.org/core/credits/1.1/?version={$wp_version}&locale={$locale}");
        if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) {
            return false;
        }
        $results = json_decode(wp_remote_retrieve_body($response), true);
        if (!is_array($results)) {
            return false;
        }
        set_site_transient('wordpress_credits_' . $locale, $results, DAY_IN_SECONDS);
    }
    return $results;
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:25,代码来源:credits.php

示例7: get_locale

function get_locale()
{
    global $webimroot, $locale_pattern;
    $locale = verifyparam("locale", $locale_pattern, "");
    if ($locale && locale_exists($locale)) {
        $_SESSION['locale'] = $locale;
        setcookie('webim_locale', $locale, time() + 60 * 60 * 24 * 1000, "{$webimroot}/");
    } else {
        if (isset($_SESSION['locale'])) {
            $locale = $_SESSION['locale'];
        }
    }
    if (!$locale || !locale_exists($locale)) {
        $locale = get_user_locale();
    }
    return $locale;
}
开发者ID:eMagicMan,项目名称:Study-CSharp,代码行数:17,代码来源:common.php

示例8: wp_dashboard_browser_nag

function wp_dashboard_browser_nag()
{
    $notice = '';
    $response = wp_check_browser_version();
    if ($response) {
        if ($response['insecure']) {
            /* translators: %s: browser name and link */
            $msg = sprintf(__("It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser."), sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name'])));
        } else {
            /* translators: %s: browser name and link */
            $msg = sprintf(__("It looks like you're using an old version of %s. For the best WordPress experience, please update your browser."), sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name'])));
        }
        $browser_nag_class = '';
        if (!empty($response['img_src'])) {
            $img_src = is_ssl() && !empty($response['img_src_ssl']) ? $response['img_src_ssl'] : $response['img_src'];
            $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr($img_src) . '" alt="" /></a></div>';
            $browser_nag_class = ' has-browser-icon';
        }
        $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
        $browsehappy = 'http://browsehappy.com/';
        $locale = get_user_locale();
        if ('en_US' !== $locale) {
            $browsehappy = add_query_arg('locale', $locale, $browsehappy);
        }
        $notice .= '<p>' . sprintf(__('<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>'), esc_attr($response['update_url']), esc_html($response['name']), esc_url($browsehappy)) . '</p>';
        $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__('Dismiss the browser warning panel') . '">' . __('Dismiss') . '</a></p>';
        $notice .= '<div class="clear"></div>';
    }
    /**
     * Filters the notice output for the 'Browse Happy' nag meta box.
     *
     * @since 3.2.0
     *
     * @param string $notice   The notice content.
     * @param array  $response An array containing web browser information.
     */
    echo apply_filters('browse-happy-notice', $notice, $response);
}
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:38,代码来源:dashboard.php

示例9: sort_by_name

 /**
  * Sorts themes by name.
  *
  * @since 3.4.0
  *
  * @static
  * @access public
  *
  * @param array $themes Array of themes to sort, passed by reference.
  */
 public static function sort_by_name(&$themes)
 {
     if (0 === strpos(get_user_locale(), 'en_')) {
         uasort($themes, array('WP_Theme', '_name_sort'));
     } else {
         uasort($themes, array('WP_Theme', '_name_sort_i18n'));
     }
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:18,代码来源:class-wp-theme.php

示例10: str_replace

if (is_admin_bar_showing()) {
    $admin_body_class .= ' admin-bar';
}
if (is_rtl()) {
    $admin_body_class .= ' rtl';
}
if ($current_screen->post_type) {
    $admin_body_class .= ' post-type-' . $current_screen->post_type;
}
if ($current_screen->taxonomy) {
    $admin_body_class .= ' taxonomy-' . $current_screen->taxonomy;
}
$admin_body_class .= ' branch-' . str_replace(array('.', ','), '-', floatval(get_bloginfo('version')));
$admin_body_class .= ' version-' . str_replace('.', '-', preg_replace('/^([.0-9]+).*/', '$1', get_bloginfo('version')));
$admin_body_class .= ' admin-color-' . sanitize_html_class(get_user_option('admin_color'), 'fresh');
$admin_body_class .= ' locale-' . sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
if (wp_is_mobile()) {
    $admin_body_class .= ' mobile';
}
if (is_multisite()) {
    $admin_body_class .= ' multisite';
}
if (is_network_admin()) {
    $admin_body_class .= ' network-admin';
}
$admin_body_class .= ' no-customize-support no-svg';
?>
</head>
<?php 
/**
 * Filters the CSS classes for the body tag in the admin.
开发者ID:johnpbloch,项目名称:wordpress,代码行数:31,代码来源:admin-header.php

示例11: load_textdomain

 /**
  * Loads the plugin language files.
  *
  * @access public
  * @since 1.4
  * @return void
  */
 public function load_textdomain()
 {
     global $wp_version;
     /*
      * Due to the introduction of language packs through translate.wordpress.org, loading our textdomain is complex.
      *
      * In v2.4.6, our textdomain changed from "edd" to "easy-digital-downloads".
      *
      * To support existing translation files from before the change, we must look for translation files in several places and under several names.
      *
      * - wp-content/languages/plugins/easy-digital-downloads (introduced with language packs)
      * - wp-content/languages/edd/ (custom folder we have supported since 1.4)
      * - wp-content/plugins/easy-digital-downloads/languages/
      *
      * In wp-content/languages/edd/ we must look for "easy-digital-downloads-{lang}_{country}.mo"
      * In wp-content/languages/edd/ we must look for "edd-{lang}_{country}.mo" as that was the old file naming convention
      * In wp-content/languages/plugins/easy-digital-downloads/ we only need to look for "easy-digital-downloads-{lang}_{country}.mo" as that is the new structure
      * In wp-content/plugins/easy-digital-downloads/languages/, we must look for both naming conventions. This is done by filtering "load_textdomain_mofile"
      *
      */
     add_filter('load_textdomain_mofile', array($this, 'load_old_textdomain'), 10, 2);
     // Set filter for plugin's languages directory.
     $edd_lang_dir = dirname(plugin_basename(EDD_PLUGIN_FILE)) . '/languages/';
     $edd_lang_dir = apply_filters('edd_languages_directory', $edd_lang_dir);
     // Traditional WordPress plugin locale filter.
     $get_locale = get_locale();
     if ($wp_version >= 4.7) {
         $get_locale = get_user_locale();
     }
     /**
      * Defines the plugin language locale used in AffiliateWP.
      *
      * @var $get_locale The locale to use. Uses get_user_locale()` in WordPress 4.7 or greater,
      *                  otherwise uses `get_locale()`.
      */
     $locale = apply_filters('plugin_locale', $get_locale, 'easy-digital-downloads');
     $mofile = sprintf('%1$s-%2$s.mo', 'easy-digital-downloads', $locale);
     // Look for wp-content/languages/edd/easy-digital-downloads-{lang}_{country}.mo
     $mofile_global1 = WP_LANG_DIR . '/edd/easy-digital-downloads-' . $locale . '.mo';
     // Look for wp-content/languages/edd/edd-{lang}_{country}.mo
     $mofile_global2 = WP_LANG_DIR . '/edd/edd-' . $locale . '.mo';
     // Look in wp-content/languages/plugins/easy-digital-downloads
     $mofile_global3 = WP_LANG_DIR . '/plugins/easy-digital-downloads/' . $mofile;
     if (file_exists($mofile_global1)) {
         load_textdomain('easy-digital-downloads', $mofile_global1);
     } elseif (file_exists($mofile_global2)) {
         load_textdomain('easy-digital-downloads', $mofile_global2);
     } elseif (file_exists($mofile_global3)) {
         load_textdomain('easy-digital-downloads', $mofile_global3);
     } else {
         // Load the default language files.
         load_plugin_textdomain('easy-digital-downloads', false, $edd_lang_dir);
     }
 }
开发者ID:benjaminprojas,项目名称:Easy-Digital-Downloads,代码行数:61,代码来源:easy-digital-downloads.php

示例12: themes_api

/**
 * Retrieves theme installer pages from the WordPress.org Themes API.
 *
 * It is possible for a theme to override the Themes API result with three
 * filters. Assume this is for themes, which can extend on the Theme Info to
 * offer more choices. This is very powerful and must be used with care, when
 * overriding the filters.
 *
 * The first filter, {@see 'themes_api_args'}, is for the args and gives the action
 * as the second parameter. The hook for {@see 'themes_api_args'} must ensure that
 * an object is returned.
 *
 * The second filter, {@see 'themes_api'}, allows a plugin to override the WordPress.org
 * Theme API entirely. If `$action` is 'query_themes', 'theme_information', or 'feature_list',
 * an object MUST be passed. If `$action` is 'hot_tags', an array should be passed.
 *
 * Finally, the third filter, {@see 'themes_api_result'}, makes it possible to filter the
 * response object or array, depending on the `$action` type.
 *
 * Supported arguments per action:
 *
 * | Argument Name      | 'query_themes' | 'theme_information' | 'hot_tags' | 'feature_list'   |
 * | -------------------| :------------: | :-----------------: | :--------: | :--------------: |
 * | `$slug`            | No             |  Yes                | No         | No               |
 * | `$per_page`        | Yes            |  No                 | No         | No               |
 * | `$page`            | Yes            |  No                 | No         | No               |
 * | `$number`          | No             |  No                 | Yes        | No               |
 * | `$search`          | Yes            |  No                 | No         | No               |
 * | `$tag`             | Yes            |  No                 | No         | No               |
 * | `$author`          | Yes            |  No                 | No         | No               |
 * | `$user`            | Yes            |  No                 | No         | No               |
 * | `$browse`          | Yes            |  No                 | No         | No               |
 * | `$locale`          | Yes            |  Yes                | No         | No               |
 * | `$fields`          | Yes            |  Yes                | No         | No               |
 *
 * @since 2.8.0
 *
 * @param string       $action API action to perform: 'query_themes', 'theme_information',
 *                             'hot_tags' or 'feature_list'.
 * @param array|object $args   {
 *     Optional. Array or object of arguments to serialize for the Themes API.
 *
 *     @type string  $slug     The theme slug. Default empty.
 *     @type int     $per_page Number of themes per page. Default 24.
 *     @type int     $page     Number of current page. Default 1.
 *     @type int     $number   Number of tags to be queried.
 *     @type string  $search   A search term. Default empty.
 *     @type string  $tag      Tag to filter themes. Default empty.
 *     @type string  $author   Username of an author to filter themes. Default empty.
 *     @type string  $user     Username to query for their favorites. Default empty.
 *     @type string  $browse   Browse view: 'featured', 'popular', 'updated', 'favorites'.
 *     @type string  $locale   Locale to provide context-sensitive results. Default is the value of get_locale().
 *     @type array   $fields   {
 *         Array of fields which should or should not be returned.
 *
 *         @type bool $description        Whether to return the theme full description. Default false.
 *         @type bool $sections           Whether to return the theme readme sections: description, installation,
 *                                        FAQ, screenshots, other notes, and changelog. Default false.
 *         @type bool $rating             Whether to return the rating in percent and total number of ratings.
 *                                        Default false.
 *         @type bool $ratings            Whether to return the number of rating for each star (1-5). Default false.
 *         @type bool $downloaded         Whether to return the download count. Default false.
 *         @type bool $downloadlink       Whether to return the download link for the package. Default false.
 *         @type bool $last_updated       Whether to return the date of the last update. Default false.
 *         @type bool $tags               Whether to return the assigned tags. Default false.
 *         @type bool $homepage           Whether to return the theme homepage link. Default false.
 *         @type bool $screenshots        Whether to return the screenshots. Default false.
 *         @type int  $screenshot_count   Number of screenshots to return. Default 1.
 *         @type bool $screenshot_url     Whether to return the URL of the first screenshot. Default false.
 *         @type bool $photon_screenshots Whether to return the screenshots via Photon. Default false.
 *         @type bool $template           Whether to return the slug of the parent theme. Default false.
 *         @type bool $parent             Whether to return the slug, name and homepage of the parent theme. Default false.
 *         @type bool $versions           Whether to return the list of all available versions. Default false.
 *         @type bool $theme_url          Whether to return theme's URL. Default false.
 *         @type bool $extended_author    Whether to return nicename or nicename and display name. Default false.
 *     }
 * }
 * @return object|array|WP_Error Response object or array on success, WP_Error on failure. See the
 *         {@link https://developer.wordpress.org/reference/functions/themes_api/ function reference article}
 *         for more information on the make-up of possible return objects depending on the value of `$action`.
 */
function themes_api($action, $args = array())
{
    if (is_array($args)) {
        $args = (object) $args;
    }
    if (!isset($args->per_page)) {
        $args->per_page = 24;
    }
    if (!isset($args->locale)) {
        $args->locale = get_user_locale();
    }
    /**
     * Filters arguments used to query for installer pages from the WordPress.org Themes API.
     *
     * Important: An object MUST be returned to this filter.
     *
     * @since 2.8.0
     *
     * @param object $args   Arguments used to query for installer pages from the WordPress.org Themes API.
//.........这里部分代码省略.........
开发者ID:johnpbloch,项目名称:wordpress,代码行数:101,代码来源:theme.php

示例13: header

// @NOTE: if the user doesn't have permission to view users
// it should be log out
// see: https://github.com/directus/directus/issues/1268
if (!$users) {
    AuthProvider::logout();
    $_SESSION['error_message'] = 'Your user doesn\'t have permission to log in';
    header('Location: ' . DIRECTUS_PATH . 'login.php');
    exit;
}
$currentUserInfo = getCurrentUserInfo($users);
// Cache buster
$git = __DIR__ . '/.git';
$cacheBuster = Directus\Util\Git::getCloneHash($git);
$tableSchema = TableSchema::getAllSchemas($currentUserInfo['group']['id'], $cacheBuster);
// $tabPrivileges = getTabPrivileges(($currentUserInfo['group']['id']));
$groupId = $currentUserInfo['group']['id'];
$groups = getGroups();
$currentUserGroup = [];
if (isset($groups['rows']) && count($groups['rows'] > 0)) {
    foreach ($groups['rows'] as $group) {
        if ($group['id'] === $groupId) {
            $currentUserGroup = $group;
            break;
        }
    }
}
$statusMapping = ['active_num' => STATUS_ACTIVE_NUM, 'deleted_num' => STATUS_DELETED_NUM, 'status_name' => STATUS_COLUMN_NAME];
$statusMapping['mapping'] = $config['statusMapping'];
$data = ['cacheBuster' => $cacheBuster, 'nonces' => getNonces(), 'storage_adapters' => getStorageAdapters(), 'path' => DIRECTUS_PATH, 'page' => '#tables', 'tables' => parseTables($tableSchema), 'preferences' => parsePreferences($tableSchema), 'users' => $users, 'groups' => $groups, 'settings' => getSettings(), 'active_files' => getActiveFiles(), 'authenticatedUser' => $authenticatedUser, 'extensions' => getExtensions($currentUserGroup), 'privileges' => getPrivileges($groupId), 'ui' => getUI(), 'locale' => get_user_locale(), 'localesAvailable' => parseLocalesAvailable(get_locales_available()), 'phrases' => get_phrases(get_user_locale()), 'timezone' => get_user_timezone(), 'timezones' => get_timezone_list(), 'listViews' => getListViews(), 'messages' => getInbox(), 'user_notifications' => getLoginNotification(), 'bookmarks' => getBookmarks(), 'extendedUserColumns' => getExtendedUserColumns($tableSchema), 'statusMapping' => $statusMapping];
$templateVars = ['cacheBuster' => $cacheBuster, 'data' => json_encode($data), 'path' => DIRECTUS_PATH, 'locale' => get_user_locale(), 'dir' => 'ltr', 'customFooterHTML' => getCusomFooterHTML(), 'cssFilePath' => getCSSFilePath()];
echo template(file_get_contents('main.html'), $templateVars);
开发者ID:jel-massih,项目名称:directus,代码行数:31,代码来源:index.php

示例14: customize_preview_settings

    /**
     * Print JavaScript settings for preview frame.
     *
     * @since 3.4.0
     */
    public function customize_preview_settings()
    {
        $post_values = $this->unsanitized_post_values(array('exclude_changeset' => true));
        $setting_validities = $this->validate_setting_values($post_values);
        $exported_setting_validities = array_map(array($this, 'prepare_setting_validity_for_js'), $setting_validities);
        // Note that the REQUEST_URI is not passed into home_url() since this breaks subdirectory installs.
        $self_url = empty($_SERVER['REQUEST_URI']) ? home_url('/') : esc_url_raw(wp_unslash($_SERVER['REQUEST_URI']));
        $state_query_params = array('customize_theme', 'customize_changeset_uuid', 'customize_messenger_channel');
        $self_url = remove_query_arg($state_query_params, $self_url);
        $allowed_urls = $this->get_allowed_urls();
        $allowed_hosts = array();
        foreach ($allowed_urls as $allowed_url) {
            $parsed = wp_parse_url($allowed_url);
            if (empty($parsed['host'])) {
                continue;
            }
            $host = $parsed['host'];
            if (!empty($parsed['port'])) {
                $host .= ':' . $parsed['port'];
            }
            $allowed_hosts[] = $host;
        }
        $switched_locale = switch_to_locale(get_user_locale());
        $l10n = array('shiftClickToEdit' => __('Shift-click to edit this element.'), 'linkUnpreviewable' => __('This link is not live-previewable.'), 'formUnpreviewable' => __('This form is not live-previewable.'));
        if ($switched_locale) {
            restore_previous_locale();
        }
        $settings = array('changeset' => array('uuid' => $this->_changeset_uuid), 'timeouts' => array('selectiveRefresh' => 250, 'keepAliveSend' => 1000), 'theme' => array('stylesheet' => $this->get_stylesheet(), 'active' => $this->is_theme_active()), 'url' => array('self' => $self_url, 'allowed' => array_map('esc_url_raw', $this->get_allowed_urls()), 'allowedHosts' => array_unique($allowed_hosts), 'isCrossDomain' => $this->is_cross_domain()), 'channel' => $this->messenger_channel, 'activePanels' => array(), 'activeSections' => array(), 'activeControls' => array(), 'settingValidities' => $exported_setting_validities, 'nonce' => current_user_can('customize') ? $this->get_nonces() : array(), 'l10n' => $l10n, '_dirty' => array_keys($post_values));
        foreach ($this->panels as $panel_id => $panel) {
            if ($panel->check_capabilities()) {
                $settings['activePanels'][$panel_id] = $panel->active();
                foreach ($panel->sections as $section_id => $section) {
                    if ($section->check_capabilities()) {
                        $settings['activeSections'][$section_id] = $section->active();
                    }
                }
            }
        }
        foreach ($this->sections as $id => $section) {
            if ($section->check_capabilities()) {
                $settings['activeSections'][$id] = $section->active();
            }
        }
        foreach ($this->controls as $id => $control) {
            if ($control->check_capabilities()) {
                $settings['activeControls'][$id] = $control->active();
            }
        }
        ?>
		<script type="text/javascript">
			var _wpCustomizeSettings = <?php 
        echo wp_json_encode($settings);
        ?>
;
			_wpCustomizeSettings.values = {};
			(function( v ) {
				<?php 
        /*
         * Serialize settings separately from the initial _wpCustomizeSettings
         * serialization in order to avoid a peak memory usage spike.
         * @todo We may not even need to export the values at all since the pane syncs them anyway.
         */
        foreach ($this->settings as $id => $setting) {
            if ($setting->check_capabilities()) {
                printf("v[%s] = %s;\n", wp_json_encode($id), wp_json_encode($setting->js_value()));
            }
        }
        ?>
			})( _wpCustomizeSettings.values );
		</script>
		<?php 
    }
开发者ID:CompositeUK,项目名称:clone.WordPress-Core,代码行数:77,代码来源:class-wp-customize-manager.php

示例15: elseif

    } elseif ($current_offset < 0) {
        $tzstring = 'UTC' . $current_offset;
    } else {
        $tzstring = 'UTC+' . $current_offset;
    }
}
?>
<th scope="row"><label for="timezone_string"><?php 
_e('Timezone');
?>
</label></th>
<td>

<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
	<?php 
echo wp_timezone_choice($tzstring, get_user_locale());
?>
</select>

<p class="description" id="timezone-description"><?php 
_e('Choose either a city in the same timezone as you or a UTC timezone offset.');
?>
</p>

<p class="timezone-info">
	<span id="utc-time"><?php 
/* translators: 1: UTC abbreviation, 2: UTC time */
printf(__('Universal time (%1$s) is %2$s.'), '<abbr>' . __('UTC') . '</abbr>', '<code>' . date_i18n($timezone_format, false, true) . '</code>');
?>
</span>
<?php 
开发者ID:aaemnnosttv,项目名称:develop.git.wordpress.org,代码行数:31,代码来源:options-general.php


注:本文中的get_user_locale函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。