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


PHP timezone_open函数代码示例

本文整理汇总了PHP中timezone_open函数的典型用法代码示例。如果您正苦于以下问题:PHP timezone_open函数的具体用法?PHP timezone_open怎么用?PHP timezone_open使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: __construct

 public function __construct()
 {
     global $wpdb;
     if (get_option('timezone_string')) {
         $this->tz_offset = timezone_offset_get(timezone_open(get_option('timezone_string')), new DateTime());
     } else {
         if (get_option('gmt_offset')) {
             $this->tz_offset = get_option('gmt_offset') * 60 * 60;
         }
     }
     $this->db = $wpdb;
     $this->tb_prefix = $wpdb->prefix;
     $this->agent = $this->get_UserAgent();
     $this->historical = array();
     // Load the options from the database
     $this->options = get_option('wp_statistics');
     // Set the default co-efficient.
     $this->coefficient = $this->get_option('coefficient', 1);
     // Double check the co-efficient setting to make sure it's not been set to 0.
     if ($this->coefficient <= 0) {
         $this->coefficient = 1;
     }
     // This is a bit of a hack, we strip off the "includes/classes" at the end of the current class file's path.
     $this->plugin_dir = substr(dirname(__FILE__), 0, -17);
     $this->plugin_url = substr(plugin_dir_url(__FILE__), 0, -17);
     $this->get_IP();
     if ($this->get_option('hash_ips') == true) {
         $this->ip_hash = '#hash#' . sha1($this->ip + $_SERVER['HTTP_USER_AGENT']);
     }
 }
开发者ID:bqevin,项目名称:wp-shopeasy,代码行数:30,代码来源:statistics.class.php

示例2: toApiArray

 /**
  * @return array order data in API form
  * @throws PilipayError
  */
 public function toApiArray()
 {
     // check goods list
     if (empty($this->_goodsList)) {
         throw new PilipayError(PilipayError::REQUIRED_ARGUMENT_NO_EXIST, array('name' => 'goodsList', 'value' => Tools::jsonEncode($this->_goodsList)));
     }
     // if the orderTime is omitted, use current time
     if (empty($this->orderTime)) {
         $now = date_create('now', timezone_open('Asia/Shanghai'))->format('Y-m-d H:i:s');
         $this->orderTime = $this->orderTime ? $this->orderTime : $now;
     }
     // verify
     parent::verifyFields();
     $apiArray = array_map('strval', array('version' => $this->version, 'merchantNo' => $this->merchantNo, 'currencyType' => $this->currencyType, 'orderNo' => $this->orderNo, 'orderAmount' => (int) round($this->orderAmount * 100), 'orderTime' => $this->orderTime, 'pageUrl' => $this->pageUrl, 'serverUrl' => $this->serverUrl, 'redirectUrl' => $this->redirectUrl, 'notifyType' => $this->notifyType, 'shipper' => (int) round($this->shipper * 100), 'tax' => (int) round($this->tax * 100), 'signType' => $this->signType));
     // sign
     if ($this->signType == 'MD5') {
         // sign using MD5
         $this->signMsg = md5(implode('', $apiArray) . $this->appSecret);
         $apiArray['signMsg'] = $this->signMsg;
     } else {
         throw new PilipayError(PilipayError::INVALID_ARGUMENT, array('name' => 'signType', 'value' => $this->signType));
     }
     $apiArray['goodsList'] = urlencode(Tools::jsonEncode($this->_goodsList));
     return $apiArray;
 }
开发者ID:pilibaba,项目名称:pilipay-for-prestashop,代码行数:29,代码来源:PilipayOrder.php

示例3: print_comment_item

function print_comment_item($tag, $id, $author, $date, $comment)
{
    global $domain;
    $output = "";
    $output .= "  <item>\n";
    $output .= "    <title>#";
    $output .= $id;
    $output .= " on tag ";
    $output .= $tag;
    $output .= " by ";
    $output .= htmlentities($author);
    $output .= "</title>\n";
    $output .= "    <link>";
    $output .= $domain . href('tag/' . $tag . '#comment-' . $id);
    $output .= "</link>\n";
    $output .= "    <description>A new comment by ";
    $output .= $author;
    $output .= " on tag ";
    $output .= $tag;
    $output .= ".";
    $output .= "</description>\n";
    $output .= "    <content:encoded><![CDATA[";
    $output .= Markdown(htmlspecialchars($comment));
    $output .= "]]></content:encoded>\n";
    $output .= "    <dc:creator>";
    $output .= $author;
    $output .= "</dc:creator>\n";
    $output .= "    <pubDate>";
    $output .= date_format(date_create($date, timezone_open('GMT')), DATE_RFC2822);
    $output .= "</pubDate>\n";
    $output .= "  </item>\n";
    return $output;
}
开发者ID:robertcardona,项目名称:stacks-website,代码行数:33,代码来源:commentsfeed.php

