| 1 |
<?php |
| 2 |
/** |
| 3 |
* Install_Skin class. |
| 4 |
* |
| 5 |
* @package ContentControl |
| 6 |
* @subpackage Installers |
| 7 |
* @since 2.0.0 |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace ContentControl\Installers; |
| 11 |
|
| 12 |
/** |
| 13 |
* Skin for on-the-fly addon installations. |
| 14 |
* |
| 15 |
* @since 1.0.0 |
| 16 |
* @since 2.0.0 Extend PluginSilentUpgraderSkin and clean up the class. |
| 17 |
*/ |
| 18 |
class Install_Skin extends PluginSilentUpgraderSkin { |
| 19 |
|
| 20 |
/** |
| 21 |
* Instead of outputting HTML for errors, json_encode the errors and send them |
| 22 |
* back to the Ajax script for processing. |
| 23 |
* |
| 24 |
* @since 2.0.0 |
| 25 |
* |
| 26 |
* @param string|\WP_Error $errors Array of errors with the install process. |
| 27 |
*/ |
| 28 |
public function error( $errors ) { |
| 29 |
if ( ! empty( $errors ) ) { |
| 30 |
return wp_send_json_error( $errors ); |
| 31 |
} |
| 32 |
|
| 33 |
return $errors; |
| 34 |
} |
| 35 |
} |
| 36 |
|