![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mautic.corals.io/app/bundles/CoreBundle/Form/EventListener/ |
<?php namespace Mautic\CoreBundle\Form\EventListener; use Mautic\CoreBundle\Helper\InputHelper; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\FormEvents; /** * Clean data before persisting to DB. */ class CleanFormSubscriber implements EventSubscriberInterface { /** * @param string|mixed[] $masks */ public function __construct( private $masks = 'clean' ) { } public static function getSubscribedEvents(): array { return [ FormEvents::PRE_SUBMIT => 'preSubmitData', ]; } public function preSubmitData(FormEvent $event): void { $data = $event->getData(); // clean the data $data = InputHelper::_($data, $this->masks); $event->setData($data); } }