Outputs the template to the browser.

[!] Overloaded to remove portion that sets headers.

@param   boolean  $caching  If true, cache the output
@param   array    $params   Associative array of attributes
@return  The rendered data
329964
public function render($caching = false, $params = array())
	{
		if (!isset($params['template']))
		{
			if (App::isAdmin())
			{
				$db = App::get('db');
				$db->setQuery("SELECT s.`template`, e.protected FROM `#__template_styles` AS s INNER JOIN `#__extensions` AS e ON e.`element`=s.`template` WHERE s.`client_id`=0 AND s.`home`=1");
				$result = $db->loadObject();
			}
			else
			{
				$result = App::get('template');
			}

			$params['template'] = $result->template;
			if (is_dir(PATH_APP . DS . 'templates' . DS . $result->template))
			{
				$params['directory'] = PATH_APP . DS . 'templates';
			}
			else
			{
				$params['directory'] = PATH_CORE . DS . 'templates';
			}
		}

		if (!isset($params['file']))
		{
			$params['file'] = 'email.php';
		}

		if (!file_exists($params['directory'] . DS . $params['template'] . DS . $params['file']))
		{
			$params['template']  = 'system';
			$params['directory'] = PATH_CORE . DS . 'templates';
		}

		$this->_caching = $caching;

		if (!empty($this->_template))
		{
			$data = $this->_renderTemplate();
		}
		else
		{
			$this->parse($params);
			$data = $this->_renderTemplate();
		}

		if (class_exists('\Pelago\Emogrifier') && $data)
		{
			$data = str_replace('&#', '{_ANDNUM_}', $data);
			$emogrifier = new \Pelago\Emogrifier();
			$emogrifier->preserveEncoding = true;
			$emogrifier->setHtml($data);
			//$emogrifier->setCss($css);

			$data = $emogrifier->emogrify();
			$data = str_replace('{_ANDNUM_}', '&#', $data);
		}

		return $data;
	}
401511
public function writeTo(string $key, $data, array $params = []): bool
    {
        $result = false;

        if (empty($params['path'])) {
            $this->errors[] = "Path parameter is required";

            return $result;
        }
        $path = $params['path'];

        try {
            Utility::validatePath($path);
        } catch (InvalidArgumentException $e) {
            $this->errors[] = "Path does not exist or is not readable: $path";

            return $result;
        }

        $content = (string)file_get_contents($path);
        $cachedData = [
            'path' => $path,
            'md5' => md5($content),
            'data' => $data,
        ];

        $result = parent::writeTo($key, $cachedData, ['raw' => true]);

        return $result;
    }
715581
public function updateCache(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template, $no_output_filter)
    {
        if ($_template->source->handler->uncompiled) {
            ob_start();
            $_template->source->render($_template);
        } else {
            ob_start();
            if (!isset($_template->compiled)) {
                $_template->loadCompiled();
            }
            $_template->compiled->render($_template);
        }
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->start_cache($_template);
        }
        $this->removeNoCacheHash($cached, $_template, $no_output_filter);
        $compile_check = $_template->smarty->compile_check;
        $_template->smarty->compile_check = false;
        if (isset($_template->parent) && $_template->parent->_objType == 2) {
            $_template->compiled->unifunc = $_template->parent->compiled->unifunc;
        }
        if (!$_template->cached->processed) {
            $_template->cached->process($_template, true);
        }
        $_template->smarty->compile_check = $compile_check;
        $cached->getRenderedTemplateCode($_template);
        if ($_template->smarty->debugging) {
            $_template->smarty->_debug->end_cache($_template);
        }
    }
1137683
public function clear($cache = null)
    {
        if ($cache === null) {
            $cache = $this->cache_name;
        }
        $cache = self::encodeCache($cache);
        $url = "projects/{$this->project_id}/caches/$cache/clear";
        $params = array();
        $this->setJsonHeaders();
        return self::json_decode($this->apiCall(self::POST, $url, $params));
    }
241270
public function useCache($caching = null)
    {
        if (is_null($caching)) {
            return ($this->useCache && $this->getCache());
        }

        $this->useCache = (bool) $caching;

        return $this;
    }
404051
protected function cacheKey(array $params = [])
    {
        $prefix   = config('antares/ui-components::cache');
        $required = ['resource', 'uid', 'brand_id', 'name'];
        if (count(array_only($params, $required)) != count($required)) {
            return $prefix;
        }
        $ordered = [];
        foreach ($required as $key) {
            $ordered[$key] = array_get($params, $key);
        }
        return implode('.', array_merge([config('antares/ui-components::cache')], $ordered));
    }
465208
public static function paginate($method, array $params = [])
    {
        // Set request params
        $params = array_filter(array_merge([
            'page' => 1
        ], $params));

        $instance = new static([], static::getParentID());;

        // Make request
        $result = $instance->makeRequest($instance->getEndpoint(), $method, [$params]);

        // Hydrate object
        $result = $instance->paginateHydrate($result);

        // Append search params
        $result->appends($params);

        return $result;
    }
