403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.217.39
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/d2m/sofident_cz/wp-content/plugins/wpml-string-translation/classes/shortcode/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/d2m/sofident_cz/wp-content/plugins/wpml-string-translation/classes/shortcode/LensFactory.php
<?php

namespace WPML\ST\Shortcode;


use WPML\FP\Fns;
use WPML\FP\Lst;
use WPML\FP\Obj;
use function WPML\Container\make;
use function WPML\FP\gatherArgs;
use function WPML\FP\invoke;
use function WPML\FP\pipe;

class LensFactory {

	public static function createLensForJobData() {
		// $get :: array->string[]
		$get = pipe( Obj::path( [ 'fields' ] ), Lst::pluck( 'data' ) );

		// $set :: string[]->array->array
		$set = function ( $newValue, $jobData ) {
			$newValue = Obj::objOf( 'fields', Fns::map( Obj::objOf( 'data' ), $newValue ) );

			return Obj::replaceRecursive( $newValue, $jobData );
		};

		return Obj::lens( $get, $set );
	}

	public static function createLensForProxyTranslations() {
		// $getTranslations :: \WPML_TP_Translation_Collection->\WPML_TP_Translation[]
		$getTranslations = pipe( invoke( 'to_array' ), Obj::prop( 'translations' ) );

		// $get :: \WPML_TP_Translation_Collection->string[]
		$get = pipe( $getTranslations, Fns::map( Obj::prop( 'target' ) ) );

		// $set :: string[]->\WPML_TP_Translation_Collection->\WPML_TP_Translation_Collection
		$set = function ( array $translations, \WPML_TP_Translation_Collection $tpTranslations ) use ( $getTranslations ) {
			$buildNewTranslations = pipe(
				$getTranslations,
				Fns::map( function ( $translation, $index ) use ( $translations ) {
					return make( '\WPML_TP_Translation', [
						':field'  => $translation['field'],
						':source' => $translation['source'],
						':target' => $translations[ $index ],
					] );
				} )
			);

			return make( '\WPML_TP_Translation_Collection', [
				':translations'    => $buildNewTranslations( $tpTranslations ),
				':source_language' => $tpTranslations->get_source_language(),
				':target_language' => $tpTranslations->get_target_language(),
			] );
		};

		return Obj::lens( $get, $set );
	}

	public static function createLensForAssignIdInCTE() {
		// $get :: array->string[]
		$get = Fns::map( Obj::prop( 'field_data' ) );

		// $set :: string[]->array->array
		$set = function ( $updatedTranslations, $fields ) {
			$newValue = Fns::map( Obj::objOf( 'field_data' ), $updatedTranslations );

			return Obj::replaceRecursive( $newValue, $fields );
		};

		return Obj::lens( $get, $set );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit