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


PHP Phpfox::getTimeZone方法代码示例

本文整理汇总了PHP中Phpfox::getTimeZone方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::getTimeZone方法的具体用法?PHP Phpfox::getTimeZone怎么用?PHP Phpfox::getTimeZone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Phpfox的用法示例。


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

示例1: process

 /**
  * Class process method wnich is used to execute this component.
  */
 public function process()
 {
     $sCurrentTimeZone = Phpfox::getTimeZone() == '0' ? '' : ' ' . (substr(Phpfox::getTimeZone(), 0, 1) == '-' ? Phpfox::getTimeZone() : '+' . Phpfox::getTimeZone());
     if (substr(Phpfox::getTimeZone(), 0, 1) == 'z' && PHPFOX_USE_DATE_TIME) {
         $aTimeZones = Phpfox::getService('core')->getTimeZones();
         if (isset($aTimeZones[Phpfox::getTimeZone()])) {
             $oDTZ = new DateTime('now', new DateTimeZone($aTimeZones[Phpfox::getTimeZone()]));
             $sCurrentTimeZone = $oDTZ->getOffset() / 3600;
         }
     }
     $this->template()->assign(array('sCurrentSiteTime' => Phpfox::getTime(Phpfox::getParam('forum.global_forum_timezone'), PHPFOX_TIME), 'sCurrentTimeZone' => $sCurrentTimeZone));
 }
开发者ID:googlesky,项目名称:snsp.vn,代码行数:15,代码来源:timezone.class.php

示例2: getTime

 /**
  * Gets a time stamp, Works similar to PHP date() function.
  * We also take into account locale and time zone settings.
  *
  * @see date()
  * @param string $sStamp Time stamp format.
  * @param int $iTime UNIX epoch time stamp.
  * @return string Time stamp value based on locale.
  */
 public static function getTime($sStamp = null, $iTime = PHPFOX_TIME, $bTimeZone = true)
 {
     static $sUserOffSet;
     if ($bTimeZone) {
         if (!$sUserOffSet) {
             $sUserOffSet = Phpfox::getTimeZone();
         }
         if (!preg_match('/z[0-9]+/i', $sUserOffSet, $aMatch)) {
             // try to find it in the cache
             $aTZ = Phpfox::getService('core')->getTimeZones();
             $sTz = array_search($sUserOffSet, $aTZ);
             if ($sTz !== false) {
                 $sUserOffSet = $sTz;
             }
         }
         if (substr($sUserOffSet, 0, 1) == 'z' && PHPFOX_USE_DATE_TIME) {
             // we are using DateTime
             // get the offset to use based on the time zone index code
             if (!isset($aTZ)) {
                 $aTZ = Phpfox::getService('core')->getTimeZones();
             }
             if (isset($aTZ[$sUserOffSet])) {
                 $oTZ = new DateTimeZone($aTZ[$sUserOffSet]);
                 $oDateTime = new DateTime(null, $oTZ);
                 $oDateTime->setTimestamp($iTime);
                 $sUserOffSet = $aTZ[$sUserOffSet];
                 if ($sStamp !== null) {
                     $iNewTime = $oDateTime->format($sStamp);
                     $bSet = true;
                 }
             }
         }
         if ($sStamp === null) {
             return !empty($sUserOffSet) ? substr($sUserOffSet, 0, 1) == '-' ? $iTime - substr($sUserOffSet, 1) * 3600 : $sUserOffSet * 3600 + $iTime : $iTime;
         } elseif (!isset($bSet)) {
             $iNewTime = !empty($sUserOffSet) ? date($sStamp, substr($sUserOffSet, 0, 1) == '-' ? $iTime - substr($sUserOffSet, 1) * 3600 : $sUserOffSet * 3600 + $iTime) : date($sStamp, $iTime);
         }
     } else {
         $iNewTime = date($sStamp, $iTime);
     }
     $aFind = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
     $aReplace = array(Phpfox::getPhrase('core.monday'), Phpfox::getPhrase('core.tuesday'), Phpfox::getPhrase('core.wednesday'), Phpfox::getPhrase('core.thursday'), Phpfox::getPhrase('core.friday'), Phpfox::getPhrase('core.saturday'), Phpfox::getPhrase('core.sunday'), Phpfox::getPhrase('core.january'), Phpfox::getPhrase('core.february'), Phpfox::getPhrase('core.march'), Phpfox::getPhrase('core.april'), Phpfox::getPhrase('core.may'), Phpfox::getPhrase('core.june'), Phpfox::getPhrase('core.july'), Phpfox::getPhrase('core.august'), Phpfox::getPhrase('core.september'), Phpfox::getPhrase('core.october'), Phpfox::getPhrase('core.november'), Phpfox::getPhrase('core.december'));
     $iNewTime = str_replace('Mon', 'Monday', $iNewTime);
     $iNewTime = str_replace('Tue', 'Tuesday', $iNewTime);
     $iNewTime = str_replace('Wed', 'Wednesday', $iNewTime);
     $iNewTime = str_replace('Thu', 'Thursday', $iNewTime);
     $iNewTime = str_replace('Fri', 'Friday', $iNewTime);
     $iNewTime = str_replace('Sat', 'Saturday', $iNewTime);
     $iNewTime = str_replace('Sun', 'Sunday', $iNewTime);
     $iNewTime = str_replace('Jan', 'January', $iNewTime);
     $iNewTime = str_replace('Feb', 'February', $iNewTime);
     $iNewTime = str_replace('Mar', 'March', $iNewTime);
     $iNewTime = str_replace('Apr', 'April', $iNewTime);
     $iNewTime = str_replace('May', 'May', $iNewTime);
     $iNewTime = str_replace('Jun', 'June', $iNewTime);
     $iNewTime = str_replace('Jul', 'July', $iNewTime);
     $iNewTime = str_replace('Aug', 'August', $iNewTime);
     $iNewTime = str_replace('Sep', 'September', $iNewTime);
     $iNewTime = str_replace('Oct', 'October', $iNewTime);
     $iNewTime = str_replace('Nov', 'November', $iNewTime);
     $iNewTime = str_replace('Dec', 'December', $iNewTime);
     $iNewTime = str_replace('Mondayday', 'Monday', $iNewTime);
     $iNewTime = str_replace('Tuesdaysday', 'Tuesday', $iNewTime);
     $iNewTime = str_replace('Wednesdaynesday', 'Wednesday', $iNewTime);
     $iNewTime = str_replace('Thursdayrsday', 'Thursday', $iNewTime);
     $iNewTime = str_replace('Fridayday', 'Friday', $iNewTime);
     $iNewTime = str_replace('Saturdayurday', 'Saturday', $iNewTime);
     $iNewTime = str_replace('Sundayday', 'Sunday', $iNewTime);
     $iNewTime = str_replace('Januaryuary', 'January', $iNewTime);
     $iNewTime = str_replace('Februaryruary', 'February', $iNewTime);
     $iNewTime = str_replace('Marchch', 'March', $iNewTime);
     $iNewTime = str_replace('Aprilil', 'April', $iNewTime);
     $iNewTime = str_replace('Junee', 'June', $iNewTime);
     $iNewTime = str_replace('Julyy', 'July', $iNewTime);
     $iNewTime = str_replace('Augustust', 'August', $iNewTime);
     $iNewTime = str_replace('Septembertember', 'September', $iNewTime);
     $iNewTime = str_replace('Octoberober', 'October', $iNewTime);
     $iNewTime = str_replace('Novemberember', 'November', $iNewTime);
     $iNewTime = str_replace('Decemberember', 'December', $iNewTime);
     $iNewTime = str_replace($aFind, $aReplace, $iNewTime);
     $iNewTime = str_replace('PM', Phpfox::getPhrase('core.pm'), $iNewTime);
     $iNewTime = str_replace('AM', Phpfox::getPhrase('core.am'), $iNewTime);
     return $iNewTime;
 }
