AJAX.php
3 years ago
Cleared_Cache_AJAX.php
3 years ago
Create_Campaign_AJAX.php
3 years ago
Delete_Campaign_AJAX.php
3 years ago
Delete_Data_AJAX.php
3 years ago
Export_Campaigns_AJAX.php
3 years ago
Export_Devices_AJAX.php
2 years ago
Export_Geo_AJAX.php
3 years ago
Export_Pages_AJAX.php
3 years ago
Export_Referrers_AJAX.php
3 years ago
Filters_AJAX.php
2 years ago
Migration_Status_AJAX.php
3 years ago
Real_Time_AJAX.php
3 years ago
Test_Email_AJAX.php
3 years ago
Update_Capabilities_AJAX.php
3 years ago
Update_Capabilities_AJAX.php
25 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP_SCOPED\IAWP\AJAX; |
| 4 | |
| 5 | use IAWP_SCOPED\IAWP\Capability_Manager; |
| 6 | class Update_Capabilities_AJAX extends AJAX |
| 7 | { |
| 8 | protected function action_name() : string |
| 9 | { |
| 10 | return 'iawp_capabilities'; |
| 11 | } |
| 12 | protected function action_callback() : void |
| 13 | { |
| 14 | if (!Capability_Manager::can_edit()) { |
| 15 | return; |
| 16 | } |
| 17 | $capabilities = $this->get_field('capabilities'); |
| 18 | $capabilities = \json_decode(\html_entity_decode(\stripslashes($capabilities))); |
| 19 | Capability_Manager::edit_all_capabilities($capabilities); |
| 20 | $white_label = $this->get_field('white_label'); |
| 21 | $white_label = \rest_sanitize_boolean($white_label); |
| 22 | \update_option('iawp_white_label', $white_label); |
| 23 | } |
| 24 | } |
| 25 |