Changeset 51781
- Timestamp:
- 09/09/2021 01:47:17 PM (3 years ago)
- Location:
- trunk/src/wp-admin/includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-automatic-upgrader-skin.php
r50828 r51781 67 67 * 68 68 * @since 3.7.0 69 * @since 5.9.0 Renamed `$data` to `$feedback` for PHP 8 named parameter support. 69 70 * 70 * @param string|array|WP_Error $ dataMessage data.71 * @param mixed ...$args Optional text replacements.71 * @param string|array|WP_Error $feedback Message data. 72 * @param mixed ...$args Optional text replacements. 72 73 */ 73 public function feedback( $ data, ...$args ) {74 if ( is_wp_error( $ data) ) {75 $string = $ data->get_error_message();76 } elseif ( is_array( $ data) ) {74 public function feedback( $feedback, ...$args ) { 75 if ( is_wp_error( $feedback ) ) { 76 $string = $feedback->get_error_message(); 77 } elseif ( is_array( $feedback ) ) { 77 78 return; 78 79 } else { 79 $string = $ data;80 $string = $feedback; 80 81 } 82 81 83 if ( ! empty( $this->upgrader->strings[ $string ] ) ) { 82 84 $string = $this->upgrader->strings[ $string ]; -
trunk/src/wp-admin/includes/class-bulk-upgrader-skin.php
r46125 r51781 50 50 51 51 /** 52 * @param string $string 53 * @param mixed ...$args Optional text replacements. 52 * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support. 53 * 54 * @param string $feedback Message data. 55 * @param mixed ...$args Optional text replacements. 54 56 */ 55 public function feedback( $ string, ...$args ) {56 if ( isset( $this->upgrader->strings[ $ string] ) ) {57 $ string = $this->upgrader->strings[ $string];57 public function feedback( $feedback, ...$args ) { 58 if ( isset( $this->upgrader->strings[ $feedback ] ) ) { 59 $feedback = $this->upgrader->strings[ $feedback ]; 58 60 } 59 61 60 if ( strpos( $ string, '%' ) !== false ) {62 if ( strpos( $feedback, '%' ) !== false ) { 61 63 if ( $args ) { 62 $args = array_map( 'strip_tags', $args );63 $args = array_map( 'esc_html', $args );64 $ string = vsprintf( $string, $args );64 $args = array_map( 'strip_tags', $args ); 65 $args = array_map( 'esc_html', $args ); 66 $feedback = vsprintf( $feedback, $args ); 65 67 } 66 68 } 67 if ( empty( $ string) ) {69 if ( empty( $feedback ) ) { 68 70 return; 69 71 } 70 72 if ( $this->in_loop ) { 71 echo "$ string<br />\n";73 echo "$feedback<br />\n"; 72 74 } else { 73 echo "<p>$ string</p>\n";75 echo "<p>$feedback</p>\n"; 74 76 } 75 77 } -
trunk/src/wp-admin/includes/class-wp-ajax-upgrader-skin.php
r49596 r51781 122 122 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it 123 123 * to the function signature. 124 * @since 5.9.0 Renamed `$data` to `$feedback` for PHP 8 named parameter support. 124 125 * 125 * @param string|array|WP_Error $ dataMessage data.126 * @param mixed ...$args Optional text replacements.126 * @param string|array|WP_Error $feedback Message data. 127 * @param mixed ...$args Optional text replacements. 127 128 */ 128 public function feedback( $ data, ...$args ) {129 if ( is_wp_error( $ data) ) {130 foreach ( $ data->get_error_codes() as $error_code ) {131 $this->errors->add( $error_code, $ data->get_error_message( $error_code ), $data->get_error_data( $error_code ) );129 public function feedback( $feedback, ...$args ) { 130 if ( is_wp_error( $feedback ) ) { 131 foreach ( $feedback->get_error_codes() as $error_code ) { 132 $this->errors->add( $error_code, $feedback->get_error_message( $error_code ), $feedback->get_error_data( $error_code ) ); 132 133 } 133 134 } 134 135 135 parent::feedback( $ data, ...$args );136 parent::feedback( $feedback, ...$args ); 136 137 } 137 138 } -
trunk/src/wp-admin/includes/class-wp-upgrader-skin.php
r49675 r51781 187 187 /** 188 188 * @since 2.8.0 189 * 190 * @param string $string 191 * @param mixed ...$args Optional text replacements. 192 */ 193 public function feedback( $string, ...$args ) { 194 if ( isset( $this->upgrader->strings[ $string ] ) ) { 195 $string = $this->upgrader->strings[ $string ]; 196 } 197 198 if ( strpos( $string, '%' ) !== false ) { 189 * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support. 190 * 191 * @param string $feedback Message data. 192 * @param mixed ...$args Optional text replacements. 193 */ 194 public function feedback( $feedback, ...$args ) { 195 if ( isset( $this->upgrader->strings[ $feedback ] ) ) { 196 $feedback = $this->upgrader->strings[ $feedback ]; 197 } 198 199 if ( strpos( $feedback, '%' ) !== false ) { 199 200 if ( $args ) { 200 $args = array_map( 'strip_tags', $args );201 $args = array_map( 'esc_html', $args );202 $ string = vsprintf( $string, $args );201 $args = array_map( 'strip_tags', $args ); 202 $args = array_map( 'esc_html', $args ); 203 $feedback = vsprintf( $feedback, $args ); 203 204 } 204 205 } 205 if ( empty( $ string) ) {206 return; 207 } 208 show_message( $ string);206 if ( empty( $feedback ) ) { 207 return; 208 } 209 show_message( $feedback ); 209 210 } 210 211
Note: See TracChangeset
for help on using the changeset viewer.