823696
function cache(options, compiled) {
  // cachable
  if (compiled && options.filename && options.cache) {
    delete templates[options.filename];
    cacheStore[options.filename] = compiled;
    return compiled;
  }
  // check cache
  if (options.filename && options.cache) {
    return cacheStore[options.filename];
  }
  return compiled;
}
150992
public function render($path, array $placeholders = [], $context = null, $isAjax = false)
    {
        if (isset($context)) {
            $this->setContext($context);
        }
        $this->scopes[spl_object_hash($this)] = $this;
        list($cacheKey, $cacheExpire, $cacheTags) = $this->calculateCacheParams($placeholders);
        // Get cache
        if (($resultCache = $this->getCacheContent($cacheKey)) !== false) {

            return $resultCache;
        }
        $result = $this->renderInternal($path, $placeholders);
        if (!$isAjax) {
            $result = implode("\n", [$this->beginPage(), $this->beginBody(), $result, $this->endBody(), $this->endPage()]);
        }

        // Set cache
        $this->setCacheContent($cacheKey, $result, $cacheExpire, $cacheTags ?: []);

        return $result;
    }
101740
private function buildCacheData()
    {
        $metadata = $this->driver->getMetadataForUser();

        return serialize(
            array_map(function (\ReflectionProperty $property) {
                return $property->getName();
            }, $metadata)
        );
    }
1208412
private function createCache(array $cache)
    {
        ksort($cache);

        $format = "\t%s => %s," . PHP_EOL;
        $rows = [];

        foreach ($cache as $key => $value) {
            $rows[] = sprintf($format, var_export($key, true), var_export($value, true));
        }

        return sprintf('<?php return [%s];' . PHP_EOL, PHP_EOL . implode('', $rows));
    }
480855
public function cacheAction(Request $request)
    {
        $cms = $this->cmsSelector->retrieve();

        try {
            $page = $cms->getPageById($request->get('page_id'));
        } catch (PageNotFoundException $e) {
            $page = false;
        }

        $block = $cms->getBlock($request->get('block_id'));

        if (!$page || !$block) {
            return new Response('', 404);
        }

        $options = [];

        $blockContext = $this->contextManager->get($block, $options);
        $response = $this->blockRenderer->render($blockContext);

        $response->setPrivate(); //  always set to private

        if ($this->sync) {
            return $response;
        }

        $response->setContent(sprintf('
    (function () {
        var block = document.getElementById("block-cms-%s");

        var div = document.createElement("div");
        div.innerHTML = %s;

        for (var node in div.childNodes) {
            if (div.childNodes[node] && div.childNodes[node].nodeType == 1) {
                block.parentNode.replaceChild(div.childNodes[node], block);
            }
        }
    })();
', $block->getId(), json_encode($response->getContent())));

        $response->headers->set('Content-Type', 'application/javascript');

        return $response;
    }
147085
public function cache($provider, array $params = array())
    {
        $this->cache = array_merge(array(config::PROVIDER => $provider), array(Config::PARAMS => $params));

        return $this;
    }
673399
protected function render_route($route, $params = []) {

        $output = false;

        if (isset($this->routes[$route])) {

            $ret = null;

            if (\is_callable($this->routes[$route])){
                $ret = \call_user_func($this->routes[$route], $params);
            }

            if (!is_null($ret)){
                return $ret;
            }
        }

        return $output;
    }
801747
protected function renderHtmlTemplate()
    {
        if ($this->cacheEnabled()) {
            $cachePool = $this->container['cache'];
            $cacheKey  = 'template/'.str_replace('/', '.', $this->cacheIdent());
            $cacheItem = $cachePool->getItem($cacheKey);

            $output = $cacheItem->get();
            if ($cacheItem->isMiss()) {
                $output = $this->renderHtmlTemplateContent();

                $cacheItem->set($output, $this->cacheTtl());
                $cachePool->save($cacheItem);
            }
        } else {
            $output = $this->renderHtmlTemplateContent();
        }

        return $output;
    }
1346172
public function getCachedUrl($image, array $params = ['w' => 300])
    {
        if (str_contains($this->getUploadTo(), 'public'))
        {
            $pieces = explode('public', $this->getUploadTo());
            $base = $pieces[1];

            $params = http_build_query($params);
            return asset(config('bumble.admin_prefix').'/cache'.$base.$image.'?'.$params);
        }
    }
216710
public function compile($template)
    {
        $name = md5($template);
        
        if (isset(self::$callbacks[$name])) {
            return self::$callbacks[$name];
        }
        
        $file = $this->cache . '/' . $this->prefix . $name . '.php';

        if (is_dir($this->cache) && file_exists($file)) {
            $callback = include($file);
        } else {
            $code = Compiler::i($this, $template)->compile();
            
            if (is_dir($this->cache)) {
                file_put_contents($file, $code);
            }
            
            //called like: function($data) {};
            $callback = @eval('?>'.$code);
            //$this->checkEval($code);
        }
        
        self::$callbacks[$name] = $callback;
        
        return $callback;
    }