diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index b8f2f8d56f..04e7a1774e 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -334,7 +334,7 @@ function get_dropins() { while ( ( $file = readdir( $plugins_dir ) ) !== false ) { if ( isset( $_dropins[ $file ] ) ) $plugin_files[] = $file; - } + } } else { return $dropins; } @@ -345,12 +345,12 @@ function get_dropins() { return $dropins; foreach ( $plugin_files as $plugin_file ) { - if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) - continue; - $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'] ) ) - $plugin_data['Name'] = $plugin_file; - $dropins[ $plugin_file ] = $plugin_data; + if ( !is_readable( WP_CONTENT_DIR . "/$plugin_file" ) ) + continue; + $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'] ) ) + $plugin_data['Name'] = $plugin_file; + $dropins[ $plugin_file ] = $plugin_data; } uksort( $dropins, create_function( '$a, $b', 'return strnatcasecmp( $a, $b );' )); diff --git a/wp-includes/meta.php b/wp-includes/meta.php index 582e3307e6..2b359f6dfb 100644 --- a/wp-includes/meta.php +++ b/wp-includes/meta.php @@ -21,7 +21,7 @@ * * @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 string $meta_key Metadata key + * @param string $meta_key Metadata key. Expected unslashed. * @param string $meta_value Metadata value * @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 @@ -42,9 +42,6 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = $column = esc_sql($meta_type . '_id'); - // expected_slashed ($meta_key) - $meta_key = stripslashes($meta_key); - if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d", $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 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 $prev_value Optional. If specified, only update existing metadata entries with * 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'); $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 ) ) ) 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 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 * 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 @@ -165,8 +159,7 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d $type_column = esc_sql($meta_type . '_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) ); $query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );