/var/www/wordpress/wp-admin/includes/admin.php
/var/www/wordpress/wp-admin/includes/bookmark.php
/var/www/wordpress/wp-admin/includes/class-ftp-pure.php
/var/www/wordpress/wp-admin/includes/class-ftp-sockets.php
/var/www/wordpress/wp-admin/includes/class-ftp.php
/var/www/wordpress/wp-admin/includes/class-pclzip.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-base.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-direct.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpext.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ftpsockets.php
/var/www/wordpress/wp-admin/includes/class-wp-filesystem-ssh2.php
/var/www/wordpress/wp-admin/includes/class-wp-importer.php
/var/www/wordpress/wp-admin/includes/class-wp-upgrader.php
/var/www/wordpress/wp-admin/includes/comment.php
/var/www/wordpress/wp-admin/includes/continents-cities.php
/var/www/wordpress/wp-admin/includes/dashboard.php
/var/www/wordpress/wp-admin/includes/deprecated.php
/var/www/wordpress/wp-admin/includes/export.php
/var/www/wordpress/wp-admin/includes/file.php
/var/www/wordpress/wp-admin/includes/image-edit.php
/var/www/wordpress/wp-admin/includes/image.php
/var/www/wordpress/wp-admin/includes/import.php
/var/www/wordpress/wp-admin/includes/manifest.php
/var/www/wordpress/wp-admin/includes/media.php
/var/www/wordpress/wp-admin/includes/meta-boxes.php
/var/www/wordpress/wp-admin/includes/misc.php
/var/www/wordpress/wp-admin/includes/ms-deprecated.php
/var/www/wordpress/wp-admin/includes/ms.php
/var/www/wordpress/wp-admin/includes/nav-menu.php
#CodeDescriptions
1<?php
2
3/**
4 * Create HTML list of nav menu input items.
5 *
6 * @package WordPress
7 * @since 3.0.0
8 * @uses Walker_Nav_Menu
9 */
10class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
11 /**
12 * @see Walker_Nav_Menu::start_lvl()
13 * @since 3.0.0
14 *
15 * @param string $output Passed by reference.
16 * @param int $depth Depth of page.
17 */
18 function start_lvl(&$output) {}
19
20 /**
21 * @see Walker_Nav_Menu::end_lvl()
22 * @since 3.0.0
23 *
24 * @param string $output Passed by reference.
25 * @param int $depth Depth of page.
26 */
27 function end_lvl(&$output) {
28 }
29
30 /**
31 * @see Walker::start_el()
32 * @since 3.0.0
33 *
34 * @param string $output Passed by reference. Used to append additional content.
35 * @param object $item Menu item data object.
36 * @param int $depth Depth of menu item. Used for padding.
37 * @param int $current_page Menu item ID.
38 * @param object $args
39 */
40 function start_el(&$output, $item, $depth, $args) {
41 global $_wp_nav_menu_max_depth;
42 $_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
43
44 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
45
46 ob_start();
47 $item_id = esc_attr( $item->ID );
48 $removed_args = array(
49 'action',
50 'customlink-tab',
51 'edit-menu-item',
52 'menu-item',
53 'page-tab',
54 '_wpnonce',
55 );
56
57 $original_title = '';
58 if ( 'taxonomy' == $item->type ) {
59 $original_title = get_term_field( 'name', $item->object_id, $item->object, 'raw' );
60 } elseif ( 'post_type' == $item->type ) {
61 $original_object = get_post( $item->object_id );
62 $original_title = $original_object->post_title;
63 }
64
65 $classes = array(
66 'menu-item menu-item-depth-' . $depth,
67 'menu-item-' . esc_attr( $item->object ),
68 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'),
69 );
70
71 $title = $item->title;
72
73 if ( isset( $item->post_status ) && 'draft' == $item->post_status ) {
74 $classes[] = 'pending';
75 /* translators: %s: title of menu item in draft status */
76 $title = sprintf( __('%s (Pending)'), $item->title );
77 }
78
79 $title = empty( $item->label ) ? $title : $item->label;
80
81 ?>
82 <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>">//Cross Site Scripting
83 <dl class="menu-item-bar">
84 <dt class="menu-item-handle">
85 <span class="item-title"><?php echo esc_html( $title ); ?></span>
86 <span class="item-controls">
87 <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
88 <span class="item-order">
89 <a href="<?php
90 echo wp_nonce_url(
91 add_query_arg(
92 array(
93 'action' => 'move-up-menu-item',
94 'menu-item' => $item_id,
95 ),
96 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
97 ),
98 'move-menu_item'
99 );
100 ?>" class="item-move-up"><abbr title="<?php esc_attr_e('Move up'); ?>">↑</abbr></a>
101 |
102 <a href="<?php
103 echo wp_nonce_url(
104 add_query_arg(
105 array(
106 'action' => 'move-down-menu-item',
107 'menu-item' => $item_id,
108 ),
109 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
110 ),
111 'move-menu_item'
112 );
113 ?>" class="item-move-down"><abbr title="<?php esc_attr_e('Move down'); ?>">↓</abbr></a>
114 </span>
115 <a class="item-edit" id="edit-<?php echo $item_id; ?>" title="<?php _e('Edit Menu Item'); ?>" href="<?php//Cross Site Scripting
116 echo ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? admin_url( 'nav-menus.php' ) : add_query_arg( 'edit-menu-item', $item_id, remove_query_arg( $removed_args, admin_url( 'nav-menus.php#menu-item-settings-' . $item_id ) ) );
117 ?>"><?php _e( 'Edit Menu Item' ); ?></a>
118 </span>
119 </dt>
120 </dl>
121
122 <div class="menu-item-settings" id="menu-item-settings-<?php echo $item_id; ?>">//Cross Site Scripting
123 <?php if( 'custom' == $item->type ) : ?>
124 <p class="field-url description description-wide">
125 <label for="edit-menu-item-url-<?php echo $item_id; ?>">//Cross Site Scripting
126 <?php _e( 'URL' ); ?><br />
127 <input type="text" id="edit-menu-item-url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-url" name="menu-item-url[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->url ); ?>" />//Cross Site Scripting
128 </label>
129 </p>
130 <?php endif; ?>
131 <p class="description description-thin">
132 <label for="edit-menu-item-title-<?php echo $item_id; ?>">//Cross Site Scripting
133 <?php _e( 'Navigation Label' ); ?><br />
134 <input type="text" id="edit-menu-item-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-title" name="menu-item-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->title ); ?>" />//Cross Site Scripting
135 </label>
136 </p>
137 <p class="description description-thin">
138 <label for="edit-menu-item-attr-title-<?php echo $item_id; ?>">//Cross Site Scripting
139 <?php _e( 'Title Attribute' ); ?><br />
140 <input type="text" id="edit-menu-item-attr-title-<?php echo $item_id; ?>" class="widefat edit-menu-item-attr-title" name="menu-item-attr-title[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->post_excerpt ); ?>" />//Cross Site Scripting
141 </label>
142 </p>
143 <p class="field-link-target description description-thin">
144 <label for="edit-menu-item-target-<?php echo $item_id; ?>">//Cross Site Scripting
145 <?php _e( 'Link Target' ); ?><br />
146 <select id="edit-menu-item-target-<?php echo $item_id; ?>" class="widefat edit-menu-item-target" name="menu-item-target[<?php echo $item_id; ?>]">//Cross Site Scripting
147 <option value="" <?php selected( $item->target, ''); ?>><?php _e('Same window or tab'); ?></option>
148 <option value="_blank" <?php selected( $item->target, '_blank'); ?>><?php _e('New window or tab'); ?></option>
149 </select>
150 </label>
151 </p>
152 <p class="field-css-classes description description-thin">
153 <label for="edit-menu-item-classes-<?php echo $item_id; ?>">//Cross Site Scripting
154 <?php _e( 'CSS Classes (optional)' ); ?><br />
155 <input type="text" id="edit-menu-item-classes-<?php echo $item_id; ?>" class="widefat code edit-menu-item-classes" name="menu-item-classes[<?php echo $item_id; ?>]" value="<?php echo esc_attr( implode(' ', $item->classes ) ); ?>" />//Cross Site Scripting
156 </label>
157 </p>
158 <p class="field-xfn description description-thin">
159 <label for="edit-menu-item-xfn-<?php echo $item_id; ?>">//Cross Site Scripting
160 <?php _e( 'Link Relationship (XFN)' ); ?><br />
161 <input type="text" id="edit-menu-item-xfn-<?php echo $item_id; ?>" class="widefat code edit-menu-item-xfn" name="menu-item-xfn[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->xfn ); ?>" />//Cross Site Scripting
162 </label>
163 </p>
164 <p class="field-description description description-wide">
165 <label for="edit-menu-item-description-<?php echo $item_id; ?>">//Cross Site Scripting
166 <?php _e( 'Description' ); ?><br />
167 <textarea id="edit-menu-item-description-<?php echo $item_id; ?>" class="widefat edit-menu-item-description" rows="3" cols="20" name="menu-item-description[<?php echo $item_id; ?>]"><?php echo esc_html( $item->description ); ?></textarea>//Cross Site Scripting
168 <span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span>
169 </label>
170 </p>
171
172 <div class="menu-item-actions description-wide submitbox">
173 <?php if( 'custom' != $item->type ) : ?>
174 <p class="link-to-original">
175 <?php printf( __('Original: %s'), '<a href="' . esc_attr( $item->url ) . '">' . esc_html( $original_title ) . '</a>' ); ?>
176 </p>
177 <?php endif; ?>
178 <a class="item-delete submitdelete deletion" id="delete-<?php echo $item_id; ?>" href="<?php//Cross Site Scripting
179 echo wp_nonce_url(
180 add_query_arg(
181 array(
182 'action' => 'delete-menu-item',
183 'menu-item' => $item_id,
184 ),
185 remove_query_arg($removed_args, admin_url( 'nav-menus.php' ) )
186 ),
187 'delete-menu_item_' . $item_id
188 ); ?>"><?php _e('Remove'); ?></a> <span class="meta-sep"> | </span> <a class="item-cancel submitcancel" id="cancel-<?php echo $item_id; ?>" href="<?php echo add_query_arg( array('edit-menu-item' => $item_id, 'cancel' => time()), remove_query_arg( $removed_args, admin_url( 'nav-menus.php' ) ) );//Cross Site Scripting
189 ?>#menu-item-settings-<?php echo $item_id; ?>"><?php _e('Cancel'); ?></a>//Cross Site Scripting
190 </div>
191
192 <input class="menu-item-data-db-id" type="hidden" name="menu-item-db-id[<?php echo $item_id; ?>]" value="<?php echo $item_id; ?>" />//Cross Site Scripting
193 <input class="menu-item-data-object-id" type="hidden" name="menu-item-object-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object_id ); ?>" />//Cross Site Scripting
194 <input class="menu-item-data-object" type="hidden" name="menu-item-object[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->object ); ?>" />//Cross Site Scripting
195 <input class="menu-item-data-parent-id" type="hidden" name="menu-item-parent-id[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_item_parent ); ?>" />//Cross Site Scripting
196 <input class="menu-item-data-position" type="hidden" name="menu-item-position[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->menu_order ); ?>" />//Cross Site Scripting
197 <input class="menu-item-data-type" type="hidden" name="menu-item-type[<?php echo $item_id; ?>]" value="<?php echo esc_attr( $item->type ); ?>" />//Cross Site Scripting
198 </div><!-- .menu-item-settings-->
199 <ul class="menu-item-transport"></ul>
200 <?php
201 $output .= ob_get_clean();
202 }
203}
204
205/**
206 * Create HTML list of nav menu input items.
207 *
208 * @package WordPress
209 * @since 3.0.0
210 * @uses Walker_Nav_Menu
211 */
212class Walker_Nav_Menu_Checklist extends Walker_Nav_Menu {
213
214 /**
215 * @see Walker::start_el()
216 * @since 3.0.0
217 *
218 * @param string $output Passed by reference. Used to append additional content.
219 * @param object $item Menu item data object.
220 * @param int $depth Depth of menu item. Used for padding.
221 * @param int $current_page Menu item ID.
222 * @param object $args
223 */
224 function start_el(&$output, $item, $depth, $args) {
225 global $_nav_menu_placeholder;
226
227 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
228 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
229 $possible_db_id = ( ! empty( $item->ID ) ) && ( 0 < $possible_object_id ) ? (int) $item->ID : 0;
230
231 $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
232
233 $output .= $indent . '<li>';
234 $output .= '<label class="menu-item-title">';
235 $output .= '<input type="checkbox" class="menu-item-checkbox';
236 if ( ! empty( $item->_add_to_top ) ) {
237 $output .= ' add-to-top';
238 }
239 $output .= '" name="menu-item[' . $possible_object_id . '][menu-item-object-id]" value="'. esc_attr( $item->object_id ) .'" /> ';
240 $output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );
241 $output .= '</label>';
242
243 // Menu item hidden fields
244 $output .= '<input type="hidden" class="menu-item-db-id" name="menu-item[' . $possible_object_id . '][menu-item-db-id]" value="' . $possible_db_id . '" />';
245 $output .= '<input type="hidden" class="menu-item-object" name="menu-item[' . $possible_object_id . '][menu-item-object]" value="'. esc_attr( $item->object ) .'" />';
246 $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 ) .'" />';
247 $output .= '<input type="hidden" class="menu-item-type" name="menu-item[' . $possible_object_id . '][menu-item-type]" value="'. esc_attr( $item->type ) .'" />';
248 $output .= '<input type="hidden" class="menu-item-title" name="menu-item[' . $possible_object_id . '][menu-item-title]" value="'. esc_attr( $item->title ) .'" />';
249 $output .= '<input type="hidden" class="menu-item-url" name="menu-item[' . $possible_object_id . '][menu-item-url]" value="'. esc_attr( $item->url ) .'" />';
250 $output .= '<input type="hidden" class="menu-item-target" name="menu-item[' . $possible_object_id . '][menu-item-target]" value="'. esc_attr( $item->target ) .'" />';
251 $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 ) .'" />';
252 $output .= '<input type="hidden" class="menu-item-description" name="menu-item[' . $possible_object_id . '][menu-item-description]" value="'. esc_attr( $item->description ) .'" />';
253 $output .= '<input type="hidden" class="menu-item-classes" name="menu-item[' . $possible_object_id . '][menu-item-classes]" value="'. esc_attr( implode( ' ', $item->classes ) ) .'" />';
254 $output .= '<input type="hidden" class="menu-item-xfn" name="menu-item[' . $possible_object_id . '][menu-item-xfn]" value="'. esc_attr( $item->xfn ) .'" />';
255 }
256}
257
258/**
259 * Prints the appropriate response to a menu quick search.
260 *
261 * @since 3.0.0
262 *
263 * @param array $request The unsanitized request values.
264 */
265function _wp_ajax_menu_quick_search( $request = array() ) {
266 $args = array();
267 $type = isset( $request['type'] ) ? $request['type'] : '';
268 $object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
269 $query = isset( $request['q'] ) ? $request['q'] : '';
270 $response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json';
271
272 if ( 'markup' == $response_format ) {
273 $args['walker'] = new Walker_Nav_Menu_Checklist;
274 }
275
276 if ( 'get-post-item' == $type ) {
277 if ( post_type_exists( $object_type ) ) {
278 if ( isset( $request['ID'] ) ) {
279 $object_id = (int) $request['ID'];
280 if ( 'markup' == $response_format ) {
281 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
282 } elseif ( 'json' == $response_format ) {
283 $post_obj = get_post( $object_id );
284 echo json_encode(
285 array(
286 'ID' => $object_id,
287 'post_title' => get_the_title( $object_id ),
288 'post_type' => get_post_type( $object_id ),
289 )
290 );
291 echo "\n";
292 }
293 }
294 } elseif ( taxonomy_exists( $object_type ) ) {
295 if ( isset( $request['ID'] ) ) {
296 $object_id = (int) $request['ID'];
297 if ( 'markup' == $response_format ) {
298 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
299 } elseif ( 'json' == $response_format ) {
300 $post_obj = get_term( $object_id, $object_type );
301 echo json_encode(
302 array(
303 'ID' => $object_id,
304 'post_title' => $post_obj->name,
305 'post_type' => $object_type,
306 )
307 );
308 echo "\n";
309 }
310 }
311
312 }
313
314
315 } elseif ( preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches) ) {
316 if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) {
317 query_posts(array(
318 'posts_per_page' => 10,
319 'post_type' => $matches[2],
320 's' => $query,
321 ));
322 if ( ! have_posts() )
323 return;
324 while ( have_posts() ) {
325 the_post();
326 if ( 'markup' == $response_format ) {
327 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref = get_the_ID() ) ) ), 0, (object) $args );
328 } elseif ( 'json' == $response_format ) {
329 echo json_encode(
330 array(
331 'ID' => get_the_ID(),
332 'post_title' => get_the_title(),
333 'post_type' => get_post_type(),
334 )
335 );
336 echo "\n";
337 }
338 }
339 } elseif ( 'taxonomy' == $matches[1] ) {
340 $terms = get_terms( $matches[2], array(
341 'name__like' => $query,
342 'number' => 10,
343 ));
344 if ( empty( $terms ) || is_wp_error( $terms ) )
345 return;
346 foreach( (array) $terms as $term ) {
347 if ( 'markup' == $response_format ) {
348 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
349 } elseif ( 'json' == $response_format ) {
350 echo json_encode(
351 array(
352 'ID' => $term->term_id,
353 'post_title' => $term->name,
354 'post_type' => $matches[2],
355 )
356 );
357 echo "\n";
358 }
359 }
360 }
361 }
362}
363
364/**
365 * Register nav menu metaboxes and advanced menu items
366 *
367 * @since 3.0.0
368 **/
369function wp_nav_menu_setup() {
370 // Register meta boxes
371 if ( wp_get_nav_menus() )
372 add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
373 add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
374 wp_nav_menu_post_type_meta_boxes();
375 wp_nav_menu_taxonomy_meta_boxes();
376
377 // Register advanced menu items (columns)
378 add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
379
380 // If first time editing, disable advanced items by default.
381 if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
382 $user = wp_get_current_user();
383 update_user_option($user->ID, 'managenav-menuscolumnshidden',
384 array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', ),
385 true);
386 }
387}
388
389/**
390 * Limit the amount of meta boxes to just links, pages and cats for first time users.
391 *
392 * @since 3.0.0
393 **/
394function wp_initial_nav_menu_meta_boxes() {
395 global $wp_meta_boxes;
396
397 if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
398 return;
399
400 $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );
401 $hidden_meta_boxes = array();
402
403 foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
404 foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
405 foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
406 if ( in_array( $box['id'], $initial_meta_boxes ) ) {
407 unset( $box['id'] );
408 } else {
409 $hidden_meta_boxes[] = $box['id'];
410 }
411 }
412 }
413 }
414
415 $user = wp_get_current_user();
416 update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
417}
418
419/**
420 * Creates metaboxes for any post type menu item.
421 *
422 * @since 3.0.0
423 */
424function wp_nav_menu_post_type_meta_boxes() {
425 $post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
426
427 if ( ! $post_types )
428 return;
429
430 foreach ( $post_types as $post_type ) {
431 $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
432 if ( $post_type ) {
433 $id = $post_type->name;
434 add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
435 }
436 }
437}
438
439/**
440 * Creates metaboxes for any taxonomy menu item.
441 *
442 * @since 3.0.0
443 */
444function wp_nav_menu_taxonomy_meta_boxes() {
445 $taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
446
447 if ( !$taxonomies )
448 return;
449
450 foreach ( $taxonomies as $tax ) {
451 $tax = apply_filters( 'nav_menu_meta_box_object', $tax );
452 if ( $tax ) {
453 $id = $tax->name;
454 add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
455 }
456 }
457}
458
459/**
460 * Displays a metabox for the nav menu theme locations.
461 *
462 * @since 3.0.0
463 */
464function wp_nav_menu_locations_meta_box() {
465 global $nav_menu_selected_id;
466
467 if ( ! current_theme_supports( 'menus' ) ) {
468 // We must only support widgets. Leave a message and bail.
469 echo '<p class="howto">' . __('The current theme does not natively support menus, but you can use the “Custom Menu” widget to add any menus you create here to the theme’s sidebar.') . '</p>';
470 return;
471 }
472
473 $locations = get_registered_nav_menus();
474 $menus = wp_get_nav_menus();
475 $menu_locations = get_nav_menu_locations();
476 $num_locations = count( array_keys($locations) );
477
478 echo '<p class="howto">' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '</p>';
479
480 foreach ( $locations as $location => $description ) {
481 ?>
482 <p>
483 <label class="howto" for="locations-<?php echo $location; ?>">//Cross Site Scripting
484 <span><?php echo $description; ?></span>//Cross Site Scripting
485 <select name="menu-locations[<?php echo $location; ?>]" id="locations-<?php echo $location; ?>">//Cross Site Scripting
486 <option value="0"></option>
487 <?php foreach ( $menus as $menu ) : ?>
488 <option<?php selected( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $menu->term_id ); ?>
489 value="<?php echo $menu->term_id; ?>"><?php//Cross Site Scripting
490 $truncated_name = wp_html_excerpt( $menu->name, 40 );
491 echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…';//Cross Site Scripting
492 ?></option>
493 <?php endforeach; ?>
494 </select>
495 </label>
496 </p>
497 <?php
498 }
499 ?>
500 <p class="button-controls">
501 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
502 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-primary" name="nav-menu-locations" value="<?php esc_attr_e( 'Save' ); ?>" />
503 </p>
504 <?php
505}
506
507/**
508 * Displays a metabox for the custom links menu item.
509 *
510 * @since 3.0.0
511 */
512function wp_nav_menu_item_link_meta_box() {
513 global $_nav_menu_placeholder, $nav_menu_selected_id;
514 $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
515
516 $current_tab = 'create';
517 if ( isset( $_REQUEST['customlink-tab'] ) && in_array( $_REQUEST['customlink-tab'], array('create', 'all') ) ) {
518 $current_tab = $_REQUEST['customlink-tab'];
519 }
520
521 $removed_args = array(
522 'action',
523 'customlink-tab',
524 'edit-menu-item',
525 'menu-item',
526 'page-tab',
527 '_wpnonce',
528 );
529
530 ?>
531 <div class="customlinkdiv" id="customlinkdiv">
532
533 <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />//Cross Site Scripting
534 <p id="menu-item-url-wrap">
535 <label class="howto" for="custom-menu-item-url">
536 <span><?php _e('URL'); ?></span>
537 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />//Cross Site Scripting
538 </label>
539 </p>
540
541 <p id="menu-item-name-wrap">
542 <label class="howto" for="custom-menu-item-name">
543 <span><?php _e('Label'); ?></span>
544 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />//Cross Site Scripting
545 </label>
546 </p>
547
548 <p class="button-controls">
549 <span class="add-to-menu">
550 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
551 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
552 </span>
553 </p>
554
555 </div><!-- /.customlinkdiv -->
556 <?php
557}
558
559/**
560 * Displays a metabox for a post type menu item.
561 *
562 * @since 3.0.0
563 *
564 * @param string $object Not used.
565 * @param string $post_type The post type object.
566 */
567function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
568 global $_nav_menu_placeholder, $nav_menu_selected_id;
569
570 $post_type_name = $post_type['args']->name;
571
572 // paginate browsing for large numbers of post objects
573 $per_page = 50;
574 $pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
575 $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
576
577 $args = array(
578 'offset' => $offset,
579 'order' => 'ASC',
580 'orderby' => 'title',
581 'posts_per_page' => $per_page,
582 'post_type' => $post_type_name,
583 'suppress_filters' => true,
584 'update_post_term_cache' => false,
585 'update_post_meta_cache' => false
586 );
587
588 if ( isset( $post_type['args']->_default_query ) )
589 $args = array_merge($args, (array) $post_type['args']->_default_query );
590
591 // @todo transient caching of these results with proper invalidation on updating of a post of this type
592 $get_posts = new WP_Query;
593 $posts = $get_posts->query( $args );
594 if ( ! $get_posts->post_count ) {
595 echo '<p>' . __( 'No items.' ) . '</p>';
596 return;
597 }
598
599 $post_type_object = get_post_type_object($post_type_name);
600
601 $num_pages = $get_posts->max_num_pages;
602
603 $page_links = paginate_links( array(
604 'base' => add_query_arg(
605 array(
606 $post_type_name . '-tab' => 'all',
607 'paged' => '%#%',
608 'item-type' => 'post_type',
609 'item-object' => $post_type_name,
610 )
611 ),
612 'format' => '',
613 'prev_text' => __('«'),
614 'next_text' => __('»'),
615 'total' => $num_pages,
616 'current' => $pagenum
617 ));
618
619 if ( !$posts )
620 $error = '<li id="error">'. $post_type['args']->labels->not_found .'</li>';
621
622 $walker = new Walker_Nav_Menu_Checklist;
623
624 $current_tab = 'most-recent';
625 if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) {
626 $current_tab = $_REQUEST[$post_type_name . '-tab'];
627 }
628
629 if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
630 $current_tab = 'search';
631 }
632
633 $removed_args = array(
634 'action',
635 'customlink-tab',
636 'edit-menu-item',
637 'menu-item',
638 'page-tab',
639 '_wpnonce',
640 );
641
642 ?>
643 <div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">//Cross Site Scripting
644 <ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">//Cross Site Scripting
645 <li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent"><?php _e('Most Recent'); ?></a></li>//Cross Site Scripting
646 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all"><?php _e('View All'); ?></a></li>//Cross Site Scripting
647 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search"><?php _e('Search'); ?></a></li>//Cross Site Scripting
648 </ul>
649
650 <div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php//Cross Site Scripting
651 echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
652 ?>">
653 <ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">//Cross Site Scripting
654 <?php
655 $recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'showposts' => 15 ) );
656 $most_recent = $get_posts->query( $recent_args );
657 $args['walker'] = $walker;
658 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
659 ?>
660 </ul>
661 </div><!-- /.tabs-panel -->
662
663 <div class="tabs-panel <?php
664 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
665 ?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">//Cross Site Scripting
666 <?php
667 if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
668 $searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
669 $search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
670 } else {
671 $searched = '';
672 $search_results = array();
673 }
674 ?>
675 <p class="quick-search-wrap">
676 <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" />//Cross Site Scripting
677 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
678 <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
679 </p>
680
681 <ul id="<?php echo $post_type_name; ?>-search-checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">//Cross Site Scripting
682 <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
683 <?php
684 $args['walker'] = $walker;
685 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
686 ?>
687 <?php elseif ( is_wp_error( $search_results ) ) : ?>
688 <li><?php echo $search_results->get_error_message(); ?></li>//Cross Site Scripting
689 <?php elseif ( ! empty( $searched ) ) : ?>
690 <li><?php _e('No results found.'); ?></li>
691 <?php endif; ?>
692 </ul>
693 </div><!-- /.tabs-panel -->
694
695
696 <div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php//Cross Site Scripting
697 echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
698 ?>">
699 <?php if ( ! empty( $page_links ) ) : ?>
700 <div class="add-menu-item-pagelinks">
701 <?php echo $page_links; ?>//Cross Site Scripting
702 </div>
703 <?php endif; ?>
704 <ul id="<?php echo $post_type_name; ?>checklist" class="list:<?php echo $post_type_name?> categorychecklist form-no-clear">//Cross Site Scripting
705 <?php
706 $args['walker'] = $walker;
707
708 // if we're dealing with pages, let's put a checkbox for the front page at the top of the list
709 if ( 'page' == $post_type_name ) {
710 $front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
711 if ( ! empty( $front_page ) ) {
712 $front_page_obj = get_post( $front_page );
713 $front_page_obj->_add_to_top = true;
714 $front_page_obj->label = sprintf( _x('Home: %s', 'nav menu front page title'), $front_page_obj->post_title );
715 array_unshift( $posts, $front_page_obj );
716 } else {
717 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
718 array_unshift( $posts, (object) array(
719 '_add_to_top' => true,
720 'ID' => 0,
721 'object_id' => $_nav_menu_placeholder,
722 'post_content' => '',
723 'post_excerpt' => '',
724 'post_title' => _x('Home', 'nav menu home label'),
725 'post_type' => 'nav_menu_item',
726 'type' => 'custom',
727 'url' => home_url('/'),
728 ) );
729 }
730 }
731
732 $checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
733
734 if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
735 $checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items);
736
737 }
738
739 echo $checkbox_items;//Cross Site Scripting
740 ?>
741 </ul>
742 <?php if ( ! empty( $page_links ) ) : ?>
743 <div class="add-menu-item-pagelinks">
744 <?php echo $page_links; ?>//Cross Site Scripting
745 </div>
746 <?php endif; ?>
747 </div><!-- /.tabs-panel -->
748
749
750 <p class="button-controls">
751 <span class="list-controls">
752 <a href="<?php
753 echo esc_url(add_query_arg(
754 array(
755 $post_type_name . '-tab' => 'all',
756 'selectall' => 1,
757 ),
758 remove_query_arg($removed_args)
759 ));
760 ?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>//Cross Site Scripting
761 </span>
762
763 <span class="add-to-menu">
764 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
765 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="submit-posttype-<?php echo $post_type_name; ?>" />//Cross Site Scripting
766 </span>
767 </p>
768
769 </div><!-- /.posttypediv -->
770 <?php
771}
772
773/**
774 * Displays a metabox for a taxonomy menu item.
775 *
776 * @since 3.0.0
777 *
778 * @param string $object Not used.
779 * @param string $taxonomy The taxonomy object.
780 */
781function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
782 global $nav_menu_selected_id;
783 $taxonomy_name = $taxonomy['args']->name;
784
785 // paginate browsing for large numbers of objects
786 $per_page = 50;
787 $pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
788 $offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
789
790 $args = array(
791 'child_of' => 0,
792 'exclude' => '',
793 'hide_empty' => false,
794 'hierarchical' => 1,
795 'include' => '',
796 'include_last_update_time' => false,
797 'number' => $per_page,
798 'offset' => $offset,
799 'order' => 'ASC',
800 'orderby' => 'name',
801 'pad_counts' => false,
802 );
803
804 $terms = get_terms( $taxonomy_name, $args );
805
806 if ( ! $terms || is_wp_error($terms) ) {
807 echo '<p>' . __( 'No items.' ) . '</p>';
808 return;
809 }
810
811 $num_pages = ceil( wp_count_terms( $taxonomy_name , array_merge( $args, array('number' => '', 'offset' => '') ) ) / $per_page );
812
813 $page_links = paginate_links( array(
814 'base' => add_query_arg(
815 array(
816 $taxonomy_name . '-tab' => 'all',
817 'paged' => '%#%',
818 'item-type' => 'taxonomy',
819 'item-object' => $taxonomy_name,
820 )
821 ),
822 'format' => '',
823 'prev_text' => __('«'),
824 'next_text' => __('»'),
825 'total' => $num_pages,
826 'current' => $pagenum
827 ));
828
829 $walker = new Walker_Nav_Menu_Checklist;
830
831 $current_tab = 'most-used';
832 if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) {
833 $current_tab = $_REQUEST[$taxonomy_name . '-tab'];
834 }
835
836 if ( ! empty( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
837 $current_tab = 'search';
838 }
839
840 $removed_args = array(
841 'action',
842 'customlink-tab',
843 'edit-menu-item',
844 'menu-item',
845 'page-tab',
846 '_wpnonce',
847 );
848
849 ?>
850 <div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">//Cross Site Scripting
851 <ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">//Cross Site Scripting
852 <li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop"><?php _e('Most Used'); ?></a></li>//Cross Site Scripting
853 <li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all"><?php _e('View All'); ?></a></li>//Cross Site Scripting
854 <li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>><a class="nav-tab-link" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>"><?php _e('Search'); ?></a></li>//Cross Site Scripting
855 </ul>
856
857 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php//Cross Site Scripting
858 echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
859 ?>">
860 <ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >//Cross Site Scripting
861 <?php
862 $popular_terms = get_terms( $taxonomy_name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
863 $args['walker'] = $walker;
864 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
865 ?>
866 </ul>
867 </div><!-- /.tabs-panel -->
868
869 <div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php//Cross Site Scripting
870 echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
871 ?>">
872 <?php if ( ! empty( $page_links ) ) : ?>
873 <div class="add-menu-item-pagelinks">
874 <?php echo $page_links; ?>//Cross Site Scripting
875 </div>
876 <?php endif; ?>
877 <ul id="<?php echo $taxonomy_name; ?>checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">//Cross Site Scripting
878 <?php
879 $args['walker'] = $walker;
880 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
881 ?>
882 </ul>
883 <?php if ( ! empty( $page_links ) ) : ?>
884 <div class="add-menu-item-pagelinks">
885 <?php echo $page_links; ?>//Cross Site Scripting
886 </div>
887 <?php endif; ?>
888 </div><!-- /.tabs-panel -->
889
890 <div class="tabs-panel <?php
891 echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
892 ?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">//Cross Site Scripting
893 <?php
894 if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
895 $searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
896 $search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
897 } else {
898 $searched = '';
899 $search_results = array();
900 }
901 ?>
902 <p class="quick-search-wrap">
903 <input type="text" class="quick-search regular-text input-with-default-title" title="<?php esc_attr_e('Search'); ?>" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />//Cross Site Scripting
904 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
905 <input type="submit" class="quick-search-submit button-secondary hide-if-js" value="<?php esc_attr_e('Search'); ?>" />
906 </p>
907
908 <ul id="<?php echo $taxonomy_name; ?>-search-checklist" class="list:<?php echo $taxonomy_name?> categorychecklist form-no-clear">//Cross Site Scripting
909 <?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
910 <?php
911 $args['walker'] = $walker;
912 echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
913 ?>
914 <?php elseif ( is_wp_error( $search_results ) ) : ?>
915 <li><?php echo $search_results->get_error_message(); ?></li>//Cross Site Scripting
916 <?php elseif ( ! empty( $searched ) ) : ?>
917 <li><?php _e('No results found.'); ?></li>
918 <?php endif; ?>
919 </ul>
920 </div><!-- /.tabs-panel -->
921
922 <p class="button-controls">
923 <span class="list-controls">
924 <a href="<?php
925 echo esc_url(add_query_arg(
926 array(
927 $taxonomy_name . '-tab' => 'all',
928 'selectall' => 1,
929 ),
930 remove_query_arg($removed_args)
931 ));
932 ?>#taxonomy-<?php echo $taxonomy_name; ?>" class="select-all"><?php _e('Select All'); ?></a>//Cross Site Scripting
933 </span>
934
935 <span class="add-to-menu">
936 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" />
937 <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="submit-taxonomy-<?php echo $taxonomy_name; ?>" />//Cross Site Scripting
938 </span>
939 </p>
940
941 </div><!-- /.taxonomydiv -->
942 <?php
943}
944
945/**
946 * Save posted nav menu item data.
947 *
948 * @since 3.0.0
949 *
950 * @param int $menu_id The menu ID for which to save this item. $menu_id of 0 makes a draft, orphaned menu item.
951 * @param array $menu_data The unsanitized posted menu item data.
952 * @return array The database IDs of the items saved
953 */
954function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
955 $menu_id = (int) $menu_id;
956 $items_saved = array();
957
958 if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
959
960 // Loop through all the menu items' POST values
961 foreach( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
962 if (
963 empty( $_item_object_data['menu-item-object-id'] ) && // checkbox is not checked
964 (
965 ! isset( $_item_object_data['menu-item-type'] ) || // and item type either isn't set
966 in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) || // or URL is the default
967 ! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
968 ! empty( $_item_object_data['menu-item-db-id'] ) // or it *is* a custom menu item that already exists
969 )
970 ) {
971 continue; // then this potential menu item is not getting added to this menu
972 }
973
974 // if this possible menu item doesn't actually have a menu database ID yet
975 if (
976 empty( $_item_object_data['menu-item-db-id'] ) ||
977 ( 0 > $_possible_db_id ) ||
978 $_possible_db_id != $_item_object_data['menu-item-db-id']
979 ) {
980 $_actual_db_id = 0;
981 } else {
982 $_actual_db_id = (int) $_item_object_data['menu-item-db-id'];
983 }
984
985 $args = array(
986 'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ),
987 'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ),
988 'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ),
989 'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ),
990 'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ),
991 'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ),
992 'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ),
993 'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ),
994 'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ),
995 'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ),
996 'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ),
997 'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ),
998 'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ),
999 );
1000
/var/www/wordpress/wp-admin/includes/plugin-install.php
/var/www/wordpress/wp-admin/includes/plugin.php
/var/www/wordpress/wp-admin/includes/post.php
/var/www/wordpress/wp-admin/includes/schema.php
/var/www/wordpress/wp-admin/includes/taxonomy.php
/var/www/wordpress/wp-admin/includes/template.php
/var/www/wordpress/wp-admin/includes/theme-install.php
/var/www/wordpress/wp-admin/includes/theme.php
/var/www/wordpress/wp-admin/includes/update-core.php
/var/www/wordpress/wp-admin/includes/update.php
/var/www/wordpress/wp-admin/includes/upgrade.php
/var/www/wordpress/wp-admin/includes/user.php
/var/www/wordpress/wp-admin/includes/widgets.php
/var/www/wordpress/wp-admin/js/revisions-js.php
/var/www/wordpress/wp-admin/maint/repair.php
/var/www/wordpress/wp-admin/admin-ajax.php
/var/www/wordpress/wp-admin/admin-footer.php
/var/www/wordpress/wp-admin/admin-functions.php
/var/www/wordpress/wp-admin/admin-header.php
/var/www/wordpress/wp-admin/admin-post.php
/var/www/wordpress/wp-admin/admin.php
/var/www/wordpress/wp-admin/async-upload.php
/var/www/wordpress/wp-admin/comment.php
/var/www/wordpress/wp-admin/custom-background.php
/var/www/wordpress/wp-admin/custom-header.php
/var/www/wordpress/wp-admin/edit-attachment-rows.php
/var/www/wordpress/wp-admin/edit-comments.php
/var/www/wordpress/wp-admin/edit-form-advanced.php
/var/www/wordpress/wp-admin/edit-form-comment.php
/var/www/wordpress/wp-admin/edit-link-categories.php
/var/www/wordpress/wp-admin/edit-link-category-form.php
/var/www/wordpress/wp-admin/edit-link-form.php
/var/www/wordpress/wp-admin/edit-post-rows.php
/var/www/wordpress/wp-admin/edit-tag-form.php
/var/www/wordpress/wp-admin/edit-tags.php
/var/www/wordpress/wp-admin/edit.php
/var/www/wordpress/wp-admin/export.php
/var/www/wordpress/wp-admin/gears-manifest.php
/var/www/wordpress/wp-admin/import.php
/var/www/wordpress/wp-admin/index-extra.php
/var/www/wordpress/wp-admin/index.php
/var/www/wordpress/wp-admin/install-helper.php
/var/www/wordpress/wp-admin/install.php
/var/www/wordpress/wp-admin/link-add.php
/var/www/wordpress/wp-admin/link-category.php
/var/www/wordpress/wp-admin/link-manager.php
/var/www/wordpress/wp-admin/link-parse-opml.php
/var/www/wordpress/wp-admin/link.php
/var/www/wordpress/wp-admin/load-scripts.php
/var/www/wordpress/wp-admin/load-styles.php
/var/www/wordpress/wp-admin/media-new.php
/var/www/wordpress/wp-admin/media-upload.php
/var/www/wordpress/wp-admin/media.php
/var/www/wordpress/wp-admin/menu-header.php
/var/www/wordpress/wp-admin/menu.php
/var/www/wordpress/wp-admin/moderation.php
/var/www/wordpress/wp-admin/ms-admin.php
/var/www/wordpress/wp-admin/ms-delete-site.php
/var/www/wordpress/wp-admin/ms-edit.php
/var/www/wordpress/wp-admin/ms-options.php
/var/www/wordpress/wp-admin/ms-sites.php
/var/www/wordpress/wp-admin/ms-themes.php
/var/www/wordpress/wp-admin/ms-upgrade-network.php
/var/www/wordpress/wp-admin/ms-users.php
/var/www/wordpress/wp-admin/my-sites.php
/var/www/wordpress/wp-admin/nav-menus.php
/var/www/wordpress/wp-admin/network.php
/var/www/wordpress/wp-admin/options-discussion.php
/var/www/wordpress/wp-admin/options-general.php
/var/www/wordpress/wp-admin/options-head.php
/var/www/wordpress/wp-admin/options-media.php
/var/www/wordpress/wp-admin/options-permalink.php
/var/www/wordpress/wp-admin/options-privacy.php
/var/www/wordpress/wp-admin/options-reading.php
/var/www/wordpress/wp-admin/options-writing.php
/var/www/wordpress/wp-admin/options.php
/var/www/wordpress/wp-admin/plugin-editor.php
/var/www/wordpress/wp-admin/plugin-install.php
/var/www/wordpress/wp-admin/plugins.php
/var/www/wordpress/wp-admin/post-new.php
/var/www/wordpress/wp-admin/post.php
/var/www/wordpress/wp-admin/press-this.php
/var/www/wordpress/wp-admin/profile.php
/var/www/wordpress/wp-admin/revision.php
/var/www/wordpress/wp-admin/setup-config.php
/var/www/wordpress/wp-admin/sidebar.php
/var/www/wordpress/wp-admin/theme-editor.php
/var/www/wordpress/wp-admin/theme-install.php
/var/www/wordpress/wp-admin/themes.php
/var/www/wordpress/wp-admin/tools.php
/var/www/wordpress/wp-admin/update-core.php
/var/www/wordpress/wp-admin/update.php
/var/www/wordpress/wp-admin/upgrade-functions.php
/var/www/wordpress/wp-admin/upgrade.php
/var/www/wordpress/wp-admin/upload.php
/var/www/wordpress/wp-admin/user-edit.php
/var/www/wordpress/wp-admin/user-new.php
/var/www/wordpress/wp-admin/users.php
/var/www/wordpress/wp-admin/widgets.php
/var/www/wordpress/wp-content/languages/ru_RU.php
/var/www/wordpress/wp-content/plugins/akismet/akismet.php
/var/www/wordpress/wp-content/plugins/rh/rh.php
/var/www/wordpress/wp-content/plugins/hello.php
/var/www/wordpress/wp-content/plugins/index.php
/var/www/wordpress/wp-content/themes/twentyten/404.php
/var/www/wordpress/wp-content/themes/twentyten/archive.php
/var/www/wordpress/wp-content/themes/twentyten/attachment.php
/var/www/wordpress/wp-content/themes/twentyten/author.php
/var/www/wordpress/wp-content/themes/twentyten/category.php
/var/www/wordpress/wp-content/themes/twentyten/comments.php
/var/www/wordpress/wp-content/themes/twentyten/footer.php
/var/www/wordpress/wp-content/themes/twentyten/functions.php
/var/www/wordpress/wp-content/themes/twentyten/header.php
/var/www/wordpress/wp-content/themes/twentyten/index.php
/var/www/wordpress/wp-content/themes/twentyten/loop.php
/var/www/wordpress/wp-content/themes/twentyten/onecolumn-page.php
/var/www/wordpress/wp-content/themes/twentyten/page.php
/var/www/wordpress/wp-content/themes/twentyten/search.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar-footer.php
/var/www/wordpress/wp-content/themes/twentyten/sidebar.php
/var/www/wordpress/wp-content/themes/twentyten/single.php
/var/www/wordpress/wp-content/themes/twentyten/tag.php
/var/www/wordpress/wp-content/themes/index.php
/var/www/wordpress/wp-content/index.php
/var/www/wordpress/wp-includes/js/tinymce/langs/wp-langs.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/Logger.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/includes/general.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/config.php
/var/www/wordpress/wp-includes/js/tinymce/plugins/spellchecker/rpc.php
/var/www/wordpress/wp-includes/js/tinymce/wp-mce-help.php
/var/www/wordpress/wp-includes/js/tinymce/wp-tinymce.php
/var/www/wordpress/wp-includes/pomo/entry.php
/var/www/wordpress/wp-includes/pomo/mo.php
/var/www/wordpress/wp-includes/pomo/po.php
/var/www/wordpress/wp-includes/pomo/streams.php
/var/www/wordpress/wp-includes/pomo/translations.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/native.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/shell.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/string.php
/var/www/wordpress/wp-includes/Text/Diff/Engine/xdiff.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer/inline.php
/var/www/wordpress/wp-includes/Text/Diff/Renderer.php
/var/www/wordpress/wp-includes/Text/Diff.php
/var/www/wordpress/wp-includes/theme-compat/comments-popup.php
/var/www/wordpress/wp-includes/theme-compat/comments.php
/var/www/wordpress/wp-includes/theme-compat/footer.php
/var/www/wordpress/wp-includes/theme-compat/header.php
/var/www/wordpress/wp-includes/theme-compat/sidebar.php
/var/www/wordpress/wp-includes/atomlib.php
/var/www/wordpress/wp-includes/author-template.php
/var/www/wordpress/wp-includes/bookmark-template.php
/var/www/wordpress/wp-includes/bookmark.php
/var/www/wordpress/wp-includes/cache.php
/var/www/wordpress/wp-includes/canonical.php
/var/www/wordpress/wp-includes/capabilities.php
/var/www/wordpress/wp-includes/category-template.php
/var/www/wordpress/wp-includes/category.php
/var/www/wordpress/wp-includes/class-feed.php
/var/www/wordpress/wp-includes/class-http.php
/var/www/wordpress/wp-includes/class-IXR.php
/var/www/wordpress/wp-includes/class-json.php
/var/www/wordpress/wp-includes/class-oembed.php
/var/www/wordpress/wp-includes/class-phpass.php
/var/www/wordpress/wp-includes/class-phpmailer.php
/var/www/wordpress/wp-includes/class-pop3.php
/var/www/wordpress/wp-includes/class-simplepie.php
/var/www/wordpress/wp-includes/class-smtp.php
/var/www/wordpress/wp-includes/class-snoopy.php
/var/www/wordpress/wp-includes/class.wp-dependencies.php
/var/www/wordpress/wp-includes/class.wp-scripts.php
/var/www/wordpress/wp-includes/class.wp-styles.php
/var/www/wordpress/wp-includes/classes.php
/var/www/wordpress/wp-includes/comment-template.php
/var/www/wordpress/wp-includes/comment.php
/var/www/wordpress/wp-includes/compat.php
/var/www/wordpress/wp-includes/cron.php
/var/www/wordpress/wp-includes/default-constants.php
/var/www/wordpress/wp-includes/default-embeds.php
/var/www/wordpress/wp-includes/default-filters.php
/var/www/wordpress/wp-includes/default-widgets.php
/var/www/wordpress/wp-includes/deprecated.php
/var/www/wordpress/wp-includes/feed-atom-comments.php
/var/www/wordpress/wp-includes/feed-atom.php
/var/www/wordpress/wp-includes/feed-rdf.php
/var/www/wordpress/wp-includes/feed-rss.php
/var/www/wordpress/wp-includes/feed-rss2-comments.php
/var/www/wordpress/wp-includes/feed-rss2.php
/var/www/wordpress/wp-includes/feed.php
/var/www/wordpress/wp-includes/formatting.php
/var/www/wordpress/wp-includes/functions.php
/var/www/wordpress/wp-includes/functions.wp-scripts.php
/var/www/wordpress/wp-includes/functions.wp-styles.php
/var/www/wordpress/wp-includes/general-template.php
/var/www/wordpress/wp-includes/http.php
/var/www/wordpress/wp-includes/kses.php
/var/www/wordpress/wp-includes/l10n.php
/var/www/wordpress/wp-includes/link-template.php
/var/www/wordpress/wp-includes/load.php
/var/www/wordpress/wp-includes/locale.php
/var/www/wordpress/wp-includes/media.php
/var/www/wordpress/wp-includes/meta.php
/var/www/wordpress/wp-includes/ms-blogs.php
/var/www/wordpress/wp-includes/ms-default-constants.php
/var/www/wordpress/wp-includes/ms-default-filters.php
/var/www/wordpress/wp-includes/ms-deprecated.php
/var/www/wordpress/wp-includes/ms-files.php
/var/www/wordpress/wp-includes/ms-functions.php
/var/www/wordpress/wp-includes/ms-load.php
/var/www/wordpress/wp-includes/ms-settings.php
/var/www/wordpress/wp-includes/nav-menu-template.php
/var/www/wordpress/wp-includes/nav-menu.php
/var/www/wordpress/wp-includes/pluggable-deprecated.php
/var/www/wordpress/wp-includes/pluggable.php
/var/www/wordpress/wp-includes/plugin.php
/var/www/wordpress/wp-includes/post-template.php
/var/www/wordpress/wp-includes/post-thumbnail-template.php
/var/www/wordpress/wp-includes/post.php
/var/www/wordpress/wp-includes/query.php
/var/www/wordpress/wp-includes/registration-functions.php
/var/www/wordpress/wp-includes/registration.php
/var/www/wordpress/wp-includes/rewrite.php
/var/www/wordpress/wp-includes/rss-functions.php
/var/www/wordpress/wp-includes/rss.php
/var/www/wordpress/wp-includes/script-loader.php
/var/www/wordpress/wp-includes/shortcodes.php
/var/www/wordpress/wp-includes/taxonomy.php
/var/www/wordpress/wp-includes/template-loader.php
/var/www/wordpress/wp-includes/theme.php
/var/www/wordpress/wp-includes/update.php
/var/www/wordpress/wp-includes/user.php
/var/www/wordpress/wp-includes/vars.php
/var/www/wordpress/wp-includes/version.php
/var/www/wordpress/wp-includes/widgets.php
/var/www/wordpress/wp-includes/wp-db.php
/var/www/wordpress/wp-includes/wp-diff.php
/var/www/wordpress/index.php
/var/www/wordpress/wp-activate.php
/var/www/wordpress/wp-app.php
/var/www/wordpress/wp-atom.php
/var/www/wordpress/wp-blog-header.php
/var/www/wordpress/wp-comments-post.php
/var/www/wordpress/wp-commentsrss2.php
/var/www/wordpress/wp-config-sample.php
/var/www/wordpress/wp-cron.php
/var/www/wordpress/wp-feed.php
/var/www/wordpress/wp-links-opml.php
/var/www/wordpress/wp-load.php
/var/www/wordpress/wp-login.php
/var/www/wordpress/wp-mail.php
/var/www/wordpress/wp-pass.php
/var/www/wordpress/wp-rdf.php
/var/www/wordpress/wp-register.php
/var/www/wordpress/wp-rss.php
/var/www/wordpress/wp-rss2.php
/var/www/wordpress/wp-settings.php
/var/www/wordpress/wp-signup.php
/var/www/wordpress/wp-trackback.php
/var/www/wordpress/xmlrpc.php