Completed
Branch BUG-10659-fix-addon-reactivati... (f6b1ff)
by
unknown
50:26 queued 37:42
created
core/libraries/plugin_api/EE_Register_Addon.lib.php 2 patches
Indentation   +988 added lines, -988 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if (! defined('EVENT_ESPRESSO_VERSION')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 
@@ -19,1047 +19,1047 @@  discard block
 block discarded – undo
19 19
 {
20 20
 
21 21
 
22
-    /**
23
-     * possibly truncated version of the EE core version string
24
-     *
25
-     * @var string
26
-     */
27
-    protected static $_core_version = '';
22
+	/**
23
+	 * possibly truncated version of the EE core version string
24
+	 *
25
+	 * @var string
26
+	 */
27
+	protected static $_core_version = '';
28 28
 
29
-    /**
30
-     * Holds values for registered addons
31
-     *
32
-     * @var array
33
-     */
34
-    protected static $_settings = array();
29
+	/**
30
+	 * Holds values for registered addons
31
+	 *
32
+	 * @var array
33
+	 */
34
+	protected static $_settings = array();
35 35
 
36
-    /**
37
-     * @var  array $_incompatible_addons keys are addon SLUGS
38
-     * (first argument passed to EE_Register_Addon::register()), keys are
39
-     * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
40
-     * Generally this should be used sparingly, as we don't want to muddle up
41
-     * EE core with knowledge of ALL the addons out there.
42
-     * If you want NO versions of an addon to run with a certain version of core,
43
-     * it's usually best to define the addon's "min_core_version" as part of its call
44
-     * to EE_Register_Addon::register(), rather than using this array with a super high value for its
45
-     * minimum plugin version.
46
-     * @access    protected
47
-     */
48
-    protected static $_incompatible_addons = array(
49
-        'Multi_Event_Registration' => '2.0.11.rc.002',
50
-        'Promotions'               => '1.0.0.rc.084',
51
-    );
36
+	/**
37
+	 * @var  array $_incompatible_addons keys are addon SLUGS
38
+	 * (first argument passed to EE_Register_Addon::register()), keys are
39
+	 * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004).
40
+	 * Generally this should be used sparingly, as we don't want to muddle up
41
+	 * EE core with knowledge of ALL the addons out there.
42
+	 * If you want NO versions of an addon to run with a certain version of core,
43
+	 * it's usually best to define the addon's "min_core_version" as part of its call
44
+	 * to EE_Register_Addon::register(), rather than using this array with a super high value for its
45
+	 * minimum plugin version.
46
+	 * @access    protected
47
+	 */
48
+	protected static $_incompatible_addons = array(
49
+		'Multi_Event_Registration' => '2.0.11.rc.002',
50
+		'Promotions'               => '1.0.0.rc.084',
51
+	);
52 52
 
53 53
 
54
-    /**
55
-     * We should always be comparing core to a version like '4.3.0.rc.000',
56
-     * not just '4.3.0'.
57
-     * So if the addon developer doesn't provide that full version string,
58
-     * fill in the blanks for them
59
-     *
60
-     * @param string $min_core_version
61
-     * @return string always like '4.3.0.rc.000'
62
-     */
63
-    protected static function _effective_version($min_core_version)
64
-    {
65
-        // versions: 4 . 3 . 1 . p . 123
66
-        // offsets:    0 . 1 . 2 . 3 . 4
67
-        $version_parts = explode('.', $min_core_version);
68
-        //check they specified the micro version (after 2nd period)
69
-        if (! isset($version_parts[2])) {
70
-            $version_parts[2] = '0';
71
-        }
72
-        //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73
-        //soon we can assume that's 'rc', but this current version is 'alpha'
74
-        if (! isset($version_parts[3])) {
75
-            $version_parts[3] = 'dev';
76
-        }
77
-        if (! isset($version_parts[4])) {
78
-            $version_parts[4] = '000';
79
-        }
80
-        return implode('.', $version_parts);
81
-    }
54
+	/**
55
+	 * We should always be comparing core to a version like '4.3.0.rc.000',
56
+	 * not just '4.3.0'.
57
+	 * So if the addon developer doesn't provide that full version string,
58
+	 * fill in the blanks for them
59
+	 *
60
+	 * @param string $min_core_version
61
+	 * @return string always like '4.3.0.rc.000'
62
+	 */
63
+	protected static function _effective_version($min_core_version)
64
+	{
65
+		// versions: 4 . 3 . 1 . p . 123
66
+		// offsets:    0 . 1 . 2 . 3 . 4
67
+		$version_parts = explode('.', $min_core_version);
68
+		//check they specified the micro version (after 2nd period)
69
+		if (! isset($version_parts[2])) {
70
+			$version_parts[2] = '0';
71
+		}
72
+		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73
+		//soon we can assume that's 'rc', but this current version is 'alpha'
74
+		if (! isset($version_parts[3])) {
75
+			$version_parts[3] = 'dev';
76
+		}
77
+		if (! isset($version_parts[4])) {
78
+			$version_parts[4] = '000';
79
+		}
80
+		return implode('.', $version_parts);
81
+	}
82 82
 
83 83
 
84
-    /**
85
-     * Returns whether or not the min core version requirement of the addon is met
86
-     *
87
-     * @param string $min_core_version    the minimum core version required by the addon
88
-     * @param string $actual_core_version the actual core version, optional
89
-     * @return boolean
90
-     */
91
-    public static function _meets_min_core_version_requirement(
92
-        $min_core_version,
93
-        $actual_core_version = EVENT_ESPRESSO_VERSION
94
-    ) {
95
-        return version_compare(
96
-            self::_effective_version($actual_core_version),
97
-            self::_effective_version($min_core_version),
98
-            '>='
99
-        );
100
-    }
84
+	/**
85
+	 * Returns whether or not the min core version requirement of the addon is met
86
+	 *
87
+	 * @param string $min_core_version    the minimum core version required by the addon
88
+	 * @param string $actual_core_version the actual core version, optional
89
+	 * @return boolean
90
+	 */
91
+	public static function _meets_min_core_version_requirement(
92
+		$min_core_version,
93
+		$actual_core_version = EVENT_ESPRESSO_VERSION
94
+	) {
95
+		return version_compare(
96
+			self::_effective_version($actual_core_version),
97
+			self::_effective_version($min_core_version),
98
+			'>='
99
+		);
100
+	}
101 101
 
102 102
 
103
-    /**
104
-     *    Method for registering new EE_Addons.
105
-     * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
106
-     * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
107
-     * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
108
-     * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
109
-     * 'activate_plugin', it registers the addon still, but its components are not registered
110
-     * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
111
-     * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
112
-     * (so that we can detect that the addon has activated on the subsequent request)
113
-     *
114
-     * @since    4.3.0
115
-     * @param string                  $addon_name                           the EE_Addon's name. Required.
116
-     * @param  array                  $setup_args                           {                                    An
117
-     *                                                                      array of arguments provided for registering
118
-     *                                                                      the message type.
119
-     * @type  string                  $class_name                           the addon's main file name.
120
-     *                                                                      If left blank, generated from the addon
121
-     *                                                                      name, changes something like "calendar" to
122
-     *                                                                      "EE_Calendar"
123
-     * @type string                   $min_core_version                     the minimum version of EE Core that the
124
-     *       addon will work with. eg "4.8.1.rc.084"
125
-     * @type string                   $version                              the "software" version for the addon. eg
126
-     *       "1.0.0.p" for a first stable release, or "1.0.0.rc.043" for a version in progress
127
-     * @type string                   $main_file_path                       the full server path to the main file
128
-     *       loaded
129
-     *                                                                      directly by WP
130
-     * @type string                   $admin_path                           full server path to the folder where the
131
-     *       addon\'s admin files reside
132
-     * @type string                   $admin_callback                       a method to be called when the EE Admin is
133
-     *       first invoked, can be used for hooking into any admin page
134
-     * @type string                   $config_section                       the section name for this addon's
135
-     *       configuration settings section (defaults to "addons")
136
-     * @type string                   $config_class                         the class name for this addon's
137
-     *       configuration settings object
138
-     * @type string                   $config_name                          the class name for this addon's
139
-     *       configuration settings object
140
-     * @type string                   $autoloader_paths                     an array of class names and the full server
141
-     *       paths to those files. Required.
142
-     * @type string                   $autoloader_folders                   an array of  "full server paths" for any
143
-     *       folders containing classes that might be invoked by the addon
144
-     * @type string                   $dms_paths                            an array of full server paths to folders
145
-     *       that contain data migration scripts. Required.
146
-     * @type string                   $module_paths                         an array of full server paths to any
147
-     *       EED_Modules used by the addon
148
-     * @type string                   $shortcode_paths                      an array of full server paths to folders
149
-     *       that contain EES_Shortcodes
150
-     * @type string                   $widget_paths                         an array of full server paths to folders
151
-     *       that contain WP_Widgets
152
-     * @type string                   $pue_options
153
-     * @type array                    $capabilities                         an array indexed by role name
154
-     *                                                                      (i.e administrator,author ) and the values
155
-     *                                                                      are an array of caps to add to the role.
156
-     *                                                                      'administrator' => array(
157
-     *                                                                      'read_addon', 'edit_addon', etc.
158
-     *                                                                      ).
159
-     * @type EE_Meta_Capability_Map[] $capability_maps                      an array of EE_Meta_Capability_Map object
160
-     *       for any addons that need to register any special meta mapped capabilities.  Should be indexed where the
161
-     *       key is the EE_Meta_Capability_Map class name and the values are the arguments sent to the class.
162
-     * @type array                    $model_paths                          array of folders containing DB models
163
-     * @see      EE_Register_Model
164
-     * @type array                    $class_paths                          array of folders containing DB classes
165
-     * @see      EE_Register_Model
166
-     * @type array                    $model_extension_paths                array of folders containing DB model
167
-     *       extensions
168
-     * @see      EE_Register_Model_Extension
169
-     * @type array                    $class_extension_paths                array of folders containing DB class
170
-     *       extensions
171
-     * @see      EE_Register_Model_Extension
172
-     * @type array message_types {
173
-     *                                                                      An array of message types with the key as
174
-     *                                                                      the message type name and the values as
175
-     *                                                                      below:
176
-     * @type string                   $mtfilename                           The filename of the message type being
177
-     *       registered. This will be the main EE_{Messagetype_Name}_message_type class.
178
-     *                                                                      (eg.
179
-     *                                                                      EE_Declined_Registration_message_type.class.php)
180
-     *                                                                      Required.
181
-     * @type array                    $autoloadpaths                        An array of paths to add to the messages
182
-     *                                                                      autoloader for the new message type.
183
-     *                                                                      Required.
184
-     * @type array                    $messengers_to_activate_with          An array of messengers that this message
185
-     *                                                                      type should activate with. Each value in
186
-     *                                                                      the
187
-     *                                                                      array
188
-     *                                                                      should match the name property of a
189
-     *                                                                      EE_messenger. Optional.
190
-     * @type array                    $messengers_to_validate_with          An array of messengers that this message
191
-     *                                                                      type should validate with. Each value in
192
-     *                                                                      the
193
-     *                                                                      array
194
-     *                                                                      should match the name property of an
195
-     *                                                                      EE_messenger.
196
-     *                                                                      Optional.
197
-     *                                                                      }
198
-     * @type array                    $custom_post_types
199
-     * @type array                    $custom_taxonomies
200
-     * @type array                    $payment_method_paths                 each element is the folder containing the
201
-     *                                                                      EE_PMT_Base child class
202
-     *                                                                      (eg,
203
-     *                                                                      '/wp-content/plugins/my_plugin/Payomatic/'
204
-     *                                                                      which contains the files
205
-     *                                                                      EE_PMT_Payomatic.pm.php)
206
-     * @type array                    $default_terms
207
-     * @type array                    $namespace                            {
208
-     *                                                                      An array with two items for registering the
209
-     *                                                                      addon's namespace. (If, for some reason,
210
-     *                                                                      you
211
-     *                                                                      require additional namespaces, use
212
-     *                                                                      EventEspresso\core\Psr4Autoloader::addNamespace()
213
-     *                                                                      directly)
214
-     * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
215
-     * @type string                   $FQNS                                 the namespace prefix
216
-     * @type string                   $DIR                                  a base directory for class files in the
217
-     *       namespace.
218
-     *                                                                      }
219
-     *                                                                      }
220
-     * @throws EE_Error
221
-     * @return void
222
-     */
223
-    public static function register($addon_name = '', $setup_args = array())
224
-    {
225
-        // required fields MUST be present, so let's make sure they are.
226
-        \EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
227
-        // get class name for addon
228
-        $class_name = \EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
229
-        //setup $_settings array from incoming values.
230
-        $addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
231
-        // setup PUE
232
-        \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233
-        // does this addon work with this version of core or WordPress ?
234
-        if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235
-            return;
236
-        }
237
-        // register namespaces
238
-        \EE_Register_Addon::_setup_namespaces($addon_settings);
239
-        // check if this is an activation request
240
-        if (\EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
241
-            // dont bother setting up the rest of the addon atm
242
-            return;
243
-        }
244
-        // we need cars
245
-        \EE_Register_Addon::_setup_autoloaders($addon_name);
246
-        // register new models and extensions
247
-        \EE_Register_Addon::_register_models_and_extensions($addon_name);
248
-        // setup DMS
249
-        \EE_Register_Addon::_register_data_migration_scripts($addon_name);
250
-        // if config_class is present let's register config.
251
-        \EE_Register_Addon::_register_config($addon_name);
252
-        // register admin pages
253
-        \EE_Register_Addon::_register_admin_pages($addon_name);
254
-        // add to list of modules to be registered
255
-        \EE_Register_Addon::_register_modules($addon_name);
256
-        // add to list of shortcodes to be registered
257
-        \EE_Register_Addon::_register_shortcodes($addon_name);
258
-        // add to list of widgets to be registered
259
-        \EE_Register_Addon::_register_widgets($addon_name);
260
-        // register capability related stuff.
261
-        \EE_Register_Addon::_register_capabilities($addon_name);
262
-        // any message type to register?
263
-        \EE_Register_Addon::_register_message_types($addon_name);
264
-        // any custom post type/ custom capabilities or default terms to register
265
-        \EE_Register_Addon::_register_custom_post_types($addon_name);
266
-        // and any payment methods
267
-        \EE_Register_Addon::_register_payment_methods($addon_name);
268
-        // load and instantiate main addon class
269
-        $addon = \EE_Register_Addon::_load_and_init_addon_class($addon_name);
270
-        $addon->after_registration();
271
-    }
103
+	/**
104
+	 *    Method for registering new EE_Addons.
105
+	 * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE
106
+	 * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it
107
+	 * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon
108
+	 * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after
109
+	 * 'activate_plugin', it registers the addon still, but its components are not registered
110
+	 * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do
111
+	 * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns
112
+	 * (so that we can detect that the addon has activated on the subsequent request)
113
+	 *
114
+	 * @since    4.3.0
115
+	 * @param string                  $addon_name                           the EE_Addon's name. Required.
116
+	 * @param  array                  $setup_args                           {                                    An
117
+	 *                                                                      array of arguments provided for registering
118
+	 *                                                                      the message type.
119
+	 * @type  string                  $class_name                           the addon's main file name.
120
+	 *                                                                      If left blank, generated from the addon
121
+	 *                                                                      name, changes something like "calendar" to
122
+	 *                                                                      "EE_Calendar"
123
+	 * @type string                   $min_core_version                     the minimum version of EE Core that the
124
+	 *       addon will work with. eg "4.8.1.rc.084"
125
+	 * @type string                   $version                              the "software" version for the addon. eg
126
+	 *       "1.0.0.p" for a first stable release, or "1.0.0.rc.043" for a version in progress
127
+	 * @type string                   $main_file_path                       the full server path to the main file
128
+	 *       loaded
129
+	 *                                                                      directly by WP
130
+	 * @type string                   $admin_path                           full server path to the folder where the
131
+	 *       addon\'s admin files reside
132
+	 * @type string                   $admin_callback                       a method to be called when the EE Admin is
133
+	 *       first invoked, can be used for hooking into any admin page
134
+	 * @type string                   $config_section                       the section name for this addon's
135
+	 *       configuration settings section (defaults to "addons")
136
+	 * @type string                   $config_class                         the class name for this addon's
137
+	 *       configuration settings object
138
+	 * @type string                   $config_name                          the class name for this addon's
139
+	 *       configuration settings object
140
+	 * @type string                   $autoloader_paths                     an array of class names and the full server
141
+	 *       paths to those files. Required.
142
+	 * @type string                   $autoloader_folders                   an array of  "full server paths" for any
143
+	 *       folders containing classes that might be invoked by the addon
144
+	 * @type string                   $dms_paths                            an array of full server paths to folders
145
+	 *       that contain data migration scripts. Required.
146
+	 * @type string                   $module_paths                         an array of full server paths to any
147
+	 *       EED_Modules used by the addon
148
+	 * @type string                   $shortcode_paths                      an array of full server paths to folders
149
+	 *       that contain EES_Shortcodes
150
+	 * @type string                   $widget_paths                         an array of full server paths to folders
151
+	 *       that contain WP_Widgets
152
+	 * @type string                   $pue_options
153
+	 * @type array                    $capabilities                         an array indexed by role name
154
+	 *                                                                      (i.e administrator,author ) and the values
155
+	 *                                                                      are an array of caps to add to the role.
156
+	 *                                                                      'administrator' => array(
157
+	 *                                                                      'read_addon', 'edit_addon', etc.
158
+	 *                                                                      ).
159
+	 * @type EE_Meta_Capability_Map[] $capability_maps                      an array of EE_Meta_Capability_Map object
160
+	 *       for any addons that need to register any special meta mapped capabilities.  Should be indexed where the
161
+	 *       key is the EE_Meta_Capability_Map class name and the values are the arguments sent to the class.
162
+	 * @type array                    $model_paths                          array of folders containing DB models
163
+	 * @see      EE_Register_Model
164
+	 * @type array                    $class_paths                          array of folders containing DB classes
165
+	 * @see      EE_Register_Model
166
+	 * @type array                    $model_extension_paths                array of folders containing DB model
167
+	 *       extensions
168
+	 * @see      EE_Register_Model_Extension
169
+	 * @type array                    $class_extension_paths                array of folders containing DB class
170
+	 *       extensions
171
+	 * @see      EE_Register_Model_Extension
172
+	 * @type array message_types {
173
+	 *                                                                      An array of message types with the key as
174
+	 *                                                                      the message type name and the values as
175
+	 *                                                                      below:
176
+	 * @type string                   $mtfilename                           The filename of the message type being
177
+	 *       registered. This will be the main EE_{Messagetype_Name}_message_type class.
178
+	 *                                                                      (eg.
179
+	 *                                                                      EE_Declined_Registration_message_type.class.php)
180
+	 *                                                                      Required.
181
+	 * @type array                    $autoloadpaths                        An array of paths to add to the messages
182
+	 *                                                                      autoloader for the new message type.
183
+	 *                                                                      Required.
184
+	 * @type array                    $messengers_to_activate_with          An array of messengers that this message
185
+	 *                                                                      type should activate with. Each value in
186
+	 *                                                                      the
187
+	 *                                                                      array
188
+	 *                                                                      should match the name property of a
189
+	 *                                                                      EE_messenger. Optional.
190
+	 * @type array                    $messengers_to_validate_with          An array of messengers that this message
191
+	 *                                                                      type should validate with. Each value in
192
+	 *                                                                      the
193
+	 *                                                                      array
194
+	 *                                                                      should match the name property of an
195
+	 *                                                                      EE_messenger.
196
+	 *                                                                      Optional.
197
+	 *                                                                      }
198
+	 * @type array                    $custom_post_types
199
+	 * @type array                    $custom_taxonomies
200
+	 * @type array                    $payment_method_paths                 each element is the folder containing the
201
+	 *                                                                      EE_PMT_Base child class
202
+	 *                                                                      (eg,
203
+	 *                                                                      '/wp-content/plugins/my_plugin/Payomatic/'
204
+	 *                                                                      which contains the files
205
+	 *                                                                      EE_PMT_Payomatic.pm.php)
206
+	 * @type array                    $default_terms
207
+	 * @type array                    $namespace                            {
208
+	 *                                                                      An array with two items for registering the
209
+	 *                                                                      addon's namespace. (If, for some reason,
210
+	 *                                                                      you
211
+	 *                                                                      require additional namespaces, use
212
+	 *                                                                      EventEspresso\core\Psr4Autoloader::addNamespace()
213
+	 *                                                                      directly)
214
+	 * @see      EventEspresso\core\Psr4Autoloader::addNamespace()
215
+	 * @type string                   $FQNS                                 the namespace prefix
216
+	 * @type string                   $DIR                                  a base directory for class files in the
217
+	 *       namespace.
218
+	 *                                                                      }
219
+	 *                                                                      }
220
+	 * @throws EE_Error
221
+	 * @return void
222
+	 */
223
+	public static function register($addon_name = '', $setup_args = array())
224
+	{
225
+		// required fields MUST be present, so let's make sure they are.
226
+		\EE_Register_Addon::_verify_parameters($addon_name, $setup_args);
227
+		// get class name for addon
228
+		$class_name = \EE_Register_Addon::_parse_class_name($addon_name, $setup_args);
229
+		//setup $_settings array from incoming values.
230
+		$addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args);
231
+		// setup PUE
232
+		\EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233
+		// does this addon work with this version of core or WordPress ?
234
+		if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235
+			return;
236
+		}
237
+		// register namespaces
238
+		\EE_Register_Addon::_setup_namespaces($addon_settings);
239
+		// check if this is an activation request
240
+		if (\EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) {
241
+			// dont bother setting up the rest of the addon atm
242
+			return;
243
+		}
244
+		// we need cars
245
+		\EE_Register_Addon::_setup_autoloaders($addon_name);
246
+		// register new models and extensions
247
+		\EE_Register_Addon::_register_models_and_extensions($addon_name);
248
+		// setup DMS
249
+		\EE_Register_Addon::_register_data_migration_scripts($addon_name);
250
+		// if config_class is present let's register config.
251
+		\EE_Register_Addon::_register_config($addon_name);
252
+		// register admin pages
253
+		\EE_Register_Addon::_register_admin_pages($addon_name);
254
+		// add to list of modules to be registered
255
+		\EE_Register_Addon::_register_modules($addon_name);
256
+		// add to list of shortcodes to be registered
257
+		\EE_Register_Addon::_register_shortcodes($addon_name);
258
+		// add to list of widgets to be registered
259
+		\EE_Register_Addon::_register_widgets($addon_name);
260
+		// register capability related stuff.
261
+		\EE_Register_Addon::_register_capabilities($addon_name);
262
+		// any message type to register?
263
+		\EE_Register_Addon::_register_message_types($addon_name);
264
+		// any custom post type/ custom capabilities or default terms to register
265
+		\EE_Register_Addon::_register_custom_post_types($addon_name);
266
+		// and any payment methods
267
+		\EE_Register_Addon::_register_payment_methods($addon_name);
268
+		// load and instantiate main addon class
269
+		$addon = \EE_Register_Addon::_load_and_init_addon_class($addon_name);
270
+		$addon->after_registration();
271
+	}
272 272
 
