| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @since 3.04.02 |
| 4 | 4 | * |
| 5 | - * @package Formidable | |
| 6 | 5 | * @subpackage Upgrader Skin |
| 7 | 6 | */ |
| 8 | 7 | |
| 9 | 8 | // Exit if accessed directly |
| @@ -11,9 +10,9 @@ | ||
| 11 | 10 | exit; |
| 12 | 11 | } |
| 13 | 12 | |
| 14 | 13 | if ( ! class_exists( 'WP_Upgrader_Skin' ) ) { |
| 15 | - // This is to prevent a unit test from failing | |
| 14 | + // this is to prevent a unit test from failing | |
| 16 | 15 | return; |
| 17 | 16 | } |
| 18 | 17 | |
| 19 | 18 | class FrmInstallerSkin extends WP_Upgrader_Skin { |
| @@ -23,10 +22,8 @@ | ||
| 23 | 22 | * |
| 24 | 23 | * @since 3.04.02 |
| 25 | 24 | * |
| 26 | 25 | * @param object $upgrader The upgrader object (passed by reference). |
| 27 | - * | |
| 28 | - * @return void | |
| 29 | 26 | */ |
| 30 | 27 | public function set_upgrader( &$upgrader ) { |
| 31 | 28 | if ( is_object( $upgrader ) ) { |
| 32 | 29 | $this->upgrader =& $upgrader; |
| @@ -37,11 +34,9 @@ | ||
| 37 | 34 | * Set the upgrader result and store it as a property in the parent class. |
| 38 | 35 | * |
| 39 | 36 | * @since 3.04.02 |
| 40 | 37 | * |
| 41 | - * @param bool|string|WP_Error $result The result of the install process. | |
| 42 | - * | |
| 43 | - * @return void | |
| 38 | + * @param object $result The result of the install process. | |
| 44 | 39 | */ |
| 45 | 40 | public function set_result( $result ) { |
| 46 | 41 | $this->result = $result; |
| 47 | 42 | } |
| @@ -66,33 +61,30 @@ | ||
| 66 | 61 | * back to the Ajax script for processing. |
| 67 | 62 | * |
| 68 | 63 | * @since 3.04.02 |
| 69 | 64 | * |
| 70 | - * @param string|\WP_Error $errors The WP Error object of errors with the install process. | |
| 65 | + * @param string|object $errors The WP Error object of errors with the install process. | |
| 71 | 66 | */ |
| 72 | 67 | public function error( $errors ) { |
| 73 | - if ( ! $errors ) { | |
| 74 | - return; | |
| 68 | + if ( ! empty( $errors ) ) { | |
| 69 | + if ( ! is_string( $errors ) ) { | |
| 70 | + $error = $errors->get_error_message(); | |
| 71 | + $message = $errors->get_error_data(); | |
| 72 | + $errors = $error . ' ' . $message; | |
| 73 | + } | |
| 74 | + echo json_encode( | |
| 75 | + array( | |
| 76 | + 'error' => $errors, | |
| 77 | + 'message' => $errors, | |
| 78 | + 'success' => false, | |
| 79 | + ) | |
| 80 | + ); | |
| 81 | + if ( wp_doing_ajax() ) { | |
| 82 | + wp_die(); | |
| 83 | + } else { | |
| 84 | + die(); | |
| 85 | + } | |
| 75 | 86 | } |
| 76 | - | |
| 77 | - if ( ! is_string( $errors ) ) { | |
| 78 | - $error = $errors->get_error_message(); | |
| 79 | - $message = $errors->get_error_data(); | |
| 80 | - $errors = $error . ' ' . $message; | |
| 81 | - } | |
| 82 | - echo json_encode( | |
| 83 | - array( | |
| 84 | - 'error' => $errors, | |
| 85 | - 'message' => $errors, | |
| 86 | - 'success' => false, | |
| 87 | - ) | |
| 88 | - ); | |
| 89 | - | |
| 90 | - if ( ! wp_doing_ajax() ) { | |
| 91 | - die(); | |
| 92 | - } | |
| 93 | - | |
| 94 | - wp_die(); | |
| 95 | 87 | } |
| 96 | 88 | |
| 97 | 89 | /** |
| 98 | 90 | * Empty out the feedback method to prevent outputting HTML strings as the install |
| @@ -103,5 +95,6 @@ | ||
| 103 | 95 | * @param string $string The feedback string. |
| 104 | 96 | * @param mixed ...$args Optional text replacements. |
| 105 | 97 | */ |
| 106 | 98 | public function feedback( $string, ...$args ) {} |
| 99 | + | |
| 107 | 100 | } |