WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/26/2019 05:28:20 PM (7 weeks ago)
Author:
SergeyBiryukov
Message:

Docs: Improve documentation for esc_attr_e(), esc_html_e(), esc_attr_x(), esc_html_x().

Props atachibana.
Fixes #48383.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n.php

    r46232 r46593  
    170170 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
    171171 *                       Default 'default'.
    172  * @return string Translated text
     172 * @return string Translated text.
    173173 */
    174174function translate( $text, $domain = 'default' ) {
     
    211211 * Retrieve the translation of $text in the context defined in $context.
    212212 *
    213  * If there is no translation, or the text domain isn't loaded the original
    214  * text is returned.
     213 * If there is no translation, or the text domain isn't loaded, the original text is returned.
    215214 *
    216215 * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
     
    283282 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
    284283 *                       Default 'default'.
    285  * @return string Translated text
     284 * @return string Translated text.
    286285 */
    287286function esc_html__( $text, $domain = 'default' ) {
     
    305304 * Display translated text that has been escaped for safe use in an attribute.
    306305 *
     306 * Encodes `< > & " '` (less than, greater than, ampersand, double quote, single quote).
     307 * Will never double encode entities.
     308 *
     309 * If you need the value for use in PHP, use esc_attr__().
     310 *
    307311 * @since 2.8.0
    308312 *
     
    317321/**
    318322 * Display translated text that has been escaped for safe use in HTML output.
     323 *
     324 * If there is no translation, or the text domain isn't loaded, the original text
     325 * is escaped and displayed.
     326 *
     327 * If you need the value for use in PHP, use esc_html__().
    319328 *
    320329 * @since 2.8.0
     
    367376 * Translate string with gettext context, and escapes it for safe use in an attribute.
    368377 *
     378 * If there is no translation, or the text domain isn't loaded, the original text
     379 * is escaped and returned.
     380 *
    369381 * @since 2.8.0
    370382 *
     
    373385 * @param string $domain  Optional. Text domain. Unique identifier for retrieving translated strings.
    374386 *                        Default 'default'.
    375  * @return string Translated text
     387 * @return string Translated text.
    376388 */
    377389function esc_attr_x( $text, $context, $domain = 'default' ) {
     
    381393/**
    382394 * Translate string with gettext context, and escapes it for safe use in HTML output.
     395 *
     396 * If there is no translation, or the text domain isn't loaded, the original text
     397 * is escaped and returned.
    383398 *
    384399 * @since 2.9.0
Note: See TracChangeset for help on using the changeset viewer.