Conditions | 3 |
Paths | 3 |
Total Lines | 24 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
41 | public function injectInto(\Twig\Environment $twig): \Twig\Environment |
||
42 | { |
||
43 | $i10n = $this->i10n; |
||
44 | |||
45 | /** |
||
46 | * Filter i10n List to register |
||
47 | * |
||
48 | * @param array $i10n The current kses list. |
||
49 | * @param \Twig\Environment $twig The twig environment instance. |
||
50 | */ |
||
51 | $i10n = apply_filters(self::FILTER_L10N_LIST, $i10n, $twig); |
||
52 | |||
53 | foreach ($i10n as $key => $function) { |
||
54 | // Looking for options. |
||
55 | list($function, $options) = $this->extractConfiguration((array)$function); |
||
56 | |||
57 | $twig->addFunction(new \Twig\TwigFunction($key, $function, $options)); |
||
58 | |||
59 | if (strpos($key, 'esc_', 0) !== false) { |
||
60 | $twig->addFilter(new \Twig\TwigFilter($key, $function, $options)); |
||
61 | } |
||
62 | } |
||
63 | |||
64 | return $twig; |
||
65 | } |
||
67 |