• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP phutil_escape_uri函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: receiveMessage

 public function receiveMessage(PhabricatorIRCMessage $message)
 {
     switch ($message->getCommand()) {
         case 'PRIVMSG':
             $reply_to = $message->getReplyTo();
             if (!$reply_to) {
                 break;
             }
             if (!$this->isChannelName($reply_to)) {
                 // Don't log private messages, although maybe we should for debugging?
                 break;
             }
             $logs = array(array('channel' => $reply_to, 'type' => 'mesg', 'epoch' => time(), 'author' => $message->getSenderNickname(), 'message' => $message->getMessageText()));
             $this->futures[] = $this->getConduit()->callMethod('chatlog.record', array('logs' => $logs));
             $prompts = array('/where is the (chat)?log\\?/i', '/where am i\\?/i', '/what year is (this|it)\\?/i');
             $tell = false;
             foreach ($prompts as $prompt) {
                 if (preg_match($prompt, $message->getMessageText())) {
                     $tell = true;
                     break;
                 }
             }
             if ($tell) {
                 $response = $this->getURI('/chatlog/channel/' . phutil_escape_uri($reply_to) . '/');
                 $this->write('PRIVMSG', "{$reply_to} :{$response}");
             }
             break;
     }
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:29,代码来源:PhabricatorIRCLogHandler.php


示例2: buildIconNavView

 public function buildIconNavView(PhabricatorUser $user)
 {
     $viewer = $this->getViewer();
     $picture = $user->getProfileImageURI();
     $name = $user->getUsername();
     $nav = new AphrontSideNavFilterView();
     $nav->setIconNav(true);
     $nav->setBaseURI(new PhutilURI('/p/'));
     $nav->addIcon("{$name}/", $name, null, $picture);
     $class = 'PhabricatorCalendarApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $nav->addIcon("{$name}/calendar/", pht('Calendar'), 'fa-calendar');
     }
     $class = 'PhabricatorManiphestApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $phid = $user->getPHID();
         $view_uri = sprintf('/maniphest/?statuses=open()&assigned=%s#R', $phid);
         $nav->addIcon('maniphest', pht('Open Tasks'), 'fa-anchor', null, $view_uri);
     }
     $class = 'PhabricatorDifferentialApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $username = phutil_escape_uri($name);
         $view_uri = '/differential/?authors=' . $username;
         $nav->addIcon('differential', pht('Revisions'), 'fa-cog', null, $view_uri);
     }
     $class = 'PhabricatorAuditApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $username = phutil_escape_uri($name);
         $view_uri = '/audit/?authors=' . $username;
         $nav->addIcon('audit', pht('Commits'), 'fa-code', null, $view_uri);
     }
     return $nav;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:33,代码来源:PhabricatorPeopleController.php