273 273
 
274
-    /**
275
-     * @param string $addon_name
276
-     * @param array  $setup_args
277
-     * @return void
278
-     * @throws \EE_Error
279
-     */
280
-    private static function _verify_parameters($addon_name, array $setup_args)
281
-    {
282
-        // required fields MUST be present, so let's make sure they are.
283
-        if (empty($addon_name) || ! is_array($setup_args)) {
284
-            throw new EE_Error(
285
-                __(
286
-                    'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
287
-                    'event_espresso'
288
-                )
289
-            );
290
-        }
291
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
292
-            throw new EE_Error(
293
-                sprintf(
294
-                    __(
295
-                        'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
296
-                        'event_espresso'
297
-                    ),
298
-                    implode(',', array_keys($setup_args))
299
-                )
300
-            );
301
-        }
302
-        // check that addon has not already been registered with that name
303
-        if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
304
-            throw new EE_Error(
305
-                sprintf(
306
-                    __(
307
-                        'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
308
-                        'event_espresso'
309
-                    ),
310
-                    $addon_name
311
-                )
312
-            );
313
-        }
314
-    }
274
+	/**
275
+	 * @param string $addon_name
276
+	 * @param array  $setup_args
277
+	 * @return void
278
+	 * @throws \EE_Error
279
+	 */
280
+	private static function _verify_parameters($addon_name, array $setup_args)
281
+	{
282
+		// required fields MUST be present, so let's make sure they are.
283
+		if (empty($addon_name) || ! is_array($setup_args)) {
284
+			throw new EE_Error(
285
+				__(
286
+					'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.',
287
+					'event_espresso'
288
+				)
289
+			);
290
+		}
291
+		if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
292
+			throw new EE_Error(
293
+				sprintf(
294
+					__(
295
+						'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s',
296
+						'event_espresso'
297
+					),
298
+					implode(',', array_keys($setup_args))
299
+				)
300
+			);
301
+		}
302
+		// check that addon has not already been registered with that name
303
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
304
+			throw new EE_Error(
305
+				sprintf(
306
+					__(
307
+						'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
308
+						'event_espresso'
309
+					),
310
+					$addon_name
311
+				)
312
+			);
313
+		}
314
+	}
315 315
 
