Skip to content

Commit 016cce0

Browse files
Docs: Improve documentation for a few functions per the documentation standards.
This affects: * `checked()` * `selected()` * `disabled()` * `wp_readonly()` * `readonly()` * `__checked_selected_helper()` Follow-up to [143], [560], [9053], [10662], [13658], [41728], [51586]. See #53399. git-svn-id: https://develop.svn.wordpress.org/trunk@51592 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 88fb0bc commit 016cce0

File tree

2 files changed

+41
-31
lines changed

2 files changed

+41
-31
lines changed

src/wp-includes/general-template.php

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4763,14 +4763,16 @@ function get_the_generator( $type = '' ) {
47634763
/**
47644764
* Outputs the HTML checked attribute.
47654765
*
4766-
* Compares the first two arguments and if identical marks as checked
4766+
* Compares the first two arguments and if identical marks as checked.
47674767
*
47684768
* @since 1.0.0
47694769
*
4770-
* @param mixed $checked One of the values to compare
4771-
* @param mixed $current (true) The other value to compare if not just true
4772-
* @param bool $echo Whether to echo or just return the string
4773-
* @return string HTML attribute or empty string
4770+
* @param mixed $checked One of the values to compare.
4771+
* @param mixed $current Optional. The other value to compare if not just true.
4772+
* Default true.
4773+
* @param bool $echo Optional. Whether to echo or just return the string.
4774+
* Default true.
4775+
* @return string HTML attribute or empty string.
47744776
*/
47754777
function checked( $checked, $current = true, $echo = true ) {
47764778
return __checked_selected_helper( $checked, $current, $echo, 'checked' );
@@ -4779,14 +4781,16 @@ function checked( $checked, $current = true, $echo = true ) {
47794781
/**
47804782
* Outputs the HTML selected attribute.
47814783
*
4782-
* Compares the first two arguments and if identical marks as selected
4784+
* Compares the first two arguments and if identical marks as selected.
47834785
*
47844786
* @since 1.0.0
47854787
*
4786-
* @param mixed $selected One of the values to compare
4787-
* @param mixed $current (true) The other value to compare if not just true
4788-
* @param bool $echo Whether to echo or just return the string
4789-
* @return string HTML attribute or empty string
4788+
* @param mixed $selected One of the values to compare.
4789+
* @param mixed $current Optional. The other value to compare if not just true.
4790+
* Default true.
4791+
* @param bool $echo Optional. Whether to echo or just return the string.
4792+
* Default true.
4793+
* @return string HTML attribute or empty string.
47904794
*/
47914795
function selected( $selected, $current = true, $echo = true ) {
47924796
return __checked_selected_helper( $selected, $current, $echo, 'selected' );
@@ -4795,14 +4799,16 @@ function selected( $selected, $current = true, $echo = true ) {
47954799
/**
47964800
* Outputs the HTML disabled attribute.
47974801
*
4798-
* Compares the first two arguments and if identical marks as disabled
4802+
* Compares the first two arguments and if identical marks as disabled.
47994803
*
48004804
* @since 3.0.0
48014805
*
4802-
* @param mixed $disabled One of the values to compare
4803-
* @param mixed $current (true) The other value to compare if not just true
4804-
* @param bool $echo Whether to echo or just return the string
4805-
* @return string HTML attribute or empty string
4806+
* @param mixed $disabled One of the values to compare.
4807+
* @param mixed $current Optional. The other value to compare if not just true.
4808+
* Default true.
4809+
* @param bool $echo Optional. Whether to echo or just return the string.
4810+
* Default true.
4811+
* @return string HTML attribute or empty string.
48064812
*/
48074813
function disabled( $disabled, $current = true, $echo = true ) {
48084814
return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
@@ -4811,14 +4817,16 @@ function disabled( $disabled, $current = true, $echo = true ) {
48114817
/**
48124818
* Outputs the HTML readonly attribute.
48134819
*
4814-
* Compares the first two arguments and if identical marks as readonly
4820+
* Compares the first two arguments and if identical marks as readonly.
48154821
*
48164822
* @since 5.9.0
48174823
*
4818-
* @param mixed $readonly One of the values to compare
4819-
* @param mixed $current (true) The other value to compare if not just true
4820-
* @param bool $echo Whether to echo or just return the string
4821-
* @return string HTML attribute or empty string
4824+
* @param mixed $readonly One of the values to compare.
4825+
* @param mixed $current Optional. The other value to compare if not just true.
4826+
* Default true.
4827+
* @param bool $echo Optional. Whether to echo or just return the string.
4828+
* Default true.
4829+
* @return string HTML attribute or empty string.
48224830
*/
48234831
function wp_readonly( $readonly, $current = true, $echo = true ) {
48244832
return __checked_selected_helper( $readonly, $current, $echo, 'readonly' );
@@ -4837,16 +4845,16 @@ function wp_readonly( $readonly, $current = true, $echo = true ) {
48374845
/**
48384846
* Private helper function for checked, selected, disabled and readonly.
48394847
*
4840-
* Compares the first two arguments and if identical marks as $type
4848+
* Compares the first two arguments and if identical marks as `$type`.
48414849
*
48424850
* @since 2.8.0
48434851
* @access private
48444852
*
4845-
* @param mixed $helper One of the values to compare
4846-
* @param mixed $current (true) The other value to compare if not just true
4847-
* @param bool $echo Whether to echo or just return the string
4848-
* @param string $type The type of checked|selected|disabled|readonly we are doing
4849-
* @return string HTML attribute or empty string
4853+
* @param mixed $helper One of the values to compare.
4854+
* @param mixed $current The other value to compare if not just true.
4855+
* @param bool $echo Whether to echo or just return the string.
4856+
* @param string $type The type of checked|selected|disabled|readonly we are doing.
4857+
* @return string HTML attribute or empty string.
48504858
*/
48514859
function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
48524860
if ( (string) $helper === (string) $current ) {

src/wp-includes/php-compat/readonly.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Outputs the HTML readonly attribute.
1717
*
18-
* Compares the first two arguments and if identical marks as readonly
18+
* Compares the first two arguments and if identical marks as readonly.
1919
*
2020
* This function is deprecated, and cannot be used on PHP >= 8.1.
2121
*
@@ -24,10 +24,12 @@
2424
*
2525
* @see wp_readonly()
2626
*
27-
* @param mixed $readonly One of the values to compare
28-
* @param mixed $current (true) The other value to compare if not just true
29-
* @param bool $echo Whether to echo or just return the string
30-
* @return string HTML attribute or empty string
27+
* @param mixed $readonly One of the values to compare.
28+
* @param mixed $current Optional. The other value to compare if not just true.
29+
* Default true.
30+
* @param bool $echo Optional. Whether to echo or just return the string.
31+
* Default true.
32+
* @return string HTML attribute or empty string.
3133
*/
3234
function readonly( $readonly, $current = true, $echo = true ) {
3335
_deprecated_function( __FUNCTION__, '5.9.0', 'wp_readonly()' );

0 commit comments

Comments
 (0)