Make WordPress Core

Ticket #62437: 62437.3.patch

File 62437.3.patch, 16.3 KB (added by viralsampat, 15 months ago)

I have checked wp-admin and wp-includes folder and founds few files where we need to make this change, I have added its patch.

  • src/index.php

    diff --git src/index.php src/index.php
    index 91c0517857..027df0affc 100644
     
    44 * Note: this file exists only to remind developers to build the assets.
    55 * For the real index.php that gets built and boots WordPress,
    66 * please refer to _index.php.
     7 *
     8 * @package WordPress
    79 */
    810
    911/** Define ABSPATH as this file's directory */
  • src/wp-admin/index.php

    diff --git src/wp-admin/index.php src/wp-admin/index.php
    index 628096844c..af687f7bbe 100644
     
    11<?php
    2 
    3 /*
     2/**
    43 * Note: this file exists only to remind developers to build the assets.
    54 * For the real wp-admin/index.php that gets built and boots WordPress,
    65 * please refer to wp-admin/_index.php.
     6 *
     7 * @package WordPress
    78 */
    89
    910if ( file_exists( __DIR__ . '/../wp-includes/js/dist/edit-post.js' ) ) {
  • src/wp-admin/load-scripts.php

    diff --git src/wp-admin/load-scripts.php src/wp-admin/load-scripts.php
    index e4b6a1ee5b..934fc79b0c 100644
     
    11<?php
    2 
    3 /*
     2/**
    43 * The error_reporting() function can be disabled in php.ini. On systems where that is the case,
    54 * it's best to add a dummy function to the wp-config.php file, but as this call to the function
    65 * is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
     6 *
     7 * @package WordPress
    78 */
     9
    810if ( function_exists( 'error_reporting' ) ) {
    911        /*
    1012         * Disable error reporting.
  • src/wp-admin/load-styles.php

    diff --git src/wp-admin/load-styles.php src/wp-admin/load-styles.php
    index 3bdfcc7a22..177c2757f8 100644
     
    11<?php
    2 
    3 /*
     2/**
    43 * The error_reporting() function can be disabled in php.ini. On systems where that is the case,
    54 * it's best to add a dummy function to the wp-config.php file, but as this call to the function
    65 * is run prior to wp-config.php loading, it is wrapped in a function_exists() check.
     6 *
     7 * @package WordPress
    78 */
     9
    810if ( function_exists( 'error_reporting' ) ) {
    911        /*
    1012         * Disable error reporting.
  • src/wp-includes/class-phpass.php

    diff --git src/wp-includes/class-phpass.php src/wp-includes/class-phpass.php
    index f8f659648e..27598001f3 100644
     
    11<?php
    22/**
    33 * Portable PHP password hashing framework.
     4 *
    45 * @package phpass
    56 * @since 2.5.0
    67 * @version 0.5 / WordPress
  • src/wp-includes/class-phpmailer.php

    diff --git src/wp-includes/class-phpmailer.php src/wp-includes/class-phpmailer.php
    index fe054f6879..e2b8e11383 100644
     
    11<?php
    2 
    32/**
    43 * The PHPMailer class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.
     4 *
     5 * @package phpmailer
    56 */
     7
    68if ( function_exists( '_deprecated_file' ) ) {
    79        _deprecated_file(
    810                basename( __FILE__ ),
  • src/wp-includes/class-smtp.php

    diff --git src/wp-includes/class-smtp.php src/wp-includes/class-smtp.php
    index 524e655250..36cfd8a968 100644
     
    11<?php
    2 
    32/**
    43 * The SMTP class has been moved to the wp-includes/PHPMailer subdirectory and now uses the PHPMailer\PHPMailer namespace.
     4 *
     5 * @package smtp
    56 */
     7
    68_deprecated_file(
    79        basename( __FILE__ ),
    810        '5.5.0',
  • src/wp-includes/class-snoopy.php

    diff --git src/wp-includes/class-snoopy.php src/wp-includes/class-snoopy.php
    index e82c673989..612e481fe9 100644
     
    11<?php
    2 
    32/**
    43 * Deprecated. Use WP_HTTP (http.php) instead.
     4 *
     5 * @package snoopy
    56 */
     7
    68_deprecated_file( basename( __FILE__ ), '3.0.0', WPINC . '/http.php' );
    79
    810if ( ! class_exists( 'Snoopy', false ) ) :
  • src/wp-includes/class-wp-oembed-controller.php

    diff --git src/wp-includes/class-wp-oembed-controller.php src/wp-includes/class-wp-oembed-controller.php
    index d78a76d885..e09ac93051 100644
     
    88 */
    99
    1010/**
    11  * oEmbed API endpoint controller.
     11 * OEmbed API endpoint controller.
    1212 *
    1313 * Registers the REST API route and delivers the response data.
    1414 * The output format (XML or JSON) is handled by the REST API.
  • src/wp-includes/embed.php

    diff --git src/wp-includes/embed.php src/wp-includes/embed.php
    index f7fe10e482..5b952ef774 100644
     
    11<?php
    22/**
    3  * oEmbed API: Top-level oEmbed functionality
     3 * Oembed API: Top-level oEmbed functionality
    44 *
    55 * @package WordPress
    66 * @subpackage oEmbed
  • src/wp-includes/pluggable-deprecated.php

    diff --git src/wp-includes/pluggable-deprecated.php src/wp-includes/pluggable-deprecated.php
    index 11e393ddfd..3ac612b6d2 100644
     
    1515 * Deprecated functions come here to die.
    1616 */
    1717
    18 if ( !function_exists('set_current_user') ) :
    19 /**
    20  * Changes the current user by ID or name.
    21  *
    22  * Set $id to null and specify a name if you do not know a user's ID.
    23  *
    24  * @since 2.0.1
    25  * @deprecated 3.0.0 Use wp_set_current_user()
    26  * @see wp_set_current_user()
    27  *
    28  * @param int|null $id User ID.
    29  * @param string $name Optional. The user's username
    30  * @return WP_User returns wp_set_current_user()
    31  */
    32 function set_current_user($id, $name = '') {
    33         _deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
    34         return wp_set_current_user($id, $name);
    35 }
     18if ( ! function_exists('set_current_user') ) :
     19        /**
     20        * Changes the current user by ID or name.
     21        *
     22        * Set $id to null and specify a name if you do not know a user's ID.
     23        *
     24        * @since 2.0.1
     25        * @deprecated 3.0.0 Use wp_set_current_user()
     26        * @see wp_set_current_user()
     27        *
     28        * @param int|null $id User ID.
     29        * @param string $name Optional. The user's username
     30        * @return WP_User returns wp_set_current_user()
     31        */
     32        function set_current_user($id, $name = '') {
     33                _deprecated_function( __FUNCTION__, '3.0.0', 'wp_set_current_user()' );
     34                return wp_set_current_user($id, $name);
     35        }
    3636endif;
    3737
    38 if ( !function_exists('get_currentuserinfo') ) :
    39 /**
    40  * Populate global variables with information about the currently logged in user.
    41  *
    42  * @since 0.71
    43  * @deprecated 4.5.0 Use wp_get_current_user()
    44  * @see wp_get_current_user()
    45  *
    46  * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise.
    47  */
    48 function get_currentuserinfo() {
    49         _deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' );
     38if ( ! function_exists('get_currentuserinfo') ) :
     39        /**
     40        * Populate global variables with information about the currently logged in user.
     41        *
     42        * @since 0.71
     43        * @deprecated 4.5.0 Use wp_get_current_user()
     44        * @see wp_get_current_user()
     45        *
     46        * @return bool|WP_User False on XMLRPC Request and invalid auth cookie, WP_User instance otherwise.
     47        */
     48        function get_currentuserinfo() {
     49                _deprecated_function( __FUNCTION__, '4.5.0', 'wp_get_current_user()' );
    5050
    51         return _wp_get_current_user();
    52 }
     51                return _wp_get_current_user();
     52        }
    5353endif;
    5454
    55 if ( !function_exists('get_userdatabylogin') ) :
    56 /**
    57  * Retrieve user info by login name.
    58  *
    59  * @since 0.71
    60  * @deprecated 3.3.0 Use get_user_by()
    61  * @see get_user_by()
    62  *
    63  * @param string $user_login User's username
    64  * @return bool|object False on failure, User DB row object
    65  */
    66 function get_userdatabylogin($user_login) {
    67         _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" );
    68         return get_user_by('login', $user_login);
    69 }
     55if ( ! function_exists('get_userdatabylogin') ) :
     56        /**
     57        * Retrieve user info by login name.
     58        *
     59        * @since 0.71
     60        * @deprecated 3.3.0 Use get_user_by()
     61        * @see get_user_by()
     62        *
     63        * @param string $user_login User's username
     64        * @return bool|object False on failure, User DB row object
     65        */
     66        function get_userdatabylogin($user_login) {
     67                _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('login')" );
     68                return get_user_by('login', $user_login);
     69        }
    7070endif;
    7171
    72 if ( !function_exists('get_user_by_email') ) :
    73 /**
    74  * Retrieve user info by email.
    75  *
    76  * @since 2.5.0
    77  * @deprecated 3.3.0 Use get_user_by()
    78  * @see get_user_by()
    79  *
    80  * @param string $email User's email address
    81  * @return bool|object False on failure, User DB row object
    82  */
    83 function get_user_by_email($email) {
    84         _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" );
    85         return get_user_by('email', $email);
    86 }
     72if ( ! function_exists('get_user_by_email') ) :
     73        /**
     74        * Retrieve user info by email.
     75        *
     76        * @since 2.5.0
     77        * @deprecated 3.3.0 Use get_user_by()
     78        * @see get_user_by()
     79        *
     80        * @param string $email User's email address
     81        * @return bool|object False on failure, User DB row object
     82        */
     83        function get_user_by_email($email) {
     84                _deprecated_function( __FUNCTION__, '3.3.0', "get_user_by('email')" );
     85                return get_user_by('email', $email);
     86        }
    8787endif;
    8888
    89 if ( !function_exists('wp_setcookie') ) :
    90 /**
    91  * Sets a cookie for a user who just logged in. This function is deprecated.
    92  *
    93  * @since 1.5.0
    94  * @deprecated 2.5.0 Use wp_set_auth_cookie()
    95  * @see wp_set_auth_cookie()
    96  *
    97  * @param string $username The user's username
    98  * @param string $password Optional. The user's password
    99  * @param bool $already_md5 Optional. Whether the password has already been through MD5
    100  * @param string $home Optional. Will be used instead of COOKIEPATH if set
    101  * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
    102  * @param bool $remember Optional. Remember that the user is logged in
    103  */
    104 function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
    105         _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' );
    106         $user = get_user_by('login', $username);
    107         wp_set_auth_cookie($user->ID, $remember);
    108 }
     89if ( ! function_exists('wp_setcookie') ) :
     90        /**
     91        * Sets a cookie for a user who just logged in. This function is deprecated.
     92        *
     93        * @since 1.5.0
     94        * @deprecated 2.5.0 Use wp_set_auth_cookie()
     95        * @see wp_set_auth_cookie()
     96        *
     97        * @param string $username The user's username
     98        * @param string $password Optional. The user's password
     99        * @param bool $already_md5 Optional. Whether the password has already been through MD5
     100        * @param string $home Optional. Will be used instead of COOKIEPATH if set
     101        * @param string $siteurl Optional. Will be used instead of SITECOOKIEPATH if set
     102        * @param bool $remember Optional. Remember that the user is logged in
     103        */
     104        function wp_setcookie($username, $password = '', $already_md5 = false, $home = '', $siteurl = '', $remember = false) {
     105                _deprecated_function( __FUNCTION__, '2.5.0', 'wp_set_auth_cookie()' );
     106                $user = get_user_by('login', $username);
     107                wp_set_auth_cookie($user->ID, $remember);
     108        }
    109109else :
    110110        _deprecated_function( 'wp_setcookie', '2.5.0', 'wp_set_auth_cookie()' );
    111111endif;
    112112
    113 if ( !function_exists('wp_clearcookie') ) :
    114 /**
    115  * Clears the authentication cookie, logging the user out. This function is deprecated.
    116  *
    117  * @since 1.5.0
    118  * @deprecated 2.5.0 Use wp_clear_auth_cookie()
    119  * @see wp_clear_auth_cookie()
    120  */
    121 function wp_clearcookie() {
    122         _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' );
    123         wp_clear_auth_cookie();
    124 }
     113if ( ! function_exists('wp_clearcookie') ) :
     114        /**
     115        * Clears the authentication cookie, logging the user out. This function is deprecated.
     116        *
     117        * @since 1.5.0
     118        * @deprecated 2.5.0 Use wp_clear_auth_cookie()
     119        * @see wp_clear_auth_cookie()
     120        */
     121        function wp_clearcookie() {
     122                _deprecated_function( __FUNCTION__, '2.5.0', 'wp_clear_auth_cookie()' );
     123                wp_clear_auth_cookie();
     124        }
    125125else :
    126126        _deprecated_function( 'wp_clearcookie', '2.5.0', 'wp_clear_auth_cookie()' );
    127127endif;
    128128
    129 if ( !function_exists('wp_get_cookie_login') ):
    130 /**
    131  * Gets the user cookie login. This function is deprecated.
    132  *
    133  * This function is deprecated and should no longer be extended as it won't be
    134  * used anywhere in WordPress. Also, plugins shouldn't use it either.
    135  *
    136  * @since 2.0.3
    137  * @deprecated 2.5.0
    138  *
    139  * @return bool Always returns false
    140  */
    141 function wp_get_cookie_login() {
    142         _deprecated_function( __FUNCTION__, '2.5.0' );
    143         return false;
    144 }
     129if ( ! function_exists('wp_get_cookie_login') ):
     130        /**
     131        * Gets the user cookie login. This function is deprecated.
     132        *
     133        * This function is deprecated and should no longer be extended as it won't be
     134        * used anywhere in WordPress. Also, plugins shouldn't use it either.
     135        *
     136        * @since 2.0.3
     137        * @deprecated 2.5.0
     138        *
     139        * @return bool Always returns false
     140        */
     141        function wp_get_cookie_login() {
     142                _deprecated_function( __FUNCTION__, '2.5.0' );
     143                return false;
     144        }
    145145else :
    146146        _deprecated_function( 'wp_get_cookie_login', '2.5.0' );
    147147endif;
    148148
    149 if ( !function_exists('wp_login') ) :
    150 /**
    151  * Checks a users login information and logs them in if it checks out. This function is deprecated.
    152  *
    153  * Use the global $error to get the reason why the login failed. If the username
    154  * is blank, no error will be set, so assume blank username on that case.
    155  *
    156  * Plugins extending this function should also provide the global $error and set
    157  * what the error is, so that those checking the global for why there was a
    158  * failure can utilize it later.
    159  *
    160  * @since 1.2.2
    161  * @deprecated 2.5.0 Use wp_signon()
    162  * @see wp_signon()
    163  *
    164  * @global string $error Error when false is returned
    165  *
    166  * @param string $username   User's username
    167  * @param string $password   User's password
    168  * @param string $deprecated Not used
    169  * @return bool True on successful check, false on login failure.
    170  */
    171 function wp_login($username, $password, $deprecated = '') {
    172         _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' );
    173         global $error;
     149if ( ! function_exists('wp_login') ) :
     150        /**
     151        * Checks a users login information and logs them in if it checks out. This function is deprecated.
     152        *
     153        * Use the global $error to get the reason why the login failed. If the username
     154        * is blank, no error will be set, so assume blank username on that case.
     155        *
     156        * Plugins extending this function should also provide the global $error and set
     157        * what the error is, so that those checking the global for why there was a
     158        * failure can utilize it later.
     159        *
     160        * @since 1.2.2
     161        * @deprecated 2.5.0 Use wp_signon()
     162        * @see wp_signon()
     163        *
     164        * @global string $error Error when false is returned
     165        *
     166        * @param string $username   User's username
     167        * @param string $password   User's password
     168        * @param string $deprecated Not used
     169        * @return bool True on successful check, false on login failure.
     170        */
     171        function wp_login($username, $password, $deprecated = '') {
     172                _deprecated_function( __FUNCTION__, '2.5.0', 'wp_signon()' );
     173                global $error;
    174174
    175         $user = wp_authenticate($username, $password);
     175                $user = wp_authenticate($username, $password);
    176176
    177         if ( ! is_wp_error($user) )
    178                 return true;
     177                if ( ! is_wp_error($user) )
     178                        return true;
    179179
    180         $error = $user->get_error_message();
    181         return false;
    182 }
     180                $error = $user->get_error_message();
     181                return false;
     182        }
    183183else :
    184184        _deprecated_function( 'wp_login', '2.5.0', 'wp_signon()' );
    185185endif;
  • src/wp-includes/pomo/plural-forms.php

    diff --git src/wp-includes/pomo/plural-forms.php src/wp-includes/pomo/plural-forms.php
    index a604334e88..20b9ca36fc 100644
     
    33/**
    44 * A gettext Plural-Forms parser.
    55 *
     6 * @package pomo
     7 * @subpackage Plural Forms
    68 * @since 4.9.0
    79 */
     10
    811if ( ! class_exists( 'Plural_Forms', false ) ) :
    912        #[AllowDynamicProperties]
    1013        class Plural_Forms {
  • src/wp-includes/shortcodes.php

    diff --git src/wp-includes/shortcodes.php src/wp-includes/shortcodes.php
    index bddf63ada2..c2912cb83a 100644
     
    3939 * @var array
    4040 * @global array $shortcode_tags
    4141 */
    42 $shortcode_tags = array();
     42if ( ! isset( $shortcode_tags ) ) {
     43        $shortcode_tags = array(); // Initialize the global variable if not already set
     44}
     45
    4346
    4447/**
    4548 * Adds a new shortcode.
  • src/wp-includes/template-loader.php

    diff --git src/wp-includes/template-loader.php src/wp-includes/template-loader.php
    index 0fd08545cc..a28748a1a9 100644
     
    44 *
    55 * @package WordPress
    66 */
     7
    78if ( wp_using_themes() ) {
    89        /**
    910         * Fires before determining which template to load.
  • src/wp-includes/theme-templates.php

    diff --git src/wp-includes/theme-templates.php src/wp-includes/theme-templates.php
    index 55b9c8fac4..e0260443cc 100644
     
    11<?php
    2 
    32/**
    43 * Sets a custom slug when creating auto-draft template parts.
    54 *