function parse($str, $markdown = true) { // process tags $pattern = '/[\\{\\{]{1}([a-z]+)[\\}\\}]{1}/i'; if (preg_match_all($pattern, $str, $matches)) { list($search, $replace) = $matches; foreach ($replace as $index => $key) { $replace[$index] = Config::meta($key); } $str = str_replace($search, $replace, $str); } $str = html_entity_decode($str, ENT_NOQUOTES, System\Config::app('encoding')); // Parse Markdown as well? if ($markdown === true) { $md = new Parsedown(); $str = $md->text($str); } return $str; }
<?php /* * Error reporting */ ini_set('display_error', true); error_reporting(-1); /** * Register composer autoloader */ $composer = (require PATH . 'vendor/autoload' . EXT); $composer->add('', APP . 'src'); /* * Set your applications current timezone */ date_default_timezone_set(System\Config::app('timezone', 'UTC')); /** * Import helpers */ require APP . 'helpers' . EXT; /** * Import defined routes */ require APP . 'routes' . EXT; /** * Error handling */ System\Error::register(); /** * Set input */
/** * Encode html to entities */ function e($str) { return htmlspecialchars($str, ENT_NOQUOTES, System\Config::app('encoding'), false); }