Changeset 922554
- Timestamp:
- 05/28/2014 03:03:47 PM (12 years ago)
- Location:
- wp-admin-directory/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (1 diff)
-
admin/lib/admin-menus/class.php (modified) (6 diffs)
-
admin/lib/remove-menu/class.php (modified) (1 diff)
-
wp-admin-directory.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-admin-directory/trunk/README.txt
r922516 r922554 75 75 * Initial Commit 76 76 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 77 87 == Upgrade Notice == 78 88 79 = 1.0.0 = 80 Initial Commit 89 = 1.1.1 = 90 removed meta box lib 91 fixed typo in settings description 81 92 82 93 == Updates == -
wp-admin-directory/trunk/admin/lib/admin-menus/class.php
r917130 r922554 24 24 class WP_Admin_Dir_Admin_Menus { 25 25 private static $instance = null; 26 protected static $key = 'wp_admin_dir_options';27 protected static $plugin_options = array();28 26 public $menu_lable; 29 27 public $page_title; … … 32 30 public $settings_menu_lable; 33 31 public $settings_page_title; 34 static $settings_option_title;35 static $settings_option_desc;32 public $settings_option_title; 33 public $settings_option_desc; 36 34 /** 37 35 * Creates or returns an instance of this class. … … 54 52 add_action( 'admin_menu', array( $this, 'add_admin_menu' ) ); 55 53 add_action( 'admin_menu', array( $this, 'add_settings_admin_menu' ) ); 54 add_action( 'admin_init', array( $this, 'initialize_settings' ) ); 56 55 $this->menu_lable = apply_filters( 'wpad_menu_lable', __( 'Directory', WP_ADMIN_DIR_SLUG ) ); 57 56 $this->page_title = apply_filters( 'wpad_page_title', __( 'Directory', WP_ADMIN_DIR_SLUG ) ); … … 65 64 $this->settings_menu_lable = apply_filters( 'wpad_settings_menu_lable', __( 'Directory Settings', WP_ADMIN_DIR_SLUG ) ); 66 65 $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', __( 'IncludeMenu 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 ) ); 69 68 } 70 69 /** … … 117 116 ?> 118 117 <div class="wrap"> 119 <?php do_action( 'wpad_before_setting_page_title' ); ?>120 118 <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 125 127 </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() { 168 187 $menu = get_transient( '_transient_wpad_menu' ); 169 188 $list = array(); … … 194 213 return $list; 195 214 } 196 /**197 * Make public the protected $key variable.198 *199 * @return string Option key200 * @since 1.0.0201 */202 public static function key() {203 return self::$key;204 }205 215 } -
wp-admin-directory/trunk/admin/lib/remove-menu/class.php
r917130 r922554 48 48 global $menu; 49 49 $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 } 51 54 $check = array(); 52 55 if( $selected ) { -
wp-admin-directory/trunk/wp-admin-directory.php
r917226 r922554 4 4 * Plugin URI: http://wordpress.org/plugins/buddypress/ 5 5 * Description: Groups togeher menu links in a single page 6 * Version: 1. 0.16 * Version: 1.1.1 7 7 * Author: Jason Witt 8 8 * Author URI: http://jawittdesigns@gmail.com … … 53 53 require_once( plugin_dir_path( __FILE__ ) . 'public/class-public-init.php' ); 54 54 WP_Admin_Dir_Public_Init::get_instance(); 55 // Load Metaboxes56 add_action( 'init', array( $this, 'wp_admin_dir_cmb_meta_boxes' ), 9999 );57 55 // Action Links 58 56 add_filter( 'plugin_action_links', array( $this, 'add_action_links' ), 10, 2 ); 59 }60 /**61 * Call the metaboxes Init62 *63 * @since 1.0.064 */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 }69 57 } 70 58 /**
Note: See TracChangeset
for help on using the changeset viewer.