SLP® phpDocs

MySLP_Addon extends SLP_BaseClass_Addon
in package

Main add-on class for the MySLP plugin.

Extends the base class for add-ons and provides custom functionality specific to the MySLP Dashboard.

Table of Contents

Properties

$activation_class_name  : string
$addon  : SLP_BaseClass_Addon
$admin  : SLP_BaseClass_Admin
$admin_class_name  : string
$admin_menu_entries  : array<string|int, mixed>
$ajax  : SLP_BaseClass_AJAX
$ajax_class_name  : string
$class_prefix  : mixed
$dir  : string
$file  : string
$instance  : MySLP_Addon
$language_dir  : string
$latest_version  : mixed
$meta  : SLP_AddOns_Meta
$metadata  : mixed
$min_slp_version  : string
$myslp  : MySLP
$name  : string
$objects  : array<string|int, mixed>
$option_defaults  : array<string|int, mixed>
$option_name  : string
$options  : array<string|int, mixed>
$options_defaults  : array<string|int, mixed>
$short_slug  : string
$slplus  : SLPlus
$slug  : string
$textdomain  : string
$Updates  : SLP_AddOn_Updates
$url  : string
$userinterface  : SLP_BaseClass_UI
$userinterface_class_name  : string
$uses_slplus  : bool
$version  : string
$widget  : SLP_BaseClass_Widget
$widget_class_name  : string
$WPOption_Manager  : SLP_WPOption_Manager
$uses_myslp  : bool

Methods

__construct()  : mixed
__get()  : mixed
Get the value, running it through a filter.
__isset()  : bool
Allow isset to be called on private properties.
__set()  : SLP_Option|null
Allow value to be set directly.
add_hooks_and_filters()  : mixed
Add the plugin specific hooks and filter configurations here.
add_object()  : mixed
create_object()  : mixed
Instantiate our objects ONCE and refer to them in an object array.
create_object_Updates()  : mixed
Creates updates object AND checks for updates for this add-on.
createobject_Admin()  : mixed
Create the admin interface object and attach to this->admin
createobject_AJAX()  : mixed
Create the AJAX processing object and attach to this->ajax
createobject_UserInterface()  : mixed
Create the user interface object and attach to this->UserInterface
filter_AddMenuItems()  : array<string|int, mixed>
Add the items specified in the menu_entries property to the SLP menu.
get_addon_version()  : string
Get the add-on pack version.
get_instance()  : static
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
get_meta()  : string
Get the add on metadata property as specified.
get_option()  : mixed
Get an option attribute.
init()  : mixed
Plugin init
init_options()  : mixed
Initialize the options properties from the WordPress database.
initialize()  : void
Do this when the plugin object initializes.
instantiate()  : null|object
Instantiate an object of the noted class.
instantiateSettingsHistory()  : void
Instantiates the settings history module for the plugin.
load_options()  : mixed
Load the options class to help the SLP smart options if we have that feature.
run_during_init()  : void
Always run this stuff during the WordPress init hook.
set_option()  : bool
Set an option attribute.
set_option_defaults()  : mixed
Set option defaults outside of hard-coded property values via an array.
set_properties()  : mixed
Set our properties.
set_ValidOptions()  : mixed
Set valid options according to the addon options array.
setting_name()  : string
Generate a proper setting name for the settings class.
slp_init()  : mixed
Things to do once SLP is alive.
at_startup()  : mixed
Things to do at startup after this baby is initialized. Override in your class.
set_default_object_options()  : mixed
Set default options for objects. Override in your class.

Properties

$activation_class_name

public string $activation_class_name

The name of the activation class for this add on.

$admin_class_name

public string $admin_class_name

The name of the admin class for this add on.

$admin_menu_entries

public array<string|int, mixed> $admin_menu_entries

array of menu entries, should be in a key=>value array where key = the menu text and value = the function or PHP file to execute.

$ajax_class_name

public string $ajax_class_name

The name of the AJAX class for this add on.

$class_prefix

public mixed $class_prefix = 'SLP_Dashboard_'

$language_dir

public string $language_dir

The directory that contains the language translation files

$min_slp_version

public string $min_slp_version

Minimum version of SLP required to run this add-on pack in x.y.zz format.

$objects read-only

public array<string|int, mixed> $objects

A named array of our instantiated objects, the key is the class name the value is the object itself.

$option_defaults

public array<string|int, mixed> $option_defaults

