Uname:Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64

403WebShell
403Webshell
Server IP : 188.114.96.2  /  Your IP : 104.23.197.230
Web Server : Apache/2.4.59 (Debian)
System : Linux EDL-STRETCH 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : edlftp ( 1002)
PHP Version : 7.4.33
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/nicolasj/www/ecoledelangues.be/wp-content/plugins/sitepress-multilingual-cms/API/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/nicolasj/www/ecoledelangues.be/wp-content/plugins/sitepress-multilingual-cms/API/ATE.php
<?php

namespace WPML\TM\API;

use WPML\FP\Obj;
use WPML\FP\Relation;
use WPML\LIB\WP\Post;
use WPML_TM_ATE_API;
use WPML_TM_ATE_Jobs;
use function WPML\FP\pipe;

class ATE {
	/** @var WPML_TM_ATE_API $ateApi */
	private $ateApi;

	/** @var WPML_TM_ATE_Jobs $ateJobs */
	private $ateJobs;

	public function __construct( WPML_TM_ATE_API $ateApi, WPML_TM_ATE_Jobs $ateJobs ) {
		$this->ateApi  = $ateApi;
		$this->ateJobs = $ateJobs;
	}

	public function checkJobStatus( $wpmlJobId ) {
		$ateJobId = $this->ateJobs->get_ate_job_id( $wpmlJobId );
		$response = $this->ateApi->get_job_status_with_priority( $ateJobId );

		if ( is_wp_error( $response ) ) {
			return [];
		}

		$encoded = wp_json_encode( $response );
		if ( ! $encoded ) {
			return [];
		}

		return wpml_collect( json_decode( $encoded, true ) )->first(
			pipe(
				Obj::prop( 'ate_job_id' ),
				Relation::equals( $ateJobId )
			)
		);
	}

	public function applyTranslation( $wpmlJobId, $postId, $xliffUrl ) {
		$ateJobId     = $this->ateJobs->get_ate_job_id( $wpmlJobId );
		$xliffContent = $this->ateApi->get_remote_xliff_content( $xliffUrl, [ 'jobId' => $wpmlJobId, 'ateJobId' => $ateJobId ] );

		if ( ! function_exists( 'wpml_tm_save_data' ) ) {
			require_once WPML_TM_PATH . '/inc/wpml-private-actions.php';
		}

		$prevPostStatus = Post::getStatus( $postId );
		if ( $this->ateJobs->apply( $xliffContent ) ) {
			if ( Post::getStatus( $postId ) !== $prevPostStatus ) {
				Post::setStatus( $postId, $prevPostStatus );
			}
			$response = $this->ateApi->confirm_received_job( $ateJobId );

			return ! is_wp_error( $response );
		}

		return false;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit