/** * */ public function display($o = null) { if (SPRequest::cmd('format') == 'json' && Sobi::Cfg('output.json_enabled', false)) { return $this->jsonDisplay(); } $type = $this->key('template_type', 'xslt'); $f = null; $task = SPRequest::task(); if ($this->key('functions')) { $f = $this->registerFunctions(); } $out = null; if ($type != 'php' && Sobi::Cfg('global.disable_xslt', false)) { $type = 'php'; } $parserClass = SPLoader::loadClass('mlo.template_' . $type); if ($parserClass) { /** @var $parser SPTemplateXSLT */ $parser = new $parserClass(); } else { throw new SPException(SPLang::e('CANNOT_LOAD_PARSER', $type)); } $this->_attr['template_path'] = Sobi::FixPath(str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), $this->_templatePath)); $messages = SPFactory::message()->getMessages(); if (count($messages)) { foreach ($messages as $type => $content) { $this->_attr['messages'][$type] = array_values($content); } } $parser->setProxy($this); $parser->setData($this->_attr); $parser->setXML($this->_xml); $parser->setCacheData(array('hidden' => $this->_hidden)); $parser->setType($this->_type); $parser->setTemplate($this->_template); Sobi::Trigger('Display', $this->name(), array($type, &$this->_attr)); $o = $o ? $o : strtolower($this->key('output', $this->key('output', 'html'), $this->tTask)); $action = $this->key('form.action'); if ($action) { $opt = SPFactory::mainframe()->form(); if (is_array($opt) && count($opt)) { foreach ($opt as $l => $v) { $this->addHidden($v, $l); } } $form = $this->csection('form'); $form['method'] = isset($form['method']) && $form['method'] ? $form['method'] : 'post'; $out .= "\n<form "; foreach ($form as $p => $v) { $out .= $p . '="' . $v . '" '; } $out .= ">\n"; } $out .= $parser->display($o, $f); $hidden = null; if (count($this->_hidden)) { $this->_hidden[SPFactory::mainframe()->token()] = 1; foreach ($this->_hidden as $name => $value) { $hidden .= "\n<input type=\"hidden\" id=\"SP_{$name}\" name=\"{$name}\" value=\"{$value}\"/>"; } // xhtml strict valid $hidden = "<div>{$hidden}</div>"; $out .= $hidden; } $out .= $action ? "\n</form>\n" : null; /* SobiPro type specific content parser */ Sobi::Trigger('ContentDisplay', $this->name(), array(&$out)); /* common content parser */ $cParse = $this->key('parse', -1); /* if it was specified in the template config file or it was set in the section config and not disabled in the template config */ if (!(strstr($task, '.edit') || strstr($task, '.add') || in_array($task, Sobi::Cfg('plugins.content_disable', array())))) { if ($cParse == 1 || Sobi::Cfg('parse_template_content', false) && $cParse == -1) { Sobi::Trigger('Parse', 'Content', array(&$out)); } } header('SobiPro: ' . Sobi::Section()); if ($o == 'html' && (!strlen(SPRequest::cmd('format')) || SPRequest::cmd('format') == 'html' || SPRequest::int('crawl'))) { $out .= $this->pb(); if ((SPRequest::cmd('dbg') || Sobi::Cfg('debug')) && Sobi::My('id')) { $start = Sobi::Reg('start'); $mem = $start[0]; $time = $start[1]; $queries = SPFactory::db()->getCount(); $mem = number_format(memory_get_usage() - $mem); $time = microtime(true) - $time; SPConfig::debOut("Memory: {$mem}<br/>Time: {$time}<br/> Queries: {$queries}"); } echo "\n<!-- Start of SobiPro component-->\n<div id=\"SobiPro\" class=\"SobiPro\">\n{$out}\n</div>\n<!-- End of SobiPro component Copyright (C) 2011-2014 Sigsiu.NET GmbH -->\n"; } else { $this->customOutput($out); } Sobi::Trigger('AfterDisplay', $this->name()); }
private function details() { $levels = $this->get('levels'); $error = $this->get('error'); if ($error->errReq) { $error->errReq = "<a href=\"{$error->errReq}\" target\"_blank\">{$error->errReq}</a>"; } if ($error->errRef) { $error->errRef = "<a href=\"{$error->errRef}\" target\"_blank\">{$error->errRef}</a>"; } if ($error->errNum) { $error->errNum = $levels[$error->errNum]; } if ($error->errBacktrace) { $error->errBacktrace = '<pre>' . SPConfig::debOut($error->errBacktrace, false, true) . '</pre>'; } if ($error->errCont) { $error->errCont = '<pre>' . SPConfig::debOut($error->errCont, false, true) . '</pre>'; } $error->errMsg = str_replace('href=\'function.', 'target="_blank" href=\'http://php.net/manual/en/function.', $error->errMsg); $this->assign($error, 'error'); }