From 76c50d8fab2b8db1e4019371c293fde6e2d7c311 Mon Sep 17 00:00:00 2001 From: nacin Date: Tue, 11 May 2010 23:58:26 +0000 Subject: [PATCH] Allow for multiple classes and XFN relationships in menu items. git-svn-id: http://svn.automattic.com/wordpress/trunk@14574 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/nav-menu.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 4b4a347ba4..874b441eaf 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -329,9 +329,11 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item update_post_meta( $menu_item_db_id, '_menu_item_object_id', (int) $args['menu-item-object-id'] ); update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) ); update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) ); - // @todo handle sanitizing multiple classes separated by whitespace. - update_post_meta( $menu_item_db_id, '_menu_item_classes', sanitize_html_class($args['menu-item-classes']) ); - update_post_meta( $menu_item_db_id, '_menu_item_xfn', sanitize_html_class($args['menu-item-xfn']) ); + // @todo sanitize_html_classes() + foreach( array( 'menu-item-classes', 'menu-item-xfn') as $arg ) + $args[$arg] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[$arg] ) ) ); + update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); + update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); // @todo: only save custom link urls. update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw($args['menu-item-url']) );