コード例 #1
0
ファイル: factory.php プロジェクト: vanie3/appland
 protected static function createDocument()
 {
     $lang = self::getLanguage();
     // @deprecated 12.1 This will be removed in the next version
     $raw = MRequest::getBool('no_html');
     $type = MRequest::getWord('format', $raw ? 'raw' : 'html');
     $attributes = array('charset' => 'utf-8', 'lineend' => 'unix', 'tab' => '  ', 'language' => $lang->getTag(), 'direction' => $lang->isRTL() ? 'rtl' : 'ltr');
     return MDocument::getInstance($type, $attributes);
 }
コード例 #2
0
ファイル: error.php プロジェクト: vanie3/appland
 public static function customErrorPage(&$error)
 {
     // Deprecation warning.
     MLog::add('MError::customErrorPage() is deprecated.', MLog::WARNING, 'deprecated');
     // Initialise variables.
     $app = MFactory::getApplication();
     $document = MDocument::getInstance('error');
     if ($document) {
         $config = MFactory::getConfig();
         // Get the current template from the application
         $template = $app->getTemplate();
         // Push the error object into the document
         $document->setError($error);
         // If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404)
         if ($error->getCode() == '404' && MFactory::getConfig()->get('offline') == 1) {
             MFactory::getApplication()->redirect('index.php');
         }
         @ob_end_clean();
         $document->setTitle(MText::_('Error') . ': ' . $error->get('code'));
         $data = $document->render(false, array('template' => $template, 'directory' => MPATH_THEMES, 'debug' => $config->get('debug')));
         // Failsafe to get the error displayed.
         if (empty($data)) {
             self::handleEcho($error, array());
         } else {
             // Do not allow cache
             MResponse::allowCache(false);
             MResponse::setBody($data);
             echo MResponse::toString();
         }
     } else {
         // Must echo the error since there is no document
         // This is a common use case for Command Line Interface applications.
         self::handleEcho($error, array());
     }
     $app->close(0);
 }