SLP_Premier_Admin
extends SLP_BaseClass_Admin
in package
Holds the admin-only code.
This allows the main plugin to only include this file in admin mode via the admin_menu call. Reduces the front-end footprint.
Table of Contents
Properties
- $activation : SLP_BaseClass_Activation
- $addon : mixed
- $Admin_Experience : SLP_Premier_Admin_Experience
- $Admin_General : SLP_Premier_Admin_General
- $Admin_Locations : SLP_Premier_Admin_Locations
- $admin_page_slug : string
- $current_group : string
- $current_section : string
- $dir : string
- $js_requirements : array<string|int, string>
- $js_settings : array<string|int, string>
- $myslp : MySLP
- $ok_to_nq_js : bool
- $saved_option_state : array<string|int, mixed>
- $settings_interface : SLP_Settings
- $settings_pages : mixed
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $class_prefix : mixed
- $objects : mixed
- $slug : mixed
Methods
- __construct() : mixed
- __get() : mixed
- Get the value, running it through a filter.
- __isset() : bool
- Allow isset to be called on private properties.
- add_hooks_and_filters() : mixed
- Admin specific hooks and filters.
- add_meta_links() : array<string|int, string>
- Add meta links.
- add_object() : mixed
- checkmark_territory_bounds() : string
- Replace JSON output with a simple checkmark.
- enqueue_admin_css() : mixed
- Enqueue our CSS
- enqueue_admin_javascript() : mixed
- Add the JS settings for admin.
- filter_AddOurAdminSlug() : array<string|int, string>
- Add our admin pages to the valid admin page slugs.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_newer_version() : string
- If there is a newer version get the link.
- get_value() : mixed
- Get the value for a specific add-on option. If empty use add-on option_defaults. If still empty use slplus defaults.
- instantiate() : null|object
- Instantiate an object of the noted class.
- save_current_option_state() : mixed
- Save the current addon option state.
- save_my_settings() : bool
- Add UX checkboxes to the save ux settings, then run save ux tab settings.
- save_SerializedOption() : array<string|int, mixed>
- Merge existing options and POST options, then save to the wp_options table.
- set_properties() : mixed
- Set our properties.
- set_ValidOptions() : mixed
- Set valid options according to the addon options array.
- update_minmax_latlng() : mixed
- Update the min/max latitude and longitude.
- at_startup() : mixed
- Things to do at startup after this baby is initialized. Override in your class.
- being_deactivated() : bool
- Is this add-on being deactivated?
- do_admin_startup() : mixed
- Things we want our add on packs to do when they start.
- initialize() : mixed
- Run these things during invocation.
- ok_to_enqueue_admin_js() : bool
- Check if it is OK to enqueue the admin JavaScript, assume so if the hook starts with our prefix.
- set_default_object_options() : mixed
- Our default object options.
- update_install_info() : mixed
- Update the install info for this add on.
Properties
$activation
public
SLP_BaseClass_Activation
$activation
$addon
public
mixed
$addon
$Admin_Experience read-only
public
SLP_Premier_Admin_Experience
$Admin_Experience
$Admin_General read-only
public
SLP_Premier_Admin_General
$Admin_General
$Admin_Locations read-only
public
SLP_Premier_Admin_Locations
$Admin_Locations
$admin_page_slug
public
string
$admin_page_slug
The slug for the admin page.
$current_group
public
string
$current_group
Current settings group.
$current_section
public
string
$current_section
Current settings section.
$dir
public
string
$dir
the root directory for this theme
$js_requirements
public
array<string|int, string>
$js_requirements
An array of the JavaScript hooks that are needed by the userinterface.js script.
$js_settings
public
array<string|int, string>
$js_settings
JavaScript settings that are to be localized as a
$myslp
public
MySLP
$myslp
$ok_to_nq_js read-only
public
bool
$ok_to_nq_js
keep track of whether we have looked up this capability before or not.
$saved_option_state read-only
public
array<string|int, mixed>
$saved_option_state
What the option values where before we did admin save.
$settings_interface
public
SLP_Settings
$settings_interface
$settings_pages
public
mixed
$settings_pages
= array('slp_experience' => array('dropdown_autosubmit', 'show_address_guess'), 'slp_general' => array('show_location_on_order_email'), 'slp_manage_locations' => array())
$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.
$class_prefix
protected
mixed
$class_prefix
= 'SLP_Premier_'
$objects
protected
mixed
$objects
= array('Admin_Settings' => array('subdir' => 'include/module/admin/'), 'Admin_General' => array('subdir' => 'include/module/admin/'), 'Admin_Locations' => array('subdir' => 'include/module/admin/'))
$slug
protected
mixed
$slug
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
Get the value, running it through a filter.
public
__get(string $property) : mixed
Parameters
- $property : string
Return values
mixed —null if not set or the value
__isset()
Allow isset to be called on private properties.
public
__isset(mixed $property) : bool
Parameters
- $property : mixed
Return values
booladd_hooks_and_filters()
Admin specific hooks and filters.
public
add_hooks_and_filters() : mixed
add_meta_links()
Add meta links.
public
add_meta_links(array<string|int, string> $links, string $file) : array<string|int, string>
Parameters
- $links : array<string|int, string>
- $file : string
Return values
array<string|int, string>add_object()
public
add_object(mixed $object) : mixed
Parameters
- $object : mixed
checkmark_territory_bounds()
Replace JSON output with a simple checkmark.
public
checkmark_territory_bounds(mixed $data, mixed $slug, mixed $label) : string
NOTE: setting display type to checkbox would do this as well.
Parameters
- $data : mixed
- $slug : mixed
- $label : mixed
Return values
stringenqueue_admin_css()
Enqueue our CSS
public
enqueue_admin_css(mixed $hook) : mixed
Parameters
- $hook : mixed
enqueue_admin_javascript()
Add the JS settings for admin.
public
enqueue_admin_javascript(mixed $hook) : mixed
Parameters
- $hook : mixed
filter_AddOurAdminSlug()
Add our admin pages to the valid admin page slugs.
public
filter_AddOurAdminSlug(array<string|int, string> $slugs) : array<string|int, string>
Parameters
- $slugs : array<string|int, string>
-
admin page slugs
Return values
array<string|int, string> —modified list of admin page slugs
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
staticget_newer_version()
If there is a newer version get the link.
public
get_newer_version() : string
Return values
stringget_value()
Get the value for a specific add-on option. If empty use add-on option_defaults. If still empty use slplus defaults.
public
get_value(string $setting) : mixed
Parameters
- $setting : string
-
The key name for the setting to retrieve.
Return values
mixed —The value of the add-on options[
instantiate()
Instantiate an object of the noted class.
public
instantiate(string $class[, array<string|int, mixed> $options = array() ]) : null|object
Parameters
- $class : string
- $options : array<string|int, mixed> = array()
Return values
null|objectsave_current_option_state()
Save the current addon option state.
public
save_current_option_state() : mixed
Used to know what options were set to before an admin save.
save_my_settings()
Add UX checkboxes to the save ux settings, then run save ux tab settings.
public
save_my_settings() : bool
Return values
boolsave_SerializedOption()
Merge existing options and POST options, then save to the wp_options table.
public
save_SerializedOption(string $optionName, array<string|int, mixed> $currentOptions[, array<string|int, string> $cbOptionArray = null ]) : array<string|int, mixed>
NOTE: USED BY ADD ON PACKS ONLY
TODO: Rewire calls from add on packs afterwards (ELM, POWER, PRO, SME, UML)
Typically used to merge post options from admin interface changes with existing options in a class.
Parameters
- $optionName : string
-
name of option to update
- $currentOptions : array<string|int, mixed>
-
current options as a named array
- $cbOptionArray : array<string|int, string> = null
-
array of options that are checkboxes
Return values
array<string|int, mixed> —the updated options
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
set_ValidOptions()
Set valid options according to the addon options array.
public
set_ValidOptions(mixed $val, mixed $key) : mixed
TODO: deprecate when all add-on packs use ($this->addon , 'set_ValidOptions') instead of $this->set_ValidOptions in admin class.
Use $this->addon->set_ValidOptions instead.
Parameters
- $val : mixed
- $key : mixed
update_minmax_latlng()
Update the min/max latitude and longitude.
public
update_minmax_latlng() : mixed
at_startup()
Things to do at startup after this baby is initialized. Override in your class.
protected
at_startup() : mixed
NOTE: this will not run at initialization if $this->objects is empty.
being_deactivated()
Is this add-on being deactivated?
protected
being_deactivated() : bool
Return values
booldo_admin_startup()
Things we want our add on packs to do when they start.
protected
do_admin_startup() : mixed
Extend this by overriding this method and then calling parent::do_admin_startup() before or after your extension.
initialize()
Run these things during invocation.
protected
initialize() : mixed
Fires from \SLPlus_BaseClass_Object::__construct
ok_to_enqueue_admin_js()
Check if it is OK to enqueue the admin JavaScript, assume so if the hook starts with our prefix.
protected
ok_to_enqueue_admin_js(mixed $hook) : bool
Parameters
- $hook : mixed
Return values
boolset_default_object_options()
Our default object options.
protected
set_default_object_options() : mixed
update_install_info()
Update the install info for this add on.
protected
update_install_info() : mixed