本文整理汇总了PHP中TagURI::base方法的典型用法代码示例。如果您正苦于以下问题:PHP TagURI::base方法的具体用法?PHP TagURI::base怎么用?PHP TagURI::base使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagURI
的用法示例。
在下文中一共展示了TagURI::base方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the request
*
* Show the user's groups
*
* @return void
*/
protected function handle()
{
parent::handle();
$sitename = common_config('site', 'name');
// TRANS: Used as title in check for group membership. %s is a user name.
$title = sprintf(_("%s's groups"), $this->target->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:Groups";
$link = common_local_url('usergroups', array('nickname' => $this->target->nickname));
$subtitle = sprintf(_('%1$s groups %2$s is a member of.'), $sitename, $this->target->nickname);
switch ($this->format) {
case 'xml':
$this->showXmlGroups($this->groups);
break;
case 'rss':
$this->showRssGroups($this->groups, $title, $link, $subtitle);
break;
case 'atom':
$selfuri = common_local_url('ApiGroupList', array('id' => $this->target->id, 'format' => 'atom'));
$this->showAtomGroups($this->groups, $title, $id, $link, $subtitle, $selfuri);
break;
case 'json':
$this->showJsonGroups($this->groups);
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
}
}
示例2: handle
/**
* Handle the request
*
* Show the user's groups
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$sitename = common_config('site', 'name');
// TRANS: Used as title in check for group membership. %s is a user name.
$title = sprintf(_("%s's groups"), $this->user->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:Groups";
$link = common_local_url('usergroups', array('nickname' => $this->user->nickname));
$subtitle = sprintf(_('%1$s groups %2$s is a member of.'), $sitename, $this->user->nickname);
switch ($this->format) {
case 'xml':
$this->showXmlGroups($this->groups);
break;
case 'rss':
$this->showRssGroups($this->groups, $title, $link, $subtitle);
break;
case 'atom':
$selfuri = common_root_url() . 'api/statusnet/groups/list/' . $this->user->id . '.atom';
$this->showAtomGroups($this->groups, $title, $id, $link, $subtitle, $selfuri);
break;
case 'json':
$this->showJsonGroups($this->groups);
break;
default:
$this->clientError(_('API method not found.'), 404, $this->format);
break;
}
}
示例3: prepare
/**
* Take arguments for running
*
* @param array $args $_REQUEST args
*
* @return boolean success flag
*
*/
function prepare($args)
{
parent::prepare($args);
$this->user = $this->auth_user;
if (empty($this->user)) {
// TRANS: Client error given when a user was not found (404).
$this->clientError(_('No such user.'), 404, $this->format);
return;
}
$server = common_root_url();
$taguribase = TagURI::base();
if ($this->arg('sent')) {
// Action was called by /api/direct_messages/sent.format
$this->title = sprintf(_("Direct messages from %s"), $this->user->nickname);
$this->subtitle = sprintf(_("All the direct messages sent from %s"), $this->user->nickname);
$this->link = $server . $this->user->nickname . '/outbox';
$this->selfuri_base = common_root_url() . 'api/direct_messages/sent';
$this->id = "tag:{$taguribase}:SentDirectMessages:" . $this->user->id;
} else {
$this->title = sprintf(_("Direct messages to %s"), $this->user->nickname);
$this->subtitle = sprintf(_("All the direct messages sent to %s"), $this->user->nickname);
$this->link = $server . $this->user->nickname . '/inbox';
$this->selfuri_base = common_root_url() . 'api/direct_messages';
$this->id = "tag:{$taguribase}:DirectMessages:" . $this->user->id;
}
$this->messages = $this->getMessages();
return true;
}
示例4: handle
/**
* Handle the request
*
* Show the user's groups
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$sitename = common_config('site', 'name');
// TRANS: Message is used as a title. %s is a site name.
$title = sprintf(_("%s groups"), $sitename);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:Groups";
$link = common_local_url('groups');
$subtitle = sprintf(_("groups on %s"), $sitename);
switch ($this->format) {
case 'xml':
$this->showXmlGroups($this->groups);
break;
case 'rss':
$this->showRssGroups($this->groups, $title, $link, $subtitle);
break;
case 'atom':
$selfuri = common_root_url() . 'api/statusnet/groups/list_all.atom';
$this->showAtomGroups($this->groups, $title, $id, $link, $subtitle, $selfuri);
break;
case 'json':
$this->showJsonGroups($this->groups);
break;
default:
$this->clientError(_('API method not found.'), 404, $this->format);
break;
}
}
示例5: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
// TRANS: Title for timeline with lastest notices with a given tag.
// TRANS: %s is the tag.
$title = sprintf(_("Notices tagged with %s"), $this->tag);
$subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:TagTimeline:" . $this->tag;
$link = common_local_url('tag', array('tag' => $this->tag));
$self = $this->getSelfUri();
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($sitelogo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例6: handle
/**
* Handle the request
*
* show a timeline of the user's repeated notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$offset = ($this->page - 1) * $this->cnt;
$limit = $this->cnt;
// TRANS: Title for Atom feed "repeated to me". %s is the user nickname.
$title = sprintf(_("Repeated to %s"), $this->auth_user->nickname);
$subtitle = sprintf(_('%1$s notices that were to repeated to %2$s / %3$s.'), $sitename, $this->user->nickname, $profile->getBestName());
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:RepeatedToMe:" . $this->auth_user->id;
$link = common_local_url('all', array('nickname' => $this->auth_user->nickname));
$strm = $this->auth_user->repeatedToMe($offset, $limit, $this->since_id, $this->max_id);
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($strm);
break;
case 'json':
$this->showJsonTimeline($strm);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setUpdated('now');
$atom->addLink($link);
$id = $this->arg('id');
$atom->setSelfLink($self);
$atom->addEntryFromNotices($strm);
$this->raw($atom->getString());
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($strm);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例7: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name');
$title = sprintf(_('%1$s / Bookmarks from %2$s'), $sitename, $this->user->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:Bookmarks:" . $this->user->id;
$subtitle = sprintf(_('%1$s updates bookmarked by %2$s / %3$s.'), $sitename, $profile->getBestName(), $this->user->nickname);
$logo = !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
$link = common_local_url('bookmarks', array('nickname' => $this->user->nickname));
$self = $this->getSelfUri();
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例8: handle
/**
* Handle the request
*
* show a timeline of the user's repeated notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$offset = ($this->page - 1) * $this->cnt;
$limit = $this->cnt;
$strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
common_debug(var_export($strm, true));
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($strm);
break;
case 'json':
$this->showJsonTimeline($strm);
break;
case 'atom':
$profile = $this->auth_user->getProfile();
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:RepeatsOfMe:" . $this->auth_user->id;
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setUpdated('now');
$atom->addLink(common_local_url('showstream', array('nickname' => $this->auth_user->nickname)));
$id = $this->arg('id');
$aargs = array('format' => 'atom');
if (!empty($id)) {
$aargs['id'] = $id;
}
$atom->addLink($this->getSelfUri('ApiTimelineRetweetsOfMe', $aargs), array('rel' => 'self', 'type' => 'application/atom+xml'));
$atom->addEntryFromNotices($strm);
$this->raw($atom->getString());
break;
default:
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例9: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$profile = $this->user->getProfile();
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
$sitename = common_config('site', 'name');
// TRANS: Timeline title for user and friends. %s is a user nickname.
$title = sprintf(_("%s and friends"), $this->user->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:HomeTimeline:" . $this->user->id;
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s!'), $this->user->nickname, $sitename);
$link = common_local_url('all', array('nickname' => $this->user->nickname));
$self = $this->getSelfUri();
$logo = !empty($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE);
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
// TRANS: Client error displayed when trying to handle an unknown API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例10: showEntry
/**
* Build an Atom entry similar to search.twitter.com's based on
* a given notice
*
* @param Notice $notice the notice to use
*
* @return void
*/
function showEntry($notice)
{
$server = common_config('site', 'server');
$profile = $notice->getProfile();
$nurl = common_local_url('shownotice', array('notice' => $notice->id));
$this->elementStart('entry');
$taguribase = TagURI::base();
$this->element('id', null, "tag:{$taguribase}:{$notice->id}");
$this->element('published', null, common_date_w3dtf($notice->created));
$this->element('link', array('type' => 'text/html', 'rel' => 'alternate', 'href' => $nurl));
$this->element('title', null, common_xml_safe_str(trim($notice->content)));
$this->element('content', array('type' => 'html'), $notice->rendered);
$this->element('updated', null, common_date_w3dtf($notice->created));
$this->element('link', array('type' => 'image/png', 'rel' => 'related', 'href' => $profile->avatarUrl()));
// TODO: Here is where we'd put in a link to an atom feed for threads
$this->element("twitter:source", null, htmlentities($this->sourceLink($notice->source)));
$this->elementStart('author');
$name = $profile->nickname;
if ($profile->fullname) {
$name .= ' (' . $profile->fullname . ')';
}
$this->element('name', null, $name);
$this->element('uri', null, common_profile_uri($profile));
$this->elementEnd('author');
$this->elementEnd('entry');
}
示例11: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
$sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
$title = sprintf(_("Notices tagged with %s"), $this->tag);
$subtitle = sprintf(_('Updates tagged with %1$s on %2$s!'), $this->tag, $sitename);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:TagTimeline:" . $tag;
$link = common_local_url('tag', array('tag' => $this->tag));
$self = $this->getSelfUri();
common_debug("self link is: {$self}");
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
default:
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例12: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$sitename = common_config('site', 'name');
// TRANS: Title of API timeline for a user and friends.
// TRANS: %s is a username.
$title = sprintf(_("%s and friends"), $this->target->nickname);
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:FriendsTimelineHiddenReplies:" . $this->target->id;
$subtitle = sprintf(_('Updates from %1$s and friends on %2$s! (with replies to non-friends hidden)'), $this->target->nickname, $sitename);
$logo = $this->target->avatarUrl(AVATAR_PROFILE_SIZE);
$link = common_local_url('all', array('nickname' => $this->target->nickname));
$self = $this->getSelfUri();
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $logo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($logo);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user, $title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
}
}
示例13: rssDirectMessageArray
function rssDirectMessageArray($message)
{
$entry = array();
$from = $message->getFrom();
$entry['title'] = sprintf('Message from %1$s to %2$s', $from->nickname, $message->getTo()->nickname);
$entry['content'] = common_xml_safe_str($message->rendered);
$entry['link'] = common_local_url('showmessage', array('message' => $message->id));
$entry['published'] = common_date_iso8601($message->created);
$taguribase = TagURI::base();
$entry['id'] = "tag:{$taguribase}:{$entry['link']}";
$entry['updated'] = $entry['published'];
$entry['author-name'] = $from->getBestName();
$entry['author-uri'] = $from->homepage;
$avatar = $from->getAvatar(AVATAR_STREAM_SIZE);
$entry['avatar'] = !empty($avatar) ? $avatar->url : Avatar::defaultImage(AVATAR_STREAM_SIZE);
$entry['avatar-type'] = !empty($avatar) ? $avatar->mediatype : 'image/png';
// RSS item specific
$entry['description'] = $entry['content'];
$entry['pubDate'] = common_date_rfc2822($message->created);
$entry['guid'] = $entry['link'];
return $entry;
}
示例14: showTimeline
/**
* Show the timeline of notices
*
* @return void
*/
function showTimeline()
{
$nonapi_action = substr($this->action, strlen('apitimeline'));
// Just so we don't need to set this explicitly
$sitelogo = common_config('site', 'logo') ? common_config('site', 'logo') : Theme::path('logo.png');
$title = $this->title();
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:" . ucfirst($nonapi_action) . 'Timeline';
// Public or Networkpublic probably
$link = common_local_url($nonapi_action);
$self = $this->getSelfUri();
// TRANS: Subtitle for site timeline. %s is the GNU social sitename.
$subtitle = sprintf(_("%s updates from everyone!"), common_config('site', 'name'));
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($this->notices);
break;
case 'rss':
$this->showRssTimeline($this->notices, $title, $link, $subtitle, null, $sitelogo, $self);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setLogo($sitelogo);
$atom->setUpdated('now');
$atom->addLink(common_local_url($nonapi_action));
$atom->setSelfLink($self);
$atom->addEntryFromNotices($this->notices);
$this->raw($atom->getString());
break;
case 'json':
$this->showJsonTimeline($this->notices);
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($this->notices);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), $code = 404);
break;
}
}
示例15: handle
/**
* Handle the request
*
* show a timeline of the user's repeated notices
*
* @param array $args $_REQUEST data (unused)
*
* @return void
*/
function handle($args)
{
parent::handle($args);
$offset = ($this->page - 1) * $this->cnt;
$limit = $this->cnt;
// TRANS: Title of list of repeated notices of the logged in user.
// TRANS: %s is the nickname of the logged in user.
$title = sprintf(_("Repeats of %s"), $this->auth_user->nickname);
$sitename = common_config('site', 'name');
$profile = $this->auth_user->getProfile();
$subtitle = sprintf(_('%1$s notices that %2$s / %3$s has repeated.'), $sitename, $this->auth_user->nickname, $profile->getBestName());
$taguribase = TagURI::base();
$id = "tag:{$taguribase}:RepeatsOfMe:" . $this->auth_user->id;
$link = common_local_url('all', array('nickname' => $this->auth_user->nickname));
// This is a really bad query for some reason
if (!common_config('performance', 'high')) {
$strm = $this->auth_user->repeatsOfMe($offset, $limit, $this->since_id, $this->max_id);
} else {
$strm = new Notice();
$strm->whereAdd('0 = 1');
$strm->find();
}
switch ($this->format) {
case 'xml':
$this->showXmlTimeline($strm);
break;
case 'json':
$this->showJsonTimeline($strm);
break;
case 'atom':
header('Content-Type: application/atom+xml; charset=utf-8');
$atom = new AtomNoticeFeed($this->auth_user);
$atom->setId($id);
$atom->setTitle($title);
$atom->setSubtitle($subtitle);
$atom->setUpdated('now');
$atom->addLink($link);
$atom->setSelfLink($this->getSelfUri());
$atom->addEntryFromNotices($strm);
$this->raw($atom->getString());
break;
case 'as':
header('Content-Type: ' . ActivityStreamJSONDocument::CONTENT_TYPE);
$doc = new ActivityStreamJSONDocument($this->auth_user);
$doc->setTitle($title);
$doc->addLink($link, 'alternate', 'text/html');
$doc->addItemsFromNotices($strm);
$this->raw($doc->asString());
break;
default:
// TRANS: Client error displayed when coming across a non-supported API method.
$this->clientError(_('API method not found.'), 404);
break;
}
}