two-fa
2 months ago
vulnerabilities
2 months ago
block-code-execution-uploads.php
2 months ago
disable-xmlrpc.php
2 months ago
display-name-is-login-name.php
2 months ago
file-editing.php
2 months ago
hide-wp-version.php
2 months ago
index.php
2 months ago
prevent-login-info-leakage.php
2 months ago
rename-admin-user.php
2 months ago
rest-api.php
2 months ago
user-enumeration.php
2 months ago
user-registration.php
2 months ago
file-editing.php
45 lines
| 1 | <?php |
| 2 | defined( 'ABSPATH' ) or die(); |
| 3 | |
| 4 | /** |
| 5 | * @return void |
| 6 | * |
| 7 | * Disable file editing |
| 8 | */ |
| 9 | function rsssl_disable_file_editing() { |
| 10 | if ( ! defined('DISALLOW_FILE_EDIT' ) ) { |
| 11 | define('DISALLOW_FILE_EDIT', true ); |
| 12 | } |
| 13 | } |
| 14 | add_action("init", "rsssl_disable_file_editing"); |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * Username 'admin' changed notice |
| 19 | * @return array |
| 20 | */ |
| 21 | function rsssl_disable_file_editing_notice( $notices ) { |
| 22 | $notices['disallow_file_edit_false'] = array( |
| 23 | 'condition' => ['rsssl_file_editing_defined_but_disabled'], |
| 24 | 'callback' => '_true_', |
| 25 | 'score' => 5, |
| 26 | 'output' => array( |
| 27 | 'true' => array( |
| 28 | 'msg' => __("The DISALLOW_FILE_EDIT constant is defined and set to false. You can remove it from your wp-config.php.", "really-simple-ssl"), |
| 29 | 'icon' => 'open', |
| 30 | 'dismissible' => true, |
| 31 | 'url' => 'disallow_file_edit-defined-set-to-false' |
| 32 | ), |
| 33 | ), |
| 34 | ); |
| 35 | return $notices; |
| 36 | } |
| 37 | add_filter('rsssl_notices', 'rsssl_disable_file_editing_notice'); |
| 38 | |
| 39 | /** |
| 40 | * Check if the constant is defined, AND set to false. In that case the plugin cannot override it anymore |
| 41 | * @return bool |
| 42 | */ |
| 43 | function rsssl_file_editing_defined_but_disabled(){ |
| 44 | return defined( 'DISALLOW_FILE_EDIT' ) && ! DISALLOW_FILE_EDIT; |
| 45 | } |