Ticket #9702: 9702.patch
File 9702.patch, 3.0 KB (added by , 15 years ago) |
---|
-
link-template.php
609 609 } 610 610 611 611 /** 612 * Retrieve edit category link. 613 * 614 * @since 2.8.0 615 * 616 * @param int $category_id Tag ID 617 * @return string 618 */ 619 function get_edit_category_link( $category_id = 0, $taxonomy = 'category' ) { 620 $category = get_term($category_id, $taxonomy); 621 622 if ( !current_user_can('manage_categories') ) 623 return; 624 625 $location = admin_url('categories.php?action=edit&taxonomy=' . $taxonomy . '&cat_ID=' . $category->term_id); 626 return apply_filters( 'get_edit_category_link', $location ); 627 } 628 629 /** 630 * Display or retrieve edit category link with formatting. 631 * 632 * @since 2.8.0 633 * 634 * @param string $link Optional. Anchor text. 635 * @param string $before Optional. Display before edit link. 636 * @param string $after Optional. Display after edit link. 637 * @param int|object $category Tag object or ID 638 * @return string|null HTML content, if $echo is set to false. 639 */ 640 function edit_category_link( $link = '', $before = '', $after = '', $category = null ) { 641 $category = get_term($category, 'category'); 642 643 if ( !current_user_can('manage_categories') ) 644 return; 645 646 if ( empty($link) ) 647 $link = __('Edit This'); 648 649 $link = '<a href="' . get_edit_category_link( $category->term_id ) . '" title="' . __( 'Edit category' ) . '">' . $link . '</a>'; 650 echo $before . apply_filters( 'edit_category_link', $link, $category->term_id ) . $after; 651 } 652 653 /** 612 654 * Retrieve the permalink for the feed of the search results. 613 655 * 614 656 * @since 2.5.0 … … 720 762 * @param string $after Optional. Display after edit link. 721 763 * @param int $id Optional. Post ID. 722 764 */ 723 function edit_post_link( $link = ' Edit This', $before = '', $after = '', $id = 0 ) {765 function edit_post_link( $link = '', $before = '', $after = '', $id = 0 ) { 724 766 if ( !$post = &get_post( $id ) ) 725 767 return; 726 768 727 769 if ( !$url = get_edit_post_link( $post->ID ) ) 728 770 return; 729 771 772 if ( empty($link) ) 773 $link = __('Edit This'); 774 730 775 $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( __( 'Edit post' ) ) . '">' . $link . '</a>'; 731 776 echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after; 732 777 } … … 765 810 * @param string $after Optional. Display after edit link. 766 811 * @return string|null HTML content, if $echo is set to false. 767 812 */ 768 function edit_comment_link( $link = ' Edit This', $before = '', $after = '' ) {813 function edit_comment_link( $link = '', $before = '', $after = '' ) { 769 814 global $comment, $post; 770 815 771 816 if ( $post->post_type == 'attachment' ) { … … 777 822 return; 778 823 } 779 824 825 if ( empty($link) ) 826 $link = __('Edit This'); 827 780 828 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>'; 781 829 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 782 830 }