316 316
 
317
-    /**
318
-     * @param string $addon_name
319
-     * @param array  $setup_args
320
-     * @return string
321
-     */
322
-    private static function _parse_class_name($addon_name, array $setup_args)
323
-    {
324
-        if (empty($setup_args['class_name'])) {
325
-            // generate one by first separating name with spaces
326
-            $class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
327
-            //capitalize, then replace spaces with underscores
328
-            $class_name = str_replace(' ', '_', ucwords($class_name));
329
-        } else {
330
-            $class_name = $setup_args['class_name'];
331
-        }
332
-        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
333
-    }
317
+	/**
318
+	 * @param string $addon_name
319
+	 * @param array  $setup_args
320
+	 * @return string
321
+	 */
322
+	private static function _parse_class_name($addon_name, array $setup_args)
323
+	{
324
+		if (empty($setup_args['class_name'])) {
325
+			// generate one by first separating name with spaces
326
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
327
+			//capitalize, then replace spaces with underscores
328
+			$class_name = str_replace(' ', '_', ucwords($class_name));
329
+		} else {
330
+			$class_name = $setup_args['class_name'];
331
+		}
332
+		return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
333
+	}
334 334
 
335 335
 
336
-    /**
337
-     * @param string $class_name
338
-     * @param array  $setup_args
339
-     * @return array
340
-     */
341
-    private static function _get_addon_settings($class_name, array $setup_args)
342
-    {
343
-        //setup $_settings array from incoming values.
344
-        $addon_settings = array(
345
-            // generated from the addon name, changes something like "calendar" to "EE_Calendar"
346
-            'class_name'            => $class_name,
347
-            // the addon slug for use in URLs, etc
348
-            'plugin_slug'           => isset($setup_args['plugin_slug'])
349
-                ? (string)$setup_args['plugin_slug']
350
-                : '',
351
-            // page slug to be used when generating the "Settings" link on the WP plugin page
352
-            'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
353
-                ? (string)$setup_args['plugin_action_slug']
354
-                : '',
355
-            // the "software" version for the addon
356
-            'version'               => isset($setup_args['version'])
357
-                ? (string)$setup_args['version']
358
-                : '',
359
-            // the minimum version of EE Core that the addon will work with
360
-            'min_core_version'      => isset($setup_args['min_core_version'])
361
-                ? (string)$setup_args['min_core_version']
362
-                : '',
363
-            // the minimum version of WordPress that the addon will work with
364
-            'min_wp_version'        => isset($setup_args['min_wp_version'])
365
-                ? (string)$setup_args['min_wp_version']
366
-                : EE_MIN_WP_VER_REQUIRED,
367
-            // full server path to main file (file loaded directly by WP)
368
-            'main_file_path'        => isset($setup_args['main_file_path'])
369
-                ? (string)$setup_args['main_file_path']
370
-                : '',
371
-            // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
372
-            'admin_path'            => isset($setup_args['admin_path'])
373
-                ? (string)$setup_args['admin_path'] : '',
374
-            // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
375
-            'admin_callback'        => isset($setup_args['admin_callback'])
376
-                ? (string)$setup_args['admin_callback']
377
-                : '',
378
-            // the section name for this addon's configuration settings section (defaults to "addons")
379
-            'config_section'        => isset($setup_args['config_section'])
380
-                ? (string)$setup_args['config_section']
381
-                : 'addons',
382
-            // the class name for this addon's configuration settings object
383
-            'config_class'          => isset($setup_args['config_class'])
384
-                ? (string)$setup_args['config_class'] : '',
385
-            //the name given to the config for this addons' configuration settings object (optional)
386
-            'config_name'           => isset($setup_args['config_name'])
387
-                ? (string)$setup_args['config_name'] : '',
388
-            // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
389
-            'autoloader_paths'      => isset($setup_args['autoloader_paths'])
390
-                ? (array)$setup_args['autoloader_paths']
391
-                : array(),
392
-            // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
393
-            'autoloader_folders'    => isset($setup_args['autoloader_folders'])
394
-                ? (array)$setup_args['autoloader_folders']
395
-                : array(),
396
-            // array of full server paths to any EE_DMS data migration scripts used by the addon
397
-            'dms_paths'             => isset($setup_args['dms_paths'])
398
-                ? (array)$setup_args['dms_paths']
399
-                : array(),
400
-            // array of full server paths to any EED_Modules used by the addon
401
-            'module_paths'          => isset($setup_args['module_paths'])
402
-                ? (array)$setup_args['module_paths']
403
-                : array(),
404
-            // array of full server paths to any EES_Shortcodes used by the addon
405
-            'shortcode_paths'       => isset($setup_args['shortcode_paths'])
406
-                ? (array)$setup_args['shortcode_paths']
407
-                : array(),
408
-            // array of full server paths to any WP_Widgets used by the addon
409
-            'widget_paths'          => isset($setup_args['widget_paths'])
410
-                ? (array)$setup_args['widget_paths']
411
-                : array(),
412
-            // array of PUE options used by the addon
413
-            'pue_options'           => isset($setup_args['pue_options'])
414
-                ? (array)$setup_args['pue_options']
415
-                : array(),
416
-            'message_types'         => isset($setup_args['message_types'])
417
-                ? (array)$setup_args['message_types']
418
-                : array(),
419
-            'capabilities'          => isset($setup_args['capabilities'])
420
-                ? (array)$setup_args['capabilities']
421
-                : array(),
422
-            'capability_maps'       => isset($setup_args['capability_maps'])
423
-                ? (array)$setup_args['capability_maps']
424
-                : array(),
425
-            'model_paths'           => isset($setup_args['model_paths'])
426
-                ? (array)$setup_args['model_paths']
427
-                : array(),
428
-            'class_paths'           => isset($setup_args['class_paths'])
429
-                ? (array)$setup_args['class_paths']
430
-                : array(),
431
-            'model_extension_paths' => isset($setup_args['model_extension_paths'])
432
-                ? (array)$setup_args['model_extension_paths']
433
-                : array(),
434
-            'class_extension_paths' => isset($setup_args['class_extension_paths'])
435
-                ? (array)$setup_args['class_extension_paths']
436
-                : array(),
437
-            'custom_post_types'     => isset($setup_args['custom_post_types'])
438
-                ? (array)$setup_args['custom_post_types']
439
-                : array(),
440
-            'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
441
-                ? (array)$setup_args['custom_taxonomies']
442
-                : array(),
443
-            'payment_method_paths'  => isset($setup_args['payment_method_paths'])
444
-                ? (array)$setup_args['payment_method_paths']
445
-                : array(),
446
-            'default_terms'         => isset($setup_args['default_terms'])
447
-                ? (array)$setup_args['default_terms']
448
-                : array(),
449
-            // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
450
-            // that can be used for adding upgrading/marketing info
451
-            'plugins_page_row'      => isset($setup_args['plugins_page_row'])
452
-                ? $setup_args['plugins_page_row']
453
-                : '',
454
-            'namespace'             => isset(
455
-                $setup_args['namespace'],
456
-                $setup_args['namespace']['FQNS'],
457
-                $setup_args['namespace']['DIR']
458
-            )
459
-                ? (array)$setup_args['namespace']
460
-                : array(),
461
-        );
462
-        // if plugin_action_slug is NOT set, but an admin page path IS set,
463
-        // then let's just use the plugin_slug since that will be used for linking to the admin page
464
-        $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
465
-                                                && ! empty($addon_settings['admin_path'])
466
-            ? $addon_settings['plugin_slug']
467
-            : $addon_settings['plugin_action_slug'];
468
-        // full server path to main file (file loaded directly by WP)
469
-        $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
470
-        return $addon_settings;
471
-    }
336
+	/**
337
+	 * @param string $class_name
338
+	 * @param array  $setup_args
339
+	 * @return array
340
+	 */
341
+	private static function _get_addon_settings($class_name, array $setup_args)
342
+	{
343
+		//setup $_settings array from incoming values.
344
+		$addon_settings = array(
345
+			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
346
+			'class_name'            => $class_name,
347
+			// the addon slug for use in URLs, etc
348
+			'plugin_slug'           => isset($setup_args['plugin_slug'])
349
+				? (string)$setup_args['plugin_slug']
350
+				: '',
351
+			// page slug to be used when generating the "Settings" link on the WP plugin page
352
+			'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
353
+				? (string)$setup_args['plugin_action_slug']
354
+				: '',
355
+			// the "software" version for the addon
356
+			'version'               => isset($setup_args['version'])
357
+				? (string)$setup_args['version']
358
+				: '',
359
+			// the minimum version of EE Core that the addon will work with
360
+			'min_core_version'      => isset($setup_args['min_core_version'])
361
+				? (string)$setup_args['min_core_version']
362
+				: '',
363
+			// the minimum version of WordPress that the addon will work with
364
+			'min_wp_version'        => isset($setup_args['min_wp_version'])
365
+				? (string)$setup_args['min_wp_version']
366
+				: EE_MIN_WP_VER_REQUIRED,
367
+			// full server path to main file (file loaded directly by WP)
368
+			'main_file_path'        => isset($setup_args['main_file_path'])
369
+				? (string)$setup_args['main_file_path']
370
+				: '',
371
+			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
372
+			'admin_path'            => isset($setup_args['admin_path'])
373
+				? (string)$setup_args['admin_path'] : '',
374
+			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
375
+			'admin_callback'        => isset($setup_args['admin_callback'])
376
+				? (string)$setup_args['admin_callback']
377
+				: '',
378
+			// the section name for this addon's configuration settings section (defaults to "addons")
379
+			'config_section'        => isset($setup_args['config_section'])
380
+				? (string)$setup_args['config_section']
381
+				: 'addons',
382
+			// the class name for this addon's configuration settings object
383
+			'config_class'          => isset($setup_args['config_class'])
384
+				? (string)$setup_args['config_class'] : '',
385
+			//the name given to the config for this addons' configuration settings object (optional)
386
+			'config_name'           => isset($setup_args['config_name'])
387
+				? (string)$setup_args['config_name'] : '',
388
+			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
389
+			'autoloader_paths'      => isset($setup_args['autoloader_paths'])
390
+				? (array)$setup_args['autoloader_paths']
391
+				: array(),
392
+			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
393
+			'autoloader_folders'    => isset($setup_args['autoloader_folders'])
394
+				? (array)$setup_args['autoloader_folders']
395
+				: array(),
396
+			// array of full server paths to any EE_DMS data migration scripts used by the addon
397
+			'dms_paths'             => isset($setup_args['dms_paths'])
398
+				? (array)$setup_args['dms_paths']
399
+				: array(),
400
+			// array of full server paths to any EED_Modules used by the addon
401
+			'module_paths'          => isset($setup_args['module_paths'])
402
+				? (array)$setup_args['module_paths']
403
+				: array(),
404
+			// array of full server paths to any EES_Shortcodes used by the addon
405
+			'shortcode_paths'       => isset($setup_args['shortcode_paths'])
406
+				? (array)$setup_args['shortcode_paths']
407
+				: array(),
408
+			// array of full server paths to any WP_Widgets used by the addon
409
+			'widget_paths'          => isset($setup_args['widget_paths'])
410
+				? (array)$setup_args['widget_paths']
411
+				: array(),
412
+			// array of PUE options used by the addon
413
+			'pue_options'           => isset($setup_args['pue_options'])
414
+				? (array)$setup_args['pue_options']
415
+				: array(),
416
+			'message_types'         => isset($setup_args['message_types'])
417
+				? (array)$setup_args['message_types']
418
+				: array(),
419
+			'capabilities'          => isset($setup_args['capabilities'])
420
+				? (array)$setup_args['capabilities']
421
+				: array(),
422
+			'capability_maps'       => isset($setup_args['capability_maps'])
423
+				? (array)$setup_args['capability_maps']
424
+				: array(),
425
+			'model_paths'           => isset($setup_args['model_paths'])
426
+				? (array)$setup_args['model_paths']
427
+				: array(),
428
+			'class_paths'           => isset($setup_args['class_paths'])
429
+				? (array)$setup_args['class_paths']
430
+				: array(),
431
+			'model_extension_paths' => isset($setup_args['model_extension_paths'])
432
+				? (array)$setup_args['model_extension_paths']
433
+				: array(),
434
+			'class_extension_paths' => isset($setup_args['class_extension_paths'])
435
+				? (array)$setup_args['class_extension_paths']
436
+				: array(),
437
+			'custom_post_types'     => isset($setup_args['custom_post_types'])
438
+				? (array)$setup_args['custom_post_types']
439
+				: array(),
440
+			'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
441
+				? (array)$setup_args['custom_taxonomies']
442
+				: array(),
443
+			'payment_method_paths'  => isset($setup_args['payment_method_paths'])
444
+				? (array)$setup_args['payment_method_paths']
445
+				: array(),
446
+			'default_terms'         => isset($setup_args['default_terms'])
447
+				? (array)$setup_args['default_terms']
448
+				: array(),
449
+			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page
450
+			// that can be used for adding upgrading/marketing info
451
+			'plugins_page_row'      => isset($setup_args['plugins_page_row'])
452
+				? $setup_args['plugins_page_row']
453
+				: '',
454
+			'namespace'             => isset(
455
+				$setup_args['namespace'],
456
+				$setup_args['namespace']['FQNS'],
457
+				$setup_args['namespace']['DIR']
458
+			)
459
+				? (array)$setup_args['namespace']
460
+				: array(),
461
+		);
462
+		// if plugin_action_slug is NOT set, but an admin page path IS set,
463
+		// then let's just use the plugin_slug since that will be used for linking to the admin page
464
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
465
+												&& ! empty($addon_settings['admin_path'])
466
+			? $addon_settings['plugin_slug']
467
+			: $addon_settings['plugin_action_slug'];
468
+		// full server path to main file (file loaded directly by WP)
469
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
470
+		return $addon_settings;
471
+	}
472 472
 
