Allow passing sustitution args to prepare() as an array. Makes building queries for prepare easier.

git-svn-id: https://develop.svn.wordpress.org/trunk@10721 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2009-03-05 22:15:17 +00:00
parent 125fa7591b
commit a3ff3cdbf2
1 changed files with 3 additions and 0 deletions

View File

@ -502,6 +502,9 @@ class wpdb {
return;
$args = func_get_args();
$query = array_shift($args);
// If args were passed as an array, move them up
if ( is_array($args[0]) )
$args = $args[0];
$query = str_replace("'%s'", '%s', $query); // in case someone mistakenly already singlequoted it
$query = str_replace('"%s"', '%s', $query); // doublequote unquoting
$query = str_replace('%s', "'%s'", $query); // quote the strings