| 374 | /** |
| 375 | * Retrieve the translation of $text and escapes it for safe use in XML output. |
| 376 | * |
| 377 | * If there is no translation, or the text domain isn't loaded, the original text |
| 378 | * is escaped and returned. |
| 379 | * |
| 380 | * @since 5.5.0 |
| 381 | * |
| 382 | * @param string $text Text to translate. |
| 383 | * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. |
| 384 | * Default 'default'. |
| 385 | * @return string Translated text. |
| 386 | */ |
| 387 | function esc_xml__( $text, $domain = 'default' ) { |
| 388 | return esc_xml( translate( $text, $domain ) ); |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * Display translated text that has been escaped for safe use in XML output. |
| 393 | * |
| 394 | * If there is no translation, or the text domain isn't loaded, the original text |
| 395 | * is escaped and displayed. |
| 396 | * |
| 397 | * If you need the value for use in PHP, use esc_xml__(). |
| 398 | * |
| 399 | * @since 5.5.0 |
| 400 | * |
| 401 | * @param string $text Text to translate. |
| 402 | * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. |
| 403 | * Default 'default'. |
| 404 | */ |
| 405 | function esc_xml_e( $text, $domain = 'default' ) { |
| 406 | echo esc_xml( translate( $text, $domain ) ); |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Translate string with gettext context, and escapes it for safe use in XML output. |
| 411 | * |
| 412 | * If there is no translation, or the text domain isn't loaded, the original text |
| 413 | * is escaped and returned. |
| 414 | * |
| 415 | * @since 5.5.0 |
| 416 | * |
| 417 | * @param string $text Text to translate. |
| 418 | * @param string $context Context information for the translators. |
| 419 | * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings. |
| 420 | * Default 'default'. |
| 421 | * @return string Translated text. |
| 422 | */ |
| 423 | function esc_xml_x( $text, $context, $domain = 'default' ) { |
| 424 | return esc_xml( translate_with_gettext_context( $text, $context, $domain ) ); |
| 425 | } |
| 426 | |