473 473
 
474
-    /**
475
-     * @param string $addon_name
476
-     * @param array  $addon_settings
477
-     * @return boolean
478
-     */
479
-    private static function _addon_is_compatible($addon_name, array $addon_settings)
480
-    {
481
-        global $wp_version;
482
-        $incompatibility_message = '';
483
-        //check whether this addon version is compatible with EE core
484
-        if (
485
-            isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
486
-            && ! self::_meets_min_core_version_requirement(
487
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
488
-                $addon_settings['version']
489
-            )
490
-        ) {
491
-            $incompatibility_message = sprintf(
492
-                __(
493
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.'
494
-                ),
495
-                $addon_name,
496
-                '<br />',
497
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
498
-                '<span style="font-weight: bold; color: #D54E21;">',
499
-                '</span><br />'
500
-            );
501
-        } else if (
502
-        ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
503
-        ) {
504
-            $incompatibility_message = sprintf(
505
-                __(
506
-                    '%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
507
-                    'event_espresso'
508
-                ),
509
-                $addon_name,
510
-                self::_effective_version($addon_settings['min_core_version']),
511
-                self::_effective_version(espresso_version()),
512
-                '<br />',
513
-                '<span style="font-weight: bold; color: #D54E21;">',
514
-                '</span><br />'
515
-            );
516
-        } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
517
-            $incompatibility_message = sprintf(
518
-                __(
519
-                    '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
520
-                    'event_espresso'
521
-                ),
522
-                $addon_name,
523
-                $addon_settings['min_wp_version'],
524
-                '<br />',
525
-                '<span style="font-weight: bold; color: #D54E21;">',
526
-                '</span><br />'
527
-            );
528
-        }
529
-        if (! empty($incompatibility_message)) {
530
-            // remove 'activate' from the REQUEST
531
-            // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
532
-            unset($_GET['activate'], $_REQUEST['activate']);
533
-            if (current_user_can('activate_plugins')) {
534
-                // show an error message indicating the plugin didn't activate properly
535
-                EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
536
-            }
537
-            // BAIL FROM THE ADDON REGISTRATION PROCESS
538
-            return false;
539
-        }
540
-        // addon IS compatible
541
-        return true;
542
-    }
474
+	/**
475
+	 * @param string $addon_name
476
+	 * @param array  $addon_settings
477
+	 * @return boolean
478
+	 */
479
+	private static function _addon_is_compatible($addon_name, array $addon_settings)
480
+	{
481
+		global $wp_version;
482
+		$incompatibility_message = '';
483
+		//check whether this addon version is compatible with EE core
484
+		if (
485
+			isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
486
+			&& ! self::_meets_min_core_version_requirement(
487
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
488
+				$addon_settings['version']
489
+			)
490
+		) {
491
+			$incompatibility_message = sprintf(
492
+				__(
493
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is not compatible with this version of Event Espresso.%2$sPlease upgrade your "%1$s" addon to version %3$s or newer to resolve this issue.'
494
+				),
495
+				$addon_name,
496
+				'<br />',
497
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
498
+				'<span style="font-weight: bold; color: #D54E21;">',
499
+				'</span><br />'
500
+			);
501
+		} else if (
502
+		! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
503
+		) {
504
+			$incompatibility_message = sprintf(
505
+				__(
506
+					'%5$sIMPORTANT!%6$sThe Event Espresso "%1$s" addon requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-activate "%1$s".',
507
+					'event_espresso'
508
+				),
509
+				$addon_name,
510
+				self::_effective_version($addon_settings['min_core_version']),
511
+				self::_effective_version(espresso_version()),
512
+				'<br />',
513
+				'<span style="font-weight: bold; color: #D54E21;">',
514
+				'</span><br />'
515
+			);
516
+		} else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
517
+			$incompatibility_message = sprintf(
518
+				__(
519
+					'%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
520
+					'event_espresso'
521
+				),
522
+				$addon_name,
523
+				$addon_settings['min_wp_version'],
524
+				'<br />',
525
+				'<span style="font-weight: bold; color: #D54E21;">',
526
+				'</span><br />'
527
+			);
528
+		}
529
+		if (! empty($incompatibility_message)) {
530
+			// remove 'activate' from the REQUEST
531
+			// so WP doesn't erroneously tell the user the plugin activated fine when it didn't
532
+			unset($_GET['activate'], $_REQUEST['activate']);
533
+			if (current_user_can('activate_plugins')) {
534
+				// show an error message indicating the plugin didn't activate properly
535
+				EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
536
+			}
537
+			// BAIL FROM THE ADDON REGISTRATION PROCESS
538
+			return false;
539
+		}
540
+		// addon IS compatible
541
+		return true;
542
+	}
543 543
 
544 544
 
545
-    /**
546
-     * if plugin update engine is being used for auto-updates,
547
-     * then let's set that up now before going any further so that ALL addons can be updated
548
-     * (not needed if PUE is not being used)
549
-     *
550
-     * @param string $addon_name
551
-     * @param string $class_name
552
-     * @param array  $setup_args
553
-     * @return void
554
-     */
555
-    private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
556
-    {
557
-        if (! empty($setup_args['pue_options'])) {
558
-            self::$_settings[$addon_name]['pue_options'] = array(
559
-                'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
560
-                    ? (string)$setup_args['pue_options']['pue_plugin_slug']
561
-                    : 'espresso_' . strtolower($class_name),
562
-                'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
563
-                    ? (string)$setup_args['pue_options']['plugin_basename']
564
-                    : plugin_basename($setup_args['main_file_path']),
565
-                'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
566
-                    ? (string)$setup_args['pue_options']['checkPeriod']
567
-                    : '24',
568
-                'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
569
-                    ? (string)$setup_args['pue_options']['use_wp_update']
570
-                    : false,
571
-            );
572
-            add_action(
573
-                'AHEE__EE_System__brew_espresso__after_pue_init',
574
-                array('EE_Register_Addon', 'load_pue_update')
575
-            );
576
-        }
577
-    }
545
+	/**
546
+	 * if plugin update engine is being used for auto-updates,
547
+	 * then let's set that up now before going any further so that ALL addons can be updated
548
+	 * (not needed if PUE is not being used)
549
+	 *
550
+	 * @param string $addon_name
551
+	 * @param string $class_name
552
+	 * @param array  $setup_args
553
+	 * @return void
554
+	 */
555
+	private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
556
+	{
557
+		if (! empty($setup_args['pue_options'])) {
558
+			self::$_settings[$addon_name]['pue_options'] = array(
559
+				'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
560
+					? (string)$setup_args['pue_options']['pue_plugin_slug']
561
+					: 'espresso_' . strtolower($class_name),
562
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
563
+					? (string)$setup_args['pue_options']['plugin_basename']
564
+					: plugin_basename($setup_args['main_file_path']),
565
+				'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
566
+					? (string)$setup_args['pue_options']['checkPeriod']
567
+					: '24',
568
+				'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
569
+					? (string)$setup_args['pue_options']['use_wp_update']
570
+					: false,
571
+			);
572
+			add_action(
573
+				'AHEE__EE_System__brew_espresso__after_pue_init',
574
+				array('EE_Register_Addon', 'load_pue_update')
575
+			);
576
+		}
577
+	}
578 578
 
579 579
 
580
-    /**
581
-     * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
582
-     *
583
-     * @param array $addon_settings
584
-     * @return void
585
-     */
586
-    private static function _setup_namespaces(array $addon_settings)
587
-    {
588
-        //
589
-        if (
590
-        isset(
591
-            $addon_settings['namespace'],
592
-            $addon_settings['namespace']['FQNS'],
593
-            $addon_settings['namespace']['DIR']
594
-        )
595
-        ) {
596
-            EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
597
-                $addon_settings['namespace']['FQNS'],
598
-                $addon_settings['namespace']['DIR']
599
-            );
600
-        }
601
-    }
580
+	/**
581
+	 * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
582
+	 *
583
+	 * @param array $addon_settings
584
+	 * @return void
585
+	 */
586
+	private static function _setup_namespaces(array $addon_settings)
587
+	{
588
+		//
589
+		if (
590
+		isset(
591
+			$addon_settings['namespace'],
592
+			$addon_settings['namespace']['FQNS'],
593
+			$addon_settings['namespace']['DIR']
594
+		)
595
+		) {
596
+			EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
597
+				$addon_settings['namespace']['FQNS'],
598
+				$addon_settings['namespace']['DIR']
599
+			);
600
+		}
601
+	}
602 602
 
