| Server IP : 123.56.80.60 / Your IP : 216.73.216.78 Web Server : Apache/2.4.54 (Win32) OpenSSL/1.1.1s PHP/7.4.33 mod_fcgid/2.3.10-dev System : Windows NT iZhx3sob14hnz7Z 10.0 build 14393 (Windows Server 2016) i586 User : SYSTEM ( 0) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/site/20241224/spunner/wp-content/plugins/astra-sites/inc/lib/ai-builder/inc/ajax/ |
Upload File : |
<?php
/**
* AiBuilder Ajax Base.
*
* @package AiBuilder
*/
namespace AiBuilder\Inc\Ajax;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AiBuilder\Inc\Ajax\AjaxErrors;
/**
* Class Admin_Menu.
*/
abstract class AjaxBase {
/**
* Ajax action prefix.
*
* @var string
*/
private $prefix = 'astra-sites';
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
}
/**
* Register ajax events.
*
* @param array<int, string> $ajax_events Ajax events.
*
* @return void
*/
public function init_ajax_events( $ajax_events ) {
if ( ! empty( $ajax_events ) ) {
foreach ( $ajax_events as $ajax_event ) {
add_action( 'wp_ajax_' . $this->prefix . '-' . $ajax_event, array( $this, $ajax_event ) ); // @phpstan-ignore-line
}
}
}
/**
* Get ajax error message.
*
* @param string $type Message type.
* @return string
*/
public function get_error_msg( $type ) {
if ( class_exists( 'AiBuilder\Inc\Ajax\AjaxErrors' ) && method_exists( AjaxErrors::Instance(), 'get_error_msg' ) ) {
return AjaxErrors::Instance()->get_error_msg( $type );
}
return '';
}
}