| 1 |
<?php |
| 2 |
|
| 3 |
namespace LIBRARY; |
| 4 |
|
| 5 |
if ( ! class_exists( '\Plugin_Upgrader', false ) ) { |
| 6 |
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
| 7 |
} |
| 8 |
|
| 9 |
class PluginInstallerSkin extends \WP_Upgrader_Skin { |
| 10 |
|
| 11 |
public function header() {} |
| 12 |
public function footer() {} |
| 13 |
public function feedback( $string, ...$args ) {} |
| 14 |
public function decrement_update_count( $type ) {} |
| 15 |
|
| 16 |
public function error( $errors ) { |
| 17 |
if ( empty( $errors ) ) { |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
if ( is_string( $errors ) ) { |
| 22 |
wp_send_json_error( $errors ); |
| 23 |
} elseif ( is_wp_error( $errors ) && $errors->has_errors() ) { |
| 24 |
if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { |
| 25 |
wp_send_json_error( $message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); |
| 26 |
} else { |
| 27 |
wp_send_json_error( $message ); |
| 28 |
} |
| 29 |
} |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
|