| 1 |
<?php |
| 2 |
/** |
| 3 |
* Integrations Initializer |
| 4 |
* |
| 5 |
* Hub for all third-party and platform integrations. |
| 6 |
* Currently handles WordPress Abilities API (WP 6.9+). |
| 7 |
* Future integrations can be added here with their own feature gates. |
| 8 |
* |
| 9 |
* @package SureCookie |
| 10 |
* @subpackage SureCookie/Inc/Integrations |
| 11 |
* @since 0.0.0-alpha.1 |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace SureCookie\Inc\Integrations; |
| 15 |
|
| 16 |
use SureCookie\Inc\Integrations\Astra\Init as Astra; |
| 17 |
use SureCookie\Inc\Integrations\Cache\Init as Cache; |
| 18 |
use SureCookie\Inc\Integrations\Elementor\Init as Elementor; |
| 19 |
use SureCookie\Inc\Integrations\Multilingual\Init as Multilingual; |
| 20 |
use SureCookie\Inc\Integrations\PrestoPlayer\Init as Presto_Player; |
| 21 |
use SureCookie\Inc\Integrations\ThemePalette\Init as Theme_Palette; |
| 22 |
use SureCookie\Inc\Integrations\Wordpress\Init as Wordpress_Abilities; |
| 23 |
use SureCookie\Inc\Integrations\WpConsentApi\Init as Wp_Consent_Api; |
| 24 |
use SureCookie\Inc\Traits\GetInstance; |
| 25 |
|
| 26 |
if ( ! defined( 'ABSPATH' ) ) { |
| 27 |
exit; // Exit if accessed directly. |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Class Init |
| 32 |
* |
| 33 |
* Conditionally initializes available integrations. |
| 34 |
* |
| 35 |
* @since 0.0.0-alpha.1 |
| 36 |
*/ |
| 37 |
class Init { |
| 38 |
use GetInstance; |
| 39 |
|
| 40 |
/** |
| 41 |
* Constructor. |
| 42 |
* |
| 43 |
* Feature-gates each integration behind its own availability check. |
| 44 |
* |
| 45 |
* @since 0.0.0-alpha.1 |
| 46 |
*/ |
| 47 |
public function __construct() { |
| 48 |
// WordPress Abilities API (WP 6.9+). |
| 49 |
if ( function_exists( 'wp_register_ability' ) ) { |
| 50 |
Wordpress_Abilities::get_instance(); |
| 51 |
} |
| 52 |
|
| 53 |
// Multilingual compatibility (WPML, Polylang). |
| 54 |
if ( Multilingual::is_multilingual_plugin_active() ) { |
| 55 |
Multilingual::get_instance(); |
| 56 |
} |
| 57 |
|
| 58 |
// WP Consent API integration. |
| 59 |
Wp_Consent_Api::get_instance(); |
| 60 |
|
| 61 |
// Presto Player block-level content blocker (gated inside Init). |
| 62 |
Presto_Player::get_instance(); |
| 63 |
|
| 64 |
// Elementor widgets that build their embed client-side (gated inside Init). |
| 65 |
Elementor::get_instance(); |
| 66 |
|
| 67 |
// Astra Global Color Palette (gated inside Init). |
| 68 |
Astra::get_instance(); |
| 69 |
|
| 70 |
// Theme palette presets for the Custom Colors pickers (Astra or |
| 71 |
// block-theme cascade resolved inside). |
| 72 |
Theme_Palette::get_instance(); |
| 73 |
|
| 74 |
// Cache and optimisation plugin compatibility. Always on: the exclusions |
| 75 |
// are filters the host plugins simply never call when absent. |
| 76 |
Cache::get_instance(); |
| 77 |
} |
| 78 |
} |
| 79 |
|