From 34d455832de8a152a920951f1270540c35f82a83 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 5 Mar 2009 22:15:17 +0000 Subject: [PATCH] Allow passing sustitution args to prepare() as an array. Makes building queries for prepare easier. git-svn-id: http://svn.automattic.com/wordpress/trunk@10721 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/wp-db.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wp-includes/wp-db.php b/wp-includes/wp-db.php index 518c36471..1d45d6c3d 100644 --- a/wp-includes/wp-db.php +++ b/wp-includes/wp-db.php @@ -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