Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
StringLoaderExtension.php
01 <?php
02
03 /*
04 * This file is part of Twig.
05 *
06 * (c) Fabien Potencier
07 *
08 * For the full copyright and license information, please view the LICENSE
09 * file that was distributed with this source code.
10 */
11
12 namespace Twig\Extension {
13 use Twig\TwigFunction;
14
15 final class StringLoaderExtension extends AbstractExtension
16 {
17 public function getFunctions()
18 {
19 return [
20 new TwigFunction('template_from_string', 'twig_template_from_string', ['needs_environment' => true]),
21 ];
22 }
23 }
24
25 class_alias('Twig\Extension\StringLoaderExtension', 'Twig_Extension_StringLoader');
26 }
27
28 namespace {
29 use Twig\Environment;
30 use Twig\TemplateWrapper;
31
32 /**
33 * Loads a template from a string.
34 *
35 * {{ include(template_from_string("Hello {{ name }}")) }}
36 *
37 * @param string $template A template as a string or object implementing __toString()
38 * @param string $name An optional name of the template to be used in error messages
39 *
40 * @return TemplateWrapper
41 */
42 function twig_template_from_string(Environment $env, $template, string $name = null)
43 {
44 return $env->createTemplate((string) $template, $name);
45 }
46 }
47