private function _test_normalized_ids()
 {
     $this->_check_equal('untergeordnet_asthetisch', normalize_file_id('Untergeordnet �sthetisch'));
     $this->_check_equal('untergeordnet_asthetisch', normalize_file_id('Untergeordnet    �sthetisch'));
     $this->_check_equal('aaaaeeeeiiiioooouuuuaaaaeeeeiiiioooouuuunncc', normalize_file_id('��������������������������������������������'));
     $opts = global_file_options();
     $opts->normalized_ids_are_lower_case = false;
     $this->_check_equal('Untergeordnet_Asthetisch', normalize_file_id('Untergeordnet �sthetisch'));
     $this->_check_equal('Untergeordnet_Asthetisch', normalize_file_id('Untergeordnet    �sthetisch'));
     $this->_check_equal('aaaaeeeeiiiioooouuuuAAAAEEEEIIIIOOOOUUUUnNcC', normalize_file_id('��������������������������������������������'));
 }
Example #2
0
/**
 * Create a valid path based on 'path'.
 * @param string $path
 * @param FILE_OPTIONS $opts
 * @return string
 * @see normalize_file_id()
 */
function normalize_path($path, $opts = null)
{
    $Result = '';
    if (!isset($opts)) {
        $opts = global_file_options();
    }
    $parts_to_process = explode($opts->path_delimiter, $path);
    if (sizeof($parts_to_process)) {
        /* If the first part is a Windows drive, use it without normalizing it. */
        $part = $parts_to_process[0];
        if (!$opts->path_starts_with_delimiter() && strlen($part) == 2 && $part[1] == ':') {
            $processed_parts[] = array_shift($parts_to_process);
        }
        /* Process all other path parts normally. */
        foreach ($parts_to_process as $part) {
            $processed_parts[] = normalize_file_id($part, $opts);
        }
        $Result = implode($opts->path_delimiter, $processed_parts);
    }
    return strtolower($Result);
}