Completed
Branch FET-Wait-List (92c8c5)
by
unknown
134:10 queued 122:28
created
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Indentation   +1012 added lines, -1012 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,1073 +19,1073 @@  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);
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 270
 
271
-        //delay calling after_registration hook on each addon until after all add-ons have been registered.
272
-        add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
273
-    }
271
+		//delay calling after_registration hook on each addon until after all add-ons have been registered.
272
+		add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999);
273
+	}
274 274
 
275 275
 
276
-    /**
277
-     * @param string $addon_name
278
-     * @param array  $setup_args
279
-     * @return void
280
-     * @throws \EE_Error
281
-     */
282
-    private static function _verify_parameters($addon_name, array $setup_args)
283
-    {
284
-        // required fields MUST be present, so let's make sure they are.
285
-        if (empty($addon_name) || ! is_array($setup_args)) {
286
-            throw new EE_Error(
287
-                __(
288
-                    '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.',
289
-                    'event_espresso'
290
-                )
291
-            );
292
-        }
293
-        if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
294
-            throw new EE_Error(
295
-                sprintf(
296
-                    __(
297
-                        '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',
298
-                        'event_espresso'
299
-                    ),
300
-                    implode(',', array_keys($setup_args))
301
-                )
302
-            );
303
-        }
304
-        // check that addon has not already been registered with that name
305
-        if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
306
-            throw new EE_Error(
307
-                sprintf(
308
-                    __(
309
-                        'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
310
-                        'event_espresso'
311
-                    ),
312
-                    $addon_name
313
-                )
314
-            );
315
-        }
316
-    }
276
+	/**
277
+	 * @param string $addon_name
278
+	 * @param array  $setup_args
279
+	 * @return void
280
+	 * @throws \EE_Error
281
+	 */
282
+	private static function _verify_parameters($addon_name, array $setup_args)
283
+	{
284
+		// required fields MUST be present, so let's make sure they are.
285
+		if (empty($addon_name) || ! is_array($setup_args)) {
286
+			throw new EE_Error(
287
+				__(
288
+					'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.',
289
+					'event_espresso'
290
+				)
291
+			);
292
+		}
293
+		if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
294
+			throw new EE_Error(
295
+				sprintf(
296
+					__(
297
+						'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',
298
+						'event_espresso'
299
+					),
300
+					implode(',', array_keys($setup_args))
301
+				)
302
+			);
303
+		}
304
+		// check that addon has not already been registered with that name
305
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
306
+			throw new EE_Error(
307
+				sprintf(
308
+					__(
309
+						'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.',
310
+						'event_espresso'
311
+					),
312
+					$addon_name
313
+				)
314
+			);
315
+		}
316
+	}
317 317
 
318 318
 
319
-    /**
320
-     * @param string $addon_name
321
-     * @param array  $setup_args
322
-     * @return string
323
-     */
324
-    private static function _parse_class_name($addon_name, array $setup_args)
325
-    {
326
-        if (empty($setup_args['class_name'])) {
327
-            // generate one by first separating name with spaces
328
-            $class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
329
-            //capitalize, then replace spaces with underscores
330
-            $class_name = str_replace(' ', '_', ucwords($class_name));
331
-        } else {
332
-            $class_name = $setup_args['class_name'];
333
-        }
334
-        return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
335
-    }
319
+	/**
320
+	 * @param string $addon_name
321
+	 * @param array  $setup_args
322
+	 * @return string
323
+	 */
324
+	private static function _parse_class_name($addon_name, array $setup_args)
325
+	{
326
+		if (empty($setup_args['class_name'])) {
327
+			// generate one by first separating name with spaces
328
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
329
+			//capitalize, then replace spaces with underscores
330
+			$class_name = str_replace(' ', '_', ucwords($class_name));
331
+		} else {
332
+			$class_name = $setup_args['class_name'];
333
+		}
334
+		return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name;
335
+	}
336 336
 
337 337
 
338
-    /**
339
-     * @param string $class_name
340
-     * @param array  $setup_args
341
-     * @return array
342
-     */
343
-    private static function _get_addon_settings($class_name, array $setup_args)
344
-    {
345
-        //setup $_settings array from incoming values.
346
-        $addon_settings = array(
347
-            // generated from the addon name, changes something like "calendar" to "EE_Calendar"
348
-            'class_name'            => $class_name,
349
-            // the addon slug for use in URLs, etc
350
-            'plugin_slug'           => isset($setup_args['plugin_slug'])
351
-                ? (string)$setup_args['plugin_slug']
352
-                : '',
353
-            // page slug to be used when generating the "Settings" link on the WP plugin page
354
-            'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
355
-                ? (string)$setup_args['plugin_action_slug']
356
-                : '',
357
-            // the "software" version for the addon
358
-            'version'               => isset($setup_args['version'])
359
-                ? (string)$setup_args['version']
360
-                : '',
361
-            // the minimum version of EE Core that the addon will work with
362
-            'min_core_version'      => isset($setup_args['min_core_version'])
363
-                ? (string)$setup_args['min_core_version']
364
-                : '',
365
-            // the minimum version of WordPress that the addon will work with
366
-            'min_wp_version'        => isset($setup_args['min_wp_version'])
367
-                ? (string)$setup_args['min_wp_version']
368
-                : EE_MIN_WP_VER_REQUIRED,
369
-            // full server path to main file (file loaded directly by WP)
370
-            'main_file_path'        => isset($setup_args['main_file_path'])
371
-                ? (string)$setup_args['main_file_path']
372
-                : '',
373
-            // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
374
-            'admin_path'            => isset($setup_args['admin_path'])
375
-                ? (string)$setup_args['admin_path'] : '',
376
-            // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
377
-            'admin_callback'        => isset($setup_args['admin_callback'])
378
-                ? (string)$setup_args['admin_callback']
379
-                : '',
380
-            // the section name for this addon's configuration settings section (defaults to "addons")
381
-            'config_section'        => isset($setup_args['config_section'])
382
-                ? (string)$setup_args['config_section']
383
-                : 'addons',
384
-            // the class name for this addon's configuration settings object
385
-            'config_class'          => isset($setup_args['config_class'])
386
-                ? (string)$setup_args['config_class'] : '',
387
-            //the name given to the config for this addons' configuration settings object (optional)
388
-            'config_name'           => isset($setup_args['config_name'])
389
-                ? (string)$setup_args['config_name'] : '',
390
-            // an array of "class names" => "full server paths" for any classes that might be invoked by the addon
391
-            'autoloader_paths'      => isset($setup_args['autoloader_paths'])
392
-                ? (array)$setup_args['autoloader_paths']
393
-                : array(),
394
-            // an array of  "full server paths" for any folders containing classes that might be invoked by the addon
395
-            'autoloader_folders'    => isset($setup_args['autoloader_folders'])
396
-                ? (array)$setup_args['autoloader_folders']
397
-                : array(),
398
-            // array of full server paths to any EE_DMS data migration scripts used by the addon
399
-            'dms_paths'             => isset($setup_args['dms_paths'])
400
-                ? (array)$setup_args['dms_paths']
401
-                : array(),
402
-            // array of full server paths to any EED_Modules used by the addon
403
-            'module_paths'          => isset($setup_args['module_paths'])
404
-                ? (array)$setup_args['module_paths']
405
-                : array(),
406
-            // array of full server paths to any EES_Shortcodes used by the addon
407
-            'shortcode_paths'       => isset($setup_args['shortcode_paths'])
408
-                ? (array)$setup_args['shortcode_paths']
409
-                : array(),
410
-            'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
411
-                ? (array) $setup_args['shortcode_fqcns']
412
-                : array(),
413
-            // array of full server paths to any WP_Widgets used by the addon
414
-            'widget_paths'          => isset($setup_args['widget_paths'])
415
-                ? (array)$setup_args['widget_paths']
416
-                : array(),
417
-            // array of PUE options used by the addon
418
-            'pue_options'           => isset($setup_args['pue_options'])
419
-                ? (array)$setup_args['pue_options']
420
-                : array(),
421
-            'message_types'         => isset($setup_args['message_types'])
422
-                ? (array)$setup_args['message_types']
423
-                : array(),
424
-            'capabilities'          => isset($setup_args['capabilities'])
425
-                ? (array)$setup_args['capabilities']
426
-                : array(),
427
-            'capability_maps'       => isset($setup_args['capability_maps'])
428
-                ? (array)$setup_args['capability_maps']
429
-                : array(),
430
-            'model_paths'           => isset($setup_args['model_paths'])
431
-                ? (array)$setup_args['model_paths']
432
-                : array(),
433
-            'class_paths'           => isset($setup_args['class_paths'])
434
-                ? (array)$setup_args['class_paths']
435
-                : array(),
436
-            'model_extension_paths' => isset($setup_args['model_extension_paths'])
437
-                ? (array)$setup_args['model_extension_paths']
438
-                : array(),
439
-            'class_extension_paths' => isset($setup_args['class_extension_paths'])
440
-                ? (array)$setup_args['class_extension_paths']
441
-                : array(),
442
-            'custom_post_types'     => isset($setup_args['custom_post_types'])
443
-                ? (array)$setup_args['custom_post_types']
444
-                : array(),
445
-            'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
446
-                ? (array)$setup_args['custom_taxonomies']
447
-                : array(),
448
-            'payment_method_paths'  => isset($setup_args['payment_method_paths'])
449
-                ? (array)$setup_args['payment_method_paths']
450
-                : array(),
451
-            'default_terms'         => isset($setup_args['default_terms'])
452
-                ? (array)$setup_args['default_terms']
453
-                : array(),
454
-            // if not empty, inserts a new table row after this plugin's row on the WP Plugins page
455
-            // that can be used for adding upgrading/marketing info
456
-            'plugins_page_row'      => isset($setup_args['plugins_page_row'])
457
-                ? $setup_args['plugins_page_row']
458
-                : '',
459
-            'namespace'             => isset(
460
-                $setup_args['namespace'],
461
-                $setup_args['namespace']['FQNS'],
462
-                $setup_args['namespace']['DIR']
463
-            )
464
-                ? (array)$setup_args['namespace']
465
-                : array(),
466
-        );
467
-        // if plugin_action_slug is NOT set, but an admin page path IS set,
468
-        // then let's just use the plugin_slug since that will be used for linking to the admin page
469
-        $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
470
-                                                && ! empty($addon_settings['admin_path'])
471
-            ? $addon_settings['plugin_slug']
472
-            : $addon_settings['plugin_action_slug'];
473
-        // full server path to main file (file loaded directly by WP)
474
-        $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
475
-        return $addon_settings;
476
-    }
338
+	/**
339
+	 * @param string $class_name
340
+	 * @param array  $setup_args
341
+	 * @return array
342
+	 */
343
+	private static function _get_addon_settings($class_name, array $setup_args)
344
+	{
345
+		//setup $_settings array from incoming values.
346
+		$addon_settings = array(
347
+			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
348
+			'class_name'            => $class_name,
349
+			// the addon slug for use in URLs, etc
350
+			'plugin_slug'           => isset($setup_args['plugin_slug'])
351
+				? (string)$setup_args['plugin_slug']
352
+				: '',
353
+			// page slug to be used when generating the "Settings" link on the WP plugin page
354
+			'plugin_action_slug'    => isset($setup_args['plugin_action_slug'])
355
+				? (string)$setup_args['plugin_action_slug']
356
+				: '',
357
+			// the "software" version for the addon
358
+			'version'               => isset($setup_args['version'])
359
+				? (string)$setup_args['version']
360
+				: '',
361
+			// the minimum version of EE Core that the addon will work with
362
+			'min_core_version'      => isset($setup_args['min_core_version'])
363
+				? (string)$setup_args['min_core_version']
364
+				: '',
365
+			// the minimum version of WordPress that the addon will work with
366
+			'min_wp_version'        => isset($setup_args['min_wp_version'])
367
+				? (string)$setup_args['min_wp_version']
368
+				: EE_MIN_WP_VER_REQUIRED,
369
+			// full server path to main file (file loaded directly by WP)
370
+			'main_file_path'        => isset($setup_args['main_file_path'])
371
+				? (string)$setup_args['main_file_path']
372
+				: '',
373
+			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
374
+			'admin_path'            => isset($setup_args['admin_path'])
375
+				? (string)$setup_args['admin_path'] : '',
376
+			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
377
+			'admin_callback'        => isset($setup_args['admin_callback'])
378
+				? (string)$setup_args['admin_callback']
379
+				: '',
380
+			// the section name for this addon's configuration settings section (defaults to "addons")
381
+			'config_section'        => isset($setup_args['config_section'])
382
+				? (string)$setup_args['config_section']
383
+				: 'addons',
384
+			// the class name for this addon's configuration settings object
385
+			'config_class'          => isset($setup_args['config_class'])
386
+				? (string)$setup_args['config_class'] : '',
387
+			//the name given to the config for this addons' configuration settings object (optional)
388
+			'config_name'           => isset($setup_args['config_name'])
389
+				? (string)$setup_args['config_name'] : '',
390
+			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
391
+			'autoloader_paths'      => isset($setup_args['autoloader_paths'])
392
+				? (array)$setup_args['autoloader_paths']
393
+				: array(),
394
+			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
395
+			'autoloader_folders'    => isset($setup_args['autoloader_folders'])
396
+				? (array)$setup_args['autoloader_folders']
397
+				: array(),
398
+			// array of full server paths to any EE_DMS data migration scripts used by the addon
399
+			'dms_paths'             => isset($setup_args['dms_paths'])
400
+				? (array)$setup_args['dms_paths']
401
+				: array(),
402
+			// array of full server paths to any EED_Modules used by the addon
403
+			'module_paths'          => isset($setup_args['module_paths'])
404
+				? (array)$setup_args['module_paths']
405
+				: array(),
406
+			// array of full server paths to any EES_Shortcodes used by the addon
407
+			'shortcode_paths'       => isset($setup_args['shortcode_paths'])
408
+				? (array)$setup_args['shortcode_paths']
409
+				: array(),
410
+			'shortcode_fqcns' => isset($setup_args['shortcode_fqcns'])
411
+				? (array) $setup_args['shortcode_fqcns']
412
+				: array(),
413
+			// array of full server paths to any WP_Widgets used by the addon
414
+			'widget_paths'          => isset($setup_args['widget_paths'])
415
+				? (array)$setup_args['widget_paths']
416
+				: array(),
417
+			// array of PUE options used by the addon
418
+			'pue_options'           => isset($setup_args['pue_options'])
419
+				? (array)$setup_args['pue_options']
420
+				: array(),
421
+			'message_types'         => isset($setup_args['message_types'])
422
+				? (array)$setup_args['message_types']
423
+				: array(),
424
+			'capabilities'          => isset($setup_args['capabilities'])
425
+				? (array)$setup_args['capabilities']
426
+				: array(),
427
+			'capability_maps'       => isset($setup_args['capability_maps'])
428
+				? (array)$setup_args['capability_maps']
429
+				: array(),
430
+			'model_paths'           => isset($setup_args['model_paths'])
431
+				? (array)$setup_args['model_paths']
432
+				: array(),
433
+			'class_paths'           => isset($setup_args['class_paths'])
434
+				? (array)$setup_args['class_paths']
435
+				: array(),
436
+			'model_extension_paths' => isset($setup_args['model_extension_paths'])
437
+				? (array)$setup_args['model_extension_paths']
438
+				: array(),
439
+			'class_extension_paths' => isset($setup_args['class_extension_paths'])
440
+				? (array)$setup_args['class_extension_paths']
441
+				: array(),
442
+			'custom_post_types'     => isset($setup_args['custom_post_types'])
443
+				? (array)$setup_args['custom_post_types']
444
+				: array(),
445
+			'custom_taxonomies'     => isset($setup_args['custom_taxonomies'])
446
+				? (array)$setup_args['custom_taxonomies']
447
+				: array(),
448
+			'payment_method_paths'  => isset($setup_args['payment_method_paths'])
449
+				? (array)$setup_args['payment_method_paths']
450
+				: array(),
451
+			'default_terms'         => isset($setup_args['default_terms'])
452
+				? (array)$setup_args['default_terms']
453
+				: array(),
454
+			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page
455
+			// that can be used for adding upgrading/marketing info
456
+			'plugins_page_row'      => isset($setup_args['plugins_page_row'])
457
+				? $setup_args['plugins_page_row']
458
+				: '',
459
+			'namespace'             => isset(
460
+				$setup_args['namespace'],
461
+				$setup_args['namespace']['FQNS'],
462
+				$setup_args['namespace']['DIR']
463
+			)
464
+				? (array)$setup_args['namespace']
465
+				: array(),
466
+		);
467
+		// if plugin_action_slug is NOT set, but an admin page path IS set,
468
+		// then let's just use the plugin_slug since that will be used for linking to the admin page
469
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug'])
470
+												&& ! empty($addon_settings['admin_path'])
471
+			? $addon_settings['plugin_slug']
472
+			: $addon_settings['plugin_action_slug'];
473
+		// full server path to main file (file loaded directly by WP)
474
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
475
+		return $addon_settings;
476
+	}
477 477
 
478 478
 
479
-    /**
480
-     * @param string $addon_name
481
-     * @param array  $addon_settings
482
-     * @return boolean
483
-     */
484
-    private static function _addon_is_compatible($addon_name, array $addon_settings)
485
-    {
486
-        global $wp_version;
487
-        $incompatibility_message = '';
488
-        //check whether this addon version is compatible with EE core
489
-        if (
490
-            isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
491
-            && ! self::_meets_min_core_version_requirement(
492
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
493
-                $addon_settings['version']
494
-            )
495
-        ) {
496
-            $incompatibility_message = sprintf(
497
-                __(
498
-                    '%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.'
499
-                ),
500
-                $addon_name,
501
-                '<br />',
502
-                EE_Register_Addon::$_incompatible_addons[$addon_name],
503
-                '<span style="font-weight: bold; color: #D54E21;">',
504
-                '</span><br />'
505
-            );
506
-        } else if (
507
-        ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
508
-        ) {
509
-            $incompatibility_message = sprintf(
510
-                __(
511
-                    '%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".',
512
-                    'event_espresso'
513
-                ),
514
-                $addon_name,
515
-                self::_effective_version($addon_settings['min_core_version']),
516
-                self::_effective_version(espresso_version()),
517
-                '<br />',
518
-                '<span style="font-weight: bold; color: #D54E21;">',
519
-                '</span><br />'
520
-            );
521
-        } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
522
-            $incompatibility_message = sprintf(
523
-                __(
524
-                    '%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.',
525
-                    'event_espresso'
526
-                ),
527
-                $addon_name,
528
-                $addon_settings['min_wp_version'],
529
-                '<br />',
530
-                '<span style="font-weight: bold; color: #D54E21;">',
531
-                '</span><br />'
532
-            );
533
-        }
534
-        if (! empty($incompatibility_message)) {
535
-            // remove 'activate' from the REQUEST
536
-            // so WP doesn't erroneously tell the user the plugin activated fine when it didn't
537
-            unset($_GET['activate'], $_REQUEST['activate']);
538
-            if (current_user_can('activate_plugins')) {
539
-                // show an error message indicating the plugin didn't activate properly
540
-                EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
541
-            }
542
-            // BAIL FROM THE ADDON REGISTRATION PROCESS
543
-            return false;
544
-        }
545
-        // addon IS compatible
546
-        return true;
547
-    }
479
+	/**
480
+	 * @param string $addon_name
481
+	 * @param array  $addon_settings
482
+	 * @return boolean
483
+	 */
484
+	private static function _addon_is_compatible($addon_name, array $addon_settings)
485
+	{
486
+		global $wp_version;
487
+		$incompatibility_message = '';
488
+		//check whether this addon version is compatible with EE core
489
+		if (
490
+			isset(EE_Register_Addon::$_incompatible_addons[$addon_name])
491
+			&& ! self::_meets_min_core_version_requirement(
492
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
493
+				$addon_settings['version']
494
+			)
495
+		) {
496
+			$incompatibility_message = sprintf(
497
+				__(
498
+					'%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.'
499
+				),
500
+				$addon_name,
501
+				'<br />',
502
+				EE_Register_Addon::$_incompatible_addons[$addon_name],
503
+				'<span style="font-weight: bold; color: #D54E21;">',
504
+				'</span><br />'
505
+			);
506
+		} else if (
507
+		! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())
508
+		) {
509
+			$incompatibility_message = sprintf(
510
+				__(
511
+					'%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".',
512
+					'event_espresso'
513
+				),
514
+				$addon_name,
515
+				self::_effective_version($addon_settings['min_core_version']),
516
+				self::_effective_version(espresso_version()),
517
+				'<br />',
518
+				'<span style="font-weight: bold; color: #D54E21;">',
519
+				'</span><br />'
520
+			);
521
+		} else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
522
+			$incompatibility_message = sprintf(
523
+				__(
524
+					'%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.',
525
+					'event_espresso'
526
+				),
527
+				$addon_name,
528
+				$addon_settings['min_wp_version'],
529
+				'<br />',
530
+				'<span style="font-weight: bold; color: #D54E21;">',
531
+				'</span><br />'
532
+			);
533
+		}
534
+		if (! empty($incompatibility_message)) {
535
+			// remove 'activate' from the REQUEST
536
+			// so WP doesn't erroneously tell the user the plugin activated fine when it didn't
537
+			unset($_GET['activate'], $_REQUEST['activate']);
538
+			if (current_user_can('activate_plugins')) {
539
+				// show an error message indicating the plugin didn't activate properly
540
+				EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
541
+			}
542
+			// BAIL FROM THE ADDON REGISTRATION PROCESS
543
+			return false;
544
+		}
545
+		// addon IS compatible
546
+		return true;
547
+	}
548 548
 
549 549
 
