SLP® phpDocs

MySLP_Admin extends SLP_BaseClass_Admin
in package

Admin interface methods.

Table of Contents

Properties

$activation  : SLP_BaseClass_Activation
$addon  : SLP_BaseClass_Addon
$admin_page_slug  : string
$class_prefix  : string
$css_dir  : mixed
$current_group  : string
$current_section  : string
$dir  : string
$js_requirements  : array<string|int, string>
$js_settings  : array<string|int, string>
$myslp  : MySLP
$objects  : array<string|int, mixed>
$ok_to_nq_js  : bool
$saved_option_state  : array<string|int, mixed>
$settings_interface  : SLP_Settings
$settings_pages  : array<string|int, mixed>
$slplus  : SLPlus
$uses_myslp  : bool
$uses_slplus  : bool
$slug  : mixed
$active_column  : mixed
$categories  : mixed
$css_url  : mixed
$current_screen  : mixed
$default_column  : mixed
$extended_column  : mixed
$group_name  : mixed
$group_params  : mixed
$ManageLocations  : mixed
$power  : mixed
$propack  : mixed
$theme  : 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_category_nav()  : mixed
Extend the Navigation item
add_hooks_and_filters()  : mixed
Admin hook, enqueue and localized script
add_meta_links()  : array<string|int, string>
Add meta links.
add_object()  : mixed
admin_hook()  : mixed
Do actual enqueue and localized script
check_active_plugin_by_level()  : mixed
Check if plugin is active.
country_options()  : mixed
Return the Map Domain dropdown options
create_object_categories()  : mixed
Create Categories object from main SLP plugin
create_object_theme()  : mixed
Create theme object from main SLP plugin
display_navigation_content()  : mixed
Display content of extended nav item based on current item
do_admin_startup()  : mixed
Run this function on admin startup This is required for running the activation class
enqueue_admin_css()  : mixed
If the file admin.css exists and the page prefix starts with slp_ , enqueue the admin style.
enqueue_admin_javascript()  : mixed
Enqueues Admin JavaScript for include/admin.js and js/admin.js and js/admin-<tabname>-tab.js (minified if present)
filter_AddOurAdminSlug()  : array<string|int, string>
Add our admin pages to the valid admin page slugs.
get_active_addon()  : mixed
Get all active addon
get_active_country()  : mixed
Get all active country from location database
get_active_state()  : mixed
Get all active state from location database
get_addon_options()  : mixed
Get all active addon options
get_extended_column()  : mixed
Get the extended column if SLP has extendedo return null
get_filter()  : mixed
Construct filters from SLP and premium addons
get_icons_array()  : mixed
Return custom marker icons on add/edit form Useable only if Experience is active
get_instance()  : static
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
get_management_default_values()  : mixed
Return Management data in array format for enqueue Cannot use directly on localize as we need to check individual addon first to avoid fatal error
get_newer_version()  : string
If there is a newer version get the link.
get_plugins_by_level()  : mixed
Get all active addon based on SA level
get_required_fields()  : array<string|int, mixed>
Get the requred rields array keys, in array;
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.
is_show_welcome_tour()  : bool
Check for the current user if he see the welcome tour
limit_locations()  : string
Limit locations.
save_current_option_state()  : mixed
Save the current addon option state.
save_my_settings()  : bool
Use this to save option settings far earlier in the admin process.
save_SerializedOption()  : array<string|int, mixed>
Merge existing options and POST options, then save to the wp_options table.
set_active_column()  : mixed
Set all active column to use on the React column return array
set_default_column()  : mixed
Reconstruct the default data.
set_extended_column()  : mixed
Set extended data into readable array.
set_extended_data_group()  : mixed
Get addon name from extended column
set_field_type()  : mixed
By using the extended data, determine the data type return string
set_properties()  : mixed
Set our properties.
set_ValidOptions()  : mixed
Set valid options according to the addon options array.
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?
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
Set default options for objects. Override in your class.
update_install_info()  : mixed
Update the install info for this add on.
get_app_mode()  : mixed
Get the app mode, last setted by user
get_categories()  : mixed
Get store taxonomy. It will be use on generating category modal on React application
get_default_column()  : mixed
Set manually the comlumn from SLP and set it in default_column return null
get_search_request()  : mixed

Properties

$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 _settings JS variable.

$objects

public array<string|int, mixed> $objects

