MySLP_REST_API
in package
Class MySLP_REST_API
Table of Contents
Properties
- $myslp : MySLP
- $myslp_namespace : string
- $options : string|null
- $slplus : SLPlus
- $status : array<string, bool>
- $user : int|null
Methods
- __construct() : mixed
- Default things to do/load when running this plugin
- add_hooks() : void
- Adding hooks
- bulk_action_customers() : array<string|int, mixed>|WP_Error
- Handle bulk actions on the customer's list (React UI).
- can_manage_accounting() : bool
- Verify the current user can manage accounting data.
- create_accounting_key() : WP_REST_Response|WP_Error
- Create an accounting key row.
- create_accounting_monthly_history() : WP_REST_Response|WP_Error
- Create an accounting monthly history row.
- delete_accounting_key() : WP_REST_Response|WP_Error
- Delete an accounting key row.
- delete_accounting_monthly_history() : WP_REST_Response|WP_Error
- Delete an accounting monthly history row.
- delete_location() : WP_Error|array<string|int, mixed>
- Delete location
- edit_location() : mixed
- Edit location
- get_accounting_keys() : WP_REST_Response
- List accounting key records.
- get_accounting_monthly_history() : WP_REST_Response
- List accounting monthly history rows.
- get_accounting_monthly_history_keys() : WP_REST_Response
- Return the distinct ledger keys for quick-fill UIs.
- get_accounting_monthly_matrix() : WP_REST_Response
- Return a gap-free monthly summary matrix grouped by entry_key.
- get_accounting_revenue_series() : WP_REST_Response
- Return the SAAS_REVENUE series for chart rendering.
- get_active_customer_stats() : WP_REST_Response
- Return the total count of active customer accounts and the sum of their payments.
- get_customer_history() : WP_REST_Response|WP_Error
- Return customer profile history rows for the given blog_id.
- get_customer_monthly_views_report() : WP_REST_Response|WP_Error
- Return a monthly map-views report for a single customer blog.
- get_customers() : array<string|int, mixed>
- Get a paginated, filtered, sorted list of MySLP customers.
- get_invoices() : array<string|int, mixed>|WP_Error
- Retrieve a list of invoices.
- get_locations() : WP_Error|StdClass
- Get all locations
- get_locations_limit() : WP_Error|WP_REST_Response
- Callback for locations-limit route
- get_map_options() : StdClass
- Get options if api key is active
- get_user_account_info() : array<string|int, mixed>
- Get user account info
- register_routes() : void
- Register the necessary routes in here
- search_map() : WP_Error|StdClass
- Search map locations if api key is active
- update_accounting_key() : WP_REST_Response|WP_Error
- Update an accounting key row.
- update_accounting_monthly_history() : WP_REST_Response|WP_Error
- Update an accounting monthly history row.
- attach_core_scripts() : string
- Return the MySLP and Core JavaScript as a string.
- catch_addon_scripts() : array<string|int, mixed>
- Get add on scripts.
- catch_addon_styles() : array<string|int, mixed>
- check_activation() : bool
- Check if the api key is active
- get_accounting_keys_store() : string
- Load the accounting key helper and return the class name.
- get_accounting_monthly_history_store() : string
- Load the accounting monthly history helper and return the class name.
- get_inline_style() : string
- get_layout_data() : false|string
- Get the DIV HTML for SLPLUS
- get_location_count_for_user() : void
- Get location count for a user, handling multisite blog switching.
- get_map_locations() : array<string|int, mixed>
- Get map locations, with its map positions
- get_options() : StdClass
- Get options
- get_options_data() : false|string
- Set the option data in the SLP scripts.
- get_short_stripe_id() : string
- Format a Stripe ID for compact display.
- myslp_get_dep_scripts() : array<string|int, mixed>
- Get dependent scripts.
- set_options() : void
- Set db prefix according to the user, who got api key provided in the request
Properties
$myslp
private
MySLP
$myslp
$myslp_namespace
private
string
$myslp_namespace
$options
private
string|null
$options
= \null
$slplus
private
SLPlus
$slplus
$status
private
array<string, bool>
$status
= []
$user
private
int|null
$user
= \null
Methods
__construct()
Default things to do/load when running this plugin
public
__construct() : mixed
add_hooks()
Adding hooks
public
add_hooks() : void
bulk_action_customers()
Handle bulk actions on the customer's list (React UI).
public
bulk_action_customers(WP_REST_Request $request) : array<string|int, mixed>|WP_Error
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>|WP_Errorcan_manage_accounting()
Verify the current user can manage accounting data.
public
can_manage_accounting() : bool
Return values
boolcreate_accounting_key()
Create an accounting key row.
public
create_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorcreate_accounting_monthly_history()
Create an accounting monthly history row.
public
create_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_accounting_key()
Delete an accounting key row.
public
delete_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_accounting_monthly_history()
Delete an accounting monthly history row.
public
delete_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errordelete_location()
Delete location
public
delete_location(mixed $data) : WP_Error|array<string|int, mixed>
Parameters
- $data : mixed
Return values
WP_Error|array<string|int, mixed>edit_location()
Edit location
public
edit_location(mixed $data) : mixed
Parameters
- $data : mixed
get_accounting_keys()
List accounting key records.
public
get_accounting_keys(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_accounting_monthly_history()
List accounting monthly history rows.
public
get_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_accounting_monthly_history_keys()
Return the distinct ledger keys for quick-fill UIs.
public
get_accounting_monthly_history_keys() : WP_REST_Response
Return values
WP_REST_Responseget_accounting_monthly_matrix()
Return a gap-free monthly summary matrix grouped by entry_key.
public
get_accounting_monthly_matrix() : WP_REST_Response
Return values
WP_REST_Responseget_accounting_revenue_series()
Return the SAAS_REVENUE series for chart rendering.
public
get_accounting_revenue_series(WP_REST_Request $request) : WP_REST_Response
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Responseget_active_customer_stats()
Return the total count of active customer accounts and the sum of their payments.
public
get_active_customer_stats() : WP_REST_Response
Used by the Manage Customers React UI to populate the persistent summary chips.
Always queries the active account_status ā independent of the current filter tab.
Return values
WP_REST_Responseget_customer_history()
Return customer profile history rows for the given blog_id.
public
get_customer_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorget_customer_monthly_views_report()
Return a monthly map-views report for a single customer blog.
public
get_customer_monthly_views_report(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
-
REST request.
Return values
WP_REST_Response|WP_Errorget_customers()
Get a paginated, filtered, sorted list of MySLP customers.
public
get_customers(WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $request : WP_REST_Request
Return values
array<string|int, mixed>get_invoices()
Retrieve a list of invoices.
public
get_invoices() : array<string|int, mixed>|WP_Error
Return values
array<string|int, mixed>|WP_Error —A list of invoices or a WP_Error instance if fetching fails.
get_locations()
Get all locations
public
get_locations(WP_REST_Request $request) : WP_Error|StdClass
Parameters
- $request : WP_REST_Request
Return values
WP_Error|StdClassget_locations_limit()
Callback for locations-limit route
public
get_locations_limit() : WP_Error|WP_REST_Response
Tags
Return values
WP_Error|WP_REST_Response —location with its limit
get_map_options()
Get options if api key is active
public
get_map_options(WP_REST_Request $request) : StdClass
Parameters
- $request : WP_REST_Request
Return values
StdClassget_user_account_info()
Get user account info
public
get_user_account_info() : array<string|int, mixed>
Return values
array<string|int, mixed>register_routes()
Register the necessary routes in here
public
register_routes() : void
search_map()
Search map locations if api key is active
public
search_map(WP_REST_Request $request) : WP_Error|StdClass
Parameters
- $request : WP_REST_Request
Return values
WP_Error|StdClassupdate_accounting_key()
Update an accounting key row.
public
update_accounting_key(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorupdate_accounting_monthly_history()
Update an accounting monthly history row.
public
update_accounting_monthly_history(WP_REST_Request $request) : WP_REST_Response|WP_Error
Parameters
- $request : WP_REST_Request
Return values
WP_REST_Response|WP_Errorattach_core_scripts()
Return the MySLP and Core JavaScript as a string.
private
attach_core_scripts() : string
Return values
stringcatch_addon_scripts()
Get add on scripts.
private
catch_addon_scripts() : array<string|int, mixed>
Return values
array<string|int, mixed>catch_addon_styles()
private
catch_addon_styles() : array<string|int, mixed>
Return values
array<string|int, mixed>check_activation()
Check if the api key is active
private
check_activation(string $API_key) : bool
Parameters
- $API_key : string
-
The api key
Return values
bool —True if the api key is active, else false
get_accounting_keys_store()
Load the accounting key helper and return the class name.
private
get_accounting_keys_store() : string
Return values
stringget_accounting_monthly_history_store()
Load the accounting monthly history helper and return the class name.
private
get_accounting_monthly_history_store() : string
Return values
stringget_inline_style()
private
get_inline_style() : string
Return values
stringget_layout_data()
Get the DIV HTML for SLPLUS
private
get_layout_data(array<string|int, mixed> $attributes) : false|string
Parameters
- $attributes : array<string|int, mixed>
Return values
false|stringget_location_count_for_user()
Get location count for a user, handling multisite blog switching.
private
get_location_count_for_user(int $user_id) : void
Parameters
- $user_id : int
get_map_locations()
Get map locations, with its map positions
private
get_map_locations(array<string|int, mixed> $query) : array<string|int, mixed>
Parameters
- $query : array<string|int, mixed>
-
The executable query params | null to get from default options
Return values
array<string|int, mixed> —Locations
get_options()
Get options
private
get_options(array<string|int, mixed> $attributes) : StdClass
Parameters
- $attributes : array<string|int, mixed>
Tags
Return values
StdClass —The all map options.
get_options_data()
Set the option data in the SLP scripts.
private
get_options_data() : false|string
Tags
Return values
false|stringget_short_stripe_id()
Format a Stripe ID for compact display.
private
get_short_stripe_id(string $stripe_id) : string
Parameters
- $stripe_id : string
Return values
stringmyslp_get_dep_scripts()
Get dependent scripts.
private
myslp_get_dep_scripts(mixed $deps[, array<string|int, mixed> $return = array() ]) : array<string|int, mixed>
Parameters
- $deps : mixed
- $return : array<string|int, mixed> = array()
Return values
array<string|int, mixed>set_options()
Set db prefix according to the user, who got api key provided in the request
private
set_options() : void