@@ -18,14 +18,14 @@ |
||
18 | 18 | interface EmailValidatorInterface |
19 | 19 | { |
20 | 20 | |
21 | - /** |
|
22 | - * Validates the supplied email address. If it is invalid, throws EmailValidationException |
|
23 | - * |
|
24 | - * @param string $email_address |
|
25 | - * @return boolean |
|
26 | - * @throws EmailValidationException |
|
27 | - */ |
|
28 | - public function validate($email_address); |
|
21 | + /** |
|
22 | + * Validates the supplied email address. If it is invalid, throws EmailValidationException |
|
23 | + * |
|
24 | + * @param string $email_address |
|
25 | + * @return boolean |
|
26 | + * @throws EmailValidationException |
|
27 | + */ |
|
28 | + public function validate($email_address); |
|
29 | 29 | |
30 | 30 | |
31 | 31 | } |
@@ -18,72 +18,72 @@ |
||
18 | 18 | { |
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * @param string $validation_error_message |
|
23 | - */ |
|
24 | - public function __construct($validation_error_message = '') |
|
25 | - { |
|
26 | - if (! $validation_error_message) { |
|
27 | - $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
|
28 | - } |
|
29 | - parent::__construct($validation_error_message); |
|
30 | - } |
|
21 | + /** |
|
22 | + * @param string $validation_error_message |
|
23 | + */ |
|
24 | + public function __construct($validation_error_message = '') |
|
25 | + { |
|
26 | + if (! $validation_error_message) { |
|
27 | + $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
|
28 | + } |
|
29 | + parent::__construct($validation_error_message); |
|
30 | + } |
|
31 | 31 | |
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * just checks the field isn't blank |
|
36 | - * |
|
37 | - * @param $normalized_value |
|
38 | - * @return bool |
|
39 | - * @throws InvalidArgumentException |
|
40 | - * @throws InvalidInterfaceException |
|
41 | - * @throws InvalidDataTypeException |
|
42 | - * @throws EE_Validation_Error |
|
43 | - */ |
|
44 | - public function validate($normalized_value) |
|
45 | - { |
|
46 | - if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
47 | - throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
48 | - } |
|
49 | - return true; |
|
50 | - } |
|
34 | + /** |
|
35 | + * just checks the field isn't blank |
|
36 | + * |
|
37 | + * @param $normalized_value |
|
38 | + * @return bool |
|
39 | + * @throws InvalidArgumentException |
|
40 | + * @throws InvalidInterfaceException |
|
41 | + * @throws InvalidDataTypeException |
|
42 | + * @throws EE_Validation_Error |
|
43 | + */ |
|
44 | + public function validate($normalized_value) |
|
45 | + { |
|
46 | + if ($normalized_value && ! $this->_validate_email($normalized_value)) { |
|
47 | + throw new EE_Validation_Error($this->get_validation_error_message(), 'required'); |
|
48 | + } |
|
49 | + return true; |
|
50 | + } |
|
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - /** |
|
55 | - * @return array |
|
56 | - */ |
|
57 | - public function get_jquery_validation_rule_array() |
|
58 | - { |
|
59 | - return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
60 | - } |
|
54 | + /** |
|
55 | + * @return array |
|
56 | + */ |
|
57 | + public function get_jquery_validation_rule_array() |
|
58 | + { |
|
59 | + return array('email' => true, 'messages' => array('email' => $this->get_validation_error_message())); |
|
60 | + } |
|
61 | 61 | |
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * Validate an email address. |
|
66 | - * Provide email address (raw input) |
|
67 | - * |
|
68 | - * @param $email |
|
69 | - * @return bool of whether the email is valid or not |
|
70 | - * @throws InvalidArgumentException |
|
71 | - * @throws InvalidInterfaceException |
|
72 | - * @throws InvalidDataTypeException |
|
73 | - * @throws EE_Validation_Error |
|
74 | - */ |
|
75 | - private function _validate_email($email) |
|
76 | - { |
|
77 | - try { |
|
78 | - EmailAddressFactory::create($email); |
|
79 | - } catch (EmailValidationException $e) { |
|
80 | - throw new EE_Validation_Error( |
|
81 | - $e->getMessage(), |
|
82 | - 'invalid_email', |
|
83 | - $this->_input, |
|
84 | - $e |
|
85 | - ); |
|
86 | - } |
|
87 | - return true; |
|
88 | - } |
|
64 | + /** |
|
65 | + * Validate an email address. |
|
66 | + * Provide email address (raw input) |
|
67 | + * |
|
68 | + * @param $email |
|
69 | + * @return bool of whether the email is valid or not |
|
70 | + * @throws InvalidArgumentException |
|
71 | + * @throws InvalidInterfaceException |
|
72 | + * @throws InvalidDataTypeException |
|
73 | + * @throws EE_Validation_Error |
|
74 | + */ |
|
75 | + private function _validate_email($email) |
|
76 | + { |
|
77 | + try { |
|
78 | + EmailAddressFactory::create($email); |
|
79 | + } catch (EmailValidationException $e) { |
|
80 | + throw new EE_Validation_Error( |
|
81 | + $e->getMessage(), |
|
82 | + 'invalid_email', |
|
83 | + $this->_input, |
|
84 | + $e |
|
85 | + ); |
|
86 | + } |
|
87 | + return true; |
|
88 | + } |
|
89 | 89 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | public function __construct($validation_error_message = '') |
25 | 25 | { |
26 | - if (! $validation_error_message) { |
|
26 | + if ( ! $validation_error_message) { |
|
27 | 27 | $validation_error_message = esc_html__('Please enter a valid email address.', 'event_espresso'); |
28 | 28 | } |
29 | 29 | parent::__construct($validation_error_message); |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function verifySystemActivated(ActivatableInterface $system_activated) |
50 | 50 | { |
51 | - if (! ($system_activated instanceof EE_System || $system_activated instanceof EE_Addon)) { |
|
51 | + if ( ! ($system_activated instanceof EE_System || $system_activated instanceof EE_Addon)) { |
|
52 | 52 | throw new InvalidArgumentException( |
53 | 53 | sprintf( |
54 | 54 | esc_html__( |
@@ -23,205 +23,205 @@ |
||
23 | 23 | class ActivationHandler |
24 | 24 | { |
25 | 25 | |
26 | - /** |
|
27 | - * @var EE_Maintenance_Mode $maintenance_mode |
|
28 | - */ |
|
29 | - private $maintenance_mode; |
|
30 | - |
|
31 | - |
|
32 | - |
|
33 | - /** |
|
34 | - * ActivationHandler constructor. |
|
35 | - * |
|
36 | - * @param EE_Maintenance_Mode $maintenance_mode |
|
37 | - */ |
|
38 | - public function __construct(EE_Maintenance_Mode $maintenance_mode) |
|
39 | - { |
|
40 | - $this->maintenance_mode = $maintenance_mode; |
|
41 | - } |
|
42 | - |
|
43 | - |
|
44 | - |
|
45 | - /** |
|
46 | - * @param ActivatableInterface $system_activated |
|
47 | - * @throws InvalidArgumentException |
|
48 | - */ |
|
49 | - public function verifySystemActivated(ActivatableInterface $system_activated) |
|
50 | - { |
|
51 | - if (! ($system_activated instanceof EE_System || $system_activated instanceof EE_Addon)) { |
|
52 | - throw new InvalidArgumentException( |
|
53 | - sprintf( |
|
54 | - esc_html__( |
|
55 | - 'The %1$s parameter must either be an instance of EE_System for Core, or an EE_Addon class. The following was supplied: %2$s%3$s', |
|
56 | - 'event_espresso' |
|
57 | - ), |
|
58 | - '$system', |
|
59 | - '<br />', |
|
60 | - var_export($system_activated, true) |
|
61 | - ) |
|
62 | - ); |
|
63 | - } |
|
64 | - } |
|
65 | - |
|
66 | - |
|
67 | - |
|
68 | - /** |
|
69 | - * switches handling based on activation type |
|
70 | - * |
|
71 | - * @param ActivatableInterface $system_activated |
|
72 | - * @param ActivationType $activation_type |
|
73 | - * @param ActivationHistory $activation_history |
|
74 | - * @return bool |
|
75 | - * @throws InvalidArgumentException |
|
76 | - */ |
|
77 | - public function detectActivationOrVersionChange( |
|
78 | - ActivatableInterface $system_activated, |
|
79 | - ActivationType $activation_type, |
|
80 | - ActivationHistory $activation_history |
|
81 | - ) { |
|
82 | - $this->verifySystemActivated($system_activated); |
|
83 | - do_action( |
|
84 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__detectActivationOrVersionChange__before_detection', |
|
85 | - $system_activated, |
|
86 | - $this |
|
87 | - ); |
|
88 | - switch ($activation_type->getActivationType()) { |
|
89 | - case ActivationType::NEW_ACTIVATION: |
|
90 | - $activation_detected = $this->handleNewActivation( |
|
91 | - $system_activated, |
|
92 | - $activation_history |
|
93 | - ); |
|
94 | - break; |
|
95 | - case ActivationType::REACTIVATION: |
|
96 | - $activation_detected = $this->handleReactivation( |
|
97 | - $system_activated, |
|
98 | - $activation_history |
|
99 | - ); |
|
100 | - break; |
|
101 | - case ActivationType::UPGRADE: |
|
102 | - $activation_detected = $this->handleUpgrade( |
|
103 | - $system_activated, |
|
104 | - $activation_history |
|
105 | - ); |
|
106 | - break; |
|
107 | - case ActivationType::DOWNGRADE: |
|
108 | - $activation_detected = $this->handleDowngrade( |
|
109 | - $system_activated, |
|
110 | - $activation_history |
|
111 | - ); |
|
112 | - break; |
|
113 | - case ActivationType::NOT_ACTIVATION: |
|
114 | - default: |
|
115 | - $activation_detected = $this->handleNormalRequest($system_activated); |
|
116 | - break; |
|
117 | - } |
|
118 | - do_action( |
|
119 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__detectActivationOrVersionChange__detection_complete', |
|
120 | - $system_activated, |
|
121 | - $this |
|
122 | - ); |
|
123 | - return $activation_detected; |
|
124 | - } |
|
125 | - |
|
126 | - |
|
127 | - |
|
128 | - /** |
|
129 | - * handling for new activations |
|
130 | - * |
|
131 | - * @param ActivatableInterface $system_activated |
|
132 | - * @param ActivationHistory $activation_history |
|
133 | - * @return boolean |
|
134 | - */ |
|
135 | - private function handleNewActivation(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
136 | - { |
|
137 | - do_action( |
|
138 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleNewActivation', |
|
139 | - $system_activated, |
|
140 | - $this |
|
141 | - ); |
|
142 | - $activation_history->updateActivationHistory(); |
|
143 | - return true; |
|
144 | - } |
|
145 | - |
|
146 | - |
|
147 | - |
|
148 | - /** |
|
149 | - * handling for reactivations |
|
150 | - * |
|
151 | - * @param ActivatableInterface $system_activated |
|
152 | - * @param ActivationHistory $activation_history |
|
153 | - * @return boolean |
|
154 | - */ |
|
155 | - private function handleReactivation(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
156 | - { |
|
157 | - do_action( |
|
158 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleReactivation', |
|
159 | - $system_activated, |
|
160 | - $this |
|
161 | - ); |
|
162 | - $activation_history->updateActivationHistory(); |
|
163 | - return true; |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - |
|
168 | - /** |
|
169 | - * handling for upgrades |
|
170 | - * |
|
171 | - * @param ActivatableInterface $system_activated |
|
172 | - * @param ActivationHistory $activation_history |
|
173 | - * @return boolean |
|
174 | - */ |
|
175 | - private function handleUpgrade(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
176 | - { |
|
177 | - do_action( |
|
178 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleUpgrade', |
|
179 | - $system_activated, |
|
180 | - $this |
|
181 | - ); |
|
182 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
183 | - $activation_history->updateActivationHistory(); |
|
184 | - return true; |
|
185 | - } |
|
186 | - |
|
187 | - |
|
188 | - |
|
189 | - /** |
|
190 | - * handling for downgrades |
|
191 | - * |
|
192 | - * @param ActivatableInterface $system_activated |
|
193 | - * @param ActivationHistory $activation_history |
|
194 | - * @return boolean |
|
195 | - */ |
|
196 | - private function handleDowngrade(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
197 | - { |
|
198 | - do_action( |
|
199 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleDowngrade', |
|
200 | - $system_activated, |
|
201 | - $this |
|
202 | - ); |
|
203 | - $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
204 | - $activation_history->updateActivationHistory(); |
|
205 | - return true; |
|
206 | - } |
|
207 | - |
|
208 | - |
|
209 | - |
|
210 | - /** |
|
211 | - * handling for normal requests |
|
212 | - * |
|
213 | - * @param ActivatableInterface $system_activated |
|
214 | - * @return boolean |
|
215 | - */ |
|
216 | - private function handleNormalRequest(ActivatableInterface $system_activated) |
|
217 | - { |
|
218 | - do_action( |
|
219 | - 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleNormalRequest', |
|
220 | - $system_activated, |
|
221 | - $this |
|
222 | - ); |
|
223 | - return false; |
|
224 | - } |
|
26 | + /** |
|
27 | + * @var EE_Maintenance_Mode $maintenance_mode |
|
28 | + */ |
|
29 | + private $maintenance_mode; |
|
30 | + |
|
31 | + |
|
32 | + |
|
33 | + /** |
|
34 | + * ActivationHandler constructor. |
|
35 | + * |
|
36 | + * @param EE_Maintenance_Mode $maintenance_mode |
|
37 | + */ |
|
38 | + public function __construct(EE_Maintenance_Mode $maintenance_mode) |
|
39 | + { |
|
40 | + $this->maintenance_mode = $maintenance_mode; |
|
41 | + } |
|
42 | + |
|
43 | + |
|
44 | + |
|
45 | + /** |
|
46 | + * @param ActivatableInterface $system_activated |
|
47 | + * @throws InvalidArgumentException |
|
48 | + */ |
|
49 | + public function verifySystemActivated(ActivatableInterface $system_activated) |
|
50 | + { |
|
51 | + if (! ($system_activated instanceof EE_System || $system_activated instanceof EE_Addon)) { |
|
52 | + throw new InvalidArgumentException( |
|
53 | + sprintf( |
|
54 | + esc_html__( |
|
55 | + 'The %1$s parameter must either be an instance of EE_System for Core, or an EE_Addon class. The following was supplied: %2$s%3$s', |
|
56 | + 'event_espresso' |
|
57 | + ), |
|
58 | + '$system', |
|
59 | + '<br />', |
|
60 | + var_export($system_activated, true) |
|
61 | + ) |
|
62 | + ); |
|
63 | + } |
|
64 | + } |
|
65 | + |
|
66 | + |
|
67 | + |
|
68 | + /** |
|
69 | + * switches handling based on activation type |
|
70 | + * |
|
71 | + * @param ActivatableInterface $system_activated |
|
72 | + * @param ActivationType $activation_type |
|
73 | + * @param ActivationHistory $activation_history |
|
74 | + * @return bool |
|
75 | + * @throws InvalidArgumentException |
|
76 | + */ |
|
77 | + public function detectActivationOrVersionChange( |
|
78 | + ActivatableInterface $system_activated, |
|
79 | + ActivationType $activation_type, |
|
80 | + ActivationHistory $activation_history |
|
81 | + ) { |
|
82 | + $this->verifySystemActivated($system_activated); |
|
83 | + do_action( |
|
84 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__detectActivationOrVersionChange__before_detection', |
|
85 | + $system_activated, |
|
86 | + $this |
|
87 | + ); |
|
88 | + switch ($activation_type->getActivationType()) { |
|
89 | + case ActivationType::NEW_ACTIVATION: |
|
90 | + $activation_detected = $this->handleNewActivation( |
|
91 | + $system_activated, |
|
92 | + $activation_history |
|
93 | + ); |
|
94 | + break; |
|
95 | + case ActivationType::REACTIVATION: |
|
96 | + $activation_detected = $this->handleReactivation( |
|
97 | + $system_activated, |
|
98 | + $activation_history |
|
99 | + ); |
|
100 | + break; |
|
101 | + case ActivationType::UPGRADE: |
|
102 | + $activation_detected = $this->handleUpgrade( |
|
103 | + $system_activated, |
|
104 | + $activation_history |
|
105 | + ); |
|
106 | + break; |
|
107 | + case ActivationType::DOWNGRADE: |
|
108 | + $activation_detected = $this->handleDowngrade( |
|
109 | + $system_activated, |
|
110 | + $activation_history |
|
111 | + ); |
|
112 | + break; |
|
113 | + case ActivationType::NOT_ACTIVATION: |
|
114 | + default: |
|
115 | + $activation_detected = $this->handleNormalRequest($system_activated); |
|
116 | + break; |
|
117 | + } |
|
118 | + do_action( |
|
119 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__detectActivationOrVersionChange__detection_complete', |
|
120 | + $system_activated, |
|
121 | + $this |
|
122 | + ); |
|
123 | + return $activation_detected; |
|
124 | + } |
|
125 | + |
|
126 | + |
|
127 | + |
|
128 | + /** |
|
129 | + * handling for new activations |
|
130 | + * |
|
131 | + * @param ActivatableInterface $system_activated |
|
132 | + * @param ActivationHistory $activation_history |
|
133 | + * @return boolean |
|
134 | + */ |
|
135 | + private function handleNewActivation(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
136 | + { |
|
137 | + do_action( |
|
138 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleNewActivation', |
|
139 | + $system_activated, |
|
140 | + $this |
|
141 | + ); |
|
142 | + $activation_history->updateActivationHistory(); |
|
143 | + return true; |
|
144 | + } |
|
145 | + |
|
146 | + |
|
147 | + |
|
148 | + /** |
|
149 | + * handling for reactivations |
|
150 | + * |
|
151 | + * @param ActivatableInterface $system_activated |
|
152 | + * @param ActivationHistory $activation_history |
|
153 | + * @return boolean |
|
154 | + */ |
|
155 | + private function handleReactivation(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
156 | + { |
|
157 | + do_action( |
|
158 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleReactivation', |
|
159 | + $system_activated, |
|
160 | + $this |
|
161 | + ); |
|
162 | + $activation_history->updateActivationHistory(); |
|
163 | + return true; |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + |
|
168 | + /** |
|
169 | + * handling for upgrades |
|
170 | + * |
|
171 | + * @param ActivatableInterface $system_activated |
|
172 | + * @param ActivationHistory $activation_history |
|
173 | + * @return boolean |
|
174 | + */ |
|
175 | + private function handleUpgrade(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
176 | + { |
|
177 | + do_action( |
|
178 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleUpgrade', |
|
179 | + $system_activated, |
|
180 | + $this |
|
181 | + ); |
|
182 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
183 | + $activation_history->updateActivationHistory(); |
|
184 | + return true; |
|
185 | + } |
|
186 | + |
|
187 | + |
|
188 | + |
|
189 | + /** |
|
190 | + * handling for downgrades |
|
191 | + * |
|
192 | + * @param ActivatableInterface $system_activated |
|
193 | + * @param ActivationHistory $activation_history |
|
194 | + * @return boolean |
|
195 | + */ |
|
196 | + private function handleDowngrade(ActivatableInterface $system_activated, ActivationHistory $activation_history) |
|
197 | + { |
|
198 | + do_action( |
|
199 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleDowngrade', |
|
200 | + $system_activated, |
|
201 | + $this |
|
202 | + ); |
|
203 | + $this->maintenance_mode->set_maintenance_mode_if_db_old(); |
|
204 | + $activation_history->updateActivationHistory(); |
|
205 | + return true; |
|
206 | + } |
|
207 | + |
|
208 | + |
|
209 | + |
|
210 | + /** |
|
211 | + * handling for normal requests |
|
212 | + * |
|
213 | + * @param ActivatableInterface $system_activated |
|
214 | + * @return boolean |
|
215 | + */ |
|
216 | + private function handleNormalRequest(ActivatableInterface $system_activated) |
|
217 | + { |
|
218 | + do_action( |
|
219 | + 'AHEE__EventEspresso_core_services_activation_ActivationHandler__handleNormalRequest', |
|
220 | + $system_activated, |
|
221 | + $this |
|
222 | + ); |
|
223 | + return false; |
|
224 | + } |
|
225 | 225 | |
226 | 226 | |
227 | 227 |
@@ -15,10 +15,10 @@ |
||
15 | 15 | interface InitializeInterface |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param bool $verify_schema whether to verify the database's schema during this activation, or just its data. |
|
20 | - * This is a resource-intensive job so we prefer to only do it when necessary |
|
21 | - * @return void |
|
22 | - */ |
|
23 | - public function initialize($verify_schema = true); |
|
18 | + /** |
|
19 | + * @param bool $verify_schema whether to verify the database's schema during this activation, or just its data. |
|
20 | + * This is a resource-intensive job so we prefer to only do it when necessary |
|
21 | + * @return void |
|
22 | + */ |
|
23 | + public function initialize($verify_schema = true); |
|
24 | 24 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | // if no activations are scheduled, then just return false |
94 | - if($this->activations === array()) { |
|
94 | + if ($this->activations === array()) { |
|
95 | 95 | return false; |
96 | 96 | } |
97 | 97 | add_action( |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | { |
168 | 168 | foreach ($this->activations as $activation) { |
169 | 169 | $initializer = ActivationsFactory::createInitializer($activation); |
170 | - if($initializer instanceof InitializeInterface){ |
|
170 | + if ($initializer instanceof InitializeInterface) { |
|
171 | 171 | $initializer->initialize(); |
172 | 172 | } |
173 | 173 | do_action( |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | private function deactivateIncompatibleAddons() |
189 | 189 | { |
190 | 190 | $incompatible_addons = get_option(ActivationsAndUpgradesManager::EE_INCOMPATIBLE_ADDONS_OPTION_NAME, array()); |
191 | - if (! empty($incompatible_addons)) { |
|
191 | + if ( ! empty($incompatible_addons)) { |
|
192 | 192 | $active_plugins = get_option('active_plugins', array()); |
193 | 193 | foreach ($active_plugins as $active_plugin) { |
194 | 194 | foreach ($incompatible_addons as $incompatible_addon) { |
@@ -24,181 +24,181 @@ |
||
24 | 24 | class ActivationsAndUpgradesManager |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * option name for recording an array of addon names |
|
29 | - * that are not compatible with the current version of core |
|
30 | - */ |
|
31 | - const EE_INCOMPATIBLE_ADDONS_OPTION_NAME = 'ee_incompatible_addons'; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var ActivatableInterface[] $activations |
|
35 | - */ |
|
36 | - private $activations = array(); |
|
37 | - |
|
38 | - /** |
|
39 | - * @var ActivationHandler $activation_handler |
|
40 | - */ |
|
41 | - private $activation_handler; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var ActivationTypeDetector $activation_type_detector |
|
45 | - */ |
|
46 | - private $activation_type_detector; |
|
47 | - |
|
48 | - |
|
49 | - |
|
50 | - /** |
|
51 | - * ActivationsAndUpgradesManager constructor. |
|
52 | - * |
|
53 | - * @param ActivationHandler $activation_handler |
|
54 | - * @param ActivationTypeDetector $activation_type_detector |
|
55 | - */ |
|
56 | - public function __construct( |
|
57 | - ActivationHandler $activation_handler, |
|
58 | - ActivationTypeDetector $activation_type_detector |
|
59 | - ) { |
|
60 | - defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
|
61 | - $this->activation_handler = $activation_handler; |
|
62 | - $this->activation_type_detector = $activation_type_detector; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - |
|
67 | - /** |
|
68 | - * @param ActivatableInterface[] $activations |
|
69 | - * @return bool |
|
70 | - * @throws InvalidInterfaceException |
|
71 | - * @throws InvalidDataTypeException |
|
72 | - * @throws InvalidEntityException |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws DomainException |
|
75 | - */ |
|
76 | - public function detectActivationsAndVersionChanges(array $activations): bool |
|
77 | - { |
|
78 | - foreach ($activations as $activation) { |
|
79 | - if ( ! $activation instanceof ActivatableInterface) { |
|
80 | - throw new InvalidEntityException( |
|
81 | - $activation, |
|
82 | - 'EventEspresso\core\services\activation\ActivatableInterface' |
|
83 | - ); |
|
84 | - } |
|
85 | - $activation_history = $this->getActivationHistory($activation); |
|
86 | - if ( |
|
87 | - $this->activation_handler->detectActivationOrVersionChange( |
|
88 | - $activation, |
|
89 | - $this->getActivationType($activation, $activation_history), |
|
90 | - $activation_history |
|
91 | - ) |
|
92 | - ) { |
|
93 | - $this->activations[] = $activation; |
|
94 | - } |
|
95 | - } |
|
96 | - // if no activations are scheduled, then just return false |
|
97 | - if($this->activations === array()) { |
|
98 | - return false; |
|
99 | - } |
|
100 | - add_action( |
|
101 | - 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
102 | - array($this, 'performActivationsAndUpgrades') |
|
103 | - ); |
|
104 | - return true; |
|
105 | - } |
|
106 | - |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @param ActivatableInterface $activation |
|
111 | - * @return ActivationHistory |
|
112 | - * @throws InvalidArgumentException |
|
113 | - * @throws InvalidInterfaceException |
|
114 | - * @throws InvalidDataTypeException |
|
115 | - * @throws DomainException |
|
116 | - */ |
|
117 | - private function getActivationHistory(ActivatableInterface $activation): ActivationHistory |
|
118 | - { |
|
119 | - // get activation history and set arguments array based on activation type |
|
120 | - $activation_history = ActivationsFactory::createActivationHistory($activation); |
|
121 | - if ($activation_history instanceof ActivationHistory) { |
|
122 | - // convert EE Core activation history to the latest format |
|
123 | - if ($activation instanceof EE_System) { |
|
124 | - $migrate_activation_history = ActivationsFactory::getMigrateActivationHistory(); |
|
125 | - $activation_history = $migrate_activation_history->updateFormat($activation_history); |
|
126 | - } |
|
127 | - $activation->setActivationHistory($activation_history); |
|
128 | - return $activation_history; |
|
129 | - } |
|
130 | - throw new DomainException( |
|
131 | - sprintf( |
|
132 | - esc_html__( |
|
133 | - 'Could not obtain an ActivationHistory for the "%1$s" Activatable class.', |
|
134 | - 'event_espresso' |
|
135 | - ), |
|
136 | - get_class($activation) |
|
137 | - ) |
|
138 | - ); |
|
139 | - } |
|
140 | - |
|
141 | - |
|
142 | - |
|
143 | - /** |
|
144 | - * @param ActivatableInterface $activation |
|
145 | - * @param ActivationHistory $activation_history |
|
146 | - * @return ActivationType |
|
147 | - * @throws InvalidArgumentException |
|
148 | - */ |
|
149 | - private function getActivationType(ActivatableInterface $activation, ActivationHistory $activation_history): ActivationType |
|
150 | - { |
|
151 | - // determine whether current request is new activation, upgrade, etc |
|
152 | - $activation_type = $this->activation_type_detector->resolveActivationTypeFromActivationHistory( |
|
153 | - $activation_history |
|
154 | - ); |
|
155 | - $activation->setActivationType($activation_type); |
|
156 | - return $activation_type; |
|
157 | - } |
|
158 | - |
|
159 | - |
|
160 | - /** |
|
161 | - * @return void |
|
162 | - * @throws EE_Error |
|
163 | - * @throws ReflectionException |
|
164 | - */ |
|
165 | - public function performActivationsAndUpgrades() |
|
166 | - { |
|
167 | - foreach ($this->activations as $activation) { |
|
168 | - $initializer = ActivationsFactory::createInitializer($activation); |
|
169 | - if($initializer instanceof InitializeInterface){ |
|
170 | - $initializer->initialize(); |
|
171 | - } |
|
172 | - do_action( |
|
173 | - 'AHEE__EventEspresso_core_services_activation_ActivationsAndUpgradesManager__performActivationsAndUpgrades', |
|
174 | - $activation, |
|
175 | - $initializer |
|
176 | - ); |
|
177 | - } |
|
178 | - $this->deactivateIncompatibleAddons(); |
|
179 | - } |
|
180 | - |
|
181 | - |
|
182 | - |
|
183 | - /** |
|
184 | - * Using the information gathered in EE_System::_incompatible_addon_error, |
|
185 | - * deactivates any addons considered incompatible with the current version of EE |
|
186 | - */ |
|
187 | - private function deactivateIncompatibleAddons() |
|
188 | - { |
|
189 | - $incompatible_addons = get_option(ActivationsAndUpgradesManager::EE_INCOMPATIBLE_ADDONS_OPTION_NAME, array()); |
|
190 | - if (! empty($incompatible_addons)) { |
|
191 | - $active_plugins = get_option('active_plugins', array()); |
|
192 | - foreach ($active_plugins as $active_plugin) { |
|
193 | - foreach ($incompatible_addons as $incompatible_addon) { |
|
194 | - if (strpos($active_plugin, $incompatible_addon) !== false) { |
|
195 | - unset($_GET['activate']); |
|
196 | - espresso_deactivate_plugin($active_plugin); |
|
197 | - } |
|
198 | - } |
|
199 | - } |
|
200 | - } |
|
201 | - } |
|
27 | + /** |
|
28 | + * option name for recording an array of addon names |
|
29 | + * that are not compatible with the current version of core |
|
30 | + */ |
|
31 | + const EE_INCOMPATIBLE_ADDONS_OPTION_NAME = 'ee_incompatible_addons'; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var ActivatableInterface[] $activations |
|
35 | + */ |
|
36 | + private $activations = array(); |
|
37 | + |
|
38 | + /** |
|
39 | + * @var ActivationHandler $activation_handler |
|
40 | + */ |
|
41 | + private $activation_handler; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var ActivationTypeDetector $activation_type_detector |
|
45 | + */ |
|
46 | + private $activation_type_detector; |
|
47 | + |
|
48 | + |
|
49 | + |
|
50 | + /** |
|
51 | + * ActivationsAndUpgradesManager constructor. |
|
52 | + * |
|
53 | + * @param ActivationHandler $activation_handler |
|
54 | + * @param ActivationTypeDetector $activation_type_detector |
|
55 | + */ |
|
56 | + public function __construct( |
|
57 | + ActivationHandler $activation_handler, |
|
58 | + ActivationTypeDetector $activation_type_detector |
|
59 | + ) { |
|
60 | + defined('EVENT_ESPRESSO_VERSION') || exit('No direct script access allowed'); |
|
61 | + $this->activation_handler = $activation_handler; |
|
62 | + $this->activation_type_detector = $activation_type_detector; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + |
|
67 | + /** |
|
68 | + * @param ActivatableInterface[] $activations |
|
69 | + * @return bool |
|
70 | + * @throws InvalidInterfaceException |
|
71 | + * @throws InvalidDataTypeException |
|
72 | + * @throws InvalidEntityException |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws DomainException |
|
75 | + */ |
|
76 | + public function detectActivationsAndVersionChanges(array $activations): bool |
|
77 | + { |
|
78 | + foreach ($activations as $activation) { |
|
79 | + if ( ! $activation instanceof ActivatableInterface) { |
|
80 | + throw new InvalidEntityException( |
|
81 | + $activation, |
|
82 | + 'EventEspresso\core\services\activation\ActivatableInterface' |
|
83 | + ); |
|
84 | + } |
|
85 | + $activation_history = $this->getActivationHistory($activation); |
|
86 | + if ( |
|
87 | + $this->activation_handler->detectActivationOrVersionChange( |
|
88 | + $activation, |
|
89 | + $this->getActivationType($activation, $activation_history), |
|
90 | + $activation_history |
|
91 | + ) |
|
92 | + ) { |
|
93 | + $this->activations[] = $activation; |
|
94 | + } |
|
95 | + } |
|
96 | + // if no activations are scheduled, then just return false |
|
97 | + if($this->activations === array()) { |
|
98 | + return false; |
|
99 | + } |
|
100 | + add_action( |
|
101 | + 'AHEE__EE_System__perform_activations_upgrades_and_migrations', |
|
102 | + array($this, 'performActivationsAndUpgrades') |
|
103 | + ); |
|
104 | + return true; |
|
105 | + } |
|
106 | + |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @param ActivatableInterface $activation |
|
111 | + * @return ActivationHistory |
|
112 | + * @throws InvalidArgumentException |
|
113 | + * @throws InvalidInterfaceException |
|
114 | + * @throws InvalidDataTypeException |
|
115 | + * @throws DomainException |
|
116 | + */ |
|
117 | + private function getActivationHistory(ActivatableInterface $activation): ActivationHistory |
|
118 | + { |
|
119 | + // get activation history and set arguments array based on activation type |
|
120 | + $activation_history = ActivationsFactory::createActivationHistory($activation); |
|
121 | + if ($activation_history instanceof ActivationHistory) { |
|
122 | + // convert EE Core activation history to the latest format |
|
123 | + if ($activation instanceof EE_System) { |
|
124 | + $migrate_activation_history = ActivationsFactory::getMigrateActivationHistory(); |
|
125 | + $activation_history = $migrate_activation_history->updateFormat($activation_history); |
|
126 | + } |
|
127 | + $activation->setActivationHistory($activation_history); |
|
128 | + return $activation_history; |
|
129 | + } |
|
130 | + throw new DomainException( |
|
131 | + sprintf( |
|
132 | + esc_html__( |
|
133 | + 'Could not obtain an ActivationHistory for the "%1$s" Activatable class.', |
|
134 | + 'event_espresso' |
|
135 | + ), |
|
136 | + get_class($activation) |
|
137 | + ) |
|
138 | + ); |
|
139 | + } |
|
140 | + |
|
141 | + |
|
142 | + |
|
143 | + /** |
|
144 | + * @param ActivatableInterface $activation |
|
145 | + * @param ActivationHistory $activation_history |
|
146 | + * @return ActivationType |
|
147 | + * @throws InvalidArgumentException |
|
148 | + */ |
|
149 | + private function getActivationType(ActivatableInterface $activation, ActivationHistory $activation_history): ActivationType |
|
150 | + { |
|
151 | + // determine whether current request is new activation, upgrade, etc |
|
152 | + $activation_type = $this->activation_type_detector->resolveActivationTypeFromActivationHistory( |
|
153 | + $activation_history |
|
154 | + ); |
|
155 | + $activation->setActivationType($activation_type); |
|
156 | + return $activation_type; |
|
157 | + } |
|
158 | + |
|
159 | + |
|
160 | + /** |
|
161 | + * @return void |
|
162 | + * @throws EE_Error |
|
163 | + * @throws ReflectionException |
|
164 | + */ |
|
165 | + public function performActivationsAndUpgrades() |
|
166 | + { |
|
167 | + foreach ($this->activations as $activation) { |
|
168 | + $initializer = ActivationsFactory::createInitializer($activation); |
|
169 | + if($initializer instanceof InitializeInterface){ |
|
170 | + $initializer->initialize(); |
|
171 | + } |
|
172 | + do_action( |
|
173 | + 'AHEE__EventEspresso_core_services_activation_ActivationsAndUpgradesManager__performActivationsAndUpgrades', |
|
174 | + $activation, |
|
175 | + $initializer |
|
176 | + ); |
|
177 | + } |
|
178 | + $this->deactivateIncompatibleAddons(); |
|
179 | + } |
|
180 | + |
|
181 | + |
|
182 | + |
|
183 | + /** |
|
184 | + * Using the information gathered in EE_System::_incompatible_addon_error, |
|
185 | + * deactivates any addons considered incompatible with the current version of EE |
|
186 | + */ |
|
187 | + private function deactivateIncompatibleAddons() |
|
188 | + { |
|
189 | + $incompatible_addons = get_option(ActivationsAndUpgradesManager::EE_INCOMPATIBLE_ADDONS_OPTION_NAME, array()); |
|
190 | + if (! empty($incompatible_addons)) { |
|
191 | + $active_plugins = get_option('active_plugins', array()); |
|
192 | + foreach ($active_plugins as $active_plugin) { |
|
193 | + foreach ($incompatible_addons as $incompatible_addon) { |
|
194 | + if (strpos($active_plugin, $incompatible_addon) !== false) { |
|
195 | + unset($_GET['activate']); |
|
196 | + espresso_deactivate_plugin($active_plugin); |
|
197 | + } |
|
198 | + } |
|
199 | + } |
|
200 | + } |
|
201 | + } |
|
202 | 202 | |
203 | 203 | |
204 | 204 | } |
@@ -11,33 +11,33 @@ |
||
11 | 11 | class EE_Float_Input extends EE_Form_Input_Base |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @param array $input_settings |
|
16 | - * @throws InvalidArgumentException |
|
17 | - */ |
|
18 | - public function __construct($input_settings = array()) |
|
19 | - { |
|
20 | - $this->_set_display_strategy( |
|
21 | - new EE_Number_Input_Display_Strategy( |
|
22 | - isset($input_settings['min_value']) |
|
23 | - ? $input_settings['min_value'] |
|
24 | - : null, |
|
25 | - isset($input_settings['max_value']) |
|
26 | - ? $input_settings['max_value'] |
|
27 | - : null, |
|
28 | - isset($input_settings['step_value']) |
|
29 | - ? $input_settings['step_value'] |
|
30 | - : null |
|
31 | - ) |
|
32 | - ); |
|
33 | - $this->_set_normalization_strategy(new EE_Float_Normalization()); |
|
34 | - $this->_add_validation_strategy( |
|
35 | - new EE_Float_Validation_Strategy( |
|
36 | - isset($input_settings['validation_error_message']) |
|
37 | - ? $input_settings['validation_error_message'] |
|
38 | - : null |
|
39 | - ) |
|
40 | - ); |
|
41 | - parent::__construct($input_settings); |
|
42 | - } |
|
14 | + /** |
|
15 | + * @param array $input_settings |
|
16 | + * @throws InvalidArgumentException |
|
17 | + */ |
|
18 | + public function __construct($input_settings = array()) |
|
19 | + { |
|
20 | + $this->_set_display_strategy( |
|
21 | + new EE_Number_Input_Display_Strategy( |
|
22 | + isset($input_settings['min_value']) |
|
23 | + ? $input_settings['min_value'] |
|
24 | + : null, |
|
25 | + isset($input_settings['max_value']) |
|
26 | + ? $input_settings['max_value'] |
|
27 | + : null, |
|
28 | + isset($input_settings['step_value']) |
|
29 | + ? $input_settings['step_value'] |
|
30 | + : null |
|
31 | + ) |
|
32 | + ); |
|
33 | + $this->_set_normalization_strategy(new EE_Float_Normalization()); |
|
34 | + $this->_add_validation_strategy( |
|
35 | + new EE_Float_Validation_Strategy( |
|
36 | + isset($input_settings['validation_error_message']) |
|
37 | + ? $input_settings['validation_error_message'] |
|
38 | + : null |
|
39 | + ) |
|
40 | + ); |
|
41 | + parent::__construct($input_settings); |
|
42 | + } |
|
43 | 43 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | $event_label = 'Testing Context Deactivation'; |
9 | 9 | |
10 | 10 | $I->wantTo( |
11 | - 'Test that the context activation toggle for turning on or off specific contexts for message sending works as' |
|
12 | - . ' expected' |
|
11 | + 'Test that the context activation toggle for turning on or off specific contexts for message sending works as' |
|
12 | + . ' expected' |
|
13 | 13 | ); |
14 | 14 | |
15 | 15 | $I->loginAsAdmin(); |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $I->see('The template for Primary Registrant Recipient is currently inactive.'); |
35 | 35 | |
36 | 36 | $I->amGoingTo( |
37 | - 'Trigger Registration Approved Messages and verify primary registrant context is excluded from sent messages.' |
|
37 | + 'Trigger Registration Approved Messages and verify primary registrant context is excluded from sent messages.' |
|
38 | 38 | ); |
39 | 39 | $I->amOnDefaultEventsListTablePage(); |
40 | 40 | $I->click(EventsAdmin::ADD_NEW_EVENT_BUTTON_SELECTOR); |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | $event_link = $I->observeLinkUrlAt(EventsAdmin::EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR); |
45 | 45 | $event_id = $I->observeValueFromInputAt(EventsAdmin::EVENT_EDITOR_EVT_ID_SELECTOR); |
46 | 46 | $test_registration_details = array( |
47 | - 'fname' => 'ContextTestGuy', |
|
48 | - 'lname' => 'ContextTestDude', |
|
49 | - 'email' => '[email protected]', |
|
47 | + 'fname' => 'ContextTestGuy', |
|
48 | + 'lname' => 'ContextTestDude', |
|
49 | + 'email' => '[email protected]', |
|
50 | 50 | ); |
51 | 51 | $I->logOut(); |
52 | 52 | $I->amOnUrl($event_link); |
@@ -63,48 +63,48 @@ discard block |
||
63 | 63 | $I->amOnMessagesActivityListTablePage(); |
64 | 64 | //verify registrant context |
65 | 65 | $I->see( |
66 | - $test_registration_details['email'], |
|
67 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
68 | - 'to', |
|
69 | - 'Registration Approved', |
|
70 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
71 | - '', |
|
72 | - 'Registrant' |
|
73 | - ) |
|
66 | + $test_registration_details['email'], |
|
67 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
68 | + 'to', |
|
69 | + 'Registration Approved', |
|
70 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
71 | + '', |
|
72 | + 'Registrant' |
|
73 | + ) |
|
74 | 74 | ); |
75 | 75 | $I->deleteMessageInMessagesListTableFor( |
76 | - 'Registration Approved', |
|
77 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
78 | - 'Email', |
|
79 | - 'Registrant' |
|
76 | + 'Registration Approved', |
|
77 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
78 | + 'Email', |
|
79 | + 'Registrant' |
|
80 | 80 | ); |
81 | 81 | //verify admin context |
82 | 82 | $I->see( |
83 | - '[email protected]', |
|
84 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
85 | - 'to', |
|
86 | - 'Registration Approved', |
|
87 | - MessagesAdmin::MESSAGE_STATUS_SENT |
|
88 | - ) |
|
83 | + '[email protected]', |
|
84 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
85 | + 'to', |
|
86 | + 'Registration Approved', |
|
87 | + MessagesAdmin::MESSAGE_STATUS_SENT |
|
88 | + ) |
|
89 | 89 | ); |
90 | 90 | $I->deleteMessageInMessagesListTableFor( |
91 | - 'Registration Approved' |
|
91 | + 'Registration Approved' |
|
92 | 92 | ); |
93 | 93 | //verify primary registrant context is NOT present. |
94 | 94 | $I->dontSee( |
95 | - $test_registration_details['email'], |
|
96 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
97 | - 'to', |
|
98 | - 'Registration Approved', |
|
99 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
100 | - '', |
|
101 | - 'Primary Registrant' |
|
102 | - ) |
|
95 | + $test_registration_details['email'], |
|
96 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
97 | + 'to', |
|
98 | + 'Registration Approved', |
|
99 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
100 | + '', |
|
101 | + 'Primary Registrant' |
|
102 | + ) |
|
103 | 103 | ); |
104 | 104 | |
105 | 105 | $I->amGoingTo( |
106 | - 'Deactivate primary registrant context for Registration Approved Message Templates and restore the "To"' |
|
107 | - . ' field to an empty string to verify the message does not send for that context.' |
|
106 | + 'Deactivate primary registrant context for Registration Approved Message Templates and restore the "To"' |
|
107 | + . ' field to an empty string to verify the message does not send for that context.' |
|
108 | 108 | ); |
109 | 109 | $I->amOnDefaultMessageTemplateListTablePage(); |
110 | 110 | $I->clickToEditMessageTemplateByMessageType('registration', 'primary_attendee'); |
@@ -128,41 +128,41 @@ discard block |
||
128 | 128 | $I->amOnMessagesActivityListTablePage(); |
129 | 129 | //verify registrant context |
130 | 130 | $I->see( |
131 | - $test_registration_details['email'], |
|
132 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
133 | - 'to', |
|
134 | - 'Registration Approved', |
|
135 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
136 | - '', |
|
137 | - 'Registrant' |
|
138 | - ) |
|
131 | + $test_registration_details['email'], |
|
132 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
133 | + 'to', |
|
134 | + 'Registration Approved', |
|
135 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
136 | + '', |
|
137 | + 'Registrant' |
|
138 | + ) |
|
139 | 139 | ); |
140 | 140 | $I->deleteMessageInMessagesListTableFor( |
141 | - 'Registration Approved', |
|
142 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
143 | - 'Email', |
|
144 | - 'Registrant' |
|
141 | + 'Registration Approved', |
|
142 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
143 | + 'Email', |
|
144 | + 'Registrant' |
|
145 | 145 | ); |
146 | 146 | //verify admin context |
147 | 147 | $I->see( |
148 | - '[email protected]', |
|
149 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
150 | - 'to', |
|
151 | - 'Registration Approved', |
|
152 | - MessagesAdmin::MESSAGE_STATUS_SENT |
|
153 | - ) |
|
148 | + '[email protected]', |
|
149 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
150 | + 'to', |
|
151 | + 'Registration Approved', |
|
152 | + MessagesAdmin::MESSAGE_STATUS_SENT |
|
153 | + ) |
|
154 | 154 | ); |
155 | 155 | $I->deleteMessageInMessagesListTableFor( |
156 | - 'Registration Approved' |
|
156 | + 'Registration Approved' |
|
157 | 157 | ); |
158 | 158 | //verify primary registrant context is NOT present. |
159 | 159 | $I->dontSee( |
160 | - $test_registration_details['email'], |
|
161 | - MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
162 | - 'to', |
|
163 | - 'Registration Approved', |
|
164 | - MessagesAdmin::MESSAGE_STATUS_SENT, |
|
165 | - '', |
|
166 | - 'Primary Registrant' |
|
167 | - ) |
|
160 | + $test_registration_details['email'], |
|
161 | + MessagesAdmin::messagesActivityListTableCellSelectorFor( |
|
162 | + 'to', |
|
163 | + 'Registration Approved', |
|
164 | + MessagesAdmin::MESSAGE_STATUS_SENT, |
|
165 | + '', |
|
166 | + 'Primary Registrant' |
|
167 | + ) |
|
168 | 168 | ); |
169 | 169 | \ No newline at end of file |
@@ -19,16 +19,16 @@ |
||
19 | 19 | 'The green colored gear %s indicates that this messenger is currently active.', |
20 | 20 | 'event_espresso' |
21 | 21 | ), |
22 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | - . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
22 | + '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-active.png'.'"' |
|
23 | + . ' alt="'.esc_attr__('Active Email Tab', 'event_espresso').'" />' |
|
24 | 24 | ); |
25 | 25 | printf( |
26 | 26 | esc_html__( |
27 | 27 | ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
28 | 28 | 'event_espresso' |
29 | 29 | ), |
30 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | - . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
30 | + '<img class="inline-text" src="'.EE_MSG_ASSETS_URL.'images/email-tab-inactive.png' |
|
31 | + . '" alt="'.esc_attr__('Inactive Email Tab', 'event_espresso').'" />' |
|
32 | 32 | ); ?> |
33 | 33 | </p> |
34 | 34 | <p> |
@@ -3,79 +3,79 @@ |
||
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php esc_html_e( |
6 | - 'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab. When you click one of those tabs it will display that messenger.', |
|
7 | - 'event_espresso' |
|
8 | - ); ?> |
|
6 | + 'You can select Messengers via the tabs across the top of the settings page. The available messengers you see depends on what version of Event Espresso you have and what addons are installed. Every install include an "Email" messenger tab. When you click one of those tabs it will display that messenger.', |
|
7 | + 'event_espresso' |
|
8 | + ); ?> |
|
9 | 9 | </p> |
10 | 10 | <p> |
11 | 11 | <?php esc_html_e( |
12 | - 'There are two ways to determine whether a messenger is active or not. The first way is via the messenger tab itself.', |
|
13 | - 'event_espresso' |
|
14 | - ); ?> |
|
12 | + 'There are two ways to determine whether a messenger is active or not. The first way is via the messenger tab itself.', |
|
13 | + 'event_espresso' |
|
14 | + ); ?> |
|
15 | 15 | </p> |
16 | 16 | <p> |
17 | 17 | <?php printf( |
18 | - esc_html__( |
|
19 | - 'The green colored gear %s indicates that this messenger is currently active.', |
|
20 | - 'event_espresso' |
|
21 | - ), |
|
22 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | - . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
24 | - ); |
|
25 | - printf( |
|
26 | - esc_html__( |
|
27 | - ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
|
28 | - 'event_espresso' |
|
29 | - ), |
|
30 | - '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | - . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
32 | - ); ?> |
|
18 | + esc_html__( |
|
19 | + 'The green colored gear %s indicates that this messenger is currently active.', |
|
20 | + 'event_espresso' |
|
21 | + ), |
|
22 | + '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-active.png' . '"' |
|
23 | + . ' alt="' . esc_attr__('Active Email Tab', 'event_espresso') . '" />' |
|
24 | + ); |
|
25 | + printf( |
|
26 | + esc_html__( |
|
27 | + ' The white colored gear %s indicates the messenger is inactive. This is very helpful for seeing at a glance all the messengers that are active when you first view the page.', |
|
28 | + 'event_espresso' |
|
29 | + ), |
|
30 | + '<img class="inline-text" src="' . EE_MSG_ASSETS_URL . 'images/email-tab-inactive.png' |
|
31 | + . '" alt="' . esc_attr__('Inactive Email Tab', 'event_espresso') . '" />' |
|
32 | + ); ?> |
|
33 | 33 | </p> |
34 | 34 | <p> |
35 | 35 | <?php esc_html_e( |
36 | - 'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', |
|
37 | - 'event_espresso' |
|
38 | - ); ?> |
|
36 | + 'The second way to determine whether a messenger is active or not is via the "on/off" button in the top right corner of the active messenger displayed content:', |
|
37 | + 'event_espresso' |
|
38 | + ); ?> |
|
39 | 39 | </p> |
40 | 40 | <p> |
41 | 41 | <?php printf( |
42 | - esc_html__( |
|
43 | - '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - '<div class="switch">' |
|
47 | - . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>' |
|
48 | - . '<label for="ee-on-off-toggle-on"></label>' |
|
49 | - . '</div>', |
|
50 | - '<div class="switch">' |
|
51 | - . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>' |
|
52 | - . '<label for="ee-on-off-toggle-on"></label>' |
|
53 | - . '</div>' |
|
54 | - ); ?> |
|
42 | + esc_html__( |
|
43 | + '%1$s means of course that the messenger is active and %2$s means the messenger is inactive.', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + '<div class="switch">' |
|
47 | + . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" checked disabled>' |
|
48 | + . '<label for="ee-on-off-toggle-on"></label>' |
|
49 | + . '</div>', |
|
50 | + '<div class="switch">' |
|
51 | + . '<input class="ee-on-off-toggle ee-toggle-round-flat" type="checkbox" disabled>' |
|
52 | + . '<label for="ee-on-off-toggle-on"></label>' |
|
53 | + . '</div>' |
|
54 | + ); ?> |
|
55 | 55 | </p> |
56 | 56 | <p> |
57 | 57 | <?php |
58 | - esc_html_e( |
|
59 | - 'The on/off toggle is also what you use to activate or deactivate a messenger.', |
|
60 | - 'event_espresso' |
|
61 | - ); ?> |
|
58 | + esc_html_e( |
|
59 | + 'The on/off toggle is also what you use to activate or deactivate a messenger.', |
|
60 | + 'event_espresso' |
|
61 | + ); ?> |
|
62 | 62 | </p> |
63 | 63 | <p> |
64 | 64 | <?php esc_html_e( |
65 | - 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', |
|
66 | - 'event_espresso' |
|
67 | - ); ?> |
|
65 | + 'What happens when you click the toggle to activate is the messenger is activated and the system determines what default message types are activated with the messenger. Then, if there are any default settings for either the messenger or message types those settings are saved. Next, the system will generate any default templates (if none have been generated before, if there are previously generated templates then they are reactivated). Finally, you will see the display change to reflect that the messenger is active. If the messenger has settings you can modify them then. Any message types that have settings will also automatically expand so you can see the default settings and make any changes as necessary to fit your needs. Usually the defaults are sufficient however.', |
|
66 | + 'event_espresso' |
|
67 | + ); ?> |
|
68 | 68 | </p> |
69 | 69 | <p> |
70 | 70 | <?php esc_html_e( |
71 | - 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', |
|
72 | - 'event_espresso' |
|
73 | - ); ?> |
|
71 | + 'When you deactivate a messenger, the system will first check if there are any custom event templates for that messenger. If there are you will be unable to deactivate the messenger. This is a fail safe to make sure you know that no messages will go out for those specific events so you don\'t accidentally deactivate. If this check passes, then the system will deactivate any global templates for that messenger (note the templates are not erased, they just become inactive, so if you decide to reactivate the messenger later all your customizations are preserved). Then the display will change to reflect the deactivation.', |
|
72 | + 'event_espresso' |
|
73 | + ); ?> |
|
74 | 74 | </p> |
75 | 75 | <p> |
76 | 76 | <strong><?php esc_html_e('Important', 'event_espresso'); ?></strong><br /> |
77 | 77 | <?php esc_html_e( |
78 | - 'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation. Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', |
|
79 | - 'event_espresso' |
|
80 | - ); ?> |
|
78 | + 'Although customizations made to global templates are preserved when a messenger is deactivated, any settings for that messenger (or the message types that were attached to it) are lost on deactivation. Also, once you deactivate a messenger, no more messages will be delivered using that messenger for any of your events.', |
|
79 | + 'event_espresso' |
|
80 | + ); ?> |
|
81 | 81 | </p> |
@@ -15,22 +15,22 @@ |
||
15 | 15 | class EE_Radio_Button_Input extends EE_Form_Input_With_Options_Base |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @param array $answer_options |
|
20 | - * @param array $input_settings |
|
21 | - */ |
|
22 | - public function __construct($answer_options, $input_settings = array()) |
|
23 | - { |
|
24 | - $this->_set_display_strategy(new EE_Radio_Button_Display_Strategy()); |
|
25 | - $this->_add_validation_strategy( |
|
26 | - new EE_Enum_Validation_Strategy( |
|
27 | - isset($input_settings['validation_error_message']) |
|
28 | - ? $input_settings['validation_error_message'] |
|
29 | - : null |
|
30 | - ) |
|
31 | - ); |
|
32 | - $this->_multiple_selections = false; |
|
33 | - parent::__construct($answer_options, $input_settings); |
|
34 | - } |
|
18 | + /** |
|
19 | + * @param array $answer_options |
|
20 | + * @param array $input_settings |
|
21 | + */ |
|
22 | + public function __construct($answer_options, $input_settings = array()) |
|
23 | + { |
|
24 | + $this->_set_display_strategy(new EE_Radio_Button_Display_Strategy()); |
|
25 | + $this->_add_validation_strategy( |
|
26 | + new EE_Enum_Validation_Strategy( |
|
27 | + isset($input_settings['validation_error_message']) |
|
28 | + ? $input_settings['validation_error_message'] |
|
29 | + : null |
|
30 | + ) |
|
31 | + ); |
|
32 | + $this->_multiple_selections = false; |
|
33 | + parent::__construct($answer_options, $input_settings); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | } |