Changeset 54932
- Timestamp:
- 12/04/2022 01:20:50 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/general-template.php
r54868 r54932 371 371 * 372 372 * @param string $redirect Optional path to redirect to on login/logout. 373 * @param bool $ echoDefault to echo and not return the link.374 * @return void|string Void if `$ echo` argument is true, log in/out link if `$echo` is false.375 */ 376 function wp_loginout( $redirect = '', $ echo= true ) {373 * @param bool $display Default to echo and not return the link. 374 * @return void|string Void if `$display` argument is true, log in/out link if `$display` is false. 375 */ 376 function wp_loginout( $redirect = '', $display = true ) { 377 377 if ( ! is_user_logged_in() ) { 378 378 $link = '<a href="' . esc_url( wp_login_url( $redirect ) ) . '">' . __( 'Log in' ) . '</a>'; … … 381 381 } 382 382 383 if ( $ echo) {383 if ( $display ) { 384 384 /** 385 385 * Filters the HTML output for the Log In/Log Out link. … … 674 674 * @since 1.5.0 675 675 * 676 * @param string $before Text to output before the link. Default `<li>`.677 * @param string $after Text to output after the link. Default `</li>`.678 * @param bool $ echoDefault to echo and not return the link.679 * @return void|string Void if `$ echo` argument is true, registration or admin link680 * if `$ echo` is false.681 */ 682 function wp_register( $before = '<li>', $after = '</li>', $ echo= true ) {676 * @param string $before Text to output before the link. Default `<li>`. 677 * @param string $after Text to output after the link. Default `</li>`. 678 * @param bool $display Default to echo and not return the link. 679 * @return void|string Void if `$display` argument is true, registration or admin link 680 * if `$display` is false. 681 */ 682 function wp_register( $before = '<li>', $after = '</li>', $display = true ) { 683 683 if ( ! is_user_logged_in() ) { 684 684 if ( get_option( 'users_can_register' ) ) { … … 705 705 $link = apply_filters( 'register', $link ); 706 706 707 if ( $ echo) {707 if ( $display ) { 708 708 echo $link; 709 709 } else { … … 2221 2221 * 2222 2222 * @param bool $initial Optional. Whether to use initial calendar names. Default true. 2223 * @param bool $ echoOptional. Whether to display the calendar output. Default true.2224 * @return void|string Void if `$ echo` argument is true, calendar HTML if `$echo` is false.2225 */ 2226 function get_calendar( $initial = true, $ echo= true ) {2223 * @param bool $display Optional. Whether to display the calendar output. Default true. 2224 * @return void|string Void if `$display` argument is true, calendar HTML if `$display` is false. 2225 */ 2226 function get_calendar( $initial = true, $display = true ) { 2227 2227 global $wpdb, $m, $monthnum, $year, $wp_locale, $posts; 2228 2228 … … 2234 2234 $output = apply_filters( 'get_calendar', $cache[ $key ] ); 2235 2235 2236 if ( $ echo) {2236 if ( $display ) { 2237 2237 echo $output; 2238 2238 return; … … 2431 2431 wp_cache_set( 'get_calendar', $cache, 'calendar' ); 2432 2432 2433 if ( $ echo) {2433 if ( $display ) { 2434 2434 /** 2435 2435 * Filters the HTML calendar output. … … 2512 2512 * @global string $previousday The day of the previous post in the loop. 2513 2513 * 2514 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.2515 * @param string $before Optional. Output before the date. Default empty.2516 * @param string $after Optional. Output after the date. Default empty.2517 * @param bool $ echoOptional. Whether to echo the date or return it. Default true.2514 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. 2515 * @param string $before Optional. Output before the date. Default empty. 2516 * @param string $after Optional. Output after the date. Default empty. 2517 * @param bool $display Optional. Whether to echo the date or return it. Default true. 2518 2518 * @return string|void String if retrieving. 2519 2519 */ 2520 function the_date( $format = '', $before = '', $after = '', $ echo= true ) {2520 function the_date( $format = '', $before = '', $after = '', $display = true ) { 2521 2521 global $currentday, $previousday; 2522 2522 … … 2540 2540 $the_date = apply_filters( 'the_date', $the_date, $format, $before, $after ); 2541 2541 2542 if ( $ echo) {2542 if ( $display ) { 2543 2543 echo $the_date; 2544 2544 } else { … … 2587 2587 * @since 2.1.0 2588 2588 * 2589 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option.2590 * @param string $before Optional. Output before the date. Default empty.2591 * @param string $after Optional. Output after the date. Default empty.2592 * @param bool $ echoOptional. Whether to echo the date or return it. Default true.2589 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. 2590 * @param string $before Optional. Output before the date. Default empty. 2591 * @param string $after Optional. Output after the date. Default empty. 2592 * @param bool $display Optional. Whether to echo the date or return it. Default true. 2593 2593 * @return string|void String if retrieving. 2594 2594 */ 2595 function the_modified_date( $format = '', $before = '', $after = '', $ echo= true ) {2595 function the_modified_date( $format = '', $before = '', $after = '', $display = true ) { 2596 2596 $the_modified_date = $before . get_the_modified_date( $format ) . $after; 2597 2597 … … 2608 2608 $the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $format, $before, $after ); 2609 2609 2610 if ( $ echo) {2610 if ( $display ) { 2611 2611 echo $the_modified_date; 2612 2612 } else { … … 5067 5067 * @param mixed $current Optional. The other value to compare if not just true. 5068 5068 * Default true. 5069 * @param bool $ echoOptional. Whether to echo or just return the string.5069 * @param bool $display Optional. Whether to echo or just return the string. 5070 5070 * Default true. 5071 5071 * @return string HTML attribute or empty string. 5072 5072 */ 5073 function checked( $checked, $current = true, $ echo= true ) {5074 return __checked_selected_helper( $checked, $current, $ echo, 'checked' );5073 function checked( $checked, $current = true, $display = true ) { 5074 return __checked_selected_helper( $checked, $current, $display, 'checked' ); 5075 5075 } 5076 5076 … … 5085 5085 * @param mixed $current Optional. The other value to compare if not just true. 5086 5086 * Default true. 5087 * @param bool $ echoOptional. Whether to echo or just return the string.5087 * @param bool $display Optional. Whether to echo or just return the string. 5088 5088 * Default true. 5089 5089 * @return string HTML attribute or empty string. 5090 5090 */ 5091 function selected( $selected, $current = true, $ echo= true ) {5092 return __checked_selected_helper( $selected, $current, $ echo, 'selected' );5091 function selected( $selected, $current = true, $display = true ) { 5092 return __checked_selected_helper( $selected, $current, $display, 'selected' ); 5093 5093 } 5094 5094 … … 5103 5103 * @param mixed $current Optional. The other value to compare if not just true. 5104 5104 * Default true. 5105 * @param bool $ echoOptional. Whether to echo or just return the string.5105 * @param bool $display Optional. Whether to echo or just return the string. 5106 5106 * Default true. 5107 5107 * @return string HTML attribute or empty string. 5108 5108 */ 5109 function disabled( $disabled, $current = true, $ echo= true ) {5110 return __checked_selected_helper( $disabled, $current, $ echo, 'disabled' );5109 function disabled( $disabled, $current = true, $display = true ) { 5110 return __checked_selected_helper( $disabled, $current, $display, 'disabled' ); 5111 5111 } 5112 5112 … … 5118 5118 * @since 5.9.0 5119 5119 * 5120 * @param mixed $readonly One of the values to compare.5121 * @param mixed $current Optional. The other value to compare if not just true.5122 * Default true.5123 * @param bool $ echoOptional. Whether to echo or just return the string.5124 * Default true.5120 * @param mixed $readonly_value One of the values to compare. 5121 * @param mixed $current Optional. The other value to compare if not just true. 5122 * Default true. 5123 * @param bool $display Optional. Whether to echo or just return the string. 5124 * Default true. 5125 5125 * @return string HTML attribute or empty string. 5126 5126 */ 5127 function wp_readonly( $readonly , $current = true, $echo= true ) {5128 return __checked_selected_helper( $readonly , $current, $echo, 'readonly' );5127 function wp_readonly( $readonly_value, $current = true, $display = true ) { 5128 return __checked_selected_helper( $readonly_value, $current, $display, 'readonly' ); 5129 5129 } 5130 5130 … … 5149 5149 * @param mixed $helper One of the values to compare. 5150 5150 * @param mixed $current The other value to compare if not just true. 5151 * @param bool $ echoWhether to echo or just return the string.5151 * @param bool $display Whether to echo or just return the string. 5152 5152 * @param string $type The type of checked|selected|disabled|readonly we are doing. 5153 5153 * @return string HTML attribute or empty string. 5154 5154 */ 5155 function __checked_selected_helper( $helper, $current, $ echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore5155 function __checked_selected_helper( $helper, $current, $display, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore 5156 5156 if ( (string) $helper === (string) $current ) { 5157 5157 $result = " $type='$type'"; … … 5160 5160 } 5161 5161 5162 if ( $ echo) {5162 if ( $display ) { 5163 5163 echo $result; 5164 5164 }
Note: See TracChangeset
for help on using the changeset viewer.