Changeset 28590
- Timestamp:
- 05/27/2014 01:42:27 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r28575 r28590 1197 1197 * @since 1.0.0 1198 1198 * 1199 * @param string $ linkOptional. Anchor text.1199 * @param string $text Optional. Anchor text. 1200 1200 * @param string $before Optional. Display before edit link. 1201 1201 * @param string $after Optional. Display after edit link. 1202 1202 * @param int $id Optional. Post ID. 1203 1203 */ 1204 function edit_post_link( $ link= null, $before = '', $after = '', $id = 0 ) {1205 if ( ! $post = get_post( $id ) )1204 function edit_post_link( $text = null, $before = '', $after = '', $id = 0 ) { 1205 if ( ! $post = get_post( $id ) ) { 1206 1206 return; 1207 1208 if ( !$url = get_edit_post_link( $post->ID ) ) 1207 } 1208 1209 if ( ! $url = get_edit_post_link( $post->ID ) ) { 1209 1210 return; 1210 1211 if ( null === $link ) 1212 $link = __('Edit This'); 1213 1214 $link = '<a class="post-edit-link" href="' . $url . '">' . $link . '</a>'; 1211 } 1212 1213 if ( null === $text ) { 1214 $text = __( 'Edit This' ); 1215 } 1216 1217 $link = '<a class="post-edit-link" href="' . $url . '">' . $text . '</a>'; 1215 1218 1216 1219 /** … … 1221 1224 * @param string $link Anchor tag for the edit link. 1222 1225 * @param int $post_id Post ID. 1223 */ 1224 echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after; 1226 * @param string $text Anchor text. 1227 */ 1228 echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after; 1225 1229 } 1226 1230 … … 1298 1302 * @since 1.0.0 1299 1303 * 1300 * @param string $ linkOptional. Anchor text.1304 * @param string $text Optional. Anchor text. 1301 1305 * @param string $before Optional. Display before edit link. 1302 1306 * @param string $after Optional. Display after edit link. 1303 1307 */ 1304 function edit_comment_link( $ link= null, $before = '', $after = '' ) {1308 function edit_comment_link( $text = null, $before = '', $after = '' ) { 1305 1309 global $comment; 1306 1310 1307 if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) )1311 if ( ! current_user_can( 'edit_comment', $comment->comment_ID ) ) { 1308 1312 return; 1309 1310 if ( null === $link ) 1311 $link = __('Edit This'); 1312 1313 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $link . '</a>'; 1313 } 1314 1315 if ( null === $text ) { 1316 $text = __( 'Edit This' ); 1317 } 1318 1319 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>'; 1314 1320 1315 1321 /** … … 1320 1326 * @param string $link Anchor tag for the edit link. 1321 1327 * @param int $comment_id Comment ID. 1322 */ 1323 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after; 1328 * @param string $text Anchor text. 1329 */ 1330 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after; 1324 1331 } 1325 1332
Note: See TracChangeset
for help on using the changeset viewer.