本文整理汇总了PHP中phutil_escape_uri函数的典型用法代码示例。如果您正苦于以下问题:PHP phutil_escape_uri函数的具体用法?PHP phutil_escape_uri怎么用?PHP phutil_escape_uri使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了phutil_escape_uri函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
示例3: getPanelURI
protected function getPanelURI($path)
{
$user = $this->getProfileObject();
$username = $user->getUsername();
$username = phutil_escape_uri($username);
return "/p/{$username}/panel/{$path}";
}
示例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;
}
}
示例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;
}
示例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()));
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例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()));
}
示例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'));
}
示例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;
}
示例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'));
}