Revision 520
Added by Matthias almost 17 years ago
functions.php | ||
---|---|---|
879 | 879 |
function page_filename($string) { |
880 | 880 |
$string = entities_to_7bit(umlauts_to_entities($string)); |
881 | 881 |
// Now replace spaces with page spcacer |
882 |
$string = str_replace(' ', PAGE_SPACER, $string); |
|
882 |
$string = trim($string); |
|
883 |
$string = preg_replace('/(\s)+/', PAGE_SPACER, $string); |
|
883 | 884 |
// Now remove all bad characters |
884 | 885 |
$bad = array( |
885 | 886 |
'\'', /* / */ '"', /* " */ '<', /* < */ '>', /* > */ |
... | ... | |
892 | 893 |
$string = str_replace($bad, '', $string); |
893 | 894 |
// Now convert to lower-case |
894 | 895 |
$string = strtolower($string); |
895 |
// Now remove multiple page spacers |
|
896 |
$string = str_replace(PAGE_SPACER.PAGE_SPACER, PAGE_SPACER, $string); |
|
897 |
// Clean any page spacers at the end of string |
|
898 |
$string = str_replace(PAGE_SPACER, ' ', $string); |
|
899 |
$string = trim($string); |
|
900 |
$string = str_replace(' ', PAGE_SPACER, $string); |
|
901 | 896 |
// If there are any weird language characters, this will protect us against possible problems they could cause |
902 | 897 |
$string = str_replace(array('%2F', '%'), array('/', ''), urlencode($string)); |
903 | 898 |
// Finally, return the cleaned string |
Also available in: Unified diff
Fixed #542 (thanks to Thorn)