Fix double-tabbing in get_dropins.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-05-10 20:41:14 +00:00
parent f708a1bf38
commit d91623d3d0
2 changed files with 11 additions and 18 deletions

View File

@ -334,7 +334,7 @@ function get_dropins() {
while ( ( $file = readdir( $plugins_dir ) ) !== false ) { while ( ( $file = readdir( $plugins_dir ) ) !== false ) {
if ( isset( $_dropins[ $file ] ) ) if ( isset( $_dropins[ $file ] ) )
$plugin_files[] = $file; $plugin_files[] = $file;
} }
} else { } else {
return $dropins; return $dropins;
} }
@ -345,12 +345,12 @@ function get_dropins() {
return $dropins; return $dropins;
foreach ( $plugin_files as $plugin_file ) { foreach ( $plugin_files as $plugin_file ) {
if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) )
continue; continue;
$plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached. $plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.
if ( empty ( $plugin_data['Name'] ) ) if ( empty( $plugin_data['Name'] ) )
$plugin_data['Name'] = $plugin_file; $plugin_data['Name'] = $plugin_file;
$dropins[ $plugin_file ] = $plugin_data; $dropins[ $plugin_file ] = $plugin_data;
} }
uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' )); uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' ));

View File

@ -21,7 +21,7 @@
* *
* @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
* @param int $object_id ID of the object metadata is for * @param int $object_id ID of the object metadata is for
* @param string $meta_key Metadata key * @param string $meta_key Metadata key. Expected unslashed.
* @param string $meta_value Metadata value * @param string $meta_value Metadata value
* @param bool $unique Optional, default is false. Whether the specified metadata key should be * @param bool $unique Optional, default is false. Whether the specified metadata key should be
* unique for the object. If true, and the object already has a value for the specified * unique for the object. If true, and the object already has a value for the specified
@ -42,9 +42,6 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
$column = esc_sql($meta_type . '_id'); $column = esc_sql($meta_type . '_id');
// expected_slashed ($meta_key)
$meta_key = stripslashes($meta_key);
if ( $unique && $wpdb->get_var( $wpdb->prepare( if ( $unique && $wpdb->get_var( $wpdb->prepare(
"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
$meta_key, $object_id ) ) ) $meta_key, $object_id ) ) )
@ -82,7 +79,7 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
* *
* @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
* @param int $object_id ID of the object metadata is for * @param int $object_id ID of the object metadata is for
* @param string $meta_key Metadata key * @param string $meta_key Metadata key. Expected unslashed.
* @param string $meta_value Metadata value * @param string $meta_value Metadata value
* @param string $prev_value Optional. If specified, only update existing metadata entries with * @param string $prev_value Optional. If specified, only update existing metadata entries with
* the specified value. Otherwise, update all entries. * the specified value. Otherwise, update all entries.
@ -103,9 +100,6 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
$column = esc_sql($meta_type . '_id'); $column = esc_sql($meta_type . '_id');
$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
// expected_slashed ($meta_key)
$meta_key = stripslashes($meta_key);
if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) ) if ( ! $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) ) )
return add_metadata($meta_type, $object_id, $meta_key, $meta_value); return add_metadata($meta_type, $object_id, $meta_key, $meta_value);
@ -143,7 +137,7 @@ function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_v
* *
* @param string $meta_type Type of object metadata is for (e.g., comment, post, or user) * @param string $meta_type Type of object metadata is for (e.g., comment, post, or user)
* @param int $object_id ID of the object metadata is for * @param int $object_id ID of the object metadata is for
* @param string $meta_key Metadata key * @param string $meta_key Metadata key. Expected unslashed.
* @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries * @param string $meta_value Optional. Metadata value. If specified, only delete metadata entries
* with this value. Otherwise, delete all entries with the specified meta_key. * with this value. Otherwise, delete all entries with the specified meta_key.
* @param bool $delete_all Optional, default is false. If true, delete matching metadata entries * @param bool $delete_all Optional, default is false. If true, delete matching metadata entries
@ -165,8 +159,7 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
$type_column = esc_sql($meta_type . '_id'); $type_column = esc_sql($meta_type . '_id');
$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id'; $id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
// expected_slashed ($meta_key)
$meta_key = stripslashes($meta_key);
$meta_value = maybe_serialize( stripslashes_deep($meta_value) ); $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key ); $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );