<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13314] trunk/wp-includes/wp-db.php: Docs and code convention cleanups.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13314">13314</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2010-02-22 22:53:54 +0000 (Mon, 22 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Docs and code convention cleanups. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a> props hakre</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludeswpdbphp">trunk/wp-includes/wp-db.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludeswpdbphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/wp-db.php (13313 => 13314)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/wp-db.php        2010-02-22 21:59:40 UTC (rev 13313)
+++ trunk/wp-includes/wp-db.php        2010-02-22 22:53:54 UTC (rev 13314)
</span><span class="lines">@@ -12,27 +12,27 @@
</span><span class="cx"> /**
</span><span class="cx"> * @since 0.71
</span><span class="cx"> */
</span><del>-define('EZSQL_VERSION', 'WP1.25');
</del><ins>+define( 'EZSQL_VERSION', 'WP1.25' );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * @since 0.71
</span><span class="cx"> */
</span><del>-define('OBJECT', 'OBJECT', true);
</del><ins>+define( 'OBJECT', 'OBJECT', true );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * @since {@internal Version Unknown}}
</span><span class="cx"> */
</span><del>-define('OBJECT_K', 'OBJECT_K', false);
</del><ins>+define( 'OBJECT_K', 'OBJECT_K', false );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * @since 0.71
</span><span class="cx"> */
</span><del>-define('ARRAY_A', 'ARRAY_A', false);
</del><ins>+define( 'ARRAY_A', 'ARRAY_A', false );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * @since 0.71
</span><span class="cx"> */
</span><del>-define('ARRAY_N', 'ARRAY_N', false);
</del><ins>+define( 'ARRAY_N', 'ARRAY_N', false );
</ins><span class="cx">
</span><span class="cx"> /**
</span><span class="cx"> * WordPress Database Access Abstraction Object
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">          * Whether to suppress errors during the DB bootstrapping.
</span><span class="cx">          *
</span><span class="cx">          * @access private
</span><del>-         * @since {@internal Version Unknown}}
</del><ins>+         * @since 2.5
</ins><span class="cx">          * @var bool
</span><span class="cx">          */
</span><span class="cx">         var $suppress_errors = false;
</span><span class="lines">@@ -73,7 +73,9 @@
</span><span class="cx">         /**
</span><span class="cx">          * The last error during query.
</span><span class="cx">          *
</span><del>-         * @since {@internal Version Unknown}}
</del><ins>+         * @see get_last_error()
+         * @since 2.5
+         * @access private
</ins><span class="cx">          * @var string
</span><span class="cx">          */
</span><span class="cx">         var $last_error = '';
</span><span class="lines">@@ -88,6 +90,22 @@
</span><span class="cx">         var $num_queries = 0;
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Count of rows returned by previous query
+         *
+         * @since 1.2
+         * @var int
+         */
+        var $num_rows = 0;
+
+        /**
+         * Count of affected rows by previous query
+         *
+         * @since 0.71
+         * @var int
+         */
+        var $rows_affected = 0;
+
+        /**
</ins><span class="cx">          * Saved result of the last query made
</span><span class="cx">          *
</span><span class="cx">          * @since 1.2.0
</span><span class="lines">@@ -97,6 +115,14 @@
</span><span class="cx">         var $last_query;
</span><span class="cx">
</span><span class="cx">         /**
</span><ins>+         * Results of the last query made
+         *
+         * @since {@internal Version Unknown}}
+         * @var mixed
+         */
+        var $last_result;
+
+        /**
</ins><span class="cx">          * Saved info on the table column
</span><span class="cx">          *
</span><span class="cx">          * @since 1.2.0
</span><span class="lines">@@ -135,7 +161,21 @@
</span><span class="cx">          * @var bool
</span><span class="cx">          */
</span><span class="cx">         var $ready = false;
</span><ins>+
+        /**
+         * {@internal Missing Description}}
+         *
+         * @since 3.0.0
+         * @var int
+         */
</ins><span class="cx">         var $blogid = 0;
</span><ins>+
+        /**
+         * {@internal Missing Description}}
+         *
+         * @since 3.0.0
+         * @var int
+         */
</ins><span class="cx">         var $siteid = 0;
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -251,6 +291,7 @@
</span><span class="cx">         /**
</span><span class="cx">          * List of deprecated WordPress tables
</span><span class="cx">          *
</span><ins>+         * @deprecated
</ins><span class="cx">          * @since 2.9.0
</span><span class="cx">          * @access private
</span><span class="cx">          * @see wpdb::tables()
</span><span class="lines">@@ -343,10 +384,10 @@
</span><span class="cx">         var $global_tables = array( 'users', 'usermeta' );
</span><span class="cx">
</span><span class="cx">         /**
</span><del>-         * Format specifiers for DB columns. Columns not listed here default to %s. Initialized in wp-settings.php.
</del><ins>+         * Format specifiers for DB columns. Columns not listed here default to %s. Initialized during WP load.
+         *
+         * Keys are column names, values are format types: 'ID' => '%d'
</ins><span class="cx">          *
</span><del>-         * Keys are colmn names, values are format types: 'ID' => '%d'
-         *
</del><span class="cx">          * @since 2.8.0
</span><span class="cx">          * @see wpdb:prepare()
</span><span class="cx">          * @see wpdb:insert()
</span><span class="lines">@@ -406,10 +447,10 @@
</span><span class="cx">          * @param string $dbname MySQL database name
</span><span class="cx">          * @param string $dbhost MySQL database host
</span><span class="cx">          */
</span><del>-        function wpdb($dbuser, $dbpassword, $dbname, $dbhost) {
</del><ins>+        function wpdb( $dbuser, $dbpassword, $dbname, $dbhost ) {
</ins><span class="cx">                 if( defined( 'WP_USE_MULTIPLE_DB' ) && WP_USE_MULTIPLE_DB )
</span><span class="cx">                         $this->db_connect();
</span><del>-                return $this->__construct($dbuser, $dbpassword, $dbname, $dbhost);
</del><ins>+                return $this->__construct( $dbuser, $dbpassword, $dbname, $dbhost );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -426,8 +467,8 @@
</span><span class="cx">          * @param string $dbname MySQL database name
</span><span class="cx">          * @param string $dbhost MySQL database host
</span><span class="cx">          */
</span><del>-        function __construct($dbuser, $dbpassword, $dbname, $dbhost) {
-                register_shutdown_function(array(&$this, "__destruct"));
</del><ins>+        function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
+                register_shutdown_function( array( &$this, '__destruct' ) );
</ins><span class="cx">
</span><span class="cx">                 if ( WP_DEBUG )
</span><span class="cx">                         $this->show_errors();
</span><span class="lines">@@ -442,14 +483,14 @@
</span><span class="cx">                         $this->collate = DB_COLLATE;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( defined('DB_CHARSET') )
</del><ins>+                if ( defined( 'DB_CHARSET' ) )
</ins><span class="cx">                         $this->charset = DB_CHARSET;
</span><span class="cx">
</span><span class="cx">                 $this->dbuser = $dbuser;
</span><span class="cx">
</span><del>-                $this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword, true);
-                if (!$this->dbh) {
-                        $this->bail(sprintf(/*WP_I18N_DB_CONN_ERROR*/"
</del><ins>+                $this->dbh = @mysql_connect( $dbhost, $dbuser, $dbpassword, true );
+                if ( !$this->dbh ) {
+                        $this->bail( sprintf( /*WP_I18N_DB_CONN_ERROR*/"
</ins><span class="cx"> <h1>Error establishing a database connection</h1>
</span><span class="cx"> <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>%s</code>. This could mean your host's database server is down.</p>
</span><span class="cx"> <ul>
</span><span class="lines">@@ -458,33 +499,32 @@
</span><span class="cx">         <li>Are you sure that the database server is running?</li>
</span><span class="cx"> </ul>
</span><span class="cx"> <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
</span><del>-"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost), 'db_connect_fail');
</del><ins>+"/*/WP_I18N_DB_CONN_ERROR*/, $dbhost ), 'db_connect_fail' );
</ins><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $this->ready = true;
</span><span class="cx">
</span><del>-                if ( $this->has_cap( 'collation' ) && !empty($this->charset) ) {
-                        if ( function_exists('mysql_set_charset') ) {
-                                mysql_set_charset($this->charset, $this->dbh);
</del><ins>+                if ( $this->has_cap( 'collation' ) && !empty( $this->charset ) ) {
+                        if ( function_exists( 'mysql_set_charset' ) ) {
+                                mysql_set_charset( $this->charset, $this->dbh );
</ins><span class="cx">                                 $this->real_escape = true;
</span><span class="cx">                         } else {
</span><del>-                                $collation_query = "SET NAMES '{$this->charset}'";
-                                if ( !empty($this->collate) )
-                                        $collation_query .= " COLLATE '{$this->collate}'";
-                                $this->query($collation_query);
</del><ins>+                                $query = $this->prepare( 'SET NAMES %s', $this->charset );
+                                if ( ! empty( $this->collate ) )
+                                        $query .= $this->prepare( ' COLLATE %s', $this->collate );
+                                $this->query( $query );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->select($dbname, $this->dbh);
</del><ins>+                $this->select( $dbname, $this->dbh );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="cx">          * PHP5 style destructor and will run when database object is destroyed.
</span><span class="cx">          *
</span><span class="cx">          * @since 2.0.8
</span><del>-         *
-         * @return bool Always true
</del><ins>+         * @return bool true
</ins><span class="cx">          */
</span><span class="cx">         function __destruct() {
</span><span class="cx">                 return true;
</span><span class="lines">@@ -503,13 +543,10 @@
</span><span class="cx">          */
</span><span class="cx">         function set_prefix( $prefix ) {
</span><span class="cx">
</span><del>-                if ( preg_match('|[^a-z0-9_]|i', $prefix) )
</del><ins>+                if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
</ins><span class="cx">                         return new WP_Error('invalid_db_prefix', /*WP_I18N_DB_BAD_PREFIX*/'Invalid database prefix'/*/WP_I18N_DB_BAD_PREFIX*/);
</span><span class="cx">
</span><del>-                if ( is_multisite() )
-                        $old_prefix = '';
-                else
-                        $old_prefix = $prefix;
</del><ins>+                $old_prefix = is_multisite() ? '' : $prefix;
</ins><span class="cx">
</span><span class="cx">                 if ( isset( $this->base_prefix ) )
</span><span class="cx">                         $old_prefix = $this->base_prefix;
</span><span class="lines">@@ -517,7 +554,7 @@
</span><span class="cx">                 foreach ( $this->tables( 'global' ) as $table )
</span><span class="cx">                         $this->$table = $prefix . $table;
</span><span class="cx">
</span><del>-                if ( defined('VHOST') && empty( $this->blogid ) )
</del><ins>+                if ( defined( 'VHOST' ) && empty( $this->blogid ) )
</ins><span class="cx">                         return $old_prefix;
</span><span class="cx">
</span><span class="cx">                 $this->prefix = $this->get_blog_prefix( $this->blogid );
</span><span class="lines">@@ -528,20 +565,29 @@
</span><span class="cx">                 foreach ( (array) $this->tables( 'old' ) as $table )
</span><span class="cx">                         $this->$table = $this->prefix . $table;
</span><span class="cx">
</span><del>-                if ( defined('CUSTOM_USER_TABLE') )
</del><ins>+                if ( defined( 'CUSTOM_USER_TABLE' ) )
</ins><span class="cx">                         $this->users = CUSTOM_USER_TABLE;
</span><span class="cx">
</span><del>-                if ( defined('CUSTOM_USER_META_TABLE') )
</del><ins>+                if ( defined( 'CUSTOM_USER_META_TABLE' ) )
</ins><span class="cx">                         $this->usermeta = CUSTOM_USER_META_TABLE;
</span><span class="cx">
</span><span class="cx">                 return $old_prefix;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function set_blog_id($blog_id, $site_id = '') {
-                if ( !empty($site_id) )
</del><ins>+        /**
+         * Sets blog id.
+         *
+         * @since 3.0.0
+         * @access public
+         * @param string $blog_id
+         * @param string $site_id. Optional.
+         * @return string previous blog id
+         */        
+        function set_blog_id( $blog_id, $site_id = '' ) {
+                if ( ! empty( $site_id ) )
</ins><span class="cx">                         $this->siteid = $site_id;
</span><span class="cx">
</span><del>-                $old_blog_id = $this->blogid;
</del><ins>+                $old_blog_id = $this->blogid;
</ins><span class="cx">                 $this->blogid = $blog_id;
</span><span class="cx">
</span><span class="cx">                 $this->prefix = $this->get_blog_prefix( $this->blogid );
</span><span class="lines">@@ -555,7 +601,15 @@
</span><span class="cx">                 return $old_blog_id;
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function get_blog_prefix( $blog_id = '' ) {
</del><ins>+        /**
+         * Gets blog prefix.
+         *
+         * @uses is_multisite()
+         * @since 3.0.0
+         * @param int $blog_id. Optional.
+         * @return string Blog prefix.
+         */
+        function get_blog_prefix( $blog_id = 0 ) {
</ins><span class="cx">                 if ( is_multisite() && $blog_id ) {
</span><span class="cx">                         if ( defined('MULTISITE') && ( $blog_id == 0 || $blog_id == 1 ) )
</span><span class="cx">                                 return $this->base_prefix;
</span><span class="lines">@@ -620,10 +674,10 @@
</span><span class="cx">          * @param string $db MySQL database name
</span><span class="cx">          * @return null Always null.
</span><span class="cx">          */
</span><del>-        function select($db, &$dbh) {
-                if (!@mysql_select_db($db, $dbh)) {
</del><ins>+        function select( $db, &$dbh ) {
+                if ( !@mysql_select_db( $db, $dbh ) ) {
</ins><span class="cx">                         $this->ready = false;
</span><del>-                        $this->bail(sprintf(/*WP_I18N_DB_SELECT_DB*/'
</del><ins>+                        $this->bail( sprintf( /*WP_I18N_DB_SELECT_DB*/'
</ins><span class="cx"> <h1>Can&#8217;t select database</h1>
</span><span class="cx"> <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>%1$s</code> database.</p>
</span><span class="cx"> <ul>
</span><span class="lines">@@ -631,24 +685,55 @@
</span><span class="cx"> <li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
</span><span class="cx"> <li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
</span><span class="cx"> </ul>
</span><del>-<p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser), 'db_select_fail');
</del><ins>+<p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, $this->dbuser ), 'db_select_fail' );
</ins><span class="cx">                         return;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function _weak_escape($string) {
-                return addslashes($string);
</del><ins>+        /**
+         * Weak escape
+         *
+         * @see addslashes()
+         * @since unknown
+         * @access private
+         *
+         * @param string $string
+         * @return string
+         */
+        function _weak_escape( $string ) {
+                return addslashes( $string );
</ins><span class="cx">         }
</span><span class="cx">
</span><del>-        function _real_escape($string) {
</del><ins>+        /**
+         * Real escape
+         *
+         * @see mysql_real_escape_string()
+         * @see addslashes()
+         * @since 2.8
+         * @access private
+         *
+         * @param string $string to escape
+         * @return string escaped
+         */
+        function _real_escape( $string ) {
</ins><span class="cx">                 if ( $this->dbh && $this->real_escape )
</span><span class="cx">                         return mysql_real_escape_string( $string, $this->dbh );
</span><span class="cx">                 else
</span><span class="cx">                         return addslashes( $string );
</span><span class="cx">         }
</span><span class="cx">
</span><del>-        function _escape($data) {
-                if ( is_array($data) ) {
</del><ins>+        /**
+         * Escape data.
+         *
+         * @see esc_sql()
+         * @since 2.8
+         * @access private
+         *
+         * @param string|array $data
+         * @return string|array escaped
+         */
+        function _escape( $data ) {
+                if ( is_array( $data ) ) {
</ins><span class="cx">                         foreach ( (array) $data as $k => $v ) {
</span><span class="cx">                                 if ( is_array($v) )
</span><span class="cx">                                         $data[$k] = $this->_escape( $v );
</span><span class="lines">@@ -667,13 +752,13 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><span class="cx">          *
</span><del>-         * @param string|array $data
-         * @return string query safe string
</del><ins>+         * @param string|array $data to escape
+         * @return string|array escaped as query safe string
</ins><span class="cx">          */
</span><del>-        function escape($data) {
-                if ( is_array($data) ) {
</del><ins>+        function escape( $data ) {
+                if ( is_array( $data ) ) {
</ins><span class="cx">                         foreach ( (array) $data as $k => $v ) {
</span><del>-                                if ( is_array($v) )
</del><ins>+                                if ( is_array( $v ) )
</ins><span class="cx">                                         $data[$k] = $this->escape( $v );
</span><span class="cx">                                 else
</span><span class="cx">                                         $data[$k] = $this->_weak_escape( $v );
</span><span class="lines">@@ -690,15 +775,25 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 2.3.0
</span><span class="cx">          *
</span><del>-         * @param string $s
</del><ins>+         * @param string $string to escape
+         * @return void
</ins><span class="cx">          */
</span><del>-        function escape_by_ref(&$string) {
</del><ins>+        function escape_by_ref( &$string ) {
</ins><span class="cx">                 $string = $this->_real_escape( $string );
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="cx">          * Prepares a SQL query for safe execution. Uses sprintf()-like syntax.
</span><span class="cx">          *
</span><ins>+         * The following directives can be used in the query format string:
+         * %d (decimal number)
+         * %s (string)
+         * %% (literal percentage sign - no argument needed)
+         *
+         * Both %d and %s are to be left unquoted in the query string and
+         * they need an argument passed for them. Literals (%) as parts of
+         * the query must be properly written as %%.
+         *
</ins><span class="cx">          * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string).
</span><span class="cx">          * Does not support sign, padding, alignment, width or precision specifiers.
</span><span class="cx">          * Does not support argument numbering/swapping.
</span><span class="lines">@@ -715,23 +810,27 @@
</span><span class="cx">          * @since 2.3.0
</span><span class="cx">          *
</span><span class="cx">          * @param string $query Query statement with sprintf()-like placeholders
</span><del>-         * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-         * @param mixed $args,... further variables to substitute into the query's placeholders if being called like {@link http://php.net/sprintf sprintf()}.
-         * @return null|string Sanitized query string
</del><ins>+         * @param array|mixed $args The array of variables to substitute into the query's placeholders if being called like
+         *         {@link http://php.net/vsprintf vsprintf()}, or the first variable to substitute into the query's placeholders if
+         *         being called like {@link http://php.net/sprintf sprintf()}.
+         * @param mixed $args,... further variables to substitute into the query's placeholders if being called like
+         *         {@link http://php.net/sprintf sprintf()}.
+         * @return null|false|string Sanitized query string, null if there is no query, false if there is an error and string
+         *         if there was something to prepare
</ins><span class="cx">          */
</span><del>-        function prepare($query = null) { // ( $query, *$args )
</del><ins>+        function prepare( $query = null ) { // ( $query, *$args )
</ins><span class="cx">                 if ( is_null( $query ) )
</span><span class="cx">                         return;
</span><span class="cx">                 $args = func_get_args();
</span><del>-                array_shift($args);
</del><ins>+                array_shift( $args );
</ins><span class="cx">                 // If args were passed as an array (as in vsprintf), move them up
</span><del>-                if ( isset($args[0]) && is_array($args[0]) )
</del><ins>+                if ( isset( $args[0] ) && is_array($args[0]) )
</ins><span class="cx">                         $args = $args[0];
</span><del>-                $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
-                array_walk($args, array(&$this, 'escape_by_ref'));
-                return @vsprintf($query, $args);
</del><ins>+                $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
+                array_walk( $args, array( &$this, 'escape_by_ref' ) );
+                return @vsprintf( $query, $args );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -743,11 +842,12 @@
</span><span class="cx">          * @param string $str The error to display
</span><span class="cx">          * @return bool False if the showing of errors is disabled.
</span><span class="cx">          */
</span><del>-        function print_error($str = '') {
</del><ins>+        function print_error( $str = '' ) {
</ins><span class="cx">                 global $EZSQL_ERROR;
</span><span class="cx">
</span><del>-                if (!$str) $str = mysql_error($this->dbh);
-                $EZSQL_ERROR[] = array ('query' => $this->last_query, 'error_str' => $str);
</del><ins>+                if ( !$str )
+                        $str = mysql_error( $this->dbh );
+                $EZSQL_ERROR[] = array( 'query' => $this->last_query, 'error_str' => $str );
</ins><span class="cx">
</span><span class="cx">                 if ( $this->suppress_errors )
</span><span class="cx">                         return false;
</span><span class="lines">@@ -780,8 +880,8 @@
</span><span class="cx">                         if ( defined( 'DIEONDBERROR' ) )
</span><span class="cx">                                 die( $msg );
</span><span class="cx">                 } else {
</span><del>-                        $str = htmlspecialchars($str, ENT_QUOTES);
-                        $query = htmlspecialchars($this->last_query, ENT_QUOTES);
</del><ins>+                        $str = htmlspecialchars( $str, ENT_QUOTES );
+                        $query = htmlspecialchars( $this->last_query, ENT_QUOTES );
</ins><span class="cx">
</span><span class="cx">                         print "<div id='error'>
</span><span class="cx">                         <p class='wpdberror'><strong>WordPress database error:</strong> [$str]<br />
</span><span class="lines">@@ -799,6 +899,7 @@
</span><span class="cx">          * errors.
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><ins>+         * @see wpdb::hide_errors()
</ins><span class="cx">          *
</span><span class="cx">          * @param bool $show Whether to show or hide errors
</span><span class="cx">          * @return bool Old value for showing errors.
</span><span class="lines">@@ -812,7 +913,10 @@
</span><span class="cx">         /**
</span><span class="cx">          * Disables showing of database errors.
</span><span class="cx">          *
</span><ins>+         * By default database errors are not shown.
+         *
</ins><span class="cx">          * @since 0.71
</span><ins>+         * @see wpdb::show_errors()
</ins><span class="cx">          *
</span><span class="cx">          * @return bool Whether showing of errors was active or not
</span><span class="cx">          */
</span><span class="lines">@@ -825,12 +929,17 @@
</span><span class="cx">         /**
</span><span class="cx">          * Whether to suppress database errors.
</span><span class="cx">          *
</span><del>-         * @param unknown_type $suppress
-         * @return unknown
</del><ins>+         * By default database errors are suppressed, with a simple
+         * call to this function they can be enabled.
+         *
+         * @since 2.5
+         * @see wpdb::hide_errors()
+         * @param bool $suppress Optional. New value. Defaults to true.
+         * @return bool Old value
</ins><span class="cx">          */
</span><span class="cx">         function suppress_errors( $suppress = true ) {
</span><span class="cx">                 $errors = $this->suppress_errors;
</span><del>-                $this->suppress_errors = $suppress;
</del><ins>+                $this->suppress_errors = (bool) $suppress;
</ins><span class="cx">                 return $errors;
</span><span class="cx">         }
</span><span class="cx">
</span><span class="lines">@@ -838,16 +947,17 @@
</span><span class="cx">          * Kill cached query results.
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><ins>+         * @return void
</ins><span class="cx">          */
</span><span class="cx">         function flush() {
</span><span class="cx">                 $this->last_result = array();
</span><del>-                $this->col_info = null;
-                $this->last_query = null;
</del><ins>+                $this->col_info = null;
+                $this->last_query = null;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function db_connect( $query = "SELECT" ) {
</span><span class="cx">                 global $db_list, $global_db_list;
</span><del>-                if ( is_array( $db_list ) == false )
</del><ins>+                if ( ! is_array( $db_list ) )
</ins><span class="cx">                         return true;
</span><span class="cx">
</span><span class="cx">                 if ( $this->blogs != '' && preg_match("/(" . $this->blogs . "|" . $this->users . "|" . $this->usermeta . "|" . $this->site . "|" . $this->sitemeta . "|" . $this->sitecategories . ")/i",$query) ) {
</span><span class="lines">@@ -867,7 +977,7 @@
</span><span class="cx">                 $dbhname = "dbh" . $action;
</span><span class="cx">                 $this->$dbhname = @mysql_connect( $details[ 'db_host' ], $details[ 'db_user' ], $details[ 'db_password' ] );
</span><span class="cx">                 if (!$this->$dbhname ) {
</span><del>-                        $this->bail("
</del><ins>+                        $this->bail(/*WP_I18N_DB_CONNECT_DB*/"
</ins><span class="cx"> <h1>Error establishing a database connection</h1>
</span><span class="cx"> <p>This either means that the username and password information in your <code>wp-config.php</code> file is incorrect or we can't contact the database server at <code>{$details['db_host']}</code>. This could mean your host's database server is down.</p>
</span><span class="cx"> <ul>
</span><span class="lines">@@ -876,7 +986,7 @@
</span><span class="cx">         <li>Are you sure that the database server is running?</li>
</span><span class="cx"> </ul>
</span><span class="cx"> <p>If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the <a href='http://wordpress.org/support/'>WordPress Support Forums</a>.</p>
</span><del>-");
</del><ins>+"/*/WP_I18N_DB_CONNECT_DB*/);
</ins><span class="cx">                 }
</span><span class="cx">                 $this->select( $details[ 'db_name' ], $this->$dbhname );
</span><span class="cx">         }
</span><span class="lines">@@ -888,19 +998,19 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><span class="cx">          *
</span><del>-         * @param string $query
</del><ins>+         * @param string $query Database query
</ins><span class="cx">          * @return int|false Number of rows affected/selected or false on error
</span><span class="cx">          */
</span><del>-        function query($query) {
</del><ins>+        function query( $query ) {
</ins><span class="cx">                 if ( ! $this->ready )
</span><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 // filter the query, if filters are available
</span><span class="cx">                 // NOTE: some queries are made before the plugins have been loaded, and thus cannot be filtered with this method
</span><del>-                if ( function_exists('apply_filters') )
-                        $query = apply_filters('query', $query);
</del><ins>+                if ( function_exists( 'apply_filters' ) )
+                        $query = apply_filters( 'query', $query );
</ins><span class="cx">
</span><del>-                // initialise return
</del><ins>+                // initialize return
</ins><span class="cx">                 $return_val = 0;
</span><span class="cx">                 $this->flush();
</span><span class="cx">
</span><span class="lines">@@ -910,8 +1020,7 @@
</span><span class="cx">                 // Keep track of the last query for debug..
</span><span class="cx">                 $this->last_query = $query;
</span><span class="cx">
</span><del>-                // Perform the query via std mysql_query function..
-                if ( defined('SAVEQUERIES') && SAVEQUERIES )
</del><ins>+                if ( defined( 'SAVEQUERIES' ) && SAVEQUERIES )
</ins><span class="cx">                         $this->timer_start();
</span><span class="cx">
</span><span class="cx">                 // use $this->dbh for read ops, and $this->dbhwrite for write ops
</span><span class="lines">@@ -939,45 +1048,44 @@
</span><span class="cx">                         $this->last_db_used = "other/read";
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->result = @mysql_query($query, $dbh);
</del><ins>+                $this->result = @mysql_query( $query, $dbh );
</ins><span class="cx">                 ++$this->num_queries;
</span><span class="cx">
</span><span class="cx">                 if ( defined('SAVEQUERIES') && SAVEQUERIES )
</span><span class="cx">                         $this->queries[] = array( $query, $this->timer_stop(), $this->get_caller() );
</span><span class="cx">
</span><span class="cx">                 // If there is an error then take note of it..
</span><del>-                if ( $this->last_error = mysql_error($dbh) ) {
</del><ins>+                if ( $this->last_error = mysql_error( $dbh ) ) {
</ins><span class="cx">                         $this->print_error();
</span><span class="cx">                         return false;
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) {
-                        $this->rows_affected = mysql_affected_rows($dbh);
</del><ins>+                if ( preg_match( "/^\\s*(insert|delete|update|replace|alter) /i", $query ) ) {
+                        $this->rows_affected = mysql_affected_rows( $dbh );
</ins><span class="cx">                         // Take note of the insert_id
</span><del>-                        if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
</del><ins>+                        if ( preg_match( "/^\\s*(insert|replace) /i", $query ) ) {
</ins><span class="cx">                                 $this->insert_id = mysql_insert_id($dbh);
</span><span class="cx">                         }
</span><span class="cx">                         // Return number of rows affected
</span><span class="cx">                         $return_val = $this->rows_affected;
</span><span class="cx">                 } else {
</span><span class="cx">                         $i = 0;
</span><del>-                        while ($i < @mysql_num_fields($this->result)) {
-                                $this->col_info[$i] = @mysql_fetch_field($this->result);
</del><ins>+                        while ( $i < @mysql_num_fields( $this->result ) ) {
+                                $this->col_info[$i] = @mysql_fetch_field( $this->result );
</ins><span class="cx">                                 $i++;
</span><span class="cx">                         }
</span><span class="cx">                         $num_rows = 0;
</span><del>-                        while ( $row = @mysql_fetch_object($this->result) ) {
</del><ins>+                        while ( $row = @mysql_fetch_object( $this->result ) ) {
</ins><span class="cx">                                 $this->last_result[$num_rows] = $row;
</span><span class="cx">                                 $num_rows++;
</span><span class="cx">                         }
</span><span class="cx">
</span><del>-                        @mysql_free_result($this->result);
</del><ins>+                        @mysql_free_result( $this->result );
</ins><span class="cx">
</span><span class="cx">                         // Log number of rows the query returned
</span><ins>+                        // and return number of rows selected
</ins><span class="cx">                         $this->num_rows = $num_rows;
</span><del>-
-                        // Return number of rows selected
-                        $return_val = $this->num_rows;
</del><ins>+                        $return_val = $num_rows;
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 return $return_val;
</span><span class="lines">@@ -998,21 +1106,21 @@
</span><span class="cx">          * @param array|string $format (optional) An array of formats to be mapped to each of the value in $data. If string, that format will be used for all of the values in $data. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $data will be treated as strings.
</span><span class="cx">          * @return int|false The number of rows inserted, or false on error.
</span><span class="cx">          */
</span><del>-        function insert($table, $data, $format = null) {
</del><ins>+        function insert( $table, $data, $format = null ) {
</ins><span class="cx">                 $formats = $format = (array) $format;
</span><del>-                $fields = array_keys($data);
</del><ins>+                $fields = array_keys( $data );
</ins><span class="cx">                 $formatted_fields = array();
</span><span class="cx">                 foreach ( $fields as $field ) {
</span><del>-                        if ( !empty($format) )
-                                $form = ( $form = array_shift($formats) ) ? $form : $format[0];
-                        elseif ( isset($this->field_types[$field]) )
</del><ins>+                        if ( !empty( $format ) )
+                                $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
+                        elseif ( isset( $this->field_types[$field] ) )
</ins><span class="cx">                                 $form = $this->field_types[$field];
</span><span class="cx">                         else
</span><span class="cx">                                 $form = '%s';
</span><span class="cx">                         $formatted_fields[] = $form;
</span><span class="cx">                 }
</span><span class="cx">                 $sql = "INSERT INTO `$table` (`" . implode( '`,`', $fields ) . "`) VALUES ('" . implode( "','", $formatted_fields ) . "')";
</span><del>-                return $this->query( $this->prepare( $sql, $data) );
</del><ins>+                return $this->query( $this->prepare( $sql, $data ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">
</span><span class="lines">@@ -1033,15 +1141,15 @@
</span><span class="cx">          * @param array|string $format_where (optional) An array of formats to be mapped to each of the values in $where. If string, that format will be used for all of the items in $where. A format is one of '%d', '%s' (decimal number, string). If omitted, all values in $where will be treated as strings.
</span><span class="cx">          * @return int|false The number of rows updated, or false on error.
</span><span class="cx">          */
</span><del>-        function update($table, $data, $where, $format = null, $where_format = null) {
-                if ( !is_array( $where ) )
</del><ins>+        function update( $table, $data, $where, $format = null, $where_format = null ) {
+                if ( ! is_array( $where ) )
</ins><span class="cx">                         return false;
</span><span class="cx">
</span><span class="cx">                 $formats = $format = (array) $format;
</span><span class="cx">                 $bits = $wheres = array();
</span><del>-                foreach ( (array) array_keys($data) as $field ) {
-                        if ( !empty($format) )
-                                $form = ( $form = array_shift($formats) ) ? $form : $format[0];
</del><ins>+                foreach ( (array) array_keys( $data ) as $field ) {
+                        if ( !empty( $format ) )
+                                $form = ( $form = array_shift( $formats ) ) ? $form : $format[0];
</ins><span class="cx">                         elseif ( isset($this->field_types[$field]) )
</span><span class="cx">                                 $form = $this->field_types[$field];
</span><span class="cx">                         else
</span><span class="lines">@@ -1050,10 +1158,10 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $where_formats = $where_format = (array) $where_format;
</span><del>-                foreach ( (array) array_keys($where) as $field ) {
-                        if ( !empty($where_format) )
-                                $form = ( $form = array_shift($where_formats) ) ? $form : $where_format[0];
-                        elseif ( isset($this->field_types[$field]) )
</del><ins>+                foreach ( (array) array_keys( $where ) as $field ) {
+                        if ( !empty( $where_format ) )
+                                $form = ( $form = array_shift( $where_formats ) ) ? $form : $where_format[0];
+                        elseif ( isset( $this->field_types[$field] ) )
</ins><span class="cx">                                 $form = $this->field_types[$field];
</span><span class="cx">                         else
</span><span class="cx">                                 $form = '%s';
</span><span class="lines">@@ -1061,7 +1169,7 @@
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $sql = "UPDATE `$table` SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres );
</span><del>-                return $this->query( $this->prepare( $sql, array_merge(array_values($data), array_values($where))) );
</del><ins>+                return $this->query( $this->prepare( $sql, array_merge( array_values( $data ), array_values( $where ) ) ) );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -1073,23 +1181,23 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><span class="cx">          *
</span><del>-         * @param string|null $query SQL query. If null, use the result from the previous query.
</del><ins>+         * @param string|null $query Optional. SQL query. If null (default), uses the result from the previous query.
</ins><span class="cx">          * @param int $x (optional) Column of value to return. Indexed from 0.
</span><span class="cx">          * @param int $y (optional) Row of value to return. Indexed from 0.
</span><del>-         * @return string Database query result
</del><ins>+         * @return string|null Database query result, or null on failure
</ins><span class="cx">          */
</span><del>-        function get_var($query=null, $x = 0, $y = 0) {
-                $this->func_call = "\$db->get_var(\"$query\",$x,$y)";
</del><ins>+        function get_var( $query = null, $x = 0, $y = 0 ) {
+                $this->func_call = "\$db->get_var(\"$query\", $x, $y)";
</ins><span class="cx">                 if ( $query )
</span><del>-                        $this->query($query);
</del><ins>+                        $this->query( $query );
</ins><span class="cx">
</span><span class="cx">                 // Extract var out of cached results based x,y vals
</span><span class="cx">                 if ( !empty( $this->last_result[$y] ) ) {
</span><del>-                        $values = array_values(get_object_vars($this->last_result[$y]));
</del><ins>+                        $values = array_values( get_object_vars( $this->last_result[$y] ) );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 // If there is a value return it else return null
</span><del>-                return (isset($values[$x]) && $values[$x]!=='') ? $values[$x] : null;
</del><ins>+                return ( isset( $values[$x] ) && $values[$x] !== '' ) ? $values[$x] : null;
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -1102,24 +1210,24 @@
</span><span class="cx">          * @param string|null $query SQL query.
</span><span class="cx">          * @param string $output (optional) one of ARRAY_A | ARRAY_N | OBJECT constants. Return an associative array (column => value, ...), a numerically indexed array (0 => value, ...) or an object ( ->column = value ), respectively.
</span><span class="cx">          * @param int $y (optional) Row to return. Indexed from 0.
</span><del>-         * @return mixed Database query result in format specifed by $output
</del><ins>+         * @return mixed Database query result in format specifed by $output or null on failure
</ins><span class="cx">          */
</span><del>-        function get_row($query = null, $output = OBJECT, $y = 0) {
</del><ins>+        function get_row( $query = null, $output = OBJECT, $y = 0 ) {
</ins><span class="cx">                 $this->func_call = "\$db->get_row(\"$query\",$output,$y)";
</span><span class="cx">                 if ( $query )
</span><del>-                        $this->query($query);
</del><ins>+                        $this->query( $query );
</ins><span class="cx">                 else
</span><span class="cx">                         return null;
</span><span class="cx">
</span><del>-                if ( !isset($this->last_result[$y]) )
</del><ins>+                if ( !isset( $this->last_result[$y] ) )
</ins><span class="cx">                         return null;
</span><span class="cx">
</span><span class="cx">                 if ( $output == OBJECT ) {
</span><span class="cx">                         return $this->last_result[$y] ? $this->last_result[$y] : null;
</span><span class="cx">                 } elseif ( $output == ARRAY_A ) {
</span><del>-                        return $this->last_result[$y] ? get_object_vars($this->last_result[$y]) : null;
</del><ins>+                        return $this->last_result[$y] ? get_object_vars( $this->last_result[$y] ) : null;
</ins><span class="cx">                 } elseif ( $output == ARRAY_N ) {
</span><del>-                        return $this->last_result[$y] ? array_values(get_object_vars($this->last_result[$y])) : null;
</del><ins>+                        return $this->last_result[$y] ? array_values( get_object_vars( $this->last_result[$y] ) ) : null;
</ins><span class="cx">                 } else {
</span><span class="cx">                         $this->print_error(/*WP_I18N_DB_GETROW_ERROR*/" \$db->get_row(string query, output type, int offset) -- Output type must be one of: OBJECT, ARRAY_A, ARRAY_N"/*/WP_I18N_DB_GETROW_ERROR*/);
</span><span class="cx">                 }
</span><span class="lines">@@ -1134,18 +1242,18 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><span class="cx">          *
</span><del>-         * @param string|null $query SQL query. If null, use the result from the previous query.
-         * @param int $x Column to return. Indexed from 0.
-         * @return array Database query result. Array indexed from 0 by SQL result row number.
</del><ins>+         * @param string|null $query Optional. SQL query. If null (default), use the result from the previous query.
+         * @param int $x Optional. Column to return. Indexed from 0.
+         * @return array Database query result. Array indexed from 0 by SQL result row number.
</ins><span class="cx">          */
</span><del>-        function get_col($query = null , $x = 0) {
</del><ins>+        function get_col( $query = null , $x = 0 ) {
</ins><span class="cx">                 if ( $query )
</span><del>-                        $this->query($query);
</del><ins>+                        $this->query( $query );
</ins><span class="cx">
</span><span class="cx">                 $new_array = array();
</span><span class="cx">                 // Extract the column values
</span><del>-                for ( $i=0; $i < count($this->last_result); $i++ ) {
-                        $new_array[$i] = $this->get_var(null, $x, $i);
</del><ins>+                for ( $i=0; $i < count( $this->last_result ); $i++ ) {
+                        $new_array[$i] = $this->get_var( null, $x, $i );
</ins><span class="cx">                 }
</span><span class="cx">                 return $new_array;
</span><span class="cx">         }
</span><span class="lines">@@ -1161,11 +1269,11 @@
</span><span class="cx">          * @param string $output (optional) ane of ARRAY_A | ARRAY_N | OBJECT | OBJECT_K constants. With one of the first three, return an array of rows indexed from 0 by SQL result row number. Each row is an associative array (column => value, ...), a numerically indexed array (0 => value, ...), or an object. ( ->column = value ), respectively. With OBJECT_K, return an associative array of row objects keyed by the value of each row's first column's value. Duplicate keys are discarded.
</span><span class="cx">          * @return mixed Database query results
</span><span class="cx">          */
</span><del>-        function get_results($query = null, $output = OBJECT) {
</del><ins>+        function get_results( $query = null, $output = OBJECT ) {
</ins><span class="cx">                 $this->func_call = "\$db->get_results(\"$query\", $output)";
</span><span class="cx">
</span><span class="cx">                 if ( $query )
</span><del>-                        $this->query($query);
</del><ins>+                        $this->query( $query );
</ins><span class="cx">                 else
</span><span class="cx">                         return null;
</span><span class="cx">
</span><span class="lines">@@ -1206,14 +1314,14 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 0.71
</span><span class="cx">          *
</span><del>-         * @param string $info_type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
-         * @param int $col_offset 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
</del><ins>+         * @param string $info_type Optional. Type one of name, table, def, max_length, not_null, primary_key, multiple_key, unique_key, numeric, blob, type, unsigned, zerofill
+         * @param int $col_offset Optional. 0: col name. 1: which table the col's in. 2: col's max length. 3: if the col is numeric. 4: col's type
</ins><span class="cx">          * @return mixed Column Results
</span><span class="cx">          */
</span><del>-        function get_col_info($info_type = 'name', $col_offset = -1) {
</del><ins>+        function get_col_info( $info_type = 'name', $col_offset = -1 ) {
</ins><span class="cx">                 if ( $this->col_info ) {
</span><span class="cx">                         if ( $col_offset == -1 ) {
</span><del>-                                $i = 0;
</del><ins>+                                $i = 0;
</ins><span class="cx">                                 $new_array = array();
</span><span class="cx">                                 foreach( (array) $this->col_info as $col ) {
</span><span class="cx">                                         $new_array[$i] = $col->{$info_type};
</span><span class="lines">@@ -1234,8 +1342,7 @@
</span><span class="cx">          * @return true
</span><span class="cx">          */
</span><span class="cx">         function timer_start() {
</span><del>-                $mtime = microtime();
-                $mtime = explode(' ', $mtime);
</del><ins>+                $mtime = explode( ' ', microtime() );
</ins><span class="cx">                 $this->time_start = $mtime[1] + $mtime[0];
</span><span class="cx">                 return true;
</span><span class="cx">         }
</span><span class="lines">@@ -1248,9 +1355,8 @@
</span><span class="cx">          * @return int Total time spent on the query, in milliseconds
</span><span class="cx">          */
</span><span class="cx">         function timer_stop() {
</span><del>-                $mtime = microtime();
-                $mtime = explode(' ', $mtime);
-                $time_end = $mtime[1] + $mtime[0];
</del><ins>+                $mtime = explode( ' ', microtime() );
+                $time_end = $mtime[1] + $mtime[0];
</ins><span class="cx">                 $time_total = $time_end - $this->time_start;
</span><span class="cx">                 return $time_total;
</span><span class="cx">         }
</span><span class="lines">@@ -1266,9 +1372,9 @@
</span><span class="cx">          * @param string $error_code (optional) A Computer readable string to identify the error.
</span><span class="cx">          * @return false|void
</span><span class="cx">          */
</span><del>-        function bail($message, $error_code = '500') {
</del><ins>+        function bail( $message, $error_code = '500' ) {
</ins><span class="cx">                 if ( !$this->show_errors ) {
</span><del>-                        if ( class_exists('WP_Error') )
</del><ins>+                        if ( class_exists( 'WP_Error' ) )
</ins><span class="cx">                                 $this->error = new WP_Error($error_code, $message);
</span><span class="cx">                         else
</span><span class="cx">                                 $this->error = $message;
</span><span class="lines">@@ -1282,6 +1388,7 @@
</span><span class="cx">          *
</span><span class="cx">          * @since 2.5.0
</span><span class="cx">          * @uses $wp_version
</span><ins>+         * @uses $required_mysql_version
</ins><span class="cx">          *
</span><span class="cx">          * @return WP_Error
</span><span class="cx">          */
</span><span class="lines">@@ -1289,7 +1396,7 @@
</span><span class="cx">                 global $wp_version, $required_mysql_version;
</span><span class="cx">                 // Make sure the server has the required MySQL version
</span><span class="cx">                 if ( version_compare($this->db_version(), $required_mysql_version, '<') )
</span><del>-                        return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher'), $wp_version, $required_mysql_version));
</del><ins>+                        return new WP_Error('database_version', sprintf( __( '<strong>ERROR</strong>: WordPress %1$s requires MySQL %2$s or higher' ), $wp_version, $required_mysql_version ));
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -1306,21 +1413,25 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><del>-         * Generic function to determine if a database supports a particular feature
</del><ins>+         * Determine if a database supports a particular feature
+         *
+         * @since 2.7
+         * @see wpdb::db_version()
+         *
</ins><span class="cx">          * @param string $db_cap the feature
</span><del>-         * @param false|string|resource $dbh_or_table (not implemented) Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
</del><ins>+         * @param false|string|resource $dbh_or_table. Not implemented.
+         *         Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
</ins><span class="cx">          * @return bool
</span><span class="cx">          */
</span><span class="cx">         function has_cap( $db_cap ) {
</span><span class="cx">                 $version = $this->db_version();
</span><span class="cx">
</span><del>-                switch ( strtolower( $db_cap ) ) :
-                case 'collation' : // @since 2.5.0
-                case 'group_concat' : // @since 2.7
-                case 'subqueries' : // @since 2.7
-                        return version_compare($version, '4.1', '>=');
-                        break;
-                endswitch;
</del><ins>+                switch ( strtolower( $db_cap ) ) {
+                        case 'collation' : // @since 2.5.0
+                        case 'group_concat' : // @since 2.7
+                        case 'subqueries' : // @since 2.7
+                                return version_compare( $version, '4.1', '>=' );
+                };
</ins><span class="cx">
</span><span class="cx">                 return false;
</span><span class="cx">         }
</span><span class="lines">@@ -1355,11 +1466,12 @@
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="cx">          * The database version number
</span><del>-         * @param false|string|resource $dbh_or_table (not implemented) Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
</del><ins>+         * @param false|string|resource $dbh_or_table. Not implemented.
+         *         Which database to test. False = the currently selected database, string = the database containing the specified table, resource = the database corresponding to the specified mysql resource.
</ins><span class="cx">          * @return false|string false on failure, version number on success
</span><span class="cx">          */
</span><span class="cx">         function db_version() {
</span><del>-                return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ));
</del><ins>+                return preg_replace( '/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ) );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>