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,43 @@
<?php
namespace WPML\TM\ATE\ClonedSites;
class ReportAjax implements \IWPML_Backend_Action, \IWPML_DIC_Action {
/**
* @var Report
*/
private $reportHandler;
/**
* @param Report $reportHandler
*/
public function __construct( Report $reportHandler ) {
$this->reportHandler = $reportHandler;
}
public function add_hooks() {
add_action( 'wp_ajax_wpml_save_cloned_sites_report_type', [ $this, 'reportSiteCloned' ] );
}
/**
* @param string $reportType
*/
public function handleInstallerSiteUrlDetection($reportType) {
$this->reportHandler->report( $reportType );
}
public function reportSiteCloned() {
if ( $this->isValidRequest() && $this->reportHandler->report( $_POST['reportType'] ) ) {
wp_send_json_success();
} else {
wp_send_json_error();
}
}
private function isValidRequest() {
return array_key_exists( 'nonce', $_POST )
&& array_key_exists( 'reportType', $_POST )
&& wp_verify_nonce( $_POST['nonce'], 'icl_doc_translation_method_cloned_nonce' );
}
}