Changeset 6660
- Timestamp:
- 01/25/2008 07:29:01 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6633 r6660 60 60 61 61 if ( wp_delete_category( $id ) ) 62 die('1'); 63 else die('0'); 64 break; 65 case 'delete-tag' : 66 check_ajax_referer( "delete-tag_$id" ); 67 if ( !current_user_can( 'manage_categories' ) ) 68 die('-1'); 69 70 if ( wp_delete_term($id, 'post_tag')) 62 71 die('1'); 63 72 else die('0'); … … 300 309 'id' => $term_id, 301 310 'data' => $link_cat 311 ) ); 312 $x->send(); 313 break; 314 case 'add-tag' : // From Manage->Tags 315 check_ajax_referer( 'add-tag' ); 316 if ( !current_user_can( 'manage_categories' ) ) 317 die('-1'); 318 319 if ( '' === trim($_POST['name']) ) { 320 $x = new WP_Ajax_Response( array( 321 'what' => 'tag', 322 'id' => new WP_Error( 'name', __('You did not enter a tag name.') ) 323 ) ); 324 $x->send(); 325 } 326 327 $tag = wp_insert_term($_POST['name'], 'post_tag', $_POST ); 328 329 if ( is_wp_error($tag) ) { 330 $x = new WP_Ajax_Response( array( 331 'what' => 'tag', 332 'id' => $tag 333 ) ); 334 $x->send(); 335 } 336 337 if ( !$tag || (!$tag = get_term( $tag['term_id'], 'post_tag' )) ) 338 die('0'); 339 340 $tag_full_name = $tag->name; 341 $tag_full_name = attribute_escape($tag_full_name); 342 343 $x = new WP_Ajax_Response( array( 344 'what' => 'tag', 345 'id' => $tag->term_id, 346 'data' => _tag_row( $tag ), 347 'supplemental' => array('name' => $tag_full_name, 'show-link' => sprintf(__( 'Tag <a href="#%s">%s</a> added' ), "tag-$tag->term_id", $tag_full_name)) 302 348 ) ); 303 349 $x->send(); -
trunk/wp-admin/edit.php
r6581 r6660 49 49 $h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching “%s”'), wp_specialchars( get_search_query() ) ) : ''; 50 50 $h2_cat = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in “%s”'), single_cat_title('', false) ) : ''; 51 $h2_tag = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with “%s”'), single_tag_title('', false) ) : ''; 51 52 $h2_month = isset($_GET['m']) && $_GET['m'] ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : ''; 52 printf( _c( '%1$s%2$s%3$s%4$s%5$s |You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_month );53 printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month ); 53 54 } 54 55 ?></h2> -
trunk/wp-admin/includes/template.php
r6659 r6660 231 231 echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', ($checked ? ' checked="checked"' : "" ), '/> ', $name, "</label></li>"; 232 232 } 233 } 234 235 // Tag stuff 236 237 // Returns a single tag row (see tag_rows below) 238 // Note: this is also used in admin-ajax.php! 239 function _tag_row( $tag, $class = '' ) { 240 $count = number_format_i18n( $tag->count ); 241 $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count; 242 243 $out = ''; 244 $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>'; 245 $out .= '<th scope="row">' . $tag->term_id . '</th>'; 246 247 $out .= '<td>' . apply_filters( 'term_name', $tag->name ) . '</td>'; 248 249 $out .= "<td>$count</td>"; 250 $out .= '<td><a href="edit-tags.php?action=edit&tag_ID=' . $tag->term_id . '" class="edit">' . 251 __( 'Edit' ) . "</a></td>" . 252 '<td><a href="' . wp_nonce_url( "edit-tags.php?action=delete&tag_ID=$tag->term_id", 253 'delete-tag_' . $tag->term_id ) . 254 '" class="delete:the-list:tag-' . $tag->term_id . ' delete">' . 255 __( 'Delete' ) . "</a></td>"; 256 $out .= '</tr>'; 257 258 return $out; 259 } 260 261 // Outputs appropriate rows for the Nth page of the Tag Management screen, 262 // assuming M tags displayed at a time on the page 263 // Returns the number of tags displayed 264 function tag_rows( $page = 0, $pagesize = 20 ) { 265 266 // Get a page worth of tags 267 $start = $page * $pagesize; 268 $tags = get_terms( 'post_tag', "offset=$start&number=$pagesize&hide_empty=0" ); 269 270 // convert it to table rows 271 $out = ''; 272 $class = ''; 273 $i = 0; 274 $count = 0; 275 foreach( $tags as $tag ) { 276 if( $i ) { 277 $i = 0; 278 $class = ' class="alternate"'; 279 } else { 280 $i = 1; 281 $class = ''; 282 } 283 284 $out .= _tag_row( $tag, $class ); 285 $count++; 286 } 287 288 // filter and send to screen 289 $out = apply_filters('tag_rows', $out); 290 echo $out; 291 return $count; 233 292 } 234 293 -
trunk/wp-admin/menu.php
r6638 r6660 41 41 $submenu['edit.php'][15] = array(__('Links'), 'manage_links', 'link-manager.php'); 42 42 $submenu['edit.php'][20] = array(__('Categories'), 'manage_categories', 'categories.php'); 43 $submenu['edit.php'][21] = array(__('Tags'), 'manage_categories', 'edit-tags.php'); 43 44 $submenu['edit.php'][25] = array(__('Media Library'), 'upload_files', 'upload.php'); 44 45 $submenu['edit.php'][30] = array(__('Import'), 'import', 'import.php'); -
trunk/wp-includes/script-loader.php
r6659 r6660 117 117 ) ); 118 118 $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' ); 119 $this->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' ); 119 120 $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' ); 120 121 $this->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' ); -
trunk/wp-includes/taxonomy.php
r6592 r6660 526 526 'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '', 527 527 'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '', 528 'pad_counts' => false );528 'pad_counts' => false, 'offset' => ''); 529 529 $args = wp_parse_args( $args, $defaults ); 530 530 $args['number'] = absint( $args['number'] ); 531 $args['offset'] = absint( $args['offset'] ); 531 532 if ( !$single_taxonomy || !is_taxonomy_hierarchical($taxonomies[0]) || 532 533 '' != $args['parent'] ) { … … 626 627 $where .= ' AND tt.count > 0'; 627 628 628 if ( !empty($number) ) 629 $number = 'LIMIT ' . $number; 630 else 629 if ( !empty($number) ) { 630 if( $offset ) 631 $number = 'LIMIT ' . $offset . ',' . $number; 632 else 633 $number = 'LIMIT ' . $number; 634 635 } else 631 636 $number = ''; 632 637
Note: See TracChangeset
for help on using the changeset viewer.