input(); if ( ! isset( $args['helper'] ) ) { return new WP_Error( 'invalid_args', __( 'You must specify a helper script body', 'jetpack' ), 400 ); } $this->helper_script = base64_decode( $args['helper'] ); if ( ! $this->helper_script ) { return new WP_Error( 'invalid_args', __( 'Helper script body must be base64 encoded', 'jetpack' ), 400 ); } return true; } /** * Installs the uploaded Helper Script. */ protected function install() { $this->result = Helper_Script_Manager::install_helper_script( $this->helper_script ); Helper_Script_Manager::cleanup_expired_helper_scripts(); } /** * Returns the result of Helper Script installation. Returns one of: * - WP_Error on failure, or * - An array containing the access url ('url') and installation path ('path') on success. * * @return array|WP_Error Success or failure information. */ protected function result() { // Include ABSPATH with successful result. if ( ! is_wp_error( $this->result ) ) { $this->result['abspath'] = ABSPATH; } return $this->result; } }