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


PHP SS_Datetime::create方法代码示例

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


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

示例1: Created

 /**
  * @return SS_Datetime
  */
 public function Created()
 {
     $created = $this->tag->getCommit()->getCommitterDate();
     $created->setTimezone(new DateTimeZone(date_default_timezone_get()));
     $d = SS_Datetime::create();
     $d->setValue($created->format('Y-m-d H:i:s'));
     return $d;
 }
开发者ID:silverstripe,项目名称:deploynaut,代码行数:11,代码来源:DNTag.php

示例2: Title

 public function Title()
 {
     $date = SS_Datetime::create();
     $date->setValue($this->owner->Created);
     $dateReadable = $date->Format('D d/m/y') . ', ' . $date->Format('g:ia');
     if ($this->owner->SubmittedBy()) {
         return '#' . $this->owner->ID . ' ' . $this->owner->SubmittedBy()->getName() . ', ' . $dateReadable;
     } else {
         return '#' . $this->owner->ID . ' unknown, ' . $dateReadable;
     }
 }
开发者ID:adrexia,项目名称:chimera,代码行数:11,代码来源:SubmittedFormExtension.php

示例3: history

 /**
  * @param \SS_HTTPRequest $request
  * @return \SS_HTTPResponse
  */
 public function history(\SS_HTTPRequest $request)
 {
     $data = [];
     $list = $this->environment->DeployHistory('DeployStarted');
     $fromTimestamp = $request->requestVar('from');
     if ($fromTimestamp) {
         $from = SS_Datetime::create();
         $from->setValue($fromTimestamp);
         $list = $list->filter('LastEdited:GreaterThan', $from->Format('Y-m-d H:i:s'));
     }
     foreach ($list as $deployment) {
         $data[] = $this->formatter->getDeploymentData($deployment);
     }
     return $this->getAPIResponse(['list' => $data], 200);
 }
开发者ID:silverstripe,项目名称:deploynaut,代码行数:19,代码来源:DeployDispatcher.php

示例4: LastUpdated

 /**
  * @return SS_Datetime
  */
 public function LastUpdated()
 {
     if ($this->_lastUpdatedCache) {
         return $this->_lastUpdatedCache;
     }
     try {
         $created = $this->branch->getCommit()->getCommitterDate();
     } catch (Exception $e) {
         //occasionally parsing will fail this is a fallback to make it still work
         return new SS_Datetime();
     }
     $created->setTimezone(new DateTimeZone(date_default_timezone_get()));
     $date = SS_Datetime::create();
     $date->setValue($created->format('Y-m-d H:i:s'));
     $this->_lastUpdatedCache = $date;
     return $date;
 }
开发者ID:silverstripe,项目名称:deploynaut,代码行数:20,代码来源:DNBranch.php

示例5: getFeed

 /**
  * Get feed from provider, will automatically cache the result.
  *
  * If QueuedJobs module is installed, it will also create a job to update the cache
  * 5 minutes before it expires.
  *
  * @return SS_List
  */
 public function getFeed()
 {
     $feed = $this->getFeedCache();
     if (!$feed) {
         $feed = $this->getFeedUncached();
         $this->setFeedCache($feed);
         if (class_exists('AbstractQueuedJob')) {
             singleton('SocialFeedCacheQueuedJob')->createJob($this);
         }
     }
     $data = array();
     if ($feed) {
         foreach ($feed as $post) {
             $created = SS_Datetime::create();
             $created->setValue($this->getPostCreated($post));
             $data[] = array('Type' => $this->getType(), 'Content' => $this->getPostContent($post), 'Created' => $created, 'URL' => $this->getPostUrl($post), 'Data' => $post, 'UserName' => $this->getUserName($post), 'Image' => $this->getImage($post));
         }
     }
     $result = ArrayList::create($data);
     $result = $result->sort('Created', 'DESC');
     return $result;
 }
开发者ID:isaacrankin,项目名称:silverstripe-social-feed,代码行数:30,代码来源:SocialFeedProvider.php

示例6: getLatestTweets

 function getLatestTweets()
 {
     require Director::baseFolder() . '/twitter-feed/libs/tmhOAuth.php';
     require Director::baseFolder() . '/twitter-feed/libs/tmhUtilities.php';
     $tmhOAuth = new tmhOAuth(array('consumer_key' => self::get_consumer_key(), 'consumer_secret' => self::get_consumer_secret(), 'user_token' => self::get_user_token(), 'user_secret' => self::get_user_secret(), 'curl_ssl_verifypeer' => false));
     $code = $tmhOAuth->request('GET', $tmhOAuth->url('1.1/statuses/user_timeline'), array('screen_name' => self::get_username(), 'count' => self::get_tweetcount() + 10, 'exclude_replies' => true));
     $response = $tmhOAuth->response['response'];
     $tweets = json_decode($response, true);
     if ($this->_errorCheck($tweets)) {
         return false;
     }
     $output = new ArrayList();
     foreach ($tweets as &$tweet) {
         $tweet['text'] = $this->tweetConvert($tweet['text']);
         $time = SS_Datetime::create('SS_Datetime');
         $time->setValue($tweet['created_at']);
         $tweet['created_at'] = $time;
         //
         $tweet['username'] = self::get_username();
         $output->push(new ArrayData($tweet));
     }
     return $output->limit(self::get_tweetcount());
 }
开发者ID:helpfulrobot,项目名称:purplespider-twitter-feed,代码行数:23,代码来源:TwitterFeed.php

示例7: isBounced

 /**
  * @param $mailbox
  * @param $emailID
  * @param $isBounce
  */
 private function isBounced($mailbox, $emailID, $isBounce)
 {
     $stripTags = array('<', '>');
     // Some servers reply with "<user@mail.com>", so, let's strip that.
     $to = str_replace($stripTags, array('', ''), $isBounce[1]);
     $error = $isBounce[2];
     /** @var Recipient $recipient */
     $recipient = Recipient::get()->filter(array("Email" => $to))->first();
     if ($recipient->BouncedCount == self::$blacklistLimit) {
         // When we reach the blacklistLimit, just blacklist this address.
         $recipient->BlacklistedEmail = true;
         $recipient->write();
     } else {
         // Otherwise, just up the bouncedCount.
         $recipient->BouncedCount = $recipient->BouncedCount + 1;
         $recipient->write();
         /** @var NewsletterEmailBounceRecord $record Record this bounce in the NewsletterEmailBounceRecord class. */
         $record = NewsletterEmailBounceRecord::get()->filter(array("BounceEmail" => $to));
         if (!$record->count()) {
             $record = NewsletterEmailBounceRecord::create();
             $record->BounceEmail = $to;
             $record->BounceMessage = $error;
             $record->RecipientID = $recipient->ID;
         } else {
             $record = $record->first();
         }
         $record->LastBounceTime = SS_Datetime::create()->now();
         $record->write();
     }
     // Set the e-mail flag
     imap_setflag_full($mailbox, $emailID, '\\flagged', ST_UID);
     // Also mark it for deletion.
     imap_delete($mailbox, $emailID, ST_UID);
     // And up the bounces counter.
     $this->bounces = $this->bounces + 1;
 }
开发者ID:sunnysideup,项目名称:newsletter_bounce,代码行数:41,代码来源:NewsletterBounceTask.php


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