- md5
- 3d714c61a2091101e9622f0c0fd1fb30
- sha1
- 7dbf85bfa12d879f31c41d7416a2a42f15ea445c
- sha256
- 6b1714ce0ae81d09f661b0a51e725cadfb3c7bba055bb56041dc9264d1cd8d12
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
<?php
require_once('admin.php');
wp_reset_vars(array('action', 'cat'));
switch($action) {
case 'addcat':
check_admin_referer('add-link-category');
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?'));
if ( wp_insert_term($_POST['name'], 'link_category', $_POST ) ) {
wp_redirect('edit-link-categories.php?message=1#addcat');
} else {
wp_redirect('edit-link-categories.php?message=4#addcat');
}
exit;
break;
case 'delete':
$cat_ID = (int) $_GET['cat_ID'];
check_admin_referer('delete-link-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?'));
$cat_name = get_term_field('name', $cat_ID, 'link_category');
// Don't delete the default cats.
if ( $cat_ID == get_option('default_link_category') )
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
wp_delete_term($cat_ID, 'link_category');
$location = 'edit-link-categories.php';
if ( $referer = wp_get_original_referer() ) {
if ( false !== strpos($referer, 'edit-link-categories.php') )
$location = $referer;
}
$location = add_query_arg('message', 2, $location);
wp_redirect($location);
exit;
break;
case 'edit':
$title = __('Categories');
$parent_file = 'edit.php';
$submenu_file = 'edit-link-categories.php';
require_once ('admin-header.php');
$cat_ID = (int) $_GET['cat_ID'];
$category = get_term_to_edit($cat_ID, 'link_category');
include('edit-link-category-form.php');
include('admin-footer.php');
exit;
break;
case 'editedcat':
$cat_ID = (int) $_POST['cat_ID'];
check_admin_referer('update-link-category_' . $cat_ID);
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin’ uh?'));
$location = 'edit-link-categories.php';
if ( $referer = wp_get_original_referer() ) {
if ( false !== strpos($referer, 'edit-link-categories.php') )
$location = $referer;
}
if ( wp_update_term($cat_ID, 'link_category', $_POST) )
$location = add_query_arg('message', 3, $location);
else
$location = add_query_arg('message', 5, $location);
wp_redirect($location);
exit;
break;
}
?>
The same content is in 8 releases, WordPress 2.5-RC3 to 2.6. See them all, or every version of this file.