550
-    /**
551
-     * if plugin update engine is being used for auto-updates,
552
-     * then let's set that up now before going any further so that ALL addons can be updated
553
-     * (not needed if PUE is not being used)
554
-     *
555
-     * @param string $addon_name
556
-     * @param string $class_name
557
-     * @param array  $setup_args
558
-     * @return void
559
-     */
560
-    private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
561
-    {
562
-        if (! empty($setup_args['pue_options'])) {
563
-            self::$_settings[$addon_name]['pue_options'] = array(
564
-                'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
565
-                    ? (string)$setup_args['pue_options']['pue_plugin_slug']
566
-                    : 'espresso_' . strtolower($class_name),
567
-                'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
568
-                    ? (string)$setup_args['pue_options']['plugin_basename']
569
-                    : plugin_basename($setup_args['main_file_path']),
570
-                'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
571
-                    ? (string)$setup_args['pue_options']['checkPeriod']
572
-                    : '24',
573
-                'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
574
-                    ? (string)$setup_args['pue_options']['use_wp_update']
575
-                    : false,
576
-            );
577
-            add_action(
578
-                'AHEE__EE_System__brew_espresso__after_pue_init',
579
-                array('EE_Register_Addon', 'load_pue_update')
580
-            );
581
-        }
582
-    }
550
+	/**
551
+	 * if plugin update engine is being used for auto-updates,
552
+	 * then let's set that up now before going any further so that ALL addons can be updated
553
+	 * (not needed if PUE is not being used)
554
+	 *
555
+	 * @param string $addon_name
556
+	 * @param string $class_name
557
+	 * @param array  $setup_args
558
+	 * @return void
559
+	 */
560
+	private static function _parse_pue_options($addon_name, $class_name, array $setup_args)
561
+	{
562
+		if (! empty($setup_args['pue_options'])) {
563
+			self::$_settings[$addon_name]['pue_options'] = array(
564
+				'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug'])
565
+					? (string)$setup_args['pue_options']['pue_plugin_slug']
566
+					: 'espresso_' . strtolower($class_name),
567
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename'])
568
+					? (string)$setup_args['pue_options']['plugin_basename']
569
+					: plugin_basename($setup_args['main_file_path']),
570
+				'checkPeriod'     => isset($setup_args['pue_options']['checkPeriod'])
571
+					? (string)$setup_args['pue_options']['checkPeriod']
572
+					: '24',
573
+				'use_wp_update'   => isset($setup_args['pue_options']['use_wp_update'])
574
+					? (string)$setup_args['pue_options']['use_wp_update']
575
+					: false,
576
+			);
577
+			add_action(
578
+				'AHEE__EE_System__brew_espresso__after_pue_init',
579
+				array('EE_Register_Addon', 'load_pue_update')
580
+			);
581
+		}
582
+	}
583 583
 
584 584
 
585
-    /**
586
-     * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
587
-     *
588
-     * @param array $addon_settings
589
-     * @return void
590
-     */
591
-    private static function _setup_namespaces(array $addon_settings)
592
-    {
593
-        //
594
-        if (
595
-        isset(
596
-            $addon_settings['namespace'],
597
-            $addon_settings['namespace']['FQNS'],
598
-            $addon_settings['namespace']['DIR']
599
-        )
600
-        ) {
601
-            EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
602
-                $addon_settings['namespace']['FQNS'],
603
-                $addon_settings['namespace']['DIR']
604
-            );
605
-        }
606
-    }
585
+	/**
586
+	 * register namespaces right away before any other files or classes get loaded, but AFTER the version checks
587
+	 *
588
+	 * @param array $addon_settings
589
+	 * @return void
590
+	 */
591
+	private static function _setup_namespaces(array $addon_settings)
592
+	{
593
+		//
594
+		if (
595
+		isset(
596
+			$addon_settings['namespace'],
597
+			$addon_settings['namespace']['FQNS'],
598
+			$addon_settings['namespace']['DIR']
599
+		)
600
+		) {
601
+			EE_Psr4AutoloaderInit::psr4_loader()->addNamespace(
602
+				$addon_settings['namespace']['FQNS'],
603
+				$addon_settings['namespace']['DIR']
604
+			);
605
+		}
606
+	}
607 607
 
608 608
 
609
-    /**
610
-     * @param string $addon_name
611
-     * @param array  $addon_settings
612
-     * @return bool
613
-     */
614
-    private static function _addon_activation($addon_name, array $addon_settings)
615
-    {
616
-        // this is an activation request
617
-        if (did_action('activate_plugin')) {
618
-            //to find if THIS is the addon that was activated, just check if we have already registered it or not
619
-            //(as the newly-activated addon wasn't around the first time addons were registered).
620
-            //Note: the presence of pue_options in the addon registration options will initialize the $_settings
621
-            //property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
622
-            if (! isset(self::$_settings[$addon_name])
623
-                || (isset(self::$_settings[$addon_name])
624
-                    && ! isset(self::$_settings[$addon_name]['class_name'])
625
-                )
626
-            ) {
627
-                self::$_settings[$addon_name] = $addon_settings;
628
-                $addon                        = self::_load_and_init_addon_class($addon_name);
629
-                $addon->set_activation_indicator_option();
630
-                // dont bother setting up the rest of the addon.
631
-                // we know it was just activated and the request will end soon
632
-            }
633
-            return true;
634
-        }
635
-        // make sure this was called in the right place!
636
-        if (
637
-            ! did_action('AHEE__EE_System__load_espresso_addons')
638
-            || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
639
-        ) {
640
-            EE_Error::doing_it_wrong(
641
-                __METHOD__,
642
-                sprintf(
643
-                    __(
644
-                        '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.',
645
-                        'event_espresso'
646
-                    ),
647
-                    $addon_name
648
-                ),
649
-                '4.3.0'
650
-            );
651
-        }
652
-        // make sure addon settings are set correctly without overwriting anything existing
653
-        if (isset(self::$_settings[$addon_name])) {
654
-            self::$_settings[$addon_name] += $addon_settings;
655
-        } else {
656
-            self::$_settings[$addon_name] = $addon_settings;
657
-        }
658
-        return false;
659
-    }
609
+	/**
610
+	 * @param string $addon_name
611
+	 * @param array  $addon_settings
612
+	 * @return bool
613
+	 */
614
+	private static function _addon_activation($addon_name, array $addon_settings)
615
+	{
616
+		// this is an activation request
617
+		if (did_action('activate_plugin')) {
618
+			//to find if THIS is the addon that was activated, just check if we have already registered it or not
619
+			//(as the newly-activated addon wasn't around the first time addons were registered).
620
+			//Note: the presence of pue_options in the addon registration options will initialize the $_settings
621
+			//property for the add-on, but the add-on is only partially initialized.  Hence, the additional check.
622
+			if (! isset(self::$_settings[$addon_name])
623
+				|| (isset(self::$_settings[$addon_name])
624
+					&& ! isset(self::$_settings[$addon_name]['class_name'])
625
+				)
626
+			) {
627
+				self::$_settings[$addon_name] = $addon_settings;
628
+				$addon                        = self::_load_and_init_addon_class($addon_name);
629
+				$addon->set_activation_indicator_option();
630
+				// dont bother setting up the rest of the addon.
631
+				// we know it was just activated and the request will end soon
632
+			}
633
+			return true;
634
+		}
635
+		// make sure this was called in the right place!
636
+		if (
637
+			! did_action('AHEE__EE_System__load_espresso_addons')
638
+			|| did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')
639
+		) {
640
+			EE_Error::doing_it_wrong(
641
+				__METHOD__,
642
+				sprintf(
643
+					__(
644
+						'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.',
645
+						'event_espresso'
646
+					),
647
+					$addon_name
648
+				),
649
+				'4.3.0'
650
+			);
651
+		}
652
+		// make sure addon settings are set correctly without overwriting anything existing
653
+		if (isset(self::$_settings[$addon_name])) {
654
+			self::$_settings[$addon_name] += $addon_settings;
655
+		} else {
656
+			self::$_settings[$addon_name] = $addon_settings;
657
+		}
658
+		return false;
659
+	}
660 660
 
661 661
 
662
-    /**
663
-     * @param string $addon_name
664
-     * @return void
665
-     * @throws \EE_Error
666
-     */
667
-    private static function _setup_autoloaders($addon_name)
668
-    {
669
-        if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
670
-            // setup autoloader for single file
671
-            EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
672
-        }
673
-        // setup autoloaders for folders
674
-        if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
675
-            foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
676
-                EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
677
-            }
678
-        }
679
-    }
662
+	/**
663
+	 * @param string $addon_name
664
+	 * @return void
665
+	 * @throws \EE_Error
666
+	 */
667
+	private static function _setup_autoloaders($addon_name)
668
+	{
669
+		if (! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
670
+			// setup autoloader for single file
671
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
672
+		}
673
+		// setup autoloaders for folders
674
+		if (! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
675
+			foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
676
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
677
+			}
678
+		}
679
+	}
680 680
 
681 681
 
682
-    /**
683
-     * register new models and extensions
684
-     *
685
-     * @param string $addon_name
686
-     * @return void
687
-     * @throws \EE_Error
688
-     */
689
-    private static function _register_models_and_extensions($addon_name)
690
-    {
691
-        // register new models
692
-        if (
693
-            ! empty(self::$_settings[$addon_name]['model_paths'])
694
-            || ! empty(self::$_settings[$addon_name]['class_paths'])
695
-        ) {
696
-            EE_Register_Model::register(
697
-                $addon_name,
698
-                array(
699
-                    'model_paths' => self::$_settings[$addon_name]['model_paths'],
700
-                    'class_paths' => self::$_settings[$addon_name]['class_paths'],
701
-                )
702
-            );
703
-        }
704
-        // register model extensions
705
-        if (
706
-            ! empty(self::$_settings[$addon_name]['model_extension_paths'])
707
-            || ! empty(self::$_settings[$addon_name]['class_extension_paths'])
708
-        ) {
709
-            EE_Register_Model_Extensions::register(
710
-                $addon_name,
711
-                array(
712
-                    'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
713
-                    'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
714
-                )
715
-            );
716
-        }
717
-    }
682
+	/**
683
+	 * register new models and extensions
684
+	 *
685
+	 * @param string $addon_name
686
+	 * @return void
687
+	 * @throws \EE_Error
688
+	 */
689
+	private static function _register_models_and_extensions($addon_name)
690
+	{
691
+		// register new models
692
+		if (
693
+			! empty(self::$_settings[$addon_name]['model_paths'])
694
+			|| ! empty(self::$_settings[$addon_name]['class_paths'])
695
+		) {
696
+			EE_Register_Model::register(
697
+				$addon_name,
698
+				array(
699
+					'model_paths' => self::$_settings[$addon_name]['model_paths'],
700
+					'class_paths' => self::$_settings[$addon_name]['class_paths'],
701
+				)
702
+			);
703
+		}
704
+		// register model extensions
705
+		if (
706
+			! empty(self::$_settings[$addon_name]['model_extension_paths'])
707
+			|| ! empty(self::$_settings[$addon_name]['class_extension_paths'])
708
+		) {
709
+			EE_Register_Model_Extensions::register(
710
+				$addon_name,
711
+				array(
712
+					'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'],
713
+					'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'],
714
+				)
715
+			);
716
+		}
717
+	}
718 718
 
719 719
 
720
-    /**
721
-     * @param string $addon_name
722
-     * @return void
723
-     * @throws \EE_Error
724
-     */
725
-    private static function _register_data_migration_scripts($addon_name)
726
-    {
727
-        // setup DMS
728
-        if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
729
-            EE_Register_Data_Migration_Scripts::register(
730
-                $addon_name,
731
-                array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
732
-            );
733
-        }
734
-    }
720
+	/**
721
+	 * @param string $addon_name
722
+	 * @return void
723
+	 * @throws \EE_Error
724
+	 */
725
+	private static function _register_data_migration_scripts($addon_name)
726
+	{
727
+		// setup DMS
728
+		if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
729
+			EE_Register_Data_Migration_Scripts::register(
730
+				$addon_name,
731
+				array('dms_paths' => self::$_settings[$addon_name]['dms_paths'])
732
+			);
733
+		}
734
+	}
735 735
 
736 736
 
737
-    /**
738
-     * @param string $addon_name
739
-     * @return void
740
-     * @throws \EE_Error
741
-     */
742
-    private static function _register_config($addon_name)
743
-    {
744
-        // if config_class is present let's register config.
745
-        if (! empty(self::$_settings[$addon_name]['config_class'])) {
746
-            EE_Register_Config::register(
747
-                self::$_settings[$addon_name]['config_class'],
748
-                array(
749
-                    'config_section' => self::$_settings[$addon_name]['config_section'],
750
-                    'config_name'    => self::$_settings[$addon_name]['config_name'],
751
-                )
752
-            );
753
-        }
754
-    }
737
+	/**
738
+	 * @param string $addon_name
739
+	 * @return void
740
+	 * @throws \EE_Error
741
+	 */
742
+	private static function _register_config($addon_name)
743
+	{
744
+		// if config_class is present let's register config.
745
+		if (! empty(self::$_settings[$addon_name]['config_class'])) {
746
+			EE_Register_Config::register(
747
+				self::$_settings[$addon_name]['config_class'],
748
+				array(
749
+					'config_section' => self::$_settings[$addon_name]['config_section'],
750
+					'config_name'    => self::$_settings[$addon_name]['config_name'],
751
+				)
752
+			);
753
+		}
754
+	}
755 755
 
756 756
 
757
-    /**
758
-     * @param string $addon_name
759
-     * @return void
760
-     * @throws \EE_Error
761
-     */
762
-    private static function _register_admin_pages($addon_name)
763
-    {
764
-        if (! empty(self::$_settings[$addon_name]['admin_path'])) {
765
-            EE_Register_Admin_Page::register(
766
-                $addon_name,
767
-                array('page_path' => self::$_settings[$addon_name]['admin_path'])
768
-            );
769
-        }
770
-    }
757
+	/**
758
+	 * @param string $addon_name
759
+	 * @return void
760
+	 * @throws \EE_Error
761
+	 */
762
+	private static function _register_admin_pages($addon_name)
763
+	{
764
+		if (! empty(self::$_settings[$addon_name]['admin_path'])) {
765
+			EE_Register_Admin_Page::register(
766
+				$addon_name,
767
+				array('page_path' => self::$_settings[$addon_name]['admin_path'])
768
+			);
769
+		}
770
+	}
771 771
 
772 772
 
773
-    /**
774
-     * @param string $addon_name
775
-     * @return void
776
-     * @throws \EE_Error
777
-     */
778
-    private static function _register_modules($addon_name)
779
-    {
780
-        if (! empty(self::$_settings[$addon_name]['module_paths'])) {
781
-            EE_Register_Module::register(
782
-                $addon_name,
783
-                array('module_paths' => self::$_settings[$addon_name]['module_paths'])
784
-            );
785
-        }
786
-    }
773
+	/**
774
+	 * @param string $addon_name
775
+	 * @return void
776
+	 * @throws \EE_Error
777
+	 */
778
+	private static function _register_modules($addon_name)
779
+	{
780
+		if (! empty(self::$_settings[$addon_name]['module_paths'])) {
781
+			EE_Register_Module::register(
782
+				$addon_name,
783
+				array('module_paths' => self::$_settings[$addon_name]['module_paths'])
784
+			);
785
+		}
786
+	}
787 787
 
788 788
 
789
-    /**
790
-     * @param string $addon_name
791
-     * @return void
792
-     * @throws \EE_Error
793
-     */
794
-    private static function _register_shortcodes($addon_name)
795
-    {
796
-        if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
797
-            || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
798
-        ) {
799
-            EE_Register_Shortcode::register(
800
-                $addon_name,
801
-                array(
802
-                    'shortcode_paths' => isset(self::$_settings[$addon_name]['shortcode_paths'])
803
-                        ? self::$_settings[$addon_name]['shortcode_paths']
804
-                        : array(),
805
-                    'shortcode_fqcns' => isset(self::$_settings[$addon_name]['shortcode_fqcns'])
806
-                        ? self::$_settings[$addon_name]['shortcode_fqcns']
807
-                        : array()
808
-                )
809
-            );
810
-        }
811
-    }
789
+	/**
790
+	 * @param string $addon_name
791
+	 * @return void
792
+	 * @throws \EE_Error
793
+	 */
794
+	private static function _register_shortcodes($addon_name)
795
+	{
796
+		if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
797
+			|| ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
798
+		) {
799
+			EE_Register_Shortcode::register(
800
+				$addon_name,
801
+				array(
802
+					'shortcode_paths' => isset(self::$_settings[$addon_name]['shortcode_paths'])
803
+						? self::$_settings[$addon_name]['shortcode_paths']
804
+						: array(),
805
+					'shortcode_fqcns' => isset(self::$_settings[$addon_name]['shortcode_fqcns'])
806
+						? self::$_settings[$addon_name]['shortcode_fqcns']
807
+						: array()
808
+				)
809
+			);
810
+		}
811
+	}
812 812
 
813 813
 
814
-    /**
815
-     * @param string $addon_name
816
-     * @return void
817
-     * @throws \EE_Error
818
-     */
819
-    private static function _register_widgets($addon_name)
820
-    {
821
-        if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
822
-            EE_Register_Widget::register(
823
-                $addon_name,
824
-                array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
825
-            );
826
-        }
827
-    }
814
+	/**
815
+	 * @param string $addon_name
816
+	 * @return void
817
+	 * @throws \EE_Error
818
+	 */
819
+	private static function _register_widgets($addon_name)
820
+	{
821
+		if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
822
+			EE_Register_Widget::register(
823
+				$addon_name,
824
+				array('widget_paths' => self::$_settings[$addon_name]['widget_paths'])
825
+			);
826
+		}
827
+	}
828 828
 
829 829
 
830
-    /**
831
-     * @param string $addon_name
832
-     * @return void
833
-     * @throws \EE_Error
834
-     */
835
-    private static function _register_capabilities($addon_name)
836
-    {
837
-        if (! empty(self::$_settings[$addon_name]['capabilities'])) {
838
-            EE_Register_Capabilities::register(
839
-                $addon_name,
840
-                array(
841
-                    'capabilities'       => self::$_settings[$addon_name]['capabilities'],
842
-                    'capability_maps'    => self::$_settings[$addon_name]['capability_maps'],
843
-                )
844
-            );
845
-        }
846
-    }
830
+	/**
831
+	 * @param string $addon_name
832
+	 * @return void
833
+	 * @throws \EE_Error
834
+	 */
835
+	private static function _register_capabilities($addon_name)
836
+	{
837
+		if (! empty(self::$_settings[$addon_name]['capabilities'])) {
838
+			EE_Register_Capabilities::register(
839
+				$addon_name,
840
+				array(
841
+					'capabilities'       => self::$_settings[$addon_name]['capabilities'],
842
+					'capability_maps'    => self::$_settings[$addon_name]['capability_maps'],
843
+				)
844
+			);
845
+		}
846
+	}
847 847
 
848 848
 
849
-    /**
850
-     * @param string $addon_name
851
-     * @return void
852
-     * @throws \EE_Error
853
-     */
854
-    private static function _register_message_types($addon_name)
855
-    {
856
-        if (! empty(self::$_settings[$addon_name]['message_types'])) {
857
-            add_action(
858
-                'EE_Brewing_Regular___messages_caf',
859
-                array('EE_Register_Addon', 'register_message_types')
860
-            );
861
-        }
862
-    }
849
+	/**
850
+	 * @param string $addon_name
851
+	 * @return void
852
+	 * @throws \EE_Error
853
+	 */
854
+	private static function _register_message_types($addon_name)
855
+	{
856
+		if (! empty(self::$_settings[$addon_name]['message_types'])) {
857
+			add_action(
858
+				'EE_Brewing_Regular___messages_caf',
859
+				array('EE_Register_Addon', 'register_message_types')
860
+			);
861
+		}
862
+	}
863 863
 
864 864
 
865
-    /**
866
-     * @param string $addon_name
867
-     * @return void
868
-     * @throws \EE_Error
869
-     */
870
-    private static function _register_custom_post_types($addon_name)
871
-    {
872
-        if (
873
-            ! empty(self::$_settings[$addon_name]['custom_post_types'])
874
-            || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
875
-        ) {
876
-            EE_Register_CPT::register(
877
-                $addon_name,
878
-                array(
879
-                    'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
880
-                    'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
881
-                    'default_terms' => self::$_settings[$addon_name]['default_terms'],
882
-                )
883
-            );
884
-        }
885
-    }
865
+	/**
866
+	 * @param string $addon_name
867
+	 * @return void
868
+	 * @throws \EE_Error
869
+	 */
870
+	private static function _register_custom_post_types($addon_name)
871
+	{
872
+		if (
873
+			! empty(self::$_settings[$addon_name]['custom_post_types'])
874
+			|| ! empty(self::$_settings[$addon_name]['custom_taxonomies'])
875
+		) {
876
+			EE_Register_CPT::register(
877
+				$addon_name,
878
+				array(
879
+					'cpts'          => self::$_settings[$addon_name]['custom_post_types'],
880
+					'cts'           => self::$_settings[$addon_name]['custom_taxonomies'],
881
+					'default_terms' => self::$_settings[$addon_name]['default_terms'],
882
+				)
883
+			);
884
+		}
885
+	}
886 886
 
887 887
 
888
-    /**
889
-     * @param string $addon_name
890
-     * @return void
891
-     * @throws \EE_Error
892
-     */
893
-    private static function _register_payment_methods($addon_name)
894
-    {
895
-        if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
896
-            EE_Register_Payment_Method::register(
897
-                $addon_name,
898
-                array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
899
-            );
900
-        }
901
-    }
888
+	/**
889
+	 * @param string $addon_name
890
+	 * @return void
891
+	 * @throws \EE_Error
892
+	 */
893
+	private static function _register_payment_methods($addon_name)
894
+	{
895
+		if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
896
+			EE_Register_Payment_Method::register(
897
+				$addon_name,
898
+				array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths'])
899
+			);
900
+		}
901
+	}
902 902
 
903 903
 
904
-    /**
905
-     * Loads and instantiates the EE_Addon class and adds it onto the registry
906
-     *
907
-     * @param string $addon_name
908
-     * @return EE_Addon
909
-     */
910
-    private static function _load_and_init_addon_class($addon_name)
911
-    {
912
-        $addon = EE_Registry::instance()->load_addon(
913
-            dirname(self::$_settings[$addon_name]['main_file_path']),
914
-            self::$_settings[$addon_name]['class_name']
915
-        );
916
-        $addon->set_name($addon_name);
917
-        $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
918
-        $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
919
-        $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
920
-        $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
921
-        $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
922
-        $addon->set_version(self::$_settings[$addon_name]['version']);
923
-        $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
924
-        $addon->set_config_section(self::$_settings[$addon_name]['config_section']);
925
-        $addon->set_config_class(self::$_settings[$addon_name]['config_class']);
926
-        $addon->set_config_name(self::$_settings[$addon_name]['config_name']);
927
-        //unfortunately this can't be hooked in upon construction, because we don't have
928
-        //the plugin mainfile's path upon construction.
929
-        register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
930
-        // call any additional admin_callback functions during load_admin_controller hook
931
-        if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
932
-            add_action(
933
-                'AHEE__EE_System__load_controllers__load_admin_controllers',
934
-                array($addon, self::$_settings[$addon_name]['admin_callback'])
935
-            );
936
-        }
937
-        return $addon;
938
-    }
904
+	/**
905
+	 * Loads and instantiates the EE_Addon class and adds it onto the registry
906
+	 *
907
+	 * @param string $addon_name
908
+	 * @return EE_Addon
909
+	 */
910
+	private static function _load_and_init_addon_class($addon_name)
911
+	{
912
+		$addon = EE_Registry::instance()->load_addon(
913
+			dirname(self::$_settings[$addon_name]['main_file_path']),
914
+			self::$_settings[$addon_name]['class_name']
915
+		);
916
+		$addon->set_name($addon_name);
917
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
918
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
919
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
920
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
921
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
922
+		$addon->set_version(self::$_settings[$addon_name]['version']);
923
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
924
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
925
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
926
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
927
+		//unfortunately this can't be hooked in upon construction, because we don't have
928
+		//the plugin mainfile's path upon construction.
929
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
930
+		// call any additional admin_callback functions during load_admin_controller hook
931
+		if (! empty(self::$_settings[$addon_name]['admin_callback'])) {
932
+			add_action(
933
+				'AHEE__EE_System__load_controllers__load_admin_controllers',
934
+				array($addon, self::$_settings[$addon_name]['admin_callback'])
935
+			);
936
+		}
937
+		return $addon;
938
+	}
939 939
 
