Make WordPress Core


Ignore:
Timestamp:
05/23/2007 05:28:13 PM (17 years ago)
Author:
ryan
Message:

wp_insert_category(), cat_rows(), and others using taxonomy. see #4189

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r5527 r5528  
    770770// Dandy new recursive multiple category stuff.
    771771function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
    772     if (!$categories )
     772    if ( !$categories )
    773773        $categories = get_categories( 'hide_empty=0' );
    774774
     
    778778        ob_start();
    779779        foreach ( $categories as $category ) {
    780             if ( $category->category_parent == $parent) {
     780            if ( $category->parent == $parent) {
    781781                echo "\t" . _cat_row( $category, $level );
    782                 if ( isset($children[$category->cat_ID]) )
    783                     cat_rows( $category->cat_ID, $level +1, $categories );
     782                if ( isset($children[$category->term_id]) )
     783                    cat_rows( $category->term_id, $level +1, $categories );
    784784            }
    785785        }
     
    800800    $pad = str_repeat( '— ', $level );
    801801    if ( current_user_can( 'manage_categories' ) ) {
    802         $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>";
     802        $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";
    803803        $default_cat_id = (int) get_option( 'default_category' );
    804         $default_link_cat_id = (int) get_option( 'default_link_category' );
    805 
    806         if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) )
    807             $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->cat_ID", 'delete-category_' . $category->cat_ID ) . "' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->cat_name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
     804
     805        if ( $category->term_id != $default_cat_id )
     806            $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";
    808807        else
    809808            $edit .= "<td style='text-align:center'>".__( "Default" );
     
    813812    $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
    814813
    815     $category->category_count = number_format_i18n( $category->category_count );
    816     $category->link_count = number_format_i18n( $category->link_count );
    817     $posts_count = ( $category->category_count > 0 ) ? "<a href='edit.php?cat=$category->cat_ID'>$category->category_count</a>" : $category->category_count;
    818     return "<tr id='cat-$category->cat_ID'$class>
    819         <th scope='row' style='text-align: center'>$category->cat_ID</th>
    820         <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td>
    821         <td>$category->category_description</td>
     814    $category->count = number_format_i18n( $category->count );
     815    $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
     816    return "<tr id='cat-$category->term_id'$class>
     817        <th scope='row' style='text-align: center'>$category->term_id</th>
     818        <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>
     819        <td>$category->description</td>
    822820        <td align='center'>$posts_count</td>
    823         <td align='center'>$category->link_count</td>
    824821        <td>$edit</td>\n\t</tr>\n";
    825822}
Note: See TracChangeset for help on using the changeset viewer.