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


PHP AphrontRequest::getSite方法代码示例

本文整理汇总了PHP中AphrontRequest::getSite方法的典型用法代码示例。如果您正苦于以下问题:PHP AphrontRequest::getSite方法的具体用法?PHP AphrontRequest::getSite怎么用?PHP AphrontRequest::getSite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AphrontRequest的用法示例。


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

示例1: handleRequest

 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $site = $request->getSite();
     if ($site instanceof PhameBlogSite) {
         $blog = $site->getBlog();
     } else {
         $id = $request->getURIData('id');
         $blog = id(new PhameBlogQuery())->setViewer($viewer)->withIDs(array($id))->executeOne();
         if (!$blog) {
             return new Aphront404Response();
         }
     }
     if ($blog->getDomain() && $request->getHost() != $blog->getDomain()) {
         $base_uri = $blog->getLiveURI();
         // Don't redirect directly, since the domain is user-controlled and there
         // are a bevy of security issues associated with automatic redirects to
         // external domains.
         // Previously we CSRF'd this and someone found a way to pass OAuth
         // information through it using anchors. Just make users click a normal
         // link so that this is no more dangerous than any other external link
         // on the site.
         $dialog = id(new AphrontDialogView())->setTitle(pht('Blog Moved'))->setUser($viewer)->appendParagraph(pht('This blog is now hosted here:'))->appendParagraph(phutil_tag('a', array('href' => $base_uri), $base_uri))->addCancelButton('/');
         return id(new AphrontDialogResponse())->setDialog($dialog);
     }
     $phame_request = clone $request;
     $more = $phame_request->getURIData('more', '');
     $phame_request->setPath('/' . ltrim($more, '/'));
     $uri = $blog->getLiveURI();
     $skin = $blog->getSkinRenderer($phame_request);
     $skin->setBlog($blog)->setBaseURI($uri);
     $skin->willProcessRequest(array());
     return $skin->processRequest();
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:34,代码来源:PhameBlogLiveController.php

示例2: isPhabricatorSite

 protected function isPhabricatorSite(AphrontRequest $request)
 {
     $site = $request->getSite();
     if (!$site) {
         return false;
     }
     return $site instanceof PhabricatorSite;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:8,代码来源:PhabricatorRequestExceptionHandler.php


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