本文整理汇总了PHP中wp_timezone_choice函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_timezone_choice函数的具体用法?PHP wp_timezone_choice怎么用?PHP wp_timezone_choice使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_timezone_choice函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: render
public function render()
{
$field = $this->field;
$args = wp_parse_args($this->args, array('value' => $field->escaped_value(), 'desc' => $this->_desc(true), 'text_datetime_timestamp' => array(), 'select_timezone' => array()));
$args['value'] = $field->escaped_value();
if (is_array($args['value'])) {
$args['value'] = '';
}
$datetime = maybe_unserialize($args['value']);
$value = $tzstring = '';
if ($datetime && $datetime instanceof DateTime) {
$tz = $datetime->getTimezone();
$tzstring = $tz->getName();
$value = $datetime->getTimestamp();
}
$timestamp_args = wp_parse_args($args['text_datetime_timestamp'], array('desc' => '', 'value' => $value, 'rendered' => true));
$datetime_timestamp = $this->types->text_datetime_timestamp($timestamp_args);
$timezone_select_args = wp_parse_args($args['select_timezone'], array('class' => 'cmb2_select cmb2-select-timezone', 'name' => $this->_name('[timezone]'), 'id' => $this->_id('_timezone'), 'options' => wp_timezone_choice($tzstring), 'desc' => $args['desc'], 'rendered' => true));
$select = $this->types->select($timezone_select_args);
return $this->rendered($datetime_timestamp . "\n" . $select);
}
开发者ID:jrfnl,项目名称:CMB2,代码行数:21,代码来源:CMB2_Type_Text_Datetime_Timestamp_Timezone.php
示例2: sp_text
$tout = '';
$tout .= '<div class="spColumnSection spProfileLeftCol">';
$tout .= '<p class="spProfileLabel">' . sp_text('Select your Timezone') . ':</p>';
$tout .= '</div>';
$tout .= '<div class="spColumnSection spProfileSpacerCol"></div>';
$tout .= '<div class="spColumnSection spProfileRightCol">';
$tz = get_option('timezone_string');
if (empty($tz) || substr($tz, 0, 3) == 'UTC') {
$tz = 'UTC';
}
$tzUser = !empty($spProfileUser->timezone_string) ? $spProfileUser->timezone_string : $tz;
if (substr($tzUser, 0, 3) == 'UTC') {
$tzUser = 'UTC';
}
$tout .= '<p class="spProfileLabel"><select class="spControl" id="timezone" name="timezone">';
$wptz = explode('<optgroup label=', wp_timezone_choice($tzUser));
unset($wptz[count($wptz) - 1]);
$tout .= implode('<optgroup label=', $wptz);
$tout .= '</select></p>';
$tout .= '<p><small>' . sp_text('Server Timezone set to') . ': <b>' . $tz . '</b></small></p>';
# timezone message
date_default_timezone_set($tz);
$now = localtime(time(), true);
if ($now['tm_isdst']) {
$tout .= '<p><small>' . sp_text('This timezone is currently in daylight savings time') . '</small></p>';
} else {
$tout .= '<p><small>' . sp_text('This timezone is currently in standard time') . '</small></p>';
}
$tout .= '<p><small>' . sp_text('Server Time is') . ': <b>' . date('Y-m-d G:i:s') . '</b></small></p>';
date_default_timezone_set($tzUser);
$tout .= '<p><small>' . sp_text('Local Time is') . ': <b>' . date('Y-m-d G:i:s') . '</b></small></p>';
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:sp-form-display-options.php
示例3: audiotheme_timezone_choice
/**
* Gives a nicely formatted list of timezone strings.
*
* Strips the manual offsets from the default WordPress list.
*
* @since 1.0.0
* @uses wp_timezone_choice()
*
* @param string $selected_zone Selected Zone.
* @return string
*/
function audiotheme_timezone_choice($selected_zone = null)
{
$selected = empty($selected_zone) ? get_option('timezone_string') : $selected_zone;
$choices = wp_timezone_choice($selected);
// Remove the manual offsets optgroup.
$pos = strrpos($choices, '<optgroup');
if (false !== $pos) {
$choices = substr($choices, 0, $pos);
}
return apply_filters('audiotheme_timezone_dropdown', $choices, $selected);
}
开发者ID:TyRichards,项目名称:ty_the_band,代码行数:22,代码来源:functions.php
示例4: timezone_setting
/**
* Timezone settings
*
* @access public
* @return void
*/
public function timezone_setting()
{
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if (false !== strpos($tzstring, 'Etc/GMT')) {
$tzstring = '';
}
if (empty($tzstring)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if (0 == $current_offset) {
$tzstring = 'UTC+0';
} elseif ($current_offset < 0) {
$tzstring = 'UTC' . $current_offset;
} else {
$tzstring = 'UTC+' . $current_offset;
}
}
$class = 'chosen-select' . (is_rtl() ? ' chosen-rtl' : '');
?>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="timezone_string"><?php
_e('Timezone', 'sportspress');
?>
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php
_e('Choose a city in the same timezone as you.', 'sportspress');
?>
"></i></label>
</th>
<td class="forminp">
<legend class="screen-reader-text"><span><?php
_e('Timezone', 'sportspress');
?>
</span></legend>
<select id="timezone_string" name="timezone_string" class="<?php
echo $class;
?>
">
<?php
echo wp_timezone_choice($tzstring);
?>
</select>
</td>
</tr>
<?php
}
开发者ID:krmkrl,项目名称:SportsPress,代码行数:55,代码来源:class-sp-settings-general.php
示例5: about_screen
//.........这里部分代码省略.........
<th scope="row" class="titledesc">
<label for="timezone_string"><?php
_e('Timezone', 'sportspress');
?>
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php
_e('Choose a city in the same timezone as you.', 'sportspress');
?>
"></i></label>
</th>
<td>
<select id="timezone_string" name="timezone_string" class="<?php
echo $class;
?>
">
<?php
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if (false !== strpos($tzstring, 'Etc/GMT')) {
$tzstring = '';
}
if (empty($tzstring)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if (0 == $current_offset) {
$tzstring = 'UTC+0';
} elseif ($current_offset < 0) {
$tzstring = 'UTC' . $current_offset;
} else {
$tzstring = 'UTC+' . $current_offset;
}
}
echo wp_timezone_choice($tzstring);
?>
</select>
</td>
</tr>
<?php
$sport_options = SP_Admin_Sports::get_preset_options();
$settings = array(array('id' => 'sportspress_sport', 'default' => 'custom', 'type' => 'sport', 'title' => __('Sport', 'sportspress'), 'welcome' => true, 'class' => $class, 'options' => $sport_options));
SP_Admin_Settings::output_fields($settings);
?>
</tbody>
</table>
<p class="submit sportspress-actions">
<input name="save" class="button-primary" type="submit" value="<?php
_e('Save Changes', 'sportspress');
?>
" />
<input type="hidden" name="subtab" id="last_tab" />
<?php
wp_nonce_field('sportspress-settings');
?>
</p>
</form>
</div>
<?php
if (current_user_can('install_themes') && !current_theme_supports('sportspress')) {
?>
<div class="last-feature">
<h4><?php
_e('Free SportsPress Theme', 'sportspress');
?>
</h4>
<a href="<?php
开发者ID:krmkrl,项目名称:SportsPress,代码行数:67,代码来源:class-sp-admin-welcome.php
示例6: 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">
<?php
echo wp_timezone_choice($tzstring);
?>
</select>
<span id="utc-time"><?php
printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt'));
?>
</span>
<?php
if (get_option('timezone_string') || !empty($current_offset)) {
?>
<span id="local-time"><?php
printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format));
?>
</span>
<?php
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:31,代码来源:options-general.php
示例7: advanced_settings_panel
/**
* Print the advanced settings panel.
*
* @since 3.0.0
* @access private
*
* @param \WP_Post $post
*/
private static function advanced_settings_panel($post)
{
?>
<table>
<thead>
<tr><th colspan="2"><?php
_e('Date and Time', 'google-calendar-events');
?>
</th></tr>
</thead>
<tbody class="simcal-panel-section simcal-panel-datetime-formatting">
<tr class="simcal-panel-field">
<th><label for="_calendar_timezone_setting"><?php
_e('Timezone', 'google-calendar-events');
?>
</label></th>
<td>
<?php
$timezone_wordpress = simcal_get_wp_timezone();
$timezone_default = $timezone_wordpress ? $timezone_wordpress : 'UTC';
$timezone_setting = esc_attr(get_post_meta($post->ID, '_feed_timezone_setting', true));
$timezone = esc_attr(get_post_meta($post->ID, '_feed_timezone', true));
$timezone = $timezone ? $timezone : $timezone_default;
?>
<select name="_feed_timezone_setting"
id="_feed_timezone_setting"
class="simcal-field simcal-field-select simcal-field-inline simcal-field-show-next"
data-show-next-if-value="use_custom">
<option value="use_calendar" <?php
selected('use_calendar', $timezone_setting, true);
?>
><?php
_ex('Events source default', 'Use the calendar default setting', 'google-calendar-events');
?>
</option>
<option value="use_site" <?php
selected('use_site', $timezone_setting, true);
?>
><?php
printf(_x('Site default', 'Use this site default setting', 'google-calendar-events') . ' (%s)', $timezone_default);
?>
</option>
<option value="use_custom" <?php
selected('use_custom', $timezone_setting, true);
?>
><?php
_ex('Custom', 'Use a custom setting', 'google-calendar-events');
?>
</option>
</select>
<select name="_feed_timezone"
id="_feed_timezone"
class="simcal-field simcal-field-select simcal-field-inline"
<?php
echo 'use_custom' != $timezone_setting ? 'style="display: none;"' : '';
?>
>
<?php
echo wp_timezone_choice($timezone);
?>
</select>
<i class="simcal-icon-help simcal-help-tip" data-tip="<?php
_e('Using a different timezone may alter the date and time display of your calendar events. It is recommended to keep the calendar default timezone.', 'google-calendar-events');
?>
"></i>
</td>
</tr>
<tr class="simcal-panel-field">
<th><label for="_calendar_date_format_setting"><?php
_e('Date format', 'google-calendar-events');
?>
</label></th>
<td>
<?php
$date_format_setting = esc_attr(get_post_meta($post->ID, '_calendar_date_format_setting', true));
$date_format_default = esc_attr(get_option('date_format'));
$date_format = esc_attr(get_post_meta($post->ID, '_calendar_date_format', true));
$date_format_php = esc_attr(get_post_meta($post->ID, '_calendar_date_format_php', true));
$date_format_php = $date_format_php ? $date_format_php : $date_format_default;
?>
<select name="_calendar_date_format_setting"
id="_calendar_date_format_setting"
class="simcal-field simcal-field-select simcal-field-show-other">
<option value="use_site" data-show-field="_calendar_date_format_default" <?php
selected('use_site', $date_format_setting, true);
?>
><?php
_ex('Site default', 'Use this site default setting', 'google-calendar-events');
?>
</option>
<option value="use_custom" data-show-field="_calendar_date_format" <?php
selected('use_custom', $date_format_setting, true);
//.........这里部分代码省略.........
开发者ID:petersonca,项目名称:Simple-Calendar,代码行数:101,代码来源:settings.php
示例8: timezone_select_input
/**
* @access public
* @param string $timezone_string
*/
public static function timezone_select_input($timezone_string = '')
{
// get WP date time format
$datetime_format = get_option('date_format') . ' ' . get_option('time_format');
// if passed a value, then use that, else get WP option
$timezone_string = !empty($timezone_string) ? $timezone_string : get_option('timezone_string');
// check if the timezone is valid but don't throw any errors if it isn't
$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
$gmt_offset = get_option('gmt_offset');
$check_zone_info = true;
if (empty($timezone_string)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if ($gmt_offset > 0) {
$timezone_string = 'UTC+' . $gmt_offset;
} elseif ($gmt_offset < 0) {
$timezone_string = 'UTC' . $gmt_offset;
} else {
$timezone_string = 'UTC';
}
}
?>
<p>
<label for="timezone_string"><?php
_e('timezone');
?>
</label>
<select id="timezone_string" name="timezone_string">
<?php
echo wp_timezone_choice($timezone_string);
?>
</select>
<br />
<span class="description"><?php
_e('Choose a city in the same timezone as the event.');
?>
</span>
</p>
<p>
<span><?php
printf(__('%1$sUTC%2$s time is %3$s'), '<abbr title="Coordinated Universal Time">', '</abbr>', '<code>' . date_i18n($datetime_format, false, 'gmt') . '</code>');
?>
</span>
<?php
if (!empty($timezone_string) || !empty($gmt_offset)) {
?>
<br /><span><?php
printf(__('Local time is %1$s'), '<code>' . date_i18n($datetime_format) . '</code>');
?>
</span>
<?php
}
?>
<?php
if ($check_zone_info && $timezone_string) {
?>
<br />
<span>
<?php
// Set TZ so localtime works.
date_default_timezone_set($timezone_string);
$now = localtime(time(), true);
if ($now['tm_isdst']) {
_e('This timezone is currently in daylight saving time.');
} else {
_e('This timezone is currently in standard time.');
}
?>
<br />
<?php
if (function_exists('timezone_transitions_get')) {
$found = false;
$date_time_zone_selected = new DateTimeZone($timezone_string);
$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
$right_now = time();
$tr['isdst'] = false;
foreach (timezone_transitions_get($date_time_zone_selected) as $tr) {
if ($tr['ts'] > $right_now) {
$found = true;
break;
}
}
if ($found) {
$message = $tr['isdst'] ? __(' Daylight saving time begins on: %s.') : __(' Standard time begins on: %s.');
// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
printf($message, '<code >' . date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])) . '</code >');
} else {
_e('This timezone does not observe daylight saving time.');
}
}
// Set back to UTC.
date_default_timezone_set('UTC');
?>
//.........这里部分代码省略.........
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:101,代码来源:EEH_DTT_Helper.helper.php
示例9: ddtimezone
public static function ddtimezone($tz_event = '')
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
$current_offset = get_option('gmt_offset');
$tzstring = $tz_event != '' ? $tz_event : get_option('timezone_string');
//echo $tzstring;
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if (false !== strpos($tzstring, 'Etc/GMT')) {
$tzstring = '';
}
if (empty($tzstring)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if (0 == $current_offset) {
$tzstring = 'UTC';
} elseif ($current_offset < 0) {
$tzstring = 'UTC' . $current_offset;
} else {
$tzstring = 'UTC+' . $current_offset;
}
}
?>
<p><select id="timezone_string" name="timezone_string">
<?php
echo wp_timezone_choice($tzstring);
?>
</select>
<br />
<span class="description"><?php
_e('Choose a city in the same timezone as the event.');
?>
</span>
</p>
<p><span><?php
printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt'));
?>
</span>
<?php
if (get_option('timezone_string') || !empty($current_offset)) {
?>
<br /><span><?php
printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format));
?>
</span>
<?php
}
?>
<?php
if ($check_zone_info && $tzstring) {
?>
<br />
<span>
<?php
// Set TZ so localtime works.
date_default_timezone_set($tzstring);
$now = localtime(time(), true);
if ($now['tm_isdst']) {
_e('This timezone is currently in daylight saving time.');
} else {
_e('This timezone is currently in standard time.');
}
?>
<br />
<?php
if (function_exists('timezone_transitions_get')) {
$found = false;
$date_time_zone_selected = new DateTimeZone($tzstring);
$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
$right_now = time();
foreach (timezone_transitions_get($date_time_zone_selected) as $tr) {
if ($tr['ts'] > $right_now) {
$found = true;
break;
}
}
if ($found) {
echo ' ';
$message = $tr['isdst'] ? __('Daylight saving time begins on: <code>%s</code>.') : __('Standard time begins on: <code>%s</code>.');
// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
printf($message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset'])));
} else {
_e('This timezone does not observe daylight saving time.');
}
}
// Set back to UTC.
date_default_timezone_set('UTC');
?>
</span></p>
<?php
}
}
开发者ID:robert-osborne,项目名称:event-espresso-core-1,代码行数:96,代码来源:EEH_DTT_Helper.helper.php
示例10: about_screen
//.........这里部分代码省略.........
?>
</a></li>
<li><a href="<?php
echo esc_url(admin_url(add_query_arg(array('post_type' => 'sp_player'), 'edit.php')));
?>
" class="welcome-icon sp-welcome-icon dashicons-groups"><?php
_e('Add New Player', 'prosports');
?>
</a></li>
<li><a href="<?php
echo esc_url(admin_url(add_query_arg(array('post_type' => 'sp_event'), 'edit.php')));
?>
" class="welcome-icon sp-welcome-icon dashicons-calendar"><?php
_e('Add New Event', 'prosports');
?>
</a></li>
</ul>
</div>
<div class="return-to-dashboard">
<a href="<?php
echo esc_url(admin_url(add_query_arg(array('page' => 'prosports'), 'admin.php')));
?>
"><?php
_e('Go to ProSports Settings', 'prosports');
?>
</a>
</div>
<?php
} else {
?>
<form method="post" id="mainform" action="" enctype="multipart/form-data">
<h4><?php
_e('Basic Setup', 'prosports');
?>
</h4>
<p><?php
_e('Select your timezone and sport to get started.', 'prosports');
?>
</p>
<table class="form-table">
<tbody>
<tr valign="top">
<th scope="row" class="titledesc">
<label for="timezone_string"><?php
_e('Timezone', 'prosports');
?>
</label>
</th>
<td>
<select id="timezone_string" name="timezone_string" class="<?php
echo $class;
?>
">
<?php
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if (false !== strpos($tzstring, 'Etc/GMT')) {
$tzstring = '';
}
if (empty($tzstring)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if (0 == $current_offset) {
$tzstring = 'UTC+0';
} elseif ($current_offset < 0) {
$tzstring = 'UTC' . $current_offset;
} else {
$tzstring = 'UTC+' . $current_offset;
}
}
echo wp_timezone_choice($tzstring);
?>
</select>
</td>
</tr>
</tbody>
</table>
<p class="submit prosports-actions">
<input name="save" class="button-primary" type="submit" value="<?php
_e('Save changes', 'prosports');
?>
" />
<input type="hidden" name="subtab" id="last_tab" />
<?php
wp_nonce_field('prosports-settings');
?>
</p>
</form>
<?php
}
?>
</div>
</div>
</div>
<?php
}
开发者ID:kleitz,项目名称:ProSports,代码行数:101,代码来源:class-sp-admin-welcome.php
示例11: cets_blog_defaults_management_page
function cets_blog_defaults_management_page(){
// Display the defaults that can be set by site admins
global $wpdb;
// only allow site admins to come here.
if( is_super_admin() == false ) {
wp_die( __('You do not have permission to access this page.') );
}
/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
// process form submission
if (isset($_POST['action']) && $_POST['action'] == 'update') {
$this->update_defaults($_POST);
$updated = true;
}
// make sure we're using latest data
$opt = get_site_option('cets_blog_defaults_options');
if (isset($updated) && $updated) { ?>
<div id="message" class="updated fade"><p><?php _e('Options saved.') ?></p></div>
<?php } ?>
<h1>New Blog Defaults</h1>
<form name="blogdefaultsform" action="" method="post">
<p>Set the defaults for new blog creation. Note that these defaults can still be over-ridden by blog owners.</p>
<div class="wrap">
<h2><?php _e('General Settings') ?></h2>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php _e('Blog Title') ?></th>
<td><input name="blogname" type="text" id="blogname" value="<?php echo($opt['blogname']); ?>" size="40" /><br/>
<input type="checkbox" name="blogname_flag" value="1" <?php checked('1', $opt[blogname_flag]) ?> /> <?php _e("I understand this will overwrite the user's chosen blog name from the setup page.") ?></td>
</tr>
<tr valign="top">
<th scope="row"><?php _e('Tagline') ?></th>
<td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php echo($opt['blogdescription']); ?>" size="45" />
<br />
<?php _e('In a few words, explain what this blog is about.') ?></td>
</tr>
<!-- Begin Time Zone -->
<tr>
<?php
$current_offset = $opt['gmt_offset'];
$tzstring = $opt['timezone_string'];
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if ( false !== strpos($tzstring,'Etc/GMT') )
$tzstring = '';
if (empty($tzstring)) { // set the Etc zone if no timezone string exists
$check_zone_info = false;
if ( 0 == $current_offset )
$tzstring = 'UTC+0';
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">
<?php echo wp_timezone_choice($tzstring); ?>
</select>
<span id="utc-time"><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span>
<?php if ($opt['timezone_string']) : ?>
<span id="local-time"><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span>
<?php endif; ?>
<br />
<span class="description"><?php _e('Choose a city in the same timezone as you.'); ?></span>
<br />
<span>
<?php if ($check_zone_info && $tzstring) : ?>
<?php
$now = localtime(time(),true);
if ($now['tm_isdst']) _e('This timezone is currently in daylight savings time.');
else _e('This timezone is currently in standard time.');
?>
<br />
<?php
if (function_exists('timezone_transitions_get')) {
$dateTimeZoneSelected = new DateTimeZone($tzstring);
foreach (timezone_transitions_get($dateTimeZoneSelected) as $tr) {
if ($tr['ts'] > time()) {
$found = true;
break;
}
}
//.........这里部分代码省略.........
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:101,代码来源:cets_blog_defaults.php
示例12: 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
示例13: add_profile_boxes
/**
* add_profile_boxes method
*
* Add options HTML to `wp-admin/profile.php` page.
*
* @return void Method does not return
*/
public function add_profile_boxes()
{
global $ai1ec_view_helper;
$user = wp_get_current_user();
$selected_tz = '';
if ($user->ID > 0) {
$selected_tz = $this->user_selected_tz($user->ID);
}
$argv = array('tz_selector' => wp_timezone_choice($selected_tz));
$ai1ec_view_helper->display_admin('box_profile_timezone.php', $argv);
}
开发者ID:briancompton,项目名称:knightsplaza,代码行数:18,代码来源:class-ai1ec-app-helper.php
示例14: select_timezone
public static function select_timezone($field, $meta)
{
$meta = '' !== $meta ? $meta : $field['std'];
if ('' === $meta) {
$meta = cpmb_Meta_Box::timezone_string();
}
echo '<select name="', $field['id'], '" id="', $field['id'], '">';
echo wp_timezone_choice($meta);
echo '</select>';
}
开发者ID:rainrose,项目名称:WoodsDev,代码行数:10,代码来源:cpmb_Meta_Box_types.php
示例15: timezone_input
/**
* Output a select input box.
*
* @access public
* @param array $field
* @return void
*/
public function timezone_input($field)
{
$field['class'] = isset($field['class']) ? $field['class'] : 'select short';
$field['value'] = isset($field['value']) ? $field['value'] : '';
$field['name'] = isset($field['name']) ? $field['name'] : $field['id'];
// Custom attribute handling
$custom_attributes = array();
if (!empty($field['custom_attributes']) && is_array($field['custom_attributes'])) {
foreach ($field['custom_attributes'] as $attribute => $value) {
$custom_attributes[] = 'data-' . esc_attr($attribute) . '="' . esc_attr($value) . '"';
}
}
$options = wp_timezone_choice($field['value']);
$field = $this->field_wrapper_start($field);
printf('<select id="%s" name="%s" class="%s" %s />%s</select>', esc_attr($field['id']), esc_attr($field['name']), esc_attr($field['class']), implode(' ', $custom_attributes), $options);
$this->field_wrapper_end($field);
}
开发者ID:itsunus,项目名称:wstore,代码行数:24,代码来源:class-dc-wp-fields.php
示例16: test_select_timezone_field_after_value_update
public function test_select_timezone_field_after_value_update()
{
$value_to_save = cmb2_utils()->timezone_string();
update_post_meta($this->post_id, $this->text_type_field['id'], $value_to_save);
$zones = wp_timezone_choice($value_to_save);
$this->assertHTMLstringsAreEqual(sprintf('<select class="cmb2_select cmb2-select-timezone" name="field_test_field" id="field_test_field">%s</select><span class="cmb2-metabox-description">This is a description</span>', $zones), $this->capture_render(array($this->get_field_type_object('select_timezone'), 'render')));
delete_post_meta($this->post_id, $this->text_type_field['id']);
}
开发者ID:Dovahkiin1991,项目名称:CMB2,代码行数:8,代码来源:test-cmb-types.php
示例17: round
if (!($timezone_string = bb_get_option('timezone_string'))) {
// set the Etc zone if no timezone string exists
$_gmt_offset = (int) round($gmt_offset);
if ($_gmt_offset === 0) {
$timezone_string = 'Etc/UTC';
} elseif ($_gmt_offset > 0) {
// Zoneinfo has these signed backwards to common convention
$timezone_string = 'Etc/GMT-' . abs($_gmt_offset);
} else {
// Zoneinfo has these signed backwards to common convention
$timezone_string = 'Etc/GMT+' . abs($_gmt_offset);
}
unset($_gmt_offset);
}
// Build the new selector
$_time_options = array('timezone_string' => array('title' => __('Time zone'), 'type' => 'select', 'options' => wp_timezone_choice($timezone_string), 'note' => array(__('Choose a city in the same time zone as you.'), sprintf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), bb_gmdate_i18n(bb_get_datetime_formatstring_i18n(), bb_current_time())), sprintf(__('Local time is <code>%s</code>'), bb_datetime_format_i18n(bb_current_time())))));
$_now = localtime(bb_current_time(), true);
if ($now['tm_isdst']) {
$_time_options['timezone_string']['note'][] = __('This time zone is currently in daylight savings time.');
} else {
$_time_options['timezone_string']['note'][] = __('This time zone is currently in standard time.');
}
if (function_exists('timezone_transitions_get')) {
$timezone_object = new DateTimeZone($timezone_string);
$found_transition = false;
foreach (timezone_transitions_get($timezone_object) as $timezone_transition) {
if ($timezone_transition['ts'] > time()) {
$note = $timezone_transition['isdst'] ? __('Daylight savings time begins on <code>%s</code>') : __('Standard time begins on <code>%s</code>');
$_time_options['timezone_string']['note'][] = sprintf($note, bb_gmdate_i18n(bb_get_datetime_formatstring_i18n(), $timezone_transition['ts'], false));
break;
}
开发者ID:danielcoats,项目名称:schoolpress,代码行数:31,代码来源:options-general.php
示例18: about_screen
//.........这里部分代码省略.........
<th scope="row" class="titledesc">
<label for="timezone_string"><?php
_e('Timezone', 'sportspress');
?>
<i class="dashicons dashicons-editor-help sp-desc-tip" title="<?php
_e('Choose a city in the same timezone as you.', 'sportspress');
?>
"></i></label>
</th>
<td>
<select id="timezone_string" name="timezone_string" class="<?php
echo $class;
?>
">
<?php
$current_offset = get_option('gmt_offset');
$tzstring = get_option('timezone_string');
$check_zone_info = true;
// Remove old Etc mappings. Fallback to gmt_offset.
if (false !== strpos($tzstring, 'Etc/GMT')) {
$tzstring = '';
}
if (empty($tzstring)) {
// Create a UTC+- zone if no timezone string exists
$check_zone_info = false;
if (0 == $current_offset) {
$tzstring = 'UTC+0';
} elseif ($current_offset < 0) {
$tzstring = 'UTC' . $current_offset;
} else {
$tzstring = 'UTC+' . $current_offset;
}
}
echo wp_timezone_choice($tzstring);
?>
</select>
</td>
</tr>
<?php
$sport_options = SP_Admin_Sports::get_preset_options();
$settings = array(array('id' => 'sportspress_sport', 'default' => 'custom', 'type' => 'sport', 'title' => __('Sport', 'sportspress'), 'welcome' => true, 'class' => $class, 'options' => $sport_options));
SP_Admin_Settings::output_fields($settings);
?>
</tbody>
</table>
<p class="submit sportspress-actions">
<input name="save" class="button-primary" type="submit" value="<?php
_e('Save Changes', 'sportspress');
?>
" />
<input type="hidden" name="subtab" id="last_tab" />
<?php
wp_nonce_field('sportspress-settings');
?>
</p>
</form>
<?php
}
?>
</div>
<?php
if (current_user_can('install_themes') && !current_theme_supports('sportspress')) {
?>
<div class="last-feature">
<h4><?php
_e('Free SportsPress Theme', 'sportspress');
开发者ID:damiansu,项目名 |
请发表评论