public static function clear_cache_twig() { $loader = new Loader(); return $loader->clear_cache_twig(); }
/** * Compile string. * @api * @param string $string a string with twig variables. * @param array $data an array with data in it. * @return bool|string */ public static function compile_string($string, $data = array()) { $dummy_loader = new Loader(); $twig = $dummy_loader->get_twig(); $template = $twig->createTemplate($string); return $template->render($data); }
/** * Get sidebar from PHP * * @param string $sidebar * @param array $data * @return string */ public static function get_sidebar_from_php($sidebar = '', $data) { $caller = self::get_calling_script_dir(); $loader = new Loader(); $uris = $loader->get_locations($caller); ob_start(); $found = false; foreach ($uris as $uri) { if (file_exists(trailingslashit($uri) . $sidebar)) { include trailingslashit($uri) . $sidebar; $found = true; break; } } if (!$found) { Helper::error_log('error loading your sidebar, check to make sure the file exists'); } $ret = ob_get_contents(); ob_end_clean(); return $ret; }