Adds field charsets to field/value/format arrays generated by wpdb::process_field_formats().
Parameters
$dataarrayrequired- Array of values and formats keyed by their field names, as it comes from the wpdb::process_field_formats() method.
...$0arrayValue and format for this field.valuemixedThe value to be formatted.formatstringThe format to be mapped to the value.
$tablestringrequired- Table name.
Source
protected function process_field_charsets( $data, $table ) {
foreach ( $data as $field => $value ) {
if ( '%d' === $value['format'] || '%f' === $value['format'] ) {
/*
* We can skip this field if we know it isn't a string.
* This checks %d/%f versus ! %s because its sprintf() could take more.
*/
$value['charset'] = false;
} else {
$value['charset'] = $this->get_col_charset( $table, $field );
if ( is_wp_error( $value['charset'] ) ) {
return false;
}
}
$data[ $field ] = $value;
}
return $data;
}
Changelog
| Version | Description |
|---|---|
| 4.2.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.