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
security.php
66 lines
| 1 | <?php |
| 2 | |
| 3 | use RSSSL\Security\RSSSL_Htaccess_File_Manager; |
| 4 | |
| 5 | defined('ABSPATH') or die(); |
| 6 | class REALLY_SIMPLE_SECURITY |
| 7 | { |
| 8 | private static $instance; |
| 9 | public $firewall_manager; |
| 10 | public $hardening; |
| 11 | /** |
| 12 | * Components array, so we can access singleton classes which are dynamically added, from anywhere. |
| 13 | * @var |
| 14 | */ |
| 15 | public $components; |
| 16 | |
| 17 | private function __construct() |
| 18 | { |
| 19 | if (!defined('RSSSL_SAFE_MODE') && file_exists(trailingslashit(WP_CONTENT_DIR) . 'rsssl-safe-mode.lock')) { |
| 20 | define('RSSSL_SAFE_MODE', true); |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | public static function instance() |
| 25 | { |
| 26 | if (!isset(self::$instance) && !(self::$instance instanceof REALLY_SIMPLE_SECURITY)) { |
| 27 | self::$instance = new REALLY_SIMPLE_SECURITY; |
| 28 | self::$instance->includes(); |
| 29 | if ( rsssl_admin_logged_in() ) { |
| 30 | $htaccessFileManager = new RSSSL_Htaccess_File_Manager(); |
| 31 | self::$instance->firewall_manager = new rsssl_firewall_manager($htaccessFileManager); |
| 32 | self::$instance->hardening = new rsssl_hardening(); |
| 33 | } |
| 34 | } |
| 35 | return self::$instance; |
| 36 | } |
| 37 | |
| 38 | private function includes() |
| 39 | { |
| 40 | |
| 41 | $path = rsssl_path.'security/'; |
| 42 | require_once( $path . 'integrations.php' ); |
| 43 | require_once( $path . 'hardening.php' ); |
| 44 | require_once( $path . 'cron.php' ); |
| 45 | require_once( $path . 'includes/check404/class-rsssl-simple-404-interceptor.php' ); |
| 46 | |
| 47 | /** |
| 48 | * Load only on back-end |
| 49 | */ |
| 50 | if ( rsssl_admin_logged_in() ) { |
| 51 | require_once( $path . 'functions.php' ); |
| 52 | require_once( $path . 'deactivate-integration.php' ); |
| 53 | require_once( $path . 'firewall-manager.php' ); |
| 54 | require_once( $path . 'tests.php' ); |
| 55 | require_once( $path . 'notices.php' ); |
| 56 | require_once( $path . 'sync-settings.php' ); |
| 57 | } |
| 58 | |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | function RSSSL_SECURITY() |
| 63 | { |
| 64 | return REALLY_SIMPLE_SECURITY::instance(); |
| 65 | } |
| 66 | add_action('plugins_loaded', 'RSSSL_SECURITY', 9); |