mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Edit and Delete links for link categories. see #7552
git-svn-id: http://svn.automattic.com/wordpress/trunk@8911 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2c516732de
commit
86db7961b7
@ -78,6 +78,7 @@ function _cat_row( $category, $level, $name_override = false ) {
|
||||
|
||||
$category = get_category( $category );
|
||||
|
||||
$default_cat_id = (int) get_option( 'default_category' );
|
||||
$pad = str_repeat( '— ', $level );
|
||||
$name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
|
||||
$edit_link = "categories.php?action=edit&cat_ID=$category->term_id";
|
||||
@ -85,7 +86,8 @@ function _cat_row( $category, $level, $name_override = false ) {
|
||||
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&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>";
|
||||
if ( $default_cat_id != $category->term_id )
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("categories.php?action=delete&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>";
|
||||
$action_count = count($actions);
|
||||
$i = 0;
|
||||
foreach ( $actions as $action => $link ) {
|
||||
@ -103,7 +105,7 @@ function _cat_row( $category, $level, $name_override = false ) {
|
||||
$posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
|
||||
$output = "<tr id='cat-$category->term_id'$class>
|
||||
<th scope='row' class='check-column'>";
|
||||
if ( absint(get_option( 'default_category' ) ) != $category->term_id ) {
|
||||
if ( $default_cat_id != $category->term_id ) {
|
||||
$output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
|
||||
} else {
|
||||
$output .= " ";
|
||||
@ -124,10 +126,22 @@ function link_cat_row( $category ) {
|
||||
if ( is_wp_error( $category ) )
|
||||
return $category;
|
||||
|
||||
$default_cat_id = (int) get_option( 'default_link_category' );
|
||||
$name = ( $name_override ? $name_override : $category->name );
|
||||
$edit_link = "link-category.php?action=edit&cat_ID=$category->term_id";
|
||||
if ( current_user_can( 'manage_categories' ) ) {
|
||||
$edit = "<a class='row-title' href='link-category.php?action=edit&cat_ID=$category->term_id' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a>";
|
||||
$default_cat_id = (int) get_option( 'default_link_category' );
|
||||
$edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a><br />";
|
||||
$actions = array();
|
||||
$actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
|
||||
if ( $default_cat_id != $category->term_id )
|
||||
$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("link-category.php?action=delete&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>";
|
||||
$action_count = count($actions);
|
||||
$i = 0;
|
||||
foreach ( $actions as $action => $link ) {
|
||||
++$i;
|
||||
( $i == $action_count ) ? $sep = '' : $sep = ' | ';
|
||||
$edit .= "<span class='$action'>$link$sep</span>";
|
||||
}
|
||||
} else {
|
||||
$edit = $name;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user