603 603
 
604
-    /**
605
-     * @param string $addon_name
606
-     * @param array  $addon_settings
607
-     * @return bool
608
-     */
609
-    private static function _addon_activation($addon_name, array $addon_settings)
610
-    {
611
-        // this is an activation request
612
-        if (did_action('activate_plugin')) {
613
-            //to find if THIS is the addon that was activated,
614
-            //just check if we have already registered it or not
615
-            //(as the newly-activated addon wasn't around the first time addons were registered)
616
-            if (! isset(self::$_settings[$addon_name])
617
-                || (isset(self::$_settings[$addon_name])
618
-                    && ! isset(self::$_settings[$addon_name]['class_name'])
619
-                )
620
-            ) {
621
-                self::$_settings[$addon_name] = $addon_settings;
622
-                $addon                        = self::_load_and_init_addon_class($addon_name);
623
-                $addon->set_activation_indicator_option();
624
-                // dont bother setting up the rest of the addon.
625
-                // we know it was just activated and the request will end soon
626
-            }
627
-            return true;
628
-        } else {
629
-            // make sure this was called in the right place!
630
-            if (
631
-                ! did_action('AHEE__EE_System__load_espresso_addons')
632
-                || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
633
-            ) {
634
-                EE_Error::doing_it_wrong(
635
-                    __METHOD__,
636
-                    sprintf(
637
-                        __(
638
-                            'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
639
-                            'event_espresso'
640
-                        ),
641
-                        $addon_name
642
-                    ),
643
-                    '4.3.0'
644
-                );
645
-            }
646
-            // make sure addon settings are set correctly without overwriting anything existing
647
-            if (isset(self::$_settings[$addon_name])) {
648
-                self::$_settings[$addon_name] += $addon_settings;
649
-            } else {
650
-                self::$_settings[$addon_name] = $addon_settings;
651
-            }
652
-        }
653
-        return false;
654
-    }
604
+	/**
605
+	 * @param string $addon_name
606
+	 * @param array  $addon_settings
607
+	 * @return bool
608
+	 */
609
+	private static function _addon_activation($addon_name, array $addon_settings)
610
+	{
611
+		// this is an activation request
612
+		if (did_action('activate_plugin')) {
613
+			//to find if THIS is the addon that was activated,
614
+			//just check if we have already registered it or not
615
+			//(as the newly-activated addon wasn't around the first time addons were registered)
616
+			if (! isset(self::$_settings[$addon_name])
617
+				|| (isset(self::$_settings[$addon_name])
618
+					&& ! isset(self::$_settings[$addon_name]['class_name'])
619
+				)
620
+			) {
621
+				self::$_settings[$addon_name] = $addon_settings;
622
+				$addon                        = self::_load_and_init_addon_class($addon_name);
623
+				$addon->set_activation_indicator_option();
624
+				// dont bother setting up the rest of the addon.
625
+				// we know it was just activated and the request will end soon
626
+			}
627
+			return true;
628
+		} else {
629
+			// make sure this was called in the right place!
630
+			if (
631
+				! did_action('AHEE__EE_System__load_espresso_addons')
632
+				|| did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
633
+			) {
634
+				EE_Error::doing_it_wrong(
635
+					__METHOD__,
636
+					sprintf(
637
+						__(
638
+							'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.',
639
+							'event_espresso'
640
+						),
641
+						$addon_name
642
+					),
643
+					'4.3.0'
644
+				);
645
+			}
646
+			// make sure addon settings are set correctly without overwriting anything existing
647
+			if (isset(self::$_settings[$addon_name])) {
648
+				self::$_settings[$addon_name] += $addon_settings;
649
+			} else {
650
+				self::$_settings[$addon_name] = $addon_settings;
651
+			}
652
+		}
653
+		return false;
654
+	}
655 655
 
656 656
 
657
-    /**
658
-     * @param string $addon_name
659
-     * @return void
660
-     * @throws \EE_Error
661
-     */
662
-    private static function _setup_autoloaders($addon_name)
663
-    {
664
-        if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
665
-            // setup autoloader for single file
666
-            EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
667
-        }
668
-        // setup autoloaders for folders
669
-        if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
670
-            foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
671
-                EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
672
-            }
673
-        }
674
-    }
657
+	/**
658
+	 * @param string $addon_name
659
+	 * @return void
660
+	 * @throws \EE_Error
661
+	 */
662
+	private static function _setup_autoloaders($addon_name)
663
+	{
664
+		if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
665
+			// setup autoloader for single file
666
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
667
+		}
668
+		// setup autoloaders for folders
669
+		if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
670
+			foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
671
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
672
+			}
673
+		}
674
+	}
675 675
 
676 676
 
677
-    /**
678
-     * register new models and extensions
679
-     *
680
-     * @param string $addon_name
681
-     * @return void
682
-     * @throws \EE_Error
683
-     */
684
-    private static function _register_models_and_extensions($addon_name)
685
-    {
686
-        // register new models
687
-        if (
688
-            ! empty(self::$_settings[$addon_name]['model_paths'])
689
-            || ! empty(self::$_settings[$addon_name]['class_paths'])
690
-        ) {
691
-            EE_Register_Model::register(
692
-                $addon_name,
693
-                array(
694
-                    'model_paths' => self::$_settings[$addon_name]['model_paths'],
695
-                    'class_paths' => self::$_settings[$addon_name]['class_paths'],
696
-                )
697
-            );
698
-        }
699
-        // register model extensions
700
-        if (
701
-            ! empty(self::$_settings[$addon_name]['model_extension_paths'])
702
-            || ! empty(self::$_settings[$addon_name]['class_extension_paths'])
703
-        ) {
704
-            EE_Register_Model_Extensions::register(
705
-                $addon_name,
706
-                array(
707
-                    'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
708
-                    'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
709
-                )
710
-            );
711
-        }
712
-    }
677
+	/**
678
+	 * register new models and extensions
679
+	 *
680
+	 * @param string $addon_name
681
+	 * @return void
682
+	 * @throws \EE_Error
683
+	 */
684
+	private static function _register_models_and_extensions($addon_name)
685
+	{
686
+		// register new models
687
+		if (
688
+			! empty(self::$_settings[$addon_name]['model_paths'])
689
+			|| ! empty(self::$_settings[$addon_name]['class_paths'])
690
+		) {
691
+			EE_Register_Model::register(
692
+				$addon_name,
693
+				array(
694
+					'model_paths' => self::$_settings[$addon_name]['model_paths'],
695
+					'class_paths' => self::$_settings[$addon_name]['class_paths'],
696
+				)
697
+			);
698
+		}
699
+		// register model extensions
700
+		if (
701
+			! empty(self::$_settings[$addon_name]['model_extension_paths'])
702
+			|| ! empty(self::$_settings[$addon_name]['class_extension_paths'])
703
+		) {
704
+			EE_Register_Model_Extensions::register(
705
+				$addon_name,
706
+				array(
707
+					'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
708
+					'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
709
+				)
710
+			);
711
+		}
712
+	}
713 713
 
714 714
 
715
-    /**
716
-     * @param string $addon_name
717
-     * @return void
718
-     * @throws \EE_Error
719
-     */
720
-    private static function _register_data_migration_scripts($addon_name)
721
-    {
722
-        // setup DMS
723
-        if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
724
-            EE_Register_Data_Migration_Scripts::register(
725
-                $addon_name,
726
-                array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
727
-            );
728
-        }
729
-    }
715
+	/**
716
+	 * @param string $addon_name
717
+	 * @return void
718
+	 * @throws \EE_Error
719
+	 */
720
+	private static function _register_data_migration_scripts($addon_name)
721
+	{
722
+		// setup DMS
723
+		if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
724
+			EE_Register_Data_Migration_Scripts::register(
725
+				$addon_name,
726
+				array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
727
+			);
728
+		}
729
+	}
730 730
 
731 731
 
732
-    /**
733
-     * @param string $addon_name
734
-     * @return void
735
-     * @throws \EE_Error
736
-     */
737
-    private static function _register_config($addon_name)
738
-    {
739
-        // if config_class is present let's register config.
740
-        if (! empty(self::$_settings[$addon_name]['config_class'])) {
741
-            EE_Register_Config::register(
742
-                self::$_settings[$addon_name]['config_class'],
743
-                array(
744
-                    'config_section' => self::$_settings[$addon_name]['config_section'],
745
-                    'config_name'    => self::$_settings[$addon_name]['config_name'],
746
-                )
747
-            );
748
-        }
749
-    }
732
+	/**
733
+	 * @param string $addon_name
734
+	 * @return void
735
+	 * @throws \EE_Error
736
+	 */
737
+	private static function _register_config($addon_name)
738
+	{
739
+		// if config_class is present let's register config.
740
+		if (! empty(self::$_settings[$addon_name]['config_class'])) {
741
+			EE_Register_Config::register(
742
+				self::$_settings[$addon_name]['config_class'],
743
+				array(
744
+					'config_section' => self::$_settings[$addon_name]['config_section'],
745
+					'config_name'    => self::$_settings[$addon_name]['config_name'],
746
+				)
747
+			);
748
+		}
749
+	}
750 750
 
751 751
 
752
-    /**
753
-     * @param string $addon_name
754
-     * @return void
755
-     * @throws \EE_Error
756
-     */
757
-    private static function _register_admin_pages($addon_name)
758
-    {
759
-        if (! empty(self::$_settings[$addon_name]['admin_path'])) {
760
-            EE_Register_Admin_Page::register(
761
-                $addon_name,
762
-                array('page_path' => self::$_settings[$addon_name]['admin_path'])
763
-            );
764
-        }
765
-    }
752
+	/**
753
+	 * @param string $addon_name
754
+	 * @return void
755
+	 * @throws \EE_Error
756
+	 */
757
+	private static function _register_admin_pages($addon_name)
758
+	{
759
+		if (! empty(self::$_settings[$addon_name]['admin_path'])) {
760
+			EE_Register_Admin_Page::register(
761
+				$addon_name,
762
+				array('page_path' => self::$_settings[$addon_name]['admin_path'])
763
+			);
764
+		}
765
+	}
766 766
 
767 767
 
768
-    /**
769
-     * @param string $addon_name
770
-     * @return void
771
-     * @throws \EE_Error
772
-     */
773
-    private static function _register_modules($addon_name)
774
-    {
775
-        if (! empty(self::$_settings[$addon_name]['module_paths'])) {
776
-            EE_Register_Module::register(
777
-                $addon_name,
778
-                array('module_paths' => self::$_settings[$addon_name]['module_paths'])
779
-            );
780
-        }
781
-    }
768
+	/**
769
+	 * @param string $addon_name
770
+	 * @return void
771
+	 * @throws \EE_Error
772
+	 */
773
+	private static function _register_modules($addon_name)
774
+	{
775
+		if (! empty(self::$_settings[$addon_name]['module_paths'])) {
776
+			EE_Register_Module::register(
777
+				$addon_name,
778
+				array('module_paths' => self::$_settings[$addon_name]['module_paths'])
779
+			);
780
+		}
781
+	}
782 782
 
783 783
 
