function _potx_format_quoted_string in Translation template extractor 7.2
Same name and namespace in other branches
- 8 potx.inc \_potx_format_quoted_string()
- 5.2 potx.inc \_potx_format_quoted_string()
- 5 potx.inc \_potx_format_quoted_string()
- 6.3 potx.inc \_potx_format_quoted_string()
- 6 potx.inc \_potx_format_quoted_string()
- 6.2 potx.inc \_potx_format_quoted_string()
- 7.3 potx.inc \_potx_format_quoted_string()
- 7 potx.inc \_potx_format_quoted_string()
Escape quotes in a strings depending on the surrounding quote type used.
Parameters
$str: The strings to escape
20 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::assertNoPluralIDContext in tests/
potx.test - Helper function to assert lack of msgid_plural with context in the .po file.
File
- ./
potx.inc, line 676 - 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\\\"");
}