You are here

function _potx_format_quoted_string in Translation template extractor 6.2

Same name and namespace in other branches
  1. 8 potx.inc \_potx_format_quoted_string()
  2. 5.2 potx.inc \_potx_format_quoted_string()
  3. 5 potx.inc \_potx_format_quoted_string()
  4. 6.3 potx.inc \_potx_format_quoted_string()
  5. 6 potx.inc \_potx_format_quoted_string()
  6. 7.3 potx.inc \_potx_format_quoted_string()
  7. 7 potx.inc \_potx_format_quoted_string()
  8. 7.2 potx.inc \_potx_format_quoted_string()

Escape quotes in a strings depending on the surrounding quote type used.

Parameters

$str: The strings to escape

7 calls to _potx_format_quoted_string()
_potx_find_format_plural_calls in ./potx.inc
Detect all occurances of format_plural calls.
_potx_find_language_names in ./potx.inc
Get languages names from Drupal's locale.inc.
_potx_find_menu_hook in ./potx.inc
List of menu item titles. Only for Drupal 6.
_potx_find_perm_hook in ./potx.inc
Detect permission names from the hook_perm() implementations. Note that this will get confused with a similar pattern in a comment, and with dynamic permissions, which need to be accounted for.
_potx_find_t_calls in ./potx.inc
Detect all occurances of t()-like calls.

... See full list

File

./potx.inc, line 520
Extraction API used by the web and command line interface.

Code

function _potx_format_quoted_string($str) {
  $quo = substr($str, 0, 1);
  $str = substr($str, 1, -1);
  if ($quo == '"') {
    $str = stripcslashes($str);
  }
  else {
    $str = strtr($str, array(
      "\\'" => "'",
      "\\\\" => "\\",
    ));
  }
  return addcslashes($str, "\0..\37\\\"");
}