/** * Set the plugin property to point to the primary plugin object. * * Returns false if we can't get to the main plugin object. * * @global wpCSL_plugin__slplus $slplus_plugin * @return boolean true if plugin property is valid */ function setPlugin() { if (!isset($this->plugin) || $this->plugin == null) { global $slplus_plugin; $this->plugin = $slplus_plugin; $this->plugin->register_module($this->name, $this); } return isset($this->plugin) && $this->plugin != null; }
/** * Do not use, deprecated. * * @deprecated 4.0 */ function createSettingsGroup() { if (!$this->depnotice_createSettingsGroup) { $this->plugin->notifications->add_notice(9, $this->plugin->createstring_Deprecated(__FUNCTION__)); $this->plugin->notifications->display(); $this->depnotice_createSettingsGroup = true; } }
/** * Do not use, deprecated. * * @deprecated 4.0 */ function getCompoundOption() { if (!$this->depnotice_getCompoundOption) { $this->slplus->notifications->add_notice(9, $this->slplus->createstring_Deprecated(__FUNCTION__)); $this->slplus->notifications->display(); $this->depnotice_getCompoundOption = true; } }
/** * Do not use, deprecated. * * @deprecated 4.2.63 */ function loadPluginData() { if (!$this->depnotice_loadPluginData) { $this->slplus->notifications->add_notice(9, $this->slplus->createstring_Deprecated(__FUNCTION__)); $this->slplus->notifications->display(); $this->depnotice_loadPluginData = true; } }
/** * Do not use, deprecated. * * @deprecated 4.0 */ function create_InputElement() { if (!$this->depnotice_create_InputElement) { $this->slplus->notifications->add_notice(9, $this->slplus->createstring_Deprecated(__FUNCTION__)); $this->slplus->notifications->display(); $this->depnotice_create_InputElement = true; } }
/** * Do not use, deprecated. * * @deprecated 4.0 */ function slp_render_search_form_tag_list() { if (!$this->depnotice_setResultsString) { $this->slplus->notifications->add_notice(9, $this->slplus->createstring_Deprecated(__FUNCTION__)); $this->slplus->notifications->display(); $this->depnotice_setResultsString = true; } }
/** * Theme constructor. * * @param mixed[] $params named array of properties */ function __construct($params) { // Properties with default values // $this->css_dir = 'css/'; foreach ($params as $name => $value) { $this->{$name} = $value; } // Remember the base directory path, then // Append plugin path to the directories // $this->css_url = $this->plugin_url . '/' . $this->css_dir; $this->css_dir = $this->plugin_path . $this->css_dir; // Load Up Admin Class As Needed // if ($this->slplus->check_IsOurAdminPage()) { require_once 'class.themes.admin.php'; $this->admin = new PluginThemeAdmin(array_merge($params, array('css_dir' => $this->css_dir, 'css_url' => $this->css_url))); } }
/** * Build the admin settings panel. */ function build_AdminSettingsPanel() { $panel_name = __('Admin', 'csa-slplus'); $section_name = __('Settings', 'csa-slplus'); $this->settings->add_section(array('name' => $panel_name)); $this->settings->add_ItemToGroup(array('section' => $panel_name, 'group' => $section_name, 'label' => __('Turn off rate notification', 'csa-slplus'), 'setting' => 'thisbox', 'type' => 'checkbox', 'description' => __('This will disable the notification asking you to rate our product.', 'csa-slplus'))); $this->settings->add_ItemToGroup(array('section' => $panel_name, 'group' => $section_name, 'type' => 'checkbox', 'use_prefix' => false, 'label' => __('Extended Admin Messages', 'csa-slplus'), 'setting' => 'extended_admin_messages', 'value' => $this->plugin->is_CheckTrue($this->plugin->options_nojs['extended_admin_messages']), 'description' => __('Show extended messages on the admin panel.', 'csa-slplus'))); // ACTION: slp_generalsettings_modify_adminpanel // params: settings object, section name do_action('slp_generalsettings_modify_adminpanel', $this->settings, $panel_name); }
/** * Build an HTML string to show under the theme selection box. * * @return string */ private function createstring_ThemeDetails() { $HTML = "<div id='{$this->current_slug}_details' class='theme_details'>"; // Description // $HTML .= $this->slplus->helper->create_SubheadingLabel(__('About This Theme', 'csa-slplus')); if (empty($this->themeDetails[$this->current_slug]['description'])) { $HTML .= __('No description has been set for this theme.', 'csa-slplus'); } else { $HTML .= $this->themeDetails[$this->current_slug]['description']; } $HTML .= '<p>' . __('Learn more about changing the Store Locator Plus interface via the ', 'csa-slplus') . sprintf('<a href="%s" target="csa">%s</a>', $this->support_url . 'user-experience/view/themes-custom-css/', __('Custom Themes documentation.', 'csa-slplus')) . '</p>'; // Add On Packs // if (!empty($this->themeDetails[$this->current_slug]['add-ons'])) { // List The Add On Packs Wanted // $HTML .= $this->slplus->helper->create_SubheadingLabel(__('Add On Packs', 'csa-slplus')); $active_HTML = ''; $inactive_HTML = ''; $this->slplus->createobject_AddOnManager(); $addon_list = explode(',', $this->themeDetails[$this->current_slug]['add-ons']); foreach ($addon_list as $slug) { $slug = trim(strtolower($slug)); if (isset($this->slplus->add_ons->available[$slug])) { // Show Active Add Ons // if ($this->slplus->add_ons->is_active($slug)) { $active_HTML .= "<li class='product active'>" . $this->slplus->add_ons->get_product_url($slug) . '</li>'; // Add to inactive HTML string // } else { $inactive_HTML .= "<li class='product inactive'>" . $this->slplus->add_ons->get_product_url($slug) . '</li>'; } } } $HTML .= '</ul>'; // Add active add on pack list // if (!empty($active_HTML)) { $HTML .= __('This theme will make use of these add-on packs:', 'csa-slplus') . '<ul>' . $active_HTML . '</ul>'; } // Add inactive add on pack list // if (!empty($inactive_HTML)) { $HTML .= __('This theme works best if you activate the following add-on packs:', 'csa-slplus') . '<ul>' . $inactive_HTML . '</ul>'; } // Add the options section // $HTML .= $this->createstring_ThemeOptions(); } $HTML .= '</div>'; return $HTML; }
/** * Tell people if the extended data contains a field identified by slug. * * @param string $slug the field slug * @return boolean true if the field exists, false if not. */ function has_field($slug) { if (!isset($this->metatable['records'][$slug])) { $slug_data = $this->slplus->database->get_Record(array('select_all_from_extendo', 'where_slugis'), $slug, 0, OBJECT); if (is_object($slug_data) && $slug_data->slug == $slug) { $this->metatable['records'][$slug] = $slug_data; } } $this->slplus->debugMP('slp.main', 'pr', 'SLPlus_Data_Extension::' . __FUNCTION__ . ' ' . $slug, $this->metatable); return isset($this->metatable['records'][$slug]); }
/** * Build the User Settings Panel */ function build_UserSettingsPanel() { $sectName = __('User Interface', 'csa-slplus'); $this->settings->add_section(array('name' => $sectName)); $groupName = __('JavaScript', 'csa-slplus'); $this->settings->add_ItemToGroup(array('section' => $sectName, 'group' => $groupName, 'label' => '', 'type' => 'subheader', 'show_label' => false, 'description' => __('These settings change how JavaScript behaves on your site. ', 'csa-slplus') . ($this->slplus->javascript_is_forced ? '<br/><em>*' . sprintf(__('You have <a href="%s" target="csa">Force Load JavaScript</a> ON. ', 'csa-slplus'), $this->slplus->support_url . 'general-settings/user-interface/javascript/') . __('Themes that follow WordPress best practices and employ wp_footer() properly do not need this. ', 'csa-slplus') . __('Leaving it on slows down your site and disables a lot of extra features with the plugin and add-on packs. ', 'csa-slplus') . '</em>' : ''))); $this->settings->add_ItemToGroup(array('section' => $sectName, 'group' => $groupName, 'type' => 'checkbox', 'use_prefix' => false, 'label' => __('Force Load JavaScript', 'csa-slplus'), 'setting' => 'force_load_js', 'value' => $this->slplus->is_CheckTrue($this->slplus->options_nojs['force_load_js']), 'description' => __('Force the JavaScript for Store Locator Plus to load on every page with early loading. ', 'csa-slplus') . __('This can slow down your site, but is compatible with more themes and plugins. ', 'csa-slplus') . __('If you need to do this to make SLP work you should ask your theme author to add proper wp_footer() support to their code. ', 'csa-slplus'))); // Map Interface // $groupName = __('Map Interface', 'csa-slplus'); $this->settings->add_ItemToGroup(array('section' => $sectName, 'group' => $groupName, 'label' => __('Turn Off SLP Maps', 'csa-slplus'), 'setting' => 'no_google_js', 'type' => 'checkbox', 'description' => __('Check this box if your Theme or another plugin is providing Google Maps and generating warning messages. ' . 'THIS MAY BREAK THIS PLUGIN.', 'csa-slplus'))); // ACTION: slp_generalsettings_modify_userpanel // params: settings object, section name do_action('slp_generalsettings_modify_userpanel', $this->settings, $sectName); }
/** * The Constructor */ function __construct($params = null) { $this->name = 'AjaxHandler'; // Set slplus property // if (!isset($this->slplus) || $this->slplus == null) { global $slplus_plugin; $this->slplus = $slplus_plugin; $this->slplus->register_module($this->name, $this); $this->plugin = $this->slplus; } $this->slplus->notifications->enabled = false; // Set incoming params // $this->set_QueryParams(); }
/** * Render the manage locations admin page. * */ function render_adminpage() { $this->slplus->debugMP('slp.managelocs', 'msg', __FUNCTION__); $this->slplus->helper->loadPluginData(); $this->slplus->AdminUI->initialize_variables(); $this->process_Actions(); //------------------------------------------------------------------------ // CHANGE UPDATER // Changing Updater //------------------------------------------------------------------------ if (isset($_GET['changeUpdater']) && $_GET['changeUpdater'] == 1) { if (get_option('sl_location_updater_type') == "Tagging") { update_option('sl_location_updater_type', 'Multiple Fields'); $updaterTypeText = "Multiple Fields"; } else { update_option('sl_location_updater_type', 'Tagging'); $updaterTypeText = "Tagging"; } $_SERVER['REQUEST_URI'] = preg_replace('/&changeUpdater=1/', '', $_SERVER['REQUEST_URI']); print "<script>location.replace('" . $_SERVER['REQUEST_URI'] . "');</script>"; } //------------------------------------------------------------------------ // Reload Variables - anything that my have changed //------------------------------------------------------------------------ $this->slplus->helper->getData('sl_admin_locations_per_page', 'get_option', null, '10', true, true); //-------------------------------------- // Setup the Location panel navigation //-------------------------------------- $subtabs = apply_filters('slp_locations_subtabs', array(__('Manage', 'csa-slplus'), __('Add', 'csa-slplus'))); //------------------------------------ // Create Location Panels // add_action('slp_build_locations_panels', array($this, 'create_settings_section_Manage'), 10); add_action('slp_build_locations_panels', array($this, 'create_settings_section_Add'), 20); //------------------------- // Setup Navigation Bar // $this->settings->add_section(array('name' => 'Navigation', 'div_id' => 'navbar_wrapper', 'description' => $this->slplus->AdminUI->create_Navbar(), 'innerdiv' => false, 'is_topmenu' => true, 'auto' => false, 'headerbar' => false)); //------------------------------------ // Render It // do_action('slp_build_locations_panels'); $this->settings->render_settings_page(); }
/** * Format the result data into a named array. * * We will later use this to build our JSONP response. * * @param null mixed[] $row * @return mixed[] */ function slp_add_marker($row = null) { if ($row == null) { return ''; } $this->slplus->currentLocation->set_PropertiesViaArray($row); $marker = array('name' => esc_attr($row['sl_store']), 'address' => esc_attr($row['sl_address']), 'address2' => esc_attr($row['sl_address2']), 'city' => esc_attr($row['sl_city']), 'state' => esc_attr($row['sl_state']), 'zip' => esc_attr($row['sl_zip']), 'country' => esc_attr($row['sl_country']), 'lat' => $row['sl_latitude'], 'lng' => $row['sl_longitude'], 'description' => html_entity_decode($row['sl_description']), 'url' => esc_url($row['sl_url']), 'sl_pages_url' => esc_url($row['sl_pages_url']), 'email' => esc_attr($row['sl_email']), 'email_link' => esc_attr($row['sl_email']), 'hours' => esc_attr($row['sl_hours']), 'phone' => esc_attr($row['sl_phone']), 'fax' => esc_attr($row['sl_fax']), 'image' => esc_attr($row['sl_image']), 'distance' => $row['sl_distance'], 'tags' => esc_attr($row['sl_tags']), 'option_value' => esc_js($row['sl_option_value']), 'attributes' => maybe_unserialize($row['sl_option_value']), 'id' => $row['sl_id'], 'linked_postid' => $row['sl_linked_postid'], 'neat_title' => esc_attr($row['sl_neat_title'])); $web_link = isset($this->slplus->options['use_pages_links']) && $this->slplus->is_CheckTrue($this->slplus->options['use_pages_links']) ? $marker['sl_pages_url'] : $marker['url']; if (!empty($web_link)) { $marker['web_link'] = sprintf("<a href='%s' target='%s' class='storelocatorlink'><nobr>%s</nobr></a><br/>", $web_link, isset($this->slplus->options['use_same_window']) && $this->slplus->is_CheckTrue($this->slplus->options['use_same_window']) ? '_self' : '_blank', $this->slplus->options['label_website']); } else { $marker['web_link'] = ''; } // FILTER: slp_results_marker_data // Modify the map marker object that is sent back to the UI in the JSONP response. // $marker = apply_filters('slp_results_marker_data', $marker); return $marker; }
/** * Do not use, deprecated. * * @deprecated 4.0 */ function ShortcodeOrSettingEnabled($a = null, $b = null, $c = null, $d = null, $e = null, $f = null) { $this->slplus->helper->create_string_wp_setting_error_box($this->slplus->createstring_Deprecated(__FUNCTION__)); }
/** * Add the left column to the add/edit locations form. * * @return string HTML of the form inputs */ function filter_EditLocationLeft_Address() { $HTML = $this->createstring_InputElement('store', __('Name', 'store-locator-le'), $this->slplus->currentLocation->store) . $this->createstring_InputElement('address', __('Street - Line 1', 'store-locator-le'), $this->slplus->currentLocation->address) . $this->createstring_InputElement('address2', __('Street - Line 2', 'store-locator-le'), $this->slplus->currentLocation->address2) . $this->createstring_InputElement('city', __('City', 'store-locator-le'), $this->slplus->currentLocation->city) . $this->createstring_InputElement('state', __('State', 'store-locator-le'), $this->slplus->currentLocation->state) . $this->createstring_InputElement('zip', __('ZIP / Postal Code', 'store-locator-le'), $this->slplus->currentLocation->zip) . $this->createstring_InputElement('country', __('Country', 'store-locator-le'), $this->slplus->currentLocation->country) . $this->createstring_InputElement('latitude', __('Latitude (N/S)', 'store-locator-le'), $this->slplus->currentLocation->latitude, '', false, 'input', __('Leave blank to have Google look up the latitude.', 'store-locator-le')) . $this->createstring_InputElement('longitude', __('Longitude (E/W)', 'store-locator-le'), $this->slplus->currentLocation->longitude, '', false, 'input', __('Leave blank to have Google look up the longitude.', 'store-locator-le')); $HTML .= $this->slplus->helper->CreateCheckboxDiv("private-{$this->slplus->currentLocation->id}", __('Private Entry', 'store-locator-le'), __('If checked the listing will not show up in location search results.', 'store-locator-le'), '', false, 0, $this->slplus->is_CheckTrue($this->slplus->currentLocation->private)); return $HTML; }
/** * Invoke the CSV Import object using a named array to configure behavior parameters. * * Parameters: * - firstline_has_fieldname <boolean> true if first line has field names for the columns * - parent <object> pointer to the invoked add-on object * - plugin <object> pointer to the invoked base plugin (\SLPlus) object * - skip_firstline <boolean> true if the first line does not have data to process * - strip_prefix <string> prefix to strip out of field names if first line has field names * * Example: * $this->importer = new CSVImport(array('parent'=>$this,'plugin'=>$this->plugin)); * * @param mixed[] $params */ function __construct($params) { foreach ($params as $property => $value) { if (property_exists($this, $property)) { $this->{$property} = $value; } } if (isset($this->plugin) && !isset($this->slplus)) { $this->slplus = $this->plugin; } if (isset($this->parent) && !isset($this->addon)) { $this->addon = $this->parent; } if ($this->firstline_has_fieldname) { $this->skip_firstline = true; } $this->slplus->set_php_timeout(); }
/** * Things to do once SLP is alive. */ function slp_init() { global $slplus_plugin; $this->addon = $this; $this->slplus = $slplus_plugin; // Check the base plugin minimum version requirement. // $this->slplus->VersionCheck(array('addon_name' => $this->name, 'addon_slug' => $this->slug, 'min_required_version' => $this->min_slp_version)); // Tell SLP we are here // $this->slplus->register_addon($this->slug, $this); // Initialize The Options // $this->init_options(); // Add Hooks and Filters // $this->add_hooks_and_filters(); // Admin Interface? // if (!empty($this->admin_class_name)) { add_filter('slp_menu_items', array($this, 'filter_AddMenuItems')); add_action('slp_admin_menu_starting', array($this, 'admin_menu')); } // User Interface? // if (!empty($this->userinterface_class_name)) { add_action('wp_enqueue_scripts', array($this, 'userinterface_init')); } // AJAX Processing // if (defined('DOING_AJAX') && DOING_AJAX && !empty($this->ajax_class_name)) { $this->createobject_AJAX(); } }
/** * Call parent DebugMP only if parent has been set. * * * @param string $panel - panel name * @param string $type - what type of debugging (msg = simple string, pr = print_r of variable) * @param string $header - the header * @param string $message - what you want to say * @param string $file - file of the call (__FILE__) * @param int $line - line number of the call (__LINE__) * @param boolean $notime - show time? default true = yes. * @return null */ function debugMP($panel = 'main', $type = 'msg', $header = 'wpCSL DMP', $message = '', $file = null, $line = null, $notime = false) { if (is_object($this->parent)) { $this->parent->debugMP($panel, $type, $header, $message, $file, $line, $notime); } }
/** * Register an add-on pack. * * @param string $slug * @param object $object */ private function register_addon($slug, $object) { $this->slplus->createobject_AddOnManager(); $this->slplus->add_ons->register($slug, $object); // TODO: remove this when all add-on packs reference $this->slplus->add_ons->instances vs. $this->slplus->addons (GFI, MMap) // $this->slplus->addons[$slug] = $object; }
define('SLPLUS_UPLOADURL', SLPLUS_PLUGINURL); } } define('SLPLUS_COREURL', SLPLUS_PLUGINURL); //==================================================================== // Main Plugin Configuration //==================================================================== /** * @var SLPlus $slplus_plugin */ global $slplus_plugin; if (defined('SLPLUS_PLUGINDIR') && !is_a($slplus_plugin, 'SLPlus')) { if (class_exists('SLPlus') == false) { require_once SLPLUS_PLUGINDIR . 'include/class.slplus.php'; } $slplus_plugin = new SLPlus(); $slplus_plugin->initialize(); } //==================================================================== // Add Required Libraries //==================================================================== // Errors? // if ($error != '') { $slplus_plugin->notifications->add_notice(4, $error); } // General WP Action Interface // require_once SLPLUS_PLUGINDIR . 'include/class.actions.php'; $slplus_plugin->Actions = new SLPlus_Actions(array('uses_slplus' => true)); require_once SLPLUS_PLUGINDIR . 'include/class.activation.php';
/** * Simplify the plugin debugMP interface. * * @param string $type * @param string $hdr * @param string $msg */ function debugMP($type, $hdr, $msg = '') { $this->slplus->debugMP('slp.location', $type, $hdr, $msg, NULL, NULL, true); }