Ticket #28373: 28373.3.diff
File 28373.3.diff, 2.9 KB (added by , 10 years ago) |
---|
-
src/wp-includes/link-template.php
1196 1196 * 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 } 1207 1208 1208 if ( ! $url = get_edit_post_link( $post->ID ) )1209 if ( ! $url = get_edit_post_link( $post->ID ) ) { 1209 1210 return; 1211 } 1210 1212 1211 if ( null === $link ) 1212 $link = __('Edit This'); 1213 if ( null === $text ) { 1214 $text = __( 'Edit This' ); 1215 } 1213 1216 1214 $link = '<a class="post-edit-link" href="' . $url . '">' . $ link. '</a>';1217 $link = '<a class="post-edit-link" href="' . $url . '">' . $text . '</a>'; 1215 1218 1216 1219 /** 1217 1220 * Filter the post edit link anchor tag. … … 1220 1223 * 1221 1224 * @param string $link Anchor tag for the edit link. 1222 1225 * @param int $post_id Post ID. 1226 * @param string $text Anchor text. 1223 1227 */ 1224 echo $before . apply_filters( 'edit_post_link', $link, $post->ID ) . $after;1228 echo $before . apply_filters( 'edit_post_link', $link, $post->ID, $text ) . $after; 1225 1229 } 1226 1230 1227 1231 /** … … 1297 1301 * 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; 1313 } 1309 1314 1310 if ( null === $link ) 1311 $link = __('Edit This'); 1315 if ( null === $text ) { 1316 $text = __( 'Edit This' ); 1317 } 1312 1318 1313 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $ link. '</a>';1319 $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '">' . $text . '</a>'; 1314 1320 1315 1321 /** 1316 1322 * Filter the comment edit link anchor tag. … … 1319 1325 * 1320 1326 * @param string $link Anchor tag for the edit link. 1321 1327 * @param int $comment_id Comment ID. 1328 * @param string $text Anchor text. 1322 1329 */ 1323 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;1330 echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID, $text ) . $after; 1324 1331 } 1325 1332 1326 1333 /**