Changeset 7262 for trunk/wp-includes/link-template.php
- Timestamp:
- 03/12/2008 05:50:07 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/link-template.php
r7250 r7262 440 440 441 441 function get_edit_post_link( $id = 0 ) { 442 $post = &get_post( $id ); 442 if ( !$post = &get_post( $id ) ) 443 return; 444 445 switch ( $post->post_type ) : 446 case 'page' : 447 if ( !current_user_can( 'edit_page', $post->ID ) ) 448 return; 449 $file = 'page'; 450 $var = 'post'; 451 break; 452 case 'attachment' : 453 if ( !current_user_can( 'edit_post', $post->ID ) ) 454 return; 455 $file = 'media'; 456 $var = 'attachment_id'; 457 break; 458 default : 459 if ( !current_user_can( 'edit_post', $post->ID ) ) 460 return; 461 $file = 'post'; 462 $var = 'post'; 463 break; 464 endswitch; 465 466 return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . "/wp-admin/$file.php?action=edit&$var=$post->ID", $post->ID ); 467 } 468 469 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) { 470 global $post; 443 471 444 472 if ( $post->post_type == 'page' ) { 445 473 if ( !current_user_can( 'edit_page', $post->ID ) ) 446 474 return; 447 448 $file = 'page';449 475 } else { 450 476 if ( !current_user_can( 'edit_post', $post->ID ) ) 451 477 return; 452 453 $file = 'post';454 }455 456 return apply_filters( 'get_edit_post_link', get_bloginfo( 'wpurl' ) . '/wp-admin/' . $file . '.php?action=edit&post=' . $post->ID, $post->ID );457 }458 459 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {460 global $post;461 462 if ( $post->post_type == 'page' ) {463 if ( !current_user_can( 'edit_page', $post->ID ) )464 return;465 466 $file = 'page';467 } else {468 if ( !current_user_can( 'edit_post', $post->ID ) )469 return;470 471 $file = 'post';472 478 } 473 479
Note: See TracChangeset
for help on using the changeset viewer.