mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-04 04:34:31 +00:00
deprecate wp_specialchars() in favor of esc_html(). Encode quotes for esc_html() as in esc_attr(), to improve plugin security.
git-svn-id: https://develop.svn.wordpress.org/trunk@11380 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -119,6 +119,22 @@ function esc_attr__( $text, $domain = 'default' ) {
|
||||
return esc_attr( translate( $text, $domain ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the translation of $text and escapes it for safe use in HTML output.
|
||||
* If there is no translation, or the domain isn't loaded the original text is returned.
|
||||
*
|
||||
* @see translate() An alias of translate()
|
||||
* @see esc_html()
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $text Text to translate
|
||||
* @param string $domain Optional. Domain to retrieve the translated text
|
||||
* @return string Translated text
|
||||
*/
|
||||
function esc_html__( $text, $domain = 'default' ) {
|
||||
return esc_html( translate( $text, $domain ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the returned translated text from translate().
|
||||
*
|
||||
@@ -146,6 +162,20 @@ function esc_attr_e( $text, $domain = 'default' ) {
|
||||
echo esc_attr( translate( $text, $domain ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays translated text that has been escaped for safe use in HTML output.
|
||||
*
|
||||
* @see translate() Echoes returned translate() string
|
||||
* @see esc_html()
|
||||
* @since 2.8.0
|
||||
*
|
||||
* @param string $text Text to translate
|
||||
* @param string $domain Optional. Domain to retrieve the translated text
|
||||
*/
|
||||
function esc_html_e( $text, $domain = 'default' ) {
|
||||
echo esc_html( translate( $text, $domain ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve translated string with vertical bar context
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user