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