示例3: getPanelURI

 protected function getPanelURI($path)
 {
     $user = $this->getProfileObject();
     $username = $user->getUsername();
     $username = phutil_escape_uri($username);
     return "/p/{$username}/panel/{$path}";
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:7,代码来源:PhabricatorPeopleProfilePanelEngine.php


示例4: receiveMessage

 public function receiveMessage(PhabricatorBotMessage $message)
 {
     switch ($message->getCommand()) {
         case 'MESSAGE':
             $target = $message->getTarget();
             if (!$target->isPublic()) {
                 // Don't log private messages, although maybe we should for debugging?
                 break;
             }
             $target_name = $target->getName();
             $logs = array(array('channel' => $target_name, 'type' => 'mesg', 'epoch' => time(), 'author' => $message->getSender()->getName(), 'message' => $message->getBody(), 'serviceName' => $this->getServiceName(), 'serviceType' => $this->getServiceType()));
             $this->futures[] = $this->getConduit()->callMethod('chatlog.record', array('logs' => $logs));
             $prompts = array('/where is the (chat)?log\\?/i', '/where am i\\?/i', '/what year is (this|it)\\?/i');
             $tell = false;
             foreach ($prompts as $prompt) {
                 if (preg_match($prompt, $message->getBody())) {
                     $tell = true;
                     break;
                 }
             }
             if ($tell) {
                 $response = $this->getURI('/chatlog/channel/' . phutil_escape_uri($target_name) . '/');
                 $this->replyTo($message, $response);
             }
             break;
     }
 }
开发者ID:pugong,项目名称:phabricator,代码行数:27,代码来源:PhabricatorBotLogHandler.php


示例5: __toString

 public function __toString()
 {
     $prefix = null;
     if ($this->protocol || $this->domain || $this->port) {
         $protocol = nonempty($this->protocol, 'http');
         $auth = '';
         if (strlen($this->user) && strlen($this->pass)) {
             $auth = phutil_escape_uri($this->user) . ':' . phutil_escape_uri($this->pass) . '@';
         } else {
             if (strlen($this->user)) {
                 $auth = phutil_escape_uri($this->user) . '@';
             }
         }
         $prefix = $protocol . '://' . $auth . $this->domain;
         if ($this->port) {
             $prefix .= ':' . $this->port;
         }
     }
     if ($this->query) {
         $query = '?' . http_build_query($this->query);
     } else {
         $query = null;
     }
     if (strlen($this->getFragment())) {
         $fragment = '#' . $this->getFragment();
     } else {
         $fragment = null;
     }
     return $prefix . $this->getPath() . $query . $fragment;
 }
开发者ID:jasteele12,项目名称:prb_lint_tests,代码行数:30,代码来源:PhutilURI.php


示例6: processRequest

 public function processRequest()
 {
     $viewer = $this->getRequest()->getUser();
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needBadges(true)->needProfileImage(true)->needAvailability(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $profile = $user->loadUserProfile();
     $username = phutil_escape_uri($user->getUserName());
     $picture = $user->getProfileImageURI();
     $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader($profile->getTitle())->setImage($picture);
     $actions = id(new PhabricatorActionListView())->setObject($user)->setUser($viewer);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Profile'))->setHref($this->getApplicationURI('editprofile/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-picture-o')->setName(pht('Edit Profile Picture'))->setHref($this->getApplicationURI('picture/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $class = 'PhabricatorConpherenceApplication';
     if (PhabricatorApplication::isClassInstalledForViewer($class, $viewer)) {
         $href = id(new PhutilURI('/conpherence/new/'))->setQueryParam('participant', $user->getPHID());
         $can_send = $viewer->isLoggedIn();
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-comments')->setName(pht('Send Message'))->setWorkflow(true)->setDisabled(!$can_send)->setHref($href));
     }
     if ($viewer->getIsAdmin()) {
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-wrench')->setName(pht('Edit Settings'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref('/settings/' . $user->getID() . '/'));
         if ($user->getIsAdmin()) {
             $empower_icon = 'fa-arrow-circle-o-down';
             $empower_name = pht('Remove Administrator');
         } else {
             $empower_icon = 'fa-arrow-circle-o-up';
             $empower_name = pht('Make Administrator');
         }
         $actions->addAction(id(new PhabricatorActionView())->setIcon($empower_icon)->setName($empower_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('empower/' . $user->getID() . '/')));
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-tag')->setName(pht('Change Username'))->setWorkflow(true)->setHref($this->getApplicationURI('rename/' . $user->getID() . '/')));
         if ($user->getIsDisabled()) {
             $disable_icon = 'fa-check-circle-o';
             $disable_name = pht('Enable User');
         } else {
             $disable_icon = 'fa-ban';
             $disable_name = pht('Disable User');
         }
         $actions->addAction(id(new PhabricatorActionView())->setIcon($disable_icon)->setName($disable_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('disable/' . $user->getID() . '/')));
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-times')->setName(pht('Delete User'))->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('delete/' . $user->getID() . '/')));
         $can_welcome = $user->canEstablishWebSessions();
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-envelope')->setName(pht('Send Welcome Email'))->setWorkflow(true)->setDisabled(!$can_welcome)->setHref($this->getApplicationURI('welcome/' . $user->getID() . '/')));
     }
     $properties = $this->buildPropertyView($user, $actions);
     $name = $user->getUsername();
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($name);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $feed = id(new PHUIObjectBoxView())->setHeaderText(pht('Recent Activity'))->appendChild($this->buildPeopleFeed($user, $viewer));
     $badges = $this->buildBadgesView($user);
     $nav = $this->buildIconNavView($user);
     $nav->selectFilter("{$name}/");
     $nav->appendChild($object_box);
     $nav->appendChild($badges);
     $nav->appendChild($feed);
     return $this->buildApplicationPage($nav, array('title' => $user->getUsername()));
 }
开发者ID:barcelonascience,项目名称:phabricator,代码行数:58,代码来源:PhabricatorPeopleProfileController.php


示例7: getJumpResponse

 public static function getJumpResponse(PhabricatorUser $viewer, $jump)
 {
     $jump = trim($jump);
     $help_href = PhabricatorEnv::getDocLink('Jump Nav User Guide');
     $patterns = array('/^help/i' => 'uri:' . $help_href, '/^a$/i' => 'uri:/audit/', '/^f$/i' => 'uri:/feed/', '/^d$/i' => 'uri:/differential/', '/^r$/i' => 'uri:/diffusion/', '/^t$/i' => 'uri:/maniphest/', '/^p$/i' => 'uri:/project/', '/^u$/i' => 'uri:/people/', '/^p\\s+(.+)$/i' => 'project', '/^u\\s+(\\S+)$/i' => 'user', '/^task:\\s*(.+)/i' => 'create-task', '/^(?:s|symbol)\\s+(\\S+)/i' => 'find-symbol', '/^r\\s+(.+)$/i' => 'find-repository');
     foreach ($patterns as $pattern => $effect) {
         $matches = null;
         if (preg_match($pattern, $jump, $matches)) {
             if (!strncmp($effect, 'uri:', 4)) {
                 return id(new AphrontRedirectResponse())->setURI(substr($effect, 4));
             } else {
                 switch ($effect) {
                     case 'user':
                         return id(new AphrontRedirectResponse())->setURI('/p/' . $matches[1] . '/');
                     case 'project':
                         $project = self::findCloselyNamedProject($matches[1]);
                         if ($project) {
                             return id(new AphrontRedirectResponse())->setURI('/project/view/' . $project->getID() . '/');
                         } else {
                             $jump = $matches[1];
                         }
                         break;
                     case 'find-symbol':
                         $context = '';
                         $symbol = $matches[1];
                         $parts = array();
                         if (preg_match('/(.*)(?:\\.|::|->)(.*)/', $symbol, $parts)) {
                             $context = '&context=' . phutil_escape_uri($parts[1]);
                             $symbol = $parts[2];
                         }
                         return id(new AphrontRedirectResponse())->setURI("/diffusion/symbol/{$symbol}/?jump=true{$context}");
                     case 'find-repository':
                         $name = $matches[1];
                         $repositories = id(new PhabricatorRepositoryQuery())->setViewer($viewer)->withNameContains($name)->execute();
                         if (count($repositories) == 1) {
                             // Just one match, jump to repository.
                             $uri = '/diffusion/' . head($repositories)->getCallsign() . '/';
                         } else {
                             // More than one match, jump to search.
                             $uri = urisprintf('/diffusion/?order=name&name=%s', $name);
                         }
                         return id(new AphrontRedirectResponse())->setURI($uri);
                     case 'create-task':
                         return id(new AphrontRedirectResponse())->setURI('/maniphest/task/create/?title=' . phutil_escape_uri($matches[1]));
                     default:
                         throw new Exception("Unknown jump effect '{$effect}'!");
                 }
             }
         }
     }
     // If none of the patterns matched, look for an object by name.
     $objects = id(new PhabricatorObjectQuery())->setViewer($viewer)->withNames(array($jump))->execute();
     if (count($objects) == 1) {
         $handle = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs(mpull($objects, 'getPHID'))->executeOne();
         return id(new AphrontRedirectResponse())->setURI($handle->getURI());
     }
     return null;
 }
开发者ID:denghp,项目名称:phabricator,代码行数:58,代码来源:PhabricatorJumpNavHandler.php


示例8: renderUserItems

 private function renderUserItems(PhutilEvent $event)
 {
     if (!$this->canUseApplication($event->getUser())) {
         return null;
     }
     $user = $event->getValue('object');
     $username = phutil_escape_uri($user->getUsername());
     $view_uri = '/audit/?authors=' . $username;
     return id(new PhabricatorActionView())->setIcon('fa-check-circle-o')->setName(pht('View Commits'))->setHref($view_uri);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:10,代码来源:AuditActionMenuEventListener.php


示例9: getViewURI

 public function getViewURI($blogger_name = '')
 {
     // go for the pretty uri if we can
     if ($blogger_name) {
         $phame_title = PhabricatorSlug::normalize($this->getPhameTitle());
         $uri = phutil_escape_uri('/phame/posts/' . $blogger_name . '/' . $phame_title);
     } else {
         $uri = $this->getActionURI('view');
     }
     return $uri;
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:11,代码来源:PhamePost.php


示例10: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     // Redirect "/panel/XYZ/" to the viewer's personal settings panel. This
     // was the primary URI before global settings were introduced and allows
     // generation of viewer-agnostic URIs for email.
     $panel = $request->getURIData('panel');
     if ($panel) {
         $panel = phutil_escape_uri($panel);
         $username = $viewer->getUsername();
         $panel_uri = "/user/{$username}/page/{$panel}/";
         $panel_uri = $this->getApplicationURI($panel_uri);
         return id(new AphrontRedirectResponse())->setURI($panel_uri);
     }
     $username = $request->getURIData('username');
     $builtin = $request->getURIData('builtin');
     $key = $request->getURIData('pageKey');
     if ($builtin) {
         $this->builtinKey = $builtin;
         $preferences = id(new PhabricatorUserPreferencesQuery())->setViewer($viewer)->withBuiltinKeys(array($builtin))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if (!$preferences) {
             $preferences = id(new PhabricatorUserPreferences())->attachUser(null)->setBuiltinKey($builtin);
         }
     } else {
         $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($username))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if (!$user) {
             return new Aphront404Response();
         }
         $preferences = PhabricatorUserPreferences::loadUserPreferences($user);
         $this->user = $user;
     }
     if (!$preferences) {
         return new Aphront404Response();
     }
     PhabricatorPolicyFilter::requireCapability($viewer, $preferences, PhabricatorPolicyCapability::CAN_EDIT);
     $this->preferences = $preferences;
     $panels = $this->buildPanels($preferences);
     $nav = $this->renderSideNav($panels);
     $key = $nav->selectFilter($key, head($panels)->getPanelKey());
     $panel = $panels[$key]->setController($this)->setNavigation($nav);
     $response = $panel->processRequest($request);
     if ($response instanceof AphrontResponse || $response instanceof AphrontResponseProducerInterface) {
         return $response;
     }
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($panel->getPanelName());
     $title = $panel->getPanelName();
     $view = id(new PHUITwoColumnView())->setNavigation($nav)->setMainColumn($response);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:50,代码来源:PhabricatorSettingsMainController.php


示例11: jumpPostResponse

 public static function jumpPostResponse($jump)
 {
     $jump = trim($jump);
     $help_href = PhabricatorEnv::getDocLink('article/Jump_Nav_User_Guide.html');
     $patterns = array('/^help/i' => 'uri:' . $help_href, '/^a$/i' => 'uri:/audit/', '/^f$/i' => 'uri:/feed/', '/^d$/i' => 'uri:/differential/', '/^r$/i' => 'uri:/diffusion/', '/^t$/i' => 'uri:/maniphest/', '/^p$/i' => 'uri:/project/', '/^u$/i' => 'uri:/people/', '/^r([A-Z]+)$/' => 'repository', '/^r([A-Z]+)(\\S+)$/' => 'commit', '/^d(\\d+)$/i' => 'revision', '/^t(\\d+)$/i' => 'task', '/^p\\s+(.+)$/i' => 'project', '/^u\\s+(\\S+)$/i' => 'user', '/^task:\\s*(.+)/i' => 'create-task', '/^(?:s|symbol)\\s+(\\S+)/i' => 'find-symbol');
     foreach ($patterns as $pattern => $effect) {
         $matches = null;
         if (preg_match($pattern, $jump, $matches)) {
             if (!strncmp($effect, 'uri:', 4)) {
                 return id(new AphrontRedirectResponse())->setURI(substr($effect, 4));
             } else {
                 switch ($effect) {
                     case 'repository':
                         return id(new AphrontRedirectResponse())->setURI('/diffusion/' . $matches[1] . '/');
                     case 'commit':
                         return id(new AphrontRedirectResponse())->setURI('/' . $matches[0]);
                     case 'revision':
                         return id(new AphrontRedirectResponse())->setURI('/D' . $matches[1]);
                     case 'task':
                         return id(new AphrontRedirectResponse())->setURI('/T' . $matches[1]);
                     case 'user':
                         return id(new AphrontRedirectResponse())->setURI('/p/' . $matches[1] . '/');
                     case 'project':
                         $project = self::findCloselyNamedProject($matches[1]);
                         if ($project) {
                             return id(new AphrontRedirectResponse())->setURI('/project/view/' . $project->getID() . '/');
                         } else {
                             $jump = $matches[1];
                         }
                         break;
                     case 'find-symbol':
                         $context = '';
                         $symbol = $matches[1];
                         $parts = array();
                         if (preg_match('/(.*)(?:\\.|::|->)(.*)/', $symbol, $parts)) {
                             $context = '&context=' . phutil_escape_uri($parts[1]);
                             $symbol = $parts[2];
                         }
                         return id(new AphrontRedirectResponse())->setURI("/diffusion/symbol/{$symbol}/?jump=true{$context}");
                     case 'create-task':
                         return id(new AphrontRedirectResponse())->setURI('/maniphest/task/create/?title=' . phutil_escape_uri($matches[1]));
                     default:
                         throw new Exception("Unknown jump effect '{$effect}'!");
                 }
             }
         }
     }
     return null;
 }
开发者ID:neoxen,项目名称:phabricator,代码行数:49,代码来源:PhabricatorJumpNavHandler.php


示例12: processRequest

 public function processRequest()
 {
     $viewer = $this->getRequest()->getUser();
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needProfileImage(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     require_celerity_resource('phabricator-profile-css');
     $profile = $user->loadUserProfile();
     $username = phutil_escape_uri($user->getUserName());
     $picture = $user->loadProfileImageURI();
     $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader($profile->getTitle())->setImage($picture);
     $actions = id(new PhabricatorActionListView())->setObject($user)->setObjectURI($this->getRequest()->getRequestURI())->setUser($viewer);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Profile'))->setHref($this->getApplicationURI('editprofile/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-picture-o')->setName(pht('Edit Profile Picture'))->setHref($this->getApplicationURI('picture/' . $user->getID() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
     if ($viewer->getIsAdmin()) {
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-wrench')->setName(pht('Edit Settings'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit)->setHref('/settings/' . $user->getID() . '/'));
         if ($user->getIsAdmin()) {
             $empower_icon = 'fa-arrow-circle-o-down';
             $empower_name = pht('Remove Administrator');
         } else {
             $empower_icon = 'fa-arrow-circle-o-up';
             $empower_name = pht('Make Administrator');
         }
         $actions->addAction(id(new PhabricatorActionView())->setIcon($empower_icon)->setName($empower_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('empower/' . $user->getID() . '/')));
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-tag')->setName(pht('Change Username'))->setWorkflow(true)->setHref($this->getApplicationURI('rename/' . $user->getID() . '/')));
         if ($user->getIsDisabled()) {
             $disable_icon = 'fa-check-circle-o';
             $disable_name = pht('Enable User');
         } else {
             $disable_icon = 'fa-ban';
             $disable_name = pht('Disable User');
         }
         $actions->addAction(id(new PhabricatorActionView())->setIcon($disable_icon)->setName($disable_name)->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('disable/' . $user->getID() . '/')));
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-times')->setName(pht('Delete User'))->setDisabled($user->getPHID() == $viewer->getPHID())->setWorkflow(true)->setHref($this->getApplicationURI('delete/' . $user->getID() . '/')));
         $actions->addAction(id(new PhabricatorActionView())->setIcon('fa-envelope')->setName(pht('Send Welcome Email'))->setWorkflow(true)->setHref($this->getApplicationURI('welcome/' . $user->getID() . '/')));
     }
     $properties = $this->buildPropertyView($user, $actions);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($user->getUsername());
     $crumbs->setActionList($actions);
     $feed = $this->renderUserFeed($user);
     $calendar = $this->renderUserCalendar($user);
     $activity = phutil_tag('div', array('class' => 'profile-activity-view grouped'), array($calendar, $feed));
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     return $this->buildApplicationPage(array($crumbs, $object_box, $activity), array('title' => $user->getUsername()));
 }
开发者ID:denghp,项目名称:phabricator,代码行数:48,代码来源:PhabricatorPeopleProfileController.php


示例13: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $nav = $this->buildNavAndSelectFilter();
     if ($request->isFormPost()) {
         // If the list filter is POST'ed, redirect to GET so the page can be
         // bookmarked.
         $uri = $request->getRequestURI();
         $phid = head($request->getArr('set_phid'));
         $user = id(new PhabricatorUser())->loadOneWhere('phid = %s', $phid);
         $uri = $request->getRequestURI();
         if ($user) {
             $username = phutil_escape_uri($user->getUsername());
             $uri = '/audit/view/' . $this->filter . '/' . $username . '/';
         } else {
             if ($phid) {
                 $uri = $request->getRequestURI();
                 $uri = $uri->alter('phid', $phid);
             }
         }
         return id(new AphrontRedirectResponse())->setURI($uri);
     }
     $this->filterStatus = $request->getStr('status', 'all');
     $handle = $this->loadHandle();
     $nav->appendChild($this->buildListFilters($handle));
     $title = null;
     $message = null;
     if (!$handle) {
         switch ($this->filter) {
             case 'project':
                 $title = 'Choose A Project';
                 $message = 'Choose a project to view audits for.';
                 break;
             case 'package':
             case 'packagecommits':
                 $title = 'Choose a Package';
                 $message = 'Choose a package to view audits for.';
                 break;
         }
     }
     if (!$message) {
         $nav->appendChild($this->buildViews($handle));
     } else {
         $panel = id(new AphrontErrorView())->setSeverity(AphrontErrorView::SEVERITY_NODATA)->setTitle($title)->appendChild($message);
         $nav->appendChild($panel);
     }
     return $this->buildStandardPageResponse($nav, array('title' => 'Audits'));
 }
开发者ID:ramons03,项目名称:phabricator,代码行数:48,代码来源:PhabricatorAuditListController.php


示例14: buildSideNav

 protected final function buildSideNav($selected, $has_change_view)
 {
     $nav = new AphrontSideNavView();
     $navs = array('history' => 'History View', 'browse' => 'Browse View', 'change' => 'Change View');
     if (!$has_change_view) {
         unset($navs['change']);
     }
     $drequest = $this->getDiffusionRequest();
     foreach ($navs as $action => $name) {
         $href = $drequest->generateURI(array('action' => $action));
         $nav->addNavItem(phutil_render_tag('a', array('href' => $href, 'class' => $action == $selected ? 'aphront-side-nav-selected' : null), $name));
     }
     // TODO: URI encoding might need to be sorted out for this link.
     $nav->addNavItem(phutil_render_tag('a', array('href' => '/owners/view/search/' . '?repository=' . phutil_escape_uri($drequest->getCallsign()) . '&path=' . phutil_escape_uri('/' . $drequest->getPath())), 'Search Owners'));
     return $nav;
 }
开发者ID:rudimk,项目名称:phabricator,代码行数:16,代码来源:DiffusionController.php


示例15: processRequest

 public function processRequest()
 {
     $table = new PhabricatorChatLogEvent();
     $channels = queryfx_all($table->establishConnection('r'), 'SELECT DISTINCT channel FROM %T', $table->getTableName());
     $rows = array();
     foreach ($channels as $channel) {
         $name = $channel['channel'];
         $rows[] = array(phutil_render_tag('a', array('href' => '/chatlog/channel/' . phutil_escape_uri($name) . '/'), phutil_escape_html($name)));
     }
     $table = new AphrontTableView($rows);
     $table->setHeaders(array('Channel'));
     $table->setColumnClasses(array('pri wide'));
     $panel = new AphrontPanelView();
     $panel->appendChild($table);
     return $this->buildStandardPageResponse($panel, array('title' => 'Channel List'));
 }
开发者ID:nexeck,项目名称:phabricator,代码行数:16,代码来源:PhabricatorChatLogChannelListController.php


示例16: getSlugURI

 public static function getSlugURI($slug, $type = 'document')
 {
     static $types = array('document' => '/w/', 'history' => '/phriction/history/');
     if (empty($types[$type])) {
         throw new Exception("Unknown URI type '{$type}'!");
     }
     $prefix = $types[$type];
     if ($slug == '/') {
         return $prefix;
     } else {
         // NOTE: The effect here is to escape non-latin characters, since modern
         // browsers deal with escaped UTF8 characters in a reasonable way (showing
         // the user a readable URI) but older programs may not.
         $slug = phutil_escape_uri($slug);
         return $prefix . $slug;
     }
 }
开发者ID:denghp,项目名称:phabricator,代码行数:17,代码来源:PhrictionDocument.php


示例17: xsprintf_uri

/**
 * uri_sprintf() callback for URI encoding.
 * @group markup
 */
function xsprintf_uri($userdata, &$pattern, &$pos, &$value, &$length)
{
    $type = $pattern[$pos];
    switch ($type) {
        case 's':
            $value = phutil_escape_uri($value);
            $type = 's';
            break;
        case 'p':
            $value = phutil_escape_uri_path_component($value);
            $type = 's';
            break;
        case 'R':
            $type = 's';
            break;
    }
    $pattern[$pos] = $type;
}
开发者ID:jasteele12,项目名称:prb_lint_tests,代码行数:22,代码来源:urisprintf.php


示例18: processRequest

 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     if ($request->isFormPost()) {
         $files = $request->getArr('file');
         if (count($files) > 1) {
             return id(new AphrontRedirectResponse())->setURI('/file/?author=' . phutil_escape_uri($user->getUserName()));
         } else {
             return id(new AphrontRedirectResponse())->setURI('/file/info/' . end($files) . '/');
         }
     }
     $panel_id = celerity_generate_unique_node_id();
     $form = new AphrontFormView();
     $form->setAction('/file/upload/');
     $form->setUser($request->getUser());
     $form->setEncType('multipart/form-data')->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Files')->setName('file')->setError(true)->setDragAndDropTarget($panel_id)->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Done here!'));
     $panel = new AphrontPanelView();
     $panel->setHeader('Upload File');
     $panel->appendChild($form);
     $panel->setWidth(AphrontPanelView::WIDTH_FORM);
     $panel->setID($panel_id);
     return $this->buildStandardPageResponse(array($panel), array('title' => 'Upload File'));
 }
