File tree Expand file tree Collapse file tree 11 files changed +30
-6
lines changed
Expand file tree Collapse file tree 11 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 11<?php
2+
23declare (strict_types=1 );
34
5+ namespace CrowdSecWordPressBouncer ;
6+
47use CrowdSec \RemediationEngine \CacheStorage \CacheStorageException ;
58use CrowdSec \RemediationEngine \LapiRemediation ;
69use CrowdSec \Common \Logger \FileLog ;
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5+ namespace CrowdSecWordPressBouncer ;
6+
57use CrowdSecBouncer \Constants as LibConstants ;
68
79/**
Original file line number Diff line number Diff line change 11<?php
22
3+ use CrowdSecWordPressBouncer \AdminNotice ;
4+ use CrowdSecWordPressBouncer \Constants ;
5+ use CrowdSecWordPressBouncer \Bouncer ;
36use CrowdSecBouncer \BouncerException ;
47use CrowdSec \RemediationEngine \Constants as RemConstants ;
58use IPLib \Factory ;
9+
610require_once __DIR__ . '/../Constants.php ' ;
711require_once __DIR__ . '/../options-config.php ' ;
812require_once __DIR__ . '/notice.php ' ;
Original file line number Diff line number Diff line change 11<?php
22
3+ use CrowdSecWordPressBouncer \Constants ;
34use CrowdSecBouncer \BouncerException ;
45use CrowdSec \RemediationEngine \Geolocation ;
6+ use CrowdSecWordPressBouncer \AdminNotice ;
7+ use CrowdSecWordPressBouncer \Bouncer ;
58
69require_once __DIR__ . '/notice.php ' ;
710require_once __DIR__ . '/../Constants.php ' ;
@@ -222,7 +225,7 @@ function testGeolocationInAdminPage($ip)
222225 !isset ($ _POST ['nonce ' ]) || !wp_verify_nonce ($ _POST ['nonce ' ], 'crowdsec_test_connection ' )) {
223226 die ('This link expired. ' );
224227 }
225- $ ip = isset ( $ _POST ['crowdsec_test_connection_ip ' ]) ? $ _POST [ ' crowdsec_test_connection_ip ' ] : $ _SERVER ['REMOTE_ADDR ' ];
228+ $ ip = $ _POST ['crowdsec_test_connection_ip ' ] ?? $ _SERVER ['REMOTE_ADDR ' ];
226229 testBouncerConnexionInAdminPage ($ ip );
227230 header ("Location: {$ _SERVER ['HTTP_REFERER ' ]}" );
228231 exit (0 );
@@ -233,7 +236,7 @@ function testGeolocationInAdminPage($ip)
233236 !isset ($ _POST ['nonce ' ]) || !wp_verify_nonce ($ _POST ['nonce ' ], 'crowdsec_test_geolocation ' )) {
234237 die ('This link expired. ' );
235238 }
236- $ ip = isset ( $ _POST ['crowdsec_test_geolocation_ip ' ]) ? $ _POST [ ' crowdsec_test_geolocation_ip ' ] : $ _SERVER ['REMOTE_ADDR ' ];
239+ $ ip = $ _POST ['crowdsec_test_geolocation_ip ' ] ?? $ _SERVER ['REMOTE_ADDR ' ];
237240 testGeolocationInAdminPage ($ ip );
238241 header ("Location: {$ _SERVER ['HTTP_REFERER ' ]}" );
239242 exit (0 );
Original file line number Diff line number Diff line change 11<?php
22
3+ namespace CrowdSecWordPressBouncer ;
4+
35class AdminNotice
46{
57 const NOTICE_FIELD = 'crowdsec_admin_notice_message ' ;
68
79 public function displayAdminNotice ()
810 {
911 $ option = is_multisite () ? get_site_option (self ::NOTICE_FIELD ) : get_option (self ::NOTICE_FIELD );
10- $ message = isset ( $ option ['message ' ]) ? $ option [ ' message ' ] : false ;
12+ $ message = $ option ['message ' ] ?? false ;
1113 $ noticeLevel = !empty ($ option ['notice-level ' ]) ? $ option ['notice-level ' ] : 'notice-error ' ;
1214
1315 if ($ message ) {
Original file line number Diff line number Diff line change 11<?php
22require_once __DIR__ . '/../Constants.php ' ;
3+ use CrowdSecWordPressBouncer \Constants ;
4+
35
46function adminSettings ()
57{
Original file line number Diff line number Diff line change 66require_once __DIR__ . '/Constants.php ' ;
77require_once __DIR__ . '/options-config.php ' ;
88
9+ use CrowdSecWordPressBouncer \Constants ;
10+ use CrowdSecWordPressBouncer \Bouncer ;
911use CrowdSecBouncer \BouncerException ;
1012use Psr \Cache \CacheException ;
1113
Original file line number Diff line number Diff line change 11<?php
22require_once __DIR__ . '/Constants.php ' ;
3+ use CrowdSecWordPressBouncer \Constants ;
4+
35
46function getCrowdSecOptionsConfig (): array
57{
Original file line number Diff line number Diff line change 11<?php
22
3+ use CrowdSecWordPressBouncer \Constants ;
4+
35require_once __DIR__ .'/options-config.php ' ;
46require_once __DIR__ . '/Constants.php ' ;
57
Original file line number Diff line number Diff line change 11<?php
2+
3+ use CrowdSecWordPressBouncer \Bouncer ;
4+
25require_once __DIR__ . '/options-config.php ' ;
36require_once __DIR__ . '/Bouncer.php ' ;
47
You can’t perform that action at this time.
0 commit comments