SLPPower
extends SLP_BaseClass_Addon
in package
The main Power add on class.
Table of Contents
Properties
- $activation_class_name : string
- $addon : SLP_BaseClass_Addon
- $admin : mixed
- $admin_class_name : string
- $admin_menu_entries : array<string|int, mixed>
- $ajax : SLP_BaseClass_AJAX
- $ajax_class_name : string
- $category_attributes : mixed
- $category_data : mixed
- $category_manager : mixed
- $category_meta_option_base : mixed
- $cron : mixed
- $csvImporter : mixed
- $current_location_categories : mixed
- $dir : string
- $file : string
- $instance : mixed
- $language_dir : string
- $latest_version : mixed
- $location_fields : mixed
- $messages : mixed
- $meta : SLP_AddOns_Meta
- $metadata : mixed
- $min_slp_version : string
- $myslp : MySLP
- $name : string
- $objects : array<string|int, mixed>
- $option_defaults : array<string|int, mixed>
- $option_name : string
- $options : mixed
- $options_defaults : array<string|int, mixed>
- $pages : mixed
- $short_slug : string
- $slplus : SLPlus
- $slug : string
- $stores_taxonomy : mixed
- $textdomain : string
- $Updates : SLP_AddOn_Updates
- $url : string
- $userinterface : SLP_Power_UI
- $userinterface_class_name : string
- $uses_myslp : bool
- $uses_slplus : bool
- $using_pages : mixed
- $version : string
- $widget : SLP_BaseClass_Widget
- $widget_class_name : string
- $WPOption_Manager : SLP_WPOption_Manager
- $class_prefix : mixed
- $cache_icon_strings : mixed
- $categories_loaded_for : mixed
- $category_details : mixed
Methods
- __construct() : mixed
- __get() : mixed
- Get the value, running it through a filter.
- __isset() : bool
- Allow isset to be called on private properties.
- __set() : SLP_Option|null
- Allow value to be set directly.
- action_DeleteLocationCategories() : mixed
- Delete current location categories from Tagalong categories table.
- add_csv_mime_type() : array<string|int, mixed>
- Allows WordPress to process csv file types
- add_hooks_and_filters() : mixed
- Add cross-element hooks & filters.
- add_icon_directory() : array<string|int, mixed>
- Add our icon directory to the list used by SLP.
- add_object() : mixed
- add_REST_endpoints() : mixed
- Add some new REST endpoints.
- add_sql_commands() : string
- Return an SQL command component based on the command key provided.
- array_to_CSV() : string
- Convert an array to CSV.
- create_cron_object() : mixed
- Create the cron object.
- create_CSVLocationImporter() : mixed
- Create and attach the \CSVImportLocations object
- create_LocationIcons() : string
- Create a category icon array.
- create_object() : mixed
- Instantiate our objects ONCE and refer to them in an object array.
- create_object_category_data() : mixed
- Setup the category data object.
- create_object_import_messages() : mixed
- Attach a message stack to this import object.
- create_object_schedule_messages() : mixed
- Attach a message stack to this import object.
- create_object_Updates() : mixed
- Creates updates object AND checks for updates for this add-on.
- create_string_icon_array() : string
- Create the icon array for a given location.
- createobject_Admin() : mixed
- Create the admin interface object and attach to this->admin
- createobject_AJAX() : mixed
- Create the AJAX processing object and attach to this->ajax
- createobject_UserInterface() : mixed
- Create the user interface object and attach to this->UserInterface
- createstring_CategoryImageHTML() : string
- Create the image string HTML
- createstring_CategoryLegendText() : string
- Create the category title span HTML
- filter_AddMenuItems() : array<string|int, mixed>
- Set the admin menu items.
- get_addon_version() : string
- Get the add-on pack version.
- get_all_crons_for_hook() : array<string|int, mixed>
- Get all the crons for the specified hook.
- get_instance() : static
- Return an instance of the object which is also registered to the slplus global less the SLP_ part.
- get_meta() : string
- Get the add on metadata property as specified.
- get_option() : mixed
- Get an option attribute.
- get_TermWithTagalongData() : array<string|int, mixed>|false
- Add extended tagalong data to the category array.
- init_options() : mixed
- Initialize the options properties from the WordPress database.
- initialize() : void
- Initialize a singleton of this object.
- instantiate() : null|object
- Instantiate an object of the noted class.
- load_options() : mixed
- Load the options class to help the SLP smart options if we have that feature.
- modify_page_title() : mixed
- Modify the HTML <title> tag page title of the current page.
- process_hook_SLPLocationAdded() : void
- Processes the hook triggered when a new location is added.
- recode_all_uncoded_locations() : mixed
- Recode all the uncoded locations.
- run_during_init() : void
- Executes actions during the initialization process.
- set_LocationCategories() : mixed
- Fill the current_location_categories array with the category IDs assigned to the current location.
- set_option() : bool
- Set an option attribute.
- set_option_defaults() : mixed
- Set option defaults outside of hard-coded property values via an array.
- set_properties() : mixed
- Set our properties.
- set_ValidOptions() : mixed
- Set valid options according to the addon options array.
- set_where_not_valid_lat_long() : string
- Set the NOT where valid lat long clause.
- setting_name() : string
- Generate a proper setting name for the settings class.
- slp_init() : mixed
- Things to do once SLP is alive.
- widgets_init() : void
- at_startup() : mixed
- Things to do at startup after this baby is initialized. Override in your class.
- set_default_object_options() : mixed
- Set default options for objects. Override in your class.
- createstring_CategoryEditLink() : string
- Create a link to the category editor if warranted.
- createstring_CategoryIconHTML() : string
- Create the category HTML output for admin and user interface with images and text.
- init_using_pages() : mixed
- Set using pages and look for incoming change on general tab.
- process_bad_category_id() : mixed
- Process a bad category ID.
Properties
$activation_class_name
public
string
$activation_class_name
The name of the activation class for this add on.
$addon
public
SLP_BaseClass_Addon
$addon
$admin
public
mixed
$admin
$admin_class_name
public
string
$admin_class_name
The name of the admin class for this add on.
$admin_menu_entries
public
array<string|int, mixed>
$admin_menu_entries
array of menu entries, should be in a key=>value array where key = the menu text and value = the function or PHP file to execute.
$ajax
public
SLP_BaseClass_AJAX
$ajax
The AJAX object.
$ajax_class_name
public
string
$ajax_class_name
The name of the AJAX class for this add on.
$category_attributes
public
mixed
$category_attributes
= array('category_url' => '', 'map-marker' => '', 'medium-icon' => '', 'rank' => '', 'url_target' => '')
$category_data
public
mixed
$category_data
$category_manager
public
mixed
$category_manager
$category_meta_option_base
public
mixed
$category_meta_option_base
$cron
public
mixed
$cron
$csvImporter
public
mixed
$csvImporter
$current_location_categories
public
mixed
$current_location_categories
= array()
$dir
public
string
$dir
The directory the add-on pack resides in.
$file
public
string
$file
The add on loader file.
$instance
public
static mixed
$instance
$language_dir
public
string
$language_dir
The directory that contains the language translation files
$latest_version
public
mixed
$latest_version
= '0.0.0'
$location_fields
public
mixed
$location_fields
= array('sl_city' => 'city', 'sl_country' => 'country', 'sl_state' => 'state', 'territory' => 'territory')
$messages
public
mixed
$messages
$meta
public
SLP_AddOns_Meta
$meta
$metadata
public
mixed
$metadata
$min_slp_version
public
string
$min_slp_version
Minimum version of SLP required to run this add-on pack in x.y.zz format.
$myslp
public
MySLP
$myslp
$name
public
string
$name
Text name for this add on pack.
$objects read-only
public
array<string|int, mixed>
$objects
A named array of our instantiated objects, the key is the class name the value is the object itself.
$option_defaults
public
array<string|int, mixed>
$option_defaults
The default values for options. Set this in init_options for any gettext elements. $option_defaults['setting'] = __('string to translate', 'textdomain')
$option_name
public
string
$option_name
The name of the wp_option to store serialized add-on pack settings.
$options
public
mixed
$options
= array(
'city' => '',
// Group By Fields by= shortcode attribute
'city_selector' => '',
// Group By Fields by= shortcode attribute
'country' => '',
// Group By Fields by= shortcode attribute
'country_selector' => '',
// Group By Fields by= shortcode attribute
'cron_import_timestamp' => '',
'cron_import_recurrence' => 'none',
'csv_clear_messages_on_import' => '1',
'csv_file_url' => '',
'csv_skip_geocoding' => '0',
'csv_duplicates_handling' => 'update',
'default_comments' => '0',
'default_page_status' => 'publish',
'default_trackbacks' => '0',
'load_data' => '0',
'installed_version' => '',
'pages_read_more_text' => '',
'pages_replace_websites' => '1',
'page_template' => '',
'permalink_starts_with' => \SLPlus::locationPostURL,
'prevent_new_window' => '1',
'prepend_permalink_blog' => '1',
'state' => '',
// Group By Fields by= shortcode attribute
'state_selector' => '',
// Group By Fields by= shortcode attribute
'territory' => '',
// Group By Fields by= shortcode attribute
'territory_selector' => '',
)
$options_defaults
public
array<string|int, mixed>
$options_defaults
Default options.
$pages
public
mixed
$pages
$short_slug
public
string
$short_slug
The short slug name.
$slplus
public
SLPlus
$slplus
$slug
public
string
$slug
The slug for this plugin, usually matches the plugin subdirectory name.
$stores_taxonomy
public
mixed
$stores_taxonomy
$textdomain
public
string
$textdomain
The slug for the textdomain
$Updates
public
SLP_AddOn_Updates
$Updates
$url
public
string
$url
The url for this plugin admin features.
$userinterface
public
SLP_Power_UI
$userinterface
$userinterface_class_name
public
string
$userinterface_class_name
The name of the user class for this add on.
$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.
$using_pages
public
mixed
$using_pages
$version
public
string
$version
Current version of this add-on pack in x.y.zz format.
$widget
public
SLP_BaseClass_Widget
$widget
The Widget object.
$widget_class_name
public
string
$widget_class_name
The name of the widget class for this add on.
$WPOption_Manager
public
SLP_WPOption_Manager
$WPOption_Manager
The option manager
$class_prefix
protected
mixed
$class_prefix
= 'SLP_Power_'
$cache_icon_strings
private
mixed
$cache_icon_strings
= array()
$categories_loaded_for
private
mixed
$categories_loaded_for
= \null
$category_details
private
mixed
$category_details
= array()
Methods
__construct()
public
__construct([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
__get()
Get the value, running it through a filter.
public
__get(string $property) : mixed
Parameters
- $property : string
Return values
mixed —null if not set or the value
__isset()
Allow isset to be called on private properties.
public
__isset(mixed $property) : bool
Parameters
- $property : mixed
Return values
bool__set()
Allow value to be set directly.
public
__set(mixed $property, mixed $value) : SLP_Option|null
Parameters
- $property : mixed
- $value : mixed
Return values
SLP_Option|nullaction_DeleteLocationCategories()
Delete current location categories from Tagalong categories table.
public
action_DeleteLocationCategories() : mixed
add_csv_mime_type()
Allows WordPress to process csv file types
public
add_csv_mime_type([array<string|int, mixed> $existing_mimes = array() ]) : array<string|int, mixed>
Parameters
- $existing_mimes : array<string|int, mixed> = array()
Tags
Return values
array<string|int, mixed>add_hooks_and_filters()
Add cross-element hooks & filters.
public
add_hooks_and_filters() : mixed
Haven't yet moved all items to the AJAX and UI classes.
add_icon_directory()
Add our icon directory to the list used by SLP.
public
add_icon_directory(array<string|int, mixed> $directories) : array<string|int, mixed>
Parameters
- $directories : array<string|int, mixed>
-
- array of directories.
Return values
array<string|int, mixed>add_object()
public
add_object(mixed $object) : mixed
Parameters
- $object : mixed
add_REST_endpoints()
Add some new REST endpoints.
public
add_REST_endpoints() : mixed
add_sql_commands()
Return an SQL command component based on the command key provided.
public
add_sql_commands(string $command) : string
Parameters
- $command : string
Return values
stringarray_to_CSV()
Convert an array to CSV.
public
static array_to_CSV(array<string|int, array<string|int, mixed>> $data) : string
Parameters
- $data : array<string|int, array<string|int, mixed>>
Return values
stringcreate_cron_object()
Create the cron object.
public
create_cron_object() : mixed
create_CSVLocationImporter()
Create and attach the \CSVImportLocations object
public
create_CSVLocationImporter() : mixed
Check max locations allowed.
create_LocationIcons()
Create a category icon array.
public
create_LocationIcons(array<string|int, mixed> $categories[, array<string|int, mixed> $params = array() ]) : string
$params values
- show_label if true put text under the icons (default: false)
- add_edit_link if true wrap the output in a link to the category edit page (default: false)
Example /---code php $this->create_LocationIcons($category_list, array('show_label'=>false, 'add_edit_link'=>false)); ---
Parameters
- $categories : array<string|int, mixed>
-
array of category details
- $params : array<string|int, mixed> = array()
-
the parameters
Tags
Return values
string —html of the icon array
create_object()
Instantiate our objects ONCE and refer to them in an object array.
public
create_object(string $class[, string $subdir = '.' ]) : mixed
TODO: Remove and update Power compat to 4.9.1
Parameters
- $class : string
- $subdir : string = '.'
create_object_category_data()
Setup the category data object.
public
create_object_category_data() : mixed
create_object_import_messages()
Attach a message stack to this import object.
public
create_object_import_messages() : mixed
create_object_schedule_messages()
Attach a message stack to this import object.
public
create_object_schedule_messages() : mixed
create_object_Updates()
Creates updates object AND checks for updates for this add-on.
public
create_object_Updates(bool $force) : mixed
Parameters
- $force : bool
create_string_icon_array()
Create the icon array for a given location.
public
create_string_icon_array([array<string|int, mixed> $params = array() ]) : string
$params array values: 'show_label' = if true show the labels under the icon strings
Parameters
- $params : array<string|int, mixed> = array()
-
named array of settings
Return values
stringcreateobject_Admin()
Create the admin interface object and attach to this->admin
public
createobject_Admin() : mixed
Called on slp_admin_menu_starting. If that menu is rendering, we are on an admin page. Called via hook slp_admin_menu_starting setup in this class.
createobject_AJAX()
Create the AJAX processing object and attach to this->ajax
public
createobject_AJAX() : mixed
createobject_UserInterface()
Create the user interface object and attach to this->UserInterface
public
createobject_UserInterface() : mixed
Tags
createstring_CategoryImageHTML()
Create the image string HTML
public
createstring_CategoryImageHTML(array<string|int, mixed> $category[, string $field_name = 'medium-icon' ]) : string
Parameters
- $category : array<string|int, mixed>
-
a taxonomy array
- $field_name : string = 'medium-icon'
-
which category field to get the image from
Return values
string —HTML for presenting an image
createstring_CategoryLegendText()
Create the category title span HTML
public
createstring_CategoryLegendText(array<string|int, mixed> $category) : string
Parameters
- $category : array<string|int, mixed>
-
a taxonomy array
Return values
string —HTML for putting category title in a span
filter_AddMenuItems()
Set the admin menu items.
public
filter_AddMenuItems(array<string|int, mixed> $menuItems) : array<string|int, mixed>
Parameters
- $menuItems : array<string|int, mixed>
Return values
array<string|int, mixed>get_addon_version()
Get the add-on pack version.
public
get_addon_version() : string
Return values
stringget_all_crons_for_hook()
Get all the crons for the specified hook.
public
get_all_crons_for_hook(mixed $hook) : array<string|int, mixed>
TODO: put in a new SLP_Cron class.
Parameters
- $hook : mixed
Return values
array<string|int, mixed>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() ]) : 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
staticget_meta()
Get the add on metadata property as specified.
public
get_meta(string $property) : string
Parameters
- $property : string
Return values
stringget_option()
Get an option attribute.
public
get_option(string $property, string $attribute) : mixed
Parameters
- $property : string
- $attribute : string
get_TermWithTagalongData()
Add extended tagalong data to the category array.
public
get_TermWithTagalongData(int $term_id) : array<string|int, mixed>|false
Parameters
- $term_id : int
-
the category term id
Return values
array<string|int, mixed>|false —named array of category attributes
init_options()
Initialize the options properties from the WordPress database.
public
init_options() : mixed
initialize()
Initialize a singleton of this object.
public
final initialize() : void
for this plugin we are now running this earlier at the plugins_loaded hook.
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|objectload_options()
Load the options class to help the SLP smart options if we have that feature.
public
load_options() : mixed
modify_page_title()
Modify the HTML <title> tag page title of the current page.
public
modify_page_title(string $title, string $sep, int $sep_pos) : mixed
Parameters
- $title : string
- $sep : string
- $sep_pos : int
process_hook_SLPLocationAdded()
Processes the hook triggered when a new location is added.
public
process_hook_SLPLocationAdded() : void
recode_all_uncoded_locations()
Recode all the uncoded locations.
public
recode_all_uncoded_locations([SLP_Message_Manager $messages = null ][, int $max_id = null ]) : mixed
Parameters
- $messages : SLP_Message_Manager = null
- $max_id : int = null
-
set if called from geocode cron
run_during_init()
Executes actions during the initialization process.
public
run_during_init() : void
Sets the name property with a localized string and calls the parent class's initialization method.
set_LocationCategories()
Fill the current_location_categories array with the category IDs assigned to the current location.
public
set_LocationCategories() : mixed
Assumes slplus->currentLocation is loaded with the current location data.
set_option()
Set an option attribute.
public
set_option(string $property, string $attribute, mixed $value) : bool
Parameters
- $property : string
- $attribute : string
- $value : mixed
Return values
boolset_option_defaults()
Set option defaults outside of hard-coded property values via an array.
public
set_option_defaults() : mixed
This allows for gettext() string translations of defaults.
Only bring over items in default_value_array that have matching keys in $this->options already.
set_properties()
Set our properties.
public
set_properties([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
set_ValidOptions()
Set valid options according to the addon options array.
public
set_ValidOptions(mixed $val, mixed $key) : mixed
Parameters
- $val : mixed
- $key : mixed
set_where_not_valid_lat_long()
Set the NOT where valid lat long clause.
public
set_where_not_valid_lat_long(string $where) : string
Parameters
- $where : string
Return values
stringsetting_name()
Generate a proper setting name for the settings class.
public
setting_name(mixed $setting) : string
Parameters
- $setting : mixed
Return values
stringslp_init()
Things to do once SLP is alive.
public
slp_init() : mixed
Tags
widgets_init()
public
widgets_init() : void
at_startup()
Things to do at startup after this baby is initialized. Override in your class.
protected
at_startup() : mixed
NOTE: this will not run at initialization if $this->objects is empty.
set_default_object_options()
Set default options for objects. Override in your class.
protected
set_default_object_options() : mixed
createstring_CategoryEditLink()
Create a link to the category editor if warranted.
private
createstring_CategoryEditLink(int $category_id, string $html) : string
Parameters
- $category_id : int
-
the category ID
- $html : string
-
the HTML output to be wrapped
Return values
string —the HTML wrapped in a link to the category editor.
createstring_CategoryIconHTML()
Create the category HTML output for admin and user interface with images and text.
private
createstring_CategoryIconHTML(array<string|int, mixed> $category, array<string|int, mixed> $params) : string
$params values
- show_label if true put text under the icons (default: false)
- add_edit_link if true wrap the output in a link to the category edit page (default: false)
Example /---code php $this->createstring_CategoryIconHTML($category, array('show_label'=>false, 'add_edit_link'=>false)); ---
Parameters
- $category : array<string|int, mixed>
-
a taxonomy array
- $params : array<string|int, mixed>
-
the parameters we accept
Tags
Return values
string —HTML for the category output on UI and admin panels
init_using_pages()
Set using pages and look for incoming change on general tab.
private
init_using_pages() : mixed
We need to catch this super early in the stack before action processing.
process_bad_category_id()
Process a bad category ID.
private
process_bad_category_id(mixed $id) : mixed
Parameters
- $id : mixed