Fix for Code

  1. <?php
  2.         function adamfrost_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL)
  3.         {
  4.        
  5.                 // $class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
  6.                 //
  7.                 // if (!empty($extra_class))
  8.                 // {
  9.                 //      $class .= ' '. $extra_class;
  10.                 // }
  11.                 //
  12.                 // if ($in_active_trail)
  13.                 // {
  14.                 //      $class .= ' active-trail';
  15.                 // }
  16.        
  17.                 $pattern = '/<a href="[\/\w-\s]*" title="[\/\w-\s]*">([\/\w-\s]*)<\/a>/';
  18.                 preg_match($pattern, $link, $matches);
  19.        
  20.                 print_r($matches);
  21.                
  22.                 if($matches[1] != '')
  23.                 {
  24.                         return '<li id="'.preg_replace("/[^a-z0-9-]/", "-", strtolower($matches[1])).'" class="'.$class.'">'.$link.$menu."</li>\n";
  25.                 }
  26.                 else
  27.                 {
  28.                         return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
  29.                 }
  30.                
  31.         }
  32.        
  33.         function adamfrost_menu_item_link($link)
  34.         {
  35.                 if (empty($link['localized_options']))
  36.                 {
  37.                         $link['localized_options'] = array();
  38.                 }
  39.        
  40.                 return l($link['title'], $link['href'], $link['localized_options']);
  41.         }

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.