@@ -4,8 +4,8 @@ |
||
| 4 | 4 | <p><strong><?php esc_html_e('Edit Price Type', 'event_espresso'); ?></strong></p> |
| 5 | 5 | <p> |
| 6 | 6 | <?php printf( |
| 7 | - esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'), |
|
| 8 | - Domain::brandName() |
|
| 7 | + esc_html__('This page allows you to edit a price type for %s.', 'event_espresso'), |
|
| 8 | + Domain::brandName() |
|
| 9 | 9 | ); ?> |
| 10 | 10 | </p> |
| 11 | 11 | <ul> |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | <p><strong><?php esc_html_e('Add New Default Price', 'event_espresso'); ?></strong></p> |
| 5 | 5 | <p> |
| 6 | 6 | <?php printf( |
| 7 | - esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
| 8 | - Domain::brandName() |
|
| 7 | + esc_html__('This page allows you to create a new default price for %s.', 'event_espresso'), |
|
| 8 | + Domain::brandName() |
|
| 9 | 9 | ); ?> |
| 10 | 10 | </p> |
| 11 | 11 | <ul> |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | $this->loader->getShared( |
| 60 | 60 | 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
| 61 | 61 | ); |
| 62 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
| 62 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[self::RESPONSE_KEY_THANK_YOU_PAGE])) { |
|
| 63 | 63 | $this->loader->getShared( |
| 64 | 64 | 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
| 65 | 65 | ); |
@@ -16,52 +16,52 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | class WordpressHeartbeat |
| 18 | 18 | { |
| 19 | - const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
| 19 | + const RESPONSE_KEY_THANK_YOU_PAGE = 'espresso_thank_you_page'; |
|
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * @var LoaderInterface $loader |
|
| 23 | - */ |
|
| 24 | - protected $loader; |
|
| 21 | + /** |
|
| 22 | + * @var LoaderInterface $loader |
|
| 23 | + */ |
|
| 24 | + protected $loader; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * @var RequestInterface $request |
|
| 28 | - */ |
|
| 29 | - protected $request; |
|
| 26 | + /** |
|
| 27 | + * @var RequestInterface $request |
|
| 28 | + */ |
|
| 29 | + protected $request; |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * WordpressHeartbeat constructor. |
|
| 34 | - * |
|
| 35 | - * @param LoaderInterface $loader |
|
| 36 | - * @param RequestInterface $request |
|
| 37 | - */ |
|
| 38 | - public function __construct( |
|
| 39 | - LoaderInterface $loader, |
|
| 40 | - RequestInterface $request |
|
| 41 | - ) { |
|
| 42 | - $this->loader = $loader; |
|
| 43 | - $this->request = $request; |
|
| 44 | - do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
| 45 | - add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
| 46 | - } |
|
| 32 | + /** |
|
| 33 | + * WordpressHeartbeat constructor. |
|
| 34 | + * |
|
| 35 | + * @param LoaderInterface $loader |
|
| 36 | + * @param RequestInterface $request |
|
| 37 | + */ |
|
| 38 | + public function __construct( |
|
| 39 | + LoaderInterface $loader, |
|
| 40 | + RequestInterface $request |
|
| 41 | + ) { |
|
| 42 | + $this->loader = $loader; |
|
| 43 | + $this->request = $request; |
|
| 44 | + do_action('AHEE__EventEspresso_core_domain_services_admin_ajax_WordpressHeartbeat__constructor', $this); |
|
| 45 | + add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'resolveRoutes')); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @since 4.9.76.p |
|
| 51 | - * @throws InvalidClassException |
|
| 52 | - */ |
|
| 53 | - public function resolveRoutes() |
|
| 54 | - { |
|
| 55 | - $screenID = $this->request->getRequestParam('screen_id'); |
|
| 56 | - $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
| 57 | - if ($screenID === 'espresso_events') { |
|
| 58 | - $this->loader->getShared( |
|
| 59 | - 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
| 60 | - ); |
|
| 61 | - } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
| 62 | - $this->loader->getShared( |
|
| 63 | - 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
| 64 | - ); |
|
| 65 | - } |
|
| 66 | - } |
|
| 49 | + /** |
|
| 50 | + * @since 4.9.76.p |
|
| 51 | + * @throws InvalidClassException |
|
| 52 | + */ |
|
| 53 | + public function resolveRoutes() |
|
| 54 | + { |
|
| 55 | + $screenID = $this->request->getRequestParam('screen_id'); |
|
| 56 | + $heartbeat_data = $this->request->getRequestParam('data', [], 'string', true); |
|
| 57 | + if ($screenID === 'espresso_events') { |
|
| 58 | + $this->loader->getShared( |
|
| 59 | + 'EventEspresso\core\domain\services\admin\ajax\EventEditorHeartbeat' |
|
| 60 | + ); |
|
| 61 | + } elseif ($screenID === 'front' && ! empty($heartbeat_data[ self::RESPONSE_KEY_THANK_YOU_PAGE ])) { |
|
| 62 | + $this->loader->getShared( |
|
| 63 | + 'EventEspresso\core\domain\services\admin\ajax\ThankYouPageIpnMonitor' |
|
| 64 | + ); |
|
| 65 | + } |
|
| 66 | + } |
|
| 67 | 67 | } |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * ACF compatibility |
| 8 | 8 | */ |
| 9 | 9 | add_action( |
| 10 | - 'plugins_loaded', |
|
| 11 | - function () { |
|
| 12 | - if (function_exists('acf_include')) { |
|
| 13 | - add_filter( |
|
| 14 | - 'acf/get_post_types', |
|
| 15 | - function ($post_types, $args) { |
|
| 16 | - if (! empty($args['show_ui'])) { |
|
| 17 | - $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
|
| 18 | - $ee_post_types = array_keys($ee_post_types); |
|
| 19 | - $post_types = array_merge($post_types, $ee_post_types); |
|
| 20 | - $post_types = array_unique($post_types); |
|
| 21 | - } |
|
| 22 | - return $post_types; |
|
| 23 | - }, |
|
| 24 | - 10, |
|
| 25 | - 2 |
|
| 26 | - ); |
|
| 27 | - } |
|
| 28 | - }, |
|
| 29 | - 100 |
|
| 10 | + 'plugins_loaded', |
|
| 11 | + function () { |
|
| 12 | + if (function_exists('acf_include')) { |
|
| 13 | + add_filter( |
|
| 14 | + 'acf/get_post_types', |
|
| 15 | + function ($post_types, $args) { |
|
| 16 | + if (! empty($args['show_ui'])) { |
|
| 17 | + $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
|
| 18 | + $ee_post_types = array_keys($ee_post_types); |
|
| 19 | + $post_types = array_merge($post_types, $ee_post_types); |
|
| 20 | + $post_types = array_unique($post_types); |
|
| 21 | + } |
|
| 22 | + return $post_types; |
|
| 23 | + }, |
|
| 24 | + 10, |
|
| 25 | + 2 |
|
| 26 | + ); |
|
| 27 | + } |
|
| 28 | + }, |
|
| 29 | + 100 |
|
| 30 | 30 | ); |
@@ -8,12 +8,12 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | add_action( |
| 10 | 10 | 'plugins_loaded', |
| 11 | - function () { |
|
| 11 | + function() { |
|
| 12 | 12 | if (function_exists('acf_include')) { |
| 13 | 13 | add_filter( |
| 14 | 14 | 'acf/get_post_types', |
| 15 | - function ($post_types, $args) { |
|
| 16 | - if (! empty($args['show_ui'])) { |
|
| 15 | + function($post_types, $args) { |
|
| 16 | + if ( ! empty($args['show_ui'])) { |
|
| 17 | 17 | $ee_post_types = get_post_types(array('show_ee_ui' => 1)); |
| 18 | 18 | $ee_post_types = array_keys($ee_post_types); |
| 19 | 19 | $post_types = array_merge($post_types, $ee_post_types); |
@@ -23,15 +23,15 @@ |
||
| 23 | 23 | public function __construct() |
| 24 | 24 | { |
| 25 | 25 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
| 26 | - if (! defined('REG_PG_SLUG')) { |
|
| 26 | + if ( ! defined('REG_PG_SLUG')) { |
|
| 27 | 27 | define('REG_PG_SLUG', 'espresso_registrations'); |
| 28 | 28 | define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
| 29 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
| 30 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
| 31 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
| 32 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
| 33 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
| 34 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
| 29 | + define('REG_ADMIN', EE_ADMIN_PAGES.'registrations/'); |
|
| 30 | + define('REG_ADMIN_URL', admin_url('admin.php?page='.REG_PG_SLUG)); |
|
| 31 | + define('REG_ASSETS_PATH', REG_ADMIN.'assets/'); |
|
| 32 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL.'registrations/assets/'); |
|
| 33 | + define('REG_TEMPLATE_PATH', REG_ADMIN.'templates/'); |
|
| 34 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registrations/templates/'); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | parent::__construct(); |
@@ -13,48 +13,48 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | class Registrations_Admin_Page_Init extends EE_Admin_Page_CPT_Init |
| 15 | 15 | { |
| 16 | - /** |
|
| 17 | - * constructor |
|
| 18 | - * |
|
| 19 | - * @Constructor |
|
| 20 | - * @access public |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function __construct() |
|
| 24 | - { |
|
| 25 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 26 | - if (! defined('REG_PG_SLUG')) { |
|
| 27 | - define('REG_PG_SLUG', 'espresso_registrations'); |
|
| 28 | - define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
| 29 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
| 30 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
| 31 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
| 32 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
| 33 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
| 34 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
| 35 | - } |
|
| 16 | + /** |
|
| 17 | + * constructor |
|
| 18 | + * |
|
| 19 | + * @Constructor |
|
| 20 | + * @access public |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function __construct() |
|
| 24 | + { |
|
| 25 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 26 | + if (! defined('REG_PG_SLUG')) { |
|
| 27 | + define('REG_PG_SLUG', 'espresso_registrations'); |
|
| 28 | + define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
| 29 | + define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
| 30 | + define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
| 31 | + define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
| 32 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
| 33 | + define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
| 34 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - parent::__construct(); |
|
| 38 | - } |
|
| 37 | + parent::__construct(); |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | 40 | |
| 41 | - protected function _set_init_properties() |
|
| 42 | - { |
|
| 43 | - $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
| 44 | - } |
|
| 41 | + protected function _set_init_properties() |
|
| 42 | + { |
|
| 43 | + $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | |
| 47 | - public function getMenuProperties(): array |
|
| 48 | - { |
|
| 49 | - return [ |
|
| 50 | - 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
| 51 | - 'menu_group' => AdminMenuGroup::MENU_SLUG_MAIN, |
|
| 52 | - 'menu_order' => 40, |
|
| 53 | - 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
| 54 | - 'parent_slug' => AdminMenuTopLevel::MENU_PARENT_ACTIVE, |
|
| 55 | - 'menu_slug' => REG_PG_SLUG, |
|
| 56 | - 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
| 57 | - 'capability' => 'ee_read_registrations', |
|
| 58 | - ]; |
|
| 59 | - } |
|
| 47 | + public function getMenuProperties(): array |
|
| 48 | + { |
|
| 49 | + return [ |
|
| 50 | + 'menu_type' => AdminMenuItem::TYPE_MENU_SUB_ITEM, |
|
| 51 | + 'menu_group' => AdminMenuGroup::MENU_SLUG_MAIN, |
|
| 52 | + 'menu_order' => 40, |
|
| 53 | + 'show_on_menu' => AdminMenuItem::DISPLAY_BLOG_ONLY, |
|
| 54 | + 'parent_slug' => AdminMenuTopLevel::MENU_PARENT_ACTIVE, |
|
| 55 | + 'menu_slug' => REG_PG_SLUG, |
|
| 56 | + 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
| 57 | + 'capability' => 'ee_read_registrations', |
|
| 58 | + ]; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | // load interfaces |
| 200 | 200 | espresso_load_required( |
| 201 | 201 | 'EEH_Autoloader', |
| 202 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
| 202 | + EE_CORE.'helpers/EEH_Autoloader.helper.php' |
|
| 203 | 203 | ); |
| 204 | 204 | EEH_Autoloader::instance(); |
| 205 | 205 | } |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | protected function setAutoloadersForRequiredFiles() |
| 214 | 214 | { |
| 215 | 215 | // load interfaces |
| 216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
| 216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces', true); |
|
| 217 | 217 | // load helpers |
| 218 | 218 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
| 219 | 219 | // register legacy request stack classes just in case |
| 220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
| 220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack/'); |
|
| 221 | 221 | // register legacy middleware classes just in case |
| 222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
| 222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware/'); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -54,213 +54,213 @@ |
||
| 54 | 54 | */ |
| 55 | 55 | class BootstrapCore |
| 56 | 56 | { |
| 57 | - private LoaderInterface $loader; |
|
| 57 | + private LoaderInterface $loader; |
|
| 58 | 58 | |
| 59 | - protected RequestInterface $request; |
|
| 59 | + protected RequestInterface $request; |
|
| 60 | 60 | |
| 61 | - protected ResponseInterface $response; |
|
| 61 | + protected ResponseInterface $response; |
|
| 62 | 62 | |
| 63 | - protected RequestStackBuilder $request_stack_builder; |
|
| 63 | + protected RequestStackBuilder $request_stack_builder; |
|
| 64 | 64 | |
| 65 | - protected RequestStack $request_stack; |
|
| 65 | + protected RequestStack $request_stack; |
|
| 66 | 66 | |
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * BootstrapCore constructor. |
|
| 70 | - */ |
|
| 71 | - public function __construct() |
|
| 72 | - { |
|
| 73 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
| 74 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
| 75 | - add_action('plugins_loaded', [$this, 'initialize'], 0); |
|
| 76 | - } |
|
| 68 | + /** |
|
| 69 | + * BootstrapCore constructor. |
|
| 70 | + */ |
|
| 71 | + public function __construct() |
|
| 72 | + { |
|
| 73 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
| 74 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
| 75 | + add_action('plugins_loaded', [$this, 'initialize'], 0); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | - /** |
|
| 80 | - * @throws DomainException |
|
| 81 | - * @throws EE_Error |
|
| 82 | - * @throws Exception |
|
| 83 | - * @throws InvalidArgumentException |
|
| 84 | - * @throws InvalidClassException |
|
| 85 | - * @throws InvalidDataTypeException |
|
| 86 | - * @throws InvalidFilePathException |
|
| 87 | - * @throws InvalidInterfaceException |
|
| 88 | - * @throws InvalidRequestStackMiddlewareException |
|
| 89 | - * @throws OutOfBoundsException |
|
| 90 | - * @throws ReflectionException |
|
| 91 | - * @throws Throwable |
|
| 92 | - */ |
|
| 93 | - public function initialize() |
|
| 94 | - { |
|
| 95 | - $this->bootstrapDependencyInjectionContainer(); |
|
| 96 | - $this->bootstrapDomain(); |
|
| 97 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
| 98 | - add_action( |
|
| 99 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
| 100 | - [$bootstrap_request, 'setupLegacyRequest'] |
|
| 101 | - ); |
|
| 102 | - $this->runRequestStack(); |
|
| 103 | - } |
|
| 79 | + /** |
|
| 80 | + * @throws DomainException |
|
| 81 | + * @throws EE_Error |
|
| 82 | + * @throws Exception |
|
| 83 | + * @throws InvalidArgumentException |
|
| 84 | + * @throws InvalidClassException |
|
| 85 | + * @throws InvalidDataTypeException |
|
| 86 | + * @throws InvalidFilePathException |
|
| 87 | + * @throws InvalidInterfaceException |
|
| 88 | + * @throws InvalidRequestStackMiddlewareException |
|
| 89 | + * @throws OutOfBoundsException |
|
| 90 | + * @throws ReflectionException |
|
| 91 | + * @throws Throwable |
|
| 92 | + */ |
|
| 93 | + public function initialize() |
|
| 94 | + { |
|
| 95 | + $this->bootstrapDependencyInjectionContainer(); |
|
| 96 | + $this->bootstrapDomain(); |
|
| 97 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
| 98 | + add_action( |
|
| 99 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
| 100 | + [$bootstrap_request, 'setupLegacyRequest'] |
|
| 101 | + ); |
|
| 102 | + $this->runRequestStack(); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | 105 | |
| 106 | - /** |
|
| 107 | - * @throws ReflectionException |
|
| 108 | - * @throws EE_Error |
|
| 109 | - * @throws InvalidArgumentException |
|
| 110 | - * @throws InvalidDataTypeException |
|
| 111 | - * @throws InvalidInterfaceException |
|
| 112 | - * @throws OutOfBoundsException |
|
| 113 | - */ |
|
| 114 | - private function bootstrapDependencyInjectionContainer() |
|
| 115 | - { |
|
| 116 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
| 117 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
| 118 | - $bootstrap_di->buildLoader(); |
|
| 119 | - $registry = $bootstrap_di->getRegistry(); |
|
| 120 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
| 121 | - $dependency_map->initialize(); |
|
| 122 | - $registry->initialize(); |
|
| 123 | - $this->loader = $bootstrap_di->getLoader(); |
|
| 124 | - } |
|
| 106 | + /** |
|
| 107 | + * @throws ReflectionException |
|
| 108 | + * @throws EE_Error |
|
| 109 | + * @throws InvalidArgumentException |
|
| 110 | + * @throws InvalidDataTypeException |
|
| 111 | + * @throws InvalidInterfaceException |
|
| 112 | + * @throws OutOfBoundsException |
|
| 113 | + */ |
|
| 114 | + private function bootstrapDependencyInjectionContainer() |
|
| 115 | + { |
|
| 116 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
| 117 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
| 118 | + $bootstrap_di->buildLoader(); |
|
| 119 | + $registry = $bootstrap_di->getRegistry(); |
|
| 120 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
| 121 | + $dependency_map->initialize(); |
|
| 122 | + $registry->initialize(); |
|
| 123 | + $this->loader = $bootstrap_di->getLoader(); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * configures the Domain object for core |
|
| 129 | - * |
|
| 130 | - * @return void |
|
| 131 | - * @throws DomainException |
|
| 132 | - * @throws InvalidArgumentException |
|
| 133 | - * @throws InvalidDataTypeException |
|
| 134 | - * @throws InvalidClassException |
|
| 135 | - * @throws InvalidFilePathException |
|
| 136 | - * @throws InvalidInterfaceException |
|
| 137 | - */ |
|
| 138 | - private function bootstrapDomain() |
|
| 139 | - { |
|
| 140 | - DomainFactory::getEventEspressoCoreDomain(); |
|
| 141 | - } |
|
| 127 | + /** |
|
| 128 | + * configures the Domain object for core |
|
| 129 | + * |
|
| 130 | + * @return void |
|
| 131 | + * @throws DomainException |
|
| 132 | + * @throws InvalidArgumentException |
|
| 133 | + * @throws InvalidDataTypeException |
|
| 134 | + * @throws InvalidClassException |
|
| 135 | + * @throws InvalidFilePathException |
|
| 136 | + * @throws InvalidInterfaceException |
|
| 137 | + */ |
|
| 138 | + private function bootstrapDomain() |
|
| 139 | + { |
|
| 140 | + DomainFactory::getEventEspressoCoreDomain(); |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * sets up the request and response objects |
|
| 146 | - * |
|
| 147 | - * @return BootstrapRequestResponseObjects |
|
| 148 | - * @throws InvalidArgumentException |
|
| 149 | - */ |
|
| 150 | - private function bootstrapRequestResponseObjects(): BootstrapRequestResponseObjects |
|
| 151 | - { |
|
| 152 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
| 153 | - $bootstrap_request = $this->loader->getShared( |
|
| 154 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
| 155 | - [$this->loader] |
|
| 156 | - ); |
|
| 157 | - $bootstrap_request->buildRequestResponse(); |
|
| 158 | - $bootstrap_request->shareRequestResponse(); |
|
| 159 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
| 160 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
| 161 | - return $bootstrap_request; |
|
| 162 | - } |
|
| 144 | + /** |
|
| 145 | + * sets up the request and response objects |
|
| 146 | + * |
|
| 147 | + * @return BootstrapRequestResponseObjects |
|
| 148 | + * @throws InvalidArgumentException |
|
| 149 | + */ |
|
| 150 | + private function bootstrapRequestResponseObjects(): BootstrapRequestResponseObjects |
|
| 151 | + { |
|
| 152 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
| 153 | + $bootstrap_request = $this->loader->getShared( |
|
| 154 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
| 155 | + [$this->loader] |
|
| 156 | + ); |
|
| 157 | + $bootstrap_request->buildRequestResponse(); |
|
| 158 | + $bootstrap_request->shareRequestResponse(); |
|
| 159 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
| 160 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
| 161 | + return $bootstrap_request; |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | |
| 165 | - /** |
|
| 166 | - * run_request_stack |
|
| 167 | - * construct request stack and run middleware apps |
|
| 168 | - * |
|
| 169 | - * @throws EE_Error |
|
| 170 | - * @throws Exception |
|
| 171 | - * @throws Throwable |
|
| 172 | - */ |
|
| 173 | - public function runRequestStack() |
|
| 174 | - { |
|
| 175 | - $this->loadAutoloader(); |
|
| 176 | - $this->setAutoloadersForRequiredFiles(); |
|
| 177 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
| 178 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
| 179 | - new RequestStackCoreApp() |
|
| 180 | - ); |
|
| 181 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
| 182 | - $this->request_stack->handleResponse(); |
|
| 183 | - } |
|
| 165 | + /** |
|
| 166 | + * run_request_stack |
|
| 167 | + * construct request stack and run middleware apps |
|
| 168 | + * |
|
| 169 | + * @throws EE_Error |
|
| 170 | + * @throws Exception |
|
| 171 | + * @throws Throwable |
|
| 172 | + */ |
|
| 173 | + public function runRequestStack() |
|
| 174 | + { |
|
| 175 | + $this->loadAutoloader(); |
|
| 176 | + $this->setAutoloadersForRequiredFiles(); |
|
| 177 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
| 178 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
| 179 | + new RequestStackCoreApp() |
|
| 180 | + ); |
|
| 181 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
| 182 | + $this->request_stack->handleResponse(); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * load_autoloader |
|
| 188 | - * |
|
| 189 | - * @throws EE_Error |
|
| 190 | - */ |
|
| 191 | - protected function loadAutoloader() |
|
| 192 | - { |
|
| 193 | - // load interfaces |
|
| 194 | - espresso_load_required( |
|
| 195 | - 'EEH_Autoloader', |
|
| 196 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
| 197 | - ); |
|
| 198 | - EEH_Autoloader::instance(); |
|
| 199 | - } |
|
| 186 | + /** |
|
| 187 | + * load_autoloader |
|
| 188 | + * |
|
| 189 | + * @throws EE_Error |
|
| 190 | + */ |
|
| 191 | + protected function loadAutoloader() |
|
| 192 | + { |
|
| 193 | + // load interfaces |
|
| 194 | + espresso_load_required( |
|
| 195 | + 'EEH_Autoloader', |
|
| 196 | + EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
| 197 | + ); |
|
| 198 | + EEH_Autoloader::instance(); |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | 201 | |
| 202 | - /** |
|
| 203 | - * load_required_files |
|
| 204 | - * |
|
| 205 | - * @throws EE_Error |
|
| 206 | - */ |
|
| 207 | - protected function setAutoloadersForRequiredFiles() |
|
| 208 | - { |
|
| 209 | - // load interfaces |
|
| 210 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
| 211 | - // load helpers |
|
| 212 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
| 213 | - // register legacy request stack classes just in case |
|
| 214 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
| 215 | - // register legacy middleware classes just in case |
|
| 216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
| 217 | - } |
|
| 202 | + /** |
|
| 203 | + * load_required_files |
|
| 204 | + * |
|
| 205 | + * @throws EE_Error |
|
| 206 | + */ |
|
| 207 | + protected function setAutoloadersForRequiredFiles() |
|
| 208 | + { |
|
| 209 | + // load interfaces |
|
| 210 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
| 211 | + // load helpers |
|
| 212 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
| 213 | + // register legacy request stack classes just in case |
|
| 214 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
| 215 | + // register legacy middleware classes just in case |
|
| 216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * build_request_stack |
|
| 222 | - * |
|
| 223 | - * @return RequestStackBuilder |
|
| 224 | - */ |
|
| 225 | - public function buildRequestStack(): RequestStackBuilder |
|
| 226 | - { |
|
| 227 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
| 228 | - /** |
|
| 229 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
| 230 | - * so items at the beginning of the final middleware stack will run last. |
|
| 231 | - * First parameter is the middleware classname, second is an array of arguments |
|
| 232 | - */ |
|
| 233 | - $stack_apps = apply_filters( |
|
| 234 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
| 235 | - [ |
|
| 236 | - // first in last out |
|
| 237 | - BotDetector::class => [], |
|
| 238 | - DetectFileEditorRequest::class => [], |
|
| 239 | - PreProductionVersionWarning::class => [], |
|
| 240 | - RecommendedVersions::class => [], |
|
| 241 | - DetectLogin::class => [], |
|
| 242 | - // last in first out |
|
| 243 | - SkipRequests::class => [], |
|
| 244 | - ] |
|
| 245 | - ); |
|
| 246 | - // legacy filter for backwards compatibility |
|
| 247 | - $stack_apps = apply_filters( |
|
| 248 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
| 249 | - $stack_apps |
|
| 250 | - ); |
|
| 251 | - // load middleware onto stack : FILO (First In Last Out) |
|
| 252 | - // items at the beginning of the $stack_apps array will run last |
|
| 253 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
| 254 | - $request_stack_builder->push([$stack_app, $stack_app_args]); |
|
| 255 | - } |
|
| 256 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
| 257 | - // and we also need it to always run first because the rest of the system relies on it |
|
| 258 | - $request_stack_builder->push( |
|
| 259 | - [SetRequestTypeContextChecker::class, []] |
|
| 260 | - ); |
|
| 261 | - return apply_filters( |
|
| 262 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
| 263 | - $request_stack_builder |
|
| 264 | - ); |
|
| 265 | - } |
|
| 220 | + /** |
|
| 221 | + * build_request_stack |
|
| 222 | + * |
|
| 223 | + * @return RequestStackBuilder |
|
| 224 | + */ |
|
| 225 | + public function buildRequestStack(): RequestStackBuilder |
|
| 226 | + { |
|
| 227 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
| 228 | + /** |
|
| 229 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
| 230 | + * so items at the beginning of the final middleware stack will run last. |
|
| 231 | + * First parameter is the middleware classname, second is an array of arguments |
|
| 232 | + */ |
|
| 233 | + $stack_apps = apply_filters( |
|
| 234 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
| 235 | + [ |
|
| 236 | + // first in last out |
|
| 237 | + BotDetector::class => [], |
|
| 238 | + DetectFileEditorRequest::class => [], |
|
| 239 | + PreProductionVersionWarning::class => [], |
|
| 240 | + RecommendedVersions::class => [], |
|
| 241 | + DetectLogin::class => [], |
|
| 242 | + // last in first out |
|
| 243 | + SkipRequests::class => [], |
|
| 244 | + ] |
|
| 245 | + ); |
|
| 246 | + // legacy filter for backwards compatibility |
|
| 247 | + $stack_apps = apply_filters( |
|
| 248 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
| 249 | + $stack_apps |
|
| 250 | + ); |
|
| 251 | + // load middleware onto stack : FILO (First In Last Out) |
|
| 252 | + // items at the beginning of the $stack_apps array will run last |
|
| 253 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
| 254 | + $request_stack_builder->push([$stack_app, $stack_app_args]); |
|
| 255 | + } |
|
| 256 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
| 257 | + // and we also need it to always run first because the rest of the system relies on it |
|
| 258 | + $request_stack_builder->push( |
|
| 259 | + [SetRequestTypeContextChecker::class, []] |
|
| 260 | + ); |
|
| 261 | + return apply_filters( |
|
| 262 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
| 263 | + $request_stack_builder |
|
| 264 | + ); |
|
| 265 | + } |
|
| 266 | 266 | } |
@@ -129,8 +129,8 @@ discard block |
||
| 129 | 129 | array(), |
| 130 | 130 | CoffeeMaker::BREW_LOAD_ONLY, |
| 131 | 131 | array( |
| 132 | - EE_INTERFACES . '*.php', |
|
| 133 | - EE_INTERFACES . '*.interfaces.php', |
|
| 132 | + EE_INTERFACES.'*.php', |
|
| 133 | + EE_INTERFACES.'*.interfaces.php', |
|
| 134 | 134 | ) |
| 135 | 135 | ) |
| 136 | 136 | ); |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | array(), |
| 143 | 143 | array(), |
| 144 | 144 | CoffeeMaker::BREW_SHARED, |
| 145 | - EE_MODELS . '*.model.php' |
|
| 145 | + EE_MODELS.'*.model.php' |
|
| 146 | 146 | ) |
| 147 | 147 | ); |
| 148 | 148 | // add a wildcard recipe for loading core classes |
@@ -154,10 +154,10 @@ discard block |
||
| 154 | 154 | array(), |
| 155 | 155 | CoffeeMaker::BREW_SHARED, |
| 156 | 156 | array( |
| 157 | - EE_CORE . '*.core.php', |
|
| 158 | - EE_ADMIN . '*.core.php', |
|
| 159 | - EE_CPTS . '*.core.php', |
|
| 160 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
| 157 | + EE_CORE.'*.core.php', |
|
| 158 | + EE_ADMIN.'*.core.php', |
|
| 159 | + EE_CPTS.'*.core.php', |
|
| 160 | + EE_CORE.'data_migration_scripts/*.core.php', |
|
| 161 | 161 | ) |
| 162 | 162 | ) |
| 163 | 163 | ); |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | array(), |
| 170 | 170 | array(), |
| 171 | 171 | CoffeeMaker::BREW_LOAD_ONLY, |
| 172 | - array(EE_ADMIN . '*.core.php') |
|
| 172 | + array(EE_ADMIN.'*.core.php') |
|
| 173 | 173 | ) |
| 174 | 174 | ); |
| 175 | 175 | // add a wildcard recipe for loading core classes |
@@ -19,192 +19,192 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | class OpenCoffeeShop |
| 21 | 21 | { |
| 22 | - /** |
|
| 23 | - * @var CoffeeShop $CoffeeShop |
|
| 24 | - */ |
|
| 25 | - private $CoffeeShop; |
|
| 22 | + /** |
|
| 23 | + * @var CoffeeShop $CoffeeShop |
|
| 24 | + */ |
|
| 25 | + private $CoffeeShop; |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * OpenCoffeeShop constructor |
|
| 30 | - * |
|
| 31 | - * @throws InvalidInterfaceException |
|
| 32 | - */ |
|
| 33 | - public function __construct() |
|
| 34 | - { |
|
| 35 | - // instantiate the DI container |
|
| 36 | - $this->CoffeeShop = new CoffeeShop(); |
|
| 37 | - } |
|
| 28 | + /** |
|
| 29 | + * OpenCoffeeShop constructor |
|
| 30 | + * |
|
| 31 | + * @throws InvalidInterfaceException |
|
| 32 | + */ |
|
| 33 | + public function __construct() |
|
| 34 | + { |
|
| 35 | + // instantiate the DI container |
|
| 36 | + $this->CoffeeShop = new CoffeeShop(); |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | - // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 41 | - /** |
|
| 42 | - * @return CoffeeShop |
|
| 43 | - */ |
|
| 44 | - public function CoffeeShop() |
|
| 45 | - { |
|
| 46 | - return $this->CoffeeShop; |
|
| 47 | - } |
|
| 40 | + // phpcs:disable PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
|
| 41 | + /** |
|
| 42 | + * @return CoffeeShop |
|
| 43 | + */ |
|
| 44 | + public function CoffeeShop() |
|
| 45 | + { |
|
| 46 | + return $this->CoffeeShop; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * configure coffee makers which control the different kinds of brews |
|
| 52 | - * ( shared services, new factory objects, etc ) |
|
| 53 | - * |
|
| 54 | - * @throws InvalidEntityException |
|
| 55 | - */ |
|
| 56 | - public function setupCoffeeMakers() |
|
| 57 | - { |
|
| 58 | - // create a dependency injector class for resolving class constructor arguments |
|
| 59 | - $DependencyInjector = new DependencyInjector( |
|
| 60 | - $this->CoffeeShop, |
|
| 61 | - new \EEH_Array() |
|
| 62 | - ); |
|
| 63 | - // and some coffeemakers, one for creating new instances |
|
| 64 | - $this->CoffeeShop->addCoffeeMaker( |
|
| 65 | - new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 66 | - CoffeeMaker::BREW_NEW |
|
| 67 | - ); |
|
| 68 | - // one for shared services |
|
| 69 | - $this->CoffeeShop->addCoffeeMaker( |
|
| 70 | - new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 71 | - CoffeeMaker::BREW_SHARED |
|
| 72 | - ); |
|
| 73 | - // and one for classes that only get loaded |
|
| 74 | - $this->CoffeeShop->addCoffeeMaker( |
|
| 75 | - new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 76 | - CoffeeMaker::BREW_LOAD_ONLY |
|
| 77 | - ); |
|
| 78 | - } |
|
| 50 | + /** |
|
| 51 | + * configure coffee makers which control the different kinds of brews |
|
| 52 | + * ( shared services, new factory objects, etc ) |
|
| 53 | + * |
|
| 54 | + * @throws InvalidEntityException |
|
| 55 | + */ |
|
| 56 | + public function setupCoffeeMakers() |
|
| 57 | + { |
|
| 58 | + // create a dependency injector class for resolving class constructor arguments |
|
| 59 | + $DependencyInjector = new DependencyInjector( |
|
| 60 | + $this->CoffeeShop, |
|
| 61 | + new \EEH_Array() |
|
| 62 | + ); |
|
| 63 | + // and some coffeemakers, one for creating new instances |
|
| 64 | + $this->CoffeeShop->addCoffeeMaker( |
|
| 65 | + new NewCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 66 | + CoffeeMaker::BREW_NEW |
|
| 67 | + ); |
|
| 68 | + // one for shared services |
|
| 69 | + $this->CoffeeShop->addCoffeeMaker( |
|
| 70 | + new SharedCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 71 | + CoffeeMaker::BREW_SHARED |
|
| 72 | + ); |
|
| 73 | + // and one for classes that only get loaded |
|
| 74 | + $this->CoffeeShop->addCoffeeMaker( |
|
| 75 | + new LoadOnlyCoffeeMaker($this->CoffeeShop, $DependencyInjector), |
|
| 76 | + CoffeeMaker::BREW_LOAD_ONLY |
|
| 77 | + ); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | 80 | |
| 81 | - /** |
|
| 82 | - * Recipes define how to load legacy classes |
|
| 83 | - * |
|
| 84 | - * @throws InvalidIdentifierException |
|
| 85 | - */ |
|
| 86 | - public function addRecipes() |
|
| 87 | - { |
|
| 88 | - // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
| 89 | - // as long as they are not type hinting for interfaces |
|
| 90 | - $this->CoffeeShop->addRecipe( |
|
| 91 | - new Recipe( |
|
| 92 | - Recipe::DEFAULT_ID |
|
| 93 | - ) |
|
| 94 | - ); |
|
| 95 | - // PSR-4 compatible class with aliases |
|
| 96 | - $this->CoffeeShop->addRecipe( |
|
| 97 | - new Recipe( |
|
| 98 | - 'CommandHandlerManager', |
|
| 99 | - 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 100 | - array( |
|
| 101 | - 'CommandHandlerManagerInterface', |
|
| 102 | - 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 103 | - ), |
|
| 104 | - array(), |
|
| 105 | - CoffeeMaker::BREW_SHARED |
|
| 106 | - ) |
|
| 107 | - ); |
|
| 108 | - // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
| 109 | - $this->CoffeeShop->addRecipe( |
|
| 110 | - new Recipe( |
|
| 111 | - 'CommandBus', |
|
| 112 | - 'EventEspresso\core\services\commands\CommandBus', |
|
| 113 | - array( |
|
| 114 | - 'CommandBusInterface', |
|
| 115 | - 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 116 | - ), |
|
| 117 | - array(), |
|
| 118 | - CoffeeMaker::BREW_SHARED |
|
| 119 | - ) |
|
| 120 | - ); |
|
| 121 | - // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
| 122 | - // add a wildcard recipe for loading legacy core interfaces |
|
| 123 | - $this->CoffeeShop->addRecipe( |
|
| 124 | - new Recipe( |
|
| 125 | - 'EEI_*', |
|
| 126 | - '', |
|
| 127 | - array(), |
|
| 128 | - array(), |
|
| 129 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
| 130 | - array( |
|
| 131 | - EE_INTERFACES . '*.php', |
|
| 132 | - EE_INTERFACES . '*.interfaces.php', |
|
| 133 | - ) |
|
| 134 | - ) |
|
| 135 | - ); |
|
| 136 | - // add a wildcard recipe for loading models |
|
| 137 | - $this->CoffeeShop->addRecipe( |
|
| 138 | - new Recipe( |
|
| 139 | - 'EEM_*', |
|
| 140 | - '', |
|
| 141 | - array(), |
|
| 142 | - array(), |
|
| 143 | - CoffeeMaker::BREW_SHARED, |
|
| 144 | - EE_MODELS . '*.model.php' |
|
| 145 | - ) |
|
| 146 | - ); |
|
| 147 | - // add a wildcard recipe for loading core classes |
|
| 148 | - $this->CoffeeShop->addRecipe( |
|
| 149 | - new Recipe( |
|
| 150 | - 'EE_*', |
|
| 151 | - '', |
|
| 152 | - array(), |
|
| 153 | - array(), |
|
| 154 | - CoffeeMaker::BREW_SHARED, |
|
| 155 | - array( |
|
| 156 | - EE_CORE . '*.core.php', |
|
| 157 | - EE_ADMIN . '*.core.php', |
|
| 158 | - EE_CPTS . '*.core.php', |
|
| 159 | - EE_CORE . 'data_migration_scripts/*.core.php', |
|
| 160 | - ) |
|
| 161 | - ) |
|
| 162 | - ); |
|
| 163 | - // load admin page parent class |
|
| 164 | - $this->CoffeeShop->addRecipe( |
|
| 165 | - new Recipe( |
|
| 166 | - 'EE_Admin_Page*', |
|
| 167 | - '', |
|
| 168 | - array(), |
|
| 169 | - array(), |
|
| 170 | - CoffeeMaker::BREW_LOAD_ONLY, |
|
| 171 | - array(EE_ADMIN . '*.core.php') |
|
| 172 | - ) |
|
| 173 | - ); |
|
| 174 | - // add a wildcard recipe for loading core classes |
|
| 175 | - // $this->CoffeeShop->addRecipe( |
|
| 176 | - // new Recipe( |
|
| 177 | - // '*_Admin_Page', |
|
| 178 | - // '', |
|
| 179 | - // array(), |
|
| 180 | - // array(), |
|
| 181 | - // CoffeeMaker::BREW_SHARED, |
|
| 182 | - // array( |
|
| 183 | - // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
| 184 | - // ) |
|
| 185 | - // ) |
|
| 186 | - // ); |
|
| 187 | - } |
|
| 81 | + /** |
|
| 82 | + * Recipes define how to load legacy classes |
|
| 83 | + * |
|
| 84 | + * @throws InvalidIdentifierException |
|
| 85 | + */ |
|
| 86 | + public function addRecipes() |
|
| 87 | + { |
|
| 88 | + // add default recipe, which should handle loading for most PSR-4 compatible classes |
|
| 89 | + // as long as they are not type hinting for interfaces |
|
| 90 | + $this->CoffeeShop->addRecipe( |
|
| 91 | + new Recipe( |
|
| 92 | + Recipe::DEFAULT_ID |
|
| 93 | + ) |
|
| 94 | + ); |
|
| 95 | + // PSR-4 compatible class with aliases |
|
| 96 | + $this->CoffeeShop->addRecipe( |
|
| 97 | + new Recipe( |
|
| 98 | + 'CommandHandlerManager', |
|
| 99 | + 'EventEspresso\core\services\commands\CommandHandlerManager', |
|
| 100 | + array( |
|
| 101 | + 'CommandHandlerManagerInterface', |
|
| 102 | + 'EventEspresso\core\services\commands\CommandHandlerManagerInterface', |
|
| 103 | + ), |
|
| 104 | + array(), |
|
| 105 | + CoffeeMaker::BREW_SHARED |
|
| 106 | + ) |
|
| 107 | + ); |
|
| 108 | + // PSR-4 compatible class with aliases, which dependency on CommandHandlerManager |
|
| 109 | + $this->CoffeeShop->addRecipe( |
|
| 110 | + new Recipe( |
|
| 111 | + 'CommandBus', |
|
| 112 | + 'EventEspresso\core\services\commands\CommandBus', |
|
| 113 | + array( |
|
| 114 | + 'CommandBusInterface', |
|
| 115 | + 'EventEspresso\core\services\commands\CommandBusInterface', |
|
| 116 | + ), |
|
| 117 | + array(), |
|
| 118 | + CoffeeMaker::BREW_SHARED |
|
| 119 | + ) |
|
| 120 | + ); |
|
| 121 | + // LEGACY classes that are NOT compatible with PSR-4 autoloading, and so must specify a filepath |
|
| 122 | + // add a wildcard recipe for loading legacy core interfaces |
|
| 123 | + $this->CoffeeShop->addRecipe( |
|
| 124 | + new Recipe( |
|
| 125 | + 'EEI_*', |
|
| 126 | + '', |
|
| 127 | + array(), |
|
| 128 | + array(), |
|
| 129 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
| 130 | + array( |
|
| 131 | + EE_INTERFACES . '*.php', |
|
| 132 | + EE_INTERFACES . '*.interfaces.php', |
|
| 133 | + ) |
|
| 134 | + ) |
|
| 135 | + ); |
|
| 136 | + // add a wildcard recipe for loading models |
|
| 137 | + $this->CoffeeShop->addRecipe( |
|
| 138 | + new Recipe( |
|
| 139 | + 'EEM_*', |
|
| 140 | + '', |
|
| 141 | + array(), |
|
| 142 | + array(), |
|
| 143 | + CoffeeMaker::BREW_SHARED, |
|
| 144 | + EE_MODELS . '*.model.php' |
|
| 145 | + ) |
|
| 146 | + ); |
|
| 147 | + // add a wildcard recipe for loading core classes |
|
| 148 | + $this->CoffeeShop->addRecipe( |
|
| 149 | + new Recipe( |
|
| 150 | + 'EE_*', |
|
| 151 | + '', |
|
| 152 | + array(), |
|
| 153 | + array(), |
|
| 154 | + CoffeeMaker::BREW_SHARED, |
|
| 155 | + array( |
|
| 156 | + EE_CORE . '*.core.php', |
|
| 157 | + EE_ADMIN . '*.core.php', |
|
| 158 | + EE_CPTS . '*.core.php', |
|
| 159 | + EE_CORE . 'data_migration_scripts/*.core.php', |
|
| 160 | + ) |
|
| 161 | + ) |
|
| 162 | + ); |
|
| 163 | + // load admin page parent class |
|
| 164 | + $this->CoffeeShop->addRecipe( |
|
| 165 | + new Recipe( |
|
| 166 | + 'EE_Admin_Page*', |
|
| 167 | + '', |
|
| 168 | + array(), |
|
| 169 | + array(), |
|
| 170 | + CoffeeMaker::BREW_LOAD_ONLY, |
|
| 171 | + array(EE_ADMIN . '*.core.php') |
|
| 172 | + ) |
|
| 173 | + ); |
|
| 174 | + // add a wildcard recipe for loading core classes |
|
| 175 | + // $this->CoffeeShop->addRecipe( |
|
| 176 | + // new Recipe( |
|
| 177 | + // '*_Admin_Page', |
|
| 178 | + // '', |
|
| 179 | + // array(), |
|
| 180 | + // array(), |
|
| 181 | + // CoffeeMaker::BREW_SHARED, |
|
| 182 | + // array( |
|
| 183 | + // EE_ADMIN_PAGES . 'transactions/*.core.php', |
|
| 184 | + // ) |
|
| 185 | + // ) |
|
| 186 | + // ); |
|
| 187 | + } |
|
| 188 | 188 | |
| 189 | 189 | |
| 190 | - /** |
|
| 191 | - * bootstrap EE and the request stack |
|
| 192 | - * |
|
| 193 | - * @throws ServiceNotFoundException |
|
| 194 | - * @throws InvalidClassException |
|
| 195 | - * @throws InvalidDataTypeException |
|
| 196 | - * @throws InvalidIdentifierException |
|
| 197 | - * @throws exceptions\ServiceExistsException |
|
| 198 | - * @throws OutOfBoundsException |
|
| 199 | - * @throws exceptions\InstantiationException |
|
| 200 | - */ |
|
| 201 | - public function firstBrew() |
|
| 202 | - { |
|
| 203 | - $this->CoffeeShop->brew( |
|
| 204 | - 'EventEspresso\core\services\request\Request', |
|
| 205 | - array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
| 206 | - ); |
|
| 207 | - $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
| 208 | - $this->CoffeeShop->brew('EE_Bootstrap'); |
|
| 209 | - } |
|
| 190 | + /** |
|
| 191 | + * bootstrap EE and the request stack |
|
| 192 | + * |
|
| 193 | + * @throws ServiceNotFoundException |
|
| 194 | + * @throws InvalidClassException |
|
| 195 | + * @throws InvalidDataTypeException |
|
| 196 | + * @throws InvalidIdentifierException |
|
| 197 | + * @throws exceptions\ServiceExistsException |
|
| 198 | + * @throws OutOfBoundsException |
|
| 199 | + * @throws exceptions\InstantiationException |
|
| 200 | + */ |
|
| 201 | + public function firstBrew() |
|
| 202 | + { |
|
| 203 | + $this->CoffeeShop->brew( |
|
| 204 | + 'EventEspresso\core\services\request\Request', |
|
| 205 | + array($_GET, $_POST, $_COOKIE, $_SERVER) |
|
| 206 | + ); |
|
| 207 | + $this->CoffeeShop->brew('EventEspresso\core\services\request\Response'); |
|
| 208 | + $this->CoffeeShop->brew('EE_Bootstrap'); |
|
| 209 | + } |
|
| 210 | 210 | } |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
| 27 | 27 | wp_enqueue_style( |
| 28 | 28 | 'ee_progress_steps_display_number_bubbles', |
| 29 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
| 29 | + plugin_dir_url(__FILE__).'number_bubbles.css' |
|
| 30 | 30 | ); |
| 31 | 31 | } |
| 32 | 32 | |
@@ -39,6 +39,6 @@ discard block |
||
| 39 | 39 | public function getTemplate() |
| 40 | 40 | { |
| 41 | 41 | // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
| 42 | - return __DIR__ . '/number_bubbles.template.php'; |
|
| 42 | + return __DIR__.'/number_bubbles.template.php'; |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -14,29 +14,29 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class NumberBubblesProgressStepsDisplay implements ProgressStepsDisplayInterface |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * used for setting up css and js required for the display strategy |
|
| 19 | - * |
|
| 20 | - * @return void |
|
| 21 | - */ |
|
| 22 | - public function enqueueStylesAndScripts() |
|
| 23 | - { |
|
| 24 | - // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
| 25 | - wp_enqueue_style( |
|
| 26 | - 'ee_progress_steps_display_number_bubbles', |
|
| 27 | - plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
| 28 | - ); |
|
| 29 | - } |
|
| 17 | + /** |
|
| 18 | + * used for setting up css and js required for the display strategy |
|
| 19 | + * |
|
| 20 | + * @return void |
|
| 21 | + */ |
|
| 22 | + public function enqueueStylesAndScripts() |
|
| 23 | + { |
|
| 24 | + // core/services/progress_steps/display_strategies/number_bubbles/number_bubbles.css |
|
| 25 | + wp_enqueue_style( |
|
| 26 | + 'ee_progress_steps_display_number_bubbles', |
|
| 27 | + plugin_dir_url(__FILE__) . 'number_bubbles.css' |
|
| 28 | + ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * loads and returns a full server path to the template used for the display strategy |
|
| 34 | - * |
|
| 35 | - * @return string |
|
| 36 | - */ |
|
| 37 | - public function getTemplate() |
|
| 38 | - { |
|
| 39 | - // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
| 40 | - return __DIR__ . '/number_bubbles.template.php'; |
|
| 41 | - } |
|
| 32 | + /** |
|
| 33 | + * loads and returns a full server path to the template used for the display strategy |
|
| 34 | + * |
|
| 35 | + * @return string |
|
| 36 | + */ |
|
| 37 | + public function getTemplate() |
|
| 38 | + { |
|
| 39 | + // return plugin_dir_path( __FILE__ ) . 'number_bubbles.template.php'; |
|
| 40 | + return __DIR__ . '/number_bubbles.template.php'; |
|
| 41 | + } |
|
| 42 | 42 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | // first get registrations just for this attendee. |
| 81 | 81 | $att = $data->att_obj; |
| 82 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 82 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
| 83 | 83 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
| 84 | 84 | ? array($data->reg_obj) : $registrations_on_attendee; |
| 85 | 85 | $tkts = array(); |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | // tickets will be tickets for all registrations on this attendee. |
| 102 | 102 | foreach ($registrations_on_attendee as $reg) { |
| 103 | 103 | if ($reg instanceof EE_Registration) { |
| 104 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 105 | - $data->registrations[ $reg->ID() ] |
|
| 106 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 107 | - ) ]['tkt_obj'] : null; |
|
| 104 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 105 | + $data->registrations[$reg->ID()] |
|
| 106 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 107 | + )]['tkt_obj'] : null; |
|
| 108 | 108 | if ($ticket instanceof EE_Ticket) { |
| 109 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 109 | + $tkts[$ticket->ID()] = $ticket; |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -123,12 +123,12 @@ discard block |
||
| 123 | 123 | // data will be tickets for this event for this recipient. |
| 124 | 124 | foreach ($registrations_on_attendee as $reg) { |
| 125 | 125 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
| 126 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 127 | - $data->registrations[ $reg->ID() ] |
|
| 128 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 129 | - ) ]['tkt_obj'] : null; |
|
| 126 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 127 | + $data->registrations[$reg->ID()] |
|
| 128 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 129 | + )]['tkt_obj'] : null; |
|
| 130 | 130 | if ($ticket instanceof EE_Ticket) { |
| 131 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 131 | + $tkts[$ticket->ID()] = $ticket; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | // first get registrations just for this attendee. |
| 172 | 172 | $att = $data->att_obj; |
| 173 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 173 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[$att->ID()]['reg_objs'] : array(); |
|
| 174 | 174 | $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
| 175 | 175 | ? array($data->reg_obj) |
| 176 | 176 | : $registrations_on_attendee; |
@@ -185,14 +185,14 @@ discard block |
||
| 185 | 185 | // dtts will be datetimes for all registrations on this attendee |
| 186 | 186 | foreach ($registrations_on_attendee as $reg) { |
| 187 | 187 | if ($reg instanceof EE_Registration) { |
| 188 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 189 | - $data->registrations[ $reg->ID() ] |
|
| 190 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 191 | - ) ]['dtt_objs'] : array(); |
|
| 188 | + $dtt_objs = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 189 | + $data->registrations[$reg->ID()] |
|
| 190 | + ) && isset($data->registrations[$reg->ID()]['dtt_objs']) ? $data->registrations[$reg->ID( |
|
| 191 | + )]['dtt_objs'] : array(); |
|
| 192 | 192 | $dtt_objs = (array) $dtt_objs; |
| 193 | 193 | foreach ($dtt_objs as $dtt_obj) { |
| 194 | 194 | if ($dtt_obj instanceof EE_Datetime) { |
| 195 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 195 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,19 +208,19 @@ discard block |
||
| 208 | 208 | // data will be datetimes for this event for this recipient |
| 209 | 209 | foreach ($registrations_on_attendee as $reg) { |
| 210 | 210 | if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
| 211 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 212 | - $data->registrations[ $reg->ID() ] |
|
| 213 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 214 | - ) ]['tkt_obj'] : null; |
|
| 211 | + $ticket = isset($data->registrations[$reg->ID()]) && is_array( |
|
| 212 | + $data->registrations[$reg->ID()] |
|
| 213 | + ) && isset($data->registrations[$reg->ID()]['tkt_obj']) ? $data->registrations[$reg->ID( |
|
| 214 | + )]['tkt_obj'] : null; |
|
| 215 | 215 | if ($ticket instanceof EE_Ticket) { |
| 216 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 217 | - $data->tickets[ $ticket->ID() ] |
|
| 218 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 219 | - ) ]['dtt_objs'] : array(); |
|
| 216 | + $dtt_objs = isset($data->tickets[$ticket->ID()]) && is_array( |
|
| 217 | + $data->tickets[$ticket->ID()] |
|
| 218 | + ) && isset($data->tickets[$ticket->ID()]['dtt_objs']) ? $data->tickets[$ticket->ID( |
|
| 219 | + )]['dtt_objs'] : array(); |
|
| 220 | 220 | $dtt_objs = (array) $dtt_objs; |
| 221 | 221 | foreach ($dtt_objs as $dtt_obj) { |
| 222 | 222 | if ($dtt_obj instanceof EE_Datetime) { |
| 223 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 223 | + $dtts[$dtt_obj->ID()] = $dtt_obj; |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | } |
@@ -18,223 +18,223 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class EE_Recipient_List_Shortcodes extends EE_Shortcodes |
| 20 | 20 | { |
| 21 | - public function __construct() |
|
| 22 | - { |
|
| 23 | - parent::__construct(); |
|
| 24 | - } |
|
| 25 | - |
|
| 26 | - |
|
| 27 | - protected function _init_props() |
|
| 28 | - { |
|
| 29 | - $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
| 30 | - $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
| 31 | - $this->_shortcodes = array( |
|
| 32 | - '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
| 33 | - 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
| 34 | - 'event_espresso' |
|
| 35 | - ), |
|
| 36 | - '[RECIPIENT_DATETIME_LIST]' => esc_html__( |
|
| 37 | - 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
| 38 | - 'event_espresso' |
|
| 39 | - ), |
|
| 40 | - ); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - protected function _parser($shortcode) |
|
| 45 | - { |
|
| 46 | - switch ($shortcode) { |
|
| 47 | - case '[RECIPIENT_TICKET_LIST]': |
|
| 48 | - return $this->_get_recipient_ticket_list(); |
|
| 49 | - |
|
| 50 | - case '[RECIPIENT_DATETIME_LIST]': |
|
| 51 | - return $this->_get_recipient_datetime_list(); |
|
| 52 | - } |
|
| 53 | - return ''; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - |
|
| 57 | - /** |
|
| 58 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
| 59 | - * |
|
| 60 | - * @return string |
|
| 61 | - */ |
|
| 62 | - private function _get_recipient_ticket_list() |
|
| 63 | - { |
|
| 64 | - $this->_validate_list_requirements(); |
|
| 65 | - |
|
| 66 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 67 | - return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
| 68 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 69 | - return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
| 70 | - } else { |
|
| 71 | - return ''; |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - |
|
| 76 | - private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
| 77 | - { |
|
| 78 | - // first get registrations just for this attendee. |
|
| 79 | - $att = $data->att_obj; |
|
| 80 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 81 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 82 | - ? array($data->reg_obj) : $registrations_on_attendee; |
|
| 83 | - $tkts = array(); |
|
| 84 | - |
|
| 85 | - // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
| 86 | - // which means we want to get tickets for all events this addressee is a part of. |
|
| 87 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 88 | - $valid_shortcodes = array( |
|
| 89 | - 'ticket', |
|
| 90 | - 'event_list', |
|
| 91 | - 'attendee_list', |
|
| 92 | - 'datetime_list', |
|
| 93 | - 'registration_details', |
|
| 94 | - 'attendee', |
|
| 95 | - 'recipient_details', |
|
| 96 | - ); |
|
| 97 | - $template = $this->_data['template']; |
|
| 98 | - |
|
| 99 | - // tickets will be tickets for all registrations on this attendee. |
|
| 100 | - foreach ($registrations_on_attendee as $reg) { |
|
| 101 | - if ($reg instanceof EE_Registration) { |
|
| 102 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 103 | - $data->registrations[ $reg->ID() ] |
|
| 104 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 105 | - ) ]['tkt_obj'] : null; |
|
| 106 | - if ($ticket instanceof EE_Ticket) { |
|
| 107 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - } |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
| 114 | - $event = $this->_data['data']; |
|
| 115 | - if ($event instanceof EE_Event) { |
|
| 116 | - $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
| 117 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
| 118 | - ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 119 | - // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
| 120 | - $template = str_replace('[EVENT_LIST]', '', $template); |
|
| 121 | - // data will be tickets for this event for this recipient. |
|
| 122 | - foreach ($registrations_on_attendee as $reg) { |
|
| 123 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 124 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 125 | - $data->registrations[ $reg->ID() ] |
|
| 126 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 127 | - ) ]['tkt_obj'] : null; |
|
| 128 | - if ($ticket instanceof EE_Ticket) { |
|
| 129 | - $tkts[ $ticket->ID() ] = $ticket; |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - $tkt_parsed = ''; |
|
| 136 | - foreach ($tkts as $ticket) { |
|
| 137 | - $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
| 138 | - $template, |
|
| 139 | - $ticket, |
|
| 140 | - $valid_shortcodes, |
|
| 141 | - $this->_extra_data |
|
| 142 | - ); |
|
| 143 | - } |
|
| 144 | - return $tkt_parsed; |
|
| 145 | - } |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * figure out what the incoming data is and then return the appropriate parsed value |
|
| 150 | - * |
|
| 151 | - * @return string |
|
| 152 | - */ |
|
| 153 | - private function _get_recipient_datetime_list() |
|
| 154 | - { |
|
| 155 | - $this->_validate_list_requirements(); |
|
| 156 | - |
|
| 157 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 158 | - return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
| 159 | - } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 160 | - return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
| 161 | - } else { |
|
| 162 | - return ''; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - |
|
| 167 | - private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
| 168 | - { |
|
| 169 | - // first get registrations just for this attendee. |
|
| 170 | - $att = $data->att_obj; |
|
| 171 | - $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 172 | - $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 173 | - ? array($data->reg_obj) |
|
| 174 | - : $registrations_on_attendee; |
|
| 175 | - $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
| 176 | - $template = ''; |
|
| 177 | - $dtts = array(); |
|
| 178 | - |
|
| 179 | - // setup valid shortcodes depending on what the status of the $this->_data property is |
|
| 180 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 181 | - $template = $this->_data['template']; |
|
| 182 | - |
|
| 183 | - // dtts will be datetimes for all registrations on this attendee |
|
| 184 | - foreach ($registrations_on_attendee as $reg) { |
|
| 185 | - if ($reg instanceof EE_Registration) { |
|
| 186 | - $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 187 | - $data->registrations[ $reg->ID() ] |
|
| 188 | - ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 189 | - ) ]['dtt_objs'] : array(); |
|
| 190 | - $dtt_objs = (array) $dtt_objs; |
|
| 191 | - foreach ($dtt_objs as $dtt_obj) { |
|
| 192 | - if ($dtt_obj instanceof EE_Datetime) { |
|
| 193 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - |
|
| 200 | - // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
| 201 | - $event = $this->_data['data']; |
|
| 202 | - if ($event instanceof EE_Event) { |
|
| 203 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
| 204 | - ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 205 | - |
|
| 206 | - // data will be datetimes for this event for this recipient |
|
| 207 | - foreach ($registrations_on_attendee as $reg) { |
|
| 208 | - if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 209 | - $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 210 | - $data->registrations[ $reg->ID() ] |
|
| 211 | - ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 212 | - ) ]['tkt_obj'] : null; |
|
| 213 | - if ($ticket instanceof EE_Ticket) { |
|
| 214 | - $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 215 | - $data->tickets[ $ticket->ID() ] |
|
| 216 | - ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 217 | - ) ]['dtt_objs'] : array(); |
|
| 218 | - $dtt_objs = (array) $dtt_objs; |
|
| 219 | - foreach ($dtt_objs as $dtt_obj) { |
|
| 220 | - if ($dtt_obj instanceof EE_Datetime) { |
|
| 221 | - $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 222 | - } |
|
| 223 | - } |
|
| 224 | - } |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - } |
|
| 228 | - |
|
| 229 | - $dtt_parsed = ''; |
|
| 230 | - foreach ($dtts as $datetime) { |
|
| 231 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
| 232 | - $template, |
|
| 233 | - $datetime, |
|
| 234 | - $valid_shortcodes, |
|
| 235 | - $this->_extra_data |
|
| 236 | - ); |
|
| 237 | - } |
|
| 238 | - return $dtt_parsed; |
|
| 239 | - } |
|
| 21 | + public function __construct() |
|
| 22 | + { |
|
| 23 | + parent::__construct(); |
|
| 24 | + } |
|
| 25 | + |
|
| 26 | + |
|
| 27 | + protected function _init_props() |
|
| 28 | + { |
|
| 29 | + $this->label = esc_html__('Recipient List Shortcodes', 'event_espresso'); |
|
| 30 | + $this->description = esc_html__('All shortcodes specific to registrant recipients list type data.', 'event_espresso'); |
|
| 31 | + $this->_shortcodes = array( |
|
| 32 | + '[RECIPIENT_TICKET_LIST]' => esc_html__( |
|
| 33 | + 'Will output a list of tickets for the recipient of the email. Note, if the recipient is the Event Author, then this is blank.', |
|
| 34 | + 'event_espresso' |
|
| 35 | + ), |
|
| 36 | + '[RECIPIENT_DATETIME_LIST]' => esc_html__( |
|
| 37 | + 'Will output a list of datetimes that the person receiving this message has been registered for.', |
|
| 38 | + 'event_espresso' |
|
| 39 | + ), |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + protected function _parser($shortcode) |
|
| 45 | + { |
|
| 46 | + switch ($shortcode) { |
|
| 47 | + case '[RECIPIENT_TICKET_LIST]': |
|
| 48 | + return $this->_get_recipient_ticket_list(); |
|
| 49 | + |
|
| 50 | + case '[RECIPIENT_DATETIME_LIST]': |
|
| 51 | + return $this->_get_recipient_datetime_list(); |
|
| 52 | + } |
|
| 53 | + return ''; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
| 59 | + * |
|
| 60 | + * @return string |
|
| 61 | + */ |
|
| 62 | + private function _get_recipient_ticket_list() |
|
| 63 | + { |
|
| 64 | + $this->_validate_list_requirements(); |
|
| 65 | + |
|
| 66 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 67 | + return $this->_get_recipient_ticket_list_parsed($this->_data['data']); |
|
| 68 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 69 | + return $this->_get_recipient_ticket_list_parsed($this->_extra_data['data']); |
|
| 70 | + } else { |
|
| 71 | + return ''; |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + |
|
| 76 | + private function _get_recipient_ticket_list_parsed(EE_Messages_Addressee $data) |
|
| 77 | + { |
|
| 78 | + // first get registrations just for this attendee. |
|
| 79 | + $att = $data->att_obj; |
|
| 80 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 81 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 82 | + ? array($data->reg_obj) : $registrations_on_attendee; |
|
| 83 | + $tkts = array(); |
|
| 84 | + |
|
| 85 | + // if we're coming in from the main content then $this->_data['data'] is instanceof EE_Messages_Addressee. |
|
| 86 | + // which means we want to get tickets for all events this addressee is a part of. |
|
| 87 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 88 | + $valid_shortcodes = array( |
|
| 89 | + 'ticket', |
|
| 90 | + 'event_list', |
|
| 91 | + 'attendee_list', |
|
| 92 | + 'datetime_list', |
|
| 93 | + 'registration_details', |
|
| 94 | + 'attendee', |
|
| 95 | + 'recipient_details', |
|
| 96 | + ); |
|
| 97 | + $template = $this->_data['template']; |
|
| 98 | + |
|
| 99 | + // tickets will be tickets for all registrations on this attendee. |
|
| 100 | + foreach ($registrations_on_attendee as $reg) { |
|
| 101 | + if ($reg instanceof EE_Registration) { |
|
| 102 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 103 | + $data->registrations[ $reg->ID() ] |
|
| 104 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 105 | + ) ]['tkt_obj'] : null; |
|
| 106 | + if ($ticket instanceof EE_Ticket) { |
|
| 107 | + $tkts[ $ticket->ID() ] = $ticket; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + // if coming from the context of the event list parser, then let's return just the tickets for that event. |
|
| 114 | + $event = $this->_data['data']; |
|
| 115 | + if ($event instanceof EE_Event) { |
|
| 116 | + $valid_shortcodes = array('ticket', 'attendee_list', 'datetime_list', 'attendee', 'recipient_details'); |
|
| 117 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['ticket_list']) |
|
| 118 | + ? $this->_data['template']['ticket_list'] : $this->_extra_data['template']['ticket_list']; |
|
| 119 | + // let's remove any existing [EVENT_LIST] shortcode from the ticket list template so that we don't get recursion. |
|
| 120 | + $template = str_replace('[EVENT_LIST]', '', $template); |
|
| 121 | + // data will be tickets for this event for this recipient. |
|
| 122 | + foreach ($registrations_on_attendee as $reg) { |
|
| 123 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 124 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 125 | + $data->registrations[ $reg->ID() ] |
|
| 126 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 127 | + ) ]['tkt_obj'] : null; |
|
| 128 | + if ($ticket instanceof EE_Ticket) { |
|
| 129 | + $tkts[ $ticket->ID() ] = $ticket; |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + $tkt_parsed = ''; |
|
| 136 | + foreach ($tkts as $ticket) { |
|
| 137 | + $tkt_parsed .= $this->_shortcode_helper->parse_ticket_list_template( |
|
| 138 | + $template, |
|
| 139 | + $ticket, |
|
| 140 | + $valid_shortcodes, |
|
| 141 | + $this->_extra_data |
|
| 142 | + ); |
|
| 143 | + } |
|
| 144 | + return $tkt_parsed; |
|
| 145 | + } |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * figure out what the incoming data is and then return the appropriate parsed value |
|
| 150 | + * |
|
| 151 | + * @return string |
|
| 152 | + */ |
|
| 153 | + private function _get_recipient_datetime_list() |
|
| 154 | + { |
|
| 155 | + $this->_validate_list_requirements(); |
|
| 156 | + |
|
| 157 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 158 | + return $this->_get_recipient_datetime_list_parsed($this->_data['data']); |
|
| 159 | + } elseif ($this->_extra_data['data'] instanceof EE_Messages_Addressee) { |
|
| 160 | + return $this->_get_recipient_datetime_list_parsed($this->_extra_data['data']); |
|
| 161 | + } else { |
|
| 162 | + return ''; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + |
|
| 167 | + private function _get_recipient_datetime_list_parsed(EE_Messages_Addressee $data) |
|
| 168 | + { |
|
| 169 | + // first get registrations just for this attendee. |
|
| 170 | + $att = $data->att_obj; |
|
| 171 | + $registrations_on_attendee = $att instanceof EE_Attendee ? $data->attendees[ $att->ID() ]['reg_objs'] : array(); |
|
| 172 | + $registrations_on_attendee = empty($registrations_on_attendee) && $data->reg_obj instanceof EE_Registration |
|
| 173 | + ? array($data->reg_obj) |
|
| 174 | + : $registrations_on_attendee; |
|
| 175 | + $valid_shortcodes = array('datetime', 'attendee', 'recipient_details'); |
|
| 176 | + $template = ''; |
|
| 177 | + $dtts = array(); |
|
| 178 | + |
|
| 179 | + // setup valid shortcodes depending on what the status of the $this->_data property is |
|
| 180 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
| 181 | + $template = $this->_data['template']; |
|
| 182 | + |
|
| 183 | + // dtts will be datetimes for all registrations on this attendee |
|
| 184 | + foreach ($registrations_on_attendee as $reg) { |
|
| 185 | + if ($reg instanceof EE_Registration) { |
|
| 186 | + $dtt_objs = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 187 | + $data->registrations[ $reg->ID() ] |
|
| 188 | + ) && isset($data->registrations[ $reg->ID() ]['dtt_objs']) ? $data->registrations[ $reg->ID( |
|
| 189 | + ) ]['dtt_objs'] : array(); |
|
| 190 | + $dtt_objs = (array) $dtt_objs; |
|
| 191 | + foreach ($dtt_objs as $dtt_obj) { |
|
| 192 | + if ($dtt_obj instanceof EE_Datetime) { |
|
| 193 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + |
|
| 200 | + // if coming from the context of the event list parser, then let's just return the datetimes for the specific event. |
|
| 201 | + $event = $this->_data['data']; |
|
| 202 | + if ($event instanceof EE_Event) { |
|
| 203 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
| 204 | + ? $this->_data['template']['datetime_list'] : $this->_extra_data['template']['datetime_list']; |
|
| 205 | + |
|
| 206 | + // data will be datetimes for this event for this recipient |
|
| 207 | + foreach ($registrations_on_attendee as $reg) { |
|
| 208 | + if ($reg instanceof EE_Registration && $reg->event_ID() == $event->ID()) { |
|
| 209 | + $ticket = isset($data->registrations[ $reg->ID() ]) && is_array( |
|
| 210 | + $data->registrations[ $reg->ID() ] |
|
| 211 | + ) && isset($data->registrations[ $reg->ID() ]['tkt_obj']) ? $data->registrations[ $reg->ID( |
|
| 212 | + ) ]['tkt_obj'] : null; |
|
| 213 | + if ($ticket instanceof EE_Ticket) { |
|
| 214 | + $dtt_objs = isset($data->tickets[ $ticket->ID() ]) && is_array( |
|
| 215 | + $data->tickets[ $ticket->ID() ] |
|
| 216 | + ) && isset($data->tickets[ $ticket->ID() ]['dtt_objs']) ? $data->tickets[ $ticket->ID( |
|
| 217 | + ) ]['dtt_objs'] : array(); |
|
| 218 | + $dtt_objs = (array) $dtt_objs; |
|
| 219 | + foreach ($dtt_objs as $dtt_obj) { |
|
| 220 | + if ($dtt_obj instanceof EE_Datetime) { |
|
| 221 | + $dtts[ $dtt_obj->ID() ] = $dtt_obj; |
|
| 222 | + } |
|
| 223 | + } |
|
| 224 | + } |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + } |
|
| 228 | + |
|
| 229 | + $dtt_parsed = ''; |
|
| 230 | + foreach ($dtts as $datetime) { |
|
| 231 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
| 232 | + $template, |
|
| 233 | + $datetime, |
|
| 234 | + $valid_shortcodes, |
|
| 235 | + $this->_extra_data |
|
| 236 | + ); |
|
| 237 | + } |
|
| 238 | + return $dtt_parsed; |
|
| 239 | + } |
|
| 240 | 240 | } |