Plugin Directory

Changeset 922554


Ignore:
Timestamp:
05/28/2014 03:03:47 PM (12 years ago)
Author:
jawittdesigns
Message:

Removed meta box lib and fixed typo in settings description

Location:
wp-admin-directory/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • wp-admin-directory/trunk/README.txt

    r922516 r922554  
    7575* Initial Commit
    7676
     77= 1.0.1 =
     78
     79* changed cmb_Meta_Box class name to WP_Admin_Dir_cmb_Meta_Box to avoid conflicts
     80* updated version
     81
     82= 1.1.1 =
     83
     84* removed meta box lib
     85* fixed typo in settings description
     86
    7787== Upgrade Notice ==
    7888
    79 = 1.0.0 =
    80 Initial Commit
     89= 1.1.1 =
     90removed meta box lib
     91fixed typo in settings description
    8192
    8293== Updates ==
  • wp-admin-directory/trunk/admin/lib/admin-menus/class.php

    r917130 r922554  
    2424class WP_Admin_Dir_Admin_Menus {
    2525    private static $instance = null;
    26     protected static $key = 'wp_admin_dir_options';
    27     protected static $plugin_options = array();
    2826    public $menu_lable;
    2927    public $page_title;
     
    3230    public $settings_menu_lable;
    3331    public $settings_page_title;
    34     static $settings_option_title;
    35     static $settings_option_desc;
     32    public $settings_option_title;
     33    public $settings_option_desc;
    3634    /**
    3735     * Creates or returns an instance of this class.
     
    5452        add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
    5553        add_action( 'admin_menu', array( $this, 'add_settings_admin_menu' ) );
     54        add_action( 'admin_init', array( $this, 'initialize_settings' ) );
    5655        $this->menu_lable = apply_filters( 'wpad_menu_lable', __( 'Directory', WP_ADMIN_DIR_SLUG ) );
    5756        $this->page_title = apply_filters( 'wpad_page_title', __( 'Directory', WP_ADMIN_DIR_SLUG ) );
     
    6564        $this->settings_menu_lable = apply_filters( 'wpad_settings_menu_lable', __( 'Directory Settings', WP_ADMIN_DIR_SLUG ) );
    6665        $this->settings_page_title = apply_filters( 'wpad_settings_page_title', __( 'WP Admin Directory Settings', WP_ADMIN_DIR_SLUG ) );
    67         self::$settings_option_title = apply_filters( 'wpad_settings_option_title', __( 'Include Menu Items', WP_ADMIN_DIR_SLUG ) );
    68         self::$settings_option_desc = apply_filters( 'wpad_settings_option_desc', __( 'Choose the menu items to include in the Driectory menu item', WP_ADMIN_DIR_SLUG ) );
     66        $this->settings_option_title = apply_filters( 'wpad_settings_option_title', __( 'Menu Items', WP_ADMIN_DIR_SLUG ) );
     67        $this->settings_option_desc = apply_filters( 'wpad_settings_option_desc', __( 'Choose the menu items to include in the Directory menu item', WP_ADMIN_DIR_SLUG ) );
    6968    }
    7069    /**
     
    117116        ?>
    118117        <div class="wrap">
    119             <?php do_action( 'wpad_before_setting_page_title' ); ?>
    120118            <h2><?php echo esc_html( get_admin_page_title() ); ?></h2>
    121             <?php do_action( 'wpad_after_setting_page_title' ); ?>
    122             <?php do_action( 'wpad_before_settings_form' ); ?>
    123             <?php cmb_metabox_form( $this->display_in(), self::$key ); ?>
    124             <?php do_action( 'wpad_after_settings_form' ); ?>
     119            <form method="post" action="options.php" class="wpad-form">
     120                <?php
     121                settings_fields( 'wp_admin_dir_options' );
     122                do_settings_sections( WP_ADMIN_DIR_SLUG . '-settings' );
     123                submit_button();
     124                ?>
     125            </form>
     126           
    125127        </div>
    126         <?php
    127     }
    128     /**
    129      * Register our setting to WP
    130      *
    131      * @since  1.0.0
    132      */
    133     public function register_settings() {
    134         register_setting( self::$key, self::$key );
    135     }
    136     /**
    137      * Defines the theme option metabox and field configuration
    138      *
    139      * @return array
    140      * @since  1.0.0
    141      */
    142     public static function display_in() {
    143        
    144         if ( ! empty( self::$plugin_options ) )
    145             return self::$plugin_options;
    146         self::$plugin_options = array(
    147             'id'         => 'wp_admin_dir_options',
    148             'show_on'    => array( 'key' => 'options-page', 'value' => array( self::$key, ), ),
    149             'show_names' => true,
    150             'fields'     => array(                array(
    151                     'name'          => self::$settings_option_title,
    152                     'desc'          => self::$settings_option_desc,
    153                     'id'            => 'wp_admin_dir_post_multicheckbox',
    154                     'type'          => 'multicheck',
    155                     'options'       => self::get_menu_items(),
    156                 ),
    157             ),
    158         );
    159         return self::$plugin_options;
    160     }
    161     /**
    162      * Creat an array of the menu items from the transient
    163      *
    164      * @return array the list of menu items to display in the options
    165      * @since  1.0.0
    166      */
    167     private static function get_menu_items() {
     128    <?php
     129    }
     130
     131    public function initialize_settings(){
     132        if( !get_option( 'wp_admin_dir_options' ) ) {
     133            add_option( 'wp_admin_dir_options' );
     134        }
     135        add_settings_section(
     136            'wp_admin_dir_options',
     137            '',
     138            '',
     139            WP_ADMIN_DIR_SLUG . '-settings'
     140        );
     141        add_settings_field(
     142            'wp_admin_dir_post_multicheckbox',
     143            $this->settings_option_title,
     144            array( $this, 'multicheck_callback'),
     145             WP_ADMIN_DIR_SLUG . '-settings',
     146            'wp_admin_dir_options'
     147        );
     148        register_setting(
     149            'wp_admin_dir_options',
     150            'wp_admin_dir_options'
     151        );
     152    }
     153   
     154    public function multicheck_callback() {
     155        $list_items = $this->return_menu_items();
     156        $counter = '';
     157        $checker = '';
     158        $types = get_option( 'wp_admin_dir_options' );
     159        $selected = '';
     160        if( !empty( $types ) ) {
     161            $selected = $types['wp_admin_dir_post_multicheckbox'];
     162        }
     163        echo '<ul>';
     164        foreach( $list_items as $key => $item ) {
     165            $counter++;
     166            if( get_option( 'wp_admin_dir_options' ) ) {
     167                $checker = ( ( array_search( $key , $selected ) !== FALSE ) ? 'checked="checked"' : '');
     168            }
     169            ?>
     170            <li>
     171                <input
     172                    type="checkbox"
     173                    class="cmb_option"
     174                    name="wp_admin_dir_options[wp_admin_dir_post_multicheckbox][]"
     175                    id="wp_admin_dir_post_multicheckbox<?php echo $counter; ?>"
     176                    value="<?php echo $key; ?>"
     177                    <?php echo $checker; ?>>
     178                <label for="wp_admin_dir_post_multicheckbox<?php echo $counter; ?>"><?php echo $item; ?></label>
     179            </li>
     180            <?php
     181        }
     182        echo '</ul>';
     183        echo '<p style="color: #AAA; font-style: italic;">'. $this->settings_option_desc .'</p>';
     184    }
     185   
     186    private function return_menu_items() {
    168187        $menu = get_transient( '_transient_wpad_menu' );
    169188        $list = array();
     
    194213        return $list;
    195214    }
    196     /**
    197      * Make public the protected $key variable.
    198      *
    199      * @return string  Option key
    200      * @since  1.0.0
    201      */
    202     public static function key() {
    203         return self::$key;
    204     }
    205215}
  • wp-admin-directory/trunk/admin/lib/remove-menu/class.php

    r917130 r922554  
    4848        global $menu;
    4949        $types = get_option( 'wp_admin_dir_options' );
    50         $selected = $types['wp_admin_dir_post_multicheckbox'];
     50        $selected = '';
     51        if( !empty( $types ) ) {
     52            $selected = $types['wp_admin_dir_post_multicheckbox'];
     53        }
    5154        $check = array();
    5255        if( $selected ) {
  • wp-admin-directory/trunk/wp-admin-directory.php

    r917226 r922554  
    44 * Plugin URI:        http://wordpress.org/plugins/buddypress/
    55 * Description:       Groups togeher menu links in a single page
    6  * Version:           1.0.1
     6 * Version:           1.1.1
    77 * Author:            Jason Witt
    88 * Author URI:        http://jawittdesigns@gmail.com
     
    5353        require_once( plugin_dir_path( __FILE__ ) . 'public/class-public-init.php' );
    5454        WP_Admin_Dir_Public_Init::get_instance();
    55         // Load Metaboxes
    56         add_action( 'init', array( $this, 'wp_admin_dir_cmb_meta_boxes' ), 9999 );
    5755        // Action Links
    5856        add_filter( 'plugin_action_links', array( $this, 'add_action_links' ), 10, 2 );
    59     }
    60     /**
    61      * Call the metaboxes Init
    62      *
    63      * @since  1.0.0
    64      */
    65     public function wp_admin_dir_cmb_meta_boxes() {
    66         if ( ! class_exists( 'cmb_Meta_Box' ) ) {
    67             require_once( plugin_dir_path( __FILE__ ) . 'admin/assets/metaboxes/init.php' );
    68         }
    6957    }
    7058    /**
Note: See TracChangeset for help on using the changeset viewer.