Translated using Weblate (Portuguese)
[phpmyadmin.git] / src / Twig / UtilExtension.php
blob919f01f4d379f92aab5bf54900ad6e0dd20ff3a1
1 <?php
3 declare(strict_types=1);
5 namespace PhpMyAdmin\Twig;
7 use PhpMyAdmin\Html\Generator;
8 use PhpMyAdmin\Html\MySQLDocumentation;
9 use PhpMyAdmin\Util;
10 use PhpMyAdmin\Utils\Gis;
11 use Twig\Extension\AbstractExtension;
12 use Twig\TwigFilter;
13 use Twig\TwigFunction;
15 class UtilExtension extends AbstractExtension
17 /**
18 * Returns a list of functions to add to the existing list.
20 * @return TwigFunction[]
22 public function getFunctions(): array
24 return [
25 new TwigFunction(
26 'backquote',
27 Util::backquote(...),
29 new TwigFunction(
30 'extract_column_spec',
31 Util::extractColumnSpec(...),
33 new TwigFunction(
34 'format_byte_down',
35 Util::formatByteDown(...),
37 new TwigFunction(
38 'format_number',
39 Util::formatNumber(...),
41 new TwigFunction(
42 'format_sql',
43 Generator::formatSql(...),
44 ['is_safe' => ['html']],
46 new TwigFunction(
47 'get_docu_link',
48 MySQLDocumentation::getDocumentationLink(...),
49 ['is_safe' => ['html']],
51 new TwigFunction(
52 'get_list_navigator',
53 Generator::getListNavigator(...),
54 ['is_safe' => ['html']],
56 new TwigFunction(
57 'show_docu',
58 MySQLDocumentation::showDocumentation(...),
59 ['is_safe' => ['html']],
61 new TwigFunction(
62 'get_gis_datatypes',
63 Gis::getDataTypes(...),
65 new TwigFunction(
66 'get_gis_functions',
67 Gis::getFunctions(...),
69 new TwigFunction(
70 'get_icon',
71 Generator::getIcon(...),
72 ['is_safe' => ['html']],
74 new TwigFunction(
75 'get_image',
76 Generator::getImage(...),
77 ['is_safe' => ['html']],
79 new TwigFunction(
80 'get_supported_datatypes',
81 Generator::getSupportedDatatypes(...),
82 ['is_safe' => ['html']],
84 new TwigFunction(
85 'is_uuid_supported',
86 Util::isUUIDSupported(...),
88 new TwigFunction(
89 'link_or_button',
90 Generator::linkOrButton(...),
91 ['is_safe' => ['html']],
93 new TwigFunction(
94 'link_to_var_documentation',
95 Generator::linkToVarDocumentation(...),
96 ['is_safe' => ['html']],
98 new TwigFunction(
99 'show_hint',
100 Generator::showHint(...),
101 ['is_safe' => ['html']],
103 new TwigFunction(
104 'show_icons',
105 Util::showIcons(...),
107 new TwigFunction(
108 'show_text',
109 Util::showText(...),
111 new TwigFunction(
112 'show_mysql_docu',
113 MySQLDocumentation::show(...),
114 ['is_safe' => ['html']],
116 new TwigFunction(
117 'get_mysql_docu_url',
118 Util::getMySQLDocuURL(...),
119 ['is_safe' => ['html']],
121 new TwigFunction(
122 'get_docu_url',
123 Util::getDocuURL(...),
124 ['is_safe' => ['html']],
126 new TwigFunction(
127 'show_php_docu',
128 Generator::showPHPDocumentation(...),
129 ['is_safe' => ['html']],
131 new TwigFunction(
132 'sortable_table_header',
133 Util::sortableTableHeader(...),
134 ['is_safe' => ['html']],
136 new TwigFunction(
137 'timespan_format',
138 Util::timespanFormat(...),
140 new TwigFunction('parse_enum_set_values', 'PhpMyAdmin\Util::parseEnumSetValues'),
145 * Returns a list of filters to add to the existing list.
147 * @return TwigFilter[]
149 public function getFilters(): array
151 return [
152 new TwigFilter(
153 'convert_bit_default_value',
154 Util::convertBitDefaultValue(...),