/**
 * Get a setting from the settings API.
 * @param  mixed $option_name
 * @param  mixed $default
 * @return string
 */
function restaurantpress_settings_get_option($option_name, $default = '')
{
    if (!class_exists('RP_Admin_Settings')) {
        include 'class-rp-admin-settings.php';
    }
    return RP_Admin_Settings::get_option($option_name, $default);
}
 /**
  * Include the settings page classes.
  */
 public static function get_settings_pages()
 {
     if (empty(self::$settings)) {
         $settings = array();
         include_once 'settings/class-rp-settings-page.php';
         $settings[] = (include 'settings/class-rp-settings-general.php');
         self::$settings = apply_filters('restaurantpress_get_settings_pages', $settings);
     }
     return self::$settings;
 }
 /**
  * Save settings
  */
 public function save()
 {
     global $current_section;
     $settings = $this->get_settings();
     RP_Admin_Settings::save_fields($settings);
     if ($current_section) {
         do_action('restaurantpress_update_options_' . $this->id . '_' . $current_section);
     }
 }
 /**
  * Default options
  *
  * Sets up the default options used on the settings page
  */
 private static function create_options()
 {
     // Include settings so that we can run through defaults
     include_once 'admin/class-rp-admin-settings.php';
     $settings = RP_Admin_Settings::get_settings_pages();
     foreach ($settings as $section) {
         if (!method_exists($section, 'get_settings')) {
             continue;
         }
         $subsections = array_unique(array_merge(array(''), array_keys($section->get_sections())));
         foreach ($subsections as $subsection) {
             foreach ($section->get_settings($subsection) 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();
     RP_Admin_Settings::save_fields($settings);
 }
 /**
  * Init the settings page.
  */
 public function settings_page()
 {
     RP_Admin_Settings::output();
 }