SLP_Style_Manager
extends SLPlus_BaseClass_Object
in package
The "Locator Style" manager, handles implementing and changing SLP UI "themes".
Cached styles are cached by the post ID.
Table of Contents
Constants
- REST_ENDPOINT = 'wp-json/wp/v2/slp_style_gallery'
- TRANSIENT_BASE = 'slp_style_'
Properties
- $page_size : mixed
- $slplus : SLPlus
- $uses_slplus : bool
- $slplus : mixed
- $uses_slplus : mixed
- $current_style : mixed
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- apply_style() : mixed
- Apply the new style.
- cache_style() : mixed
- Write the locator style to the cache (WP transient)
- change_style() : mixed
- Change the active style.
- fetch_style() : WP_Error|string
- Fetch the style (or styles) from the style server.
- 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.
- initialize() : mixed
- Do these things when this object is invoked. Override in your class.
- set_active_style() : mixed
- Set the active style including its meta as $this->current_style
- style_matches_slug() : bool
- Does the style slug match our active setting?
Constants
REST_ENDPOINT
public
mixed
REST_ENDPOINT
= 'wp-json/wp/v2/slp_style_gallery'
TRANSIENT_BASE
public
mixed
TRANSIENT_BASE
= 'slp_style_'
Properties
$page_size
public
mixed
$page_size
= 9
$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
$current_style
private
mixed
$current_style
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
boolapply_style()
Apply the new style.
public
apply_style( $style_id[, $only_for_property = null ]) : mixed
Parameters
cache_style()
Write the locator style to the cache (WP transient)
public
cache_style( $post) : mixed
Parameters
change_style()
Change the active style.
public
change_style(int $old_id, int $new_id) : mixed
Parameters
- $old_id : int
- $new_id : int
fetch_style()
Fetch the style (or styles) from the style server.
public
fetch_style([int|null $style_id = null ]) : WP_Error|string
Parameters
- $style_id : int|null = null
Return values
WP_Error|stringget_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()
initialize()
Do these things when this object is invoked. Override in your class.
protected
initialize() : mixed
set_active_style()
Set the active style including its meta as $this->current_style
private
set_active_style(int $style_id) : mixed
Parameters
- $style_id : int
style_matches_slug()
Does the style slug match our active setting?
private
style_matches_slug( $slug) : bool