MySLP_AJAX
extends SLP_BaseClass_AJAX
in package
Class MySLP_AJAX
Table of Contents
Properties
- $addon : SLP_BaseClass_Addon
- $formdata : array<string|int, mixed>
- $formdata_defaults : array<string|int, mixed>
- $formdata_set : bool
- $myslp : MySLP
- $plugin : mixed
- $query_params : array<string|int, mixed>
- $query_params_valid : array<string|int, string>
- $short_action : string
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $valid_actions : array<string|int, string>
- $slug : mixed
- $active_addon : mixed
- $csvImporter : mixed
Methods
- __construct() : mixed
- Contructor
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_ajax_hooks() : mixed
- Override this with the WordPress AJAX hooks you want to invoke.
- delete_single_location() : mixed
- Delete single location.
- do_ajax_startup() : mixed
- Things we do to latch onto an AJAX processing environment.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- initialize() : mixed
- Instantiate the admin panel object.
- is_valid_ajax_action() : mixed
- Return true if the AJAX action is one we process.
- process_management_data() : mixed
- Management Data tab processing
- process_management_ui() : mixed
- Management UI tab processing
- sanitize_query_params() : mixed|string
- A less aggressive query param processor.
- save_app_mode() : mixed
- Callback for the ajax action save_app_mode
- save_power_option() : mixed
- Save Category Settings
- send_JSON_response() : mixed
- Output a JSON response based on the incoming data and die.
- set_properties() : mixed
- Set our properties.
- set_QueryParams() : mixed
- Set incoming query and request parameters into object properties.
- get_ajax_user_input_data() : array<string|int, mixed>
- Get data from AJAX request, loading defaults as needed.
- update_addons_options() : array<string|int, mixed>
Properties
$addon
public
SLP_BaseClass_Addon
$addon
This addon pack.
$formdata
public
array<string|int, mixed>
$formdata
Form data that comes into the AJAX request in the formdata variable.
$formdata_defaults
public
array<string|int, mixed>
$formdata_defaults
The formdata default values.
$formdata_set read-only
public
bool
$formdata_set
Has the formdata been set already?
$myslp
public
MySLP
$myslp
$plugin
public
mixed
$plugin
$query_params
public
array<string|int, mixed>
$query_params
$query_params_valid
public
array<string|int, string>
$query_params_valid
Array of valid AJAX query parameters
$short_action read-only
public
string
$short_action
The shortened (csl_ajax prefix dropped) AJAX action.
$slplus
public
SLPlus
$slplus
$uses_myslp
public
bool
$uses_myslp
Set to true to add a $myslp property pointing to global $myslp
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$valid_actions
public
array<string|int, string>
$valid_actions
What AJAX actions are valid for this add on to process? Override in the extended class if not serving the default SLP actions: csl_ajax_onload csl_ajax_search
$slug
protected
mixed
$slug
$active_addon
private
mixed
$active_addon
= array()
$csvImporter
private
mixed
$csvImporter
Methods
__construct()
Contructor
public
__construct([mixed $options = array() ]) : mixed
Parameters
- $options : mixed = array()
__get()
public
__get(string $property) : SLPlus_BaseClass_Object
Parameters
- $property : string
Return values
SLPlus_BaseClass_Object__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
booladd_ajax_hooks()
Override this with the WordPress AJAX hooks you want to invoke.
public
add_ajax_hooks() : mixed
example: add_action('wp_ajax_csl_ajax_search' , array( $this,'csl_ajax_search' )) // For logged in users add_action('wp_ajax_nopriv_csl_ajax_search' , array( $this,'csl_ajax_search' )) // Not logged-in users
delete_single_location()
Delete single location.
public
delete_single_location() : mixed
Use this as backup once the REST API don't work
do_ajax_startup()
Things we do to latch onto an AJAX processing environment.
public
do_ajax_startup() : mixed
Add WordPress and SLP hooks and filters only if in AJAX mode.
WP syntax reminder: add_filter( <filter_name> ,
Remember:
- or - array(
Tags
get_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([bool $no_global = false ][, mixed $params = array() ]) : static
Parameters
- $no_global : bool = false
-
set to true to skip assigning object to SLP global as a property.
- $params : mixed = array()
-
object init params
Return values
staticinitialize()
Instantiate the admin panel object.
public
initialize() : mixed
Sets short_action property. Calls do_ajax_startup.
- sets Query Params (formdata)
- Calls process_{short_action} if method exists.
is_valid_ajax_action()
Return true if the AJAX action is one we process.
public
is_valid_ajax_action() : mixed
TODO: add a "source" parameter as well and set to "slp" then check that to make sure we only process SLP requests
process_management_data()
Management Data tab processing
public
process_management_data() : mixed
process_management_ui()
Management UI tab processing
public
process_management_ui() : mixed
sanitize_query_params()
A less aggressive query param processor.
public
sanitize_query_params(mixed $str) : mixed|string
We need to keep & as & for query strings. We also need to allow some form posts to send allowed HTML tags (layout settings).
Parameters
- $str : mixed
Return values
mixed|stringsave_app_mode()
Callback for the ajax action save_app_mode
public
save_app_mode() : mixed
save_power_option()
Save Category Settings
public
save_power_option() : mixed
send_JSON_response()
Output a JSON response based on the incoming data and die.
public
send_JSON_response(array<string|int, mixed> $data) : mixed
Used for AJAX processing in WordPress where a remote listener expects JSON data.
Parameters
- $data : array<string|int, mixed>
-
named array of keys and values to turn into JSON data
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
set_QueryParams()
Set incoming query and request parameters into object properties.
public
set_QueryParams() : mixed
get_ajax_user_input_data()
Get data from AJAX request, loading defaults as needed.
private
get_ajax_user_input_data(mixed $section, mixed $default[, bool $on_to_bool = false ]) : array<string|int, mixed>
Parameters
- $section : mixed
- $default : mixed
- $on_to_bool : bool = false
Return values
array<string|int, mixed>update_addons_options()
private
update_addons_options(mixed $addon_name, mixed $data) : array<string|int, mixed>
Parameters
- $addon_name : mixed
- $data : mixed