Changeset 5282
- Timestamp:
- 04/17/2007 11:00:35 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r5277 r5282 275 275 } 276 276 277 function get_edit_post_link( $link = 'Edit This') {277 function edit_post_link($link = 'Edit This', $before = '', $after = '') { 278 278 global $post; 279 280 if ( is_attachment() ) {279 280 if ( is_attachment() ) 281 281 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) ) 286 285 return; 287 }288 286 $file = 'page'; 289 287 } else { 290 if ( ! current_user_can( 'edit_post', $post->ID ) ) {288 if ( ! current_user_can('edit_post', $post->ID) ) 291 289 return; 292 }293 290 $file = 'post'; 294 291 } 295 296 return '<a href="' . get_option( 'wpurl' ) . '/wp-admin/' . $file . '.php?action=edit&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&post=$post->ID"; 294 echo $before . "<a href=\"$location\">$link</a>" . $after; 295 } 296 297 function edit_comment_link($link = 'Edit This', $before = '', $after = '') { 304 298 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) ) 308 302 return; 309 } 310 } else { 311 if ( !current_user_can( 'edit_post', $post->ID ) ) { 303 } else { 304 if ( ! current_user_can('edit_post', $post->ID) ) 312 305 return; 313 } 314 } 315 316 return '<a href="' . get_option( 'siteurl' ) . '/wp-admin/comment.php?action=editcomment&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&c=$comment->comment_ID"; 309 echo $before . "<a href='$location'>$link</a>" . $after; 321 310 } 322 311
Note: See TracChangeset
for help on using the changeset viewer.