本文整理汇总了PHP中eZModule::redirectStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP eZModule::redirectStatus方法的具体用法?PHP eZModule::redirectStatus怎么用?PHP eZModule::redirectStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZModule
的用法示例。
在下文中一共展示了eZModule::redirectStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
/**
* Performs a redirection
*/
protected function redirect()
{
$GLOBALS['eZRedirection'] = true;
$ini = eZINI::instance();
$automaticRedirect = true;
if ($GLOBALS['eZDebugAllowed'] && ($redirUri = $ini->variable('DebugSettings', 'DebugRedirection')) !== 'disabled') {
if ($redirUri == "enabled") {
$automaticRedirect = false;
} else {
$uri = eZURI::instance(eZSys::requestURI());
$uri->toBeginning();
foreach ($ini->variableArray("DebugSettings", "DebugRedirection") as $redirUri) {
$redirUri = new eZURI($redirUri);
if ($redirUri->matchBase($uri)) {
$automaticRedirect = false;
break;
}
}
}
}
$redirectURI = eZSys::indexDir();
$moduleRedirectUri = $this->module->redirectURI();
if ($ini->variable('URLTranslator', 'Translation') === 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
$translatedModuleRedirectUri = $moduleRedirectUri;
if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
$moduleRedirectUri = $translatedModuleRedirectUri;
if (strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] !== '/') {
$moduleRedirectUri = '/' . $moduleRedirectUri;
}
}
}
if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
$redirectURI = $moduleRedirectUri;
} else {
$leftSlash = strlen($redirectURI) > 0 && $redirectURI[strlen($redirectURI) - 1] === '/';
$rightSlash = strlen($moduleRedirectUri) > 0 && $moduleRedirectUri[0] === '/';
if (!$leftSlash && !$rightSlash) {
// Both are without a slash, so add one
$moduleRedirectUri = '/' . $moduleRedirectUri;
} else {
if ($leftSlash && $rightSlash) {
// Both are with a slash, so we remove one
$moduleRedirectUri = substr($moduleRedirectUri, 1);
}
}
$redirectURI .= $moduleRedirectUri;
}
eZStaticCache::executeActions();
eZDB::checkTransactionCounter();
if ($automaticRedirect) {
eZHTTPTool::redirect($redirectURI, array(), $this->module->redirectStatus());
} else {
// Make sure any errors or warnings are reported
if ($ini->variable('DebugSettings', 'DisplayDebugWarnings') === 'enabled') {
if (isset($GLOBALS['eZDebugError']) && $GLOBALS['eZDebugError']) {
eZAppendWarningItem(array('error' => array('type' => 'error', 'number' => 1, 'count' => $GLOBALS['eZDebugErrorCount']), 'identifier' => 'ezdebug-first-error', 'text' => ezpI18n::tr('index.php', 'Some errors occurred, see debug for more information.')));
}
if (isset($GLOBALS['eZDebugWarning']) && $GLOBALS['eZDebugWarning']) {
eZAppendWarningItem(array('error' => array('type' => 'warning', 'number' => 1, 'count' => $GLOBALS['eZDebugWarningCount']), 'identifier' => 'ezdebug-first-warning', 'text' => ezpI18n::tr('index.php', 'Some general warnings occured, see debug for more information.')));
}
}
$tpl = eZTemplate::factory();
$tpl->setVariable('site', $this->site);
$tpl->setVariable('warning_list', !empty($this->warningList) ? $this->warningList : false);
$tpl->setVariable('redirect_uri', eZURI::encodeURL($redirectURI));
$templateResult = $tpl->fetch('design:redirect.tpl');
eZDebug::addTimingPoint("Script end");
eZDisplayResult($templateResult);
}
eZExecution::cleanExit();
}
示例2: foreach
} else {
$redirUris = $ini->variableArray("DebugSettings", "DebugRedirection");
$uri = eZURI::instance(eZSys::requestURI());
$uri->toBeginning();
foreach ($redirUris as $redirUri) {
$redirUri = new eZURI($redirUri);
if ($redirUri->matchBase($uri)) {
$automatic_redir = false;
break;
}
}
}
}
$redirectURI = eZSys::indexDir();
$moduleRedirectUri = $module->redirectURI();
$redirectStatus = $module->redirectStatus();
$translatedModuleRedirectUri = $moduleRedirectUri;
if ($ini->variable('URLTranslator', 'Translation') == 'enabled' && eZURLAliasML::urlTranslationEnabledByUri(new eZURI($moduleRedirectUri))) {
if (eZURLAliasML::translate($translatedModuleRedirectUri, true)) {
$moduleRedirectUri = $translatedModuleRedirectUri;
if (strlen($moduleRedirectUri) > 0 and $moduleRedirectUri[0] != '/') {
$moduleRedirectUri = '/' . $moduleRedirectUri;
}
}
}
if (preg_match('#^(\\w+:)|^//#', $moduleRedirectUri)) {
$redirectURI = $moduleRedirectUri;
} else {
$leftSlash = false;
$rightSlash = false;
if (strlen($redirectURI) > 0 and $redirectURI[strlen($redirectURI) - 1] == '/') {