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


PHP common_local_url函数代码示例

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


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

示例1: show

 /**
  * Show the menu
  *
  * @return void
  */
 function show()
 {
     $this->actionName = $this->action->trimmed('action');
     $this->action->elementStart('ul', array('class' => 'nav'));
     if (Event::handle('StartPublicGroupNav', array($this))) {
         if (!common_config('singleuser', 'enabled')) {
             // TRANS: Menu item in search group navigation panel.
             $this->out->menuItem(common_local_url('public'), _m('MENU', 'Public'), _('Public timeline'), $this->actionName == 'public', 'nav_timeline_public');
         }
         // TRANS: Menu item in search group navigation panel.
         $this->out->menuItem(common_local_url('groups'), _m('MENU', 'Groups'), _('User groups'), $this->actionName == 'groups', 'nav_groups');
         if (!common_config('performance', 'high')) {
             // TRANS: Menu item in search group navigation panel.
             $this->out->menuItem(common_local_url('publictagcloud'), _m('MENU', 'Recent tags'), _('Recent tags'), $this->actionName == 'publictagcloud', 'nav_recent-tags');
         }
         if (count(common_config('nickname', 'featured')) > 0) {
             // TRANS: Menu item in search group navigation panel.
             $this->out->menuItem(common_local_url('featured'), _m('MENU', 'Featured'), _('Featured users'), $this->actionName == 'featured', 'nav_featured');
         }
         if (!common_config('singleuser', 'enabled')) {
             // TRANS: Menu item in search group navigation panel.
             $this->out->menuItem(common_local_url('favorited'), _m('MENU', 'Popular'), _('Popular notices'), $this->actionName == 'favorited', 'nav_timeline_favorited');
         }
         Event::handle('EndPublicGroupNav', array($this));
     }
     $this->action->elementEnd('ul');
 }
开发者ID:Grasia,项目名称:bolotweet,代码行数:32,代码来源:publicgroupnav.php

示例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: 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;
     }
 }
开发者ID:Br3nda,项目名称:StatusNet,代码行数:38,代码来源:apigrouplistall.php

