Loads a template.

@return Storage|bool false if the template cannot be loaded, a Storage instance otherwise
962650
public function load(TemplateReferenceInterface $template)
    {
        $file = $template->get('name');

        if (self::isAbsolutePath($file) && is_file($file)) {
            return new FileStorage($file);
        }

        $replacements = [];
        foreach ($template->all() as $key => $value) {
            $replacements['%'.$key.'%'] = $value;
        }

        $fileFailures = [];
        foreach ($this->templatePathPatterns as $templatePathPattern) {
            if (is_file($file = strtr($templatePathPattern, $replacements)) && is_readable($file)) {
                if (null !== $this->logger) {
                    $this->logger->debug('Loaded template file.', ['file' => $file]);
                }

                return new FileStorage($file);
            }

            if (null !== $this->logger) {
                $fileFailures[] = $file;
            }
        }

        // only log failures if no template could be loaded at all
        foreach ($fileFailures as $file) {
            if (null !== $this->logger) {
                $this->logger->debug('Failed loading template file.', ['file' => $file]);
            }
        }

        return false;
    }
590702
protected function loadTemplates()
	{
		$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
		$this->twigEnv = new Twig_Environment($loader, ['cache' => false, 'debug' => true]);
		$this->twigEnv->addExtension(new Twig_Extension_Debug());

		// Custom filter for phpdoc
		$filter = new \Twig_Filter('phpdoc', function($string, $indentationCount = 0, $indentChar = "\t") {
			$result = str_repeat($indentChar, $indentationCount) . '/**' . "\n";
			// Split per line
			$lines = explode("\n", trim($string));
			foreach ($lines as $line) {
				$result .= str_repeat($indentChar, $indentationCount) . ' * ' . $line . "\n";
			}
			$result .= str_repeat($indentChar, $indentationCount) . ' */' . "\n";
			return $result;
		});

		$this->twigEnv->addFilter($filter);

		$this->managerTemplate = $this->twigEnv->load('manager.php.twig');
		$this->resourceTemplate = $this->twigEnv->load('resource.php.twig');
		$this->mainClientTemplate = $this->twigEnv->load('mainClient.php.twig');
		$this->mainExceptionTemplate = $this->twigEnv->load('mainException.php.twig');
		$this->unexpectedResponseExceptionTemplate = $this->twigEnv->load('unexpectedResponseException.php.twig');

		if (!is_null($this->testsOutputPath)) {
			$this->mainClientTestTemplate = $this->twigEnv->load('mainClientTest.php.twig');
			$this->managerTestTemplate = $this->twigEnv->load('managerTest.php.twig');
		}
	}
466023
function load()
    {
        if ( $this->ImageObject !== null and
             $this->ImageObjectRef !== null )
            return;
        switch( $this->StoredType )
        {
            case 'png':
            {
                return $this->loadPNG( $this->StoredPath, $this->StoredFile );
            } break;

            case 'jpg':
            {
                return $this->loadJPEG( $this->StoredPath, $this->StoredFile );
            } break;

            case 'gif':
            {
                return $this->loadGIF( $this->StoredPath, $this->StoredFile );
            } break;

            default:
            {
                if ( @$this->loadPNG( $this->StoredPath, $this->StoredFile ) )
                    return true;
                else if ( @$this->loadJPEG( $this->StoredPath, $this->StoredFile ) )
                    return true;
                else if ( @$this->loadGIF( $this->StoredPath, $this->StoredFile ) )
                    return true;
                eZDebug::writeError( 'Image format not supported: ' . $this->StoredType, __METHOD__ );
            }
        }
        return false;
    }
1325752
public function before()
	{
		// setup the template if this isn't a RESTful call
		if ( ! $this->is_restful())
		{
			if ( ! empty($this->template) and is_string($this->template))
			{
				// Load the template
				$this->template = \View::forge($this->template);
			}
		}

		return parent::before();
	}
999585
public function loadTemplate($name)
    {
        $template = new Template();
        $template->app = $this;

        if (in_array($name[0], ['.', '/', '\\']) || strpos($name, ':\\') !== false) {
            return $template->load($name);
        } else {
            $dir = is_array($this->template_dir) ? $this->template_dir : [$this->template_dir];
            foreach ($dir as $td) {
                if ($t = $template->tryLoad($td.'/'.$name)) {
                    return $t;
                }
            }
        }

        throw new Exception(['Can not find template file', 'name'=>$name, 'template_dir'=>$this->template_dir]);
    }
