_wp_specialchars


_wp_specialchars ( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false )

Access:
  • private
Parameters:
  • (string) text The text which is to be encoded.
  • (int|string) quote_style Optional. Converts double quotes if set to ENT_COMPAT, both single and double if set to ENT_QUOTES or none if set to ENT_NOQUOTES. Converts single and double quotes, as well as converting HTML named entities (that are not also XML named entities) to their code points if set to ENT_XML1. Also compatible with old values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
  • (false|string) charset Optional. The character encoding of the string. Default false.
  • (bool) double_encode Optional. Whether to encode existing HTML entities. Default false.
Returns:
  • (string) The encoded text with HTML entities.
Defined at:
Change Log:
  • 5: .

Description

Converts a number of special characters into their HTML entities.Specifically deals with: `&`, `<`, `>`, `"`, and `'`. `$quote_style` can be set to ENT_COMPAT to encode `"` to `"`, or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.

Related Functions

wp_specialchars, wp_specialchars_decode, wp_cache_reset, _canonical_charset, wp_get_nocache_headers

Top Google Results

User discussions

wpseek mobile