wpdb::strip_invalid_text_for_column() public WP 4.2.0
Strips any invalid characters from the string for a given table and column.
{} Это метод класса: wpdb{}
Хуков нет.
Возвращает
Строку/WP_Error. The converted string, or a WP_Error object if the conversion fails.
Использование
global $wpdb; $wpdb->strip_invalid_text_for_column( $table, $column, $value );
- $table(строка) (обязательный)
- Table name.
- $column(строка) (обязательный)
- Column name.
- $value(строка) (обязательный)
- The text to check.
Список изменений
С версии 4.2.0 | Введена. |
Код wpdb::strip_invalid_text_for_column() wpdb::strip invalid text for column WP 5.6.2
public function strip_invalid_text_for_column( $table, $column, $value ) {
if ( ! is_string( $value ) ) {
return $value;
}
$charset = $this->get_col_charset( $table, $column );
if ( ! $charset ) {
// Not a string column.
return $value;
} elseif ( is_wp_error( $charset ) ) {
// Bail on real errors.
return $charset;
}
$data = array(
$column => array(
'value' => $value,
'charset' => $charset,
'length' => $this->get_col_length( $table, $column ),
),
);
$data = $this->strip_invalid_text( $data );
if ( is_wp_error( $data ) ) {
return $data;
}
return $data[ $column ]['value'];
}