HEX
Server: LiteSpeed
System: Linux venus 5.15.0-153-generic #163-Ubuntu SMP Thu Aug 7 16:37:18 UTC 2025 x86_64
User: axxoncom (1007)
PHP: 8.3.19
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/axxoncom/domains/nazade.xyz/private_html/wp-content/plugins/stratum/includes/ajax-manager.php
<?php

namespace Stratum\Managers;

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * Class Ajax_Manager
 * @package Stratum
 */
class Ajax_Manager {

	/**
	 * Ajax_Manager constructor.
	 */
	public function __construct() {
		//Ajax (Admin)
		add_action( 'elementor/ajax/register_actions', [ $this, 'register_admin_ajax_actions' ] );
	}

	public function register_admin_ajax_actions($ajax_manager) {
		$ajax_manager->register_ajax_action( 'stratum_get_elementor_templates', [ $this, 'stratum_get_elementor_templates' ] );
	}

	public static function stratum_get_elementor_templates($data = []){
		$args = [
			'post_type' => 'elementor_library',
			'posts_per_page' => -1,
		];

		//Call from AJAX
		if (!empty($data)){
			//Check nonce
			$nonce = $data['nonce'];
			if ( ! wp_verify_nonce( $nonce, 'stratum_nonce_get_elementor_templates' ) ) {
				wp_send_json_error();
			}
		}

		$page_templates = get_posts($args);
		$options = array();

		if (!empty($page_templates) && !is_wp_error($page_templates)) {
			foreach ($page_templates as $post) {
				$options[$post->ID] = $post->post_title;
			}
		}
		return $options;
	}

	public function register_ajax_action($action, $func){
		add_action( "wp_ajax_{$action}", [ $this, $func ] );
		add_action( "wp_ajax_nopriv_{$action}", [ $this, $func ] );
	}
}