MySLP_Locations_Research
in package
Enterprise Locations research backed by Amazon Places v2.
Table of Contents
Constants
- LIMIT : int = 1000
- MAX_CALLS_PER_PAGE : int = 8
- MAX_TILE_DEPTH : int = 5
- PAGE_SIZE : int = 100
- ROUTE : string = 'myslp/v2'
Methods
- __construct() : mixed
- Register the Locations section and REST actions.
- add() : array<string|int, mixed>|WP_Error
- Add confirmed results through the standard SLP location model.
- add_tab() : void
- Add the tab and its React mount point.
- can_manage() : bool
- Require an Enterprise account and location administration permission.
- register_routes() : void
- Register search and add routes.
- search() : array<string|int, mixed>|WP_Error
- Geocode once, then continue a bounded search session on each grid page request.
- enqueue_followups() : void
- Queue the next native page, or search smaller areas when a full page has no token.
- map_place() : array<string|int, mixed>
- Turn a Places result into the fields used by Research and the SLP location model.
- mark_existing_locations() : array<string|int, mixed>|WP_Error
- Mark results that already match a Store Locator Plus location.
- normalize_place_text() : string
- Normalize place text for matching against saved SLP location fields.
- places_request() : array<string|int, mixed>|WP_Error
- Send a server-side AWS Places request without exposing the API key.
- search_places() : array<string|int, mixed>|WP_Error
- Build the same AWS search for an area or one of its native token pages.
- split_box() : array<string|int, mixed>
- Split a saturated search area so AWS can return places outside its first 100 results.
Constants
LIMIT
private
int
LIMIT
= 1000
MAX_CALLS_PER_PAGE
private
int
MAX_CALLS_PER_PAGE
= 8
MAX_TILE_DEPTH
private
int
MAX_TILE_DEPTH
= 5
PAGE_SIZE
private
int
PAGE_SIZE
= 100
ROUTE
private
string
ROUTE
= 'myslp/v2'
Methods
__construct()
Register the Locations section and REST actions.
public
__construct() : mixed
add()
Add confirmed results through the standard SLP location model.
public
add(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Erroradd_tab()
Add the tab and its React mount point.
public
add_tab(SLP_Settings $settings) : void
Parameters
- $settings : SLP_Settings
can_manage()
Require an Enterprise account and location administration permission.
public
can_manage() : bool
Return values
boolregister_routes()
Register search and add routes.
public
register_routes() : void
search()
Geocode once, then continue a bounded search session on each grid page request.
public
search(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorenqueue_followups()
Queue the next native page, or search smaller areas when a full page has no token.
private
enqueue_followups(array<string|int, mixed> &$queue, array<string|int, mixed> $job, array<string|int, mixed> $page) : void
Parameters
- $queue : array<string|int, mixed>
- $job : array<string|int, mixed>
- $page : array<string|int, mixed>
map_place()
Turn a Places result into the fields used by Research and the SLP location model.
private
map_place(array<string|int, mixed> $item) : array<string|int, mixed>
Parameters
- $item : array<string|int, mixed>
Return values
array<string|int, mixed>mark_existing_locations()
Mark results that already match a Store Locator Plus location.
private
mark_existing_locations(array<string|int, mixed> $results) : array<string|int, mixed>|WP_Error
Parameters
- $results : array<string|int, mixed>
Return values
array<string|int, mixed>|WP_Errornormalize_place_text()
Normalize place text for matching against saved SLP location fields.
private
normalize_place_text(string $value) : string
Parameters
- $value : string
Return values
stringplaces_request()
Send a server-side AWS Places request without exposing the API key.
private
places_request(string $operation, array<string|int, mixed> $body) : array<string|int, mixed>|WP_Error
Parameters
- $operation : string
- $body : array<string|int, mixed>
Return values
array<string|int, mixed>|WP_Errorsearch_places()
Build the same AWS search for an area or one of its native token pages.
private
search_places(string $vertical, array<string|int, mixed> $job) : array<string|int, mixed>|WP_Error
Parameters
- $vertical : string
- $job : array<string|int, mixed>
Return values
array<string|int, mixed>|WP_Errorsplit_box()
Split a saturated search area so AWS can return places outside its first 100 results.
private
split_box(array<string|int, mixed> $box) : array<string|int, mixed>
Parameters
- $box : array<string|int, mixed>