wpcf7_enctype_value()
Returns an enctype attribute value.
Хуков нет.
Возвращает
Строку. Enctype value. Empty if not a valid enctype.
Использование
wpcf7_enctype_value( $enctype );
- $enctype(строка) (обязательный)
- Enctype value.
Код wpcf7_enctype_value() wpcf7 enctype value CF7 6.1.6
function wpcf7_enctype_value( $enctype ) {
$enctype = trim( $enctype );
if ( empty( $enctype ) ) {
return '';
}
$valid_enctypes = array(
'application/x-www-form-urlencoded',
'multipart/form-data',
'text/plain',
);
if ( in_array( $enctype, $valid_enctypes, true ) ) {
return $enctype;
}
$pattern = '%^enctype="(' . implode( '|', $valid_enctypes ) . ')"$%';
if ( preg_match( $pattern, $enctype, $matches ) ) {
return $matches[1]; // for back-compat
}
return '';
}