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


PHP KunenaLayout::renderError方法代码示例

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


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

示例1: execute

 public function execute()
 {
     KUNENA_PROFILER ? KunenaProfiler::instance()->start('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
     // Run before executing action.
     $result = $this->before();
     if ($result === false) {
         KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
         throw new KunenaExceptionAuthorise(JText::_('COM_KUNENA_NO_ACCESS'), 404);
     }
     // Wrapper layout.
     $this->output = KunenaLayout::factory('Page')->set('me', $this->me)->setOptions($this->getOptions());
     if ($this->config->board_offline && !$this->me->isAdmin()) {
         // Forum is offline.
         $this->setResponseStatus(503);
         $this->output->setLayout('offline');
         $this->content = KunenaLayout::factory('Widget/Custom')->set('header', JText::_('COM_KUNENA_FORUM_IS_OFFLINE'))->set('body', $this->config->offline_message);
     } elseif ($this->config->regonly && !$this->me->exists()) {
         // Forum is for registered users only.
         $this->setResponseStatus(403);
         $this->output->setLayout('offline');
         $this->content = KunenaLayout::factory('Widget/Custom')->set('header', JText::_('COM_KUNENA_LOGIN_NOTIFICATION'))->set('body', JText::_('COM_KUNENA_LOGIN_FORUM'));
     } else {
         // Display real content.
         try {
             // Split into two lines for exception handling.
             $content = $this->display()->set('breadcrumb', $this->breadcrumb);
             $this->content = $content->render();
         } catch (KunenaExceptionAuthorise $e) {
             $this->setResponseStatus($e->getResponseCode());
             $this->output->setLayout('unauthorized');
             $this->document->setTitle($e->getResponseStatus());
             $this->content = KunenaLayout::factory('Widget/Custom')->set('header', $e->getResponseStatus())->set('body', $e->getMessage());
         } catch (Exception $e) {
             if (!$e instanceof KunenaExceptionAuthorise) {
                 $header = 'Error while rendering layout';
                 $content = isset($content) ? $content->renderError($e) : $this->content->renderError($e);
                 $e = new KunenaExceptionAuthorise($e->getMessage(), $e->getCode(), $e);
             } else {
                 $header = $e->getResponseStatus();
                 $content = $e->getMessage();
             }
             $this->setResponseStatus($e->getResponseCode());
             $this->output->setLayout('unauthorized');
             $this->document->setTitle($header);
             $this->content = KunenaLayout::factory('Widget/Custom')->set('header', $header)->set('body', $content);
         }
     }
     // Display wrapper layout with given parameters.
     $this->output->set('content', $this->content)->set('breadcrumb', $this->breadcrumb);
     // Run after executing action.
     $this->after();
     KUNENA_PROFILER ? KunenaProfiler::instance()->stop('function ' . get_class($this) . '::' . __FUNCTION__ . '()') : null;
     return $this->output;
 }
开发者ID:giabmf11,项目名称:Kunena-Forum,代码行数:54,代码来源:display.php


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