示例4: getSchedule

 /**
  * Get weekly shedule for a particular day
  *
  * @param $timestamp
  * @return array
  */
 function getSchedule($timestamp)
 {
     if (!$this->magister->personData) {
         return 403;
     }
     $tz = timezone_open('Europe/Amsterdam');
     $tz_offset = timezone_offset_get($tz, new \DateTime('@' . $timestamp, timezone_open('UTC')));
     $timestamp += $tz_offset + 4;
     $weekstart = $this->getFirstDayOfWeek(date('Y', $timestamp), date('W', $timestamp));
     $weekend = strtotime('this Friday', $weekstart);
     $data = $this->magister->personRequest('afspraken?status=1&tot=' . date('Y-m-d', $weekend) . '&van=' . date('Y-m-d', $weekstart))->Items;
     $result = array('week_timestamp' => $weekstart, 'days' => array());
     $curday = $weekstart;
     while ($curday <= $weekend) {
         $result['days'][(int) date('w', $curday)] = array('day_title' => $this->dutchDayName($curday), 'day_ofweek' => (int) date('w', $curday), 'items' => array());
         $curday += 86400;
     }
     foreach ($data as $item) {
         $start = strtotime($item->Start) + $tz_offset;
         $curwd = date('w', $start);
         if ($item->DuurtHeleDag) {
             $result['days'][(int) $curwd]['items'][] = array('title' => $item->Omschrijving, 'subtitle' => $item->Lokatie, 'start' => $start, 'start_str' => 'DAG');
         } else {
             $result['days'][(int) $curwd]['items'][] = array('title' => $item->LesuurVan . '. ' . $item->Vakken[0]->Naam, 'subtitle' => 'Lokaal ' . $item->Lokalen[0]->Naam, 'start' => $start, 'start_str' => date('H:i', $start + $tz_offset));
         }
     }
     foreach ($result['days'] as $index => $day) {
         if (empty($day['items'])) {
             unset($result['days'][$index]);
         }
     }
     return $result;
 }
开发者ID:wvanbreukelen,项目名称:api.lesrooster.io,代码行数:39,代码来源:Handler.php

示例5: sendDataToAPI

 function sendDataToAPI($data)
 {
     //get JSON from Source and parse it
     $arr = json_decode($data, true);
     $date = DateTime::createFromFormat("U", $arr["timestamp"], timezone_open("Europe/Berlin"));
     $date = date_format($date, 'Y-m-d');
     //Make a new JSON in the format described on page X of the API Documentation
     $json = '{
                 "originalId":"11111",
                 "attributes":{
                 },
                 "externalSourceId":36,
                 "geoBlobDates":[
                 {
                 "valid":{
                 "since":"' . $date . '",
                 "until":"3000-01-01"
                 }
                 },
                 {
                 "valid":{
                 "since":"' . $date . '",
                 "until":"3000-01-01"
                 }
                 }
                 ],
                 "tagDates":[
                 {
                 "tags":{
                 "data":"true",
                 "substance":"' . $arr["substance"] . '",
                 "value":"' . $arr["value"] . '",
                 "unit":"' . $arr["unit"] . '",
                 "timestamp":' . $arr["timestamp"] . '
                 },
                 "valid":{
                 "since":"' . $date . '",
                 "until":"3000-01-01"
                 }
                 }
                 ],
                 "geometricObjects":[
                 {
                 "valid":{
                 "since":"' . $date . '",
                 "until":"' . $date . '"
                 },
                 "multipoint":"MULTIPOINT(' . $arr["lon"] . ' ' . $arr["lat"] . ' 0)"
                 }
                 ]
               }';
     //send this
     $url = "http://ohsm.f4.htw-berlin.de:8080/OhdmApi/geographicObject/";
     $connection_options = $this->buildConnection("PUT", $json);
     $arr["response"] = file_get_contents($url, false, $connection_options);
     $arr["status"] = substr($http_response_header[0], 9, 3);
     //return the answer
     return $arr;
 }
