Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/plugins/wpml-string-translation/classes/translation-memory/FetchTranslationMemory.php
Назад
<?php namespace WPML\ST\Main\Ajax; use WPML\Ajax\IHandler; use WPML\Collect\Support\Collection; use WPML\FP\Either; use WPML\FP\Fns; use WPML\FP\Lst; use WPML\FP\Obj; class FetchTranslationMemory implements IHandler { /** @var \WPML_ST_Translation_Memory_Records $records */ private $records; public function __construct( \WPML_ST_Translation_Memory_Records $records ) { $this->records = $records; } public function run( Collection $data ) { $translations = Obj::prop( 'batch', $data ) ? $this->fetchBatchStrings( Obj::prop( 'strings', $data ) ) : $this->fetchSingleString( $data ); if ( $translations !== false ) { return Either::of( $translations ); } else { return Either::left( 'invalid data' ); } } private function fetchBatchStrings( $strings ) { $results = Fns::map( [ $this, 'fetchSingleString' ], $strings ); return Lst::includes( false, $results ) ? false : $results; } public function fetchSingleString( $data ) { $string = Obj::prop( 'string', $data ); $source = Obj::prop( 'source', $data ); $target = Obj::prop( 'target', $data ); if ( $string && $source && $target ) { return $this->records->get( [ $string ], $source, $target ); } else { return false; } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка