SLP_REST_Handler
extends SLPlus_BaseClass_Object
in package
WP REST API interface.
Read the REST API documentation for more details.
Table of Contents
Properties
- $slplus : SLPlus
- $uses_slplus : bool
- $slplus : mixed
- $uses_slplus : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_location() : WP_Error|WP_REST_Response
- Add a location.
- delete_location_by_id() : WP_Error|WP_REST_Response
- Delete a single location
- geocode_address() : void|WP_REST_Response
- Serves the change setting endpoint.
- get_all_options() : WP_Error|WP_REST_Response
- Return the current value of a smart option.
- get_instance() : SLPlus_BaseClass_Object
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_location_by_id() : WP_Error|WP_REST_Response
- Return a single location.
- get_locations() : WP_Error|WP_REST_Response
- Return a list of locations.
- get_rest_path() : string
- Return rest path.
- get_smart_option() : WP_Error|WP_REST_Response
- Return the current value of a smart option.
- get_smart_option_filtered() : WP_Error|WP_REST_Response
- Return the current value of a smart option.
- getEnvironment() : void|WP_REST_Response
- Get the environment info
- getSchedule() : void|WP_REST_Response
- Get the environment info
- import_options() : WP_Error|WP_REST_Response
- Import the options JSON file.
- initialize() : mixed
- Things we do at the start.
- set_properties() : mixed
- Set our properties.
- setup_rest() : mixed
- Only if REST_REQUEST is defined.
- update_location() : WP_Error|WP_REST_Response
- Update a location.
- update_smart_option() : SLP_Option|WP_Error|WP_REST_Response|null
- Update a smart option.
- user_can_manage_slp() : bool
- Return true if user can manage SLP.
- valid_referer() : bool
- Validate the referrer as coming from this site.
- validate_apikey() : bool
- Validate the API key.
- set_rest_hooks() : mixed
- Set the rest hooks.
- setup_rest_cross_version_endpoints() : mixed
- Setup cross-version REST endpoints
- setup_rest_endpoints() : mixed
- Setup the REST endpoints for Store Locator Plus.
Properties
$slplus
public
SLPlus
$slplus
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$slplus
protected
mixed
$slplus
$uses_slplus
protected
mixed
$uses_slplus
= \true
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, 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_location()
Add a location.
public
add_location(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responsedelete_location_by_id()
Delete a single location
public
delete_location_by_id(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responsegeocode_address()
Serves the change setting endpoint.
public
geocode_address(WP_REST_Request $request) : void|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
void|WP_REST_Responseget_all_options()
Return the current value of a smart option.
public
get_all_options(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseget_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_Objectget_location_by_id()
Return a single location.
public
get_location_by_id(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseget_locations()
Return a list of locations.
public
get_locations(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseget_rest_path()
Return rest path.
public
get_rest_path() : string
Return values
stringget_smart_option()
Return the current value of a smart option.
public
get_smart_option(WP_REST_Request $request[, mixed $filtered = false ]) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
- $filtered : mixed = false
Return values
WP_Error|WP_REST_Responseget_smart_option_filtered()
Return the current value of a smart option.
public
get_smart_option_filtered(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_ResponsegetEnvironment()
Get the environment info
public
getEnvironment(WP_REST_Request $request) : void|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
void|WP_REST_ResponsegetSchedule()
Get the environment info
public
getSchedule(WP_REST_Request $request) : void|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
void|WP_REST_Responseimport_options()
Import the options JSON file.
public
import_options(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseinitialize()
Things we do at the start.
public
initialize() : mixed
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
setup_rest()
Only if REST_REQUEST is defined.
public
setup_rest() : mixed
update_location()
Update a location.
public
update_location(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_Error|WP_REST_Responseupdate_smart_option()
Update a smart option.
public
update_smart_option(WP_REST_Request $request[, bool $filtered = false ]) : SLP_Option|WP_Error|WP_REST_Response|null
Parameters
- $request : WP_REST_Request
- $filtered : bool = false
Return values
SLP_Option|WP_Error|WP_REST_Response|nulluser_can_manage_slp()
Return true if user can manage SLP.
public
user_can_manage_slp() : bool
Return values
boolvalid_referer()
Validate the referrer as coming from this site.
public
valid_referer(WP_REST_Request $request) : bool
Parameters
- $request : WP_REST_Request
Return values
boolvalidate_apikey()
Validate the API key.
public
validate_apikey( $param, $request, $key) : bool
Parameters
Return values
boolset_rest_hooks()
Set the rest hooks.
private
set_rest_hooks() : mixed
setup_rest_cross_version_endpoints()
Setup cross-version REST endpoints
private
setup_rest_cross_version_endpoints(string $version) : mixed
Parameters
- $version : string
setup_rest_endpoints()
Setup the REST endpoints for Store Locator Plus.
private
setup_rest_endpoints() : mixed