WordPress.org

Make WordPress Core

Ticket #24197: 24197.patch

File 24197.patch, 1.3 KB (added by azaozz, 10 months ago)
  • wp-includes/class.wp-dependencies.php

     
    3838                $handles = false === $handles ? $this->queue : (array) $handles; 
    3939                $this->all_deps( $handles ); 
    4040 
     41                // Move any (localization) data from group (alias) handles to the first dependency in the group 
    4142                foreach( $this->to_do as $key => $handle ) { 
     43                        if ( ! in_array( $handle, $this->done, true ) && isset( $this->registered[$handle] ) && ! $this->registered[$handle]->src 
     44                                && ( $handle_data = $this->get_data( $handle, 'data' ) ) && ! empty( $this->registered[$handle]->deps ) ) { 
     45 
     46                                $first_dep = $this->registered[$handle]->deps[0]; 
     47                                // The first dependency data has priority over the handle data (printed after) 
     48                                if ( $first_dep_data = $this->get_data( $first_dep, 'data' ) ) 
     49                                        $handle_data = "$handle_data\n$first_dep_data"; 
     50 
     51                                $this->add_data( $first_dep, 'data', $handle_data ); 
     52                                unset( $this->registered[$handle]->extra['data'] ); 
     53                        } 
     54                } 
     55 
     56                foreach( $this->to_do as $key => $handle ) { 
    4257                        if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { 
    4358 
    4459                                if ( ! $this->registered[$handle]->src ) { // Defines a group.