Store Locator Plus®

SLP_Power_Directory_UI_Shortcode_slp_directory extends SLPlus_BaseClass_Object
in package

The slp_directory shortcode processor.

[slp_directory]

[slp_directory by="city" style="list"]

[slp_directory by="city" style="list_with_count" locator_page="/locations/"] [slp_directory by="city" style="list_with_count" landing_page="/locations/"]

[slp_directory by="city" locator_page="/locations" locator_data="sl_id"]

[slp_directory by="city" filter_by=""]

[slp_directory style="landing_page"]

[slp_directory style="title"]

Attributes: o by = a store property to group data by o filter_by = an SQL clause to include/exclude locations i.e. filter_by="sl_country='USA'" o if_blank_use = alternate data field if the group by field is blank o locator_page = a URL for the locator page on the site o style = list, list_with_count, landing_page, title

By attribute: Takes a location property in the form of the field name. sl_store, sl_city, etc. * The following field names are aliased for ease-of-use: o store, sl_store, name = the store name field (sl_store) o city, sl_city = the city field (sl_city)

Style attribute: Determines the output format of the sl_directory shortcode. o list = a list of the "by attribute" values from the current location database, for example a list of cities, for example "Charleston" o list_with_count = same as list but with the count of locations with that property, for example "Charleston (2)"

Table of Contents

Properties

$addon  : SLPPower
$addon  : mixed
$alternate_groupby_field  : string
$attribute_defaults  : array<string|int, string>
$attributes  : array<string|int, string>
$attributes  : mixed
$content  : string
$content  : mixed
$filter_by  : string
$group_by  : string
$landing_page  : SLP_Power_Directory_Landing_Page
$name  : string
$name  : mixed
$slplus  : SLPlus
$uses_slplus  : bool
$slplus  : mixed
$uses_slplus  : mixed
$alternate_groupby_field  : mixed
$attribute_defaults  : mixed
$filter_by  : mixed
$group_by  : mixed
$landing_page  : mixed
$only_with_category  : mixed

Methods

__construct()  : mixed
__get()  : SLPlus_BaseClass_Object
__isset()  : bool
createstring_ShortcodeOutput()  : string
Process the slp_directory shortcode.
filter_SQLStatements()  : string
Custom SQL command statements for the shortcode processor.
get_instance()  : SLPlus_BaseClass_Object
Return an instance of the object which is also registered to the slplus global less the SLP_ part.
initialize()  : mixed
Things to do at start.
remove_sql_filter()  : mixed
Remove the SQL filter as needed.
set_properties()  : mixed
Set our properties.
sql_add_only_with_category()  : string
Add the only_with_category to the WHERE selection clause.
sql_AddFilterBy()  : string
Add the filter_by to the WHERE selection clause.
createstring_LandingPage()  : string
Create the landing page HTML.
createstring_List()  : string
Create the list HTML for this shortcode.
createstring_ListLink()  : string
Create an anchor text link for a directory entry.
set_location_grouping()  : mixed
Group the directory output by a specific location property.
translate_field_alias()  : mixed

Properties

$uses_slplus

public bool $uses_slplus

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

$attribute_defaults

private mixed $attribute_defaults = array('by' => 'sl_state', 'if_blank_use' => '', 'filter_by' => '', 'landing_page' => '', 'locator_page' => '', 'locator_data' => '', 'only_with_category' => '', 'style' => 'list')

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

createstring_ShortcodeOutput()

Process the slp_directory shortcode.

public createstring_ShortcodeOutput() : string

Attributes: o by = a store property to group data by o style = list, list_with_count, details

Return values
string

$HTML

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

remove_sql_filter()

Remove the SQL filter as needed.

public remove_sql_filter() : mixed

This is called from the parent whenever the specific shortcode processing is no longer needed. Allows for multiple shortcodes with different attributes to appear on the same page.

set_properties()

Set our properties.

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

Create an anchor text link for a directory entry.

private createstring_ListLink( $text, mixed $field_name[, mixed $url_data = null ][, mixed $url_field = null ]) : string
Parameters
$text :

the text to show on the link

$field_name : mixed
$url_data : mixed = null
$url_field : mixed = null
Return values
string

the HTML output string


        
On this page

Search results