function _locale_import_parse_quoted in Drupal 4
Same name and namespace in other branches
- 5 includes/locale.inc \_locale_import_parse_quoted()
- 6 includes/locale.inc \_locale_import_parse_quoted()
- 7 includes/locale.inc \_locale_import_parse_quoted()
Parses a string in quotes
Parameters
$string A string specified with enclosing quotes:
Return value
The string parsed from inside the quotes
1 call to _locale_import_parse_quoted()
- _locale_import_read_po in includes/
locale.inc - Parses Gettext Portable Object file into an array
File
- includes/
locale.inc, line 1014 - Admin-related functions for locale.module.
Code
function _locale_import_parse_quoted($string) {
if (substr($string, 0, 1) != substr($string, -1, 1)) {
return FALSE;
// Start and end quotes must be the same
}
$quote = substr($string, 0, 1);
$string = substr($string, 1, -1);
if ($quote == '"') {
// Double quotes: strip slashes
return stripcslashes($string);
}
elseif ($quote == "'") {
// Simple quote: return as-is
return $string;
}
else {
return FALSE;
// Unrecognized quote
}
}