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,11 @@
<?php
class WPML_ST_Theme_Plugin_Hooks_Factory implements IWPML_Backend_Action_Loader {
/**
* @return WPML_ST_Theme_Plugin_Hooks
*/
public function create() {
return new WPML_ST_Theme_Plugin_Hooks( new WPML_ST_File_Hashing() );
}
}

View File

@@ -0,0 +1,17 @@
<?php
class WPML_ST_Update_File_Hash_Ajax_Factory extends WPML_AJAX_Base_Factory implements IWPML_Backend_Action_Loader {
const AJAX_ACTION = 'update_file_hash';
const NONCE = 'wpml-update-file-hash-nonce';
/** @return null|WPML_ST_Update_File_Hash_Ajax */
public function create() {
$hooks = null;
if ( $this->is_valid_action( self::AJAX_ACTION ) ) {
$hooks = new WPML_ST_Update_File_Hash_Ajax( new WPML_ST_File_Hashing() );
}
return $hooks;
}
}

View File

@@ -0,0 +1,10 @@
<?php
class WPML_ST_Plugin_String_Scanner_Factory {
/** @return WPML_Plugin_String_Scanner */
public function create() {
$file_hashing = new WPML_ST_File_Hashing();
return new WPML_Plugin_String_Scanner( wpml_get_filesystem_direct(), $file_hashing );
}
}

View File

@@ -0,0 +1,20 @@
<?php
class WPML_ST_Theme_Plugin_Scan_Dir_Ajax_Factory extends WPML_AJAX_Base_Factory implements IWPML_Backend_Action_Loader {
const AJAX_ACTION = 'wpml_get_files_to_scan';
const NONCE = 'wpml-get-files-to-scan-nonce';
/** @return null|WPML_ST_Theme_Plugin_Scan_Dir_Ajax */
public function create() {
$hooks = null;
if ( $this->is_valid_action( self::AJAX_ACTION ) ) {
$scan_dir = new WPML_ST_Scan_Dir();
$file_hashing = new WPML_ST_File_Hashing();
$hooks = new WPML_ST_Theme_Plugin_Scan_Dir_Ajax( $scan_dir, $file_hashing );
}
return $hooks;
}
}

View File

@@ -0,0 +1,28 @@
<?php
class WPML_ST_Theme_Plugin_Scan_Files_Ajax_Factory extends WPML_AJAX_Base_Factory implements IWPML_Backend_Action_Loader {
const AJAX_ACTION = 'wpml_st_scan_chunk';
const NONCE = 'wpml-scan-files-nonce';
/** @return null|WPML_ST_Theme_Plugin_Scan_Files_Ajax */
public function create() {
$hooks = null;
$scan_factory = '';
if ( $this->is_valid_action( self::AJAX_ACTION ) ) {
if ( array_key_exists( 'theme', $_POST ) ) {
$scan_factory = new WPML_ST_Theme_String_Scanner_Factory();
} elseif ( array_key_exists( 'plugin', $_POST ) ) {
$scan_factory = new WPML_ST_Plugin_String_Scanner_Factory();
}
if ( $scan_factory ) {
$scan = $scan_factory->create();
$hooks = new WPML_ST_Theme_Plugin_Scan_Files_Ajax( $scan );
}
}
return $hooks;
}
}

View File

@@ -0,0 +1,10 @@
<?php
class WPML_ST_Theme_String_Scanner_Factory {
/** @return WPML_Theme_String_Scanner */
public function create() {
$file_hashing = new WPML_ST_File_Hashing();
return new WPML_Theme_String_Scanner( wpml_get_filesystem_direct(), $file_hashing );
}
}