Store Locator Plus®

MySLP_AJAX extends SLP_BaseClass_AJAX
in package

Class MySLP_AJAX

Table of Contents

Properties

$addon  : mixed
$addon  : SLP_BaseClass_Addon
$formdata  : array<string|int, mixed>
$formdata_defaults  : array<string|int, mixed>
$formdata_set  : bool
$plugin  : mixed
$query_params  : mixed
$query_params  : array<string|int, mixed>
$query_params_valid  : array<string|int, string>
$short_action  : string
$slplus  : SLPlus
$uses_slplus  : bool
$valid_actions  : array<string|int, string>
$formdata  : mixed
$formdata_defaults  : mixed
$query_params_valid  : mixed
$slplus  : mixed
$uses_slplus  : mixed
$valid_actions  : mixed
$active_addon  : mixed
$csvImporter  : mixed
$formdata_set  : mixed
$set_query_params_done  : mixed
$short_action  : 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.
dismiss_welcome_tour()  : mixed
Callback for the ajax action dismissWelcomeTour
do_ajax_startup()  : mixed
Things we do to latch onto an AJAX processing environment.
get_instance()  : SLPlus_BaseClass_Object
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
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.
initialize()  : mixed
Do these things when this object is invoked. Override in your class.
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

$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?

$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.

$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

$valid_actions

protected mixed $valid_actions = array('csl_ajax_onload', 'csl_ajax_search')

$active_addon

private mixed $active_addon = array()

$set_query_params_done

private mixed $set_query_params_done = \false

Methods

__construct()

Contructor

public __construct([mixed $options = array() ]) : mixed
Parameters
$options : mixed = array()

__isset()

public __isset(string $property) : bool
Parameters
$property : string
Return values
bool

add_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

dismiss_welcome_tour()

Callback for the ajax action dismissWelcomeTour

public dismiss_welcome_tour() : mixed

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> , , , # of params )

Remember: can be a simple function name as a string

  • or - array( , 'method_name_as_string' ) for a class method In either case the or needs to be declared public.
    Tags
    link
    http://codex.wordpress.org/Function_Reference/add_filter

    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() ]) : SLPlus_BaseClass_Object

    TODO: PHP7.4 and PHP8.0 the static instance variable returns an object matching $class TODO: PHP8.1 the static instance continually returns the FIRST object (SLP_Admin_Helper) every time -- it is like PHP8.1 static instance is bound to base_class-object versus the calling class object

    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
    SLPlus_BaseClass_Object

    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( $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 :
    Return values
    mixed|string

    save_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

    initialize()

    Do these things when this object is invoked. Override in your class.

    protected initialize() : mixed

    get_ajax_user_input_data()

    Get data from AJAX request, loading defaults as needed.

    private get_ajax_user_input_data( $section,  $default[, bool $on_to_bool = false ]) : array<string|int, mixed>
    Parameters
    $section :
    $default :
    $on_to_bool : bool = false
    Return values
    array<string|int, mixed>

    update_addons_options()

    private update_addons_options( $addon_name,  $data) : array<string|int, mixed>
    Parameters
    $addon_name :
    $data :
    Return values
    array<string|int, mixed>
    
            
    On this page

    Search results