_acf_log_escaped_html()
Logs instances of ACF successfully escaping unsafe HTML.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуки из функции
Возвращает
null. Ничего (null).
Использование
_acf_log_escaped_html( $function, $selector, $field, $post_id );
- $function(строка) (обязательный)
- The function that resulted in HTML being escaped.
- $selector(строка) (обязательный)
- The selector (field key, name, etc.) passed to that function.
- $field(массив) (обязательный)
- The field being queried when HTML was escaped.
- $post_id(разное) (обязательный)
- The post ID the function was called on.
Список изменений
| С версии 6.2.5 | Введена. |
Код _acf_log_escaped_html() acf log escaped html ACF 6.4.2
function _acf_log_escaped_html( $function, $selector, $field, $post_id ) {
// If the notice isn't shown, no use in logging the errors.
if ( apply_filters( 'acf/admin/prevent_escaped_html_notice', true ) ) {
return;
}
// If the notice has been dismissed, don't log further errors.
if ( get_option( 'acf_escaped_html_notice_dismissed' ) ) {
return;
}
// If the field isn't set, we've output a non-ACF field, so don't log anything.
if ( ! is_array( $field ) ) {
return;
}
$escaped = _acf_get_escaped_html_log();
// Only store up to 100 results at a time.
if ( count( $escaped ) >= 100 ) {
return;
}
// Bail if we already logged an error for this field.
if ( isset( $escaped[ $field['key'] ] ) ) {
return;
}
$escaped[ $field['key'] ] = array(
'selector' => $selector,
'function' => $function,
'field' => $field['label'],
'post_id' => $post_id,
);
_acf_update_escaped_html_log( $escaped );
}