本文整理汇总了PHP中AphrontRequest::getRequestURI方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getRequestURI方法的具体用法?PHP AphrontRequest::getRequestURI怎么用?PHP AphrontRequest::getRequestURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontRequest
的用法示例。
在下文中一共展示了AphrontRequest::getRequestURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readFromRequest
public final function readFromRequest(AphrontRequest $request)
{
$this->uri = $request->getRequestURI();
$this->afterID = $request->getStr('after');
$this->beforeID = $request->getStr('before');
return $this;
}
示例2: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getUser();
$file = PhabricatorFile::initializeNewFile();
$e_file = true;
$errors = array();
if ($request->isFormPost()) {
$view_policy = $request->getStr('viewPolicy');
if (!$request->getFileExists('file')) {
$e_file = pht('Required');
$errors[] = pht('You must select a file to upload.');
} else {
$file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $viewer->getPHID(), 'viewPolicy' => $view_policy, 'isExplicitUpload' => true));
}
if (!$errors) {
return id(new AphrontRedirectResponse())->setURI($file->getInfoURI());
}
$file->setViewPolicy($view_policy);
}
$support_id = celerity_generate_unique_node_id();
$instructions = id(new AphrontFormMarkupControl())->setControlID($support_id)->setControlStyle('display: none')->setValue(hsprintf('<br /><br /><strong>%s</strong> %s<br /><br />', pht('Drag and Drop:'), pht('You can also upload files by dragging and dropping them from your ' . 'desktop onto this page or the Phabricator home page.')));
$policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($file)->execute();
$form = id(new AphrontFormView())->setUser($viewer)->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel(pht('File'))->setName('file')->setError($e_file))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name'))->setName('name')->setValue($request->getStr('name')))->appendChild(id(new AphrontFormPolicyControl())->setUser($viewer)->setCapability(PhabricatorPolicyCapability::CAN_VIEW)->setPolicyObject($file)->setPolicies($policies)->setName('viewPolicy'))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Upload'))->addCancelButton('/file/'))->appendChild($instructions);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Upload'), $request->getRequestURI());
$crumbs->setBorder(true);
$title = pht('Upload File');
$global_upload = id(new PhabricatorGlobalUploadTargetView())->setUser($viewer)->setShowIfSupportedID($support_id);
$form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('File'))->setFormErrors($errors)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($form);
$header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-upload');
$view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($form_box, $global_upload));
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
}
示例3: readFromRequest
public final function readFromRequest(AphrontRequest $request)
{
$this->uri = $request->getRequestURI();
$this->pagingParameter = 'offset';
$this->offset = $request->getInt($this->pagingParameter);
return $this;
}
示例4: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
if ($request->isFormPost()) {
$uri = $request->getRequestURI();
$project = head($request->getArr('set_project'));
$project = nonempty($project, null);
$uri = $uri->alter('project', $project);
$window = $request->getStr('set_window');
$uri = $uri->alter('window', $window);
return id(new AphrontRedirectResponse())->setURI($uri);
}
$nav = $this->buildNavMenu();
$this->view = $nav->selectFilter($this->view, 'List');
switch ($this->view) {
case 'list':
case 'user':
case 'project':
$core = id(new SprintReportOpenTasksView())->setUser($viewer)->setRequest($request)->setView($this->view);
break;
case 'burn':
$core = id(new SprintReportBurnUpView())->setUser($viewer)->setRequest($request);
break;
case 'history':
$core = id(new SprintHistoryTableView())->setUser($viewer)->setRequest($request);
break;
default:
return new Aphront404Response();
}
$can_create = $this->hasApplicationCapability(ProjectCreateProjectsCapability::CAPABILITY);
$nav->appendChild($core);
$nav->setCrumbs($this->buildSprintApplicationCrumbs($can_create)->setBorder(true)->addTextCrumb(pht('Reports')));
return $this->buildApplicationPage($nav, array('title' => pht('Sprint Reports'), 'device' => false));
}
示例5: handleRequest
public function handleRequest(AphrontRequest $request)
{
$this->viewer = $request->getViewer();
if ($request->isFormPost()) {
$uri = $request->getRequestURI();
$project = head($request->getArr('set_project'));
$project = nonempty($project, null);
$uri = $uri->alter('project', $project);
$window = $request->getStr('set_window');
$uri = $uri->alter('window', $window);
return id(new AphrontRedirectResponse())->setURI($uri);
}
$error_box = null;
$history_model = id(new SprintHistoryDataProvider())->setViewer($this->viewer)->setRequest($request)->execute();
try {
$sprintlist_table = id(new SprintHistoryTableView())->setViewer($this->viewer)->setRequest($request)->setTableData($history_model)->render();
} catch (Exception $e) {
$error_box = $this->getErrorBox($e);
}
$can_create = $this->hasApplicationCapability(ProjectCreateProjectsCapability::CAPABILITY);
$crumbs = $this->buildSprintApplicationCrumbs($can_create);
$crumbs->addTextCrumb(pht('Task Project History'));
$help = id(new PHUIBoxView())->appendChild(phutil_tag('p', array(), 'This is a history of tasks and logs when a project was added or removed'))->appendChild(phutil_tag('br', array(), ''))->appendChild(phutil_tag('p', array(), 'NOTE: The tasks are selected from the current tasks in the project. Tasks previously removed
will not appear!'))->addMargin(PHUI::MARGIN_LARGE);
$nav = $this->buildNavMenu();
$this->view = $nav->selectFilter($this->view, 'history');
$nav->appendChild(array($error_box, $crumbs, $help, $sprintlist_table));
return $this->buildApplicationPage($nav, array('title' => array(pht('Task Project History')), 'device' => true));
}
示例6: processDiffusionRequest
protected function processDiffusionRequest(AphrontRequest $request)
{
$limit = 500;
$offset = $request->getInt('offset', 0);
$drequest = $this->getDiffusionRequest();
$branch = $drequest->loadBranch();
$messages = $this->loadLintMessages($branch, $limit, $offset);
$is_dir = substr('/' . $drequest->getPath(), -1) == '/';
$authors = $this->loadViewerHandles(ipull($messages, 'authorPHID'));
$rows = array();
foreach ($messages as $message) {
$path = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'lint', 'path' => $message['path']))), substr($message['path'], strlen($drequest->getPath()) + 1));
$line = phutil_tag('a', array('href' => $drequest->generateURI(array('action' => 'browse', 'path' => $message['path'], 'line' => $message['line'], 'commit' => $branch->getLintCommit()))), $message['line']);
$author = $message['authorPHID'];
if ($author && $authors[$author]) {
$author = $authors[$author]->renderLink();
}
$rows[] = array($path, $line, $author, ArcanistLintSeverity::getStringForSeverity($message['severity']), $message['name'], $message['description']);
}
$table = id(new AphrontTableView($rows))->setHeaders(array(pht('Path'), pht('Line'), pht('Author'), pht('Severity'), pht('Name'), pht('Description')))->setColumnClasses(array('', 'n'))->setColumnVisibility(array($is_dir));
$content = array();
$pager = id(new AphrontPagerView())->setPageSize($limit)->setOffset($offset)->setHasMorePages(count($messages) >= $limit)->setURI($request->getRequestURI(), 'offset');
$content[] = id(new PHUIObjectBoxView())->setHeaderText(pht('Lint Details'))->appendChild($table);
$crumbs = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'lint'));
return $this->buildApplicationPage(array($crumbs, $content, $pager), array('title' => array(pht('Lint'), $drequest->getRepository()->getCallsign())));
}
示例7: handleRequest
public function handleRequest(AphrontRequest $request)
{
$phid = $request->getURIData('phid');
$file = id(new PhabricatorFileQuery())->setViewer($request->getUser())->withPHIDs(array($phid))->executeOne();
if (!$file) {
return new Aphront404Response();
}
$data = $file->loadFileData();
try {
$data = phutil_json_decode($data);
} catch (PhutilJSONParserException $ex) {
throw new PhutilProxyException(pht('Failed to unserialize XHProf profile!'), $ex);
}
$symbol = $request->getStr('symbol');
$is_framed = $request->getBool('frame');
if ($symbol) {
$view = new PhabricatorXHProfProfileSymbolView();
$view->setSymbol($symbol);
} else {
$view = new PhabricatorXHProfProfileTopLevelView();
$view->setFile($file);
$view->setLimit(100);
}
$view->setBaseURI($request->getRequestURI()->getPath());
$view->setIsFramed($is_framed);
$view->setProfileData($data);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('%s Profile', $symbol));
return $this->buildStandardPageResponse(array($crumbs, $view), array('title' => pht('Profile'), 'frame' => $is_framed));
}
示例8: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$pager = new PHUIPagerView();
$pager->setURI($request->getRequestURI(), 'page');
$pager->setOffset($request->getInt('page'));
$query = id(new PhabricatorTokenReceiverQuery());
$objects = $query->setViewer($viewer)->executeWithOffsetPager($pager);
$counts = $query->getTokenCounts();
$handles = array();
$phids = array();
if ($counts) {
$phids = mpull($objects, 'getPHID');
$handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
}
$list = new PHUIObjectItemListView();
foreach ($phids as $object) {
$count = idx($counts, $object, 0);
$item = id(new PHUIObjectItemView());
$handle = $handles[$object];
$item->setHeader($handle->getFullName());
$item->setHref($handle->getURI());
$item->addAttribute(pht('Tokens: %s', $count));
$list->addItem($item);
}
$title = pht('Token Leader Board');
$box = id(new PHUIObjectBoxView())->setHeaderText($title)->setObjectList($list);
$nav = $this->buildSideNav();
$nav->setCrumbs($this->buildApplicationCrumbs()->addTextCrumb($title));
$nav->selectFilter('leaders/');
$nav->appendChild($box);
$nav->appendChild($pager);
return $this->newPage()->setTitle($title)->appendChild($nav);
}
示例9: handleRequest
public function handleRequest(AphrontRequest $request)
{
$user = $request->getUser();
$nav = $this->renderSideNavFilterView(null);
$filter = $request->getURIData('filter');
$filter = $nav->selectFilter('blog/' . $filter, 'blog/user');
$query = id(new PhameBlogQuery())->setViewer($user);
switch ($filter) {
case 'blog/all':
$title = pht('All Blogs');
$nodata = pht('No blogs have been created.');
break;
case 'blog/user':
$title = pht('Joinable Blogs');
$nodata = pht('There are no blogs you can contribute to.');
$query->requireCapabilities(array(PhabricatorPolicyCapability::CAN_JOIN));
break;
default:
throw new Exception(pht("Unknown filter '%s'!", $filter));
}
$pager = id(new AphrontPagerView())->setURI($request->getRequestURI(), 'offset')->setOffset($request->getInt('offset'));
$blogs = $query->executeWithOffsetPager($pager);
$blog_list = $this->renderBlogList($blogs, $user, $nodata);
$blog_list->setPager($pager);
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb($title, $this->getApplicationURI());
$nav->appendChild(array($crumbs, $blog_list));
return $this->buildApplicationPage($nav, array('title' => $title));
}
示例10: getCallsign
private static function getCallsign(AphrontRequest $request)
{
$uri = $request->getRequestURI();
$regex = '@^/diffusion/(?P<callsign>[A-Z]+)(/|$)@';
$matches = null;
if (!preg_match($regex, (string) $uri, $matches)) {
return null;
}
return $matches['callsign'];
}
示例11: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$product = id(new PhortuneProductQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
if (!$product) {
return new Aphront404Response();
}
$title = pht('Product: %s', $product->getProductName());
$header = id(new PHUIHeaderView())->setHeader($product->getProductName());
$edit_uri = $this->getApplicationURI('product/edit/' . $product->getID() . '/');
$actions = id(new PhabricatorActionListView())->setUser($viewer)->setObjectURI($request->getRequestURI());
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Products'), $this->getApplicationURI('product/'));
$crumbs->addTextCrumb(pht('#%d', $product->getID()), $request->getRequestURI());
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions)->addProperty(pht('Price'), $product->getPriceAsCurrency()->formatForDisplay());
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
return $this->buildApplicationPage(array($crumbs, $object_box), array('title' => $title));
}
示例12: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$view = $request->getURIData('view');
if (!$view) {
$view = 'all';
}
$pager = new PHUIPagerView();
$pager->setOffset($request->getInt('page'));
switch ($view) {
case 'sampled':
$clause = 'sampleRate > 0';
$show_type = false;
break;
case 'my-runs':
$clause = qsprintf(id(new PhabricatorXHProfSample())->establishConnection('r'), 'sampleRate = 0 AND userPHID = %s', $request->getUser()->getPHID());
$show_type = false;
break;
case 'manual':
$clause = 'sampleRate = 0';
$show_type = false;
break;
case 'all':
default:
$clause = '1 = 1';
$show_type = true;
break;
}
$samples = id(new PhabricatorXHProfSample())->loadAllWhere('%Q ORDER BY id DESC LIMIT %d, %d', $clause, $pager->getOffset(), $pager->getPageSize() + 1);
$samples = $pager->sliceResults($samples);
$pager->setURI($request->getRequestURI(), 'page');
$list = new PHUIObjectItemListView();
foreach ($samples as $sample) {
$file_phid = $sample->getFilePHID();
$item = id(new PHUIObjectItemView())->setObjectName($sample->getID())->setHeader($sample->getRequestPath())->setHref($this->getApplicationURI('profile/' . $file_phid . '/'))->addAttribute(number_format($sample->getUsTotal()) . " μs");
if ($sample->getController()) {
$item->addAttribute($sample->getController());
}
$item->addAttribute($sample->getHostName());
$rate = $sample->getSampleRate();
if ($rate == 0) {
$item->addIcon('flag-6', pht('Manual Run'));
} else {
$item->addIcon('flag-7', pht('Sampled (1/%d)', $rate));
}
$item->addIcon('none', phabricator_datetime($sample->getDateCreated(), $viewer));
$list->addItem($item);
}
$list->setPager($pager);
$list->setNoDataString(pht('There are no profiling samples.'));
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('XHProf Samples'));
$title = pht('XHProf Samples');
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($list);
}
示例13: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$key = $request->getURIData('key');
$var = id(new PhluxVariableQuery())->setViewer($viewer)->withKeys(array($key))->executeOne();
if (!$var) {
return new Aphront404Response();
}
$crumbs = $this->buildApplicationCrumbs();
$title = $var->getVariableKey();
$crumbs->addTextCrumb($title, $request->getRequestURI());
$header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($var);
$actions = id(new PhabricatorActionListView())->setUser($viewer)->setObjectURI($request->getRequestURI())->setObject($var);
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $var, PhabricatorPolicyCapability::CAN_EDIT);
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Variable'))->setHref($this->getApplicationURI('/edit/' . $var->getVariableKey() . '/'))->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$display_value = json_encode($var->getVariableValue());
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($var)->setActionList($actions)->addProperty(pht('Value'), $display_value);
$timeline = $this->buildTransactionTimeline($var, new PhluxTransactionQuery());
$timeline->setShouldTerminate(true);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
return $this->buildApplicationPage(array($crumbs, $object_box, $timeline), array('title' => $title));
}
示例14: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$issue_key = $request->getURIData('key');
$issues = PhabricatorSetupCheck::runAllChecks();
PhabricatorSetupCheck::setOpenSetupIssueKeys(PhabricatorSetupCheck::getUnignoredIssueKeys($issues), $update_database = true);
if (empty($issues[$issue_key])) {
$content = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Issue Resolved'))->appendChild(pht('This setup issue has been resolved. '))->appendChild(phutil_tag('a', array('href' => $this->getApplicationURI('issue/')), pht('Return to Open Issue List')));
$title = pht('Resolved Issue');
} else {
$issue = $issues[$issue_key];
$content = $this->renderIssue($issue);
$title = $issue->getShortName();
}
$crumbs = $this->buildApplicationCrumbs()->setBorder(true)->addTextCrumb(pht('Setup Issues'), $this->getApplicationURI('issue/'))->addTextCrumb($title, $request->getRequestURI());
return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($content);
}
示例15: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $this->getViewer();
$authority = $this->loadMerchantAuthority();
$subscription_query = id(new PhortuneSubscriptionQuery())->setViewer($viewer)->withIDs(array($request->getURIData('id')))->needTriggers(true);
if ($authority) {
$subscription_query->withMerchantPHIDs(array($authority->getPHID()));
}
$subscription = $subscription_query->executeOne();
if (!$subscription) {
return new Aphront404Response();
}
$can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $subscription, PhabricatorPolicyCapability::CAN_EDIT);
$merchant = $subscription->getMerchant();
$account = $subscription->getAccount();
$account_id = $account->getID();
$subscription_id = $subscription->getID();
$title = $subscription->getSubscriptionFullName();
$header = id(new PHUIHeaderView())->setHeader($title);
$actions = id(new PhabricatorActionListView())->setUser($viewer)->setObjectURI($request->getRequestURI());
$edit_uri = $subscription->getEditURI();
$actions->addAction(id(new PhabricatorActionView())->setIcon('fa-pencil')->setName(pht('Edit Subscription'))->setHref($edit_uri)->setDisabled(!$can_edit)->setWorkflow(!$can_edit));
$crumbs = $this->buildApplicationCrumbs();
if ($authority) {
$this->addMerchantCrumb($crumbs, $merchant);
} else {
$this->addAccountCrumb($crumbs, $account);
}
$crumbs->addTextCrumb($subscription->getSubscriptionCrumbName());
$properties = id(new PHUIPropertyListView())->setUser($viewer)->setActionList($actions);
$next_invoice = $subscription->getTrigger()->getNextEventPrediction();
$properties->addProperty(pht('Next Invoice'), phabricator_datetime($next_invoice, $viewer));
$default_method = $subscription->getDefaultPaymentMethodPHID();
if ($default_method) {
$handles = $this->loadViewerHandles(array($default_method));
$autopay_method = $handles[$default_method]->renderLink();
} else {
$autopay_method = phutil_tag('em', array(), pht('No Autopay Method Configured'));
}
$properties->addProperty(pht('Autopay With'), $autopay_method);
$object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
$due_box = $this->buildDueInvoices($subscription, $authority);
$invoice_box = $this->buildPastInvoices($subscription, $authority);
return $this->buildApplicationPage(array($crumbs, $object_box, $due_box, $invoice_box), array('title' => $title));
}