Make WordPress Core

Changeset 54929


Ignore:
Timestamp:
12/03/2022 03:05:41 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/functions.php.

While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:

  • Renames the $echo parameter to $display in:
    • wp_nonce_field()
    • wp_referer_field()
    • wp_original_referer_field()
  • Renames the $string parameter to $input_string in
    • _wp_json_convert_string()
    • _wp_to_kebab_case()
  • Renames the $list parameter to $input_list in:
    • wp_parse_list()
    • wp_parse_id_list()
    • wp_parse_slug_list()
    • wp_filter_object_list()
    • wp_list_filter()
    • wp_list_pluck()
    • wp_list_sort()
  • Renames the $array parameter to $input_array in:
    • add_magic_quotes()
    • wp_array_slice_assoc()
    • _wp_array_get()
    • _wp_array_set()
  • Renames the $function parameter to $function_name in:
    • _deprecated_function()
    • _deprecated_argument()
    • _doing_it_wrong()
  • Renames the $class parameter to $class_name in _deprecated_constructor().
  • Renames the $default parameter to $default_value in apache_mod_loaded().
  • Renames the $var parameter to $value in wp_validate_boolean().
  • Amends the $input parameter in wp_parse_str() for consistency.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.

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

Legend:

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

    r54927 r54929  
    50345034 * @since 2.2.1
    50355035 *
    5036  * @param string $input  The string to be parsed.
    5037  * @param array  $result Variables will be stored in this array.
    5038  */
    5039 function wp_parse_str( $input, &$result ) {
    5040         parse_str( (string) $input, $result );
     5036 * @param string $input_string The string to be parsed.
     5037 * @param array  $result       Variables will be stored in this array.
     5038 */
     5039function wp_parse_str( $input_string, &$result ) {
     5040        parse_str( (string) $input_string, $result );
    50415041
    50425042        /**
  • trunk/src/wp-includes/functions.php

    r54896 r54929  
    12681268 * @since 5.5.0 Non-string values are left untouched.
    12691269 *
    1270  * @param array $array Array to walk while sanitizing contents.
    1271  * @return array Sanitized $array.
    1272  */
    1273 function add_magic_quotes( $array ) {
    1274         foreach ( (array) $array as $k => $v ) {
     1270 * @param array $input_array Array to walk while sanitizing contents.
     1271 * @return array Sanitized $input_array.
     1272 */
     1273function add_magic_quotes( $input_array ) {
     1274        foreach ( (array) $input_array as $k => $v ) {
    12751275                if ( is_array( $v ) ) {
    1276                         $array[ $k ] = add_magic_quotes( $v );
     1276                        $input_array[ $k ] = add_magic_quotes( $v );
    12771277                } elseif ( is_string( $v ) ) {
    1278                         $array[ $k ] = addslashes( $v );
     1278                        $input_array[ $k ] = addslashes( $v );
    12791279                } else {
    12801280                        continue;
    … …  
    12821282        }
    12831283
    1284         return $array;
     1284        return $input_array;
    12851285}
    12861286
    … …  
    18681868 * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
    18691869 * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
    1870  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
     1870 * @param bool       $display Optional. Whether to display or return hidden form field. Default true.
    18711871 * @return string Nonce field HTML markup.
    18721872 */
    1873 function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $echo = true ) {
     1873function wp_nonce_field( $action = -1, $name = '_wpnonce', $referer = true, $display = true ) {
    18741874        $name        = esc_attr( $name );
    18751875        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
    … …  
    18791879        }
    18801880
    1881         if ( $echo ) {
     1881        if ( $display ) {
    18821882                echo $nonce_field;
    18831883        }
    … …  
    18941894 * @since 2.0.4
    18951895 *
    1896  * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
     1896 * @param bool $display Optional. Whether to echo or return the referer field. Default true.
    18971897 * @return string Referer field HTML markup.
    18981898 */
    1899 function wp_referer_field( $echo = true ) {
     1899function wp_referer_field( $display = true ) {
    19001900        $request_url   = remove_query_arg( '_wp_http_referer' );
    19011901        $referer_field = '<input type="hidden" name="_wp_http_referer" value="' . esc_url( $request_url ) . '" />';
    19021902
    1903         if ( $echo ) {
     1903        if ( $display ) {
    19041904                echo $referer_field;
    19051905        }
    … …  
    19171917 * @since 2.0.4
    19181918 *
    1919  * @param bool   $echo         Optional. Whether to echo the original http referer. Default true.
     1919 * @param bool   $display      Optional. Whether to echo the original http referer. Default true.
    19201920 * @param string $jump_back_to Optional. Can be 'previous' or page you want to jump back to.
    19211921 *                             Default 'current'.
    19221922 * @return string Original referer field.
    19231923 */
    1924 function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
     1924function wp_original_referer_field( $display = true, $jump_back_to = 'current' ) {
    19251925        $ref = wp_get_original_referer();
    19261926
    … …  
    19311931        $orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
    19321932
    1933         if ( $echo ) {
     1933        if ( $display ) {
    19341934                echo $orig_referer_field;
    19351935        }
    … …  
    43374337 * @see _wp_json_sanity_check()
    43384338 *
    4339  * @param string $string The string which is to be converted.
     4339 * @param string $input_string The string which is to be converted.
    43404340 * @return string The checked string.
    43414341 */
    4342 function _wp_json_convert_string( $string ) {
     4342function _wp_json_convert_string( $input_string ) {
    43434343        static $use_mb = null;
    43444344        if ( is_null( $use_mb ) ) {
    … …  
    43474347
    43484348        if ( $use_mb ) {
    4349                 $encoding = mb_detect_encoding( $string, mb_detect_order(), true );
     4349                $encoding = mb_detect_encoding( $input_string, mb_detect_order(), true );
    43504350                if ( $encoding ) {
    4351                         return mb_convert_encoding( $string, 'UTF-8', $encoding );
     4351                        return mb_convert_encoding( $input_string, 'UTF-8', $encoding );
    43524352                } else {
    4353                         return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
     4353                        return mb_convert_encoding( $input_string, 'UTF-8', 'UTF-8' );
    43544354                }
    43554355        } else {
    4356                 return wp_check_invalid_utf8( $string, true );
     4356                return wp_check_invalid_utf8( $input_string, true );
    43574357        }
    43584358}
    … …  
    48124812 * @since 5.1.0
    48134813 *
    4814  * @param array|string $list List of values.
     4814 * @param array|string $input_list List of values.
    48154815 * @return array Array of values.
    48164816 */
    4817 function wp_parse_list( $list ) {
    4818         if ( ! is_array( $list ) ) {
    4819                 return preg_split( '/[\s,]+/', $list, -1, PREG_SPLIT_NO_EMPTY );
     4817function wp_parse_list( $input_list ) {
     4818        if ( ! is_array( $input_list ) ) {
     4819                return preg_split( '/[\s,]+/', $input_list, -1, PREG_SPLIT_NO_EMPTY );
    48204820        }
    48214821
    48224822        // Validate all entries of the list are scalar.
    4823         $list = array_filter( $list, 'is_scalar' );
    4824 
    4825         return $list;
     4823        $input_list = array_filter( $input_list, 'is_scalar' );
     4824
     4825        return $input_list;
    48264826}
    48274827
    … …  
    48324832 * @since 5.1.0 Refactored to use wp_parse_list().
    48334833 *
    4834  * @param array|string $list List of IDs.
     4834 * @param array|string $input_list List of IDs.
    48354835 * @return int[] Sanitized array of IDs.
    48364836 */
    4837 function wp_parse_id_list( $list ) {
    4838         $list = wp_parse_list( $list );
    4839 
    4840         return array_unique( array_map( 'absint', $list ) );
     4837function wp_parse_id_list( $input_list ) {
     4838        $input_list = wp_parse_list( $input_list );
     4839
     4840        return array_unique( array_map( 'absint', $input_list ) );
    48414841}
    48424842
    … …  
    48474847 * @since 5.1.0 Refactored to use wp_parse_list().
    48484848 *
    4849  * @param array|string $list List of slugs.
     4849 * @param array|string $input_list List of slugs.
    48504850 * @return string[] Sanitized array of slugs.
    48514851 */
    4852 function wp_parse_slug_list( $list ) {
    4853         $list = wp_parse_list( $list );
    4854 
    4855         return array_unique( array_map( 'sanitize_title', $list ) );
     4852function wp_parse_slug_list( $input_list ) {
     4853        $input_list = wp_parse_list( $input_list );
     4854
     4855        return array_unique( array_map( 'sanitize_title', $input_list ) );
    48564856}
    48574857
    … …  
    48614861 * @since 3.1.0
    48624862 *
    4863  * @param array $array The original array.
    4864  * @param array $keys  The list of keys.
     4863 * @param array $input_array The original array.
     4864 * @param array $keys        The list of keys.
    48654865 * @return array The array slice.
    48664866 */
    4867 function wp_array_slice_assoc( $array, $keys ) {
     4867function wp_array_slice_assoc( $input_array, $keys ) {
    48684868        $slice = array();
    48694869
    48704870        foreach ( $keys as $key ) {
    4871                 if ( isset( $array[ $key ] ) ) {
    4872                         $slice[ $key ] = $array[ $key ];
     4871                if ( isset( $input_array[ $key ] ) ) {
     4872                        $slice[ $key ] = $input_array[ $key ];
    48734873                }
    48744874        }
    … …  
    48854885 * Example usage:
    48864886 *
    4887  *     $array = array(
     4887 *     $input_array = array(
    48884888 *         'a' => array(
    48894889 *             'b' => array(
    … …  
    48924892 *         ),
    48934893 *     );
    4894  *     _wp_array_get( $array, array( 'a', 'b', 'c' ) );
     4894 *     _wp_array_get( $input_array, array( 'a', 'b', 'c' ) );
    48954895 *
    48964896 * @internal
    … …  
    48994899 * @access private
    49004900 *
    4901  * @param array $array   An array from which we want to retrieve some information.
    4902  * @param array $path    An array of keys describing the path with which to retrieve information.
    4903  * @param mixed $default Optional. The return value if the path does not exist within the array,
    4904  *                       or if `$array` or `$path` are not arrays. Default null.
     4901 * @param array $input_array   An array from which we want to retrieve some information.
     4902 * @param array $path          An array of keys describing the path with which to retrieve information.
     4903 * @param mixed $default_value Optional. The return value if the path does not exist within the array,
     4904 *                             or if `$input_array` or `$path` are not arrays. Default null.
    49054905 * @return mixed The value from the path specified.
    49064906 */
    4907 function _wp_array_get( $array, $path, $default = null ) {
     4907function _wp_array_get( $input_array, $path, $default_value = null ) {
    49084908        // Confirm $path is valid.
    49094909        if ( ! is_array( $path ) || 0 === count( $path ) ) {
    4910                 return $default;
     4910                return $default_value;
    49114911        }
    49124912
    49134913        foreach ( $path as $path_element ) {
    49144914                if (
    4915                         ! is_array( $array ) ||
     4915                        ! is_array( $input_array ) ||
    49164916                        ( ! is_string( $path_element ) && ! is_integer( $path_element ) && ! is_null( $path_element ) ) ||
    4917                         ! array_key_exists( $path_element, $array )
     4917                        ! array_key_exists( $path_element, $input_array )
    49184918                ) {
    4919                         return $default;
    4920                 }
    4921                 $array = $array[ $path_element ];
    4922         }
    4923 
    4924         return $array;
     4919                        return $default_value;
     4920                }
     4921                $input_array = $input_array[ $path_element ];
     4922        }
     4923
     4924        return $input_array;
    49254925}
    49264926
    … …  
    49334933 * Example usage:
    49344934 *
    4935  *     $array = array();
    4936  *     _wp_array_set( $array, array( 'a', 'b', 'c', 1 ) );
    4937  *
    4938  *     $array becomes:
     4935 *     $input_array = array();
     4936 *     _wp_array_set( $input_array, array( 'a', 'b', 'c', 1 ) );
     4937 *
     4938 *     $input_array becomes:
    49394939 *     array(
    49404940 *         'a' => array(
    … …  
    49504950 * @access private
    49514951 *
    4952  * @param array $array An array that we want to mutate to include a specific value in a path.
    4953  * @param array $path  An array of keys describing the path that we want to mutate.
    4954  * @param mixed $value The value that will be set.
    4955  */
    4956 function _wp_array_set( &$array, $path, $value = null ) {
    4957         // Confirm $array is valid.
    4958         if ( ! is_array( $array ) ) {
     4952 * @param array $input_array An array that we want to mutate to include a specific value in a path.
     4953 * @param array $path        An array of keys describing the path that we want to mutate.
     4954 * @param mixed $value       The value that will be set.
     4955 */
     4956function _wp_array_set( &$input_array, $path, $value = null ) {
     4957        // Confirm $input_array is valid.
     4958        if ( ! is_array( $input_array ) ) {
    49594959                return;
    49604960        }
    … …  
    49834983                $path_element = $path[ $i ];
    49844984                if (
    4985                         ! array_key_exists( $path_element, $array ) ||
    4986                         ! is_array( $array[ $path_element ] )
     4985                        ! array_key_exists( $path_element, $input_array ) ||
     4986                        ! is_array( $input_array[ $path_element ] )
    49874987                ) {
    4988                         $array[ $path_element ] = array();
    4989                 }
    4990                 $array = &$array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
    4991         }
    4992 
    4993         $array[ $path[ $i ] ] = $value;
     4988                        $input_array[ $path_element ] = array();
     4989                }
     4990                $input_array = &$input_array[ $path_element ]; // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.VariableRedeclaration
     4991        }
     4992
     4993        $input_array[ $path[ $i ] ] = $value;
    49944994}
    49954995
    … …  
    50155015 * @link https://github.com/lodash-php/lodash-php/blob/master/src/internal/unicodeWords.php
    50165016 *
    5017  * @param string $string The string to kebab-case.
     5017 * @param string $input_string The string to kebab-case.
    50185018 *
    50195019 * @return string kebab-cased-string.
    50205020 */
    5021 function _wp_to_kebab_case( $string ) {
     5021function _wp_to_kebab_case( $input_string ) {
    50225022        //phpcs:disable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
    50235023        // ignore the camelCase names for variables so the names are the same as lodash
    … …  
    50665066        ) . '/u';
    50675067
    5068         preg_match_all( $regexp, str_replace( "'", '', $string ), $matches );
     5068        preg_match_all( $regexp, str_replace( "'", '', $input_string ), $matches );
    50695069        return strtolower( implode( '-', $matches[0] ) );
    50705070        //phpcs:enable WordPress.NamingConventions.ValidVariableName.VariableNotSnakeCase
    … …  
    51075107 * @since 4.7.0 Uses `WP_List_Util` class.
    51085108 *
    5109  * @param array       $list    An array of objects to filter.
    5110  * @param array       $args     Optional. An array of key => value arguments to match
    5111  *                              against each object. Default empty array.
    5112  * @param string      $operator Optional. The logical operation to perform. 'AND' means
    5113  *                              all elements from the array must match. 'OR' means only
    5114  *                              one element needs to match. 'NOT' means no elements may
    5115  *                              match. Default 'AND'.
    5116  * @param bool|string $field    Optional. A field from the object to place instead
    5117  *                              of the entire object. Default false.
     5109 * @param array       $input_list An array of objects to filter.
     5110 * @param array       $args       Optional. An array of key => value arguments to match
     5111 *                                against each object. Default empty array.
     5112 * @param string      $operator   Optional. The logical operation to perform. 'AND' means
     5113 *                                all elements from the array must match. 'OR' means only
     5114 *                                one element needs to match. 'NOT' means no elements may
     5115 *                                match. Default 'AND'.
     5116 * @param bool|string $field      Optional. A field from the object to place instead
     5117 *                                of the entire object. Default false.
    51185118 * @return array A list of objects or object fields.
    51195119 */
    5120 function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
    5121         if ( ! is_array( $list ) ) {
     5120function wp_filter_object_list( $input_list, $args = array(), $operator = 'and', $field = false ) {
     5121        if ( ! is_array( $input_list ) ) {
    51225122                return array();
    51235123        }
    51245124
    5125         $util = new WP_List_Util( $list );
     5125        $util = new WP_List_Util( $input_list );
    51265126
    51275127        $util->filter( $args, $operator );
    … …  
    51515151 * @since 5.9.0 Converted into a wrapper for `wp_filter_object_list()`.
    51525152 *
    5153  * @param array  $list    An array of objects to filter.
    5154  * @param array  $args     Optional. An array of key => value arguments to match
    5155  *                         against each object. Default empty array.
    5156  * @param string $operator Optional. The logical operation to perform. 'AND' means
    5157  *                         all elements from the array must match. 'OR' means only
    5158  *                         one element needs to match. 'NOT' means no elements may
    5159  *                         match. Default 'AND'.
     5153 * @param array  $input_list An array of objects to filter.
     5154 * @param array  $args       Optional. An array of key => value arguments to match
     5155 *                           against each object. Default empty array.
     5156 * @param string $operator   Optional. The logical operation to perform. 'AND' means
     5157 *                           all elements from the array must match. 'OR' means only
     5158 *                           one element needs to match. 'NOT' means no elements may
     5159 *                           match. Default 'AND'.
    51605160 * @return array Array of found values.
    51615161 */
    5162 function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
    5163         return wp_filter_object_list( $list, $args, $operator );
     5162function wp_list_filter( $input_list, $args = array(), $operator = 'AND' ) {
     5163        return wp_filter_object_list( $input_list, $args, $operator );
    51645164}
    51655165
    … …  
    51745174 * @since 4.7.0 Uses `WP_List_Util` class.
    51755175 *
    5176  * @param array      $list      List of objects or arrays.
    5177  * @param int|string $field     Field from the object to place instead of the entire object.
    5178  * @param int|string $index_key Optional. Field from the object to use as keys for the new array.
    5179  *                              Default null.
     5176 * @param array      $input_list List of objects or arrays.
     5177 * @param int|string $field      Field from the object to place instead of the entire object.
     5178 * @param int|string $index_key  Optional. Field from the object to use as keys for the new array.
     5179 *                               Default null.
    51805180 * @return array Array of found values. If `$index_key` is set, an array of found values with keys
    51815181 *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
    5182  *               `$list` will be preserved in the results.
    5183  */
    5184 function wp_list_pluck( $list, $field, $index_key = null ) {
    5185         if ( ! is_array( $list ) ) {
     5182 *               `$input_list` will be preserved in the results.
     5183 */
     5184function wp_list_pluck( $input_list, $field, $index_key = null ) {
     5185        if ( ! is_array( $input_list ) ) {
    51865186                return array();
    51875187        }
    51885188
    5189         $util = new WP_List_Util( $list );
     5189        $util = new WP_List_Util( $input_list );
    51905190
    51915191        return $util->pluck( $field, $index_key );
    … …  
    51975197 * @since 4.7.0
    51985198 *
    5199  * @param array        $list          An array of objects or arrays to sort.
     5199 * @param array        $input_list    An array of objects or arrays to sort.
    52005200 * @param string|array $orderby       Optional. Either the field name to order by or an array
    52015201 *                                    of multiple orderby fields as `$orderby => $order`.
    … …  
    52065206 * @return array The sorted array.
    52075207 */
    5208 function wp_list_sort( $list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
    5209         if ( ! is_array( $list ) ) {
     5208function wp_list_sort( $input_list, $orderby = array(), $order = 'ASC', $preserve_keys = false ) {
     5209        if ( ! is_array( $input_list ) ) {
    52105210                return array();
    52115211        }
    52125212
    5213         $util = new WP_List_Util( $list );
     5213        $util = new WP_List_Util( $input_list );
    52145214
    52155215        return $util->sort( $orderby, $order, $preserve_keys );
    … …  
    53495349 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
    53505350 *
    5351  * @param string $function    The function that was called.
    5352  * @param string $version     The version of WordPress that deprecated the function.
    5353  * @param string $replacement Optional. The function that should have been called. Default empty.
    5354  */
    5355 function _deprecated_function( $function, $version, $replacement = '' ) {
     5351 * @param string $function_name The function that was called.
     5352 * @param string $version       The version of WordPress that deprecated the function.
     5353 * @param string $replacement   Optional. The function that should have been called. Default empty.
     5354 */
     5355function _deprecated_function( $function_name, $version, $replacement = '' ) {
    53565356
    53575357        /**
    … …  
    53605360         * @since 2.5.0
    53615361         *
    5362          * @param string $function    The function that was called.
    5363          * @param string $replacement The function that should have been called.
    5364          * @param string $version     The version of WordPress that deprecated the function.
     5362         * @param string $function_name The function that was called.
     5363         * @param string $replacement   The function that should have been called.
     5364         * @param string $version       The version of WordPress that deprecated the function.
    53655365         */
    5366         do_action( 'deprecated_function_run', $function, $replacement, $version );
     5366        do_action( 'deprecated_function_run', $function_name, $replacement, $version );
    53675367
    53685368        /**
    … …  
    53805380                                                /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
    53815381                                                __( 'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
    5382                                                 $function,
     5382                                                $function_name,
    53835383                                                $version,
    53845384                                                $replacement
    … …  
    53915391                                                /* translators: 1: PHP function name, 2: Version number. */
    53925392                                                __( 'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
    5393                                                 $function,
     5393                                                $function_name,
    53945394                                                $version
    53955395                                        ),
    … …  
    54025402                                        sprintf(
    54035403                                                'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
    5404                                                 $function,
     5404                                                $function_name,
    54055405                                                $version,
    54065406                                                $replacement
    … …  
    54125412                                        sprintf(
    54135413                                                'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
    5414                                                 $function,
     5414                                                $function_name,
    54155415                                                $version
    54165416                                        ),
    … …  
    54375437 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
    54385438 *
    5439  * @param string $class        The class containing the deprecated constructor.
     5439 * @param string $class_name   The class containing the deprecated constructor.
    54405440 * @param string $version      The version of WordPress that deprecated the function.
    54415441 * @param string $parent_class Optional. The parent class calling the deprecated constructor.
    54425442 *                             Default empty string.
    54435443 */
    5444 function _deprecated_constructor( $class, $version, $parent_class = '' ) {
     5444function _deprecated_constructor( $class_name, $version, $parent_class = '' ) {
    54455445
    54465446        /**
    … …  
    54505450         * @since 4.5.0 Added the `$parent_class` parameter.
    54515451         *
    5452          * @param string $class        The class containing the deprecated constructor.
     5452         * @param string $class_name   The class containing the deprecated constructor.
    54535453         * @param string $version      The version of WordPress that deprecated the function.
    54545454         * @param string $parent_class The parent class calling the deprecated constructor.
    54555455         */
    5456         do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
     5456        do_action( 'deprecated_constructor_run', $class_name, $version, $parent_class );
    54575457
    54585458        /**
    … …  
    54725472                                                /* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
    54735473                                                __( 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
    5474                                                 $class,
     5474                                                $class_name,
    54755475                                                $parent_class,
    54765476                                                $version,
    … …  
    54845484                                                /* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */
    54855485                                                __( 'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
    5486                                                 $class,
     5486                                                $class_name,
    54875487                                                $version,
    54885488                                                '<code>__construct()</code>'
    … …  
    54965496                                        sprintf(
    54975497                                                'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
    5498                                                 $class,
     5498                                                $class_name,
    54995499                                                $parent_class,
    55005500                                                $version,
    … …  
    55075507                                        sprintf(
    55085508                                                'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
    5509                                                 $class,
     5509                                                $class_name,
    55105510                                                $version,
    55115511                                                '<code>__construct()</code>'
    … …  
    56335633 * @since 5.4.0 The error type is now classified as E_USER_DEPRECATED (used to default to E_USER_NOTICE).
    56345634 *
    5635  * @param string $function The function that was called.
    5636  * @param string $version  The version of WordPress that deprecated the argument used.
    5637  * @param string $message  Optional. A message regarding the change. Default empty.
    5638  */
    5639 function _deprecated_argument( $function, $version, $message = '' ) {
     5635 * @param string $function_name The function that was called.
     5636 * @param string $version       The version of WordPress that deprecated the argument used.
     5637 * @param string $message       Optional. A message regarding the change. Default empty.
     5638 */
     5639function _deprecated_argument( $function_name, $version, $message = '' ) {
    56405640
    56415641        /**
    … …  
    56445644         * @since 3.0.0
    56455645         *
    5646          * @param string $function The function that was called.
    5647          * @param string $message  A message regarding the change.
    5648          * @param string $version  The version of WordPress that deprecated the argument used.
     5646         * @param string $function_name The function that was called.
     5647         * @param string $message       A message regarding the change.
     5648         * @param string $version       The version of WordPress that deprecated the argument used.
    56495649         */
    5650         do_action( 'deprecated_argument_run', $function, $message, $version );
     5650        do_action( 'deprecated_argument_run', $function_name, $message, $version );
    56515651
    56525652        /**
    … …  
    56645664                                                /* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */
    56655665                                                __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ),
    5666                                                 $function,
     5666                                                $function_name,
    56675667                                                $version,
    56685668                                                $message
    … …  
    56755675                                                /* translators: 1: PHP function name, 2: Version number. */
    56765676                                                __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
    5677                                                 $function,
     5677                                                $function_name,
    56785678                                                $version
    56795679                                        ),
    … …  
    56865686                                        sprintf(
    56875687                                                'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s',
    5688                                                 $function,
     5688                                                $function_name,
    56895689                                                $version,
    56905690                                                $message
    … …  
    56965696                                        sprintf(
    56975697                                                'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.',
    5698                                                 $function,
     5698                                                $function_name,
    56995699                                                $version
    57005700                                        ),
    … …  
    57875787 * @since 5.4.0 This function is no longer marked as "private".
    57885788 *
    5789  * @param string $function The function that was called.
    5790  * @param string $message  A message explaining what has been done incorrectly.
    5791  * @param string $version  The version of WordPress where the message was added.
    5792  */
    5793 function _doing_it_wrong( $function, $message, $version ) {
     5789 * @param string $function_name The function that was called.
     5790 * @param string $message       A message explaining what has been done incorrectly.
     5791 * @param string $version       The version of WordPress where the message was added.
     5792 */
     5793function _doing_it_wrong( $function_name, $message, $version ) {
    57945794
    57955795        /**
    … …  
    57985798         * @since 3.1.0
    57995799         *
    5800          * @param string $function The function that was called.
    5801          * @param string $message  A message explaining what has been done incorrectly.
    5802          * @param string $version  The version of WordPress where the message was added.
     5800         * @param string $function_name The function that was called.
     5801         * @param string $message       A message explaining what has been done incorrectly.
     5802         * @param string $version       The version of WordPress where the message was added.
    58035803         */
    5804         do_action( 'doing_it_wrong_run', $function, $message, $version );
     5804        do_action( 'doing_it_wrong_run', $function_name, $message, $version );
    58055805
    58065806        /**
    … …  
    58085808         *
    58095809         * @since 3.1.0
    5810          * @since 5.1.0 Added the $function, $message and $version parameters.
    5811          *
    5812          * @param bool   $trigger  Whether to trigger the error for _doing_it_wrong() calls. Default true.
    5813          * @param string $function The function that was called.
    5814          * @param string $message  A message explaining what has been done incorrectly.
    5815          * @param string $version  The version of WordPress where the message was added.
     5810         * @since 5.1.0 Added the $function_name, $message and $version parameters.
     5811         *
     5812         * @param bool   $trigger       Whether to trigger the error for _doing_it_wrong() calls. Default true.
     5813         * @param string $function_name The function that was called.
     5814         * @param string $message       A message explaining what has been done incorrectly.
     5815         * @param string $version       The version of WordPress where the message was added.
    58165816         */
    5817         if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function, $message, $version ) ) {
     5817        if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true, $function_name, $message, $version ) ) {
    58185818                if ( function_exists( '__' ) ) {
    58195819                        if ( $version ) {
    … …  
    58325832                                        /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
    58335833                                        __( 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s' ),
    5834                                         $function,
     5834                                        $function_name,
    58355835                                        $message,
    58365836                                        $version
    … …  
    58515851                                sprintf(
    58525852                                        'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s',
    5853                                         $function,
     5853                                        $function_name,
    58545854                                        $message,
    58555855                                        $version
    … …  
    58825882 * @global bool $is_apache
    58835883 *
    5884  * @param string $mod     The module, e.g. mod_rewrite.
    5885  * @param bool   $default Optional. The default return value if the module is not found. Default false.
     5884 * @param string $mod           The module, e.g. mod_rewrite.
     5885 * @param bool   $default_value Optional. The default return value if the module is not found. Default false.
    58865886 * @return bool Whether the specified module is loaded.
    58875887 */
    5888 function apache_mod_loaded( $mod, $default = false ) {
     5888function apache_mod_loaded( $mod, $default_value = false ) {
    58895889        global $is_apache;
    58905890
    … …  
    59165916        }
    59175917
    5918         return $default;
     5918        return $default_value;
    59195919}
    59205920
    … …  
    72897289 * Filters/validates a variable as a boolean.
    72907290 *
    7291  * Alternative to `filter_var( $var, FILTER_VALIDATE_BOOLEAN )`.
     7291 * Alternative to `filter_var( $value, FILTER_VALIDATE_BOOLEAN )`.
    72927292 *
    72937293 * @since 4.0.0
    72947294 *
    7295  * @param mixed $var Boolean value to validate.
     7295 * @param mixed $value Boolean value to validate.
    72967296 * @return bool Whether the value is validated.
    72977297 */
    7298 function wp_validate_boolean( $var ) {
    7299         if ( is_bool( $var ) ) {
    7300                 return $var;
    7301         }
    7302 
    7303         if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
     7298function wp_validate_boolean( $value ) {
     7299        if ( is_bool( $value ) ) {
     7300                return $value;
     7301        }
     7302
     7303        if ( is_string( $value ) && 'false' === strtolower( $value ) ) {
    73047304                return false;
    73057305        }
    73067306
    7307         return (bool) $var;
     7307        return (bool) $value;
    73087308}
    73097309
Note: See TracChangeset for help on using the changeset viewer.