File manager - Edit - /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/gettext/gettext/src/Extractors/Csv.php
Back
<?php namespace Gettext\Extractors; use Gettext\Translations; use Gettext\Utils\HeadersExtractorTrait; use Gettext\Utils\CsvTrait; /** * Class to get gettext strings from csv. */ class Csv extends Extractor implements ExtractorInterface { use HeadersExtractorTrait; use CsvTrait; public static $options = [ 'delimiter' => ",", 'enclosure' => '"', 'escape_char' => "\\" ]; /** * {@inheritdoc} */ public static function fromString($string, Translations $translations, array $options = []) { $options += static::$options; $handle = fopen('php://memory', 'w'); fputs($handle, $string); rewind($handle); while ($row = static::fgetcsv($handle, $options)) { $context = array_shift($row); $original = array_shift($row); if ($context === '' && $original === '') { static::extractHeaders(array_shift($row), $translations); continue; } $translation = $translations->insert($context, $original); if (!empty($row)) { $translation->setTranslation(array_shift($row)); $translation->setPluralTranslations($row); } } fclose($handle); } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings