wc_esc_json()
Escape JSON for use on HTML or attribute text nodes.
Хуков нет.
Возвращает
Строку
. Escaped JSON.
Использование
wc_esc_json( $json, $html );
- $json(строка) (обязательный)
- JSON to escape.
- $html(true|false)
- True if escaping for HTML text node, false for attributes. Determines how quotes are handled.
По умолчанию: false
Список изменений
С версии 3.5.5 | Введена. |
Код wc_esc_json() wc esc json WC 8.7.0
function wc_esc_json( $json, $html = false ) { return _wp_specialchars( $json, $html ? ENT_NOQUOTES : ENT_QUOTES, // Escape quotes in attribute nodes only. 'UTF-8', // json_encode() outputs UTF-8 (really just ASCII), not the blog's charset. true // Double escape entities: `&` -> `&`. ); }