本文整理汇总了PHP中AphrontRequest::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getPath方法的具体用法?PHP AphrontRequest::getPath怎么用?PHP AphrontRequest::getPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AphrontRequest
的用法示例。
在下文中一共展示了AphrontRequest::getPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: newSiteForRequest
public function newSiteForRequest(AphrontRequest $request)
{
if (!$this->isPhameActive()) {
return null;
}
$whitelist = array('/phame/r/');
$path = $request->getPath();
if (!$this->isPathPrefixMatch($path, $whitelist)) {
return null;
}
return new PhameBlogResourceSite();
}
示例2: newSiteForRequest
public function newSiteForRequest(AphrontRequest $request)
{
$host = $request->getHost();
$uri = PhabricatorEnv::getEnvConfig('security.alternate-file-domain');
if (!strlen($uri)) {
return null;
}
if ($this->isHostMatch($host, array($uri))) {
return new PhabricatorResourceSite();
}
// These are CDN routes, so we let them through even if the "Host" header
// doesn't match anything we recognize. The
$whitelist = array('/res/', '/file/data/', '/file/xform/');
$path = $request->getPath();
if ($this->isPathPrefixMatch($path, $whitelist)) {
return new PhabricatorResourceSite();
}
return null;
}
示例3: handleRequest
public function handleRequest(AphrontRequest $request)
{
$viewer = $request->getViewer();
$id = $request->getURIData('id');
$countdown = id(new PhabricatorCountdownQuery())->setViewer($viewer)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
if (!$countdown) {
return new Aphront404Response();
}
if ($request->isFormPost()) {
$countdown->delete();
return id(new AphrontRedirectResponse())->setURI('/countdown/');
}
$inst = pht('Are you sure you want to delete the countdown %s?', $countdown->getTitle());
$dialog = new AphrontDialogView();
$dialog->setUser($request->getUser());
$dialog->setTitle(pht('Really delete this countdown?'));
$dialog->appendChild(phutil_tag('p', array(), $inst));
$dialog->addSubmitButton(pht('Delete'));
$dialog->addCancelButton('/countdown/');
$dialog->setSubmitURI($request->getPath());
return id(new AphrontDialogResponse())->setDialog($dialog);
}
示例4: getPathForRouting
/**
* NOTE: This is temporary glue; eventually, sites will return an entire
* route map.
*/
public function getPathForRouting(AphrontRequest $request)
{
return $request->getPath();
}
示例5: renderContent
/**
* @task internal
*/
protected function renderContent(AphrontRequest $request)
{
$user = $request->getUser();
$matches = null;
$path = $request->getPath();
// default to the blog-wide values
$this->setTitle($this->getBlog()->getName());
$this->setDescription($this->getBlog()->getDescription());
$this->setOGType('website');
$this->setURIPath('');
if (preg_match('@^/post/(?P<name>.*)$@', $path, $matches)) {
$post = id(new PhamePostQuery())->setViewer($user)->withBlogPHIDs(array($this->getBlog()->getPHID()))->withPhameTitles(array($matches['name']))->executeOne();
if ($post) {
$description = $post->getMarkupText(PhamePost::MARKUP_FIELD_SUMMARY);
$this->setTitle($post->getTitle());
$this->setDescription($description);
$this->setOGType('article');
$this->setURIPath('post/' . $post->getPhameTitle());
$view = head($this->buildPostViews(array($post)));
return $this->renderPostDetail($view);
}
} else {
$pager = new AphrontCursorPagerView();
if (preg_match('@^/older/(?P<before>\\d+)/$@', $path, $matches)) {
$pager->setAfterID($matches['before']);
} else {
if (preg_match('@^/newer/(?P<after>\\d)/$@', $path, $matches)) {
$pager->setBeforeID($matches['after']);
} else {
if (preg_match('@^/$@', $path, $matches)) {
// Just show the first page.
} else {
return null;
}
}
}
$pager->setPageSize($this->getPageSize());
$posts = id(new PhamePostQuery())->setViewer($user)->withBlogPHIDs(array($this->getBlog()->getPHID()))->executeWithCursorPager($pager);
$this->pager = $pager;
if ($posts) {
$views = $this->buildPostViews($posts);
return $this->renderPostList($views);
}
}
return null;
}
示例6: getPathForRouting
public function getPathForRouting(AphrontRequest $request)
{
$path = $request->getPath();
$id = $this->getBlog()->getID();
return "/phame/live/{$id}/{$path}";
}