Changeset 54943
- Timestamp:
- 12/06/2022 09:16:09 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r54842 r54943 40 40 * @global WP_Rewrite $wp_rewrite WordPress rewrite component. 41 41 * 42 * @param string $ stringURL with or without a trailing slash.42 * @param string $url URL with or without a trailing slash. 43 43 * @param string $type_of_url Optional. The type of URL being considered (e.g. single, category, etc) 44 44 * for use in the filter. Default empty string. 45 45 * @return string The URL with the trailing slash appended or stripped. 46 46 */ 47 function user_trailingslashit( $ string, $type_of_url = '' ) {47 function user_trailingslashit( $url, $type_of_url = '' ) { 48 48 global $wp_rewrite; 49 49 if ( $wp_rewrite->use_trailing_slashes ) { 50 $ string = trailingslashit( $string);51 } else { 52 $ string = untrailingslashit( $string);50 $url = trailingslashit( $url ); 51 } else { 52 $url = untrailingslashit( $url ); 53 53 } 54 54 … … 58 58 * @since 2.2.0 59 59 * 60 * @param string $ stringURL with or without a trailing slash.60 * @param string $url URL with or without a trailing slash. 61 61 * @param string $type_of_url The type of URL being considered. Accepts 'single', 'single_trackback', 62 62 * 'single_feed', 'single_paged', 'commentpaged', 'paged', 'home', 'feed', 63 63 * 'category', 'page', 'year', 'month', 'day', 'post_type_archive'. 64 64 */ 65 return apply_filters( 'user_trailingslashit', $ string, $type_of_url );65 return apply_filters( 'user_trailingslashit', $url, $type_of_url ); 66 66 } 67 67 … … 1123 1123 * @since 3.1.0 1124 1124 * 1125 * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty.1126 * @param string $before Optional. Display before edit link. Default empty.1127 * @param string $after Optional. Display after edit link. Default empty.1128 * @param int|WP_Term|null $term Optional. Term ID or object. If null, the queried object will be inspected. Default null.1129 * @param bool $ echoOptional. Whether or not to echo the return. Default true.1125 * @param string $link Optional. Anchor text. If empty, default is 'Edit This'. Default empty. 1126 * @param string $before Optional. Display before edit link. Default empty. 1127 * @param string $after Optional. Display after edit link. Default empty. 1128 * @param int|WP_Term|null $term Optional. Term ID or object. If null, the queried object will be inspected. Default null. 1129 * @param bool $display Optional. Whether or not to echo the return. Default true. 1130 1130 * @return string|void HTML content. 1131 1131 */ 1132 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $ echo= true ) {1132 function edit_term_link( $link = '', $before = '', $after = '', $term = null, $display = true ) { 1133 1133 if ( is_null( $term ) ) { 1134 1134 $term = get_queried_object(); … … 1162 1162 $link = $before . apply_filters( 'edit_term_link', $link, $term->term_id ) . $after; 1163 1163 1164 if ( $ echo) {1164 if ( $display ) { 1165 1165 echo $link; 1166 1166 } else { … … 1493 1493 * 1494 1494 * @since 1.0.0 1495 * @since 4.4.0 The `$c lass` argument was added.1496 * 1497 * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null.1498 * @param string $before Optional. Display before edit link. Default empty.1499 * @param string $after Optional. Display after edit link. Default empty.1500 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`.1501 * @param string $c lassOptional. Add custom class to link. Default 'post-edit-link'.1502 */ 1503 function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $c lass = 'post-edit-link' ) {1495 * @since 4.4.0 The `$css_class` argument was added. 1496 * 1497 * @param string $text Optional. Anchor text. If null, default is 'Edit This'. Default null. 1498 * @param string $before Optional. Display before edit link. Default empty. 1499 * @param string $after Optional. Display after edit link. Default empty. 1500 * @param int|WP_Post $post Optional. Post ID or post object. Default is the global `$post`. 1501 * @param string $css_class Optional. Add custom class to link. Default 'post-edit-link'. 1502 */ 1503 function edit_post_link( $text = null, $before = '', $after = '', $post = 0, $css_class = 'post-edit-link' ) { 1504 1504 $post = get_post( $post ); 1505 1505 … … 1518 1518 } 1519 1519 1520 $link = '<a class="' . esc_attr( $c lass ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>';1520 $link = '<a class="' . esc_attr( $css_class ) . '" href="' . esc_url( $url ) . '">' . $text . '</a>'; 1521 1521 1522 1522 /** … … 2489 2489 * 2490 2490 * @param int $max_page Optional. Max pages. Default 0. 2491 * @param bool $ echoOptional. Whether to echo the link. Default true.2492 * @return string|void The link URL for next posts page if `$ echo= false`.2493 */ 2494 function next_posts( $max_page = 0, $ echo= true ) {2491 * @param bool $display Optional. Whether to echo the link. Default true. 2492 * @return string|void The link URL for next posts page if `$display = false`. 2493 */ 2494 function next_posts( $max_page = 0, $display = true ) { 2495 2495 $output = esc_url( get_next_posts_page_link( $max_page ) ); 2496 2496 2497 if ( $ echo) {2497 if ( $display ) { 2498 2498 echo $output; 2499 2499 } else { … … 2587 2587 * @since 0.71 2588 2588 * 2589 * @param bool $ echoOptional. Whether to echo the link. Default true.2590 * @return string|void The previous posts page link if `$ echo= false`.2591 */ 2592 function previous_posts( $ echo= true ) {2589 * @param bool $display Optional. Whether to echo the link. Default true. 2590 * @return string|void The previous posts page link if `$display = false`. 2591 */ 2592 function previous_posts( $display = true ) { 2593 2593 $output = esc_url( get_previous_posts_page_link() ); 2594 2594 2595 if ( $ echo) {2595 if ( $display ) { 2596 2596 echo $output; 2597 2597 } else { … … 2959 2959 * 2960 2960 * @param string $links Navigational links. 2961 * @param string $c lassOptional. Custom class for the nav element.2961 * @param string $css_class Optional. Custom class for the nav element. 2962 2962 * Default 'posts-navigation'. 2963 2963 * @param string $screen_reader_text Optional. Screen reader text for the nav element. … … 2967 2967 * @return string Navigation template tag. 2968 2968 */ 2969 function _navigation_markup( $links, $c lass = 'posts-navigation', $screen_reader_text = '', $aria_label = '' ) {2969 function _navigation_markup( $links, $css_class = 'posts-navigation', $screen_reader_text = '', $aria_label = '' ) { 2970 2970 if ( empty( $screen_reader_text ) ) { 2971 2971 $screen_reader_text = __( 'Posts navigation' ); … … 2995 2995 * @since 4.4.0 2996 2996 * 2997 * @param string $template The default template.2998 * @param string $c lassThe class passed by the calling function.2997 * @param string $template The default template. 2998 * @param string $css_class The class passed by the calling function. 2999 2999 * @return string Navigation template. 3000 3000 */ 3001 $template = apply_filters( 'navigation_markup_template', $template, $c lass );3002 3003 return sprintf( $template, sanitize_html_class( $c lass ), esc_html( $screen_reader_text ), $links, esc_html( $aria_label ) );3001 $template = apply_filters( 'navigation_markup_template', $template, $css_class ); 3002 3003 return sprintf( $template, sanitize_html_class( $css_class ), esc_html( $screen_reader_text ), $links, esc_html( $aria_label ) ); 3004 3004 } 3005 3005
Note: See TracChangeset
for help on using the changeset viewer.