Class to get gettext strings from php files returning arrays.
More...
Class to get gettext strings from php files returning arrays.
Definition at line 11 of file PhpCode.php.
◆ convertString()
static Gettext\Extractors\PhpCode::convertString |
( |
|
$value | ) |
|
|
static |
Decodes a T_CONSTANT_ENCAPSED_STRING string.
- Parameters
-
- Returns
- string
Definition at line 72 of file PhpCode.php.
Referenced by Gettext\Utils\PhpFunctionsScanner\getFunctions().
74 if (strpos($value,
'\\') ===
false) {
75 return substr($value, 1, -1);
78 if ($value[0] ===
"'") {
79 return strtr(substr($value, 1, -1), array(
'\\\\' =>
'\\',
'\\\'' =>
'\''));
82 $value = substr($value, 1, -1);
84 return preg_replace_callback(
'/\\\(n|r|t|v|e|f|\$|"|\\\|x[0-9A-Fa-f]{1,2}|u{[0-9a-f]{1,6}}|[0-7]{1,3})/',
function ($match) {
85 switch ($match[1][0]) {
105 return chr(hexdec(substr($match[0], 1)));
107 return self::unicodeChar(hexdec(substr($match[0], 1)));
109 return chr(octdec($match[0]));
◆ fromString()
static Gettext\Extractors\PhpCode::fromString |
( |
|
$string, |
|
|
Translations |
$translations = null , |
|
|
|
$file = '' |
|
) |
| |
|
static |
◆ unicodeChar()
static Gettext\Extractors\PhpCode::unicodeChar |
( |
|
$dec | ) |
|
|
staticprivate |
Definition at line 115 of file PhpCode.php.
122 return chr(0xC0 + ($dec >> 6))
123 .chr(0x80 + ($dec & 0x3f));
126 if ($dec < 0x010000) {
127 return chr(0xE0 + ($dec >> 12))
128 .chr(0x80 + (($dec >> 6) & 0x3f))
129 .chr(0x80 + ($dec & 0x3f));
132 if ($dec < 0x200000) {
133 return chr(0xF0 + ($dec >> 18))
134 .chr(0x80 + (($dec >> 12) & 0x3f))
135 .chr(0x80 + (($dec >> 6) & 0x3f))
136 .chr(0x80 + ($dec & 0x3f));
◆ $extractComments
Gettext\Extractors\PhpCode::$extractComments = false |
|
static |
◆ $functions
Gettext\Extractors\PhpCode::$functions |
|
static |
Initial value:= array(
'gettext' => '__',
'__' => '__',
'__e' => '__',
'ngettext' => 'n__',
'n__' => 'n__',
'n__e' => 'n__',
'pgettext' => 'p__',
'p__' => 'p__',
'p__e' => 'p__',
'dgettext' => 'd__',
'd__' => 'd__',
'd__e' => 'd__',
'dpgettext' => 'dp__',
'dp__' => 'dp__',
'dp__e' => 'dp__',
'npgettext' => 'np__',
'np__' => 'np__',
'np__e' => 'np__',
'dnpgettext' => 'dnp__',
'dnp__' => 'dnp__',
'dnp__e' => 'dnp__',
)
Definition at line 13 of file PhpCode.php.
Referenced by Gettext\Extractors\Twig\fromString(), and Gettext\Extractors\PhpCode\fromString().
The documentation for this class was generated from the following file:
- libs/composer/vendor/gettext/gettext/src/Extractors/PhpCode.php