WordPress.org

Make WordPress Core

Changeset 28461


Ignore:
Timestamp:
05/16/2014 09:28:05 PM (7 years ago)
Author:
wonderboymusic
Message:

Eliminate use of extract() in wp_update_term().

See #22400.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r28441 r28461  
    28892889    $args = wp_parse_args($args, $defaults);
    28902890    $args = sanitize_term($args, $taxonomy, 'db');
    2891     extract($args, EXTR_SKIP);
     2891    $parsed_args = $args;
    28922892
    28932893    // expected_slashed ($name)
    2894     $name = wp_unslash($name);
    2895     $description = wp_unslash($description);
     2894    $name = wp_unslash( $args['name'] );
     2895    $description = wp_unslash( $args['description'] );
     2896
     2897    $parsed_args['name'] = $name;
     2898    $parsed_args['description'] = $description;
    28962899
    28972900    if ( '' == trim($name) )
     
    28992902
    29002903    $empty_slug = false;
    2901     if ( empty($slug) ) {
     2904    if ( empty( $args['slug'] ) ) {
    29022905        $empty_slug = true;
    29032906        $slug = sanitize_title($name);
    2904     }
    2905 
    2906     if ( $alias_of ) {
    2907         $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $alias_of) );
     2907    } else {
     2908        $slug = $args['slug'];
     2909    }
     2910
     2911    $parsed_args['slug'] = $slug;
     2912
     2913    if ( $args['alias_of'] ) {
     2914        $alias = $wpdb->get_row( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $args['alias_of'] ) );
    29082915        if ( $alias->term_group ) {
    29092916            // The alias we want is already in a group, so let's use that one.
     
    29202927            do_action( 'edited_terms', $alias->term_id, $taxonomy );
    29212928        }
     2929
     2930        $parsed_args['term_group'] = $term_group;
    29222931    }
    29232932
     
    29292938     * @since 3.1.0
    29302939     *
    2931      * @param int    $parent   ID of the parent term.
    2932      * @param int    $term_id  Term ID.
    2933      * @param string $taxonomy Taxonomy slug.
    2934      * @param array  $args     Compacted array of update arguments for the given term.
    2935      * @param array  $args     An array of update arguments for the given term.
     2940     * @param int    $parent      ID of the parent term.
     2941     * @param int    $term_id     Term ID.
     2942     * @param string $taxonomy    Taxonomy slug.
     2943     * @param array  $parsed_args An array of potentially altered update arguments for the given term.
     2944     * @param array  $args        An array of update arguments for the given term.
    29362945     */
    2937     $parent = apply_filters( 'wp_update_term_parent', $parent, $term_id, $taxonomy, compact( array_keys( $args ) ), $args );
     2946    $parent = apply_filters( 'wp_update_term_parent', $args['parent'], $term_id, $taxonomy, $parsed_args, $args );
    29382947
    29392948    // Check for duplicate slug
Note: See TracChangeset for help on using the changeset viewer.