本文整理汇总了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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}