The default values for options. Set this in init_options for any gettext elements. $option_defaults['setting'] = __('string to translate', 'textdomain')

$option_name

public string $option_name

The name of the wp_option to store serialized add-on pack settings.

$options

public array<string|int, mixed> $options

Settable options for this plugin. (Does NOT go into main plugin JavaScript)

$options_defaults

public array<string|int, mixed> $options_defaults

Default options.

$slug

public string $slug

The slug for this plugin, usually matches the plugin subdirectory name.

$userinterface_class_name

public string $userinterface_class_name

The name of the user class for this add on.

$uses_slplus

public bool $uses_slplus

Set to true (default) if the object needs access to the SLPlus plugin object.

$version

public string $version

Current version of this add-on pack in x.y.zz format.

$widget_class_name

public string $widget_class_name

The name of the widget class for this add on.

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

Add the plugin specific hooks and filter configurations here.

public add_hooks_and_filters() : mixed

The hooks & filters that go here are cross-interface element hooks/filters needed in 2+ locations:

  • AJAX
  • Admin Interface
  • User Interface

For example, custom taxonomy hooks and filters.

Should include WordPress and SLP specific hooks and filters.

create_object()

Instantiate our objects ONCE and refer to them in an object array.

public create_object(string $class[, string $subdir = '.' ]) : mixed

TODO: Remove and update Power compat to 4.9.1

Parameters
$class : string
$subdir : string = '.'

create_object_Updates()

Creates updates object AND checks for updates for this add-on.

public create_object_Updates(bool $force) : mixed
Parameters
$force : bool

createobject_Admin()

Create the admin interface object and attach to this->admin

public createobject_Admin() : mixed

Called on slp_admin_menu_starting. If that menu is rendering, we are on an admin page. Called via hook slp_admin_menu_starting setup in this class.

createobject_AJAX()

Create the AJAX processing object and attach to this->ajax

public createobject_AJAX() : mixed

createobject_UserInterface()

Create the user interface object and attach to this->UserInterface

public createobject_UserInterface() : mixed
Tags
used-by

\MySLP_REST_API::get_options

used-by

\SLP_BaseClass_Addon::slp_init via WP Filter wp_enqueue_scripts

filter_AddMenuItems()

Add the items specified in the menu_entries property to the SLP menu.

public filter_AddMenuItems(array<string|int, mixed> $menuItems) : array<string|int, mixed>

If you make the 'slug' property of the $admin_menu_entries array = $this->addon->short_slug you won't need to set this->addon->admin->admin_page_slug

Parameters
$menuItems : array<string|int, mixed>
Return values
array<string|int, mixed>

get_addon_version()

Get the add-on pack version.

public get_addon_version() : string
Return values
string

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

Get the add on metadata property as specified.

public get_meta(string $property) : string
Parameters
$property : string
Return values
string

get_option()

Get an option attribute.

public get_option(string $property, string $attribute) : mixed
Parameters
$property : string
$attribute : string

init_options()

Initialize the options properties from the WordPress database.

public init_options() : mixed

initialize()

Do this when the plugin object initializes.

public final initialize() : void
Tags
uses
MySLP_DomainSwitcher::updateUserBlogDomain

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

instantiateSettingsHistory()

Instantiates the settings history module for the plugin.

public instantiateSettingsHistory() : void

load_options()

Load the options class to help the SLP smart options if we have that feature.

public load_options() : mixed

run_during_init()

Always run this stuff during the WordPress init hook.

public run_during_init() : void

set_option()

Set an option attribute.

public set_option(string $property, string $attribute, mixed $value) : bool
Parameters
$property : string
$attribute : string
$value : mixed
Return values
bool

set_option_defaults()

Set option defaults outside of hard-coded property values via an array.

public set_option_defaults() : mixed

This allows for gettext() string translations of defaults.

Only bring over items in default_value_array that have matching keys in $this->options already.

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
Parameters
$val : mixed
$key : mixed

setting_name()

Generate a proper setting name for the settings class.

public setting_name(mixed $setting) : string
Parameters
$setting : mixed
Return values
string

slp_init()

Things to do once SLP is alive.

public slp_init() : mixed
Tags
used-by

\SLP_BaseClass_Addon::initialize via SLP Filter slp_init_complete

uses
SLP_BaseClass_Addon::createobject_UserInterface

via WP Filter wp_enqueue_scripts

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.

set_default_object_options()

Set default options for objects. Override in your class.

protected set_default_object_options() : mixed

        
On this page

Search results