开发者ID:hunterbridges,项目名称:phabricator,代码行数:24,代码来源:PhabricatorFileUploadController.php


示例19: getProxyImageURI

 public static function getProxyImageURI($uri)
 {
     return '/file/proxy/?uri=' . phutil_escape_uri($uri);
 }
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:4,代码来源:PhabricatorFileProxyImage.php


示例20: generateDiffusionURI

 /**
  * Generate a Diffusion URI from a parameter map. Applies the correct encoding
  * and formatting to the URI. Parameters are:
  *
  *   - `action` One of `history`, `browse`, `change`, `lastmodified`,
  *     `branch`, `tags`, `branches`,  or `revision-ref`. The action specified
  *      by the URI.
  *   - `repository` Repository.
  *   - `callsign` Repository callsign.
  *   - `branch` Optional if action is not `branch`, branch name.
  *   - `path` Optional, path to file.
  *   - `commit` Optional, commit identifier.
  *   - `line` Optional, line range.
  *   - `lint` Optional, lint code.
  *   - `params` Optional, query parameters.
  *
  * The function generates the specified URI and returns it.
  *
  * @param   map         See documentation.
  * @return  PhutilURI   Generated URI.
  * @task uri
  */
 public static function generateDiffusionURI(array $params)
 {
     $action = idx($params, 'action');
     $repository = idx($params, 'repository');
     if ($repository) {
         $callsign = $repository->getCallsign();
     } else {
         $callsign = idx($params, 'callsign');
     }
     $path = idx($params, 'path');
     $branch = idx($params, 'branch');
     $commit = idx($params, 'commit');
     $line = idx($params, 'line');
     if (strlen($callsign)) {
         $callsign = phutil_escape_uri_path_component($callsign) . '/';
     }
     if (strlen($branch)) {
         $branch = phutil_escape_uri_path_component($branch) . '/';
     }
     if (strlen($path)) {
         $path = ltrim($path, '/');
         $path = str_replace(array(';', '$'), array(';;', '$$'), $path);
         $path = phutil_escape_uri($path);
     }
     $path = "{$branch}{$path}";
     if (strlen($commit)) {
         $commit = str_replace('$', '$$', $commit);
         $commit = ';' . phutil_escape_uri($commit);
     }
     if (strlen($line)) {
         $line = '$' . phutil_escape_uri($line);
     }
     $req_callsign = false;
     $req_branch = false;
     $req_commit = false;
     switch ($action) {
         case 'history':
         case 'browse':
         case 'change':
         case 'lastmodified':
         case 'tags':
         case 'branches':
         case 'lint':
         case 'refs':
             $req_callsign = true;
             break;
         case 'branch':
             $req_callsign = true;
             $req_branch = true;
             break;
         case 'commit':
             $req_callsign = true;
             $req_commit = true;
             break;
     }
     if ($req_callsign && !strlen($callsign)) {
         throw new Exception(pht("Diffusion URI action '%s' requires callsign!", $action));
     }
     if ($req_commit && !strlen($commit)) {
         throw new Exception(pht("Diffusion URI action '%s' requires commit!", $action));
     }
     switch ($action) {
         case 'change':
         case 'history':
         case 'browse':
         case 'lastmodified':
         case 'tags':
         case 'branches':
         case 'lint':
         case 'pathtree':
         case 'refs':
             $uri = "/diffusion/{$callsign}{$action}/{$path}{$commit}{$line}";
             break;
         case 'branch':
             if (strlen($path)) {
                 $uri = "/diffusion/{$callsign}repository/{$path}";
             } else {
                 $uri = "/diffusion/{$callsign}";
//.........这里部分代码省略.........
开发者ID:demon,项目名称:phabricator,代码行数:101,代码来源:DiffusionRequest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP phutil_format_bytes函数代码示例发布时间:2022-05-15
下一篇:
PHP phutil_escape_html_newlines函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap