| 1 |
<?php |
| 2 |
|
| 3 |
namespace AgeGate\Admin\Controller; |
| 4 |
|
| 5 |
use Asylum\Utility\Storage; |
| 6 |
use AgeGate\Admin\Settings\Advanced; |
| 7 |
use AgeGate\Common\Admin\AbstractController; |
| 8 |
use AgeGate\Common\Immutable\Constants as Immutable; |
| 9 |
|
| 10 |
class AdvancedController extends AbstractController |
| 11 |
{ |
| 12 |
use Advanced; |
| 13 |
public const PERMISSION = Immutable::ADVANCED; |
| 14 |
public const OPTION = Immutable::OPTION_ADVANCED; |
| 15 |
|
| 16 |
public function register(): void |
| 17 |
{ |
| 18 |
$this->menu(__('Advanced', 'age-gate'), self::PERMISSION); |
| 19 |
} |
| 20 |
|
| 21 |
protected function required(): bool |
| 22 |
{ |
| 23 |
return current_user_can(self::PERMISSION); |
| 24 |
} |
| 25 |
|
| 26 |
protected function data(): array |
| 27 |
{ |
| 28 |
return get_option(Immutable::OPTION_ADVANCED, []) ?: []; |
| 29 |
} |
| 30 |
|
| 31 |
protected function fields(): array |
| 32 |
{ |
| 33 |
return $this->getAdvancedFields(); |
| 34 |
} |
| 35 |
|
| 36 |
protected function rules() : array |
| 37 |
{ |
| 38 |
return [ |
| 39 |
'method' => 'alpha', |
| 40 |
'munge' => 'boolean', |
| 41 |
'in_header' => 'boolean', |
| 42 |
'preload' => 'boolean', |
| 43 |
'focus' => 'boolean', |
| 44 |
'dev_tools' => 'boolean', |
| 45 |
'rta' => 'boolean', |
| 46 |
'toolbar' => 'boolean', |
| 47 |
'anonymous' => 'boolean', |
| 48 |
'cookie_name' => 'ag_alpha_underscore', |
| 49 |
'css_type' => "alpha_numeric", |
| 50 |
]; |
| 51 |
} |
| 52 |
} |
| 53 |
|