function globallink_format_file_name in GlobalLink Connect for Drupal 7.7
Same name and namespace in other branches
- 7.5 globallink.inc \globallink_format_file_name()
- 7.6 globallink.inc \globallink_format_file_name()
Formats file name.
Parameters
string $string: The file name to be formatted.
Return value
string The formatted file name.
3 calls to globallink_format_file_name()
- globallink_entity_get_xml in globallink_entity/
globallink_entity.inc - Gets XML data from specific entity.
- globallink_entity_reference_get_xml in globallink_custom_entity/
globallink_custom_entity.inc - globallink_get_xml in ./
globallink_node.inc - Retrieves translation XML data.
File
- ./
globallink.inc, line 560 - Miscellaneous GlobalLink functions for node translations (non-entity).
Code
function globallink_format_file_name($string) {
$bad = array_merge(array_map('chr', range(0, 31)), array(
'<',
'>',
':',
'"',
'/',
'\\',
'|',
'?',
'*',
';',
'&',
' ',
'.',
));
$name = str_replace($bad, '_', utf8_decode(preg_replace('/[^(\\x20-\\x7F)]*/', '', $string)));
if (strlen($name) > 50) {
$name = substr($name, 0, 50);
}
return $name;
}