开发者ID:html5ravi,项目名称:phpfox,代码行数:93,代码来源:phpfox.class.php

示例3: getGmtOffset

	/**
	 * Gets the offset from the current timezone being used to GMT.
	 *
	 * @param int $iTime Current time stamp to check
	 * @return int Returns GMT offset
	 */
	public function getGmtOffset($iTime)
	{		
		return Phpfox::getTimeZone();
	}
开发者ID:hoanghd,项目名称:tools,代码行数:10,代码来源:date.class.php

示例4: foreach

<?php 
    echo Phpfox::getPhrase('user.time_zone');
    ?>
:
			</div>
			<div class="table_right">
				<select name="val[time_zone]">
<?php 
    if (count((array) $this->_aVars['aTimeZones'])) {
        foreach ((array) $this->_aVars['aTimeZones'] as $this->_aVars['sTimeZoneKey'] => $this->_aVars['sTimeZone']) {
            ?>
					<option value="<?php 
            echo $this->_aVars['sTimeZoneKey'];
            ?>
"<?php 
            if (Phpfox::getTimeZone() == $this->_aVars['sTimeZoneKey'] && !isset($this->_aVars['iTimeZonePosted']) || isset($this->_aVars['iTimeZonePosted']) && $this->_aVars['iTimeZonePosted'] == $this->_aVars['sTimeZoneKey'] || Phpfox::getParam('core.default_time_zone_offset') == $this->_aVars['sTimeZoneKey']) {
                ?>
 selected="selected"<?php 
            }
            ?>
><?php 
            echo $this->_aVars['sTimeZone'];
            ?>
</option>
<?php 
        }
    }
    ?>
				</select>
			</div>
			<div class="clear"></div>
开发者ID:laiello,项目名称:kr-indian,代码行数:31,代码来源:block_user.block.register.step2.php


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