SLP_SmartOptions
extends SLPlus_BaseClass_Object
in package
Smart Options setup defines user settings and manages event triggers.
The Smart Options is an object that defines the user settings for Store Locator Plus. It helps define properties that are used to render the administrative UI, default values, and the behavior of the setting throughout the application.
Does things like execute functions when a value changes, set defaults.
The options management for the base plugin (replaces SLPlus->options / SLPlus->options_nojs)
Table of Contents
Properties
- $active_style_css : SLP_Option
- $add_tel_to_phone : SLP_Option
- $address_placeholder : SLP_Option
- $admin_notice_dismissed : mixed
- $ajax_orderby_catcount : SLP_Option
- $allow_tag_in_url : SLP_Option
- $append_to_search : SLP_Option
- $block_ip_limit : SLP_Option
- $block_ip_period : SLP_Option
- $block_ip_release_after : SLP_Option
- $change_callbacks : array<string|int, mixed>
- $current_checkboxes : array<string|int, string>
- $db_loading : bool
- $default_country : string
- $default_country : mixed
- $default_icons : SLP_Option
- $distance_unit : mixed
- $dropdown_style : string
- $force_load_js : SLP_Option
- $google_map_style : SLP_Option
- $google_server_key : mixed
- $has_been_setup : mixed
- $hide_address_entry : SLP_Option
- $hide_address_entry : mixed
- $hide_empty : SLP_Option
- $hide_radius_selections : SLP_Option
- $hide_radius_selector : SLP_Option
- $hide_search_form : SLP_Option
- $highlight_uncoded : SLP_Option
- $initial_distance_already_calculated : bool
- $initial_radius : mixed
- $initial_results_returned : mixed
- $instructions : mixed
- $invalid_query_message : mixed
- $ip_whitelist : SLP_Option
- $label_category : SLP_Option
- $label_directions : mixed
- $label_email : mixed
- $label_fax : mixed
- $label_hours : mixed
- $label_image : mixed
- $label_phone : mixed
- $label_radius : mixed
- $label_search : mixed
- $label_website : mixed
- $loading_indicator : SLP_Option
- $log_schedule_messages : mixed
- $map_center : mixed
- $map_center_lat : mixed
- $map_center_lng : mixed
- $map_end_icon : string
- $map_home_icon : string
- $map_initial_display : SLP_Option
- $message_no_results : SLP_Option
- $message_no_results : mixed
- $no_autozoom : SLP_Option
- $no_homeicon_at_start : SLP_Option
- $no_results_gf_id : SLP_Option
- $no_results_interface : SLP_Option
- $page_layout : array<string|int, mixed>
- $page_layout : mixed
- $permalink_flush_needed : SLP_Option
- $premium_subscription_id : string
- $premium_subscription_id : mixed
- $premium_user_id : string
- $premium_user_id : mixed
- $radii : string
- $remove_credits : mixed
- $reporting_enabled : SLP_Option
- $results_box_title : SLP_Option
- $show_cats_on_search : SLP_Option
- $show_icon_array : SLP_Option
- $show_legend_text : SLP_Option
- $show_option_all : SLP_Option
- $slplus : SLPlus
- $smart_properties : array<string|int, string>
- $starting_image : SLP_Option
- $style_id : int
- $style_id : mixed
- $text_options : array<string|int, string>
- $text_options : mixed
- $time_callbacks : array<string|int, mixed>
- $url_allow_address : SLP_Option
- $use_contact_fields : SLP_Option
- $use_nonces : SLP_Option
- $use_pages : SLP_Option
- $use_sensor : SLP_Option
- $uses_slplus : bool
- $zoom_tweak : mixed
- $change_callbacks : mixed
- $slplus : mixed
- $time_callbacks : mixed
- $uses_slplus : mixed
- $current_callback : mixed
- $current_checkboxes : mixed
- $db_loading : mixed
- $initial_distance_already_calculated : mixed
- $initialized : mixed
- $page_options : mixed
- $smart_properties : mixed
Methods
- __construct() : mixed
- __get() : SLP_Option|null
- Get something for non-existent properties.
- __isset() : bool
- change_map_center() : mixed
- Things we do when a new map center is set.
- change_style_id() : mixed
- Run this when the style ID changes.
- create_smart_options() : mixed
- Create smart option objects and set to default_if_empty values.
- execute_change_callbacks() : mixed
- Execute the stack of change callbacks.
- execute_time_callbacks() : mixed
- Execute the stack of time callbacks.
- exists() : bool
- Does the specified slug exist as a smart option?
- get_instance() : SLPlus_BaseClass_Object
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_option_name() : string
- Return the property formatted option name.
- get_options() : mixed
- Get a list of Smart Options
- get_page_options() : array<string|int, mixed>
- Get a list of options that reside on the specified admin page.
- get_setting_params() : array<string|int, mixed>
- Get the parameters needed for the SLP_Settings entry.
- get_text_options() : array<string|int, string>
- Return a list of option slugs that are text options.
- initialize() : mixed
- Things we do at the start.
- initialize_after_plugins_loaded() : mixed
- Things we do once after the plugins are loaded.
- only_smart_options() : bool
- Return true if the element is an SLP_Option -- call get_options()
- recalculate_initial_distance() : mixed
- Recalculate the initial distance for a location from the map center.
- save() : mixed
- Save the options for the given admin page.
- set() : bool
- Set the smart option value and the legacy options/options_nojs
- set_checkboxes() : mixed
- Set incoming REQUEST checkboxes for the current admin page. Only run on admin pages.
- set_properties() : mixed
- Set our properties.
- set_valid_options() : bool
- Set valid slplus->options and copy to SmartOptions
- set_valid_options_nojs() : bool
- Set valid slplus->options_nojs and copy to SmartOptions
- slp_specific_setup() : mixed
- Initialize the options properties from the WordPress database.
- strip_slashes_if_text() : mixed
- Strip slashes from value if this is a text entry.
- trim() : mixed
- Trim the string.
- create_general_options() : mixed
- General
- create_settings_options() : mixed
- Settings
- create_system_wide_options() : mixed
- System Wide Smart Options
- experience_map_appearance() : mixed
- Settings / Map / Appearance
- experience_map_at_startup() : mixed
- Settings / Map / At Startup
- experience_map_functionality() : mixed
- Settings / Map / Functionality
- experience_map_markers() : mixed
- Settings / Map / Markers
- experience_results_after_search() : mixed
- Settings / Results / After Search
- experience_results_at_startup() : mixed
- Settings / Results / At Startup
- experience_results_labels() : mixed
- Settings / Results / Labels
- experience_search_functionality() : mixed
- Settings / Search / Functionality
- experience_search_labels() : mixed
- Settings / Search / Labels
- general_admin_addons() : mixed
- General > Admin > Addons
- general_admin_messages() : mixed
- General / Admin
- general_app_features() : mixed
- General | App | Features
- general_app_map_services() : mixed
- General | App | Map Services
- general_user_interface() : mixed
- General | User Interface | URL Controls
- get_original_value() : mixed
- Remember the original value of a setting before we change it.
- get_string_default() : string
- Get string defaults.
- results_appearance() : mixed
- Results / Appearance
- results_appearance_no_results() : mixed
- Results | Appearance | No Results
- set_current_checkboxes() : mixed
- Builds a list of checkboxes for the current admin settings page.
- set_text_string_defaults() : mixed
- Set text string defaults.
- set_the_val() : mixed
- Set the value of a smart option & legacy option array copy
- set_valid_option() : bool
- Set an option in an array only if the key already exists, for empty values set to default.
- settings_search_appearance() : mixed
- Settings / Search / Appearance
- setup_smart_callback() : mixed
- Set value change callback methods for smart options.
- view_appearance() : mixed
- Settings / View / Appearance
Properties
$active_style_css
public
SLP_Option
$active_style_css
$add_tel_to_phone
public
SLP_Option
$add_tel_to_phone
$address_placeholder
public
SLP_Option
$address_placeholder
$admin_notice_dismissed
public
mixed
$admin_notice_dismissed
$ajax_orderby_catcount
public
SLP_Option
$ajax_orderby_catcount
$allow_tag_in_url
public
SLP_Option
$allow_tag_in_url
$append_to_search
public
SLP_Option
$append_to_search
$block_ip_limit
public
SLP_Option
$block_ip_limit
$block_ip_period
public
SLP_Option
$block_ip_period
$block_ip_release_after
public
SLP_Option
$block_ip_release_after
$change_callbacks
public
array<string|int, mixed>
$change_callbacks
Stack (array) of callbacks in array ( func , params ) format.
$current_checkboxes read-only
public
array<string|int, string>
$current_checkboxes
Array of smart option checkbox slugs for the current admin screen
$db_loading read-only
public
bool
$db_loading
True only when processing the option values loaded from the db.
$default_country
public
string
$default_country
The default country.
$default_country
public
mixed
$default_country
$default_icons
public
SLP_Option
$default_icons
$distance_unit
public
mixed
$distance_unit
$dropdown_style read-only
public
string
$dropdown_style
The selected jQuery UI theme for the SLPLUS UI.
$force_load_js
public
SLP_Option
$force_load_js
$google_map_style
public
SLP_Option
$google_map_style
$google_server_key
public
mixed
$google_server_key
$has_been_setup
public
mixed
$has_been_setup
= \false
$hide_address_entry
public
SLP_Option
$hide_address_entry
$hide_address_entry
public
mixed
$hide_address_entry
$hide_empty
public
SLP_Option
$hide_empty
$hide_radius_selections
public
SLP_Option
$hide_radius_selections
$hide_radius_selector
public
SLP_Option
$hide_radius_selector
$hide_search_form
public
SLP_Option
$hide_search_form
$highlight_uncoded
public
SLP_Option
$highlight_uncoded
$initial_distance_already_calculated read-only
public
bool
$initial_distance_already_calculated
only do this once per change set.
SLP
$initial_radius
public
mixed
$initial_radius
$initial_results_returned
public
mixed
$initial_results_returned
$instructions
public
mixed
$instructions
$invalid_query_message
public
mixed
$invalid_query_message
$ip_whitelist
public
SLP_Option
$ip_whitelist
$label_category
public
SLP_Option
$label_category
$label_directions
public
mixed
$label_directions
$label_email
public
mixed
$label_email
$label_fax
public
mixed
$label_fax
$label_hours
public
mixed
$label_hours
$label_image
public
mixed
$label_image
$label_phone
public
mixed
$label_phone
$label_radius
public
mixed
$label_radius
$label_search
public
mixed
$label_search
$label_website
public
mixed
$label_website
$loading_indicator
public
SLP_Option
$loading_indicator
$log_schedule_messages
public
mixed
$log_schedule_messages
$map_center
public
mixed
$map_center
$map_center_lat
public
mixed
$map_center_lat
$map_center_lng
public
mixed
$map_center_lng
$map_end_icon
public
string
$map_end_icon
$map_home_icon
public
string
$map_home_icon
$map_initial_display
public
SLP_Option
$map_initial_display
$message_no_results
public
SLP_Option
$message_no_results
$message_no_results
public
mixed
$message_no_results
$no_autozoom
public
SLP_Option
$no_autozoom
$no_homeicon_at_start
public
SLP_Option
$no_homeicon_at_start
$no_results_gf_id
public
SLP_Option
$no_results_gf_id
$no_results_interface
public
SLP_Option
$no_results_interface
Power
$page_layout read-only
public
array<string|int, mixed>
$page_layout
The page layout array( pages slugs => array( section slugs => array( group_slugs => property slugs ) ) )
$page_layout
public
mixed
$page_layout
$permalink_flush_needed
public
SLP_Option
$permalink_flush_needed
$premium_subscription_id
public
string
$premium_subscription_id
$premium_subscription_id
public
mixed
$premium_subscription_id
$premium_user_id
public
string
$premium_user_id
Experience
$premium_user_id
public
mixed
$premium_user_id
$radii read-only
public
string
$radii
The radii string
$remove_credits
public
mixed
$remove_credits
$reporting_enabled
public
SLP_Option
$reporting_enabled
$results_box_title
public
SLP_Option
$results_box_title
$show_cats_on_search
public
SLP_Option
$show_cats_on_search
$show_icon_array
public
SLP_Option
$show_icon_array
$show_legend_text
public
SLP_Option
$show_legend_text
$show_option_all
public
SLP_Option
$show_option_all
$slplus
public
SLPlus
$slplus
$smart_properties read-only
public
array<string|int, string>
$smart_properties
Array of property names that are smart options.
$starting_image
public
SLP_Option
$starting_image
$style_id read-only
public
int
$style_id
The active style ID (hidden, works with "style" setting).
$style_id
public
mixed
$style_id
$text_options
public
array<string|int, string>
$text_options
An array of smart option slugs that are text options.
$text_options
public
mixed
$text_options
$time_callbacks
public
array<string|int, mixed>
$time_callbacks
Stack (array) of callbacks for cron jobs in array ( func , params ) format.
$url_allow_address
public
SLP_Option
$url_allow_address
Premier
$use_contact_fields
public
SLP_Option
$use_contact_fields
$use_nonces
public
SLP_Option
$use_nonces
$use_pages
public
SLP_Option
$use_pages
$use_sensor
public
SLP_Option
$use_sensor
TODO: Options for drop downs needs to be hooked to a load_dropdowns method - to offload this overhead so we don't carry around huge arrays for every SLPlus instantiation note: should be called only when rendering the admin page, the option values should go in the include/module/admin_tabs directory in an SLP_Admin_Experience_Dropdown class
$uses_slplus
public
bool
$uses_slplus
Set to true (default) if the object needs access to the SLPlus plugin object.
$zoom_tweak
public
mixed
$zoom_tweak
$change_callbacks
protected
mixed
$change_callbacks
= array()
$slplus
protected
mixed
$slplus
$time_callbacks
protected
mixed
$time_callbacks
= array()
$uses_slplus
protected
mixed
$uses_slplus
= \true
$current_callback
private
mixed
$current_callback
$current_checkboxes
private
mixed
$current_checkboxes
$db_loading
private
mixed
$db_loading
= \false
$initial_distance_already_calculated
private
mixed
$initial_distance_already_calculated
= \false
$initialized
private
mixed
$initialized
= \false
$page_options
private
mixed
$page_options
$smart_properties
private
mixed
$smart_properties
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
Get something for non-existent properties.
public
__get(string $property) : SLP_Option|null
Parameters
- $property : string
Return values
SLP_Option|null__isset()
public
__isset(string $property) : bool
Parameters
- $property : string
Return values
boolchange_map_center()
Things we do when a new map center is set.
public
change_map_center() : mixed
TODO: look up the address and set the lat/long.
change_style_id()
Run this when the style ID changes.
public
change_style_id( $key, $old_val, $new_val) : mixed
Parameters
create_smart_options()
Create smart option objects and set to default_if_empty values.
public
create_smart_options(array<string|int, mixed> $smart_option_params[, array<string|int, mixed> $defaults = array() ]) : mixed
Parameters
- $smart_option_params : array<string|int, mixed>
-
An array of smart option attributes.
- $defaults : array<string|int, mixed> = array()
-
If not empty, set this as the default for every smart_option_params entry.
execute_change_callbacks()
Execute the stack of change callbacks.
public
execute_change_callbacks() : mixed
Use this to run callbacks after all options have been updated.
Tags
execute_time_callbacks()
Execute the stack of time callbacks.
public
execute_time_callbacks() : mixed
Use this to run callbacks after all options have been updated.
exists()
Does the specified slug exist as a smart option?
public
exists(string $property) : bool
Parameters
- $property : string
Return values
boolget_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_Objectget_option_name()
Return the property formatted option name.
public
get_option_name( $property) : string
Parameters
Return values
stringget_options()
Get a list of Smart Options
public
get_options() : mixed
Tags
get_page_options()
Get a list of options that reside on the specified admin page.
public
get_page_options(string $admin_page) : array<string|int, mixed>
Parameters
- $admin_page : string
Return values
array<string|int, mixed>get_setting_params()
Get the parameters needed for the SLP_Settings entry.
public
get_setting_params(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
- $params : array<string|int, mixed>
Return values
array<string|int, mixed>get_text_options()
Return a list of option slugs that are text options.
public
get_text_options() : array<string|int, string>
Return values
array<string|int, string>initialize()
Things we do at the start.
public
initialize() : mixed
initialize_after_plugins_loaded()
Things we do once after the plugins are loaded.
public
initialize_after_plugins_loaded() : mixed
only_smart_options()
Return true if the element is an SLP_Option -- call get_options()
public
static only_smart_options(mixed $element) : bool
Parameters
- $element : mixed
Tags
Return values
boolrecalculate_initial_distance()
Recalculate the initial distance for a location from the map center.
public
recalculate_initial_distance() : mixed
Called if 'distance_unit' changes.
call_when_changed alway gets 3 params whether or not they are used...
save()
Save the options for the given admin page.
public
save([string $admin_page = '' ]) : mixed
Parameters
- $admin_page : string = ''
set()
Set the smart option value and the legacy options/options_nojs
public
set( $property, $value[, bool $writeToDB = false ]) : bool
Parameters
Return values
boolset_checkboxes()
Set incoming REQUEST checkboxes for the current admin page. Only run on admin pages.
public
set_checkboxes(string $admin_page) : mixed
Parameters
- $admin_page : string
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
set_valid_options()
Set valid slplus->options and copy to SmartOptions
public
set_valid_options( $val, $key) : bool
Parameters
Return values
boolset_valid_options_nojs()
Set valid slplus->options_nojs and copy to SmartOptions
public
set_valid_options_nojs( $val, $key) : bool
Parameters
Return values
boolslp_specific_setup()
Initialize the options properties from the WordPress database.
public
slp_specific_setup() : mixed
Called by MySLP Dashboard.
strip_slashes_if_text()
Strip slashes from value if this is a text entry.
public
strip_slashes_if_text(string &$val, string $key) : mixed
Parameters
- $val : string
- $key : string
trim()
Trim the string.
public
trim(string $key, string $old_val, string $new_val) : mixed
Parameters
- $key : string
- $old_val : string
- $new_val : string
create_general_options()
General
private
create_general_options() : mixed
create_settings_options()
Settings
private
create_settings_options() : mixed
create_system_wide_options()
System Wide Smart Options
private
create_system_wide_options() : mixed
experience_map_appearance()
Settings / Map / Appearance
private
experience_map_appearance() : mixed
experience_map_at_startup()
Settings / Map / At Startup
private
experience_map_at_startup() : mixed
experience_map_functionality()
Settings / Map / Functionality
private
experience_map_functionality() : mixed
experience_map_markers()
Settings / Map / Markers
private
experience_map_markers() : mixed
experience_results_after_search()
Settings / Results / After Search
private
experience_results_after_search() : mixed
experience_results_at_startup()
Settings / Results / At Startup
private
experience_results_at_startup() : mixed
experience_results_labels()
Settings / Results / Labels
private
experience_results_labels() : mixed
experience_search_functionality()
Settings / Search / Functionality
private
experience_search_functionality() : mixed
experience_search_labels()
Settings / Search / Labels
private
experience_search_labels() : mixed
general_admin_addons()
General > Admin > Addons
private
general_admin_addons() : mixed
general_admin_messages()
General / Admin
private
general_admin_messages() : mixed
general_app_features()
General | App | Features
private
general_app_features() : mixed
general_app_map_services()
General | App | Map Services
private
general_app_map_services() : mixed
general_user_interface()
General | User Interface | URL Controls
private
general_user_interface() : mixed
get_original_value()
Remember the original value of a setting before we change it.
private
get_original_value( $new_value, $key, &$option_array, $is_smart_option, $valid_legacy_option) : mixed
Parameters
get_string_default()
Get string defaults.
private
get_string_default(string $key) : string
Parameters
- $key : string
-
key name for string to translate
Return values
stringresults_appearance()
Results / Appearance
private
results_appearance() : mixed
results_appearance_no_results()
Results | Appearance | No Results
private
results_appearance_no_results() : mixed
set_current_checkboxes()
Builds a list of checkboxes for the current admin settings page.
private
set_current_checkboxes(string $admin_page) : mixed
Parameters
- $admin_page : string
set_text_string_defaults()
Set text string defaults.
private
set_text_string_defaults() : mixed
set_the_val()
Set the value of a smart option & legacy option array copy
private
set_the_val( $value, $key, &$option_array, $is_smart_option, $valid_legacy_option) : mixed
Parameters
set_valid_option()
Set an option in an array only if the key already exists, for empty values set to default.
private
set_valid_option(mixed $val, string $key, string $which_option) : bool
External classes should use set_valid_options / set_valid_options_nojs.
Parameters
- $val : mixed
-
the value of a form var
- $key : string
-
the key for that form var
- $which_option : string
-
which array to use
Return values
boolsettings_search_appearance()
Settings / Search / Appearance
private
settings_search_appearance() : mixed
setup_smart_callback()
Set value change callback methods for smart options.
private
setup_smart_callback( $key, $original_value) : mixed
That are defined as on this page (or the page is not defined) Whose original value from slplus->options or slplus->options_nojs DOES NOT match the new value (from the DB usually) ... reset the original value temp var to the smart option default value (if provided , null if not provided) ... and set the smart option to the new value if not empty or the smart option default if the new value was empty
Parameters
view_appearance()
Settings / View / Appearance
private
view_appearance() : mixed