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,42 @@
<?php
class WPML_Ajax_Response {
private $success;
private $response_data;
public function __construct( $success, $response_data ) {
$this->success = $success;
$this->response_data = $response_data;
}
public function send_json() {
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
if ( $this->success ) {
wp_send_json_success( $this->response_data );
} else {
wp_send_json_error( $this->response_data );
}
} else {
throw new WPML_Not_Doing_Ajax_On_Send_Exception( $this );
}
}
public function is_success() {
return $this->success;
}
public function get_response() {
return $this->response_data;
}
}
class WPML_Not_Doing_Ajax_On_Send_Exception extends Exception {
public $response;
public function __construct( $response ) {
parent::__construct( 'Not doing AJAX' );
$this->response = $response;
}
};