Strips any invalid characters from the string for a given table and column.
Parameters
$table
stringrequired- Table name.
$column
stringrequired- Column name.
$value
stringrequired- The text to check.
Source
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'];
}
Changelog
Version | Description |
---|---|
4.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.