Make WordPress Core

Changeset 5938


Ignore:
Timestamp:
08/24/2007 06:41:01 PM (17 years ago)
Author:
ryan
Message:

Don't pass cat as ref. Fix some term sanitization. fixes #4702

Location:
trunk
Files:
3 edited

Legend:

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

    r5712 r5938  
    1313
    1414function get_category_to_edit( $id ) {
    15     $category = get_category( $id );
    16 
    17     $category->term_id = (int) $category->term_id;
    18     $category->parent = (int) $category->parent;
    19 
     15    $category = get_category( $id, OBJECT, 'edit' );
    2016    return $category;
    2117}
     
    9187
    9288    $parent = (int) $parent;
    93     if ( empty($parent) || !get_category( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
     89    if ( empty($parent) || !category_exists( $parent ) || ($cat_ID && cat_is_ancestor_of($cat_ID, $parent) ) )
    9490        $parent = 0;
    9591
  • trunk/wp-includes/category.php

    r5912 r5938  
    2929// Retrieves category data given a category ID or category object.
    3030// Handles category caching.
    31 function &get_category(&$category, $output = OBJECT) {
    32     $category = get_term($category, 'category', $output);
     31function &get_category($category, $output = OBJECT, $filter = 'raw') {
     32    $category = get_term($category, 'category', $output, $filter);
    3333
    3434    _make_cat_compat($category);
  • trunk/wp-includes/taxonomy.php

    r5937 r5938  
    230230 *      might be inaccurate or wrong.
    231231 */
    232 function &get_term(&$term, $taxonomy, $output = OBJECT, $filter = 'raw') {
     232function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
    233233    global $wpdb;
    234234
     
    885885    $term = get_term ($term_id, $taxonomy, ARRAY_A);
    886886
    887     $term = sanitize_term($term, $taxonomy, 'db');
    888 
    889887    // Escape data pulled from DB.
    890888    $term = add_magic_quotes($term);
     
    895893    $defaults = array( 'alias_of' => '', 'description' => '', 'parent' => 0, 'slug' => '');
    896894    $args = wp_parse_args($args, $defaults);
     895    $args = sanitize_term($args, $taxonomy, 'db');
    897896    extract($args, EXTR_SKIP);
    898897
    899898    if ( empty($slug) )
    900899        $slug = sanitize_title($name);
    901     else
    902         $slug = sanitize_title($slug);
    903900
    904901    if ( $alias_of ) {
Note: See TracChangeset for help on using the changeset viewer.