first commit

This commit is contained in:
2023-09-12 21:41:04 +02:00
commit 3361a7f053
13284 changed files with 2116755 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
<?php
use function WPML\FP\invoke;
class WPML_TM_ATE_Job_Repository {
/** @var WPML_TM_Jobs_Repository */
private $job_repository;
public function __construct( WPML_TM_Jobs_Repository $job_repository ) {
$this->job_repository = $job_repository;
}
/**
* @return WPML_TM_Jobs_Collection
*/
public function get_jobs_to_sync() {
$search_params = new WPML_TM_Jobs_Search_Params();
$search_params->set_scope( WPML_TM_Jobs_Search_Params::SCOPE_LOCAL );
$search_params->set_status( self::get_in_progress_statuses() );
$search_params->set_job_types( [
WPML_TM_Job_Entity::POST_TYPE,
WPML_TM_Job_Entity::PACKAGE_TYPE,
WPML_TM_Job_Entity::STRING_BATCH,
] );
return $this->job_repository
->get( $search_params )
->filter( invoke( 'is_ate_job' ) );
}
/** @return array */
public static function get_in_progress_statuses() {
return array( ICL_TM_WAITING_FOR_TRANSLATOR, ICL_TM_IN_PROGRESS );
}
}

View File

@@ -0,0 +1,51 @@
<?php
/**
* @author OnTheGo Systems
*/
class WPML_TM_ATE_Models_Job_Create {
/** @var int */
public $deadline;
/** @var WPML_TM_ATE_Models_Job_File */
public $file;
/** @var bool */
public $notify_enabled;
/** @var string */
public $notify_url;
/** @var int */
public $source_id;
/** @var string */
public $permalink;
/** @var string */
public $site_identifier;
/** @var WPML_TM_ATE_Models_Language */
public $source_language;
/** @var WPML_TM_ATE_Models_Language */
public $target_language;
/** @var string */
public $ate_ams_console_url;
/**
* WPML_TM_ATE_Models_Job_Create constructor.
*
* @param array $args
*
* @throws \Auryn\InjectionException
*/
public function __construct( array $args = array() ) {
foreach ( $args as $key => $value ) {
$this->$key = $value;
}
if ( ! $this->file ) {
$this->file = new WPML_TM_ATE_Models_Job_File();
}
if ( ! $this->source_language ) {
$this->source_language = new WPML_TM_ATE_Models_Language();
}
if ( ! $this->target_language ) {
$this->target_language = new WPML_TM_ATE_Models_Language();
}
$this->ate_ams_console_url = wpml_tm_get_ams_ate_console_url();
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* @author OnTheGo Systems
*/
class WPML_TM_ATE_Models_Job_File {
public $content;
public $name;
public $type;
/**
* WPML_TM_ATE_Models_Job_File constructor.
*
* @param array $args
*/
public function __construct( array $args = array() ) {
foreach ( $args as $key => $value ) {
$this->$key = $value;
}
}
}

View File

@@ -0,0 +1,9 @@
<?php
/**
* @author OnTheGo Systems
*/
class WPML_TM_ATE_Models_Language {
public $code;
public $name;
}

View File

@@ -0,0 +1,26 @@
<?php
/**
* @author OnTheGo Systems
*/
class WPML_TM_Job_Created {
public $job_id;
public $rid;
public $translation_service;
public $translator_id;
public $translation_package;
public $batch_options;
public $data;
/**
* WPML_TM_Job_Created constructor.
*
* @param array $args
*/
public function __construct( array $args ) {
foreach ( $args as $key => $value ) {
$this->$key = $value;
}
}
}