Пример #1
0
/**
 * Get a setting from the settings API.
 *
 * @param mixed $option_name
 * @return string
 */
function recipe_hero_settings_get_option($option_name, $default = '')
{
    if (!class_exists('RH_Admin_Settings')) {
        include 'class-rh-admin-settings.php';
    }
    return RH_Admin_Settings::get_option($option_name, $default);
}
Пример #2
0
 /**
  * Save settings
  */
 public function save()
 {
     global $current_section;
     $settings = $this->get_settings();
     RH_Admin_Settings::save_fields($settings);
     if ($current_section) {
         do_action('recipe_hero_update_options_' . $this->id . '_' . $current_section);
     }
 }
Пример #3
0
 /**
  * Include the settings page classes
  */
 public static function get_settings_pages()
 {
     if (empty(self::$settings)) {
         $settings = array();
         include_once 'settings/class-rh-settings-page.php';
         $settings[] = (include 'settings/class-rh-settings-general.php');
         $settings[] = (include 'settings/class-rh-settings-integrations.php');
         self::$settings = apply_filters('recipe_hero_get_settings_pages', $settings);
     }
     return self::$settings;
 }
Пример #4
0
 /**
  * Default options
  *
  * Sets up the default options used on the settings page
  *
  * @return void
  */
 public function create_options()
 {
     // Include settings so that we can run through defaults
     include_once 'admin/class-rh-admin-settings.php';
     $settings = RH_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         if (!method_exists($section, 'get_settings')) {
             continue;
         }
         foreach ($section->get_settings() as $value) {
             if (isset($value['default']) && isset($value['id'])) {
                 $autoload = isset($value['autoload']) ? (bool) $value['autoload'] : true;
                 add_option($value['id'], $value['default'], '', $autoload ? 'yes' : 'no');
             }
         }
     }
 }
 /**
  * Save settings
  */
 public function save()
 {
     $settings = $this->get_settings();
     RH_Admin_Settings::save_fields($settings);
 }
Пример #6
0
 /**
  * Init the settings page
  */
 public function settings_page()
 {
     RH_Admin_Settings::output();
 }