本文整理汇总了PHP中timezones函数的典型用法代码示例。如果您正苦于以下问题:PHP timezones函数的具体用法?PHP timezones怎么用?PHP timezones使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timezones函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: api_user
function api_user()
{
$this->ci->load->library('tweet');
$remote_user = $this->ci->tweet->call('get', 'account/verify_credentials');
$user = array('sso_twitter' => $remote_user->id, 'username' => 'twitter_' . $remote_user->id);
$name = explode(' ', $remote_user->name);
if (empty($name)) {
$name = explode(' ', $remote_user->screen_name);
}
$user['first_name'] = $name[0];
$user['last_name'] = $name[count($name) - 1];
$this->ci->load->helper('date');
$timezones = timezones();
if ($remote_user->utc_offset > 0) {
$t = '+' . $remote_user->utc_offset / 3600;
} else {
$t = '-' . abs($remote_user->utc_offset / 3600);
}
$timezone = 'UTC';
foreach ($timezones as $key => $val) {
if ($t == $val) {
$timezone = $key;
break;
}
}
$user['timezone'] = $timezone;
$user['locale'] = $remote_user->lang;
$user['sso_verified'] = $remote_user->verified;
$user['image'] = $remote_user->profile_image_url;
$db_user = $this->ci->_model('user')->get_login(array('sso_twitter' => $user['sso_twitter']));
$user['row_status'] = empty($db_user) ? 'new' : 'existing';
return $user;
}
示例2: api_user
function api_user()
{
$user_sso = $this->ci->facebook->user();
if (isset($user_sso) && isset($user_sso->__resp) && !empty($user_sso->__resp->data)) {
$user_sso = @$user_sso->__resp->data;
} else {
return array();
}
$user = array('sso_facebook' => $user_sso->id, 'username' => 'twitter_' . $user_sso->id);
if ($this->facebook_download_picture) {
$pic_types = array('small', 'normal', 'large', 'square');
foreach ($pic_types as $pic_type) {
@mkdir('data/user/image/' . $pic_type, 0777, true);
fork('wget "http://graph.facebook.com/' . $user_sso->id . '/picture?type=' . $pic_type . '" -O "./data/user/image/' . $pic_type . '/fb_' . $user_sso->id . '"');
}
$user['image'] = 'user/image/fb_' . $user_sso->id;
} else {
$user['image'] = 'http://graph.facebook.com/' . $user_sso->id . '/picture';
}
$user['email'] = $user_sso->email;
$user['first_name'] = $user_sso->first_name;
$user['last_name'] = $user_sso->last_name;
$user['address'] = $user_sso->location->name;
$user['locale'] = $user_sso->locale;
$user['sso_verified'] = $user_sso->verified;
$genders = array('male' => 1, 'female' => 2);
$user['gender'] = empty($user_sso->gender) ? 0 : $genders[$user_sso->gender];
if (!empty($user_sso->timezone)) {
$this->ci->load->helper('date');
$timezones = timezones();
if ($user_sso->timezone > 0) {
$t = '+' . $user_sso->timezone;
} else {
$t = '-' . abs($user_sso->timezone);
}
$timezone = 'UTC';
foreach ($timezones as $key => $val) {
if ($t == $val) {
$timezone = $key;
break;
}
}
$user['timezone'] = $timezone;
} else {
$user['timezone'] = 'UTC';
}
if (!empty($user_sso->birthday)) {
$b = $user_sso->birthday;
$e = explode('/', $b);
if (count($e) == 3) {
$user['dob'] = $e[2] . '-' . $e[0] . '-' . $e[1];
} else {
$user['dob'] = '';
}
}
$db_user = $this->ci->_model('user')->get_login(array('sso_facebook' => $user['sso_facebook']));
$user['row_status'] = empty($db_user) ? 'new' : 'existing';
return $user;
}
示例3: gmt_to_local
function gmt_to_local($time = '', $timezone = 'UP8', $dst = FALSE)
{
if ($time == '') {
return now();
}
$time += timezones($timezone) * 3600;
if ($dst == TRUE) {
$time += 3600;
}
return $time;
}
示例4: _to_gmt
function _to_gmt($time, $timezone, $format = 'Y-m-d H:i:s')
{
$dst = FALSE;
$time = !is_numeric($time) ? strtotime(str_replace('/', '-', $time)) : $time;
$daylight_saving = date("I") == 1 ? TRUE : FALSE;
$time -= timezones($timezone) * 3600;
if ($daylight_saving == TRUE) {
$time -= 3600;
}
return date($format, $time);
}
示例5: is_int_multiple_unit_time
function is_int_multiple_unit_time($ts, $unit)
{
$timezone_offset = timezones('UP8') * 3600;
foreach ((array) $ts as $t) {
if (empty($t)) {
continue;
}
$t += $timezone_offset;
if ($t % $unit != 0) {
return FALSE;
}
}
return TRUE;
}
示例6: test_timezones
public function test_timezones()
{
$zones = array('UM12' => -12, 'UM11' => -11, 'UM10' => -10, 'UM95' => -9.5, 'UM9' => -9, 'UM8' => -8, 'UM7' => -7, 'UM6' => -6, 'UM5' => -5, 'UM45' => -4.5, 'UM4' => -4, 'UM35' => -3.5, 'UM3' => -3, 'UM2' => -2, 'UM1' => -1, 'UTC' => 0, 'UP1' => +1, 'UP2' => +2, 'UP3' => +3, 'UP35' => +3.5, 'UP4' => +4, 'UP45' => +4.5, 'UP5' => +5, 'UP55' => +5.5, 'UP575' => +5.75, 'UP6' => +6, 'UP65' => +6.5, 'UP7' => +7, 'UP8' => +8, 'UP875' => +8.75, 'UP9' => +9, 'UP95' => +9.5, 'UP10' => +10, 'UP105' => +10.5, 'UP11' => +11, 'UP115' => +11.5, 'UP12' => +12, 'UP1275' => +12.75, 'UP13' => +13, 'UP14' => +14);
foreach ($zones as $test => $expected) {
$this->assertEquals($expected, timezones($test));
}
$this->assertArrayHasKey('UP3', timezones());
$this->assertEquals(0, timezones('non_existant'));
}
示例7: _t
echo _t("mod_rewrite is required");
?>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>Time settings</legend>
<table cellspacing="0" width="100%">
<tr>
<td width="120px"><?php
echo _t("Timezone");
?>
:</td>
<td><select name="offset"><?php
echo timezones($time->offset);
?>
</select></td>
</tr>
<tr>
<td><?php
echo _t("Time format");
?>
:</td>
<td><input name="time_long" type="text" value="<?php
echo $time->long;
?>
" size="14" /> <?php
echo get_date(time(), "", 1, 0);
?>
</td>
示例8: time
<div class="grid_24">
<?php
//$mysql = '20061124092345';
//$now = time();
$datestring = "%Y-%m-%d %H:%i";
$time = time();
echo mdate($datestring, $time);
echo timezones('UP7');
?>
<ul>
<li>ºÑ¹·Ö¡Ë¹èǧҹ</li>
<li>ÃÒ¡ÒÃ˹èǧҹ</li>
</ul>
<span style="float: right;"><a href="javascript:void(0)" id="customer-form-hide"><img src="<?php echo base_url()?>imgs/directional_down.png" /></a></span></div>
<div class="clear"></div>
<div class="grid_24">
<div>
<form id="customer-form">
<div id="customer-info">
<table>
<thead>
<tr>
<th colspan="5"><?php echo $this->lang->line('customers_title');?></th>
</tr>
</thead>
示例9: zones
/**
* Timezones
*
* This array is used to render the localization pull-down menu
*
* @access public
* @return array
*/
function zones()
{
ee()->load->library('logger');
ee()->logger->deprecated('2.6', 'Date helper\'s timezones()');
ee()->load->helper('date');
return timezones();
}
示例10: foreach
}
if ($pass == false) {
return 0;
} else {
return 1;
}
}
$oops = true;
$do_fallback = false;
foreach ($start as $k => $b) {
if (!isset($ci_timezone)) {
$ci_timezone = "UM8";
}
$ci->config->set_item('time_reference', 'local');
$ci->load->helper('date');
$offset = (int) timezones($ci_timezone);
$hour = date("G") + $offset;
$server_time = mktime($hour, date("i"), date("s"));
$server_time_formatted = date("G:i", $server_time);
$server_day = date("w", $server_time);
$currentTime = $server_time_formatted;
$finish_time = $finish[$k];
//debug - set a time here to restate $currentTime
//$currentTime = "17:00";
//echo $currentTime.' - '.$b.' - '.$finish_time;
if (verify_time($currentTime, $b, $finish_time) == 1 and verify_day($k, $server_day)) {
$response->addRedirect($choice_array[$k]);
$response->Respond();
$oops = false;
$do_fallback = false;
//echo "passed check ";
示例11: timezone_menu
function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
{
call('lang', 'load', 'date');
if ($default == 'GMT') {
$default = 'UTC';
}
$menu = '<select name="' . $name . '"';
if ($class != '') {
$menu .= ' class="' . $class . '"';
}
$menu .= ">\n";
foreach (timezones() as $key => $val) {
$selected = $default == $key ? " selected='selected'" : '';
$menu .= "<option value='{$key}'{$selected}>" . call('lang', 'line', $key) . "</option>\n";
}
$menu .= "</select>";
return $menu;
}
示例12: timezone_menu
function timezone_menu($default = 'UTC', $class = "", $name = 'timezones')
{
$CI =& get_instance();
$CI->lang->load('date');
if ($default == 'GMT') {
$default = 'UTC';
}
$menu = '<select name="' . $name . '"';
if ($class != '') {
$menu .= ' class="' . $class . '"';
}
$menu .= ">\n";
foreach (timezones() as $key => $val) {
$selected = $default == $key ? " selected='selected'" : '';
$menu .= "<option value='{$key}'{$selected}>" . $CI->lang->line($key) . "</option>\n";
}
$menu .= "</select>";
return $menu;
}
示例13: timezone_offset
/**
* Get timezone offset from legacy or modern
*
* @access public
* @return int
*/
public function timezone_offset()
{
ee()->load->helper('date');
$offset = 0;
$timezones = timezones();
$timezone = $this->either_or(ee()->config->item('default_site_timezone'), ee()->config->item('server_timezone'), date_default_timezone_get());
// Check legacy timezone formats
if (isset($timezones[$timezone])) {
$offset = $timezones[$timezone] * 3600;
} else {
if (class_exists('DateTime')) {
$dt = new DateTime('now', new DateTimeZone($timezone));
if ($dt) {
$offset = $dt->getOffset();
}
}
}
return $offset;
}
示例14: general_settings
/**
* Function: general_settings
* General Settings page.
*/
public function general_settings()
{
if (!Visitor::current()->group->can("change_settings")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to change settings."));
}
$locales = array();
if ($open = opendir(INCLUDES_DIR . "/locale/")) {
while (($folder = readdir($open)) !== false) {
$split = explode(".", $folder);
if (end($split) == "mo") {
$locales[] = array("code" => $split[0], "name" => lang_code($split[0]));
}
}
closedir($open);
}
if (empty($_POST)) {
return $this->display("general_settings", array("locales" => $locales, "timezones" => timezones()));
}
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
$config = Config::current();
$set = array($config->set("name", $_POST['name']), $config->set("description", $_POST['description']), $config->set("chyrp_url", rtrim($_POST['chyrp_url'], "/")), $config->set("url", rtrim(oneof($_POST['url'], $_POST['chyrp_url']), "/")), $config->set("email", $_POST['email']), $config->set("timezone", $_POST['timezone']), $config->set("locale", $_POST['locale']));
if (!in_array(false, $set)) {
Flash::notice(__("Settings updated."), "/admin/?action=general_settings");
}
}
示例15: _ci_to_php_zone
/**
* _ci_to_php_zone()
*
* Converts a CI timezone ($zone) to a PHP timezone identifier
*
* @return string PHP timezone identifier
*
* Thoughts:
* - timezone_name_from_abbr() needs false for param 3 always? should that be the value of dst_supported()?
*
*/
private function _ci_to_php_zone($zone = null)
{
if ($zone === null) {
$zone = $this->current_zone;
}
$offset = timezones($zone);
$php_zone = timezone_name_from_abbr('', $offset * 3600, -1);
if ($php_zone === false) {
// might be in DST
$php_zone = timezone_name_from_abbr('', $offset * 3600 + 3600, true);
}
return $php_zone;
}