'ajaxpress', 'menu_title' => 'AjaxPress', 'menu_slug' => 'ajaxpress', 'parent_menu' => 'options-general.php', 'capability' => 'manage_options', 'icon_url' => 'dashicons-airplane', 'position' => 9999, # february option page 'title' => 'AjaxPress Settings', 'description' => '', # february behaviors 'default_section' => null, "enable_tools" => true, 'save' => 'Save Settings', 'saving' => 'Saving...', 'divider' => 1, # sections 'sections' => [ # General [ 'id' => 'general', 'title' => 'General Settings', 'fields' => [ [ 'id' => 'active', 'type' => 'checkbox', 'label' => 'Activate AjaxPress', 'description' => 'Enabling this option will activate AjaxPress.', 'default' => 1, ], [ 'id' => 'active_contents', 'type' => 'checkbox', 'label' => 'Ajaxify Contents', 'description' => 'Enabling this option will load page, post contents with Ajax.', 'default' => true, 'condition' => '$active === true', ], [ 'id' => 'active_comments', 'type' => 'checkbox', 'label' => 'Ajaxify Comments', 'description' => 'Enabling this option will load and submit comments with Ajax.', 'default' => true, 'condition' => '$active === true', ], [ 'id' => 'active_search', 'type' => 'checkbox', 'label' => 'Ajaxify Search', 'description' => 'Enabling this option will load search results with Ajax.', 'default' => true, 'condition' => '$active === true', ], ], ], # Advance [ 'id' => 'advance', 'title' => 'Advance Settings', 'icon' => 'dashicons dashicons-shield', 'condition' => '$active === true', 'fields' => [ [ 'id' => 'dynamic_selector', 'type' => 'text', 'label' => 'Dynamic Selector', 'description' => 'Selector for elements that will be Ajaxified. Default: main', 'default' => 'main', ], [ 'id' => 'show_loading', 'type' => 'checkbox', 'label' => 'Show Loading', 'description' => 'Enabling this option will show loading animation while Ajax is loading.', 'default' => 1, ], [ 'id' => 'loading_text', 'type' => 'text', 'label' => 'Loading Text', 'description' => 'Text to show while Ajax is loading.', 'default' => 'Loading...', ], [ 'id' => 'theme', 'type' => 'select', 'label' => 'Select Theme', 'options' => [ 'default' => 'Default', 'dark' => 'Dark', 'light' => 'Light', ], 'default' => 'default', 'condition' => '$show_loading === true', ], ], ], # About [ 'id' => 'about', 'title' => 'About AjaxPress', 'full' => true, 'icon' => 'dashicons dashicons-info', 'submit' => false, 'fields' => [ // message field [ 'id' => 'message', 'type' => 'html', "text" => "

AjaxPress is a simple plugin that allows you to load contents with Ajax.

AjaxPress is developed by Jafran Hasan.

It's free and always will be.

", ], ], ], ], ]; return apply_filters('ajaxpress_sections', $sections); } /** * Get Option Keys. */ public function options() { $keys = []; $sections = $this->sections()['sections']; foreach ($sections as $section) { foreach ($section['fields'] as $field) { $keys[$field['id']] = $field['default'] ?? null; } } return $keys; } /** * Get Option Values. */ public function get_options() { $values = []; $keys = $this->options(); foreach ($keys as $key => $default) { $values[$key] = get_option($key, $default); } return $values; } }