cms_escape

   Purpose

This modifier is used to escape the string in one of many ways. This can be used for converting the string to multiple different display formats, or to make user entered data with special characters displayable on a standard web page.

   Usage

{$some_var_with_text|cms_escape[:<escape type>|[<character set>]]}

   Valid escape types

  • html (default) - use htmlspecialchars.
  • htmlall - use htmlentities.
  • url - raw url encode all entities.
  • urlpathinfo - Similar to the url escape type, but also encode /.
  • quotes - Escape unescaped single quotes.
  • hex - Escape every character into hex.
  • hexentity - Hex encode every character.
  • decentity - Decimal encode every character.
  • javascript - Escape quotes, backslashes, newlines etc.
  • mail - Encode an email address into something that is safe to display.
  • nonstd - Escape non standard characters, such as document quotes.

   Character Set

If the character set is not specified, utf-8 is assumed. The character set is only applicable to the "html" and "htmlall" escape types.