Changeset 14058 for trunk/wp-includes/wp-db.php
- Timestamp:
- 04/10/2010 12:39:25 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-db.php
r13949 r14058 23 23 * @since 2.5.0 24 24 */ 25 define( 'OBJECT_K', 'OBJECT_K' , false);25 define( 'OBJECT_K', 'OBJECT_K' ); 26 26 27 27 /** 28 28 * @since 0.71 29 29 */ 30 define( 'ARRAY_A', 'ARRAY_A' , false);30 define( 'ARRAY_A', 'ARRAY_A' ); 31 31 32 32 /** 33 33 * @since 0.71 34 34 */ 35 define( 'ARRAY_N', 'ARRAY_N' , false);35 define( 'ARRAY_N', 'ARRAY_N' ); 36 36 37 37 /** … … 579 579 return $old_prefix; 580 580 581 $this->prefix = $this->get_blog_prefix( $this->blogid);581 $this->prefix = $this->get_blog_prefix(); 582 582 583 583 foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) … … 606 606 $this->blogid = $blog_id; 607 607 608 $this->prefix = $this->get_blog_prefix( $this->blogid);608 $this->prefix = $this->get_blog_prefix(); 609 609 610 610 foreach ( $this->tables( 'blog' ) as $table => $prefixed_table ) … … 625 625 * @return string Blog prefix. 626 626 */ 627 function get_blog_prefix( $blog_id = -1) {627 function get_blog_prefix( $blog_id = null ) { 628 628 if ( is_multisite() ) { 629 if ( $blog_id < 0)629 if ( null === $blog_id ) 630 630 $blog_id = $this->blogid; 631 631 if ( defined( 'MULTISITE' ) && ( 0 == $blog_id || 1 == $blog_id ) ) … … 838 838 839 839 /** 840 * Prepares a SQL query for safe execution. 840 * Prepares a SQL query for safe execution. Uses sprintf()-like syntax. 841 841 * 842 842 * The following directives can be used in the query format string: … … 845 845 * %% (literal percentage sign - no argument needed) 846 846 * 847 * Both %d and %s are to be left unquoted in the query string and 848 * they need an argument passed for them. Literals (%) as parts of 849 * the query must be properly written as %%. 847 * Both %d and %s are to be left unquoted in the query string and they need an argument passed for them. 848 * Literals (%) as parts of the query must be properly written as %%. 850 849 * 851 850 * This function only supports a small subset of the sprintf syntax; it only supports %d (decimal number), %s (string). … … 1356 1355 $new_array = array(); 1357 1356 // Extract the column values 1358 for ( $i =0; $i < count( $this->last_result ); $i++ ) {1357 for ( $i = 0, $j = count( $this->last_result ); $i < $j; $i++ ) { 1359 1358 $new_array[$i] = $this->get_var( null, $x, $i ); 1360 1359 } … … 1392 1391 foreach ( $this->last_result as $row ) { 1393 1392 $key = array_shift( get_object_vars( $row ) ); 1394 if ( ! isset( $new_array[ $key ] ) )1393 if ( ! isset( $new_array[ $key ] ) ) 1395 1394 $new_array[ $key ] = $row; 1396 1395 } … … 1426 1425 if ( $this->col_info ) { 1427 1426 if ( $col_offset == -1 ) { 1428 $i 1427 $i = 0; 1429 1428 $new_array = array(); 1430 1429 foreach( (array) $this->col_info as $col ) { … … 1572 1571 } 1573 1572 1574 if ( ! isset( $wpdb) ) {1573 if ( ! isset( $wpdb ) ) { 1575 1574 /** 1576 1575 * WordPress Database Object, if it isn't set already in wp-content/db.php … … 1578 1577 * @since 0.71 1579 1578 */ 1580 $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST);1579 $wpdb = new wpdb( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST ); 1581 1580 } 1582 1581 ?>
Note: See TracChangeset
for help on using the changeset viewer.