WordPress.org

Make WordPress Core

Changeset 51592


Ignore:
Timestamp:
08/10/2021 01:44:34 PM (4 months ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/general-template.php

    r51586 r51592  
    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 */
    47754777function checked( $checked, $current = true, $echo = true ) {
     
    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 */
    47914795function selected( $selected, $current = true, $echo = true ) {
     
    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 */
    48074813function disabled( $disabled, $current = true, $echo = true ) {
     
    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 */
    48234831function wp_readonly( $readonly, $current = true, $echo = true ) {
     
    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 */
    48514859function __checked_selected_helper( $helper, $current, $echo, $type ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore,PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
  • trunk/src/wp-includes/php-compat/readonly.php

    r51586 r51592  
    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.
     
    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 */
    3234function readonly( $readonly, $current = true, $echo = true ) {
Note: See TracChangeset for help on using the changeset viewer.