SLPĀ® phpDocs

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

$uses_slplus

public bool $uses_slplus

Set to true (default) if the object needs access to the SLPlus plugin object.

Methods

__construct()

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

can_manage_locations()

Confirm the request can manage Store Locator Plus locations.

public can_manage_locations() : bool
Return values
bool

clear_import_messages()

Clear persisted import messages.

public clear_import_messages() : WP_REST_Response
Return values
WP_REST_Response

delete_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_Response

get_geocoding()

Return a list of active location imports by attachment ID.

public get_geocoding(WP_REST_Request $request) : WP_Error|WP_REST_Response
APIYes
Parameters
$request : WP_REST_Request
Tags
used-by

\SLP_Power_REST_Handler::setup_endpoints via READABLE REST Route store-locator-plus/location_imports/

Return values
WP_Error|WP_REST_Response

get_imports()

Return a list of active location imports by attachment ID.

public get_imports(WP_REST_Request $request) : WP_Error|WP_REST_Response
APIYes
Parameters
$request : WP_REST_Request
Tags
used-by

\SLP_Power_REST_Handler::setup_endpoints via READABLE REST Route store-locator-plus/location_imports/

Return values
WP_Error|WP_REST_Response

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

get_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_Response

get_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_Response

GetReportLocationResultHistoryCount()

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_Response

GetReportLocationSearchHistory()

Handle the REST requests coming in on /report/location/search_history

public GetReportLocationSearchHistory(WP_REST_Request $request) : WP_REST_Response
APIYes
Parameters
$request : WP_REST_Request
Tags
route

{get} /report/location/search_history Get data for location search history report.

apiName

GetReportLocationSearchHistory

apiGroup

Report

apiParam

{string} start The start date as a string (YYYY-MM-DD)

{string} end The end date as a string (YYYY-MM-DD)

{number} limit Max records to return from SQL query.

Return values
WP_REST_Response

GetReportLocationSearchHistoryCount()

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_Response

GetReportLocationSearchResultHistory()

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_Response

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_Response

set_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_Response

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

find_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_Error

get_uploads_directory()

Return the canonical uploads directory.

private get_uploads_directory() : array{path: string}|WP_Error
Return values
array{path: string}|WP_Error

resolve_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_Error

setup_endpoints()

Setup endpoints.

private setup_endpoints() : mixed
Tags
route

GET wp-json/store-locator-plus/v2/imports/ Get list of running imports.

GET wp-json/store-locator-plus/v2/geocoding/ Get list of running geocodes.

On this page

Search results