Make WordPress Core

Ticket #3176: 3176.switch.diff

File 3176.switch.diff, 2.2 KB (added by Sewar, 20 years ago)

Using switch

  • admin-functions.php

     
    738738                $default_cat_id = get_option('default_category');
    739739                $default_link_cat_id = get_option('default_link_category');
    740740
    741                 if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) )
    742                         $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, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
    743                 else
    744                         $edit .= "<td style='text-align:center'>".__("Default");
    745         } else
     741                switch ($category->cat_ID){
     742                        case $default_cat_id:
     743                                $edit .= "<td style='text-align:center'>".__("Default posts category");
     744                                break;
     745                        case $default_link_cat_id:
     746                                $edit .= "<td style='text-align:center'>".__("Default links category");
     747                                break;
     748                        default:
     749                                $edit .= "<td style='text-align:center'><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, '" . sprintf(__("You are about to delete the category &quot;%s&quot;.\\nAll of its posts will go into the default category of &quot;%s&quot;\\nAll of its bookmarks will go into the default category of &quot;%s&quot;.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), js_escape($category->cat_name), js_escape(get_catname($default_cat_id)), js_escape(get_catname($default_link_cat_id))) . "' );\" class='delete'>".__('Delete')."</a>";
     750                }
     751        } else {
    746752                $edit = '';
     753        }
    747754
    748755        $class = ( ( defined('DOING_AJAX') && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
    749756