开发者ID:OHDMax,项目名称:OHDM-SDC,代码行数:59,代码来源:SDC_model.php

示例6: sortPublishDateDesc

function sortPublishDateDesc($fb, $sb)
{
    if (date_create_from_format("Y-m-d", $fb[4], timezone_open("Europe/Sofia")) > date_create_from_format("Y-m-d", $sb[4], timezone_open("Europe/Sofia"))) {
        return -1;
    } else {
        return 1;
    }
}
开发者ID:KonstantinKirchev,项目名称:PHP,代码行数:8,代码来源:book-store.php

示例7: isValid

 public function isValid($value)
 {
     $this->setValue($value);
     if (!timezone_open($value)) {
         $this->error(self::INVALID_TIMEZONE);
         return false;
     }
     return true;
 }
开发者ID:bcremer,项目名称:mwop.net,代码行数:9,代码来源:Timezone.php

示例8: safeCreateDateTimeZone

 protected static function safeCreateDateTimeZone($object)
 {
     if ($object instanceof \DateTimeZone) {
         return $object;
     }
     $tz = @timezone_open((string) $object);
     if ($tz === false) {
         throw new \InvalidArgumentException('Unknown or bad timezone (' . $object . ')');
     }
     return $tz;
 }
开发者ID:igez,项目名称:gaiaehr,代码行数:11,代码来源:Carbon.php

示例9: printChange

function printChange($tag, $change)
{
    $output = "<tr>";
    //$time = time($change["time"]);
    $time = $change["time"];
    $time = date_create($change["time"], timezone_open('GMT'));
    //$time = date_format($time, "F j, Y \a\\t g:i a e");
    $time = date_format($time, "F j, Y");
    switch ($change["type"]) {
        case "creation":
            $output .= "<td>created statement";
            $output .= "<td>in <code>" . $change["file"] . ".tex</code>";
            if ($change["label"] != "") {
                $output .= "<br>label <code>" . $change["label"] . "</code>";
            }
            $output .= "<td>" . $time;
            $output .= "<td><a href='" . GitHubCommitLinesLink($change) . "'>link</a>";
            break;
        case "label":
            $output .= "<td>changed label";
            $output .= "<td>label <code>" . $change["label"] . "</code>";
            $output .= "<td>" . $time;
            $output .= "<td><a href='" . GitHubCommitLinesLink($change) . "'>diff</a>";
            break;
        case "move":
            $output .= "<td>moved the tag";
            $output .= "<td>";
            $output .= "<td>" . $time;
            break;
        case "move file":
            $output .= "<td>moved the tag";
            $output .= "<td>to <code>" . $change["file"] . ".tex</code>";
            $output .= "<td>" . $time;
            break;
        case "proof":
        case "statement":
        case "statement and proof":
            $output .= "<td>changed " . $change["type"];
            $output .= "<td>";
            $output .= "<td>" . $time;
            $output .= "<td><a href='" . GitHubDiffLink($change) . "'>diff</a>";
            break;
        case "tag":
            $output .= "<td>assigned tag";
            $output .= "<td><var>" . $tag . "</var>";
            $output .= "<td>" . $time;
            $output .= "<td>";
            break;
    }
    $output .= "</tr>";
    return $output;
}
开发者ID:robertcardona,项目名称:stacks-website,代码行数:52,代码来源:taghistory.php

示例10: parseInputList

function parseInputList()
{
    $list = $_GET['list'];
    $lines = preg_split('/\\n/', $list);
    $result = [];
    //var_dump($lines);
    foreach ($lines as $line) {
        $tempDate = date_create($line, timezone_open("Europe/Sofia"));
        if ($line != "" && $tempDate) {
            $result[] = $tempDate;
        }
    }
    return $result;
}
开发者ID:KonstantinKirchev,项目名称:PHP,代码行数:14,代码来源:date-sorter.php

示例11: calculateDistance

 /**
  * Calculates date interval from $dateTime (given in current format) to current datetime
  *
  * @param string $format
  * @param string $dateTime
  *
  * @return \DateInterval
  */
 public static function calculateDistance($dateTime, $format = null)
 {
     if ($dateTime == '') {
         return array();
     }
     if ($format == null) {
         $format = $_SESSION['formats']['datetime_php'];
     }
     $date = \DateTime::createFromFormat($format, $dateTime, timezone_open('UTC'));
     $now = new \DateTime('now', timezone_open('UTC'));
     $interval = (array) $date->diff($now);
     $interval['expired'] = $interval['invert'] == 0 ? 1 : 0;
     return $interval;
 }
开发者ID:barcodex,项目名称:temple,代码行数:22,代码来源:DateTimeUtil.php

示例12: zoneInfo

	/**
	 * Return a set of timezone information relevant to this joyful stuff :D
	 */
	public static function zoneInfo() {
		$zones = array();
		$now = date_create();
		foreach( timezone_identifiers_list() as $tz ) {
			$zone = timezone_open( $tz );

			$name = timezone_name_get( $zone );
			$location = timezone_location_get( $zone );
			$offset = timezone_offset_get( $zone, $now ) / 60; // convert seconds to minutes

			$zones[] = array('name' => $name, 'offset' => $offset, 'location' => $location);
		}
		return $zones;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:17,代码来源:TimeZonePicker.hooks.php

示例13: getStartTimeStamp

 /**
  * Getter for the start timestamp.
  *
  * @param int $index
  *   The index of the field value to be retrieved. Defaults to 0.
  *
  * @return int
  *   The start date as a UNIX timestamp.
  */
 protected function getStartTimeStamp($index = 0)
 {
     $value = $this->fieldItemList->getValue()[$index]['value'];
     $field_def = $this->fieldItemList->getFieldDefinition();
     $field_type = $field_def->getFieldStorageDefinition()->getType();
     if ($field_type == 'datetime') {
         /** @var \Drupal/datetime\Plugin\FieldType\DateTimeItem $field */
         $field = $this->fieldItemList->get($index);
         // Set User's Timezone
         $field->date->setTimezone(timezone_open(drupal_get_user_timezone()));
         // Format to timestamp.
         return $field->date->format('U');
     }
     return (int) $value;
 }
开发者ID:CIGIHub,项目名称:bsia-drupal8,代码行数:24,代码来源:DateFieldWrapper.php

示例14: __construct

 /**
  * Creates a new timezone from a given name.
  *
  * @param   string timezone name or NULL to use default timezone
  * @throws  lang.IllegalArgumentException if timezone is unknown
  */
 public function __construct($tz)
 {
     switch (TRUE) {
         case is_string($tz):
             $this->tz = timezone_open($tz);
             break;
         case is_null($tz):
             $this->tz = timezone_open(date_default_timezone_get());
             break;
         case $tz instanceof DateTimeZone:
             $this->tz = $tz;
     }
     if (!$this->tz instanceof DateTimeZone) {
         $e = new IllegalArgumentException('Invalid timezone identifier given: "' . $tz . '"');
         xp::gc(__FILE__);
         throw $e;
     }
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:24,代码来源:TimeZone.class.php

示例15: printComment

function printComment($comment)
{
    global $config;
    $output = "";
    $tag = getTag($comment['tag']);
    $date = date_create($comment['date'], timezone_open('GMT'));
    $output .= "<li>On " . date_format($date, 'F j') . " ";
    if (empty($comment['site'])) {
        $output .= htmlspecialchars($comment['author']);
    } else {
        $output .= "<a href='" . htmlspecialchars($comment['site']) . "'>" . htmlspecialchars($comment['author']) . "</a>";
    }
    $output .= " left <a href='" . href("tag/" . $comment["tag"] . "#comment-" . $comment['id']) . "'>comment " . $comment['id'] . "</a>";
    $output .= " on <a href='" . href('tag/' . $comment['tag']) . "'>tag <var title='" . $tag['label'] . "'>" . $comment['tag'] . "</var></a>";
    $output .= "<blockquote>";
    $output .= htmlentities(substr($comment['comment'], 0, $config["comments cutoff"])) . (strlen($comment['comment']) > $config["comments cutoff"] ? '...' : '');
    $output .= "</blockquote>";
    return $output;
}
开发者ID:robertcardona,项目名称:stacks-website,代码行数:19,代码来源:recentcomments.php


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