????JFIF??x?x????'
Server IP : 104.21.80.1 / Your IP : 216.73.216.145 Web Server : LiteSpeed System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 User : tempvsty ( 647) PHP Version : 8.0.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/tempvsty/pontiacques.org/wp-content/plugins/give/src/FormBuilder/Routes/ |
Upload File : |
<?php namespace Give\FormBuilder\Routes; use Exception; use Give\DonationForms\Models\DonationForm; use Give\DonationForms\Properties\FormSettings; use Give\DonationForms\ValueObjects\DonationFormStatus; use Give\FormBuilder\Actions\GenerateDefaultDonationFormBlockCollection; use Give\FormBuilder\FormBuilderRouteBuilder; use Give\Helpers\Hooks; use Give\Helpers\Language; /** * Route to create a new form */ class CreateFormRoute { /** * @since 3.22.0 Add locale support * @since 3.1.0 updated default form blocks to be generated from block models instead of json * @since 3.0.0 * * @return void * @throws Exception */ public function __invoke() { if (isset($_GET['page']) && FormBuilderRouteBuilder::SLUG === $_GET['page']) { $locale = $_GET['locale'] ?? ''; // Little hack for alpha users to make sure the form builder is loaded. if (!isset($_GET['donationFormID'])) { wp_redirect(FormBuilderRouteBuilder::makeCreateFormRoute($locale)->getUrl()); exit(); } if ('new' === $_GET['donationFormID']) { // Make sure the Form will be created using the proper locale $locale = $_GET['locale'] ?? ''; Language::switchToLocale($locale); $form = new DonationForm([ 'title' => __('GiveWP Donation Form', 'give'), 'status' => DonationFormStatus::DRAFT(), 'settings' => FormSettings::fromArray([ 'enableDonationGoal' => true, 'goalAmount' => 1000, ]), 'blocks' => (new GenerateDefaultDonationFormBlockCollection())(), ]); Hooks::doAction('givewp_form_builder_new_form', $form); $form->save(); wp_redirect(FormBuilderRouteBuilder::makeEditFormRoute($form->id, $locale)->getUrl()); exit(); } } } }