HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/testingff/public_html/fdfctr/wp-content/plugins/lifterlms/assets/js/app/llms-ajax.js
/**
 * Main Ajax class
 * Handles Primary Ajax connection
 *
 * @package LifterLMS/Scripts
 *
 * @since Unknown
 * @version Unknown
 */

LLMS.Ajax = {

	/**
	 * Url
	 *
	 * @type {String}
	 */
	url: window.ajaxurl || window.llms.ajaxurl,

	/**
	 * Type
	 *
	 * @type {[type]}
	 */
	type: 'post',

	/**
	 * Data
	 *
	 * @type {[type]}
	 */
	data: [],

	/**
	 * Cache
	 *
	 * @type {[type]}
	 */
	cache: false,

	/**
	 * DataType
	 * defaulted to json
	 *
	 * @type {String}
	 */
	dataType: 'json',

	/**
	 * Async
	 * default to false
	 *
	 * @type {Boolean}
	 */
	async: true,

	response:[],

	/**
	 * Initialize Ajax methods
	 *
	 * @since Unknown
	 * @since 4.4.0 Update ajax nonce source.
	 *
	 * @param {Object} obj Options object.
	 * @return {Object}
	 */
	init: function( obj ) {

		// If obj is not of type object or null return false.
		if ( obj === null || typeof obj !== 'object' ) {
			return false;
		}

		// set object defaults if values are not supplied
		obj.url      = 'url'         in obj ? obj.url : this.url;
		obj.type     = 'type' 		in obj ? obj.type : this.type;
		obj.data     = 'data' 		in obj ? obj.data : this.data;
		obj.cache    = 'cache' 		in obj ? obj.cache : this.cache;
		obj.dataType = 'dataType'	in obj ? obj.dataType : this.dataType;
		obj.async    = 'async'		in obj ? obj.async : this.async;

		// Add nonce to data object.
		obj.data._ajax_nonce = window.llms.ajax_nonce || wp_ajax_data.nonce;

		// Add post id to data object.
		var $R           = LLMS.Rest,
		query_vars       = $R.get_query_vars();
		obj.data.post_id = 'post' in query_vars ? query_vars.post : null;
		if ( ! obj.data.post_id && $( 'input#post_ID' ).length ) {
			obj.data.post_id = $( 'input#post_ID' ).val();
		}

		return obj;
	},

	/**
	 * Call
	 * Called by external classes
	 * Sets up jQuery Ajax object
	 *
	 * @param  {[object]} [object of ajax settings]
	 * @return {[mixed]} [false if not object or this]
	 */
	call: function(obj) {

		// get default variables if not included in call
		var settings = this.init( obj );

		// if init return a response of false
		if ( ! settings) {
			return false;
		} else {
			this.request( settings );
		}

		return this;

	},

	/**
	 * Calls jQuery Ajax on settings object
	 *
	 * @return {[object]} [this]
	 */
	request: function(settings) {

		$.ajax( settings );

		return this;

	}

};