You are here

function _potx_format_quoted_string in Translation template extractor 7

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. 6.2 potx.inc \_potx_format_quoted_string()
  7. 7.3 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

14 calls to _potx_format_quoted_string()
PotxTestCase::assertMsgID in tests/potx.test
Helper function to assert an msgid construct in the .po file.
PotxTestCase::assertMsgIDContext in tests/potx.test
Helper function to assert an msgid with context in the .po file.
PotxTestCase::assertNoMsgID in tests/potx.test
Helper function to assert a missing msgid construct in the .po file.
PotxTestCase::assertNoMsgIDContext in tests/potx.test
Helper function to assert an msgid with context in the .po file.
PotxTestCase::assertPluralID in tests/potx.test
Helper function to assert an msgid_plural construct in the .po file.

... See full list

File

./potx.inc, line 561
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\\\"");
}