Jake Vanderwerf
2026-08-28 a9654f00c8fbc9934289d761843ddd071025013f
inc/rest/routes/FormRoutes.php
@@ -8,7 +8,6 @@
use JVBase\meta\Validator;
use JVBase\rest\PermissionHandler;
use JVBase\rest\Rest;
use JVBase\managers\Cache;
use JVBase\blocks\FormBlock;
use JVBase\rest\Route;
use JVBase\base\Site;
@@ -99,8 +98,7 @@
         if (is_wp_error($result)) {
            return $this->error(
               $result->get_error_message(),
               $result->get_error_code(),
               400
               $result->get_error_code()
            );
         }
         if (array_key_exists('success', $result)){
@@ -161,7 +159,7 @@
      if (!empty($files)) {
         try {
            $files = $this->validateFileUploads($files, $form_config);
         } catch (\Exception $e) {
         } catch (Exception $e) {
            return new WP_Error('file_validation_failed', 'File validation error: ' . $e->getMessage());
         }
      }
@@ -169,7 +167,7 @@
      // Validate and sanitize form data
      try {
         $processed_data = $this->validateAndSanitizeData($form_config, $form_data);
      } catch (\Exception $e) {
      } catch (Exception $e) {
         return new WP_Error('validation_failed', 'Data validation error: ' . $e->getMessage());
      }
      if (array_key_exists('success', $processed_data) && $processed_data['success'] === false) {
@@ -179,7 +177,7 @@
      // Send email notification with attachments
      try {
         $email_sent = $this->sendEmailNotification($form_type, $form_config, $processed_data, $files);
      } catch (\Exception $e) {
      } catch (Exception $e) {
         return new WP_Error('email_failed', 'Email error: ' . $e->getMessage());
      }
@@ -367,7 +365,7 @@
         ];
      }
      $body .= Emails::getInstance()->spacer(20);
      $body .= Emails::getInstance()->spacer();
      $body .= Emails::getInstance()->table($form);
      // Show attachment info
@@ -375,8 +373,7 @@
      if (!empty($attachments)) {
         $body .= Emails::getInstance()->spacer(10);
         $body .= Emails::getInstance()->alert(
            sprintf('%d file(s) attached to this email', count($attachments)),
            'info'
            sprintf('%d file(s) attached to this email', count($attachments))
         );
      }
@@ -707,18 +704,18 @@
      $forms = FormBlock::getForms();
      // Remove sensitive data
      $public_forms = [];
      foreach ($forms as $key => $config) {
         $public_forms[$key] = [
      // Remove sensitive configuration
      $public_forms = array_map(function ($config) use ($field) {
         return [
            'title' => $config['title'],
            'description' => $config['description'],
            'fields' => array_map(function($field) {
            'fields' => array_map(function ($field) {
               // Remove sensitive configuration
               unset($field['email_to']);
               return $field;
            }, $config['fields'])
         ];
      }
      }, $forms);
      return $this->success($public_forms);
   }