本文整理汇总了PHP中Rewrite::isRedirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Rewrite::isRedirect方法的具体用法?PHP Rewrite::isRedirect怎么用?PHP Rewrite::isRedirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rewrite
的用法示例。
在下文中一共展示了Rewrite::isRedirect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: analyzeUrl
public function analyzeUrl()
{
// Check if URL is set in general
if (is_null($this->url)) {
throw new Exception("No request URL set!");
return;
}
// Check for rewrtite rules
$rewrite = new Rewrite($this->url);
$rewrite->applyRules();
if ($rewrite->getTargetUrl() != $this->url) {
if (!$rewrite->transportQueryParameter()) {
$_GET = array();
$_POST = array();
}
if ($rewrite->isRedirect()) {
$this->redirectToUrl($rewrite->getTargetUrl(), $_POST);
}
$this->setUrl($rewrite->getTargetUrl());
$this->analyzeRequest(!$rewrite->isLastForward());
}
// Check access rights to requested content
$access = new AccessOfficer("content", $this->content_id, $this->session->getUser(), $this->content_parents);
if (!$access->check()) {
// Access denied
if (!$access->getDeniedContentID()) {
// No content to be shown as 403 page set
// TODO set up default 403 (and 404) templates
throw new Exception("Access denied and no denied content defined!");
return;
}
// Should parameters be transported through the redirects / rewrites
if (!$access->transportQueryParameter()) {
$_GET = array();
$_POST = array();
}
// Show 403 error page or redirect if neccessary
$newcontent = new Content($access->getDeniedContentID());
if ($access->isRedirect() && $newcontent->getID() != $this->content_id) {
// Redirect, but keep requested URL as origin parameter
// TODO: keep origin request parameters as well!
$this->redirectToUrl("/" . $newcontent->getUrl() . "?origin=" . $this->url, $_POST);
}
$this->setUrl($newcontent->getUrl());
$this->analyzeRequest(!$access->isLastForward());
}
// TODO: HookPoints to manipulate this behaviour
}