PluginProbe
Extendify / 1.18.2
Extendify v1.18.2
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 0.7.0 All 126 releases
extendify / bootstrap.php

bootstrap.php in Extendify 1.18.2, at bootstrap.php

127 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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
25 if (!defined('EXTENDIFY_REQUIRED_CAPABILITY')) {
26 define('EXTENDIFY_REQUIRED_CAPABILITY', 'manage_options');
27 }
28
29 if (!defined('EXTENDIFY_PATH')) {
30 define('EXTENDIFY_PATH', \plugin_dir_path(__FILE__));
31 }
32
33 if (!defined('EXTENDIFY_URL')) {
34 define('EXTENDIFY_URL', \plugin_dir_url(__FILE__));
35 }
36
37 if (!defined('EXTENDIFY_PLUGIN_BASENAME')) {
38 define('EXTENDIFY_PLUGIN_BASENAME', \plugin_basename(__DIR__ . '/extendify.php'));
39 }
40
41 if (is_readable(EXTENDIFY_PATH . 'vendor/autoload.php')) {
42 require EXTENDIFY_PATH . 'vendor/autoload.php';
43 }
44
45 // This file should have no dependencies and always load.
46 new LibraryFrontend();
47 // This file hooks into an external task and should always load.
48 new Insights();
49 // This class set up the image import check scheduler.
50 new ImagesImporter();
51
52 // Run various database updates depending on the plugin version.
53 new VersionMigrator();
54
55 // This class will fetch and cache partner data to be used
56 // throughout every class below. If opt in.
57 new PartnerData();
58
59 // Set up scheduled cache (if opt-in and active).
60 if (!PartnerData::setting('deactivated')) {
61 ResourceData::scheduleCache();
62 }
63
64 if (current_user_can(EXTENDIFY_REQUIRED_CAPABILITY)) {
65 // The config class will collect information about the
66 // partner and plugin, so it's easier to access.
67 new Config();
68 if (!defined('EXTENDIFY_DEVMODE')) {
69 define('EXTENDIFY_DEVMODE', Config::$environment === 'DEVELOPMENT');
70 }
71
72 // This is a global "loader" class that loads in any assets that are shared everywhere.
73 new SharedAdmin();
74 // This class will handle loading library assets.
75 new LibraryAdmin();
76
77 // Only load these if the partner ID is set. These are all opt-in features.
78 if ((Config::$partnerId || constant('EXTENDIFY_DEVMODE')) && !PartnerData::setting('deactivated')) {
79 // This class handles the admin pages required for the plugin.
80 new AdminPageRouter();
81
82 // This class will handle loading page creator assets.
83 if (PartnerData::setting('showAIPageCreation') || constant('EXTENDIFY_DEVMODE')) {
84 new PageCreatorAdmin();
85 }
86
87 // This class will update links based on the partner's specifications.
88 new Affiliate();
89 // The remaining classes handle loading assets for each individual products.
90 // They are essentially asset loading classes.
91 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
92 if (isset($_GET['page']) && $_GET['page'] === 'extendify-assist') {
93 // Load only on Assist.
94 new AssistAdmin();
95 }
96
97 // Don't load on Launch.
98 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
99 if (!isset($_GET['page']) || $_GET['page'] !== 'extendify-launch') {
100 new HelpCenterAdmin();
101 if (PartnerData::setting('showDraft') || constant('EXTENDIFY_DEVMODE')) {
102 new DraftAdmin();
103 }
104 } else {
105 new LaunchAdmin();
106 }
107 }//end if
108
109 // This loads in all the REST API routes used by the plugin.
110 require EXTENDIFY_PATH . 'routes/api.php';
111 }//end if
112
113 // This file is used to update the plugin and removed before w.org release.
114 if (is_readable(EXTENDIFY_PATH . '/updater.php')) {
115 require EXTENDIFY_PATH . 'updater.php';
116 }
117
118 add_action('init', function () {
119 load_plugin_textdomain('extendify-local', false, dirname(plugin_basename(__FILE__)) . '/languages/php');
120 });
121
122 // To cover legacy conflicts.
123 // phpcs:ignore
124 class ExtendifySdk
125 {
126 }
127