@@ -53,7 +53,7 @@ |
||
53 | 53 | 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
54 | 54 | 'event_espresso' |
55 | 55 | ), |
56 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
56 | + '<img src="'.admin_url('images/media-button-image.gif').'">' |
|
57 | 57 | ); |
58 | 58 | ?> |
59 | 59 | </li> |
@@ -12,62 +12,62 @@ discard block |
||
12 | 12 | <strong><?php esc_html_e('Name', 'event_espresso'); ?></strong> |
13 | 13 | <br> |
14 | 14 | <?php esc_html_e( |
15 | - 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
16 | - 'event_espresso' |
|
17 | - ); ?> |
|
15 | + 'The name of the payment method as customers see it in the registration form, in emails, in receipts, etc.', |
|
16 | + 'event_espresso' |
|
17 | + ); ?> |
|
18 | 18 | </li> |
19 | 19 | <li> |
20 | 20 | <strong><?php esc_html_e('Description', 'event_espresso'); ?></strong> |
21 | 21 | <br /> |
22 | 22 | <?php esc_html_e( |
23 | - 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
24 | - 'event_espresso' |
|
25 | - ); ?> |
|
23 | + 'The description of how to use the payment method as customers will see it. This is mostly only seen during registration.', |
|
24 | + 'event_espresso' |
|
25 | + ); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php esc_html_e('Admin-Only Name', 'event_espresso'); ?></strong> |
29 | 29 | <br /> |
30 | 30 | <?php esc_html_e( |
31 | - 'The name of the payment method as seen internally by site administrators and staff.', |
|
32 | - 'event_espresso' |
|
33 | - ); ?> |
|
31 | + 'The name of the payment method as seen internally by site administrators and staff.', |
|
32 | + 'event_espresso' |
|
33 | + ); ?> |
|
34 | 34 | </li> |
35 | 35 | <li> |
36 | 36 | <strong><?php esc_html_e('Admin-Only Description', 'event_espresso'); ?></strong> |
37 | 37 | <br /> |
38 | 38 | <?php esc_html_e( |
39 | - 'The description of the payment method as seen internally by site administrators and staff.', |
|
40 | - 'event_espresso' |
|
41 | - ); ?> |
|
39 | + 'The description of the payment method as seen internally by site administrators and staff.', |
|
40 | + 'event_espresso' |
|
41 | + ); ?> |
|
42 | 42 | </li> |
43 | 43 | <li> |
44 | 44 | <strong><?php esc_html_e('Debug (sandbox) Mode', 'event_espresso'); ?></strong> |
45 | 45 | <br /> |
46 | 46 | <?php esc_html_e( |
47 | - 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
48 | - 'event_espresso' |
|
49 | - ); ?> |
|
47 | + 'Many payment methods have a debug/sandbox mode where payments are not processed but are only simulated. This is helpful when setup and debugging.', |
|
48 | + 'event_espresso' |
|
49 | + ); ?> |
|
50 | 50 | </li> |
51 | 51 | <li> |
52 | 52 | <strong><?php esc_html_e('Open by Default', 'event_espresso'); ?></strong> |
53 | 53 | <br /> |
54 | 54 | <?php esc_html_e( |
55 | - 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
56 | - 'event_espresso' |
|
57 | - ); ?> |
|
55 | + 'If checked, this payment method will be selected by default (assuming no other valid payment methods are also marked as open by default.)', |
|
56 | + 'event_espresso' |
|
57 | + ); ?> |
|
58 | 58 | </li> |
59 | 59 | <li> |
60 | 60 | <strong><?php esc_html_e('Button URL', 'event_espresso'); ?></strong> |
61 | 61 | <br /> |
62 | 62 | <?php |
63 | - printf( |
|
64 | - esc_html__( |
|
65 | - 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
66 | - 'event_espresso' |
|
67 | - ), |
|
68 | - '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
69 | - ); |
|
70 | - ?> |
|
63 | + printf( |
|
64 | + esc_html__( |
|
65 | + 'The URL of the button image for this payment method in the registration process. You may use any uploaded image on your website (click %s next to the field to select). If left blank, the default button image will be used.', |
|
66 | + 'event_espresso' |
|
67 | + ), |
|
68 | + '<img src="' . admin_url('images/media-button-image.gif') . '">' |
|
69 | + ); |
|
70 | + ?> |
|
71 | 71 | </li> |
72 | 72 | <li> |
73 | 73 | <strong><?php esc_html_e('Usable From', 'event_espresso'); ?></strong> |
@@ -76,15 +76,15 @@ discard block |
||
76 | 76 | <ul> |
77 | 77 | <li> |
78 | 78 | <?php esc_html_e( |
79 | - 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
80 | - 'event_espresso' |
|
81 | - ); ?> |
|
79 | + 'Front-end Registration Page: the payment method will appear as an option during the normal registration process to customers and they can use it to process payments.', |
|
80 | + 'event_espresso' |
|
81 | + ); ?> |
|
82 | 82 | </li> |
83 | 83 | <li> |
84 | 84 | <?php esc_html_e( |
85 | - 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
86 | - 'event_espresso' |
|
87 | - ); ?> |
|
85 | + 'Admin Registration Page: when recording payments made from the transaction admin page, the payment method will appear as an option. Note: currently payments can only be RECORDED from the admin, they cannot be PROCESSED.', |
|
86 | + 'event_espresso' |
|
87 | + ); ?> |
|
88 | 88 | </li> |
89 | 89 | </ul> |
90 | 90 | </li> |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | <strong><?php esc_html_e('Recommendations', 'event_espresso'); ?></strong> |
93 | 93 | <br /> |
94 | 94 | <?php esc_html_e( |
95 | - 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
96 | - 'event_espresso' |
|
95 | + 'To learn more about the options on this page, take a look at the different tabs that appear on the left side of the page.', |
|
96 | + 'event_espresso' |
|
97 | 97 | ); ?> |
98 | 98 | <p> |
99 | 99 | <strong><?php esc_html_e('Screen Options', 'event_espresso'); ?></strong> |
100 | 100 | <br /> |
101 | 101 | <?php esc_html_e( |
102 | - 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
103 | - 'event_espresso' |
|
104 | - ); ?> |
|
102 | + 'You can customize the information that is shown on this page by toggling the Screen Options tab. Then you can add or remove checkmarks to hide or show certain content.', |
|
103 | + 'event_espresso' |
|
104 | + ); ?> |
|
105 | 105 | </p> |
@@ -8,31 +8,31 @@ |
||
8 | 8 | |
9 | 9 | class SitePermissions extends JsonDataNode |
10 | 10 | { |
11 | - const NODE_NAME = 'sitePermissions'; |
|
12 | - |
|
13 | - /** |
|
14 | - * @var FeatureFlags |
|
15 | - */ |
|
16 | - private $feature_flags; |
|
17 | - |
|
18 | - |
|
19 | - /** |
|
20 | - * @param FeatureFlags $feature_flags |
|
21 | - * @param JsonDataNodeValidator $validator |
|
22 | - */ |
|
23 | - public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator) |
|
24 | - { |
|
25 | - $this->feature_flags = $feature_flags; |
|
26 | - parent::__construct($validator); |
|
27 | - $this->setNodeName(SitePermissions::NODE_NAME); |
|
28 | - } |
|
29 | - |
|
30 | - |
|
31 | - /** |
|
32 | - * @inheritDoc |
|
33 | - */ |
|
34 | - public function initialize() |
|
35 | - { |
|
36 | - $this->setDataArray($this->feature_flags->getAllowedFeatures()); |
|
37 | - } |
|
11 | + const NODE_NAME = 'sitePermissions'; |
|
12 | + |
|
13 | + /** |
|
14 | + * @var FeatureFlags |
|
15 | + */ |
|
16 | + private $feature_flags; |
|
17 | + |
|
18 | + |
|
19 | + /** |
|
20 | + * @param FeatureFlags $feature_flags |
|
21 | + * @param JsonDataNodeValidator $validator |
|
22 | + */ |
|
23 | + public function __construct(FeatureFlags $feature_flags, JsonDataNodeValidator $validator) |
|
24 | + { |
|
25 | + $this->feature_flags = $feature_flags; |
|
26 | + parent::__construct($validator); |
|
27 | + $this->setNodeName(SitePermissions::NODE_NAME); |
|
28 | + } |
|
29 | + |
|
30 | + |
|
31 | + /** |
|
32 | + * @inheritDoc |
|
33 | + */ |
|
34 | + public function initialize() |
|
35 | + { |
|
36 | + $this->setDataArray($this->feature_flags->getAllowedFeatures()); |
|
37 | + } |
|
38 | 38 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | && ! function_exists('json_basic_auth_handler') |
43 | 43 | && ! function_exists('json_basic_auth_error') |
44 | 44 | ) { |
45 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php'; |
|
45 | + include_once EE_THIRD_PARTY.'wp-api-basic-auth/basic-auth.php'; |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | } |
@@ -6,40 +6,40 @@ |
||
6 | 6 | |
7 | 7 | class ThirdPartyPluginHandler |
8 | 8 | { |
9 | - private RequestInterface $request; |
|
10 | - |
|
11 | - |
|
12 | - /** |
|
13 | - * ThirdPartyPluginHandler constructor. |
|
14 | - * |
|
15 | - * @param RequestInterface $request |
|
16 | - */ |
|
17 | - public function __construct(RequestInterface $request) |
|
18 | - { |
|
19 | - $this->request = $request; |
|
20 | - } |
|
21 | - |
|
22 | - |
|
23 | - public function loadPlugins() |
|
24 | - { |
|
25 | - $this->wpApiBasicAuth(); |
|
26 | - } |
|
27 | - |
|
28 | - |
|
29 | - private function wpApiBasicAuth() |
|
30 | - { |
|
31 | - // if the WP API basic auth plugin isn't already loaded, load it now. |
|
32 | - // We want it for mobile apps. Just include the entire plugin |
|
33 | - // also, don't load the basic auth when a plugin is getting activated, because |
|
34 | - // it could be the basic auth plugin, and it doesn't check if its methods are already defined |
|
35 | - // and causes a fatal error |
|
36 | - if ( |
|
37 | - ($this->request->isWordPressApi() || $this->request->isApi()) |
|
38 | - && ! $this->request->isActivation() |
|
39 | - && ! function_exists('json_basic_auth_handler') |
|
40 | - && ! function_exists('json_basic_auth_error') |
|
41 | - ) { |
|
42 | - include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php'; |
|
43 | - } |
|
44 | - } |
|
9 | + private RequestInterface $request; |
|
10 | + |
|
11 | + |
|
12 | + /** |
|
13 | + * ThirdPartyPluginHandler constructor. |
|
14 | + * |
|
15 | + * @param RequestInterface $request |
|
16 | + */ |
|
17 | + public function __construct(RequestInterface $request) |
|
18 | + { |
|
19 | + $this->request = $request; |
|
20 | + } |
|
21 | + |
|
22 | + |
|
23 | + public function loadPlugins() |
|
24 | + { |
|
25 | + $this->wpApiBasicAuth(); |
|
26 | + } |
|
27 | + |
|
28 | + |
|
29 | + private function wpApiBasicAuth() |
|
30 | + { |
|
31 | + // if the WP API basic auth plugin isn't already loaded, load it now. |
|
32 | + // We want it for mobile apps. Just include the entire plugin |
|
33 | + // also, don't load the basic auth when a plugin is getting activated, because |
|
34 | + // it could be the basic auth plugin, and it doesn't check if its methods are already defined |
|
35 | + // and causes a fatal error |
|
36 | + if ( |
|
37 | + ($this->request->isWordPressApi() || $this->request->isApi()) |
|
38 | + && ! $this->request->isActivation() |
|
39 | + && ! function_exists('json_basic_auth_handler') |
|
40 | + && ! function_exists('json_basic_auth_error') |
|
41 | + ) { |
|
42 | + include_once EE_THIRD_PARTY . 'wp-api-basic-auth/basic-auth.php'; |
|
43 | + } |
|
44 | + } |
|
45 | 45 | } |
@@ -33,14 +33,14 @@ |
||
33 | 33 | */ |
34 | 34 | public function __construct(string $fully_qualified_name) |
35 | 35 | { |
36 | - if (! is_string($fully_qualified_name)) { |
|
36 | + if ( ! is_string($fully_qualified_name)) { |
|
37 | 37 | throw new InvalidDataTypeException( |
38 | 38 | '$fully_qualified_name', |
39 | 39 | $fully_qualified_name, |
40 | 40 | 'string' |
41 | 41 | ); |
42 | 42 | } |
43 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
43 | + if ( ! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
44 | 44 | if (strpos($fully_qualified_name, 'Interface') !== false) { |
45 | 45 | throw new InvalidInterfaceException($fully_qualified_name); |
46 | 46 | } |
@@ -16,53 +16,53 @@ |
||
16 | 16 | */ |
17 | 17 | class FullyQualifiedName |
18 | 18 | { |
19 | - /** |
|
20 | - * @var string $fully_qualified_name |
|
21 | - */ |
|
22 | - private $fully_qualified_name; |
|
19 | + /** |
|
20 | + * @var string $fully_qualified_name |
|
21 | + */ |
|
22 | + private $fully_qualified_name; |
|
23 | 23 | |
24 | 24 | |
25 | - /** |
|
26 | - * FullyQualifiedName constructor. |
|
27 | - * |
|
28 | - * @param string $fully_qualified_name |
|
29 | - * @throws InvalidClassException |
|
30 | - * @throws InvalidInterfaceException |
|
31 | - * @throws InvalidDataTypeException |
|
32 | - */ |
|
33 | - public function __construct(string $fully_qualified_name) |
|
34 | - { |
|
35 | - if (! is_string($fully_qualified_name)) { |
|
36 | - throw new InvalidDataTypeException( |
|
37 | - '$fully_qualified_name', |
|
38 | - $fully_qualified_name, |
|
39 | - 'string' |
|
40 | - ); |
|
41 | - } |
|
42 | - if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
43 | - if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
44 | - throw new InvalidInterfaceException($fully_qualified_name); |
|
45 | - } |
|
46 | - throw new InvalidClassException($fully_qualified_name); |
|
47 | - } |
|
48 | - $this->fully_qualified_name = $fully_qualified_name; |
|
49 | - } |
|
25 | + /** |
|
26 | + * FullyQualifiedName constructor. |
|
27 | + * |
|
28 | + * @param string $fully_qualified_name |
|
29 | + * @throws InvalidClassException |
|
30 | + * @throws InvalidInterfaceException |
|
31 | + * @throws InvalidDataTypeException |
|
32 | + */ |
|
33 | + public function __construct(string $fully_qualified_name) |
|
34 | + { |
|
35 | + if (! is_string($fully_qualified_name)) { |
|
36 | + throw new InvalidDataTypeException( |
|
37 | + '$fully_qualified_name', |
|
38 | + $fully_qualified_name, |
|
39 | + 'string' |
|
40 | + ); |
|
41 | + } |
|
42 | + if (! class_exists($fully_qualified_name) && ! interface_exists($fully_qualified_name)) { |
|
43 | + if (strpos($fully_qualified_name, 'Interface') !== false) { |
|
44 | + throw new InvalidInterfaceException($fully_qualified_name); |
|
45 | + } |
|
46 | + throw new InvalidClassException($fully_qualified_name); |
|
47 | + } |
|
48 | + $this->fully_qualified_name = $fully_qualified_name; |
|
49 | + } |
|
50 | 50 | |
51 | 51 | |
52 | - /** |
|
53 | - * @return string |
|
54 | - */ |
|
55 | - public function string(): string |
|
56 | - { |
|
57 | - return $this->fully_qualified_name; |
|
58 | - } |
|
52 | + /** |
|
53 | + * @return string |
|
54 | + */ |
|
55 | + public function string(): string |
|
56 | + { |
|
57 | + return $this->fully_qualified_name; |
|
58 | + } |
|
59 | 59 | |
60 | 60 | |
61 | - /** |
|
62 | - * @return string |
|
63 | - */ |
|
64 | - public function __toString(): string |
|
65 | - { |
|
66 | - return $this->fully_qualified_name; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @return string |
|
63 | + */ |
|
64 | + public function __toString(): string |
|
65 | + { |
|
66 | + return $this->fully_qualified_name; |
|
67 | + } |
|
68 | 68 | } |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | public static function getEventEspressoCoreDomain(): DomainInterface |
77 | 77 | { |
78 | 78 | $fqcn = 'EventEspresso\core\domain\Domain'; |
79 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
79 | + if ( ! isset(DomainFactory::$domains[$fqcn])) { |
|
80 | 80 | DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]); |
81 | 81 | } |
82 | - return DomainFactory::$domains[ $fqcn ]; |
|
82 | + return DomainFactory::$domains[$fqcn]; |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | */ |
91 | 91 | private static function getDomain(string $fqcn, array $arguments): DomainInterface |
92 | 92 | { |
93 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
94 | - if (! isset($arguments[0], $arguments[1])) { |
|
93 | + if ( ! isset(DomainFactory::$domains[$fqcn])) { |
|
94 | + if ( ! isset($arguments[0], $arguments[1])) { |
|
95 | 95 | throw new InvalidArgumentException( |
96 | 96 | esc_html__( |
97 | 97 | 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]); |
103 | 103 | $version = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]); |
104 | 104 | $domain = new $fqcn($filepath, $version); |
105 | - if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
105 | + if ( ! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
106 | 106 | throw new DomainException( |
107 | 107 | sprintf( |
108 | 108 | esc_html__( |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | ) |
114 | 114 | ); |
115 | 115 | } |
116 | - DomainFactory::$domains[ $fqcn ] = $domain; |
|
116 | + DomainFactory::$domains[$fqcn] = $domain; |
|
117 | 117 | // we still need to share this with the core loader to facilitate automatic dependency injection |
118 | 118 | LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]); |
119 | 119 | } |
120 | - return DomainFactory::$domains[ $fqcn ]; |
|
120 | + return DomainFactory::$domains[$fqcn]; |
|
121 | 121 | } |
122 | 122 | } |
@@ -22,101 +22,101 @@ |
||
22 | 22 | */ |
23 | 23 | class DomainFactory |
24 | 24 | { |
25 | - /** |
|
26 | - * @var DomainInterface[] |
|
27 | - */ |
|
28 | - protected static array $domains = []; |
|
25 | + /** |
|
26 | + * @var DomainInterface[] |
|
27 | + */ |
|
28 | + protected static array $domains = []; |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * @param string $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | - * @param string $main_file [required] path to the main plugin file |
|
34 | - * @param string $version [required] version string for the plugin |
|
35 | - * @return DomainInterface |
|
36 | - * @throws DomainException |
|
37 | - * @throws InvalidArgumentException |
|
38 | - * @throws InvalidDataTypeException |
|
39 | - * @throws InvalidInterfaceException |
|
40 | - */ |
|
41 | - public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface |
|
42 | - { |
|
43 | - $fqcn = new FullyQualifiedName($domain_fqcn); |
|
44 | - return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]); |
|
45 | - } |
|
31 | + /** |
|
32 | + * @param string $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
33 | + * @param string $main_file [required] path to the main plugin file |
|
34 | + * @param string $version [required] version string for the plugin |
|
35 | + * @return DomainInterface |
|
36 | + * @throws DomainException |
|
37 | + * @throws InvalidArgumentException |
|
38 | + * @throws InvalidDataTypeException |
|
39 | + * @throws InvalidInterfaceException |
|
40 | + */ |
|
41 | + public static function create(string $domain_fqcn, string $main_file, string $version): DomainInterface |
|
42 | + { |
|
43 | + $fqcn = new FullyQualifiedName($domain_fqcn); |
|
44 | + return DomainFactory::getDomain($fqcn->string(), [$main_file, $version]); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
50 | - * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
51 | - * constructor. Must at least include the following two value objects: |
|
52 | - * [ |
|
53 | - * EventEspresso\core\domain\values\FilePath $plugin_file |
|
54 | - * EventEspresso\core\domain\values\Version $version |
|
55 | - * ] |
|
56 | - * @return DomainInterface |
|
57 | - * @throws DomainException |
|
58 | - * @throws InvalidArgumentException |
|
59 | - * @throws InvalidDataTypeException |
|
60 | - * @throws InvalidInterfaceException |
|
61 | - */ |
|
62 | - public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface |
|
63 | - { |
|
64 | - return DomainFactory::getDomain($domain_fqcn->string(), $arguments); |
|
65 | - } |
|
48 | + /** |
|
49 | + * @param FullyQualifiedName $domain_fqcn [required] Fully Qualified Class Name for the Domain class |
|
50 | + * @param array $arguments [required] array of arguments to be passed to the Domain class |
|
51 | + * constructor. Must at least include the following two value objects: |
|
52 | + * [ |
|
53 | + * EventEspresso\core\domain\values\FilePath $plugin_file |
|
54 | + * EventEspresso\core\domain\values\Version $version |
|
55 | + * ] |
|
56 | + * @return DomainInterface |
|
57 | + * @throws DomainException |
|
58 | + * @throws InvalidArgumentException |
|
59 | + * @throws InvalidDataTypeException |
|
60 | + * @throws InvalidInterfaceException |
|
61 | + */ |
|
62 | + public static function getShared(FullyQualifiedName $domain_fqcn, array $arguments): DomainInterface |
|
63 | + { |
|
64 | + return DomainFactory::getDomain($domain_fqcn->string(), $arguments); |
|
65 | + } |
|
66 | 66 | |
67 | 67 | |
68 | - /** |
|
69 | - * @return DomainInterface |
|
70 | - * @throws DomainException |
|
71 | - * @throws InvalidArgumentException |
|
72 | - * @throws InvalidDataTypeException |
|
73 | - * @throws InvalidFilePathException |
|
74 | - * @throws InvalidInterfaceException |
|
75 | - */ |
|
76 | - public static function getEventEspressoCoreDomain(): DomainInterface |
|
77 | - { |
|
78 | - $fqcn = 'EventEspresso\core\domain\Domain'; |
|
79 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
80 | - DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]); |
|
81 | - } |
|
82 | - return DomainFactory::$domains[ $fqcn ]; |
|
83 | - } |
|
68 | + /** |
|
69 | + * @return DomainInterface |
|
70 | + * @throws DomainException |
|
71 | + * @throws InvalidArgumentException |
|
72 | + * @throws InvalidDataTypeException |
|
73 | + * @throws InvalidFilePathException |
|
74 | + * @throws InvalidInterfaceException |
|
75 | + */ |
|
76 | + public static function getEventEspressoCoreDomain(): DomainInterface |
|
77 | + { |
|
78 | + $fqcn = 'EventEspresso\core\domain\Domain'; |
|
79 | + if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
80 | + DomainFactory::getDomain($fqcn, [EVENT_ESPRESSO_MAIN_FILE, espresso_version()]); |
|
81 | + } |
|
82 | + return DomainFactory::$domains[ $fqcn ]; |
|
83 | + } |
|
84 | 84 | |
85 | 85 | |
86 | - /** |
|
87 | - * @param string $fqcn |
|
88 | - * @param array $arguments |
|
89 | - * @return DomainInterface |
|
90 | - */ |
|
91 | - private static function getDomain(string $fqcn, array $arguments): DomainInterface |
|
92 | - { |
|
93 | - if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
94 | - if (! isset($arguments[0], $arguments[1])) { |
|
95 | - throw new InvalidArgumentException( |
|
96 | - esc_html__( |
|
97 | - 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
98 | - 'event_espresso' |
|
99 | - ) |
|
100 | - ); |
|
101 | - } |
|
102 | - $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]); |
|
103 | - $version = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]); |
|
104 | - $domain = new $fqcn($filepath, $version); |
|
105 | - if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
106 | - throw new DomainException( |
|
107 | - sprintf( |
|
108 | - esc_html__( |
|
109 | - 'The requested Domain class "%1$s" could not be loaded.', |
|
110 | - 'event_espresso' |
|
111 | - ), |
|
112 | - $fqcn |
|
113 | - ) |
|
114 | - ); |
|
115 | - } |
|
116 | - DomainFactory::$domains[ $fqcn ] = $domain; |
|
117 | - // we still need to share this with the core loader to facilitate automatic dependency injection |
|
118 | - LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]); |
|
119 | - } |
|
120 | - return DomainFactory::$domains[ $fqcn ]; |
|
121 | - } |
|
86 | + /** |
|
87 | + * @param string $fqcn |
|
88 | + * @param array $arguments |
|
89 | + * @return DomainInterface |
|
90 | + */ |
|
91 | + private static function getDomain(string $fqcn, array $arguments): DomainInterface |
|
92 | + { |
|
93 | + if (! isset(DomainFactory::$domains[ $fqcn ])) { |
|
94 | + if (! isset($arguments[0], $arguments[1])) { |
|
95 | + throw new InvalidArgumentException( |
|
96 | + esc_html__( |
|
97 | + 'You need to pass at least two arguments, representing the addon plugin file and version, in order to generate a Domain class', |
|
98 | + 'event_espresso' |
|
99 | + ) |
|
100 | + ); |
|
101 | + } |
|
102 | + $filepath = $arguments[0] instanceof FilePath ? $arguments[0] : new FilePath($arguments[0]); |
|
103 | + $version = $arguments[1] instanceof Version ? $arguments[1] : Version::fromString($arguments[1]); |
|
104 | + $domain = new $fqcn($filepath, $version); |
|
105 | + if (! $domain instanceof DomainBase || ! $domain instanceof $fqcn) { |
|
106 | + throw new DomainException( |
|
107 | + sprintf( |
|
108 | + esc_html__( |
|
109 | + 'The requested Domain class "%1$s" could not be loaded.', |
|
110 | + 'event_espresso' |
|
111 | + ), |
|
112 | + $fqcn |
|
113 | + ) |
|
114 | + ); |
|
115 | + } |
|
116 | + DomainFactory::$domains[ $fqcn ] = $domain; |
|
117 | + // we still need to share this with the core loader to facilitate automatic dependency injection |
|
118 | + LoaderFactory::getLoader()->share($fqcn, $domain, [$filepath, $version, $domain->assetNamespace()]); |
|
119 | + } |
|
120 | + return DomainFactory::$domains[ $fqcn ]; |
|
121 | + } |
|
122 | 122 | } |
@@ -3,25 +3,25 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php |
6 | - printf( |
|
7 | - esc_html__( |
|
8 | - 'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.', |
|
9 | - 'event_espresso' |
|
10 | - ), |
|
11 | - '<em>', |
|
12 | - '</em>' |
|
13 | - ); |
|
14 | - ?> |
|
6 | + printf( |
|
7 | + esc_html__( |
|
8 | + 'Message Templates are the %1$sformat%2$s of the messages going out. Think of them as a “form letter”. Templates tell the Messages system how to style your messages and the content (information) they will have when they are delivered.', |
|
9 | + 'event_espresso' |
|
10 | + ), |
|
11 | + '<em>', |
|
12 | + '</em>' |
|
13 | + ); |
|
14 | + ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <?php esc_html_e( |
18 | - 'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant. Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).', |
|
19 | - 'event_espresso' |
|
20 | - ); ?> |
|
18 | + 'There is a template created for each Messenger / Message Type and context combination. For example, messages that are sent for Payment Confirmation have a template for Event Administrator and a different one for Primary Registrant. Whereas, messages that are sent for the Registration confirmation have 3 templates: one for Event Administrator, one for the Primary Registrant, and another for each additional Registrant(s).', |
|
19 | + 'event_espresso' |
|
20 | + ); ?> |
|
21 | 21 | </p> |
22 | 22 | <p> |
23 | 23 | <?php esc_html_e( |
24 | - 'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', |
|
25 | - 'event_espresso' |
|
26 | - ); ?> |
|
24 | + 'With the Event Espresso Messages system, every Messenger, Message Type, and context will have a global template created with some default content on creation. You have the ability to edit the global template that will be used for all events you create. Additionally, you have the ability to create custom templates for each event on the edit event page for the event (in a metabox labelled "Notifications").', |
|
25 | + 'event_espresso' |
|
26 | + ); ?> |
|
27 | 27 | </p> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | private function _get_datetimes_from_event(EE_Event $event) |
169 | 169 | { |
170 | 170 | return isset($this->_extra_data['data']->events) |
171 | - ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
171 | + ? $this->_extra_data['data']->events[$event->ID()]['dtt_objs'] |
|
172 | 172 | : []; |
173 | 173 | } |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
183 | 183 | { |
184 | 184 | return isset($this->_extra_data['data']->tickets) |
185 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
185 | + ? $this->_extra_data['data']->tickets[$ticket->ID()]['dtt_objs'] |
|
186 | 186 | : []; |
187 | 187 | } |
188 | 188 | } |
@@ -18,168 +18,168 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Datetime_List_Shortcodes extends EE_Shortcodes |
20 | 20 | { |
21 | - protected function _init_props() |
|
22 | - { |
|
23 | - $this->label = esc_html__('Datetime List Shortcodes', 'event_espresso'); |
|
24 | - $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso'); |
|
25 | - $this->_shortcodes = [ |
|
26 | - '[DATETIME_LIST]' => esc_html__( |
|
27 | - 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - ]; |
|
31 | - } |
|
32 | - |
|
33 | - |
|
34 | - /** |
|
35 | - * @param string $shortcode |
|
36 | - * @return string |
|
37 | - * @throws EE_Error |
|
38 | - * @throws ReflectionException |
|
39 | - */ |
|
40 | - protected function _parser($shortcode) |
|
41 | - { |
|
42 | - if ($shortcode == '[DATETIME_LIST]') { |
|
43 | - return $this->_get_datetime_list(); |
|
44 | - } |
|
45 | - return ''; |
|
46 | - } |
|
47 | - |
|
48 | - |
|
49 | - /** |
|
50 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
51 | - * |
|
52 | - * @return string |
|
53 | - * @throws EE_Error |
|
54 | - * @throws ReflectionException |
|
55 | - */ |
|
56 | - private function _get_datetime_list() |
|
57 | - { |
|
58 | - $this->_validate_list_requirements(); |
|
59 | - |
|
60 | - if ($this->_data['data'] instanceof EE_Ticket) { |
|
61 | - return $this->_get_datetime_list_for_ticket(); |
|
62 | - } |
|
63 | - if ($this->_data['data'] instanceof EE_Event) { |
|
64 | - return $this->_get_datetime_list_for_event(); |
|
65 | - } |
|
66 | - if ( |
|
67 | - $this->_data['data'] instanceof EE_Messages_Addressee |
|
68 | - && $this->_data['data']->reg_obj instanceof EE_Registration |
|
69 | - ) { |
|
70 | - return $this->_get_datetime_list_for_registration(); |
|
71 | - } |
|
72 | - // prevent recursive loop |
|
73 | - return ''; |
|
74 | - } |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * return parsed list of datetimes for an event |
|
79 | - * |
|
80 | - * @return string |
|
81 | - * @throws EE_Error |
|
82 | - * @throws ReflectionException |
|
83 | - */ |
|
84 | - private function _get_datetime_list_for_event() |
|
85 | - { |
|
86 | - $event = $this->_data['data']; |
|
87 | - $valid_shortcodes = ['datetime', 'attendee']; |
|
88 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
89 | - ? $this->_data['template']['datetime_list'] |
|
90 | - : $this->_extra_data['template']['datetime_list']; |
|
91 | - |
|
92 | - // here we're setting up the datetimes for the datetime list template for THIS event. |
|
93 | - $dtt_parsed = ''; |
|
94 | - $datetimes = $this->_get_datetimes_from_event($event); |
|
95 | - |
|
96 | - // each datetime in this case should be an datetime object. |
|
97 | - foreach ($datetimes as $datetime) { |
|
98 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
99 | - $template, |
|
100 | - $datetime, |
|
101 | - $valid_shortcodes, |
|
102 | - $this->_extra_data |
|
103 | - ); |
|
104 | - } |
|
105 | - |
|
106 | - return $dtt_parsed; |
|
107 | - } |
|
108 | - |
|
109 | - |
|
110 | - /** |
|
111 | - * return parsed list of datetimes for an ticket |
|
112 | - * |
|
113 | - * @return string |
|
114 | - * @throws EE_Error |
|
115 | - */ |
|
116 | - private function _get_datetime_list_for_ticket() |
|
117 | - { |
|
118 | - $valid_shortcodes = ['datetime', 'attendee']; |
|
119 | - |
|
120 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
121 | - ? $this->_data['template']['datetime_list'] |
|
122 | - : $this->_extra_data['template']['datetime_list']; |
|
123 | - $ticket = $this->_data['data']; |
|
124 | - |
|
125 | - // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
126 | - $dtt_parsed = ''; |
|
127 | - $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
128 | - |
|
129 | - // each datetime in this case should be an datetime object. |
|
130 | - foreach ($datetimes as $datetime) { |
|
131 | - $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
132 | - $template, |
|
133 | - $datetime, |
|
134 | - $valid_shortcodes, |
|
135 | - $this->_extra_data |
|
136 | - ); |
|
137 | - } |
|
138 | - |
|
139 | - return $dtt_parsed; |
|
140 | - } |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * return parsed list of datetimes from a given registration. |
|
145 | - * |
|
146 | - * @return string |
|
147 | - * @throws EE_Error |
|
148 | - * @throws EE_Error |
|
149 | - */ |
|
150 | - private function _get_datetime_list_for_registration() |
|
151 | - { |
|
152 | - $registration = $this->_data['data']->reg_obj; |
|
153 | - |
|
154 | - // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
155 | - $this->_data['data'] = $registration->ticket(); |
|
156 | - return $this->_get_datetime_list_for_ticket(); |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param EE_Event $event |
|
162 | - * @return array|mixed |
|
163 | - * @throws EE_Error |
|
164 | - * @throws ReflectionException |
|
165 | - */ |
|
166 | - private function _get_datetimes_from_event(EE_Event $event) |
|
167 | - { |
|
168 | - return isset($this->_extra_data['data']->events) |
|
169 | - ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
170 | - : []; |
|
171 | - } |
|
172 | - |
|
173 | - |
|
174 | - /** |
|
175 | - * @param EE_Ticket $ticket |
|
176 | - * @return array|mixed |
|
177 | - * @throws EE_Error |
|
178 | - */ |
|
179 | - private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
|
180 | - { |
|
181 | - return isset($this->_extra_data['data']->tickets) |
|
182 | - ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
183 | - : []; |
|
184 | - } |
|
21 | + protected function _init_props() |
|
22 | + { |
|
23 | + $this->label = esc_html__('Datetime List Shortcodes', 'event_espresso'); |
|
24 | + $this->description = esc_html__('All shortcodes specific to datetime lists', 'event_espresso'); |
|
25 | + $this->_shortcodes = [ |
|
26 | + '[DATETIME_LIST]' => esc_html__( |
|
27 | + 'Will output a list of datetimes according to the layout specified in the datetime list field.', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + ]; |
|
31 | + } |
|
32 | + |
|
33 | + |
|
34 | + /** |
|
35 | + * @param string $shortcode |
|
36 | + * @return string |
|
37 | + * @throws EE_Error |
|
38 | + * @throws ReflectionException |
|
39 | + */ |
|
40 | + protected function _parser($shortcode) |
|
41 | + { |
|
42 | + if ($shortcode == '[DATETIME_LIST]') { |
|
43 | + return $this->_get_datetime_list(); |
|
44 | + } |
|
45 | + return ''; |
|
46 | + } |
|
47 | + |
|
48 | + |
|
49 | + /** |
|
50 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
51 | + * |
|
52 | + * @return string |
|
53 | + * @throws EE_Error |
|
54 | + * @throws ReflectionException |
|
55 | + */ |
|
56 | + private function _get_datetime_list() |
|
57 | + { |
|
58 | + $this->_validate_list_requirements(); |
|
59 | + |
|
60 | + if ($this->_data['data'] instanceof EE_Ticket) { |
|
61 | + return $this->_get_datetime_list_for_ticket(); |
|
62 | + } |
|
63 | + if ($this->_data['data'] instanceof EE_Event) { |
|
64 | + return $this->_get_datetime_list_for_event(); |
|
65 | + } |
|
66 | + if ( |
|
67 | + $this->_data['data'] instanceof EE_Messages_Addressee |
|
68 | + && $this->_data['data']->reg_obj instanceof EE_Registration |
|
69 | + ) { |
|
70 | + return $this->_get_datetime_list_for_registration(); |
|
71 | + } |
|
72 | + // prevent recursive loop |
|
73 | + return ''; |
|
74 | + } |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * return parsed list of datetimes for an event |
|
79 | + * |
|
80 | + * @return string |
|
81 | + * @throws EE_Error |
|
82 | + * @throws ReflectionException |
|
83 | + */ |
|
84 | + private function _get_datetime_list_for_event() |
|
85 | + { |
|
86 | + $event = $this->_data['data']; |
|
87 | + $valid_shortcodes = ['datetime', 'attendee']; |
|
88 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
89 | + ? $this->_data['template']['datetime_list'] |
|
90 | + : $this->_extra_data['template']['datetime_list']; |
|
91 | + |
|
92 | + // here we're setting up the datetimes for the datetime list template for THIS event. |
|
93 | + $dtt_parsed = ''; |
|
94 | + $datetimes = $this->_get_datetimes_from_event($event); |
|
95 | + |
|
96 | + // each datetime in this case should be an datetime object. |
|
97 | + foreach ($datetimes as $datetime) { |
|
98 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
99 | + $template, |
|
100 | + $datetime, |
|
101 | + $valid_shortcodes, |
|
102 | + $this->_extra_data |
|
103 | + ); |
|
104 | + } |
|
105 | + |
|
106 | + return $dtt_parsed; |
|
107 | + } |
|
108 | + |
|
109 | + |
|
110 | + /** |
|
111 | + * return parsed list of datetimes for an ticket |
|
112 | + * |
|
113 | + * @return string |
|
114 | + * @throws EE_Error |
|
115 | + */ |
|
116 | + private function _get_datetime_list_for_ticket() |
|
117 | + { |
|
118 | + $valid_shortcodes = ['datetime', 'attendee']; |
|
119 | + |
|
120 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['datetime_list']) |
|
121 | + ? $this->_data['template']['datetime_list'] |
|
122 | + : $this->_extra_data['template']['datetime_list']; |
|
123 | + $ticket = $this->_data['data']; |
|
124 | + |
|
125 | + // here we're setting up the datetimes for the datetime list template for THIS ticket. |
|
126 | + $dtt_parsed = ''; |
|
127 | + $datetimes = $this->_get_datetimes_from_ticket($ticket); |
|
128 | + |
|
129 | + // each datetime in this case should be an datetime object. |
|
130 | + foreach ($datetimes as $datetime) { |
|
131 | + $dtt_parsed .= $this->_shortcode_helper->parse_datetime_list_template( |
|
132 | + $template, |
|
133 | + $datetime, |
|
134 | + $valid_shortcodes, |
|
135 | + $this->_extra_data |
|
136 | + ); |
|
137 | + } |
|
138 | + |
|
139 | + return $dtt_parsed; |
|
140 | + } |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * return parsed list of datetimes from a given registration. |
|
145 | + * |
|
146 | + * @return string |
|
147 | + * @throws EE_Error |
|
148 | + * @throws EE_Error |
|
149 | + */ |
|
150 | + private function _get_datetime_list_for_registration() |
|
151 | + { |
|
152 | + $registration = $this->_data['data']->reg_obj; |
|
153 | + |
|
154 | + // now let's just get the ticket, set $this->_data['data'] to the ticket and then call _get_datetime_list_for__ticket(); |
|
155 | + $this->_data['data'] = $registration->ticket(); |
|
156 | + return $this->_get_datetime_list_for_ticket(); |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param EE_Event $event |
|
162 | + * @return array|mixed |
|
163 | + * @throws EE_Error |
|
164 | + * @throws ReflectionException |
|
165 | + */ |
|
166 | + private function _get_datetimes_from_event(EE_Event $event) |
|
167 | + { |
|
168 | + return isset($this->_extra_data['data']->events) |
|
169 | + ? $this->_extra_data['data']->events[ $event->ID() ]['dtt_objs'] |
|
170 | + : []; |
|
171 | + } |
|
172 | + |
|
173 | + |
|
174 | + /** |
|
175 | + * @param EE_Ticket $ticket |
|
176 | + * @return array|mixed |
|
177 | + * @throws EE_Error |
|
178 | + */ |
|
179 | + private function _get_datetimes_from_ticket(EE_Ticket $ticket) |
|
180 | + { |
|
181 | + return isset($this->_extra_data['data']->tickets) |
|
182 | + ? $this->_extra_data['data']->tickets[ $ticket->ID() ]['dtt_objs'] |
|
183 | + : []; |
|
184 | + } |
|
185 | 185 | } |
@@ -163,7 +163,7 @@ |
||
163 | 163 | private function _get_events_from_registration(EE_Registration $registration) |
164 | 164 | { |
165 | 165 | return isset($this->_extra_data['data']->registrations) |
166 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
166 | + ? [$this->_extra_data['data']->registrations[$registration->ID()]['evt_obj']] |
|
167 | 167 | : []; |
168 | 168 | } |
169 | 169 | } |
@@ -18,155 +18,155 @@ |
||
18 | 18 | */ |
19 | 19 | class EE_Event_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__('Event List Shortcodes', 'event_espresso'); |
|
30 | - $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso'); |
|
31 | - $this->_shortcodes = [ |
|
32 | - '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'), |
|
33 | - ]; |
|
34 | - } |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * @param string $shortcode |
|
39 | - * @return string |
|
40 | - * @throws EE_Error |
|
41 | - * @throws ReflectionException |
|
42 | - */ |
|
43 | - protected function _parser($shortcode) |
|
44 | - { |
|
45 | - if ($shortcode == '[EVENT_LIST]') { |
|
46 | - return $this->_get_event_list(); |
|
47 | - } |
|
48 | - return ''; |
|
49 | - } |
|
50 | - |
|
51 | - |
|
52 | - /** |
|
53 | - * figure out what the incoming data is and then return the appropriate parsed value. |
|
54 | - * |
|
55 | - * @return string |
|
56 | - * @throws EE_Error |
|
57 | - * @throws ReflectionException |
|
58 | - */ |
|
59 | - private function _get_event_list() |
|
60 | - { |
|
61 | - $this->_validate_list_requirements(); |
|
62 | - |
|
63 | - if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
64 | - return $this->_get_event_list_for_main(); |
|
65 | - } |
|
66 | - if ($this->_data['data'] instanceof EE_Registration) { |
|
67 | - return $this->_get_event_list_for_registration(); |
|
68 | - } |
|
69 | - // prevent recursive loop |
|
70 | - return ''; |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * This returns the parsed event list for main template |
|
76 | - * |
|
77 | - * @return string |
|
78 | - */ |
|
79 | - private function _get_event_list_for_main() |
|
80 | - { |
|
81 | - |
|
82 | - $valid_shortcodes = [ |
|
83 | - 'event', |
|
84 | - 'attendee_list', |
|
85 | - 'ticket_list', |
|
86 | - 'datetime_list', |
|
87 | - 'venue', |
|
88 | - 'attendee', |
|
89 | - 'recipient_list', |
|
90 | - 'recipient_details', |
|
91 | - 'primary_registration_list', |
|
92 | - 'primary_registration_details', |
|
93 | - 'event_author', |
|
94 | - 'organization', |
|
95 | - ]; |
|
96 | - $template = $this->_data['template']; |
|
97 | - $data = $this->_data['data']; |
|
98 | - $events = ''; |
|
99 | - |
|
100 | - // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
101 | - foreach ($data->events as $event) { |
|
102 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
103 | - $template, |
|
104 | - $event['event'], |
|
105 | - $valid_shortcodes, |
|
106 | - $this->_extra_data |
|
107 | - ); |
|
108 | - } |
|
109 | - return $events; |
|
110 | - } |
|
111 | - |
|
112 | - |
|
113 | - /** |
|
114 | - * This returns the parsed event list for an attendee |
|
115 | - * |
|
116 | - * @return string |
|
117 | - * @throws EE_Error |
|
118 | - * @throws ReflectionException |
|
119 | - */ |
|
120 | - private function _get_event_list_for_registration() |
|
121 | - { |
|
122 | - $valid_shortcodes = [ |
|
123 | - 'event', |
|
124 | - 'ticket_list', |
|
125 | - 'datetime_list', |
|
126 | - 'attendee', |
|
127 | - 'event_author', |
|
128 | - 'recipient_details', |
|
129 | - 'recipient_list', |
|
130 | - 'venue', |
|
131 | - 'organization', |
|
132 | - ]; |
|
133 | - $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
134 | - ? $this->_data['template']['event_list'] |
|
135 | - : $this->_extra_data['template']['event_list']; |
|
136 | - $registration = $this->_data['data']; |
|
137 | - |
|
138 | - // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
139 | - $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
140 | - |
|
141 | - // here we're setting up the events for the event_list template for THIS registration. |
|
142 | - $all_events = $this->_get_events_from_registration($registration); |
|
143 | - |
|
144 | - // we're NOT going to prepare a list of attendees this time around |
|
145 | - $events = ''; |
|
146 | - |
|
147 | - foreach ($all_events as $event) { |
|
148 | - $events .= $this->_shortcode_helper->parse_event_list_template( |
|
149 | - $template, |
|
150 | - $event, |
|
151 | - $valid_shortcodes, |
|
152 | - $this->_extra_data |
|
153 | - ); |
|
154 | - } |
|
155 | - |
|
156 | - return $events; |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @param EE_Registration $registration |
|
162 | - * @return array |
|
163 | - * @throws EE_Error |
|
164 | - * @throws ReflectionException |
|
165 | - */ |
|
166 | - private function _get_events_from_registration(EE_Registration $registration) |
|
167 | - { |
|
168 | - return isset($this->_extra_data['data']->registrations) |
|
169 | - ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
170 | - : []; |
|
171 | - } |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + |
|
27 | + protected function _init_props() |
|
28 | + { |
|
29 | + $this->label = esc_html__('Event List Shortcodes', 'event_espresso'); |
|
30 | + $this->description = esc_html__('All shortcodes specific to event lists', 'event_espresso'); |
|
31 | + $this->_shortcodes = [ |
|
32 | + '[EVENT_LIST]' => esc_html__('Will output a list of events', 'event_espresso'), |
|
33 | + ]; |
|
34 | + } |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * @param string $shortcode |
|
39 | + * @return string |
|
40 | + * @throws EE_Error |
|
41 | + * @throws ReflectionException |
|
42 | + */ |
|
43 | + protected function _parser($shortcode) |
|
44 | + { |
|
45 | + if ($shortcode == '[EVENT_LIST]') { |
|
46 | + return $this->_get_event_list(); |
|
47 | + } |
|
48 | + return ''; |
|
49 | + } |
|
50 | + |
|
51 | + |
|
52 | + /** |
|
53 | + * figure out what the incoming data is and then return the appropriate parsed value. |
|
54 | + * |
|
55 | + * @return string |
|
56 | + * @throws EE_Error |
|
57 | + * @throws ReflectionException |
|
58 | + */ |
|
59 | + private function _get_event_list() |
|
60 | + { |
|
61 | + $this->_validate_list_requirements(); |
|
62 | + |
|
63 | + if ($this->_data['data'] instanceof EE_Messages_Addressee) { |
|
64 | + return $this->_get_event_list_for_main(); |
|
65 | + } |
|
66 | + if ($this->_data['data'] instanceof EE_Registration) { |
|
67 | + return $this->_get_event_list_for_registration(); |
|
68 | + } |
|
69 | + // prevent recursive loop |
|
70 | + return ''; |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * This returns the parsed event list for main template |
|
76 | + * |
|
77 | + * @return string |
|
78 | + */ |
|
79 | + private function _get_event_list_for_main() |
|
80 | + { |
|
81 | + |
|
82 | + $valid_shortcodes = [ |
|
83 | + 'event', |
|
84 | + 'attendee_list', |
|
85 | + 'ticket_list', |
|
86 | + 'datetime_list', |
|
87 | + 'venue', |
|
88 | + 'attendee', |
|
89 | + 'recipient_list', |
|
90 | + 'recipient_details', |
|
91 | + 'primary_registration_list', |
|
92 | + 'primary_registration_details', |
|
93 | + 'event_author', |
|
94 | + 'organization', |
|
95 | + ]; |
|
96 | + $template = $this->_data['template']; |
|
97 | + $data = $this->_data['data']; |
|
98 | + $events = ''; |
|
99 | + |
|
100 | + // now we need to loop through the events array in EE_Messages_Addressee and send data to the EE_Parser helper. |
|
101 | + foreach ($data->events as $event) { |
|
102 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
103 | + $template, |
|
104 | + $event['event'], |
|
105 | + $valid_shortcodes, |
|
106 | + $this->_extra_data |
|
107 | + ); |
|
108 | + } |
|
109 | + return $events; |
|
110 | + } |
|
111 | + |
|
112 | + |
|
113 | + /** |
|
114 | + * This returns the parsed event list for an attendee |
|
115 | + * |
|
116 | + * @return string |
|
117 | + * @throws EE_Error |
|
118 | + * @throws ReflectionException |
|
119 | + */ |
|
120 | + private function _get_event_list_for_registration() |
|
121 | + { |
|
122 | + $valid_shortcodes = [ |
|
123 | + 'event', |
|
124 | + 'ticket_list', |
|
125 | + 'datetime_list', |
|
126 | + 'attendee', |
|
127 | + 'event_author', |
|
128 | + 'recipient_details', |
|
129 | + 'recipient_list', |
|
130 | + 'venue', |
|
131 | + 'organization', |
|
132 | + ]; |
|
133 | + $template = is_array($this->_data['template']) && isset($this->_data['template']['event_list']) |
|
134 | + ? $this->_data['template']['event_list'] |
|
135 | + : $this->_extra_data['template']['event_list']; |
|
136 | + $registration = $this->_data['data']; |
|
137 | + |
|
138 | + // let's remove any existing [ATTENDEE_LIST] shortcode from the event list template so that we don't get recursion. |
|
139 | + $template = str_replace('[ATTENDEE_LIST]', '', $template); |
|
140 | + |
|
141 | + // here we're setting up the events for the event_list template for THIS registration. |
|
142 | + $all_events = $this->_get_events_from_registration($registration); |
|
143 | + |
|
144 | + // we're NOT going to prepare a list of attendees this time around |
|
145 | + $events = ''; |
|
146 | + |
|
147 | + foreach ($all_events as $event) { |
|
148 | + $events .= $this->_shortcode_helper->parse_event_list_template( |
|
149 | + $template, |
|
150 | + $event, |
|
151 | + $valid_shortcodes, |
|
152 | + $this->_extra_data |
|
153 | + ); |
|
154 | + } |
|
155 | + |
|
156 | + return $events; |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @param EE_Registration $registration |
|
162 | + * @return array |
|
163 | + * @throws EE_Error |
|
164 | + * @throws ReflectionException |
|
165 | + */ |
|
166 | + private function _get_events_from_registration(EE_Registration $registration) |
|
167 | + { |
|
168 | + return isset($this->_extra_data['data']->registrations) |
|
169 | + ? [$this->_extra_data['data']->registrations[ $registration->ID() ]['evt_obj']] |
|
170 | + : []; |
|
171 | + } |
|
172 | 172 | } |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <div class="padding"> |
2 | 2 | <p> |
3 | 3 | <?php |
4 | - printf( |
|
5 | - esc_html__( |
|
6 | - 'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!', |
|
7 | - 'event_espresso' |
|
8 | - ), |
|
9 | - '<a |
|
4 | + printf( |
|
5 | + esc_html__( |
|
6 | + 'Upgrade to an %1$sEvent Espresso 4 support license%2$s to get access to dedicated support staff and premium features, such as a calendar, printable tickets and check-in capabilities, MailChimp integration, and more!', |
|
7 | + 'event_espresso' |
|
8 | + ), |
|
9 | + '<a |
|
10 | 10 | href="https://eventespresso.com/pricing/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link" |
11 | 11 | target="_blank">', |
12 | - '</a>' |
|
13 | - ); |
|
14 | - ?> |
|
12 | + '</a>' |
|
13 | + ); |
|
14 | + ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner' |
@@ -23,16 +23,16 @@ discard block |
||
23 | 23 | </p> |
24 | 24 | <p> |
25 | 25 | <?php |
26 | - printf( |
|
27 | - esc_html__( |
|
28 | - 'Visit %1$sEvent Espresso%2$s for more details.', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - '<a |
|
26 | + printf( |
|
27 | + esc_html__( |
|
28 | + 'Visit %1$sEvent Espresso%2$s for more details.', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + '<a |
|
32 | 32 | href="https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=link" |
33 | 33 | target="_blank">', |
34 | - '</a>' |
|
35 | - ); |
|
36 | - ?> |
|
34 | + '</a>' |
|
35 | + ); |
|
36 | + ?> |
|
37 | 37 | </p> |
38 | 38 | </div> |
@@ -17,7 +17,7 @@ |
||
17 | 17 | <a href='https://eventespresso.com/?ee_ver=ee4&utm_source=ee4_plugin_admin&utm_medium=link&utm_campaign=event_espresso_highlights_widget&utm_content=banner' |
18 | 18 | target='_blank'> |
19 | 19 | <img alt="<?php esc_html_e('manage events faster', 'event_espresso'); ?>" |
20 | - src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL . 'images/manage-events-faster-240x240.jpg'); ?>" |
|
20 | + src="<?php echo esc_url_raw(EE_GLOBAL_ASSETS_URL.'images/manage-events-faster-240x240.jpg'); ?>" |
|
21 | 21 | /> |
22 | 22 | </a> |
23 | 23 | </p> |