Beispiel #1
0
 public static function hook_output($to_print)
 {
     Backend::add('BackendErrors', Backend::getError());
     Backend::add('BackendSuccess', Backend::getSuccess());
     Backend::add('BackendNotices', Backend::getNotice());
     Backend::add('BackendInfo', Backend::getInfo());
     Backend::setError();
     Backend::setSuccess();
     Backend::setNotice();
     Backend::setInfo();
     $content = Backend::getContent();
     if (empty($content)) {
         ob_start();
         var_dump($to_print);
         $content = ob_get_clean();
         if (substr($content, 0, 4) != '<pre') {
             $content = '<pre>' . $content . '</pre>';
         }
         Backend::addContent($content);
     }
     $layout = Backend::get('HTMLLayout', 'index');
     if (!Render::checkTemplateFile($layout . '.tpl.php')) {
         if (SITE_STATE != 'production') {
             Backend::addError('Missing Layout ' . $layout);
         }
         $layout = 'index';
     }
     $to_print = Render::file($layout . '.tpl.php');
     $to_print = self::addLastContent($to_print);
     $to_print = self::replace($to_print);
     $to_print = self::rewriteLinks($to_print);
     $to_print = self::addLinks($to_print);
     $to_print = self::formsAcceptCharset($to_print);
     //TODO fix this
     if (Component::isActive('BackendFilter')) {
         $BEFilter = new BEFilterObj();
         $BEFilter->read();
         $filters = $BEFilter->list ? $BEFilter->list : array();
         foreach ($filters as $row) {
             if (class_exists($row['class'], true) && is_callable(array($row['class'], $row['function']))) {
                 $to_print = call_user_func(array($row['class'], $row['function']), $to_print);
             }
         }
     }
     //TODO Make this configurable
     if (ConfigValue::get('html_view.TidyHTML') && function_exists('tidy_repair_string')) {
         $to_print = tidy_repair_string($to_print);
     }
     return $to_print;
 }
Beispiel #2
0
 public static function hook_output($to_print)
 {
     Backend::add('BackendErrors', Backend::getError());
     Backend::add('BackendSuccess', Backend::getSuccess());
     Backend::add('BackendNotices', Backend::getNotice());
     Backend::add('BackendInfo', Backend::getInfo());
     Backend::setError();
     Backend::setSuccess();
     Backend::setNotice();
     Backend::setInfo();
     $content = Backend::getContent();
     if (empty($content)) {
         ob_start();
         var_dump($to_print);
         $content = ob_get_clean();
         if (substr($content, 0, 4) != '<pre') {
             $content = '<pre>' . $content . '</pre>';
         }
         Backend::addContent($content);
     }
     $to_print = Render::renderFile('styles.area.tpl.php');
     $to_print .= Render::renderFile('maincontent.tpl.php');
     $to_print .= Render::renderFile('scripts.tpl.php');
     $to_print = HtmlView::addLastContent($to_print);
     $to_print = HtmlView::replace($to_print);
     $to_print = HtmlView::rewriteLinks($to_print);
     $to_print = HtmlView::addLinks($to_print);
     $to_print = HtmlView::formsAcceptCharset($to_print);
     if (Component::isActive('BackendFilter')) {
         $BEFilter = new BEFilterObj();
         $BEFilter->read();
         $filters = $BEFilter->list ? $BEFilter->list : array();
         foreach ($filters as $row) {
             if (class_exists($row['class'], true) && is_callable(array($row['class'], $row['function']))) {
                 $to_print = call_user_func(array($row['class'], $row['function']), $to_print);
             }
         }
     }
     return $to_print;
 }
Beispiel #3
0
 public static function hook_output($to_print)
 {
     //Construct the object to output
     $object = new stdClass();
     $object->result = $to_print;
     $object->error = Backend::getError();
     $object->notice = Backend::getNotice();
     $object->success = Backend::getSuccess();
     $object->info = Backend::getInfo();
     $object->content = Backend::getContent();
     $last = '';
     while (ob_get_level() > self::$ob_level) {
         //Ending the ob_start from __construct
         $last .= ob_get_clean();
     }
     $object->output = $last;
     //Clean up
     Backend::setError();
     Backend::setNotice();
     Backend::setSuccess();
     Backend::setInfo();
     //$result_only = Controller::getVar('result_only');
     return json_encode($object);
 }