本文整理汇总了PHP中wp_timezone_supported函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_timezone_supported函数的具体用法?PHP wp_timezone_supported怎么用?PHP wp_timezone_supported使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_timezone_supported函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printf
<p><?php
printf(__('There is a pending change of the admin e-mail to <code>%1$s</code>. <a href="%2$s">Cancel</a>'), $new_admin_email, esc_url(admin_url('options.php?dismiss=new_admin_email')));
?>
</p>
</div>
<?php
}
?>
</td>
</tr>
<?php
}
?>
<tr>
<?php
if (!wp_timezone_supported()) {
// no magic timezone support here
?>
<th scope="row"><label for="gmt_offset"><?php
_e('Timezone');
?>
</label></th>
<td>
<select name="gmt_offset" id="gmt_offset">
<?php
$current_offset = get_option('gmt_offset');
$offset_range = array(-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
foreach ($offset_range as $offset) {
if (0 < $offset) {
$offset_name = '+' . $offset;
} elseif (0 == $offset) {
示例2: wp_timezone_override_offset
/**
* gmt_offset modification for smart timezone handling
*
* Overrides the gmt_offset option if we have a timezone_string available
*
* @since 2.8.0
*
* @return float|bool
*/
function wp_timezone_override_offset()
{
if (!wp_timezone_supported()) {
return false;
}
if (!($timezone_string = get_option('timezone_string'))) {
return false;
}
$timezone_object = timezone_open($timezone_string);
$datetime_object = date_create();
if (false === $timezone_object || false === $datetime_object) {
return false;
}
return round(timezone_offset_get($timezone_object, $datetime_object) / 3600, 2);
}
示例3: _e
<tr valign="top">
<th scope="row"><?php _e('Membership') ?></th>
<td> <fieldset><legend class="screen-reader-text"><span><?php _e('Membership') ?></span></legend><label for="users_can_register">
<input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
<?php _e('Anyone can register') ?></label>
</fieldset></td>
</tr>
<tr valign="top">
<th scope="row"><label for="default_role"><?php _e('New User Default Role') ?></label></th>
<td>
<select name="default_role" id="default_role"><?php wp_dropdown_roles( get_option('default_role') ); ?></select>
</td>
</tr>
<tr>
<?php
if ( !wp_timezone_supported() ) : // no magic timezone support here
?>
<th scope="row"><label for="gmt_offset"><?php _e('Timezone') ?> </label></th>
<td>
<select name="gmt_offset" id="gmt_offset">
<?php
$current_offset = get_option('gmt_offset');
$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
foreach ( $offset_range as $offset ) {
if ( 0 < $offset )
$offset_name = '+' . $offset;
elseif ( 0 == $offset )
$offset_name = '';
else
$offset_name = (string) $offset;
示例4: wp_timezone_override_offset
/**
* gmt_offset modification for smart timezone handling
*
* Overrides the gmt_offset option if we have a timezone_string available
*/
function wp_timezone_override_offset()
{
if (!wp_timezone_supported()) {
return false;
}
$tz = get_option('timezone_string');
if (empty($tz)) {
return false;
}
@date_default_timezone_set($tz);
$dateTimeZoneSelected = timezone_open($tz);
$dateTimeServer = date_create();
if ($dateTimeZoneSelected === false || $dateTimeServer === false) {
return false;
}
$timeOffset = timezone_offset_get($dateTimeZoneSelected, $dateTimeServer);
$timeOffset = $timeOffset / 3600;
return $timeOffset;
}
示例5: mbbt_first
function mbbt_first()
{
if (function_exists('wp_timezone_supported') && wp_timezone_supported()) {
wp_timezone_override_offset();
}
}