Changeset 51122
- Timestamp:
- 06/08/2021 11:12:22 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpcs.xml.dist
r50697 r51122 250 250 <element value="Tests_Query_Conditionals"/> 251 251 <element value="WP_Test_XML_TestCase"/> 252 <element value="WP_Test_Adjacent_Image_Link_TestCase"/> 252 253 253 254 <!-- Mock classes. --> -
trunk/src/wp-includes/media.php
r50831 r51122 3378 3378 3379 3379 /** 3380 * Displaysprevious image link that has the same post parent.3381 * 3382 * @since 2.5.03383 * 3384 * @see adjacent_image_link()3380 * Gets the previous image link that has the same post parent. 3381 * 3382 * @since 5.8.0 3383 * 3384 * @see get_adjacent_image_link() 3385 3385 * 3386 3386 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 3387 3387 * of width and height values in pixels (in that order). Default 'thumbnail'. 3388 3388 * @param string|false $text Optional. Link text. Default false. 3389 */ 3390 function previous_image_link( $size = 'thumbnail', $text = false ) { 3391 adjacent_image_link( true, $size, $text ); 3392 } 3393 3394 /** 3395 * Displays next image link that has the same post parent. 3389 * @return string Markup for previous image link. 3390 */ 3391 function get_previous_image_link( $size = 'thumbnail', $text = false ) { 3392 return get_adjacent_image_link( true, $size, $text ); 3393 } 3394 3395 /** 3396 * Displays previous image link that has the same post parent. 3396 3397 * 3397 3398 * @since 2.5.0 3398 *3399 * @see adjacent_image_link()3400 3399 * 3401 3400 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array … … 3403 3402 * @param string|false $text Optional. Link text. Default false. 3404 3403 */ 3404 function previous_image_link( $size = 'thumbnail', $text = false ) { 3405 echo get_previous_image_link( $size, $text ); 3406 } 3407 3408 /** 3409 * Gets the next image link that has the same post parent. 3410 * 3411 * @since 5.8.0 3412 * 3413 * @see get_adjacent_image_link() 3414 * 3415 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 3416 * of width and height values in pixels (in that order). Default 'thumbnail'. 3417 * @param string|false $text Optional. Link text. Default false. 3418 * @return string Markup for next image link. 3419 */ 3420 function get_next_image_link( $size = 'thumbnail', $text = false ) { 3421 return get_adjacent_image_link( false, $size, $text ); 3422 } 3423 3424 /** 3425 * Displays next image link that has the same post parent. 3426 * 3427 * @since 2.5.0 3428 * 3429 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 3430 * of width and height values in pixels (in that order). Default 'thumbnail'. 3431 * @param string|false $text Optional. Link text. Default false. 3432 */ 3405 3433 function next_image_link( $size = 'thumbnail', $text = false ) { 3406 adjacent_image_link( false,$size, $text );3407 } 3408 3409 /** 3410 * Displaysnext or previous image link that has the same post parent.3434 echo get_next_image_link( $size, $text ); 3435 } 3436 3437 /** 3438 * Gets the next or previous image link that has the same post parent. 3411 3439 * 3412 3440 * Retrieves the current attachment object from the $post global. 3413 3441 * 3414 * @since 2.5.03442 * @since 5.8.0 3415 3443 * 3416 3444 * @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true. … … 3418 3446 * of width and height values in pixels (in that order). Default 'thumbnail'. 3419 3447 * @param bool $text Optional. Link text. Default false. 3420 */ 3421 function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { 3448 * @return string Markup for image link. 3449 */ 3450 function get_adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { 3422 3451 $post = get_post(); 3423 3452 $attachments = array_values( … … 3474 3503 * @param string $text Link text. 3475 3504 */ 3476 echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); 3505 return apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text ); 3506 } 3507 3508 /** 3509 * Displays next or previous image link that has the same post parent. 3510 * 3511 * Retrieves the current attachment object from the $post global. 3512 * 3513 * @since 2.5.0 3514 * 3515 * @param bool $prev Optional. Whether to display the next (false) or previous (true) link. Default true. 3516 * @param string|int[] $size Optional. Image size. Accepts any registered image size name, or an array 3517 * of width and height values in pixels (in that order). Default 'thumbnail'. 3518 * @param bool $text Optional. Link text. Default false. 3519 */ 3520 function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) { 3521 echo get_adjacent_image_link( $prev, $size, $text ); 3477 3522 } 3478 3523
Note: See TracChangeset
for help on using the changeset viewer.