| 1 |
<?php |
| 2 |
/** |
| 3 |
* Initialize Script Blocking. |
| 4 |
* |
| 5 |
* @package SureCookie\Inc\Modules\ScriptBlocking |
| 6 |
* @since 0.0.1 |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SureCookie\Inc\Modules\ScriptBlocking; |
| 10 |
|
| 11 |
use SureCookie\Inc\Traits\GetInstance; |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; // Exit if accessed directly. |
| 15 |
} |
| 16 |
|
| 17 |
/** |
| 18 |
* Init |
| 19 |
* |
| 20 |
* @since 0.0.1 |
| 21 |
*/ |
| 22 |
class Init { |
| 23 |
use GetInstance; |
| 24 |
|
| 25 |
/** |
| 26 |
* Constructor. |
| 27 |
* |
| 28 |
* @since 0.0.1 |
| 29 |
*/ |
| 30 |
private function __construct() { |
| 31 |
// The blocker's should_process() handles all conditions including settings check. |
| 32 |
Blocker::get_instance(); |
| 33 |
Scan_Scripts::get_instance(); |
| 34 |
|
| 35 |
// Nothing else reads the catalog, so a resource gated only by a catalog |
| 36 |
// pattern has no row on any admin screen. Record what the blocker matches |
| 37 |
// and surface those as rows. |
| 38 |
Matched_Resources::get_instance(); |
| 39 |
|
| 40 |
// The catalog domain (Services_Source, Known_Scripts blocking view, the |
| 41 |
// refresh Cron, declared cookies) now lives in the Services module and is |
| 42 |
// consumed here purely through the `surecookie_known_scripts` filter. |
| 43 |
|
| 44 |
// Custom block rules (custom_blocked_scripts) contribute their own |
| 45 |
// entries to that same filter at priority 25 (after the catalog view and |
| 46 |
// scan-detected merge), so this stays a pure consumer of the shared view. |
| 47 |
Custom_Scripts::get_instance(); |
| 48 |
} |
| 49 |
} |
| 50 |
|