PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 1.0.5
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v1.0.5
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / app / src / Controllers / Admin / Settings / ProcessorsSettings.php
ProcessorsSettings.php
48 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace SureCart\Controllers\Admin\Settings;
4
5 /**
6 * Controls the settings page.
7 */
8 class ProcessorsSettings {
9 /**
10 * Show the page.
11 *
12 * @param \SureCartCore\Requests\RequestInterface $request Request.
13 * @return function
14 */
15 public function show( \SureCartCore\Requests\RequestInterface $request ) {
16 $processors = [];
17 foreach ( \SureCart::account()->processors ?? [] as $processor ) {
18 $processors[ $processor->processor_type . '_' . ( $processor->live_mode ? 'live' : 'test' ) ] = $processor;
19 }
20
21 return \SureCart::view( 'admin/processors' )->with(
22 [
23 'tab' => $request->query( 'tab' ) ?? '',
24 'status' => '',
25 'processors' => (object) $processors,
26 ]
27 );
28 }
29
30 /**
31 * Save the page.
32 *
33 * @param \SureCartCore\Requests\RequestInterface $request Request.
34 * @return function
35 */
36 public function save( \SureCartCore\Requests\RequestInterface $request ) {
37 $url = $request->getHeaderLine( 'Referer' );
38
39 // update uninstall option.
40 update_option( 'sc_uninstall', $request->body( 'uninstall' ) === 'on' );
41
42 // update performance option.
43 update_option( 'surecart_use_esm_loader', $request->body( 'use_esm_loader' ) === 'on' );
44
45 return \SureCart::redirect()->to( esc_url_raw( add_query_arg( 'status', 'saved', $url ) ) );
46 }
47 }
48