Completed
Branch dependabot/composer/wp-graphql... (64393b)
by
unknown
04:29
created
core/services/addon/api/IncompatibleAddonHandler.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,14 +43,14 @@  discard block
 block discarded – undo
43 43
         string $load_callback,
44 44
         string $plugin_file_constant
45 45
     ) {
46
-        if (! defined($version_constant)) {
46
+        if ( ! defined($version_constant)) {
47 47
             return;
48 48
         }
49 49
         $addon_version = constant($version_constant);
50 50
         if ($addon_version && version_compare($addon_version, $min_version_required, '<')) {
51 51
             remove_action('AHEE__EE_System__load_espresso_addons', $load_callback);
52
-            if (! function_exists('deactivate_plugins')) {
53
-                require_once ABSPATH . 'wp-admin/includes/plugin.php';
52
+            if ( ! function_exists('deactivate_plugins')) {
53
+                require_once ABSPATH.'wp-admin/includes/plugin.php';
54 54
             }
55 55
             deactivate_plugins(plugin_basename(constant($plugin_file_constant)));
56 56
             unset($_GET['activate'], $_REQUEST['activate'], $_GET['activate-multi'], $_REQUEST['activate-multi']);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                     $min_version_required
65 65
                 ),
66 66
                 __FILE__,
67
-                __FUNCTION__ . "({$addon_name})",
67
+                __FUNCTION__."({$addon_name})",
68 68
                 __LINE__
69 69
             );
70 70
             EE_Error::get_notices(false, true);
Please login to merge, or discard this patch.
Indentation   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -6,80 +6,80 @@
 block discarded – undo
6 6
 
7 7
 class IncompatibleAddonHandler
8 8
 {
9
-    /**
10
-     * @return void
11
-     */
12
-    public function deactivateIncompatibleAddons()
13
-    {
14
-        static $done = false;
15
-        if ($done) {
16
-            return;
17
-        }
18
-        $this->deactivateIncompatibleAddon(
19
-            'Wait Lists',
20
-            'EE_WAIT_LISTS_VERSION',
21
-            '1.0.0.beta.074',
22
-            'load_espresso_wait_lists',
23
-            'EE_WAIT_LISTS_PLUGIN_FILE'
24
-        );
25
-        $this->deactivateIncompatibleAddon(
26
-            'Automated Upcoming Event Notifications',
27
-            'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION',
28
-            '1.0.0.beta.091',
29
-            'load_espresso_automated_upcoming_event_notification',
30
-            'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE'
31
-        );
32
-        // $this->deactivateIncompatibleAddon(
33
-        //     'WP Users Integration',
34
-        //     'EE_WPUSERS_VERSION',
35
-        //     '2.1.0.rc.003',
36
-        //     'load_ee_core_wpusers',
37
-        //     'EE_WPUSERS_PLUGIN_FILE'
38
-        // );
39
-        $done = true;
40
-    }
9
+	/**
10
+	 * @return void
11
+	 */
12
+	public function deactivateIncompatibleAddons()
13
+	{
14
+		static $done = false;
15
+		if ($done) {
16
+			return;
17
+		}
18
+		$this->deactivateIncompatibleAddon(
19
+			'Wait Lists',
20
+			'EE_WAIT_LISTS_VERSION',
21
+			'1.0.0.beta.074',
22
+			'load_espresso_wait_lists',
23
+			'EE_WAIT_LISTS_PLUGIN_FILE'
24
+		);
25
+		$this->deactivateIncompatibleAddon(
26
+			'Automated Upcoming Event Notifications',
27
+			'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_VERSION',
28
+			'1.0.0.beta.091',
29
+			'load_espresso_automated_upcoming_event_notification',
30
+			'EE_AUTOMATED_UPCOMING_EVENT_NOTIFICATION_PLUGIN_FILE'
31
+		);
32
+		// $this->deactivateIncompatibleAddon(
33
+		//     'WP Users Integration',
34
+		//     'EE_WPUSERS_VERSION',
35
+		//     '2.1.0.rc.003',
36
+		//     'load_ee_core_wpusers',
37
+		//     'EE_WPUSERS_PLUGIN_FILE'
38
+		// );
39
+		$done = true;
40
+	}
41 41
 
42 42
 
43
-    /**
44
-     * @param string $addon_name
45
-     * @param string $version_constant
46
-     * @param string $min_version_required
47
-     * @param string $load_callback
48
-     * @param string $plugin_file_constant
49
-     * @return void
50
-     */
51
-    private function deactivateIncompatibleAddon(
52
-        string $addon_name,
53
-        string $version_constant,
54
-        string $min_version_required,
55
-        string $load_callback,
56
-        string $plugin_file_constant
57
-    ) {
58
-        if (! defined($version_constant)) {
59
-            return;
60
-        }
61
-        $addon_version = constant($version_constant);
62
-        if ($addon_version && version_compare($addon_version, $min_version_required, '<')) {
63
-            remove_action('AHEE__EE_System__load_espresso_addons', $load_callback);
64
-            if (! function_exists('deactivate_plugins')) {
65
-                require_once ABSPATH . 'wp-admin/includes/plugin.php';
66
-            }
67
-            deactivate_plugins(plugin_basename(constant($plugin_file_constant)));
68
-            unset($_GET['activate'], $_REQUEST['activate'], $_GET['activate-multi'], $_REQUEST['activate-multi']);
69
-            EE_Error::add_error(
70
-                sprintf(
71
-                    esc_html__(
72
-                        'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.',
73
-                        'event_espresso'
74
-                    ),
75
-                    $addon_name,
76
-                    $min_version_required
77
-                ),
78
-                __FILE__,
79
-                __FUNCTION__ . "({$addon_name})",
80
-                __LINE__
81
-            );
82
-            EE_Error::get_notices(false, true);
83
-        }
84
-    }
43
+	/**
44
+	 * @param string $addon_name
45
+	 * @param string $version_constant
46
+	 * @param string $min_version_required
47
+	 * @param string $load_callback
48
+	 * @param string $plugin_file_constant
49
+	 * @return void
50
+	 */
51
+	private function deactivateIncompatibleAddon(
52
+		string $addon_name,
53
+		string $version_constant,
54
+		string $min_version_required,
55
+		string $load_callback,
56
+		string $plugin_file_constant
57
+	) {
58
+		if (! defined($version_constant)) {
59
+			return;
60
+		}
61
+		$addon_version = constant($version_constant);
62
+		if ($addon_version && version_compare($addon_version, $min_version_required, '<')) {
63
+			remove_action('AHEE__EE_System__load_espresso_addons', $load_callback);
64
+			if (! function_exists('deactivate_plugins')) {
65
+				require_once ABSPATH . 'wp-admin/includes/plugin.php';
66
+			}
67
+			deactivate_plugins(plugin_basename(constant($plugin_file_constant)));
68
+			unset($_GET['activate'], $_REQUEST['activate'], $_GET['activate-multi'], $_REQUEST['activate-multi']);
69
+			EE_Error::add_error(
70
+				sprintf(
71
+					esc_html__(
72
+						'We\'re sorry, but the Event Espresso %1$s addon was deactivated because version %2$s or higher is required with this version of Event Espresso core.',
73
+						'event_espresso'
74
+					),
75
+					$addon_name,
76
+					$min_version_required
77
+				),
78
+				__FILE__,
79
+				__FUNCTION__ . "({$addon_name})",
80
+				__LINE__
81
+			);
82
+			EE_Error::get_notices(false, true);
83
+		}
84
+	}
85 85
 }
Please login to merge, or discard this patch.
core/services/addon/api/AddonApiVersion.php 2 patches
Indentation   +282 added lines, -282 removed lines patch added patch discarded remove patch
@@ -19,286 +19,286 @@
 block discarded – undo
19 19
  */
20 20
 abstract class AddonApiVersion
21 21
 {
22
-    const V1 = 1;
23
-
24
-    /**
25
-     * @var int one of the API_VERSION_* constants from above
26
-     */
27
-    private $api_version;
28
-
29
-    /**
30
-     * @var DomainInterface
31
-     */
32
-    private $domain;
33
-
34
-    /**
35
-     * @var Version minimum version of EE core that the add-on will work with
36
-     */
37
-    private $min_core_version;
38
-
39
-    /**
40
-     * @var Version minimum version of WP core that the add-on will work with
41
-     */
42
-    private $min_wp_version;
43
-
44
-    /**
45
-     * @var string  PascalCase identifier for the add-on.
46
-     *              IMPORTANT! there must be a class of the same name in the root of the add-ons /src/domain/ folder
47
-     */
48
-    private $name;
49
-
50
-    /**
51
-     * @var string
52
-     */
53
-    private $addon_namespace;
54
-
55
-    /**
56
-     * @var FilePath
57
-     */
58
-    private $main_file;
59
-
60
-    /**
61
-     * @var string
62
-     */
63
-    private $slug;
64
-
65
-    /**
66
-     * @var Version the current add-on version
67
-     */
68
-    private $version;
69
-
70
-
71
-    /**
72
-     * Bootstrap constructor.
73
-     *
74
-     * @param string $slug
75
-     * @param string $name
76
-     * @param string $namespace
77
-     * @param string $version
78
-     * @param string $min_core_version
79
-     * @param string $main_file
80
-     * @param int    $api_version
81
-     */
82
-    protected function __construct(
83
-        string $slug,
84
-        string $name,
85
-        string $namespace,
86
-        string $version,
87
-        string $min_core_version,
88
-        string $main_file,
89
-        int $api_version
90
-    ) {
91
-        $this->setSlug($slug);
92
-        $this->setName($name);
93
-        $this->setNamespace($namespace);
94
-        $this->setMinCoreVersion($min_core_version);
95
-        $this->setMainFile($main_file);
96
-        $this->setVersion($version);
97
-        $this->setApiVersion($api_version);
98
-    }
99
-
100
-
101
-    /**
102
-     * @return void
103
-     */
104
-    public function initialize(): void
105
-    {
106
-        $this->domain = DomainFactory::create(
107
-            "{$this->addon_namespace}\\domain\\Domain",
108
-            $this->main_file,
109
-            $this->version
110
-        );
111
-    }
112
-
113
-
114
-    /**
115
-     * @return int[]
116
-     */
117
-    private function validApiVersions(): array
118
-    {
119
-        return [
120
-            AddonApiVersion::V1,
121
-        ];
122
-    }
123
-
124
-
125
-    /**
126
-     * @param int $api_version
127
-     */
128
-    private function setApiVersion(int $api_version): void
129
-    {
130
-        if (! in_array($api_version, $this->validApiVersions())) {
131
-            throw new DomainException(
132
-                esc_html__(
133
-                    'Invalid Add-on API Version! Please use one of the EventEspresso\core\domain\entities\addon\Bootstrap class constants',
134
-                    'event_espresso'
135
-                )
136
-            );
137
-        }
138
-        $this->api_version = $api_version;
139
-    }
140
-
141
-
142
-    /**
143
-     * @param string $main_file
144
-     */
145
-    public function setMainFile(string $main_file): void
146
-    {
147
-        $this->main_file = new FilePath($main_file);
148
-    }
149
-
150
-
151
-    /**
152
-     * @param string $min_core_version
153
-     */
154
-    private function setMinCoreVersion(string $min_core_version): void
155
-    {
156
-        $this->min_core_version = Version::fromString($min_core_version);
157
-    }
158
-
159
-
160
-    /**
161
-     * @param string $name
162
-     */
163
-    public function setName(string $name): void
164
-    {
165
-        $this->name = $name;
166
-    }
167
-
168
-
169
-    /**
170
-     * @param string $namespace
171
-     */
172
-    private function setNamespace(string $namespace): void
173
-    {
174
-        $this->addon_namespace = $namespace;
175
-    }
176
-
177
-
178
-    /**
179
-     * @param string $slug
180
-     */
181
-    private function setSlug(string $slug): void
182
-    {
183
-        $valid_slug = sanitize_key($slug);
184
-        if ($slug !== $valid_slug) {
185
-            throw new DomainException(
186
-                esc_html__(
187
-                    'Invalid Add-on "slug"! Please ensure that slug only uses lowercase characters and dashes.',
188
-                    'event_espresso'
189
-                )
190
-            );
191
-        }
192
-        $this->slug = $valid_slug;
193
-    }
194
-
195
-
196
-    /**
197
-     * @param string $version
198
-     */
199
-    public function setVersion(string $version): void
200
-    {
201
-        $this->version = Version::fromString($version);
202
-    }
203
-
204
-
205
-    /**
206
-     * @return int
207
-     */
208
-    public function apiVersion(): int
209
-    {
210
-        return $this->api_version;
211
-    }
212
-
213
-
214
-    /**
215
-     * @return DomainInterface
216
-     */
217
-    public function domain(): DomainInterface
218
-    {
219
-        return $this->domain;
220
-    }
221
-
222
-
223
-    /**
224
-     * @return Version|null
225
-     */
226
-    public function minCoreVersion(): ?Version
227
-    {
228
-        return $this->min_core_version;
229
-    }
230
-
231
-
232
-    /**
233
-     * @return Version|null
234
-     */
235
-    public function minWpVersion(): ?Version
236
-    {
237
-        return $this->min_wp_version;
238
-    }
239
-
240
-
241
-    /**
242
-     * @param string $min_wp_version
243
-     */
244
-    public function setMinWpVersion(string $min_wp_version = EE_MIN_WP_VER_REQUIRED): void
245
-    {
246
-        $this->min_wp_version = Version::fromString($min_wp_version);
247
-    }
248
-
249
-
250
-    /**
251
-     * @return string
252
-     */
253
-    public function name(): string
254
-    {
255
-        return $this->name;
256
-    }
257
-
258
-
259
-    /**
260
-     * FQCN for the domain's EE_Addon class
261
-     *
262
-     * @return string
263
-     */
264
-    public function fqcn(): string
265
-    {
266
-        return "{$this->addon_namespace}\\domain\\{$this->name}";
267
-    }
268
-
269
-
270
-    /**
271
-     * @return string
272
-     */
273
-    public function getNamespace(): string
274
-    {
275
-        return $this->addon_namespace;
276
-    }
277
-
278
-
279
-    /**
280
-     * @return FilePath
281
-     */
282
-    public function mainFile(): FilePath
283
-    {
284
-        return $this->main_file;
285
-    }
286
-
287
-
288
-    /**
289
-     * @return string
290
-     */
291
-    public function slug(): string
292
-    {
293
-        return $this->slug;
294
-    }
295
-
296
-
297
-    /**
298
-     * @return Version
299
-     */
300
-    public function version(): Version
301
-    {
302
-        return $this->version;
303
-    }
22
+	const V1 = 1;
23
+
24
+	/**
25
+	 * @var int one of the API_VERSION_* constants from above
26
+	 */
27
+	private $api_version;
28
+
29
+	/**
30
+	 * @var DomainInterface
31
+	 */
32
+	private $domain;
33
+
34
+	/**
35
+	 * @var Version minimum version of EE core that the add-on will work with
36
+	 */
37
+	private $min_core_version;
38
+
39
+	/**
40
+	 * @var Version minimum version of WP core that the add-on will work with
41
+	 */
42
+	private $min_wp_version;
43
+
44
+	/**
45
+	 * @var string  PascalCase identifier for the add-on.
46
+	 *              IMPORTANT! there must be a class of the same name in the root of the add-ons /src/domain/ folder
47
+	 */
48
+	private $name;
49
+
50
+	/**
51
+	 * @var string
52
+	 */
53
+	private $addon_namespace;
54
+
55
+	/**
56
+	 * @var FilePath
57
+	 */
58
+	private $main_file;
59
+
60
+	/**
61
+	 * @var string
62
+	 */
63
+	private $slug;
64
+
65
+	/**
66
+	 * @var Version the current add-on version
67
+	 */
68
+	private $version;
69
+
70
+
71
+	/**
72
+	 * Bootstrap constructor.
73
+	 *
74
+	 * @param string $slug
75
+	 * @param string $name
76
+	 * @param string $namespace
77
+	 * @param string $version
78
+	 * @param string $min_core_version
79
+	 * @param string $main_file
80
+	 * @param int    $api_version
81
+	 */
82
+	protected function __construct(
83
+		string $slug,
84
+		string $name,
85
+		string $namespace,
86
+		string $version,
87
+		string $min_core_version,
88
+		string $main_file,
89
+		int $api_version
90
+	) {
91
+		$this->setSlug($slug);
92
+		$this->setName($name);
93
+		$this->setNamespace($namespace);
94
+		$this->setMinCoreVersion($min_core_version);
95
+		$this->setMainFile($main_file);
96
+		$this->setVersion($version);
97
+		$this->setApiVersion($api_version);
98
+	}
99
+
100
+
101
+	/**
102
+	 * @return void
103
+	 */
104
+	public function initialize(): void
105
+	{
106
+		$this->domain = DomainFactory::create(
107
+			"{$this->addon_namespace}\\domain\\Domain",
108
+			$this->main_file,
109
+			$this->version
110
+		);
111
+	}
112
+
113
+
114
+	/**
115
+	 * @return int[]
116
+	 */
117
+	private function validApiVersions(): array
118
+	{
119
+		return [
120
+			AddonApiVersion::V1,
121
+		];
122
+	}
123
+
124
+
125
+	/**
126
+	 * @param int $api_version
127
+	 */
128
+	private function setApiVersion(int $api_version): void
129
+	{
130
+		if (! in_array($api_version, $this->validApiVersions())) {
131
+			throw new DomainException(
132
+				esc_html__(
133
+					'Invalid Add-on API Version! Please use one of the EventEspresso\core\domain\entities\addon\Bootstrap class constants',
134
+					'event_espresso'
135
+				)
136
+			);
137
+		}
138
+		$this->api_version = $api_version;
139
+	}
140
+
141
+
142
+	/**
143
+	 * @param string $main_file
144
+	 */
145
+	public function setMainFile(string $main_file): void
146
+	{
147
+		$this->main_file = new FilePath($main_file);
148
+	}
149
+
150
+
151
+	/**
152
+	 * @param string $min_core_version
153
+	 */
154
+	private function setMinCoreVersion(string $min_core_version): void
155
+	{
156
+		$this->min_core_version = Version::fromString($min_core_version);
157
+	}
158
+
159
+
160
+	/**
161
+	 * @param string $name
162
+	 */
163
+	public function setName(string $name): void
164
+	{
165
+		$this->name = $name;
166
+	}
167
+
168
+
169
+	/**
170
+	 * @param string $namespace
171
+	 */
172
+	private function setNamespace(string $namespace): void
173
+	{
174
+		$this->addon_namespace = $namespace;
175
+	}
176
+
177
+
178
+	/**
179
+	 * @param string $slug
180
+	 */
181
+	private function setSlug(string $slug): void
182
+	{
183
+		$valid_slug = sanitize_key($slug);
184
+		if ($slug !== $valid_slug) {
185
+			throw new DomainException(
186
+				esc_html__(
187
+					'Invalid Add-on "slug"! Please ensure that slug only uses lowercase characters and dashes.',
188
+					'event_espresso'
189
+				)
190
+			);
191
+		}
192
+		$this->slug = $valid_slug;
193
+	}
194
+
195
+
196
+	/**
197
+	 * @param string $version
198
+	 */
199
+	public function setVersion(string $version): void
200
+	{
201
+		$this->version = Version::fromString($version);
202
+	}
203
+
204
+
205
+	/**
206
+	 * @return int
207
+	 */
208
+	public function apiVersion(): int
209
+	{
210
+		return $this->api_version;
211
+	}
212
+
213
+
214
+	/**
215
+	 * @return DomainInterface
216
+	 */
217
+	public function domain(): DomainInterface
218
+	{
219
+		return $this->domain;
220
+	}
221
+
222
+
223
+	/**
224
+	 * @return Version|null
225
+	 */
226
+	public function minCoreVersion(): ?Version
227
+	{
228
+		return $this->min_core_version;
229
+	}
230
+
231
+
232
+	/**
233
+	 * @return Version|null
234
+	 */
235
+	public function minWpVersion(): ?Version
236
+	{
237
+		return $this->min_wp_version;
238
+	}
239
+
240
+
241
+	/**
242
+	 * @param string $min_wp_version
243
+	 */
244
+	public function setMinWpVersion(string $min_wp_version = EE_MIN_WP_VER_REQUIRED): void
245
+	{
246
+		$this->min_wp_version = Version::fromString($min_wp_version);
247
+	}
248
+
249
+
250
+	/**
251
+	 * @return string
252
+	 */
253
+	public function name(): string
254
+	{
255
+		return $this->name;
256
+	}
257
+
258
+
259
+	/**
260
+	 * FQCN for the domain's EE_Addon class
261
+	 *
262
+	 * @return string
263
+	 */
264
+	public function fqcn(): string
265
+	{
266
+		return "{$this->addon_namespace}\\domain\\{$this->name}";
267
+	}
268
+
269
+
270
+	/**
271
+	 * @return string
272
+	 */
273
+	public function getNamespace(): string
274
+	{
275
+		return $this->addon_namespace;
276
+	}
277
+
278
+
279
+	/**
280
+	 * @return FilePath
281
+	 */
282
+	public function mainFile(): FilePath
283
+	{
284
+		return $this->main_file;
285
+	}
286
+
287
+
288
+	/**
289
+	 * @return string
290
+	 */
291
+	public function slug(): string
292
+	{
293
+		return $this->slug;
294
+	}
295
+
296
+
297
+	/**
298
+	 * @return Version
299
+	 */
300
+	public function version(): Version
301
+	{
302
+		return $this->version;
303
+	}
304 304
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,7 @@
 block discarded – undo
127 127
      */
128 128
     private function setApiVersion(int $api_version): void
129 129
     {
130
-        if (! in_array($api_version, $this->validApiVersions())) {
130
+        if ( ! in_array($api_version, $this->validApiVersions())) {
131 131
             throw new DomainException(
132 132
                 esc_html__(
133 133
                     'Invalid Add-on API Version! Please use one of the EventEspresso\core\domain\entities\addon\Bootstrap class constants',
Please login to merge, or discard this patch.
core/services/addon/api/ThirdPartyPluginHandler.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
             && ! function_exists('json_basic_auth_handler')
43 43
             && ! function_exists('json_basic_auth_error')
44 44
         ) {
45
-            include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php';
45
+            include_once EE_THIRD_PARTY.'wp-api-basic-auth/basic-auth.php';
46 46
         }
47 47
     }
48 48
 }
Please login to merge, or discard this patch.
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -7,43 +7,43 @@
 block discarded – undo
7 7
 class ThirdPartyPluginHandler
8 8
 {
9 9
 
10
-    /**
11
-     * @var RequestInterface $request
12
-     */
13
-    private $request;
14
-
15
-
16
-    /**
17
-     * ThirdPartyPluginHandler constructor.
18
-     *
19
-     * @param RequestInterface $request
20
-     */
21
-    public function __construct(RequestInterface $request)
22
-    {
23
-        $this->request = $request;
24
-    }
25
-
26
-
27
-    public function loadPlugins()
28
-    {
29
-        $this->wpApiBasicAuth();
30
-    }
31
-
32
-
33
-    private function wpApiBasicAuth()
34
-    {
35
-        // if the WP API basic auth plugin isn't already loaded, load it now.
36
-        // We want it for mobile apps. Just include the entire plugin
37
-        // also, don't load the basic auth when a plugin is getting activated, because
38
-        // it could be the basic auth plugin, and it doesn't check if its methods are already defined
39
-        // and causes a fatal error
40
-        if (
41
-            ($this->request->isWordPressApi() || $this->request->isApi())
42
-            && ! $this->request->isActivation()
43
-            && ! function_exists('json_basic_auth_handler')
44
-            && ! function_exists('json_basic_auth_error')
45
-        ) {
46
-            include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php';
47
-        }
48
-    }
10
+	/**
11
+	 * @var RequestInterface $request
12
+	 */
13
+	private $request;
14
+
15
+
16
+	/**
17
+	 * ThirdPartyPluginHandler constructor.
18
+	 *
19
+	 * @param RequestInterface $request
20
+	 */
21
+	public function __construct(RequestInterface $request)
22
+	{
23
+		$this->request = $request;
24
+	}
25
+
26
+
27
+	public function loadPlugins()
28
+	{
29
+		$this->wpApiBasicAuth();
30
+	}
31
+
32
+
33
+	private function wpApiBasicAuth()
34
+	{
35
+		// if the WP API basic auth plugin isn't already loaded, load it now.
36
+		// We want it for mobile apps. Just include the entire plugin
37
+		// also, don't load the basic auth when a plugin is getting activated, because
38
+		// it could be the basic auth plugin, and it doesn't check if its methods are already defined
39
+		// and causes a fatal error
40
+		if (
41
+			($this->request->isWordPressApi() || $this->request->isApi())
42
+			&& ! $this->request->isActivation()
43
+			&& ! function_exists('json_basic_auth_handler')
44
+			&& ! function_exists('json_basic_auth_error')
45
+		) {
46
+			include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php';
47
+		}
48
+	}
49 49
 }
Please login to merge, or discard this patch.
core/services/addon/api/v1/LegacyModelApi.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -5,95 +5,95 @@
 block discarded – undo
5 5
 class LegacyModelApi
6 6
 {
7 7
 
8
-    /**
9
-     * @var string path to EE_* entity classes
10
-     */
11
-    private $entity_classes;
12
-
13
-    /**
14
-     * @var string path to EEM_* entity model classes
15
-     */
16
-    private $entity_models;
17
-
18
-    /**
19
-     * @var string path to EEE_* entity class extensions
20
-     */
21
-    private $entity_class_extensions;
22
-
23
-    /**
24
-     * @var string path to EEME_* entity model class extensions
25
-     */
26
-    private $entity_model_extensions;
27
-
28
-
29
-    /**
30
-     * @return string
31
-     */
32
-    public function entityClasses(): string
33
-    {
34
-        return $this->entity_classes;
35
-    }
36
-
37
-
38
-    /**
39
-     * @param string $entity_classes
40
-     */
41
-    public function addEntityClasses(string $entity_classes): void
42
-    {
43
-        $this->entity_classes = $entity_classes;
44
-    }
45
-
46
-
47
-    /**
48
-     * @return string
49
-     */
50
-    public function entityModels(): string
51
-    {
52
-        return $this->entity_models;
53
-    }
54
-
55
-
56
-    /**
57
-     * @param string $entity_models
58
-     */
59
-    public function addEntityModels(string $entity_models): void
60
-    {
61
-        $this->entity_models = $entity_models;
62
-    }
63
-
64
-
65
-    /**
66
-     * @return string
67
-     */
68
-    public function entityClassExtensions(): string
69
-    {
70
-        return $this->entity_class_extensions;
71
-    }
72
-
73
-
74
-    /**
75
-     * @param string $entity_class_extensions
76
-     */
77
-    public function addEntityClassExtensions(string $entity_class_extensions): void
78
-    {
79
-        $this->entity_class_extensions = $entity_class_extensions;
80
-    }
81
-
82
-
83
-    /**
84
-     * @return string
85
-     */
86
-    public function entityModelExtensions(): string
87
-    {
88
-        return $this->entity_model_extensions;
89
-    }
90
-
91
-
92
-    /**
93
-     * @param string $entity_model_extensions
94
-     */
95
-    public function addEntityModelExtensions(string $entity_model_extensions): void
96
-    {
97
-        $this->entity_model_extensions = $entity_model_extensions;
98
-    }
8
+	/**
9
+	 * @var string path to EE_* entity classes
10
+	 */
11
+	private $entity_classes;
12
+
13
+	/**
14
+	 * @var string path to EEM_* entity model classes
15
+	 */
16
+	private $entity_models;
17
+
18
+	/**
19
+	 * @var string path to EEE_* entity class extensions
20
+	 */
21
+	private $entity_class_extensions;
22
+
23
+	/**
24
+	 * @var string path to EEME_* entity model class extensions
25
+	 */
26
+	private $entity_model_extensions;
27
+
28
+
29
+	/**
30
+	 * @return string
31
+	 */
32
+	public function entityClasses(): string
33
+	{
34
+		return $this->entity_classes;
35
+	}
36
+
37
+
38
+	/**
39
+	 * @param string $entity_classes
40
+	 */
41
+	public function addEntityClasses(string $entity_classes): void
42
+	{
43
+		$this->entity_classes = $entity_classes;
44
+	}
45
+
46
+
47
+	/**
48
+	 * @return string
49
+	 */
50
+	public function entityModels(): string
51
+	{
52
+		return $this->entity_models;
53
+	}
54
+
55
+
56
+	/**
57
+	 * @param string $entity_models
58
+	 */
59
+	public function addEntityModels(string $entity_models): void
60
+	{
61
+		$this->entity_models = $entity_models;
62
+	}
63
+
64
+
65
+	/**
66
+	 * @return string
67
+	 */
68
+	public function entityClassExtensions(): string
69
+	{
70
+		return $this->entity_class_extensions;
71
+	}
72
+
73
+
74
+	/**
75
+	 * @param string $entity_class_extensions
76
+	 */
77
+	public function addEntityClassExtensions(string $entity_class_extensions): void
78
+	{
79
+		$this->entity_class_extensions = $entity_class_extensions;
80
+	}
81
+
82
+
83
+	/**
84
+	 * @return string
85
+	 */
86
+	public function entityModelExtensions(): string
87
+	{
88
+		return $this->entity_model_extensions;
89
+	}
90
+
91
+
92
+	/**
93
+	 * @param string $entity_model_extensions
94
+	 */
95
+	public function addEntityModelExtensions(string $entity_model_extensions): void
96
+	{
97
+		$this->entity_model_extensions = $entity_model_extensions;
98
+	}
99 99
 }
Please login to merge, or discard this patch.
core/services/addon/api/v1/RegisterAddon.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,26 +8,26 @@
 block discarded – undo
8 8
 
9 9
 class RegisterAddon
10 10
 {
11
-    /**
12
-     * @param AddonApiV1 $addon
13
-     * @throws EE_Error
14
-     */
15
-    public function register(AddonApiV1 $addon)
16
-    {
17
-        EE_Register_Addon::register(
18
-            $addon->fqcn(),
19
-            [
20
-                'version'               => $addon->version(),
21
-                'plugin_slug'           => $addon->slug(),
22
-                'min_core_version'      => $addon->minCoreVersion(),
23
-                'min_wp_version'        => $addon->minWpVersion(),
24
-                'main_file_path'        => $addon->mainFile(),
25
-                'dms_paths'             => [$addon->dataMigrationScripts()],
26
-                'class_paths'           => [$addon->entityClasses()],
27
-                'model_paths'           => [$addon->entityModels()],
28
-                'class_extension_paths' => [$addon->entityClassExtensions()],
29
-                'model_extension_paths' => [$addon->entityModelExtensions()],
30
-            ]
31
-        );
32
-    }
11
+	/**
12
+	 * @param AddonApiV1 $addon
13
+	 * @throws EE_Error
14
+	 */
15
+	public function register(AddonApiV1 $addon)
16
+	{
17
+		EE_Register_Addon::register(
18
+			$addon->fqcn(),
19
+			[
20
+				'version'               => $addon->version(),
21
+				'plugin_slug'           => $addon->slug(),
22
+				'min_core_version'      => $addon->minCoreVersion(),
23
+				'min_wp_version'        => $addon->minWpVersion(),
24
+				'main_file_path'        => $addon->mainFile(),
25
+				'dms_paths'             => [$addon->dataMigrationScripts()],
26
+				'class_paths'           => [$addon->entityClasses()],
27
+				'model_paths'           => [$addon->entityModels()],
28
+				'class_extension_paths' => [$addon->entityClassExtensions()],
29
+				'model_extension_paths' => [$addon->entityModelExtensions()],
30
+			]
31
+		);
32
+	}
33 33
 }
Please login to merge, or discard this patch.
core/services/addon/api/v1/AddonApi.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -7,135 +7,135 @@
 block discarded – undo
7 7
 class AddonApi extends AddonApiVersion
8 8
 {
9 9
 
10
-    /**
11
-     * @var DataMigrationApi
12
-     */
13
-    private $data_migration_api;
14
-
15
-    /**
16
-     * @var LegacyModelApi
17
-     */
18
-    private $legacy_model_api;
19
-
20
-
21
-    /**
22
-     * Bootstrap constructor.
23
-     *
24
-     * @param string $slug
25
-     * @param string $name
26
-     * @param string $namespace
27
-     * @param string $version
28
-     * @param string $min_core_version
29
-     * @param string $main_file
30
-     */
31
-    public function __construct(
32
-        string $slug,
33
-        string $name,
34
-        string $namespace,
35
-        string $version,
36
-        string $min_core_version,
37
-        string $main_file
38
-    ) {
39
-        parent::__construct(
40
-            $slug,
41
-            $name,
42
-            $namespace,
43
-            $version,
44
-            $min_core_version,
45
-            $main_file,
46
-            AddonApiVersion::V1
47
-        );
48
-        $this->legacy_model_api = new LegacyModelApi();
49
-        $this->data_migration_api = new DataMigrationApi();
50
-    }
51
-
52
-
53
-    /**
54
-     * @return string
55
-     */
56
-    public function dataMigrationScripts(): string
57
-    {
58
-        return $this->data_migration_api->dataMigrationScripts();
59
-    }
60
-
61
-
62
-    /**
63
-     * @param string $data_migration_scripts
64
-     */
65
-    public function addDataMigrationScripts(string $data_migration_scripts): void
66
-    {
67
-        $this->data_migration_api->addDataMigrationScripts($data_migration_scripts);
68
-    }
69
-
70
-
71
-    /**
72
-     * @return string
73
-     */
74
-    public function entityClasses(): string
75
-    {
76
-        return $this->legacy_model_api->entityClasses();
77
-    }
78
-
79
-
80
-    /**
81
-     * @param string $entity_classes
82
-     */
83
-    public function addEntityClasses(string $entity_classes): void
84
-    {
85
-        $this->legacy_model_api->addEntityClasses($entity_classes);
86
-    }
87
-
88
-
89
-    /**
90
-     * @return string
91
-     */
92
-    public function entityModels(): string
93
-    {
94
-        return $this->legacy_model_api->entityModels();
95
-    }
96
-
97
-
98
-    /**
99
-     * @param string $entity_models
100
-     */
101
-    public function addEntityModels(string $entity_models): void
102
-    {
103
-        $this->legacy_model_api->addEntityModels($entity_models);
104
-    }
105
-
106
-
107
-    /**
108
-     * @return string
109
-     */
110
-    public function entityClassExtensions(): string
111
-    {
112
-        return $this->legacy_model_api->entityClassExtensions();
113
-    }
114
-
115
-
116
-    /**
117
-     * @param string $entity_class_extensions
118
-     */
119
-    public function addEntityClassExtensions(string $entity_class_extensions): void
120
-    {
121
-        $this->legacy_model_api->addEntityClassExtensions($entity_class_extensions);
122
-    }
123
-
124
-
125
-    /**
126
-     * @return string
127
-     */
128
-    public function entityModelExtensions(): string
129
-    {
130
-        return $this->legacy_model_api->entityModelExtensions();
131
-    }
132
-
133
-
134
-    /**
135
-     * @param string $entity_model_extensions
136
-     */
137
-    public function addEntityModelExtensions(string $entity_model_extensions): void
138
-    {
139
-        $this->legacy_model_api->addEntityModelExtensions($entity_model_extensions);
140
-    }
10
+	/**
11
+	 * @var DataMigrationApi
12
+	 */
13
+	private $data_migration_api;
14
+
15
+	/**
16
+	 * @var LegacyModelApi
17
+	 */
18
+	private $legacy_model_api;
19
+
20
+
21
+	/**
22
+	 * Bootstrap constructor.
23
+	 *
24
+	 * @param string $slug
25
+	 * @param string $name
26
+	 * @param string $namespace
27
+	 * @param string $version
28
+	 * @param string $min_core_version
29
+	 * @param string $main_file
30
+	 */
31
+	public function __construct(
32
+		string $slug,
33
+		string $name,
34
+		string $namespace,
35
+		string $version,
36
+		string $min_core_version,
37
+		string $main_file
38
+	) {
39
+		parent::__construct(
40
+			$slug,
41
+			$name,
42
+			$namespace,
43
+			$version,
44
+			$min_core_version,
45
+			$main_file,
46
+			AddonApiVersion::V1
47
+		);
48
+		$this->legacy_model_api = new LegacyModelApi();
49
+		$this->data_migration_api = new DataMigrationApi();
50
+	}
51
+
52
+
53
+	/**
54
+	 * @return string
55
+	 */
56
+	public function dataMigrationScripts(): string
57
+	{
58
+		return $this->data_migration_api->dataMigrationScripts();
59
+	}
60
+
61
+
62
+	/**
63
+	 * @param string $data_migration_scripts
64
+	 */
65
+	public function addDataMigrationScripts(string $data_migration_scripts): void
66
+	{
67
+		$this->data_migration_api->addDataMigrationScripts($data_migration_scripts);
68
+	}
69
+
70
+
71
+	/**
72
+	 * @return string
73
+	 */
74
+	public function entityClasses(): string
75
+	{
76
+		return $this->legacy_model_api->entityClasses();
77
+	}
78
+
79
+
80
+	/**
81
+	 * @param string $entity_classes
82
+	 */
83
+	public function addEntityClasses(string $entity_classes): void
84
+	{
85
+		$this->legacy_model_api->addEntityClasses($entity_classes);
86
+	}
87
+
88
+
89
+	/**
90
+	 * @return string
91
+	 */
92
+	public function entityModels(): string
93
+	{
94
+		return $this->legacy_model_api->entityModels();
95
+	}
96
+
97
+
98
+	/**
99
+	 * @param string $entity_models
100
+	 */
101
+	public function addEntityModels(string $entity_models): void
102
+	{
103
+		$this->legacy_model_api->addEntityModels($entity_models);
104
+	}
105
+
106
+
107
+	/**
108
+	 * @return string
109
+	 */
110
+	public function entityClassExtensions(): string
111
+	{
112
+		return $this->legacy_model_api->entityClassExtensions();
113
+	}
114
+
115
+
116
+	/**
117
+	 * @param string $entity_class_extensions
118
+	 */
119
+	public function addEntityClassExtensions(string $entity_class_extensions): void
120
+	{
121
+		$this->legacy_model_api->addEntityClassExtensions($entity_class_extensions);
122
+	}
123
+
124
+
125
+	/**
126
+	 * @return string
127
+	 */
128
+	public function entityModelExtensions(): string
129
+	{
130
+		return $this->legacy_model_api->entityModelExtensions();
131
+	}
132
+
133
+
134
+	/**
135
+	 * @param string $entity_model_extensions
136
+	 */
137
+	public function addEntityModelExtensions(string $entity_model_extensions): void
138
+	{
139
+		$this->legacy_model_api->addEntityModelExtensions($entity_model_extensions);
140
+	}
141 141
 }
Please login to merge, or discard this patch.
core/services/addon/api/v1/DataMigrationApi.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,26 +5,26 @@
 block discarded – undo
5 5
 class DataMigrationApi
6 6
 {
7 7
 
8
-    /**
9
-     * @var string path to DMS folder
10
-     */
11
-    private $data_migration_scripts;
8
+	/**
9
+	 * @var string path to DMS folder
10
+	 */
11
+	private $data_migration_scripts;
12 12
 
13 13
 
14
-    /**
15
-     * @return string
16
-     */
17
-    public function dataMigrationScripts(): string
18
-    {
19
-        return $this->data_migration_scripts;
20
-    }
14
+	/**
15
+	 * @return string
16
+	 */
17
+	public function dataMigrationScripts(): string
18
+	{
19
+		return $this->data_migration_scripts;
20
+	}
21 21
 
22 22
 
23
-    /**
24
-     * @param string $data_migration_scripts
25
-     */
26
-    public function addDataMigrationScripts(string $data_migration_scripts): void
27
-    {
28
-        $this->data_migration_scripts = $data_migration_scripts;
29
-    }
23
+	/**
24
+	 * @param string $data_migration_scripts
25
+	 */
26
+	public function addDataMigrationScripts(string $data_migration_scripts): void
27
+	{
28
+		$this->data_migration_scripts = $data_migration_scripts;
29
+	}
30 30
 }
Please login to merge, or discard this patch.
core/domain/values/FilePath.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
      */
32 32
     public function __construct(string $file_path)
33 33
     {
34
-        if (! is_string($file_path)) {
34
+        if ( ! is_string($file_path)) {
35 35
             throw new InvalidDataTypeException(
36 36
                 '$file_path',
37 37
                 $file_path,
38 38
                 'string'
39 39
             );
40 40
         }
41
-        if (! is_readable($file_path)) {
41
+        if ( ! is_readable($file_path)) {
42 42
             throw new InvalidFilePathException($file_path);
43 43
         }
44 44
         $this->file_path = $file_path;
Please login to merge, or discard this patch.
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,40 +15,40 @@
 block discarded – undo
15 15
  */
16 16
 class FilePath
17 17
 {
18
-    /**
19
-     * @var string file_path
20
-     */
21
-    private $file_path;
18
+	/**
19
+	 * @var string file_path
20
+	 */
21
+	private $file_path;
22 22
 
23 23
 
24
-    /**
25
-     * FilePath constructor.
26
-     *
27
-     * @param string $file_path
28
-     * @throws InvalidDataTypeException
29
-     * @throws InvalidFilePathException
30
-     */
31
-    public function __construct(string $file_path)
32
-    {
33
-        if (! is_string($file_path)) {
34
-            throw new InvalidDataTypeException(
35
-                '$file_path',
36
-                $file_path,
37
-                'string'
38
-            );
39
-        }
40
-        if (! is_readable($file_path)) {
41
-            throw new InvalidFilePathException($file_path);
42
-        }
43
-        $this->file_path = $file_path;
44
-    }
24
+	/**
25
+	 * FilePath constructor.
26
+	 *
27
+	 * @param string $file_path
28
+	 * @throws InvalidDataTypeException
29
+	 * @throws InvalidFilePathException
30
+	 */
31
+	public function __construct(string $file_path)
32
+	{
33
+		if (! is_string($file_path)) {
34
+			throw new InvalidDataTypeException(
35
+				'$file_path',
36
+				$file_path,
37
+				'string'
38
+			);
39
+		}
40
+		if (! is_readable($file_path)) {
41
+			throw new InvalidFilePathException($file_path);
42
+		}
43
+		$this->file_path = $file_path;
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * @return string
49
-     */
50
-    public function __toString(): string
51
-    {
52
-        return $this->file_path;
53
-    }
47
+	/**
48
+	 * @return string
49
+	 */
50
+	public function __toString(): string
51
+	{
52
+		return $this->file_path;
53
+	}
54 54
 }
Please login to merge, or discard this patch.
core/domain/values/FullyQualifiedName.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,14 +33,14 @@
 block discarded – undo
33 33
      */
34 34
     public function __construct(string $fully_qualified_name)
35 35
     {
36
-        if (! is_string($fully_qualified_name)) {
36
+        if ( ! is_string($fully_qualified_name)) {
37 37
             throw new InvalidDataTypeException(
38 38
                 '$fully_qualified_name',
39 39
                 $fully_qualified_name,
40 40
                 'string'
41 41
             );
42 42
         }
43
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
+        if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
44 44
             if (strpos($fully_qualified_name, 'Interface') !== false) {
45 45
                 throw new InvalidInterfaceException($fully_qualified_name);
46 46
             }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -16,53 +16,53 @@
 block discarded – undo
16 16
  */
17 17
 class FullyQualifiedName
18 18
 {
19
-    /**
20
-     * @var string $fully_qualified_name
21
-     */
22
-    private $fully_qualified_name;
19
+	/**
20
+	 * @var string $fully_qualified_name
21
+	 */
22
+	private $fully_qualified_name;
23 23
 
24 24
 
25
-    /**
26
-     * FullyQualifiedName constructor.
27
-     *
28
-     * @param string $fully_qualified_name
29
-     * @throws InvalidClassException
30
-     * @throws InvalidInterfaceException
31
-     * @throws InvalidDataTypeException
32
-     */
33
-    public function __construct(string $fully_qualified_name)
34
-    {
35
-        if (! is_string($fully_qualified_name)) {
36
-            throw new InvalidDataTypeException(
37
-                '$fully_qualified_name',
38
-                $fully_qualified_name,
39
-                'string'
40
-            );
41
-        }
42
-        if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
-            if (strpos($fully_qualified_name, 'Interface') !== false) {
44
-                throw new InvalidInterfaceException($fully_qualified_name);
45
-            }
46
-            throw new InvalidClassException($fully_qualified_name);
47
-        }
48
-        $this->fully_qualified_name = $fully_qualified_name;
49
-    }
25
+	/**
26
+	 * FullyQualifiedName constructor.
27
+	 *
28
+	 * @param string $fully_qualified_name
29
+	 * @throws InvalidClassException
30
+	 * @throws InvalidInterfaceException
31
+	 * @throws InvalidDataTypeException
32
+	 */
33
+	public function __construct(string $fully_qualified_name)
34
+	{
35
+		if (! is_string($fully_qualified_name)) {
36
+			throw new InvalidDataTypeException(
37
+				'$fully_qualified_name',
38
+				$fully_qualified_name,
39
+				'string'
40
+			);
41
+		}
42
+		if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) {
43
+			if (strpos($fully_qualified_name, 'Interface') !== false) {
44
+				throw new InvalidInterfaceException($fully_qualified_name);
45
+			}
46
+			throw new InvalidClassException($fully_qualified_name);
47
+		}
48
+		$this->fully_qualified_name = $fully_qualified_name;
49
+	}
50 50
 
51 51
 
52
-    /**
53
-     * @return string
54
-     */
55
-    public function string(): string
56
-    {
57
-        return $this->fully_qualified_name;
58
-    }
52
+	/**
53
+	 * @return string
54
+	 */
55
+	public function string(): string
56
+	{
57
+		return $this->fully_qualified_name;
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * @return string
63
-     */
64
-    public function __toString(): string
65
-    {
66
-        return $this->fully_qualified_name;
67
-    }
61
+	/**
62
+	 * @return string
63
+	 */
64
+	public function __toString(): string
65
+	{
66
+		return $this->fully_qualified_name;
67
+	}
68 68
 }
Please login to merge, or discard this patch.