SLP_Experience_UI
extends SLP_BaseClass_UI
in package
Holds the UI-only code.
This allows the main plugin to only include this file in the front end via the wp_enqueue_scripts call. Reduces the back-end footprint.
Table of Contents
Properties
- $addon : mixed
- $js_requirements : array<string|int, string>
- $js_settings : array<string|int, string>
- $jsHandle : mixed
- $myslp : MySLP
- $slplus : SLPlus
- $uses_myslp : bool
- $uses_slplus : bool
- $slug : mixed
- $attribute_js_options : array<string|int, mixed>
- $is_address_in_url : bool
- $shortcode_options_combo : array<string|int, mixed>
Methods
- __construct() : mixed
- __get() : SLPlus_BaseClass_Object
- __isset() : bool
- add_data_queries() : string
- Add Experience-specific data queries.
- add_email_form() : string
- Add a popup email form div to the map output.
- add_hooks_and_filters() : void
- Add WordPress and SLP hooks and filters.
- add_missing_dropdown() : string
- Adds a missing dropdown shortcode to the provided HTML if it's not already present.
- add_radius_first_entry() : array<string|int, mixed>
- Add a starting entry on the radius selection menu.
- add_slplus_shortcode_attributes() : array<string|int, mixed>
- Extends the main SLP shortcode approved attributes list, setting defaults.
- at_startup() : void
- Things we do when starting.
- change_find_button_text() : string
- Change the find button label to what we have set in this plugin.
- create_selector() : string
- Create a select drop-down based on the SQL commands listed.
- create_string_hidden_fields_from_widget_vars() : string
- Create the hidden search form fields from the inbound widget vars.
- createstring_CSSForHeader() : string
- Add Custom CSS to the UI header.
- createstring_LocatorLayout() : string
- Take over the search form layout.
- enqueue_ui_css() : mixed
- If the file userinterface.css exists, enqueue it.
- enqueue_ui_javascript() : void
- Add our helpers for the userinterface.js.
- filter_ModifyMapOutput() : string
- Modify the map layout.
- filter_ModifyMapOutput_ES() : string
- Modify the map layout.
- filter_ProcessSearchElement() : array<string|int, mixed>
- Perform extra search form element processing.
- filter_ui_radius_selector() : string
- Modify the UI radius selector according to the selected behavior.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- initialize() : mixed
- Instantiate the admin panel object.
- is_address_passed_by_URL() : bool
- Return true if the address was passed in via the URL and that option is enabled.
- modify_js_options() : array<string|int, mixed>
- Modify the slplus.options object going into SLP.js
- modify_results_layout() : string
- Change how the information below the map is rendered.
- modify_searchlayout() : string
- Modify the search form.
- process_hook_ShortCodeSLPOption() : array<string|int, mixed>
- Processes the SLP shortcode option hook.
- set_properties() : mixed
- Set our properties.
- set_SearchAddressFromRequest() : string
- Sets the search form address input on the UI to a post/get var.
- attribute_special_processing() : void
- Special attribute processing.
- create_options_string() : string
- Create the <option ...> filler for a select drop-down based on a returned SQL search.
- CreateSliderButton() : string
- Return the HTML for a slider button.
- createstring_MapDisplaySlider() : string
- Generate the HTML for the map on/off slider button if requested.
Properties
$addon
public
mixed
$addon
$js_requirements
public
array<string|int, string>
$js_requirements
An array of the JavaScript hooks that are needed by the userinterface.js script. userinterface.js is only loaded if the file exists in the include directory.
$js_settings
public
array<string|int, string>
$js_settings
JavaScript settings that are to be localized as a
$jsHandle
public
mixed
$jsHandle
$myslp
public
MySLP
$myslp
$slplus
public
SLPlus
$slplus
$uses_myslp
public
bool
$uses_myslp
Set to true to add a $myslp property pointing to global $myslp
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$slug
protected
mixed
$slug
= 'slp-experience'
$attribute_js_options
private
array<string|int, mixed>
$attribute_js_options
= array()
$is_address_in_url
private
bool
$is_address_in_url
$shortcode_options_combo
private
array<string|int, mixed>
$shortcode_options_combo
= array('city_selector' => array('discrete' => 'dropdown_discretefilter', 'input' => 'dropdown_addressinput', 'hidden' => 'hidden'), 'country_selector' => array('discrete' => 'dropdown_discretefilter', 'input' => 'dropdown_addressinput', 'hidden' => 'hidden'), 'state_selector' => array('discrete' => 'dropdown_discretefilter', 'input' => 'dropdown_addressinput', 'hidden' => 'hidden'))
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_data_queries()
Add Experience-specific data queries.
public
add_data_queries(string $slug) : string
Parameters
- $slug : string
Return values
stringadd_email_form()
Add a popup email form div to the map output.
public
add_email_form(string $slp_html) : string
Parameters
- $slp_html : string
Return values
stringadd_hooks_and_filters()
Add WordPress and SLP hooks and filters.
public
add_hooks_and_filters() : void
WP syntax reminder: add_filter(<filter_name>,
Remember:
- or - array(
Tags
add_missing_dropdown()
Adds a missing dropdown shortcode to the provided HTML if it's not already present.
public
add_missing_dropdown(string $field, string $html) : string
Parameters
- $field : string
-
The name of the dropdown field to check for.
- $html : string
-
The HTML content where the dropdown should be checked or added.
Return values
string —The dropdown shortcode if it was missing, or an empty string if it's already present.
add_radius_first_entry()
Add a starting entry on the radius selection menu.
public
add_radius_first_entry(array<string|int, string> $options, SLP_UI $ui_object) : array<string|int, mixed>
Parameters
- $options : array<string|int, string>
- $ui_object : SLP_UI
Return values
array<string|int, mixed>add_slplus_shortcode_attributes()
Extends the main SLP shortcode approved attributes list, setting defaults.
public
add_slplus_shortcode_attributes(array<string|int, mixed> $valid_attributes, array<string|int, mixed> $attributes_in_use) : array<string|int, mixed>
This will extend the approved shortcode attributes to include the items listed. The array key is the attribute name, the value is the default if the attribute is not set.
The attribute values are set in the SLP UI class render_shortcode method via WordPress core functions.
Any changes that are needed in slp.js need to be recorded here for later use by the 'slp_js_options' filter.
Parameters
- $valid_attributes : array<string|int, mixed>
-
current list of approved attributes
- $attributes_in_use : array<string|int, mixed>
-
attributes from the shortcode as entered
Return values
array<string|int, mixed> —return the allowed attributes (key) and their defaults (value)
at_startup()
Things we do when starting.
public
final at_startup() : void
change_find_button_text()
Change the find button label to what we have set in this plugin.
public
change_find_button_text() : string
Return values
stringcreate_selector()
Create a select drop-down based on the SQL commands listed.
public
create_selector(string $base_name, array<string|int, string> $sql_commands) : string
Parameters
- $base_name : string
-
the base name for our selector
- $sql_commands : array<string|int, string>
-
the SQL command array
Return values
stringcreate_string_hidden_fields_from_widget_vars()
Create the hidden search form fields from the inbound widget vars.
public
create_string_hidden_fields_from_widget_vars() : string
Return values
stringcreatestring_CSSForHeader()
Add Custom CSS to the UI header.
public
createstring_CSSForHeader(string $HTML) : string
Parameters
- $HTML : string
Return values
stringcreatestring_LocatorLayout()
Take over the search form layout.
public
createstring_LocatorLayout(string $HTML) : string
Parameters
- $HTML : string
-
the original SLP layout
Return values
string —the modified layout
enqueue_ui_css()
If the file userinterface.css exists, enqueue it.
public
enqueue_ui_css() : mixed
enqueue_ui_javascript()
Add our helpers for the userinterface.js.
public
enqueue_ui_javascript() : void
filter_ModifyMapOutput()
Modify the map layout.
public
filter_ModifyMapOutput(string $HTML) : string
Parameters
- $HTML : string
Return values
stringfilter_ModifyMapOutput_ES()
Modify the map layout.
public
filter_ModifyMapOutput_ES(string $HTML) : string
Parameters
- $HTML : string
Return values
stringfilter_ProcessSearchElement()
Perform extra search form element processing.
public
filter_ProcessSearchElement(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed>filter_ui_radius_selector()
Modify the UI radius selector according to the selected behavior.
public
filter_ui_radius_selector(string $radius_HTML) : string
Behavior 'always_ignore' hides the radius.
Parameters
- $radius_HTML : string
Return values
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() ]) : 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
staticinitialize()
Instantiate the admin panel object.
public
initialize() : mixed
is_address_passed_by_URL()
Return true if the address was passed in via the URL and that option is enabled.
public
is_address_passed_by_URL() : bool
Return values
boolmodify_js_options()
Modify the slplus.options object going into SLP.js
public
modify_js_options(array<string|int, mixed> $options) : array<string|int, mixed>
Parameters
- $options : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>modify_results_layout()
Change how the information below the map is rendered.
public
modify_results_layout() : string
Return values
string —the modified layout
modify_searchlayout()
Modify the search form.
public
modify_searchlayout(string $html) : string
Parameters
- $html : string
Tags
Return values
stringprocess_hook_ShortCodeSLPOption()
Processes the SLP shortcode option hook.
public
process_hook_ShortCodeSLPOption(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
set_SearchAddressFromRequest()
Sets the search form address input on the UI to a post/get var.
public
set_SearchAddressFromRequest(string $currentVal) : string
The option "allow address in URL" needs to be on.
Parameters
- $currentVal : string
Return values
string —the default input value
attribute_special_processing()
Special attribute processing.
private
attribute_special_processing(string $option_name) : void
Parameters
- $option_name : string
create_options_string()
Create the <option ...> filler for a select drop-down based on a returned SQL search.
private
create_options_string(string $selected_value, array<string|int, string> $sql_commands) : string
Parameters
- $selected_value : string
- $sql_commands : array<string|int, string>
Return values
stringCreateSliderButton()
Return the HTML for a slider button.
private
CreateSliderButton(bool $isChecked) : string
The setting parameter will be used for several things: the div ID will be "settingid_div" the assumed matching label option will be "settingid_label" for WP get_option() the ahref ID will be "settingid_toggle"
Parameters
- $isChecked : bool
-
default on/off state of checkbox
Return values
string —the slider HTML
createstring_MapDisplaySlider()
Generate the HTML for the map on/off slider button if requested.
private
createstring_MapDisplaySlider() : string
Return values
string —HTML for the map slider.