/**
  * Parse configuration file to set an option array
  *
  * @param    string $iniFile the configuration file name (default 'BBCodeParser.ini')
  * @return   array the corresponding options
  *           as a tree general|parse|render|format*Format*Rule
  * @access   public
  * @static
  */
 function parseIniFile($iniFile = 'BBCodeParser.ini')
 {
     static $isArray = array('set_render', 'filters', 'rules', 'schemes', 'extensions', 'refused', 'prefixes', 'img_ext');
     $options = array();
     // Parse the ini file
     $config = parse_ini_file($iniFile, true);
     // Normalize if old config
     if (isset($config['HTML_BBCodeParser'])) {
         $config = array_merge($config['HTML_BBCodeParser'], $config);
         unset($config['HTML_BBCodeParser']);
     }
     // proceed each section or general items
     foreach ($config as $name => $section) {
         if (is_string($section)) {
             $options[$name] = in_array($name, $isArray) ? explode(',', $section) : $section;
             continue;
         }
         $keys = explode('_', $name);
         $here =& $options;
         foreach ($keys as $key) {
             if (!isset($here[$key])) {
                 $here[$key] = array();
             }
             $here =& $here[$key];
         }
         $smiley = count($keys) == 3 && $keys[0] == 'parse' && $keys[2] == 'Smiley';
         foreach ($section as $itk => $item) {
             if ($item === '') {
                 continue;
             }
             if ($smiley && substr($itk, 0, 7) == 'smiley_') {
                 $words = explode(' ', $item);
                 $equal = false;
                 $variante = array();
                 for ($i = 1; $i < count($words); $i++) {
                     if ($equal) {
                         $variante[] = $words[$i];
                         $equal = false;
                         continue;
                     }
                     if (!($equal = $words[$i] == '=')) {
                         break;
                     }
                 }
                 $here[$words[0]] = array_merge(array(substr($itk, 7), $equal || count($words) == $i + 1 ? $itk : implode(' ', array_slice($words, $i))), $variante);
             } else {
                 $here[$itk] = in_array($itk, $isArray) ? explode(',', $item) : $item;
             }
         }
     }
     HTML_BBCodeParser::pruneOptions($options);
     return $options;
 }