コード例 #1
0
 /**
  * Add the theme settings to the admin panel.
  *
  * @param   SLP_Settings    $settings
  * @param   string          $section_name
  * @param   string          $group_name
  */
 public function add_settings($settings, $section_name, $group_name)
 {
     $theme_list = $this->get_theme_list();
     $settings->add_ItemToGroup(array('label' => __('Plugin Style', 'store-locator-le'), 'type' => 'subheader', 'description' => __('Select a plugin style to change the CSS styling and layout of the slplus shortcode elements.', 'store-locator-le'), 'section' => is_null($section_name) ? __('Display Settings', 'store-locator-le') : $section_name, 'group' => $group_name));
     $settings->add_itemToGroup(array('description' => __('How should the plugin UI elements look?  ', 'store-locator-le') . $this->slplus->get_web_link('documentation_plugin_styles'), 'show_label' => false, 'use_prefix' => false, 'setting' => 'theme', 'value' => $this->slplus->options_nojs['theme'], 'onChange' => "AdminUI.show_ThemeDetails(this);", 'type' => 'list', 'section' => $section_name, 'group' => $group_name, 'custom' => $theme_list));
     // Add Style Details Divs
     //
     $settings->add_ItemToGroup(array('label' => '', 'description' => $this->setup_ThemeDetails($theme_list), 'section' => $section_name, 'group' => $group_name, 'setting' => 'themedesc', 'type' => 'subheader', 'show_label' => false));
 }
コード例 #2
0
 /**
  * General / Data
  *
  * @param   SLP_Settings    $settings
  */
 public function add_data_subtab($settings)
 {
     $section_params['name'] = __('Data', 'store-locator-le');
     $section_params['slug'] = 'data';
     $settings->add_section($section_params);
     $group_params['header'] = __('Packaged Data Extensions', 'store-locator-le');
     $group_params['group_slug'] = 'packaged_data_extensions';
     $group_params['section_slug'] = $section_params['slug'];
     $group_params['intro'] = __('Add pre-defined groups of extended data fields to your locations. ', 'store-locator-le');
     $group_params['plugin'] = $this->slplus;
     $settings->add_group($group_params);
     // Don't show the notice if these add-ons are active.
     //
     if ($this->slplus->add_ons->is_active('slp-premier')) {
         return;
     }
     if ($this->slplus->add_ons->is_active('slp-power')) {
         return;
     }
     // Note that some add-on packs will put settings here.
     //
     $settings->add_ItemToGroup(array('group_params' => $group_params, 'type' => 'details', 'custom' => sprintf(__('Some of the %s add ons will add settings here. ', 'store-locator-le'), $this->slplus->text_manager->get_text_string('slp')) . sprintf(__('Visit the %s to see a full list of features you can add to this plugin. ', 'store-locator-le'), $this->slplus->get_web_link('slp_store'))));
 }
コード例 #3
0
 /**
  * Add the theme settings to the admin panel.
  *
  * @param SLP_Settings $settings
  */
 public function add_settings($settings, $section_name, $group_name)
 {
     // Exit is directory does not exist
     //
     if (!is_dir($this->css_dir)) {
         if (isset($this->notifications)) {
             $this->notifications->add_notice(2, sprintf(__('The styles directory:<br/>%s<br/>is missing. ', 'store-locator-le'), $this->css_dir) . __('Create it to enable styles and get rid of this message.', 'store-locator-le'));
         }
         return;
     }
     // The Styles
     // No styles? Force the default at least
     //
     $themeArray = get_option(SLPLUS_PREFIX . '-theme_array');
     if (count($themeArray, COUNT_RECURSIVE) < 2) {
         $themeArray = array('Default' => 'default');
     }
     // Remove from drop down list if style file does not exist in the plugin dir
     //
     foreach ($themeArray as $k => $theme) {
         if (!file_exists($this->css_dir . $theme . '.css')) {
             unset($themeArray[$k]);
         }
     }
     // Check for theme files
     //
     $lastNewThemeDate = get_option(SLPLUS_PREFIX . '-theme_lastupdated');
     $newEntry = array();
     if ($dh = opendir($this->css_dir)) {
         while (($file = readdir($dh)) !== false) {
             if (!is_readable($this->css_dir . $file)) {
                 continue;
             }
             // If not a hidden file
             //
             if (!preg_match('/^\\./', $file)) {
                 $thisFileModTime = filemtime($this->css_dir . $file);
                 // We have a new style file possibly...
                 //
                 if ($thisFileModTime > $lastNewThemeDate) {
                     $newEntry = $this->get_ThemeInfo($this->css_dir . $file);
                     $themeArray = array_merge($themeArray, array($newEntry['label'] => $newEntry['file']));
                     update_option(SLPLUS_PREFIX . '-theme_lastupdated', $thisFileModTime);
                 }
             }
         }
         closedir($dh);
     }
     // Remove empties and sort
     $themeArray = array_filter($themeArray);
     uksort($themeArray, 'strcasecmp');
     // Delete the default style if we have specific ones
     //
     $resetDefault = false;
     if (count($themeArray, COUNT_RECURSIVE) > 1 && isset($themeArray['Default'])) {
         unset($themeArray['Default']);
         $resetDefault = true;
     }
     // We added at least one new theme
     //
     if (count($newEntry, COUNT_RECURSIVE) > 1 || $resetDefault) {
         update_option(SLPLUS_PREFIX . '-theme_array', $themeArray);
     }
     if ($section_name == null) {
         $section_name = 'Display Settings';
     }
     $settings->add_ItemToGroup(array('label' => __('Plugin Style', 'store-locator-le'), 'type' => 'subheader', 'description' => __('Select a plugin style to change the CSS styling and layout of the slplus shortcode elements.', 'store-locator-le'), 'section' => $section_name, 'group' => $group_name));
     $settings->add_itemToGroup(array('description' => __('How should the plugin UI elements look?  ', 'store-locator-le') . sprintf(__('Learn more in the <a href="%s" target="slp">online documentation</a>.', 'store-locator-le'), $this->slplus->support_url . 'user-experience/view/themes-custom-css/'), 'setting' => 'theme', 'show_label' => false, 'value' => $this->slplus->options_nojs['theme'], 'onChange' => "AdminUI.show_ThemeDetails(this);", 'type' => 'list', 'section' => $section_name, 'group' => $group_name, 'custom' => $themeArray));
     // Add Style Details Divs
     //
     $settings->add_ItemToGroup(array('label' => '', 'description' => $this->setup_ThemeDetails($themeArray), 'section' => $section_name, 'group' => $group_name, 'setting' => 'themedesc', 'type' => 'subheader', 'show_label' => false));
 }