MySLP
in package
Class MySLP
Table of Contents
Constants
- class_base = 'MySLP_'
- MANAGE_OPTIONS_CAP = 'manage_options'
- PRODUCTION_DOMAIN = 'dashboard.storelocatorplus.com'
Properties
- $Customer_Profile : MySLP_Customer_Profile
- $domain : string
- $History : MySLP_History
- $is_production_domain : bool
- $menu_hooks : mixed
- $objects : mixed
- $option_modifier : mixed
- $options : mixed
- $Payments_Page : MySLP_Payments_Page
- $PayPal_Payments : MySLP_PayPal_Payments
- $Recurring_Payments : MySLP_Recurring_Payments
- $Service_Levels : MySLP_Service_Levels
- $Settings_General : MySLP_Settings_General
- $Stripe_Payments : MySLP_Stripe_Payments
- $DSRA : MySLP_DSRA|null
- $Option : mixed
- $Payments : MySLP_Payments|null
- $User : MySLP_User|null
Methods
- __construct() : mixed
- MySLP constructor.
- __get() : null
- Get our objects using a simple name without needing an array ref.
- activate_option_modifier() : void
- Turn on the option modifier for SLP.
- add_customer_role() : mixed
- Creeate new user role: Customer Basic Role: Customer can only access 3 pages: 1.) MySLP Dashboard 2.) Account Management 3.) Billing Management
- add_desc_wrapper() : html
- Create data group descripion wrapper
- add_hooks() : void
- Adding hooks
- add_section() : string|void
- Add new section markup dynamically. It accepts array as param
- add_section_desc() : html
- Create data group descripion
- add_subsection_desc() : html
- Add subsection description
- add_subsection_title() : string|void
- Add subsection heading title
- admin_bar() : mixed
- Remove admin bar access if not administrator
- auto_load() : void
- Auto-loads classes of name MySLP<module>* from include/<module>/<classname>.php whenever it is needed.
- check_admin() : void
- Enforce customer admin UI restrictions.
- create_content() : string|void
- Create collapsible content for input data group
- create_dashboard_page() : mixed
- Dashboard page
- create_header() : html
- Create section header
- create_input() : html
- Create input data group. A wrapper of html input fields.
- create_menu() : void
- MySLP admin menu (users login)
- create_network_admin_menu() : void
- MySLP Network Admin menu
- dashboard_redirect() : string|null
- Auto redirect to dashboard if it's active.
- define_deployment() : void
- Define MySLP Deployment Level in MYSLP_DEPLOYMENT_LEVEL
- delete_location() : mixed
- Delete location using ajax.
- enqueue_scripts() : void
- Enqueue custom styles and JavaScript for Locations and Generate Embed Pages This uses legacy PHP-driven interfaces based on Foundation (outdated) and supporting scripts and CSS.
- get_base_email() : mixed
- User email account as username
- get_instance() : MySLP
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- getUserBlogId() : int
- Get the blog ID of the logged in user.
- is_addon_active() : bool
- Is the specified add on active?
- log_and_validate_referer() : bool
- Log and validate referer
- map_languages() : mixed
- Return array flip of Map Languages
- modify_settings_general_tab() : mixed
- Modify the SLP General Settings Tab
- perform_init_actions() : void
- Things that happen after plugins are loaded and users are set.
- rand_password() : mixed
- Auto generate password using bin2hex This value will be emailed to new user
- remove_adminbar_dashboard() : void
- CSS based for hiding the admin dashboard when the customer is logged in.
- render_configuration_page() : mixed
- Render the configuration page for network admins.
- render_contact_us_page() : void
- Contact Us page.
- render_manage_page() : mixed
- Render the manage network admin page.
- render_profile_page() : void
- My Profile page.
- rest_dispatch_request_filter() : WP_REST_Response
- Hook on the REST API response. Do the categorization for the location add / edit. Get the categories data on the get single location calls.
- set_input() : html
- Set input markup for fields in Settings
- show_notification() : mixed
- Create notification div.
- tweak_widgets() : void
- Tweak the WP dashboard widgets. Add ours, remove some defaults.
- update_options() : mixed
- Update our primary site options.
- upgrade_user_to_admin_role_if_needed() : void
- Upgrade user to admin role if needed
- zoom_adjustment() : mixed
- Return Zoom Adjustment array
- zoom_level() : mixed
- Return Zoom Level array
- remove_default_widgets() : void
- Remove Default Widgets
- updateLocationCategories() : void
- Add categories to the location
Constants
class_base
public
mixed
class_base
= 'MySLP_'
MANAGE_OPTIONS_CAP
public
mixed
MANAGE_OPTIONS_CAP
= 'manage_options'
PRODUCTION_DOMAIN
public
mixed
PRODUCTION_DOMAIN
= 'dashboard.storelocatorplus.com'
Properties
$Customer_Profile
public
MySLP_Customer_Profile
$Customer_Profile
$domain
public
string
$domain
= ''
$History
public
MySLP_History
$History
$is_production_domain
public
bool
$is_production_domain
= \true
$menu_hooks
public
mixed
$menu_hooks
$objects
public
mixed
$objects
$option_modifier
public
mixed
$option_modifier
$options
public
mixed
$options
$Payments_Page
public
MySLP_Payments_Page
$Payments_Page
MUP(17.6) Payments Admin Tab
$PayPal_Payments
public
MySLP_PayPal_Payments
$PayPal_Payments
MUP(17.6) PayPal Payment Processing (stub only)
$Recurring_Payments
public
MySLP_Recurring_Payments
$Recurring_Payments
CPROF: Recurring Payments Module
$Service_Levels
public
MySLP_Service_Levels
$Service_Levels
MUP: Service Levels Management
$Settings_General
public
MySLP_Settings_General
$Settings_General
$Stripe_Payments
public
MySLP_Stripe_Payments
$Stripe_Payments
MUP(17.6) Stripe Payment Processing
$DSRA
private
MySLP_DSRA|null
$DSRA
= \null
$Option
private
mixed
$Option
$Payments
private
MySLP_Payments|null
$Payments
= \null
$User
private
MySLP_User|null
$User
= \null
Methods
__construct()
MySLP constructor.
public
__construct() : mixed
__get()
Get our objects using a simple name without needing an array ref.
public
__get(mixed $property) : null
Parameters
- $property : mixed
Return values
nullactivate_option_modifier()
Turn on the option modifier for SLP.
public
activate_option_modifier() : void
add_customer_role()
Creeate new user role: Customer Basic Role: Customer can only access 3 pages: 1.) MySLP Dashboard 2.) Account Management 3.) Billing Management
public
add_customer_role() : mixed
add_desc_wrapper()
Create data group descripion wrapper
public
add_desc_wrapper(mixed $desc) : html
Parameters
- $desc : mixed
Return values
html —markup for input data
add_hooks()
Adding hooks
public
add_hooks() : void
add_section()
Add new section markup dynamically. It accepts array as param
public
add_section([array<string|int, mixed> $param = array() ]) : string|void
Parameters
- $param : array<string|int, mixed> = array()
-
id required string Section id selector title required string Section title fields required array Determine what type of input using field param. It accepts array argument.id(fields) required string Input id selector label required string Use for input labeling tip required string Helper text for each field input required string text/textarea/select/check/radio
Return values
string|voidadd_section_desc()
Create data group descripion
public
add_section_desc(mixed $desc) : html
Parameters
- $desc : mixed
Return values
html —markup for input data
add_subsection_desc()
Add subsection description
public
add_subsection_desc(mixed $desc, mixed $section_id) : html
Parameters
- $desc : mixed
- $section_id : mixed
Return values
html —markup for input data
add_subsection_title()
Add subsection heading title
public
add_subsection_title(mixed $title, mixed $section_id) : string|void
Parameters
- $title : mixed
-
string Sub section title
- $section_id : mixed
-
string section ID
Return values
string|void —markup for input data
admin_bar()
Remove admin bar access if not administrator
public
admin_bar() : mixed
auto_load()
Auto-loads classes of name MySLP<module>* from include/<module>/<classname>.php whenever it is needed.
public
auto_load(string $class_name) : void
Parameters
- $class_name : string
check_admin()
Enforce customer admin UI restrictions.
public
check_admin() : void
create_content()
Create collapsible content for input data group
public
create_content(string $section_id, string $description, array<string|int, mixed> $fields[, array<string|int, mixed> $subsections = array() ]) : string|void
Parameters
- $section_id : string
-
Unique section id selector
- $description : string
-
Section descrioption -- optional
- $fields : array<string|int, mixed>
-
Data types needed for creating html input markup
- $subsections : array<string|int, mixed> = array()
-
Subsection content that will be rendered
Return values
string|voidcreate_dashboard_page()
Dashboard page
public
create_dashboard_page() : mixed
create_header()
Create section header
public
create_header(mixed $id, mixed $title) : html
Parameters
- $id : mixed
- $title : mixed
Return values
html —markup for header section
create_input()
Create input data group. A wrapper of html input fields.
public
create_input([mixed $input_fields = array() ][, mixed $counter = 0 ]) : html
Parameters
- $input_fields : mixed = array()
- $counter : mixed = 0
Return values
html —markup for input data
create_menu()
MySLP admin menu (users login)
public
create_menu() : void
create_network_admin_menu()
MySLP Network Admin menu
public
create_network_admin_menu() : void
dashboard_redirect()
Auto redirect to dashboard if it's active.
public
dashboard_redirect(mixed $url, mixed $query, mixed $user) : string|null
Processes the WP login_redirect filter.
On a fresh login: url = https://local.storelocatorplus.com/wp-admin/ query = https://local.storelocatorplus.com/wp-admin/ user = the WP_User object for the logged in user
starting_page = https://local.storelocatorplus.com/wp-admin/admin.php?page=csl-slplus
Parameters
- $url : mixed
-
($redirect_to) the redirect destination URL.
- $query : mixed
-
($requested_redirect_to) The requested redirect destination URL passed as a parameter.
- $user : mixed
-
WP_User object if login was successful, WP_Error object otherwise.
Return values
string|nulldefine_deployment()
Define MySLP Deployment Level in MYSLP_DEPLOYMENT_LEVEL
public
define_deployment() : void
delete_location()
Delete location using ajax.
public
delete_location() : mixed
It won't directly delete but instead it will pass to WP REST API request and do the deletion there
enqueue_scripts()
Enqueue custom styles and JavaScript for Locations and Generate Embed Pages This uses legacy PHP-driven interfaces based on Foundation (outdated) and supporting scripts and CSS.
public
enqueue_scripts(mixed $hook) : void
Parameters
- $hook : mixed
get_base_email()
User email account as username
public
get_base_email(mixed $email) : mixed
Parameters
- $email : mixed
get_instance()
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
public
static get_instance([null|array<string|int, mixed> $options = array() ]) : MySLP
Parameters
- $options : null|array<string|int, mixed> = array()
-
object init params
Return values
MySLPgetUserBlogId()
Get the blog ID of the logged in user.
public
getUserBlogId() : int
This method retrieves the logged in user's ID and then fetches the blog ID associated with that user.
Return values
int —The blog ID of the logged in user.
is_addon_active()
Is the specified add on active?
public
is_addon_active(mixed $addon) : bool
Parameters
- $addon : mixed
Return values
boollog_and_validate_referer()
Log and validate referer
public
log_and_validate_referer(bool $is_valid, WP_REST_Request $request) : bool
Parameters
- $is_valid : bool
-
Boolean value indicating if the referer is valid or not
- $request : WP_REST_Request
-
The WP REST Request object
Return values
bool —Returns true if the user agent is not a bot, false otherwise
map_languages()
Return array flip of Map Languages
public
map_languages() : mixed
modify_settings_general_tab()
Modify the SLP General Settings Tab
public
modify_settings_general_tab(SLP_Settings $settings) : mixed
Parameters
- $settings : SLP_Settings
perform_init_actions()
Things that happen after plugins are loaded and users are set.
public
perform_init_actions() : void
Hooked to WP init action,
rand_password()
Auto generate password using bin2hex This value will be emailed to new user
public
rand_password([mixed $length = 4 ]) : mixed
Parameters
- $length : mixed = 4
remove_adminbar_dashboard()
CSS based for hiding the admin dashboard when the customer is logged in.
public
remove_adminbar_dashboard() : void
render_configuration_page()
Render the configuration page for network admins.
public
render_configuration_page() : mixed
render_contact_us_page()
Contact Us page.
public
render_contact_us_page() : void
render_manage_page()
Render the manage network admin page.
public
render_manage_page() : mixed
render_profile_page()
My Profile page.
public
render_profile_page() : void
rest_dispatch_request_filter()
Hook on the REST API response. Do the categorization for the location add / edit. Get the categories data on the get single location calls.
public
rest_dispatch_request_filter(mixed $result, WP_REST_Request $request, string $route, array<string|int, mixed> $handler) : WP_REST_Response
Parameters
- $result : mixed
- $request : WP_REST_Request
-
Request used to generate the response.
- $route : string
-
Route matched for the request.
- $handler : array<string|int, mixed>
-
Route handler used for the request.
Tags
Return values
WP_REST_Responseset_input()
Set input markup for fields in Settings
public
set_input([mixed $input_fields = array() ]) : html
Parameters
- $input_fields : mixed = array()
Return values
html —markup for input data
show_notification()
Create notification div.
public
show_notification(mixed $message) : mixed
Parameters
- $message : mixed
tweak_widgets()
Tweak the WP dashboard widgets. Add ours, remove some defaults.
public
tweak_widgets() : void
update_options()
Update our primary site options.
public
update_options() : mixed
upgrade_user_to_admin_role_if_needed()
Upgrade user to admin role if needed
public
upgrade_user_to_admin_role_if_needed() : void
This method checks if the current user has the capability to manage options and if not, upgrades the user to the administrator role.
zoom_adjustment()
Return Zoom Adjustment array
public
zoom_adjustment() : mixed
zoom_level()
Return Zoom Level array
public
zoom_level() : mixed
remove_default_widgets()
Remove Default Widgets
private
remove_default_widgets() : void
updateLocationCategories()
Add categories to the location
private
updateLocationCategories(int $location_id, array<string|int, mixed> $categories) : void
Parameters
- $location_id : int
- $categories : array<string|int, mixed>