X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7688c6ba71852cd89123b62b2d57683535e4702a..refs/tags/wordpress-2.9:/wp-admin/edit-link-categories.php diff --git a/wp-admin/edit-link-categories.php b/wp-admin/edit-link-categories.php index 3e05f5a8..90dcce66 100644 --- a/wp-admin/edit-link-categories.php +++ b/wp-admin/edit-link-categories.php @@ -1,10 +1,56 @@ %s category: this is the default one"), get_term_field('name', $cat_ID, 'link_category') ) ); + + wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id)); + } + + $location = 'edit-link-categories.php'; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos($referer, 'edit-link-categories.php') ) + $location = $referer; + } + + $location = add_query_arg('message', 6, $location); + wp_redirect($location); + exit(); + } +} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); + exit; +} + +$title = __('Link Categories'); + +wp_enqueue_script('admin-categories'); +if ( current_user_can('manage_categories') ) + wp_enqueue_script('inline-edit-tax'); -//wp_enqueue_script( 'admin-categories' ); TODO: Fix AJAX require_once ('admin-header.php'); $messages[1] = __('Category added.'); @@ -12,65 +58,96 @@ $messages[2] = __('Category deleted.'); $messages[3] = __('Category updated.'); $messages[4] = __('Category not added.'); $messages[5] = __('Category not updated.'); +$messages[6] = __('Categories deleted.'); ?> + +
+ +

' . __('Search results for “%s”') . '', esc_html( stripslashes($_GET['s']) ) ); ?> +

+ + +

+ + +
+ +
+
+ +
+ +
+
+
+
-function link_cat_row($category) { - global $class; - - if ( current_user_can( 'manage_categories' ) ) { - $edit = "".__( 'Edit' ).""; - $default_cat_id = (int) get_option( 'default_link_category' ); + add_query_arg( 'pagenum', '%#%' ), + 'format' => '', + 'prev_text' => __('«'), + 'next_text' => __('»'), + 'total' => ceil(wp_count_terms('link_category') / $catsperpage), + 'current' => $pagenum +)); + +if ( $page_links ) + echo "
$page_links
"; +?> - if ( $category->term_id != $default_cat_id ) - $edit .= "term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\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_term_field( 'name', $default_cat_id, 'link_category' ))) . "' );\" class='delete'>".__( 'Delete' ).""; - else - $edit .= "".__( "Default" ); - } else { - $edit = ''; - } +
+ + + +
- $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; +
+
- $category->count = number_format_i18n( $category->count ); - $count = ( $category->count > 0 ) ? "$category->count" : $category->count; - return " - $category->term_id - " . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . " - $category->description - $count - $edit\n\t\n"; -} -?> +
- -

- - -
- -

add new)'), '#addcat') ?>

- -

- - +
- - - - - + - + + + + + + + + $start, 'number' => $catsperpage, 'hide_empty' => 0); +if ( !empty( $_GET['s'] ) ) + $args['search'] = $_GET['s']; + +$categories = get_terms( 'link_category', $args ); if ( $categories ) { $output = ''; foreach ( $categories as $category ) { - $category = sanitize_term($category, 'link_category', 'display'); $output .= link_cat_row($category); } - $output = apply_filters('cat_rows', $output); echo $output; unset($category); } @@ -79,15 +156,75 @@ if ( $categories ) {
+
+$page_links
"; +?> + +
+ + +
+ +
+
+
- -
+

Note:
Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category %s.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?>

- - +
+
+ +
+
+ +parent = 0; do_action('add_link_category_form_pre', $category); ?> + +
+

+
+
+ + + +
+ + +
+ +
+ + +

+
+ +
+ + +

+
+ +

+ +
+
+ + + +
+
+ +
+
+