784
-    /**
785
-     * @param string $addon_name
786
-     * @return void
787
-     * @throws \EE_Error
788
-     */
789
-    private static function _register_shortcodes($addon_name)
790
-    {
791
-        if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
792
-            EE_Register_Shortcode::register(
793
-                $addon_name,
794
-                array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths'])
795
-            );
796
-        }
797
-    }
784
+	/**
785
+	 * @param string $addon_name
786
+	 * @return void
787
+	 * @throws \EE_Error
788
+	 */
789
+	private static function _register_shortcodes($addon_name)
790
+	{
791
+		if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
792
+			EE_Register_Shortcode::register(
793
+				$addon_name,
794
+				array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths'])
795
+			);
796
+		}
797
+	}
798 798
 
799 799
 
800
-    /**
801
-     * @param string $addon_name
802
-     * @return void
803
-     * @throws \EE_Error
804
-     */
805
-    private static function _register_widgets($addon_name)
806
-    {
807
-        if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
808
-            EE_Register_Widget::register(
809
-                $addon_name,
810
-                array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
811
-            );
812
-        }
813
-    }
800
+	/**
801
+	 * @param string $addon_name
802
+	 * @return void
803
+	 * @throws \EE_Error
804
+	 */
805
+	private static function _register_widgets($addon_name)
806
+	{
807
+		if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
808
+			EE_Register_Widget::register(
809
+				$addon_name,
810
+				array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
811
+			);
812
+		}
813
+	}
814 814
 
815 815
 
816
-    /**
817
-     * @param string $addon_name
818
-     * @return void
819
-     * @throws \EE_Error
820
-     */
821
-    private static function _register_capabilities($addon_name)
822
-    {
823
-        if (! empty(self::$_settings[$addon_name]['capabilities'])) {
824
-            EE_Register_Capabilities::register(
825
-                $addon_name,
826
-                array(
827
-                    'capabilities'    => self::$_settings[$addon_name]['capabilities'],
828
-                    'capability_maps' => self::$_settings[$addon_name]['capability_maps'],
829
-                )
830
-            );
831
-        }
832
-    }
816
+	/**
817
+	 * @param string $addon_name
818
+	 * @return void
819
+	 * @throws \EE_Error
820
+	 */
821
+	private static function _register_capabilities($addon_name)
822
+	{
823
+		if (! empty(self::$_settings[$addon_name]['capabilities'])) {
824
+			EE_Register_Capabilities::register(
825
+				$addon_name,
826
+				array(
827
+					'capabilities'    => self::$_settings[$addon_name]['capabilities'],
828
+					'capability_maps' => self::$_settings[$addon_name]['capability_maps'],
829
+				)
830
+			);
831
+		}
832
+	}
833 833
 
834 834
 
835
-    /**
836
-     * @param string $addon_name
837
-     * @return void
838
-     * @throws \EE_Error
839
-     */
840
-    private static function _register_message_types($addon_name)
841
-    {
842
-        if (! empty(self::$_settings[$addon_name]['message_types'])) {
843
-            add_action(
844
-                'EE_Brewing_Regular___messages_caf',
845
-                array('EE_Register_Addon', 'register_message_types')
846
-            );
847
-        }
848
-    }
835
+	/**
836
+	 * @param string $addon_name
837
+	 * @return void
838
+	 * @throws \EE_Error
839
+	 */
840
+	private static function _register_message_types($addon_name)
841
+	{
842
+		if (! empty(self::$_settings[$addon_name]['message_types'])) {
843
+			add_action(
844
+				'EE_Brewing_Regular___messages_caf',
845
+				array('EE_Register_Addon', 'register_message_types')
846
+			);
847
+		}
848
+	}
849 849
 
850 850
 
851
-    /**
852
-     * @param string $addon_name
853
-     * @return void
854
-     * @throws \EE_Error
855
-     */
856
-    private static function _register_custom_post_types($addon_name)
857
-    {
858
-        if (
859
-            ! empty(self::$_settings[$addon_name]['custom_post_types'])
860
-            || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
861
-        ) {
862
-            EE_Register_CPT::register(
863
-                $addon_name,
864
-                array(
865
-                    'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
866
-                    'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
867
-                    'default_terms' => self::$_settings[$addon_name]['default_terms'],
868
-                )
869
-            );
870
-        }
871
-    }
851
+	/**
852
+	 * @param string $addon_name
853
+	 * @return void
854
+	 * @throws \EE_Error
855
+	 */
856
+	private static function _register_custom_post_types($addon_name)
857
+	{
858
+		if (
859
+			! empty(self::$_settings[$addon_name]['custom_post_types'])
860
+			|| ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
861
+		) {
862
+			EE_Register_CPT::register(
863
+				$addon_name,
864
+				array(
865
+					'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
866
+					'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
867
+					'default_terms' => self::$_settings[$addon_name]['default_terms'],
868
+				)
869
+			);
870
+		}
871
+	}
872 872
 
873 873
 
874
-    /**
875
-     * @param string $addon_name
876
-     * @return void
877
-     * @throws \EE_Error
878
-     */
879
-    private static function _register_payment_methods($addon_name)
880
-    {
881
-        if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
882
-            EE_Register_Payment_Method::register(
883
-                $addon_name,
884
-                array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
885
-            );
886
-        }
887
-    }
874
+	/**
875
+	 * @param string $addon_name
876
+	 * @return void
877
+	 * @throws \EE_Error
878
+	 */
879
+	private static function _register_payment_methods($addon_name)
880
+	{
881
+		if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
882
+			EE_Register_Payment_Method::register(
883
+				$addon_name,
884
+				array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
885
+			);
886
+		}
887
+	}
888 888
 
889 889
 
890
-    /**
891
-     * Loads and instantiates the EE_Addon class and adds it onto the registry
892
-     *
893
-     * @param string $addon_name
894
-     * @return EE_Addon
895
-     */
896
-    private static function _load_and_init_addon_class($addon_name)
897
-    {
898
-        $addon = EE_Registry::instance()->load_addon(
899
-            dirname(self::$_settings[$addon_name]['main_file_path']),
900
-            self::$_settings[$addon_name]['class_name']
901
-        );
902
-        $addon->set_name($addon_name);
903
-        $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
904
-        $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
905
-        $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
906
-        $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
907
-        $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
908
-        $addon->set_version(self::$_settings[$addon_name]['version']);
909
-        $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
910
-        $addon->set_config_section(self::$_settings[$addon_name]['config_section']);
911
-        $addon->set_config_class(self::$_settings[$addon_name]['config_class']);
912
-        $addon->set_config_name(self::$_settings[$addon_name]['config_name']);
913
-        //unfortunately this can't be hooked in upon construction, because we don't have
914
-        //the plugin mainfile's path upon construction.
915
-        register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
916
-        // call any additional admin_callback functions during load_admin_controller hook
917
-        if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
918
-            add_action(
919
-                'AHEE__EE_System__load_controllers__load_admin_controllers',
920
-                array($addon, self::$_settings[$addon_name]['admin_callback'])
921
-            );
922
-        }
923
-        return $addon;
924
-    }
890
+	/**
891
+	 * Loads and instantiates the EE_Addon class and adds it onto the registry
892
+	 *
893
+	 * @param string $addon_name
894
+	 * @return EE_Addon
895
+	 */
896
+	private static function _load_and_init_addon_class($addon_name)
897
+	{
898
+		$addon = EE_Registry::instance()->load_addon(
899
+			dirname(self::$_settings[$addon_name]['main_file_path']),
900
+			self::$_settings[$addon_name]['class_name']
901
+		);
902
+		$addon->set_name($addon_name);
903
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
904
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
905
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
906
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
907
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
908
+		$addon->set_version(self::$_settings[$addon_name]['version']);
909
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
910
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
911
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
912
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
913
+		//unfortunately this can't be hooked in upon construction, because we don't have
914
+		//the plugin mainfile's path upon construction.
915
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
916
+		// call any additional admin_callback functions during load_admin_controller hook
917
+		if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
918
+			add_action(
919
+				'AHEE__EE_System__load_controllers__load_admin_controllers',
920
+				array($addon, self::$_settings[$addon_name]['admin_callback'])
921
+			);
922
+		}
923
+		return $addon;
924
+	}
925 925
 
926 926
 
927
-    /**
928
-     *    load_pue_update - Update notifications
929
-     *
930
-     * @return    void
931
-     */
932
-    public static function load_pue_update()
933
-    {
934
-        // load PUE client
935
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
936
-        // cycle thru settings
937
-        foreach (self::$_settings as $settings) {
938
-            if (! empty($settings['pue_options'])) {
939
-                // initiate the class and start the plugin update engine!
940
-                new PluginUpdateEngineChecker(
941
-                // host file URL
942
-                    'https://eventespresso.com',
943
-                    // plugin slug(s)
944
-                    array(
945
-                        'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
946
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
947
-                    ),
948
-                    // options
949
-                    array(
950
-                        'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
951
-                        'lang_domain'       => 'event_espresso',
952
-                        'checkPeriod'       => $settings['pue_options']['checkPeriod'],
953
-                        'option_key'        => 'site_license_key',
954
-                        'options_page_slug' => 'event_espresso',
955
-                        'plugin_basename'   => $settings['pue_options']['plugin_basename'],
956
-                        // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
957
-                        'use_wp_update'     => $settings['pue_options']['use_wp_update'],
958
-                    )
959
-                );
960
-            }
961
-        }
962
-    }
927
+	/**
928
+	 *    load_pue_update - Update notifications
929
+	 *
930
+	 * @return    void
931
+	 */
932
+	public static function load_pue_update()
933
+	{
934
+		// load PUE client
935
+		require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
936
+		// cycle thru settings
937
+		foreach (self::$_settings as $settings) {
938
+			if (! empty($settings['pue_options'])) {
939
+				// initiate the class and start the plugin update engine!
940
+				new PluginUpdateEngineChecker(
941
+				// host file URL
942
+					'https://eventespresso.com',
943
+					// plugin slug(s)
944
+					array(
945
+						'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
946
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
947
+					),
948
+					// options
949
+					array(
950
+						'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
951
+						'lang_domain'       => 'event_espresso',
952
+						'checkPeriod'       => $settings['pue_options']['checkPeriod'],
953
+						'option_key'        => 'site_license_key',
954
+						'options_page_slug' => 'event_espresso',
955
+						'plugin_basename'   => $settings['pue_options']['plugin_basename'],
956
+						// if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
957
+						'use_wp_update'     => $settings['pue_options']['use_wp_update'],
958
+					)
959
+				);
960
+			}
961
+		}
962
+	}
963 963
 
964 964
 
965
-    /**
966
-     * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
967
-     *
968
-     * @since 4.4.0
969
-     * @return void
970
-     * @throws \EE_Error
971
-     */
972
-    public static function register_message_types()
973
-    {
974
-        foreach (self::$_settings as $addon_name => $settings) {
975
-            if (! empty($settings['message_types'])) {
976
-                foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
977
-                    EE_Register_Message_Type::register($message_type, $message_type_settings);
978
-                }
979
-            }
980
-        }
981
-    }
965
+	/**
966
+	 * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
967
+	 *
968
+	 * @since 4.4.0
969
+	 * @return void
970
+	 * @throws \EE_Error
971
+	 */
972
+	public static function register_message_types()
973
+	{
974
+		foreach (self::$_settings as $addon_name => $settings) {
975
+			if (! empty($settings['message_types'])) {
976
+				foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
977
+					EE_Register_Message_Type::register($message_type, $message_type_settings);
978
+				}
979
+			}
980
+		}
981
+	}
982 982
 
983 983
 
