$allocation) { if (is_array($allocation) || ! $allocation) { continue; } $textAllocations[$type][0] = [ 'country' => 'DE', 'language' => 'de', 'pageId' => (int)$allocation, 'wcOrderEmailAttachment' => ! empty($appendEmail[$type]), 'savePdfFile' => true, ]; } delete_option('agb_connector_wc_append_email'); delete_option('agb_connector_text_types_allocation'); update_option(Plugin::OPTION_TEXT_ALLOCATIONS, $textAllocations); } /** * Convert old Plugin data to new * * phpcs:disable Inpsyde.CodeQuality.FunctionLength.TooLong */ public static function convertOldAgbConnectorPluginOptions() { $agbConnectorOptions = get_option('agb_connectors_settings', []); if (! $agbConnectorOptions) { return; } if (! empty($agbConnectorOptions['agb_connector_api'])) { update_option( Plugin::OPTION_USER_AUTH_TOKEN, $agbConnectorOptions['agb_connector_api'] ); } $textAllocations = []; if (isset($agbConnectorOptions['agb_connector_agb_page'])) { $textAllocations['agb'][0] = [ 'country' => 'DE', 'language' => 'de', 'pageId' => absint($agbConnectorOptions['agb_connector_agb_page']), 'wcOrderEmailAttachment' => ! empty($agbConnectorOptions['agb_connector_agb_pdf']), 'savePdfFile' => true, ]; } if (isset($agbConnectorOptions['agb_connector_impressum_page'])) { $textAllocations['impressum'][0] = [ 'country' => 'DE', 'language' => 'de', 'pageId' => absint($agbConnectorOptions['agb_connector_impressum_page']), 'wcOrderEmailAttachment' => false, ]; } if (isset($agbConnectorOptions['agb_connector_datenschutz_page'])) { $textAllocations['datenschutz'][0] = [ 'country' => 'DE', 'language' => 'de', 'pageId' => absint($agbConnectorOptions['agb_connector_datenschutz_page']), 'wcOrderEmailAttachment' => ! empty($agbConnectorOptions['agb_connector_datenschutz_pdf']), 'savePdfFile' => true, ]; } if (isset($agbConnectorOptions['agb_connector_widerruf_page'])) { $textAllocations['widerruf'][0] = [ 'country' => 'DE', 'language' => 'de', 'pageId' => absint($agbConnectorOptions['agb_connector_widerruf_page']), 'wcOrderEmailAttachment' => ! empty($agbConnectorOptions['agb_connector_widerruf_pdf']), 'savePdfFile' => true, ]; } $updated = update_option(Plugin::OPTION_TEXT_ALLOCATIONS, $textAllocations); if ($updated) { delete_option('agb_connectors_settings'); } } }