WordPress.org

Make WordPress Core

Ticket #47678: 47678-WP_Ajax_Upgrader_Skin-error.patch

File 47678-WP_Ajax_Upgrader_Skin-error.patch, 1.6 KB (added by jrf, 7 months ago)

Simplify & modernize WP_Ajax_Upgrader_Skin::error()

  • src/wp-admin/includes/class-wp-ajax-upgrader-skin.php

    From f6d8eeab319f36a6a19661249f866274df31e853 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 18 Jul 2019 02:51:43 +0200
    Subject: [PATCH] Simplify & modernize WP_Ajax_Upgrader_Skin::error()
    
    ---
     src/wp-admin/includes/class-wp-ajax-upgrader-skin.php | 10 ++++------
     1 file changed, 4 insertions(+), 6 deletions(-)
    
    diff --git a/src/wp-admin/includes/class-wp-ajax-upgrader-skin.php b/src/wp-admin/includes/class-wp-ajax-upgrader-skin.php
    index bb92eeef02..b19e573fb8 100644
    a b class WP_Ajax_Upgrader_Skin extends Automatic_Upgrader_Skin { 
    7878         *
    7979         * @since 4.6.0
    8080         *
    81          * @param string|WP_Error $errors Errors.
     81         * @param string|WP_Error $errors  Errors.
     82         * @param mixed           ...$args Optional text replacements.
    8283         */
    83         public function error( $errors ) {
     84        public function error( $errors, ...$args ) {
    8485                if ( is_string( $errors ) ) {
    8586                        $string = $errors;
    8687                        if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
    class WP_Ajax_Upgrader_Skin extends Automatic_Upgrader_Skin { 
    8889                        }
    8990
    9091                        if ( false !== strpos( $string, '%' ) ) {
    91                                 $args = func_get_args();
    92                                 $args = array_splice( $args, 1 );
    9392                                if ( ! empty( $args ) ) {
    9493                                        $string = vsprintf( $string, $args );
    9594                                }
    class WP_Ajax_Upgrader_Skin extends Automatic_Upgrader_Skin { 
    104103                        }
    105104                }
    106105
    107                 $args = func_get_args();
    108                 call_user_func_array( array( $this, 'parent::error' ), $args );
     106                parent::error( $errors, ...$args );
    109107        }
    110108
    111109        /**