Server IP : 192.158.238.246 / Your IP : 3.148.210.152 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/task/7779/cwd/plugins/give/src/FormMigration/Steps/ |
Upload File : |
<?php namespace Give\FormMigration\Steps; use Give\FormMigration\Contracts\FormMigrationStep; /** * @since 3.0.0 */ class PdfSettings extends FormMigrationStep { /** * @since 3.0.0 */ public function process() { $oldFormId = $this->formV2->id; $newForm = $this->formV3; $pdfSettings = [ 'enable' => $this->getMetaValue($oldFormId, 'give_pdf_receipts_enable_disable', 'global'), 'generationMethod' => $this->getMetaValue($oldFormId, 'give_pdf_generation_method', 'set_pdf_templates'), 'colorPicker' => $this->getMetaValue($oldFormId, 'give_pdf_colorpicker', '#1E8CBE'), 'templateId' => $this->getMetaValue($oldFormId, 'give_pdf_templates', 'default'), 'logoUpload' => $this->getMetaValue($oldFormId, 'give_pdf_logo_upload', ''), 'name' => $this->getMetaValue($oldFormId, 'give_pdf_company_name', ''), 'addressLine1' => $this->getMetaValue($oldFormId, 'give_pdf_address_line1', ''), 'addressLine2' => $this->getMetaValue($oldFormId, 'give_pdf_address_line2', ''), 'cityStateZip' => $this->getMetaValue($oldFormId, 'give_pdf_address_city_state_zip', ''), 'displayWebsiteUrl' => $this->getMetaValue($oldFormId, 'give_pdf_url', ''), 'emailAddress' => $this->getMetaValue($oldFormId, 'give_pdf_email_address', ''), 'headerMessage' => $this->getMetaValue($oldFormId, 'give_pdf_header_message', ''), 'footerMessage' => $this->getMetaValue($oldFormId, 'give_pdf_footer_message', ''), 'additionalNotes' => $this->getMetaValue($oldFormId, 'give_pdf_additional_notes', ''), 'customTemplateId' => $this->getMetaValue($oldFormId, 'give_pdf_receipt_template', ''), 'customTemplateName' => $this->getMetaValue($oldFormId, 'give_pdf_receipt_template_name', ''), 'customPageSize' => $this->getMetaValue($oldFormId, 'give_pdf_builder_page_size', ''), 'customPdfBuilder' => $this->getMetaValue($oldFormId, 'give_pdf_builder', ''), ]; $newForm->settings->pdfSettings = $pdfSettings; } /** * @since 3.0.0 */ private function getMetaValue(int $formId, string $metaKey, $defaultValue) { $metaValue = give()->form_meta->get_meta($formId, $metaKey, true); if ( ! $metaValue) { return $defaultValue; } return $metaValue; } }