'general', 'title' => 'Below are the general options for the Filter Display:', 'fields' => array( array( 'field_name' => '_post_type', 'field_description' => 'Select a post type to pull the feed from. (default is "post")', 'default' => 'post' ), array( 'field_name' => '_post_taxonomy', 'field_description' => 'Select a post taxonomy for the tabbed filters. (default is "post")', 'default' => 'category' ), array( 'field_name' => '_posts_per_page', 'field_description' => 'How many posts to display per page.', 'default' => 10 ), array( 'field_name' => '_show_filters', 'field_description' => 'Display tabbed filters.', 'default' => 1 ), array( 'field_name' => '_views', 'field_description' => 'Show optional views. (List View / Grid View)', 'default' => 1 ), /*array( 'field_name' => '_repeatable_meta_box_display', 'field_description' => 'test' ),*/ ) ), /*array( 'name' => 'style_options', 'title' => 'Style the Filter Display according to your brand:', 'fields' => array( array( 'field_name' => '_table_header', 'field_description' => 'Select a color for the table header.', 'default' => '#f1b45c' ), ) ), array( 'name' => 'directions', 'title' => '', 'fields' => array( array( 'field_name' => '_content', 'field_description' => '' ), ) ),*/ ); /* CALLBACK DESCRIPTION FUNCTIONS FOR EACH TAB SECTION */ static function afs_settings_general_section_callback( ) { echo __( 'Customize your settings below and then copy and paste the shortcode [ajax_filter_search] on the page you\'d like the feed to display.', 'wordpress' ); } static function afs_settings_style_options_section_callback( ) { echo __( '', 'wordpress' ); } //function afs_settings_directions_section_callback( ) { //echo __( '', 'wordpress' ); //} /* RETRIEVE VALUES */ static function afs_retrieve($val) { $value = self::afs_get_option(AFS_SUB.$val); return $value; } /* SET DEFAULTS */ static function afs_get_option( $option_name='' ){ // Array of defaults: option => default value $defaults = array(); $tab_array = self::$tabs; foreach($tab_array as $tab) { $fields = $tab['fields']; if($fields) { foreach($fields as $field) { $field_function = AFS_SUB.'_'.$tab['name'].$field['field_name']; if(isset($field['default'])) { $field_default = $field['default']; $defaults[$field_function] = $field_default; } } } } $options = get_option(AFS_SETTINGS,$defaults); //Parse defaults again - see comments $options = wp_parse_args( $options, $defaults ); if( !isset($options[$option_name]) ) return false; return $options[$option_name]; } /****************************************** * INITIALIZE EVERYTHING ******************************************/ static function init() { // Admin Settings, Styles & Scripts add_action( 'admin_menu', array(__CLASS__, AFS_SUB.'_add_admin_menu') ); add_action( 'admin_init', array(__CLASS__, AFS_SUB.'_settings_init') ); add_action( 'admin_enqueue_scripts', array(__CLASS__, 'load_admin_scripts'), 100); // Adds Settings Link to Plugins Page add_filter( 'plugin_action_links_'.AFS_PLUGIN_FILE, array(__CLASS__, 'plugin_settings_link') ); // Core Styles & Scripts add_action( 'wp_enqueue_scripts', array(__CLASS__, 'load_core_scripts'), 999 ); } /****************************************** * BUILD ADMIN AREA ******************************************/ // Set Up Admin Area static function afs_add_admin_menu( ) { add_options_page( AFS_PAGE_TITLE, AFS_MENU_TAB_TITLE, AFS_CAPABILITIES, AFS_MENU_SLUG, array(__CLASS__, AFS_CALLBACK) ); } // Add Settings Link to Plugins Page static function plugin_settings_link($links) { $url = get_admin_url() . 'options-general.php?page='.AFS_MENU_SLUG; $settings_link = '' . __( 'Settings', AFS_MENU_SLUG ) . ''; array_unshift( $links, $settings_link ); return $links; } // Initialize The Tabs static function init_setting_tabs ( ) { $tab_array = self::$tabs; foreach($tab_array as $tab) { // Register Tab & Create Settings Section register_setting( AFS_SUB.'_'.$tab['name'], AFS_SETTINGS ); $tab_name = AFS_SUB.'_'.$tab['name']; $tab_section = $tab_name.'_section'; add_settings_section( $tab_section, __( $tab['title'], 'wordpress' ), array(__CLASS__, AFS_SETTINGS.'_'.$tab['name'].'_section_callback'), $tab_name ); // Set Up Form Fields Defined In $tabs array $fields = $tab['fields']; if($fields) { foreach($fields as $field) { $field_function = AFS_SUB.'_'.$tab['name'].$field['field_name']; add_settings_field( $field_function, __( $field['field_description'], 'wordpress' ), array(__CLASS__, $field_function), $tab_name, $tab_section ); } } } // Set Default Variables self::afs_get_option(); } // Initialize the tabs and all it's data static function afs_settings_init( ) { // Grab Tab Information self::init_setting_tabs(); } /* REGISTER FORM FIELD FUNCTIONS */ // General static function afs_general_post_type( ) { // Select a Post Type $args = array( 'public' => true, //'_builtin' => false ); $output = 'objects'; // names or objects, note names is the default $operator = 'and'; // 'and' or 'or' $post_types = get_post_types( $args, $output, $operator ); ?> ' value=''> Yes ' value='1'>   No ' value='0'> Yes ' value='1'>   No ' value='0'> ' type="text" class="plugin-colorpicker" value=""> ' value='1'>


__('Clear'), 'defaultString' => __('Default'), 'pick' => __('Select Color')); wp_localize_script( 'wp-color-picker', 'wpColorPickerL10n', $colorpicker_l10n ); // Media Uploader Scripts: wp_enqueue_media(); // Plugin Scripts wp_register_script( AFS_SUB.'-admin-script-js', AFS_PLUGIN_URL.'/admin/js/admin.min.js', array( 'jquery' ), '', true ); wp_enqueue_script( AFS_SUB.'-admin-script-js' ); } } endif; // TURN ON THE SETTINGS $afs_admin = new AFSAdmin(); $afs_admin::init(); ?>