*/ protected function input_properties(): array { return array( 'slug' => array( 'type' => 'string', 'description' => __( 'Pack slug, from list-packs.', 'acrossai-abilities-manager' ), ), ); } /** * @since 0.0.34 * @return array */ protected function required_input(): array { return array( 'slug' ); } /** * @since 0.0.34 * @return array */ protected function output_properties(): array { return array( 'pack' => array( 'type' => 'string' ), 'installed' => array( 'type' => 'array', 'items' => array( 'type' => 'object', 'additionalProperties' => true ), ), 'installed_count' => array( 'type' => 'integer' ), 'skipped_count' => array( 'type' => 'integer' ), 'failed_count' => array( 'type' => 'integer' ), 'safe_mode' => array( 'type' => 'boolean' ), ); } /** * @since 0.0.34 * @return array */ protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => false ); } /** * @since 0.0.34 * @return bool */ protected function requires_confirmation(): bool { return true; } /** * @since 0.0.34 * @return string */ protected function confirmation_message(): string { return __( 'This installs a bundle of third-party snippets from the WPCode library. All of them are installed inactive and none will run until you activate them individually. Pass confirm: true to proceed.', 'acrossai-abilities-manager' ); } /** * @since 0.0.34 * @param array $input Input. * @return array|WP_Error */ protected function run( array $input ) { $result = Library_Repository::apply_pack( (string) ( $input['slug'] ?? '' ) ); if ( is_wp_error( $result ) ) { return $result; } return array_merge( $result, array( 'safe_mode' => WPCode_Guard::safe_mode(), 'message' => __( 'Pack installed. Every snippet is inactive until you activate it.', 'acrossai-abilities-manager' ), ) ); } }