本文整理汇总了PHP中XenForo_Error::noViewRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Error::noViewRenderer方法的具体用法?PHP XenForo_Error::noViewRenderer怎么用?PHP XenForo_Error::noViewRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Error
的用法示例。
在下文中一共展示了XenForo_Error::noViewRenderer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runXenDynamic
public function runXenDynamic($html)
{
global $XenDynamic_indexFile, $XenDynamic_container;
ob_start();
$this->setup();
$this->_request->setBasePath(XenForo_Link::convertUriToAbsoluteUri("{$XenDynamic_indexFile}"));
$this->setRequestPaths();
$showDebugOutput = $this->showDebugOutput();
$this->_dependencies->preLoadData();
XenForo_CodeEvent::fire('front_controller_pre_route', array($this));
$routeMatch = $this->route();
XenForo_CodeEvent::fire('front_controller_pre_dispatch', array($this, &$routeMatch));
$controllerResponse = $this->dispatch($routeMatch);
$controllerResponse = new XenForo_ControllerResponse_View();
$controllerResponse->templateName = "XenDynamic";
$controllerResponse->viewName = "XenDynamic_Index";
/*
$title = "";
if(preg_match('/<title>(.*?)<\/title>/i', $html, $matches) && count($matches) == 2){
$title = $matches[1];
}
$controllerResponse->params = array(
'title' => $title,
'html' => $html
);
*/
$viewRenderer = $this->_getViewRenderer('html');
if (!$viewRenderer) {
XenForo_Error::noViewRenderer($this->_request);
exit;
}
$viewRenderer->setNeedsContainer($XenDynamic_container);
$containerParams = array();
XenForo_CodeEvent::fire('front_controller_pre_view', array($this, &$controllerResponse, &$viewRenderer, &$containerParams));
$content = $this->renderView($controllerResponse, $viewRenderer, $containerParams);
if ($showDebugOutput) {
$content = $this->renderDebugOutput($content);
}
$bufferedContents = ob_get_contents();
ob_end_clean();
if ($bufferedContents !== '') {
$content = $bufferedContents . $content;
}
XenForo_CodeEvent::fire('front_controller_post_view', array($this, &$content));
/*
if ($this->_sendResponse)
{
$headers = $this->_response->getHeaders();
$isText = false;
foreach ($headers AS $header)
{
if ($header['name'] == 'Content-Type')
{
if (strpos($header['value'], 'text/') === 0)
{
$isText = true;
}
break;
}
}
if ($isText && is_string($content) && $content)
{
$extraHeaders = XenForo_Application::gzipContentIfSupported($content);
foreach ($extraHeaders AS $extraHeader)
{
$this->_response->setHeader($extraHeader[0], $extraHeader[1], $extraHeader[2]);
}
}
if (is_string($content) && $content && !ob_get_level() && XenForo_Application::get('config')->enableContentLength)
{
$this->_response->setHeader('Content-Length', strlen($content), true);
}
$this->_response->sendHeaders();
if ($content instanceof XenForo_FileOutput)
{
$content->output();
}
else
{
echo $content;
}
}
else
{
*/
return $content;
// }
}
示例2: run
/**
* Runs the request, handling from routing straight through to response output.
* Primary method to be used by the external API.
*
* @return string|null Returns a string if {@link $_sendResponse} is false
*/
public function run()
{
ob_start();
XenForo_Application::set('fc', $this);
$this->setup();
$this->setRequestPaths();
$showDebugOutput = $this->showDebugOutput();
$this->_dependencies->preLoadData();
XenForo_CodeEvent::fire('front_controller_pre_route', array($this));
$routeMatch = $this->route();
XenForo_CodeEvent::fire('front_controller_pre_dispatch', array($this, &$routeMatch));
$controllerResponse = $this->dispatch($routeMatch);
if (!$controllerResponse) {
XenForo_Error::noControllerResponse($routeMatch, $this->_request);
exit;
}
$viewRenderer = $this->_getViewRenderer($routeMatch->getResponseType());
if (!$viewRenderer) {
// note: should only happen if there's an error getting the default renderer, which should never happen :)
XenForo_Error::noViewRenderer($this->_request);
exit;
}
$containerParams = array('majorSection' => $routeMatch->getMajorSection(), 'minorSection' => $routeMatch->getMinorSection());
XenForo_CodeEvent::fire('front_controller_pre_view', array($this, &$controllerResponse, &$viewRenderer, &$containerParams));
$content = $this->renderView($controllerResponse, $viewRenderer, $containerParams);
if ($showDebugOutput) {
$content = $this->renderDebugOutput($content);
}
$bufferedContents = ob_get_contents();
ob_end_clean();
if ($bufferedContents !== '' && is_string($content)) {
if (preg_match('#<body[^>]*>#sU', $content, $match)) {
$content = str_replace($match[0], $match[0] . $bufferedContents, $content);
} else {
$content = $bufferedContents . $content;
}
}
XenForo_CodeEvent::fire('front_controller_post_view', array($this, &$content));
if ($this->_sendResponse) {
$headers = $this->_response->getHeaders();
$isText = false;
foreach ($headers as $header) {
if ($header['name'] == 'Content-Type') {
if (strpos($header['value'], 'text/') === 0) {
$isText = true;
}
break;
}
}
if ($isText && is_string($content) && $content) {
$extraHeaders = XenForo_Application::gzipContentIfSupported($content);
foreach ($extraHeaders as $extraHeader) {
$this->_response->setHeader($extraHeader[0], $extraHeader[1], $extraHeader[2]);
}
}
if (is_string($content) && $content && !ob_get_level() && XenForo_Application::get('config')->enableContentLength) {
if ($this->_response->getHttpResponseCode() >= 400 && strpos($this->_request->getServer('HTTP_USER_AGENT', ''), 'IEMobile') !== false) {
// Windows mobile bug - 400+ errors cause the standard browser error
// to be output if a content length is sent. ...Err, what?
} else {
$this->_response->setHeader('Content-Length', strlen($content), true);
}
}
$this->_response->sendHeaders();
if ($content instanceof XenForo_FileOutput) {
$content->output();
} else {
echo $content;
}
} else {
return $content;
}
}
示例3: run
/**
* Runs the request, handling from routing straight through to response output.
* Primary method to be used by the external API.
*
* @return string|null Returns a string if {@link $_sendResponse} is false
*/
public function run($innerContent = "", $newParams = array())
{
ob_start();
$this->setup();
$this->setRequestPaths();
$showDebugOutput = $this->showDebugOutput();
$this->_dependencies->preLoadData();
XenForo_CodeEvent::fire('front_controller_pre_route', array($this));
$routeMatch = $this->route();
XenForo_CodeEvent::fire('front_controller_pre_dispatch', array($this, &$routeMatch));
$controllerResponse = $this->dispatch($routeMatch);
if (!$controllerResponse) {
XenForo_Error::noControllerResponse($routeMatch, $this->_request);
exit;
}
$viewRenderer = $this->_getViewRenderer($routeMatch->getResponseType());
if (!$viewRenderer) {
// note: should only happen if there's an error getting the default renderer, which should never happen :)
XenForo_Error::noViewRenderer($this->_request);
exit;
}
$containerParams = array('majorSection' => $routeMatch->getMajorSection(), 'minorSection' => $routeMatch->getMinorSection());
XenForo_CodeEvent::fire('front_controller_pre_view', array($this, &$controllerResponse, &$viewRenderer, &$containerParams));
$content = $this->renderView($controllerResponse, $viewRenderer, $containerParams, $innerContent, $newParams);
if ($showDebugOutput) {
$content = $this->renderDebugOutput($content);
}
$bufferedContents = ob_get_contents();
ob_end_clean();
if ($bufferedContents !== '') {
$content = $bufferedContents . $content;
}
XenForo_CodeEvent::fire('front_controller_post_view', array($this, &$content));
if ($this->_sendResponse) {
$headers = $this->_response->getHeaders();
$isText = false;
foreach ($headers as $header) {
if ($header['name'] == 'Content-Type') {
if (strpos($header['value'], 'text/') === 0) {
$isText = true;
}
break;
}
}
if ($isText && is_string($content) && $content) {
$extraHeaders = XenForo_Application::gzipContentIfSupported($content);
foreach ($extraHeaders as $extraHeader) {
$this->_response->setHeader($extraHeader[0], $extraHeader[1], $extraHeader[2]);
}
}
if (is_string($content) && $content && !ob_get_level() && XenForo_Application::get('config')->enableContentLength) {
$this->_response->setHeader('Content-Length', strlen($content), true);
}
$this->_response->sendHeaders();
if ($content instanceof XenForo_FileOutput) {
$content->output();
} else {
//$uncompressed = gzuncompress($content);
//echo $uncompressed;
echo $content;
}
} else {
return $content;
}
}