protected function getContent() { $man_ctr = \OWeb\manage\Controller::getInstance(); //On va voir quel page on doit charger $get = \OWeb\OWeb::getInstance()->get_get(); if (isset($get['page'])) { $ctr = $get['page']; } else { $ctr = OWEB_DEFAULT_PAGE; } try { $ctr = str_replace("\\\\", "\\", $ctr); $ctr = str_replace(".", "\\", $ctr); $ctr = $man_ctr->loadController('Page\\' . $ctr); $ctr->loadParams(); $man_ctr->initController(); } catch (\Exception $ex) { $ctr = $man_ctr->loadController('Page\\OWeb\\errors\\http\\NotFound'); } ob_start(); try { $ctr->display(); } catch (\Exception $e) { ob_end_clean(); ob_start(); $ctr = $man_ctr->loadException($e); $ctr->addParams("exception", $e); $man_ctr->display(); } $this->content = ob_get_contents(); ob_end_clean(); Events::getInstance()->sendEvent('Didplay_Prepare@OWeb\\manage\\Headers'); $header = \OWeb\manage\Headers::getInstance()->getAllHeaders(); return array('headers' => $header, "content" => $this->content); }
/** * Will add the headers registered to the main Headers Manager */ public function makeAdd() { if (OWEB_DEBUG > 0) { $code .= $this->makeAddNormal(); } else { $code .= $this->makeAddNormal(); } Headers::getInstance()->addHeader($code, Headers::jsCode); }
/** * Adding a Header to the Page * * @param type $code The url, or code if the header. * @param type $type The type of the header. */ public function addHeader($code, $type) { \OWeb\manage\Headers::getInstance()->addHeader($code, $type); }
public function __construct(&$get, &$post, &$files, &$cookies, &$server, $adr) { $this->get_runTime(); //Checking if There is an older instance. If yes Exception. if (self::$instance != null) { throw new Exception("Only 1 instance of OWeb can run."); } else { self::$instance = $this; } error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT); //Variables d'environement $this->_get = $get; $this->_post = $post; $this->_files = $files; $this->_cookies = $cookies; $this->_server = $server; $this->_adresse = $adr; //Initializing AutoLoader. $this->autoLoader = new autoLoader(); //Initialize Events manager $this->manage_events = \OWeb\manage\Events::getInstance(); //Initialize headers manager $this->manage_headers = \OWeb\manage\Headers::getInstance(); //Initialize Extension manager $this->manage_extensions = \OWeb\manage\Extensions::getInstance(); //Initialize Controller manager $this->manage_controllers = \OWeb\manage\Controller::getInstance(); //Initialize SubView manager $this->manage_subViews = \OWeb\manage\SubViews::getInstance(); //Initialize Setting Manager $this->manage_settings = \OWeb\manage\Settings::getInstance(); }
public function getNewParser() { $parser = new \SBBCodeParser\Node_Container_Document(); $bbcode = new \SBBCodeParser\BBCode('title', function ($content, $attribs) { $tag = trim(htmlspecialchars($content)); $att = $attribs['default']; if ($att == 'h1') { SBBCodeParser::$tree[] = array(1, $content, $tag); return "<h1 class=\"uk-h2\" id=\"{$tag}\">" . $content . "</h1>"; } else { if ($att == 'h2') { SBBCodeParser::$tree[] = array(2, $content, $tag); return "<h2 class=\"uk-h3\" id=\"{$tag}\">" . $content . "</h2>"; } else { if ($att == 'h3') { SBBCodeParser::$tree[] = array(3, $content, $tag); return "<h3 class=\"uk-h4\" id=\"{$tag}\">" . $content . "</h2>"; } else { if ($att == 'h4') { SBBCodeParser::$tree[] = array(4, $content, $tag); return "<h4 class=\"uk-h5\" id=\"{$tag}\">" . $content . "</h4>"; } else { if ($att == 'h5') { SBBCodeParser::$tree[] = array(5, $content, $tag); return "<h5 class=\"uk-h6\" id=\"{$tag}\">" . $content . "</h5>"; } } } } } }, \SBBCodeParser\BBCode::BLOCK_TAG, false, array(), array('text_node'), \SBBCodeParser\BBCode::AUTO_DETECT_EXCLUDE_ALL); $parser->add_bbcode($bbcode); $bbcode = new \SBBCodeParser\BBCode('codes', function ($content, $attribs) { if (isset($attribs['default']) && !empty($attribs['default'])) { $att = strtolower($attribs['default']); } else { $att = 'text'; } $brushes = array(); $brushes['actionscript3'] = 'shBrushAS3.js'; $brushes['as3,actionscript3'] = 'shBrushAS3.js'; $brushes['bash'] = 'shBrushBash.js'; $brushes['shell'] = 'shBrushBash.js'; $brushes['cf,coldfusion'] = 'shBrushColdFusion.js'; $brushes['cf'] = 'shBrushColdFusion.js'; $brushes['csharp'] = 'shBrushCSharp.js'; $brushes['c-sharp'] = 'shBrushCSharp.js'; $brushes['cpp'] = 'shBrushCpp.js'; $brushes['c'] = 'shBrushCpp.js'; $brushes['css'] = 'shBrushCss.js'; $brushes['delphi'] = 'shBrushDelphi.js'; $brushes['pas'] = '******'; $brushes['pascal'] = 'shBrushDelphi.js'; $brushes['patch'] = 'shBrushDiff.js'; $brushes['diff'] = 'shBrushDiff.js'; $brushes['erlang'] = 'shBrushErlang.js'; $brushes['erl'] = 'shBrushErlang.js'; $brushes['groovy'] = 'shBrushGroovy.js'; $brushes['js'] = 'shBrushJScript.js'; $brushes['jscript,'] = 'shBrushJScript.js'; $brushes['javascript'] = 'shBrushJScript.js'; $brushes['java'] = 'shBrushJava.js'; $brushes['javafx'] = 'shBrushJavaFX.js'; $brushes['jfx'] = 'shBrushJavaFX.js'; $brushes['pl'] = 'shBrushPerl.js'; $brushes['perl'] = 'shBrushPerl.js'; $brushes['php'] = 'shBrushPhp.js'; $brushes['text'] = 'shBrushPlain.js'; $brushes['plain'] = 'shBrushPlain.js'; $brushes['ps'] = 'shBrushPowerShell.js'; $brushes['powershell'] = 'shBrushPowerShell.js'; $brushes['py'] = 'shBrushPython.js'; $brushes['python'] = 'shBrushPython.js'; $brushes['rails'] = 'shBrushRuby.js'; $brushes['ror'] = 'shBrushRuby.js'; $brushes['ruby'] = 'shBrushRuby.js'; $brushes['scala'] = 'shBrushScala.js'; $brushes['sql'] = 'shBrushSql.js'; $brushes['vb'] = 'shBrushVb.js'; $brushes['vbnet'] = 'shBrushVb.js'; $brushes['xml'] = 'shBrushXml.js'; $brushes['xhtml'] = 'shBrushXml.js'; $brushes['xslt'] = 'shBrushXml.js'; $brushes['html'] = 'shBrushXml.js'; $brushes['xhtml'] = 'shBrushXml.js'; if (isset($brushes[$att])) { $js = $brushes[$att]; } else { $att = 'plain'; $js = $brushes['plain']; } $headers = \OWeb\manage\Headers::getInstance(); $headers->addHeader('syntaxHighlighter/shCore.js', \OWeb\manage\Headers::javascript); $headers->addHeader('syntaxHighlighter/' . $js, \OWeb\manage\Headers::js); $headers->addHeader('syntaxHighlighter/shCoreDefault.css', \OWeb\manage\Headers::css); \OWeb\utils\js\jquery\HeaderOnReadyManager::getInstance()->add("SyntaxHighlighter.config.bloggerMode = true;\n\t\t\t\t\t\t\tSyntaxHighlighter.defaults['toolbar'] = true;\n\t\t\t\t\t\t\tSyntaxHighlighter.all();"); $content = str_replace("<br />", "", $content); return '<pre class="brush: ' . $att . ';">' . $content . '</pre>'; }, \SBBCodeParser\BBCode::BLOCK_TAG, false, array(), array(), \SBBCodeParser\BBCode::AUTO_DETECT_EXCLUDE_ALL); $parser->add_bbcode($bbcode); $parser->add_emoticons(array(':D' => OWEB_HTML_URL_IMG . '/icons/01.png', 'OD' => OWEB_HTML_URL_IMG . '/icons/02.png', ':)' => OWEB_HTML_URL_IMG . '/icons/03.png', ';)' => OWEB_HTML_URL_IMG . '/icons/04.png', '8)' => OWEB_HTML_URL_IMG . '/icons/05.png')); return $parser; }