SLP_Admin_Helper
extends SLPlus_BaseClass_Object
in package
Helper, non-critical methods to make WordPress plugins easier to manage.
Table of Contents
Properties
- $slplus : SLPlus
- $uses_slplus : bool
- $slplus : mixed
- $uses_slplus : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_wp_admin_notification() : mixed
- Add a notification to the WP admin pages.
- create_string_wp_setting_error_box() : string
- Create a WordPress-like settings message error box.
- create_SubheadingLabel() : string
- Generate the HTML for a sub-heading label in a settings panel.
- createstring_DropDownMenu() : string
- Create the bulk actions block for the top-of-table navigation.
- createstring_DropDownMenuWithButton() : string
- Create the bulk actions block for the top-of-table navigation.
- get_instance() : SLPlus_BaseClass_Object
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- set_properties() : mixed
- Set our properties.
- webItemExists() : bool
- Check if an item exists out there in the "ether".
- initialize() : mixed
- Do these things when this object is invoked. Override in your class.
Properties
$slplus
public
SLPlus
$slplus
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$slplus
protected
mixed
$slplus
$uses_slplus
protected
mixed
$uses_slplus
= \true
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
public
__get(string $property) : SLPlus_BaseClass_Object
Parameters
- $property : string
Return values
SLPlus_BaseClass_Object__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
booladd_wp_admin_notification()
Add a notification to the WP admin pages.
public
add_wp_admin_notification(string $text[, string $class = 'error' ]) : mixed
Parameters
- $text : string
- $class : string = 'error'
create_string_wp_setting_error_box()
Create a WordPress-like settings message error box.
public
create_string_wp_setting_error_box( $message[, string $message_detail = '' ]) : string
Uses same class as that for the built-in "settings saved" message.
Parameters
Return values
stringcreate_SubheadingLabel()
Generate the HTML for a sub-heading label in a settings panel.
public
create_SubheadingLabel(string $label[, bool $use_h3 = false ]) : string
TODO: Move directly into MySLP-Dashboard and EM if we still want to support those.
Parameters
- $label : string
- $use_h3 : bool = false
-
- use h3 tag like an add_ItemToGroup subheader.
Return values
string —HTML
createstring_DropDownMenu()
Create the bulk actions block for the top-of-table navigation.
public
createstring_DropDownMenu(array<string|int, mixed> $params) : string
$params is a named array:
The drop down components:
string $params['id'] the ID that goes in the select tag, defaults to 'actionType'
string $params['name'] the name that goes in the select tag, defaults to 'action'
string $params['onchange'] JavaScript to run on select change.
string $params['selectedVal'] if the item value matches this param, mark it as selected
mixed[] $params['items'] the named array of drop down elements
$params['items'] is an array of named arrays:
string $params['items'][0]['label'] the label to put in the drop down selection
string $params['items'][0]['value'] the value of the option
boolean $params['items'][0]['selected] true of selected
Parameters
- $params : array<string|int, mixed>
-
a named array of the drivers for this method.
Return values
string —the HTML for the drop down with a button beside it
createstring_DropDownMenuWithButton()
Create the bulk actions block for the top-of-table navigation.
public
createstring_DropDownMenuWithButton(array<string|int, mixed> $params) : string
$params is a named array:
The drop down components:
string $params['id'] the ID that goes in the select tag, defaults to 'actionType' string $params['name'] the name that goes in the select tag, defaults to 'action' string $params['onchange'] JavaScript to run on select change. mixed[] $params['items'] the named array of drop down elements $params['items'] is an array of named arrays: string $params['items'][0]['label'] the label to put in the drop down selection string $params['items'][0]['value'] the value of the option boolean $params['items'][0]['selected] true of selected
string $params['buttonLabel'] the text that goes on the accompanying button, defaults to 'Apply' string $params['onclick'] JavaScript to run on button click.
Parameters
- $params : array<string|int, mixed>
-
a named array of the drivers for this method.
Return values
string —the HTML for the drop down with a button beside it
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() ]) : SLPlus_BaseClass_Object
TODO: PHP7.4 and PHP8.0 the static instance variable returns an object matching $class TODO: PHP8.1 the static instance continually returns the FIRST object (SLP_Admin_Helper) every time -- it is like PHP8.1 static instance is bound to base_class-object versus the calling class object
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
SLPlus_BaseClass_Objectset_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
webItemExists()
Check if an item exists out there in the "ether".
public
webItemExists(string $url) : bool
Parameters
- $url : string
-
- preferably a fully qualified URL
Return values
bool —- true if it is out there somewhere
initialize()
Do these things when this object is invoked. Override in your class.
protected
initialize() : mixed