| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
class FrmSquareLiteSettingsController { |
| 7 |
|
| 8 |
/** |
| 9 |
* Add Square section to Global Settings. |
| 10 |
* |
| 11 |
* @since 6.22 |
| 12 |
* |
| 13 |
* @param array $sections |
| 14 |
* @return array |
| 15 |
*/ |
| 16 |
public static function add_settings_section( $sections ) { |
| 17 |
$sections['square'] = array( |
| 18 |
'class' => __CLASS__, |
| 19 |
'function' => 'route', |
| 20 |
'icon' => 'frm_icon_font frm_square_icon', |
| 21 |
); |
| 22 |
|
| 23 |
return $sections; |
| 24 |
} |
| 25 |
|
| 26 |
/** |
| 27 |
* Handle global settings routing. |
| 28 |
* |
| 29 |
* @return void |
| 30 |
*/ |
| 31 |
public static function route() { |
| 32 |
self::global_settings_form(); |
| 33 |
} |
| 34 |
|
| 35 |
/** |
| 36 |
* Print the Stripe section for Global settings. |
| 37 |
* |
| 38 |
* @param array $atts |
| 39 |
* @return void |
| 40 |
*/ |
| 41 |
public static function global_settings_form( $atts = array() ) { |
| 42 |
include FrmSquareLiteAppHelper::plugin_path() . '/views/settings/form.php'; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* @return array |
| 47 |
*/ |
| 48 |
private static function get_default_settings_atts() { |
| 49 |
return array( |
| 50 |
'errors' => array(), |
| 51 |
'message' => '', |
| 52 |
); |
| 53 |
} |
| 54 |
|
| 55 |
/** |
| 56 |
* Handle processing changes to global Stripe Settings. |
| 57 |
* |
| 58 |
* @return void |
| 59 |
*/ |
| 60 |
public static function process_form() { |
| 61 |
$settings = FrmSquareLiteAppHelper::get_settings(); |
| 62 |
// phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 63 |
$settings->update( $_POST ); |
| 64 |
$settings->store(); |
| 65 |
} |
| 66 |
} |
| 67 |
|