732671
static function load($_template)
    {
        // check runtime cache
        if (!$_template->source->handler->recompiled &&
            ($_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
        ) {
            $_cache_key = $_template->source->unique_resource . '#';
            if ($_template->caching) {
                $_cache_key .= 'caching#';
            }
            $_cache_key .= $_template->compile_id;
            if (isset($_template->source->compileds[$_cache_key])) {
                return $_template->source->compileds[$_cache_key];
            }
        }
        $compiled = new Smarty_Template_Compiled();
        if ($_template->source->handler->hasCompiledHandler) {
            $_template->source->handler->populateCompiledFilepath($compiled, $_template);
        } else {
            $compiled->populateCompiledFilepath($_template);
        }
        // runtime cache
        if (!$_template->source->handler->recompiled &&
            ($_template->smarty->resource_cache_mode & Smarty::RESOURCE_CACHE_ON)
        ) {
            $_template->source->compileds[$_cache_key] = $compiled;
        }
        return $compiled;
    }
827703
private function load()
    {
        if ($this->loaded === false) {
            if ($this->autoCreate === true) {
                if (!is_file($this->path)) {
                    $this->touch();
                }
            }

            $array = $this->fileType->fetch($this->path);

            if (is_array($array)) {
                // Keep initial array hash
                $this->hash = $this->serializer->buildHash($array);
                $this->config = $array;
                $this->loaded = true;

                return true;
            } else {
                throw new LogicException(sprintf(
                    'Required file should return an array and only, not "%s"', gettype($array)
                ));
            }
        }

        return true;
    }
1202206
protected function loadTemplates()
    {
        $templates = $this->templatesObjectBackend->loadObject();
        if (!is_array($templates)) {
            $templates = array();
        }
        
        $this->templates = $templates;
    }
1349173
public function getTemplate()
    {
        if (is_null($this->_template)) {
            Template::appendPath(dirname(__FILE__).'/Views');
            $temp = new Template();
            $this->_template = $temp->initialize();
        }
        return $this->_template;
    }
591287
protected function _getTemplate()
    {
        if (is_null($this->_template)) {
            foreach ($this->_map as $method => $className) {
                if ($this->_sql instanceof $className) {
                    $this->_template = $this->$method();
                    break;
                }
            }
        }
        return $this->_template;
    }
163070
public function load()
	{
		if (file_exists($this->name) && is_readable($this->name))
		{
			return unserialize(file_get_contents($this->name));
		}
		return false;
	}
522211
protected function loadStorage($resource)
    {
        $template = $this->parser->parse($resource);

        $key = $template->getLogicalName();
        if (isset($this->cache[$key])) {
            return $this->cache[$key];
        }

        $storage = $this->template_loader->load($template);
        if (!$storage instanceof MatterStorage) {
            throw new \RuntimeException(sprintf('The template "%s" does not have matter.', $template));
        }

        return $this->cache[$key] = $storage;
    }
1243917
public function loadTemplates()
    {
        if (!($this->configurationManager instanceof ConfigurationManager)) {
            throw new Exception('You need to install ConfigurationBundle');
        }

        $templates = new ArrayCollection([]);
        $bundles = $this->kernel->getBundles();

        /**
         * @var Bundle $bundle
         */
        foreach ($bundles as $bundle) {
            if ($bundle instanceof TemplateInterface) {
                $bundleName = $bundle->getName();
                $bundleNamespace = $bundle->getNamespace();
                $templates->set($bundleName, [
                    'bundle'    => $bundleName,
                    'namespace' => $bundleNamespace,
                    'name'      => $bundle->getTemplateName(),
                ]);
            }
        }

        $templatesArray = $templates->toArray();

        $this
            ->configurationManager
            ->set('store.templates', $templatesArray);

        return $templatesArray;
    }
709918
protected function getTemplates()
    {
        if (empty($this->templates)) {
            $this->templates[] = $this->environment->loadTemplate($this::DEFAULT_TEMPLATE);
        }

        return $this->templates;
    }
1362230
private function getTemplate()
    {
        if ($this->template) {
            return $this->template;
        }

        try {
            $this->template = $this->environment->load($name = $this->config['template']);
        } catch (\Twig_Error $e) {
            throw new Exception\RenderingException("Failed to load $name template.");
        }

        // TODO : hasBlock() does not use template inheritance.

        if (!$this->template->hasBlock('cms_content')) {
            throw new Exception\RenderingException('Unable to find "cms_content" twig block.');
        }
        if (!$this->template->hasBlock('cms_container')) {
            throw new Exception\RenderingException('Unable to find "cms_container" twig block.');
        }
        if (!$this->template->hasBlock('cms_row')) {
            throw new Exception\RenderingException('Unable to find "cms_row" twig block.');
        }
        if (!$this->template->hasBlock('cms_block')) {
            throw new Exception\RenderingException('Unable to find "cms_block" twig block.');
        }

        return $this->template;
    }
567287
public function load()
    {
        if (null === $this->loaded) {
            return;
        }

        $this->loaded = null;

        /** @var $cache StorageInterface */
        $cache      = $this->serviceLocator->get('BjyAuthorize\Cache');

        /** @var $cacheKeyGenerator callable */
        $cacheKeyGenerator  = $this->serviceLocator->get('BjyAuthorize\CacheKeyGenerator');
        $cacheKey           = $cacheKeyGenerator();

        $success    = false;
        $this->acl  = $cache->getItem($cacheKey, $success);

        if (!($this->acl instanceof Acl) || !$success) {
            $this->loadAcl();
            $cache->setItem($cacheKey, $this->acl);
        }

        $this->setIdentityProvider($this->serviceLocator->get('BjyAuthorize\Provider\Identity\ProviderInterface'));

        $parentRoles = $this->getIdentityProvider()->getIdentityRoles();

        $this->acl->addRole($this->getIdentity(), $parentRoles);
    }
1369077
protected function load()
    {
        $id = $this->getId();
        $values = $this->getStore()->fetch($id);

        if ($values === false) {
            return false;
        }

        // metadata
        $metadata = $values[self::METADATA_NAMESPACE];
        $this->firstTrace = $metadata['firstTrace'];
        $this->lastTrace = $metadata['lastTrace'];
        $this->regenerationTrace = $metadata['regenerationTrace'];
        $this->requestsCount = $metadata['requestsCount'];
        $this->fingerprint = $metadata['fingerprint'];

        // values
        $this->values = $values;

        return true;
    }