0) { $loaders[] = new \Twig_Loader_Filesystem($filesystemLoaderPaths); } $loaders[] = new \Twig_Loader_String(); // set-up Twig $twigLoader = new \Twig_Loader_Chain($loaders); $instance = new \Twig_Environment($twigLoader, array("debug" => $twigDebug)); // customize Twig TwigUtil::setInstance($instance); // Disabling custom Twig Extensions for String loader as it is only used internally by PL // TwigUtil::loadCustomExtensions(); // @todo Determine if any custom things should be loaded for this TwigUtil::loadFilters(); TwigUtil::loadFunctions(); TwigUtil::loadTags(); TwigUtil::loadTests(); TwigUtil::loadDateFormats(); TwigUtil::loadDebug(); TwigUtil::loadMacros(); // set-up the dispatcher $dispatcherInstance = Dispatcher::getInstance(); $dispatcherInstance->dispatch("twigLoader.customize"); $dispatcherInstance->dispatch("twigStringLoader.customize"); // get the instance $this->instance = TwigUtil::getInstance(); } /** * Render a string * @param {Array} the options to be rendered by Twig * * @return {String} the rendered result */ public function render($options = array()) { return $this->instance->render($options["string"], $options["data"]); } }