Hi,
I'm not sure if I am posting this properly, but I did a thorough search for existing solutions. When entering an external link like
http://www.example.com/?q=bug&db=help
the link itself gets properly encoded for html, but the class name generated by nice_menus retains unencoded ampersands. This causes a validation error in the page. The offending code in nice_menus.module (on line 150 or 151) is:
// Build class name based on menu path e.g. to give each menu item individual style
$path_class = 'menu-path-'. str_replace('/', '-', $menu['items'][$mid]['path']);
Which I changed to:
// Build class name based on menu path e.g. to give each menu item individual style
$path_class = 'menu-path-'. str_replace(array("/", "&", "<", ">"), '-', $menu['items'][$mid]['path']);
This alleviates the validation error caused by ampersands in the class name as well as the validation warning caused by opening and closing brackets when a path points to <front>.
I have not check for all of the possible offending URL characters, but characters can be added into the array I am using. It might be easier just to do a url_encode on the path name, though I am not sure if that would cause any other problems.
I would upload the proposed patch, but I am not sure how to do that. I have never contributed code before, and I naively thought I could just upload the changed file.
Comments
Comment #1
add1sun commentedHi jsherman, thanks for looking in to this. This is actually a duplicate of an existing issue (http://drupal.org/node/100914) so i'm gonna mark this and link from that one so we can keep everything in one place. So please respond further over there.