WordPress.org

Make WordPress Core

Changeset 8911


Ignore:
Timestamp:
09/17/08 00:11:17 (7 years ago)
Author:
ryan
Message:

Edit and Delete links for link categories. see #7552

File:
1 edited

Legend:

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

    r8910 r8911  
    7979    $category = get_category( $category ); 
    8080 
     81    $default_cat_id = (int) get_option( 'default_category' ); 
    8182    $pad = str_repeat( '— ', $level ); 
    8283    $name = ( $name_override ? $name_override : $pad . ' ' . $category->name ); 
     
    8687        $actions = array(); 
    8788        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
    88         $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     89        if ( $default_cat_id != $category->term_id ) 
     90            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
    8991        $action_count = count($actions); 
    9092        $i = 0; 
     
    104106    $output = "<tr id='cat-$category->term_id'$class> 
    105107               <th scope='row' class='check-column'>"; 
    106     if ( absint(get_option( 'default_category' ) ) != $category->term_id ) { 
     108    if ( $default_cat_id != $category->term_id ) { 
    107109        $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />"; 
    108110    } else { 
     
    125127        return $category; 
    126128 
     129    $default_cat_id = (int) get_option( 'default_link_category' ); 
    127130    $name = ( $name_override ? $name_override : $category->name ); 
     131    $edit_link = "link-category.php?action=edit&amp;cat_ID=$category->term_id"; 
    128132    if ( current_user_can( 'manage_categories' ) ) { 
    129         $edit = "<a class='row-title' href='link-category.php?action=edit&amp;cat_ID=$category->term_id' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a>"; 
    130         $default_cat_id = (int) get_option( 'default_link_category' ); 
     133        $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />"; 
     134        $actions = array(); 
     135        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     136        if ( $default_cat_id != $category->term_id ) 
     137            $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&amp;cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id) . "' onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this category '%s'\n  'Cancel' to stop, 'OK' to delete."), $name )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 
     138        $action_count = count($actions); 
     139        $i = 0; 
     140        foreach ( $actions as $action => $link ) { 
     141            ++$i; 
     142            ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 
     143            $edit .= "<span class='$action'>$link$sep</span>"; 
     144        } 
    131145    } else { 
    132146        $edit = $name; 
Note: See TracChangeset for help on using the changeset viewer.