940 940
 
941
-    /**
942
-     *    load_pue_update - Update notifications
943
-     *
944
-     * @return    void
945
-     */
946
-    public static function load_pue_update()
947
-    {
948
-        // load PUE client
949
-        require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
950
-        // cycle thru settings
951
-        foreach (self::$_settings as $settings) {
952
-            if (! empty($settings['pue_options'])) {
953
-                // initiate the class and start the plugin update engine!
954
-                new PluginUpdateEngineChecker(
955
-                // host file URL
956
-                    'https://eventespresso.com',
957
-                    // plugin slug(s)
958
-                    array(
959
-                        'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
960
-                        'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
961
-                    ),
962
-                    // options
963
-                    array(
964
-                        'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
965
-                        'lang_domain'       => 'event_espresso',
966
-                        'checkPeriod'       => $settings['pue_options']['checkPeriod'],
967
-                        'option_key'        => 'site_license_key',
968
-                        'options_page_slug' => 'event_espresso',
969
-                        'plugin_basename'   => $settings['pue_options']['plugin_basename'],
970
-                        // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
971
-                        'use_wp_update'     => $settings['pue_options']['use_wp_update'],
972
-                    )
973
-                );
974
-            }
975
-        }
976
-    }
941
+	/**
942
+	 *    load_pue_update - Update notifications
943
+	 *
944
+	 * @return    void
945
+	 */
946
+	public static function load_pue_update()
947
+	{
948
+		// load PUE client
949
+		require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
950
+		// cycle thru settings
951
+		foreach (self::$_settings as $settings) {
952
+			if (! empty($settings['pue_options'])) {
953
+				// initiate the class and start the plugin update engine!
954
+				new PluginUpdateEngineChecker(
955
+				// host file URL
956
+					'https://eventespresso.com',
957
+					// plugin slug(s)
958
+					array(
959
+						'premium'    => array('p' => $settings['pue_options']['pue_plugin_slug']),
960
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'),
961
+					),
962
+					// options
963
+					array(
964
+						'apikey'            => EE_Registry::instance()->NET_CFG->core->site_license_key,
965
+						'lang_domain'       => 'event_espresso',
966
+						'checkPeriod'       => $settings['pue_options']['checkPeriod'],
967
+						'option_key'        => 'site_license_key',
968
+						'options_page_slug' => 'event_espresso',
969
+						'plugin_basename'   => $settings['pue_options']['plugin_basename'],
970
+						// if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP
971
+						'use_wp_update'     => $settings['pue_options']['use_wp_update'],
972
+					)
973
+				);
974
+			}
975
+		}
976
+	}
977 977
 
978 978
 
979
-    /**
980
-     * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
981
-     *
982
-     * @since 4.4.0
983
-     * @return void
984
-     * @throws \EE_Error
985
-     */
986
-    public static function register_message_types()
987
-    {
988
-        foreach (self::$_settings as $addon_name => $settings) {
989
-            if (! empty($settings['message_types'])) {
990
-                foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
991
-                    EE_Register_Message_Type::register($message_type, $message_type_settings);
992
-                }
993
-            }
994
-        }
995
-    }
979
+	/**
980
+	 * Callback for EE_Brewing_Regular__messages_caf hook used to register message types.
981
+	 *
982
+	 * @since 4.4.0
983
+	 * @return void
984
+	 * @throws \EE_Error
985
+	 */
986
+	public static function register_message_types()
987
+	{
988
+		foreach (self::$_settings as $addon_name => $settings) {
989
+			if (! empty($settings['message_types'])) {
990
+				foreach ((array)$settings['message_types'] as $message_type => $message_type_settings) {
991
+					EE_Register_Message_Type::register($message_type, $message_type_settings);
992
+				}
993
+			}
994
+		}
995
+	}
996 996
 
997 997
 
998
-    /**
999
-     * This deregisters an addon that was previously registered with a specific addon_name.
1000
-     *
1001
-     * @since    4.3.0
1002
-     * @param string $addon_name the name for the addon that was previously registered
1003
-     * @throws EE_Error
1004
-     * @return void
1005
-     */
1006
-    public static function deregister($addon_name = null)
1007
-    {
1008
-        if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
1009
-            do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1010
-            $class_name = self::$_settings[$addon_name]['class_name'];
1011
-            if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
1012
-                // setup DMS
1013
-                EE_Register_Data_Migration_Scripts::deregister($addon_name);
1014
-            }
1015
-            if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1016
-                // register admin page
1017
-                EE_Register_Admin_Page::deregister($addon_name);
1018
-            }
1019
-            if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1020
-                // add to list of modules to be registered
1021
-                EE_Register_Module::deregister($addon_name);
1022
-            }
1023
-            if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
1024
-                || ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
1025
-            ) {
1026
-                // add to list of shortcodes to be registered
1027
-                EE_Register_Shortcode::deregister($addon_name);
1028
-            }
1029
-            if (! empty(self::$_settings[$addon_name]['config_class'])) {
1030
-                // if config_class present let's register config.
1031
-                EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1032
-            }
1033
-            if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1034
-                // add to list of widgets to be registered
1035
-                EE_Register_Widget::deregister($addon_name);
1036
-            }
1037
-            if (! empty(self::$_settings[$addon_name]['model_paths'])
1038
-                ||
1039
-                ! empty(self::$_settings[$addon_name]['class_paths'])
1040
-            ) {
1041
-                // add to list of shortcodes to be registered
1042
-                EE_Register_Model::deregister($addon_name);
1043
-            }
1044
-            if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1045
-                ||
1046
-                ! empty(self::$_settings[$addon_name]['class_extension_paths'])
1047
-            ) {
1048
-                // add to list of shortcodes to be registered
1049
-                EE_Register_Model_Extensions::deregister($addon_name);
1050
-            }
1051
-            if (! empty(self::$_settings[$addon_name]['message_types'])) {
1052
-                foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1053
-                    EE_Register_Message_Type::deregister($message_type);
1054
-                }
1055
-            }
1056
-            //deregister capabilities for addon
1057
-            if (
1058
-                ! empty(self::$_settings[$addon_name]['capabilities'])
1059
-                || ! empty(self::$_settings[$addon_name]['capability_maps'])
1060
-            ) {
1061
-                EE_Register_Capabilities::deregister($addon_name);
1062
-            }
1063
-            //deregister custom_post_types for addon
1064
-            if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1065
-                EE_Register_CPT::deregister($addon_name);
1066
-            }
1067
-            if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1068
-                EE_Register_Payment_Method::deregister($addon_name);
1069
-            }
1070
-            remove_action(
1071
-                'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1072
-                array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1073
-            );
1074
-            remove_action(
1075
-                'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1076
-                array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1077
-            );
1078
-            //remove `after_registration` call
1079
-            remove_action(
1080
-                'AHEE__EE_System__load_espresso_addons__complete',
1081
-                array(EE_Registry::instance()->addons->{$class_name}, 'after_registration'),
1082
-                999
1083
-            );
1084
-            unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
998
+	/**
999
+	 * This deregisters an addon that was previously registered with a specific addon_name.
1000
+	 *
1001
+	 * @since    4.3.0
1002
+	 * @param string $addon_name the name for the addon that was previously registered
1003
+	 * @throws EE_Error
1004
+	 * @return void
1005
+	 */
1006
+	public static function deregister($addon_name = null)
1007
+	{
1008
+		if (isset(self::$_settings[$addon_name], self::$_settings[$addon_name]['class_name'])) {
1009
+			do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name);
1010
+			$class_name = self::$_settings[$addon_name]['class_name'];
1011
+			if (! empty(self::$_settings[$addon_name]['dms_paths'])) {
1012
+				// setup DMS
1013
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
1014
+			}
1015
+			if (! empty(self::$_settings[$addon_name]['admin_path'])) {
1016
+				// register admin page
1017
+				EE_Register_Admin_Page::deregister($addon_name);
1018
+			}
1019
+			if (! empty(self::$_settings[$addon_name]['module_paths'])) {
1020
+				// add to list of modules to be registered
1021
+				EE_Register_Module::deregister($addon_name);
1022
+			}
1023
+			if (! empty(self::$_settings[$addon_name]['shortcode_paths'])
1024
+				|| ! empty(self::$_settings[$addon_name]['shortcode_fqcns'])
1025
+			) {
1026
+				// add to list of shortcodes to be registered
1027
+				EE_Register_Shortcode::deregister($addon_name);
1028
+			}
1029
+			if (! empty(self::$_settings[$addon_name]['config_class'])) {
1030
+				// if config_class present let's register config.
1031
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
1032
+			}
1033
+			if (! empty(self::$_settings[$addon_name]['widget_paths'])) {
1034
+				// add to list of widgets to be registered
1035
+				EE_Register_Widget::deregister($addon_name);
1036
+			}
1037
+			if (! empty(self::$_settings[$addon_name]['model_paths'])
1038
+				||
1039
+				! empty(self::$_settings[$addon_name]['class_paths'])
1040
+			) {
1041
+				// add to list of shortcodes to be registered
1042
+				EE_Register_Model::deregister($addon_name);
1043
+			}
1044
+			if (! empty(self::$_settings[$addon_name]['model_extension_paths'])
1045
+				||
1046
+				! empty(self::$_settings[$addon_name]['class_extension_paths'])
1047
+			) {
1048
+				// add to list of shortcodes to be registered
1049
+				EE_Register_Model_Extensions::deregister($addon_name);
1050
+			}
1051
+			if (! empty(self::$_settings[$addon_name]['message_types'])) {
1052
+				foreach ((array)self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
1053
+					EE_Register_Message_Type::deregister($message_type);
1054
+				}
1055
+			}
1056
+			//deregister capabilities for addon
1057
+			if (
1058
+				! empty(self::$_settings[$addon_name]['capabilities'])
1059
+				|| ! empty(self::$_settings[$addon_name]['capability_maps'])
1060
+			) {
1061
+				EE_Register_Capabilities::deregister($addon_name);
1062
+			}
1063
+			//deregister custom_post_types for addon
1064
+			if (! empty(self::$_settings[$addon_name]['custom_post_types'])) {
1065
+				EE_Register_CPT::deregister($addon_name);
1066
+			}
1067
+			if (! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
1068
+				EE_Register_Payment_Method::deregister($addon_name);
1069
+			}
1070
+			remove_action(
1071
+				'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),
1072
+				array(EE_Registry::instance()->addons->{$class_name}, 'deactivation')
1073
+			);
1074
+			remove_action(
1075
+				'AHEE__EE_System__perform_activations_upgrades_and_migrations',
1076
+				array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required')
1077
+			);
1078
+			//remove `after_registration` call
1079
+			remove_action(
1080
+				'AHEE__EE_System__load_espresso_addons__complete',
1081
+				array(EE_Registry::instance()->addons->{$class_name}, 'after_registration'),
1082
+				999
1083
+			);
1084
+			unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]);
1085 1085
 
1086
-            do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1087
-        }
1088
-    }
1086
+			do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name);
1087
+		}
1088
+	}
1089 1089
 
1090 1090
 
1091 1091
 }
