public function execute($input_parameters = null) { $start = microtime(true); parent::execute($input_parameters); \Wave\Debug::getInstance()->addQuery($time = microtime(true) - $start, $this); //printf("%s: %s: %s\n", microtime(true), $time, implode(' ', explode("\n", $this->queryString))); }
private function __construct() { $loader = new \Twig_Loader_Filesystem(Config::get('wave')->path->views); $conf = array('cache' => Config::get('wave')->view->cache); if (Core::$_MODE !== Core::MODE_PRODUCTION) { $conf['auto_reload'] = true; $conf['debug'] = true; } $this->twig = new View\TwigEnvironment($loader, $conf); $this->twig->addExtension(new View\TwigExtension()); foreach (self::$_filters as $name => $action) { $this->twig->addFilter($name, $action); } $this->twig->registerUndefinedFilterCallback(function ($name) { if (function_exists($name)) { return new \Twig_Filter_Function($name); } return false; }); $this->twig->addFilter('last', new \Twig_Filter_Function('\\Wave\\Utils::array_peek')); $this->twig->addFilter('short', new \Twig_Filter_Function('\\Wave\\Utils::shorten', array('pre_escape' => 'html', 'is_safe' => array('html')))); // global variables $this->twig->addGlobal('_assets', Config::get('deploy')->assets); $this->twig->addGlobal('_host', Config::get('deploy')->profiles->default->baseurl); $this->twig->addGlobal('_mode', Core::$_MODE); if (self::$_timezone !== null) { $this->twig->getExtension('core')->setTimezone(self::$_timezone); } if (self::$_date_format !== null) { $this->twig->getExtension('core')->setDateFormat(self::$_date_format); } if (Config::get('deploy')->mode == Core::MODE_DEVELOPMENT || isset($_REQUEST['_wave_show_debugger'])) { $this->twig->addGlobal('_debugger', Debug::getInstance()); } foreach (self::$_globals as $key => $value) { $this->twig->addGlobal($key, $value); } }