PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / trunk
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar vtrunk
3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.2.0 1.2.1 All 156 releases
notificationx / includes / MCP / Bootstrap.php

Bootstrap.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar trunk, at includes/MCP/Bootstrap.php

56 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Conditional bootstrap for the NotificationX MCP module.
4 *
5 * NotificationX still supports PHP 5.6, but the MCP server uses modern PHP
6 * (random_bytes, hash_equals, JSON everywhere). Rather than raise the plugin's
7 * floor for everyone, the MCP module is a progressive enhancement: it loads
8 * only when the runtime can support it. On older PHP the plugin behaves exactly
9 * as before and MCP simply does not appear.
10 *
11 * @package NotificationX\MCP
12 */
13
14 namespace NotificationX\MCP;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * Static entry point invoked from the main NotificationX engine.
22 */
23 class Bootstrap {
24
25 /**
26 * Minimum PHP version the MCP module requires.
27 */
28 const MIN_PHP = '7.0';
29
30 /**
31 * Load the MCP module when the runtime supports it.
32 *
33 * @return void
34 */
35 public static function init() {
36 if ( ! self::is_supported() ) {
37 return;
38 }
39 Manager::get_instance()->init();
40 }
41
42 /**
43 * Whether the current runtime can run the MCP module.
44 *
45 * @return bool
46 */
47 public static function is_supported() {
48 $supported = version_compare( PHP_VERSION, self::MIN_PHP, '>=' )
49 && function_exists( 'random_bytes' )
50 && function_exists( 'hash_equals' );
51
52 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Prefixed with nx_ per NotificationX convention.
53 return (bool) apply_filters( 'nx_mcp_is_supported', $supported );
54 }
55 }
56