示例3: prepare

 function prepare($args)
 {
     parent::prepare($args);
     $nickname_arg = $this->arg('nickname');
     $nickname = common_canonical_nickname($nickname_arg);
     // Permanent redirect on non-canonical nickname
     if ($nickname_arg != $nickname) {
         $args = array('nickname' => $nickname);
         if ($this->arg('page') && $this->arg('page') != 1) {
             $args['page'] = $this->arg['page'];
         }
         common_redirect(common_local_url($this->trimmed('action'), $args), 301);
         return false;
     }
     $this->user = User::staticGet('nickname', $nickname);
     if (!$this->user) {
         $this->clientError(_m('No such user.'), 404);
         return false;
     }
     $this->profile = $this->user->getProfile();
     if (!$this->profile) {
         $this->serverError(_m('User has no profile.'));
         return false;
     }
     $page = $this->trimmed('page');
     if (!empty($page) && Validate::number($page)) {
         $this->page = $page + 0;
     } else {
         $this->page = 1;
     }
     $this->notices = empty($this->tag) ? $this->user->getNotices(($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1) : $this->user->getTaggedNotices($this->tag, ($this->page - 1) * NOTICES_PER_PAGE, NOTICES_PER_PAGE + 1, 0, 0, null);
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:33,代码来源:map.php

示例4: updateGroupUrls

function updateGroupUrls()
{
    printfnq("Updating group URLs...\n");
    $group = new User_group();
    if ($group->find()) {
        while ($group->fetch()) {
            try {
                printfv("Updating group {$group->nickname}...");
                $orig = User_group::getKV('id', $group->id);
                if (!empty($group->original_logo)) {
                    $group->original_logo = Avatar::url(basename($group->original_logo));
                    $group->homepage_logo = Avatar::url(basename($group->homepage_logo));
                    $group->stream_logo = Avatar::url(basename($group->stream_logo));
                    $group->mini_logo = Avatar::url(basename($group->mini_logo));
                }
                // XXX: this is a hack to see if a group is local or not
                $localUri = common_local_url('groupbyid', array('id' => $group->id));
                if ($group->getUri() != $localUri) {
                    $group->mainpage = common_local_url('showgroup', array('nickname' => $group->nickname));
                }
                $group->update($orig);
                printfv("DONE.");
            } catch (Exception $e) {
                echo "Can't update avatars for group " . $group->nickname . ": " . $e->getMessage();
            }
        }
    }
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:28,代码来源:updateurls.php

示例5: prepare

 function prepare($args)
 {
     parent::prepare($args);
     if (common_config('singleuser', 'enabled')) {
         $nickname_arg = User::singleUserNickname();
     } else {
         $nickname_arg = $this->arg('nickname');
     }
     $nickname = common_canonical_nickname($nickname_arg);
     // Permanent redirect on non-canonical nickname
     if ($nickname_arg != $nickname) {
         $args = array('nickname' => $nickname);
         if ($this->arg('page') && $this->arg('page') != 1) {
             $args['page'] = $this->arg['page'];
         }
         common_redirect(common_local_url('peopletagsforuser', $args), 301);
     }
     $this->user = User::getKV('nickname', $nickname);
     if (!$this->user) {
         // TRANS: Client error displayed trying to perform an action related to a non-existing user.
         $this->clientError(_('No such user.'), 404);
     }
     $this->tagged = $this->user->getProfile();
     if (!$this->tagged) {
         // TRANS: Error message displayed when referring to a user without a profile.
         $this->serverError(_('User has no profile.'));
     }
     $this->page = $this->arg('page') ? $this->arg('page') + 0 : 1;
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:30,代码来源:peopletagsforuser.php

示例6: handle

 /**
  * Handle input and output a page
  *
  * @param array $args $_REQUEST arguments
  *
  * @return void
  */
 function handle($args)
 {
     parent::handle($args);
     if (!common_logged_in()) {
         $this->clientError(_('Not logged in.'));
         return;
     } else {
         if (!common_is_real_login()) {
             // Cookie theft means that automatic logins can't
             // change important settings or see private info, and
             // _all_ our settings are important
             common_set_returnto($this->selfUrl());
             $user = common_current_user();
             if (Event::handle('RedirectToLogin', array($this, $user))) {
                 common_redirect(common_local_url('login'), 303);
             }
         } else {
             if ($_SERVER['REQUEST_METHOD'] == 'POST') {
                 $this->handlePost();
             } else {
                 $this->showForm();
             }
         }
     }
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:32,代码来源:settingsaction.php

示例7: showContent

 /**
  * Content area of the page
  *
  * Shows a form for uploading an avatar.
  *
  * @return void
  */
 function showContent()
 {
     $user = common_current_user();
     $this->elementStart('form', array('method' => 'post', 'id' => 'form_settings_other', 'class' => 'form_settings', 'action' => common_local_url('othersettings')));
     $this->elementStart('fieldset');
     $this->hidden('token', common_session_token());
     $this->elementStart('ul', 'form_data');
     $shorteners = array();
     Event::handle('GetUrlShorteners', array(&$shorteners));
     $services = array();
     foreach ($shorteners as $name => $value) {
         $services[$name] = $name;
         if ($value['freeService']) {
             $services[$name] .= _(' (free service)');
         }
     }
     if ($services) {
         asort($services);
         $this->elementStart('li');
         $this->dropdown('urlshorteningservice', _('Shorten URLs with'), $services, _('Automatic shortening service to use.'), false, $user->urlshorteningservice);
         $this->elementEnd('li');
     }
     $this->elementStart('li');
     $this->checkbox('viewdesigns', _('View profile designs'), $user->viewdesigns, _('Show or hide profile designs.'));
     $this->elementEnd('li');
     $this->elementEnd('ul');
     $this->submit('save', _('Save'));
     $this->elementEnd('fieldset');
     $this->elementEnd('form');
 }
开发者ID:himmelex,项目名称:NTW,代码行数:37,代码来源:othersettings.php

示例8: 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');
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:39,代码来源:messagelistitem.php

示例9: showTagsDropdown

 function showTagsDropdown()
 {
     $tag = $this->trimmed('tag');
     $tags = $this->getAllTags();
     $content = array();
     foreach ($tags as $t) {
         $content[$t] = $t;
     }
     if ($tags) {
         $this->elementStart('dl', array('id' => 'filter_tags'));
         $this->element('dt', null, _('Tags'));
         $this->elementStart('dd');
         $this->elementStart('ul');
         $this->elementStart('li', array('id' => 'filter_tags_all', 'class' => 'child_1'));
         $this->element('a', array('href' => common_local_url($this->trimmed('action'), array('nickname' => $this->target->getNickname()))), _m('TAGS', 'All'));
         $this->elementEnd('li');
         $this->elementStart('li', array('id' => 'filter_tags_item'));
         $this->elementStart('form', array('name' => 'bytag', 'id' => 'form_filter_bytag', 'action' => common_path('?action=' . $this->getActionName()), 'method' => 'post'));
         $this->elementStart('fieldset');
         // TRANS: Fieldset legend on gallery action page.
         $this->element('legend', null, _('Select tag to filter'));
         // TRANS: Dropdown field label on gallery action page for a list containing tags.
         $this->dropdown('tag', _('Tag'), $content, _('Choose a tag to narrow list.'), false, $tag);
         $this->hidden('nickname', $this->target->getNickname());
         // TRANS: Submit button text on gallery action page.
         $this->submit('submit', _m('BUTTON', 'Go'));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
         $this->elementEnd('li');
         $this->elementEnd('ul');
         $this->elementEnd('dd');
         $this->elementEnd('dl');
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:34,代码来源:galleryaction.php

示例10: prepare

 /**
  * For initializing members of the class.
  *
  * @param array $argarray misc. arguments
  *
  * @return boolean true
  */
 function prepare($argarray)
 {
     parent::prepare($argarray);
     $cur = common_current_user();
     if (empty($cur)) {
         throw new ClientException(_('Only for logged-in users'), 403);
     }
     $nicknameArg = $this->trimmed('nickname');
     $nickname = common_canonical_nickname($nicknameArg);
     if ($nickname != $nicknameArg) {
         $url = common_local_url('groupinbox', array('nickname' => $nickname));
         common_redirect($url);
         return false;
     }
     $localGroup = Local_group::staticGet('nickname', $nickname);
     if (empty($localGroup)) {
         throw new ClientException(_('No such group'), 404);
     }
     $this->group = User_group::staticGet('id', $localGroup->group_id);
     if (empty($this->group)) {
         throw new ClientException(_('No such group'), 404);
     }
     if (!$cur->isMember($this->group)) {
         throw new ClientException(_('Only for members'), 403);
     }
     $this->page = $this->trimmed('page');
     if (!$this->page) {
         $this->page = 1;
     }
     $this->gm = Group_message::forGroup($this->group, ($this->page - 1) * MESSAGES_PER_PAGE, MESSAGES_PER_PAGE + 1);
     return true;
 }
开发者ID:microcosmx,项目名称:experiments,代码行数:39,代码来源:groupinbox.php

示例11: handle

 /**
  * Class handler.
  *
  * @param array $args query arguments
  *
  * @return boolean false if user doesn't exist
  */
 function handle($args)
 {
     parent::handle($args);
     $type = $this->trimmed('type');
     $short_name = '';
     if ($type == 'people') {
         $type = 'peoplesearch';
         // TRANS: ShortName in the OpenSearch interface when trying to find users.
         $short_name = _('People Search');
     } else {
         $type = 'noticesearch';
         // TRANS: ShortName in the OpenSearch interface when trying to find notices.
         $short_name = _('Notice Search');
     }
     header('Content-Type: application/opensearchdescription+xml');
     $this->startXML();
     $this->elementStart('OpenSearchDescription', array('xmlns' => 'http://a9.com/-/spec/opensearch/1.1/'));
     $short_name = common_config('site', 'name') . ' ' . $short_name;
     $this->element('ShortName', null, $short_name);
     $this->element('Contact', null, common_config('site', 'email'));
     $this->element('Url', array('type' => 'text/html', 'method' => 'get', 'template' => str_replace('---', '{searchTerms}', common_local_url($type, array('q' => '---')))));
     $this->element('Image', array('height' => 16, 'width' => 16, 'type' => 'image/vnd.microsoft.icon'), common_path('favicon.ico'));
     $this->element('Image', array('height' => 50, 'width' => 50, 'type' => 'image/png'), Theme::path('logo.png'));
     $this->element('AdultContent', null, 'false');
     $this->element('Language', null, common_language());
     $this->element('OutputEncoding', null, 'UTF-8');
     $this->element('InputEncoding', null, 'UTF-8');
     $this->elementEnd('OpenSearchDescription');
     $this->endXML();
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:37,代码来源:opensearch.php

示例12: prepare

 /**
  * Take arguments for running
  *
  * @param array $args $_REQUEST args
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     $this->checkSessionToken();
     if (!common_logged_in()) {
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
             $this->clientError(_('Not logged in.'));
         } else {
             // Redirect to login.
             common_set_returnto($this->selfUrl());
             $user = common_current_user();
             if (Event::handle('RedirectToLogin', array($this, $user))) {
                 common_redirect(common_local_url('login'), 303);
             }
         }
         return false;
     }
     $id = $this->trimmed('profileid');
     if (!$id) {
         $this->clientError(_('No profile specified.'));
         return false;
     }
     $this->profile = Profile::staticGet('id', $id);
     if (!$this->profile) {
         $this->clientError(_('No profile with that ID.'));
         return false;
     }
     return true;
 }
开发者ID:stevertiqo,项目名称:StatusNet,代码行数:36,代码来源:profileformaction.php

示例13: prepare

 /**
  * Prepare for the action
  *
  * We check to see that the user is logged in, has
  * authenticated in this session, and has the right
  * to configure the site.
  *
  * @param array $args Array of arguments from Web driver
  *
  * @return boolean success flag
  */
 function prepare($args)
 {
     parent::prepare($args);
     // User must be logged in.
     if (!common_logged_in()) {
         // TRANS: Error message displayed when trying to perform an action that requires a logged in user.
         $this->clientError(_('Not logged in.'));
     }
     $user = common_current_user();
     // ...because they're logged in
     assert(!empty($user));
     // It must be a "real" login, not saved cookie login
     if (!common_is_real_login()) {
         // Cookie theft is too easy; we require automatic
         // logins to re-authenticate before admining the site
         common_set_returnto($this->selfUrl());
         if (Event::handle('RedirectToLogin', array($this, $user))) {
             common_redirect(common_local_url('login'), 303);
         }
     }
     // User must have the right to change admin settings
     if (!$user->hasRight(Right::CONFIGURESITE)) {
         // TRANS: Client error message thrown when a user tries to change admin settings but has no access rights.
         $this->clientError(_('You cannot make changes to this site.'));
     }
     // This panel must be enabled
     $name = $this->trimmed('action');
     $name = mb_substr($name, 0, -10);
     if (!self::canAdmin($name)) {
         // TRANS: Client error message throw when a certain panel's settings cannot be changed.
         $this->clientError(_('Changes to that panel are not allowed.'), 403);
     }
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:45,代码来源:adminpanelaction.php

示例14: handlePost

 /**
  * We've gotten a post event on the Salmon backchannel, probably a reply.
  */
 function handlePost()
 {
     // @fixme process all objects?
     switch ($this->activity->objects[0]->type) {
         case ActivityObject::ARTICLE:
         case ActivityObject::BLOGENTRY:
         case ActivityObject::NOTE:
         case ActivityObject::STATUS:
         case ActivityObject::COMMENT:
             break;
         default:
             // TRANS: Client exception.
             throw new ClientException('Cannot handle that kind of post.');
     }
     // Notice must be to the attention of this group
     if (empty($this->activity->context->attention)) {
         // TRANS: Client exception.
         throw new ClientException("Not to the attention of anyone.");
     } else {
         $uri = common_local_url('groupbyid', array('id' => $this->group->id));
         if (!array_key_exists($uri, $this->activity->context->attention)) {
             // TRANS: Client exception.
             throw new ClientException("Not to the attention of this group.");
         }
     }
     try {
         $this->saveNotice();
     } catch (AlreadyFulfilledException $e) {
         return;
     }
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:34,代码来源:groupsalmon.php

示例15: doPost

 protected function doPost()
 {
     try {
         $request = Subscription_queue::pkeyGet(array('subscriber' => $this->scoped->id, 'subscribed' => $this->target->id));
         if ($request instanceof Subscription_queue) {
             $request->abort();
         }
     } catch (AlreadyFulfilledException $e) {
         common_debug('Tried to cancel a non-existing pending subscription');
     }
     if (GNUsocial::isAjax()) {
         $this->startHTML('text/xml;charset=utf-8');
         $this->elementStart('head');
         // TRANS: Title after unsubscribing from a group.
         $this->element('title', null, _m('TITLE', 'Unsubscribed'));
         $this->elementEnd('head');
         $this->elementStart('body');
         $subscribe = new SubscribeForm($this, $this->target);
         $subscribe->show();
         $this->elementEnd('body');
         $this->endHTML();
         exit;
     }
     common_redirect(common_local_url('subscriptions', array('nickname' => $this->scoped->getNickname())), 303);
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:25,代码来源:cancelsubscription.php


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