@@ -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(); |
@@ -11,50 +11,50 @@ |
||
11 | 11 | */ |
12 | 12 | class Registrations_Admin_Page_Init extends EE_Admin_Page_CPT_Init |
13 | 13 | { |
14 | - /** |
|
15 | - * constructor |
|
16 | - * |
|
17 | - * @Constructor |
|
18 | - * @access public |
|
19 | - * @return void |
|
20 | - */ |
|
21 | - public function __construct() |
|
22 | - { |
|
23 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
24 | - if (! defined('REG_PG_SLUG')) { |
|
25 | - define('REG_PG_SLUG', 'espresso_registrations'); |
|
26 | - define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
27 | - define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
28 | - define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
29 | - define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
30 | - define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
31 | - define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
32 | - define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
33 | - } |
|
14 | + /** |
|
15 | + * constructor |
|
16 | + * |
|
17 | + * @Constructor |
|
18 | + * @access public |
|
19 | + * @return void |
|
20 | + */ |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
24 | + if (! defined('REG_PG_SLUG')) { |
|
25 | + define('REG_PG_SLUG', 'espresso_registrations'); |
|
26 | + define('REG_PG_NAME', ucwords(str_replace('_', '', REG_PG_SLUG))); |
|
27 | + define('REG_ADMIN', EE_ADMIN_PAGES . 'registrations/'); |
|
28 | + define('REG_ADMIN_URL', admin_url('admin.php?page=' . REG_PG_SLUG)); |
|
29 | + define('REG_ASSETS_PATH', REG_ADMIN . 'assets/'); |
|
30 | + define('REG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registrations/assets/'); |
|
31 | + define('REG_TEMPLATE_PATH', REG_ADMIN . 'templates/'); |
|
32 | + define('REG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registrations/templates/'); |
|
33 | + } |
|
34 | 34 | |
35 | - parent::__construct(); |
|
36 | - } |
|
35 | + parent::__construct(); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - protected function _set_init_properties() |
|
40 | - { |
|
41 | - $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
42 | - } |
|
39 | + protected function _set_init_properties() |
|
40 | + { |
|
41 | + $this->label = esc_html__('Registrations Overview', 'event_espresso'); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | |
45 | - protected function _set_menu_map() |
|
46 | - { |
|
47 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
48 | - array( |
|
49 | - 'menu_group' => 'main', |
|
50 | - 'menu_order' => 40, |
|
51 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
52 | - 'parent_slug' => 'espresso_events', |
|
53 | - 'menu_slug' => REG_PG_SLUG, |
|
54 | - 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
55 | - 'capability' => 'ee_read_registrations', |
|
56 | - 'admin_init_page' => $this, |
|
57 | - ) |
|
58 | - ); |
|
59 | - } |
|
45 | + protected function _set_menu_map() |
|
46 | + { |
|
47 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
48 | + array( |
|
49 | + 'menu_group' => 'main', |
|
50 | + 'menu_order' => 40, |
|
51 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
52 | + 'parent_slug' => 'espresso_events', |
|
53 | + 'menu_slug' => REG_PG_SLUG, |
|
54 | + 'menu_label' => esc_html__('Registrations', 'event_espresso'), |
|
55 | + 'capability' => 'ee_read_registrations', |
|
56 | + 'admin_init_page' => $this, |
|
57 | + ) |
|
58 | + ); |
|
59 | + } |
|
60 | 60 | } |
@@ -20,18 +20,18 @@ |
||
20 | 20 | */ |
21 | 21 | public function __construct($pm_instance = null) |
22 | 22 | { |
23 | - require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | + require_once($this->file_folder().'EEG_Paypal_Express.gateway.php'); |
|
24 | 24 | $this->_gateway = new EEG_Paypal_Express(); |
25 | 25 | |
26 | 26 | $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
27 | - $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | + $this->_template_path = $this->file_folder().'templates/'; |
|
28 | 28 | $this->_default_description = esc_html__( |
29 | 29 | // @codingStandardsIgnoreStart |
30 | 30 | 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
31 | 31 | // @codingStandardsIgnoreEnd |
32 | 32 | 'event_espresso' |
33 | 33 | ); |
34 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
34 | + $this->_default_button_url = $this->file_url().'lib/paypal-express-checkout-logo-gold-160.png'; |
|
35 | 35 | |
36 | 36 | parent::__construct($pm_instance); |
37 | 37 | } |
@@ -14,89 +14,89 @@ |
||
14 | 14 | */ |
15 | 15 | class EE_PMT_Paypal_Express extends EE_PMT_Base |
16 | 16 | { |
17 | - /** |
|
18 | - * EE_PMT_Paypal_Express constructor. |
|
19 | - */ |
|
20 | - public function __construct($pm_instance = null) |
|
21 | - { |
|
22 | - require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | - $this->_gateway = new EEG_Paypal_Express(); |
|
17 | + /** |
|
18 | + * EE_PMT_Paypal_Express constructor. |
|
19 | + */ |
|
20 | + public function __construct($pm_instance = null) |
|
21 | + { |
|
22 | + require_once($this->file_folder() . 'EEG_Paypal_Express.gateway.php'); |
|
23 | + $this->_gateway = new EEG_Paypal_Express(); |
|
24 | 24 | |
25 | - $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
26 | - $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | - $this->_default_description = esc_html__( |
|
28 | - // @codingStandardsIgnoreStart |
|
29 | - 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
30 | - // @codingStandardsIgnoreEnd |
|
31 | - 'event_espresso' |
|
32 | - ); |
|
33 | - $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
25 | + $this->_pretty_name = esc_html__('PayPal Express', 'event_espresso'); |
|
26 | + $this->_template_path = $this->file_folder() . 'templates/'; |
|
27 | + $this->_default_description = esc_html__( |
|
28 | + // @codingStandardsIgnoreStart |
|
29 | + 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', |
|
30 | + // @codingStandardsIgnoreEnd |
|
31 | + 'event_espresso' |
|
32 | + ); |
|
33 | + $this->_default_button_url = $this->file_url() . 'lib/paypal-express-checkout-logo-gold-160.png'; |
|
34 | 34 | |
35 | - parent::__construct($pm_instance); |
|
36 | - } |
|
35 | + parent::__construct($pm_instance); |
|
36 | + } |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * Adds the help tab. |
|
41 | - * |
|
42 | - * @see EE_PMT_Base::help_tabs_config() |
|
43 | - * @return array |
|
44 | - */ |
|
45 | - public function help_tabs_config() |
|
46 | - { |
|
47 | - return array( |
|
48 | - $this->get_help_tab_name() => array( |
|
49 | - 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
50 | - 'filename' => 'payment_methods_overview_paypal_express' |
|
51 | - ) |
|
52 | - ); |
|
53 | - } |
|
39 | + /** |
|
40 | + * Adds the help tab. |
|
41 | + * |
|
42 | + * @see EE_PMT_Base::help_tabs_config() |
|
43 | + * @return array |
|
44 | + */ |
|
45 | + public function help_tabs_config() |
|
46 | + { |
|
47 | + return array( |
|
48 | + $this->get_help_tab_name() => array( |
|
49 | + 'title' => esc_html__('PayPal Express Settings', 'event_espresso'), |
|
50 | + 'filename' => 'payment_methods_overview_paypal_express' |
|
51 | + ) |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * Gets the form for all the settings related to this payment method type. |
|
58 | - * |
|
59 | - * @return EE_Payment_Method_Form |
|
60 | - */ |
|
61 | - public function generate_new_settings_form() |
|
62 | - { |
|
63 | - return new SettingsForm(array(), $this->get_help_tab_link()); |
|
64 | - } |
|
56 | + /** |
|
57 | + * Gets the form for all the settings related to this payment method type. |
|
58 | + * |
|
59 | + * @return EE_Payment_Method_Form |
|
60 | + */ |
|
61 | + public function generate_new_settings_form() |
|
62 | + { |
|
63 | + return new SettingsForm(array(), $this->get_help_tab_link()); |
|
64 | + } |
|
65 | 65 | |
66 | 66 | |
67 | - /** |
|
68 | - * Creates a billing form for this payment method type. |
|
69 | - * |
|
70 | - * @param \EE_Transaction $transaction |
|
71 | - * @return \EE_Billing_Info_Form |
|
72 | - */ |
|
73 | - public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
74 | - { |
|
75 | - if ($this->_pm_instance->debug_mode()) { |
|
76 | - $form = new EE_Billing_Info_Form( |
|
77 | - $this->_pm_instance, |
|
78 | - array( |
|
79 | - 'name' => 'paypal_express_Info_Form', |
|
80 | - 'subsections' => array( |
|
81 | - 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
82 | - array( |
|
83 | - 'layout_strategy' => new EE_Template_Layout( |
|
84 | - array( |
|
85 | - 'layout_template_file' => $this->_template_path |
|
86 | - . 'paypal_express_debug_info.template.php', |
|
87 | - 'template_args' => array( |
|
88 | - 'debug_mode' => $this->_pm_instance->debug_mode() |
|
89 | - ) |
|
90 | - ) |
|
91 | - ) |
|
92 | - ) |
|
93 | - ) |
|
94 | - ) |
|
95 | - ) |
|
96 | - ); |
|
97 | - return $form; |
|
98 | - } |
|
67 | + /** |
|
68 | + * Creates a billing form for this payment method type. |
|
69 | + * |
|
70 | + * @param \EE_Transaction $transaction |
|
71 | + * @return \EE_Billing_Info_Form |
|
72 | + */ |
|
73 | + public function generate_new_billing_form(EE_Transaction $transaction = null) |
|
74 | + { |
|
75 | + if ($this->_pm_instance->debug_mode()) { |
|
76 | + $form = new EE_Billing_Info_Form( |
|
77 | + $this->_pm_instance, |
|
78 | + array( |
|
79 | + 'name' => 'paypal_express_Info_Form', |
|
80 | + 'subsections' => array( |
|
81 | + 'paypal_express_debug_info' => new EE_Form_Section_Proper( |
|
82 | + array( |
|
83 | + 'layout_strategy' => new EE_Template_Layout( |
|
84 | + array( |
|
85 | + 'layout_template_file' => $this->_template_path |
|
86 | + . 'paypal_express_debug_info.template.php', |
|
87 | + 'template_args' => array( |
|
88 | + 'debug_mode' => $this->_pm_instance->debug_mode() |
|
89 | + ) |
|
90 | + ) |
|
91 | + ) |
|
92 | + ) |
|
93 | + ) |
|
94 | + ) |
|
95 | + ) |
|
96 | + ); |
|
97 | + return $form; |
|
98 | + } |
|
99 | 99 | |
100 | - return false; |
|
101 | - } |
|
100 | + return false; |
|
101 | + } |
|
102 | 102 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | { |
91 | 91 | espresso_load_required( |
92 | 92 | 'EE_Request', |
93 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
93 | + EE_CORE.'request_stack/EE_Request.core.php' |
|
94 | 94 | ); |
95 | 95 | $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
96 | 96 | $this->legacy_request->setRequest($this->request); |
@@ -29,84 +29,84 @@ |
||
29 | 29 | */ |
30 | 30 | class BootstrapRequestResponseObjects implements InterminableInterface |
31 | 31 | { |
32 | - /** |
|
33 | - * @type LegacyRequestInterface $legacy_request |
|
34 | - */ |
|
35 | - protected $legacy_request; |
|
32 | + /** |
|
33 | + * @type LegacyRequestInterface $legacy_request |
|
34 | + */ |
|
35 | + protected $legacy_request; |
|
36 | 36 | |
37 | - /** |
|
38 | - * @type LoaderInterface $loader |
|
39 | - */ |
|
40 | - protected $loader; |
|
37 | + /** |
|
38 | + * @type LoaderInterface $loader |
|
39 | + */ |
|
40 | + protected $loader; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @var RequestInterface $request |
|
44 | - */ |
|
45 | - protected $request; |
|
42 | + /** |
|
43 | + * @var RequestInterface $request |
|
44 | + */ |
|
45 | + protected $request; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var ResponseInterface $response |
|
49 | - */ |
|
50 | - protected $response; |
|
47 | + /** |
|
48 | + * @var ResponseInterface $response |
|
49 | + */ |
|
50 | + protected $response; |
|
51 | 51 | |
52 | 52 | |
53 | - /** |
|
54 | - * BootstrapRequestResponseObjects constructor. |
|
55 | - * |
|
56 | - * @param LoaderInterface $loader |
|
57 | - */ |
|
58 | - public function __construct(LoaderInterface $loader) |
|
59 | - { |
|
60 | - $this->loader = $loader; |
|
61 | - } |
|
53 | + /** |
|
54 | + * BootstrapRequestResponseObjects constructor. |
|
55 | + * |
|
56 | + * @param LoaderInterface $loader |
|
57 | + */ |
|
58 | + public function __construct(LoaderInterface $loader) |
|
59 | + { |
|
60 | + $this->loader = $loader; |
|
61 | + } |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * @return void |
|
66 | - */ |
|
67 | - public function buildRequestResponse() |
|
68 | - { |
|
69 | - $request_params = new RequestParams(new RequestSanitizer()); |
|
70 | - $server_params = new ServerParams(new ServerSanitizer()); |
|
71 | - // load our Request and Response objects |
|
72 | - $this->request = new Request($request_params, $server_params); |
|
73 | - $this->response = new Response(); |
|
74 | - $this->loader->share(RequestParams::class, $request_params); |
|
75 | - $this->loader->share(ServerParams::class, $server_params); |
|
76 | - } |
|
64 | + /** |
|
65 | + * @return void |
|
66 | + */ |
|
67 | + public function buildRequestResponse() |
|
68 | + { |
|
69 | + $request_params = new RequestParams(new RequestSanitizer()); |
|
70 | + $server_params = new ServerParams(new ServerSanitizer()); |
|
71 | + // load our Request and Response objects |
|
72 | + $this->request = new Request($request_params, $server_params); |
|
73 | + $this->response = new Response(); |
|
74 | + $this->loader->share(RequestParams::class, $request_params); |
|
75 | + $this->loader->share(ServerParams::class, $server_params); |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | - /** |
|
80 | - * @return void |
|
81 | - * @throws InvalidArgumentException |
|
82 | - */ |
|
83 | - public function shareRequestResponse() |
|
84 | - { |
|
85 | - $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
86 | - $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
87 | - EE_Dependency_Map::instance()->setRequest($this->request); |
|
88 | - EE_Dependency_Map::instance()->setResponse($this->response); |
|
89 | - } |
|
79 | + /** |
|
80 | + * @return void |
|
81 | + * @throws InvalidArgumentException |
|
82 | + */ |
|
83 | + public function shareRequestResponse() |
|
84 | + { |
|
85 | + $this->loader->share('EventEspresso\core\services\request\Request', $this->request); |
|
86 | + $this->loader->share('EventEspresso\core\services\request\Response', $this->response); |
|
87 | + EE_Dependency_Map::instance()->setRequest($this->request); |
|
88 | + EE_Dependency_Map::instance()->setResponse($this->response); |
|
89 | + } |
|
90 | 90 | |
91 | 91 | |
92 | - /** |
|
93 | - * @return void |
|
94 | - * @throws InvalidArgumentException |
|
95 | - * @throws EE_Error |
|
96 | - */ |
|
97 | - public function setupLegacyRequest() |
|
98 | - { |
|
99 | - espresso_load_required( |
|
100 | - 'EE_Request', |
|
101 | - EE_CORE . 'request_stack/EE_Request.core.php' |
|
102 | - ); |
|
103 | - $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
104 | - $this->legacy_request->setRequest($this->request); |
|
105 | - $this->legacy_request->admin = $this->request->isAdmin(); |
|
106 | - $this->legacy_request->ajax = $this->request->isAjax(); |
|
107 | - $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
108 | - EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
109 | - $this->loader->share('EE_Request', $this->legacy_request); |
|
110 | - $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
111 | - } |
|
92 | + /** |
|
93 | + * @return void |
|
94 | + * @throws InvalidArgumentException |
|
95 | + * @throws EE_Error |
|
96 | + */ |
|
97 | + public function setupLegacyRequest() |
|
98 | + { |
|
99 | + espresso_load_required( |
|
100 | + 'EE_Request', |
|
101 | + EE_CORE . 'request_stack/EE_Request.core.php' |
|
102 | + ); |
|
103 | + $this->legacy_request = new EE_Request($_GET, $_POST, $_COOKIE, $_SERVER); |
|
104 | + $this->legacy_request->setRequest($this->request); |
|
105 | + $this->legacy_request->admin = $this->request->isAdmin(); |
|
106 | + $this->legacy_request->ajax = $this->request->isAjax(); |
|
107 | + $this->legacy_request->front_ajax = $this->request->isFrontAjax(); |
|
108 | + EE_Dependency_Map::instance()->setLegacyRequest($this->legacy_request); |
|
109 | + $this->loader->share('EE_Request', $this->legacy_request); |
|
110 | + $this->loader->share('EventEspresso\core\services\request\LegacyRequestInterface', $this->legacy_request); |
|
111 | + } |
|
112 | 112 | } |
@@ -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 |
@@ -47,225 +47,225 @@ |
||
47 | 47 | */ |
48 | 48 | class BootstrapCore implements InterminableInterface |
49 | 49 | { |
50 | - /** |
|
51 | - * @type LoaderInterface $loader |
|
52 | - */ |
|
53 | - private $loader; |
|
50 | + /** |
|
51 | + * @type LoaderInterface $loader |
|
52 | + */ |
|
53 | + private $loader; |
|
54 | 54 | |
55 | - /** |
|
56 | - * @var RequestInterface $request |
|
57 | - */ |
|
58 | - protected $request; |
|
55 | + /** |
|
56 | + * @var RequestInterface $request |
|
57 | + */ |
|
58 | + protected $request; |
|
59 | 59 | |
60 | - /** |
|
61 | - * @var ResponseInterface $response |
|
62 | - */ |
|
63 | - protected $response; |
|
60 | + /** |
|
61 | + * @var ResponseInterface $response |
|
62 | + */ |
|
63 | + protected $response; |
|
64 | 64 | |
65 | - /** |
|
66 | - * @var RequestStackBuilder $request_stack_builder |
|
67 | - */ |
|
68 | - protected $request_stack_builder; |
|
65 | + /** |
|
66 | + * @var RequestStackBuilder $request_stack_builder |
|
67 | + */ |
|
68 | + protected $request_stack_builder; |
|
69 | 69 | |
70 | - /** |
|
71 | - * @var RequestStack $request_stack |
|
72 | - */ |
|
73 | - protected $request_stack; |
|
70 | + /** |
|
71 | + * @var RequestStack $request_stack |
|
72 | + */ |
|
73 | + protected $request_stack; |
|
74 | 74 | |
75 | 75 | |
76 | - /** |
|
77 | - * BootstrapCore constructor. |
|
78 | - */ |
|
79 | - public function __construct() |
|
80 | - { |
|
81 | - do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
82 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
83 | - add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
84 | - } |
|
76 | + /** |
|
77 | + * BootstrapCore constructor. |
|
78 | + */ |
|
79 | + public function __construct() |
|
80 | + { |
|
81 | + do_action('AHEE__EventEspresso_core_services_bootstrap_BootstrapCore___construct'); |
|
82 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
83 | + add_action('plugins_loaded', array($this, 'initialize'), 0); |
|
84 | + } |
|
85 | 85 | |
86 | 86 | |
87 | - /** |
|
88 | - * @throws DomainException |
|
89 | - * @throws EE_Error |
|
90 | - * @throws Exception |
|
91 | - * @throws InvalidArgumentException |
|
92 | - * @throws InvalidClassException |
|
93 | - * @throws InvalidDataTypeException |
|
94 | - * @throws InvalidFilePathException |
|
95 | - * @throws InvalidInterfaceException |
|
96 | - * @throws InvalidRequestStackMiddlewareException |
|
97 | - * @throws OutOfBoundsException |
|
98 | - * @throws ReflectionException |
|
99 | - */ |
|
100 | - public function initialize() |
|
101 | - { |
|
102 | - $this->bootstrapDependencyInjectionContainer(); |
|
103 | - $this->bootstrapDomain(); |
|
104 | - $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
105 | - add_action( |
|
106 | - 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
107 | - array($bootstrap_request, 'setupLegacyRequest') |
|
108 | - ); |
|
109 | - $this->runRequestStack(); |
|
110 | - } |
|
87 | + /** |
|
88 | + * @throws DomainException |
|
89 | + * @throws EE_Error |
|
90 | + * @throws Exception |
|
91 | + * @throws InvalidArgumentException |
|
92 | + * @throws InvalidClassException |
|
93 | + * @throws InvalidDataTypeException |
|
94 | + * @throws InvalidFilePathException |
|
95 | + * @throws InvalidInterfaceException |
|
96 | + * @throws InvalidRequestStackMiddlewareException |
|
97 | + * @throws OutOfBoundsException |
|
98 | + * @throws ReflectionException |
|
99 | + */ |
|
100 | + public function initialize() |
|
101 | + { |
|
102 | + $this->bootstrapDependencyInjectionContainer(); |
|
103 | + $this->bootstrapDomain(); |
|
104 | + $bootstrap_request = $this->bootstrapRequestResponseObjects(); |
|
105 | + add_action( |
|
106 | + 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', |
|
107 | + array($bootstrap_request, 'setupLegacyRequest') |
|
108 | + ); |
|
109 | + $this->runRequestStack(); |
|
110 | + } |
|
111 | 111 | |
112 | 112 | |
113 | - /** |
|
114 | - * @throws ReflectionException |
|
115 | - * @throws EE_Error |
|
116 | - * @throws InvalidArgumentException |
|
117 | - * @throws InvalidDataTypeException |
|
118 | - * @throws InvalidInterfaceException |
|
119 | - * @throws OutOfBoundsException |
|
120 | - */ |
|
121 | - private function bootstrapDependencyInjectionContainer() |
|
122 | - { |
|
123 | - $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
124 | - $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
125 | - $bootstrap_di->buildLoader(); |
|
126 | - $registry = $bootstrap_di->getRegistry(); |
|
127 | - $dependency_map = $bootstrap_di->getDependencyMap(); |
|
128 | - $dependency_map->initialize(); |
|
129 | - $registry->initialize(); |
|
130 | - $this->loader = $bootstrap_di->getLoader(); |
|
131 | - } |
|
113 | + /** |
|
114 | + * @throws ReflectionException |
|
115 | + * @throws EE_Error |
|
116 | + * @throws InvalidArgumentException |
|
117 | + * @throws InvalidDataTypeException |
|
118 | + * @throws InvalidInterfaceException |
|
119 | + * @throws OutOfBoundsException |
|
120 | + */ |
|
121 | + private function bootstrapDependencyInjectionContainer() |
|
122 | + { |
|
123 | + $bootstrap_di = new BootstrapDependencyInjectionContainer(); |
|
124 | + $bootstrap_di->buildLegacyDependencyInjectionContainer(); |
|
125 | + $bootstrap_di->buildLoader(); |
|
126 | + $registry = $bootstrap_di->getRegistry(); |
|
127 | + $dependency_map = $bootstrap_di->getDependencyMap(); |
|
128 | + $dependency_map->initialize(); |
|
129 | + $registry->initialize(); |
|
130 | + $this->loader = $bootstrap_di->getLoader(); |
|
131 | + } |
|
132 | 132 | |
133 | 133 | |
134 | - /** |
|
135 | - * configures the Domain object for core |
|
136 | - * |
|
137 | - * @return void |
|
138 | - * @throws DomainException |
|
139 | - * @throws InvalidArgumentException |
|
140 | - * @throws InvalidDataTypeException |
|
141 | - * @throws InvalidClassException |
|
142 | - * @throws InvalidFilePathException |
|
143 | - * @throws InvalidInterfaceException |
|
144 | - */ |
|
145 | - private function bootstrapDomain() |
|
146 | - { |
|
147 | - DomainFactory::getEventEspressoCoreDomain(); |
|
148 | - } |
|
134 | + /** |
|
135 | + * configures the Domain object for core |
|
136 | + * |
|
137 | + * @return void |
|
138 | + * @throws DomainException |
|
139 | + * @throws InvalidArgumentException |
|
140 | + * @throws InvalidDataTypeException |
|
141 | + * @throws InvalidClassException |
|
142 | + * @throws InvalidFilePathException |
|
143 | + * @throws InvalidInterfaceException |
|
144 | + */ |
|
145 | + private function bootstrapDomain() |
|
146 | + { |
|
147 | + DomainFactory::getEventEspressoCoreDomain(); |
|
148 | + } |
|
149 | 149 | |
150 | 150 | |
151 | - /** |
|
152 | - * sets up the request and response objects |
|
153 | - * |
|
154 | - * @return BootstrapRequestResponseObjects |
|
155 | - * @throws InvalidArgumentException |
|
156 | - */ |
|
157 | - private function bootstrapRequestResponseObjects(): BootstrapRequestResponseObjects |
|
158 | - { |
|
159 | - /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
160 | - $bootstrap_request = $this->loader->getShared( |
|
161 | - 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
162 | - array($this->loader) |
|
163 | - ); |
|
164 | - $bootstrap_request->buildRequestResponse(); |
|
165 | - $bootstrap_request->shareRequestResponse(); |
|
166 | - $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
167 | - $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
168 | - return $bootstrap_request; |
|
169 | - } |
|
151 | + /** |
|
152 | + * sets up the request and response objects |
|
153 | + * |
|
154 | + * @return BootstrapRequestResponseObjects |
|
155 | + * @throws InvalidArgumentException |
|
156 | + */ |
|
157 | + private function bootstrapRequestResponseObjects(): BootstrapRequestResponseObjects |
|
158 | + { |
|
159 | + /** @var BootstrapRequestResponseObjects $bootstrap_request */ |
|
160 | + $bootstrap_request = $this->loader->getShared( |
|
161 | + 'EventEspresso\core\services\bootstrap\BootstrapRequestResponseObjects', |
|
162 | + array($this->loader) |
|
163 | + ); |
|
164 | + $bootstrap_request->buildRequestResponse(); |
|
165 | + $bootstrap_request->shareRequestResponse(); |
|
166 | + $this->request = $this->loader->getShared('EventEspresso\core\services\request\Request'); |
|
167 | + $this->response = $this->loader->getShared('EventEspresso\core\services\request\Response'); |
|
168 | + return $bootstrap_request; |
|
169 | + } |
|
170 | 170 | |
171 | 171 | |
172 | - /** |
|
173 | - * run_request_stack |
|
174 | - * construct request stack and run middleware apps |
|
175 | - * |
|
176 | - * @throws EE_Error |
|
177 | - * @throws Exception |
|
178 | - */ |
|
179 | - public function runRequestStack() |
|
180 | - { |
|
181 | - $this->loadAutoloader(); |
|
182 | - $this->setAutoloadersForRequiredFiles(); |
|
183 | - $this->request_stack_builder = $this->buildRequestStack(); |
|
184 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
185 | - new RequestStackCoreApp() |
|
186 | - ); |
|
187 | - $this->request_stack->handleRequest($this->request, $this->response); |
|
188 | - $this->request_stack->handleResponse(); |
|
189 | - } |
|
172 | + /** |
|
173 | + * run_request_stack |
|
174 | + * construct request stack and run middleware apps |
|
175 | + * |
|
176 | + * @throws EE_Error |
|
177 | + * @throws Exception |
|
178 | + */ |
|
179 | + public function runRequestStack() |
|
180 | + { |
|
181 | + $this->loadAutoloader(); |
|
182 | + $this->setAutoloadersForRequiredFiles(); |
|
183 | + $this->request_stack_builder = $this->buildRequestStack(); |
|
184 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
185 | + new RequestStackCoreApp() |
|
186 | + ); |
|
187 | + $this->request_stack->handleRequest($this->request, $this->response); |
|
188 | + $this->request_stack->handleResponse(); |
|
189 | + } |
|
190 | 190 | |
191 | 191 | |
192 | - /** |
|
193 | - * load_autoloader |
|
194 | - * |
|
195 | - * @throws EE_Error |
|
196 | - */ |
|
197 | - protected function loadAutoloader() |
|
198 | - { |
|
199 | - // load interfaces |
|
200 | - espresso_load_required( |
|
201 | - 'EEH_Autoloader', |
|
202 | - EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
203 | - ); |
|
204 | - EEH_Autoloader::instance(); |
|
205 | - } |
|
192 | + /** |
|
193 | + * load_autoloader |
|
194 | + * |
|
195 | + * @throws EE_Error |
|
196 | + */ |
|
197 | + protected function loadAutoloader() |
|
198 | + { |
|
199 | + // load interfaces |
|
200 | + espresso_load_required( |
|
201 | + 'EEH_Autoloader', |
|
202 | + EE_CORE . 'helpers/EEH_Autoloader.helper.php' |
|
203 | + ); |
|
204 | + EEH_Autoloader::instance(); |
|
205 | + } |
|
206 | 206 | |
207 | 207 | |
208 | - /** |
|
209 | - * load_required_files |
|
210 | - * |
|
211 | - * @throws EE_Error |
|
212 | - */ |
|
213 | - protected function setAutoloadersForRequiredFiles() |
|
214 | - { |
|
215 | - // load interfaces |
|
216 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
217 | - // load helpers |
|
218 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
219 | - // register legacy request stack classes just in case |
|
220 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
221 | - // register legacy middleware classes just in case |
|
222 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
223 | - } |
|
208 | + /** |
|
209 | + * load_required_files |
|
210 | + * |
|
211 | + * @throws EE_Error |
|
212 | + */ |
|
213 | + protected function setAutoloadersForRequiredFiles() |
|
214 | + { |
|
215 | + // load interfaces |
|
216 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
217 | + // load helpers |
|
218 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
219 | + // register legacy request stack classes just in case |
|
220 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack/'); |
|
221 | + // register legacy middleware classes just in case |
|
222 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware/'); |
|
223 | + } |
|
224 | 224 | |
225 | 225 | |
226 | - /** |
|
227 | - * build_request_stack |
|
228 | - * |
|
229 | - * @return RequestStackBuilder |
|
230 | - */ |
|
231 | - public function buildRequestStack(): RequestStackBuilder |
|
232 | - { |
|
233 | - $request_stack_builder = new RequestStackBuilder($this->loader); |
|
234 | - /** |
|
235 | - * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
236 | - * so items at the beginning of the final middleware stack will run last. |
|
237 | - * First parameter is the middleware classname, second is an array of arguments |
|
238 | - */ |
|
239 | - $stack_apps = apply_filters( |
|
240 | - 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
241 | - array( |
|
242 | - // first in last out |
|
243 | - 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
244 | - 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
245 | - 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
246 | - 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
247 | - // last in first out |
|
248 | - 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
249 | - ) |
|
250 | - ); |
|
251 | - // legacy filter for backwards compatibility |
|
252 | - $stack_apps = apply_filters( |
|
253 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
254 | - $stack_apps |
|
255 | - ); |
|
256 | - // load middleware onto stack : FILO (First In Last Out) |
|
257 | - // items at the beginning of the $stack_apps array will run last |
|
258 | - foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
259 | - $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
260 | - } |
|
261 | - // finally, we'll add this on its own because we need it to always be part of the stack |
|
262 | - // and we also need it to always run first because the rest of the system relies on it |
|
263 | - $request_stack_builder->push( |
|
264 | - array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
265 | - ); |
|
266 | - return apply_filters( |
|
267 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
268 | - $request_stack_builder |
|
269 | - ); |
|
270 | - } |
|
226 | + /** |
|
227 | + * build_request_stack |
|
228 | + * |
|
229 | + * @return RequestStackBuilder |
|
230 | + */ |
|
231 | + public function buildRequestStack(): RequestStackBuilder |
|
232 | + { |
|
233 | + $request_stack_builder = new RequestStackBuilder($this->loader); |
|
234 | + /** |
|
235 | + * ! IMPORTANT ! The middleware stack operates FILO : FIRST IN LAST OUT |
|
236 | + * so items at the beginning of the final middleware stack will run last. |
|
237 | + * First parameter is the middleware classname, second is an array of arguments |
|
238 | + */ |
|
239 | + $stack_apps = apply_filters( |
|
240 | + 'FHEE__EventEspresso_core_services_bootstrap_BootstrapCore__buildRequestStack__stack_apps', |
|
241 | + array( |
|
242 | + // first in last out |
|
243 | + 'EventEspresso\core\services\request\middleware\BotDetector' => array(), |
|
244 | + 'EventEspresso\core\services\request\middleware\DetectFileEditorRequest' => array(), |
|
245 | + 'EventEspresso\core\services\request\middleware\PreProductionVersionWarning' => array(), |
|
246 | + 'EventEspresso\core\services\request\middleware\RecommendedVersions' => array(), |
|
247 | + // last in first out |
|
248 | + 'EventEspresso\core\services\request\middleware\DetectLogin' => array(), |
|
249 | + ) |
|
250 | + ); |
|
251 | + // legacy filter for backwards compatibility |
|
252 | + $stack_apps = apply_filters( |
|
253 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
254 | + $stack_apps |
|
255 | + ); |
|
256 | + // load middleware onto stack : FILO (First In Last Out) |
|
257 | + // items at the beginning of the $stack_apps array will run last |
|
258 | + foreach ((array) $stack_apps as $stack_app => $stack_app_args) { |
|
259 | + $request_stack_builder->push(array($stack_app, $stack_app_args)); |
|
260 | + } |
|
261 | + // finally, we'll add this on its own because we need it to always be part of the stack |
|
262 | + // and we also need it to always run first because the rest of the system relies on it |
|
263 | + $request_stack_builder->push( |
|
264 | + array('EventEspresso\core\services\request\middleware\SetRequestTypeContextChecker', array()) |
|
265 | + ); |
|
266 | + return apply_filters( |
|
267 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
268 | + $request_stack_builder |
|
269 | + ); |
|
270 | + } |
|
271 | 271 | } |
@@ -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 | } |
@@ -15,94 +15,94 @@ |
||
15 | 15 | */ |
16 | 16 | class LicenseService |
17 | 17 | { |
18 | - /** |
|
19 | - * @var Config |
|
20 | - */ |
|
21 | - private $config; |
|
22 | - |
|
23 | - |
|
24 | - /** |
|
25 | - * @var Stats |
|
26 | - */ |
|
27 | - private $stats_collection; |
|
28 | - |
|
29 | - public function __construct(Stats $stats_collection, Config $config) |
|
30 | - { |
|
31 | - $this->config = $config; |
|
32 | - $this->stats_collection = $stats_collection; |
|
33 | - $this->loadPueClient(); |
|
34 | - } |
|
35 | - |
|
36 | - private function loadPueClient() |
|
37 | - { |
|
38 | - // PUE Auto Upgrades stuff |
|
39 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
41 | - |
|
42 | - // $options needs to be an array with the included keys as listed. |
|
43 | - $options = array( |
|
44 | - // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
45 | - // clients options table. Will be automatically set if left blank. |
|
46 | - 'apikey' => $this->config->siteLicenseKey(), |
|
47 | - // (required), you will need to obtain the apikey that the client gets from your site and |
|
48 | - // then saves in their sites options table (see 'getting an api-key' below) |
|
49 | - 'lang_domain' => $this->config->i18nDomain(), |
|
50 | - // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
51 | - // localized). That way strings in this file will be included in the translation for your plugin. |
|
52 | - 'checkPeriod' => $this->config->checkPeriod(), |
|
53 | - // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
54 | - // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
55 | - // default to 12 hours. |
|
56 | - 'option_key' => $this->config->optionKey(), |
|
57 | - // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
58 | - // updating your information message whenever this option_key is modified. |
|
59 | - 'options_page_slug' => $this->config->optionsPageSlug(), |
|
60 | - 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
61 | - 'use_wp_update' => true, |
|
62 | - // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
63 | - 'extra_stats' => $this->stats_collection->statsCallback(), |
|
64 | - 'turn_on_notices_saved' => true, |
|
65 | - ); |
|
66 | - // initiate the class and start the plugin update engine! |
|
67 | - new PluginUpdateEngineChecker( |
|
68 | - $this->config->hostServerUrl(), |
|
69 | - $this->config->pluginSlug(), |
|
70 | - $options |
|
71 | - ); |
|
72 | - } |
|
73 | - } |
|
74 | - |
|
75 | - |
|
76 | - /** |
|
77 | - * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
78 | - * |
|
79 | - * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
80 | - * identify plugins. Defaults to core update |
|
81 | - * @return boolean True if update available, false if not. |
|
82 | - */ |
|
83 | - public static function isUpdateAvailable($basename = '') |
|
84 | - { |
|
85 | - $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
86 | - |
|
87 | - $update = false; |
|
88 | - |
|
89 | - // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
90 | - $folder = '/' . dirname($basename); |
|
91 | - |
|
92 | - $plugins = get_plugins($folder); |
|
93 | - $current = get_site_transient('update_plugins'); |
|
94 | - |
|
95 | - foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
96 | - if (isset($current->response['plugin_file'])) { |
|
97 | - $update = true; |
|
98 | - } |
|
99 | - } |
|
100 | - |
|
101 | - // it's possible that there is an update but an invalid site-license-key is in use |
|
102 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
103 | - $update = true; |
|
104 | - } |
|
105 | - |
|
106 | - return $update; |
|
107 | - } |
|
18 | + /** |
|
19 | + * @var Config |
|
20 | + */ |
|
21 | + private $config; |
|
22 | + |
|
23 | + |
|
24 | + /** |
|
25 | + * @var Stats |
|
26 | + */ |
|
27 | + private $stats_collection; |
|
28 | + |
|
29 | + public function __construct(Stats $stats_collection, Config $config) |
|
30 | + { |
|
31 | + $this->config = $config; |
|
32 | + $this->stats_collection = $stats_collection; |
|
33 | + $this->loadPueClient(); |
|
34 | + } |
|
35 | + |
|
36 | + private function loadPueClient() |
|
37 | + { |
|
38 | + // PUE Auto Upgrades stuff |
|
39 | + if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | + require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
41 | + |
|
42 | + // $options needs to be an array with the included keys as listed. |
|
43 | + $options = array( |
|
44 | + // 'optionName' => '', //(optional) - used as the reference for saving update information in the |
|
45 | + // clients options table. Will be automatically set if left blank. |
|
46 | + 'apikey' => $this->config->siteLicenseKey(), |
|
47 | + // (required), you will need to obtain the apikey that the client gets from your site and |
|
48 | + // then saves in their sites options table (see 'getting an api-key' below) |
|
49 | + 'lang_domain' => $this->config->i18nDomain(), |
|
50 | + // (optional) - put here whatever reference you are using for the localization of your plugin (if it's |
|
51 | + // localized). That way strings in this file will be included in the translation for your plugin. |
|
52 | + 'checkPeriod' => $this->config->checkPeriod(), |
|
53 | + // (optional) - use this parameter to indicate how often you want the client's install to ping your |
|
54 | + // server for update checks. The integer indicates hours. If you don't include this parameter it will |
|
55 | + // default to 12 hours. |
|
56 | + 'option_key' => $this->config->optionKey(), |
|
57 | + // this is what is used to reference the api_key in your plugin options. PUE uses this to trigger |
|
58 | + // updating your information message whenever this option_key is modified. |
|
59 | + 'options_page_slug' => $this->config->optionsPageSlug(), |
|
60 | + 'plugin_basename' => EE_PLUGIN_BASENAME, |
|
61 | + 'use_wp_update' => true, |
|
62 | + // if TRUE then you want FREE versions of the plugin to be updated from WP |
|
63 | + 'extra_stats' => $this->stats_collection->statsCallback(), |
|
64 | + 'turn_on_notices_saved' => true, |
|
65 | + ); |
|
66 | + // initiate the class and start the plugin update engine! |
|
67 | + new PluginUpdateEngineChecker( |
|
68 | + $this->config->hostServerUrl(), |
|
69 | + $this->config->pluginSlug(), |
|
70 | + $options |
|
71 | + ); |
|
72 | + } |
|
73 | + } |
|
74 | + |
|
75 | + |
|
76 | + /** |
|
77 | + * This is a handy helper method for retrieving whether there is an update available for the given plugin. |
|
78 | + * |
|
79 | + * @param string $basename Use the equivalent result from plugin_basename() for this param as WP uses that to |
|
80 | + * identify plugins. Defaults to core update |
|
81 | + * @return boolean True if update available, false if not. |
|
82 | + */ |
|
83 | + public static function isUpdateAvailable($basename = '') |
|
84 | + { |
|
85 | + $basename = ! empty($basename) ? $basename : EE_PLUGIN_BASENAME; |
|
86 | + |
|
87 | + $update = false; |
|
88 | + |
|
89 | + // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
|
90 | + $folder = '/' . dirname($basename); |
|
91 | + |
|
92 | + $plugins = get_plugins($folder); |
|
93 | + $current = get_site_transient('update_plugins'); |
|
94 | + |
|
95 | + foreach ((array) $plugins as $plugin_file => $plugin_data) { |
|
96 | + if (isset($current->response['plugin_file'])) { |
|
97 | + $update = true; |
|
98 | + } |
|
99 | + } |
|
100 | + |
|
101 | + // it's possible that there is an update but an invalid site-license-key is in use |
|
102 | + if (get_site_option('pue_json_error_' . $basename)) { |
|
103 | + $update = true; |
|
104 | + } |
|
105 | + |
|
106 | + return $update; |
|
107 | + } |
|
108 | 108 | } |
@@ -36,8 +36,8 @@ discard block |
||
36 | 36 | private function loadPueClient() |
37 | 37 | { |
38 | 38 | // PUE Auto Upgrades stuff |
39 | - if (is_readable(EE_THIRD_PARTY . 'pue/pue-client.php')) { // include the file |
|
40 | - require_once(EE_THIRD_PARTY . 'pue/pue-client.php'); |
|
39 | + if (is_readable(EE_THIRD_PARTY.'pue/pue-client.php')) { // include the file |
|
40 | + require_once(EE_THIRD_PARTY.'pue/pue-client.php'); |
|
41 | 41 | |
42 | 42 | // $options needs to be an array with the included keys as listed. |
43 | 43 | $options = array( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $update = false; |
88 | 88 | |
89 | 89 | // should take "event-espresso-core/espresso.php" and change to "/event-espresso-core" |
90 | - $folder = '/' . dirname($basename); |
|
90 | + $folder = '/'.dirname($basename); |
|
91 | 91 | |
92 | 92 | $plugins = get_plugins($folder); |
93 | 93 | $current = get_site_transient('update_plugins'); |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | |
101 | 101 | // it's possible that there is an update but an invalid site-license-key is in use |
102 | - if (get_site_option('pue_json_error_' . $basename)) { |
|
102 | + if (get_site_option('pue_json_error_'.$basename)) { |
|
103 | 103 | $update = true; |
104 | 104 | } |
105 | 105 |
@@ -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 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function venue_location($content) |
164 | 164 | { |
165 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
165 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | // get some style |
178 | 178 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
179 | 179 | // first check theme folder |
180 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
180 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
181 | 181 | wp_register_style( |
182 | 182 | $this->theme, |
183 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
183 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
184 | 184 | array('dashicons', 'espresso_default') |
185 | 185 | ); |
186 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
186 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
187 | 187 | wp_register_style( |
188 | 188 | $this->theme, |
189 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
189 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
190 | 190 | array('dashicons', 'espresso_default') |
191 | 191 | ); |
192 | 192 | } |
@@ -28,173 +28,173 @@ |
||
28 | 28 | */ |
29 | 29 | class EED_Venue_Single extends EED_Module |
30 | 30 | { |
31 | - /** |
|
32 | - * @return EED_Venue_Single |
|
33 | - */ |
|
34 | - public static function instance() |
|
35 | - { |
|
36 | - return parent::get_instance(__CLASS__); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | - * |
|
43 | - * @return void |
|
44 | - * @throws InvalidArgumentException |
|
45 | - * @throws InvalidDataTypeException |
|
46 | - * @throws InvalidInterfaceException |
|
47 | - */ |
|
48 | - public static function set_hooks() |
|
49 | - { |
|
50 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
51 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
52 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
53 | - ); |
|
54 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
55 | - EE_Config::register_route( |
|
56 | - $custom_post_types['espresso_venues']['singular_slug'], |
|
57 | - 'Venue_Single', |
|
58 | - 'run' |
|
59 | - ); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
64 | - * |
|
65 | - * @access public |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public static function set_hooks_admin() |
|
69 | - { |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * run - initial module setup |
|
75 | - * |
|
76 | - * @access public |
|
77 | - * @param \WP $WP |
|
78 | - */ |
|
79 | - public function run($WP) |
|
80 | - { |
|
81 | - // check what template is loaded |
|
82 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
83 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * template_include |
|
89 | - * |
|
90 | - * @access public |
|
91 | - * @param string $template |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function template_include($template) |
|
95 | - { |
|
96 | - // not a custom template? |
|
97 | - if ( |
|
98 | - EE_Registry::instance() |
|
99 | - ->load_core('Front_Controller', array(), false, true) |
|
100 | - ->get_selected_template() != 'single-espresso_venues.php' |
|
101 | - ) { |
|
102 | - EEH_Template::load_espresso_theme_functions(); |
|
103 | - // then add extra event data via hooks |
|
104 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
106 | - // don't display entry meta because the existing theme will take car of that |
|
107 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
108 | - } |
|
109 | - return $template; |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * the_title |
|
115 | - * |
|
116 | - * @access public |
|
117 | - * @param string $title |
|
118 | - * @return string |
|
119 | - */ |
|
120 | - public function the_title($title = '') |
|
121 | - { |
|
122 | - return $title; |
|
123 | - } |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * venue_details |
|
128 | - * |
|
129 | - * @access public |
|
130 | - * @param string $content |
|
131 | - * @return string |
|
132 | - */ |
|
133 | - public function venue_details($content) |
|
134 | - { |
|
135 | - global $post; |
|
136 | - if ( |
|
137 | - $post->post_type == 'espresso_venues' |
|
138 | - && ! post_password_required() |
|
139 | - ) { |
|
140 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
141 | - // it uses the_content() for displaying the $post->post_content |
|
142 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
143 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
144 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
145 | - // add filters we want |
|
146 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
147 | - // now load our template |
|
148 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
149 | - // remove other filters we added so they won't get applied to the next post |
|
150 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | - } |
|
152 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
153 | - return ! empty($template) ? $template : $content; |
|
154 | - } |
|
155 | - |
|
156 | - |
|
157 | - /** |
|
158 | - * venue_location |
|
159 | - * |
|
160 | - * @access public |
|
161 | - * @param string $content |
|
162 | - * @return string |
|
163 | - */ |
|
164 | - public function venue_location($content) |
|
165 | - { |
|
166 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
167 | - } |
|
168 | - |
|
169 | - |
|
170 | - /** |
|
171 | - * wp_enqueue_scripts |
|
172 | - * |
|
173 | - * @access public |
|
174 | - * @return void |
|
175 | - */ |
|
176 | - public function wp_enqueue_scripts() |
|
177 | - { |
|
178 | - // get some style |
|
179 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
|
180 | - // first check theme folder |
|
181 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
182 | - wp_register_style( |
|
183 | - $this->theme, |
|
184 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
185 | - array('dashicons', 'espresso_default') |
|
186 | - ); |
|
187 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
188 | - wp_register_style( |
|
189 | - $this->theme, |
|
190 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
191 | - array('dashicons', 'espresso_default') |
|
192 | - ); |
|
193 | - } |
|
194 | - wp_enqueue_style($this->theme); |
|
195 | - if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
196 | - add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
31 | + /** |
|
32 | + * @return EED_Venue_Single |
|
33 | + */ |
|
34 | + public static function instance() |
|
35 | + { |
|
36 | + return parent::get_instance(__CLASS__); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | + * |
|
43 | + * @return void |
|
44 | + * @throws InvalidArgumentException |
|
45 | + * @throws InvalidDataTypeException |
|
46 | + * @throws InvalidInterfaceException |
|
47 | + */ |
|
48 | + public static function set_hooks() |
|
49 | + { |
|
50 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
51 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
52 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
53 | + ); |
|
54 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
55 | + EE_Config::register_route( |
|
56 | + $custom_post_types['espresso_venues']['singular_slug'], |
|
57 | + 'Venue_Single', |
|
58 | + 'run' |
|
59 | + ); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
64 | + * |
|
65 | + * @access public |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public static function set_hooks_admin() |
|
69 | + { |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * run - initial module setup |
|
75 | + * |
|
76 | + * @access public |
|
77 | + * @param \WP $WP |
|
78 | + */ |
|
79 | + public function run($WP) |
|
80 | + { |
|
81 | + // check what template is loaded |
|
82 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
83 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * template_include |
|
89 | + * |
|
90 | + * @access public |
|
91 | + * @param string $template |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function template_include($template) |
|
95 | + { |
|
96 | + // not a custom template? |
|
97 | + if ( |
|
98 | + EE_Registry::instance() |
|
99 | + ->load_core('Front_Controller', array(), false, true) |
|
100 | + ->get_selected_template() != 'single-espresso_venues.php' |
|
101 | + ) { |
|
102 | + EEH_Template::load_espresso_theme_functions(); |
|
103 | + // then add extra event data via hooks |
|
104 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
105 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
106 | + // don't display entry meta because the existing theme will take car of that |
|
107 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
108 | + } |
|
109 | + return $template; |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * the_title |
|
115 | + * |
|
116 | + * @access public |
|
117 | + * @param string $title |
|
118 | + * @return string |
|
119 | + */ |
|
120 | + public function the_title($title = '') |
|
121 | + { |
|
122 | + return $title; |
|
123 | + } |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * venue_details |
|
128 | + * |
|
129 | + * @access public |
|
130 | + * @param string $content |
|
131 | + * @return string |
|
132 | + */ |
|
133 | + public function venue_details($content) |
|
134 | + { |
|
135 | + global $post; |
|
136 | + if ( |
|
137 | + $post->post_type == 'espresso_venues' |
|
138 | + && ! post_password_required() |
|
139 | + ) { |
|
140 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
141 | + // it uses the_content() for displaying the $post->post_content |
|
142 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
143 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
144 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
145 | + // add filters we want |
|
146 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
147 | + // now load our template |
|
148 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
149 | + // remove other filters we added so they won't get applied to the next post |
|
150 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
151 | + } |
|
152 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
153 | + return ! empty($template) ? $template : $content; |
|
154 | + } |
|
155 | + |
|
156 | + |
|
157 | + /** |
|
158 | + * venue_location |
|
159 | + * |
|
160 | + * @access public |
|
161 | + * @param string $content |
|
162 | + * @return string |
|
163 | + */ |
|
164 | + public function venue_location($content) |
|
165 | + { |
|
166 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
167 | + } |
|
168 | + |
|
169 | + |
|
170 | + /** |
|
171 | + * wp_enqueue_scripts |
|
172 | + * |
|
173 | + * @access public |
|
174 | + * @return void |
|
175 | + */ |
|
176 | + public function wp_enqueue_scripts() |
|
177 | + { |
|
178 | + // get some style |
|
179 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) { |
|
180 | + // first check theme folder |
|
181 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
182 | + wp_register_style( |
|
183 | + $this->theme, |
|
184 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
185 | + array('dashicons', 'espresso_default') |
|
186 | + ); |
|
187 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
188 | + wp_register_style( |
|
189 | + $this->theme, |
|
190 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
191 | + array('dashicons', 'espresso_default') |
|
192 | + ); |
|
193 | + } |
|
194 | + wp_enqueue_style($this->theme); |
|
195 | + if (EE_Registry::instance()->CFG->map_settings->use_google_maps) { |
|
196 | + add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11); |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | 200 | } |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | */ |
171 | 171 | public function venue_location($content) |
172 | 172 | { |
173 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
173 | + return $content.EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | // get some style |
186 | 186 | if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
187 | 187 | // first check theme folder |
188 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
188 | + if (is_readable(get_stylesheet_directory().$this->theme.'/style.css')) { |
|
189 | 189 | wp_register_style( |
190 | 190 | $this->theme, |
191 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
191 | + get_stylesheet_directory_uri().$this->theme.'/style.css', |
|
192 | 192 | array('dashicons', 'espresso_default') |
193 | 193 | ); |
194 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
194 | + } elseif (is_readable(EE_TEMPLATES.$this->theme.'/style.css')) { |
|
195 | 195 | wp_register_style( |
196 | 196 | $this->theme, |
197 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
197 | + EE_TEMPLATES_URL.$this->theme.'/style.css', |
|
198 | 198 | array('dashicons', 'espresso_default') |
199 | 199 | ); |
200 | 200 | } |
@@ -28,178 +28,178 @@ |
||
28 | 28 | */ |
29 | 29 | class EED_Venues_Archive extends EED_Module |
30 | 30 | { |
31 | - /** |
|
32 | - * @return EED_Venues_Archive |
|
33 | - */ |
|
34 | - public static function instance() |
|
35 | - { |
|
36 | - return parent::get_instance(__CLASS__); |
|
37 | - } |
|
38 | - |
|
39 | - |
|
40 | - /** |
|
41 | - * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | - * |
|
43 | - * @return void |
|
44 | - * @throws InvalidArgumentException |
|
45 | - * @throws InvalidDataTypeException |
|
46 | - * @throws InvalidInterfaceException |
|
47 | - */ |
|
48 | - public static function set_hooks() |
|
49 | - { |
|
50 | - /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
51 | - $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
52 | - 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
53 | - ); |
|
54 | - $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
55 | - EE_Config::register_route( |
|
56 | - $custom_post_types['espresso_venues']['plural_slug'], |
|
57 | - 'Venues_Archive', |
|
58 | - 'run' |
|
59 | - ); |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
64 | - * |
|
65 | - * @access public |
|
66 | - * @return void |
|
67 | - */ |
|
68 | - public static function set_hooks_admin() |
|
69 | - { |
|
70 | - } |
|
71 | - |
|
72 | - |
|
73 | - /** |
|
74 | - * run - initial module setup |
|
75 | - * |
|
76 | - * @access public |
|
77 | - * @param \WP $WP |
|
78 | - */ |
|
79 | - public function run($WP) |
|
80 | - { |
|
81 | - // check what template is loaded |
|
82 | - add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
83 | - add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * template_include |
|
89 | - * |
|
90 | - * @access public |
|
91 | - * @param string $template |
|
92 | - * @return string |
|
93 | - */ |
|
94 | - public function template_include($template) |
|
95 | - { |
|
96 | - // not a custom template? |
|
97 | - if ( |
|
98 | - EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
99 | - ->get_selected_template() != 'archive-espresso_venues.php' |
|
100 | - ) { |
|
101 | - EEH_Template::load_espresso_theme_functions(); |
|
102 | - // then add extra event data via hooks |
|
103 | - add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
104 | - // don't know if theme uses the_excerpt |
|
105 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
106 | - // or the_content |
|
107 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
108 | - // don't display entry meta because the existing theme will take care of that |
|
109 | - add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
110 | - } |
|
111 | - return $template; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - /** |
|
116 | - * the_title |
|
117 | - * |
|
118 | - * @access public |
|
119 | - * @param string $title |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function the_title($title = '') |
|
123 | - { |
|
124 | - return $title; |
|
125 | - } |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * venue_details |
|
130 | - * |
|
131 | - * @access public |
|
132 | - * @param string $content |
|
133 | - * @return string |
|
134 | - */ |
|
135 | - public function venue_details($content) |
|
136 | - { |
|
137 | - global $post; |
|
138 | - if ( |
|
139 | - $post->post_type == 'espresso_venues' |
|
140 | - && ! post_password_required() |
|
141 | - ) { |
|
142 | - // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
143 | - // it uses the_content() for displaying the $post->post_content |
|
144 | - // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
145 | - // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
146 | - remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
147 | - remove_filter('the_content', array($this, 'venue_details'), 100); |
|
148 | - // add filters we want |
|
149 | - add_filter('the_content', array($this, 'venue_location'), 110); |
|
150 | - add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
151 | - // now load our template |
|
152 | - $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
153 | - // now add our filter back in, plus some others |
|
154 | - add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
155 | - add_filter('the_content', array($this, 'venue_details'), 100); |
|
156 | - // remove other filters we added so they won't get applied to the next post |
|
157 | - remove_filter('the_content', array($this, 'venue_location'), 110); |
|
158 | - remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
159 | - // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
160 | - } |
|
161 | - return ! empty($template) ? $template : $content; |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - /** |
|
166 | - * venue_location |
|
167 | - * |
|
168 | - * @access public |
|
169 | - * @param string $content |
|
170 | - * @return string |
|
171 | - */ |
|
172 | - public function venue_location($content) |
|
173 | - { |
|
174 | - return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
175 | - } |
|
176 | - |
|
177 | - |
|
178 | - /** |
|
179 | - * wp_enqueue_scripts |
|
180 | - * |
|
181 | - * @access public |
|
182 | - * @return void |
|
183 | - */ |
|
184 | - public function wp_enqueue_scripts() |
|
185 | - { |
|
186 | - // get some style |
|
187 | - if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
188 | - // first check theme folder |
|
189 | - if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
190 | - wp_register_style( |
|
191 | - $this->theme, |
|
192 | - get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
193 | - array('dashicons', 'espresso_default') |
|
194 | - ); |
|
195 | - } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
196 | - wp_register_style( |
|
197 | - $this->theme, |
|
198 | - EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
199 | - array('dashicons', 'espresso_default') |
|
200 | - ); |
|
201 | - } |
|
202 | - wp_enqueue_style($this->theme); |
|
203 | - } |
|
204 | - } |
|
31 | + /** |
|
32 | + * @return EED_Venues_Archive |
|
33 | + */ |
|
34 | + public static function instance() |
|
35 | + { |
|
36 | + return parent::get_instance(__CLASS__); |
|
37 | + } |
|
38 | + |
|
39 | + |
|
40 | + /** |
|
41 | + * set_hooks - for hooking into EE Core, other modules, etc |
|
42 | + * |
|
43 | + * @return void |
|
44 | + * @throws InvalidArgumentException |
|
45 | + * @throws InvalidDataTypeException |
|
46 | + * @throws InvalidInterfaceException |
|
47 | + */ |
|
48 | + public static function set_hooks() |
|
49 | + { |
|
50 | + /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */ |
|
51 | + $custom_post_type_definitions = LoaderFactory::getLoader()->getShared( |
|
52 | + 'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions' |
|
53 | + ); |
|
54 | + $custom_post_types = $custom_post_type_definitions->getDefinitions(); |
|
55 | + EE_Config::register_route( |
|
56 | + $custom_post_types['espresso_venues']['plural_slug'], |
|
57 | + 'Venues_Archive', |
|
58 | + 'run' |
|
59 | + ); |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * set_hooks_admin - for hooking into EE Admin Core, other modules, etc |
|
64 | + * |
|
65 | + * @access public |
|
66 | + * @return void |
|
67 | + */ |
|
68 | + public static function set_hooks_admin() |
|
69 | + { |
|
70 | + } |
|
71 | + |
|
72 | + |
|
73 | + /** |
|
74 | + * run - initial module setup |
|
75 | + * |
|
76 | + * @access public |
|
77 | + * @param \WP $WP |
|
78 | + */ |
|
79 | + public function run($WP) |
|
80 | + { |
|
81 | + // check what template is loaded |
|
82 | + add_filter('template_include', array($this, 'template_include'), 999, 1); |
|
83 | + add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * template_include |
|
89 | + * |
|
90 | + * @access public |
|
91 | + * @param string $template |
|
92 | + * @return string |
|
93 | + */ |
|
94 | + public function template_include($template) |
|
95 | + { |
|
96 | + // not a custom template? |
|
97 | + if ( |
|
98 | + EE_Registry::instance()->load_core('Front_Controller', array(), false, true) |
|
99 | + ->get_selected_template() != 'archive-espresso_venues.php' |
|
100 | + ) { |
|
101 | + EEH_Template::load_espresso_theme_functions(); |
|
102 | + // then add extra event data via hooks |
|
103 | + add_filter('the_title', array($this, 'the_title'), 100, 1); |
|
104 | + // don't know if theme uses the_excerpt |
|
105 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
106 | + // or the_content |
|
107 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
108 | + // don't display entry meta because the existing theme will take care of that |
|
109 | + add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false'); |
|
110 | + } |
|
111 | + return $template; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + /** |
|
116 | + * the_title |
|
117 | + * |
|
118 | + * @access public |
|
119 | + * @param string $title |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function the_title($title = '') |
|
123 | + { |
|
124 | + return $title; |
|
125 | + } |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * venue_details |
|
130 | + * |
|
131 | + * @access public |
|
132 | + * @param string $content |
|
133 | + * @return string |
|
134 | + */ |
|
135 | + public function venue_details($content) |
|
136 | + { |
|
137 | + global $post; |
|
138 | + if ( |
|
139 | + $post->post_type == 'espresso_venues' |
|
140 | + && ! post_password_required() |
|
141 | + ) { |
|
142 | + // since the 'content-espresso_venues-details.php' template might be used directly from within a theme, |
|
143 | + // it uses the_content() for displaying the $post->post_content |
|
144 | + // so in order to load a template that uses the_content() from within a callback being used to filter the_content(), |
|
145 | + // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb) |
|
146 | + remove_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
147 | + remove_filter('the_content', array($this, 'venue_details'), 100); |
|
148 | + // add filters we want |
|
149 | + add_filter('the_content', array($this, 'venue_location'), 110); |
|
150 | + add_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
151 | + // now load our template |
|
152 | + $template = EEH_Template::locate_template('content-espresso_venues-details.php'); |
|
153 | + // now add our filter back in, plus some others |
|
154 | + add_filter('the_excerpt', array($this, 'venue_details'), 100); |
|
155 | + add_filter('the_content', array($this, 'venue_details'), 100); |
|
156 | + // remove other filters we added so they won't get applied to the next post |
|
157 | + remove_filter('the_content', array($this, 'venue_location'), 110); |
|
158 | + remove_filter('the_excerpt', array($this, 'venue_location'), 110); |
|
159 | + // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt) |
|
160 | + } |
|
161 | + return ! empty($template) ? $template : $content; |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + /** |
|
166 | + * venue_location |
|
167 | + * |
|
168 | + * @access public |
|
169 | + * @param string $content |
|
170 | + * @return string |
|
171 | + */ |
|
172 | + public function venue_location($content) |
|
173 | + { |
|
174 | + return $content . EEH_Template::locate_template('content-espresso_venues-location.php'); |
|
175 | + } |
|
176 | + |
|
177 | + |
|
178 | + /** |
|
179 | + * wp_enqueue_scripts |
|
180 | + * |
|
181 | + * @access public |
|
182 | + * @return void |
|
183 | + */ |
|
184 | + public function wp_enqueue_scripts() |
|
185 | + { |
|
186 | + // get some style |
|
187 | + if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) { |
|
188 | + // first check theme folder |
|
189 | + if (is_readable(get_stylesheet_directory() . $this->theme . '/style.css')) { |
|
190 | + wp_register_style( |
|
191 | + $this->theme, |
|
192 | + get_stylesheet_directory_uri() . $this->theme . '/style.css', |
|
193 | + array('dashicons', 'espresso_default') |
|
194 | + ); |
|
195 | + } elseif (is_readable(EE_TEMPLATES . $this->theme . '/style.css')) { |
|
196 | + wp_register_style( |
|
197 | + $this->theme, |
|
198 | + EE_TEMPLATES_URL . $this->theme . '/style.css', |
|
199 | + array('dashicons', 'espresso_default') |
|
200 | + ); |
|
201 | + } |
|
202 | + wp_enqueue_style($this->theme); |
|
203 | + } |
|
204 | + } |
|
205 | 205 | } |