984
-    /**
985
-     * This deregisters an addon that was previously registered with a specific addon_name.
986
-     *
987
-     * @since    4.3.0
988
-     * @param string $addon_name the name for the addon that was previously registered
989
-     * @throws EE_Error
990
-     * @return void
991
-     */
992
-    public static function deregister($addon_name = null)
993
-    {
994
-        if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
995
-            do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
996
-            $class_name = self::$_settings[$addon_name]['class_name'];
997
-            if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
998
-                // setup DMS
999
-                EE_Register_Data_Migration_Scripts::deregister($addon_name);
1000
-            }
1001
-            if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1002
-                // register admin page
1003
-                EE_Register_Admin_Page::deregister($addon_name);
1004
-            }
1005
-            if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1006
-                // add to list of modules to be registered
1007
-                EE_Register_Module::deregister($addon_name);
1008
-            }
1009
-            if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
1010
-                // add to list of shortcodes to be registered
1011
-                EE_Register_Shortcode::deregister($addon_name);
1012
-            }
1013
-            if (! empty(self::$_settings[$addon_name]['config_class'])) {
1014
-                // if config_class present let's register config.
1015
-                EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1016
-            }
1017
-            if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1018
-                // add to list of widgets to be registered
1019
-                EE_Register_Widget::deregister($addon_name);
1020
-            }
1021
-            if (! empty(self::$_settings[$addon_name]['model_paths'])
1022
-                ||
1023
-                ! empty(self::$_settings[$addon_name]['class_paths'])
1024
-            ) {
1025
-                // add to list of shortcodes to be registered
1026
-                EE_Register_Model::deregister($addon_name);
1027
-            }
1028
-            if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1029
-                ||
1030
-                ! empty(self::$_settings[$addon_name]['class_extension_paths'])
1031
-            ) {
1032
-                // add to list of shortcodes to be registered
1033
-                EE_Register_Model_Extensions::deregister($addon_name);
1034
-            }
1035
-            if (! empty(self::$_settings[$addon_name]['message_types'])) {
1036
-                foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1037
-                    EE_Register_Message_Type::deregister($message_type);
1038
-                }
1039
-            }
1040
-            //deregister capabilities for addon
1041
-            if (
1042
-                ! empty(self::$_settings[$addon_name]['capabilities'])
1043
-                || ! empty(self::$_settings[$addon_name]['capability_maps'])
1044
-            ) {
1045
-                EE_Register_Capabilities::deregister($addon_name);
1046
-            }
1047
-            //deregister custom_post_types for addon
1048
-            if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1049
-                EE_Register_CPT::deregister($addon_name);
1050
-            }
1051
-            remove_action(
1052
-                'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1053
-                array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1054
-            );
1055
-            remove_action(
1056
-                'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1057
-                array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1058
-            );
1059
-            unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
1060
-            do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1061
-        }
1062
-    }
984
+	/**
985
+	 * This deregisters an addon that was previously registered with a specific addon_name.
986
+	 *
987
+	 * @since    4.3.0
988
+	 * @param string $addon_name the name for the addon that was previously registered
989
+	 * @throws EE_Error
990
+	 * @return void
991
+	 */
992
+	public static function deregister($addon_name = null)
993
+	{
994
+		if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
995
+			do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
996
+			$class_name = self::$_settings[$addon_name]['class_name'];
997
+			if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
998
+				// setup DMS
999
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
1000
+			}
1001
+			if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1002
+				// register admin page
1003
+				EE_Register_Admin_Page::deregister($addon_name);
1004
+			}
1005
+			if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1006
+				// add to list of modules to be registered
1007
+				EE_Register_Module::deregister($addon_name);
1008
+			}
1009
+			if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
1010
+				// add to list of shortcodes to be registered
1011
+				EE_Register_Shortcode::deregister($addon_name);
1012
+			}
1013
+			if (! empty(self::$_settings[$addon_name]['config_class'])) {
1014
+				// if config_class present let's register config.
1015
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1016
+			}
1017
+			if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1018
+				// add to list of widgets to be registered
1019
+				EE_Register_Widget::deregister($addon_name);
1020
+			}
1021
+			if (! empty(self::$_settings[$addon_name]['model_paths'])
1022
+				||
1023
+				! empty(self::$_settings[$addon_name]['class_paths'])
1024
+			) {
1025
+				// add to list of shortcodes to be registered
1026
+				EE_Register_Model::deregister($addon_name);
1027
+			}
1028
+			if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1029
+				||
1030
+				! empty(self::$_settings[$addon_name]['class_extension_paths'])
1031
+			) {
1032
+				// add to list of shortcodes to be registered
1033
+				EE_Register_Model_Extensions::deregister($addon_name);
1034
+			}
1035
+			if (! empty(self::$_settings[$addon_name]['message_types'])) {
1036
+				foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1037
+					EE_Register_Message_Type::deregister($message_type);
1038
+				}
1039
+			}
1040
+			//deregister capabilities for addon
1041
+			if (
1042
+				! empty(self::$_settings[$addon_name]['capabilities'])
1043
+				|| ! empty(self::$_settings[$addon_name]['capability_maps'])
1044
+			) {
1045
+				EE_Register_Capabilities::deregister($addon_name);
1046
+			}
1047
+			//deregister custom_post_types for addon
1048
+			if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1049
+				EE_Register_CPT::deregister($addon_name);
1050
+			}
1051
+			remove_action(
1052
+				'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1053
+				array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1054
+			);
1055
+			remove_action(
1056
+				'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1057
+				array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1058
+			);
1059
+			unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
1060
+			do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1061
+		}
1062
+	}
1063 1063
 
1064 1064
 
1065 1065
 }
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (! defined('EVENT_ESPRESSO_VERSION')) {
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
     exit('No direct script access allowed');
3 3
 }
4 4
 
@@ -66,15 +66,15 @@  discard block
 block discarded – undo
66 66
         // offsets:    0 . 1 . 2 . 3 . 4
67 67
         $version_parts = explode('.', $min_core_version);
68 68
         //check they specified the micro version (after 2nd period)
69
-        if (! isset($version_parts[2])) {
69
+        if ( ! isset($version_parts[2])) {
70 70
             $version_parts[2] = '0';
71 71
         }
72 72
         //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
73 73
         //soon we can assume that's 'rc', but this current version is 'alpha'
74
-        if (! isset($version_parts[3])) {
74
+        if ( ! isset($version_parts[3])) {
75 75
             $version_parts[3] = 'dev';
76 76
         }
77
-        if (! isset($version_parts[4])) {
77
+        if ( ! isset($version_parts[4])) {
78 78
             $version_parts[4] = '000';
79 79
         }
80 80
         return implode('.', $version_parts);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         // setup PUE
232 232
         \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args);
233 233
         // does this addon work with this version of core or WordPress ?
234
-        if (! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
234
+        if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) {
235 235
             return;
236 236
         }
237 237
         // register namespaces
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
                 )
289 289
             );
290 290
         }
291
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
291
+        if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
292 292
             throw new EE_Error(
293 293
                 sprintf(
294 294
                     __(
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
         } else {
330 330
             $class_name = $setup_args['class_name'];
331 331
         }
332
-        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
332
+        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
333 333
     }
334 334
 
335 335
 
@@ -346,105 +346,105 @@  discard block
 block discarded – undo
346 346
             'class_name'            => $class_name,
347 347
             // the addon slug for use in URLs, etc
348 348
             'plugin_slug'           => isset($setup_args['plugin_slug'])
349
-                ? (string)$setup_args['plugin_slug']
349
+                ? (string) $setup_args['plugin_slug']
350 350
                 : '',
351 351
             // page slug to be used when generating the "Settings" link on the WP plugin page
352 352
             'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
353
-                ? (string)$setup_args['plugin_action_slug']
353
+                ? (string) $setup_args['plugin_action_slug']
354 354
                 : '',
355 355
             // the "software" version for the addon
356 356
             'version'               => isset($setup_args['version'])
357
-                ? (string)$setup_args['version']
357
+                ? (string) $setup_args['version']
358 358
                 : '',
359 359
             // the minimum version of EE Core that the addon will work with
360 360
             'min_core_version'      => isset($setup_args['min_core_version'])
361
-                ? (string)$setup_args['min_core_version']
361
+                ? (string) $setup_args['min_core_version']
362 362
                 : '',
363 363
             // the minimum version of WordPress that the addon will work with
364 364
             'min_wp_version'        => isset($setup_args['min_wp_version'])
365
-                ? (string)$setup_args['min_wp_version']
365
+                ? (string) $setup_args['min_wp_version']
366 366
                 : EE_MIN_WP_VER_REQUIRED,
367 367
             // full server path to main file (file loaded directly by WP)
368 368
             'main_file_path'        => isset($setup_args['main_file_path'])
369
-                ? (string)$setup_args['main_file_path']
369
+                ? (string) $setup_args['main_file_path']
370 370
                 : '',
371 371
             // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
372 372
             'admin_path'            => isset($setup_args['admin_path'])
373
-                ? (string)$setup_args['admin_path'] : '',
373
+                ? (string) $setup_args['admin_path'] : '',
374 374
             // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
375 375
             'admin_callback'        => isset($setup_args['admin_callback'])
376
-                ? (string)$setup_args['admin_callback']
376
+                ? (string) $setup_args['admin_callback']
377 377
                 : '',
378 378
             // the section name for this addon's configuration settings section (defaults to "addons")
379 379
             'config_section'        => isset($setup_args['config_section'])
380
-                ? (string)$setup_args['config_section']
380
+                ? (string) $setup_args['config_section']
381 381
                 : 'addons',
382 382
             // the class name for this addon's configuration settings object
383 383
             'config_class'          => isset($setup_args['config_class'])
384
-                ? (string)$setup_args['config_class'] : '',
384
+                ? (string) $setup_args['config_class'] : '',
385 385
             //the name given to the config for this addons' configuration settings object (optional)
386 386
             'config_name'           => isset($setup_args['config_name'])
387
-                ? (string)$setup_args['config_name'] : '',
387
+                ? (string) $setup_args['config_name'] : '',
388 388
             // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
389 389
             'autoloader_paths'      => isset($setup_args['autoloader_paths'])
390
-                ? (array)$setup_args['autoloader_paths']
390
+                ? (array) $setup_args['autoloader_paths']
391 391
                 : array(),
392 392
             // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
393 393
             'autoloader_folders'    => isset($setup_args['autoloader_folders'])
394
-                ? (array)$setup_args['autoloader_folders']
394
+                ? (array) $setup_args['autoloader_folders']
395 395
                 : array(),
396 396
             // array of full server paths to any EE_DMS data migration scripts used by the addon
397 397
             'dms_paths'             => isset($setup_args['dms_paths'])
398
-                ? (array)$setup_args['dms_paths']
398
+                ? (array) $setup_args['dms_paths']
399 399
                 : array(),
400 400
             // array of full server paths to any EED_Modules used by the addon
401 401
             'module_paths'          => isset($setup_args['module_paths'])
402
-                ? (array)$setup_args['module_paths']
402
+                ? (array) $setup_args['module_paths']
403 403
                 : array(),
404 404
             // array of full server paths to any EES_Shortcodes used by the addon
405 405
             'shortcode_paths'       => isset($setup_args['shortcode_paths'])
406
-                ? (array)$setup_args['shortcode_paths']
406
+                ? (array) $setup_args['shortcode_paths']
407 407
                 : array(),
408 408
             // array of full server paths to any WP_Widgets used by the addon
409 409
             'widget_paths'          => isset($setup_args['widget_paths'])
410
-                ? (array)$setup_args['widget_paths']
410
+                ? (array) $setup_args['widget_paths']
411 411
                 : array(),
412 412
             // array of PUE options used by the addon
413 413
             'pue_options'           => isset($setup_args['pue_options'])
414
-                ? (array)$setup_args['pue_options']
414
+                ? (array) $setup_args['pue_options']
415 415
                 : array(),
416 416
             'message_types'         => isset($setup_args['message_types'])
417
-                ? (array)$setup_args['message_types']
417
+                ? (array) $setup_args['message_types']
418 418
                 : array(),
419 419
             'capabilities'          => isset($setup_args['capabilities'])
420
-                ? (array)$setup_args['capabilities']
420
+                ? (array) $setup_args['capabilities']
421 421
                 : array(),
422 422
             'capability_maps'       => isset($setup_args['capability_maps'])
423
-                ? (array)$setup_args['capability_maps']
423
+                ? (array) $setup_args['capability_maps']
424 424
                 : array(),
425 425
             'model_paths'           => isset($setup_args['model_paths'])
426
-                ? (array)$setup_args['model_paths']
426
+                ? (array) $setup_args['model_paths']
427 427
                 : array(),
428 428
             'class_paths'           => isset($setup_args['class_paths'])
429
-                ? (array)$setup_args['class_paths']
429
+                ? (array) $setup_args['class_paths']
430 430
                 : array(),
431 431
             'model_extension_paths' => isset($setup_args['model_extension_paths'])
432
-                ? (array)$setup_args['model_extension_paths']
432
+                ? (array) $setup_args['model_extension_paths']
433 433
                 : array(),
434 434
             'class_extension_paths' => isset($setup_args['class_extension_paths'])
435
-                ? (array)$setup_args['class_extension_paths']
435
+                ? (array) $setup_args['class_extension_paths']
436 436
                 : array(),
437 437
             'custom_post_types'     => isset($setup_args['custom_post_types'])
438
-                ? (array)$setup_args['custom_post_types']
438
+                ? (array) $setup_args['custom_post_types']
439 439
                 : array(),
440 440
             'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
441
-                ? (array)$setup_args['custom_taxonomies']
441
+                ? (array) $setup_args['custom_taxonomies']
442 442
                 : array(),
443 443
             'payment_method_paths'  => isset($setup_args['payment_method_paths'])
444
-                ? (array)$setup_args['payment_method_paths']
444
+                ? (array) $setup_args['payment_method_paths']
445 445
                 : array(),
446 446
             'default_terms'         => isset($setup_args['default_terms'])
447
-                ? (array)$setup_args['default_terms']
447
+                ? (array) $setup_args['default_terms']
448 448
                 : array(),
449 449
             // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
450 450
             // that can be used for adding upgrading/marketing info
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
                 $setup_args['namespace']['FQNS'],
457 457
                 $setup_args['namespace']['DIR']
458 458
             )
