SLP® phpDocs

SLP_Premier_AJAX extends SLP_BaseClass_AJAX
in package

Holds the ajax-only code.

This allows the main plugin to only include this file in AJAX mode via the slp_init when DOING_AJAX is true.

Table of Contents

Properties

$addon  : mixed
$formdata  : array<string|int, mixed>
$formdata_defaults  : array<string|int, mixed>
$formdata_set  : bool
$myslp  : MySLP
$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  : mixed
$slug  : mixed
$territory  : mixed

Methods

__construct()  : mixed
__get()  : SLPlus_BaseClass_Object
__isset()  : bool
add_ajax_hooks()  : mixed
Things we do to latch onto an AJAX processing environment.
add_global_hooks()  : mixed
Global hooks, exposed possibly even outside AJAX.
do_ajax_startup()  : mixed
Things we want our add on packs to do when they start in AJAX mode.
drop_locations_not_in_radius_and_serving_territory()  : array<string|int, mixed>
Remove any locations whose territory does not cover the given lat/long.
get_category_name_separator()  : mixed
Setup the Tagalong interface.
get_instance()  : static
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
initialize()  : mixed
Initialize
is_valid_ajax_action()  : mixed
Return true if the AJAX action is one we process.
sanitize_query_params()  : mixed|string
A less aggressive query param processor.
send_JSON_response()  : mixed
Output a JSON response based on the incoming data and die.
set_location_search_queries()  : array<string|int, mixed>
Add the address within territory query to the stack of AJAX load/search queries on locations.
set_marker_in_territory_flag()  : array<string|int, mixed>
Add a marker property to note whether a location services the user's location.
set_properties()  : mixed
Set our properties.
set_QueryParams()  : mixed
Set incoming query and request parameters into object properties.
set_territory_bounds_on_import()  : void
Add the territory bounds for imported CSV data.
where_address_within_territory()  : string
Modify the AJAX selector to only get locations where address is within the territory.
where_territory_is_set()  : string
Modify the AJAX selector to only get locations serving this spot.
zip_selector_discreet_filter()  : string
Add a discreet zip filter to the search results.
create_object_territory()  : mixed
Create and attach the location import object.
process_zip_selector()  : mixed
Setup Zip Selector Filters

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_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 mixed $valid_actions = array('csl_ajax_onload', 'csl_ajax_search', 'slp_new_upload')

Methods

__construct()

public __construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

__isset()

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

add_ajax_hooks()

Things we do to latch onto an AJAX processing environment.

public add_ajax_hooks() : 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

    add_global_hooks()

    Global hooks, exposed possibly even outside AJAX.

    public add_global_hooks() : mixed

    do_ajax_startup()

    Things we want our add on packs to do when they start in AJAX mode.

    public do_ajax_startup() : mixed

    Add methods named process_{short_action_name} to the extended class, or override this method.

    Tags
    uses
    SLP_AJAX::process_location_manager

    NOTE: If you name something with process_{short_action_name} this will bypass the WordPress AJAX hooks and will run IMMEDIATELY when this class is instantiated.

    drop_locations_not_in_radius_and_serving_territory()

    Remove any locations whose territory does not cover the given lat/long.

    public drop_locations_not_in_radius_and_serving_territory(array<string|int, mixed> $results, mixed $query_slug) : array<string|int, mixed>
    Parameters
    $results : array<string|int, mixed>

    Results from a wpdb select

    $query_slug : mixed
    Return values
    array<string|int, mixed>

    $results

    get_category_name_separator()

    Setup the Tagalong interface.

    public get_category_name_separator(mixed $separator) : mixed
    Parameters
    $separator : mixed

    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
    static

    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

    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|string

    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_location_search_queries()

    Add the address within territory query to the stack of AJAX load/search queries on locations.

    public set_location_search_queries(array<string|int, mixed> $queries) : array<string|int, mixed>
    Parameters
    $queries : array<string|int, mixed>

    the standard query

    Return values
    array<string|int, mixed>

    the standard query PLUS the address within territory query

    set_marker_in_territory_flag()

    Add a marker property to note whether a location services the user's location.

    public set_marker_in_territory_flag(array<string|int, mixed> $marker) : array<string|int, mixed>
    Parameters
    $marker : array<string|int, mixed>
    Return values
    array<string|int, mixed>

    $marker

    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

    set_territory_bounds_on_import()

    Add the territory bounds for imported CSV data.

    public set_territory_bounds_on_import(mixed $data) : void

    POWER add-on uses AJAX for this.

    Parameters
    $data : mixed

    where_address_within_territory()

    Modify the AJAX selector to only get locations where address is within the territory.

    public where_address_within_territory(string $where_clause) : string
    Parameters
    $where_clause : string
    Return values
    string

    $where_clause

    where_territory_is_set()

    Modify the AJAX selector to only get locations serving this spot.

    public where_territory_is_set(string $where_clause) : string

    Since this is a WHERE clause and we don't have a MySQL PointInPolygon function , only do basic filtering of locations.

    If territory bounds is empty, do not return the location. If the distance unit is none do not return the location.

    Parameters
    $where_clause : string
    Return values
    string

    $where_clause

    zip_selector_discreet_filter()

    Add a discreet zip filter to the search results.

    public zip_selector_discreet_filter(string $where) : string
    Parameters
    $where : string
    Return values
    string

    create_object_territory()

    Create and attach the location import object.

    private create_object_territory() : mixed

    process_zip_selector()

    Setup Zip Selector Filters

    private process_zip_selector() : mixed
    
            
    On this page

    Search results