admin-notices
1 year ago
features
1 year ago
plugin-capabilities
1 year ago
redirects
1 year ago
roles
1 year ago
admin-load.php
1 year ago
admin.php
1 year ago
backup-handler.php
1 year ago
backup.php
1 year ago
cap-helper.php
1 year ago
dashboard.php
1 year ago
extractor-capabilities.php
1 year ago
filters-admin.php
1 year ago
filters-woocommerce.php
1 year ago
filters-wp_rest_workarounds.php
1 year ago
filters.php
1 year ago
functions-admin.php
1 year ago
functions.php
1 year ago
handler.php
1 year ago
inflect-cme.php
1 year ago
manager.php
1 year ago
network.php
1 year ago
plugin-capabilities.php
1 year ago
pp-handler.php
1 year ago
pp-ui.php
1 year ago
publishpress-roles.php
1 year ago
settings-handler.php
1 year ago
settings-ui.php
1 year ago
settings.php
1 year ago
test-user-ui.php
1 year ago
test-user.php
1 year ago
settings-handler.php
29 lines
| 1 | <?php |
| 2 | /* |
| 3 | * PublishPress Capabilities [Free] |
| 4 | * |
| 5 | * Process updates to plugin settings |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | add_action('init', function() { |
| 10 | if (check_admin_referer('pp-capabilities-settings') && current_user_can('manage_capabilities_settings')) { |
| 11 | if (!empty($_POST['all_options'])) { |
| 12 | foreach (array_map('sanitize_key', explode(',', sanitize_text_field($_POST['all_options']))) as $option_name) { |
| 13 | foreach (['cme_', 'capsman', 'pp_capabilities', 'presspermit'] as $prefix) { |
| 14 | if (0 === strpos($option_name, $prefix)) { |
| 15 | $value = isset($_POST[$option_name]) ? $_POST[$option_name] : '';// phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 16 | $value = is_array($value) ? map_deep($value, 'sanitize_text_field') : sanitize_text_field($value); |
| 17 | |
| 18 | if (!is_array($value)) { |
| 19 | $value = trim($value); |
| 20 | } |
| 21 | |
| 22 | update_option($option_name, $value); |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | }); |
| 29 |