1 gettext.inc _locale_import_parse_quoted($string)

Parses a string in quotes.

Parameters

$string: A string specified with enclosing quotes.

Return value

The string parsed from inside the quotes.:

Related topics

File

core/includes/gettext.inc, line 872
Gettext parsing and generating API.

Code

function _locale_import_parse_quoted($string) {
  if (substr($string, 0, 1) != substr($string, -1, 1)) {
    // Start and end quotes must be the same.
    return FALSE;
  }
  $quote = substr($string, 0, 1);
  $string = substr($string, 1, -1);
  // Double quotes: strip slashes.
  if ($quote == '"') {
    return stripcslashes($string);
  }
  // Simple quote: return as-is.
  elseif ($quote == "'") {
    return $string;
  }
  // Unrecognized quote.
  else {
    return FALSE;
  }
}