459
-                ? (array)$setup_args['namespace']
459
+                ? (array) $setup_args['namespace']
460 460
                 : array(),
461 461
         );
462 462
         // if plugin_action_slug is NOT set, but an admin page path IS set,
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 '</span><br />'
527 527
             );
528 528
         }
529
-        if (! empty($incompatibility_message)) {
529
+        if ( ! empty($incompatibility_message)) {
530 530
             // remove 'activate' from the REQUEST
531 531
             // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
532 532
             unset($_GET['activate'], $_REQUEST['activate']);
@@ -554,19 +554,19 @@  discard block
 block discarded – undo
554 554
      */
555 555
     private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
556 556
     {
557
-        if (! empty($setup_args['pue_options'])) {
557
+        if ( ! empty($setup_args['pue_options'])) {
558 558
             self::$_settings[$addon_name]['pue_options'] = array(
559 559
                 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
560
-                    ? (string)$setup_args['pue_options']['pue_plugin_slug']
561
-                    : 'espresso_' . strtolower($class_name),
560
+                    ? (string) $setup_args['pue_options']['pue_plugin_slug']
561
+                    : 'espresso_'.strtolower($class_name),
562 562
                 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
563
-                    ? (string)$setup_args['pue_options']['plugin_basename']
563
+                    ? (string) $setup_args['pue_options']['plugin_basename']
564 564
                     : plugin_basename($setup_args['main_file_path']),
565 565
                 'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
566
-                    ? (string)$setup_args['pue_options']['checkPeriod']
566
+                    ? (string) $setup_args['pue_options']['checkPeriod']
567 567
                     : '24',
568 568
                 'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
569
-                    ? (string)$setup_args['pue_options']['use_wp_update']
569
+                    ? (string) $setup_args['pue_options']['use_wp_update']
570 570
                     : false,
571 571
             );
572 572
             add_action(
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
             //to find if THIS is the addon that was activated,
614 614
             //just check if we have already registered it or not
615 615
             //(as the newly-activated addon wasn't around the first time addons were registered)
616
-            if (! isset(self::$_settings[$addon_name])
616
+            if ( ! isset(self::$_settings[$addon_name])
617 617
                 || (isset(self::$_settings[$addon_name])
618 618
                     && ! isset(self::$_settings[$addon_name]['class_name'])
619 619
                 )
@@ -661,13 +661,13 @@  discard block
 block discarded – undo
661 661
      */
662 662
     private static function _setup_autoloaders($addon_name)
663 663
     {
664
-        if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
664
+        if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
665 665
             // setup autoloader for single file
666 666
             EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
667 667
         }
668 668
         // setup autoloaders for folders
669
-        if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
670
-            foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
669
+        if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
670
+            foreach ((array) self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
671 671
                 EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
672 672
             }
673 673
         }
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
     private static function _register_data_migration_scripts($addon_name)
721 721
     {
722 722
         // setup DMS
723
-        if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
723
+        if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
724 724
             EE_Register_Data_Migration_Scripts::register(
725 725
                 $addon_name,
726 726
                 array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
     private static function _register_config($addon_name)
738 738
     {
739 739
         // if config_class is present let's register config.
740
-        if (! empty(self::$_settings[$addon_name]['config_class'])) {
740
+        if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
741 741
             EE_Register_Config::register(
742 742
                 self::$_settings[$addon_name]['config_class'],
743 743
                 array(
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
      */
757 757
     private static function _register_admin_pages($addon_name)
758 758
     {
759
-        if (! empty(self::$_settings[$addon_name]['admin_path'])) {
759
+        if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
760 760
             EE_Register_Admin_Page::register(
761 761
                 $addon_name,
762 762
                 array('page_path' => self::$_settings[$addon_name]['admin_path'])
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
      */
773 773
     private static function _register_modules($addon_name)
774 774
     {
775
-        if (! empty(self::$_settings[$addon_name]['module_paths'])) {
775
+        if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
776 776
             EE_Register_Module::register(
777 777
                 $addon_name,
778 778
                 array('module_paths' => self::$_settings[$addon_name]['module_paths'])
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
      */
789 789
     private static function _register_shortcodes($addon_name)
790 790
     {
791
-        if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
791
+        if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
792 792
             EE_Register_Shortcode::register(
793 793
                 $addon_name,
794 794
                 array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths'])
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
      */
805 805
     private static function _register_widgets($addon_name)
806 806
     {
807
-        if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
807
+        if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
808 808
             EE_Register_Widget::register(
809 809
                 $addon_name,
810 810
                 array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
      */
821 821
     private static function _register_capabilities($addon_name)
822 822
     {
823
-        if (! empty(self::$_settings[$addon_name]['capabilities'])) {
823
+        if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
824 824
             EE_Register_Capabilities::register(
825 825
                 $addon_name,
826 826
                 array(
@@ -839,7 +839,7 @@  discard block
 block discarded – undo
839 839
      */
840 840
     private static function _register_message_types($addon_name)
841 841
     {
842
-        if (! empty(self::$_settings[$addon_name]['message_types'])) {
842
+        if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
843 843
             add_action(
844 844
                 'EE_Brewing_Regular___messages_caf',
845 845
                 array('EE_Register_Addon', 'register_message_types')
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
      */
879 879
     private static function _register_payment_methods($addon_name)
880 880
     {
881
-        if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
881
+        if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
882 882
             EE_Register_Payment_Method::register(
883 883
                 $addon_name,
884 884
                 array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
         //the plugin mainfile's path upon construction.
915 915
         register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
916 916
         // call any additional admin_callback functions during load_admin_controller hook
917
-        if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
917
+        if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
918 918
             add_action(
919 919
                 'AHEE__EE_System__load_controllers__load_admin_controllers',
920 920
                 array($addon, self::$_settings[$addon_name]['admin_callback'])
@@ -932,10 +932,10 @@  discard block
 block discarded – undo
932 932
     public static function load_pue_update()
933 933
     {
934 934
         // load PUE client
935
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
935
+        require_once EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
936 936
         // cycle thru settings
937 937
         foreach (self::$_settings as $settings) {
938
-            if (! empty($settings['pue_options'])) {
938
+            if ( ! empty($settings['pue_options'])) {
939 939
                 // initiate the class and start the plugin update engine!
940 940
                 new PluginUpdateEngineChecker(
941 941
                 // host file URL
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
                     // plugin slug(s)
944 944
                     array(
945 945
                         'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
946
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
946
+                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'),
947 947
                     ),
948 948
                     // options
949 949
                     array(
@@ -972,8 +972,8 @@  discard block
 block discarded – undo
972 972
     public static function register_message_types()
973 973
     {
974 974
         foreach (self::$_settings as $addon_name => $settings) {
975
-            if (! empty($settings['message_types'])) {
976
-                foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
975
+            if ( ! empty($settings['message_types'])) {
976
+                foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) {
977 977
                     EE_Register_Message_Type::register($message_type, $message_type_settings);
978 978
                 }
979 979
             }
@@ -994,46 +994,46 @@  discard block
 block discarded – undo
994 994
         if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
995 995
             do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
996 996
             $class_name = self::$_settings[$addon_name]['class_name'];
997
-            if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
997
+            if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
998 998
                 // setup DMS
999 999
                 EE_Register_Data_Migration_Scripts::deregister($addon_name);
1000 1000
             }
1001
-            if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1001
+            if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
1002 1002
                 // register admin page
1003 1003
                 EE_Register_Admin_Page::deregister($addon_name);
1004 1004
             }
1005
-            if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1005
+            if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
1006 1006
                 // add to list of modules to be registered
1007 1007
                 EE_Register_Module::deregister($addon_name);
1008 1008
             }
1009
-            if (! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
1009
+            if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
1010 1010
                 // add to list of shortcodes to be registered
1011 1011
                 EE_Register_Shortcode::deregister($addon_name);
1012 1012
             }
1013
-            if (! empty(self::$_settings[$addon_name]['config_class'])) {
1013
+            if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
1014 1014
                 // if config_class present let's register config.
1015 1015
                 EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1016 1016
             }
1017
-            if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1017
+            if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
1018 1018
                 // add to list of widgets to be registered
1019 1019
                 EE_Register_Widget::deregister($addon_name);
1020 1020
             }
1021
-            if (! empty(self::$_settings[$addon_name]['model_paths'])
1021
+            if ( ! empty(self::$_settings[$addon_name]['model_paths'])
1022 1022
                 ||
1023 1023
                 ! empty(self::$_settings[$addon_name]['class_paths'])
1024 1024
             ) {
1025 1025
                 // add to list of shortcodes to be registered
1026 1026
                 EE_Register_Model::deregister($addon_name);
1027 1027
             }
1028
-            if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1028
+            if ( ! empty(self::$_settings[$addon_name]['model_extension_paths'])
1029 1029
                 ||
1030 1030
                 ! empty(self::$_settings[$addon_name]['class_extension_paths'])
1031 1031
             ) {
1032 1032
                 // add to list of shortcodes to be registered
1033 1033
                 EE_Register_Model_Extensions::deregister($addon_name);
1034 1034
             }
1035
-            if (! empty(self::$_settings[$addon_name]['message_types'])) {
1036
-                foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1035
+            if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
1036
+                foreach ((array) self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1037 1037
                     EE_Register_Message_Type::deregister($message_type);
1038 1038
                 }
1039 1039
             }
@@ -1045,11 +1045,11 @@  discard block
 block discarded – undo
1045 1045
                 EE_Register_Capabilities::deregister($addon_name);
1046 1046
             }
1047 1047
             //deregister custom_post_types for addon
1048
-            if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1048
+            if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1049 1049
                 EE_Register_CPT::deregister($addon_name);
1050 1050
             }
1051 1051
             remove_action(
1052
-                'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1052
+                'deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1053 1053
                 array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1054 1054
             );
1055 1055
             remove_action(
Please login to merge, or discard this patch.