Please login to merge, or discard this patch.
core/EE_Addon.core.php 2 patches
Indentation   +760 added lines, -760 removed lines patch added patch discarded remove patch
@@ -14,732 +14,732 @@  discard block
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-    /**
18
-     * prefix to be added onto an addon's plugin slug to make a wp option name
19
-     * which will be used to store the plugin's activation history
20
-     */
21
-    const ee_addon_version_history_option_prefix = 'ee_version_history_';
22
-
23
-    /**
24
-     * @var $_version
25
-     * @type string
26
-     */
27
-    protected $_version = '';
28
-
29
-    /**
30
-     * @var $_min_core_version
31
-     * @type string
32
-     */
33
-    protected $_min_core_version = '';
34
-
35
-    /**
36
-     * derived from plugin 'main_file_path using plugin_basename()
37
-     *
38
-     * @type string $_plugin_basename
39
-     */
40
-    protected $_plugin_basename = '';
41
-
42
-    /**
43
-     * A non-internationalized name to identify this addon for use in URLs, etc
44
-     *
45
-     * @type string $_plugin_slug
46
-     */
47
-    protected $_plugin_slug = '';
48
-
49
-    /**
50
-     * A non-internationalized name to identify this addon. Eg 'Calendar','MailChimp',etc/
51
-     *
52
-     * @type string _addon_name
53
-     */
54
-    protected $_addon_name = '';
55
-
56
-    /**
57
-     * one of the EE_System::req_type_* constants
58
-     *
59
-     * @type int $_req_type
60
-     */
61
-    protected $_req_type;
62
-
63
-    /**
64
-     * page slug to be used when generating the "Settings" link on the WP plugin page
65
-     *
66
-     * @type string $_plugin_action_slug
67
-     */
68
-    protected $_plugin_action_slug = '';
69
-
70
-    /**
71
-     * if not empty, inserts a new table row after this plugin's row on the WP Plugins page
72
-     * that can be used for adding upgrading/marketing info
73
-     *
74
-     * @type array $_plugins_page_row
75
-     */
76
-    protected $_plugins_page_row = array();
77
-
78
-
79
-
80
-    /**
81
-     *    filepath to the main file, which can be used for register_activation_hook, register_deactivation_hook, etc.
82
-     *
83
-     * @type string
84
-     */
85
-    protected $_main_plugin_file;
86
-
87
-
88
-    /**
89
-     *    class constructor
90
-     */
91
-    public function __construct()
92
-    {
93
-        add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($this, 'admin_init'));
94
-    }
95
-
96
-
97
-    /**
98
-     * @param mixed $version
99
-     */
100
-    public function set_version($version = null)
101
-    {
102
-        $this->_version = $version;
103
-    }
104
-
105
-
106
-    /**
107
-     * get__version
108
-     *
109
-     * @return string
110
-     */
111
-    public function version()
112
-    {
113
-        return $this->_version;
114
-    }
115
-
116
-
117
-    /**
118
-     * @param mixed $min_core_version
119
-     */
120
-    public function set_min_core_version($min_core_version = null)
121
-    {
122
-        $this->_min_core_version = $min_core_version;
123
-    }
124
-
125
-
126
-    /**
127
-     * get__min_core_version
128
-     *
129
-     * @return string
130
-     */
131
-    public function min_core_version()
132
-    {
133
-        return $this->_min_core_version;
134
-    }
135
-
136
-
137
-    /**
138
-     * Sets addon_name
139
-     *
140
-     * @param string $addon_name
141
-     * @return boolean
142
-     */
143
-    public function set_name($addon_name)
144
-    {
145
-        return $this->_addon_name = $addon_name;
146
-    }
147
-
148
-
149
-    /**
150
-     * Gets addon_name
151
-     *
152
-     * @return string
153
-     */
154
-    public function name()
155
-    {
156
-        return $this->_addon_name;
157
-    }
158
-
159
-
160
-    /**
161
-     * @return string
162
-     */
163
-    public function plugin_basename()
164
-    {
165
-
166
-        return $this->_plugin_basename;
167
-    }
168
-
169
-
170
-    /**
171
-     * @param string $plugin_basename
172
-     */
173
-    public function set_plugin_basename($plugin_basename)
174
-    {
175
-
176
-        $this->_plugin_basename = $plugin_basename;
177
-    }
178
-
179
-
180
-    /**
181
-     * @return string
182
-     */
183
-    public function plugin_slug()
184
-    {
185
-
186
-        return $this->_plugin_slug;
187
-    }
188
-
189
-
190
-    /**
191
-     * @param string $plugin_slug
192
-     */
193
-    public function set_plugin_slug($plugin_slug)
194
-    {
195
-
196
-        $this->_plugin_slug = $plugin_slug;
197
-    }
198
-
199
-
200
-    /**
201
-     * @return string
202
-     */
203
-    public function plugin_action_slug()
204
-    {
205
-
206
-        return $this->_plugin_action_slug;
207
-    }
208
-
209
-
210
-    /**
211
-     * @param string $plugin_action_slug
212
-     */
213
-    public function set_plugin_action_slug($plugin_action_slug)
214
-    {
215
-
216
-        $this->_plugin_action_slug = $plugin_action_slug;
217
-    }
218
-
219
-
220
-    /**
221
-     * @return array
222
-     */
223
-    public function get_plugins_page_row()
224
-    {
225
-
226
-        return $this->_plugins_page_row;
227
-    }
228
-
229
-
230
-    /**
231
-     * @param array $plugins_page_row
232
-     */
233
-    public function set_plugins_page_row($plugins_page_row = array())
234
-    {
235
-        // sigh.... check for example content that I stupidly merged to master and remove it if found
236
-        if (! is_array($plugins_page_row)
237
-            && strpos($plugins_page_row, '<h3>Promotions Addon Upsell Info</h3>') !== false
238
-        ) {
239
-            $plugins_page_row = array();
240
-        }
241
-        $this->_plugins_page_row = (array) $plugins_page_row;
242
-    }
243
-
244
-
245
-    /**
246
-     * Called when EE core detects this addon has been activated for the first time.
247
-     * If the site isn't in maintenance mode, should setup the addon's database
248
-     *
249
-     * @return void
250
-     */
251
-    public function new_install()
252
-    {
253
-        $classname = get_class($this);
254
-        do_action("AHEE__{$classname}__new_install");
255
-        do_action('AHEE__EE_Addon__new_install', $this);
256
-        EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
257
-        add_action(
258
-            'AHEE__EE_System__perform_activations_upgrades_and_migrations',
259
-            array($this, 'initialize_db_if_no_migrations_required')
260
-        );
261
-    }
262
-
263
-
264
-    /**
265
-     * Called when EE core detects this addon has been reactivated. When this happens,
266
-     * it's good to just check that your data is still intact
267
-     *
268
-     * @return void
269
-     */
270
-    public function reactivation()
271
-    {
272
-        $classname = get_class($this);
273
-        do_action("AHEE__{$classname}__reactivation");
274
-        do_action('AHEE__EE_Addon__reactivation', $this);
275
-        EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
276
-        add_action(
277
-            'AHEE__EE_System__perform_activations_upgrades_and_migrations',
278
-            array($this, 'initialize_db_if_no_migrations_required')
279
-        );
280
-    }
281
-
282
-
283
-    /**
284
-     * Called when the registered deactivation hook for this addon fires.
285
-     * @throws EE_Error
286
-     */
287
-    public function deactivation()
288
-    {
289
-        $classname = get_class($this);
290
-        do_action("AHEE__{$classname}__deactivation");
291
-        do_action('AHEE__EE_Addon__deactivation', $this);
292
-        //check if the site no longer needs to be in maintenance mode
293
-        EE_Register_Addon::deregister($this->name());
294
-        EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
295
-    }
296
-
297
-
298
-    /**
299
-     * Takes care of double-checking that we're not in maintenance mode, and then
300
-     * initializing this addon's necessary initial data. This is called by default on new activations
301
-     * and reactivations.
302
-     *
303
-     * @param boolean $verify_schema whether to verify the database's schema for this addon, or just its data.
304
-     *                               This is a resource-intensive job so we prefer to only do it when necessary
305
-     * @return void
306
-     * @throws \EE_Error
307
-     */
308
-    public function initialize_db_if_no_migrations_required($verify_schema = true)
309
-    {
310
-        if ($verify_schema === '') {
311
-            //wp core bug imo: if no args are passed to `do_action('some_hook_name')` besides the hook's name
312
-            //(ie, no 2nd or 3rd arguments), instead of calling the registered callbacks with no arguments, it
313
-            //calls them with an argument of an empty string (ie ""), which evaluates to false
314
-            //so we need to treat the empty string as if nothing had been passed, and should instead use the default
315
-            $verify_schema = true;
316
-        }
317
-        if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
318
-            if ($verify_schema) {
319
-                $this->initialize_db();
320
-            }
321
-            $this->initialize_default_data();
322
-            //@todo: this will probably need to be adjusted in 4.4 as the array changed formats I believe
323
-            EE_Data_Migration_Manager::instance()->update_current_database_state_to(
324
-                array(
325
-                    'slug'    => $this->name(),
326
-                    'version' => $this->version(),
327
-                )
328
-            );
329
-            /* make sure core's data is a-ok
17
+	/**
18
+	 * prefix to be added onto an addon's plugin slug to make a wp option name
19
+	 * which will be used to store the plugin's activation history
20
+	 */
21
+	const ee_addon_version_history_option_prefix = 'ee_version_history_';
22
+
23
+	/**
24
+	 * @var $_version
25
+	 * @type string
26
+	 */
27
+	protected $_version = '';
28
+
29
+	/**
30
+	 * @var $_min_core_version
31
+	 * @type string
32
+	 */
33
+	protected $_min_core_version = '';
34
+
35
+	/**
36
+	 * derived from plugin 'main_file_path using plugin_basename()
37
+	 *
38
+	 * @type string $_plugin_basename
39
+	 */
40
+	protected $_plugin_basename = '';
41
+
42
+	/**
43
+	 * A non-internationalized name to identify this addon for use in URLs, etc
44
+	 *
45
+	 * @type string $_plugin_slug
46
+	 */
47
+	protected $_plugin_slug = '';
48
+
49
+	/**
50
+	 * A non-internationalized name to identify this addon. Eg 'Calendar','MailChimp',etc/
51
+	 *
52
+	 * @type string _addon_name
53
+	 */
54
+	protected $_addon_name = '';
55
+
56
+	/**
57
+	 * one of the EE_System::req_type_* constants
58
+	 *
59
+	 * @type int $_req_type
60
+	 */
61
+	protected $_req_type;
62
+
63
+	/**
64
+	 * page slug to be used when generating the "Settings" link on the WP plugin page
65
+	 *
66
+	 * @type string $_plugin_action_slug
67
+	 */
68
+	protected $_plugin_action_slug = '';
69
+
70
+	/**
71
+	 * if not empty, inserts a new table row after this plugin's row on the WP Plugins page
72
+	 * that can be used for adding upgrading/marketing info
73
+	 *
74
+	 * @type array $_plugins_page_row
75
+	 */
76
+	protected $_plugins_page_row = array();
77
+
78
+
79
+
80
+	/**
81
+	 *    filepath to the main file, which can be used for register_activation_hook, register_deactivation_hook, etc.
82
+	 *
83
+	 * @type string
84
+	 */
85
+	protected $_main_plugin_file;
86
+
87
+
88
+	/**
89
+	 *    class constructor
90
+	 */
91
+	public function __construct()
92
+	{
93
+		add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($this, 'admin_init'));
94
+	}
95
+
96
+
97
+	/**
98
+	 * @param mixed $version
99
+	 */
100
+	public function set_version($version = null)
101
+	{
102
+		$this->_version = $version;
103
+	}
104
+
105
+
106
+	/**
107
+	 * get__version
108
+	 *
109
+	 * @return string
110
+	 */
111
+	public function version()
112
+	{
113
+		return $this->_version;
114
+	}
115
+
116
+
117
+	/**
118
+	 * @param mixed $min_core_version
119
+	 */
120
+	public function set_min_core_version($min_core_version = null)
121
+	{
122
+		$this->_min_core_version = $min_core_version;
123
+	}
124
+
125
+
126
+	/**
127
+	 * get__min_core_version
128
+	 *
129
+	 * @return string
130
+	 */
131
+	public function min_core_version()
132
+	{
133
+		return $this->_min_core_version;
134
+	}
135
+
136
+
137
+	/**
138
+	 * Sets addon_name
139
+	 *
140
+	 * @param string $addon_name
141
+	 * @return boolean
142
+	 */
143
+	public function set_name($addon_name)
144
+	{
145
+		return $this->_addon_name = $addon_name;
146
+	}
147
+
148
+
149
+	/**
150
+	 * Gets addon_name
151
+	 *
152
+	 * @return string
153
+	 */
154
+	public function name()
155
+	{
156
+		return $this->_addon_name;
157
+	}
158
+
159
+
160
+	/**
161
+	 * @return string
162
+	 */
163
+	public function plugin_basename()
164
+	{
165
+
166
+		return $this->_plugin_basename;
167
+	}
168
+
169
+
170
+	/**
171
+	 * @param string $plugin_basename
172
+	 */
173
+	public function set_plugin_basename($plugin_basename)
174
+	{
175
+
176
+		$this->_plugin_basename = $plugin_basename;
177
+	}
178
+
179
+
180
+	/**
181
+	 * @return string
182
+	 */
183
+	public function plugin_slug()
184
+	{
185
+
186
+		return $this->_plugin_slug;
187
+	}
188
+
189
+
190
+	/**
191
+	 * @param string $plugin_slug
192
+	 */
193
+	public function set_plugin_slug($plugin_slug)
194
+	{
195
+
196
+		$this->_plugin_slug = $plugin_slug;
197
+	}
198
+
199
+
200
+	/**
201
+	 * @return string
202
+	 */
203
+	public function plugin_action_slug()
204
+	{
205
+
206
+		return $this->_plugin_action_slug;
207
+	}
208
+
209
+
210
+	/**
211
+	 * @param string $plugin_action_slug
212
+	 */
213
+	public function set_plugin_action_slug($plugin_action_slug)
214
+	{
215
+
216
+		$this->_plugin_action_slug = $plugin_action_slug;
217
+	}
218
+
219
+
220
+	/**
221
+	 * @return array
222
+	 */
223
+	public function get_plugins_page_row()
224
+	{
225
+
226
+		return $this->_plugins_page_row;
227
+	}
228
+
229
+
230
+	/**
231
+	 * @param array $plugins_page_row
232
+	 */
233
+	public function set_plugins_page_row($plugins_page_row = array())
234
+	{
235
+		// sigh.... check for example content that I stupidly merged to master and remove it if found
236
+		if (! is_array($plugins_page_row)
237
+			&& strpos($plugins_page_row, '<h3>Promotions Addon Upsell Info</h3>') !== false
238
+		) {
239
+			$plugins_page_row = array();
240
+		}
241
+		$this->_plugins_page_row = (array) $plugins_page_row;
242
+	}
243
+
244
+
245
+	/**
246
+	 * Called when EE core detects this addon has been activated for the first time.
247
+	 * If the site isn't in maintenance mode, should setup the addon's database
248
+	 *
249
+	 * @return void
250
+	 */
251
+	public function new_install()
252
+	{
253
+		$classname = get_class($this);
254
+		do_action("AHEE__{$classname}__new_install");
255
+		do_action('AHEE__EE_Addon__new_install', $this);
256
+		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
257
+		add_action(
258
+			'AHEE__EE_System__perform_activations_upgrades_and_migrations',
259
+			array($this, 'initialize_db_if_no_migrations_required')
260
+		);
261
+	}
262
+
263
+
264
+	/**
265
+	 * Called when EE core detects this addon has been reactivated. When this happens,
266
+	 * it's good to just check that your data is still intact
267
+	 *
268
+	 * @return void
269
+	 */
270
+	public function reactivation()
271
+	{
272
+		$classname = get_class($this);
273
+		do_action("AHEE__{$classname}__reactivation");
274
+		do_action('AHEE__EE_Addon__reactivation', $this);
275
+		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
276
+		add_action(
277
+			'AHEE__EE_System__perform_activations_upgrades_and_migrations',
278
+			array($this, 'initialize_db_if_no_migrations_required')
279
+		);
280
+	}
281
+
282
+
283
+	/**
284
+	 * Called when the registered deactivation hook for this addon fires.
285
+	 * @throws EE_Error
286
+	 */
287
+	public function deactivation()
288
+	{
289
+		$classname = get_class($this);
290
+		do_action("AHEE__{$classname}__deactivation");
291
+		do_action('AHEE__EE_Addon__deactivation', $this);
292
+		//check if the site no longer needs to be in maintenance mode
293
+		EE_Register_Addon::deregister($this->name());
294
+		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
295
+	}
296
+
297
+
298
+	/**
299
+	 * Takes care of double-checking that we're not in maintenance mode, and then
300
+	 * initializing this addon's necessary initial data. This is called by default on new activations
301
+	 * and reactivations.
302
+	 *
303
+	 * @param boolean $verify_schema whether to verify the database's schema for this addon, or just its data.
304
+	 *                               This is a resource-intensive job so we prefer to only do it when necessary
305
+	 * @return void
306
+	 * @throws \EE_Error
307
+	 */
308
+	public function initialize_db_if_no_migrations_required($verify_schema = true)
309
+	{
310
+		if ($verify_schema === '') {
311
+			//wp core bug imo: if no args are passed to `do_action('some_hook_name')` besides the hook's name
312
+			//(ie, no 2nd or 3rd arguments), instead of calling the registered callbacks with no arguments, it
313
+			//calls them with an argument of an empty string (ie ""), which evaluates to false
314
+			//so we need to treat the empty string as if nothing had been passed, and should instead use the default
315
+			$verify_schema = true;
316
+		}
317
+		if (EE_Maintenance_Mode::instance()->level() !== EE_Maintenance_Mode::level_2_complete_maintenance) {
318
+			if ($verify_schema) {
319
+				$this->initialize_db();
320
+			}
321
+			$this->initialize_default_data();
322
+			//@todo: this will probably need to be adjusted in 4.4 as the array changed formats I believe
323
+			EE_Data_Migration_Manager::instance()->update_current_database_state_to(
324
+				array(
325
+					'slug'    => $this->name(),
326
+					'version' => $this->version(),
327
+				)
328
+			);
329
+			/* make sure core's data is a-ok
330 330
              * (at the time of writing, we especially want to verify all the caps are present
331 331
              * because payment method type capabilities are added dynamically, and it's
332 332
              * possible this addon added a payment method. But it's also possible
333 333
              * other data needs to be verified)
334 334
              */
335
-            EEH_Activation::initialize_db_content();
336
-            update_option('ee_flush_rewrite_rules', true);
337
-            //in case there are lots of addons being activated at once, let's force garbage collection
338
-            //to help avoid memory limit errors
339
-            //EEH_Debug_Tools::instance()->measure_memory( 'db content initialized for ' . get_class( $this), true );
340
-            gc_collect_cycles();
341
-        } else {
342
-            //ask the data migration manager to init this addon's data
343
-            //when migrations are finished because we can't do it now
344
-            EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for($this->name());
345
-        }
346
-    }
347
-
348
-
349
-    /**
350
-     * Used to setup this addon's database tables, but not necessarily any default
351
-     * data in them. The default is to actually use the most up-to-date data migration script
352
-     * for this addon, and just use its schema_changes_before_migration() and schema_changes_after_migration()
353
-     * methods to setup the db.
354
-     */
355
-    public function initialize_db()
356
-    {
357
-        //find the migration script that sets the database to be compatible with the code
358
-        $current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms($this->name());
359
-        if ($current_dms_name) {
360
-            $current_data_migration_script = EE_Registry::instance()->load_dms($current_dms_name);
361
-            $current_data_migration_script->set_migrating(false);
362
-            $current_data_migration_script->schema_changes_before_migration();
363
-            $current_data_migration_script->schema_changes_after_migration();
364
-            if ($current_data_migration_script->get_errors()) {
365
-                foreach ($current_data_migration_script->get_errors() as $error) {
366
-                    EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
367
-                }
368
-            }
369
-        }
370
-        //if not DMS was found that should be ok. This addon just doesn't require any database changes
371
-        EE_Data_Migration_Manager::instance()->update_current_database_state_to(
372
-            array(
373
-                'slug'    => $this->name(),
374
-                'version' => $this->version(),
375
-            )
376
-        );
377
-    }
378
-
379
-
380
-    /**
381
-     * If you want to setup default data for the addon, override this method, and call
382
-     * parent::initialize_default_data() from within it. This is normally called
383
-     * from EE_Addon::initialize_db_if_no_migrations_required(), just after EE_Addon::initialize_db()
384
-     * and should verify default data is present (but this is also called
385
-     * on reactivations and just after migrations, so please verify you actually want
386
-     * to ADD default data, because it may already be present).
387
-     * However, please call this parent (currently it just fires a hook which other
388
-     * addons may be depending on)
389
-     */
390
-    public function initialize_default_data()
391
-    {
392
-        /**
393
-         * Called when an addon is ensuring its default data is set (possibly called
394
-         * on a reactivation, so first check for the absence of other data before setting
395
-         * default data)
396
-         *
397
-         * @param EE_Addon $addon the addon that called this
398
-         */
399
-        do_action('AHEE__EE_Addon__initialize_default_data__begin', $this);
400
-        //override to insert default data. It is safe to use the models here
401
-        //because the site should not be in maintenance mode
402
-    }
403
-
404
-
405
-    /**
406
-     * EE Core detected that this addon has been upgraded. We should check if there
407
-     * are any new migration scripts, and if so put the site into maintenance mode until
408
-     * they're ran
409
-     *
410
-     * @return void
411
-     */
412
-    public function upgrade()
413
-    {
414
-        $classname = get_class($this);
415
-        do_action("AHEE__{$classname}__upgrade");
416
-        do_action('AHEE__EE_Addon__upgrade', $this);
417
-        EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
418
-        //also it's possible there is new default data that needs to be added
419
-        add_action(
420
-            'AHEE__EE_System__perform_activations_upgrades_and_migrations',
421
-            array($this, 'initialize_db_if_no_migrations_required')
422
-        );
423
-    }
424
-
425
-
426
-    /**
427
-     * If Core detects this addon has been downgraded, you may want to invoke some special logic here.
428
-     */
429
-    public function downgrade()
430
-    {
431
-        $classname = get_class($this);
432
-        do_action("AHEE__{$classname}__downgrade");
433
-        do_action('AHEE__EE_Addon__downgrade', $this);
434
-        //it's possible there's old default data that needs to be double-checked
435
-        add_action(
436
-            'AHEE__EE_System__perform_activations_upgrades_and_migrations',
437
-            array($this, 'initialize_db_if_no_migrations_required')
438
-        );
439
-    }
440
-
441
-
442
-    /**
443
-     * set_db_update_option_name
444
-     * Until we do something better, we'll just check for migration scripts upon
445
-     * plugin activation only. In the future, we'll want to do it on plugin updates too
446
-     *
447
-     * @return bool
448
-     */
449
-    public function set_db_update_option_name()
450
-    {
451
-        EE_Error::doing_it_wrong(
452
-            __FUNCTION__,
453
-            esc_html__(
454
-                'EE_Addon::set_db_update_option_name was renamed to EE_Addon::set_activation_indicator_option',
455
-                'event_espresso'
456
-            ),
457
-            '4.3.0.alpha.016'
458
-        );
459
-        //let's just handle this on the next request, ok? right now we're just not really ready
460
-        return $this->set_activation_indicator_option();
461
-    }
462
-
463
-
464
-    /**
465
-     * Returns the name of the activation indicator option
466
-     * (an option which is set temporarily to indicate that this addon was just activated)
467
-     *
468
-     * @deprecated since version 4.3.0.alpha.016
469
-     * @return string
470
-     */
471
-    public function get_db_update_option_name()
472
-    {
473
-        EE_Error::doing_it_wrong(
474
-            __FUNCTION__,
475
-            esc_html__(
476
-                'EE_Addon::get_db_update_option was renamed to EE_Addon::get_activation_indicator_option_name',
477
-                'event_espresso'
478
-            ),
479
-            '4.3.0.alpha.016'
480
-        );
481
-        return $this->get_activation_indicator_option_name();
482
-    }
483
-
484
-
485
-    /**
486
-     * When the addon is activated, this should be called to set a wordpress option that
487
-     * indicates it was activated. This is especially useful for detecting reactivations.
488
-     *
489
-     * @return bool
490
-     */
491
-    public function set_activation_indicator_option()
492
-    {
493
-        // let's just handle this on the next request, ok? right now we're just not really ready
494
-        return update_option($this->get_activation_indicator_option_name(), true);
495
-    }
496
-
497
-
498
-    /**
499
-     * Gets the name of the wp option which is used to temporarily indicate that this addon was activated
500
-     *
501
-     * @return string
502
-     */
503
-    public function get_activation_indicator_option_name()
504
-    {
505
-        return 'ee_activation_' . $this->name();
506
-    }
507
-
508
-
509
-    /**
510
-     * Used by EE_System to set the request type of this addon. Should not be used by addon developers
511
-     *
512
-     * @param int $req_type
513
-     */
514
-    public function set_req_type($req_type)
515
-    {
516
-        $this->_req_type = $req_type;
517
-    }
518
-
519
-
520
-    /**
521
-     * Returns the request type of this addon (ie, EE_System::req_type_normal, EE_System::req_type_new_activation,
522
-     * EE_System::req_type_reactivation, EE_System::req_type_upgrade, or EE_System::req_type_downgrade). This is set by
523
-     * EE_System when it is checking for new install or upgrades of addons
524
-     */
525
-    public function detect_req_type()
526
-    {
527
-        if (! $this->_req_type) {
528
-            $this->detect_activation_or_upgrade();
529
-        }
530
-        return $this->_req_type;
531
-    }
532
-
533
-
534
-    /**
535
-     * Detects the request type for this addon (whether it was just activated, upgrades, a normal request, etc.)
536
-     * Should only be called once per request
537
-     *
538
-     * @return void
539
-     */
540
-    public function detect_activation_or_upgrade()
541
-    {
542
-        $activation_history_for_addon = $this->get_activation_history();
335
+			EEH_Activation::initialize_db_content();
336
+			update_option('ee_flush_rewrite_rules', true);
337
+			//in case there are lots of addons being activated at once, let's force garbage collection
338
+			//to help avoid memory limit errors
339
+			//EEH_Debug_Tools::instance()->measure_memory( 'db content initialized for ' . get_class( $this), true );
340
+			gc_collect_cycles();
341
+		} else {
342
+			//ask the data migration manager to init this addon's data
343
+			//when migrations are finished because we can't do it now
344
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for($this->name());
345
+		}
346
+	}
347
+
348
+
349
+	/**
350
+	 * Used to setup this addon's database tables, but not necessarily any default
351
+	 * data in them. The default is to actually use the most up-to-date data migration script
352
+	 * for this addon, and just use its schema_changes_before_migration() and schema_changes_after_migration()
353
+	 * methods to setup the db.
354
+	 */
355
+	public function initialize_db()
356
+	{
357
+		//find the migration script that sets the database to be compatible with the code
358
+		$current_dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms($this->name());
359
+		if ($current_dms_name) {
360
+			$current_data_migration_script = EE_Registry::instance()->load_dms($current_dms_name);
361
+			$current_data_migration_script->set_migrating(false);
362
+			$current_data_migration_script->schema_changes_before_migration();
363
+			$current_data_migration_script->schema_changes_after_migration();
364
+			if ($current_data_migration_script->get_errors()) {
365
+				foreach ($current_data_migration_script->get_errors() as $error) {
366
+					EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
367
+				}
368
+			}
369
+		}
370
+		//if not DMS was found that should be ok. This addon just doesn't require any database changes
371
+		EE_Data_Migration_Manager::instance()->update_current_database_state_to(
372
+			array(
373
+				'slug'    => $this->name(),
374
+				'version' => $this->version(),
375
+			)
376
+		);
377
+	}
378
+
379
+
380
+	/**
381
+	 * If you want to setup default data for the addon, override this method, and call
382
+	 * parent::initialize_default_data() from within it. This is normally called
383
+	 * from EE_Addon::initialize_db_if_no_migrations_required(), just after EE_Addon::initialize_db()
384
+	 * and should verify default data is present (but this is also called
385
+	 * on reactivations and just after migrations, so please verify you actually want
386
+	 * to ADD default data, because it may already be present).
387
+	 * However, please call this parent (currently it just fires a hook which other
388
+	 * addons may be depending on)
389
+	 */
390
+	public function initialize_default_data()
391
+	{
392
+		/**
393
+		 * Called when an addon is ensuring its default data is set (possibly called
394
+		 * on a reactivation, so first check for the absence of other data before setting
395
+		 * default data)
396
+		 *
397
+		 * @param EE_Addon $addon the addon that called this
398
+		 */
399
+		do_action('AHEE__EE_Addon__initialize_default_data__begin', $this);
400
+		//override to insert default data. It is safe to use the models here
401
+		//because the site should not be in maintenance mode
402
+	}
403
+
404
+
405
+	/**
406
+	 * EE Core detected that this addon has been upgraded. We should check if there
407
+	 * are any new migration scripts, and if so put the site into maintenance mode until
408
+	 * they're ran
409
+	 *
410
+	 * @return void
411
+	 */
412
+	public function upgrade()
413
+	{
414
+		$classname = get_class($this);
415
+		do_action("AHEE__{$classname}__upgrade");
416
+		do_action('AHEE__EE_Addon__upgrade', $this);
417
+		EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
418
+		//also it's possible there is new default data that needs to be added
419
+		add_action(
420
+			'AHEE__EE_System__perform_activations_upgrades_and_migrations',
421
+			array($this, 'initialize_db_if_no_migrations_required')
422
+		);
423
+	}
424
+
425
+
426
+	/**
427
+	 * If Core detects this addon has been downgraded, you may want to invoke some special logic here.
428
+	 */
429
+	public function downgrade()
430
+	{
431
+		$classname = get_class($this);
432
+		do_action("AHEE__{$classname}__downgrade");
433
+		do_action('AHEE__EE_Addon__downgrade', $this);
434
+		//it's possible there's old default data that needs to be double-checked
435
+		add_action(
436
+			'AHEE__EE_System__perform_activations_upgrades_and_migrations',
437
+			array($this, 'initialize_db_if_no_migrations_required')
438
+		);
439
+	}
440
+
441
+
442
+	/**
443
+	 * set_db_update_option_name
444
+	 * Until we do something better, we'll just check for migration scripts upon
445
+	 * plugin activation only. In the future, we'll want to do it on plugin updates too
446
+	 *
447
+	 * @return bool
448
+	 */
449
+	public function set_db_update_option_name()
450
+	{
451
+		EE_Error::doing_it_wrong(
452
+			__FUNCTION__,
453
+			esc_html__(
454
+				'EE_Addon::set_db_update_option_name was renamed to EE_Addon::set_activation_indicator_option',
455
+				'event_espresso'
456
+			),
457
+			'4.3.0.alpha.016'
458
+		);
459
+		//let's just handle this on the next request, ok? right now we're just not really ready
460
+		return $this->set_activation_indicator_option();
461
+	}
462
+
463
+
464
+	/**
465
+	 * Returns the name of the activation indicator option
466
+	 * (an option which is set temporarily to indicate that this addon was just activated)
467
+	 *
468
+	 * @deprecated since version 4.3.0.alpha.016
469
+	 * @return string
470
+	 */
471
+	public function get_db_update_option_name()
472
+	{
473
+		EE_Error::doing_it_wrong(
474
+			__FUNCTION__,
475
+			esc_html__(
476
+				'EE_Addon::get_db_update_option was renamed to EE_Addon::get_activation_indicator_option_name',
477
+				'event_espresso'
478
+			),
479
+			'4.3.0.alpha.016'
480
+		);
481
+		return $this->get_activation_indicator_option_name();
482
+	}
483
+
484
+
485
+	/**
486
+	 * When the addon is activated, this should be called to set a wordpress option that
487
+	 * indicates it was activated. This is especially useful for detecting reactivations.
488
+	 *
489
+	 * @return bool
490
+	 */
491
+	public function set_activation_indicator_option()
492
+	{
493
+		// let's just handle this on the next request, ok? right now we're just not really ready
494
+		return update_option($this->get_activation_indicator_option_name(), true);
495
+	}
496
+
497
+
498
+	/**
499
+	 * Gets the name of the wp option which is used to temporarily indicate that this addon was activated
500
+	 *
501
+	 * @return string
502
+	 */
503
+	public function get_activation_indicator_option_name()
504
+	{
505
+		return 'ee_activation_' . $this->name();
506
+	}
507
+
508
+
509
+	/**
510
+	 * Used by EE_System to set the request type of this addon. Should not be used by addon developers
511
+	 *
512
+	 * @param int $req_type
513
+	 */
514
+	public function set_req_type($req_type)
515
+	{
516
+		$this->_req_type = $req_type;
517
+	}
518
+
519
+
520
+	/**
521
+	 * Returns the request type of this addon (ie, EE_System::req_type_normal, EE_System::req_type_new_activation,
522
+	 * EE_System::req_type_reactivation, EE_System::req_type_upgrade, or EE_System::req_type_downgrade). This is set by
523
+	 * EE_System when it is checking for new install or upgrades of addons
524
+	 */
525
+	public function detect_req_type()
526
+	{
527
+		if (! $this->_req_type) {
528
+			$this->detect_activation_or_upgrade();
529
+		}
530
+		return $this->_req_type;
531
+	}
532
+
533
+
534
+	/**
535
+	 * Detects the request type for this addon (whether it was just activated, upgrades, a normal request, etc.)
536
+	 * Should only be called once per request
537
+	 *
538
+	 * @return void
539
+	 */
540
+	public function detect_activation_or_upgrade()
541
+	{
542
+		$activation_history_for_addon = $this->get_activation_history();
543 543
 //		d($activation_history_for_addon);
544
-        $request_type = EE_System::detect_req_type_given_activation_history(
545
-            $activation_history_for_addon,
546
-            $this->get_activation_indicator_option_name(),
547
-            $this->version()
548
-        );
549
-        $this->set_req_type($request_type);
550
-        $classname = get_class($this);
551
-        switch ($request_type) {
552
-            case EE_System::req_type_new_activation:
553
-                do_action("AHEE__{$classname}__detect_activations_or_upgrades__new_activation");
554
-                do_action('AHEE__EE_Addon__detect_activations_or_upgrades__new_activation', $this);
555
-                $this->new_install();
556
-                $this->update_list_of_installed_versions($activation_history_for_addon);
557
-                break;
558
-            case EE_System::req_type_reactivation:
559
-                do_action("AHEE__{$classname}__detect_activations_or_upgrades__reactivation");
560
-                do_action('AHEE__EE_Addon__detect_activations_or_upgrades__reactivation', $this);
561
-                $this->reactivation();
562
-                $this->update_list_of_installed_versions($activation_history_for_addon);
563
-                break;
564
-            case EE_System::req_type_upgrade:
565
-                do_action("AHEE__{$classname}__detect_activations_or_upgrades__upgrade");
566
-                do_action('AHEE__EE_Addon__detect_activations_or_upgrades__upgrade', $this);
567
-                $this->upgrade();
568
-                $this->update_list_of_installed_versions($activation_history_for_addon);
569
-                break;
570
-            case EE_System::req_type_downgrade:
571
-                do_action("AHEE__{$classname}__detect_activations_or_upgrades__downgrade");
572
-                do_action('AHEE__EE_Addon__detect_activations_or_upgrades__downgrade', $this);
573
-                $this->downgrade();
574
-                $this->update_list_of_installed_versions($activation_history_for_addon);
575
-                break;
576
-            case EE_System::req_type_normal:
577
-            default:
544
+		$request_type = EE_System::detect_req_type_given_activation_history(
545
+			$activation_history_for_addon,
546
+			$this->get_activation_indicator_option_name(),
547
+			$this->version()
548
+		);
549
+		$this->set_req_type($request_type);
550
+		$classname = get_class($this);
551
+		switch ($request_type) {
552
+			case EE_System::req_type_new_activation:
553
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__new_activation");
554
+				do_action('AHEE__EE_Addon__detect_activations_or_upgrades__new_activation', $this);
555
+				$this->new_install();
556
+				$this->update_list_of_installed_versions($activation_history_for_addon);
557
+				break;
558
+			case EE_System::req_type_reactivation:
559
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__reactivation");
560
+				do_action('AHEE__EE_Addon__detect_activations_or_upgrades__reactivation', $this);
561
+				$this->reactivation();
562
+				$this->update_list_of_installed_versions($activation_history_for_addon);
563
+				break;
564
+			case EE_System::req_type_upgrade:
565
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__upgrade");
566
+				do_action('AHEE__EE_Addon__detect_activations_or_upgrades__upgrade', $this);
567
+				$this->upgrade();
568
+				$this->update_list_of_installed_versions($activation_history_for_addon);
569
+				break;
570
+			case EE_System::req_type_downgrade:
571
+				do_action("AHEE__{$classname}__detect_activations_or_upgrades__downgrade");
572
+				do_action('AHEE__EE_Addon__detect_activations_or_upgrades__downgrade', $this);
573
+				$this->downgrade();
574
+				$this->update_list_of_installed_versions($activation_history_for_addon);
575
+				break;
576
+			case EE_System::req_type_normal:
577
+			default:
578 578
 //				$this->_maybe_redirect_to_ee_about();
579
-                break;
580
-        }
581
-
582
-        do_action("AHEE__{$classname}__detect_if_activation_or_upgrade__complete");
583
-    }
584
-
585
-    /**
586
-     * Updates the version history for this addon
587
-     *
588
-     * @param array  $version_history
589
-     * @param string $current_version_to_add
590
-     * @return boolean success
591
-     */
592
-    public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
593
-    {
594
-        if (! $version_history) {
595
-            $version_history = $this->get_activation_history();
596
-        }
597
-        if ($current_version_to_add === null) {
598
-            $current_version_to_add = $this->version();
599
-        }
600
-        $version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
601
-        // resave
579
+				break;
580
+		}
581
+
582
+		do_action("AHEE__{$classname}__detect_if_activation_or_upgrade__complete");
583
+	}
584
+
585
+	/**
586
+	 * Updates the version history for this addon
587
+	 *
588
+	 * @param array  $version_history
589
+	 * @param string $current_version_to_add
590
+	 * @return boolean success
591
+	 */
592
+	public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
593
+	{
594
+		if (! $version_history) {
595
+			$version_history = $this->get_activation_history();
596
+		}
597
+		if ($current_version_to_add === null) {
598
+			$current_version_to_add = $this->version();
599
+		}
600
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
601
+		// resave
602 602
 //		echo "updating list of installed versions:".$this->get_activation_history_option_name();d($version_history);
603
-        return update_option($this->get_activation_history_option_name(), $version_history);
604
-    }
605
-
606
-    /**
607
-     * Gets the name of the wp option that stores the activation history
608
-     * of this addon
609
-     *
610
-     * @return string
611
-     */
612
-    public function get_activation_history_option_name()
613
-    {
614
-        return self::ee_addon_version_history_option_prefix . $this->name();
615
-    }
616
-
617
-
618
-    /**
619
-     * Gets the wp option which stores the activation history for this addon
620
-     *
621
-     * @return array
622
-     */
623
-    public function get_activation_history()
624
-    {
625
-        return get_option($this->get_activation_history_option_name(), null);
626
-    }
627
-
628
-
629
-    /**
630
-     * @param string $config_section
631
-     */
632
-    public function set_config_section($config_section = '')
633
-    {
634
-        $this->_config_section = ! empty($config_section) ? $config_section : 'addons';
635
-    }
636
-
637
-    /**
638
-     * Sets the filepath to the main plugin file
639
-     *
640
-     * @param string $filepath
641
-     */
642
-    public function set_main_plugin_file($filepath)
643
-    {
644
-        $this->_main_plugin_file = $filepath;
645
-    }
646
-
647
-    /**
648
-     * gets the filepath to teh main file
649
-     *
650
-     * @return string
651
-     */
652
-    public function get_main_plugin_file()
653
-    {
654
-        return $this->_main_plugin_file;
655
-    }
656
-
657
-    /**
658
-     * Gets the filename (no path) of the main file (the main file loaded
659
-     * by WP)
660
-     *
661
-     * @return string
662
-     */
663
-    public function get_main_plugin_file_basename()
664
-    {
665
-        return plugin_basename($this->get_main_plugin_file());
666
-    }
667
-
668
-    /**
669
-     * Gets the folder name which contains the main plugin file
670
-     *
671
-     * @return string
672
-     */
673
-    public function get_main_plugin_file_dirname()
674
-    {
675
-        return dirname($this->get_main_plugin_file());
676
-    }
677
-
678
-
679
-    /**
680
-     * sets hooks used in the admin
681
-     *
682
-     * @return void
683
-     */
684
-    public function admin_init()
685
-    {
686
-        // is admin and not in M-Mode ?
687
-        if (is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
688
-            add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
689
-            add_filter('after_plugin_row_' . $this->_plugin_basename, array($this, 'after_plugin_row'), 10, 3);
690
-        }
691
-    }
692
-
693
-
694
-    /**
695
-     * plugin_actions
696
-     * Add a settings link to the Plugins page, so people can go straight from the plugin page to the settings page.
697
-     *
698
-     * @param $links
699
-     * @param $file
700
-     * @return array
701
-     */
702
-    public function plugin_action_links($links, $file)
703
-    {
704
-        if ($file === $this->plugin_basename() && $this->plugin_action_slug() !== '') {
705
-            // before other links
706
-            array_unshift(
707
-                $links,
708
-                '<a href="admin.php?page=' . $this->plugin_action_slug() . '">'
709
-                . esc_html__('Settings', 'event_espresso')
710
-                . '</a>'
711
-            );
712
-        }
713
-        return $links;
714
-    }
715
-
716
-
717
-    /**
718
-     * after_plugin_row
719
-     * Add additional content to the plugins page plugin row
720
-     * Inserts another row
721
-     *
722
-     * @param $plugin_file
723
-     * @param $plugin_data
724
-     * @param $status
725
-     * @return void
726
-     */
727
-    public function after_plugin_row($plugin_file, $plugin_data, $status)
728
-    {
729
-        $after_plugin_row = '';
730
-        $plugins_page_row = $this->get_plugins_page_row();
731
-        if (! empty($plugins_page_row) && $plugin_file === $this->plugin_basename()) {
732
-            $class            = $status ? 'active' : 'inactive';
733
-            $link_text        = isset($plugins_page_row['link_text']) ? $plugins_page_row['link_text'] : '';
734
-            $link_url         = isset($plugins_page_row['link_url']) ? $plugins_page_row['link_url'] : '';
735
-            $description      = isset($plugins_page_row['description'])
736
-                ? $plugins_page_row['description']
737
-                : '';
738
-            if (! empty($link_text) && ! empty($link_url) && ! empty($description)) {
739
-                $after_plugin_row .= '<tr id="' . sanitize_title($plugin_file) . '-ee-addon" class="' . $class . '">';
740
-                $after_plugin_row .= '<th class="check-column" scope="row"></th>';
741
-                $after_plugin_row .= '<td class="ee-addon-upsell-info-title-td plugin-title column-primary">';
742
-                $after_plugin_row .= '<style>
603
+		return update_option($this->get_activation_history_option_name(), $version_history);
604
+	}
605
+
606
+	/**
607
+	 * Gets the name of the wp option that stores the activation history
608
+	 * of this addon
609
+	 *
610
+	 * @return string
611
+	 */
612
+	public function get_activation_history_option_name()
613
+	{
614
+		return self::ee_addon_version_history_option_prefix . $this->name();
615
+	}
616
+
617
+
618
+	/**
619
+	 * Gets the wp option which stores the activation history for this addon
620
+	 *
621
+	 * @return array
622
+	 */
623
+	public function get_activation_history()
624
+	{
625
+		return get_option($this->get_activation_history_option_name(), null);
626
+	}
627
+
628
+
629
+	/**
630
+	 * @param string $config_section
631
+	 */
632
+	public function set_config_section($config_section = '')
633
+	{
634
+		$this->_config_section = ! empty($config_section) ? $config_section : 'addons';
635
+	}
636
+
637
+	/**
638
+	 * Sets the filepath to the main plugin file
639
+	 *
640
+	 * @param string $filepath
641
+	 */
642
+	public function set_main_plugin_file($filepath)
643
+	{
644
+		$this->_main_plugin_file = $filepath;
645
+	}
646
+
647
+	/**
648
+	 * gets the filepath to teh main file
649
+	 *
650
+	 * @return string
651
+	 */
652
+	public function get_main_plugin_file()
653
+	{
654
+		return $this->_main_plugin_file;
655
+	}
656
+
657
+	/**
658
+	 * Gets the filename (no path) of the main file (the main file loaded
659
+	 * by WP)
660
+	 *
661
+	 * @return string
662
+	 */
663
+	public function get_main_plugin_file_basename()
664
+	{
665
+		return plugin_basename($this->get_main_plugin_file());
666
+	}
667
+
668
+	/**
669
+	 * Gets the folder name which contains the main plugin file
670
+	 *
671
+	 * @return string
672
+	 */
673
+	public function get_main_plugin_file_dirname()
674
+	{
675
+		return dirname($this->get_main_plugin_file());
676
+	}
677
+
678
+
679
+	/**
680
+	 * sets hooks used in the admin
681
+	 *
682
+	 * @return void
683
+	 */
684
+	public function admin_init()
685
+	{
686
+		// is admin and not in M-Mode ?
687
+		if (is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
688
+			add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
689
+			add_filter('after_plugin_row_' . $this->_plugin_basename, array($this, 'after_plugin_row'), 10, 3);
690
+		}
691
+	}
692
+
693
+
694
+	/**
695
+	 * plugin_actions
696
+	 * Add a settings link to the Plugins page, so people can go straight from the plugin page to the settings page.
697
+	 *
698
+	 * @param $links
699
+	 * @param $file
700
+	 * @return array
701
+	 */
702
+	public function plugin_action_links($links, $file)
703
+	{
704
+		if ($file === $this->plugin_basename() && $this->plugin_action_slug() !== '') {
705
+			// before other links
706
+			array_unshift(
707
+				$links,
708
+				'<a href="admin.php?page=' . $this->plugin_action_slug() . '">'
709
+				. esc_html__('Settings', 'event_espresso')
710
+				. '</a>'
711
+			);
712
+		}
713
+		return $links;
714
+	}
715
+
716
+
717
+	/**
718
+	 * after_plugin_row
719
+	 * Add additional content to the plugins page plugin row
720
+	 * Inserts another row
721
+	 *
722
+	 * @param $plugin_file
723
+	 * @param $plugin_data
724
+	 * @param $status
725
+	 * @return void
726
+	 */
727
+	public function after_plugin_row($plugin_file, $plugin_data, $status)
728
+	{
729
+		$after_plugin_row = '';
730
+		$plugins_page_row = $this->get_plugins_page_row();
731
+		if (! empty($plugins_page_row) && $plugin_file === $this->plugin_basename()) {
732
+			$class            = $status ? 'active' : 'inactive';
733
+			$link_text        = isset($plugins_page_row['link_text']) ? $plugins_page_row['link_text'] : '';
734
+			$link_url         = isset($plugins_page_row['link_url']) ? $plugins_page_row['link_url'] : '';
735
+			$description      = isset($plugins_page_row['description'])
736
+				? $plugins_page_row['description']
737
+				: '';
738
+			if (! empty($link_text) && ! empty($link_url) && ! empty($description)) {
739
+				$after_plugin_row .= '<tr id="' . sanitize_title($plugin_file) . '-ee-addon" class="' . $class . '">';
740
+				$after_plugin_row .= '<th class="check-column" scope="row"></th>';
741
+				$after_plugin_row .= '<td class="ee-addon-upsell-info-title-td plugin-title column-primary">';
742
+				$after_plugin_row .= '<style>
743 743
 .ee-button,
744 744
 .ee-button:active,
745 745
 .ee-button:visited {
@@ -776,49 +776,49 @@  discard block
 block discarded – undo
776 776
 }
777 777
 .ee-button:active { top:0; }
778 778
 </style>';
779
-                $after_plugin_row .= '
779
+				$after_plugin_row .= '
780 780
 <p class="ee-addon-upsell-info-dv">
781 781
 	<a class="ee-button" href="' . $link_url . '">'
782
-                . $link_text
783
-                . ' &nbsp;<span class="dashicons dashicons-arrow-right-alt2" style="margin:0;"></span>'
784
-                . '</a>
782
+				. $link_text
783
+				. ' &nbsp;<span class="dashicons dashicons-arrow-right-alt2" style="margin:0;"></span>'
784
+				. '</a>
785 785
 </p>';
786
-                $after_plugin_row .= '</td>';
787
-                $after_plugin_row .= '<td class="ee-addon-upsell-info-desc-td column-description desc">';
788
-                $after_plugin_row .= $description;
789
-                $after_plugin_row .= '</td>';
790
-                $after_plugin_row .= '</tr>';
791
-            } else {
792
-                $after_plugin_row .= $description;
793
-            }
794
-        }
795
-
796
-        echo $after_plugin_row;
797
-    }
798
-
799
-
800
-    /**
801
-     * A safe space for addons to add additional logic like setting hooks that need to be set early in the request.
802
-     * Child classes that have logic like that to run can override this method declaration.  This was not made abstract
803
-     * for back compat reasons.
804
-     *
805
-     * This will fire on the `AHEE__EE_System__load_espresso_addons__complete` hook at priority 999.
806
-     *
807
-     * It is recommended, if client code is `de-registering` an add-on, then do it on the
808
-     * `AHEE__EE_System__load_espresso_addons__complete` hook before priority 999 so as to ensure any code logic in this
809
-     * callback does not get run/set in that request.
810
-     *
811
-     * Also, keep in mind that if a registered add-on happens to be deactivated via
812
-     * EE_System::_deactivate_incompatible_addons() because its incompatible, any code executed in this method
813
-     * (including setting hooks etc) will have executed before the plugin was deactivated.  If you use
814
-     * `after_registration` to set any filter and/or action hooks and want to ensure they are removed on this add-on's
815
-     * deactivation, you can override `EE_Addon::deactivation` and unset your hooks and filters there.  Just remember
816
-     * to call `parent::deactivation`.
817
-     *
818
-     * @since 4.9.26
819
-     */
820
-    public function after_registration()
821
-    {
822
-        // cricket chirp... cricket chirp...
823
-    }
786
+				$after_plugin_row .= '</td>';
787
+				$after_plugin_row .= '<td class="ee-addon-upsell-info-desc-td column-description desc">';
788
+				$after_plugin_row .= $description;
789
+				$after_plugin_row .= '</td>';
790
+				$after_plugin_row .= '</tr>';
791
+			} else {
792
+				$after_plugin_row .= $description;
793
+			}
794
+		}
795
+
796
+		echo $after_plugin_row;
797
+	}
798
+
799
+
800
+	/**
801
+	 * A safe space for addons to add additional logic like setting hooks that need to be set early in the request.
802
+	 * Child classes that have logic like that to run can override this method declaration.  This was not made abstract
803
+	 * for back compat reasons.
804
+	 *
805
+	 * This will fire on the `AHEE__EE_System__load_espresso_addons__complete` hook at priority 999.
806
+	 *
807
+	 * It is recommended, if client code is `de-registering` an add-on, then do it on the
808
+	 * `AHEE__EE_System__load_espresso_addons__complete` hook before priority 999 so as to ensure any code logic in this
809
+	 * callback does not get run/set in that request.
810
+	 *
811
+	 * Also, keep in mind that if a registered add-on happens to be deactivated via
812
+	 * EE_System::_deactivate_incompatible_addons() because its incompatible, any code executed in this method
813
+	 * (including setting hooks etc) will have executed before the plugin was deactivated.  If you use
814
+	 * `after_registration` to set any filter and/or action hooks and want to ensure they are removed on this add-on's
815
+	 * deactivation, you can override `EE_Addon::deactivation` and unset your hooks and filters there.  Just remember
816
+	 * to call `parent::deactivation`.
817
+	 *
818
+	 * @since 4.9.26
819
+	 */
820
+	public function after_registration()
821
+	{
822
+		// cricket chirp... cricket chirp...
823
+	}
824 824
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
     public function set_plugins_page_row($plugins_page_row = array())
