/** * Include the settings page classes * * @since 1.0.0 * @access public static * @filter auto_load_next_post_get_settings_pages * @return $settings */ public static function get_settings_pages() { if (empty(self::$settings)) { $settings = array(); include_once 'settings/class-auto-load-next-post-settings-page.php'; $settings[] = (include 'settings/class-auto-load-next-post-settings-general.php'); self::$settings = apply_filters('auto_load_next_post_get_settings_pages', $settings); } return self::$settings; }
/** * Default Options * * Sets up the default options defined on the settings pages. * * @since 1.0.0 * @access public */ public function create_options() { // Include settings so that we can run through defaults include_once 'class-auto-load-next-post-admin-settings.php'; $settings = Auto_Load_Next_Post_Admin_Settings::get_settings_pages(); foreach ($settings as $section) { 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'); } } } }
/** * Initialize the Auto Load Next Post settings page. * @since 1.0.0 * @access public */ public function settings_page() { include_once 'class-auto-load-next-post-admin-settings.php'; Auto_Load_Next_Post_Admin_Settings::output(); }
/** * Save settings * * @since 1.0.0 * @access public * @global $current_tab */ public function save() { global $current_tab; $settings = $this->get_settings(); Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab); }
/** * Save settings. * * @since 1.0.0 * @access public * @global $current_tab * @global $current_section */ public function save() { global $current_tab, $current_section; $settings = $this->get_settings(); Auto_Load_Next_Post_Admin_Settings::save_fields($settings, $current_tab, $current_section); if ($current_section) { do_action('auto_load_next_post_update_options_' . $this->id . '_' . $current_section); } }