Changeset 15077
- Timestamp:
- 05/31/2010 03:47:53 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/nav-menu.php
r15067 r15077 201 201 202 202 /** 203 * Create HTML list of nav menu input items. 204 * 205 * @package WordPress 206 * @since 3.0.0 207 * @uses Walker_Nav_Menu 208 */ 209 class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu { 210 211 /** 212 * @see Walker::start_el() 213 * @since 3.0.0 214 * 215 * @param string $output Passed by reference. Used to append additional content. 216 * @param object $item Menu item data object. 217 * @param int $depth Depth of menu item. Used for padding. 218 * @param int $current_page Menu item ID. 219 * @param object $args 220 */ 221 function start_el(&$output, $item, $depth, $args) { 222 global $_nav_menu_placeholder; 223 224 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1; 225 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; 226 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0; 227 228 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; 229 230 $output .= $indent . '<li>'; 231 $output .= '<label class="menu-item-title">'; 232 $output .= '<input type="checkbox" class="menu-item-checkbox'; 233 if ( ! empty( $item->_add_to_top ) ) { 234 $output .= ' add-to-top'; 235 } 236 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> '; 237 $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label ); 238 $output .= '</label>'; 239 240 // Menu item hidden fields 241 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />'; 242 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />'; 243 $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />'; 244 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />'; 245 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />'; 246 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />'; 247 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />'; 248 $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />'; 249 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />'; 250 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />'; 251 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />'; 252 } 253 } 254 255 /** 203 256 * Prints the appropriate response to a menu quick search. 204 257 * -
trunk/wp-includes/nav-menu-template.php
r15075 r15077 129 129 130 130 /** 131 * Create HTML list of nav menu input items.132 *133 * @package WordPress134 * @since 3.0.0135 * @uses Walker_Nav_Menu136 */137 class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {138 139 /**140 * @see Walker::start_el()141 * @since 3.0.0142 *143 * @param string $output Passed by reference. Used to append additional content.144 * @param object $item Menu item data object.145 * @param int $depth Depth of menu item. Used for padding.146 * @param int $current_page Menu item ID.147 * @param object $args148 */149 function start_el(&$output, $item, $depth, $args) {150 global $_nav_menu_placeholder;151 152 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;153 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;154 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;155 156 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';157 158 $output .= $indent . '<li>';159 $output .= '<label class="menu-item-title">';160 $output .= '<input type="checkbox" class="menu-item-checkbox';161 if ( ! empty( $item->_add_to_top ) ) {162 $output .= ' add-to-top';163 }164 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';165 $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );166 $output .= '</label>';167 168 // Menu item hidden fields169 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';170 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';171 $output .= '<input type="hidden" class="menu-item-parent-id" name="menu-item[' . $possible_object_id . '][menu-item-parent-id]" value="'. esc_attr( $item->menu_item_parent ) .'" />';172 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';173 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';174 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';175 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';176 $output .= '<input type="hidden" class="menu-item-attr_title" name="menu-item[' . $possible_object_id . '][menu-item-attr_title]" value="'. esc_attr( $item->attr_title ) .'" />';177 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';178 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';179 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';180 }181 }182 183 /**184 131 * Displays a navigation menu. 185 132 *
Note: See TracChangeset
for help on using the changeset viewer.