Changeset 5275
- Timestamp:
- 04/16/2007 11:53:34 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/link-template.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r5260 r5275 275 275 } 276 276 277 function edit_post_link($link = 'Edit This', $before = '', $after = '') {277 function get_edit_post_link( $link = 'Edit This' ) { 278 278 global $post; 279 280 if ( is_attachment() ) 279 280 if ( is_attachment() ) { 281 281 return; 282 283 if( $post->post_type == 'page' ) { 284 if ( ! current_user_can('edit_page', $post->ID) ) 282 } 283 284 if ( $post->post_type == 'page' ) { 285 if ( !current_user_can( 'edit_page', $post->ID ) ) { 285 286 return; 287 } 286 288 $file = 'page'; 287 289 } else { 288 if ( ! current_user_can('edit_post', $post->ID) )290 if ( !current_user_can( 'edit_post', $post->ID ) ) { 289 291 return; 292 } 290 293 $file = 'post'; 291 294 } 292 293 $location = get_option('siteurl') . "/wp-admin/{$file}.php?action=edit&post=$post->ID"; 294 echo $before . "<a href=\"$location\">$link</a>" . $after; 295 } 296 297 function edit_comment_link($link = 'Edit This', $before = '', $after = '') { 295 296 return '<a href="' . get_option( 'wpurl' ) . '/wp-admin/' . $file '.php?action=edit&post=' . $post->ID . '>' . $link . '</a>' . $after; 297 298 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) { 299 echo $before . get_edit_post_link( $link ) . $after; 300 } 301 302 function get_edit_comment_link( $link = 'Edit This' ) { 298 303 global $post, $comment; 299 300 if ( $post->post_type == 'page' ){301 if ( ! current_user_can('edit_page', $post->ID) )304 305 if ( $post->post_type == 'page' ) { 306 if ( !current_user_can( 'edit_page', $post->ID ) ) { 302 307 return; 303 } else { 304 if ( ! current_user_can('edit_post', $post->ID) ) 308 } 309 } else { 310 if ( !current_user_can( 'edit_post', $post->ID ) ) { 305 311 return; 306 } 307 308 $location = get_option('siteurl') . "/wp-admin/comment.php?action=editcomment&c=$comment->comment_ID"; 309 echo $before . "<a href='$location'>$link</a>" . $after; 312 } 313 } 314 315 return '<a href="' . get_option( 'siteurl' ) . '/wp-admin/comment.php?action=editcomment&c=' . $comment->comment_ID . '">' . $link . '</a>'; 316 } 317 318 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) { 319 echo $before . get_edit_comment_link( $link ) . $after; 310 320 } 311 321
Note: See TracChangeset
for help on using the changeset viewer.