@@ -22,1224 +22,1224 @@ |
||
22 | 22 | class EE_Register_Addon implements EEI_Plugin_API |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * possibly truncated version of the EE core version string |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - protected static $_core_version = ''; |
|
25 | + /** |
|
26 | + * possibly truncated version of the EE core version string |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + protected static $_core_version = ''; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Holds values for registered addons |
|
34 | - * |
|
35 | - * @var array |
|
36 | - */ |
|
37 | - protected static $_settings = array(); |
|
32 | + /** |
|
33 | + * Holds values for registered addons |
|
34 | + * |
|
35 | + * @var array |
|
36 | + */ |
|
37 | + protected static $_settings = array(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @var array $_incompatible_addons keys are addon SLUGS |
|
41 | - * (first argument passed to EE_Register_Addon::register()), keys are |
|
42 | - * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004). |
|
43 | - * Generally this should be used sparingly, as we don't want to muddle up |
|
44 | - * EE core with knowledge of ALL the addons out there. |
|
45 | - * If you want NO versions of an addon to run with a certain version of core, |
|
46 | - * it's usually best to define the addon's "min_core_version" as part of its call |
|
47 | - * to EE_Register_Addon::register(), rather than using this array with a super high value for its |
|
48 | - * minimum plugin version. |
|
49 | - * @access protected |
|
50 | - */ |
|
51 | - protected static $_incompatible_addons = array( |
|
52 | - 'Multi_Event_Registration' => '2.0.11.rc.002', |
|
53 | - 'Promotions' => '1.0.0.rc.084', |
|
54 | - ); |
|
39 | + /** |
|
40 | + * @var array $_incompatible_addons keys are addon SLUGS |
|
41 | + * (first argument passed to EE_Register_Addon::register()), keys are |
|
42 | + * their MINIMUM VERSION (with all 5 parts. Eg 1.2.3.rc.004). |
|
43 | + * Generally this should be used sparingly, as we don't want to muddle up |
|
44 | + * EE core with knowledge of ALL the addons out there. |
|
45 | + * If you want NO versions of an addon to run with a certain version of core, |
|
46 | + * it's usually best to define the addon's "min_core_version" as part of its call |
|
47 | + * to EE_Register_Addon::register(), rather than using this array with a super high value for its |
|
48 | + * minimum plugin version. |
|
49 | + * @access protected |
|
50 | + */ |
|
51 | + protected static $_incompatible_addons = array( |
|
52 | + 'Multi_Event_Registration' => '2.0.11.rc.002', |
|
53 | + 'Promotions' => '1.0.0.rc.084', |
|
54 | + ); |
|
55 | 55 | |
56 | 56 | |
57 | - /** |
|
58 | - * We should always be comparing core to a version like '4.3.0.rc.000', |
|
59 | - * not just '4.3.0'. |
|
60 | - * So if the addon developer doesn't provide that full version string, |
|
61 | - * fill in the blanks for them |
|
62 | - * |
|
63 | - * @param string $min_core_version |
|
64 | - * @return string always like '4.3.0.rc.000' |
|
65 | - */ |
|
66 | - protected static function _effective_version($min_core_version) |
|
67 | - { |
|
68 | - // versions: 4 . 3 . 1 . p . 123 |
|
69 | - // offsets: 0 . 1 . 2 . 3 . 4 |
|
70 | - $version_parts = explode('.', $min_core_version); |
|
71 | - // check they specified the micro version (after 2nd period) |
|
72 | - if (! isset($version_parts[2])) { |
|
73 | - $version_parts[2] = '0'; |
|
74 | - } |
|
75 | - // if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible |
|
76 | - // soon we can assume that's 'rc', but this current version is 'alpha' |
|
77 | - if (! isset($version_parts[3])) { |
|
78 | - $version_parts[3] = 'dev'; |
|
79 | - } |
|
80 | - if (! isset($version_parts[4])) { |
|
81 | - $version_parts[4] = '000'; |
|
82 | - } |
|
83 | - return implode('.', $version_parts); |
|
84 | - } |
|
57 | + /** |
|
58 | + * We should always be comparing core to a version like '4.3.0.rc.000', |
|
59 | + * not just '4.3.0'. |
|
60 | + * So if the addon developer doesn't provide that full version string, |
|
61 | + * fill in the blanks for them |
|
62 | + * |
|
63 | + * @param string $min_core_version |
|
64 | + * @return string always like '4.3.0.rc.000' |
|
65 | + */ |
|
66 | + protected static function _effective_version($min_core_version) |
|
67 | + { |
|
68 | + // versions: 4 . 3 . 1 . p . 123 |
|
69 | + // offsets: 0 . 1 . 2 . 3 . 4 |
|
70 | + $version_parts = explode('.', $min_core_version); |
|
71 | + // check they specified the micro version (after 2nd period) |
|
72 | + if (! isset($version_parts[2])) { |
|
73 | + $version_parts[2] = '0'; |
|
74 | + } |
|
75 | + // if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible |
|
76 | + // soon we can assume that's 'rc', but this current version is 'alpha' |
|
77 | + if (! isset($version_parts[3])) { |
|
78 | + $version_parts[3] = 'dev'; |
|
79 | + } |
|
80 | + if (! isset($version_parts[4])) { |
|
81 | + $version_parts[4] = '000'; |
|
82 | + } |
|
83 | + return implode('.', $version_parts); |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * Returns whether or not the min core version requirement of the addon is met |
|
89 | - * |
|
90 | - * @param string $min_core_version the minimum core version required by the addon |
|
91 | - * @param string $actual_core_version the actual core version, optional |
|
92 | - * @return boolean |
|
93 | - */ |
|
94 | - public static function _meets_min_core_version_requirement( |
|
95 | - $min_core_version, |
|
96 | - $actual_core_version = EVENT_ESPRESSO_VERSION |
|
97 | - ) { |
|
98 | - return version_compare( |
|
99 | - self::_effective_version($actual_core_version), |
|
100 | - self::_effective_version($min_core_version), |
|
101 | - '>=' |
|
102 | - ); |
|
103 | - } |
|
87 | + /** |
|
88 | + * Returns whether or not the min core version requirement of the addon is met |
|
89 | + * |
|
90 | + * @param string $min_core_version the minimum core version required by the addon |
|
91 | + * @param string $actual_core_version the actual core version, optional |
|
92 | + * @return boolean |
|
93 | + */ |
|
94 | + public static function _meets_min_core_version_requirement( |
|
95 | + $min_core_version, |
|
96 | + $actual_core_version = EVENT_ESPRESSO_VERSION |
|
97 | + ) { |
|
98 | + return version_compare( |
|
99 | + self::_effective_version($actual_core_version), |
|
100 | + self::_effective_version($min_core_version), |
|
101 | + '>=' |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | |
105 | 105 | |
106 | - /** |
|
107 | - * Method for registering new EE_Addons. |
|
108 | - * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE |
|
109 | - * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it |
|
110 | - * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon |
|
111 | - * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after |
|
112 | - * 'activate_plugin', it registers the addon still, but its components are not registered |
|
113 | - * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do |
|
114 | - * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns |
|
115 | - * (so that we can detect that the addon has activated on the subsequent request) |
|
116 | - * |
|
117 | - * @since 4.3.0 |
|
118 | - * @param string $addon_name [Required] the EE_Addon's name. |
|
119 | - * @param array $setup_args { |
|
120 | - * An array of arguments provided for registering |
|
121 | - * the message type. |
|
122 | - * @type string $class_name the addon's main file name. |
|
123 | - * If left blank, generated from the addon name, |
|
124 | - * changes something like "calendar" to |
|
125 | - * "EE_Calendar" |
|
126 | - * @type string $min_core_version the minimum version of EE Core that the |
|
127 | - * addon will work with. eg "4.8.1.rc.084" |
|
128 | - * @type string $version the "software" version for the addon. eg |
|
129 | - * "1.0.0.p" for a first stable release, or |
|
130 | - * "1.0.0.rc.043" for a version in progress |
|
131 | - * @type string $main_file_path the full server path to the main file |
|
132 | - * loaded directly by WP |
|
133 | - * @type DomainInterface $domain child class of |
|
134 | - * EventEspresso\core\domain\DomainBase |
|
135 | - * @type string $domain_fqcn Fully Qualified Class Name |
|
136 | - * for the addon's Domain class |
|
137 | - * (see EventEspresso\core\domain\Domain) |
|
138 | - * @type string $admin_path full server path to the folder where the |
|
139 | - * addon\'s admin files reside |
|
140 | - * @type string $admin_callback a method to be called when the EE Admin is |
|
141 | - * first invoked, can be used for hooking into |
|
142 | - * any admin page |
|
143 | - * @type string $config_section the section name for this addon's |
|
144 | - * configuration settings section |
|
145 | - * (defaults to "addons") |
|
146 | - * @type string $config_class the class name for this addon's |
|
147 | - * configuration settings object |
|
148 | - * @type string $config_name the class name for this addon's |
|
149 | - * configuration settings object |
|
150 | - * @type string $autoloader_paths [Required] an array of class names and the full |
|
151 | - * server paths to those files. |
|
152 | - * @type string $autoloader_folders an array of "full server paths" for any |
|
153 | - * folders containing classes that might be |
|
154 | - * invoked by the addon |
|
155 | - * @type string $dms_paths [Required] an array of full server paths to |
|
156 | - * folders that contain data migration scripts. |
|
157 | - * The key should be the EE_Addon class name that |
|
158 | - * this set of data migration scripts belongs to. |
|
159 | - * If the EE_Addon class is namespaced, then this |
|
160 | - * needs to be the Fully Qualified Class Name |
|
161 | - * @type string $module_paths an array of full server paths to any |
|
162 | - * EED_Modules used by the addon |
|
163 | - * @type string $shortcode_paths an array of full server paths to folders |
|
164 | - * that contain EES_Shortcodes |
|
165 | - * @type string $widget_paths an array of full server paths to folders |
|
166 | - * that contain WP_Widgets |
|
167 | - * @type string $pue_options |
|
168 | - * @type array $capabilities an array indexed by role name |
|
169 | - * (i.e administrator,author ) and the values |
|
170 | - * are an array of caps to add to the role. |
|
171 | - * 'administrator' => array( |
|
172 | - * 'read_addon', |
|
173 | - * 'edit_addon', |
|
174 | - * etc. |
|
175 | - * ). |
|
176 | - * @type EE_Meta_Capability_Map[] $capability_maps an array of EE_Meta_Capability_Map object |
|
177 | - * for any addons that need to register any |
|
178 | - * special meta mapped capabilities. Should |
|
179 | - * be indexed where the key is the |
|
180 | - * EE_Meta_Capability_Map class name and the |
|
181 | - * values are the arguments sent to the class. |
|
182 | - * @type array $model_paths array of folders containing DB models |
|
183 | - * @see EE_Register_Model |
|
184 | - * @type array $class_paths array of folders containing DB classes |
|
185 | - * @see EE_Register_Model |
|
186 | - * @type array $model_extension_paths array of folders containing DB model |
|
187 | - * extensions |
|
188 | - * @see EE_Register_Model_Extension |
|
189 | - * @type array $class_extension_paths array of folders containing DB class |
|
190 | - * extensions |
|
191 | - * @see EE_Register_Model_Extension |
|
192 | - * @type array message_types { |
|
193 | - * An array of message types with the key as |
|
194 | - * the message type name and the values as |
|
195 | - * below: |
|
196 | - * @type string $mtfilename [Required] The filename of the message type |
|
197 | - * being registered. This will be the main |
|
198 | - * EE_{Message Type Name}_message_type class. |
|
199 | - * for example: |
|
200 | - * EE_Declined_Registration_message_type.class.php |
|
201 | - * @type array $autoloadpaths [Required] An array of paths to add to the |
|
202 | - * messages autoloader for the new message type. |
|
203 | - * @type array $messengers_to_activate_with An array of messengers that this message |
|
204 | - * type should activate with. Each value in |
|
205 | - * the |
|
206 | - * array |
|
207 | - * should match the name property of a |
|
208 | - * EE_messenger. Optional. |
|
209 | - * @type array $messengers_to_validate_with An array of messengers that this message |
|
210 | - * type should validate with. Each value in |
|
211 | - * the |
|
212 | - * array |
|
213 | - * should match the name property of an |
|
214 | - * EE_messenger. |
|
215 | - * Optional. |
|
216 | - * } |
|
217 | - * @type array $custom_post_types |
|
218 | - * @type array $custom_taxonomies |
|
219 | - * @type array $payment_method_paths each element is the folder containing the |
|
220 | - * EE_PMT_Base child class |
|
221 | - * (eg, |
|
222 | - * '/wp-content/plugins/my_plugin/Payomatic/' |
|
223 | - * which contains the files |
|
224 | - * EE_PMT_Payomatic.pm.php) |
|
225 | - * @type array $default_terms |
|
226 | - * @type array $namespace { |
|
227 | - * An array with two items for registering the |
|
228 | - * addon's namespace. (If, for some reason, you |
|
229 | - * require additional namespaces, |
|
230 | - * use |
|
231 | - * EventEspresso\core\Psr4Autoloader::addNamespace() |
|
232 | - * directly) |
|
233 | - * @see EventEspresso\core\Psr4Autoloader::addNamespace() |
|
234 | - * @type string $FQNS the namespace prefix |
|
235 | - * @type string $DIR a base directory for class files in the |
|
236 | - * namespace. |
|
237 | - * } |
|
238 | - * } |
|
239 | - * @type string $privacy_policies FQNSs (namespaces, each of which contains only |
|
240 | - * privacy policy classes) or FQCNs (specific |
|
241 | - * classnames of privacy policy classes) |
|
242 | - * @type string $personal_data_exporters FQNSs (namespaces, each of which contains only |
|
243 | - * privacy policy classes) or FQCNs (specific |
|
244 | - * classnames of privacy policy classes) |
|
245 | - * @type string $personal_data_erasers FQNSs (namespaces, each of which contains only |
|
246 | - * privacy policy classes) or FQCNs (specific |
|
247 | - * classnames of privacy policy classes) |
|
248 | - * @return void |
|
249 | - * @throws DomainException |
|
250 | - * @throws EE_Error |
|
251 | - * @throws InvalidArgumentException |
|
252 | - * @throws ReflectionException |
|
253 | - * @throws InvalidDataTypeException |
|
254 | - * @throws InvalidInterfaceException |
|
255 | - */ |
|
256 | - public static function register($addon_name = '', $setup_args = array()) |
|
257 | - { |
|
258 | - // required fields MUST be present, so let's make sure they are. |
|
259 | - EE_Register_Addon::_verify_parameters($addon_name, $setup_args); |
|
260 | - // get class name for addon |
|
261 | - $class_name = EE_Register_Addon::_parse_class_name($addon_name, $setup_args); |
|
262 | - // setup $_settings array from incoming values. |
|
263 | - $addon_settings = EE_Register_Addon::_get_addon_settings($class_name, $setup_args); |
|
264 | - // setup PUE |
|
265 | - EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
|
266 | - // does this addon work with this version of core or WordPress ? |
|
267 | - if (! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) { |
|
268 | - return; |
|
269 | - } |
|
270 | - // register namespaces |
|
271 | - EE_Register_Addon::_setup_namespaces($addon_settings); |
|
272 | - // check if this is an activation request |
|
273 | - if (EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
274 | - // dont bother setting up the rest of the addon atm |
|
275 | - return; |
|
276 | - } |
|
277 | - // we need cars |
|
278 | - EE_Register_Addon::_setup_autoloaders($addon_name); |
|
279 | - // register new models and extensions |
|
280 | - EE_Register_Addon::_register_models_and_extensions($addon_name); |
|
281 | - // setup DMS |
|
282 | - EE_Register_Addon::_register_data_migration_scripts($addon_name); |
|
283 | - // if config_class is present let's register config. |
|
284 | - EE_Register_Addon::_register_config($addon_name); |
|
285 | - // register admin pages |
|
286 | - EE_Register_Addon::_register_admin_pages($addon_name); |
|
287 | - // add to list of modules to be registered |
|
288 | - EE_Register_Addon::_register_modules($addon_name); |
|
289 | - // add to list of shortcodes to be registered |
|
290 | - EE_Register_Addon::_register_shortcodes($addon_name); |
|
291 | - // add to list of widgets to be registered |
|
292 | - EE_Register_Addon::_register_widgets($addon_name); |
|
293 | - // register capability related stuff. |
|
294 | - EE_Register_Addon::_register_capabilities($addon_name); |
|
295 | - // any message type to register? |
|
296 | - EE_Register_Addon::_register_message_types($addon_name); |
|
297 | - // any custom post type/ custom capabilities or default terms to register |
|
298 | - EE_Register_Addon::_register_custom_post_types($addon_name); |
|
299 | - // and any payment methods |
|
300 | - EE_Register_Addon::_register_payment_methods($addon_name); |
|
301 | - // and privacy policy generators |
|
302 | - EE_Register_Addon::registerPrivacyPolicies($addon_name); |
|
303 | - // and privacy policy generators |
|
304 | - EE_Register_Addon::registerPersonalDataExporters($addon_name); |
|
305 | - // and privacy policy generators |
|
306 | - EE_Register_Addon::registerPersonalDataErasers($addon_name); |
|
307 | - // load and instantiate main addon class |
|
308 | - $addon = EE_Register_Addon::_load_and_init_addon_class($addon_name); |
|
309 | - // delay calling after_registration hook on each addon until after all add-ons have been registered. |
|
310 | - add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999); |
|
311 | - } |
|
106 | + /** |
|
107 | + * Method for registering new EE_Addons. |
|
108 | + * Should be called AFTER AHEE__EE_System__load_espresso_addons but BEFORE |
|
109 | + * AHEE__EE_System___detect_if_activation_or_upgrade__begin in order to register all its components. However, it |
|
110 | + * may also be called after the 'activate_plugin' action (when an addon is activated), because an activating addon |
|
111 | + * won't be loaded by WP until after AHEE__EE_System__load_espresso_addons has fired. If its called after |
|
112 | + * 'activate_plugin', it registers the addon still, but its components are not registered |
|
113 | + * (they shouldn't be needed anyways, because it's just an activation request and they won't have a chance to do |
|
114 | + * anything anyways). Instead, it just sets the newly-activated addon's activation indicator wp option and returns |
|
115 | + * (so that we can detect that the addon has activated on the subsequent request) |
|
116 | + * |
|
117 | + * @since 4.3.0 |
|
118 | + * @param string $addon_name [Required] the EE_Addon's name. |
|
119 | + * @param array $setup_args { |
|
120 | + * An array of arguments provided for registering |
|
121 | + * the message type. |
|
122 | + * @type string $class_name the addon's main file name. |
|
123 | + * If left blank, generated from the addon name, |
|
124 | + * changes something like "calendar" to |
|
125 | + * "EE_Calendar" |
|
126 | + * @type string $min_core_version the minimum version of EE Core that the |
|
127 | + * addon will work with. eg "4.8.1.rc.084" |
|
128 | + * @type string $version the "software" version for the addon. eg |
|
129 | + * "1.0.0.p" for a first stable release, or |
|
130 | + * "1.0.0.rc.043" for a version in progress |
|
131 | + * @type string $main_file_path the full server path to the main file |
|
132 | + * loaded directly by WP |
|
133 | + * @type DomainInterface $domain child class of |
|
134 | + * EventEspresso\core\domain\DomainBase |
|
135 | + * @type string $domain_fqcn Fully Qualified Class Name |
|
136 | + * for the addon's Domain class |
|
137 | + * (see EventEspresso\core\domain\Domain) |
|
138 | + * @type string $admin_path full server path to the folder where the |
|
139 | + * addon\'s admin files reside |
|
140 | + * @type string $admin_callback a method to be called when the EE Admin is |
|
141 | + * first invoked, can be used for hooking into |
|
142 | + * any admin page |
|
143 | + * @type string $config_section the section name for this addon's |
|
144 | + * configuration settings section |
|
145 | + * (defaults to "addons") |
|
146 | + * @type string $config_class the class name for this addon's |
|
147 | + * configuration settings object |
|
148 | + * @type string $config_name the class name for this addon's |
|
149 | + * configuration settings object |
|
150 | + * @type string $autoloader_paths [Required] an array of class names and the full |
|
151 | + * server paths to those files. |
|
152 | + * @type string $autoloader_folders an array of "full server paths" for any |
|
153 | + * folders containing classes that might be |
|
154 | + * invoked by the addon |
|
155 | + * @type string $dms_paths [Required] an array of full server paths to |
|
156 | + * folders that contain data migration scripts. |
|
157 | + * The key should be the EE_Addon class name that |
|
158 | + * this set of data migration scripts belongs to. |
|
159 | + * If the EE_Addon class is namespaced, then this |
|
160 | + * needs to be the Fully Qualified Class Name |
|
161 | + * @type string $module_paths an array of full server paths to any |
|
162 | + * EED_Modules used by the addon |
|
163 | + * @type string $shortcode_paths an array of full server paths to folders |
|
164 | + * that contain EES_Shortcodes |
|
165 | + * @type string $widget_paths an array of full server paths to folders |
|
166 | + * that contain WP_Widgets |
|
167 | + * @type string $pue_options |
|
168 | + * @type array $capabilities an array indexed by role name |
|
169 | + * (i.e administrator,author ) and the values |
|
170 | + * are an array of caps to add to the role. |
|
171 | + * 'administrator' => array( |
|
172 | + * 'read_addon', |
|
173 | + * 'edit_addon', |
|
174 | + * etc. |
|
175 | + * ). |
|
176 | + * @type EE_Meta_Capability_Map[] $capability_maps an array of EE_Meta_Capability_Map object |
|
177 | + * for any addons that need to register any |
|
178 | + * special meta mapped capabilities. Should |
|
179 | + * be indexed where the key is the |
|
180 | + * EE_Meta_Capability_Map class name and the |
|
181 | + * values are the arguments sent to the class. |
|
182 | + * @type array $model_paths array of folders containing DB models |
|
183 | + * @see EE_Register_Model |
|
184 | + * @type array $class_paths array of folders containing DB classes |
|
185 | + * @see EE_Register_Model |
|
186 | + * @type array $model_extension_paths array of folders containing DB model |
|
187 | + * extensions |
|
188 | + * @see EE_Register_Model_Extension |
|
189 | + * @type array $class_extension_paths array of folders containing DB class |
|
190 | + * extensions |
|
191 | + * @see EE_Register_Model_Extension |
|
192 | + * @type array message_types { |
|
193 | + * An array of message types with the key as |
|
194 | + * the message type name and the values as |
|
195 | + * below: |
|
196 | + * @type string $mtfilename [Required] The filename of the message type |
|
197 | + * being registered. This will be the main |
|
198 | + * EE_{Message Type Name}_message_type class. |
|
199 | + * for example: |
|
200 | + * EE_Declined_Registration_message_type.class.php |
|
201 | + * @type array $autoloadpaths [Required] An array of paths to add to the |
|
202 | + * messages autoloader for the new message type. |
|
203 | + * @type array $messengers_to_activate_with An array of messengers that this message |
|
204 | + * type should activate with. Each value in |
|
205 | + * the |
|
206 | + * array |
|
207 | + * should match the name property of a |
|
208 | + * EE_messenger. Optional. |
|
209 | + * @type array $messengers_to_validate_with An array of messengers that this message |
|
210 | + * type should validate with. Each value in |
|
211 | + * the |
|
212 | + * array |
|
213 | + * should match the name property of an |
|
214 | + * EE_messenger. |
|
215 | + * Optional. |
|
216 | + * } |
|
217 | + * @type array $custom_post_types |
|
218 | + * @type array $custom_taxonomies |
|
219 | + * @type array $payment_method_paths each element is the folder containing the |
|
220 | + * EE_PMT_Base child class |
|
221 | + * (eg, |
|
222 | + * '/wp-content/plugins/my_plugin/Payomatic/' |
|
223 | + * which contains the files |
|
224 | + * EE_PMT_Payomatic.pm.php) |
|
225 | + * @type array $default_terms |
|
226 | + * @type array $namespace { |
|
227 | + * An array with two items for registering the |
|
228 | + * addon's namespace. (If, for some reason, you |
|
229 | + * require additional namespaces, |
|
230 | + * use |
|
231 | + * EventEspresso\core\Psr4Autoloader::addNamespace() |
|
232 | + * directly) |
|
233 | + * @see EventEspresso\core\Psr4Autoloader::addNamespace() |
|
234 | + * @type string $FQNS the namespace prefix |
|
235 | + * @type string $DIR a base directory for class files in the |
|
236 | + * namespace. |
|
237 | + * } |
|
238 | + * } |
|
239 | + * @type string $privacy_policies FQNSs (namespaces, each of which contains only |
|
240 | + * privacy policy classes) or FQCNs (specific |
|
241 | + * classnames of privacy policy classes) |
|
242 | + * @type string $personal_data_exporters FQNSs (namespaces, each of which contains only |
|
243 | + * privacy policy classes) or FQCNs (specific |
|
244 | + * classnames of privacy policy classes) |
|
245 | + * @type string $personal_data_erasers FQNSs (namespaces, each of which contains only |
|
246 | + * privacy policy classes) or FQCNs (specific |
|
247 | + * classnames of privacy policy classes) |
|
248 | + * @return void |
|
249 | + * @throws DomainException |
|
250 | + * @throws EE_Error |
|
251 | + * @throws InvalidArgumentException |
|
252 | + * @throws ReflectionException |
|
253 | + * @throws InvalidDataTypeException |
|
254 | + * @throws InvalidInterfaceException |
|
255 | + */ |
|
256 | + public static function register($addon_name = '', $setup_args = array()) |
|
257 | + { |
|
258 | + // required fields MUST be present, so let's make sure they are. |
|
259 | + EE_Register_Addon::_verify_parameters($addon_name, $setup_args); |
|
260 | + // get class name for addon |
|
261 | + $class_name = EE_Register_Addon::_parse_class_name($addon_name, $setup_args); |
|
262 | + // setup $_settings array from incoming values. |
|
263 | + $addon_settings = EE_Register_Addon::_get_addon_settings($class_name, $setup_args); |
|
264 | + // setup PUE |
|
265 | + EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
|
266 | + // does this addon work with this version of core or WordPress ? |
|
267 | + if (! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) { |
|
268 | + return; |
|
269 | + } |
|
270 | + // register namespaces |
|
271 | + EE_Register_Addon::_setup_namespaces($addon_settings); |
|
272 | + // check if this is an activation request |
|
273 | + if (EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
274 | + // dont bother setting up the rest of the addon atm |
|
275 | + return; |
|
276 | + } |
|
277 | + // we need cars |
|
278 | + EE_Register_Addon::_setup_autoloaders($addon_name); |
|
279 | + // register new models and extensions |
|
280 | + EE_Register_Addon::_register_models_and_extensions($addon_name); |
|
281 | + // setup DMS |
|
282 | + EE_Register_Addon::_register_data_migration_scripts($addon_name); |
|
283 | + // if config_class is present let's register config. |
|
284 | + EE_Register_Addon::_register_config($addon_name); |
|
285 | + // register admin pages |
|
286 | + EE_Register_Addon::_register_admin_pages($addon_name); |
|
287 | + // add to list of modules to be registered |
|
288 | + EE_Register_Addon::_register_modules($addon_name); |
|
289 | + // add to list of shortcodes to be registered |
|
290 | + EE_Register_Addon::_register_shortcodes($addon_name); |
|
291 | + // add to list of widgets to be registered |
|
292 | + EE_Register_Addon::_register_widgets($addon_name); |
|
293 | + // register capability related stuff. |
|
294 | + EE_Register_Addon::_register_capabilities($addon_name); |
|
295 | + // any message type to register? |
|
296 | + EE_Register_Addon::_register_message_types($addon_name); |
|
297 | + // any custom post type/ custom capabilities or default terms to register |
|
298 | + EE_Register_Addon::_register_custom_post_types($addon_name); |
|
299 | + // and any payment methods |
|
300 | + EE_Register_Addon::_register_payment_methods($addon_name); |
|
301 | + // and privacy policy generators |
|
302 | + EE_Register_Addon::registerPrivacyPolicies($addon_name); |
|
303 | + // and privacy policy generators |
|
304 | + EE_Register_Addon::registerPersonalDataExporters($addon_name); |
|
305 | + // and privacy policy generators |
|
306 | + EE_Register_Addon::registerPersonalDataErasers($addon_name); |
|
307 | + // load and instantiate main addon class |
|
308 | + $addon = EE_Register_Addon::_load_and_init_addon_class($addon_name); |
|
309 | + // delay calling after_registration hook on each addon until after all add-ons have been registered. |
|
310 | + add_action('AHEE__EE_System__load_espresso_addons__complete', array($addon, 'after_registration'), 999); |
|
311 | + } |
|
312 | 312 | |
313 | 313 | |
314 | - /** |
|
315 | - * @param string $addon_name |
|
316 | - * @param array $setup_args |
|
317 | - * @return void |
|
318 | - * @throws EE_Error |
|
319 | - */ |
|
320 | - private static function _verify_parameters($addon_name, array $setup_args) |
|
321 | - { |
|
322 | - // required fields MUST be present, so let's make sure they are. |
|
323 | - if (empty($addon_name) || ! is_array($setup_args)) { |
|
324 | - throw new EE_Error( |
|
325 | - __( |
|
326 | - '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.', |
|
327 | - 'event_espresso' |
|
328 | - ) |
|
329 | - ); |
|
330 | - } |
|
331 | - if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
332 | - throw new EE_Error( |
|
333 | - sprintf( |
|
334 | - __( |
|
335 | - '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', |
|
336 | - 'event_espresso' |
|
337 | - ), |
|
338 | - implode(',', array_keys($setup_args)) |
|
339 | - ) |
|
340 | - ); |
|
341 | - } |
|
342 | - // check that addon has not already been registered with that name |
|
343 | - if (isset(self::$_settings[ $addon_name ]) && ! did_action('activate_plugin')) { |
|
344 | - throw new EE_Error( |
|
345 | - sprintf( |
|
346 | - __( |
|
347 | - 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', |
|
348 | - 'event_espresso' |
|
349 | - ), |
|
350 | - $addon_name |
|
351 | - ) |
|
352 | - ); |
|
353 | - } |
|
354 | - } |
|
314 | + /** |
|
315 | + * @param string $addon_name |
|
316 | + * @param array $setup_args |
|
317 | + * @return void |
|
318 | + * @throws EE_Error |
|
319 | + */ |
|
320 | + private static function _verify_parameters($addon_name, array $setup_args) |
|
321 | + { |
|
322 | + // required fields MUST be present, so let's make sure they are. |
|
323 | + if (empty($addon_name) || ! is_array($setup_args)) { |
|
324 | + throw new EE_Error( |
|
325 | + __( |
|
326 | + '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.', |
|
327 | + 'event_espresso' |
|
328 | + ) |
|
329 | + ); |
|
330 | + } |
|
331 | + if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
332 | + throw new EE_Error( |
|
333 | + sprintf( |
|
334 | + __( |
|
335 | + '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', |
|
336 | + 'event_espresso' |
|
337 | + ), |
|
338 | + implode(',', array_keys($setup_args)) |
|
339 | + ) |
|
340 | + ); |
|
341 | + } |
|
342 | + // check that addon has not already been registered with that name |
|
343 | + if (isset(self::$_settings[ $addon_name ]) && ! did_action('activate_plugin')) { |
|
344 | + throw new EE_Error( |
|
345 | + sprintf( |
|
346 | + __( |
|
347 | + 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', |
|
348 | + 'event_espresso' |
|
349 | + ), |
|
350 | + $addon_name |
|
351 | + ) |
|
352 | + ); |
|
353 | + } |
|
354 | + } |
|
355 | 355 | |
356 | 356 | |
357 | - /** |
|
358 | - * @param string $addon_name |
|
359 | - * @param array $setup_args |
|
360 | - * @return string |
|
361 | - */ |
|
362 | - private static function _parse_class_name($addon_name, array $setup_args) |
|
363 | - { |
|
364 | - if (empty($setup_args['class_name'])) { |
|
365 | - // generate one by first separating name with spaces |
|
366 | - $class_name = str_replace(array('-', '_'), ' ', trim($addon_name)); |
|
367 | - // capitalize, then replace spaces with underscores |
|
368 | - $class_name = str_replace(' ', '_', ucwords($class_name)); |
|
369 | - } else { |
|
370 | - $class_name = $setup_args['class_name']; |
|
371 | - } |
|
372 | - // check if classname is fully qualified or is a legacy classname already prefixed with 'EE_' |
|
373 | - return strpos($class_name, '\\') || strpos($class_name, 'EE_') === 0 |
|
374 | - ? $class_name |
|
375 | - : 'EE_' . $class_name; |
|
376 | - } |
|
357 | + /** |
|
358 | + * @param string $addon_name |
|
359 | + * @param array $setup_args |
|
360 | + * @return string |
|
361 | + */ |
|
362 | + private static function _parse_class_name($addon_name, array $setup_args) |
|
363 | + { |
|
364 | + if (empty($setup_args['class_name'])) { |
|
365 | + // generate one by first separating name with spaces |
|
366 | + $class_name = str_replace(array('-', '_'), ' ', trim($addon_name)); |
|
367 | + // capitalize, then replace spaces with underscores |
|
368 | + $class_name = str_replace(' ', '_', ucwords($class_name)); |
|
369 | + } else { |
|
370 | + $class_name = $setup_args['class_name']; |
|
371 | + } |
|
372 | + // check if classname is fully qualified or is a legacy classname already prefixed with 'EE_' |
|
373 | + return strpos($class_name, '\\') || strpos($class_name, 'EE_') === 0 |
|
374 | + ? $class_name |
|
375 | + : 'EE_' . $class_name; |
|
376 | + } |
|
377 | 377 | |
378 | 378 | |
379 | - /** |
|
380 | - * @param string $class_name |
|
381 | - * @param array $setup_args |
|
382 | - * @return array |
|
383 | - */ |
|
384 | - private static function _get_addon_settings($class_name, array $setup_args) |
|
385 | - { |
|
386 | - // setup $_settings array from incoming values. |
|
387 | - $addon_settings = array( |
|
388 | - // generated from the addon name, changes something like "calendar" to "EE_Calendar" |
|
389 | - 'class_name' => $class_name, |
|
390 | - // the addon slug for use in URLs, etc |
|
391 | - 'plugin_slug' => isset($setup_args['plugin_slug']) |
|
392 | - ? (string) $setup_args['plugin_slug'] |
|
393 | - : '', |
|
394 | - // page slug to be used when generating the "Settings" link on the WP plugin page |
|
395 | - 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
|
396 | - ? (string) $setup_args['plugin_action_slug'] |
|
397 | - : '', |
|
398 | - // the "software" version for the addon |
|
399 | - 'version' => isset($setup_args['version']) |
|
400 | - ? (string) $setup_args['version'] |
|
401 | - : '', |
|
402 | - // the minimum version of EE Core that the addon will work with |
|
403 | - 'min_core_version' => isset($setup_args['min_core_version']) |
|
404 | - ? (string) $setup_args['min_core_version'] |
|
405 | - : '', |
|
406 | - // the minimum version of WordPress that the addon will work with |
|
407 | - 'min_wp_version' => isset($setup_args['min_wp_version']) |
|
408 | - ? (string) $setup_args['min_wp_version'] |
|
409 | - : EE_MIN_WP_VER_REQUIRED, |
|
410 | - // full server path to main file (file loaded directly by WP) |
|
411 | - 'main_file_path' => isset($setup_args['main_file_path']) |
|
412 | - ? (string) $setup_args['main_file_path'] |
|
413 | - : '', |
|
414 | - // instance of \EventEspresso\core\domain\DomainInterface |
|
415 | - 'domain' => isset($setup_args['domain']) && $setup_args['domain'] instanceof DomainInterface |
|
416 | - ? $setup_args['domain'] |
|
417 | - : null, |
|
418 | - // Fully Qualified Class Name for the addon's Domain class |
|
419 | - 'domain_fqcn' => isset($setup_args['domain_fqcn']) |
|
420 | - ? (string) $setup_args['domain_fqcn'] |
|
421 | - : '', |
|
422 | - // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
|
423 | - 'admin_path' => isset($setup_args['admin_path']) |
|
424 | - ? (string) $setup_args['admin_path'] : '', |
|
425 | - // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
|
426 | - 'admin_callback' => isset($setup_args['admin_callback']) |
|
427 | - ? (string) $setup_args['admin_callback'] |
|
428 | - : '', |
|
429 | - // the section name for this addon's configuration settings section (defaults to "addons") |
|
430 | - 'config_section' => isset($setup_args['config_section']) |
|
431 | - ? (string) $setup_args['config_section'] |
|
432 | - : 'addons', |
|
433 | - // the class name for this addon's configuration settings object |
|
434 | - 'config_class' => isset($setup_args['config_class']) |
|
435 | - ? (string) $setup_args['config_class'] : '', |
|
436 | - // the name given to the config for this addons' configuration settings object (optional) |
|
437 | - 'config_name' => isset($setup_args['config_name']) |
|
438 | - ? (string) $setup_args['config_name'] : '', |
|
439 | - // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
|
440 | - 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
|
441 | - ? (array) $setup_args['autoloader_paths'] |
|
442 | - : array(), |
|
443 | - // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
|
444 | - 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
|
445 | - ? (array) $setup_args['autoloader_folders'] |
|
446 | - : array(), |
|
447 | - // array of full server paths to any EE_DMS data migration scripts used by the addon. |
|
448 | - // The key should be the EE_Addon class name that this set of data migration scripts belongs to. |
|
449 | - // If the EE_Addon class is namespaced, then this needs to be the Fully Qualified Class Name |
|
450 | - 'dms_paths' => isset($setup_args['dms_paths']) |
|
451 | - ? (array) $setup_args['dms_paths'] |
|
452 | - : array(), |
|
453 | - // array of full server paths to any EED_Modules used by the addon |
|
454 | - 'module_paths' => isset($setup_args['module_paths']) |
|
455 | - ? (array) $setup_args['module_paths'] |
|
456 | - : array(), |
|
457 | - // array of full server paths to any EES_Shortcodes used by the addon |
|
458 | - 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
|
459 | - ? (array) $setup_args['shortcode_paths'] |
|
460 | - : array(), |
|
461 | - 'shortcode_fqcns' => isset($setup_args['shortcode_fqcns']) |
|
462 | - ? (array) $setup_args['shortcode_fqcns'] |
|
463 | - : array(), |
|
464 | - // array of full server paths to any WP_Widgets used by the addon |
|
465 | - 'widget_paths' => isset($setup_args['widget_paths']) |
|
466 | - ? (array) $setup_args['widget_paths'] |
|
467 | - : array(), |
|
468 | - // array of PUE options used by the addon |
|
469 | - 'pue_options' => isset($setup_args['pue_options']) |
|
470 | - ? (array) $setup_args['pue_options'] |
|
471 | - : array(), |
|
472 | - 'message_types' => isset($setup_args['message_types']) |
|
473 | - ? (array) $setup_args['message_types'] |
|
474 | - : array(), |
|
475 | - 'capabilities' => isset($setup_args['capabilities']) |
|
476 | - ? (array) $setup_args['capabilities'] |
|
477 | - : array(), |
|
478 | - 'capability_maps' => isset($setup_args['capability_maps']) |
|
479 | - ? (array) $setup_args['capability_maps'] |
|
480 | - : array(), |
|
481 | - 'model_paths' => isset($setup_args['model_paths']) |
|
482 | - ? (array) $setup_args['model_paths'] |
|
483 | - : array(), |
|
484 | - 'class_paths' => isset($setup_args['class_paths']) |
|
485 | - ? (array) $setup_args['class_paths'] |
|
486 | - : array(), |
|
487 | - 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
|
488 | - ? (array) $setup_args['model_extension_paths'] |
|
489 | - : array(), |
|
490 | - 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
|
491 | - ? (array) $setup_args['class_extension_paths'] |
|
492 | - : array(), |
|
493 | - 'custom_post_types' => isset($setup_args['custom_post_types']) |
|
494 | - ? (array) $setup_args['custom_post_types'] |
|
495 | - : array(), |
|
496 | - 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
|
497 | - ? (array) $setup_args['custom_taxonomies'] |
|
498 | - : array(), |
|
499 | - 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
|
500 | - ? (array) $setup_args['payment_method_paths'] |
|
501 | - : array(), |
|
502 | - 'default_terms' => isset($setup_args['default_terms']) |
|
503 | - ? (array) $setup_args['default_terms'] |
|
504 | - : array(), |
|
505 | - // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
|
506 | - // that can be used for adding upgrading/marketing info |
|
507 | - 'plugins_page_row' => isset($setup_args['plugins_page_row']) |
|
508 | - ? $setup_args['plugins_page_row'] |
|
509 | - : '', |
|
510 | - 'namespace' => isset( |
|
511 | - $setup_args['namespace']['FQNS'], |
|
512 | - $setup_args['namespace']['DIR'] |
|
513 | - ) |
|
514 | - ? (array) $setup_args['namespace'] |
|
515 | - : array(), |
|
516 | - 'privacy_policies' => isset($setup_args['privacy_policies']) |
|
517 | - ? (array) $setup_args['privacy_policies'] |
|
518 | - : '', |
|
519 | - ); |
|
520 | - // if plugin_action_slug is NOT set, but an admin page path IS set, |
|
521 | - // then let's just use the plugin_slug since that will be used for linking to the admin page |
|
522 | - $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) |
|
523 | - && ! empty($addon_settings['admin_path']) |
|
524 | - ? $addon_settings['plugin_slug'] |
|
525 | - : $addon_settings['plugin_action_slug']; |
|
526 | - // full server path to main file (file loaded directly by WP) |
|
527 | - $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']); |
|
528 | - return $addon_settings; |
|
529 | - } |
|
379 | + /** |
|
380 | + * @param string $class_name |
|
381 | + * @param array $setup_args |
|
382 | + * @return array |
|
383 | + */ |
|
384 | + private static function _get_addon_settings($class_name, array $setup_args) |
|
385 | + { |
|
386 | + // setup $_settings array from incoming values. |
|
387 | + $addon_settings = array( |
|
388 | + // generated from the addon name, changes something like "calendar" to "EE_Calendar" |
|
389 | + 'class_name' => $class_name, |
|
390 | + // the addon slug for use in URLs, etc |
|
391 | + 'plugin_slug' => isset($setup_args['plugin_slug']) |
|
392 | + ? (string) $setup_args['plugin_slug'] |
|
393 | + : '', |
|
394 | + // page slug to be used when generating the "Settings" link on the WP plugin page |
|
395 | + 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
|
396 | + ? (string) $setup_args['plugin_action_slug'] |
|
397 | + : '', |
|
398 | + // the "software" version for the addon |
|
399 | + 'version' => isset($setup_args['version']) |
|
400 | + ? (string) $setup_args['version'] |
|
401 | + : '', |
|
402 | + // the minimum version of EE Core that the addon will work with |
|
403 | + 'min_core_version' => isset($setup_args['min_core_version']) |
|
404 | + ? (string) $setup_args['min_core_version'] |
|
405 | + : '', |
|
406 | + // the minimum version of WordPress that the addon will work with |
|
407 | + 'min_wp_version' => isset($setup_args['min_wp_version']) |
|
408 | + ? (string) $setup_args['min_wp_version'] |
|
409 | + : EE_MIN_WP_VER_REQUIRED, |
|
410 | + // full server path to main file (file loaded directly by WP) |
|
411 | + 'main_file_path' => isset($setup_args['main_file_path']) |
|
412 | + ? (string) $setup_args['main_file_path'] |
|
413 | + : '', |
|
414 | + // instance of \EventEspresso\core\domain\DomainInterface |
|
415 | + 'domain' => isset($setup_args['domain']) && $setup_args['domain'] instanceof DomainInterface |
|
416 | + ? $setup_args['domain'] |
|
417 | + : null, |
|
418 | + // Fully Qualified Class Name for the addon's Domain class |
|
419 | + 'domain_fqcn' => isset($setup_args['domain_fqcn']) |
|
420 | + ? (string) $setup_args['domain_fqcn'] |
|
421 | + : '', |
|
422 | + // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
|
423 | + 'admin_path' => isset($setup_args['admin_path']) |
|
424 | + ? (string) $setup_args['admin_path'] : '', |
|
425 | + // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
|
426 | + 'admin_callback' => isset($setup_args['admin_callback']) |
|
427 | + ? (string) $setup_args['admin_callback'] |
|
428 | + : '', |
|
429 | + // the section name for this addon's configuration settings section (defaults to "addons") |
|
430 | + 'config_section' => isset($setup_args['config_section']) |
|
431 | + ? (string) $setup_args['config_section'] |
|
432 | + : 'addons', |
|
433 | + // the class name for this addon's configuration settings object |
|
434 | + 'config_class' => isset($setup_args['config_class']) |
|
435 | + ? (string) $setup_args['config_class'] : '', |
|
436 | + // the name given to the config for this addons' configuration settings object (optional) |
|
437 | + 'config_name' => isset($setup_args['config_name']) |
|
438 | + ? (string) $setup_args['config_name'] : '', |
|
439 | + // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
|
440 | + 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
|
441 | + ? (array) $setup_args['autoloader_paths'] |
|
442 | + : array(), |
|
443 | + // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
|
444 | + 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
|
445 | + ? (array) $setup_args['autoloader_folders'] |
|
446 | + : array(), |
|
447 | + // array of full server paths to any EE_DMS data migration scripts used by the addon. |
|
448 | + // The key should be the EE_Addon class name that this set of data migration scripts belongs to. |
|
449 | + // If the EE_Addon class is namespaced, then this needs to be the Fully Qualified Class Name |
|
450 | + 'dms_paths' => isset($setup_args['dms_paths']) |
|
451 | + ? (array) $setup_args['dms_paths'] |
|
452 | + : array(), |
|
453 | + // array of full server paths to any EED_Modules used by the addon |
|
454 | + 'module_paths' => isset($setup_args['module_paths']) |
|
455 | + ? (array) $setup_args['module_paths'] |
|
456 | + : array(), |
|
457 | + // array of full server paths to any EES_Shortcodes used by the addon |
|
458 | + 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
|
459 | + ? (array) $setup_args['shortcode_paths'] |
|
460 | + : array(), |
|
461 | + 'shortcode_fqcns' => isset($setup_args['shortcode_fqcns']) |
|
462 | + ? (array) $setup_args['shortcode_fqcns'] |
|
463 | + : array(), |
|
464 | + // array of full server paths to any WP_Widgets used by the addon |
|
465 | + 'widget_paths' => isset($setup_args['widget_paths']) |
|
466 | + ? (array) $setup_args['widget_paths'] |
|
467 | + : array(), |
|
468 | + // array of PUE options used by the addon |
|
469 | + 'pue_options' => isset($setup_args['pue_options']) |
|
470 | + ? (array) $setup_args['pue_options'] |
|
471 | + : array(), |
|
472 | + 'message_types' => isset($setup_args['message_types']) |
|
473 | + ? (array) $setup_args['message_types'] |
|
474 | + : array(), |
|
475 | + 'capabilities' => isset($setup_args['capabilities']) |
|
476 | + ? (array) $setup_args['capabilities'] |
|
477 | + : array(), |
|
478 | + 'capability_maps' => isset($setup_args['capability_maps']) |
|
479 | + ? (array) $setup_args['capability_maps'] |
|
480 | + : array(), |
|
481 | + 'model_paths' => isset($setup_args['model_paths']) |
|
482 | + ? (array) $setup_args['model_paths'] |
|
483 | + : array(), |
|
484 | + 'class_paths' => isset($setup_args['class_paths']) |
|
485 | + ? (array) $setup_args['class_paths'] |
|
486 | + : array(), |
|
487 | + 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
|
488 | + ? (array) $setup_args['model_extension_paths'] |
|
489 | + : array(), |
|
490 | + 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
|
491 | + ? (array) $setup_args['class_extension_paths'] |
|
492 | + : array(), |
|
493 | + 'custom_post_types' => isset($setup_args['custom_post_types']) |
|
494 | + ? (array) $setup_args['custom_post_types'] |
|
495 | + : array(), |
|
496 | + 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
|
497 | + ? (array) $setup_args['custom_taxonomies'] |
|
498 | + : array(), |
|
499 | + 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
|
500 | + ? (array) $setup_args['payment_method_paths'] |
|
501 | + : array(), |
|
502 | + 'default_terms' => isset($setup_args['default_terms']) |
|
503 | + ? (array) $setup_args['default_terms'] |
|
504 | + : array(), |
|
505 | + // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
|
506 | + // that can be used for adding upgrading/marketing info |
|
507 | + 'plugins_page_row' => isset($setup_args['plugins_page_row']) |
|
508 | + ? $setup_args['plugins_page_row'] |
|
509 | + : '', |
|
510 | + 'namespace' => isset( |
|
511 | + $setup_args['namespace']['FQNS'], |
|
512 | + $setup_args['namespace']['DIR'] |
|
513 | + ) |
|
514 | + ? (array) $setup_args['namespace'] |
|
515 | + : array(), |
|
516 | + 'privacy_policies' => isset($setup_args['privacy_policies']) |
|
517 | + ? (array) $setup_args['privacy_policies'] |
|
518 | + : '', |
|
519 | + ); |
|
520 | + // if plugin_action_slug is NOT set, but an admin page path IS set, |
|
521 | + // then let's just use the plugin_slug since that will be used for linking to the admin page |
|
522 | + $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) |
|
523 | + && ! empty($addon_settings['admin_path']) |
|
524 | + ? $addon_settings['plugin_slug'] |
|
525 | + : $addon_settings['plugin_action_slug']; |
|
526 | + // full server path to main file (file loaded directly by WP) |
|
527 | + $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']); |
|
528 | + return $addon_settings; |
|
529 | + } |
|
530 | 530 | |
531 | 531 | |
532 | - /** |
|
533 | - * @param string $addon_name |
|
534 | - * @param array $addon_settings |
|
535 | - * @return boolean |
|
536 | - */ |
|
537 | - private static function _addon_is_compatible($addon_name, array $addon_settings) |
|
538 | - { |
|
539 | - global $wp_version; |
|
540 | - $incompatibility_message = ''; |
|
541 | - // check whether this addon version is compatible with EE core |
|
542 | - if (isset(EE_Register_Addon::$_incompatible_addons[ $addon_name ]) |
|
543 | - && ! self::_meets_min_core_version_requirement( |
|
544 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
545 | - $addon_settings['version'] |
|
546 | - ) |
|
547 | - ) { |
|
548 | - $incompatibility_message = sprintf( |
|
549 | - __( |
|
550 | - '%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.', |
|
551 | - 'event_espresso' |
|
552 | - ), |
|
553 | - $addon_name, |
|
554 | - '<br />', |
|
555 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
556 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
557 | - '</span><br />' |
|
558 | - ); |
|
559 | - } elseif (! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
560 | - ) { |
|
561 | - $incompatibility_message = sprintf( |
|
562 | - __( |
|
563 | - '%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".', |
|
564 | - 'event_espresso' |
|
565 | - ), |
|
566 | - $addon_name, |
|
567 | - self::_effective_version($addon_settings['min_core_version']), |
|
568 | - self::_effective_version(espresso_version()), |
|
569 | - '<br />', |
|
570 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
571 | - '</span><br />' |
|
572 | - ); |
|
573 | - } elseif (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) { |
|
574 | - $incompatibility_message = sprintf( |
|
575 | - __( |
|
576 | - '%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.', |
|
577 | - 'event_espresso' |
|
578 | - ), |
|
579 | - $addon_name, |
|
580 | - $addon_settings['min_wp_version'], |
|
581 | - '<br />', |
|
582 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
583 | - '</span><br />' |
|
584 | - ); |
|
585 | - } |
|
586 | - if (! empty($incompatibility_message)) { |
|
587 | - // remove 'activate' from the REQUEST |
|
588 | - // so WP doesn't erroneously tell the user the plugin activated fine when it didn't |
|
589 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
590 | - if (current_user_can('activate_plugins')) { |
|
591 | - // show an error message indicating the plugin didn't activate properly |
|
592 | - EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__); |
|
593 | - } |
|
594 | - // BAIL FROM THE ADDON REGISTRATION PROCESS |
|
595 | - return false; |
|
596 | - } |
|
597 | - // addon IS compatible |
|
598 | - return true; |
|
599 | - } |
|
532 | + /** |
|
533 | + * @param string $addon_name |
|
534 | + * @param array $addon_settings |
|
535 | + * @return boolean |
|
536 | + */ |
|
537 | + private static function _addon_is_compatible($addon_name, array $addon_settings) |
|
538 | + { |
|
539 | + global $wp_version; |
|
540 | + $incompatibility_message = ''; |
|
541 | + // check whether this addon version is compatible with EE core |
|
542 | + if (isset(EE_Register_Addon::$_incompatible_addons[ $addon_name ]) |
|
543 | + && ! self::_meets_min_core_version_requirement( |
|
544 | + EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
545 | + $addon_settings['version'] |
|
546 | + ) |
|
547 | + ) { |
|
548 | + $incompatibility_message = sprintf( |
|
549 | + __( |
|
550 | + '%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.', |
|
551 | + 'event_espresso' |
|
552 | + ), |
|
553 | + $addon_name, |
|
554 | + '<br />', |
|
555 | + EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
556 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
557 | + '</span><br />' |
|
558 | + ); |
|
559 | + } elseif (! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
560 | + ) { |
|
561 | + $incompatibility_message = sprintf( |
|
562 | + __( |
|
563 | + '%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".', |
|
564 | + 'event_espresso' |
|
565 | + ), |
|
566 | + $addon_name, |
|
567 | + self::_effective_version($addon_settings['min_core_version']), |
|
568 | + self::_effective_version(espresso_version()), |
|
569 | + '<br />', |
|
570 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
571 | + '</span><br />' |
|
572 | + ); |
|
573 | + } elseif (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) { |
|
574 | + $incompatibility_message = sprintf( |
|
575 | + __( |
|
576 | + '%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.', |
|
577 | + 'event_espresso' |
|
578 | + ), |
|
579 | + $addon_name, |
|
580 | + $addon_settings['min_wp_version'], |
|
581 | + '<br />', |
|
582 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
583 | + '</span><br />' |
|
584 | + ); |
|
585 | + } |
|
586 | + if (! empty($incompatibility_message)) { |
|
587 | + // remove 'activate' from the REQUEST |
|
588 | + // so WP doesn't erroneously tell the user the plugin activated fine when it didn't |
|
589 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
590 | + if (current_user_can('activate_plugins')) { |
|
591 | + // show an error message indicating the plugin didn't activate properly |
|
592 | + EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__); |
|
593 | + } |
|
594 | + // BAIL FROM THE ADDON REGISTRATION PROCESS |
|
595 | + return false; |
|
596 | + } |
|
597 | + // addon IS compatible |
|
598 | + return true; |
|
599 | + } |
|
600 | 600 | |
601 | 601 | |
602 | - /** |
|
603 | - * if plugin update engine is being used for auto-updates, |
|
604 | - * then let's set that up now before going any further so that ALL addons can be updated |
|
605 | - * (not needed if PUE is not being used) |
|
606 | - * |
|
607 | - * @param string $addon_name |
|
608 | - * @param string $class_name |
|
609 | - * @param array $setup_args |
|
610 | - * @return void |
|
611 | - */ |
|
612 | - private static function _parse_pue_options($addon_name, $class_name, array $setup_args) |
|
613 | - { |
|
614 | - if (! empty($setup_args['pue_options'])) { |
|
615 | - self::$_settings[ $addon_name ]['pue_options'] = array( |
|
616 | - 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
|
617 | - ? (string) $setup_args['pue_options']['pue_plugin_slug'] |
|
618 | - : 'espresso_' . strtolower($class_name), |
|
619 | - 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
|
620 | - ? (string) $setup_args['pue_options']['plugin_basename'] |
|
621 | - : plugin_basename($setup_args['main_file_path']), |
|
622 | - 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
|
623 | - ? (string) $setup_args['pue_options']['checkPeriod'] |
|
624 | - : '24', |
|
625 | - 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
|
626 | - ? (string) $setup_args['pue_options']['use_wp_update'] |
|
627 | - : false, |
|
628 | - ); |
|
629 | - add_action( |
|
630 | - 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
631 | - array('EE_Register_Addon', 'load_pue_update') |
|
632 | - ); |
|
633 | - } |
|
634 | - } |
|
602 | + /** |
|
603 | + * if plugin update engine is being used for auto-updates, |
|
604 | + * then let's set that up now before going any further so that ALL addons can be updated |
|
605 | + * (not needed if PUE is not being used) |
|
606 | + * |
|
607 | + * @param string $addon_name |
|
608 | + * @param string $class_name |
|
609 | + * @param array $setup_args |
|
610 | + * @return void |
|
611 | + */ |
|
612 | + private static function _parse_pue_options($addon_name, $class_name, array $setup_args) |
|
613 | + { |
|
614 | + if (! empty($setup_args['pue_options'])) { |
|
615 | + self::$_settings[ $addon_name ]['pue_options'] = array( |
|
616 | + 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
|
617 | + ? (string) $setup_args['pue_options']['pue_plugin_slug'] |
|
618 | + : 'espresso_' . strtolower($class_name), |
|
619 | + 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
|
620 | + ? (string) $setup_args['pue_options']['plugin_basename'] |
|
621 | + : plugin_basename($setup_args['main_file_path']), |
|
622 | + 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
|
623 | + ? (string) $setup_args['pue_options']['checkPeriod'] |
|
624 | + : '24', |
|
625 | + 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
|
626 | + ? (string) $setup_args['pue_options']['use_wp_update'] |
|
627 | + : false, |
|
628 | + ); |
|
629 | + add_action( |
|
630 | + 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
631 | + array('EE_Register_Addon', 'load_pue_update') |
|
632 | + ); |
|
633 | + } |
|
634 | + } |
|
635 | 635 | |
636 | 636 | |
637 | - /** |
|
638 | - * register namespaces right away before any other files or classes get loaded, but AFTER the version checks |
|
639 | - * |
|
640 | - * @param array $addon_settings |
|
641 | - * @return void |
|
642 | - */ |
|
643 | - private static function _setup_namespaces(array $addon_settings) |
|
644 | - { |
|
645 | - // |
|
646 | - if (isset( |
|
647 | - $addon_settings['namespace']['FQNS'], |
|
648 | - $addon_settings['namespace']['DIR'] |
|
649 | - )) { |
|
650 | - EE_Psr4AutoloaderInit::psr4_loader()->addNamespace( |
|
651 | - $addon_settings['namespace']['FQNS'], |
|
652 | - $addon_settings['namespace']['DIR'] |
|
653 | - ); |
|
654 | - } |
|
655 | - } |
|
637 | + /** |
|
638 | + * register namespaces right away before any other files or classes get loaded, but AFTER the version checks |
|
639 | + * |
|
640 | + * @param array $addon_settings |
|
641 | + * @return void |
|
642 | + */ |
|
643 | + private static function _setup_namespaces(array $addon_settings) |
|
644 | + { |
|
645 | + // |
|
646 | + if (isset( |
|
647 | + $addon_settings['namespace']['FQNS'], |
|
648 | + $addon_settings['namespace']['DIR'] |
|
649 | + )) { |
|
650 | + EE_Psr4AutoloaderInit::psr4_loader()->addNamespace( |
|
651 | + $addon_settings['namespace']['FQNS'], |
|
652 | + $addon_settings['namespace']['DIR'] |
|
653 | + ); |
|
654 | + } |
|
655 | + } |
|
656 | 656 | |
657 | 657 | |
658 | - /** |
|
659 | - * @param string $addon_name |
|
660 | - * @param array $addon_settings |
|
661 | - * @return bool |
|
662 | - * @throws EE_Error |
|
663 | - * @throws InvalidArgumentException |
|
664 | - * @throws ReflectionException |
|
665 | - * @throws InvalidDataTypeException |
|
666 | - * @throws InvalidInterfaceException |
|
667 | - */ |
|
668 | - private static function _addon_activation($addon_name, array $addon_settings) |
|
669 | - { |
|
670 | - // this is an activation request |
|
671 | - if (did_action( |
|
672 | - 'activate_plugin' |
|
673 | - )) {// to find if THIS is the addon that was activated, just check if we have already registered it or not |
|
674 | - // (as the newly-activated addon wasn't around the first time addons were registered). |
|
675 | - // Note: the presence of pue_options in the addon registration options will initialize the $_settings |
|
676 | - // property for the add-on, but the add-on is only partially initialized. Hence, the additional check. |
|
677 | - if (! isset(self::$_settings[ $addon_name ]) |
|
678 | - || (isset(self::$_settings[ $addon_name ]) |
|
679 | - && ! isset(self::$_settings[ $addon_name ]['class_name']) |
|
680 | - ) |
|
681 | - ) { |
|
682 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
683 | - $addon = self::_load_and_init_addon_class($addon_name); |
|
684 | - $addon->set_activation_indicator_option(); |
|
685 | - // dont bother setting up the rest of the addon. |
|
686 | - // we know it was just activated and the request will end soon |
|
687 | - } |
|
688 | - return true; |
|
689 | - } |
|
690 | - // make sure this was called in the right place! |
|
691 | - if (! did_action('AHEE__EE_System__load_espresso_addons') |
|
692 | - || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
|
693 | - ) { |
|
694 | - EE_Error::doing_it_wrong( |
|
695 | - __METHOD__, |
|
696 | - sprintf( |
|
697 | - __( |
|
698 | - '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.', |
|
699 | - 'event_espresso' |
|
700 | - ), |
|
701 | - $addon_name |
|
702 | - ), |
|
703 | - '4.3.0' |
|
704 | - ); |
|
705 | - } |
|
706 | - // make sure addon settings are set correctly without overwriting anything existing |
|
707 | - if (isset(self::$_settings[ $addon_name ])) { |
|
708 | - self::$_settings[ $addon_name ] += $addon_settings; |
|
709 | - } else { |
|
710 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
711 | - } |
|
712 | - return false; |
|
713 | - } |
|
658 | + /** |
|
659 | + * @param string $addon_name |
|
660 | + * @param array $addon_settings |
|
661 | + * @return bool |
|
662 | + * @throws EE_Error |
|
663 | + * @throws InvalidArgumentException |
|
664 | + * @throws ReflectionException |
|
665 | + * @throws InvalidDataTypeException |
|
666 | + * @throws InvalidInterfaceException |
|
667 | + */ |
|
668 | + private static function _addon_activation($addon_name, array $addon_settings) |
|
669 | + { |
|
670 | + // this is an activation request |
|
671 | + if (did_action( |
|
672 | + 'activate_plugin' |
|
673 | + )) {// to find if THIS is the addon that was activated, just check if we have already registered it or not |
|
674 | + // (as the newly-activated addon wasn't around the first time addons were registered). |
|
675 | + // Note: the presence of pue_options in the addon registration options will initialize the $_settings |
|
676 | + // property for the add-on, but the add-on is only partially initialized. Hence, the additional check. |
|
677 | + if (! isset(self::$_settings[ $addon_name ]) |
|
678 | + || (isset(self::$_settings[ $addon_name ]) |
|
679 | + && ! isset(self::$_settings[ $addon_name ]['class_name']) |
|
680 | + ) |
|
681 | + ) { |
|
682 | + self::$_settings[ $addon_name ] = $addon_settings; |
|
683 | + $addon = self::_load_and_init_addon_class($addon_name); |
|
684 | + $addon->set_activation_indicator_option(); |
|
685 | + // dont bother setting up the rest of the addon. |
|
686 | + // we know it was just activated and the request will end soon |
|
687 | + } |
|
688 | + return true; |
|
689 | + } |
|
690 | + // make sure this was called in the right place! |
|
691 | + if (! did_action('AHEE__EE_System__load_espresso_addons') |
|
692 | + || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
|
693 | + ) { |
|
694 | + EE_Error::doing_it_wrong( |
|
695 | + __METHOD__, |
|
696 | + sprintf( |
|
697 | + __( |
|
698 | + '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.', |
|
699 | + 'event_espresso' |
|
700 | + ), |
|
701 | + $addon_name |
|
702 | + ), |
|
703 | + '4.3.0' |
|
704 | + ); |
|
705 | + } |
|
706 | + // make sure addon settings are set correctly without overwriting anything existing |
|
707 | + if (isset(self::$_settings[ $addon_name ])) { |
|
708 | + self::$_settings[ $addon_name ] += $addon_settings; |
|
709 | + } else { |
|
710 | + self::$_settings[ $addon_name ] = $addon_settings; |
|
711 | + } |
|
712 | + return false; |
|
713 | + } |
|
714 | 714 | |
715 | 715 | |
716 | - /** |
|
717 | - * @param string $addon_name |
|
718 | - * @return void |
|
719 | - * @throws EE_Error |
|
720 | - */ |
|
721 | - private static function _setup_autoloaders($addon_name) |
|
722 | - { |
|
723 | - if (! empty(self::$_settings[ $addon_name ]['autoloader_paths'])) { |
|
724 | - // setup autoloader for single file |
|
725 | - EEH_Autoloader::instance()->register_autoloader(self::$_settings[ $addon_name ]['autoloader_paths']); |
|
726 | - } |
|
727 | - // setup autoloaders for folders |
|
728 | - if (! empty(self::$_settings[ $addon_name ]['autoloader_folders'])) { |
|
729 | - foreach ((array) self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder) { |
|
730 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
|
731 | - } |
|
732 | - } |
|
733 | - } |
|
716 | + /** |
|
717 | + * @param string $addon_name |
|
718 | + * @return void |
|
719 | + * @throws EE_Error |
|
720 | + */ |
|
721 | + private static function _setup_autoloaders($addon_name) |
|
722 | + { |
|
723 | + if (! empty(self::$_settings[ $addon_name ]['autoloader_paths'])) { |
|
724 | + // setup autoloader for single file |
|
725 | + EEH_Autoloader::instance()->register_autoloader(self::$_settings[ $addon_name ]['autoloader_paths']); |
|
726 | + } |
|
727 | + // setup autoloaders for folders |
|
728 | + if (! empty(self::$_settings[ $addon_name ]['autoloader_folders'])) { |
|
729 | + foreach ((array) self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder) { |
|
730 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
|
731 | + } |
|
732 | + } |
|
733 | + } |
|
734 | 734 | |
735 | 735 | |
736 | - /** |
|
737 | - * register new models and extensions |
|
738 | - * |
|
739 | - * @param string $addon_name |
|
740 | - * @return void |
|
741 | - * @throws EE_Error |
|
742 | - */ |
|
743 | - private static function _register_models_and_extensions($addon_name) |
|
744 | - { |
|
745 | - // register new models |
|
746 | - if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
747 | - || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
748 | - ) { |
|
749 | - EE_Register_Model::register( |
|
750 | - $addon_name, |
|
751 | - array( |
|
752 | - 'model_paths' => self::$_settings[ $addon_name ]['model_paths'], |
|
753 | - 'class_paths' => self::$_settings[ $addon_name ]['class_paths'], |
|
754 | - ) |
|
755 | - ); |
|
756 | - } |
|
757 | - // register model extensions |
|
758 | - if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
759 | - || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
760 | - ) { |
|
761 | - EE_Register_Model_Extensions::register( |
|
762 | - $addon_name, |
|
763 | - array( |
|
764 | - 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'], |
|
765 | - 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'], |
|
766 | - ) |
|
767 | - ); |
|
768 | - } |
|
769 | - } |
|
736 | + /** |
|
737 | + * register new models and extensions |
|
738 | + * |
|
739 | + * @param string $addon_name |
|
740 | + * @return void |
|
741 | + * @throws EE_Error |
|
742 | + */ |
|
743 | + private static function _register_models_and_extensions($addon_name) |
|
744 | + { |
|
745 | + // register new models |
|
746 | + if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
747 | + || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
748 | + ) { |
|
749 | + EE_Register_Model::register( |
|
750 | + $addon_name, |
|
751 | + array( |
|
752 | + 'model_paths' => self::$_settings[ $addon_name ]['model_paths'], |
|
753 | + 'class_paths' => self::$_settings[ $addon_name ]['class_paths'], |
|
754 | + ) |
|
755 | + ); |
|
756 | + } |
|
757 | + // register model extensions |
|
758 | + if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
759 | + || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
760 | + ) { |
|
761 | + EE_Register_Model_Extensions::register( |
|
762 | + $addon_name, |
|
763 | + array( |
|
764 | + 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'], |
|
765 | + 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'], |
|
766 | + ) |
|
767 | + ); |
|
768 | + } |
|
769 | + } |
|
770 | 770 | |
771 | 771 | |
772 | - /** |
|
773 | - * @param string $addon_name |
|
774 | - * @return void |
|
775 | - * @throws EE_Error |
|
776 | - */ |
|
777 | - private static function _register_data_migration_scripts($addon_name) |
|
778 | - { |
|
779 | - // setup DMS |
|
780 | - if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
781 | - EE_Register_Data_Migration_Scripts::register( |
|
782 | - $addon_name, |
|
783 | - array('dms_paths' => self::$_settings[ $addon_name ]['dms_paths']) |
|
784 | - ); |
|
785 | - } |
|
786 | - } |
|
772 | + /** |
|
773 | + * @param string $addon_name |
|
774 | + * @return void |
|
775 | + * @throws EE_Error |
|
776 | + */ |
|
777 | + private static function _register_data_migration_scripts($addon_name) |
|
778 | + { |
|
779 | + // setup DMS |
|
780 | + if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
781 | + EE_Register_Data_Migration_Scripts::register( |
|
782 | + $addon_name, |
|
783 | + array('dms_paths' => self::$_settings[ $addon_name ]['dms_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_config($addon_name) |
|
795 | - { |
|
796 | - // if config_class is present let's register config. |
|
797 | - if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
798 | - EE_Register_Config::register( |
|
799 | - self::$_settings[ $addon_name ]['config_class'], |
|
800 | - array( |
|
801 | - 'config_section' => self::$_settings[ $addon_name ]['config_section'], |
|
802 | - 'config_name' => self::$_settings[ $addon_name ]['config_name'], |
|
803 | - ) |
|
804 | - ); |
|
805 | - } |
|
806 | - } |
|
789 | + /** |
|
790 | + * @param string $addon_name |
|
791 | + * @return void |
|
792 | + * @throws EE_Error |
|
793 | + */ |
|
794 | + private static function _register_config($addon_name) |
|
795 | + { |
|
796 | + // if config_class is present let's register config. |
|
797 | + if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
798 | + EE_Register_Config::register( |
|
799 | + self::$_settings[ $addon_name ]['config_class'], |
|
800 | + array( |
|
801 | + 'config_section' => self::$_settings[ $addon_name ]['config_section'], |
|
802 | + 'config_name' => self::$_settings[ $addon_name ]['config_name'], |
|
803 | + ) |
|
804 | + ); |
|
805 | + } |
|
806 | + } |
|
807 | 807 | |
808 | 808 | |
809 | - /** |
|
810 | - * @param string $addon_name |
|
811 | - * @return void |
|
812 | - * @throws EE_Error |
|
813 | - */ |
|
814 | - private static function _register_admin_pages($addon_name) |
|
815 | - { |
|
816 | - if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
817 | - EE_Register_Admin_Page::register( |
|
818 | - $addon_name, |
|
819 | - array('page_path' => self::$_settings[ $addon_name ]['admin_path']) |
|
820 | - ); |
|
821 | - } |
|
822 | - } |
|
809 | + /** |
|
810 | + * @param string $addon_name |
|
811 | + * @return void |
|
812 | + * @throws EE_Error |
|
813 | + */ |
|
814 | + private static function _register_admin_pages($addon_name) |
|
815 | + { |
|
816 | + if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
817 | + EE_Register_Admin_Page::register( |
|
818 | + $addon_name, |
|
819 | + array('page_path' => self::$_settings[ $addon_name ]['admin_path']) |
|
820 | + ); |
|
821 | + } |
|
822 | + } |
|
823 | 823 | |
824 | 824 | |
825 | - /** |
|
826 | - * @param string $addon_name |
|
827 | - * @return void |
|
828 | - * @throws EE_Error |
|
829 | - */ |
|
830 | - private static function _register_modules($addon_name) |
|
831 | - { |
|
832 | - if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
833 | - EE_Register_Module::register( |
|
834 | - $addon_name, |
|
835 | - array('module_paths' => self::$_settings[ $addon_name ]['module_paths']) |
|
836 | - ); |
|
837 | - } |
|
838 | - } |
|
825 | + /** |
|
826 | + * @param string $addon_name |
|
827 | + * @return void |
|
828 | + * @throws EE_Error |
|
829 | + */ |
|
830 | + private static function _register_modules($addon_name) |
|
831 | + { |
|
832 | + if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
833 | + EE_Register_Module::register( |
|
834 | + $addon_name, |
|
835 | + array('module_paths' => self::$_settings[ $addon_name ]['module_paths']) |
|
836 | + ); |
|
837 | + } |
|
838 | + } |
|
839 | 839 | |
840 | 840 | |
841 | - /** |
|
842 | - * @param string $addon_name |
|
843 | - * @return void |
|
844 | - * @throws EE_Error |
|
845 | - */ |
|
846 | - private static function _register_shortcodes($addon_name) |
|
847 | - { |
|
848 | - if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
849 | - || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
850 | - ) { |
|
851 | - EE_Register_Shortcode::register( |
|
852 | - $addon_name, |
|
853 | - array( |
|
854 | - 'shortcode_paths' => isset(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
855 | - ? self::$_settings[ $addon_name ]['shortcode_paths'] |
|
856 | - : array(), |
|
857 | - 'shortcode_fqcns' => isset(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
858 | - ? self::$_settings[ $addon_name ]['shortcode_fqcns'] |
|
859 | - : array(), |
|
860 | - ) |
|
861 | - ); |
|
862 | - } |
|
863 | - } |
|
841 | + /** |
|
842 | + * @param string $addon_name |
|
843 | + * @return void |
|
844 | + * @throws EE_Error |
|
845 | + */ |
|
846 | + private static function _register_shortcodes($addon_name) |
|
847 | + { |
|
848 | + if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
849 | + || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
850 | + ) { |
|
851 | + EE_Register_Shortcode::register( |
|
852 | + $addon_name, |
|
853 | + array( |
|
854 | + 'shortcode_paths' => isset(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
855 | + ? self::$_settings[ $addon_name ]['shortcode_paths'] |
|
856 | + : array(), |
|
857 | + 'shortcode_fqcns' => isset(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
858 | + ? self::$_settings[ $addon_name ]['shortcode_fqcns'] |
|
859 | + : array(), |
|
860 | + ) |
|
861 | + ); |
|
862 | + } |
|
863 | + } |
|
864 | 864 | |
865 | 865 | |
866 | - /** |
|
867 | - * @param string $addon_name |
|
868 | - * @return void |
|
869 | - * @throws EE_Error |
|
870 | - */ |
|
871 | - private static function _register_widgets($addon_name) |
|
872 | - { |
|
873 | - if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
874 | - EE_Register_Widget::register( |
|
875 | - $addon_name, |
|
876 | - array('widget_paths' => self::$_settings[ $addon_name ]['widget_paths']) |
|
877 | - ); |
|
878 | - } |
|
879 | - } |
|
866 | + /** |
|
867 | + * @param string $addon_name |
|
868 | + * @return void |
|
869 | + * @throws EE_Error |
|
870 | + */ |
|
871 | + private static function _register_widgets($addon_name) |
|
872 | + { |
|
873 | + if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
874 | + EE_Register_Widget::register( |
|
875 | + $addon_name, |
|
876 | + array('widget_paths' => self::$_settings[ $addon_name ]['widget_paths']) |
|
877 | + ); |
|
878 | + } |
|
879 | + } |
|
880 | 880 | |
881 | 881 | |
882 | - /** |
|
883 | - * @param string $addon_name |
|
884 | - * @return void |
|
885 | - * @throws EE_Error |
|
886 | - */ |
|
887 | - private static function _register_capabilities($addon_name) |
|
888 | - { |
|
889 | - if (! empty(self::$_settings[ $addon_name ]['capabilities'])) { |
|
890 | - EE_Register_Capabilities::register( |
|
891 | - $addon_name, |
|
892 | - array( |
|
893 | - 'capabilities' => self::$_settings[ $addon_name ]['capabilities'], |
|
894 | - 'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'], |
|
895 | - ) |
|
896 | - ); |
|
897 | - } |
|
898 | - } |
|
882 | + /** |
|
883 | + * @param string $addon_name |
|
884 | + * @return void |
|
885 | + * @throws EE_Error |
|
886 | + */ |
|
887 | + private static function _register_capabilities($addon_name) |
|
888 | + { |
|
889 | + if (! empty(self::$_settings[ $addon_name ]['capabilities'])) { |
|
890 | + EE_Register_Capabilities::register( |
|
891 | + $addon_name, |
|
892 | + array( |
|
893 | + 'capabilities' => self::$_settings[ $addon_name ]['capabilities'], |
|
894 | + 'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'], |
|
895 | + ) |
|
896 | + ); |
|
897 | + } |
|
898 | + } |
|
899 | 899 | |
900 | 900 | |
901 | - /** |
|
902 | - * @param string $addon_name |
|
903 | - * @return void |
|
904 | - * @throws EE_Error |
|
905 | - */ |
|
906 | - private static function _register_message_types($addon_name) |
|
907 | - { |
|
908 | - if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
909 | - add_action( |
|
910 | - 'EE_Brewing_Regular___messages_caf', |
|
911 | - array('EE_Register_Addon', 'register_message_types') |
|
912 | - ); |
|
913 | - } |
|
914 | - } |
|
901 | + /** |
|
902 | + * @param string $addon_name |
|
903 | + * @return void |
|
904 | + * @throws EE_Error |
|
905 | + */ |
|
906 | + private static function _register_message_types($addon_name) |
|
907 | + { |
|
908 | + if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
909 | + add_action( |
|
910 | + 'EE_Brewing_Regular___messages_caf', |
|
911 | + array('EE_Register_Addon', 'register_message_types') |
|
912 | + ); |
|
913 | + } |
|
914 | + } |
|
915 | 915 | |
916 | 916 | |
917 | - /** |
|
918 | - * @param string $addon_name |
|
919 | - * @return void |
|
920 | - * @throws EE_Error |
|
921 | - */ |
|
922 | - private static function _register_custom_post_types($addon_name) |
|
923 | - { |
|
924 | - if (! empty(self::$_settings[ $addon_name ]['custom_post_types']) |
|
925 | - || ! empty(self::$_settings[ $addon_name ]['custom_taxonomies']) |
|
926 | - ) { |
|
927 | - EE_Register_CPT::register( |
|
928 | - $addon_name, |
|
929 | - array( |
|
930 | - 'cpts' => self::$_settings[ $addon_name ]['custom_post_types'], |
|
931 | - 'cts' => self::$_settings[ $addon_name ]['custom_taxonomies'], |
|
932 | - 'default_terms' => self::$_settings[ $addon_name ]['default_terms'], |
|
933 | - ) |
|
934 | - ); |
|
935 | - } |
|
936 | - } |
|
917 | + /** |
|
918 | + * @param string $addon_name |
|
919 | + * @return void |
|
920 | + * @throws EE_Error |
|
921 | + */ |
|
922 | + private static function _register_custom_post_types($addon_name) |
|
923 | + { |
|
924 | + if (! empty(self::$_settings[ $addon_name ]['custom_post_types']) |
|
925 | + || ! empty(self::$_settings[ $addon_name ]['custom_taxonomies']) |
|
926 | + ) { |
|
927 | + EE_Register_CPT::register( |
|
928 | + $addon_name, |
|
929 | + array( |
|
930 | + 'cpts' => self::$_settings[ $addon_name ]['custom_post_types'], |
|
931 | + 'cts' => self::$_settings[ $addon_name ]['custom_taxonomies'], |
|
932 | + 'default_terms' => self::$_settings[ $addon_name ]['default_terms'], |
|
933 | + ) |
|
934 | + ); |
|
935 | + } |
|
936 | + } |
|
937 | 937 | |
938 | 938 | |
939 | - /** |
|
940 | - * @param string $addon_name |
|
941 | - * @return void |
|
942 | - * @throws InvalidArgumentException |
|
943 | - * @throws InvalidInterfaceException |
|
944 | - * @throws InvalidDataTypeException |
|
945 | - * @throws DomainException |
|
946 | - * @throws EE_Error |
|
947 | - */ |
|
948 | - private static function _register_payment_methods($addon_name) |
|
949 | - { |
|
950 | - if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
951 | - EE_Register_Payment_Method::register( |
|
952 | - $addon_name, |
|
953 | - array('payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths']) |
|
954 | - ); |
|
955 | - } |
|
956 | - } |
|
939 | + /** |
|
940 | + * @param string $addon_name |
|
941 | + * @return void |
|
942 | + * @throws InvalidArgumentException |
|
943 | + * @throws InvalidInterfaceException |
|
944 | + * @throws InvalidDataTypeException |
|
945 | + * @throws DomainException |
|
946 | + * @throws EE_Error |
|
947 | + */ |
|
948 | + private static function _register_payment_methods($addon_name) |
|
949 | + { |
|
950 | + if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
951 | + EE_Register_Payment_Method::register( |
|
952 | + $addon_name, |
|
953 | + array('payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths']) |
|
954 | + ); |
|
955 | + } |
|
956 | + } |
|
957 | 957 | |
958 | 958 | |
959 | - /** |
|
960 | - * @param string $addon_name |
|
961 | - * @return void |
|
962 | - * @throws InvalidArgumentException |
|
963 | - * @throws InvalidInterfaceException |
|
964 | - * @throws InvalidDataTypeException |
|
965 | - * @throws DomainException |
|
966 | - * @throws EE_Error |
|
967 | - */ |
|
968 | - private static function registerPrivacyPolicies($addon_name) |
|
969 | - { |
|
970 | - if (! empty(self::$_settings[ $addon_name ]['privacy_policies'])) { |
|
971 | - EE_Register_Privacy_Policy::register( |
|
972 | - $addon_name, |
|
973 | - self::$_settings[ $addon_name ]['privacy_policies'] |
|
974 | - ); |
|
975 | - } |
|
976 | - } |
|
959 | + /** |
|
960 | + * @param string $addon_name |
|
961 | + * @return void |
|
962 | + * @throws InvalidArgumentException |
|
963 | + * @throws InvalidInterfaceException |
|
964 | + * @throws InvalidDataTypeException |
|
965 | + * @throws DomainException |
|
966 | + * @throws EE_Error |
|
967 | + */ |
|
968 | + private static function registerPrivacyPolicies($addon_name) |
|
969 | + { |
|
970 | + if (! empty(self::$_settings[ $addon_name ]['privacy_policies'])) { |
|
971 | + EE_Register_Privacy_Policy::register( |
|
972 | + $addon_name, |
|
973 | + self::$_settings[ $addon_name ]['privacy_policies'] |
|
974 | + ); |
|
975 | + } |
|
976 | + } |
|
977 | 977 | |
978 | 978 | |
979 | - /** |
|
980 | - * @param string $addon_name |
|
981 | - * @return void |
|
982 | - */ |
|
983 | - private static function registerPersonalDataExporters($addon_name) |
|
984 | - { |
|
985 | - if (! empty(self::$_settings[ $addon_name ]['personal_data_exporters'])) { |
|
986 | - EE_Register_Personal_Data_Eraser::register( |
|
987 | - $addon_name, |
|
988 | - self::$_settings[ $addon_name ]['personal_data_exporters'] |
|
989 | - ); |
|
990 | - } |
|
991 | - } |
|
979 | + /** |
|
980 | + * @param string $addon_name |
|
981 | + * @return void |
|
982 | + */ |
|
983 | + private static function registerPersonalDataExporters($addon_name) |
|
984 | + { |
|
985 | + if (! empty(self::$_settings[ $addon_name ]['personal_data_exporters'])) { |
|
986 | + EE_Register_Personal_Data_Eraser::register( |
|
987 | + $addon_name, |
|
988 | + self::$_settings[ $addon_name ]['personal_data_exporters'] |
|
989 | + ); |
|
990 | + } |
|
991 | + } |
|
992 | 992 | |
993 | 993 | |
994 | - /** |
|
995 | - * @param string $addon_name |
|
996 | - * @return void |
|
997 | - */ |
|
998 | - private static function registerPersonalDataErasers($addon_name) |
|
999 | - { |
|
1000 | - if (! empty(self::$_settings[ $addon_name ]['personal_data_erasers'])) { |
|
1001 | - EE_Register_Personal_Data_Eraser::register( |
|
1002 | - $addon_name, |
|
1003 | - self::$_settings[ $addon_name ]['personal_data_erasers'] |
|
1004 | - ); |
|
1005 | - } |
|
1006 | - } |
|
994 | + /** |
|
995 | + * @param string $addon_name |
|
996 | + * @return void |
|
997 | + */ |
|
998 | + private static function registerPersonalDataErasers($addon_name) |
|
999 | + { |
|
1000 | + if (! empty(self::$_settings[ $addon_name ]['personal_data_erasers'])) { |
|
1001 | + EE_Register_Personal_Data_Eraser::register( |
|
1002 | + $addon_name, |
|
1003 | + self::$_settings[ $addon_name ]['personal_data_erasers'] |
|
1004 | + ); |
|
1005 | + } |
|
1006 | + } |
|
1007 | 1007 | |
1008 | 1008 | |
1009 | - /** |
|
1010 | - * Loads and instantiates the EE_Addon class and adds it onto the registry |
|
1011 | - * |
|
1012 | - * @param string $addon_name |
|
1013 | - * @return EE_Addon |
|
1014 | - * @throws InvalidArgumentException |
|
1015 | - * @throws InvalidInterfaceException |
|
1016 | - * @throws InvalidDataTypeException |
|
1017 | - * @throws ReflectionException |
|
1018 | - * @throws EE_Error |
|
1019 | - */ |
|
1020 | - private static function _load_and_init_addon_class($addon_name) |
|
1021 | - { |
|
1022 | - $loader = EventEspresso\core\services\loaders\LoaderFactory::getLoader(); |
|
1023 | - $addon = $loader->getShared( |
|
1024 | - self::$_settings[ $addon_name ]['class_name'], |
|
1025 | - array('EE_Registry::create(addon)' => true) |
|
1026 | - ); |
|
1027 | - // setter inject dep map if required |
|
1028 | - if ($addon instanceof RequiresDependencyMapInterface && $addon->dependencyMap() === null) { |
|
1029 | - $addon->setDependencyMap($loader->getShared('EE_Dependency_Map')); |
|
1030 | - } |
|
1031 | - // setter inject domain if required |
|
1032 | - if ($addon instanceof RequiresDomainInterface |
|
1033 | - && $addon->domain() === null |
|
1034 | - ) { |
|
1035 | - // using supplied Domain object |
|
1036 | - $domain = self::$_settings[ $addon_name ]['domain'] instanceof DomainInterface |
|
1037 | - ? self::$_settings[ $addon_name ]['domain'] |
|
1038 | - : null; |
|
1039 | - // or construct one using Domain FQCN |
|
1040 | - if ($domain === null && self::$_settings[ $addon_name ]['domain_fqcn'] !== '') { |
|
1041 | - $domain = $loader->getShared( |
|
1042 | - self::$_settings[ $addon_name ]['domain_fqcn'], |
|
1043 | - array( |
|
1044 | - new EventEspresso\core\domain\values\FilePath( |
|
1045 | - self::$_settings[ $addon_name ]['main_file_path'] |
|
1046 | - ), |
|
1047 | - EventEspresso\core\domain\values\Version::fromString( |
|
1048 | - self::$_settings[ $addon_name ]['version'] |
|
1049 | - ), |
|
1050 | - ) |
|
1051 | - ); |
|
1052 | - } |
|
1053 | - if ($domain instanceof DomainInterface) { |
|
1054 | - $addon->setDomain($domain); |
|
1055 | - } |
|
1056 | - } |
|
1057 | - $addon->set_name($addon_name); |
|
1058 | - $addon->set_plugin_slug(self::$_settings[ $addon_name ]['plugin_slug']); |
|
1059 | - $addon->set_plugin_basename(self::$_settings[ $addon_name ]['plugin_basename']); |
|
1060 | - $addon->set_main_plugin_file(self::$_settings[ $addon_name ]['main_file_path']); |
|
1061 | - $addon->set_plugin_action_slug(self::$_settings[ $addon_name ]['plugin_action_slug']); |
|
1062 | - $addon->set_plugins_page_row(self::$_settings[ $addon_name ]['plugins_page_row']); |
|
1063 | - $addon->set_version(self::$_settings[ $addon_name ]['version']); |
|
1064 | - $addon->set_min_core_version(self::_effective_version(self::$_settings[ $addon_name ]['min_core_version'])); |
|
1065 | - $addon->set_config_section(self::$_settings[ $addon_name ]['config_section']); |
|
1066 | - $addon->set_config_class(self::$_settings[ $addon_name ]['config_class']); |
|
1067 | - $addon->set_config_name(self::$_settings[ $addon_name ]['config_name']); |
|
1068 | - // unfortunately this can't be hooked in upon construction, because we don't have |
|
1069 | - // the plugin mainfile's path upon construction. |
|
1070 | - register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation')); |
|
1071 | - // call any additional admin_callback functions during load_admin_controller hook |
|
1072 | - if (! empty(self::$_settings[ $addon_name ]['admin_callback'])) { |
|
1073 | - add_action( |
|
1074 | - 'AHEE__EE_System__load_controllers__load_admin_controllers', |
|
1075 | - array($addon, self::$_settings[ $addon_name ]['admin_callback']) |
|
1076 | - ); |
|
1077 | - } |
|
1078 | - return $addon; |
|
1079 | - } |
|
1009 | + /** |
|
1010 | + * Loads and instantiates the EE_Addon class and adds it onto the registry |
|
1011 | + * |
|
1012 | + * @param string $addon_name |
|
1013 | + * @return EE_Addon |
|
1014 | + * @throws InvalidArgumentException |
|
1015 | + * @throws InvalidInterfaceException |
|
1016 | + * @throws InvalidDataTypeException |
|
1017 | + * @throws ReflectionException |
|
1018 | + * @throws EE_Error |
|
1019 | + */ |
|
1020 | + private static function _load_and_init_addon_class($addon_name) |
|
1021 | + { |
|
1022 | + $loader = EventEspresso\core\services\loaders\LoaderFactory::getLoader(); |
|
1023 | + $addon = $loader->getShared( |
|
1024 | + self::$_settings[ $addon_name ]['class_name'], |
|
1025 | + array('EE_Registry::create(addon)' => true) |
|
1026 | + ); |
|
1027 | + // setter inject dep map if required |
|
1028 | + if ($addon instanceof RequiresDependencyMapInterface && $addon->dependencyMap() === null) { |
|
1029 | + $addon->setDependencyMap($loader->getShared('EE_Dependency_Map')); |
|
1030 | + } |
|
1031 | + // setter inject domain if required |
|
1032 | + if ($addon instanceof RequiresDomainInterface |
|
1033 | + && $addon->domain() === null |
|
1034 | + ) { |
|
1035 | + // using supplied Domain object |
|
1036 | + $domain = self::$_settings[ $addon_name ]['domain'] instanceof DomainInterface |
|
1037 | + ? self::$_settings[ $addon_name ]['domain'] |
|
1038 | + : null; |
|
1039 | + // or construct one using Domain FQCN |
|
1040 | + if ($domain === null && self::$_settings[ $addon_name ]['domain_fqcn'] !== '') { |
|
1041 | + $domain = $loader->getShared( |
|
1042 | + self::$_settings[ $addon_name ]['domain_fqcn'], |
|
1043 | + array( |
|
1044 | + new EventEspresso\core\domain\values\FilePath( |
|
1045 | + self::$_settings[ $addon_name ]['main_file_path'] |
|
1046 | + ), |
|
1047 | + EventEspresso\core\domain\values\Version::fromString( |
|
1048 | + self::$_settings[ $addon_name ]['version'] |
|
1049 | + ), |
|
1050 | + ) |
|
1051 | + ); |
|
1052 | + } |
|
1053 | + if ($domain instanceof DomainInterface) { |
|
1054 | + $addon->setDomain($domain); |
|
1055 | + } |
|
1056 | + } |
|
1057 | + $addon->set_name($addon_name); |
|
1058 | + $addon->set_plugin_slug(self::$_settings[ $addon_name ]['plugin_slug']); |
|
1059 | + $addon->set_plugin_basename(self::$_settings[ $addon_name ]['plugin_basename']); |
|
1060 | + $addon->set_main_plugin_file(self::$_settings[ $addon_name ]['main_file_path']); |
|
1061 | + $addon->set_plugin_action_slug(self::$_settings[ $addon_name ]['plugin_action_slug']); |
|
1062 | + $addon->set_plugins_page_row(self::$_settings[ $addon_name ]['plugins_page_row']); |
|
1063 | + $addon->set_version(self::$_settings[ $addon_name ]['version']); |
|
1064 | + $addon->set_min_core_version(self::_effective_version(self::$_settings[ $addon_name ]['min_core_version'])); |
|
1065 | + $addon->set_config_section(self::$_settings[ $addon_name ]['config_section']); |
|
1066 | + $addon->set_config_class(self::$_settings[ $addon_name ]['config_class']); |
|
1067 | + $addon->set_config_name(self::$_settings[ $addon_name ]['config_name']); |
|
1068 | + // unfortunately this can't be hooked in upon construction, because we don't have |
|
1069 | + // the plugin mainfile's path upon construction. |
|
1070 | + register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation')); |
|
1071 | + // call any additional admin_callback functions during load_admin_controller hook |
|
1072 | + if (! empty(self::$_settings[ $addon_name ]['admin_callback'])) { |
|
1073 | + add_action( |
|
1074 | + 'AHEE__EE_System__load_controllers__load_admin_controllers', |
|
1075 | + array($addon, self::$_settings[ $addon_name ]['admin_callback']) |
|
1076 | + ); |
|
1077 | + } |
|
1078 | + return $addon; |
|
1079 | + } |
|
1080 | 1080 | |
1081 | 1081 | |
1082 | - /** |
|
1083 | - * load_pue_update - Update notifications |
|
1084 | - * |
|
1085 | - * @return void |
|
1086 | - * @throws InvalidArgumentException |
|
1087 | - * @throws InvalidDataTypeException |
|
1088 | - * @throws InvalidInterfaceException |
|
1089 | - */ |
|
1090 | - public static function load_pue_update() |
|
1091 | - { |
|
1092 | - // load PUE client |
|
1093 | - require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php'; |
|
1094 | - // cycle thru settings |
|
1095 | - foreach (self::$_settings as $settings) { |
|
1096 | - if (! empty($settings['pue_options'])) { |
|
1097 | - // initiate the class and start the plugin update engine! |
|
1098 | - new PluginUpdateEngineChecker( |
|
1099 | - // host file URL |
|
1100 | - 'https://eventespresso.com', |
|
1101 | - // plugin slug(s) |
|
1102 | - array( |
|
1103 | - 'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']), |
|
1104 | - 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'), |
|
1105 | - ), |
|
1106 | - // options |
|
1107 | - array( |
|
1108 | - 'apikey' => EE_Registry::instance()->NET_CFG->core->site_license_key, |
|
1109 | - 'lang_domain' => 'event_espresso', |
|
1110 | - 'checkPeriod' => $settings['pue_options']['checkPeriod'], |
|
1111 | - 'option_key' => 'site_license_key', |
|
1112 | - 'options_page_slug' => 'event_espresso', |
|
1113 | - 'plugin_basename' => $settings['pue_options']['plugin_basename'], |
|
1114 | - // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP |
|
1115 | - 'use_wp_update' => $settings['pue_options']['use_wp_update'], |
|
1116 | - ) |
|
1117 | - ); |
|
1118 | - } |
|
1119 | - } |
|
1120 | - } |
|
1082 | + /** |
|
1083 | + * load_pue_update - Update notifications |
|
1084 | + * |
|
1085 | + * @return void |
|
1086 | + * @throws InvalidArgumentException |
|
1087 | + * @throws InvalidDataTypeException |
|
1088 | + * @throws InvalidInterfaceException |
|
1089 | + */ |
|
1090 | + public static function load_pue_update() |
|
1091 | + { |
|
1092 | + // load PUE client |
|
1093 | + require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php'; |
|
1094 | + // cycle thru settings |
|
1095 | + foreach (self::$_settings as $settings) { |
|
1096 | + if (! empty($settings['pue_options'])) { |
|
1097 | + // initiate the class and start the plugin update engine! |
|
1098 | + new PluginUpdateEngineChecker( |
|
1099 | + // host file URL |
|
1100 | + 'https://eventespresso.com', |
|
1101 | + // plugin slug(s) |
|
1102 | + array( |
|
1103 | + 'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']), |
|
1104 | + 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'), |
|
1105 | + ), |
|
1106 | + // options |
|
1107 | + array( |
|
1108 | + 'apikey' => EE_Registry::instance()->NET_CFG->core->site_license_key, |
|
1109 | + 'lang_domain' => 'event_espresso', |
|
1110 | + 'checkPeriod' => $settings['pue_options']['checkPeriod'], |
|
1111 | + 'option_key' => 'site_license_key', |
|
1112 | + 'options_page_slug' => 'event_espresso', |
|
1113 | + 'plugin_basename' => $settings['pue_options']['plugin_basename'], |
|
1114 | + // if use_wp_update is TRUE it means you want FREE versions of the plugin to be updated from WP |
|
1115 | + 'use_wp_update' => $settings['pue_options']['use_wp_update'], |
|
1116 | + ) |
|
1117 | + ); |
|
1118 | + } |
|
1119 | + } |
|
1120 | + } |
|
1121 | 1121 | |
1122 | 1122 | |
1123 | - /** |
|
1124 | - * Callback for EE_Brewing_Regular__messages_caf hook used to register message types. |
|
1125 | - * |
|
1126 | - * @since 4.4.0 |
|
1127 | - * @return void |
|
1128 | - * @throws EE_Error |
|
1129 | - */ |
|
1130 | - public static function register_message_types() |
|
1131 | - { |
|
1132 | - foreach (self::$_settings as $addon_name => $settings) { |
|
1133 | - if (! empty($settings['message_types'])) { |
|
1134 | - foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) { |
|
1135 | - EE_Register_Message_Type::register($message_type, $message_type_settings); |
|
1136 | - } |
|
1137 | - } |
|
1138 | - } |
|
1139 | - } |
|
1123 | + /** |
|
1124 | + * Callback for EE_Brewing_Regular__messages_caf hook used to register message types. |
|
1125 | + * |
|
1126 | + * @since 4.4.0 |
|
1127 | + * @return void |
|
1128 | + * @throws EE_Error |
|
1129 | + */ |
|
1130 | + public static function register_message_types() |
|
1131 | + { |
|
1132 | + foreach (self::$_settings as $addon_name => $settings) { |
|
1133 | + if (! empty($settings['message_types'])) { |
|
1134 | + foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) { |
|
1135 | + EE_Register_Message_Type::register($message_type, $message_type_settings); |
|
1136 | + } |
|
1137 | + } |
|
1138 | + } |
|
1139 | + } |
|
1140 | 1140 | |
1141 | 1141 | |
1142 | - /** |
|
1143 | - * This deregisters an addon that was previously registered with a specific addon_name. |
|
1144 | - * |
|
1145 | - * @since 4.3.0 |
|
1146 | - * @param string $addon_name the name for the addon that was previously registered |
|
1147 | - * @throws DomainException |
|
1148 | - * @throws EE_Error |
|
1149 | - * @throws InvalidArgumentException |
|
1150 | - * @throws InvalidDataTypeException |
|
1151 | - * @throws InvalidInterfaceException |
|
1152 | - */ |
|
1153 | - public static function deregister($addon_name = null) |
|
1154 | - { |
|
1155 | - if (isset(self::$_settings[ $addon_name ]['class_name'])) { |
|
1156 | - try { |
|
1157 | - do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name); |
|
1158 | - $class_name = self::$_settings[ $addon_name ]['class_name']; |
|
1159 | - if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
1160 | - // setup DMS |
|
1161 | - EE_Register_Data_Migration_Scripts::deregister($addon_name); |
|
1162 | - } |
|
1163 | - if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
1164 | - // register admin page |
|
1165 | - EE_Register_Admin_Page::deregister($addon_name); |
|
1166 | - } |
|
1167 | - if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
1168 | - // add to list of modules to be registered |
|
1169 | - EE_Register_Module::deregister($addon_name); |
|
1170 | - } |
|
1171 | - if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
1172 | - || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
1173 | - ) { |
|
1174 | - // add to list of shortcodes to be registered |
|
1175 | - EE_Register_Shortcode::deregister($addon_name); |
|
1176 | - } |
|
1177 | - if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
1178 | - // if config_class present let's register config. |
|
1179 | - EE_Register_Config::deregister(self::$_settings[ $addon_name ]['config_class']); |
|
1180 | - } |
|
1181 | - if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
1182 | - // add to list of widgets to be registered |
|
1183 | - EE_Register_Widget::deregister($addon_name); |
|
1184 | - } |
|
1185 | - if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
1186 | - || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
1187 | - ) { |
|
1188 | - // add to list of shortcodes to be registered |
|
1189 | - EE_Register_Model::deregister($addon_name); |
|
1190 | - } |
|
1191 | - if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
1192 | - || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
1193 | - ) { |
|
1194 | - // add to list of shortcodes to be registered |
|
1195 | - EE_Register_Model_Extensions::deregister($addon_name); |
|
1196 | - } |
|
1197 | - if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
1198 | - foreach ((array) self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings) { |
|
1199 | - EE_Register_Message_Type::deregister($message_type); |
|
1200 | - } |
|
1201 | - } |
|
1202 | - // deregister capabilities for addon |
|
1203 | - if (! empty(self::$_settings[ $addon_name ]['capabilities']) |
|
1204 | - || ! empty(self::$_settings[ $addon_name ]['capability_maps']) |
|
1205 | - ) { |
|
1206 | - EE_Register_Capabilities::deregister($addon_name); |
|
1207 | - } |
|
1208 | - // deregister custom_post_types for addon |
|
1209 | - if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])) { |
|
1210 | - EE_Register_CPT::deregister($addon_name); |
|
1211 | - } |
|
1212 | - if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
1213 | - EE_Register_Payment_Method::deregister($addon_name); |
|
1214 | - } |
|
1215 | - $addon = EE_Registry::instance()->getAddon($class_name); |
|
1216 | - if ($addon instanceof EE_Addon) { |
|
1217 | - remove_action( |
|
1218 | - 'deactivate_' . $addon->get_main_plugin_file_basename(), |
|
1219 | - array($addon, 'deactivation') |
|
1220 | - ); |
|
1221 | - remove_action( |
|
1222 | - 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
1223 | - array($addon, 'initialize_db_if_no_migrations_required') |
|
1224 | - ); |
|
1225 | - // remove `after_registration` call |
|
1226 | - remove_action( |
|
1227 | - 'AHEE__EE_System__load_espresso_addons__complete', |
|
1228 | - array($addon, 'after_registration'), |
|
1229 | - 999 |
|
1230 | - ); |
|
1231 | - } |
|
1232 | - EE_Registry::instance()->removeAddon($class_name); |
|
1233 | - } catch (OutOfBoundsException $addon_not_yet_registered_exception) { |
|
1234 | - // the add-on was not yet registered in the registry, |
|
1235 | - // so RegistryContainer::__get() throws this exception. |
|
1236 | - // also no need to worry about this or log it, |
|
1237 | - // it's ok to deregister an add-on before its registered in the registry |
|
1238 | - } catch (Exception $e) { |
|
1239 | - new ExceptionLogger($e); |
|
1240 | - } |
|
1241 | - unset(self::$_settings[ $addon_name ]); |
|
1242 | - do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name); |
|
1243 | - } |
|
1244 | - } |
|
1142 | + /** |
|
1143 | + * This deregisters an addon that was previously registered with a specific addon_name. |
|
1144 | + * |
|
1145 | + * @since 4.3.0 |
|
1146 | + * @param string $addon_name the name for the addon that was previously registered |
|
1147 | + * @throws DomainException |
|
1148 | + * @throws EE_Error |
|
1149 | + * @throws InvalidArgumentException |
|
1150 | + * @throws InvalidDataTypeException |
|
1151 | + * @throws InvalidInterfaceException |
|
1152 | + */ |
|
1153 | + public static function deregister($addon_name = null) |
|
1154 | + { |
|
1155 | + if (isset(self::$_settings[ $addon_name ]['class_name'])) { |
|
1156 | + try { |
|
1157 | + do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name); |
|
1158 | + $class_name = self::$_settings[ $addon_name ]['class_name']; |
|
1159 | + if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
1160 | + // setup DMS |
|
1161 | + EE_Register_Data_Migration_Scripts::deregister($addon_name); |
|
1162 | + } |
|
1163 | + if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
1164 | + // register admin page |
|
1165 | + EE_Register_Admin_Page::deregister($addon_name); |
|
1166 | + } |
|
1167 | + if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
1168 | + // add to list of modules to be registered |
|
1169 | + EE_Register_Module::deregister($addon_name); |
|
1170 | + } |
|
1171 | + if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
1172 | + || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
1173 | + ) { |
|
1174 | + // add to list of shortcodes to be registered |
|
1175 | + EE_Register_Shortcode::deregister($addon_name); |
|
1176 | + } |
|
1177 | + if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
1178 | + // if config_class present let's register config. |
|
1179 | + EE_Register_Config::deregister(self::$_settings[ $addon_name ]['config_class']); |
|
1180 | + } |
|
1181 | + if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
1182 | + // add to list of widgets to be registered |
|
1183 | + EE_Register_Widget::deregister($addon_name); |
|
1184 | + } |
|
1185 | + if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
1186 | + || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
1187 | + ) { |
|
1188 | + // add to list of shortcodes to be registered |
|
1189 | + EE_Register_Model::deregister($addon_name); |
|
1190 | + } |
|
1191 | + if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
1192 | + || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
1193 | + ) { |
|
1194 | + // add to list of shortcodes to be registered |
|
1195 | + EE_Register_Model_Extensions::deregister($addon_name); |
|
1196 | + } |
|
1197 | + if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
1198 | + foreach ((array) self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings) { |
|
1199 | + EE_Register_Message_Type::deregister($message_type); |
|
1200 | + } |
|
1201 | + } |
|
1202 | + // deregister capabilities for addon |
|
1203 | + if (! empty(self::$_settings[ $addon_name ]['capabilities']) |
|
1204 | + || ! empty(self::$_settings[ $addon_name ]['capability_maps']) |
|
1205 | + ) { |
|
1206 | + EE_Register_Capabilities::deregister($addon_name); |
|
1207 | + } |
|
1208 | + // deregister custom_post_types for addon |
|
1209 | + if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])) { |
|
1210 | + EE_Register_CPT::deregister($addon_name); |
|
1211 | + } |
|
1212 | + if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
1213 | + EE_Register_Payment_Method::deregister($addon_name); |
|
1214 | + } |
|
1215 | + $addon = EE_Registry::instance()->getAddon($class_name); |
|
1216 | + if ($addon instanceof EE_Addon) { |
|
1217 | + remove_action( |
|
1218 | + 'deactivate_' . $addon->get_main_plugin_file_basename(), |
|
1219 | + array($addon, 'deactivation') |
|
1220 | + ); |
|
1221 | + remove_action( |
|
1222 | + 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
1223 | + array($addon, 'initialize_db_if_no_migrations_required') |
|
1224 | + ); |
|
1225 | + // remove `after_registration` call |
|
1226 | + remove_action( |
|
1227 | + 'AHEE__EE_System__load_espresso_addons__complete', |
|
1228 | + array($addon, 'after_registration'), |
|
1229 | + 999 |
|
1230 | + ); |
|
1231 | + } |
|
1232 | + EE_Registry::instance()->removeAddon($class_name); |
|
1233 | + } catch (OutOfBoundsException $addon_not_yet_registered_exception) { |
|
1234 | + // the add-on was not yet registered in the registry, |
|
1235 | + // so RegistryContainer::__get() throws this exception. |
|
1236 | + // also no need to worry about this or log it, |
|
1237 | + // it's ok to deregister an add-on before its registered in the registry |
|
1238 | + } catch (Exception $e) { |
|
1239 | + new ExceptionLogger($e); |
|
1240 | + } |
|
1241 | + unset(self::$_settings[ $addon_name ]); |
|
1242 | + do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name); |
|
1243 | + } |
|
1244 | + } |
|
1245 | 1245 | } |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | // offsets: 0 . 1 . 2 . 3 . 4 |
70 | 70 | $version_parts = explode('.', $min_core_version); |
71 | 71 | // check they specified the micro version (after 2nd period) |
72 | - if (! isset($version_parts[2])) { |
|
72 | + if ( ! isset($version_parts[2])) { |
|
73 | 73 | $version_parts[2] = '0'; |
74 | 74 | } |
75 | 75 | // if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible |
76 | 76 | // soon we can assume that's 'rc', but this current version is 'alpha' |
77 | - if (! isset($version_parts[3])) { |
|
77 | + if ( ! isset($version_parts[3])) { |
|
78 | 78 | $version_parts[3] = 'dev'; |
79 | 79 | } |
80 | - if (! isset($version_parts[4])) { |
|
80 | + if ( ! isset($version_parts[4])) { |
|
81 | 81 | $version_parts[4] = '000'; |
82 | 82 | } |
83 | 83 | return implode('.', $version_parts); |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // setup PUE |
265 | 265 | EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
266 | 266 | // does this addon work with this version of core or WordPress ? |
267 | - if (! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) { |
|
267 | + if ( ! EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | // register namespaces |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ) |
329 | 329 | ); |
330 | 330 | } |
331 | - if (! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
331 | + if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
332 | 332 | throw new EE_Error( |
333 | 333 | sprintf( |
334 | 334 | __( |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | ); |
341 | 341 | } |
342 | 342 | // check that addon has not already been registered with that name |
343 | - if (isset(self::$_settings[ $addon_name ]) && ! did_action('activate_plugin')) { |
|
343 | + if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) { |
|
344 | 344 | throw new EE_Error( |
345 | 345 | sprintf( |
346 | 346 | __( |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | // check if classname is fully qualified or is a legacy classname already prefixed with 'EE_' |
373 | 373 | return strpos($class_name, '\\') || strpos($class_name, 'EE_') === 0 |
374 | 374 | ? $class_name |
375 | - : 'EE_' . $class_name; |
|
375 | + : 'EE_'.$class_name; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | global $wp_version; |
540 | 540 | $incompatibility_message = ''; |
541 | 541 | // check whether this addon version is compatible with EE core |
542 | - if (isset(EE_Register_Addon::$_incompatible_addons[ $addon_name ]) |
|
542 | + if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) |
|
543 | 543 | && ! self::_meets_min_core_version_requirement( |
544 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
544 | + EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
545 | 545 | $addon_settings['version'] |
546 | 546 | ) |
547 | 547 | ) { |
@@ -552,11 +552,11 @@ discard block |
||
552 | 552 | ), |
553 | 553 | $addon_name, |
554 | 554 | '<br />', |
555 | - EE_Register_Addon::$_incompatible_addons[ $addon_name ], |
|
555 | + EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
556 | 556 | '<span style="font-weight: bold; color: #D54E21;">', |
557 | 557 | '</span><br />' |
558 | 558 | ); |
559 | - } elseif (! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
559 | + } elseif ( ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
560 | 560 | ) { |
561 | 561 | $incompatibility_message = sprintf( |
562 | 562 | __( |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | '</span><br />' |
584 | 584 | ); |
585 | 585 | } |
586 | - if (! empty($incompatibility_message)) { |
|
586 | + if ( ! empty($incompatibility_message)) { |
|
587 | 587 | // remove 'activate' from the REQUEST |
588 | 588 | // so WP doesn't erroneously tell the user the plugin activated fine when it didn't |
589 | 589 | unset($_GET['activate'], $_REQUEST['activate']); |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | */ |
612 | 612 | private static function _parse_pue_options($addon_name, $class_name, array $setup_args) |
613 | 613 | { |
614 | - if (! empty($setup_args['pue_options'])) { |
|
615 | - self::$_settings[ $addon_name ]['pue_options'] = array( |
|
614 | + if ( ! empty($setup_args['pue_options'])) { |
|
615 | + self::$_settings[$addon_name]['pue_options'] = array( |
|
616 | 616 | 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
617 | 617 | ? (string) $setup_args['pue_options']['pue_plugin_slug'] |
618 | - : 'espresso_' . strtolower($class_name), |
|
618 | + : 'espresso_'.strtolower($class_name), |
|
619 | 619 | 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
620 | 620 | ? (string) $setup_args['pue_options']['plugin_basename'] |
621 | 621 | : plugin_basename($setup_args['main_file_path']), |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | // (as the newly-activated addon wasn't around the first time addons were registered). |
675 | 675 | // Note: the presence of pue_options in the addon registration options will initialize the $_settings |
676 | 676 | // property for the add-on, but the add-on is only partially initialized. Hence, the additional check. |
677 | - if (! isset(self::$_settings[ $addon_name ]) |
|
678 | - || (isset(self::$_settings[ $addon_name ]) |
|
679 | - && ! isset(self::$_settings[ $addon_name ]['class_name']) |
|
677 | + if ( ! isset(self::$_settings[$addon_name]) |
|
678 | + || (isset(self::$_settings[$addon_name]) |
|
679 | + && ! isset(self::$_settings[$addon_name]['class_name']) |
|
680 | 680 | ) |
681 | 681 | ) { |
682 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
682 | + self::$_settings[$addon_name] = $addon_settings; |
|
683 | 683 | $addon = self::_load_and_init_addon_class($addon_name); |
684 | 684 | $addon->set_activation_indicator_option(); |
685 | 685 | // dont bother setting up the rest of the addon. |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | return true; |
689 | 689 | } |
690 | 690 | // make sure this was called in the right place! |
691 | - if (! did_action('AHEE__EE_System__load_espresso_addons') |
|
691 | + if ( ! did_action('AHEE__EE_System__load_espresso_addons') |
|
692 | 692 | || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
693 | 693 | ) { |
694 | 694 | EE_Error::doing_it_wrong( |
@@ -704,10 +704,10 @@ discard block |
||
704 | 704 | ); |
705 | 705 | } |
706 | 706 | // make sure addon settings are set correctly without overwriting anything existing |
707 | - if (isset(self::$_settings[ $addon_name ])) { |
|
708 | - self::$_settings[ $addon_name ] += $addon_settings; |
|
707 | + if (isset(self::$_settings[$addon_name])) { |
|
708 | + self::$_settings[$addon_name] += $addon_settings; |
|
709 | 709 | } else { |
710 | - self::$_settings[ $addon_name ] = $addon_settings; |
|
710 | + self::$_settings[$addon_name] = $addon_settings; |
|
711 | 711 | } |
712 | 712 | return false; |
713 | 713 | } |
@@ -720,13 +720,13 @@ discard block |
||
720 | 720 | */ |
721 | 721 | private static function _setup_autoloaders($addon_name) |
722 | 722 | { |
723 | - if (! empty(self::$_settings[ $addon_name ]['autoloader_paths'])) { |
|
723 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) { |
|
724 | 724 | // setup autoloader for single file |
725 | - EEH_Autoloader::instance()->register_autoloader(self::$_settings[ $addon_name ]['autoloader_paths']); |
|
725 | + EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']); |
|
726 | 726 | } |
727 | 727 | // setup autoloaders for folders |
728 | - if (! empty(self::$_settings[ $addon_name ]['autoloader_folders'])) { |
|
729 | - foreach ((array) self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder) { |
|
728 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) { |
|
729 | + foreach ((array) self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
730 | 730 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
731 | 731 | } |
732 | 732 | } |
@@ -743,26 +743,26 @@ discard block |
||
743 | 743 | private static function _register_models_and_extensions($addon_name) |
744 | 744 | { |
745 | 745 | // register new models |
746 | - if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
747 | - || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
746 | + if ( ! empty(self::$_settings[$addon_name]['model_paths']) |
|
747 | + || ! empty(self::$_settings[$addon_name]['class_paths']) |
|
748 | 748 | ) { |
749 | 749 | EE_Register_Model::register( |
750 | 750 | $addon_name, |
751 | 751 | array( |
752 | - 'model_paths' => self::$_settings[ $addon_name ]['model_paths'], |
|
753 | - 'class_paths' => self::$_settings[ $addon_name ]['class_paths'], |
|
752 | + 'model_paths' => self::$_settings[$addon_name]['model_paths'], |
|
753 | + 'class_paths' => self::$_settings[$addon_name]['class_paths'], |
|
754 | 754 | ) |
755 | 755 | ); |
756 | 756 | } |
757 | 757 | // register model extensions |
758 | - if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
759 | - || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
758 | + if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
759 | + || ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
760 | 760 | ) { |
761 | 761 | EE_Register_Model_Extensions::register( |
762 | 762 | $addon_name, |
763 | 763 | array( |
764 | - 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'], |
|
765 | - 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths'], |
|
764 | + 'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], |
|
765 | + 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'], |
|
766 | 766 | ) |
767 | 767 | ); |
768 | 768 | } |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | private static function _register_data_migration_scripts($addon_name) |
778 | 778 | { |
779 | 779 | // setup DMS |
780 | - if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
780 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
781 | 781 | EE_Register_Data_Migration_Scripts::register( |
782 | 782 | $addon_name, |
783 | - array('dms_paths' => self::$_settings[ $addon_name ]['dms_paths']) |
|
783 | + array('dms_paths' => self::$_settings[$addon_name]['dms_paths']) |
|
784 | 784 | ); |
785 | 785 | } |
786 | 786 | } |
@@ -794,12 +794,12 @@ discard block |
||
794 | 794 | private static function _register_config($addon_name) |
795 | 795 | { |
796 | 796 | // if config_class is present let's register config. |
797 | - if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
797 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
798 | 798 | EE_Register_Config::register( |
799 | - self::$_settings[ $addon_name ]['config_class'], |
|
799 | + self::$_settings[$addon_name]['config_class'], |
|
800 | 800 | array( |
801 | - 'config_section' => self::$_settings[ $addon_name ]['config_section'], |
|
802 | - 'config_name' => self::$_settings[ $addon_name ]['config_name'], |
|
801 | + 'config_section' => self::$_settings[$addon_name]['config_section'], |
|
802 | + 'config_name' => self::$_settings[$addon_name]['config_name'], |
|
803 | 803 | ) |
804 | 804 | ); |
805 | 805 | } |
@@ -813,10 +813,10 @@ discard block |
||
813 | 813 | */ |
814 | 814 | private static function _register_admin_pages($addon_name) |
815 | 815 | { |
816 | - if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
816 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
817 | 817 | EE_Register_Admin_Page::register( |
818 | 818 | $addon_name, |
819 | - array('page_path' => self::$_settings[ $addon_name ]['admin_path']) |
|
819 | + array('page_path' => self::$_settings[$addon_name]['admin_path']) |
|
820 | 820 | ); |
821 | 821 | } |
822 | 822 | } |
@@ -829,10 +829,10 @@ discard block |
||
829 | 829 | */ |
830 | 830 | private static function _register_modules($addon_name) |
831 | 831 | { |
832 | - if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
832 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
833 | 833 | EE_Register_Module::register( |
834 | 834 | $addon_name, |
835 | - array('module_paths' => self::$_settings[ $addon_name ]['module_paths']) |
|
835 | + array('module_paths' => self::$_settings[$addon_name]['module_paths']) |
|
836 | 836 | ); |
837 | 837 | } |
838 | 838 | } |
@@ -845,17 +845,17 @@ discard block |
||
845 | 845 | */ |
846 | 846 | private static function _register_shortcodes($addon_name) |
847 | 847 | { |
848 | - if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
849 | - || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
848 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths']) |
|
849 | + || ! empty(self::$_settings[$addon_name]['shortcode_fqcns']) |
|
850 | 850 | ) { |
851 | 851 | EE_Register_Shortcode::register( |
852 | 852 | $addon_name, |
853 | 853 | array( |
854 | - 'shortcode_paths' => isset(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
855 | - ? self::$_settings[ $addon_name ]['shortcode_paths'] |
|
854 | + 'shortcode_paths' => isset(self::$_settings[$addon_name]['shortcode_paths']) |
|
855 | + ? self::$_settings[$addon_name]['shortcode_paths'] |
|
856 | 856 | : array(), |
857 | - 'shortcode_fqcns' => isset(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
858 | - ? self::$_settings[ $addon_name ]['shortcode_fqcns'] |
|
857 | + 'shortcode_fqcns' => isset(self::$_settings[$addon_name]['shortcode_fqcns']) |
|
858 | + ? self::$_settings[$addon_name]['shortcode_fqcns'] |
|
859 | 859 | : array(), |
860 | 860 | ) |
861 | 861 | ); |
@@ -870,10 +870,10 @@ discard block |
||
870 | 870 | */ |
871 | 871 | private static function _register_widgets($addon_name) |
872 | 872 | { |
873 | - if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
873 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
874 | 874 | EE_Register_Widget::register( |
875 | 875 | $addon_name, |
876 | - array('widget_paths' => self::$_settings[ $addon_name ]['widget_paths']) |
|
876 | + array('widget_paths' => self::$_settings[$addon_name]['widget_paths']) |
|
877 | 877 | ); |
878 | 878 | } |
879 | 879 | } |
@@ -886,12 +886,12 @@ discard block |
||
886 | 886 | */ |
887 | 887 | private static function _register_capabilities($addon_name) |
888 | 888 | { |
889 | - if (! empty(self::$_settings[ $addon_name ]['capabilities'])) { |
|
889 | + if ( ! empty(self::$_settings[$addon_name]['capabilities'])) { |
|
890 | 890 | EE_Register_Capabilities::register( |
891 | 891 | $addon_name, |
892 | 892 | array( |
893 | - 'capabilities' => self::$_settings[ $addon_name ]['capabilities'], |
|
894 | - 'capability_maps' => self::$_settings[ $addon_name ]['capability_maps'], |
|
893 | + 'capabilities' => self::$_settings[$addon_name]['capabilities'], |
|
894 | + 'capability_maps' => self::$_settings[$addon_name]['capability_maps'], |
|
895 | 895 | ) |
896 | 896 | ); |
897 | 897 | } |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | */ |
906 | 906 | private static function _register_message_types($addon_name) |
907 | 907 | { |
908 | - if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
908 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
909 | 909 | add_action( |
910 | 910 | 'EE_Brewing_Regular___messages_caf', |
911 | 911 | array('EE_Register_Addon', 'register_message_types') |
@@ -921,15 +921,15 @@ discard block |
||
921 | 921 | */ |
922 | 922 | private static function _register_custom_post_types($addon_name) |
923 | 923 | { |
924 | - if (! empty(self::$_settings[ $addon_name ]['custom_post_types']) |
|
925 | - || ! empty(self::$_settings[ $addon_name ]['custom_taxonomies']) |
|
924 | + if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) |
|
925 | + || ! empty(self::$_settings[$addon_name]['custom_taxonomies']) |
|
926 | 926 | ) { |
927 | 927 | EE_Register_CPT::register( |
928 | 928 | $addon_name, |
929 | 929 | array( |
930 | - 'cpts' => self::$_settings[ $addon_name ]['custom_post_types'], |
|
931 | - 'cts' => self::$_settings[ $addon_name ]['custom_taxonomies'], |
|
932 | - 'default_terms' => self::$_settings[ $addon_name ]['default_terms'], |
|
930 | + 'cpts' => self::$_settings[$addon_name]['custom_post_types'], |
|
931 | + 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], |
|
932 | + 'default_terms' => self::$_settings[$addon_name]['default_terms'], |
|
933 | 933 | ) |
934 | 934 | ); |
935 | 935 | } |
@@ -947,10 +947,10 @@ discard block |
||
947 | 947 | */ |
948 | 948 | private static function _register_payment_methods($addon_name) |
949 | 949 | { |
950 | - if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
950 | + if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
|
951 | 951 | EE_Register_Payment_Method::register( |
952 | 952 | $addon_name, |
953 | - array('payment_method_paths' => self::$_settings[ $addon_name ]['payment_method_paths']) |
|
953 | + array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']) |
|
954 | 954 | ); |
955 | 955 | } |
956 | 956 | } |
@@ -967,10 +967,10 @@ discard block |
||
967 | 967 | */ |
968 | 968 | private static function registerPrivacyPolicies($addon_name) |
969 | 969 | { |
970 | - if (! empty(self::$_settings[ $addon_name ]['privacy_policies'])) { |
|
970 | + if ( ! empty(self::$_settings[$addon_name]['privacy_policies'])) { |
|
971 | 971 | EE_Register_Privacy_Policy::register( |
972 | 972 | $addon_name, |
973 | - self::$_settings[ $addon_name ]['privacy_policies'] |
|
973 | + self::$_settings[$addon_name]['privacy_policies'] |
|
974 | 974 | ); |
975 | 975 | } |
976 | 976 | } |
@@ -982,10 +982,10 @@ discard block |
||
982 | 982 | */ |
983 | 983 | private static function registerPersonalDataExporters($addon_name) |
984 | 984 | { |
985 | - if (! empty(self::$_settings[ $addon_name ]['personal_data_exporters'])) { |
|
985 | + if ( ! empty(self::$_settings[$addon_name]['personal_data_exporters'])) { |
|
986 | 986 | EE_Register_Personal_Data_Eraser::register( |
987 | 987 | $addon_name, |
988 | - self::$_settings[ $addon_name ]['personal_data_exporters'] |
|
988 | + self::$_settings[$addon_name]['personal_data_exporters'] |
|
989 | 989 | ); |
990 | 990 | } |
991 | 991 | } |
@@ -997,10 +997,10 @@ discard block |
||
997 | 997 | */ |
998 | 998 | private static function registerPersonalDataErasers($addon_name) |
999 | 999 | { |
1000 | - if (! empty(self::$_settings[ $addon_name ]['personal_data_erasers'])) { |
|
1000 | + if ( ! empty(self::$_settings[$addon_name]['personal_data_erasers'])) { |
|
1001 | 1001 | EE_Register_Personal_Data_Eraser::register( |
1002 | 1002 | $addon_name, |
1003 | - self::$_settings[ $addon_name ]['personal_data_erasers'] |
|
1003 | + self::$_settings[$addon_name]['personal_data_erasers'] |
|
1004 | 1004 | ); |
1005 | 1005 | } |
1006 | 1006 | } |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | { |
1022 | 1022 | $loader = EventEspresso\core\services\loaders\LoaderFactory::getLoader(); |
1023 | 1023 | $addon = $loader->getShared( |
1024 | - self::$_settings[ $addon_name ]['class_name'], |
|
1024 | + self::$_settings[$addon_name]['class_name'], |
|
1025 | 1025 | array('EE_Registry::create(addon)' => true) |
1026 | 1026 | ); |
1027 | 1027 | // setter inject dep map if required |
@@ -1033,19 +1033,19 @@ discard block |
||
1033 | 1033 | && $addon->domain() === null |
1034 | 1034 | ) { |
1035 | 1035 | // using supplied Domain object |
1036 | - $domain = self::$_settings[ $addon_name ]['domain'] instanceof DomainInterface |
|
1037 | - ? self::$_settings[ $addon_name ]['domain'] |
|
1036 | + $domain = self::$_settings[$addon_name]['domain'] instanceof DomainInterface |
|
1037 | + ? self::$_settings[$addon_name]['domain'] |
|
1038 | 1038 | : null; |
1039 | 1039 | // or construct one using Domain FQCN |
1040 | - if ($domain === null && self::$_settings[ $addon_name ]['domain_fqcn'] !== '') { |
|
1040 | + if ($domain === null && self::$_settings[$addon_name]['domain_fqcn'] !== '') { |
|
1041 | 1041 | $domain = $loader->getShared( |
1042 | - self::$_settings[ $addon_name ]['domain_fqcn'], |
|
1042 | + self::$_settings[$addon_name]['domain_fqcn'], |
|
1043 | 1043 | array( |
1044 | 1044 | new EventEspresso\core\domain\values\FilePath( |
1045 | - self::$_settings[ $addon_name ]['main_file_path'] |
|
1045 | + self::$_settings[$addon_name]['main_file_path'] |
|
1046 | 1046 | ), |
1047 | 1047 | EventEspresso\core\domain\values\Version::fromString( |
1048 | - self::$_settings[ $addon_name ]['version'] |
|
1048 | + self::$_settings[$addon_name]['version'] |
|
1049 | 1049 | ), |
1050 | 1050 | ) |
1051 | 1051 | ); |
@@ -1055,24 +1055,24 @@ discard block |
||
1055 | 1055 | } |
1056 | 1056 | } |
1057 | 1057 | $addon->set_name($addon_name); |
1058 | - $addon->set_plugin_slug(self::$_settings[ $addon_name ]['plugin_slug']); |
|
1059 | - $addon->set_plugin_basename(self::$_settings[ $addon_name ]['plugin_basename']); |
|
1060 | - $addon->set_main_plugin_file(self::$_settings[ $addon_name ]['main_file_path']); |
|
1061 | - $addon->set_plugin_action_slug(self::$_settings[ $addon_name ]['plugin_action_slug']); |
|
1062 | - $addon->set_plugins_page_row(self::$_settings[ $addon_name ]['plugins_page_row']); |
|
1063 | - $addon->set_version(self::$_settings[ $addon_name ]['version']); |
|
1064 | - $addon->set_min_core_version(self::_effective_version(self::$_settings[ $addon_name ]['min_core_version'])); |
|
1065 | - $addon->set_config_section(self::$_settings[ $addon_name ]['config_section']); |
|
1066 | - $addon->set_config_class(self::$_settings[ $addon_name ]['config_class']); |
|
1067 | - $addon->set_config_name(self::$_settings[ $addon_name ]['config_name']); |
|
1058 | + $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']); |
|
1059 | + $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']); |
|
1060 | + $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']); |
|
1061 | + $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']); |
|
1062 | + $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']); |
|
1063 | + $addon->set_version(self::$_settings[$addon_name]['version']); |
|
1064 | + $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version'])); |
|
1065 | + $addon->set_config_section(self::$_settings[$addon_name]['config_section']); |
|
1066 | + $addon->set_config_class(self::$_settings[$addon_name]['config_class']); |
|
1067 | + $addon->set_config_name(self::$_settings[$addon_name]['config_name']); |
|
1068 | 1068 | // unfortunately this can't be hooked in upon construction, because we don't have |
1069 | 1069 | // the plugin mainfile's path upon construction. |
1070 | 1070 | register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation')); |
1071 | 1071 | // call any additional admin_callback functions during load_admin_controller hook |
1072 | - if (! empty(self::$_settings[ $addon_name ]['admin_callback'])) { |
|
1072 | + if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) { |
|
1073 | 1073 | add_action( |
1074 | 1074 | 'AHEE__EE_System__load_controllers__load_admin_controllers', |
1075 | - array($addon, self::$_settings[ $addon_name ]['admin_callback']) |
|
1075 | + array($addon, self::$_settings[$addon_name]['admin_callback']) |
|
1076 | 1076 | ); |
1077 | 1077 | } |
1078 | 1078 | return $addon; |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | public static function load_pue_update() |
1091 | 1091 | { |
1092 | 1092 | // load PUE client |
1093 | - require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php'; |
|
1093 | + require_once EE_THIRD_PARTY.'pue'.DS.'pue-client.php'; |
|
1094 | 1094 | // cycle thru settings |
1095 | 1095 | foreach (self::$_settings as $settings) { |
1096 | - if (! empty($settings['pue_options'])) { |
|
1096 | + if ( ! empty($settings['pue_options'])) { |
|
1097 | 1097 | // initiate the class and start the plugin update engine! |
1098 | 1098 | new PluginUpdateEngineChecker( |
1099 | 1099 | // host file URL |
@@ -1101,7 +1101,7 @@ discard block |
||
1101 | 1101 | // plugin slug(s) |
1102 | 1102 | array( |
1103 | 1103 | 'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']), |
1104 | - 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr'), |
|
1104 | + 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'), |
|
1105 | 1105 | ), |
1106 | 1106 | // options |
1107 | 1107 | array( |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | public static function register_message_types() |
1131 | 1131 | { |
1132 | 1132 | foreach (self::$_settings as $addon_name => $settings) { |
1133 | - if (! empty($settings['message_types'])) { |
|
1133 | + if ( ! empty($settings['message_types'])) { |
|
1134 | 1134 | foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) { |
1135 | 1135 | EE_Register_Message_Type::register($message_type, $message_type_settings); |
1136 | 1136 | } |
@@ -1152,70 +1152,70 @@ discard block |
||
1152 | 1152 | */ |
1153 | 1153 | public static function deregister($addon_name = null) |
1154 | 1154 | { |
1155 | - if (isset(self::$_settings[ $addon_name ]['class_name'])) { |
|
1155 | + if (isset(self::$_settings[$addon_name]['class_name'])) { |
|
1156 | 1156 | try { |
1157 | 1157 | do_action('AHEE__EE_Register_Addon__deregister__before', $addon_name); |
1158 | - $class_name = self::$_settings[ $addon_name ]['class_name']; |
|
1159 | - if (! empty(self::$_settings[ $addon_name ]['dms_paths'])) { |
|
1158 | + $class_name = self::$_settings[$addon_name]['class_name']; |
|
1159 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
1160 | 1160 | // setup DMS |
1161 | 1161 | EE_Register_Data_Migration_Scripts::deregister($addon_name); |
1162 | 1162 | } |
1163 | - if (! empty(self::$_settings[ $addon_name ]['admin_path'])) { |
|
1163 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
1164 | 1164 | // register admin page |
1165 | 1165 | EE_Register_Admin_Page::deregister($addon_name); |
1166 | 1166 | } |
1167 | - if (! empty(self::$_settings[ $addon_name ]['module_paths'])) { |
|
1167 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
1168 | 1168 | // add to list of modules to be registered |
1169 | 1169 | EE_Register_Module::deregister($addon_name); |
1170 | 1170 | } |
1171 | - if (! empty(self::$_settings[ $addon_name ]['shortcode_paths']) |
|
1172 | - || ! empty(self::$_settings[ $addon_name ]['shortcode_fqcns']) |
|
1171 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths']) |
|
1172 | + || ! empty(self::$_settings[$addon_name]['shortcode_fqcns']) |
|
1173 | 1173 | ) { |
1174 | 1174 | // add to list of shortcodes to be registered |
1175 | 1175 | EE_Register_Shortcode::deregister($addon_name); |
1176 | 1176 | } |
1177 | - if (! empty(self::$_settings[ $addon_name ]['config_class'])) { |
|
1177 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
1178 | 1178 | // if config_class present let's register config. |
1179 | - EE_Register_Config::deregister(self::$_settings[ $addon_name ]['config_class']); |
|
1179 | + EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']); |
|
1180 | 1180 | } |
1181 | - if (! empty(self::$_settings[ $addon_name ]['widget_paths'])) { |
|
1181 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
1182 | 1182 | // add to list of widgets to be registered |
1183 | 1183 | EE_Register_Widget::deregister($addon_name); |
1184 | 1184 | } |
1185 | - if (! empty(self::$_settings[ $addon_name ]['model_paths']) |
|
1186 | - || ! empty(self::$_settings[ $addon_name ]['class_paths']) |
|
1185 | + if ( ! empty(self::$_settings[$addon_name]['model_paths']) |
|
1186 | + || ! empty(self::$_settings[$addon_name]['class_paths']) |
|
1187 | 1187 | ) { |
1188 | 1188 | // add to list of shortcodes to be registered |
1189 | 1189 | EE_Register_Model::deregister($addon_name); |
1190 | 1190 | } |
1191 | - if (! empty(self::$_settings[ $addon_name ]['model_extension_paths']) |
|
1192 | - || ! empty(self::$_settings[ $addon_name ]['class_extension_paths']) |
|
1191 | + if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
1192 | + || ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
1193 | 1193 | ) { |
1194 | 1194 | // add to list of shortcodes to be registered |
1195 | 1195 | EE_Register_Model_Extensions::deregister($addon_name); |
1196 | 1196 | } |
1197 | - if (! empty(self::$_settings[ $addon_name ]['message_types'])) { |
|
1198 | - foreach ((array) self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings) { |
|
1197 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
1198 | + foreach ((array) self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) { |
|
1199 | 1199 | EE_Register_Message_Type::deregister($message_type); |
1200 | 1200 | } |
1201 | 1201 | } |
1202 | 1202 | // deregister capabilities for addon |
1203 | - if (! empty(self::$_settings[ $addon_name ]['capabilities']) |
|
1204 | - || ! empty(self::$_settings[ $addon_name ]['capability_maps']) |
|
1203 | + if ( ! empty(self::$_settings[$addon_name]['capabilities']) |
|
1204 | + || ! empty(self::$_settings[$addon_name]['capability_maps']) |
|
1205 | 1205 | ) { |
1206 | 1206 | EE_Register_Capabilities::deregister($addon_name); |
1207 | 1207 | } |
1208 | 1208 | // deregister custom_post_types for addon |
1209 | - if (! empty(self::$_settings[ $addon_name ]['custom_post_types'])) { |
|
1209 | + if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) { |
|
1210 | 1210 | EE_Register_CPT::deregister($addon_name); |
1211 | 1211 | } |
1212 | - if (! empty(self::$_settings[ $addon_name ]['payment_method_paths'])) { |
|
1212 | + if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
|
1213 | 1213 | EE_Register_Payment_Method::deregister($addon_name); |
1214 | 1214 | } |
1215 | 1215 | $addon = EE_Registry::instance()->getAddon($class_name); |
1216 | 1216 | if ($addon instanceof EE_Addon) { |
1217 | 1217 | remove_action( |
1218 | - 'deactivate_' . $addon->get_main_plugin_file_basename(), |
|
1218 | + 'deactivate_'.$addon->get_main_plugin_file_basename(), |
|
1219 | 1219 | array($addon, 'deactivation') |
1220 | 1220 | ); |
1221 | 1221 | remove_action( |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | } catch (Exception $e) { |
1239 | 1239 | new ExceptionLogger($e); |
1240 | 1240 | } |
1241 | - unset(self::$_settings[ $addon_name ]); |
|
1241 | + unset(self::$_settings[$addon_name]); |
|
1242 | 1242 | do_action('AHEE__EE_Register_Addon__deregister__after', $addon_name); |
1243 | 1243 | } |
1244 | 1244 | } |
@@ -13,55 +13,55 @@ |
||
13 | 13 | class EE_Register_Personal_Data_Eraser implements EEI_Plugin_API |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * FQCN for all privacy policy generators |
|
18 | - * |
|
19 | - * @var array keys are plugin_ids, and values are an array of FQCNs or FQCNs |
|
20 | - */ |
|
21 | - protected static $erasers = array(); |
|
16 | + /** |
|
17 | + * FQCN for all privacy policy generators |
|
18 | + * |
|
19 | + * @var array keys are plugin_ids, and values are an array of FQCNs or FQCNs |
|
20 | + */ |
|
21 | + protected static $erasers = array(); |
|
22 | 22 | |
23 | 23 | |
24 | - /* |
|
24 | + /* |
|
25 | 25 | * @param string $plugin_id |
26 | 26 | * @param array $FQNSs can be the fully qualified namespaces each containing only privacy policies, |
27 | 27 | * OR fully qualified class names of privacy policies |
28 | 28 | */ |
29 | - public static function register($plugin_id = null, $FQCNs = array()) |
|
30 | - { |
|
31 | - self::$erasers[ $plugin_id ] = $FQCNs; |
|
32 | - // add to list of modules to be registered |
|
33 | - add_filter( |
|
34 | - 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
35 | - array('EE_Register_Personal_Data_Eraser', 'addErasers') |
|
36 | - ); |
|
37 | - } |
|
29 | + public static function register($plugin_id = null, $FQCNs = array()) |
|
30 | + { |
|
31 | + self::$erasers[ $plugin_id ] = $FQCNs; |
|
32 | + // add to list of modules to be registered |
|
33 | + add_filter( |
|
34 | + 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
35 | + array('EE_Register_Personal_Data_Eraser', 'addErasers') |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @param null $ID |
|
42 | - */ |
|
43 | - public static function deregister($ID = null) |
|
44 | - { |
|
45 | - unset(self::$erasers[ $ID ]); |
|
46 | - } |
|
40 | + /** |
|
41 | + * @param null $ID |
|
42 | + */ |
|
43 | + public static function deregister($ID = null) |
|
44 | + { |
|
45 | + unset(self::$erasers[ $ID ]); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Adds our personal data erasers registered by add-ons |
|
51 | - * |
|
52 | - * @param string[] $erasers |
|
53 | - * @return string[] |
|
54 | - */ |
|
55 | - public static function addErasers(array $erasers) |
|
56 | - { |
|
57 | - foreach (self::$erasers as $erasers_per_addon) { |
|
58 | - $erasers = array_merge( |
|
59 | - $erasers, |
|
60 | - $erasers_per_addon |
|
61 | - ); |
|
62 | - } |
|
63 | - return $erasers; |
|
64 | - } |
|
49 | + /** |
|
50 | + * Adds our personal data erasers registered by add-ons |
|
51 | + * |
|
52 | + * @param string[] $erasers |
|
53 | + * @return string[] |
|
54 | + */ |
|
55 | + public static function addErasers(array $erasers) |
|
56 | + { |
|
57 | + foreach (self::$erasers as $erasers_per_addon) { |
|
58 | + $erasers = array_merge( |
|
59 | + $erasers, |
|
60 | + $erasers_per_addon |
|
61 | + ); |
|
62 | + } |
|
63 | + return $erasers; |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | // End of file EE_Register_Personal_Data_Eraser.lib.php |
67 | 67 | // Location: ${NAMESPACE}/EE_Register_Personal_Data_Eraser.lib.php |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public static function register($plugin_id = null, $FQCNs = array()) |
30 | 30 | { |
31 | - self::$erasers[ $plugin_id ] = $FQCNs; |
|
31 | + self::$erasers[$plugin_id] = $FQCNs; |
|
32 | 32 | // add to list of modules to be registered |
33 | 33 | add_filter( |
34 | 34 | 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function deregister($ID = null) |
44 | 44 | { |
45 | - unset(self::$erasers[ $ID ]); |
|
45 | + unset(self::$erasers[$ID]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -13,55 +13,55 @@ |
||
13 | 13 | class EE_Register_Personal_Data_Exporter implements EEI_Plugin_API |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * FQCN for all privacy policy generators |
|
18 | - * |
|
19 | - * @var array keys are plugin_ids, and values are an array of FQCNs or FQCNs |
|
20 | - */ |
|
21 | - protected static $exporters = array(); |
|
16 | + /** |
|
17 | + * FQCN for all privacy policy generators |
|
18 | + * |
|
19 | + * @var array keys are plugin_ids, and values are an array of FQCNs or FQCNs |
|
20 | + */ |
|
21 | + protected static $exporters = array(); |
|
22 | 22 | |
23 | 23 | |
24 | - /* |
|
24 | + /* |
|
25 | 25 | * @param string $plugin_id |
26 | 26 | * @param array $FQNSs can be the fully qualified namespaces each containing only privacy policies, |
27 | 27 | * OR fully qualified class names of privacy policies |
28 | 28 | */ |
29 | - public static function register($plugin_id = null, $FQCNs = array()) |
|
30 | - { |
|
31 | - self::$exporters[ $plugin_id ] = $FQCNs; |
|
32 | - // add to list of modules to be registered |
|
33 | - add_filter( |
|
34 | - 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
35 | - array('EE_Register_Personal_Data_Exporter', 'addExporters') |
|
36 | - ); |
|
37 | - } |
|
29 | + public static function register($plugin_id = null, $FQCNs = array()) |
|
30 | + { |
|
31 | + self::$exporters[ $plugin_id ] = $FQCNs; |
|
32 | + // add to list of modules to be registered |
|
33 | + add_filter( |
|
34 | + 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
35 | + array('EE_Register_Personal_Data_Exporter', 'addExporters') |
|
36 | + ); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - /** |
|
41 | - * @param null $ID |
|
42 | - */ |
|
43 | - public static function deregister($ID = null) |
|
44 | - { |
|
45 | - unset(self::$exporters[ $ID ]); |
|
46 | - } |
|
40 | + /** |
|
41 | + * @param null $ID |
|
42 | + */ |
|
43 | + public static function deregister($ID = null) |
|
44 | + { |
|
45 | + unset(self::$exporters[ $ID ]); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | - /** |
|
50 | - * Adds our personal data exporters registered by add-ons |
|
51 | - * |
|
52 | - * @param string[] $exporters |
|
53 | - * @return string[] |
|
54 | - */ |
|
55 | - public static function addExporters(array $exporters) |
|
56 | - { |
|
57 | - foreach (self::$exporters as $exporters_per_addon) { |
|
58 | - $exporters = array_merge( |
|
59 | - $exporters, |
|
60 | - $exporters_per_addon |
|
61 | - ); |
|
62 | - } |
|
63 | - return $exporters; |
|
64 | - } |
|
49 | + /** |
|
50 | + * Adds our personal data exporters registered by add-ons |
|
51 | + * |
|
52 | + * @param string[] $exporters |
|
53 | + * @return string[] |
|
54 | + */ |
|
55 | + public static function addExporters(array $exporters) |
|
56 | + { |
|
57 | + foreach (self::$exporters as $exporters_per_addon) { |
|
58 | + $exporters = array_merge( |
|
59 | + $exporters, |
|
60 | + $exporters_per_addon |
|
61 | + ); |
|
62 | + } |
|
63 | + return $exporters; |
|
64 | + } |
|
65 | 65 | } |
66 | 66 | // End of file EE_Register_Personal_Data_Exporter.lib.php |
67 | 67 | // Location: ${NAMESPACE}/EE_Register_Personal_Data_Exporter.lib.php |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | */ |
29 | 29 | public static function register($plugin_id = null, $FQCNs = array()) |
30 | 30 | { |
31 | - self::$exporters[ $plugin_id ] = $FQCNs; |
|
31 | + self::$exporters[$plugin_id] = $FQCNs; |
|
32 | 32 | // add to list of modules to be registered |
33 | 33 | add_filter( |
34 | 34 | 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function deregister($ID = null) |
44 | 44 | { |
45 | - unset(self::$exporters[ $ID ]); |
|
45 | + unset(self::$exporters[$ID]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -14,35 +14,35 @@ |
||
14 | 14 | */ |
15 | 15 | interface PersonalDataExporterInterface |
16 | 16 | { |
17 | - /** |
|
18 | - * Gets the Translated name of this exporter |
|
19 | - * |
|
20 | - * @return string |
|
21 | - */ |
|
22 | - public function name(); |
|
17 | + /** |
|
18 | + * Gets the Translated name of this exporter |
|
19 | + * |
|
20 | + * @return string |
|
21 | + */ |
|
22 | + public function name(); |
|
23 | 23 | |
24 | - /** |
|
25 | - * Returns data for export. |
|
26 | - * |
|
27 | - * @param string $email_address , |
|
28 | - * @param int $page starts at 1, not 0 |
|
29 | - * @return array { |
|
30 | - * @type array $data { |
|
31 | - * @type array { |
|
32 | - * @type string $group_id (not translated, same for all exports) |
|
33 | - * @type string $group_label (translated string) |
|
34 | - * @type string|int $item_id |
|
35 | - * @type array $data { |
|
36 | - * @type array { |
|
37 | - * @type string $name what's shown in the left-column of the export row |
|
38 | - * @type string $value what's showin the right-column of the export row |
|
39 | - * } |
|
40 | - * } |
|
41 | - * } |
|
42 | - * } |
|
43 | - * } |
|
44 | - */ |
|
45 | - public function export($email_address, $page = 1); |
|
24 | + /** |
|
25 | + * Returns data for export. |
|
26 | + * |
|
27 | + * @param string $email_address , |
|
28 | + * @param int $page starts at 1, not 0 |
|
29 | + * @return array { |
|
30 | + * @type array $data { |
|
31 | + * @type array { |
|
32 | + * @type string $group_id (not translated, same for all exports) |
|
33 | + * @type string $group_label (translated string) |
|
34 | + * @type string|int $item_id |
|
35 | + * @type array $data { |
|
36 | + * @type array { |
|
37 | + * @type string $name what's shown in the left-column of the export row |
|
38 | + * @type string $value what's showin the right-column of the export row |
|
39 | + * } |
|
40 | + * } |
|
41 | + * } |
|
42 | + * } |
|
43 | + * } |
|
44 | + */ |
|
45 | + public function export($email_address, $page = 1); |
|
46 | 46 | } |
47 | 47 | // End of file PersonalDataExporterInterface.php |
48 | 48 | // Location: EventEspresso\core\domain\services\admin/PersonalDataExporterInterface.php |
@@ -16,73 +16,73 @@ |
||
16 | 16 | class EraseAttendeeData implements PersonalDataEraserInterface |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * @var EEM_Attendee |
|
21 | - */ |
|
22 | - protected $attendee_model; |
|
19 | + /** |
|
20 | + * @var EEM_Attendee |
|
21 | + */ |
|
22 | + protected $attendee_model; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * EraseAttendeeData constructor. |
|
27 | - * |
|
28 | - * @param EEM_Attendee $attendee_model |
|
29 | - */ |
|
30 | - public function __construct(EEM_Attendee $attendee_model) |
|
31 | - { |
|
32 | - $this->attendee_model = $attendee_model; |
|
33 | - } |
|
25 | + /** |
|
26 | + * EraseAttendeeData constructor. |
|
27 | + * |
|
28 | + * @param EEM_Attendee $attendee_model |
|
29 | + */ |
|
30 | + public function __construct(EEM_Attendee $attendee_model) |
|
31 | + { |
|
32 | + $this->attendee_model = $attendee_model; |
|
33 | + } |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * Gets a translated string name for the data eraser |
|
38 | - * |
|
39 | - * @return string |
|
40 | - */ |
|
41 | - public function name() |
|
42 | - { |
|
43 | - return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | - } |
|
36 | + /** |
|
37 | + * Gets a translated string name for the data eraser |
|
38 | + * |
|
39 | + * @return string |
|
40 | + */ |
|
41 | + public function name() |
|
42 | + { |
|
43 | + return esc_html__('Event Espresso Attendee Data', 'event_espresso'); |
|
44 | + } |
|
45 | 45 | |
46 | 46 | |
47 | - /** |
|
48 | - * Erases a "page" of personal user data |
|
49 | - * |
|
50 | - * @return array { |
|
51 | - * @type boolean $items_removed whether items were removed successfully or not |
|
52 | - * @type boolean $items_retained whether any items were skipped or not |
|
53 | - * @type array $messages values are messages to show |
|
54 | - * @type boolean $done whether this eraser is done or has more pages |
|
55 | - * } |
|
56 | - * @throws \EE_Error |
|
57 | - */ |
|
58 | - public function erase($email_address, $page = 1) |
|
59 | - { |
|
60 | - $rows_updated = $this->attendee_model->update( |
|
61 | - array( |
|
62 | - 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | - 'ATT_lname' => '', |
|
64 | - 'ATT_email' => '', |
|
65 | - 'ATT_address' => '', |
|
66 | - 'ATT_address2' => '', |
|
67 | - 'ATT_city' => '', |
|
68 | - 'STA_ID' => 0, |
|
69 | - 'CNT_ISO' => '', |
|
70 | - 'ATT_zip' => '', |
|
71 | - ), |
|
72 | - array( |
|
73 | - array( |
|
74 | - 'ATT_email' => $email_address, |
|
75 | - ), |
|
76 | - ) |
|
77 | - ); |
|
47 | + /** |
|
48 | + * Erases a "page" of personal user data |
|
49 | + * |
|
50 | + * @return array { |
|
51 | + * @type boolean $items_removed whether items were removed successfully or not |
|
52 | + * @type boolean $items_retained whether any items were skipped or not |
|
53 | + * @type array $messages values are messages to show |
|
54 | + * @type boolean $done whether this eraser is done or has more pages |
|
55 | + * } |
|
56 | + * @throws \EE_Error |
|
57 | + */ |
|
58 | + public function erase($email_address, $page = 1) |
|
59 | + { |
|
60 | + $rows_updated = $this->attendee_model->update( |
|
61 | + array( |
|
62 | + 'ATT_fname' => esc_html__('Anonymous', 'event_espresso'), |
|
63 | + 'ATT_lname' => '', |
|
64 | + 'ATT_email' => '', |
|
65 | + 'ATT_address' => '', |
|
66 | + 'ATT_address2' => '', |
|
67 | + 'ATT_city' => '', |
|
68 | + 'STA_ID' => 0, |
|
69 | + 'CNT_ISO' => '', |
|
70 | + 'ATT_zip' => '', |
|
71 | + ), |
|
72 | + array( |
|
73 | + array( |
|
74 | + 'ATT_email' => $email_address, |
|
75 | + ), |
|
76 | + ) |
|
77 | + ); |
|
78 | 78 | |
79 | - return array( |
|
80 | - 'items_removed' => (bool) $rows_updated, |
|
81 | - 'items_retained' => false, // always false in this example |
|
82 | - 'messages' => array(), |
|
83 | - 'done' => true, |
|
84 | - ); |
|
85 | - } |
|
79 | + return array( |
|
80 | + 'items_removed' => (bool) $rows_updated, |
|
81 | + 'items_retained' => false, // always false in this example |
|
82 | + 'messages' => array(), |
|
83 | + 'done' => true, |
|
84 | + ); |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | // End of file EraseAttendeeData.php |
88 | 88 | // Location: EventEspresso\core\domain\services\privacy\erasure/EraseAttendeeData.php |
@@ -15,25 +15,25 @@ |
||
15 | 15 | interface PersonalDataEraserInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * Gets a translated string name for the data eraser |
|
20 | - * |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function name(); |
|
18 | + /** |
|
19 | + * Gets a translated string name for the data eraser |
|
20 | + * |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function name(); |
|
24 | 24 | |
25 | 25 | |
26 | - /** |
|
27 | - * Erases a "page" of personal user data |
|
28 | - * |
|
29 | - * @return array { |
|
30 | - * @type boolean $items_removed whether items were removed successfully or not |
|
31 | - * @type boolean $items_retained whether any items were skipped or not |
|
32 | - * @type array $messages values are messages to show |
|
33 | - * @type boolean $done whether this eraser is done or has more pages |
|
34 | - * } |
|
35 | - */ |
|
36 | - public function erase($email_address, $page = 1); |
|
26 | + /** |
|
27 | + * Erases a "page" of personal user data |
|
28 | + * |
|
29 | + * @return array { |
|
30 | + * @type boolean $items_removed whether items were removed successfully or not |
|
31 | + * @type boolean $items_retained whether any items were skipped or not |
|
32 | + * @type array $messages values are messages to show |
|
33 | + * @type boolean $done whether this eraser is done or has more pages |
|
34 | + * } |
|
35 | + */ |
|
36 | + public function erase($email_address, $page = 1); |
|
37 | 37 | } |
38 | 38 | // End of file PersonalDataEraserInterface.php |
39 | 39 | // Location: EventEspresso\core\domain\services\admin/PersonalDataEraserInterface.php |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | ?> |
8 | 8 | <h2><?php esc_html_e('Event Registration Data', 'event_espresso'); ?></h2> |
9 | 9 | <p><?php |
10 | - esc_html_e( |
|
11 | - 'We collect information about you during event registration. This information may include but is not limited to:', |
|
12 | - 'event_espresso' |
|
13 | - ); ?></p> |
|
10 | + esc_html_e( |
|
11 | + 'We collect information about you during event registration. This information may include but is not limited to:', |
|
12 | + 'event_espresso' |
|
13 | + ); ?></p> |
|
14 | 14 | <ul> |
15 | 15 | <li><?php esc_html_e('Your names', 'event_espresso'); ?></li> |
16 | 16 | <li><?php esc_html_e('Billing address', 'event_espresso'); ?></li> |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | <li><?php esc_html_e('Phone number', 'event_espresso'); ?></li> |
20 | 20 | <li><?php esc_html_e('Location and traffic data (including IP address and browser type)', 'event_espresso'); ?></li> |
21 | 21 | <li><?php |
22 | - esc_html_e( |
|
23 | - 'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', |
|
24 | - 'event_espresso' |
|
25 | - ); ?></li> |
|
22 | + esc_html_e( |
|
23 | + 'Any other details that might be requested from you for the purpose of processing your registration or ticket purchase', |
|
24 | + 'event_espresso' |
|
25 | + ); ?></li> |
|
26 | 26 | </ul> |
27 | 27 | |
28 | 28 | <p><?php esc_html_e('Handling this data also allows us to:', 'event_espresso'); ?></p> |
@@ -30,103 +30,103 @@ discard block |
||
30 | 30 | <li><?php esc_html_e('Send you important account/purchase/service information.', 'event_espresso'); ?></li> |
31 | 31 | <li><?php esc_html_e('Respond to your queries, refund requests, or complaints.', 'event_espresso'); ?></li> |
32 | 32 | <li><?php |
33 | - esc_html_e( |
|
34 | - 'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', |
|
35 | - 'event_espresso' |
|
36 | - ); ?></li> |
|
33 | + esc_html_e( |
|
34 | + 'Process payments and prevent fraudulent transactions. We do this on the basis of our legitimate business interests.', |
|
35 | + 'event_espresso' |
|
36 | + ); ?></li> |
|
37 | 37 | <li><?php |
38 | - esc_html_e( |
|
39 | - 'Set up and administer your account, provide technical and customer support, and to verify your identity.', |
|
40 | - 'event_espresso' |
|
41 | - ); ?></li> |
|
38 | + esc_html_e( |
|
39 | + 'Set up and administer your account, provide technical and customer support, and to verify your identity.', |
|
40 | + 'event_espresso' |
|
41 | + ); ?></li> |
|
42 | 42 | </ul> |
43 | 43 | |
44 | 44 | <?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
45 | 45 | <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2> |
46 | 46 | <?php |
47 | 47 | // if onsite or offsite payment methods are active |
48 | - if (! empty($active_onsite_payment_methods)) { ?> |
|
48 | + if (! empty($active_onsite_payment_methods)) { ?> |
|
49 | 49 | <p><?php |
50 | - esc_html_e( |
|
51 | - 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
|
52 | - 'event_espresso' |
|
53 | - ); ?></p> |
|
50 | + esc_html_e( |
|
51 | + 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
|
52 | + 'event_espresso' |
|
53 | + ); ?></p> |
|
54 | 54 | <p><?php |
55 | - printf( |
|
56 | - esc_html_x( |
|
57 | - 'Please see the privacy policy of %1$s.', |
|
58 | - 'Please see the privacy policy of PayPal Pro', |
|
59 | - 'event_espresso' |
|
60 | - ), |
|
61 | - implode( |
|
62 | - ', ', |
|
63 | - array_merge( |
|
64 | - $active_onsite_payment_methods, |
|
65 | - $active_offsite_payment_methods |
|
66 | - ) |
|
67 | - ) |
|
68 | - ); ?></p> |
|
55 | + printf( |
|
56 | + esc_html_x( |
|
57 | + 'Please see the privacy policy of %1$s.', |
|
58 | + 'Please see the privacy policy of PayPal Pro', |
|
59 | + 'event_espresso' |
|
60 | + ), |
|
61 | + implode( |
|
62 | + ', ', |
|
63 | + array_merge( |
|
64 | + $active_onsite_payment_methods, |
|
65 | + $active_offsite_payment_methods |
|
66 | + ) |
|
67 | + ) |
|
68 | + ); ?></p> |
|
69 | 69 | <p><?php |
70 | - esc_html_e( |
|
71 | - 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).', |
|
72 | - 'event_espresso' |
|
73 | - ); ?></p> |
|
70 | + esc_html_e( |
|
71 | + 'Masked billing information may be stored on our servers (eg only the last 4 digits of credit card numbers are stored: **** **** **** 1234).', |
|
72 | + 'event_espresso' |
|
73 | + ); ?></p> |
|
74 | 74 | <?php } // IF OFFSITE PAYMENT METHOD ACTIVE |
75 | - elseif (! empty($active_onsite_payment_methods)) { ?> |
|
75 | + elseif (! empty($active_onsite_payment_methods)) { ?> |
|
76 | 76 | <p><?php |
77 | - printf( |
|
78 | - esc_html_x( |
|
79 | - 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
80 | - 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.', |
|
81 | - 'event_espresso' |
|
82 | - ), |
|
83 | - implode(', ', $active_offsite_payment_methods) |
|
84 | - ); ?></p> |
|
77 | + printf( |
|
78 | + esc_html_x( |
|
79 | + 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of %1$s.', |
|
80 | + 'Billing information is sent directly to the payment processor, and is not handled by our servers. Please see the privacy policy of PayPal Pro.', |
|
81 | + 'event_espresso' |
|
82 | + ), |
|
83 | + implode(', ', $active_offsite_payment_methods) |
|
84 | + ); ?></p> |
|
85 | 85 | <?php } ?> |
86 | 86 | <h2><?php esc_html_e('Payment Logging', 'event_espresso'); ?></h2> |
87 | 87 | <p><?php |
88 | - esc_html_e( |
|
89 | - 'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', |
|
90 | - 'event_espresso' |
|
91 | - ); ?></p> |
|
88 | + esc_html_e( |
|
89 | + 'Site administrators may keep a log of communications with the payment processors in order to verify payments are being processed correctly. These logs are automatically deleted after a week.', |
|
90 | + 'event_espresso' |
|
91 | + ); ?></p> |
|
92 | 92 | <?php } ?> |
93 | 93 | |
94 | 94 | <h2><?php esc_html_e('Event Registration Cookies', 'event_espresso'); ?></h2> |
95 | 95 | <p><?php |
96 | - printf( |
|
97 | - esc_html_x( |
|
98 | - 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', |
|
99 | - 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.', |
|
100 | - 'event_espresso' |
|
101 | - ), |
|
102 | - $session_lifespan |
|
103 | - ); ?></p> |
|
96 | + printf( |
|
97 | + esc_html_x( |
|
98 | + 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts %1$s.', |
|
99 | + 'When you begin registering for an event and select a ticket quantity, a cookie will be used to track your registration. This cookie lasts 2 hours.', |
|
100 | + 'event_espresso' |
|
101 | + ), |
|
102 | + $session_lifespan |
|
103 | + ); ?></p> |
|
104 | 104 | |
105 | 105 | <h2><?php esc_html_e('Email History Data', 'event_espresso'); ?></h2> |
106 | 106 | <p><?php |
107 | - esc_html_e( |
|
108 | - 'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', |
|
109 | - 'event_espresso' |
|
110 | - ); ?></p> |
|
107 | + esc_html_e( |
|
108 | + 'We keep a record of the emails sent to you. This is to ensure communication is successfully sent and its information is accurate.', |
|
109 | + 'event_espresso' |
|
110 | + ); ?></p> |
|
111 | 111 | |
112 | 112 | <h2><?php esc_html_e('Event Check-In Record', 'event_espresso'); ?></h2> |
113 | 113 | <p><?php |
114 | - esc_html_e( |
|
115 | - 'When you attend an event, an event manager may record the time you check in or out of the event.', |
|
116 | - 'event_espresso' |
|
117 | - ); ?></p> |
|
114 | + esc_html_e( |
|
115 | + 'When you attend an event, an event manager may record the time you check in or out of the event.', |
|
116 | + 'event_espresso' |
|
117 | + ); ?></p> |
|
118 | 118 | |
119 | 119 | <h2><?php esc_html_e('Event Registration Data Retention', 'event_espresso'); ?></h2> |
120 | 120 | <p><?php |
121 | - esc_html_e( |
|
122 | - 'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', |
|
123 | - 'event_espresso' |
|
124 | - ); ?></p> |
|
121 | + esc_html_e( |
|
122 | + 'Personal data is stored at least until the date of the event, and may be kept indefinitely in case of future registrations.', |
|
123 | + 'event_espresso' |
|
124 | + ); ?></p> |
|
125 | 125 | |
126 | 126 | <h2><?php esc_html_e('Event Registration Data Erasure and Export', 'event_espresso'); ?></h2> |
127 | 127 | <p><?php |
128 | - esc_html_e( |
|
129 | - 'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', |
|
130 | - 'event_espresso' |
|
131 | - ); ?></p> |
|
128 | + esc_html_e( |
|
129 | + 'You have the right to request your personal data be sent to you electronically, and the right to request your registration data be erased after the event. To do so, please contact the event manager or site administrator.', |
|
130 | + 'event_espresso' |
|
131 | + ); ?></p> |
|
132 | 132 |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | ); ?></li> |
42 | 42 | </ul> |
43 | 43 | |
44 | -<?php if (! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
|
44 | +<?php if ( ! empty($active_onsite_payment_methods) || ! empty($active_offsite_payment_methods)) { ?> |
|
45 | 45 | <h2><?php esc_html_e('Billing Information', 'event_espresso'); ?> </h2> |
46 | 46 | <?php |
47 | 47 | // if onsite or offsite payment methods are active |
48 | - if (! empty($active_onsite_payment_methods)) { ?> |
|
48 | + if ( ! empty($active_onsite_payment_methods)) { ?> |
|
49 | 49 | <p><?php |
50 | 50 | esc_html_e( |
51 | 51 | 'In order to process payments, we collect billing information on-site. Sensitive billing information is not stored on our server, but may be handled while in-transit to the payment processing server.', |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | 'event_espresso' |
73 | 73 | ); ?></p> |
74 | 74 | <?php } // IF OFFSITE PAYMENT METHOD ACTIVE |
75 | - elseif (! empty($active_onsite_payment_methods)) { ?> |
|
75 | + elseif ( ! empty($active_onsite_payment_methods)) { ?> |
|
76 | 76 | <p><?php |
77 | 77 | printf( |
78 | 78 | esc_html_x( |
@@ -23,68 +23,68 @@ |
||
23 | 23 | class PersonalDataExporterManager |
24 | 24 | { |
25 | 25 | |
26 | - public function __construct() |
|
27 | - { |
|
28 | - add_filter( |
|
29 | - 'wp_privacy_personal_data_exporters', |
|
30 | - array($this, 'hookInExporters') |
|
31 | - ); |
|
32 | - } |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + add_filter( |
|
29 | + 'wp_privacy_personal_data_exporters', |
|
30 | + array($this, 'hookInExporters') |
|
31 | + ); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * Adds EE's exporters to the list of WP exporters |
|
37 | - * |
|
38 | - * @param array $exporters |
|
39 | - * @return array |
|
40 | - */ |
|
41 | - public function hookInExporters($exporters) |
|
42 | - { |
|
43 | - // load all the privacy policy stuff |
|
44 | - // add post policy text |
|
45 | - foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
|
46 | - $exporters[ get_class($exporter) ] = array( |
|
47 | - 'exporter_friendly_name' => $exporter->name(), |
|
48 | - 'callback' => array($exporter, 'export'), |
|
49 | - ); |
|
50 | - } |
|
51 | - return $exporters; |
|
52 | - } |
|
35 | + /** |
|
36 | + * Adds EE's exporters to the list of WP exporters |
|
37 | + * |
|
38 | + * @param array $exporters |
|
39 | + * @return array |
|
40 | + */ |
|
41 | + public function hookInExporters($exporters) |
|
42 | + { |
|
43 | + // load all the privacy policy stuff |
|
44 | + // add post policy text |
|
45 | + foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
|
46 | + $exporters[ get_class($exporter) ] = array( |
|
47 | + 'exporter_friendly_name' => $exporter->name(), |
|
48 | + 'callback' => array($exporter, 'export'), |
|
49 | + ); |
|
50 | + } |
|
51 | + return $exporters; |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * @return CollectionInterface|PersonalDataExporterInterface[] |
|
57 | - * @throws InvalidIdentifierException |
|
58 | - * @throws InvalidInterfaceException |
|
59 | - * @throws InvalidFilePathException |
|
60 | - * @throws InvalidEntityException |
|
61 | - * @throws InvalidDataTypeException |
|
62 | - * @throws InvalidClassException |
|
63 | - */ |
|
64 | - protected function loadPrivateDataExporterCollection() |
|
65 | - { |
|
66 | - $loader = new CollectionLoader( |
|
67 | - new CollectionDetails( |
|
68 | - // collection name |
|
69 | - 'personal_data_exporters', |
|
70 | - // collection interface |
|
71 | - 'EventEspresso\core\services\privacy\export\PersonalDataExporterInterface', |
|
72 | - // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
73 | - apply_filters( |
|
74 | - 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
75 | - array('EventEspresso\core\domain\services\admin\privacy\export') |
|
76 | - ), |
|
77 | - // filepaths to classes to add |
|
78 | - array(), |
|
79 | - // file mask to use if parsing folder for files to add |
|
80 | - '', |
|
81 | - // what to use as identifier for collection entities |
|
82 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
83 | - CollectionDetails::ID_CLASS_NAME |
|
84 | - ) |
|
85 | - ); |
|
86 | - return $loader->getCollection(); |
|
87 | - } |
|
55 | + /** |
|
56 | + * @return CollectionInterface|PersonalDataExporterInterface[] |
|
57 | + * @throws InvalidIdentifierException |
|
58 | + * @throws InvalidInterfaceException |
|
59 | + * @throws InvalidFilePathException |
|
60 | + * @throws InvalidEntityException |
|
61 | + * @throws InvalidDataTypeException |
|
62 | + * @throws InvalidClassException |
|
63 | + */ |
|
64 | + protected function loadPrivateDataExporterCollection() |
|
65 | + { |
|
66 | + $loader = new CollectionLoader( |
|
67 | + new CollectionDetails( |
|
68 | + // collection name |
|
69 | + 'personal_data_exporters', |
|
70 | + // collection interface |
|
71 | + 'EventEspresso\core\services\privacy\export\PersonalDataExporterInterface', |
|
72 | + // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
73 | + apply_filters( |
|
74 | + 'FHEE__EventEspresso_core_services_privacy_export_PersonalDataExporterManager__exporters', |
|
75 | + array('EventEspresso\core\domain\services\admin\privacy\export') |
|
76 | + ), |
|
77 | + // filepaths to classes to add |
|
78 | + array(), |
|
79 | + // file mask to use if parsing folder for files to add |
|
80 | + '', |
|
81 | + // what to use as identifier for collection entities |
|
82 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
83 | + CollectionDetails::ID_CLASS_NAME |
|
84 | + ) |
|
85 | + ); |
|
86 | + return $loader->getCollection(); |
|
87 | + } |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | // End of file PersonalDataExporterManager.php |
@@ -43,7 +43,7 @@ |
||
43 | 43 | // load all the privacy policy stuff |
44 | 44 | // add post policy text |
45 | 45 | foreach ($this->loadPrivateDataExporterCollection() as $exporter) { |
46 | - $exporters[ get_class($exporter) ] = array( |
|
46 | + $exporters[get_class($exporter)] = array( |
|
47 | 47 | 'exporter_friendly_name' => $exporter->name(), |
48 | 48 | 'callback' => array($exporter, 'export'), |
49 | 49 | ); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | // load all the privacy policy stuff |
41 | 41 | // add post policy text |
42 | 42 | foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
43 | - $erasers[ get_class($eraser) ] = array( |
|
43 | + $erasers[get_class($eraser)] = array( |
|
44 | 44 | 'eraser_friendly_name' => $eraser->name(), |
45 | 45 | 'callback' => array($eraser, 'erase'), |
46 | 46 | ); |
@@ -23,65 +23,65 @@ |
||
23 | 23 | class PersonalDataEraserManager |
24 | 24 | { |
25 | 25 | |
26 | - public function __construct() |
|
27 | - { |
|
28 | - add_filter( |
|
29 | - 'wp_privacy_personal_data_erasers', |
|
30 | - array($this, 'hookInErasers') |
|
31 | - ); |
|
32 | - } |
|
26 | + public function __construct() |
|
27 | + { |
|
28 | + add_filter( |
|
29 | + 'wp_privacy_personal_data_erasers', |
|
30 | + array($this, 'hookInErasers') |
|
31 | + ); |
|
32 | + } |
|
33 | 33 | |
34 | 34 | |
35 | - /** |
|
36 | - * For all the registered `PrivateDataEraserInterface`s, add them as erasers |
|
37 | - */ |
|
38 | - public function hookInErasers($erasers) |
|
39 | - { |
|
40 | - // load all the privacy policy stuff |
|
41 | - // add post policy text |
|
42 | - foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
|
43 | - $erasers[ get_class($eraser) ] = array( |
|
44 | - 'eraser_friendly_name' => $eraser->name(), |
|
45 | - 'callback' => array($eraser, 'erase'), |
|
46 | - ); |
|
47 | - } |
|
48 | - return $erasers; |
|
49 | - } |
|
35 | + /** |
|
36 | + * For all the registered `PrivateDataEraserInterface`s, add them as erasers |
|
37 | + */ |
|
38 | + public function hookInErasers($erasers) |
|
39 | + { |
|
40 | + // load all the privacy policy stuff |
|
41 | + // add post policy text |
|
42 | + foreach ($this->loadPrivateDataEraserCollection() as $eraser) { |
|
43 | + $erasers[ get_class($eraser) ] = array( |
|
44 | + 'eraser_friendly_name' => $eraser->name(), |
|
45 | + 'callback' => array($eraser, 'erase'), |
|
46 | + ); |
|
47 | + } |
|
48 | + return $erasers; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @return CollectionInterface|PersonalDataEraserInterface[] |
|
54 | - * @throws InvalidIdentifierException |
|
55 | - * @throws InvalidInterfaceException |
|
56 | - * @throws InvalidFilePathException |
|
57 | - * @throws InvalidEntityException |
|
58 | - * @throws InvalidDataTypeException |
|
59 | - * @throws InvalidClassException |
|
60 | - */ |
|
61 | - protected function loadPrivateDataEraserCollection() |
|
62 | - { |
|
63 | - $loader = new CollectionLoader( |
|
64 | - new CollectionDetails( |
|
65 | - // collection name |
|
66 | - 'privacy_erasers', |
|
67 | - // collection interface |
|
68 | - 'EventEspresso\core\services\privacy\erasure\PersonalDataEraserInterface', |
|
69 | - // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
70 | - apply_filters( |
|
71 | - 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
72 | - array('EventEspresso\core\domain\services\admin\privacy\erasure') |
|
73 | - ), |
|
74 | - // filepaths to classes to add |
|
75 | - array(), |
|
76 | - // file mask to use if parsing folder for files to add |
|
77 | - '', |
|
78 | - // what to use as identifier for collection entities |
|
79 | - // using CLASS NAME prevents duplicates (works like a singleton) |
|
80 | - CollectionDetails::ID_CLASS_NAME |
|
81 | - ) |
|
82 | - ); |
|
83 | - return $loader->getCollection(); |
|
84 | - } |
|
52 | + /** |
|
53 | + * @return CollectionInterface|PersonalDataEraserInterface[] |
|
54 | + * @throws InvalidIdentifierException |
|
55 | + * @throws InvalidInterfaceException |
|
56 | + * @throws InvalidFilePathException |
|
57 | + * @throws InvalidEntityException |
|
58 | + * @throws InvalidDataTypeException |
|
59 | + * @throws InvalidClassException |
|
60 | + */ |
|
61 | + protected function loadPrivateDataEraserCollection() |
|
62 | + { |
|
63 | + $loader = new CollectionLoader( |
|
64 | + new CollectionDetails( |
|
65 | + // collection name |
|
66 | + 'privacy_erasers', |
|
67 | + // collection interface |
|
68 | + 'EventEspresso\core\services\privacy\erasure\PersonalDataEraserInterface', |
|
69 | + // FQCNs for classes to add (all classes within that namespace will be loaded) |
|
70 | + apply_filters( |
|
71 | + 'FHEE__EventEspresso_core_services_privacy_erasure_PersonalDataEraserManager__erasers', |
|
72 | + array('EventEspresso\core\domain\services\admin\privacy\erasure') |
|
73 | + ), |
|
74 | + // filepaths to classes to add |
|
75 | + array(), |
|
76 | + // file mask to use if parsing folder for files to add |
|
77 | + '', |
|
78 | + // what to use as identifier for collection entities |
|
79 | + // using CLASS NAME prevents duplicates (works like a singleton) |
|
80 | + CollectionDetails::ID_CLASS_NAME |
|
81 | + ) |
|
82 | + ); |
|
83 | + return $loader->getCollection(); |
|
84 | + } |
|
85 | 85 | } |
86 | 86 | // End of file PersonalDataEraserManager.php |
87 | 87 | // Location: EventEspresso\core\domain\services\admin/PersonalDataEraserManager.php |