PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
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 0.6.0 All 127 releases
← All changes | bootstrap.php +62 -0 3.1.03.2.1 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;
@@ -20,17 +21,24 @@
20 21 use Extendify\Agent\Frontend as AgentFrontend;
21 22 use Extendify\QuickEdit\Frontend as QuickEditFrontend;
22 23 use Extendify\PageCreator\Admin as PageCreatorAdmin;
23 24 use Extendify\PartnerData;
25 +use Extendify\Notifications\Admin as NotificationsAdmin;
26 +use Extendify\Notifications\Frontend as NotificationsFrontend;
24 27 use Extendify\Toolbar\Admin as ToolbarAdmin;
25 28 use Extendify\Toolbar\Frontend as ToolbarFrontend;
26 29 use Extendify\Recommendations\Admin as RecommendationsAdmin;
27 30 use Extendify\PluginNotifications\Admin as PluginNotificationsAdmin;
28 31 use Extendify\Shared\Admin as SharedAdmin;
32 +use Extendify\Shared\DataProvider\NotificationData;
29 33 use Extendify\Shared\DataProvider\ResourceData;
34 +use Extendify\Shared\Services\BlockStyleVariations;
35 +use Extendify\Shared\Services\ForcePluginReinstall;
30 36 use Extendify\Shared\Services\Import\ImagesImporter;
31 37 use Extendify\Shared\Services\PluginRedirectDisabler;
38 +use Extendify\Shared\Services\PluginsActivation\SimplyBook;
32 39 use Extendify\Shared\Services\VersionMigrator;
40 +use Extendify\SiteVisibility;
33 41
34 42 if (!defined('EXTENDIFY_REQUIRED_CAPABILITY')) {
35 43 define('EXTENDIFY_REQUIRED_CAPABILITY', 'manage_options');
36 44 }
@@ -46,8 +54,45 @@
46 54 if (is_readable(EXTENDIFY_PATH . 'vendor/autoload.php')) {
47 55 require EXTENDIFY_PATH . 'vendor/autoload.php';
48 56 }
49 57
58 +// Registered after the autoloader — these callbacks reference classes it loads.
59 +add_filter('http_request_args', function ($args, $url) {
60 + $extendifyHosts = array_filter(array_map(function ($host) {
61 + return wp_parse_url($host, PHP_URL_HOST);
62 + }, \Extendify\Constants::serviceUrls()));
63 +
64 + $host = wp_parse_url($url, PHP_URL_HOST);
65 + if ($host && (str_contains($host, 'extendify') || in_array($host, $extendifyHosts, true))) {
66 + $args['timeout'] = 45;
67 + }
68 +
69 + return $args;
70 +}, 100, 2);
71 +
72 +add_action('update_option', function ($option) {
73 + if (in_array($option, ['WPLANG', 'blogname'], true)) {
74 + \delete_transient('extendify_recommendations');
75 + \delete_transient('extendify_domains');
76 + \delete_transient('extendify_supportArticles');
77 + }
78 +
79 + // Delete the partner transient so we can fetch new data when the locale is switched.
80 + if (($option === 'WPLANG') && get_transient('extendify_partner_data_cache_check')) {
81 + delete_transient('extendify_partner_data_cache_check');
82 + PartnerData::getPartnerData();
83 + }
84 +});
85 +
86 +// Delete the partner transient so we can fetch new data when the locale is switched via WP-CLI.
87 +add_action('cli_init', function () {
88 + $command = sanitize_text_field(wp_unslash(($_SERVER['argv'][1] ?? '')));
89 + if ($command === 'language' && get_transient('extendify_partner_data_cache_check')) {
90 + delete_transient('extendify_partner_data_cache_check');
91 + PartnerData::getPartnerData();
92 + }
93 +});
94 +
50 95 if (!defined('EXTENDIFY_IS_THEME_EXTENDABLE')) {
51 96 define('EXTENDIFY_IS_THEME_EXTENDABLE', get_option('stylesheet') === 'extendable');
52 97 }
53 98
@@ -61,8 +106,17 @@
61 106
62 107 // Run various database updates depending on the plugin version.
63 108 new VersionMigrator();
64 109
110 + // Force-reinstall support for /wp/v2/plugins (opt-in via request header).
111 + ForcePluginReinstall::register();
112 +
113 + // Keeps our design variation names registered so global styles can hold them.
114 + BlockStyleVariations::register();
115 +
116 + // Their registration callback comes in unauthenticated, so this cannot sit behind the capability gate.
117 + SimplyBook::register();
118 +
65 119 // This class will fetch and cache partner data to be used
66 120 // throughout every class below. If opt in.
67 121 new PartnerData();
68 122
@@ -71,11 +125,16 @@
71 125
72 126 // Set up scheduled cache (if opt-in and active).
73 127 if (!PartnerData::setting('deactivated')) {
74 128 ResourceData::scheduleCache();
129 + NotificationData::scheduleCache();
75 130 }
76 131
77 132 if (!current_user_can(EXTENDIFY_REQUIRED_CAPABILITY)) {
133 + if (!SiteVisibility::isPublished()) {
134 + new ComingSoonFrontend();
135 + }
136 +
78 137 return;
79 138 }
80 139
81 140 // The config class will collect information about the
@@ -146,8 +205,11 @@
146 205
147 206 if (PartnerData::setting('showProductRecommendations') || constant('EXTENDIFY_DEVMODE')) {
148 207 new RecommendationsAdmin();
149 208 }
209 +
210 + new NotificationsAdmin();
211 + new NotificationsFrontend();
150 212
151 213 if (PartnerData::setting('showDraft') || constant('EXTENDIFY_DEVMODE')) {
152 214 new DraftAdmin();
153 215 }