WordPress.org

Make WordPress Core

Changeset 14574


Ignore:
Timestamp:
05/11/2010 11:58:26 PM (8 years ago)
Author:
nacin
Message:

Allow for multiple classes and XFN relationships in menu items.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/nav-menu.php

    r14571 r14574  
    330330        update_post_meta( $menu_item_db_id, '_menu_item_object', sanitize_key($args['menu-item-object']) );
    331331        update_post_meta( $menu_item_db_id, '_menu_item_target', sanitize_key($args['menu-item-target']) );
    332         // @todo handle sanitizing multiple classes separated by whitespace.
    333         update_post_meta( $menu_item_db_id, '_menu_item_classes', sanitize_html_class($args['menu-item-classes']) );
    334         update_post_meta( $menu_item_db_id, '_menu_item_xfn', sanitize_html_class($args['menu-item-xfn']) );
     332        // @todo sanitize_html_classes()
     333        foreach( array( 'menu-item-classes', 'menu-item-xfn') as $arg )
     334            $args[$arg] = implode( ' ', array_map( 'sanitize_html_class', explode( ' ', $args[$arg] ) ) );
     335        update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] );
     336        update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] );
    335337
    336338        // @todo: only save custom link urls.
Note: See TracChangeset for help on using the changeset viewer.