includes
6 months ago
server
9 months ago
tests
1 year ago
wordpress
3 months ago
class-rsssl-htaccess-file-manager.php
6 months ago
cron.php
1 year ago
deactivate-integration.php
3 years ago
firewall-manager.php
4 months ago
functions.php
6 months ago
hardening.php
1 year ago
index.php
2 years ago
integrations.php
1 year ago
notices.php
1 year ago
security.php
9 months ago
sync-settings.php
1 year ago
tests.php
1 year ago
sync-settings.php
95 lines
| 1 | <?php |
| 2 | defined('ABSPATH') or die(); |
| 3 | /** |
| 4 | * Conditionally we can decide to disable fields, add comments, and manipulate the value here |
| 5 | * @param array $field |
| 6 | * @param string $field_id |
| 7 | * |
| 8 | * @return array |
| 9 | */ |
| 10 | |
| 11 | function rsssl_disable_fields( $field, $field_id ) { |
| 12 | /** |
| 13 | * If a feature is already enabled, but not by RSSSL, we can simply check for that feature, and if the option in RSSSL is active. |
| 14 | * We set is as true, but disabled. Because our React interface only updates changed option, and this option never changes, this won't get set to true in the database. |
| 15 | */ |
| 16 | if ( $field_id === 'change_debug_log_location' ) { |
| 17 | if ( ! rsssl_debug_log_file_exists_in_default_location() ) { |
| 18 | if ( ! rsssl_is_debugging_enabled() ) { |
| 19 | if ( ! $field['value'] ) { |
| 20 | $field['value'] = true; |
| 21 | $field['disabled'] = true; |
| 22 | } |
| 23 | } else if ( ! rsssl_debug_log_value_is_default() ) { |
| 24 | if ( ! $field['value'] ) { |
| 25 | $field['value'] = true; |
| 26 | $field['disabled'] = true; |
| 27 | } |
| 28 | } |
| 29 | //if not the default location |
| 30 | $location = strstr( rsssl_get_debug_log_value(), 'wp-content' ); |
| 31 | if ( ! empty( $location ) && rsssl_is_debugging_enabled() && ! rsssl_debug_log_value_is_default() ) { |
| 32 | $field['help'] = [ |
| 33 | 'label' => 'default', |
| 34 | 'title' => __( "Debug.log", 'really-simple-ssl' ), |
| 35 | 'text' => __( "Changed debug.log location to:", 'really-simple-ssl' ) . $location, |
| 36 | ]; |
| 37 | } |
| 38 | |
| 39 | } |
| 40 | |
| 41 | } |
| 42 | |
| 43 | if ( $field_id === 'disable_indexing' ) { |
| 44 | if ( ! rsssl_directory_indexing_allowed() && ! ( $field['value'] ?? false ) ) { |
| 45 | $field['value'] = true; |
| 46 | $field['disabled'] = true; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | if ( $field_id === 'disable_anyone_can_register' ) { |
| 51 | if ( ! get_option( 'users_can_register' ) && ! ( $field['value'] ?? false ) ) { |
| 52 | $field['value'] = true; |
| 53 | $field['disabled'] = true; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | if ( $field_id === 'disable_http_methods' ) { |
| 58 | if ( ! rsssl_http_methods_allowed() && ! ( $field['value'] ?? false ) ) { |
| 59 | $field['value'] = true; |
| 60 | $field['disabled'] = true; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | if ( $field_id === 'disable_file_editing' ) { |
| 65 | if ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT && ! ( $field['value'] ?? false ) ) { |
| 66 | $field['value'] = true; |
| 67 | $field['disabled'] = true; |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | if ( $field_id === 'block_code_execution_uploads' ) { |
| 72 | if ( ! rsssl_code_execution_allowed() && ! ( $field['value'] ?? false ) ) { |
| 73 | $field['value'] = true; |
| 74 | $field['disabled'] = true; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if ( $field_id === 'disable_xmlrpc' ) { |
| 79 | if ( ! rsssl_xmlrpc_enabled() && ! ( $field['value'] ?? false ) ) { |
| 80 | $field['value'] = true; |
| 81 | $field['disabled'] = true; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | if ( $field_id === 'rename_db_prefix' ) { |
| 86 | if ( ! rsssl_is_default_wp_prefix() && ! ( $field['value'] ?? false ) ) { |
| 87 | $field['value'] = true; |
| 88 | $field['disabled'] = true; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return $field; |
| 93 | } |
| 94 | add_filter('rsssl_field', 'rsssl_disable_fields', 10, 2); |
| 95 |