key = class name, array of attributes() auto_instantiate = true , instantiate the object when this object initializes object = the instantiated object options = default startup options subdir = the subdirectory (from theme root) that contains the class definition

$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_pages

public array<string|int, mixed> $settings_pages

The settings pages we support and the checkboxes that live there: $settings_pages[] = array( 'checkbox_option_1' , 'checkbox_option_2', ...) // = the page name

$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.

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
bool

add_category_nav()

Extend the Navigation item

public add_category_nav(mixed $navigations, mixed $current_item) : mixed
Parameters
$navigations : mixed
$current_item : mixed

add_hooks_and_filters()

Admin hook, enqueue and localized script

public add_hooks_and_filters() : mixed

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>

admin_hook()

Do actual enqueue and localized script

public admin_hook(mixed $hook) : mixed
Parameters
$hook : mixed

check_active_plugin_by_level()

Check if plugin is active.

public check_active_plugin_by_level([mixed $plugin_name = "" ]) : mixed

This function check based on Site Architect settings

Parameters
$plugin_name : mixed = ""

country_options()

Return the Map Domain dropdown options

public country_options() : mixed

create_object_categories()

Create Categories object from main SLP plugin

public create_object_categories() : mixed

create_object_theme()

Create theme object from main SLP plugin

public create_object_theme() : mixed

display_navigation_content()

Display content of extended nav item based on current item

public display_navigation_content(mixed $current_item) : mixed
Parameters
$current_item : mixed

do_admin_startup()

Run this function on admin startup This is required for running the activation class

public do_admin_startup() : mixed

enqueue_admin_css()

If the file admin.css exists and the page prefix starts with slp_ , enqueue the admin style.

public enqueue_admin_css(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_active_addon()

Get all active addon

public get_active_addon() : mixed

get_active_country()

Get all active country from location database

public get_active_country() : mixed

get_active_state()

Get all active state from location database

public get_active_state() : mixed

get_addon_options()

Get all active addon options

public get_addon_options() : mixed

get_extended_column()

Get the extended column if SLP has extendedo return null

public get_extended_column() : mixed

get_filter()

Construct filters from SLP and premium addons

public get_filter() : mixed

get_icons_array()

Return custom marker icons on add/edit form Useable only if Experience is active

public get_icons_array() : 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([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_management_default_values()

Return Management data in array format for enqueue Cannot use directly on localize as we need to check individual addon first to avoid fatal error

public get_management_default_values() : mixed

get_newer_version()

If there is a newer version get the link.

public get_newer_version() : string
Return values
string

get_plugins_by_level()

Get all active addon based on SA level

public get_plugins_by_level() : mixed

get_required_fields()

Get the requred rields array keys, in array;

public get_required_fields() : array<string|int, mixed>
Return values
array<string|int, mixed>

Keys of required fields

get_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[], add-on option_defaults[], or slplus defaults[]

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|object

is_show_welcome_tour()

Check for the current user if he see the welcome tour

public is_show_welcome_tour() : bool
Return values
bool

limit_locations()

Limit locations.

public limit_locations(string $return_code) : string
Parameters
$return_code : string
Return values
string

save_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()

Use this to save option settings far earlier in the admin process.

public save_my_settings() : bool

Necessary if you are going to use your options in localized admin scripts.

TODO: Refactor to save_experience_tab_settings

Make sure you set the settings_pages properties so the right checkboxes end up on the right pages.

Return values
bool

save_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_active_column()

Set all active column to use on the React column return array

public set_active_column() : mixed

set_default_column()

Reconstruct the default data.

public set_default_column() : mixed

return array

set_extended_column()

Set extended data into readable array.

public set_extended_column() : mixed

return Array

set_extended_data_group()

Get addon name from extended column

public set_extended_data_group(mixed $data_field) : mixed
Parameters
$data_field : mixed

set_field_type()

By using the extended data, determine the data type return string

public set_field_type(mixed $type) : mixed
Parameters
$type : mixed

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

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
bool

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
bool

set_default_object_options()

Set default options for objects. Override in your class.

protected set_default_object_options() : mixed

update_install_info()

Update the install info for this add on.

protected update_install_info() : mixed

get_app_mode()

Get the app mode, last setted by user

private get_app_mode() : mixed

get_categories()

Get store taxonomy. It will be use on generating category modal on React application

private get_categories() : mixed

get_default_column()

Set manually the comlumn from SLP and set it in default_column return null

private get_default_column() : mixed

get_search_request()

private get_search_request() : mixed

        
On this page

Search results