本文整理汇总了PHP中timezones函数的典型用法代码示例。如果您正苦于以下问题:PHP timezones函数的具体用法?PHP timezones怎么用?PHP timezones使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了timezones函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:rip-projects,项目名称:ark-php,代码行数:33,代码来源:Xauth_twitter.php
示例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;
}
开发者ID:rip-projects,项目名称:ark-php,代码行数:59,代码来源:Xauth_facebook.php
示例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;
}
开发者ID:norain2050,项目名称:one,代码行数:11,代码来源:MY_date_helper.php
示例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);
}
开发者ID:dimplewraich,项目名称:finalproject,代码行数:11,代码来源:local_time_helper.php
示例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;
}
开发者ID:mengmeng7541,项目名称:cmnstelectronicsystem,代码行数:14,代码来源:MY_date_helper.php
示例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'));
}
开发者ID:texasag99,项目名称:pricebook,代码行数:9,代码来源:date_helper_test.php
示例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>
开发者ID:thefkboss,项目名称:openTracker,代码行数:31,代码来源:main.php
示例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>
开发者ID:arnon22,项目名称:transportcm,代码行数:31,代码来源:index+-+Copy.php
示例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();
}
开发者ID:nigelpeters,项目名称:css-recruitment-ee,代码行数:15,代码来源:Localize.php
示例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 ";
开发者ID:e6,项目名称:OpenVBX-Plugin-Scheduling,代码行数:31,代码来源:twiml.php
示例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;
}
开发者ID:Calico90,项目名称:codeigniter-version-scan,代码行数:18,代码来源:date_helper.php
示例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;
}
开发者ID:nicholasserra,项目名称:kevinandiarentfriends.com,代码行数:19,代码来源:date_helper.php
示例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;
}
开发者ID:realfluid,项目名称:umbaugh,代码行数:25,代码来源:addon_builder.php
示例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");
}
}
开发者ID:eadz,项目名称:chyrp,代码行数:31,代码来源:Admin.php
示例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;
}
开发者ID:kylebragger,项目名称:Endzone,代码行数:24,代码来源:endzone.php
示例16: timezone_menu
/**
* Timezone Menu
*
* Generates a drop-down menu of timezones.
*
* @param string timezone
* @param string classname
* @param string menu name
* @param mixed attributes
* @return string
*/
function timezone_menu($default = 'UTC', $class = '', $name = 'timezones', $attributes = '')
{
$CI =& get_instance();
$CI->lang->load('date');
$default = $default === 'GMT' ? 'UTC' : $default;
$menu = '<select name="' . $name . '"';
if ($class !== '') {
$menu .= ' class="' . $class . '"';
}
// Generate a string from the attributes submitted, if any
if (is_array($attributes)) {
$atts = '';
foreach ($attributes as $key => $val) {
$atts .= ' ' . $key . '="' . $val . '"';
}
$attributes = $atts;
} elseif (is_string($attributes) && strlen($attributes) > 0) {
$attributes = ' ' . $attributes;
}
$menu .= $attributes . ">\n";
foreach (timezones() as $key => $val) {
$selected = $default === $key ? ' selected="selected"' : '';
$menu .= '<option value="' . $key . '"' . $selected . '>' . $CI->lang->line($key) . "</option>\n";
}
return $menu . '</select>';
}
开发者ID:colonia,项目名称:tomatocart-v2,代码行数:37,代码来源:date_helper.php
示例17: timezone_menu
/**
* Generate a drop-down menu of timezones.
*
* @internal A similar version of the timezone_menu function was originally
* accepted as a commit to CodeIgniter in June 2012 (see link below). The
* signature of the function remains the same in the CI 3.x base, though the
* internals have changed somewhat. Pulling in the current version would require
* bringing in changes outside of this file. The $attributes argument could take
* the place of the $class and $name arguments, but this allows for backwards
* compatibility (since the $class and $name arguments were already in place).
* If/when the CI date_helper is updated in Bonfire, this function should be
* removed (to allow the CI function to be used).
* @link https://github.com/EllisLab/CodeIgniter/commit/7540dede0f01acd7aa1ffd224defc5189305a815
*
* @param string $default The default/selected timezone.
* @param string $class The class attribute of the select element.
* @param string $name The name attribute of the select element.
* @param mixed $attributes Additional attributes to set on the menu's
* select element. If a name or class are passed here, the behavior is likely
* to be browser-dependant, as the function does not attempt to prevent it.
*
* @return string The HTML for the timezone menu.
*/
function timezone_menu($default = 'UTC', $class = '', $name = 'timezones', $attributes = '')
{
$CI =& get_instance();
$CI->lang->load('date');
$default = $default === 'GMT' ? 'UTC' : $default;
$menu = "<select name='{$name}'";
if ($class != '') {
$menu .= " class='{$class}'";
}
// Add the submitted attributes submitted, if any.
if (is_array($attributes)) {
foreach ($attributes as $key => $val) {
$menu .= " {$key}='{$val}'";
}
} elseif (is_string($attributes) && strlen($attributes) > 0) {
$menu .= " {$attributes}";
}
$menu .= ">\n";
// The timezones() function should be defined in the CI date_helper.
foreach (timezones() as $key => $val) {
$selected = $default == $key ? " selected='selected'" : '';
$menu .= "<option value='{$key}'{$selected}>" . $CI->lang->line($key) . "</option>\n";
}
return "{$menu}</select>";
}
开发者ID:ivantcholakov,项目名称:Bonfire,代码行数:48,代码来源:BF_date_helper.php
示例18: timezone_name
function timezone_name($default = 'UTC', $class = "", $name = 'timezones')
{
$CI =& get_instance();
$CI->lang->load('date');
if ($default == 'GMT') {
$default = 'UTC';
}
$menu = '';
foreach (timezones() as $key => $val) {
if ($default == $key) {
$menu = $CI->lang->line($key);
}
}
return $menu;
}
开发者ID:BersnardC,项目名称:DROPINN,代码行数:15,代码来源:MY_date_helper.php
示例19: gmtToLocal
/**
* Converts GMT time to a localized value
*
* Takes a Unix timestamp (in GMT) as input, and returns
* at the local value based on the timezone and DST setting
* submitted
*
* Credit: http://codeigniter.com/user_guide/helpers/date_helper.html
* License: http://codeigniter.com/user_guide/license.html
*
* @param int $time Unix timestamp
* @param string $timezone timezone
* @param bool $dst whether DST is active
*
* @return int
*/
public static function gmtToLocal($time = '', $timezone = 'UTC', $dst = false)
{
if (empty($time)) {
return now();
}
$time += timezones($timezone) * 3600;
if ($dst) {
$time += 3600;
}
return $time;
}
开发者ID:SerdarSanri,项目名称:arx-core,代码行数:27,代码来源:Date.php
示例20: gmt_to_local
/**
* Converts GMT time to a localized value
*
* Takes a Unix timestamp (in GMT) as input, and returns
* at the local value based on the timezone and DST setting
* submitted
*
* @param int Unix timestamp
* @param string timezone
* @param bool whether DST is active
* @return int
*/
function gmt_to_local($time = '', $timezone = 'UTC', $dst = FALSE)
{
if ($time === '') {
return now();
}
$time += timezones($timezone) * 3600;
return $dst === TRUE ? $time + 3600 : $time;
}
开发者ID:bkader,项目名称:CodeIgniter-Extended,代码行数:20,代码来源:date_helper.php
注:本文中的timezones函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论