Store Locator Plus®

SLP_Text extends SLP_Object_With_Objects
in package

Methods to help manage the SLP text strings in an i18n compatible fashion.

Table of Contents

Properties

$class_prefix  : string
$dir  : mixed
$dir  : string
$objects  : array<string|int, mixed>
$slplus  : SLPlus
$text_strings  : mixed
$translate  : bool
$translate  : mixed
$uses_slplus  : bool
$class_prefix  : mixed
$objects  : mixed
$slplus  : mixed
$uses_slplus  : mixed

Methods

__construct()  : mixed
__get()  : SLPlus_BaseClass_Object
__isset()  : bool
add_object()  : mixed
get_instance()  : SLPlus_BaseClass_Object
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
get_text()  : string
Return an option / option_nojs value and allows for text translation if set.
get_text_group()  : array<string|int, mixed>
Return an entire array of slugs for a specific group.
get_text_string()  : string
Get a basic text string.
get_text_with_variables_replaced()  : string
Send a set of parameters to a printf on one of the Text Manager's registered printf strings.
get_url()  : string
Get an entry from our URLs list.
get_web_link()  : SLP_Web_Link
Get the specified web page HTML with embedded hyperlinks.
instantiate()  : null|object
Instantiate an object of the noted class.
set_properties()  : mixed
Set our properties.
at_startup()  : mixed
Things to do at startup after this baby is initialized. Override in your class.
initialize()  : mixed
Do these things when this object is invoked. Override in your class.
set_default_object_options()  : mixed
Set default options for objects. Override in your class.
augment_class()  : string
Augment the class names so we can reference simple property names.
auto_instantiate()  : mixed
Any object with auto_instantiate set to true is instantiate during initialization.
init_strings()  : mixed
Initialize strings in subsets as needed.

Properties

$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

$text_strings

public mixed $text_strings

$translate

public bool $translate

default: false, do not enable translate filters

$translate

public mixed $translate = \false

$uses_slplus

public bool $uses_slplus

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

$uses_slplus

protected mixed $uses_slplus = \false

Methods

__construct()

public __construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

__isset()

public __isset(string $property) : bool
Parameters
$property : string
Return values
bool

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_Object

get_text()

Return an option / option_nojs value and allows for text translation if set.

public get_text(mixed $key[, mixed $value = null ][, mixed $allow_empty = true ]) : string
Parameters
$key : mixed
$value : mixed = null
$allow_empty : mixed = true
Return values
string

The option/option_nojs value (possibly translated)

get_text_group()

Return an entire array of slugs for a specific group.

public get_text_group(string $slug) : array<string|int, mixed>
Parameters
$slug : string
Return values
array<string|int, mixed>

get_text_string()

Get a basic text string.

public get_text_string(string|array<string|int, mixed> $slug[, bool $log_no_default = true ]) : string

If the text cannot be found in the lookup table section (first param of slug array) specified, it will be searched for in the 'general section.

If still not located the text will be set to the key (seccond param of slug array) provided.

Parameters
$slug : string|array<string|int, mixed>

The slug representing the text string we want to fetch.

$log_no_default : bool = true

Should we log missing default strings?

Return values
string

The text string for the specified slug.

get_text_with_variables_replaced()

Send a set of parameters to a printf on one of the Text Manager's registered printf strings.

public get_text_with_variables_replaced(string $slug, mixed $params) : string
Parameters
$slug : string

The printf text slug

$params : mixed

The parameters for the sprintf replacements

Return values
string

the i18n text

get_url()

Get an entry from our URLs list.

public get_url(string $slug) : string
Parameters
$slug : string
Return values
string

Get the specified web page HTML with embedded hyperlinks.

public get_web_link(string $slug[, string $option = '' ]) : SLP_Web_Link
Parameters
$slug : string

Which web page link to fetch.

$option : string = ''

Option (such as a product slug) for further processing.

Return values
SLP_Web_Link

A web link object.

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

set_properties()

Set our properties.

public set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
$options : array<string|int, mixed> = array()

at_startup()

Things to do at startup after this baby is initialized. Override in your class.

protected at_startup() : mixed

initialize()

Do these things when this object is invoked. Override in your class.

protected initialize() : mixed

set_default_object_options()

Set default options for objects. Override in your class.

protected set_default_object_options() : mixed

augment_class()

Augment the class names so we can reference simple property names.

private augment_class(string $class) : string
Parameters
$class : string
Return values
string

auto_instantiate()

Any object with auto_instantiate set to true is instantiate during initialization.

private auto_instantiate() : mixed

init_strings()

Initialize strings in subsets as needed.

private init_strings(array<string|int, mixed> $slug) : mixed
Parameters
$slug : array<string|int, mixed>

        
On this page

Search results