PluginProbe ʕ •ᴥ•ʔ
Extendify / 1.19.0
Extendify v1.19.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 0.7.0 0.8.0 0.8.1 0.8.2 0.8.3 0.8.4 0.9.0 0.9.1 0.9.2 0.9.3 0.9.4 0.9.5 1.0.0 1.0.1 1.1.0 1.10.0 1.10.1 1.11.0 1.11.1 1.11.2 1.12.0 1.12.1 1.12.2 1.12.3 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.13.5 1.14.0 1.14.1 1.14.2 1.14.3 1.14.4 1.14.5 1.14.6 1.15.0 1.15.1 1.15.2 1.15.3 1.15.4 1.16.0 1.16.1 1.17.0 1.17.1 1.17.2 1.18.0 1.18.1 1.18.2 1.18.3 1.18.4 1.18.5 1.19.0 1.19.1 1.19.2 1.19.3 1.19.4 1.19.5 1.19.6 1.19.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.4.0 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.8.0 1.8.1 1.8.2 1.9.0 1.9.1 1.9.2 1.9.3 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.4.0 2.4.1 3.0.0 3.0.1 3.0.2 3.0.3
extendify / bootstrap.php
extendify Last commit date
app 1 year ago languages 1 year ago lib 2 years ago public 1 year ago routes 1 year ago src 1 year ago vendor 1 year ago .gitattributes 2 years ago LICENSE 4 years ago bootstrap.php 1 year ago extendify.php 1 year ago jest.config.js 1 year ago jest.setup.js 1 year ago readme.txt 1 year ago
bootstrap.php
175 lines
1 <?php
2 /**
3 * Bootstrap the application
4 */
5
6 defined('ABSPATH') || die('No direct access.');
7
8 use Extendify\AdminPageRouter;
9 use Extendify\Affiliate;
10 use Extendify\Assist\Admin as AssistAdmin;
11 use Extendify\Config;
12 use Extendify\Draft\Admin as DraftAdmin;
13 use Extendify\HelpCenter\Admin as HelpCenterAdmin;
14 use Extendify\Insights;
15 use Extendify\Launch\Admin as LaunchAdmin;
16 use Extendify\Library\Admin as LibraryAdmin;
17 use Extendify\PageCreator\Admin as PageCreatorAdmin;
18 use Extendify\Library\Frontend as LibraryFrontend;
19 use Extendify\PartnerData;
20 use Extendify\Shared\Admin as SharedAdmin;
21 use Extendify\Shared\DataProvider\ResourceData;
22 use Extendify\Shared\Services\Import\ImagesImporter;
23 use Extendify\Shared\Services\VersionMigrator;
24 use Extendify\Recommendations\Admin as RecommendationsAdmin;
25
26 if (!defined('EXTENDIFY_REQUIRED_CAPABILITY')) {
27 define('EXTENDIFY_REQUIRED_CAPABILITY', 'manage_options');
28 }
29
30 if (!defined('EXTENDIFY_PATH')) {
31 define('EXTENDIFY_PATH', \plugin_dir_path(__FILE__));
32 }
33
34 if (!defined('EXTENDIFY_URL')) {
35 define('EXTENDIFY_URL', \plugin_dir_url(__FILE__));
36 }
37
38 if (!defined('EXTENDIFY_PLUGIN_BASENAME')) {
39 define('EXTENDIFY_PLUGIN_BASENAME', \plugin_basename(__DIR__ . '/extendify.php'));
40 }
41
42 if (is_readable(EXTENDIFY_PATH . 'vendor/autoload.php')) {
43 require EXTENDIFY_PATH . 'vendor/autoload.php';
44 }
45
46 if (!defined('EXTENDIFY_IS_THEME_EXTENDABLE')) {
47 define('EXTENDIFY_IS_THEME_EXTENDABLE', get_option('stylesheet') === 'extendable');
48 }
49
50 // This file should have no dependencies and always load.
51 new LibraryFrontend();
52 // This file hooks into an external task and should always load.
53 new Insights();
54 // This class set up the image import check scheduler.
55 new ImagesImporter();
56
57 // Run various database updates depending on the plugin version.
58 new VersionMigrator();
59
60 // This class will fetch and cache partner data to be used
61 // throughout every class below. If opt in.
62 new PartnerData();
63
64 // Set up scheduled cache (if opt-in and active).
65 if (!PartnerData::setting('deactivated')) {
66 ResourceData::scheduleCache();
67 }
68
69 if (current_user_can(EXTENDIFY_REQUIRED_CAPABILITY)) {
70 // The config class will collect information about the
71 // partner and plugin, so it's easier to access.
72 new Config();
73 if (!defined('EXTENDIFY_DEVMODE')) {
74 define('EXTENDIFY_DEVMODE', Config::$environment === 'DEVELOPMENT');
75 }
76
77 // This is a global "loader" class that loads in any assets that are shared everywhere.
78 new SharedAdmin();
79 // This class will handle loading library assets.
80 new LibraryAdmin();
81
82 // Only load these if the partner ID is set. These are all opt-in features.
83 if ((Config::$partnerId || constant('EXTENDIFY_DEVMODE')) && !PartnerData::setting('deactivated')) {
84 // This class handles the admin pages required for the plugin.
85 new AdminPageRouter();
86
87 // This class will handle loading page creator assets.
88 if (PartnerData::setting('showAIPageCreation') || constant('EXTENDIFY_DEVMODE')) {
89 new PageCreatorAdmin();
90 }
91
92 // This class will update links based on the partner's specifications.
93 new Affiliate();
94 // The remaining classes handle loading assets for each individual products.
95 // They are essentially asset loading classes.
96 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
97 if (isset($_GET['page']) && $_GET['page'] === 'extendify-assist') {
98 // Load only on Assist.
99 new AssistAdmin();
100 }
101
102 // Don't load on Launch.
103 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
104 if (!isset($_GET['page']) || $_GET['page'] !== 'extendify-launch') {
105 new HelpCenterAdmin();
106 if (PartnerData::setting('showProductRecommendations') || constant('EXTENDIFY_DEVMODE')) {
107 new RecommendationsAdmin();
108 }
109
110 if (PartnerData::setting('showDraft') || constant('EXTENDIFY_DEVMODE')) {
111 new DraftAdmin();
112 }
113 } else {
114 new LaunchAdmin();
115 }
116 }//end if
117
118 // This loads in all the REST API routes used by the plugin.
119 require EXTENDIFY_PATH . 'routes/api.php';
120 }//end if
121
122 // This file is used to update the plugin and removed before w.org release.
123 if (is_readable(EXTENDIFY_PATH . '/updater.php')) {
124 require EXTENDIFY_PATH . 'updater.php';
125 }
126
127 add_action('init', function () {
128 load_plugin_textdomain('extendify-local', false, dirname(plugin_basename(__FILE__)) . '/languages/php');
129 });
130
131 // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter
132 add_filter('load_script_translation_file', function ($file, $handle, $domain) {
133 if ($domain !== 'extendify-local') {
134 return $file;
135 }
136
137 return extendifyResolveFallbackLocaleFile($file);
138 }, 10, 3);
139
140 add_filter('load_textdomain_mofile', function ($mofile, $domain) {
141 if ($domain !== 'extendify-local') {
142 return $mofile;
143 }
144
145 return extendifyResolveFallbackLocaleFile($mofile);
146 }, 10, 2);
147
148 /**
149 * Resolves a fallback translation file path if the requested locale is unsupported.
150 *
151 * This function checks if the current file path includes an unsupported locale
152 * and replaces it with a supported fallback (e.g. es_AR → es_ES),
153 * as long as the fallback file exists on disk.
154 *
155 * @param string $filepath The original .mo or .json translation file path.
156 * @return string The fallback file path if it exists, or the original one.
157 */
158 function extendifyResolveFallbackLocaleFile($filepath)
159 {
160 if (str_contains($filepath, '-es_') && !file_exists($filepath)) {
161 $fallbackFile = preg_replace('/-es_[A-Z]{2}/', '-es_ES', $filepath);
162 if ($fallbackFile && file_exists($fallbackFile)) {
163 return $fallbackFile;
164 }
165 }
166
167 return $filepath;
168 }
169
170 // To cover legacy conflicts.
171 // phpcs:ignore
172 class ExtendifySdk
173 {
174 }
175