changeset 19 | 3d72ae0968f4 |
parent 18 | be944660c56a |
child 21 | 48c4eec2b7e6 |
18:be944660c56a | 19:3d72ae0968f4 |
---|---|
187 } |
187 } |
188 |
188 |
189 $templates[] = "{$slug}.php"; |
189 $templates[] = "{$slug}.php"; |
190 |
190 |
191 /** |
191 /** |
192 * Fires before a template part is loaded. |
192 * Fires before an attempt is made to locate and load a template part. |
193 * |
193 * |
194 * @since 5.2.0 |
194 * @since 5.2.0 |
195 * @since 5.5.0 The `$args` parameter was added. |
195 * @since 5.5.0 The `$args` parameter was added. |
196 * |
196 * |
197 * @param string $slug The slug name for the generic template. |
197 * @param string $slug The slug name for the generic template. |
574 * @param string $content Content to display. Default empty. |
574 * @param string $content Content to display. Default empty. |
575 * @param array $args Array of login form arguments. |
575 * @param array $args Array of login form arguments. |
576 */ |
576 */ |
577 $login_form_bottom = apply_filters( 'login_form_bottom', '', $args ); |
577 $login_form_bottom = apply_filters( 'login_form_bottom', '', $args ); |
578 |
578 |
579 $form = ' |
579 $form = |
580 <form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post"> |
580 sprintf( |
581 ' . $login_form_top . ' |
581 '<form name="%1$s" id="%1$s" action="%2$s" method="post">', |
582 <p class="login-username"> |
582 esc_attr( $args['form_id'] ), |
583 <label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label> |
583 esc_url( site_url( 'wp-login.php', 'login_post' ) ) |
584 <input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" /> |
584 ) . |
585 </p> |
585 $login_form_top . |
586 <p class="login-password"> |
586 sprintf( |
587 <label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label> |
587 '<p class="login-username"> |
588 <input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" /> |
588 <label for="%1$s">%2$s</label> |
589 </p> |
589 <input type="text" name="log" id="%1$s" autocomplete="username" class="input" value="%3$s" size="20" /> |
590 ' . $login_form_middle . ' |
590 </p>', |
591 ' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . ' |
591 esc_attr( $args['id_username'] ), |
592 <p class="login-submit"> |
592 esc_html( $args['label_username'] ), |
593 <input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" /> |
593 esc_attr( $args['value_username'] ) |
594 <input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" /> |
594 ) . |
595 </p> |
595 sprintf( |
596 ' . $login_form_bottom . ' |
596 '<p class="login-password"> |
597 </form>'; |
597 <label for="%1$s">%2$s</label> |
598 <input type="password" name="pwd" id="%1$s" autocomplete="current-password" class="input" value="" size="20" /> |
|
599 </p>', |
|
600 esc_attr( $args['id_password'] ), |
|
601 esc_html( $args['label_password'] ) |
|
602 ) . |
|
603 $login_form_middle . |
|
604 ( $args['remember'] ? |
|
605 sprintf( |
|
606 '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="%1$s" value="forever"%2$s /> %3$s</label></p>', |
|
607 esc_attr( $args['id_remember'] ), |
|
608 ( $args['value_remember'] ? ' checked="checked"' : '' ), |
|
609 esc_html( $args['label_remember'] ) |
|
610 ) : '' |
|
611 ) . |
|
612 sprintf( |
|
613 '<p class="login-submit"> |
|
614 <input type="submit" name="wp-submit" id="%1$s" class="button button-primary" value="%2$s" /> |
|
615 <input type="hidden" name="redirect_to" value="%3$s" /> |
|
616 </p>', |
|
617 esc_attr( $args['id_submit'] ), |
|
618 esc_attr( $args['label_log_in'] ), |
|
619 esc_url( $args['redirect'] ) |
|
620 ) . |
|
621 $login_form_bottom . |
|
622 '</form>'; |
|
598 |
623 |
599 if ( $args['echo'] ) { |
624 if ( $args['echo'] ) { |
600 echo $form; |
625 echo $form; |
601 } else { |
626 } else { |
602 return $form; |
627 return $form; |
1288 * |
1313 * |
1289 * @param string $sep Optional. How to separate the various items within the page title. |
1314 * @param string $sep Optional. How to separate the various items within the page title. |
1290 * Default '»'. |
1315 * Default '»'. |
1291 * @param bool $display Optional. Whether to display or retrieve title. Default true. |
1316 * @param bool $display Optional. Whether to display or retrieve title. Default true. |
1292 * @param string $seplocation Optional. Location of the separator ('left' or 'right'). |
1317 * @param string $seplocation Optional. Location of the separator ('left' or 'right'). |
1293 * @return string|null String on retrieve, null when displaying. |
1318 * @return string|void String when `$display` is false, nothing otherwise. |
1294 */ |
1319 */ |
1295 function wp_title( $sep = '»', $display = true, $seplocation = '' ) { |
1320 function wp_title( $sep = '»', $display = true, $seplocation = '' ) { |
1296 global $wp_locale; |
1321 global $wp_locale; |
1297 |
1322 |
1298 $m = get_query_var( 'm' ); |
1323 $m = get_query_var( 'm' ); |
1349 } |
1374 } |
1350 |
1375 |
1351 // If there's a month. |
1376 // If there's a month. |
1352 if ( is_archive() && ! empty( $m ) ) { |
1377 if ( is_archive() && ! empty( $m ) ) { |
1353 $my_year = substr( $m, 0, 4 ); |
1378 $my_year = substr( $m, 0, 4 ); |
1354 $my_month = $wp_locale->get_month( substr( $m, 4, 2 ) ); |
1379 $my_month = substr( $m, 4, 2 ); |
1355 $my_day = (int) substr( $m, 6, 2 ); |
1380 $my_day = (int) substr( $m, 6, 2 ); |
1356 $title = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' ); |
1381 $title = $my_year . |
1382 ( $my_month ? $t_sep . $wp_locale->get_month( $my_month ) : '' ) . |
|
1383 ( $my_day ? $t_sep . $my_day : '' ); |
|
1357 } |
1384 } |
1358 |
1385 |
1359 // If there's a year. |
1386 // If there's a year. |
1360 if ( is_archive() && ! empty( $year ) ) { |
1387 if ( is_archive() && ! empty( $year ) ) { |
1361 $title = $year; |
1388 $title = $year; |
1607 * |
1634 * |
1608 * @global WP_Locale $wp_locale WordPress date and time locale object. |
1635 * @global WP_Locale $wp_locale WordPress date and time locale object. |
1609 * |
1636 * |
1610 * @param string $prefix Optional. What to display before the title. |
1637 * @param string $prefix Optional. What to display before the title. |
1611 * @param bool $display Optional. Whether to display or retrieve title. Default true. |
1638 * @param bool $display Optional. Whether to display or retrieve title. Default true. |
1612 * @return string|void Title when retrieving. |
1639 * @return string|false|void False if there's no valid title for the month. Title when retrieving. |
1613 */ |
1640 */ |
1614 function single_month_title( $prefix = '', $display = true ) { |
1641 function single_month_title( $prefix = '', $display = true ) { |
1615 global $wp_locale; |
1642 global $wp_locale; |
1616 |
1643 |
1617 $m = get_query_var( 'm' ); |
1644 $m = get_query_var( 'm' ); |
2526 * |
2553 * |
2527 * @since 3.0.0 |
2554 * @since 3.0.0 |
2528 * |
2555 * |
2529 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2556 * @param string $format Optional. PHP date format. Defaults to the 'date_format' option. |
2530 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2557 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post. |
2531 * @return string|false Date the current post was written. False on failure. |
2558 * @return string|int|false Date the current post was written. False on failure. |
2532 */ |
2559 */ |
2533 function get_the_date( $format = '', $post = null ) { |
2560 function get_the_date( $format = '', $post = null ) { |
2534 $post = get_post( $post ); |
2561 $post = get_post( $post ); |
2535 |
2562 |
2536 if ( ! $post ) { |
2563 if ( ! $post ) { |
2544 /** |
2571 /** |
2545 * Filters the date a post was published. |
2572 * Filters the date a post was published. |
2546 * |
2573 * |
2547 * @since 3.0.0 |
2574 * @since 3.0.0 |
2548 * |
2575 * |
2549 * @param string $the_date The formatted date. |
2576 * @param string|int $the_date Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2550 * @param string $format PHP date format. |
2577 * @param string $format PHP date format. |
2551 * @param int|WP_Post $post The post object or ID. |
2578 * @param WP_Post $post The post object. |
2552 */ |
2579 */ |
2553 return apply_filters( 'get_the_date', $the_date, $format, $post ); |
2580 return apply_filters( 'get_the_date', $the_date, $format, $post ); |
2554 } |
2581 } |
2555 |
2582 |
2556 /** |
2583 /** |
2670 /** |
2697 /** |
2671 * Filters the time a post was written. |
2698 * Filters the time a post was written. |
2672 * |
2699 * |
2673 * @since 1.5.0 |
2700 * @since 1.5.0 |
2674 * |
2701 * |
2675 * @param string $the_time The formatted time. |
2702 * @param string|int $the_time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2676 * @param string $format Format to use for retrieving the time the post |
2703 * @param string $format Format to use for retrieving the time the post |
2677 * was written. Accepts 'G', 'U', or PHP date format. |
2704 * was written. Accepts 'G', 'U', or PHP date format. |
2678 * @param int|WP_Post $post WP_Post object or ID. |
2705 * @param WP_Post $post Post object. |
2679 */ |
2706 */ |
2680 return apply_filters( 'get_the_time', $the_time, $format, $post ); |
2707 return apply_filters( 'get_the_time', $the_time, $format, $post ); |
2681 } |
2708 } |
2682 |
2709 |
2683 /** |
2710 /** |
2727 /** |
2754 /** |
2728 * Filters the localized time a post was written. |
2755 * Filters the localized time a post was written. |
2729 * |
2756 * |
2730 * @since 2.6.0 |
2757 * @since 2.6.0 |
2731 * |
2758 * |
2732 * @param string $time The formatted time. |
2759 * @param string|int $time Formatted date string or Unix timestamp if `$format` is 'U' or 'G'. |
2733 * @param string $format Format to use for retrieving the time the post was written. |
2760 * @param string $format Format to use for retrieving the time the post was written. |
2734 * Accepts 'G', 'U', or PHP date format. Default 'U'. |
2761 * Accepts 'G', 'U', or PHP date format. |
2735 * @param bool $gmt Whether to retrieve the GMT time. Default false. |
2762 * @param bool $gmt Whether to retrieve the GMT time. |
2736 */ |
2763 */ |
2737 return apply_filters( 'get_post_time', $time, $format, $gmt ); |
2764 return apply_filters( 'get_post_time', $time, $format, $gmt ); |
2738 } |
2765 } |
2739 |
2766 |
2740 /** |
2767 /** |
3124 |
3151 |
3125 if ( is_singular() ) { |
3152 if ( is_singular() ) { |
3126 $id = 0; |
3153 $id = 0; |
3127 $post = get_post( $id ); |
3154 $post = get_post( $id ); |
3128 |
3155 |
3129 if ( comments_open() || pings_open() || $post->comment_count > 0 ) { |
3156 /** This filter is documented in wp-includes/general-template.php */ |
3130 $title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); |
3157 $show_comments_feed = apply_filters( 'feed_links_show_comments_feed', true ); |
3131 $href = get_post_comments_feed_link( $post->ID ); |
3158 |
3159 if ( $show_comments_feed && ( comments_open() || pings_open() || $post->comment_count > 0 ) ) { |
|
3160 $title = sprintf( $args['singletitle'], get_bloginfo( 'name' ), $args['separator'], the_title_attribute( array( 'echo' => false ) ) ); |
|
3161 $feed_link = get_post_comments_feed_link( $post->ID ); |
|
3162 |
|
3163 if ( $feed_link ) { |
|
3164 $href = $feed_link; |
|
3165 } |
|
3132 } |
3166 } |
3133 } elseif ( is_post_type_archive() ) { |
3167 } elseif ( is_post_type_archive() ) { |
3134 $post_type = get_query_var( 'post_type' ); |
3168 $post_type = get_query_var( 'post_type' ); |
3135 if ( is_array( $post_type ) ) { |
3169 if ( is_array( $post_type ) ) { |
3136 $post_type = reset( $post_type ); |
3170 $post_type = reset( $post_type ); |
3195 function wlwmanifest_link() { |
3229 function wlwmanifest_link() { |
3196 echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="' . includes_url( 'wlwmanifest.xml' ) . '" /> ' . "\n"; |
3230 echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="' . includes_url( 'wlwmanifest.xml' ) . '" /> ' . "\n"; |
3197 } |
3231 } |
3198 |
3232 |
3199 /** |
3233 /** |
3200 * Displays a referrer strict-origin-when-cross-origin meta tag. |
3234 * Displays a referrer `strict-origin-when-cross-origin` meta tag. |
3201 * |
3235 * |
3202 * Outputs a referrer origin-when-cross-origin meta tag that tells the browser not to send the full |
3236 * Outputs a referrer `strict-origin-when-cross-origin` meta tag that tells the browser not to send |
3203 * url as a referrer to other sites when cross-origin assets are loaded. |
3237 * the full URL as a referrer to other sites when cross-origin assets are loaded. |
3204 * |
3238 * |
3205 * Typical usage is as a wp_head callback. add_action( 'wp_head', 'wp_strict_cross_origin_referrer' ); |
3239 * Typical usage is as a {@see 'wp_head'} callback: |
3240 * |
|
3241 * add_action( 'wp_head', 'wp_strict_cross_origin_referrer' ); |
|
3206 * |
3242 * |
3207 * @since 5.7.0 |
3243 * @since 5.7.0 |
3208 */ |
3244 */ |
3209 function wp_strict_cross_origin_referrer() { |
3245 function wp_strict_cross_origin_referrer() { |
3210 ?> |
3246 ?> |
3549 * @param array $args { |
3585 * @param array $args { |
3550 * Args. |
3586 * Args. |
3551 * |
3587 * |
3552 * @type string $type The MIME type of the file to be edited. |
3588 * @type string $type The MIME type of the file to be edited. |
3553 * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. |
3589 * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. |
3554 * @type WP_Theme $theme Theme being edited when on theme editor. |
3590 * @type WP_Theme $theme Theme being edited when on the theme file editor. |
3555 * @type string $plugin Plugin being edited when on plugin editor. |
3591 * @type string $plugin Plugin being edited when on the plugin file editor. |
3556 * @type array $codemirror Additional CodeMirror setting overrides. |
3592 * @type array $codemirror Additional CodeMirror setting overrides. |
3557 * @type array $csslint CSSLint rule overrides. |
3593 * @type array $csslint CSSLint rule overrides. |
3558 * @type array $jshint JSHint rule overrides. |
3594 * @type array $jshint JSHint rule overrides. |
3559 * @type array $htmlhint HTMLHint rule overrides. |
3595 * @type array $htmlhint HTMLHint rule overrides. |
3560 * } |
3596 * } |
3640 * @param array $args { |
3676 * @param array $args { |
3641 * Args. |
3677 * Args. |
3642 * |
3678 * |
3643 * @type string $type The MIME type of the file to be edited. |
3679 * @type string $type The MIME type of the file to be edited. |
3644 * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. |
3680 * @type string $file Filename to be edited. Extension is used to sniff the type. Can be supplied as alternative to `$type` param. |
3645 * @type WP_Theme $theme Theme being edited when on theme editor. |
3681 * @type WP_Theme $theme Theme being edited when on the theme file editor. |
3646 * @type string $plugin Plugin being edited when on plugin editor. |
3682 * @type string $plugin Plugin being edited when on the plugin file editor. |
3647 * @type array $codemirror Additional CodeMirror setting overrides. |
3683 * @type array $codemirror Additional CodeMirror setting overrides. |
3648 * @type array $csslint CSSLint rule overrides. |
3684 * @type array $csslint CSSLint rule overrides. |
3649 * @type array $jshint JSHint rule overrides. |
3685 * @type array $jshint JSHint rule overrides. |
3650 * @type array $htmlhint HTMLHint rule overrides. |
3686 * @type array $htmlhint HTMLHint rule overrides. |
3651 * } |
3687 * } |
3977 * @param array $args { |
4013 * @param array $args { |
3978 * Args passed when calling `get_code_editor_settings()`. |
4014 * Args passed when calling `get_code_editor_settings()`. |
3979 * |
4015 * |
3980 * @type string $type The MIME type of the file to be edited. |
4016 * @type string $type The MIME type of the file to be edited. |
3981 * @type string $file Filename being edited. |
4017 * @type string $file Filename being edited. |
3982 * @type WP_Theme $theme Theme being edited when on theme editor. |
4018 * @type WP_Theme $theme Theme being edited when on the theme file editor. |
3983 * @type string $plugin Plugin being edited when on plugin editor. |
4019 * @type string $plugin Plugin being edited when on the plugin file editor. |
3984 * @type array $codemirror Additional CodeMirror setting overrides. |
4020 * @type array $codemirror Additional CodeMirror setting overrides. |
3985 * @type array $csslint CSSLint rule overrides. |
4021 * @type array $csslint CSSLint rule overrides. |
3986 * @type array $jshint JSHint rule overrides. |
4022 * @type array $jshint JSHint rule overrides. |
3987 * @type array $htmlhint HTMLHint rule overrides. |
4023 * @type array $htmlhint HTMLHint rule overrides. |
3988 * } |
4024 * } |
4761 } |
4797 } |
4762 |
4798 |
4763 /** |
4799 /** |
4764 * Outputs the HTML checked attribute. |
4800 * Outputs the HTML checked attribute. |
4765 * |
4801 * |
4766 * Compares the first two arguments and if identical marks as checked |
4802 * Compares the first two arguments and if identical marks as checked. |
4767 * |
4803 * |
4768 * @since 1.0.0 |
4804 * @since 1.0.0 |
4769 * |
4805 * |
4770 * @param mixed $checked One of the values to compare |
4806 * @param mixed $checked One of the values to compare. |
4771 * @param mixed $current (true) The other value to compare if not just true |
4807 * @param mixed $current Optional. The other value to compare if not just true. |
4772 * @param bool $echo Whether to echo or just return the string |
4808 * Default true. |
4773 * @return string HTML attribute or empty string |
4809 * @param bool $echo Optional. Whether to echo or just return the string. |
4810 * Default true. |
|
4811 * @return string HTML attribute or empty string. |
|
4774 */ |
4812 */ |
4775 function checked( $checked, $current = true, $echo = true ) { |
4813 function checked( $checked, $current = true, $echo = true ) { |
4776 return __checked_selected_helper( $checked, $current, $echo, 'checked' ); |
4814 return __checked_selected_helper( $checked, $current, $echo, 'checked' ); |
4777 } |
4815 } |
4778 |
4816 |
4779 /** |
4817 /** |
4780 * Outputs the HTML selected attribute. |
4818 * Outputs the HTML selected attribute. |
4781 * |
4819 * |
4782 * Compares the first two arguments and if identical marks as selected |
4820 * Compares the first two arguments and if identical marks as selected. |
4783 * |
4821 * |
4784 * @since 1.0.0 |
4822 * @since 1.0.0 |
4785 * |
4823 * |
4786 * @param mixed $selected One of the values to compare |
4824 * @param mixed $selected One of the values to compare. |
4787 * @param mixed $current (true) The other value to compare if not just true |
4825 * @param mixed $current Optional. The other value to compare if not just true. |
4788 * @param bool $echo Whether to echo or just return the string |
4826 * Default true. |
4789 * @return string HTML attribute or empty string |
4827 * @param bool $echo Optional. Whether to echo or just return the string. |
4828 * Default true. |
|
4829 * @return string HTML attribute or empty string. |
|
4790 */ |
4830 */ |
4791 function selected( $selected, $current = true, $echo = true ) { |
4831 function selected( $selected, $current = true, $echo = true ) { |
4792 return __checked_selected_helper( $selected, $current, $echo, 'selected' ); |
4832 return __checked_selected_helper( $selected, $current, $echo, 'selected' ); |
4793 } |
4833 } |
4794 |
4834 |
4795 /** |
4835 /** |
4796 * Outputs the HTML disabled attribute. |
4836 * Outputs the HTML disabled attribute. |
4797 * |
4837 * |
4798 * Compares the first two arguments and if identical marks as disabled |
4838 * Compares the first two arguments and if identical marks as disabled. |
4799 * |
4839 * |
4800 * @since 3.0.0 |
4840 * @since 3.0.0 |
4801 * |
4841 * |
4802 * @param mixed $disabled One of the values to compare |
4842 * @param mixed $disabled One of the values to compare. |
4803 * @param mixed $current (true) The other value to compare if not just true |
4843 * @param mixed $current Optional. The other value to compare if not just true. |
4804 * @param bool $echo Whether to echo or just return the string |
4844 * Default true. |
4805 * @return string HTML attribute or empty string |
4845 * @param bool $echo Optional. Whether to echo or just return the string. |
4846 * Default true. |
|
4847 * @return string HTML attribute or empty string. |
|
4806 */ |
4848 */ |
4807 function disabled( $disabled, $current = true, $echo = true ) { |
4849 function disabled( $disabled, $current = true, $echo = true ) { |
4808 return __checked_selected_helper( $disabled, $current, $echo, 'disabled' ); |
4850 return __checked_selected_helper( $disabled, $current, $echo, 'disabled' ); |
4809 } |
4851 } |
4810 |
4852 |
4811 /** |
4853 /** |
4812 * Outputs the HTML readonly attribute. |
4854 * Outputs the HTML readonly attribute. |
4813 * |
4855 * |
4814 * Compares the first two arguments and if identical marks as readonly |
4856 * Compares the first two arguments and if identical marks as readonly. |
4815 * |
4857 * |
4816 * @since 4.9.0 |
4858 * @since 5.9.0 |
4817 * |
4859 * |
4818 * @param mixed $readonly One of the values to compare |
4860 * @param mixed $readonly One of the values to compare. |
4819 * @param mixed $current (true) The other value to compare if not just true |
4861 * @param mixed $current Optional. The other value to compare if not just true. |
4820 * @param bool $echo Whether to echo or just return the string |
4862 * Default true. |
4821 * @return string HTML attribute or empty string |
4863 * @param bool $echo Optional. Whether to echo or just return the string. |
4822 */ |
4864 * Default true. |
4823 function readonly( $readonly, $current = true, $echo = true ) { |
4865 * @return string HTML attribute or empty string. |
4866 */ |
|
4867 function wp_readonly( $readonly, $current = true, $echo = true ) { |
|
4824 return __checked_selected_helper( $readonly, $current, $echo, 'readonly' ); |
4868 return __checked_selected_helper( $readonly, $current, $echo, 'readonly' ); |
4825 } |
4869 } |
4826 |
4870 |
4871 /* |
|
4872 * Include a compat `readonly()` function on PHP < 8.1. Since PHP 8.1, |
|
4873 * `readonly` is a reserved keyword and cannot be used as a function name. |
|
4874 * In order to avoid PHP parser errors, this function was extracted |
|
4875 * to a separate file and is only included conditionally on PHP < 8.1. |
|
4876 */ |
|
4877 if ( PHP_VERSION_ID < 80100 ) { |
|
4878 require_once __DIR__ . '/php-compat/readonly.php'; |
|
4879 } |
|
4880 |
|
4827 /** |
4881 /** |
4828 * Private helper function for checked, selected, disabled and readonly. |
4882 * Private helper function for checked, selected, disabled and readonly. |
4829 * |
4883 * |
4830 * Compares the first two arguments and if identical marks as $type |
4884 * Compares the first two arguments and if identical marks as `$type`. |
4831 * |
4885 * |
4832 * @since 2.8.0 |
4886 * @since 2.8.0 |
4833 * @access private |
4887 * @access private |
4834 * |
4888 * |
4835 * @param mixed $helper One of the values to compare |
4889 * @param mixed $helper One of the values to compare. |
4836 * @param mixed $current (true) The other value to compare if not just true |
4890 * @param mixed $current The other value to compare if not just true. |
4837 * @param bool $echo Whether to echo or just return the string |
4891 * @param bool $echo Whether to echo or just return the string. |
4838 * @param string $type The type of checked|selected|disabled|readonly we are doing |
4892 * @param string $type The type of checked|selected|disabled|readonly we are doing. |
4839 * @return string HTML attribute or empty string |
4893 * @return string HTML attribute or empty string. |
4840 */ |
4894 */ |
4841 function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
4895 function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore |
4842 if ( (string) $helper === (string) $current ) { |
4896 if ( (string) $helper === (string) $current ) { |
4843 $result = " $type='$type'"; |
4897 $result = " $type='$type'"; |
4844 } else { |
4898 } else { |