You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$results = $wpdb->get_results( "SELECT {$primary_key_sql}{$column} FROM {$table}" );
899
+
$results = $wpdb->get_results( "SELECT {$primary_key_sql}{$column_sql} FROM {$table_sql}" );
898
900
} else {
899
-
$results = $wpdb->get_results( $wpdb->prepare( "SELECT {$primary_key_sql}{$column} FROM {$table} WHERE {$column} LIKE %s;", $esc_like_search ) );
901
+
$results = $wpdb->get_results( $wpdb->prepare( "SELECT {$primary_key_sql}{$column_sql} FROM {$table_sql} WHERE {$column_sql} LIKE %s;", $esc_like_search ) );
900
902
}
901
903
if ( $results ) {
902
904
$row_count += count( $results );
@@ -966,12 +968,12 @@ public function search( $args, $assoc_args ) {
* Escapes (backticks) MySQL identifiers (aka schema object names) - i.e. column names, table names, and database/index/alias/view etc names.
1066
+
* See https://dev.mysql.com/doc/refman/5.5/en/identifiers.html
1067
+
*
1068
+
* @param string|array $idents A single identifier or an array of identifiers.
1069
+
* @return string|array An escaped string if given a string, or an array of escaped strings if given an array of strings.
1070
+
*/
1071
+
privatestaticfunctionesc_sql_ident( $idents ) {
1072
+
$backtick = function ( $v ) {
1073
+
// Escape any backticks in the identifier by doubling.
1074
+
return'`' . str_replace( '`', '``', $v ) . '`';
1075
+
};
1076
+
if ( is_string( $idents ) ) {
1077
+
return$backtick( $idents );
1078
+
}
1079
+
returnarray_map( $backtick, $idents );
1080
+
}
1081
+
1061
1082
/**
1062
1083
* Gets the color codes from the options if any, and returns the passed in array colorized with 2 elements per entry, a color code (or '') and a reset (or '').
0 commit comments