AbandonedCheckoutSettings.php
3 years ago
AccountSettings.php
3 years ago
AdvancedSettings.php
3 years ago
BaseSettings.php
2 years ago
BrandSettings.php
3 years ago
CacheSettings.php
3 years ago
ConnectionSettings.php
3 years ago
CustomerSettings.php
3 years ago
ExportSettings.php
3 years ago
OrderSettings.php
3 years ago
ProcessorsSettings.php
3 years ago
ShippingProfileSettings.php
3 years ago
ShippingSettings.php
3 years ago
SubscriptionPreservationSettings.php
3 years ago
SubscriptionSettings.php
3 years ago
TaxRegionSettings.php
3 years ago
TaxSettings.php
3 years ago
UpgradeSettings.php
3 years ago
AdvancedSettings.php
41 lines
| 1 | <?php |
| 2 | |
| 3 | namespace SureCart\Controllers\Admin\Settings; |
| 4 | |
| 5 | use SureCart\Models\ApiToken; |
| 6 | |
| 7 | /** |
| 8 | * Controls the settings page. |
| 9 | */ |
| 10 | class AdvancedSettings extends BaseSettings { |
| 11 | /** |
| 12 | * Script handles for pages |
| 13 | * |
| 14 | * @var array |
| 15 | */ |
| 16 | protected $scripts = [ |
| 17 | 'show' => [ 'surecart/scripts/admin/advanced', 'admin/settings/advanced' ], |
| 18 | ]; |
| 19 | |
| 20 | /** |
| 21 | * Save the page. |
| 22 | * |
| 23 | * @param \SureCartCore\Requests\RequestInterface $request Request. |
| 24 | * @return function |
| 25 | */ |
| 26 | public function save( \SureCartCore\Requests\RequestInterface $request ) { |
| 27 | $url = $request->getHeaderLine( 'Referer' ); |
| 28 | |
| 29 | // update uninstall option. |
| 30 | update_option( 'sc_uninstall', $request->body( 'uninstall' ) === 'on' ); |
| 31 | |
| 32 | // update uninstall option. |
| 33 | update_option( 'sc_stripe_payment_element', $request->body( 'stripe-payment-element' ) === 'on' ); |
| 34 | |
| 35 | // update performance option. |
| 36 | update_option( 'surecart_use_esm_loader', $request->body( 'use_esm_loader' ) === 'on' ); |
| 37 | |
| 38 | return \SureCart::redirect()->to( esc_url_raw( add_query_arg( 'status', 'saved', $url ) ) ); |
| 39 | } |
| 40 | } |
| 41 |