--- C:\Documents and Settings\aadne\Skrivebord\old_class.tx_realurl.php Tue Aug 16 13:25:49 2005 +++ C:\Documents and Settings\aadne\Skrivebord\new_class.tx_realurl.php Tue Aug 16 13:25:54 2005 @@ -1289,24 +1289,32 @@ * @return string New alias value * @see lookUpTranslation() */ function lookUp_cleanAlias($cfg,$newAliasValue) { - // lowercase page path: + // Fetch character set: + $charset = $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] ? $GLOBALS['TYPO3_CONF_VARS']['BE']['forceCharset'] : $GLOBALS['TSFE']->defaultCharSet; + + // Convert to lowercase: if ($cfg['useUniqueCache_conf']['strtolower']) { - $newAliasValue = strtolower($newAliasValue); - } + $newAliasValue = $GLOBALS['TSFE']->csConvObj->conv_case($charset,$newAliasValue,'toLower'); + } - // Translate space and individual chars: + // Convert some special tokens to the space character: $space = $cfg['useUniqueCache_conf']['spaceCharacter'] ? substr($cfg['useUniqueCache_conf']['spaceCharacter'],0,1) : '_'; - $newAliasValue = strtr($newAliasValue,'àáâãäåçèéêëìíîïñòóôõöøùúûüýÿµ -+_','aaaaaaceeeeiiiinoooooouuuuyyu'.$space.$space.$space.$space); // remove accents, convert spaces - $newAliasValue = strtr($newAliasValue,array('þ' => 'th', 'ð' => 'dh', 'ß' => 'ss', 'æ' => 'ae')); // rewrite some special chars + $newAliasValue = strtr($newAliasValue,' -+_',$space.$space.$space.$space); // convert spaces + + // Convert extended letters to ascii equivalents: + $newAliasValue = $GLOBALS['TSFE']->csConvObj->specCharsToASCII($charset,$newAliasValue); - // Strip of non-allowed chars, convert multiple spacechar to a single one + remove any of them in the end of the string - $newAliasValue = ereg_replace('[^[:alnum:]_]', $space, $newAliasValue); - $newAliasValue = ereg_replace('\\'.$space.'+',$space,$newAliasValue); + // Strip the rest...: + $newAliasValue = ereg_replace('[^a-zA-Z0-9\\'.$space.']', '', $newAliasValue); // strip the rest + $newAliasValue = ereg_replace('\\'.$space.'+',$space,$newAliasValue); // Convert multiple 'spaces' to a single one $newAliasValue = trim($newAliasValue,$space); - return $newAliasValue; + // Return encoded URL: + return rawurlencode($newAliasValue); }