mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-11 14:22:26 +01:00
Code Modernization: Rename parameters that use reserved keywords in wp-includes/deprecated.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: * `the_category_ID()` * `get_author_link()` * `get_links()` * `get_category_rss_link()` * `get_author_rss_link()` * Renames the `$string` parameter to `$text` in `wp_specialchars()`. * Renames the `$string` parameter to `$message` in `debug_fwrite()`. * Renames the `$string` parameter to `$content` in `wp_kses_js_entities()`. 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]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53287 git-svn-id: http://core.svn.wordpress.org/trunk@52876 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dac4e3be11
commit
3c94881cd5
@ -76,17 +76,17 @@ function start_wp() {
|
||||
* @deprecated 0.71 Use get_the_category()
|
||||
* @see get_the_category()
|
||||
*
|
||||
* @param bool $echo Optional. Whether to echo the output. Default true.
|
||||
* @param bool $display Optional. Whether to display the output. Default true.
|
||||
* @return int Category ID.
|
||||
*/
|
||||
function the_category_ID($echo = true) {
|
||||
function the_category_ID($display = true) {
|
||||
_deprecated_function( __FUNCTION__, '0.71', 'get_the_category()' );
|
||||
|
||||
// Grab the first cat in the list.
|
||||
$categories = get_the_category();
|
||||
$cat = $categories[0]->term_id;
|
||||
|
||||
if ( $echo )
|
||||
if ( $display )
|
||||
echo $cat;
|
||||
|
||||
return $cat;
|
||||
@ -795,17 +795,17 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
|
||||
* @deprecated 2.1.0 Use get_author_posts_url()
|
||||
* @see get_author_posts_url()
|
||||
*
|
||||
* @param bool $echo
|
||||
* @param bool $display
|
||||
* @param int $author_id
|
||||
* @param string $author_nicename Optional.
|
||||
* @return string|null
|
||||
*/
|
||||
function get_author_link($echo, $author_id, $author_nicename = '') {
|
||||
function get_author_link($display, $author_id, $author_nicename = '') {
|
||||
_deprecated_function( __FUNCTION__, '2.1.0', 'get_author_posts_url()' );
|
||||
|
||||
$link = get_author_posts_url($author_id, $author_nicename);
|
||||
|
||||
if ( $echo )
|
||||
if ( $display )
|
||||
echo $link;
|
||||
return $link;
|
||||
}
|
||||
@ -939,11 +939,11 @@ function wp_get_links($args = '') {
|
||||
* @param int $limit Optional. Limit to X entries. If not specified, all entries are shown.
|
||||
* Default -1.
|
||||
* @param int $show_updated Optional. Whether to show last updated timestamp. Default 1.
|
||||
* @param bool $echo Whether to echo the results, or return them instead.
|
||||
* @param bool $display Whether to display the results, or return them instead.
|
||||
* @return null|string
|
||||
*/
|
||||
function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
|
||||
$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
|
||||
$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $display = true) {
|
||||
_deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmarks()' );
|
||||
|
||||
$order = 'ASC';
|
||||
@ -1018,7 +1018,7 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
|
||||
$output .= "$after\n";
|
||||
} // End while.
|
||||
|
||||
if ( !$echo )
|
||||
if ( !$display )
|
||||
return $output;
|
||||
echo $output;
|
||||
}
|
||||
@ -1149,16 +1149,16 @@ function comments_rss_link($link_text = 'Comments RSS') {
|
||||
* @deprecated 2.5.0 Use get_category_feed_link()
|
||||
* @see get_category_feed_link()
|
||||
*
|
||||
* @param bool $echo
|
||||
* @param bool $display
|
||||
* @param int $cat_ID
|
||||
* @return string
|
||||
*/
|
||||
function get_category_rss_link($echo = false, $cat_ID = 1) {
|
||||
function get_category_rss_link($display = false, $cat_ID = 1) {
|
||||
_deprecated_function( __FUNCTION__, '2.5.0', 'get_category_feed_link()' );
|
||||
|
||||
$link = get_category_feed_link($cat_ID, 'rss2');
|
||||
|
||||
if ( $echo )
|
||||
if ( $display )
|
||||
echo $link;
|
||||
return $link;
|
||||
}
|
||||
@ -1170,15 +1170,15 @@ function get_category_rss_link($echo = false, $cat_ID = 1) {
|
||||
* @deprecated 2.5.0 Use get_author_feed_link()
|
||||
* @see get_author_feed_link()
|
||||
*
|
||||
* @param bool $echo
|
||||
* @param bool $display
|
||||
* @param int $author_id
|
||||
* @return string
|
||||
*/
|
||||
function get_author_rss_link($echo = false, $author_id = 1) {
|
||||
function get_author_rss_link($display = false, $author_id = 1) {
|
||||
_deprecated_function( __FUNCTION__, '2.5.0', 'get_author_feed_link()' );
|
||||
|
||||
$link = get_author_feed_link($author_id);
|
||||
if ( $echo )
|
||||
if ( $display )
|
||||
echo $link;
|
||||
return $link;
|
||||
}
|
||||
@ -2070,18 +2070,18 @@ function js_escape( $text ) {
|
||||
* @deprecated 2.8.0 Use esc_html()
|
||||
* @see esc_html()
|
||||
*
|
||||
* @param string $string String to escape.
|
||||
* @param string $text Text to escape.
|
||||
* @param string $quote_style Unused.
|
||||
* @param false|string $charset Unused.
|
||||
* @param false $double_encode Whether to double encode. Unused.
|
||||
* @return string Escaped `$string`.
|
||||
* @return string Escaped `$text`.
|
||||
*/
|
||||
function wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
||||
function wp_specialchars( $text, $quote_style = ENT_NOQUOTES, $charset = false, $double_encode = false ) {
|
||||
_deprecated_function( __FUNCTION__, '2.8.0', 'esc_html()' );
|
||||
if ( func_num_args() > 1 ) { // Maintain back-compat for people passing additional arguments.
|
||||
return _wp_specialchars( $string, $quote_style, $charset, $double_encode );
|
||||
return _wp_specialchars( $text, $quote_style, $charset, $double_encode );
|
||||
} else {
|
||||
return esc_html( $string );
|
||||
return esc_html( $text );
|
||||
}
|
||||
}
|
||||
|
||||
@ -2858,13 +2858,13 @@ function debug_fopen( $filename, $mode ) {
|
||||
*
|
||||
* @link https://www.php.net/manual/en/function.error-log.php
|
||||
*
|
||||
* @param mixed $fp Unused.
|
||||
* @param string $string Message to log.
|
||||
* @param mixed $fp Unused.
|
||||
* @param string $message Message to log.
|
||||
*/
|
||||
function debug_fwrite( $fp, $string ) {
|
||||
function debug_fwrite( $fp, $message ) {
|
||||
_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
|
||||
if ( ! empty( $GLOBALS['debug'] ) )
|
||||
error_log( $string );
|
||||
error_log( $message );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -3820,13 +3820,13 @@ function get_paged_template() {
|
||||
* @since 1.0.0
|
||||
* @deprecated 4.7.0 Officially dropped security support for Netscape 4.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $content
|
||||
* @return string
|
||||
*/
|
||||
function wp_kses_js_entities( $string ) {
|
||||
function wp_kses_js_entities( $content ) {
|
||||
_deprecated_function( __FUNCTION__, '4.7.0' );
|
||||
|
||||
return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $string );
|
||||
return preg_replace( '%&\s*\{[^}]*(\}\s*;?|$)%', '', $content );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta2-53286';
|
||||
$wp_version = '6.0-beta2-53287';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user