234 234
     {
235 235
         // sigh.... check for example content that I stupidly merged to master and remove it if found
236
-        if (! is_array($plugins_page_row)
236
+        if ( ! is_array($plugins_page_row)
237 237
             && strpos($plugins_page_row, '<h3>Promotions Addon Upsell Info</h3>') !== false
238 238
         ) {
239 239
             $plugins_page_row = array();
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
      */
503 503
     public function get_activation_indicator_option_name()
504 504
     {
505
-        return 'ee_activation_' . $this->name();
505
+        return 'ee_activation_'.$this->name();
506 506
     }
507 507
 
508 508
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
      */
525 525
     public function detect_req_type()
526 526
     {
527
-        if (! $this->_req_type) {
527
+        if ( ! $this->_req_type) {
528 528
             $this->detect_activation_or_upgrade();
529 529
         }
530 530
         return $this->_req_type;
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
      */
592 592
     public function update_list_of_installed_versions($version_history = null, $current_version_to_add = null)
593 593
     {
594
-        if (! $version_history) {
594
+        if ( ! $version_history) {
595 595
             $version_history = $this->get_activation_history();
596 596
         }
597 597
         if ($current_version_to_add === null) {
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
      */
612 612
     public function get_activation_history_option_name()
613 613
     {
614
-        return self::ee_addon_version_history_option_prefix . $this->name();
614
+        return self::ee_addon_version_history_option_prefix.$this->name();
615 615
     }
616 616
 
617 617
 
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         // is admin and not in M-Mode ?
687 687
         if (is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
688 688
             add_filter('plugin_action_links', array($this, 'plugin_action_links'), 10, 2);
689
-            add_filter('after_plugin_row_' . $this->_plugin_basename, array($this, 'after_plugin_row'), 10, 3);
689
+            add_filter('after_plugin_row_'.$this->_plugin_basename, array($this, 'after_plugin_row'), 10, 3);
690 690
         }
691 691
     }
692 692
 
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
             // before other links
706 706
             array_unshift(
707 707
                 $links,
708
-                '<a href="admin.php?page=' . $this->plugin_action_slug() . '">'
708
+                '<a href="admin.php?page='.$this->plugin_action_slug().'">'
709 709
                 . esc_html__('Settings', 'event_espresso')
710 710
                 . '</a>'
711 711
             );
@@ -728,15 +728,15 @@  discard block
 block discarded – undo
728 728
     {
729 729
         $after_plugin_row = '';
730 730
         $plugins_page_row = $this->get_plugins_page_row();
731
-        if (! empty($plugins_page_row) && $plugin_file === $this->plugin_basename()) {
731
+        if ( ! empty($plugins_page_row) && $plugin_file === $this->plugin_basename()) {
732 732
             $class            = $status ? 'active' : 'inactive';
733 733
             $link_text        = isset($plugins_page_row['link_text']) ? $plugins_page_row['link_text'] : '';
734 734
             $link_url         = isset($plugins_page_row['link_url']) ? $plugins_page_row['link_url'] : '';
735 735
             $description      = isset($plugins_page_row['description'])
736 736
                 ? $plugins_page_row['description']
737 737
                 : '';
738
-            if (! empty($link_text) && ! empty($link_url) && ! empty($description)) {
739
-                $after_plugin_row .= '<tr id="' . sanitize_title($plugin_file) . '-ee-addon" class="' . $class . '">';
738
+            if ( ! empty($link_text) && ! empty($link_url) && ! empty($description)) {
739
+                $after_plugin_row .= '<tr id="'.sanitize_title($plugin_file).'-ee-addon" class="'.$class.'">';
740 740
                 $after_plugin_row .= '<th class="check-column" scope="row"></th>';
741 741
                 $after_plugin_row .= '<td class="ee-addon-upsell-info-title-td plugin-title column-primary">';
742 742
                 $after_plugin_row .= '<style>
@@ -778,7 +778,7 @@  discard block
 block discarded – undo
778 778
 </style>';
779 779
                 $after_plugin_row .= '
780 780
 <p class="ee-addon-upsell-info-dv">
781
-	<a class="ee-button" href="' . $link_url . '">'
781
+	<a class="ee-button" href="' . $link_url.'">'
782 782
                 . $link_text
783 783
                 . ' &nbsp;<span class="dashicons dashicons-arrow-right-alt2" style="margin:0;"></span>'
784 784
                 . '</a>
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Admin_Two_Column_Layout.strategy.php 2 patches
Indentation   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,81 +10,81 @@
 block discarded – undo
10 10
 class EE_Admin_Two_Column_Layout extends EE_Two_Column_Layout
11 11
 {
12 12
 
13
-    /**
14
-     * Overriding the parent table layout to include <tbody> tags
15
-     *
16
-     * @param array $additional_args
17
-     * @return string
18
-     */
19
-    public function layout_form_begin($additional_args = array())
20
-    {
21
-        $this->_form_section->set_html_class('form-table');
22
-        return parent::layout_form_begin($additional_args);
23
-    }
13
+	/**
14
+	 * Overriding the parent table layout to include <tbody> tags
15
+	 *
16
+	 * @param array $additional_args
17
+	 * @return string
18
+	 */
19
+	public function layout_form_begin($additional_args = array())
20
+	{
21
+		$this->_form_section->set_html_class('form-table');
22
+		return parent::layout_form_begin($additional_args);
23
+	}
24 24
 
25 25
 
26 26
 
27
-    /**
28
-     * Lays out a row for the subsection
29
-     *
30
-     * @param EE_Form_Section_Proper $form_section
31
-     * @return string
32
-     */
33
-    public function layout_subsection($form_section)
34
-    {
35
-        if ($form_section instanceof EE_Form_Section_Proper) {
36
-            return EEH_HTML::no_row($form_section->get_html());
37
-        }
38
-        if ($form_section instanceof EE_Form_Section_HTML) {
39
-            return EEH_HTML::no_row($form_section->get_html());
40
-        }
41
-        return '';
42
-    }
27
+	/**
28
+	 * Lays out a row for the subsection
29
+	 *
30
+	 * @param EE_Form_Section_Proper $form_section
31
+	 * @return string
32
+	 */
33
+	public function layout_subsection($form_section)
34
+	{
35
+		if ($form_section instanceof EE_Form_Section_Proper) {
36
+			return EEH_HTML::no_row($form_section->get_html());
37
+		}
38
+		if ($form_section instanceof EE_Form_Section_HTML) {
39
+			return EEH_HTML::no_row($form_section->get_html());
40
+		}
41
+		return '';
42
+	}
43 43
 
44 44
 
45 45
 
46
-    /**
47
-     * Lays out the row for the input, including label and errors
48
-     *
49
-     * @param EE_Form_Input_Base $input
50
-     * @return string
51
-     * @throws EE_Error
52
-     */
53
-    public function layout_input($input)
54
-    {
55
-        if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
56
-            || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57
-            || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58
-        ) {
59
-            $input->set_html_class($input->html_class() . ' large-text');
60
-        }
61
-        if ($input instanceof EE_Text_Area_Input) {
62
-            $input->set_rows(4);
63
-            $input->set_cols(60);
64
-        }
65
-        $input_html = $input->get_html_for_input();
66
-        // maybe add errors and help text ?
67
-        $input_html .= $input->get_html_for_errors() !== ''
68
-            ? EEH_HTML::nl() . $input->get_html_for_errors()
69
-            : '';
70
-        $input_html .= $input->get_html_for_help() !== ''
71
-            ? EEH_HTML::nl() . $input->get_html_for_help()
72
-            : '';
73
-        //overriding parent to add wp admin specific things.
74
-        $html = '';
75
-        if ($input instanceof EE_Hidden_Input) {
76
-            $html .= EEH_HTML::no_row($input->get_html_for_input());
77
-        } else {
78
-            $html .= EEH_HTML::tr(
79
-                EEH_HTML::th(
80
-                    $input->get_html_for_label(),
81
-                    '',
82
-                    '',
83
-                    '',
84
-                    'scope="row"'
85
-                ) . EEH_HTML::td($input_html)
86
-            );
87
-        }
88
-        return $html;
89
-    }
46
+	/**
47
+	 * Lays out the row for the input, including label and errors
48
+	 *
49
+	 * @param EE_Form_Input_Base $input
50
+	 * @return string
51
+	 * @throws EE_Error
52
+	 */
53
+	public function layout_input($input)
54
+	{
55
+		if ($input->get_display_strategy() instanceof EE_Text_Area_Display_Strategy
56
+			|| $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57
+			|| $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58
+		) {
59
+			$input->set_html_class($input->html_class() . ' large-text');
60
+		}
61
+		if ($input instanceof EE_Text_Area_Input) {
62
+			$input->set_rows(4);
63
+			$input->set_cols(60);
64
+		}
65
+		$input_html = $input->get_html_for_input();
66
+		// maybe add errors and help text ?
67
+		$input_html .= $input->get_html_for_errors() !== ''
68
+			? EEH_HTML::nl() . $input->get_html_for_errors()
69
+			: '';
70
+		$input_html .= $input->get_html_for_help() !== ''
71
+			? EEH_HTML::nl() . $input->get_html_for_help()
72
+			: '';
73
+		//overriding parent to add wp admin specific things.
74
+		$html = '';
75
+		if ($input instanceof EE_Hidden_Input) {
76
+			$html .= EEH_HTML::no_row($input->get_html_for_input());
77
+		} else {
78
+			$html .= EEH_HTML::tr(
79
+				EEH_HTML::th(
80
+					$input->get_html_for_label(),
81
+					'',
82
+					'',
83
+					'',
84
+					'scope="row"'
85
+				) . EEH_HTML::td($input_html)
86
+			);
87
+		}
88
+		return $html;
89
+	}
90 90
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             || $input->get_display_strategy() instanceof EE_Text_Input_Display_Strategy
57 57
             || $input->get_display_strategy() instanceof EE_Admin_File_Uploader_Display_Strategy
58 58
         ) {
59
-            $input->set_html_class($input->html_class() . ' large-text');
59
+            $input->set_html_class($input->html_class().' large-text');
60 60
         }
61 61
         if ($input instanceof EE_Text_Area_Input) {
62 62
             $input->set_rows(4);
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
         $input_html = $input->get_html_for_input();
66 66
         // maybe add errors and help text ?
67 67
         $input_html .= $input->get_html_for_errors() !== ''
68
-            ? EEH_HTML::nl() . $input->get_html_for_errors()
68
+            ? EEH_HTML::nl().$input->get_html_for_errors()
69 69
             : '';
70 70
         $input_html .= $input->get_html_for_help() !== ''
71
-            ? EEH_HTML::nl() . $input->get_html_for_help()
71
+            ? EEH_HTML::nl().$input->get_html_for_help()
72 72
             : '';
73 73
         //overriding parent to add wp admin specific things.
74 74
         $html = '';
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                     '',
83 83
                     '',
84 84
                     'scope="row"'
85
-                ) . EEH_HTML::td($input_html)
85
+                ).EEH_HTML::td($input_html)
86 86
             );
87 87
         }
88 88
         return $html;
Please login to merge, or discard this patch.
form_sections/strategies/layout/EE_Form_Section_Layout_Base.strategy.php 2 patches
Indentation   +253 added lines, -253 removed lines patch added patch discarded remove patch
@@ -15,257 +15,257 @@
 block discarded – undo
15 15
 abstract class EE_Form_Section_Layout_Base
16 16
 {
17 17
 
18
-    /**
19
-     * Form form section to lay out
20
-     *
21
-     * @var EE_Form_Section_Proper
22
-     */
23
-    protected $_form_section;
24
-
25
-
26
-
27
-    /**
28
-     *  __construct
29
-     */
30
-    public function __construct()
31
-    {
32
-    }
33
-
34
-
35
-
36
-    /**
37
-     * The form section on which this strategy is to perform
38
-     *
39
-     * @param EE_Form_Section_Proper $form
40
-     */
41
-    public function _construct_finalize(EE_Form_Section_Proper $form)
42
-    {
43
-        $this->_form_section = $form;
44
-    }
45
-
46
-
47
-
48
-    /**
49
-     * @return EE_Form_Section_Proper
50
-     */
51
-    public function form_section()
52
-    {
53
-        return $this->_form_section;
54
-    }
55
-
56
-
57
-
58
-    /**
59
-     * Also has teh side effect of enqueuing any needed JS and CSS for
60
-     * this form.
61
-     * Creates all the HTML necessary for displaying this form, its inputs, and
62
-     * proper subsections.
63
-     * Returns the HTML
64
-     *
65
-     * @return string HTML for displaying
66
-     * @throws EE_Error
67
-     */
68
-    public function layout_form()
69
-    {
70
-        $html = '';
71
-        // layout_form_begin
72
-        $html .= apply_filters(
73
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
74
-            $this->layout_form_begin(),
75
-            $this->_form_section
76
-        );
77
-        // layout_form_loop
78
-        $html .= apply_filters(
79
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
80
-            $this->layout_form_loop(),
81
-            $this->_form_section
82
-        );
83
-        // layout_form_end
84
-        $html .= apply_filters(
85
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
86
-            $this->layout_form_end(),
87
-            $this->_form_section
88
-        );
89
-        $html = $this->add_form_section_hooks_and_filters($html);
90
-        return $html;
91
-    }
92
-
93
-
94
-
95
-    /**
96
-     * @return string
97
-     * @throws EE_Error
98
-     */
99
-    public function layout_form_loop()
100
-    {
101
-        $html = '';
102
-        foreach ($this->_form_section->subsections() as $name => $subsection) {
103
-            if ($subsection instanceof EE_Form_Input_Base) {
104
-                $html .= apply_filters(
105
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
-                    . $name . '__in_' . $this->_form_section->name(),
107
-                    $this->layout_input($subsection),
108
-                    $this->_form_section,
109
-                    $subsection
110
-                );
111
-            } elseif ($subsection instanceof EE_Form_Section_Base) {
112
-                $html .= apply_filters(
113
-                    'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
-                    . $name . '__in_' . $this->_form_section->name(),
115
-                    $this->layout_subsection($subsection),
116
-                    $this->_form_section,
117
-                    $subsection
118
-                );
119
-            }
120
-        }
121
-        return $html;
122
-    }
123
-
124
-
125
-
126
-    /**
127
-     * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
128
-     *
129
-     * @return string
130
-     */
131
-    abstract public function layout_form_begin();
132
-
133
-
134
-
135
-    /**
136
-     * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
137
-     *
138
-     * @return string
139
-     */
140
-    abstract public function layout_form_end();
141
-
142
-
143
-
144
-    /**
145
-     * Should be used internally by layout_form() to layout each input (eg, if this layout
146
-     * is putting each input in a row of its own, this should probably be called by a
147
-     *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
148
-     * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
149
-     * customize the form's layout, but would like to make use of it for laying out
150
-     * 'easy-to-layout' inputs
151
-     *
152
-     * @param EE_Form_Input_Base $input
153
-     * @return string html
154
-     */
155
-    abstract public function layout_input($input);
156
-
157
-
158
-
159
-    /**
160
-     * Similar to layout_input(), should be used internally by layout_form() within a
161
-     * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
162
-     * that the proper subsection will layout its container, label, etc on its own.
163
-     *
164
-     * @param EE_Form_Section_Base $subsection
165
-     * @return string html
166
-     */
167
-    abstract public function layout_subsection($subsection);
168
-
169
-
170
-
171
-    /**
172
-     * Gets the HTML for the label tag and its contents for the input
173
-     *
174
-     * @param EE_Form_Input_Base $input
175
-     * @return string
176
-     */
177
-    public function display_label($input)
178
-    {
179
-        $class = $input->required()
180
-            ? 'ee-required-label ' . $input->html_label_class()
181
-            : $input->html_label_class();
182
-        $label_text = $input->required()
183
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
184
-            : $input->html_label_text();
185
-        return '<label id="'
186
-               . $input->html_label_id()
187
-               . '" class="'
188
-               . $class
189
-               . '" style="'
190
-               . $input->html_label_style()
191
-               . '" for="' . $input->html_name()
192
-               . '">'
193
-               . $label_text
194
-               . '</label>';
195
-    }
196
-
197
-
198
-
199
-    /**
200
-     * returns the HTML for the server-side validation errors for the specified input
201
-     * Note that if JS is enabled, it should remove these and instead
202
-     * populate the form's errors in the jquery validate fashion
203
-     * using the localized data provided to the JS
204
-     *
205
-     * @param EE_Form_Input_Base $input
206
-     * @return string
207
-     */
208
-    public function display_errors($input)
209
-    {
210
-        if ($input->get_validation_errors()) {
211
-            return "<label  id='"
212
-                   . $input->html_id()
213
-                   . "-error' class='error' for='{$input->html_name()}'>"
214
-                   . $input->get_validation_error_string()
215
-                   . '</label>';
216
-        }
217
-        return '';
218
-    }
219
-
220
-
221
-
222
-    /**
223
-     * Displays the help span for the specified input
224
-     *
225
-     * @param EE_Form_Input_Base $input
226
-     * @return string
227
-     */
228
-    public function display_help_text($input)
229
-    {
230
-        if ($input->html_help_text() !== '') {
231
-            $tag = is_admin() ? 'p' : 'span';
232
-            return '<'
233
-                   . $tag
234
-                   . ' id="'
235
-                   . $input->html_id()
236
-                   . '-help" class="'
237
-                   . $input->html_help_class()
238
-                   . '" style="'
239
-                   . $input->html_help_style()
240
-                   . '">'
241
-                   . $input->html_help_text()
242
-                   . '</'
243
-                   . $tag
244
-                   . '>';
245
-        }
246
-        return '';
247
-    }
248
-
249
-
250
-
251
-    /**
252
-     * Does an action and hook onto the end of teh form
253
-     *
254
-     * @param string $html
255
-     * @return string
256
-     */
257
-    public function add_form_section_hooks_and_filters($html)
258
-    {
259
-        // replace dashes and spaces with underscores
260
-        $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
262
-        $html = (string) apply_filters(
263
-            'AFEE__Form_Section_Layout__' . $hook_name . '__html',
264
-            $html,
265
-            $this->_form_section
266
-        );
267
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
269
-        return $html;
270
-    }
18
+	/**
19
+	 * Form form section to lay out
20
+	 *
21
+	 * @var EE_Form_Section_Proper
22
+	 */
23
+	protected $_form_section;
24
+
25
+
26
+
27
+	/**
28
+	 *  __construct
29
+	 */
30
+	public function __construct()
31
+	{
32
+	}
33
+
34
+
35
+
36
+	/**
37
+	 * The form section on which this strategy is to perform
38
+	 *
39
+	 * @param EE_Form_Section_Proper $form
40
+	 */
41
+	public function _construct_finalize(EE_Form_Section_Proper $form)
42
+	{
43
+		$this->_form_section = $form;
44
+	}
45
+
46
+
47
+
48
+	/**
49
+	 * @return EE_Form_Section_Proper
50
+	 */
51
+	public function form_section()
52
+	{
53
+		return $this->_form_section;
54
+	}
55
+
56
+
57
+
58
+	/**
59
+	 * Also has teh side effect of enqueuing any needed JS and CSS for
60
+	 * this form.
61
+	 * Creates all the HTML necessary for displaying this form, its inputs, and
62
+	 * proper subsections.
63
+	 * Returns the HTML
64
+	 *
65
+	 * @return string HTML for displaying
66
+	 * @throws EE_Error
67
+	 */
68
+	public function layout_form()
69
+	{
70
+		$html = '';
71
+		// layout_form_begin
72
+		$html .= apply_filters(
73
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
74
+			$this->layout_form_begin(),
75
+			$this->_form_section
76
+		);
77
+		// layout_form_loop
78
+		$html .= apply_filters(
79
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
80
+			$this->layout_form_loop(),
81
+			$this->_form_section
82
+		);
83
+		// layout_form_end
84
+		$html .= apply_filters(
85
+			'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
86
+			$this->layout_form_end(),
87
+			$this->_form_section
88
+		);
89
+		$html = $this->add_form_section_hooks_and_filters($html);
90
+		return $html;
91
+	}
92
+
93
+
94
+
95
+	/**
96
+	 * @return string
97
+	 * @throws EE_Error
98
+	 */
99
+	public function layout_form_loop()
100
+	{
101
+		$html = '';
102
+		foreach ($this->_form_section->subsections() as $name => $subsection) {
103
+			if ($subsection instanceof EE_Form_Input_Base) {
104
+				$html .= apply_filters(
105
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
+					. $name . '__in_' . $this->_form_section->name(),
107
+					$this->layout_input($subsection),
108
+					$this->_form_section,
109
+					$subsection
110
+				);
111
+			} elseif ($subsection instanceof EE_Form_Section_Base) {
112
+				$html .= apply_filters(
113
+					'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
+					. $name . '__in_' . $this->_form_section->name(),
115
+					$this->layout_subsection($subsection),
116
+					$this->_form_section,
117
+					$subsection
118
+				);
119
+			}
120
+		}
121
+		return $html;
122
+	}
123
+
124
+
125
+
126
+	/**
127
+	 * Should be used to start teh form section (Eg a table tag, or a div tag, etc.)
128
+	 *
129
+	 * @return string
130
+	 */
131
+	abstract public function layout_form_begin();
132
+
133
+
134
+
135
+	/**
136
+	 * Should be used to end the form section (eg a /table tag, or a /div tag, etc)
137
+	 *
138
+	 * @return string
139
+	 */
140
+	abstract public function layout_form_end();
141
+
142
+
143
+
144
+	/**
145
+	 * Should be used internally by layout_form() to layout each input (eg, if this layout
146
+	 * is putting each input in a row of its own, this should probably be called by a
147
+	 *  foreach loop in layout_form() (WITHOUT adding any content directly within layout_form()'s foreach loop.
148
+	 * Eg, this method should add the tr and td tags). This method is exposed in case you want to completely
149
+	 * customize the form's layout, but would like to make use of it for laying out
150
+	 * 'easy-to-layout' inputs
151
+	 *
152
+	 * @param EE_Form_Input_Base $input
153
+	 * @return string html
154
+	 */
155
+	abstract public function layout_input($input);
156
+
157
+
158
+
159
+	/**
160
+	 * Similar to layout_input(), should be used internally by layout_form() within a
161
+	 * loop to layout each proper subsection. Unlike layout_input(), however, it is assumed
162
+	 * that the proper subsection will layout its container, label, etc on its own.
163
+	 *
164
+	 * @param EE_Form_Section_Base $subsection
165
+	 * @return string html
166
+	 */
167
+	abstract public function layout_subsection($subsection);
168
+
169
+
170
+
171
+	/**
172
+	 * Gets the HTML for the label tag and its contents for the input
173
+	 *
174
+	 * @param EE_Form_Input_Base $input
175
+	 * @return string
176
+	 */
177
+	public function display_label($input)
178
+	{
179
+		$class = $input->required()
180
+			? 'ee-required-label ' . $input->html_label_class()
181
+			: $input->html_label_class();
182
+		$label_text = $input->required()
183
+			? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
184
+			: $input->html_label_text();
185
+		return '<label id="'
186
+			   . $input->html_label_id()
187
+			   . '" class="'
188
+			   . $class
189
+			   . '" style="'
190
+			   . $input->html_label_style()
191
+			   . '" for="' . $input->html_name()
192
+			   . '">'
193
+			   . $label_text
194
+			   . '</label>';
195
+	}
196
+
197
+
198
+
199
+	/**
200
+	 * returns the HTML for the server-side validation errors for the specified input
201
+	 * Note that if JS is enabled, it should remove these and instead
202
+	 * populate the form's errors in the jquery validate fashion
203
+	 * using the localized data provided to the JS
204
+	 *
205
+	 * @param EE_Form_Input_Base $input
206
+	 * @return string
207
+	 */
208
+	public function display_errors($input)
209
+	{
210
+		if ($input->get_validation_errors()) {
211
+			return "<label  id='"
212
+				   . $input->html_id()
213
+				   . "-error' class='error' for='{$input->html_name()}'>"
214
+				   . $input->get_validation_error_string()
215
+				   . '</label>';
216
+		}
217
+		return '';
218
+	}
219
+
220
+
221
+
222
+	/**
223
+	 * Displays the help span for the specified input
224
+	 *
225
+	 * @param EE_Form_Input_Base $input
226
+	 * @return string
227
+	 */
228
+	public function display_help_text($input)
229
+	{
230
+		if ($input->html_help_text() !== '') {
231
+			$tag = is_admin() ? 'p' : 'span';
232
+			return '<'
233
+				   . $tag
234
+				   . ' id="'
235
+				   . $input->html_id()
236
+				   . '-help" class="'
237
+				   . $input->html_help_class()
238
+				   . '" style="'
239
+				   . $input->html_help_style()
240
+				   . '">'
241
+				   . $input->html_help_text()
242
+				   . '</'
243
+				   . $tag
244
+				   . '>';
245
+		}
246
+		return '';
247
+	}
248
+
249
+
250
+
251
+	/**
252
+	 * Does an action and hook onto the end of teh form
253
+	 *
254
+	 * @param string $html
255
+	 * @return string
256
+	 */
257
+	public function add_form_section_hooks_and_filters($html)
258
+	{
259
+		// replace dashes and spaces with underscores
260
+		$hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
+		do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
262
+		$html = (string) apply_filters(
263
+			'AFEE__Form_Section_Layout__' . $hook_name . '__html',
264
+			$html,
265
+			$this->_form_section
266
+		);
267
+		$html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
+		$html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
269
+		return $html;
270
+	}
271 271
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
         $html = '';
71 71
         // layout_form_begin
72 72
         $html .= apply_filters(
73
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_' . $this->_form_section->name(),
73
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__start__for_'.$this->_form_section->name(),
74 74
             $this->layout_form_begin(),
75 75
             $this->_form_section
76 76
         );
77 77
         // layout_form_loop
78 78
         $html .= apply_filters(
79
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_' . $this->_form_section->name(),
79
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__loop__for_'.$this->_form_section->name(),
80 80
             $this->layout_form_loop(),
81 81
             $this->_form_section
82 82
         );
83 83
         // layout_form_end
84 84
         $html .= apply_filters(
85
-            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_' . $this->_form_section->name(),
85
+            'FHEE__EE_Form_Section_Layout_Base__layout_form__end__for_'.$this->_form_section->name(),
86 86
             $this->layout_form_end(),
87 87
             $this->_form_section
88 88
         );
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             if ($subsection instanceof EE_Form_Input_Base) {
104 104
                 $html .= apply_filters(
105 105
                     'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_input_'
106
-                    . $name . '__in_' . $this->_form_section->name(),
106
+                    . $name.'__in_'.$this->_form_section->name(),
107 107
                     $this->layout_input($subsection),
108 108
                     $this->_form_section,
109 109
                     $subsection
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
             } elseif ($subsection instanceof EE_Form_Section_Base) {
112 112
                 $html .= apply_filters(
113 113
                     'FHEE__EE_Form_Section_Layout_Base__layout_form__loop_for_non_input_'
114
-                    . $name . '__in_' . $this->_form_section->name(),
114
+                    . $name.'__in_'.$this->_form_section->name(),
115 115
                     $this->layout_subsection($subsection),
116 116
                     $this->_form_section,
117 117
                     $subsection
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
     public function display_label($input)
178 178
     {
179 179
         $class = $input->required()
180
-            ? 'ee-required-label ' . $input->html_label_class()
180
+            ? 'ee-required-label '.$input->html_label_class()
181 181
             : $input->html_label_class();
182 182
         $label_text = $input->required()
183
-            ? $input->html_label_text() . '<span class="ee-asterisk">*</span>'
183
+            ? $input->html_label_text().'<span class="ee-asterisk">*</span>'
184 184
             : $input->html_label_text();
185 185
         return '<label id="'
186 186
                . $input->html_label_id()
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                . $class
189 189
                . '" style="'
190 190
                . $input->html_label_style()
191
-               . '" for="' . $input->html_name()
191
+               . '" for="'.$input->html_name()
192 192
                . '">'
193 193
                . $label_text
194 194
                . '</label>';
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
     {
259 259
         // replace dashes and spaces with underscores
260 260
         $hook_name = str_replace(array('-', ' '), '_', $this->_form_section->html_id());
261
-        do_action('AHEE__Form_Section_Layout__' . $hook_name, $this->_form_section);
261
+        do_action('AHEE__Form_Section_Layout__'.$hook_name, $this->_form_section);
262 262
         $html = (string) apply_filters(
263
-            'AFEE__Form_Section_Layout__' . $hook_name . '__html',
263
+            'AFEE__Form_Section_Layout__'.$hook_name.'__html',
264 264
             $html,
265 265
             $this->_form_section
266 266
         );
267
-        $html .= EEH_HTML::nl() . '<!-- AHEE__Form_Section_Layout__' . $hook_name . '__html -->';
268
-        $html .= EEH_HTML::nl() . '<!-- AFEE__Form_Section_Layout__' . $hook_name . ' -->';
267
+        $html .= EEH_HTML::nl().'<!-- AHEE__Form_Section_Layout__'.$hook_name.'__html -->';
268
+        $html .= EEH_HTML::nl().'<!-- AFEE__Form_Section_Layout__'.$hook_name.' -->';
269 269
         return $html;
270 270
     }
271 271
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/strategies/filter/VsprintfFilter.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,49 +24,49 @@
 block discarded – undo
24 24
 class VsprintfFilter extends FormHtmlFilter
25 25
 {
26 26
 
27
-    /**
28
-     * @var string $format
29
-     */
30
-    protected $format = '';
31
-
32
-
33
-    /**
34
-     * @var array $args
35
-     */
36
-    protected $args = array();
37
-
38
-
39
-
40
-    /**
41
-     * VsprintfFilter constructor.
42
-     *
43
-     * @param string $format
44
-     * @param array  $args
45
-     */
46
-    public function __construct($format, array $args)
47
-    {
48
-        $this->format = $format;
49
-        $this->args   = $args;
50
-    }
51
-
52
-
53
-
54
-    /**
55
-     * @param                             $html
56
-     * @param EE_Form_Section_Validatable $form_section
57
-     * @return string
58
-     */
59
-    public function filterHtml($html, EE_Form_Section_Validatable $form_section)
60
-    {
61
-        $this->args[] = $html;
62
-        if ($form_section instanceof EE_Form_Section_Proper) {
63
-            $subsections = $form_section->subsections();
64
-            foreach ((array)$subsections as $subsection) {
65
-                $this->args[] = $subsection->get_html();
66
-            }
67
-        }
68
-        return vsprintf($this->format, $this->args);
69
-    }
27
+	/**
28
+	 * @var string $format
29
+	 */
30
+	protected $format = '';
31
+
32
+
33
+	/**
34
+	 * @var array $args
35
+	 */
36
+	protected $args = array();
37
+
38
+
39
+
40
+	/**
41
+	 * VsprintfFilter constructor.
42
+	 *
43
+	 * @param string $format
44
+	 * @param array  $args
45
+	 */
46
+	public function __construct($format, array $args)
47
+	{
48
+		$this->format = $format;
49
+		$this->args   = $args;
50
+	}
51
+
52
+
53
+
54
+	/**
55
+	 * @param                             $html
56
+	 * @param EE_Form_Section_Validatable $form_section
57
+	 * @return string
58
+	 */
59
+	public function filterHtml($html, EE_Form_Section_Validatable $form_section)
60
+	{
61
+		$this->args[] = $html;
62
+		if ($form_section instanceof EE_Form_Section_Proper) {
63
+			$subsections = $form_section->subsections();
64
+			foreach ((array)$subsections as $subsection) {
65
+				$this->args[] = $subsection->get_html();
66
+			}
67
+		}
68
+		return vsprintf($this->format, $this->args);
69
+	}
70 70
 
71 71
 
72 72
 
Please login to merge, or discard this patch.
form_sections/strategies/display/EE_Checkbox_Display_Strategy.strategy.php 2 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -15,61 +15,61 @@
 block discarded – undo
15 15
 class EE_Checkbox_Display_Strategy extends EE_Compound_Input_Display_Strategy
16 16
 {
17 17
 
18
-    /**
19
-     * @throws EE_Error
20
-     * @return string of html to display the field
21
-     */
22
-    public function display()
23
-    {
24
-        $input = $this->get_input();
25
-        $multi = count($input->options()) > 1;
26
-        $input->set_label_sizes();
27
-        $label_size_class = $input->get_label_size_class();
28
-        $html             = '';
29
-        if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
30
-            EE_Error::doing_it_wrong(
31
-                'EE_Checkbox_Display_Strategy::display()',
32
-                sprintf(
33
-                    esc_html__(
34
-                        'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
35
-                        'event_espresso'
36
-                    ),
37
-                    $input->html_id(),
38
-                    var_export($input->raw_value(), true),
39
-                    $input->html_name() . '[]'
40
-                ),
41
-                '4.8.1'
42
-            );
43
-        }
44
-        $input_raw_value = (array)$input->raw_value();
45
-        foreach ($input->options() as $value => $display_text) {
46
-            $value = $input->get_normalization_strategy()->unnormalize_one($value);
47
-            $html_id = $this->get_sub_input_id($value);
48
-            $html .= EEH_HTML::nl(0, 'checkbox');
49
-            $html .= '<label for="'
50
-                     . $html_id
51
-                     . '" id="'
52
-                     . $html_id
53
-                     . '-lbl" class="ee-checkbox-label-after'
54
-                     . $label_size_class
55
-                     . '">';
56
-            $html .= EEH_HTML::nl(1, 'checkbox');
57
-            $html .= '<input type="checkbox"';
58
-            $html .= ' name="' . $input->html_name() . '[]"';
59
-            $html .= ' id="' . $html_id . '"';
60
-            $html .= ' class="' . $input->html_class() . '"';
61
-            $html .= ' style="' . $input->html_style() . '"';
62
-            $html .= ' value="' . esc_attr($value) . '"';
63
-            $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64
-                ? ' checked="checked"'
65
-                : '';
66
-            $html .= ' ' . $this->_input->other_html_attributes();
67
-            $html .= '>&nbsp;';
68
-            $html .= $display_text;
69
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
70
-        }
71
-        return $html;
72
-    }
18
+	/**
19
+	 * @throws EE_Error
20
+	 * @return string of html to display the field
21
+	 */
22
+	public function display()
23
+	{
24
+		$input = $this->get_input();
25
+		$multi = count($input->options()) > 1;
26
+		$input->set_label_sizes();
27
+		$label_size_class = $input->get_label_size_class();
28
+		$html             = '';
29
+		if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
30
+			EE_Error::doing_it_wrong(
31
+				'EE_Checkbox_Display_Strategy::display()',
32
+				sprintf(
33
+					esc_html__(
34
+						'Input values for checkboxes should be an array of values, but the value for input "%1$s" is "%2$s". Please verify that the input name is exactly "%3$s"',
35
+						'event_espresso'
36
+					),
37
+					$input->html_id(),
38
+					var_export($input->raw_value(), true),
39
+					$input->html_name() . '[]'
40
+				),
41
+				'4.8.1'
42
+			);
43
+		}
44
+		$input_raw_value = (array)$input->raw_value();
45
+		foreach ($input->options() as $value => $display_text) {
46
+			$value = $input->get_normalization_strategy()->unnormalize_one($value);
47
+			$html_id = $this->get_sub_input_id($value);
48
+			$html .= EEH_HTML::nl(0, 'checkbox');
49
+			$html .= '<label for="'
50
+					 . $html_id
51
+					 . '" id="'
52
+					 . $html_id
53
+					 . '-lbl" class="ee-checkbox-label-after'
54
+					 . $label_size_class
55
+					 . '">';
56
+			$html .= EEH_HTML::nl(1, 'checkbox');
57
+			$html .= '<input type="checkbox"';
58
+			$html .= ' name="' . $input->html_name() . '[]"';
59
+			$html .= ' id="' . $html_id . '"';
60
+			$html .= ' class="' . $input->html_class() . '"';
61
+			$html .= ' style="' . $input->html_style() . '"';
62
+			$html .= ' value="' . esc_attr($value) . '"';
63
+			$html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64
+				? ' checked="checked"'
65
+				: '';
66
+			$html .= ' ' . $this->_input->other_html_attributes();
67
+			$html .= '>&nbsp;';
68
+			$html .= $display_text;
69
+			$html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
70
+		}
71
+		return $html;
72
+	}
73 73
 
74 74
 
75 75
 
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         $input->set_label_sizes();
27 27
         $label_size_class = $input->get_label_size_class();
28 28
         $html             = '';
29
-        if (! is_array($input->raw_value()) && $input->raw_value() !== null) {
29
+        if ( ! is_array($input->raw_value()) && $input->raw_value() !== null) {
30 30
             EE_Error::doing_it_wrong(
31 31
                 'EE_Checkbox_Display_Strategy::display()',
32 32
                 sprintf(
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
                     ),
37 37
                     $input->html_id(),
38 38
                     var_export($input->raw_value(), true),
39
-                    $input->html_name() . '[]'
39
+                    $input->html_name().'[]'
40 40
                 ),
41 41
                 '4.8.1'
42 42
             );
43 43
         }
44
-        $input_raw_value = (array)$input->raw_value();
44
+        $input_raw_value = (array) $input->raw_value();
45 45
         foreach ($input->options() as $value => $display_text) {
46 46
             $value = $input->get_normalization_strategy()->unnormalize_one($value);
47 47
             $html_id = $this->get_sub_input_id($value);
@@ -55,18 +55,18 @@  discard block
 block discarded – undo
55 55
                      . '">';
56 56
             $html .= EEH_HTML::nl(1, 'checkbox');
57 57
             $html .= '<input type="checkbox"';
58
-            $html .= ' name="' . $input->html_name() . '[]"';
59
-            $html .= ' id="' . $html_id . '"';
60
-            $html .= ' class="' . $input->html_class() . '"';
61
-            $html .= ' style="' . $input->html_style() . '"';
62
-            $html .= ' value="' . esc_attr($value) . '"';
58
+            $html .= ' name="'.$input->html_name().'[]"';
59
+            $html .= ' id="'.$html_id.'"';
60
+            $html .= ' class="'.$input->html_class().'"';
61
+            $html .= ' style="'.$input->html_style().'"';
62
+            $html .= ' value="'.esc_attr($value).'"';
63 63
             $html .= ! empty($input_raw_value) && in_array($value, $input_raw_value, true)
64 64
                 ? ' checked="checked"'
65 65
                 : '';
66
-            $html .= ' ' . $this->_input->other_html_attributes();
66
+            $html .= ' '.$this->_input->other_html_attributes();
67 67
             $html .= '>&nbsp;';
68 68
             $html .= $display_text;
69
-            $html .= EEH_HTML::nl(-1, 'checkbox') . '</label>';
69
+            $html .= EEH_HTML::nl(-1, 'checkbox').'</label>';
70 70
         }
71 71
         return $html;
72 72
     }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Radio_Button_Input.input.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -15,22 +15,22 @@
 block discarded – undo
15 15
 class EE_Radio_Button_Input extends EE_Form_Input_With_Options_Base
16 16
 {
17 17
 
18
-    /**
19
-     * @param array $answer_options
20
-     * @param array $input_settings
21
-     */
22
-    public function __construct($answer_options, $input_settings = array())
23
-    {
24
-        $this->_set_display_strategy(new EE_Radio_Button_Display_Strategy());
25
-        $this->_add_validation_strategy(
26
-            new EE_Enum_Validation_Strategy(
27
-                isset($input_settings['validation_error_message'])
28
-                    ? $input_settings['validation_error_message']
29
-                    : null
30
-            )
31
-        );
32
-        $this->_multiple_selections = false;
33
-        parent::__construct($answer_options, $input_settings);
34
-    }
18
+	/**
19
+	 * @param array $answer_options
20
+	 * @param array $input_settings
21
+	 */
22
+	public function __construct($answer_options, $input_settings = array())
23
+	{
24
+		$this->_set_display_strategy(new EE_Radio_Button_Display_Strategy());
25
+		$this->_add_validation_strategy(
26
+			new EE_Enum_Validation_Strategy(
27
+				isset($input_settings['validation_error_message'])
28
+					? $input_settings['validation_error_message']
29
+					: null
30
+			)
31
+		);
32
+		$this->_multiple_selections = false;
33
+		parent::__construct($answer_options, $input_settings);
34
+	}
35 35
 
36 36
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/inputs/EE_Datepicker_Input.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -13,47 +13,47 @@
 block discarded – undo
13 13
 class EE_Datepicker_Input extends EE_Form_Input_Base
14 14
 {
15 15
 
16
-    /**
17
-     * @param array $input_settings
18
-     */
19
-    public function __construct($input_settings = array())
20
-    {
21
-        $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker'));
22
-        $this->_set_normalization_strategy(new EE_Text_Normalization());
23
-        //we could do better for validation, but at least verify its plaintext
24
-        $this->_add_validation_strategy(
25
-            new EE_Plaintext_Validation_Strategy(
26
-                isset($input_settings['validation_error_message'])
27
-                    ? $input_settings['validation_error_message']
28
-                    : null
29
-            )
30
-        );
31
-        parent::__construct($input_settings);
32
-        $this->set_html_class($this->html_class() . ' datepicker');
33
-        // add some style and make it dance
34
-        add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35
-        add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
36
-    }
37
-
38
-
39
-
40
-    /**
41
-     *    enqueue_styles_and_scripts
42
-     *
43
-     * @access        public
44
-     * @return        void
45
-     */
46
-    public static function enqueue_styles_and_scripts()
47
-    {
48
-        // load css
49
-        wp_register_style(
50
-            'espresso-ui-theme',
51
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52
-            array(),
53
-            EVENT_ESPRESSO_VERSION
54
-        );
55
-        wp_enqueue_style('espresso-ui-theme');
56
-    }
16
+	/**
17
+	 * @param array $input_settings
18
+	 */
19
+	public function __construct($input_settings = array())
20
+	{
21
+		$this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker'));
22
+		$this->_set_normalization_strategy(new EE_Text_Normalization());
23
+		//we could do better for validation, but at least verify its plaintext
24
+		$this->_add_validation_strategy(
25
+			new EE_Plaintext_Validation_Strategy(
26
+				isset($input_settings['validation_error_message'])
27
+					? $input_settings['validation_error_message']
28
+					: null
29
+			)
30
+		);
31
+		parent::__construct($input_settings);
32
+		$this->set_html_class($this->html_class() . ' datepicker');
33
+		// add some style and make it dance
34
+		add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35
+		add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
36
+	}
37
+
38
+
39
+
40
+	/**
41
+	 *    enqueue_styles_and_scripts
42
+	 *
43
+	 * @access        public
44
+	 * @return        void
45
+	 */
46
+	public static function enqueue_styles_and_scripts()
47
+	{
48
+		// load css
49
+		wp_register_style(
50
+			'espresso-ui-theme',
51
+			EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52
+			array(),
53
+			EVENT_ESPRESSO_VERSION
54
+		);
55
+		wp_enqueue_style('espresso-ui-theme');
56
+	}
57 57
 
58 58
 
59 59
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
             )
30 30
         );
31 31
         parent::__construct($input_settings);
32
-        $this->set_html_class($this->html_class() . ' datepicker');
32
+        $this->set_html_class($this->html_class().' datepicker');
33 33
         // add some style and make it dance
34 34
         add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
35 35
         add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts'));
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         // load css
49 49
         wp_register_style(
50 50
             'espresso-ui-theme',
51
-            EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
51
+            EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css',
52 52
             array(),
53 53
             EVENT_ESPRESSO_VERSION
54 54
         );
Please login to merge, or discard this patch.
core/business/EE_Registration_Processor.class.php 2 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -188,28 +188,28 @@  discard block
 block discarded – undo
188 188
 
189 189
 
190 190
 
191
-    /**
192
-     *    toggle_incomplete_registration_status_to_default
193
-     *        changes any incomplete registrations to either the event or global default registration status
194
-     *
195
-     * @access public
196
-     * @param EE_Registration $registration
197
-     * @param bool            $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code
198
-     * @param Context|null    $context
199
-     * @return void
200
-     * @throws EE_Error
201
-     * @throws InvalidArgumentException
202
-     * @throws ReflectionException
203
-     * @throws RuntimeException
204
-     * @throws EntityNotFoundException
205
-     * @throws InvalidDataTypeException
206
-     * @throws InvalidInterfaceException
207
-     */
191
+	/**
192
+	 *    toggle_incomplete_registration_status_to_default
193
+	 *        changes any incomplete registrations to either the event or global default registration status
194
+	 *
195
+	 * @access public
196
+	 * @param EE_Registration $registration
197
+	 * @param bool            $save TRUE will save the registration if the status is updated, FALSE will leave that up to client code
198
+	 * @param Context|null    $context
199
+	 * @return void
200
+	 * @throws EE_Error
201
+	 * @throws InvalidArgumentException
202
+	 * @throws ReflectionException
203
+	 * @throws RuntimeException
204
+	 * @throws EntityNotFoundException
205
+	 * @throws InvalidDataTypeException
206
+	 * @throws InvalidInterfaceException
207
+	 */
208 208
 	public function toggle_incomplete_registration_status_to_default(
209
-	    EE_Registration $registration,
210
-        $save = true,
211
-        Context $context = null
212
-    ) {
209
+		EE_Registration $registration,
210
+		$save = true,
211
+		Context $context = null
212
+	) {
213 213
 		$existing_reg_status = $registration->status_ID();
214 214
 		// set initial REG_Status
215 215
 		$this->set_old_reg_status( $registration->ID(), $existing_reg_status );
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 			}
232 232
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
233 233
 			if ( ! EE_Processor_Base::$IPN ) {
234
-                // otherwise, send out notifications
234
+				// otherwise, send out notifications
235 235
 				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
236 236
 			}
237 237
 			// DEBUG LOG
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 			}
279 279
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
280 280
 			if ( ! EE_Processor_Base::$IPN ) {
281
-                // otherwise, send out notifications
281
+				// otherwise, send out notifications
282 282
 				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
283 283
 			}
284 284
 			// DEBUG LOG
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			}
366 366
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
367 367
 			if ( ! EE_Processor_Base::$IPN ) {
368
-                // otherwise, send out notifications
368
+				// otherwise, send out notifications
369 369
 				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
370 370
 			}
371 371
 			// DEBUG LOG
@@ -406,10 +406,10 @@  discard block
 block discarded – undo
406 406
 			// 	false,
407 407
 			// 	'EE_Transaction: ' . $registration->transaction()->ID()
408 408
 			// );
409
-            if ( ! $registration->is_primary_registrant()) {
410
-                return;
411
-            }
412
-            do_action(
409
+			if ( ! $registration->is_primary_registrant()) {
410
+				return;
411
+			}
412
+			do_action(
413 413
 				'AHEE__EE_Registration_Processor__trigger_registration_update_notifications',
414 414
 				$registration,
415 415
 				$additional_details
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 		// set new  REG_Status
445 445
 		$this->set_new_reg_status( $registration->ID(), $registration->status_ID() );
446 446
 		return $this->reg_status_updated( $registration->ID() )
447
-		       && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved
447
+			   && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved
448 448
 			? true
449 449
 			: false;
450 450
 	}
@@ -524,15 +524,15 @@  discard block
 block discarded – undo
524 524
 
525 525
 
526 526
 
527
-    /**
528
-     * update_registration_after_being_canceled_or_declined
529
-     *
530
-     * @param \EE_Registration $registration
531
-     * @param array            $closed_reg_statuses
532
-     * @param bool             $update_reg
533
-     * @return bool
534
-     * @throws \EE_Error
535
-     */
527
+	/**
528
+	 * update_registration_after_being_canceled_or_declined
529
+	 *
530
+	 * @param \EE_Registration $registration
531
+	 * @param array            $closed_reg_statuses
532
+	 * @param bool             $update_reg
533
+	 * @return bool
534
+	 * @throws \EE_Error
535
+	 */
536 536
 	public function update_registration_after_being_canceled_or_declined(
537 537
 		EE_Registration $registration,
538 538
 		$closed_reg_statuses = array(),
@@ -540,14 +540,14 @@  discard block
 block discarded – undo
540 540
 	) {
541 541
 		// these reg statuses should not be considered in any calculations involving monies owing
542 542
 		$closed_reg_statuses = ! empty( $closed_reg_statuses )
543
-            ? $closed_reg_statuses
543
+			? $closed_reg_statuses
544 544
 			: EEM_Registration::closed_reg_statuses();
545 545
 		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses, true ) ) {
546 546
 			return false;
547 547
 		}
548
-        // release a reserved ticket by decrementing ticket and datetime reserved values
549
-        $registration->release_reserved_ticket(true);
550
-        $registration->set_final_price(0);
548
+		// release a reserved ticket by decrementing ticket and datetime reserved values
549
+		$registration->release_reserved_ticket(true);
550
+		$registration->set_final_price(0);
551 551
 		if ( $update_reg ) {
552 552
 			$registration->save();
553 553
 		}
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -8,8 +8,8 @@  discard block
 block discarded – undo
8 8
 use EventEspresso\core\exceptions\InvalidDataTypeException;
9 9
 use EventEspresso\core\exceptions\InvalidInterfaceException;
10 10
 
11
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
12
-EE_Registry::instance()->load_class( 'Processor_Base' );
11
+if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
12
+EE_Registry::instance()->load_class('Processor_Base');
13 13
 
14 14
 /**
15 15
  * Class EE_Registration_Processor
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public static function instance() {
73 73
 		// check if class object is instantiated
74
-		if ( ! self::$_instance instanceof EE_Registration_Processor ) {
74
+		if ( ! self::$_instance instanceof EE_Registration_Processor) {
75 75
 			self::$_instance = new self();
76 76
 		}
77 77
 		return self::$_instance;
@@ -91,8 +91,8 @@  discard block
 block discarded – undo
91 91
 	 * @param int $REG_ID
92 92
 	 * @return string
93 93
 	 */
94
-	public function old_reg_status( $REG_ID ) {
95
-		return isset( $this->_old_reg_status[ $REG_ID ] ) ? $this->_old_reg_status[ $REG_ID ] : null;
94
+	public function old_reg_status($REG_ID) {
95
+		return isset($this->_old_reg_status[$REG_ID]) ? $this->_old_reg_status[$REG_ID] : null;
96 96
 	}
97 97
 
98 98
 
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
 	 * @param int $REG_ID
102 102
 	 * @param string $old_reg_status
103 103
 	 */
104
-	public function set_old_reg_status( $REG_ID, $old_reg_status ) {
104
+	public function set_old_reg_status($REG_ID, $old_reg_status) {
105 105
 		// only set the first time
106
-		if ( ! isset( $this->_old_reg_status[ $REG_ID ] ) ) {
107
-			$this->_old_reg_status[ $REG_ID ] = $old_reg_status;
106
+		if ( ! isset($this->_old_reg_status[$REG_ID])) {
107
+			$this->_old_reg_status[$REG_ID] = $old_reg_status;
108 108
 		}
109 109
 	}
110 110
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	 * @param int $REG_ID
115 115
 	 * @return string
116 116
 	 */
117
-	public function new_reg_status( $REG_ID ) {
118
-		return isset( $this->_new_reg_status[ $REG_ID ] ) ? $this->_new_reg_status[ $REG_ID ] : null;
117
+	public function new_reg_status($REG_ID) {
118
+		return isset($this->_new_reg_status[$REG_ID]) ? $this->_new_reg_status[$REG_ID] : null;
119 119
 	}
120 120
 
121 121
 
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 	 * @param int $REG_ID
125 125
 	 * @param string $new_reg_status
126 126
 	 */
127
-	public function set_new_reg_status( $REG_ID, $new_reg_status ) {
128
-		$this->_new_reg_status[ $REG_ID ] = $new_reg_status;
127
+	public function set_new_reg_status($REG_ID, $new_reg_status) {
128
+		$this->_new_reg_status[$REG_ID] = $new_reg_status;
129 129
 	}
130 130
 
131 131
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
 	 * @param int $REG_ID
137 137
 	 * @return bool
138 138
 	 */
139
-	public function reg_status_updated( $REG_ID ) {
140
-		return $this->new_reg_status( $REG_ID ) !== $this->old_reg_status( $REG_ID ) ? true : false;
139
+	public function reg_status_updated($REG_ID) {
140
+		return $this->new_reg_status($REG_ID) !== $this->old_reg_status($REG_ID) ? true : false;
141 141
 	}
142 142
 
143 143
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @param \EE_Registration $registration
147 147
 	 * @throws \EE_Error
148 148
 	 */
149
-	public function update_registration_status_and_trigger_notifications( \EE_Registration $registration ) {
150
-		$this->toggle_incomplete_registration_status_to_default( $registration, false );
151
-		$this->toggle_registration_status_for_default_approved_events( $registration, false );
152
-		$this->toggle_registration_status_if_no_monies_owing( $registration, false );
149
+	public function update_registration_status_and_trigger_notifications(\EE_Registration $registration) {
150
+		$this->toggle_incomplete_registration_status_to_default($registration, false);
151
+		$this->toggle_registration_status_for_default_approved_events($registration, false);
152
+		$this->toggle_registration_status_if_no_monies_owing($registration, false);
153 153
 		$registration->save();
154 154
 		// trigger notifications
155
-		$this->trigger_registration_update_notifications( $registration );
155
+		$this->trigger_registration_update_notifications($registration);
156 156
 	}
157 157
 
158 158
 
@@ -167,18 +167,18 @@  discard block
 block discarded – undo
167 167
 	 * @return boolean
168 168
 	 * @throws \EE_Error
169 169
 	 */
170
-	public function manually_update_registration_status( EE_Registration $registration, $new_reg_status = '', $save = true ) {
170
+	public function manually_update_registration_status(EE_Registration $registration, $new_reg_status = '', $save = true) {
171 171
 		// set initial REG_Status
172
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
172
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
173 173
 		// set incoming REG_Status
174
-		$this->set_new_reg_status( $registration->ID(), $new_reg_status );
174
+		$this->set_new_reg_status($registration->ID(), $new_reg_status);
175 175
 		// toggle reg status but only if it has changed and the user can do so
176 176
 		if (
177
-			$this->reg_status_updated( $registration->ID() ) &&
178
-			EE_Registry::instance()->CAP->current_user_can( 'ee_edit_registration', 'toggle_registration_status', $registration->ID() )
177
+			$this->reg_status_updated($registration->ID()) &&
178
+			EE_Registry::instance()->CAP->current_user_can('ee_edit_registration', 'toggle_registration_status', $registration->ID())
179 179
 		) {
180 180
 			// change status to new value
181
-			if ( $registration->set_status( $this->new_reg_status( $registration->ID() ) ) && $save ) {
181
+			if ($registration->set_status($this->new_reg_status($registration->ID())) && $save) {
182 182
 				$registration->save();
183 183
 			}
184 184
 			return TRUE;
@@ -212,27 +212,27 @@  discard block
 block discarded – undo
212 212
     ) {
213 213
 		$existing_reg_status = $registration->status_ID();
214 214
 		// set initial REG_Status
215
-		$this->set_old_reg_status( $registration->ID(), $existing_reg_status );
215
+		$this->set_old_reg_status($registration->ID(), $existing_reg_status);
216 216
 		// is the registration currently incomplete ?
217
-		if ( $registration->status_ID() === EEM_Registration::status_id_incomplete ) {
217
+		if ($registration->status_ID() === EEM_Registration::status_id_incomplete) {
218 218
 			// grab default reg status for the event, if set
219 219
 			$event_default_registration_status = $registration->event()->default_registration_status();
220 220
 			// if no default reg status is set for the event, then use the global value
221
-			$STS_ID = ! empty( $event_default_registration_status )
221
+			$STS_ID = ! empty($event_default_registration_status)
222 222
 				? $event_default_registration_status
223 223
 				: EE_Registry::instance()->CFG->registration->default_STS_ID;
224 224
 			// if the event default reg status is approved, then downgrade temporarily to payment pending to ensure that payments are triggered
225 225
 			$STS_ID = $STS_ID === EEM_Registration::status_id_approved ? EEM_Registration::status_id_pending_payment : $STS_ID;
226 226
 			// set incoming REG_Status
227
-			$this->set_new_reg_status( $registration->ID(), $STS_ID );
228
-			$registration->set_status( $STS_ID, false, $context );
229
-			if ( $save ) {
227
+			$this->set_new_reg_status($registration->ID(), $STS_ID);
228
+			$registration->set_status($STS_ID, false, $context);
229
+			if ($save) {
230 230
 				$registration->save();
231 231
 			}
232 232
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
233
-			if ( ! EE_Processor_Base::$IPN ) {
233
+			if ( ! EE_Processor_Base::$IPN) {
234 234
                 // otherwise, send out notifications
235
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
235
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
236 236
 			}
237 237
 			// DEBUG LOG
238 238
 			//$this->log(
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * @return boolean
258 258
 	 * @throws \EE_Error
259 259
 	 */
260
-	public function toggle_registration_status_for_default_approved_events( EE_Registration $registration, $save = TRUE ) {
260
+	public function toggle_registration_status_for_default_approved_events(EE_Registration $registration, $save = TRUE) {
261 261
 		$reg_status = $registration->status_ID();
262 262
 		// set initial REG_Status
263
-		$this->set_old_reg_status( $registration->ID(), $reg_status );
263
+		$this->set_old_reg_status($registration->ID(), $reg_status);
264 264
 		// if not already, toggle reg status to approved IF the event default reg status is approved
265 265
 		// ( as long as the registration wasn't cancelled or declined at some point )
266 266
 		if (
@@ -270,16 +270,16 @@  discard block
 block discarded – undo
270 270
 			$registration->event()->default_registration_status() === EEM_Registration::status_id_approved
271 271
 		) {
272 272
 			// set incoming REG_Status
273
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
273
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
274 274
 			// toggle status to approved
275
-			$registration->set_status( EEM_Registration::status_id_approved );
276
-			if ( $save ) {
275
+			$registration->set_status(EEM_Registration::status_id_approved);
276
+			if ($save) {
277 277
 				$registration->save();
278 278
 			}
279 279
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
280
-			if ( ! EE_Processor_Base::$IPN ) {
280
+			if ( ! EE_Processor_Base::$IPN) {
281 281
                 // otherwise, send out notifications
282
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
282
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
283 283
 			}
284 284
 			// DEBUG LOG
285 285
 			//$this->log(
@@ -307,19 +307,19 @@  discard block
 block discarded – undo
307 307
 	 * @return bool
308 308
 	 * @throws \EE_Error
309 309
 	 */
310
-	public function toggle_registration_status_if_no_monies_owing( EE_Registration $registration, $save = TRUE, $additional_details = array() ) {
310
+	public function toggle_registration_status_if_no_monies_owing(EE_Registration $registration, $save = TRUE, $additional_details = array()) {
311 311
 		// set initial REG_Status
312
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
312
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
313 313
 		//EEH_Debug_Tools::printr( $additional_details, '$additional_details', __FILE__, __LINE__ );
314 314
 		// was a payment just made ?
315 315
 		if (
316
-			isset( $additional_details[ 'payment_updates' ], $additional_details[ 'last_payment' ] ) &&
317
-			$additional_details[ 'payment_updates' ] &&
318
-			$additional_details[ 'last_payment' ] instanceof EE_Payment
316
+			isset($additional_details['payment_updates'], $additional_details['last_payment']) &&
317
+			$additional_details['payment_updates'] &&
318
+			$additional_details['last_payment'] instanceof EE_Payment
319 319
 		) {
320
-			$payment = $additional_details[ 'last_payment' ];
320
+			$payment = $additional_details['last_payment'];
321 321
 			$total_paid = 0;
322
-			foreach ( self::$_amount_paid as $reg => $amount_paid ) {
322
+			foreach (self::$_amount_paid as $reg => $amount_paid) {
323 323
 				$total_paid += $amount_paid;
324 324
 			}
325 325
 		} else {
@@ -343,30 +343,30 @@  discard block
 block discarded – undo
343 343
 					$registration->transaction()->is_completed() ||
344 344
 					$registration->transaction()->is_overpaid() ||
345 345
 					$registration->transaction()->is_free() ||
346
-					apply_filters( 'FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration )
346
+					apply_filters('FHEE__EE_Registration_Processor__toggle_registration_status_if_no_monies_owing', false, $registration)
347 347
 				) || (
348 348
 					$payment instanceof EE_Payment &&
349 349
 					$payment->is_approved() &&
350 350
 					// this specific registration has not yet been paid for
351
-					! isset( self::$_amount_paid[ $registration->ID() ] ) &&
351
+					! isset(self::$_amount_paid[$registration->ID()]) &&
352 352
 					// payment amount, less what we have already attributed to other registrations, is greater than this reg's final price
353 353
 					$payment->amount() - $total_paid >= $registration->final_price()
354 354
 				)
355 355
 			)
356 356
 		) {
357 357
 			// mark as paid
358
-			self::$_amount_paid[ $registration->ID() ] = $registration->final_price();
358
+			self::$_amount_paid[$registration->ID()] = $registration->final_price();
359 359
 			// track new REG_Status
360
-			$this->set_new_reg_status( $registration->ID(), EEM_Registration::status_id_approved );
360
+			$this->set_new_reg_status($registration->ID(), EEM_Registration::status_id_approved);
361 361
 			// toggle status to approved
362
-			$registration->set_status( EEM_Registration::status_id_approved );
363
-			if ( $save ) {
362
+			$registration->set_status(EEM_Registration::status_id_approved);
363
+			if ($save) {
364 364
 				$registration->save();
365 365
 			}
366 366
 			// don't trigger notifications during IPNs because they will get triggered by EE_Payment_Processor
367
-			if ( ! EE_Processor_Base::$IPN ) {
367
+			if ( ! EE_Processor_Base::$IPN) {
368 368
                 // otherwise, send out notifications
369
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
369
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
370 370
 			}
371 371
 			// DEBUG LOG
372 372
 			//$this->log(
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 	 * @param array 	$additional_details
393 393
 	 * @return void
394 394
 	 */
395
-	public function trigger_registration_update_notifications( $registration, $additional_details = array() ) {
395
+	public function trigger_registration_update_notifications($registration, $additional_details = array()) {
396 396
 		try {
397
-			if ( ! $registration instanceof EE_Registration ) {
398
-				throw new EE_Error( __( 'An invalid registration was received.', 'event_espresso' ) );
397
+			if ( ! $registration instanceof EE_Registration) {
398
+				throw new EE_Error(__('An invalid registration was received.', 'event_espresso'));
399 399
 			}
400 400
 			// EE_Registry::instance()->load_helper( 'Debug_Tools' );
401 401
 			// EEH_Debug_Tools::log(
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 				$registration,
415 415
 				$additional_details
416 416
 			);
417
-		} catch( Exception $e ) {
418
-			EE_Error::add_error( $e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine() );
417
+		} catch (Exception $e) {
418
+			EE_Error::add_error($e->getMessage(), $e->getFile(), 'unknown_function_from_exception', $e->getLine());
419 419
 		}
420 420
 	}
421 421
 
@@ -429,22 +429,22 @@  discard block
 block discarded – undo
429 429
 	 * @return bool
430 430
 	 * @throws \EE_Error
431 431
 	 */
432
-	public function update_registration_after_checkout_or_payment(  EE_Registration $registration, $additional_details = array() ) {
432
+	public function update_registration_after_checkout_or_payment(EE_Registration $registration, $additional_details = array()) {
433 433
 		// set initial REG_Status
434
-		$this->set_old_reg_status( $registration->ID(), $registration->status_ID() );
434
+		$this->set_old_reg_status($registration->ID(), $registration->status_ID());
435 435
 
436 436
 		// if the registration status gets updated, then save the registration
437 437
 		if (
438
-			$this->toggle_registration_status_for_default_approved_events( $registration, false )
439
-			|| $this->toggle_registration_status_if_no_monies_owing( $registration, false, $additional_details )
438
+			$this->toggle_registration_status_for_default_approved_events($registration, false)
439
+			|| $this->toggle_registration_status_if_no_monies_owing($registration, false, $additional_details)
440 440
 		) {
441 441
 			$registration->save();
442 442
 		}
443 443
 
444 444
 		// set new  REG_Status
445
-		$this->set_new_reg_status( $registration->ID(), $registration->status_ID() );
446
-		return $this->reg_status_updated( $registration->ID() )
447
-		       && $this->new_reg_status( $registration->ID() ) === EEM_Registration::status_id_approved
445
+		$this->set_new_reg_status($registration->ID(), $registration->status_ID());
446
+		return $this->reg_status_updated($registration->ID())
447
+		       && $this->new_reg_status($registration->ID()) === EEM_Registration::status_id_approved
448 448
 			? true
449 449
 			: false;
450 450
 	}
@@ -460,20 +460,20 @@  discard block
 block discarded – undo
460 460
 	 * @return void
461 461
 	 * @throws \EE_Error
462 462
 	 */
463
-	public function update_registration_final_prices( $transaction, $save_regs = true ) {
464
-		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item( $transaction->total_line_item() );
465
-		foreach( $transaction->registrations() as $registration ) {
463
+	public function update_registration_final_prices($transaction, $save_regs = true) {
464
+		$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
465
+		foreach ($transaction->registrations() as $registration) {
466 466
 			/** @var EE_Line_Item $line_item */
467
-			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration( $registration );
468
-			if( isset( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] ) ) {
469
-				$registration->set_final_price( $reg_final_price_per_ticket_line_item[ $line_item->ID() ] );
470
-				if( $save_regs ) {
467
+			$line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration);
468
+			if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) {
469
+				$registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]);
470
+				if ($save_regs) {
471 471
 					$registration->save();
472 472
 				}
473 473
 			}
474 474
 		}
475 475
 		//and make sure there's no rounding problem
476
-		$this->fix_reg_final_price_rounding_issue( $transaction );
476
+		$this->fix_reg_final_price_rounding_issue($transaction);
477 477
 	}
478 478
 
479 479
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 * @return boolean success verifying that there is NO difference after this method is done
494 494
 	 * @throws \EE_Error
495 495
 	 */
496
-	public function fix_reg_final_price_rounding_issue( $transaction ) {
496
+	public function fix_reg_final_price_rounding_issue($transaction) {
497 497
 		$reg_final_price_sum = EEM_Registration::instance()->sum(
498 498
 			array(
499 499
 				array(
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 			),
503 503
 			'REG_final_price'
504 504
 		);
505
-		$diff =  $transaction->total() - (float) $reg_final_price_sum;
505
+		$diff = $transaction->total() - (float) $reg_final_price_sum;
506 506
 		//ok then, just grab one of the registrations
507
-		if( $diff !== 0 ) {
507
+		if ($diff !== 0) {
508 508
 			$a_reg = EEM_Registration::instance()->get_one(
509 509
 					array(
510 510
 						array(
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 					));
514 514
 			$success = $a_reg instanceof EE_Registration
515 515
 				? $a_reg->save(
516
-					array( 'REG_final_price' => $a_reg->final_price() + $diff )
516
+					array('REG_final_price' => $a_reg->final_price() + $diff)
517 517
 				)
518 518
 				: false;
519 519
 			return $success ? true : false;
@@ -539,16 +539,16 @@  discard block
 block discarded – undo
539 539
 		$update_reg = true
540 540
 	) {
541 541
 		// these reg statuses should not be considered in any calculations involving monies owing
542
-		$closed_reg_statuses = ! empty( $closed_reg_statuses )
542
+		$closed_reg_statuses = ! empty($closed_reg_statuses)
543 543
             ? $closed_reg_statuses
544 544
 			: EEM_Registration::closed_reg_statuses();
545
-		if ( ! in_array( $registration->status_ID(), $closed_reg_statuses, true ) ) {
545
+		if ( ! in_array($registration->status_ID(), $closed_reg_statuses, true)) {
546 546
 			return false;
547 547
 		}
548 548
         // release a reserved ticket by decrementing ticket and datetime reserved values
549 549
         $registration->release_reserved_ticket(true);
550 550
         $registration->set_final_price(0);
551
-		if ( $update_reg ) {
551
+		if ($update_reg) {
552 552
 			$registration->save();
553 553
 		}
554 554
 		return true;
@@ -571,23 +571,23 @@  discard block
 block discarded – undo
571 571
 		$update_reg = true
572 572
 	) {
573 573
 		// these reg statuses should not be considered in any calculations involving monies owing
574
-		$closed_reg_statuses = ! empty( $closed_reg_statuses ) ? $closed_reg_statuses
574
+		$closed_reg_statuses = ! empty($closed_reg_statuses) ? $closed_reg_statuses
575 575
 			: EEM_Registration::closed_reg_statuses();
576
-		if ( in_array( $registration->status_ID(), $closed_reg_statuses ) ) {
576
+		if (in_array($registration->status_ID(), $closed_reg_statuses)) {
577 577
 			return false;
578 578
 		}
579 579
 		$ticket = $registration->ticket();
580
-		if ( ! $ticket instanceof EE_Ticket ) {
580
+		if ( ! $ticket instanceof EE_Ticket) {
581 581
 			throw new EE_Error(
582 582
 				sprintf(
583
-					__( 'The Ticket for Registration %1$d was not found or is invalid.',
584
-						'event_espresso' ),
583
+					__('The Ticket for Registration %1$d was not found or is invalid.',
584
+						'event_espresso'),
585 585
 					$registration->ticket_ID()
586 586
 				)
587 587
 			);
588 588
 		}
589
-		$registration->set_final_price( $ticket->price() );
590
-		if ( $update_reg ) {
589
+		$registration->set_final_price($ticket->price());
590
+		if ($update_reg) {
591 591
 			$registration->save();
592 592
 		}
593 593
 		return true;
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		$total_ticket_count = 1
626 626
 	) {
627 627
 		EE_Error::doing_it_wrong(
628
-			__CLASS__ . '::' . __FUNCTION__,
628
+			__CLASS__.'::'.__FUNCTION__,
629 629
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
630 630
 				'\EventEspresso\core\domain\services\registration\CreateRegistrationService::create()'),
631 631
 			'4.9.1',
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 	public function generate_reg_url_link($att_nmbr, $item)
669 669
 	{
670 670
 		EE_Error::doing_it_wrong(
671
-			__CLASS__ . '::' . __FUNCTION__,
671
+			__CLASS__.'::'.__FUNCTION__,
672 672
 			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
673 673
 				'EventEspresso\core\domain\entities\RegUrlLink'),
674 674
 			'4.9.1',
@@ -688,11 +688,11 @@  discard block
 block discarded – undo
688 688
 	 * @return string
689 689
 	 * @throws \EE_Error
690 690
 	 */
691
-	public function generate_reg_code( EE_Registration $registration ) {
691
+	public function generate_reg_code(EE_Registration $registration) {
692 692
 		EE_Error::doing_it_wrong(
693
-			__CLASS__ . '::' . __FUNCTION__,
693
+			__CLASS__.'::'.__FUNCTION__,
694 694
 			sprintf(
695
-				__( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ),
695
+				__('This method is deprecated. Please use "%s" instead', 'event_espresso'),
696 696
 				'EventEspresso\core\domain\entities\RegCode'
697 697
 			),
698 698
 			'4.9.1',
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
 		return apply_filters(
702 702
 			'FHEE__EE_Registration_Processor___generate_reg_code__new_reg_code',
703 703
 			new RegCode(
704
-				RegUrlLink::fromRegistration( $registration ),
704
+				RegUrlLink::fromRegistration($registration),
705 705
 				$registration->transaction(),
706 706
 				$registration->ticket()
707 707
 			),
Please login to merge, or discard this patch.