_wp_kses_restricts_attribute_values()
Determines whether KSES restricts the value of any attribute of an element.
An attribute rule other than required and valueless restricts the value itself, for example values or value_callback.
Внутренняя функция — эта функция рассчитана на использование самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
bool. Whether KSES restricts the value of any attribute of the element.
Использование
_wp_kses_restricts_attribute_values( $allowed_attributes ): bool;
- $allowed_attributes(массив|true|false) (обязательный)
- The attributes KSES allows on the element.
Список изменений
| С версии 7.1.4 | Введена. |
Код _wp_kses_restricts_attribute_values() wp kses restricts attribute values WP 7.1.4
function _wp_kses_restricts_attribute_values( $allowed_attributes ): bool {
if ( ! is_array( $allowed_attributes ) ) {
return false;
}
foreach ( $allowed_attributes as $attribute_rules ) {
if ( ! is_array( $attribute_rules ) ) {
continue;
}
foreach ( array_keys( $attribute_rules ) as $rule ) {
if ( ! in_array( strtolower( (string) $rule ), array( 'required', 'valueless' ), true ) ) {
return true;
}
}
}
return false;
}