本文整理汇总了PHP中common_date_iso8601函数的典型用法代码示例。如果您正苦于以下问题:PHP common_date_iso8601函数的具体用法?PHP common_date_iso8601怎么用?PHP common_date_iso8601使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了common_date_iso8601函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Show the item
*
* @return void
*/
function show()
{
$group = $this->gm->getGroup();
$sender = $this->gm->getSender();
$this->out->elementStart('li', array('class' => 'hentry notice message group-message', 'id' => 'message-' . $this->gm->id));
$this->out->elementStart('div', 'entry-title');
$this->out->elementStart('span', 'vcard author');
$this->out->elementStart('a', array('href' => $sender->profileurl, 'class' => 'url'));
$avatar = $sender->getAvatar(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $avatar ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_STREAM_SIZE), 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'class' => 'photo avatar', 'alt' => $sender->getBestName()));
$this->out->element('span', array('class' => 'nickname fn'), $sender->nickname);
$this->out->elementEnd('a');
$this->out->elementEnd('span');
$this->out->elementStart('p', array('class' => 'entry-content message-content'));
$this->out->raw($this->gm->rendered);
$this->out->elementEnd('p');
$this->out->elementEnd('div');
$this->out->elementStart('div', 'entry-content');
$this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $this->gm->url));
$dt = common_date_iso8601($this->gm->created);
$this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->gm->created));
$this->out->elementEnd('a');
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例2: show
/**
* Show the widget
*
* @return void
*/
function show()
{
$this->out->elementStart('li', array('class' => 'h-entry notice', 'id' => 'message-' . $this->message->id));
$profile = $this->getMessageProfile();
$this->out->elementStart('a', array('href' => $profile->profileurl, 'class' => 'p-author'));
$avatarUrl = $profile->avatarUrl(AVATAR_STREAM_SIZE);
$this->out->element('img', array('src' => $avatarUrl, 'class' => 'avatar u-photo', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => $profile->getBestName()));
$this->out->element('span', array('class' => 'nickname fn'), $profile->getNickname());
$this->out->elementEnd('a');
// FIXME: URL, image, video, audio
$this->out->elementStart('div', array('class' => 'e-content'));
$this->out->raw($this->message->rendered);
$this->out->elementEnd('div');
$messageurl = common_local_url('showmessage', array('message' => $this->message->id));
// XXX: we need to figure this out better. Is this right?
if (strcmp($this->message->uri, $messageurl) != 0 && preg_match('/^http/', $this->message->uri)) {
$messageurl = $this->message->uri;
}
$this->out->elementStart('div', 'entry-metadata');
$this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => $messageurl));
$dt = common_date_iso8601($this->message->created);
$this->out->element('time', array('class' => 'dt-published', 'datetime' => common_date_iso8601($this->message->created), 'title' => common_exact_date($this->message->created)), common_date_string($this->message->created));
$this->out->elementEnd('a');
if ($this->message->source) {
$this->out->elementStart('span', 'source');
// FIXME: bad i18n. Device should be a parameter (from %s).
// TRANS: Followed by notice source (usually the client used to send the notice).
$this->out->text(_('from'));
$this->showSource($this->message->source);
$this->out->elementEnd('span');
}
$this->out->elementEnd('div');
$this->out->elementEnd('li');
}
示例3: asActivity
function asActivity()
{
$notice = Notice::staticGet('id', $this->notice_id);
$profile = Profile::staticGet('id', $this->user_id);
$act = new Activity();
$act->verb = ActivityVerb::FAVORITE;
// FIXME: rationalize this with URL below
$act->id = TagURI::mint('favor:%d:%d:%s', $profile->id, $notice->id, common_date_iso8601($this->modified));
$act->time = strtotime($this->modified);
// TRANS: Activity title when marking a notice as favorite.
$act->title = _("Favor");
// TRANS: Ntofication given when a user marks a notice as favorite.
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
$act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), $profile->getBestName(), $notice->uri);
$act->actor = ActivityObject::fromProfile($profile);
$act->objects[] = ActivityObject::fromNotice($notice);
$url = common_local_url('AtomPubShowFavorite', array('profile' => $this->user_id, 'notice' => $this->notice_id));
$act->selfLink = $url;
$act->editLink = $url;
return $act;
}
示例4: handle
/**
* Handle the request
*
* Return some Twitter-ish data about API limits
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
protected function handle()
{
parent::handle();
if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(_('API method not found.'), 404, $this->format);
}
$reset = new DateTime();
$reset->modify('+1 hour');
$this->initDocument($this->format);
if ($this->format == 'xml') {
$this->elementStart('hash');
$this->element('remaining-hits', array('type' => 'integer'), 150);
$this->element('hourly-limit', array('type' => 'integer'), 150);
$this->element('reset-time', array('type' => 'datetime'), common_date_iso8601($reset->format('r')));
$this->element('reset_time_in_seconds', array('type' => 'integer'), strtotime('+1 hour'));
$this->elementEnd('hash');
} elseif ($this->format == 'json') {
$out = array('reset_time_in_seconds' => strtotime('+1 hour'), 'remaining_hits' => 150, 'hourly_limit' => 150, 'reset_time' => common_date_rfc2822($reset->format('r')));
print json_encode($out);
}
$this->endDocument($this->format);
}
示例5: showNoticeLink
function showNoticeLink()
{
$noticeurl = common_local_url('shownotice', array('notice' => $this->notice->id));
// XXX: we need to figure this out better. Is this right?
if (strcmp($this->notice->uri, $noticeurl) != 0 && preg_match('/^http/', $this->notice->uri)) {
$noticeurl = $this->notice->uri;
}
$this->out->elementStart('dl', 'timestamp');
$this->out->element('dt', null, _('Published'));
$this->out->elementStart('dd', null);
$this->out->elementStart('a', array('rel' => 'bookmark', 'href' => $noticeurl));
$dt = common_date_iso8601($this->notice->created);
$this->out->element('abbr', array('class' => 'published', 'title' => $dt), common_date_string($this->notice->created));
$this->out->elementEnd('a');
$this->out->elementEnd('dd');
$this->out->elementEnd('dl');
}
示例6: notify
/**
* Send an Activity Streams notification to the remote Salmon endpoint,
* if so configured.
*
* @param Profile $actor Actor who did the activity
* @param string $verb Activity::SUBSCRIBE or Activity::JOIN
* @param Object $object object of the action; must define asActivityNoun($tag)
*/
public function notify(Profile $actor, $verb, $object = null, $target = null)
{
if ($object == null) {
$object = $this;
}
if (empty($this->salmonuri)) {
return false;
}
$text = 'update';
$id = TagURI::mint('%s:%s:%s', $verb, $actor->getURI(), common_date_iso8601(time()));
// @todo FIXME: Consolidate all these NS settings somewhere.
$attributes = array('xmlns' => Activity::ATOM, 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/', 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0', 'xmlns:georss' => 'http://www.georss.org/georss', 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', 'xmlns:media' => 'http://purl.org/syndication/atommedia');
$entry = new XMLStringer();
$entry->elementStart('entry', $attributes);
$entry->element('id', null, $id);
$entry->element('title', null, $text);
$entry->element('summary', null, $text);
$entry->element('published', null, common_date_w3dtf(common_sql_now()));
$entry->element('activity:verb', null, $verb);
$entry->raw($actor->asAtomAuthor());
$entry->raw($actor->asActivityActor());
$entry->raw($object->asActivityNoun('object'));
if ($target != null) {
$entry->raw($target->asActivityNoun('target'));
}
$entry->elementEnd('entry');
$xml = $entry->getString();
common_log(LOG_INFO, "Posting to Salmon endpoint {$this->salmonuri}: {$xml}");
Salmon::post($this->salmonuri, $xml, $actor);
}
示例7: showAtomDirectMessages
/**
* Shows a list of direct messages as Atom entries
*
* @return void
*/
function showAtomDirectMessages()
{
$this->initDocument('atom');
$this->element('title', null, $this->title);
$this->element('id', null, $this->id);
$selfuri = common_root_url() . 'api/direct_messages.atom';
$this->element('link', array('href' => $this->link, 'rel' => 'alternate', 'type' => 'text/html'), null);
$this->element('link', array('href' => $this->selfuri_base . '.atom', 'rel' => 'self', 'type' => 'application/atom+xml'), null);
$this->element('updated', null, common_date_iso8601('now'));
$this->element('subtitle', null, $this->subtitle);
foreach ($this->messages as $m) {
$entry = $this->rssDirectMessageArray($m);
$this->showTwitterAtomEntry($entry);
}
$this->endDocument('atom');
}
示例8: showContent
function showContent()
{
$notice = $this->nli->notice;
$out = $this->nli->out;
$profile = $notice->getProfile();
$event = Happening::fromNotice($notice);
if (empty($event)) {
// TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
$out->element('p', null, _m('Deleted.'));
return;
}
$out->elementStart('div', 'vevent event');
// VEVENT IN
$out->elementStart('h3');
// VEVENT/H3 IN
if (!empty($event->url)) {
$out->element('a', array('href' => $event->url, 'class' => 'event-title entry-title summary'), $event->title);
} else {
$out->text($event->title);
}
$out->elementEnd('h3');
// VEVENT/H3 OUT
$startDate = strftime("%x", strtotime($event->start_time));
$startTime = strftime("%R", strtotime($event->start_time));
$endDate = strftime("%x", strtotime($event->end_time));
$endTime = strftime("%R", strtotime($event->end_time));
// FIXME: better dates
$out->elementStart('div', 'event-times');
// VEVENT/EVENT-TIMES IN
// TRANS: Field label for event description.
$out->element('strong', null, _m('Time:'));
$out->element('abbr', array('class' => 'dtstart', 'title' => common_date_iso8601($event->start_time)), $startDate . ' ' . $startTime);
$out->text(' - ');
if ($startDate == $endDate) {
$out->element('span', array('class' => 'dtend', 'title' => common_date_iso8601($event->end_time)), $endTime);
} else {
$out->element('span', array('class' => 'dtend', 'title' => common_date_iso8601($event->end_time)), $endDate . ' ' . $endTime);
}
$out->elementEnd('div');
// VEVENT/EVENT-TIMES OUT
if (!empty($event->location)) {
$out->elementStart('div', 'event-location');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Location:'));
$out->element('span', 'location', $event->location);
$out->elementEnd('div');
}
if (!empty($event->description)) {
$out->elementStart('div', 'event-description');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Description:'));
$out->element('span', 'description', $event->description);
$out->elementEnd('div');
}
$rsvps = $event->getRSVPs();
$out->elementStart('div', 'event-rsvps');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Attending:'));
$out->element('span', 'event-rsvps', sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'), count($rsvps[RSVP::POSITIVE]), count($rsvps[RSVP::NEGATIVE]), count($rsvps[RSVP::POSSIBLE])));
$out->elementEnd('div');
$user = common_current_user();
if (!empty($user)) {
$rsvp = $event->getRSVP($user->getProfile());
if (empty($rsvp)) {
$form = new RSVPForm($event, $out);
} else {
$form = new CancelRSVPForm($rsvp, $out);
}
$form->show();
}
$out->elementEnd('div');
// vevent out
}
示例9: showEvent
protected function showEvent(Notice $stored, HTMLOutputter $out, Profile $scoped = null)
{
$profile = $stored->getProfile();
$event = Happening::fromNotice($stored);
if (!$event instanceof Happening) {
// TRANS: Content for a deleted RSVP list item (RSVP stands for "please respond").
$out->element('p', null, _m('Deleted.'));
return;
}
$out->elementStart('div', 'h-event');
$out->elementStart('h3', 'p-summary p-name');
try {
$out->element('a', array('href' => $event->getUrl()), $event->title);
} catch (InvalidUrlException $e) {
$out->text($event->title);
}
$out->elementEnd('h3');
$now = new DateTime();
$startDate = new DateTime($event->start_time);
$endDate = new DateTime($event->end_time);
$userTz = new DateTimeZone(common_timezone());
// Localize the time for the observer
$now->setTimeZone($userTz);
$startDate->setTimezone($userTz);
$endDate->setTimezone($userTz);
$thisYear = $now->format('Y');
$startYear = $startDate->format('Y');
$endYear = $endDate->format('Y');
$dateFmt = 'D, F j, ';
// e.g.: Mon, Aug 31
if ($startYear != $thisYear || $endYear != $thisYear) {
$dateFmt .= 'Y,';
// append year if we need to think about years
}
$startDateStr = $startDate->format($dateFmt);
$endDateStr = $endDate->format($dateFmt);
$timeFmt = 'g:ia';
$startTimeStr = $startDate->format($timeFmt);
$endTimeStr = $endDate->format("{$timeFmt} (T)");
$out->elementStart('div', 'event-times');
// VEVENT/EVENT-TIMES IN
// TRANS: Field label for event description.
$out->element('strong', null, _m('Time:'));
$out->element('time', array('class' => 'dt-start', 'datetime' => common_date_iso8601($event->start_time)), $startDateStr . ' ' . $startTimeStr);
$out->text(' – ');
$out->element('time', array('class' => 'dt-end', 'datetime' => common_date_iso8601($event->end_time)), $startDateStr != $endDateStr ? "{$endDateStr} {$endTimeStr}" : $endTimeStr);
$out->elementEnd('div');
// VEVENT/EVENT-TIMES OUT
if (!empty($event->location)) {
$out->elementStart('div', 'event-location');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Location:'));
$out->element('span', 'p-location', $event->location);
$out->elementEnd('div');
}
if (!empty($event->description)) {
$out->elementStart('div', 'event-description');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Description:'));
$out->element('div', 'p-description', $event->description);
$out->elementEnd('div');
}
$rsvps = $event->getRSVPs();
$out->elementStart('div', 'event-rsvps');
// TRANS: Field label for event description.
$out->element('strong', null, _m('Attending:'));
$out->elementStart('ul', 'attending-list');
foreach ($rsvps as $verb => $responses) {
$out->elementStart('li', 'rsvp-list');
switch ($verb) {
case RSVP::POSITIVE:
$out->text(_('Yes:'));
break;
case RSVP::NEGATIVE:
$out->text(_('No:'));
break;
case RSVP::POSSIBLE:
$out->text(_('Maybe:'));
break;
}
$ids = array();
foreach ($responses as $response) {
$ids[] = $response->profile_id;
}
$ids = array_slice($ids, 0, ProfileMiniList::MAX_PROFILES + 1);
$minilist = new ProfileMiniList(Profile::multiGet('id', $ids), $out);
$minilist->show();
$out->elementEnd('li');
}
$out->elementEnd('ul');
$out->elementEnd('div');
if ($scoped instanceof Profile) {
$rsvp = $event->getRSVP($scoped);
if (empty($rsvp)) {
$form = new RSVPForm($event, $out);
} else {
$form = new CancelRSVPForm($rsvp, $out);
}
$form->show();
}
//.........这里部分代码省略.........
示例10: notify
/**
* Send an Activity Streams notification to the remote Salmon endpoint,
* if so configured.
*
* @param Profile $actor Actor who did the activity
* @param string $verb Activity::SUBSCRIBE or Activity::JOIN
* @param Object $object object of the action; must define asActivityNoun($tag)
*/
public function notify($actor, $verb, $object = null, $target = null)
{
if (!$actor instanceof Profile) {
$type = gettype($actor);
if ($type == 'object') {
$type = get_class($actor);
}
// TRANS: Server exception.
// TRANS: %1$s is the method name the exception occured in, %2$s is the actor type.
throw new ServerException(sprintf(_m('Invalid actor passed to %1$s: %2$s.'), __METHOD__, $type));
}
if ($object == null) {
$object = $this;
}
if ($this->salmonuri) {
$text = 'update';
$id = TagURI::mint('%s:%s:%s', $verb, $actor->getURI(), common_date_iso8601(time()));
// @todo FIXME: Consolidate all these NS settings somewhere.
$attributes = array('xmlns' => Activity::ATOM, 'xmlns:activity' => 'http://activitystrea.ms/spec/1.0/', 'xmlns:thr' => 'http://purl.org/syndication/thread/1.0', 'xmlns:georss' => 'http://www.georss.org/georss', 'xmlns:ostatus' => 'http://ostatus.org/schema/1.0', 'xmlns:poco' => 'http://portablecontacts.net/spec/1.0', 'xmlns:media' => 'http://purl.org/syndication/atommedia');
$entry = new XMLStringer();
$entry->elementStart('entry', $attributes);
$entry->element('id', null, $id);
$entry->element('title', null, $text);
$entry->element('summary', null, $text);
$entry->element('published', null, common_date_w3dtf(common_sql_now()));
$entry->element('activity:verb', null, $verb);
$entry->raw($actor->asAtomAuthor());
$entry->raw($actor->asActivityActor());
$entry->raw($object->asActivityNoun('object'));
if ($target != null) {
$entry->raw($target->asActivityNoun('target'));
}
$entry->elementEnd('entry');
$xml = $entry->getString();
common_log(LOG_INFO, "Posting to Salmon endpoint {$this->salmonuri}: {$xml}");
$salmon = new Salmon();
// ?
return $salmon->post($this->salmonuri, $xml, $actor);
}
return false;
}
示例11: newURI
static function newURI($profile_id, $notice_id, $modified)
{
return TagURI::mint('favor:%d:%d:%s', $profile_id, $notice_id, common_date_iso8601($modified));
}
示例12: asActivity
function asActivity()
{
$member = $this->getMember();
$group = $this->getGroup();
$act = new Activity();
$act->id = TagURI::mint('join:%d:%d:%s', $member->id, $group->id, common_date_iso8601($this->created));
$act->actor = ActivityObject::fromProfile($member);
$act->verb = ActivityVerb::JOIN;
$act->objects[] = ActivityObject::fromGroup($group);
$act->time = strtotime($this->created);
// TRANS: Activity title.
$act->title = _("Join");
// TRANS: Success message for subscribe to group attempt through OStatus.
// TRANS: %1$s is the member name, %2$s is the subscribed group's name.
$act->content = sprintf(_('%1$s has joined group %2$s.'), $member->getBestName(), $group->getBestName());
return $act;
}
示例13: showNoticeLink
/**
* show the link to the main page for the notice
*
* Displays a link to the page for a notice, with "relative" time. Tries to
* get remote notice URLs correct, but doesn't always succeed.
*
* @return void
*/
function showNoticeLink()
{
$noticeurl = $this->notice->bestUrl();
// above should always return an URL
assert(!empty($noticeurl));
$dt = common_date_iso8601($this->notice->created);
$this->out->element('div', array('class' => 'published', 'title' => $dt), common_date_string($this->notice->created));
}
示例14: asActivity
function asActivity()
{
$notice = Notice::staticGet('id', $this->notice_id);
$profile = Profile::staticGet('id', $this->user_id);
$act = new Activity();
$act->verb = ActivityVerb::FAVORITE;
$act->id = TagURI::mint('favor:%d:%d:%s', $profile->id, $notice->id, common_date_iso8601($this->modified));
$act->time = strtotime($this->modified);
// TRANS: Activity title when marking a notice as favorite.
$act->title = _("Favor");
// TRANS: Ntofication given when a user marks a notice as favorite.
// TRANS: %1$s is a user nickname or full name, %2$s is a notice URI.
$act->content = sprintf(_('%1$s marked notice %2$s as a favorite.'), $profile->getBestName(), $notice->uri);
$act->actor = ActivityObject::fromProfile($profile);
$act->objects[] = ActivityObject::fromNotice($notice);
return $act;
}
示例15: showNoticeLink
/**
* show the link to the main page for the notice
*
* Displays a local link to the rendered notice, with "relative" time.
*
* @return void
*/
function showNoticeLink()
{
$this->out->elementStart('a', array('rel' => 'bookmark', 'class' => 'timestamp', 'href' => Conversation::getUrlFromNotice($this->notice)));
$this->out->element('time', array('class' => 'dt-published', 'datetime' => common_date_iso8601($this->notice->created), 'title' => common_exact_date($this->notice->created)), common_date_string($this->notice->created));
$this->out->elementEnd('a');
}