PluginProbe
Extendify / 3.2.2
Extendify v3.2.2
3.2.2 3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 All 128 releases
← All changes | bootstrap.php +112 -5 3.0.4 → 3.2.2 View file →
@@ -8,8 +8,9 @@
8 8
9 9 use Extendify\AdminPageRouter;
10 10 use Extendify\Assist\Admin as AssistAdmin;
11 11 use Extendify\Agent\Admin as AgentAdmin;
12 +use Extendify\ComingSoon\Frontend as ComingSoonFrontend;
12 13 use Extendify\Config;
13 14 use Extendify\Draft\Admin as DraftAdmin;
14 15 use Extendify\HelpCenter\Admin as HelpCenterAdmin;
15 16 use Extendify\Insights;
@@ -16,18 +17,36 @@
16 17 use Extendify\Launch\Admin as LaunchAdmin;
17 18 use Extendify\AutoLaunch\Admin as AutoLaunchAdmin;
18 19 use Extendify\Library\Admin as LibraryAdmin;
19 20 use Extendify\Library\Frontend as LibraryFrontend;
21 +use Extendify\Mcp\Server as McpServer;
22 +use Extendify\Mcp\OAuth\Metadata as McpMetadata;
23 +use Extendify\Mcp\OAuth\Authorize as McpAuthorize;
24 +use Extendify\Mcp\OAuth\TokenEndpoint as McpTokenEndpoint;
25 +use Extendify\Mcp\OAuth\RegistrationEndpoint as McpRegistrationEndpoint;
26 +use Extendify\Mcp\Profile as McpProfile;
27 +use Extendify\Mcp\Lifecycle as McpLifecycle;
28 +use Extendify\Mcp\Jobs as McpJobs;
20 29 use Extendify\Agent\Frontend as AgentFrontend;
30 +use Extendify\QuickEdit\Frontend as QuickEditFrontend;
21 31 use Extendify\PageCreator\Admin as PageCreatorAdmin;
22 32 use Extendify\PartnerData;
33 +use Extendify\Notifications\Admin as NotificationsAdmin;
34 +use Extendify\Notifications\Frontend as NotificationsFrontend;
35 +use Extendify\Toolbar\Admin as ToolbarAdmin;
36 +use Extendify\Toolbar\Frontend as ToolbarFrontend;
23 37 use Extendify\Recommendations\Admin as RecommendationsAdmin;
24 38 use Extendify\PluginNotifications\Admin as PluginNotificationsAdmin;
25 39 use Extendify\Shared\Admin as SharedAdmin;
40 +use Extendify\Shared\DataProvider\NotificationData;
26 41 use Extendify\Shared\DataProvider\ResourceData;
42 +use Extendify\Shared\Services\BlockStyleVariations;
43 +use Extendify\Shared\Services\ForcePluginReinstall;
27 44 use Extendify\Shared\Services\Import\ImagesImporter;
28 45 use Extendify\Shared\Services\PluginRedirectDisabler;
46 +use Extendify\Shared\Services\PluginsActivation\SimplyBook;
29 47 use Extendify\Shared\Services\VersionMigrator;
48 +use Extendify\SiteVisibility;
30 49
31 50 if (!defined('EXTENDIFY_REQUIRED_CAPABILITY')) {
32 51 define('EXTENDIFY_REQUIRED_CAPABILITY', 'manage_options');
33 52 }
@@ -39,16 +58,49 @@
39 58 if (!defined('EXTENDIFY_URL')) {
40 59 define('EXTENDIFY_URL', \plugin_dir_url(__FILE__));
41 60 }
42 61
43 -if (!defined('EXTENDIFY_PLUGIN_BASENAME')) {
44 - define('EXTENDIFY_PLUGIN_BASENAME', \plugin_basename(__DIR__ . '/extendify.php'));
45 -}
46 -
47 62 if (is_readable(EXTENDIFY_PATH . 'vendor/autoload.php')) {
48 63 require EXTENDIFY_PATH . 'vendor/autoload.php';
49 64 }
50 65
66 +// Registered after the autoloader — these callbacks reference classes it loads.
67 +add_filter('http_request_args', function ($args, $url) {
68 + $extendifyHosts = array_filter(array_map(function ($host) {
69 + return wp_parse_url($host, PHP_URL_HOST);
70 + }, \Extendify\Constants::serviceUrls()));
71 +
72 + $host = wp_parse_url($url, PHP_URL_HOST);
73 + if ($host && (str_contains($host, 'extendify') || in_array($host, $extendifyHosts, true))) {
74 + $args['timeout'] = 45;
75 + }
76 +
77 + return $args;
78 +}, 100, 2);
79 +
80 +add_action('update_option', function ($option) {
81 + if (in_array($option, ['WPLANG', 'blogname'], true)) {
82 + \delete_transient('extendify_recommendations');
83 + \delete_transient('extendify_domains');
84 + \delete_transient('extendify_supportArticles');
85 + }
86 +
87 + // Delete the partner transient so we can fetch new data when the locale is switched.
88 + if (($option === 'WPLANG') && get_transient('extendify_partner_data_cache_check')) {
89 + delete_transient('extendify_partner_data_cache_check');
90 + PartnerData::getPartnerData();
91 + }
92 +});
93 +
94 +// Delete the partner transient so we can fetch new data when the locale is switched via WP-CLI.
95 +add_action('cli_init', function () {
96 + $command = sanitize_text_field(wp_unslash(($_SERVER['argv'][1] ?? '')));
97 + if ($command === 'language' && get_transient('extendify_partner_data_cache_check')) {
98 + delete_transient('extendify_partner_data_cache_check');
99 + PartnerData::getPartnerData();
100 + }
101 +});
102 +
51 103 if (!defined('EXTENDIFY_IS_THEME_EXTENDABLE')) {
52 104 define('EXTENDIFY_IS_THEME_EXTENDABLE', get_option('stylesheet') === 'extendable');
53 105 }
54 106
@@ -62,18 +114,47 @@
62 114
63 115 // Run various database updates depending on the plugin version.
64 116 new VersionMigrator();
65 117
118 + // Force-reinstall support for /wp/v2/plugins (opt-in via request header).
119 + ForcePluginReinstall::register();
120 +
121 + // Keeps our design variation names registered so global styles can hold them.
122 + BlockStyleVariations::register();
123 +
124 + // Their registration callback comes in unauthenticated, so this cannot sit behind the capability gate.
125 + SimplyBook::register();
126 +
66 127 // This class will fetch and cache partner data to be used
67 128 // throughout every class below. If opt in.
68 129 new PartnerData();
69 130
131 + // Assign A/B test variants now that partner data is loaded.
132 + Insights::setup((array) PartnerData::setting('activeTests'));
133 +
70 134 // Set up scheduled cache (if opt-in and active).
71 135 if (!PartnerData::setting('deactivated')) {
72 136 ResourceData::scheduleCache();
137 + NotificationData::scheduleCache();
73 138 }
74 139
140 + // A token request carries no session and would fail the capability check.
141 + if (defined('EXTENDIFY_PARTNER_ID') && !PartnerData::setting('deactivated')) {
142 + McpServer::register();
143 + McpMetadata::register();
144 + McpAuthorize::register();
145 + McpTokenEndpoint::register();
146 + McpRegistrationEndpoint::register();
147 + McpProfile::register();
148 + McpLifecycle::register();
149 + McpJobs::register();
150 + }
151 +
75 152 if (!current_user_can(EXTENDIFY_REQUIRED_CAPABILITY)) {
153 + if (!SiteVisibility::isPublished()) {
154 + new ComingSoonFrontend();
155 + }
156 +
76 157 return;
77 158 }
78 159
79 160 // The config class will collect information about the
@@ -131,8 +212,14 @@
131 212 $extendifyShowAgent = constant('EXTENDIFY_IS_THEME_EXTENDABLE')
132 213 && Config::$launchCompleted
133 214 && (PartnerData::setting('showAIAgents') || Config::preview('ai-agent'));
134 215
216 + // True when the AI Agent is actually loaded this request — the gate
217 + // above, or dev mode (so it can be exercised locally). Quick Edit and
218 + // the simple toolbar both build on the Agent, so they share this
219 + // decision rather than gating themselves independently.
220 + $extendifyLoadAgent = $extendifyShowAgent || constant('EXTENDIFY_DEVMODE');
221 +
135 222 if (!$extendifyShowAgent) {
136 223 new HelpCenterAdmin();
137 224 }
138 225
@@ -139,15 +226,35 @@
139 226 if (PartnerData::setting('showProductRecommendations') || constant('EXTENDIFY_DEVMODE')) {
140 227 new RecommendationsAdmin();
141 228 }
142 229
230 + new NotificationsAdmin();
231 + new NotificationsFrontend();
232 +
143 233 if (PartnerData::setting('showDraft') || constant('EXTENDIFY_DEVMODE')) {
144 234 new DraftAdmin();
145 235 }
146 236
147 - if ($extendifyShowAgent || constant('EXTENDIFY_DEVMODE')) {
237 + if ($extendifyLoadAgent) {
148 238 new AgentAdmin();
149 239 new AgentFrontend();
240 + }
241 +
242 + if ($extendifyLoadAgent) {
243 + new QuickEditFrontend();
244 + }
245 +
246 + // Simple Extendify toolbar — replaces the WordPress core admin
247 + // bar on the front end with a minimal AI Agent / Quick Edit /
248 + // Edit / WP Admin bar. The user-profile "Toolbar Style" setting
249 + // controls per-user override; the default is Launch-aware
250 + // ('simple' post-Launch, 'full' pre-Launch). Gated on the Agent
251 + // too: the toolbar's "AI Agent" button drives the Agent's mounted
252 + // admin-bar button, so without the Agent it would present a dead
253 + // button — never ship the toolbar unless the Agent is there.
254 + if ($extendifyLoadAgent && (PartnerData::setting('showSimpleToolbar') || Config::preview('simple-toolbar'))) {
255 + new ToolbarAdmin();
256 + new ToolbarFrontend();
150 257 }
151 258 })();
152 259
153 260 (static function () {