Make WordPress Core

Changeset 5282


Ignore:
Timestamp:
04/17/2007 11:00:35 PM (19 years ago)
Author:
ryan
Message:

Revert [5275] - [5277]. Fix it later. see #4153

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/link-template.php

    r5277 r5282  
    275275}
    276276
    277 function get_edit_post_link( $link = 'Edit This' ) {
     277function edit_post_link($link = 'Edit This', $before = '', $after = '') {
    278278        global $post;
    279        
    280         if ( is_attachment() ) {
     279
     280        if ( is_attachment() )
    281281                return;
    282         }
    283        
    284         if ( $post->post_type == 'page' ) {
    285                 if ( !current_user_can( 'edit_page', $post->ID ) ) {
     282
     283        if( $post->post_type == 'page' ) {
     284                if ( ! current_user_can('edit_page', $post->ID) )
    286285                        return;
    287                 }
    288286                $file = 'page';
    289287        } else {
    290                 if ( !current_user_can( 'edit_post', $post->ID ) ) {
     288                if ( ! current_user_can('edit_post', $post->ID) )
    291289                        return;
    292                 }
    293290                $file = 'post';
    294291        }
    295        
    296         return '<a href="' . get_option( 'wpurl' ) . '/wp-admin/' . $file . '.php?action=edit&amp;post=' . $post->ID . '>' . $link . '</a>' . $after;
    297 }
    298 
    299 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
    300         echo $before . get_edit_post_link( $link ) . $after;
    301 }
    302 
    303 function get_edit_comment_link( $link = 'Edit This' ) {
     292
     293        $location = get_option('siteurl') . "/wp-admin/{$file}.php?action=edit&amp;post=$post->ID";
     294        echo $before . "<a href=\"$location\">$link</a>" . $after;
     295}
     296
     297function edit_comment_link($link = 'Edit This', $before = '', $after = '') {
    304298        global $post, $comment;
    305        
    306         if ( $post->post_type == 'page' ) {
    307                 if ( !current_user_can( 'edit_page', $post->ID ) ) {
     299
     300        if( $post->post_type == 'page' ){
     301                if ( ! current_user_can('edit_page', $post->ID) )
    308302                        return;
    309                 }
    310         } else {
    311                 if ( !current_user_can( 'edit_post', $post->ID ) ) {
     303        } else {
     304                if ( ! current_user_can('edit_post', $post->ID) )
    312305                        return;
    313                 }
    314         }
    315        
    316         return '<a href="' . get_option( 'siteurl' ) . '/wp-admin/comment.php?action=editcomment&amp;c=' . $comment->comment_ID . '">' . $link . '</a>';
    317 }
    318 
    319 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
    320         echo $before . get_edit_comment_link( $link ) . $after;
     306        }
     307
     308        $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&amp;c=$comment->comment_ID";
     309        echo $before . "<a href='$location'>$link</a>" . $after;
    321310}
    322311
Note: See TracChangeset for help on using the changeset viewer.