PluginProbe ʕ •ᴥ•ʔ
Extendify / 1.17.2
Extendify v1.17.2
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 / app / Config.php
extendify / app Last commit date
Assist 1 year ago Draft 1 year ago HelpCenter 1 year ago Launch 1 year ago Library 1 year ago Shared 1 year ago AdminPageRouter.php 1 year ago Affiliate.php 2 years ago ApiRouter.php 2 years ago Config.php 1 year ago Http.php 1 year ago Insights.php 1 year ago PartnerData.php 1 year ago SiteSettings.php 1 year ago
Config.php
156 lines
1 <?php
2 /**
3 * The App details file
4 */
5
6 namespace Extendify;
7
8 defined('ABSPATH') || die('No direct access.');
9
10 use Extendify\Shared\Services\Sanitizer;
11
12 /**
13 * Controller for handling various app data
14 */
15 class Config
16 {
17
18 /**
19 * Plugin slug
20 *
21 * @var string
22 */
23 public static $slug = 'extendify';
24
25 /**
26 * The JS/CSS asset manifest (with hashes)
27 *
28 * @var array
29 */
30 public static $assetManifest = [];
31
32 /**
33 * Plugin version
34 *
35 * @var string
36 */
37 public static $version = '';
38
39 /**
40 * Plugin API REST version
41 *
42 * @var string
43 */
44 public static $apiVersion = 'v1';
45
46 /**
47 * Partner Id
48 *
49 * @var string
50 */
51 public static $partnerId = 'no-partner';
52
53 /**
54 * Whether there is a partner
55 *
56 * @var boolean
57 */
58 public static $hasPartner = false;
59
60 /**
61 * Whether to load Launch
62 *
63 * @var boolean
64 */
65 public static $showLaunch = false;
66
67 /**
68 * Plugin environment
69 *
70 * @var string
71 */
72 public static $environment = '';
73
74 /**
75 * Host plugin
76 *
77 * @var string
78 */
79 public static $requiredCapability = EXTENDIFY_REQUIRED_CAPABILITY;
80
81 /**
82 * Plugin config
83 *
84 * @var array
85 */
86 public static $config = [];
87
88 /**
89 * Whether Launch was finished
90 *
91 * @var boolean
92 */
93 public static $launchCompleted = false;
94
95 /**
96 * Process the readme file to get version and name
97 *
98 * @return void
99 */
100 public function __construct()
101 {
102 // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
103 $readme = file_get_contents(EXTENDIFY_PATH . 'readme.txt');
104
105 preg_match('/Stable tag: ([0-9.:]+)/', $readme, $matches);
106 self::$version = $matches[1];
107
108 self::$assetManifest = wp_json_file_decode(EXTENDIFY_PATH . 'public/build/manifest.json', ['associative' => true]);
109
110 if (!get_option('extendify_first_installed_version')) {
111 update_option('extendify_first_installed_version', Sanitizer::sanitizeText(self::$version));
112 }
113
114 // Here for backwards compatibility.
115 if (isset($GLOBALS['extendify_sdk_partner']) && $GLOBALS['extendify_sdk_partner']) {
116 self::$partnerId = $GLOBALS['extendify_sdk_partner'];
117 }
118
119 // Always use the partner ID if set as a constant.
120 if (defined('EXTENDIFY_PARTNER_ID')) {
121 self::$partnerId = constant('EXTENDIFY_PARTNER_ID');
122 }
123
124 if (self::$partnerId && self::$partnerId !== 'no-partner') {
125 self::$hasPartner = true;
126 }
127
128 // An easy way to check if we are in dev mode is to look for a dev specific file.
129 $isDev = is_readable(EXTENDIFY_PATH . '.devbuild');
130
131 self::$environment = $isDev ? 'DEVELOPMENT' : 'PRODUCTION';
132 self::$launchCompleted = (bool) get_option('extendify_onboarding_completed', false);
133 self::$showLaunch = $this->showLaunch();
134 }
135
136 /**
137 * Conditionally load Extendify Launch.
138 *
139 * @return boolean
140 */
141 private function showLaunch()
142 {
143 // Always show it for dev mode.
144 if (self::$environment === 'DEVELOPMENT') {
145 return true;
146 }
147
148 // Currently we require a flag to be set.
149 if (!defined('EXTENDIFY_SHOW_ONBOARDING')) {
150 return false;
151 }
152
153 return constant('EXTENDIFY_SHOW_ONBOARDING') === true;
154 }
155 }
156