@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | protected static $_incompatible_addons = array( |
49 | 49 | 'Multi_Event_Registration' => '2.0.11.rc.002', |
50 | 50 | 'Promotions' => '1.0.0.rc.084', |
51 | - ); |
|
51 | + ); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | |
@@ -219,656 +219,656 @@ discard block |
||
219 | 219 | */ |
220 | 220 | public static function register( $addon_name = '', $setup_args = array() ) { |
221 | 221 | // required fields MUST be present, so let's make sure they are. |
222 | - \EE_Register_Addon::_verify_parameters($addon_name, $setup_args); |
|
223 | - // get class name for addon |
|
222 | + \EE_Register_Addon::_verify_parameters($addon_name, $setup_args); |
|
223 | + // get class name for addon |
|
224 | 224 | $class_name = \EE_Register_Addon::_parse_class_name($addon_name, $setup_args); |
225 | 225 | //setup $_settings array from incoming values. |
226 | - $addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args); |
|
227 | - // setup PUE |
|
228 | - \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
|
229 | - // does this addon work with this version of core or WordPress ? |
|
230 | - if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings) ) { |
|
231 | - return; |
|
226 | + $addon_settings = \EE_Register_Addon::_get_addon_settings($class_name, $setup_args); |
|
227 | + // setup PUE |
|
228 | + \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
|
229 | + // does this addon work with this version of core or WordPress ? |
|
230 | + if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings) ) { |
|
231 | + return; |
|
232 | 232 | } |
233 | 233 | // register namespaces |
234 | - \EE_Register_Addon::_setup_namespaces($addon_settings); |
|
235 | - // check if this is an activation request |
|
236 | - if ( \EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
237 | - // dont bother setting up the rest of the addon atm |
|
238 | - return; |
|
239 | - } |
|
234 | + \EE_Register_Addon::_setup_namespaces($addon_settings); |
|
235 | + // check if this is an activation request |
|
236 | + if ( \EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
237 | + // dont bother setting up the rest of the addon atm |
|
238 | + return; |
|
239 | + } |
|
240 | 240 | // we need cars |
241 | - \EE_Register_Addon::_setup_autoloaders($addon_name); |
|
242 | - // register new models and extensions |
|
243 | - \EE_Register_Addon::_register_models_and_extensions($addon_name); |
|
244 | - // setup DMS |
|
245 | - \EE_Register_Addon::_register_data_migration_scripts($addon_name); |
|
246 | - // if config_class is present let's register config. |
|
247 | - \EE_Register_Addon::_register_config($addon_name); |
|
248 | - // register admin pages |
|
249 | - \EE_Register_Addon::_register_admin_pages($addon_name); |
|
250 | - // add to list of modules to be registered |
|
251 | - \EE_Register_Addon::_register_modules($addon_name); |
|
252 | - // add to list of shortcodes to be registered |
|
253 | - \EE_Register_Addon::_register_shortcodes($addon_name); |
|
254 | - // add to list of widgets to be registered |
|
255 | - \EE_Register_Addon::_register_widgets($addon_name); |
|
256 | - // register capability related stuff. |
|
257 | - \EE_Register_Addon::_register_capabilities($addon_name); |
|
258 | - // any message type to register? |
|
259 | - \EE_Register_Addon::_register_message_types($addon_name); |
|
241 | + \EE_Register_Addon::_setup_autoloaders($addon_name); |
|
242 | + // register new models and extensions |
|
243 | + \EE_Register_Addon::_register_models_and_extensions($addon_name); |
|
244 | + // setup DMS |
|
245 | + \EE_Register_Addon::_register_data_migration_scripts($addon_name); |
|
246 | + // if config_class is present let's register config. |
|
247 | + \EE_Register_Addon::_register_config($addon_name); |
|
248 | + // register admin pages |
|
249 | + \EE_Register_Addon::_register_admin_pages($addon_name); |
|
250 | + // add to list of modules to be registered |
|
251 | + \EE_Register_Addon::_register_modules($addon_name); |
|
252 | + // add to list of shortcodes to be registered |
|
253 | + \EE_Register_Addon::_register_shortcodes($addon_name); |
|
254 | + // add to list of widgets to be registered |
|
255 | + \EE_Register_Addon::_register_widgets($addon_name); |
|
256 | + // register capability related stuff. |
|
257 | + \EE_Register_Addon::_register_capabilities($addon_name); |
|
258 | + // any message type to register? |
|
259 | + \EE_Register_Addon::_register_message_types($addon_name); |
|
260 | 260 | // any custom post type/ custom capabilities or default terms to register |
261 | - \EE_Register_Addon::_register_custom_post_types($addon_name); |
|
262 | - // and any payment methods |
|
263 | - \EE_Register_Addon::_register_payment_methods($addon_name); |
|
261 | + \EE_Register_Addon::_register_custom_post_types($addon_name); |
|
262 | + // and any payment methods |
|
263 | + \EE_Register_Addon::_register_payment_methods($addon_name); |
|
264 | 264 | // load and instantiate main addon class |
265 | 265 | \EE_Register_Addon::_load_and_init_addon_class($addon_name); |
266 | 266 | } |
267 | 267 | |
268 | 268 | |
269 | 269 | |
270 | - /** |
|
271 | - * @param string $addon_name |
|
272 | - * @param array $setup_args |
|
273 | - * @return void |
|
274 | - * @throws \EE_Error |
|
275 | - */ |
|
276 | - private static function _verify_parameters($addon_name, array $setup_args) |
|
277 | - { |
|
278 | - // required fields MUST be present, so let's make sure they are. |
|
279 | - if (empty($addon_name) || ! is_array($setup_args)) { |
|
280 | - throw new EE_Error( |
|
281 | - __( |
|
282 | - '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.', |
|
283 | - 'event_espresso' |
|
284 | - ) |
|
285 | - ); |
|
286 | - } |
|
287 | - if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
288 | - throw new EE_Error( |
|
289 | - sprintf( |
|
290 | - __( |
|
291 | - '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', |
|
292 | - 'event_espresso' |
|
293 | - ), |
|
294 | - implode(',', array_keys($setup_args)) |
|
295 | - ) |
|
296 | - ); |
|
297 | - } |
|
298 | - // check that addon has not already been registered with that name |
|
299 | - if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) { |
|
300 | - throw new EE_Error( |
|
301 | - sprintf( |
|
302 | - __( |
|
303 | - 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', |
|
304 | - 'event_espresso' |
|
305 | - ), |
|
306 | - $addon_name |
|
307 | - ) |
|
308 | - ); |
|
309 | - } |
|
270 | + /** |
|
271 | + * @param string $addon_name |
|
272 | + * @param array $setup_args |
|
273 | + * @return void |
|
274 | + * @throws \EE_Error |
|
275 | + */ |
|
276 | + private static function _verify_parameters($addon_name, array $setup_args) |
|
277 | + { |
|
278 | + // required fields MUST be present, so let's make sure they are. |
|
279 | + if (empty($addon_name) || ! is_array($setup_args)) { |
|
280 | + throw new EE_Error( |
|
281 | + __( |
|
282 | + '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.', |
|
283 | + 'event_espresso' |
|
284 | + ) |
|
285 | + ); |
|
286 | + } |
|
287 | + if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) { |
|
288 | + throw new EE_Error( |
|
289 | + sprintf( |
|
290 | + __( |
|
291 | + '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', |
|
292 | + 'event_espresso' |
|
293 | + ), |
|
294 | + implode(',', array_keys($setup_args)) |
|
295 | + ) |
|
296 | + ); |
|
297 | + } |
|
298 | + // check that addon has not already been registered with that name |
|
299 | + if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) { |
|
300 | + throw new EE_Error( |
|
301 | + sprintf( |
|
302 | + __( |
|
303 | + 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', |
|
304 | + 'event_espresso' |
|
305 | + ), |
|
306 | + $addon_name |
|
307 | + ) |
|
308 | + ); |
|
309 | + } |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
313 | 313 | |
314 | - /** |
|
315 | - * @param string $addon_name |
|
316 | - * @param array $setup_args |
|
317 | - * @return string |
|
318 | - */ |
|
319 | - private static function _parse_class_name($addon_name, array $setup_args) |
|
320 | - { |
|
321 | - if (empty($setup_args['class_name'])) { |
|
322 | - // generate one by first separating name with spaces |
|
323 | - $class_name = str_replace(array('-', '_'), ' ', trim($addon_name)); |
|
324 | - //capitalize, then replace spaces with underscores |
|
325 | - $class_name = str_replace(' ', '_', ucwords($class_name)); |
|
326 | - } else { |
|
327 | - $class_name = $setup_args['class_name']; |
|
328 | - } |
|
329 | - return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name; |
|
330 | - } |
|
331 | - |
|
332 | - |
|
333 | - |
|
334 | - /** |
|
335 | - * @param string $class_name |
|
336 | - * @param array $setup_args |
|
337 | - * @return array |
|
338 | - */ |
|
339 | - private static function _get_addon_settings($class_name, array $setup_args) |
|
340 | - { |
|
341 | - //setup $_settings array from incoming values. |
|
342 | - $addon_settings = array( |
|
343 | - // generated from the addon name, changes something like "calendar" to "EE_Calendar" |
|
344 | - 'class_name' => $class_name, |
|
345 | - // the addon slug for use in URLs, etc |
|
346 | - 'plugin_slug' => isset($setup_args['plugin_slug']) |
|
347 | - ? (string)$setup_args['plugin_slug'] |
|
348 | - : '', |
|
349 | - // page slug to be used when generating the "Settings" link on the WP plugin page |
|
350 | - 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
|
351 | - ? (string)$setup_args['plugin_action_slug'] |
|
352 | - : '', |
|
353 | - // the "software" version for the addon |
|
354 | - 'version' => isset($setup_args['version']) |
|
355 | - ? (string)$setup_args['version'] |
|
356 | - : '', |
|
357 | - // the minimum version of EE Core that the addon will work with |
|
358 | - 'min_core_version' => isset($setup_args['min_core_version']) |
|
359 | - ? (string)$setup_args['min_core_version'] |
|
360 | - : '', |
|
361 | - // the minimum version of WordPress that the addon will work with |
|
362 | - 'min_wp_version' => isset($setup_args['min_wp_version']) |
|
363 | - ? (string)$setup_args['min_wp_version'] |
|
364 | - : EE_MIN_WP_VER_REQUIRED, |
|
365 | - // full server path to main file (file loaded directly by WP) |
|
366 | - 'main_file_path' => isset($setup_args['main_file_path']) |
|
367 | - ? (string)$setup_args['main_file_path'] |
|
368 | - : '', |
|
369 | - // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
|
370 | - 'admin_path' => isset($setup_args['admin_path']) |
|
371 | - ? (string)$setup_args['admin_path'] : '', |
|
372 | - // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
|
373 | - 'admin_callback' => isset($setup_args['admin_callback']) |
|
374 | - ? (string)$setup_args['admin_callback'] |
|
375 | - : '', |
|
376 | - // the section name for this addon's configuration settings section (defaults to "addons") |
|
377 | - 'config_section' => isset($setup_args['config_section']) |
|
378 | - ? (string)$setup_args['config_section'] |
|
379 | - : 'addons', |
|
380 | - // the class name for this addon's configuration settings object |
|
381 | - 'config_class' => isset($setup_args['config_class']) |
|
382 | - ? (string)$setup_args['config_class'] : '', |
|
383 | - //the name given to the config for this addons' configuration settings object (optional) |
|
384 | - 'config_name' => isset($setup_args['config_name']) |
|
385 | - ? (string)$setup_args['config_name'] : '', |
|
386 | - // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
|
387 | - 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
|
388 | - ? (array)$setup_args['autoloader_paths'] |
|
389 | - : array(), |
|
390 | - // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
|
391 | - 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
|
392 | - ? (array)$setup_args['autoloader_folders'] |
|
393 | - : array(), |
|
394 | - // array of full server paths to any EE_DMS data migration scripts used by the addon |
|
395 | - 'dms_paths' => isset($setup_args['dms_paths']) |
|
396 | - ? (array)$setup_args['dms_paths'] |
|
397 | - : array(), |
|
398 | - // array of full server paths to any EED_Modules used by the addon |
|
399 | - 'module_paths' => isset($setup_args['module_paths']) |
|
400 | - ? (array)$setup_args['module_paths'] |
|
401 | - : array(), |
|
402 | - // array of full server paths to any EES_Shortcodes used by the addon |
|
403 | - 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
|
404 | - ? (array)$setup_args['shortcode_paths'] |
|
405 | - : array(), |
|
406 | - // array of full server paths to any WP_Widgets used by the addon |
|
407 | - 'widget_paths' => isset($setup_args['widget_paths']) |
|
408 | - ? (array)$setup_args['widget_paths'] |
|
409 | - : array(), |
|
410 | - // array of PUE options used by the addon |
|
411 | - 'pue_options' => isset($setup_args['pue_options']) |
|
412 | - ? (array)$setup_args['pue_options'] |
|
413 | - : array(), |
|
414 | - 'message_types' => isset($setup_args['message_types']) |
|
415 | - ? (array)$setup_args['message_types'] |
|
416 | - : array(), |
|
417 | - 'capabilities' => isset($setup_args['capabilities']) |
|
418 | - ? (array)$setup_args['capabilities'] |
|
419 | - : array(), |
|
420 | - 'capability_maps' => isset($setup_args['capability_maps']) |
|
421 | - ? (array)$setup_args['capability_maps'] |
|
422 | - : array(), |
|
423 | - 'model_paths' => isset($setup_args['model_paths']) |
|
424 | - ? (array)$setup_args['model_paths'] |
|
425 | - : array(), |
|
426 | - 'class_paths' => isset($setup_args['class_paths']) |
|
427 | - ? (array)$setup_args['class_paths'] |
|
428 | - : array(), |
|
429 | - 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
|
430 | - ? (array)$setup_args['model_extension_paths'] |
|
431 | - : array(), |
|
432 | - 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
|
433 | - ? (array)$setup_args['class_extension_paths'] |
|
434 | - : array(), |
|
435 | - 'custom_post_types' => isset($setup_args['custom_post_types']) |
|
436 | - ? (array)$setup_args['custom_post_types'] |
|
437 | - : array(), |
|
438 | - 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
|
439 | - ? (array)$setup_args['custom_taxonomies'] |
|
440 | - : array(), |
|
441 | - 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
|
442 | - ? (array)$setup_args['payment_method_paths'] |
|
443 | - : array(), |
|
444 | - 'default_terms' => isset($setup_args['default_terms']) |
|
445 | - ? (array)$setup_args['default_terms'] |
|
446 | - : array(), |
|
447 | - // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
|
448 | - // that can be used for adding upgrading/marketing info |
|
449 | - 'plugins_page_row' => isset($setup_args['plugins_page_row']) |
|
450 | - ? $setup_args['plugins_page_row'] |
|
451 | - : '', |
|
452 | - 'namespace' => isset( |
|
453 | - $setup_args['namespace'], |
|
454 | - $setup_args['namespace']['FQNS'], |
|
455 | - $setup_args['namespace']['DIR'] |
|
456 | - ) |
|
457 | - ? (array)$setup_args['namespace'] |
|
458 | - : array(), |
|
459 | - ); |
|
460 | - // if plugin_action_slug is NOT set, but an admin page path IS set, |
|
461 | - // then let's just use the plugin_slug since that will be used for linking to the admin page |
|
462 | - $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) |
|
463 | - && ! empty($addon_settings['admin_path']) |
|
464 | - ? $addon_settings['plugin_slug'] |
|
465 | - : $addon_settings['plugin_action_slug']; |
|
466 | - // full server path to main file (file loaded directly by WP) |
|
467 | - $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']); |
|
468 | - return $addon_settings; |
|
314 | + /** |
|
315 | + * @param string $addon_name |
|
316 | + * @param array $setup_args |
|
317 | + * @return string |
|
318 | + */ |
|
319 | + private static function _parse_class_name($addon_name, array $setup_args) |
|
320 | + { |
|
321 | + if (empty($setup_args['class_name'])) { |
|
322 | + // generate one by first separating name with spaces |
|
323 | + $class_name = str_replace(array('-', '_'), ' ', trim($addon_name)); |
|
324 | + //capitalize, then replace spaces with underscores |
|
325 | + $class_name = str_replace(' ', '_', ucwords($class_name)); |
|
326 | + } else { |
|
327 | + $class_name = $setup_args['class_name']; |
|
328 | + } |
|
329 | + return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name; |
|
469 | 330 | } |
470 | 331 | |
471 | 332 | |
472 | 333 | |
473 | - /** |
|
474 | - * @param string $addon_name |
|
475 | - * @param array $addon_settings |
|
476 | - * @return boolean |
|
477 | - */ |
|
334 | + /** |
|
335 | + * @param string $class_name |
|
336 | + * @param array $setup_args |
|
337 | + * @return array |
|
338 | + */ |
|
339 | + private static function _get_addon_settings($class_name, array $setup_args) |
|
340 | + { |
|
341 | + //setup $_settings array from incoming values. |
|
342 | + $addon_settings = array( |
|
343 | + // generated from the addon name, changes something like "calendar" to "EE_Calendar" |
|
344 | + 'class_name' => $class_name, |
|
345 | + // the addon slug for use in URLs, etc |
|
346 | + 'plugin_slug' => isset($setup_args['plugin_slug']) |
|
347 | + ? (string)$setup_args['plugin_slug'] |
|
348 | + : '', |
|
349 | + // page slug to be used when generating the "Settings" link on the WP plugin page |
|
350 | + 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
|
351 | + ? (string)$setup_args['plugin_action_slug'] |
|
352 | + : '', |
|
353 | + // the "software" version for the addon |
|
354 | + 'version' => isset($setup_args['version']) |
|
355 | + ? (string)$setup_args['version'] |
|
356 | + : '', |
|
357 | + // the minimum version of EE Core that the addon will work with |
|
358 | + 'min_core_version' => isset($setup_args['min_core_version']) |
|
359 | + ? (string)$setup_args['min_core_version'] |
|
360 | + : '', |
|
361 | + // the minimum version of WordPress that the addon will work with |
|
362 | + 'min_wp_version' => isset($setup_args['min_wp_version']) |
|
363 | + ? (string)$setup_args['min_wp_version'] |
|
364 | + : EE_MIN_WP_VER_REQUIRED, |
|
365 | + // full server path to main file (file loaded directly by WP) |
|
366 | + 'main_file_path' => isset($setup_args['main_file_path']) |
|
367 | + ? (string)$setup_args['main_file_path'] |
|
368 | + : '', |
|
369 | + // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
|
370 | + 'admin_path' => isset($setup_args['admin_path']) |
|
371 | + ? (string)$setup_args['admin_path'] : '', |
|
372 | + // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
|
373 | + 'admin_callback' => isset($setup_args['admin_callback']) |
|
374 | + ? (string)$setup_args['admin_callback'] |
|
375 | + : '', |
|
376 | + // the section name for this addon's configuration settings section (defaults to "addons") |
|
377 | + 'config_section' => isset($setup_args['config_section']) |
|
378 | + ? (string)$setup_args['config_section'] |
|
379 | + : 'addons', |
|
380 | + // the class name for this addon's configuration settings object |
|
381 | + 'config_class' => isset($setup_args['config_class']) |
|
382 | + ? (string)$setup_args['config_class'] : '', |
|
383 | + //the name given to the config for this addons' configuration settings object (optional) |
|
384 | + 'config_name' => isset($setup_args['config_name']) |
|
385 | + ? (string)$setup_args['config_name'] : '', |
|
386 | + // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
|
387 | + 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
|
388 | + ? (array)$setup_args['autoloader_paths'] |
|
389 | + : array(), |
|
390 | + // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
|
391 | + 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
|
392 | + ? (array)$setup_args['autoloader_folders'] |
|
393 | + : array(), |
|
394 | + // array of full server paths to any EE_DMS data migration scripts used by the addon |
|
395 | + 'dms_paths' => isset($setup_args['dms_paths']) |
|
396 | + ? (array)$setup_args['dms_paths'] |
|
397 | + : array(), |
|
398 | + // array of full server paths to any EED_Modules used by the addon |
|
399 | + 'module_paths' => isset($setup_args['module_paths']) |
|
400 | + ? (array)$setup_args['module_paths'] |
|
401 | + : array(), |
|
402 | + // array of full server paths to any EES_Shortcodes used by the addon |
|
403 | + 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
|
404 | + ? (array)$setup_args['shortcode_paths'] |
|
405 | + : array(), |
|
406 | + // array of full server paths to any WP_Widgets used by the addon |
|
407 | + 'widget_paths' => isset($setup_args['widget_paths']) |
|
408 | + ? (array)$setup_args['widget_paths'] |
|
409 | + : array(), |
|
410 | + // array of PUE options used by the addon |
|
411 | + 'pue_options' => isset($setup_args['pue_options']) |
|
412 | + ? (array)$setup_args['pue_options'] |
|
413 | + : array(), |
|
414 | + 'message_types' => isset($setup_args['message_types']) |
|
415 | + ? (array)$setup_args['message_types'] |
|
416 | + : array(), |
|
417 | + 'capabilities' => isset($setup_args['capabilities']) |
|
418 | + ? (array)$setup_args['capabilities'] |
|
419 | + : array(), |
|
420 | + 'capability_maps' => isset($setup_args['capability_maps']) |
|
421 | + ? (array)$setup_args['capability_maps'] |
|
422 | + : array(), |
|
423 | + 'model_paths' => isset($setup_args['model_paths']) |
|
424 | + ? (array)$setup_args['model_paths'] |
|
425 | + : array(), |
|
426 | + 'class_paths' => isset($setup_args['class_paths']) |
|
427 | + ? (array)$setup_args['class_paths'] |
|
428 | + : array(), |
|
429 | + 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
|
430 | + ? (array)$setup_args['model_extension_paths'] |
|
431 | + : array(), |
|
432 | + 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
|
433 | + ? (array)$setup_args['class_extension_paths'] |
|
434 | + : array(), |
|
435 | + 'custom_post_types' => isset($setup_args['custom_post_types']) |
|
436 | + ? (array)$setup_args['custom_post_types'] |
|
437 | + : array(), |
|
438 | + 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
|
439 | + ? (array)$setup_args['custom_taxonomies'] |
|
440 | + : array(), |
|
441 | + 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
|
442 | + ? (array)$setup_args['payment_method_paths'] |
|
443 | + : array(), |
|
444 | + 'default_terms' => isset($setup_args['default_terms']) |
|
445 | + ? (array)$setup_args['default_terms'] |
|
446 | + : array(), |
|
447 | + // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
|
448 | + // that can be used for adding upgrading/marketing info |
|
449 | + 'plugins_page_row' => isset($setup_args['plugins_page_row']) |
|
450 | + ? $setup_args['plugins_page_row'] |
|
451 | + : '', |
|
452 | + 'namespace' => isset( |
|
453 | + $setup_args['namespace'], |
|
454 | + $setup_args['namespace']['FQNS'], |
|
455 | + $setup_args['namespace']['DIR'] |
|
456 | + ) |
|
457 | + ? (array)$setup_args['namespace'] |
|
458 | + : array(), |
|
459 | + ); |
|
460 | + // if plugin_action_slug is NOT set, but an admin page path IS set, |
|
461 | + // then let's just use the plugin_slug since that will be used for linking to the admin page |
|
462 | + $addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) |
|
463 | + && ! empty($addon_settings['admin_path']) |
|
464 | + ? $addon_settings['plugin_slug'] |
|
465 | + : $addon_settings['plugin_action_slug']; |
|
466 | + // full server path to main file (file loaded directly by WP) |
|
467 | + $addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']); |
|
468 | + return $addon_settings; |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + |
|
473 | + /** |
|
474 | + * @param string $addon_name |
|
475 | + * @param array $addon_settings |
|
476 | + * @return boolean |
|
477 | + */ |
|
478 | 478 | private static function _addon_is_compatible( $addon_name, array $addon_settings ) { |
479 | - global $wp_version; |
|
480 | - $incompatibility_message = ''; |
|
481 | - //check whether this addon version is compatible with EE core |
|
482 | - if ( |
|
483 | - isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) |
|
484 | - && ! self::_meets_min_core_version_requirement( |
|
485 | - EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
486 | - $addon_settings['version'] |
|
487 | - ) |
|
488 | - ) { |
|
489 | - $incompatibility_message = sprintf( |
|
490 | - __( |
|
491 | - '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon.', |
|
492 | - 'event_espresso' |
|
493 | - ), |
|
494 | - $addon_name, |
|
495 | - '<br />', |
|
496 | - EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
497 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
498 | - '</span><br />' |
|
499 | - ); |
|
500 | - } else if ( |
|
501 | - ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
502 | - ) { |
|
503 | - $incompatibility_message = sprintf( |
|
504 | - __( |
|
505 | - '%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".', |
|
506 | - 'event_espresso' |
|
507 | - ), |
|
508 | - $addon_name, |
|
509 | - self::_effective_version($addon_settings['min_core_version']), |
|
510 | - self::_effective_version(espresso_version()), |
|
511 | - '<br />', |
|
512 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
513 | - '</span><br />' |
|
514 | - ); |
|
515 | - } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) { |
|
516 | - $incompatibility_message = sprintf( |
|
517 | - __( |
|
518 | - '%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.', |
|
519 | - 'event_espresso' |
|
520 | - ), |
|
521 | - $addon_name, |
|
522 | - $addon_settings['min_wp_version'], |
|
523 | - '<br />', |
|
524 | - '<span style="font-weight: bold; color: #D54E21;">', |
|
525 | - '</span><br />' |
|
526 | - ); |
|
527 | - } |
|
528 | - if ( ! empty($incompatibility_message)) { |
|
529 | - // remove 'activate' from the REQUEST |
|
530 | - // so WP doesn't erroneously tell the user the plugin activated fine when it didn't |
|
531 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
532 | - if (current_user_can('activate_plugins')) { |
|
533 | - // show an error message indicating the plugin didn't activate properly |
|
534 | - EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__); |
|
535 | - } |
|
536 | - // BAIL FROM THE ADDON REGISTRATION PROCESS |
|
537 | - return false; |
|
538 | - } |
|
539 | - // addon IS compatible |
|
540 | - return true; |
|
479 | + global $wp_version; |
|
480 | + $incompatibility_message = ''; |
|
481 | + //check whether this addon version is compatible with EE core |
|
482 | + if ( |
|
483 | + isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) |
|
484 | + && ! self::_meets_min_core_version_requirement( |
|
485 | + EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
486 | + $addon_settings['version'] |
|
487 | + ) |
|
488 | + ) { |
|
489 | + $incompatibility_message = sprintf( |
|
490 | + __( |
|
491 | + '%4$sIMPORTANT!%5$sThe Event Espresso "%1$s" addon is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon.', |
|
492 | + 'event_espresso' |
|
493 | + ), |
|
494 | + $addon_name, |
|
495 | + '<br />', |
|
496 | + EE_Register_Addon::$_incompatible_addons[$addon_name], |
|
497 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
498 | + '</span><br />' |
|
499 | + ); |
|
500 | + } else if ( |
|
501 | + ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version()) |
|
502 | + ) { |
|
503 | + $incompatibility_message = sprintf( |
|
504 | + __( |
|
505 | + '%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".', |
|
506 | + 'event_espresso' |
|
507 | + ), |
|
508 | + $addon_name, |
|
509 | + self::_effective_version($addon_settings['min_core_version']), |
|
510 | + self::_effective_version(espresso_version()), |
|
511 | + '<br />', |
|
512 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
513 | + '</span><br />' |
|
514 | + ); |
|
515 | + } else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) { |
|
516 | + $incompatibility_message = sprintf( |
|
517 | + __( |
|
518 | + '%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.', |
|
519 | + 'event_espresso' |
|
520 | + ), |
|
521 | + $addon_name, |
|
522 | + $addon_settings['min_wp_version'], |
|
523 | + '<br />', |
|
524 | + '<span style="font-weight: bold; color: #D54E21;">', |
|
525 | + '</span><br />' |
|
526 | + ); |
|
527 | + } |
|
528 | + if ( ! empty($incompatibility_message)) { |
|
529 | + // remove 'activate' from the REQUEST |
|
530 | + // so WP doesn't erroneously tell the user the plugin activated fine when it didn't |
|
531 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
532 | + if (current_user_can('activate_plugins')) { |
|
533 | + // show an error message indicating the plugin didn't activate properly |
|
534 | + EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__); |
|
535 | + } |
|
536 | + // BAIL FROM THE ADDON REGISTRATION PROCESS |
|
537 | + return false; |
|
538 | + } |
|
539 | + // addon IS compatible |
|
540 | + return true; |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | |
544 | 544 | |
545 | - /** |
|
546 | - * if plugin update engine is being used for auto-updates, |
|
547 | - * then let's set that up now before going any further so that ALL addons can be updated |
|
548 | - * (not needed if PUE is not being used) |
|
549 | - * |
|
550 | - * @param string $addon_name |
|
551 | - * @param string $class_name |
|
552 | - * @param array $setup_args |
|
553 | - * @return void |
|
554 | - */ |
|
545 | + /** |
|
546 | + * if plugin update engine is being used for auto-updates, |
|
547 | + * then let's set that up now before going any further so that ALL addons can be updated |
|
548 | + * (not needed if PUE is not being used) |
|
549 | + * |
|
550 | + * @param string $addon_name |
|
551 | + * @param string $class_name |
|
552 | + * @param array $setup_args |
|
553 | + * @return void |
|
554 | + */ |
|
555 | 555 | private static function _parse_pue_options( $addon_name, $class_name, array $setup_args ) { |
556 | - // |
|
557 | - if ( ! empty($setup_args['pue_options'])) { |
|
558 | - self::$_settings[$addon_name]['pue_options'] = array( |
|
559 | - 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
|
560 | - ? (string)$setup_args['pue_options']['pue_plugin_slug'] |
|
561 | - : 'espresso_' . strtolower($class_name), |
|
562 | - 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
|
563 | - ? (string)$setup_args['pue_options']['plugin_basename'] |
|
564 | - : plugin_basename(self::$_settings[$addon_name]['main_file_path']), |
|
565 | - 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
|
566 | - ? (string)$setup_args['pue_options']['checkPeriod'] |
|
567 | - : '24', |
|
568 | - 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
|
569 | - ? (string)$setup_args['pue_options']['use_wp_update'] |
|
570 | - : false, |
|
571 | - ); |
|
572 | - add_action( |
|
573 | - 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
574 | - array('EE_Register_Addon', 'load_pue_update') |
|
575 | - ); |
|
576 | - } |
|
556 | + // |
|
557 | + if ( ! empty($setup_args['pue_options'])) { |
|
558 | + self::$_settings[$addon_name]['pue_options'] = array( |
|
559 | + 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
|
560 | + ? (string)$setup_args['pue_options']['pue_plugin_slug'] |
|
561 | + : 'espresso_' . strtolower($class_name), |
|
562 | + 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
|
563 | + ? (string)$setup_args['pue_options']['plugin_basename'] |
|
564 | + : plugin_basename(self::$_settings[$addon_name]['main_file_path']), |
|
565 | + 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
|
566 | + ? (string)$setup_args['pue_options']['checkPeriod'] |
|
567 | + : '24', |
|
568 | + 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
|
569 | + ? (string)$setup_args['pue_options']['use_wp_update'] |
|
570 | + : false, |
|
571 | + ); |
|
572 | + add_action( |
|
573 | + 'AHEE__EE_System__brew_espresso__after_pue_init', |
|
574 | + array('EE_Register_Addon', 'load_pue_update') |
|
575 | + ); |
|
576 | + } |
|
577 | + } |
|
578 | + |
|
579 | + |
|
580 | + |
|
581 | + /** |
|
582 | + * register namespaces right away before any other files or classes get loaded, but AFTER the version checks |
|
583 | + * |
|
584 | + * @param array $addon_settings |
|
585 | + * @return void |
|
586 | + */ |
|
587 | + private static function _setup_namespaces(array $addon_settings) |
|
588 | + { |
|
589 | + // |
|
590 | + if ( |
|
591 | + isset( |
|
592 | + $addon_settings['namespace'], |
|
593 | + $addon_settings['namespace']['FQNS'], |
|
594 | + $addon_settings['namespace']['DIR'] |
|
595 | + ) |
|
596 | + ) { |
|
597 | + EE_Psr4AutoloaderInit::psr4_loader()->addNamespace( |
|
598 | + $addon_settings['namespace']['FQNS'], |
|
599 | + $addon_settings['namespace']['DIR'] |
|
600 | + ); |
|
601 | + } |
|
577 | 602 | } |
578 | 603 | |
579 | 604 | |
580 | 605 | |
581 | - /** |
|
582 | - * register namespaces right away before any other files or classes get loaded, but AFTER the version checks |
|
583 | - * |
|
584 | - * @param array $addon_settings |
|
585 | - * @return void |
|
586 | - */ |
|
587 | - private static function _setup_namespaces(array $addon_settings) |
|
588 | - { |
|
589 | - // |
|
590 | - if ( |
|
591 | - isset( |
|
592 | - $addon_settings['namespace'], |
|
593 | - $addon_settings['namespace']['FQNS'], |
|
594 | - $addon_settings['namespace']['DIR'] |
|
595 | - ) |
|
596 | - ) { |
|
597 | - EE_Psr4AutoloaderInit::psr4_loader()->addNamespace( |
|
598 | - $addon_settings['namespace']['FQNS'], |
|
599 | - $addon_settings['namespace']['DIR'] |
|
600 | - ); |
|
601 | - } |
|
602 | - } |
|
603 | - |
|
604 | - |
|
605 | - |
|
606 | - /** |
|
607 | - * @param string $addon_name |
|
608 | - * @param array $addon_settings |
|
609 | - * @return bool |
|
610 | - */ |
|
606 | + /** |
|
607 | + * @param string $addon_name |
|
608 | + * @param array $addon_settings |
|
609 | + * @return bool |
|
610 | + */ |
|
611 | 611 | private static function _addon_activation( $addon_name, array $addon_settings ) { |
612 | - // this is an activation request |
|
613 | - if (did_action('activate_plugin')) { |
|
614 | - //to find if THIS is the addon that was activated, |
|
615 | - //just check if we have already registered it or not |
|
616 | - //(as the newly-activated addon wasn't around the first time addons were registered) |
|
617 | - if ( ! isset(self::$_settings[$addon_name])) { |
|
618 | - self::$_settings[$addon_name] = $addon_settings; |
|
619 | - $addon = self::_load_and_init_addon_class($addon_name); |
|
620 | - $addon->set_activation_indicator_option(); |
|
621 | - // dont bother setting up the rest of the addon. |
|
622 | - // we know it was just activated and the request will end soon |
|
623 | - } |
|
624 | - return true; |
|
625 | - } else { |
|
626 | - // make sure this was called in the right place! |
|
627 | - if ( |
|
628 | - ! did_action('AHEE__EE_System__load_espresso_addons') |
|
629 | - || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
|
630 | - ) { |
|
631 | - EE_Error::doing_it_wrong( |
|
632 | - __METHOD__, |
|
633 | - sprintf( |
|
634 | - __( |
|
635 | - '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.', |
|
636 | - 'event_espresso' |
|
637 | - ), |
|
638 | - $addon_name |
|
639 | - ), |
|
640 | - '4.3.0' |
|
641 | - ); |
|
642 | - } |
|
643 | - self::$_settings[$addon_name] = $addon_settings; |
|
644 | - } |
|
645 | - return false; |
|
646 | - } |
|
647 | - |
|
648 | - |
|
649 | - |
|
650 | - /** |
|
651 | - * @param string $addon_name |
|
652 | - * @return void |
|
653 | - * @throws \EE_Error |
|
654 | - */ |
|
655 | - private static function _setup_autoloaders($addon_name) |
|
656 | - { |
|
657 | - if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) { |
|
658 | - // setup autoloader for single file |
|
659 | - EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']); |
|
660 | - } |
|
661 | - // setup autoloaders for folders |
|
662 | - if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) { |
|
663 | - foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
664 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
|
665 | - } |
|
666 | - } |
|
667 | - } |
|
668 | - |
|
669 | - |
|
670 | - |
|
671 | - /** |
|
672 | - * register new models and extensions |
|
673 | - * |
|
674 | - * @param string $addon_name |
|
675 | - * @return void |
|
676 | - * @throws \EE_Error |
|
677 | - */ |
|
612 | + // this is an activation request |
|
613 | + if (did_action('activate_plugin')) { |
|
614 | + //to find if THIS is the addon that was activated, |
|
615 | + //just check if we have already registered it or not |
|
616 | + //(as the newly-activated addon wasn't around the first time addons were registered) |
|
617 | + if ( ! isset(self::$_settings[$addon_name])) { |
|
618 | + self::$_settings[$addon_name] = $addon_settings; |
|
619 | + $addon = self::_load_and_init_addon_class($addon_name); |
|
620 | + $addon->set_activation_indicator_option(); |
|
621 | + // dont bother setting up the rest of the addon. |
|
622 | + // we know it was just activated and the request will end soon |
|
623 | + } |
|
624 | + return true; |
|
625 | + } else { |
|
626 | + // make sure this was called in the right place! |
|
627 | + if ( |
|
628 | + ! did_action('AHEE__EE_System__load_espresso_addons') |
|
629 | + || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin') |
|
630 | + ) { |
|
631 | + EE_Error::doing_it_wrong( |
|
632 | + __METHOD__, |
|
633 | + sprintf( |
|
634 | + __( |
|
635 | + '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.', |
|
636 | + 'event_espresso' |
|
637 | + ), |
|
638 | + $addon_name |
|
639 | + ), |
|
640 | + '4.3.0' |
|
641 | + ); |
|
642 | + } |
|
643 | + self::$_settings[$addon_name] = $addon_settings; |
|
644 | + } |
|
645 | + return false; |
|
646 | + } |
|
647 | + |
|
648 | + |
|
649 | + |
|
650 | + /** |
|
651 | + * @param string $addon_name |
|
652 | + * @return void |
|
653 | + * @throws \EE_Error |
|
654 | + */ |
|
655 | + private static function _setup_autoloaders($addon_name) |
|
656 | + { |
|
657 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) { |
|
658 | + // setup autoloader for single file |
|
659 | + EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']); |
|
660 | + } |
|
661 | + // setup autoloaders for folders |
|
662 | + if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) { |
|
663 | + foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
664 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
|
665 | + } |
|
666 | + } |
|
667 | + } |
|
668 | + |
|
669 | + |
|
670 | + |
|
671 | + /** |
|
672 | + * register new models and extensions |
|
673 | + * |
|
674 | + * @param string $addon_name |
|
675 | + * @return void |
|
676 | + * @throws \EE_Error |
|
677 | + */ |
|
678 | 678 | private static function _register_models_and_extensions( $addon_name ) { |
679 | - // register new models |
|
680 | - if ( |
|
681 | - ! empty(self::$_settings[$addon_name]['model_paths']) |
|
682 | - || ! empty(self::$_settings[$addon_name]['class_paths']) |
|
683 | - ) { |
|
684 | - EE_Register_Model::register( |
|
685 | - $addon_name, |
|
686 | - array( |
|
687 | - 'model_paths' => self::$_settings[$addon_name]['model_paths'], |
|
688 | - 'class_paths' => self::$_settings[$addon_name]['class_paths'], |
|
689 | - ) |
|
690 | - ); |
|
691 | - } |
|
692 | - // register model extensions |
|
693 | - if ( |
|
694 | - ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
695 | - || ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
696 | - ) { |
|
697 | - EE_Register_Model_Extensions::register( |
|
698 | - $addon_name, |
|
699 | - array( |
|
700 | - 'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], |
|
701 | - 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'], |
|
702 | - ) |
|
703 | - ); |
|
704 | - } |
|
705 | - } |
|
706 | - |
|
707 | - |
|
708 | - |
|
709 | - /** |
|
710 | - * @param string $addon_name |
|
711 | - * @return void |
|
712 | - * @throws \EE_Error |
|
713 | - */ |
|
679 | + // register new models |
|
680 | + if ( |
|
681 | + ! empty(self::$_settings[$addon_name]['model_paths']) |
|
682 | + || ! empty(self::$_settings[$addon_name]['class_paths']) |
|
683 | + ) { |
|
684 | + EE_Register_Model::register( |
|
685 | + $addon_name, |
|
686 | + array( |
|
687 | + 'model_paths' => self::$_settings[$addon_name]['model_paths'], |
|
688 | + 'class_paths' => self::$_settings[$addon_name]['class_paths'], |
|
689 | + ) |
|
690 | + ); |
|
691 | + } |
|
692 | + // register model extensions |
|
693 | + if ( |
|
694 | + ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
695 | + || ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
696 | + ) { |
|
697 | + EE_Register_Model_Extensions::register( |
|
698 | + $addon_name, |
|
699 | + array( |
|
700 | + 'model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], |
|
701 | + 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths'], |
|
702 | + ) |
|
703 | + ); |
|
704 | + } |
|
705 | + } |
|
706 | + |
|
707 | + |
|
708 | + |
|
709 | + /** |
|
710 | + * @param string $addon_name |
|
711 | + * @return void |
|
712 | + * @throws \EE_Error |
|
713 | + */ |
|
714 | 714 | private static function _register_data_migration_scripts( $addon_name ) { |
715 | - // setup DMS |
|
716 | - if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
717 | - EE_Register_Data_Migration_Scripts::register( |
|
718 | - $addon_name, |
|
719 | - array('dms_paths' => self::$_settings[$addon_name]['dms_paths']) |
|
720 | - ); |
|
721 | - } |
|
722 | - } |
|
723 | - |
|
724 | - |
|
725 | - /** |
|
726 | - * @param string $addon_name |
|
727 | - * @return void |
|
728 | - * @throws \EE_Error |
|
729 | - */ |
|
715 | + // setup DMS |
|
716 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
717 | + EE_Register_Data_Migration_Scripts::register( |
|
718 | + $addon_name, |
|
719 | + array('dms_paths' => self::$_settings[$addon_name]['dms_paths']) |
|
720 | + ); |
|
721 | + } |
|
722 | + } |
|
723 | + |
|
724 | + |
|
725 | + /** |
|
726 | + * @param string $addon_name |
|
727 | + * @return void |
|
728 | + * @throws \EE_Error |
|
729 | + */ |
|
730 | 730 | private static function _register_config( $addon_name ) { |
731 | - // if config_class is present let's register config. |
|
732 | - if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
733 | - EE_Register_Config::register( |
|
734 | - self::$_settings[$addon_name]['config_class'], |
|
735 | - array( |
|
736 | - 'config_section' => self::$_settings[$addon_name]['config_section'], |
|
737 | - 'config_name' => self::$_settings[$addon_name]['config_name'], |
|
738 | - ) |
|
739 | - ); |
|
740 | - } |
|
741 | - } |
|
742 | - |
|
743 | - |
|
744 | - /** |
|
745 | - * @param string $addon_name |
|
746 | - * @return void |
|
747 | - * @throws \EE_Error |
|
748 | - */ |
|
731 | + // if config_class is present let's register config. |
|
732 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
733 | + EE_Register_Config::register( |
|
734 | + self::$_settings[$addon_name]['config_class'], |
|
735 | + array( |
|
736 | + 'config_section' => self::$_settings[$addon_name]['config_section'], |
|
737 | + 'config_name' => self::$_settings[$addon_name]['config_name'], |
|
738 | + ) |
|
739 | + ); |
|
740 | + } |
|
741 | + } |
|
742 | + |
|
743 | + |
|
744 | + /** |
|
745 | + * @param string $addon_name |
|
746 | + * @return void |
|
747 | + * @throws \EE_Error |
|
748 | + */ |
|
749 | 749 | private static function _register_admin_pages( $addon_name ) { |
750 | - if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
751 | - EE_Register_Admin_Page::register( |
|
752 | - $addon_name, |
|
753 | - array('page_path' => self::$_settings[$addon_name]['admin_path']) |
|
754 | - ); |
|
755 | - } |
|
756 | - } |
|
757 | - |
|
758 | - |
|
759 | - /** |
|
760 | - * @param string $addon_name |
|
761 | - * @return void |
|
762 | - * @throws \EE_Error |
|
763 | - */ |
|
750 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
751 | + EE_Register_Admin_Page::register( |
|
752 | + $addon_name, |
|
753 | + array('page_path' => self::$_settings[$addon_name]['admin_path']) |
|
754 | + ); |
|
755 | + } |
|
756 | + } |
|
757 | + |
|
758 | + |
|
759 | + /** |
|
760 | + * @param string $addon_name |
|
761 | + * @return void |
|
762 | + * @throws \EE_Error |
|
763 | + */ |
|
764 | 764 | private static function _register_modules( $addon_name ) { |
765 | - if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
766 | - EE_Register_Module::register( |
|
767 | - $addon_name, |
|
768 | - array('module_paths' => self::$_settings[$addon_name]['module_paths']) |
|
769 | - ); |
|
770 | - } |
|
771 | - } |
|
772 | - |
|
773 | - |
|
774 | - /** |
|
775 | - * @param string $addon_name |
|
776 | - * @return void |
|
777 | - * @throws \EE_Error |
|
778 | - */ |
|
765 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
766 | + EE_Register_Module::register( |
|
767 | + $addon_name, |
|
768 | + array('module_paths' => self::$_settings[$addon_name]['module_paths']) |
|
769 | + ); |
|
770 | + } |
|
771 | + } |
|
772 | + |
|
773 | + |
|
774 | + /** |
|
775 | + * @param string $addon_name |
|
776 | + * @return void |
|
777 | + * @throws \EE_Error |
|
778 | + */ |
|
779 | 779 | private static function _register_shortcodes( $addon_name ) { |
780 | - if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
|
781 | - EE_Register_Shortcode::register( |
|
782 | - $addon_name, |
|
783 | - array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']) |
|
784 | - ); |
|
785 | - } |
|
786 | - } |
|
787 | - |
|
788 | - |
|
789 | - /** |
|
790 | - * @param string $addon_name |
|
791 | - * @return void |
|
792 | - * @throws \EE_Error |
|
793 | - */ |
|
780 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
|
781 | + EE_Register_Shortcode::register( |
|
782 | + $addon_name, |
|
783 | + array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']) |
|
784 | + ); |
|
785 | + } |
|
786 | + } |
|
787 | + |
|
788 | + |
|
789 | + /** |
|
790 | + * @param string $addon_name |
|
791 | + * @return void |
|
792 | + * @throws \EE_Error |
|
793 | + */ |
|
794 | 794 | private static function _register_widgets( $addon_name ) { |
795 | - if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
796 | - EE_Register_Widget::register( |
|
797 | - $addon_name, |
|
798 | - array('widget_paths' => self::$_settings[$addon_name]['widget_paths']) |
|
799 | - ); |
|
800 | - } |
|
801 | - } |
|
802 | - |
|
803 | - |
|
804 | - /** |
|
805 | - * @param string $addon_name |
|
806 | - * @return void |
|
807 | - * @throws \EE_Error |
|
808 | - */ |
|
795 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
796 | + EE_Register_Widget::register( |
|
797 | + $addon_name, |
|
798 | + array('widget_paths' => self::$_settings[$addon_name]['widget_paths']) |
|
799 | + ); |
|
800 | + } |
|
801 | + } |
|
802 | + |
|
803 | + |
|
804 | + /** |
|
805 | + * @param string $addon_name |
|
806 | + * @return void |
|
807 | + * @throws \EE_Error |
|
808 | + */ |
|
809 | 809 | private static function _register_capabilities( $addon_name ) { |
810 | - if ( ! empty(self::$_settings[$addon_name]['capabilities'])) { |
|
811 | - EE_Register_Capabilities::register( |
|
812 | - $addon_name, |
|
813 | - array( |
|
814 | - 'capabilities' => self::$_settings[$addon_name]['capabilities'], |
|
815 | - 'capability_maps' => self::$_settings[$addon_name]['capability_maps'], |
|
816 | - ) |
|
817 | - ); |
|
818 | - } |
|
819 | - } |
|
820 | - |
|
821 | - |
|
822 | - /** |
|
823 | - * @param string $addon_name |
|
824 | - * @return void |
|
825 | - * @throws \EE_Error |
|
826 | - */ |
|
810 | + if ( ! empty(self::$_settings[$addon_name]['capabilities'])) { |
|
811 | + EE_Register_Capabilities::register( |
|
812 | + $addon_name, |
|
813 | + array( |
|
814 | + 'capabilities' => self::$_settings[$addon_name]['capabilities'], |
|
815 | + 'capability_maps' => self::$_settings[$addon_name]['capability_maps'], |
|
816 | + ) |
|
817 | + ); |
|
818 | + } |
|
819 | + } |
|
820 | + |
|
821 | + |
|
822 | + /** |
|
823 | + * @param string $addon_name |
|
824 | + * @return void |
|
825 | + * @throws \EE_Error |
|
826 | + */ |
|
827 | 827 | private static function _register_message_types( $addon_name ) { |
828 | - if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
829 | - add_action( |
|
830 | - 'EE_Brewing_Regular___messages_caf', |
|
831 | - array('EE_Register_Addon', 'register_message_types') |
|
832 | - ); |
|
833 | - } |
|
834 | - } |
|
835 | - |
|
836 | - |
|
837 | - /** |
|
838 | - * @param string $addon_name |
|
839 | - * @return void |
|
840 | - * @throws \EE_Error |
|
841 | - */ |
|
828 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
829 | + add_action( |
|
830 | + 'EE_Brewing_Regular___messages_caf', |
|
831 | + array('EE_Register_Addon', 'register_message_types') |
|
832 | + ); |
|
833 | + } |
|
834 | + } |
|
835 | + |
|
836 | + |
|
837 | + /** |
|
838 | + * @param string $addon_name |
|
839 | + * @return void |
|
840 | + * @throws \EE_Error |
|
841 | + */ |
|
842 | 842 | private static function _register_custom_post_types( $addon_name ) { |
843 | - if ( |
|
844 | - ! empty(self::$_settings[$addon_name]['custom_post_types']) |
|
845 | - || ! empty(self::$_settings[$addon_name]['custom_taxonomies']) |
|
846 | - ) { |
|
847 | - EE_Register_CPT::register( |
|
848 | - $addon_name, |
|
849 | - array( |
|
850 | - 'cpts' => self::$_settings[$addon_name]['custom_post_types'], |
|
851 | - 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], |
|
852 | - 'default_terms' => self::$_settings[$addon_name]['default_terms'], |
|
853 | - ) |
|
854 | - ); |
|
855 | - } |
|
856 | - } |
|
857 | - |
|
858 | - |
|
859 | - /** |
|
860 | - * @param string $addon_name |
|
861 | - * @return void |
|
862 | - * @throws \EE_Error |
|
863 | - */ |
|
843 | + if ( |
|
844 | + ! empty(self::$_settings[$addon_name]['custom_post_types']) |
|
845 | + || ! empty(self::$_settings[$addon_name]['custom_taxonomies']) |
|
846 | + ) { |
|
847 | + EE_Register_CPT::register( |
|
848 | + $addon_name, |
|
849 | + array( |
|
850 | + 'cpts' => self::$_settings[$addon_name]['custom_post_types'], |
|
851 | + 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], |
|
852 | + 'default_terms' => self::$_settings[$addon_name]['default_terms'], |
|
853 | + ) |
|
854 | + ); |
|
855 | + } |
|
856 | + } |
|
857 | + |
|
858 | + |
|
859 | + /** |
|
860 | + * @param string $addon_name |
|
861 | + * @return void |
|
862 | + * @throws \EE_Error |
|
863 | + */ |
|
864 | 864 | private static function _register_payment_methods( $addon_name ) { |
865 | - if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
|
866 | - EE_Register_Payment_Method::register( |
|
867 | - $addon_name, |
|
868 | - array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']) |
|
869 | - ); |
|
870 | - } |
|
871 | - } |
|
865 | + if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
|
866 | + EE_Register_Payment_Method::register( |
|
867 | + $addon_name, |
|
868 | + array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']) |
|
869 | + ); |
|
870 | + } |
|
871 | + } |
|
872 | 872 | |
873 | 873 | |
874 | 874 | |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | //unfortunately this can't be hooked in upon construction, because we don't have |
898 | 898 | //the plugin mainfile's path upon construction. |
899 | 899 | register_deactivation_hook( $addon->get_main_plugin_file(), array( $addon, 'deactivation' ) ); |
900 | - // call any additional admin_callback functions during load_admin_controller hook |
|
901 | - if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) { |
|
902 | - add_action( |
|
903 | - 'AHEE__EE_System__load_controllers__load_admin_controllers', |
|
904 | - array($addon, self::$_settings[$addon_name]['admin_callback']) |
|
905 | - ); |
|
906 | - } |
|
907 | - return $addon; |
|
900 | + // call any additional admin_callback functions during load_admin_controller hook |
|
901 | + if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) { |
|
902 | + add_action( |
|
903 | + 'AHEE__EE_System__load_controllers__load_admin_controllers', |
|
904 | + array($addon, self::$_settings[$addon_name]['admin_callback']) |
|
905 | + ); |
|
906 | + } |
|
907 | + return $addon; |
|
908 | 908 | } |
909 | 909 | |
910 | 910 | |
@@ -1000,15 +1000,15 @@ discard block |
||
1000 | 1000 | EE_Register_Widget::deregister( $addon_name ); |
1001 | 1001 | } |
1002 | 1002 | if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) |
1003 | - || |
|
1004 | - ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
1003 | + || |
|
1004 | + ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
1005 | 1005 | ) { |
1006 | 1006 | // add to list of shortcodes to be registered |
1007 | 1007 | EE_Register_Model::deregister( $addon_name ); |
1008 | 1008 | } |
1009 | 1009 | if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) |
1010 | - || |
|
1011 | - ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
1010 | + || |
|
1011 | + ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
1012 | 1012 | ) { |
1013 | 1013 | // add to list of shortcodes to be registered |
1014 | 1014 | EE_Register_Model_Extensions::deregister( $addon_name ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | |
5 | 5 | |
@@ -61,23 +61,23 @@ discard block |
||
61 | 61 | * @param string $min_core_version |
62 | 62 | * @return string always like '4.3.0.rc.000' |
63 | 63 | */ |
64 | - protected static function _effective_version( $min_core_version ) { |
|
64 | + protected static function _effective_version($min_core_version) { |
|
65 | 65 | // versions: 4 . 3 . 1 . p . 123 |
66 | 66 | // offsets: 0 . 1 . 2 . 3 . 4 |
67 | - $version_parts = explode( '.', $min_core_version ); |
|
67 | + $version_parts = explode('.', $min_core_version); |
|
68 | 68 | //check they specified the micro version (after 2nd period) |
69 | - if ( ! isset( $version_parts[2] ) ) { |
|
69 | + if ( ! isset($version_parts[2])) { |
|
70 | 70 | $version_parts[2] = '0'; |
71 | 71 | } |
72 | 72 | //if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible |
73 | 73 | //soon we can assume that's 'rc', but this current version is 'alpha' |
74 | - if ( ! isset( $version_parts[3] ) ) { |
|
74 | + if ( ! isset($version_parts[3])) { |
|
75 | 75 | $version_parts[3] = 'dev'; |
76 | 76 | } |
77 | - if ( ! isset( $version_parts[4] ) ) { |
|
77 | + if ( ! isset($version_parts[4])) { |
|
78 | 78 | $version_parts[4] = '000'; |
79 | 79 | } |
80 | - return implode( '.', $version_parts ); |
|
80 | + return implode('.', $version_parts); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | $actual_core_version = EVENT_ESPRESSO_VERSION |
95 | 95 | ) { |
96 | 96 | return version_compare( |
97 | - self::_effective_version( $actual_core_version ), |
|
98 | - self::_effective_version( $min_core_version ), |
|
97 | + self::_effective_version($actual_core_version), |
|
98 | + self::_effective_version($min_core_version), |
|
99 | 99 | '>=' |
100 | 100 | ); |
101 | 101 | } |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @throws EE_Error |
218 | 218 | * @return void |
219 | 219 | */ |
220 | - public static function register( $addon_name = '', $setup_args = array() ) { |
|
220 | + public static function register($addon_name = '', $setup_args = array()) { |
|
221 | 221 | // required fields MUST be present, so let's make sure they are. |
222 | 222 | \EE_Register_Addon::_verify_parameters($addon_name, $setup_args); |
223 | 223 | // get class name for addon |
@@ -227,13 +227,13 @@ discard block |
||
227 | 227 | // setup PUE |
228 | 228 | \EE_Register_Addon::_parse_pue_options($addon_name, $class_name, $setup_args); |
229 | 229 | // does this addon work with this version of core or WordPress ? |
230 | - if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings) ) { |
|
230 | + if ( ! \EE_Register_Addon::_addon_is_compatible($addon_name, $addon_settings)) { |
|
231 | 231 | return; |
232 | 232 | } |
233 | 233 | // register namespaces |
234 | 234 | \EE_Register_Addon::_setup_namespaces($addon_settings); |
235 | 235 | // check if this is an activation request |
236 | - if ( \EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
236 | + if (\EE_Register_Addon::_addon_activation($addon_name, $addon_settings)) { |
|
237 | 237 | // dont bother setting up the rest of the addon atm |
238 | 238 | return; |
239 | 239 | } |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | } else { |
327 | 327 | $class_name = $setup_args['class_name']; |
328 | 328 | } |
329 | - return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_' . $class_name; |
|
329 | + return strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | |
@@ -344,105 +344,105 @@ discard block |
||
344 | 344 | 'class_name' => $class_name, |
345 | 345 | // the addon slug for use in URLs, etc |
346 | 346 | 'plugin_slug' => isset($setup_args['plugin_slug']) |
347 | - ? (string)$setup_args['plugin_slug'] |
|
347 | + ? (string) $setup_args['plugin_slug'] |
|
348 | 348 | : '', |
349 | 349 | // page slug to be used when generating the "Settings" link on the WP plugin page |
350 | 350 | 'plugin_action_slug' => isset($setup_args['plugin_action_slug']) |
351 | - ? (string)$setup_args['plugin_action_slug'] |
|
351 | + ? (string) $setup_args['plugin_action_slug'] |
|
352 | 352 | : '', |
353 | 353 | // the "software" version for the addon |
354 | 354 | 'version' => isset($setup_args['version']) |
355 | - ? (string)$setup_args['version'] |
|
355 | + ? (string) $setup_args['version'] |
|
356 | 356 | : '', |
357 | 357 | // the minimum version of EE Core that the addon will work with |
358 | 358 | 'min_core_version' => isset($setup_args['min_core_version']) |
359 | - ? (string)$setup_args['min_core_version'] |
|
359 | + ? (string) $setup_args['min_core_version'] |
|
360 | 360 | : '', |
361 | 361 | // the minimum version of WordPress that the addon will work with |
362 | 362 | 'min_wp_version' => isset($setup_args['min_wp_version']) |
363 | - ? (string)$setup_args['min_wp_version'] |
|
363 | + ? (string) $setup_args['min_wp_version'] |
|
364 | 364 | : EE_MIN_WP_VER_REQUIRED, |
365 | 365 | // full server path to main file (file loaded directly by WP) |
366 | 366 | 'main_file_path' => isset($setup_args['main_file_path']) |
367 | - ? (string)$setup_args['main_file_path'] |
|
367 | + ? (string) $setup_args['main_file_path'] |
|
368 | 368 | : '', |
369 | 369 | // path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages |
370 | 370 | 'admin_path' => isset($setup_args['admin_path']) |
371 | - ? (string)$setup_args['admin_path'] : '', |
|
371 | + ? (string) $setup_args['admin_path'] : '', |
|
372 | 372 | // a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page |
373 | 373 | 'admin_callback' => isset($setup_args['admin_callback']) |
374 | - ? (string)$setup_args['admin_callback'] |
|
374 | + ? (string) $setup_args['admin_callback'] |
|
375 | 375 | : '', |
376 | 376 | // the section name for this addon's configuration settings section (defaults to "addons") |
377 | 377 | 'config_section' => isset($setup_args['config_section']) |
378 | - ? (string)$setup_args['config_section'] |
|
378 | + ? (string) $setup_args['config_section'] |
|
379 | 379 | : 'addons', |
380 | 380 | // the class name for this addon's configuration settings object |
381 | 381 | 'config_class' => isset($setup_args['config_class']) |
382 | - ? (string)$setup_args['config_class'] : '', |
|
382 | + ? (string) $setup_args['config_class'] : '', |
|
383 | 383 | //the name given to the config for this addons' configuration settings object (optional) |
384 | 384 | 'config_name' => isset($setup_args['config_name']) |
385 | - ? (string)$setup_args['config_name'] : '', |
|
385 | + ? (string) $setup_args['config_name'] : '', |
|
386 | 386 | // an array of "class names" => "full server paths" for any classes that might be invoked by the addon |
387 | 387 | 'autoloader_paths' => isset($setup_args['autoloader_paths']) |
388 | - ? (array)$setup_args['autoloader_paths'] |
|
388 | + ? (array) $setup_args['autoloader_paths'] |
|
389 | 389 | : array(), |
390 | 390 | // an array of "full server paths" for any folders containing classes that might be invoked by the addon |
391 | 391 | 'autoloader_folders' => isset($setup_args['autoloader_folders']) |
392 | - ? (array)$setup_args['autoloader_folders'] |
|
392 | + ? (array) $setup_args['autoloader_folders'] |
|
393 | 393 | : array(), |
394 | 394 | // array of full server paths to any EE_DMS data migration scripts used by the addon |
395 | 395 | 'dms_paths' => isset($setup_args['dms_paths']) |
396 | - ? (array)$setup_args['dms_paths'] |
|
396 | + ? (array) $setup_args['dms_paths'] |
|
397 | 397 | : array(), |
398 | 398 | // array of full server paths to any EED_Modules used by the addon |
399 | 399 | 'module_paths' => isset($setup_args['module_paths']) |
400 | - ? (array)$setup_args['module_paths'] |
|
400 | + ? (array) $setup_args['module_paths'] |
|
401 | 401 | : array(), |
402 | 402 | // array of full server paths to any EES_Shortcodes used by the addon |
403 | 403 | 'shortcode_paths' => isset($setup_args['shortcode_paths']) |
404 | - ? (array)$setup_args['shortcode_paths'] |
|
404 | + ? (array) $setup_args['shortcode_paths'] |
|
405 | 405 | : array(), |
406 | 406 | // array of full server paths to any WP_Widgets used by the addon |
407 | 407 | 'widget_paths' => isset($setup_args['widget_paths']) |
408 | - ? (array)$setup_args['widget_paths'] |
|
408 | + ? (array) $setup_args['widget_paths'] |
|
409 | 409 | : array(), |
410 | 410 | // array of PUE options used by the addon |
411 | 411 | 'pue_options' => isset($setup_args['pue_options']) |
412 | - ? (array)$setup_args['pue_options'] |
|
412 | + ? (array) $setup_args['pue_options'] |
|
413 | 413 | : array(), |
414 | 414 | 'message_types' => isset($setup_args['message_types']) |
415 | - ? (array)$setup_args['message_types'] |
|
415 | + ? (array) $setup_args['message_types'] |
|
416 | 416 | : array(), |
417 | 417 | 'capabilities' => isset($setup_args['capabilities']) |
418 | - ? (array)$setup_args['capabilities'] |
|
418 | + ? (array) $setup_args['capabilities'] |
|
419 | 419 | : array(), |
420 | 420 | 'capability_maps' => isset($setup_args['capability_maps']) |
421 | - ? (array)$setup_args['capability_maps'] |
|
421 | + ? (array) $setup_args['capability_maps'] |
|
422 | 422 | : array(), |
423 | 423 | 'model_paths' => isset($setup_args['model_paths']) |
424 | - ? (array)$setup_args['model_paths'] |
|
424 | + ? (array) $setup_args['model_paths'] |
|
425 | 425 | : array(), |
426 | 426 | 'class_paths' => isset($setup_args['class_paths']) |
427 | - ? (array)$setup_args['class_paths'] |
|
427 | + ? (array) $setup_args['class_paths'] |
|
428 | 428 | : array(), |
429 | 429 | 'model_extension_paths' => isset($setup_args['model_extension_paths']) |
430 | - ? (array)$setup_args['model_extension_paths'] |
|
430 | + ? (array) $setup_args['model_extension_paths'] |
|
431 | 431 | : array(), |
432 | 432 | 'class_extension_paths' => isset($setup_args['class_extension_paths']) |
433 | - ? (array)$setup_args['class_extension_paths'] |
|
433 | + ? (array) $setup_args['class_extension_paths'] |
|
434 | 434 | : array(), |
435 | 435 | 'custom_post_types' => isset($setup_args['custom_post_types']) |
436 | - ? (array)$setup_args['custom_post_types'] |
|
436 | + ? (array) $setup_args['custom_post_types'] |
|
437 | 437 | : array(), |
438 | 438 | 'custom_taxonomies' => isset($setup_args['custom_taxonomies']) |
439 | - ? (array)$setup_args['custom_taxonomies'] |
|
439 | + ? (array) $setup_args['custom_taxonomies'] |
|
440 | 440 | : array(), |
441 | 441 | 'payment_method_paths' => isset($setup_args['payment_method_paths']) |
442 | - ? (array)$setup_args['payment_method_paths'] |
|
442 | + ? (array) $setup_args['payment_method_paths'] |
|
443 | 443 | : array(), |
444 | 444 | 'default_terms' => isset($setup_args['default_terms']) |
445 | - ? (array)$setup_args['default_terms'] |
|
445 | + ? (array) $setup_args['default_terms'] |
|
446 | 446 | : array(), |
447 | 447 | // if not empty, inserts a new table row after this plugin's row on the WP Plugins page |
448 | 448 | // that can be used for adding upgrading/marketing info |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $setup_args['namespace']['FQNS'], |
455 | 455 | $setup_args['namespace']['DIR'] |
456 | 456 | ) |
457 | - ? (array)$setup_args['namespace'] |
|
457 | + ? (array) $setup_args['namespace'] |
|
458 | 458 | : array(), |
459 | 459 | ); |
460 | 460 | // if plugin_action_slug is NOT set, but an admin page path IS set, |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @param array $addon_settings |
476 | 476 | * @return boolean |
477 | 477 | */ |
478 | - private static function _addon_is_compatible( $addon_name, array $addon_settings ) { |
|
478 | + private static function _addon_is_compatible($addon_name, array $addon_settings) { |
|
479 | 479 | global $wp_version; |
480 | 480 | $incompatibility_message = ''; |
481 | 481 | //check whether this addon version is compatible with EE core |
@@ -552,21 +552,21 @@ discard block |
||
552 | 552 | * @param array $setup_args |
553 | 553 | * @return void |
554 | 554 | */ |
555 | - private static function _parse_pue_options( $addon_name, $class_name, array $setup_args ) { |
|
555 | + private static function _parse_pue_options($addon_name, $class_name, array $setup_args) { |
|
556 | 556 | // |
557 | 557 | if ( ! empty($setup_args['pue_options'])) { |
558 | 558 | self::$_settings[$addon_name]['pue_options'] = array( |
559 | 559 | 'pue_plugin_slug' => isset($setup_args['pue_options']['pue_plugin_slug']) |
560 | - ? (string)$setup_args['pue_options']['pue_plugin_slug'] |
|
561 | - : 'espresso_' . strtolower($class_name), |
|
560 | + ? (string) $setup_args['pue_options']['pue_plugin_slug'] |
|
561 | + : 'espresso_'.strtolower($class_name), |
|
562 | 562 | 'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) |
563 | - ? (string)$setup_args['pue_options']['plugin_basename'] |
|
563 | + ? (string) $setup_args['pue_options']['plugin_basename'] |
|
564 | 564 | : plugin_basename(self::$_settings[$addon_name]['main_file_path']), |
565 | 565 | 'checkPeriod' => isset($setup_args['pue_options']['checkPeriod']) |
566 | - ? (string)$setup_args['pue_options']['checkPeriod'] |
|
566 | + ? (string) $setup_args['pue_options']['checkPeriod'] |
|
567 | 567 | : '24', |
568 | 568 | 'use_wp_update' => isset($setup_args['pue_options']['use_wp_update']) |
569 | - ? (string)$setup_args['pue_options']['use_wp_update'] |
|
569 | + ? (string) $setup_args['pue_options']['use_wp_update'] |
|
570 | 570 | : false, |
571 | 571 | ); |
572 | 572 | add_action( |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | * @param array $addon_settings |
609 | 609 | * @return bool |
610 | 610 | */ |
611 | - private static function _addon_activation( $addon_name, array $addon_settings ) { |
|
611 | + private static function _addon_activation($addon_name, array $addon_settings) { |
|
612 | 612 | // this is an activation request |
613 | 613 | if (did_action('activate_plugin')) { |
614 | 614 | //to find if THIS is the addon that was activated, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | } |
661 | 661 | // setup autoloaders for folders |
662 | 662 | if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) { |
663 | - foreach ((array)self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
663 | + foreach ((array) self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) { |
|
664 | 664 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder); |
665 | 665 | } |
666 | 666 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | * @return void |
676 | 676 | * @throws \EE_Error |
677 | 677 | */ |
678 | - private static function _register_models_and_extensions( $addon_name ) { |
|
678 | + private static function _register_models_and_extensions($addon_name) { |
|
679 | 679 | // register new models |
680 | 680 | if ( |
681 | 681 | ! empty(self::$_settings[$addon_name]['model_paths']) |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * @return void |
712 | 712 | * @throws \EE_Error |
713 | 713 | */ |
714 | - private static function _register_data_migration_scripts( $addon_name ) { |
|
714 | + private static function _register_data_migration_scripts($addon_name) { |
|
715 | 715 | // setup DMS |
716 | 716 | if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
717 | 717 | EE_Register_Data_Migration_Scripts::register( |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | * @return void |
728 | 728 | * @throws \EE_Error |
729 | 729 | */ |
730 | - private static function _register_config( $addon_name ) { |
|
730 | + private static function _register_config($addon_name) { |
|
731 | 731 | // if config_class is present let's register config. |
732 | 732 | if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
733 | 733 | EE_Register_Config::register( |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | * @return void |
747 | 747 | * @throws \EE_Error |
748 | 748 | */ |
749 | - private static function _register_admin_pages( $addon_name ) { |
|
749 | + private static function _register_admin_pages($addon_name) { |
|
750 | 750 | if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
751 | 751 | EE_Register_Admin_Page::register( |
752 | 752 | $addon_name, |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | * @return void |
762 | 762 | * @throws \EE_Error |
763 | 763 | */ |
764 | - private static function _register_modules( $addon_name ) { |
|
764 | + private static function _register_modules($addon_name) { |
|
765 | 765 | if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
766 | 766 | EE_Register_Module::register( |
767 | 767 | $addon_name, |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | * @return void |
777 | 777 | * @throws \EE_Error |
778 | 778 | */ |
779 | - private static function _register_shortcodes( $addon_name ) { |
|
779 | + private static function _register_shortcodes($addon_name) { |
|
780 | 780 | if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
781 | 781 | EE_Register_Shortcode::register( |
782 | 782 | $addon_name, |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | * @return void |
792 | 792 | * @throws \EE_Error |
793 | 793 | */ |
794 | - private static function _register_widgets( $addon_name ) { |
|
794 | + private static function _register_widgets($addon_name) { |
|
795 | 795 | if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
796 | 796 | EE_Register_Widget::register( |
797 | 797 | $addon_name, |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @return void |
807 | 807 | * @throws \EE_Error |
808 | 808 | */ |
809 | - private static function _register_capabilities( $addon_name ) { |
|
809 | + private static function _register_capabilities($addon_name) { |
|
810 | 810 | if ( ! empty(self::$_settings[$addon_name]['capabilities'])) { |
811 | 811 | EE_Register_Capabilities::register( |
812 | 812 | $addon_name, |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | * @return void |
825 | 825 | * @throws \EE_Error |
826 | 826 | */ |
827 | - private static function _register_message_types( $addon_name ) { |
|
827 | + private static function _register_message_types($addon_name) { |
|
828 | 828 | if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
829 | 829 | add_action( |
830 | 830 | 'EE_Brewing_Regular___messages_caf', |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | * @return void |
840 | 840 | * @throws \EE_Error |
841 | 841 | */ |
842 | - private static function _register_custom_post_types( $addon_name ) { |
|
842 | + private static function _register_custom_post_types($addon_name) { |
|
843 | 843 | if ( |
844 | 844 | ! empty(self::$_settings[$addon_name]['custom_post_types']) |
845 | 845 | || ! empty(self::$_settings[$addon_name]['custom_taxonomies']) |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | * @return void |
862 | 862 | * @throws \EE_Error |
863 | 863 | */ |
864 | - private static function _register_payment_methods( $addon_name ) { |
|
864 | + private static function _register_payment_methods($addon_name) { |
|
865 | 865 | if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) { |
866 | 866 | EE_Register_Payment_Method::register( |
867 | 867 | $addon_name, |
@@ -878,25 +878,25 @@ discard block |
||
878 | 878 | * @param string $addon_name |
879 | 879 | * @return EE_Addon |
880 | 880 | */ |
881 | - private static function _load_and_init_addon_class( $addon_name ) { |
|
881 | + private static function _load_and_init_addon_class($addon_name) { |
|
882 | 882 | $addon = EE_Registry::instance()->load_addon( |
883 | - dirname( self::$_settings[ $addon_name ]['main_file_path'] ), |
|
884 | - self::$_settings[ $addon_name ]['class_name'] |
|
883 | + dirname(self::$_settings[$addon_name]['main_file_path']), |
|
884 | + self::$_settings[$addon_name]['class_name'] |
|
885 | 885 | ); |
886 | - $addon->set_name( $addon_name ); |
|
887 | - $addon->set_plugin_slug( self::$_settings[ $addon_name ]['plugin_slug'] ); |
|
888 | - $addon->set_plugin_basename( self::$_settings[ $addon_name ]['plugin_basename'] ); |
|
889 | - $addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] ); |
|
890 | - $addon->set_plugin_action_slug( self::$_settings[ $addon_name ]['plugin_action_slug'] ); |
|
891 | - $addon->set_plugins_page_row( self::$_settings[ $addon_name ]['plugins_page_row'] ); |
|
892 | - $addon->set_version( self::$_settings[ $addon_name ]['version'] ); |
|
893 | - $addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) ); |
|
894 | - $addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] ); |
|
895 | - $addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] ); |
|
896 | - $addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] ); |
|
886 | + $addon->set_name($addon_name); |
|
887 | + $addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']); |
|
888 | + $addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']); |
|
889 | + $addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']); |
|
890 | + $addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']); |
|
891 | + $addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']); |
|
892 | + $addon->set_version(self::$_settings[$addon_name]['version']); |
|
893 | + $addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version'])); |
|
894 | + $addon->set_config_section(self::$_settings[$addon_name]['config_section']); |
|
895 | + $addon->set_config_class(self::$_settings[$addon_name]['config_class']); |
|
896 | + $addon->set_config_name(self::$_settings[$addon_name]['config_name']); |
|
897 | 897 | //unfortunately this can't be hooked in upon construction, because we don't have |
898 | 898 | //the plugin mainfile's path upon construction. |
899 | - register_deactivation_hook( $addon->get_main_plugin_file(), array( $addon, 'deactivation' ) ); |
|
899 | + register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation')); |
|
900 | 900 | // call any additional admin_callback functions during load_admin_controller hook |
901 | 901 | if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) { |
902 | 902 | add_action( |
@@ -916,18 +916,18 @@ discard block |
||
916 | 916 | */ |
917 | 917 | public static function load_pue_update() { |
918 | 918 | // load PUE client |
919 | - require_once EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php'; |
|
919 | + require_once EE_THIRD_PARTY.'pue'.DS.'pue-client.php'; |
|
920 | 920 | // cycle thru settings |
921 | - foreach ( self::$_settings as $settings ) { |
|
922 | - if ( ! empty( $settings['pue_options'] ) ) { |
|
921 | + foreach (self::$_settings as $settings) { |
|
922 | + if ( ! empty($settings['pue_options'])) { |
|
923 | 923 | // initiate the class and start the plugin update engine! |
924 | 924 | new PluginUpdateEngineChecker( |
925 | 925 | // host file URL |
926 | 926 | 'https://eventespresso.com', |
927 | 927 | // plugin slug(s) |
928 | 928 | array( |
929 | - 'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ), |
|
930 | - 'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' ), |
|
929 | + 'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']), |
|
930 | + 'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr'), |
|
931 | 931 | ), |
932 | 932 | // options |
933 | 933 | array( |
@@ -955,9 +955,9 @@ discard block |
||
955 | 955 | * @throws \EE_Error |
956 | 956 | */ |
957 | 957 | public static function register_message_types() { |
958 | - foreach ( self::$_settings as $settings ) { |
|
959 | - foreach ( (array) $settings['message_types'] as $message_type => $message_type_settings ) { |
|
960 | - EE_Register_Message_Type::register( $message_type, $message_type_settings ); |
|
958 | + foreach (self::$_settings as $settings) { |
|
959 | + foreach ((array) $settings['message_types'] as $message_type => $message_type_settings) { |
|
960 | + EE_Register_Message_Type::register($message_type, $message_type_settings); |
|
961 | 961 | } |
962 | 962 | } |
963 | 963 | } |
@@ -972,73 +972,73 @@ discard block |
||
972 | 972 | * @throws EE_Error |
973 | 973 | * @return void |
974 | 974 | */ |
975 | - public static function deregister( $addon_name = null ) { |
|
976 | - if ( isset( self::$_settings[ $addon_name ] ) ) { |
|
977 | - $class_name = self::$_settings[ $addon_name ]['class_name']; |
|
978 | - if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] ) ) { |
|
975 | + public static function deregister($addon_name = null) { |
|
976 | + if (isset(self::$_settings[$addon_name])) { |
|
977 | + $class_name = self::$_settings[$addon_name]['class_name']; |
|
978 | + if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) { |
|
979 | 979 | // setup DMS |
980 | - EE_Register_Data_Migration_Scripts::deregister( $addon_name ); |
|
980 | + EE_Register_Data_Migration_Scripts::deregister($addon_name); |
|
981 | 981 | } |
982 | - if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] ) ) { |
|
982 | + if ( ! empty(self::$_settings[$addon_name]['admin_path'])) { |
|
983 | 983 | // register admin page |
984 | - EE_Register_Admin_Page::deregister( $addon_name ); |
|
984 | + EE_Register_Admin_Page::deregister($addon_name); |
|
985 | 985 | } |
986 | - if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] ) ) { |
|
986 | + if ( ! empty(self::$_settings[$addon_name]['module_paths'])) { |
|
987 | 987 | // add to list of modules to be registered |
988 | - EE_Register_Module::deregister( $addon_name ); |
|
988 | + EE_Register_Module::deregister($addon_name); |
|
989 | 989 | } |
990 | - if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] ) ) { |
|
990 | + if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) { |
|
991 | 991 | // add to list of shortcodes to be registered |
992 | - EE_Register_Shortcode::deregister( $addon_name ); |
|
992 | + EE_Register_Shortcode::deregister($addon_name); |
|
993 | 993 | } |
994 | - if ( ! empty( self::$_settings[ $addon_name ]['config_class'] ) ) { |
|
994 | + if ( ! empty(self::$_settings[$addon_name]['config_class'])) { |
|
995 | 995 | // if config_class present let's register config. |
996 | - EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class'] ); |
|
996 | + EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']); |
|
997 | 997 | } |
998 | - if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] ) ) { |
|
998 | + if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) { |
|
999 | 999 | // add to list of widgets to be registered |
1000 | - EE_Register_Widget::deregister( $addon_name ); |
|
1000 | + EE_Register_Widget::deregister($addon_name); |
|
1001 | 1001 | } |
1002 | - if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) |
|
1002 | + if ( ! empty(self::$_settings[$addon_name]['model_paths']) |
|
1003 | 1003 | || |
1004 | - ! empty( self::$_settings[ $addon_name ]['class_paths'] ) |
|
1004 | + ! empty(self::$_settings[$addon_name]['class_paths']) |
|
1005 | 1005 | ) { |
1006 | 1006 | // add to list of shortcodes to be registered |
1007 | - EE_Register_Model::deregister( $addon_name ); |
|
1007 | + EE_Register_Model::deregister($addon_name); |
|
1008 | 1008 | } |
1009 | - if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) |
|
1009 | + if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) |
|
1010 | 1010 | || |
1011 | - ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] ) |
|
1011 | + ! empty(self::$_settings[$addon_name]['class_extension_paths']) |
|
1012 | 1012 | ) { |
1013 | 1013 | // add to list of shortcodes to be registered |
1014 | - EE_Register_Model_Extensions::deregister( $addon_name ); |
|
1014 | + EE_Register_Model_Extensions::deregister($addon_name); |
|
1015 | 1015 | } |
1016 | - if ( ! empty( self::$_settings[ $addon_name ]['message_types'] ) ) { |
|
1017 | - foreach ((array)self::$_settings[ $addon_name ]['message_types'] as $message_type => $message_type_settings ) |
|
1016 | + if ( ! empty(self::$_settings[$addon_name]['message_types'])) { |
|
1017 | + foreach ((array) self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) |
|
1018 | 1018 | { |
1019 | - EE_Register_Message_Type::deregister( $message_type ); |
|
1019 | + EE_Register_Message_Type::deregister($message_type); |
|
1020 | 1020 | } |
1021 | 1021 | } |
1022 | 1022 | //deregister capabilities for addon |
1023 | 1023 | if ( |
1024 | - ! empty( self::$_settings[ $addon_name ]['capabilities'] ) |
|
1025 | - || ! empty( self::$_settings[ $addon_name ]['capability_maps'] ) |
|
1024 | + ! empty(self::$_settings[$addon_name]['capabilities']) |
|
1025 | + || ! empty(self::$_settings[$addon_name]['capability_maps']) |
|
1026 | 1026 | ) { |
1027 | - EE_Register_Capabilities::deregister( $addon_name ); |
|
1027 | + EE_Register_Capabilities::deregister($addon_name); |
|
1028 | 1028 | } |
1029 | 1029 | //deregister custom_post_types for addon |
1030 | - if ( ! empty( self::$_settings[ $addon_name ]['custom_post_types'] ) ) { |
|
1031 | - EE_Register_CPT::deregister( $addon_name ); |
|
1030 | + if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) { |
|
1031 | + EE_Register_CPT::deregister($addon_name); |
|
1032 | 1032 | } |
1033 | 1033 | remove_action( |
1034 | - 'deactivate_' . EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), |
|
1035 | - array( EE_Registry::instance()->addons->{$class_name}, 'deactivation' ) |
|
1034 | + 'deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), |
|
1035 | + array(EE_Registry::instance()->addons->{$class_name}, 'deactivation') |
|
1036 | 1036 | ); |
1037 | 1037 | remove_action( |
1038 | 1038 | 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
1039 | - array( EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required' ) |
|
1039 | + array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required') |
|
1040 | 1040 | ); |
1041 | - unset( EE_Registry::instance()->addons->{$class_name}, self::$_settings[ $addon_name ] ); |
|
1041 | + unset(EE_Registry::instance()->addons->{$class_name}, self::$_settings[$addon_name]); |
|
1042 | 1042 | } |
1043 | 1043 | } |
1044 | 1044 |