SLP_Power_REST_Handler
extends SLPlus_BaseClass_Object
in package
Configure the REST handler and connect to WordPress engine.
Table of Contents
Properties
- $addon : object
- $myslp : MySLP
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $slug : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- can_manage_locations() : bool
- Confirm the request can manage Store Locator Plus locations.
- clear_import_messages() : WP_REST_Response
- Clear persisted import messages.
- delete_recent_upload() : WP_Error|WP_REST_Response
- Permanently delete one CSV file from the uploads directory.
- get_geocoding() : WP_Error|WP_REST_Response
- Return a list of active location imports by attachment ID.
- get_imports() : WP_Error|WP_REST_Response
- Return a list of active location imports by attachment ID.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_recent_upload() : WP_Error|WP_REST_Response
- Preview or download one CSV file from the uploads directory.
- get_recent_uploads() : WP_Error|WP_REST_Response
- List CSV files stored in this site's WordPress uploads directory.
- GetReportLocationResultHistoryCount() : WP_REST_Response
- Handle the REST requests coming in on /report/location/result_history_count
- GetReportLocationSearchHistory() : WP_REST_Response
- Handle the REST requests coming in on /report/location/search_history
- GetReportLocationSearchHistoryCount() : WP_REST_Response
- Handle the REST requests coming in on /report/location/search_history_count
- GetReportLocationSearchResultHistory() : WP_REST_Response
- Handle the REST requests coming in on /report/location/search_result_history
- initialize() : mixed
- Get us going.
- schedule_import() : WP_Error|WP_REST_Response
- Save import settings and schedule a remote CSV import.
- set_properties() : void
- Set our properties.
- start_recent_upload_import() : WP_Error|WP_REST_Response
- Start an import for a CSV file that is already in the WordPress uploads directory.
- download_upload_file() : void
- Send a CSV file as a browser download.
- encode_upload_id() : string
- Encode an uploads-relative path for use as an opaque REST row ID.
- find_or_create_upload_attachment() : int|WP_Error
- Find the media attachment for an uploaded CSV, creating one when needed.
- get_uploads_directory() : array{path: string}|WP_Error
- Return the canonical uploads directory.
- resolve_upload_file() : string|WP_Error
- Resolve and validate one opaque upload ID.
- setup_endpoints() : mixed
- Setup endpoints.
Properties
$addon
public
object
$addon
$myslp
public
MySLP
$myslp
$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.
$slug
protected
mixed
$slug
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
boolcan_manage_locations()
Confirm the request can manage Store Locator Plus locations.
public
can_manage_locations() : bool
Return values
boolclear_import_messages()
Clear persisted import messages.
public
clear_import_messages() : WP_REST_Response
Return values
WP_REST_Responsedelete_recent_upload()
Permanently delete one CSV file from the uploads directory.
public
delete_recent_upload(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
-
REST request.
Return values
WP_Error|WP_REST_Responseget_geocoding()
Return a list of active location imports by attachment ID.
public
get_geocoding(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Tags
Return values
WP_Error|WP_REST_Responseget_imports()
Return a list of active location imports by attachment ID.
public
get_imports(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
Tags
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() ]) : 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
staticget_recent_upload()
Preview or download one CSV file from the uploads directory.
public
get_recent_upload(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
-
REST request.
Return values
WP_Error|WP_REST_Responseget_recent_uploads()
List CSV files stored in this site's WordPress uploads directory.
public
get_recent_uploads() : WP_Error|WP_REST_Response
Return values
WP_Error|WP_REST_ResponseGetReportLocationResultHistoryCount()
Handle the REST requests coming in on /report/location/result_history_count
public
GetReportLocationResultHistoryCount(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_ResponseGetReportLocationSearchHistory()
Handle the REST requests coming in on /report/location/search_history
public
GetReportLocationSearchHistory(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Tags
Return values
WP_REST_ResponseGetReportLocationSearchHistoryCount()
Handle the REST requests coming in on /report/location/search_history_count
public
GetReportLocationSearchHistoryCount(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_ResponseGetReportLocationSearchResultHistory()
Handle the REST requests coming in on /report/location/search_result_history
public
GetReportLocationSearchResultHistory(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseinitialize()
Get us going.
public
initialize() : mixed
schedule_import()
Save import settings and schedule a remote CSV import.
public
schedule_import(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
-
REST request.
Return values
WP_Error|WP_REST_Responseset_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : void
Parameters
- $options : array<string|int, mixed> = array()
start_recent_upload_import()
Start an import for a CSV file that is already in the WordPress uploads directory.
public
start_recent_upload_import(WP_REST_Request $request) : WP_Error|WP_REST_Response
Parameters
- $request : WP_REST_Request
-
REST request.
Return values
WP_Error|WP_REST_Responsedownload_upload_file()
Send a CSV file as a browser download.
private
download_upload_file(string $file) : void
Parameters
- $file : string
encode_upload_id()
Encode an uploads-relative path for use as an opaque REST row ID.
private
encode_upload_id(string $relative) : string
Parameters
- $relative : string
Return values
stringfind_or_create_upload_attachment()
Find the media attachment for an uploaded CSV, creating one when needed.
private
find_or_create_upload_attachment(string $file) : int|WP_Error
Parameters
- $file : string
-
Absolute, validated CSV path.
Return values
int|WP_Errorget_uploads_directory()
Return the canonical uploads directory.
private
get_uploads_directory() : array{path: string}|WP_Error
Return values
array{path: string}|WP_Errorresolve_upload_file()
Resolve and validate one opaque upload ID.
private
resolve_upload_file(string $id) : string|WP_Error
Parameters
- $id : string
Return values
string|WP_Errorsetup_endpoints()
Setup endpoints.
private
setup_endpoints() : mixed