@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | * @type $name string the name for this form section, if you want to explicitly define it |
80 | 80 | * } |
81 | 81 | */ |
82 | - public function __construct( $options_array = array() ) { |
|
82 | + public function __construct($options_array = array()) { |
|
83 | 83 | // used by display strategies |
84 | 84 | // assign incoming values to properties |
85 | - foreach( $options_array as $key => $value ) { |
|
86 | - $key = '_' . $key; |
|
87 | - if ( property_exists( $this, $key ) && empty( $this->{$key} )) { |
|
85 | + foreach ($options_array as $key => $value) { |
|
86 | + $key = '_'.$key; |
|
87 | + if (property_exists($this, $key) && empty($this->{$key} )) { |
|
88 | 88 | $this->{$key} = $value; |
89 | 89 | } |
90 | 90 | } |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | * @param $name |
98 | 98 | * @throws \EE_Error |
99 | 99 | */ |
100 | - protected function _construct_finalize( $parent_form_section, $name ){ |
|
100 | + protected function _construct_finalize($parent_form_section, $name) { |
|
101 | 101 | $this->_construction_finalized = TRUE; |
102 | 102 | $this->_parent_section = $parent_form_section; |
103 | - if( $name !== null ) { |
|
103 | + if ($name !== null) { |
|
104 | 104 | $this->_name = $name; |
105 | 105 | } |
106 | 106 | } |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public function ensure_construct_finalized_called(){ |
|
115 | - if( ! $this->_construction_finalized ){ |
|
116 | - $this->_construct_finalize($this->_parent_section, $this->_name ); |
|
114 | + public function ensure_construct_finalized_called() { |
|
115 | + if ( ! $this->_construction_finalized) { |
|
116 | + $this->_construct_finalize($this->_parent_section, $this->_name); |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * @param string $action |
133 | 133 | */ |
134 | - public function set_action( $action ) { |
|
134 | + public function set_action($action) { |
|
135 | 135 | $this->_action = $action; |
136 | 136 | } |
137 | 137 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return string |
142 | 142 | */ |
143 | 143 | public function method() { |
144 | - return ! empty( $this->_method ) ? $this->_method : 'POST'; |
|
144 | + return ! empty($this->_method) ? $this->_method : 'POST'; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | /** |
150 | 150 | * @param string $method |
151 | 151 | */ |
152 | - public function set_method( $method ) { |
|
153 | - switch ( $method ) { |
|
152 | + public function set_method($method) { |
|
153 | + switch ($method) { |
|
154 | 154 | case 'get' : |
155 | 155 | case 'GET' : |
156 | 156 | $this->_method = 'GET'; |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @throws \EE_Error |
171 | 171 | */ |
172 | - protected function _set_default_html_id_if_empty(){ |
|
173 | - if( ! $this->_html_id ){ |
|
174 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
|
175 | - $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
|
176 | - }else{ |
|
177 | - $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
|
172 | + protected function _set_default_html_id_if_empty() { |
|
173 | + if ( ! $this->_html_id) { |
|
174 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
175 | + $this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name()); |
|
176 | + } else { |
|
177 | + $this->_html_id = $this->_prep_name_for_html_id($this->name()); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param $name |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - private function _prep_name_for_html_id( $name ) { |
|
190 | - return sanitize_key( str_replace( array( ' ', ' ', '_' ), '-', $name )); |
|
189 | + private function _prep_name_for_html_id($name) { |
|
190 | + return sanitize_key(str_replace(array(' ', ' ', '_'), '-', $name)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | * and so might stop working anytime. |
202 | 202 | * @return string |
203 | 203 | */ |
204 | - public function get_html_and_js(){ |
|
204 | + public function get_html_and_js() { |
|
205 | 205 | return $this->get_html(); |
206 | 206 | } |
207 | 207 | |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param bool $add_pound_sign |
218 | 218 | * @return string |
219 | 219 | */ |
220 | - public function html_id( $add_pound_sign = FALSE ){ |
|
220 | + public function html_id($add_pound_sign = FALSE) { |
|
221 | 221 | $this->_set_default_html_id_if_empty(); |
222 | - return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id; |
|
222 | + return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | /** |
228 | 228 | * @return string |
229 | 229 | */ |
230 | - public function html_class(){ |
|
230 | + public function html_class() { |
|
231 | 231 | return $this->_html_class; |
232 | 232 | } |
233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | /** |
237 | 237 | * @return string |
238 | 238 | */ |
239 | - public function html_style(){ |
|
239 | + public function html_style() { |
|
240 | 240 | return $this->_html_style; |
241 | 241 | } |
242 | 242 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | /** |
246 | 246 | * @param mixed $html_class |
247 | 247 | */ |
248 | - public function set_html_class( $html_class ) { |
|
248 | + public function set_html_class($html_class) { |
|
249 | 249 | $this->_html_class = $html_class; |
250 | 250 | } |
251 | 251 | |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | /** |
255 | 255 | * @param mixed $html_id |
256 | 256 | */ |
257 | - public function set_html_id( $html_id ) { |
|
257 | + public function set_html_id($html_id) { |
|
258 | 258 | $this->_html_id = $html_id; |
259 | 259 | } |
260 | 260 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | /** |
264 | 264 | * @param mixed $html_style |
265 | 265 | */ |
266 | - public function set_html_style( $html_style ) { |
|
266 | + public function set_html_style($html_style) { |
|
267 | 267 | $this->_html_style = $html_style; |
268 | 268 | } |
269 | 269 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | /** |
273 | 273 | * @param string $other_html_attributes |
274 | 274 | */ |
275 | - public function set_other_html_attributes( $other_html_attributes ) { |
|
275 | + public function set_other_html_attributes($other_html_attributes) { |
|
276 | 276 | $this->_other_html_attributes = $other_html_attributes; |
277 | 277 | } |
278 | 278 | |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @throws EE_Error |
293 | 293 | * @return string |
294 | 294 | */ |
295 | - public function name(){ |
|
296 | - if( ! $this->_construction_finalized ){ |
|
297 | - throw new EE_Error(sprintf( __( 'You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso' ), get_class($this) ) ); |
|
295 | + public function name() { |
|
296 | + if ( ! $this->_construction_finalized) { |
|
297 | + throw new EE_Error(sprintf(__('You cannot use the form section\s name until _construct_finalize has been called on it (when we set the name). It was called on a form section of type \'s\'', 'event_espresso'), get_class($this))); |
|
298 | 298 | } |
299 | 299 | return $this->_name; |
300 | 300 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * Gets the parent section |
306 | 306 | * @return EE_Form_Section_Proper |
307 | 307 | */ |
308 | - public function parent_section(){ |
|
308 | + public function parent_section() { |
|
309 | 309 | return $this->_parent_section; |
310 | 310 | } |
311 | 311 | |
@@ -318,18 +318,18 @@ discard block |
||
318 | 318 | * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML |
319 | 319 | * @return string |
320 | 320 | */ |
321 | - public function form_open( $action = '', $method = '', $other_attributes = '' ) { |
|
322 | - if ( ! empty( $action )) { |
|
323 | - $this->set_action( $action ); |
|
321 | + public function form_open($action = '', $method = '', $other_attributes = '') { |
|
322 | + if ( ! empty($action)) { |
|
323 | + $this->set_action($action); |
|
324 | 324 | } |
325 | - if ( ! empty( $method )) { |
|
326 | - $this->set_method( $method ); |
|
325 | + if ( ! empty($method)) { |
|
326 | + $this->set_method($method); |
|
327 | 327 | } |
328 | - $html = EEH_HTML::nl( 1, 'form' ) . '<form'; |
|
329 | - $html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : ''; |
|
330 | - $html .= ' action="' . $this->action() . '"'; |
|
331 | - $html .= ' method="' . $this->method() . '"'; |
|
332 | - $html .= $other_attributes . '>'; |
|
328 | + $html = EEH_HTML::nl(1, 'form').'<form'; |
|
329 | + $html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : ''; |
|
330 | + $html .= ' action="'.$this->action().'"'; |
|
331 | + $html .= ' method="'.$this->method().'"'; |
|
332 | + $html .= $other_attributes.'>'; |
|
333 | 333 | return $html; |
334 | 334 | } |
335 | 335 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * @return string |
341 | 341 | */ |
342 | 342 | public function form_close() { |
343 | - return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl(); |
|
343 | + return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl(); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * Default does nothing, but child classes can override |
350 | 350 | * @return void |
351 | 351 | */ |
352 | - public function enqueue_js(){ |
|
352 | + public function enqueue_js() { |
|
353 | 353 | //defaults to enqueue NO js or css |
354 | 354 | } |
355 | 355 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | * @param array $form_other_js_data |
366 | 366 | * @return array |
367 | 367 | */ |
368 | - public function get_other_js_data( $form_other_js_data = array() ) { |
|
368 | + public function get_other_js_data($form_other_js_data = array()) { |
|
369 | 369 | return $form_other_js_data; |
370 | 370 | } |
371 | 371 | |
@@ -383,20 +383,20 @@ discard block |
||
383 | 383 | * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false |
384 | 384 | * @return EE_Form_Section_Base |
385 | 385 | */ |
386 | - public function find_section_from_path( $form_section_path ) { |
|
387 | - if( strpos( $form_section_path, '/' ) === 0 ) { |
|
388 | - $form_section_path = substr( $form_section_path, strlen( '/' ) ); |
|
386 | + public function find_section_from_path($form_section_path) { |
|
387 | + if (strpos($form_section_path, '/') === 0) { |
|
388 | + $form_section_path = substr($form_section_path, strlen('/')); |
|
389 | 389 | } |
390 | - if( empty( $form_section_path ) ) { |
|
390 | + if (empty($form_section_path)) { |
|
391 | 391 | return $this; |
392 | 392 | } |
393 | - if( strpos( $form_section_path, '../' ) === 0 ) { |
|
393 | + if (strpos($form_section_path, '../') === 0) { |
|
394 | 394 | $parent = $this->parent_section(); |
395 | 395 | |
396 | - $form_section_path = substr( $form_section_path, strlen( '../' ) ); |
|
397 | - if( $parent instanceof EE_Form_Section_Base ) { |
|
398 | - return $parent->find_section_from_path( $form_section_path ); |
|
399 | - } elseif( empty( $form_section_path ) ) { |
|
396 | + $form_section_path = substr($form_section_path, strlen('../')); |
|
397 | + if ($parent instanceof EE_Form_Section_Base) { |
|
398 | + return $parent->find_section_from_path($form_section_path); |
|
399 | + } elseif (empty($form_section_path)) { |
|
400 | 400 | return $this; |
401 | 401 | } |
402 | 402 | } |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function __construct(){ |
73 | 73 | if( ! $this->_model_name_extended){ |
74 | - throw new EE_Error( |
|
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
77 | - ); |
|
74 | + throw new EE_Error( |
|
75 | + __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso" ) |
|
77 | + ); |
|
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | 80 | if ( did_action( $construct_end_action )) { |
@@ -95,30 +95,30 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | |
98 | - /** |
|
99 | - * @param array $existing_tables |
|
100 | - * @return array |
|
101 | - */ |
|
102 | - public function add_extra_tables_on_filter( array $existing_tables ){ |
|
103 | - return array_merge( $existing_tables, $this->_extra_tables ); |
|
98 | + /** |
|
99 | + * @param array $existing_tables |
|
100 | + * @return array |
|
101 | + */ |
|
102 | + public function add_extra_tables_on_filter( array $existing_tables ){ |
|
103 | + return array_merge( $existing_tables, $this->_extra_tables ); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
107 | 107 | |
108 | - /** |
|
109 | - * @param array $existing_fields |
|
110 | - * @return array |
|
111 | - */ |
|
112 | - public function add_extra_fields_on_filter( array $existing_fields ){ |
|
108 | + /** |
|
109 | + * @param array $existing_fields |
|
110 | + * @return array |
|
111 | + */ |
|
112 | + public function add_extra_fields_on_filter( array $existing_fields ){ |
|
113 | 113 | if( $this->_extra_fields){ |
114 | 114 | foreach($this->_extra_fields as $table_alias => $fields){ |
115 | 115 | if( ! isset( $existing_fields[ $table_alias ] ) ){ |
116 | 116 | $existing_fields[ $table_alias ] = array(); |
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | - $existing_fields[$table_alias], |
|
120 | - $this->_extra_fields[$table_alias] |
|
121 | - ); |
|
119 | + $existing_fields[$table_alias], |
|
120 | + $this->_extra_fields[$table_alias] |
|
121 | + ); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | } |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * @param array $existing_relations |
|
132 | - * @return array |
|
133 | - */ |
|
134 | - public function add_extra_relations_on_filter( array $existing_relations ){ |
|
135 | - return array_merge($existing_relations,$this->_extra_relations); |
|
130 | + /** |
|
131 | + * @param array $existing_relations |
|
132 | + * @return array |
|
133 | + */ |
|
134 | + public function add_extra_relations_on_filter( array $existing_relations ){ |
|
135 | + return array_merge($existing_relations,$this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
169 | 169 | } |
170 | 170 | } |
171 | - /** @var EEM_Base $model_to_reset */ |
|
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
171 | + /** @var EEM_Base $model_to_reset */ |
|
172 | + $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | 173 | if ( class_exists( $model_to_reset ) ) { |
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
@@ -177,13 +177,13 @@ discard block |
||
177 | 177 | |
178 | 178 | |
179 | 179 | |
180 | - /** |
|
181 | - * @param string $callback_method_name |
|
182 | - * @param array $args |
|
183 | - * @return mixed |
|
184 | - * @throws EE_Error |
|
185 | - */ |
|
186 | - public function __call( $callback_method_name, array $args){ |
|
180 | + /** |
|
181 | + * @param string $callback_method_name |
|
182 | + * @param array $args |
|
183 | + * @return mixed |
|
184 | + * @throws EE_Error |
|
185 | + */ |
|
186 | + public function __call( $callback_method_name, array $args){ |
|
187 | 187 | if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
@@ -194,23 +194,23 @@ discard block |
||
194 | 194 | return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
195 | 195 | }else{ |
196 | 196 | throw new EE_Error( |
197 | - sprintf( |
|
198 | - __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
|
199 | - $this->_model_name_extended, |
|
200 | - get_class($this), |
|
201 | - $extending_method,$extending_method |
|
202 | - ) |
|
203 | - ); |
|
197 | + sprintf( |
|
198 | + __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
|
199 | + $this->_model_name_extended, |
|
200 | + get_class($this), |
|
201 | + $extending_method,$extending_method |
|
202 | + ) |
|
203 | + ); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | }else{ |
207 | 207 | throw new EE_Error( |
208 | - sprintf( |
|
209 | - __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | - $callback_method_name, |
|
211 | - get_class($this) |
|
212 | - ) |
|
213 | - ); |
|
208 | + sprintf( |
|
209 | + __("There is no method named '%s' on '%s'", "event_espresso"), |
|
210 | + $callback_method_name, |
|
211 | + get_class($this) |
|
212 | + ) |
|
213 | + ); |
|
214 | 214 | } |
215 | 215 | } |
216 | 216 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('No direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -69,27 +69,27 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @throws \EE_Error |
71 | 71 | */ |
72 | - public function __construct(){ |
|
73 | - if( ! $this->_model_name_extended){ |
|
72 | + public function __construct() { |
|
73 | + if ( ! $this->_model_name_extended) { |
|
74 | 74 | throw new EE_Error( |
75 | - __( "When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | - "event_espresso" ) |
|
75 | + __("When declaring a model extension, you must define its _model_name_extended property. It should be a model name like 'Attendee' or 'Event'", |
|
76 | + "event_espresso") |
|
77 | 77 | ); |
78 | 78 | } |
79 | 79 | $construct_end_action = 'AHEE__EEM_'.$this->_model_name_extended.'__construct__end'; |
80 | - if ( did_action( $construct_end_action )) { |
|
80 | + if (did_action($construct_end_action)) { |
|
81 | 81 | throw new EE_Error( |
82 | 82 | sprintf( |
83 | - __( "Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
83 | + __("Hooked in model extension '%s' too late! The model %s has already been used! We know because the action %s has been fired", "event_espresso"), |
|
84 | 84 | get_class($this), |
85 | 85 | $this->_model_name_extended, |
86 | 86 | $construct_end_action |
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | } |
90 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
91 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
92 | - add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
90 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
91 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
92 | + add_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
93 | 93 | $this->_register_extending_methods(); |
94 | 94 | } |
95 | 95 | |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * @param array $existing_tables |
100 | 100 | * @return array |
101 | 101 | */ |
102 | - public function add_extra_tables_on_filter( array $existing_tables ){ |
|
103 | - return array_merge( $existing_tables, $this->_extra_tables ); |
|
102 | + public function add_extra_tables_on_filter(array $existing_tables) { |
|
103 | + return array_merge($existing_tables, $this->_extra_tables); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | * @param array $existing_fields |
110 | 110 | * @return array |
111 | 111 | */ |
112 | - public function add_extra_fields_on_filter( array $existing_fields ){ |
|
113 | - if( $this->_extra_fields){ |
|
114 | - foreach($this->_extra_fields as $table_alias => $fields){ |
|
115 | - if( ! isset( $existing_fields[ $table_alias ] ) ){ |
|
116 | - $existing_fields[ $table_alias ] = array(); |
|
112 | + public function add_extra_fields_on_filter(array $existing_fields) { |
|
113 | + if ($this->_extra_fields) { |
|
114 | + foreach ($this->_extra_fields as $table_alias => $fields) { |
|
115 | + if ( ! isset($existing_fields[$table_alias])) { |
|
116 | + $existing_fields[$table_alias] = array(); |
|
117 | 117 | } |
118 | 118 | $existing_fields[$table_alias] = array_merge( |
119 | 119 | $existing_fields[$table_alias], |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param array $existing_relations |
132 | 132 | * @return array |
133 | 133 | */ |
134 | - public function add_extra_relations_on_filter( array $existing_relations ){ |
|
135 | - return array_merge($existing_relations,$this->_extra_relations); |
|
134 | + public function add_extra_relations_on_filter(array $existing_relations) { |
|
135 | + return array_merge($existing_relations, $this->_extra_relations); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | * scans the child of EEME_Base for functions starting with ext_, and magically makes them functions on the |
142 | 142 | * model extended. (Internally uses filters, and the __call magic method) |
143 | 143 | */ |
144 | - protected function _register_extending_methods(){ |
|
144 | + protected function _register_extending_methods() { |
|
145 | 145 | $all_methods = get_class_methods(get_class($this)); |
146 | - foreach($all_methods as $method_name){ |
|
147 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
146 | + foreach ($all_methods as $method_name) { |
|
147 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
148 | 148 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
149 | 149 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
150 | - add_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10,10); |
|
150 | + add_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10, 10); |
|
151 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -156,21 +156,21 @@ discard block |
||
156 | 156 | * scans the child of EEME_Base for functions starting with ext_, and magically REMOVES them as functions on the |
157 | 157 | * model extended. (Internally uses filters, and the __call magic method) |
158 | 158 | */ |
159 | - public function deregister(){ |
|
160 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables',array($this,'add_extra_tables_on_filter')); |
|
161 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields',array($this,'add_extra_fields_on_filter')); |
|
162 | - remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations',array($this,'add_extra_relations_on_filter')); |
|
159 | + public function deregister() { |
|
160 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__tables', array($this, 'add_extra_tables_on_filter')); |
|
161 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__fields', array($this, 'add_extra_fields_on_filter')); |
|
162 | + remove_filter('FHEE__EEM_'.$this->_model_name_extended.'__construct__model_relations', array($this, 'add_extra_relations_on_filter')); |
|
163 | 163 | $all_methods = get_class_methods(get_class($this)); |
164 | - foreach($all_methods as $method_name){ |
|
165 | - if(strpos($method_name, self::extending_method_prefix) === 0){ |
|
164 | + foreach ($all_methods as $method_name) { |
|
165 | + if (strpos($method_name, self::extending_method_prefix) === 0) { |
|
166 | 166 | $method_name_on_model = str_replace(self::extending_method_prefix, '', $method_name); |
167 | 167 | $callback_name = "FHEE__EEM_{$this->_model_name_extended}__$method_name_on_model"; |
168 | - remove_filter($callback_name,array($this,self::dynamic_callback_method_prefix.$method_name_on_model),10); |
|
168 | + remove_filter($callback_name, array($this, self::dynamic_callback_method_prefix.$method_name_on_model), 10); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | /** @var EEM_Base $model_to_reset */ |
172 | - $model_to_reset = 'EEM_' . $this->_model_name_extended; |
|
173 | - if ( class_exists( $model_to_reset ) ) { |
|
172 | + $model_to_reset = 'EEM_'.$this->_model_name_extended; |
|
173 | + if (class_exists($model_to_reset)) { |
|
174 | 174 | $model_to_reset::reset(); |
175 | 175 | } |
176 | 176 | } |
@@ -183,27 +183,27 @@ discard block |
||
183 | 183 | * @return mixed |
184 | 184 | * @throws EE_Error |
185 | 185 | */ |
186 | - public function __call( $callback_method_name, array $args){ |
|
187 | - if(strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0){ |
|
186 | + public function __call($callback_method_name, array $args) { |
|
187 | + if (strpos($callback_method_name, self::dynamic_callback_method_prefix) === 0) { |
|
188 | 188 | //it's a dynamic callback for a method name |
189 | 189 | $method_called_on_model = str_replace(self::dynamic_callback_method_prefix, '', $callback_method_name); |
190 | - list( $original_return_val, $model_called, $args_provided_to_method_on_model ) = $args; |
|
190 | + list($original_return_val, $model_called, $args_provided_to_method_on_model) = $args; |
|
191 | 191 | $this->_ = $model_called; |
192 | 192 | $extending_method = self::extending_method_prefix.$method_called_on_model; |
193 | - if(method_exists($this, $extending_method)){ |
|
194 | - return call_user_func_array(array($this,$extending_method), $args_provided_to_method_on_model); |
|
195 | - }else{ |
|
193 | + if (method_exists($this, $extending_method)) { |
|
194 | + return call_user_func_array(array($this, $extending_method), $args_provided_to_method_on_model); |
|
195 | + } else { |
|
196 | 196 | throw new EE_Error( |
197 | 197 | sprintf( |
198 | 198 | __("An odd error occurred. Model '%s' had a method called on it that it didn't recognize. So it passed it onto the model extension '%s' (because it had a function named '%s' which should be able to handle it), but the function '%s' doesnt exist!)", "event_espresso"), |
199 | 199 | $this->_model_name_extended, |
200 | 200 | get_class($this), |
201 | - $extending_method,$extending_method |
|
201 | + $extending_method, $extending_method |
|
202 | 202 | ) |
203 | 203 | ); |
204 | 204 | } |
205 | 205 | |
206 | - }else{ |
|
206 | + } else { |
|
207 | 207 | throw new EE_Error( |
208 | 208 | sprintf( |
209 | 209 | __("There is no method named '%s' on '%s'", "event_espresso"), |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * This prepares data for message types that send messages for multiple registrations (that could span multiple |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | * @throws EE_Error |
21 | 21 | * @access protected |
22 | 22 | */ |
23 | - public function __construct( $data = array() ) { |
|
23 | + public function __construct($data = array()) { |
|
24 | 24 | |
25 | 25 | //validate that the first element in the array is an EE_Registration object. |
26 | - if ( ! reset( $data ) instanceof EE_Registration ) { |
|
27 | - throw new EE_Error( __( 'The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso' ) ); |
|
26 | + if ( ! reset($data) instanceof EE_Registration) { |
|
27 | + throw new EE_Error(__('The EE_Message_Registrations_incoming_data class expects an array of EE_Registration objects.', 'event_espresso')); |
|
28 | 28 | } |
29 | - parent::__construct( $data ); |
|
29 | + parent::__construct($data); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -58,10 +58,10 @@ discard block |
||
58 | 58 | * |
59 | 59 | * @return EE_Registration[] The data being prepared for the db |
60 | 60 | */ |
61 | - static public function convert_data_for_persistent_storage( $registrations ) { |
|
61 | + static public function convert_data_for_persistent_storage($registrations) { |
|
62 | 62 | if ( |
63 | - ! is_array( $registrations ) |
|
64 | - || ! reset( $registrations ) instanceof EE_Registration |
|
63 | + ! is_array($registrations) |
|
64 | + || ! reset($registrations) instanceof EE_Registration |
|
65 | 65 | ) { |
66 | 66 | return array(); |
67 | 67 | } |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | |
71 | 71 | $registration_ids = array_filter( |
72 | 72 | array_map( |
73 | - function( $registration ) { |
|
74 | - if ( $registration instanceof EE_Registration ) { |
|
73 | + function($registration) { |
|
74 | + if ($registration instanceof EE_Registration) { |
|
75 | 75 | return $registration->ID(); |
76 | 76 | } |
77 | 77 | }, |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return EE_Registration[] |
97 | 97 | */ |
98 | - static public function convert_data_from_persistent_storage( $data ) { |
|
98 | + static public function convert_data_from_persistent_storage($data) { |
|
99 | 99 | //since this was added later, we need to account of possible back compat issues where data already queued for generation |
100 | 100 | //is in the old format, which is an array of EE_Registration objects. So if that's the case, then let's just return them |
101 | 101 | //@see https://events.codebasehq.com/projects/event-espresso/tickets/10127 |
102 | - if ( is_array( $data ) && reset( $data ) instanceof EE_Registration ) { |
|
102 | + if (is_array($data) && reset($data) instanceof EE_Registration) { |
|
103 | 103 | return $data; |
104 | 104 | } |
105 | 105 | |
106 | - $registrations = is_array( $data ) |
|
107 | - ? EEM_Registration::instance()->get_all( array( array( 'REG_ID' => array( 'IN', $data ) ) ) ) |
|
106 | + $registrations = is_array($data) |
|
107 | + ? EEM_Registration::instance()->get_all(array(array('REG_ID' => array('IN', $data)))) |
|
108 | 108 | : array(); |
109 | 109 | return $registrations; |
110 | 110 | } |
@@ -57,11 +57,11 @@ |
||
57 | 57 | |
58 | 58 | |
59 | 59 | |
60 | - /** |
|
61 | - * @param array $req_data |
|
62 | - * @throws EE_Error |
|
63 | - */ |
|
64 | - public function _normalize( $req_data ) { |
|
60 | + /** |
|
61 | + * @param array $req_data |
|
62 | + * @throws EE_Error |
|
63 | + */ |
|
64 | + public function _normalize( $req_data ) { |
|
65 | 65 | parent::_normalize( $req_data ); |
66 | 66 | $paypal_calculates_shipping = $this->get_input_value( 'paypal_shipping' ); |
67 | 67 | $paypal_calculates_taxes = $this->get_input_value( 'paypal_taxes' ); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -21,35 +21,35 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param EE_PMT_Paypal_Standard $payment_method_type |
23 | 23 | */ |
24 | - public function __construct( $payment_method_type ){ |
|
24 | + public function __construct($payment_method_type) { |
|
25 | 25 | parent::__construct( |
26 | 26 | array( |
27 | 27 | 'payment_method_type' => $payment_method_type, |
28 | 28 | 'extra_meta_inputs' => array( |
29 | - 'paypal_id' => new EE_Text_Input( array( |
|
30 | - 'html_label_text' => sprintf( __( "Paypal Email %s", 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
31 | - 'html_help_text' => __( "Typically [email protected]", 'event_espresso' ), |
|
29 | + 'paypal_id' => new EE_Text_Input(array( |
|
30 | + 'html_label_text' => sprintf(__("Paypal Email %s", 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
31 | + 'html_help_text' => __("Typically [email protected]", 'event_espresso'), |
|
32 | 32 | 'required' => true |
33 | - ) ), |
|
34 | - 'image_url' => new EE_Admin_File_Uploader_Input( array( |
|
35 | - 'html_help_text' => __( "Used for your business/personal logo on the PayPal page", 'event_espresso' ), |
|
36 | - 'html_label_text' => __( 'Image URL', 'event_espresso' ) |
|
37 | - ) ), |
|
38 | - 'paypal_taxes' => new EE_Yes_No_Input( array( |
|
39 | - 'html_label_text' => sprintf( __( 'Paypal Calculates Taxes %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
40 | - 'html_help_text' => __( 'Whether Paypal should add taxes to the order', 'event_espresso' ), |
|
33 | + )), |
|
34 | + 'image_url' => new EE_Admin_File_Uploader_Input(array( |
|
35 | + 'html_help_text' => __("Used for your business/personal logo on the PayPal page", 'event_espresso'), |
|
36 | + 'html_label_text' => __('Image URL', 'event_espresso') |
|
37 | + )), |
|
38 | + 'paypal_taxes' => new EE_Yes_No_Input(array( |
|
39 | + 'html_label_text' => sprintf(__('Paypal Calculates Taxes %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
40 | + 'html_help_text' => __('Whether Paypal should add taxes to the order', 'event_espresso'), |
|
41 | 41 | 'default' => false |
42 | - ) ), |
|
43 | - 'paypal_shipping' => new EE_Yes_No_Input( array( |
|
44 | - 'html_label_text' => sprintf( __( 'Paypal Calculates Shipping %s', 'event_espresso' ), $payment_method_type->get_help_tab_link() ), |
|
45 | - 'html_help_text' => __( 'Whether Paypal should add shipping surcharges', 'event_espresso' ), |
|
42 | + )), |
|
43 | + 'paypal_shipping' => new EE_Yes_No_Input(array( |
|
44 | + 'html_label_text' => sprintf(__('Paypal Calculates Shipping %s', 'event_espresso'), $payment_method_type->get_help_tab_link()), |
|
45 | + 'html_help_text' => __('Whether Paypal should add shipping surcharges', 'event_espresso'), |
|
46 | 46 | 'default' => false |
47 | - ) ), |
|
48 | - 'shipping_details' => new EE_Select_Input( array( |
|
49 | - EE_PMT_Paypal_Standard::shipping_info_none => __( "Do not prompt for an address", 'event_espresso' ), |
|
50 | - EE_PMT_Paypal_Standard::shipping_info_optional => __( "Prompt for an address, but do not require it", 'event_espresso' ), |
|
51 | - EE_PMT_Paypal_Standard::shipping_info_required => __( "Prompt for an address, and require it", 'event_espresso' ) |
|
52 | - ) ) |
|
47 | + )), |
|
48 | + 'shipping_details' => new EE_Select_Input(array( |
|
49 | + EE_PMT_Paypal_Standard::shipping_info_none => __("Do not prompt for an address", 'event_espresso'), |
|
50 | + EE_PMT_Paypal_Standard::shipping_info_optional => __("Prompt for an address, but do not require it", 'event_espresso'), |
|
51 | + EE_PMT_Paypal_Standard::shipping_info_required => __("Prompt for an address, and require it", 'event_espresso') |
|
52 | + )) |
|
53 | 53 | ) |
54 | 54 | ) |
55 | 55 | ); |
@@ -61,28 +61,28 @@ discard block |
||
61 | 61 | * @param array $req_data |
62 | 62 | * @throws EE_Error |
63 | 63 | */ |
64 | - public function _normalize( $req_data ) { |
|
65 | - parent::_normalize( $req_data ); |
|
66 | - $paypal_calculates_shipping = $this->get_input_value( 'paypal_shipping' ); |
|
67 | - $paypal_calculates_taxes = $this->get_input_value( 'paypal_taxes' ); |
|
68 | - $paypal_requests_address_info = $this->get_input_value( 'shipping_details' ); |
|
64 | + public function _normalize($req_data) { |
|
65 | + parent::_normalize($req_data); |
|
66 | + $paypal_calculates_shipping = $this->get_input_value('paypal_shipping'); |
|
67 | + $paypal_calculates_taxes = $this->get_input_value('paypal_taxes'); |
|
68 | + $paypal_requests_address_info = $this->get_input_value('shipping_details'); |
|
69 | 69 | if ( |
70 | - ( $paypal_calculates_shipping || $paypal_calculates_taxes ) && |
|
70 | + ($paypal_calculates_shipping || $paypal_calculates_taxes) && |
|
71 | 71 | $paypal_requests_address_info == EE_PMT_Paypal_Standard::shipping_info_none |
72 | 72 | ) { |
73 | 73 | //they want paypal to calculate taxes or shipping. They need to ask for |
74 | 74 | //address info, otherwise paypal can't calculate taxes or shipping |
75 | 75 | /** @type EE_Select_Input $shipping_details_input */ |
76 | - $shipping_details_input = $this->get_input( 'shipping_details' ); |
|
77 | - $shipping_details_input->set_default( EE_PMT_Paypal_Standard::shipping_info_optional ); |
|
76 | + $shipping_details_input = $this->get_input('shipping_details'); |
|
77 | + $shipping_details_input->set_default(EE_PMT_Paypal_Standard::shipping_info_optional); |
|
78 | 78 | $shipping_details_input_options = $shipping_details_input->options(); |
79 | 79 | EE_Error::add_attention( |
80 | 80 | sprintf( |
81 | - __( 'Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso' ), |
|
82 | - strip_tags( $shipping_details_input->html_label_text() ), |
|
83 | - isset( $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] ) |
|
84 | - ? $shipping_details_input_options[ EE_PMT_Paypal_Standard::shipping_info_optional ] |
|
85 | - : __( 'Unknown', 'event_espresso' ) |
|
81 | + __('Automatically set "%s" to "%s" because Paypal requires address info in order to calculate shipping or taxes.', 'event_espresso'), |
|
82 | + strip_tags($shipping_details_input->html_label_text()), |
|
83 | + isset($shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional]) |
|
84 | + ? $shipping_details_input_options[EE_PMT_Paypal_Standard::shipping_info_optional] |
|
85 | + : __('Unknown', 'event_espresso') |
|
86 | 86 | ), |
87 | 87 | __FILE__, __FUNCTION__, __LINE__ |
88 | 88 | ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | |
28 | 28 | protected function _setup_data() { |
29 | - $this->_data = $this->_get_messages( $this->_per_page, $this->_view ); |
|
30 | - $this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true ); |
|
29 | + $this->_data = $this->_get_messages($this->_per_page, $this->_view); |
|
30 | + $this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -35,32 +35,32 @@ discard block |
||
35 | 35 | |
36 | 36 | protected function _set_properties() { |
37 | 37 | $this->_wp_list_args = array( |
38 | - 'singular' => __( 'Message', 'event_espresso' ), |
|
39 | - 'plural' => __( 'Messages', 'event_espresso' ), |
|
38 | + 'singular' => __('Message', 'event_espresso'), |
|
39 | + 'plural' => __('Messages', 'event_espresso'), |
|
40 | 40 | 'ajax' => true, |
41 | 41 | 'screen' => $this->get_admin_page()->get_current_screen()->id |
42 | 42 | ); |
43 | 43 | |
44 | 44 | $this->_columns = array( |
45 | 45 | 'cb' => '<input type="checkbox" />', |
46 | - 'to' => __( 'To', 'event_espresso' ), |
|
47 | - 'from' => __( 'From', 'event_espresso' ), |
|
48 | - 'messenger' => __( 'Messenger', 'event_espresso' ), |
|
49 | - 'message_type' => __( 'Message Type', 'event_espresso' ), |
|
50 | - 'context' => __( 'Context', 'event_espresso' ), |
|
51 | - 'modified' => __( 'Modified', 'event_espresso' ), |
|
52 | - 'action' => __( 'Actions', 'event_espresso' ), |
|
53 | - 'msg_id' => __( 'ID', 'event_espresso' ), |
|
46 | + 'to' => __('To', 'event_espresso'), |
|
47 | + 'from' => __('From', 'event_espresso'), |
|
48 | + 'messenger' => __('Messenger', 'event_espresso'), |
|
49 | + 'message_type' => __('Message Type', 'event_espresso'), |
|
50 | + 'context' => __('Context', 'event_espresso'), |
|
51 | + 'modified' => __('Modified', 'event_espresso'), |
|
52 | + 'action' => __('Actions', 'event_espresso'), |
|
53 | + 'msg_id' => __('ID', 'event_espresso'), |
|
54 | 54 | ); |
55 | 55 | |
56 | 56 | $this->_sortable_columns = array( |
57 | - 'modified' => array( 'MSG_modified' => true ), |
|
58 | - 'message_type' => array( 'MSG_message_type' => false ), |
|
59 | - 'messenger' => array( 'MSG_messenger' => false ), |
|
60 | - 'to' => array( 'MSG_to' => false ), |
|
61 | - 'from' => array( 'MSG_from' => false ), |
|
62 | - 'context' => array( 'MSG_context' => false ), |
|
63 | - 'msg_id' => array( 'MSG_ID', false ), |
|
57 | + 'modified' => array('MSG_modified' => true), |
|
58 | + 'message_type' => array('MSG_message_type' => false), |
|
59 | + 'messenger' => array('MSG_messenger' => false), |
|
60 | + 'to' => array('MSG_to' => false), |
|
61 | + 'from' => array('MSG_from' => false), |
|
62 | + 'context' => array('MSG_context' => false), |
|
63 | + 'msg_id' => array('MSG_ID', false), |
|
64 | 64 | ); |
65 | 65 | |
66 | 66 | $this->_primary_column = 'to'; |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | * @param object $item the current item |
79 | 79 | * @return string |
80 | 80 | */ |
81 | - protected function _get_row_class( $item ) { |
|
82 | - $class = parent::_get_row_class( $item ); |
|
81 | + protected function _get_row_class($item) { |
|
82 | + $class = parent::_get_row_class($item); |
|
83 | 83 | //add status class |
84 | - $class .= ' ee-status-strip msg-status-' . $item->STS_ID(); |
|
85 | - if ( $this->_has_checkbox_column ) { |
|
84 | + $class .= ' ee-status-strip msg-status-'.$item->STS_ID(); |
|
85 | + if ($this->_has_checkbox_column) { |
|
86 | 86 | $class .= ' has-checkbox-column'; |
87 | 87 | } |
88 | 88 | return $class; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | ); |
111 | 111 | |
112 | 112 | //set filters to select inputs if they aren't empty |
113 | - foreach ( $select_inputs as $select_input ) { |
|
114 | - if ( $select_input ) { |
|
113 | + foreach ($select_inputs as $select_input) { |
|
114 | + if ($select_input) { |
|
115 | 115 | $filters[] = $select_input; |
116 | 116 | } |
117 | 117 | } |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | protected function _add_view_counts() { |
124 | - foreach ( $this->_views as $view => $args ) { |
|
125 | - $this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true ); |
|
124 | + foreach ($this->_views as $view => $args) { |
|
125 | + $this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | * @return string checkbox |
134 | 134 | * @throws \EE_Error |
135 | 135 | */ |
136 | - public function column_cb( $message ) { |
|
137 | - return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() ); |
|
136 | + public function column_cb($message) { |
|
137 | + return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID()); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | * @throws \EE_Error |
146 | 146 | */ |
147 | - public function column_msg_id( EE_Message $message ) { |
|
147 | + public function column_msg_id(EE_Message $message) { |
|
148 | 148 | return $message->ID(); |
149 | 149 | } |
150 | 150 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | * @return string The recipient of the message |
156 | 156 | * @throws \EE_Error |
157 | 157 | */ |
158 | - public function column_to( EE_Message $message ) { |
|
159 | - EE_Registry::instance()->load_helper( 'URL' ); |
|
158 | + public function column_to(EE_Message $message) { |
|
159 | + EE_Registry::instance()->load_helper('URL'); |
|
160 | 160 | $actions = array(); |
161 | 161 | $actions['delete'] = '<a href="' |
162 | 162 | . EEH_URL::add_query_args_and_nonce( |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | 'action' => 'delete_ee_message', |
166 | 166 | 'MSG_ID' => $message->ID() |
167 | 167 | ), |
168 | - admin_url( 'admin.php' ) |
|
168 | + admin_url('admin.php') |
|
169 | 169 | ) |
170 | - . '">' . __( 'Delete', 'event_espresso' ) . '</a>'; |
|
171 | - return esc_html( $message->to() ) . $this->row_actions( $actions ); |
|
170 | + . '">'.__('Delete', 'event_espresso').'</a>'; |
|
171 | + return esc_html($message->to()).$this->row_actions($actions); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | * @param EE_Message $message |
177 | 177 | * @return string The sender of the message |
178 | 178 | */ |
179 | - public function column_from( EE_Message $message ) { |
|
180 | - return esc_html( $message->from() ); |
|
179 | + public function column_from(EE_Message $message) { |
|
180 | + return esc_html($message->from()); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param EE_Message $message |
187 | 187 | * @return string The messenger used to send the message. |
188 | 188 | */ |
189 | - public function column_messenger( EE_Message $message ) { |
|
190 | - return ucwords( $message->messenger_label() ); |
|
189 | + public function column_messenger(EE_Message $message) { |
|
190 | + return ucwords($message->messenger_label()); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param EE_Message $message |
196 | 196 | * @return string The message type used to generate the message. |
197 | 197 | */ |
198 | - public function column_message_type( EE_Message $message ) { |
|
199 | - return ucwords( $message->message_type_label() ); |
|
198 | + public function column_message_type(EE_Message $message) { |
|
199 | + return ucwords($message->message_type_label()); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @param EE_Message $message |
205 | 205 | * @return string The context the message was generated for. |
206 | 206 | */ |
207 | - public function column_context( EE_Message $message ) { |
|
207 | + public function column_context(EE_Message $message) { |
|
208 | 208 | return $message->context_label(); |
209 | 209 | } |
210 | 210 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @param EE_Message $message |
214 | 214 | * @return string The timestamp when this message was last modified. |
215 | 215 | */ |
216 | - public function column_modified( EE_Message $message ) { |
|
216 | + public function column_modified(EE_Message $message) { |
|
217 | 217 | return $message->modified(); |
218 | 218 | } |
219 | 219 | |
@@ -222,36 +222,36 @@ discard block |
||
222 | 222 | * @param EE_Message $message |
223 | 223 | * @return string Actions that can be done on the current message. |
224 | 224 | */ |
225 | - public function column_action( EE_Message $message ) { |
|
226 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
225 | + public function column_action(EE_Message $message) { |
|
226 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
227 | 227 | $action_links = array( |
228 | - 'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ), |
|
229 | - 'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ), |
|
230 | - 'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ), |
|
231 | - 'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ), |
|
232 | - 'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ), |
|
233 | - 'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ), |
|
228 | + 'view' => EEH_MSG_Template::get_message_action_link('view', $message), |
|
229 | + 'error' => EEH_MSG_Template::get_message_action_link('error', $message), |
|
230 | + 'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message), |
|
231 | + 'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message), |
|
232 | + 'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message), |
|
233 | + 'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message), |
|
234 | 234 | ); |
235 | 235 | $content = ''; |
236 | - switch ( $message->STS_ID() ) { |
|
236 | + switch ($message->STS_ID()) { |
|
237 | 237 | case EEM_Message::status_sent : |
238 | - $content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction']; |
|
238 | + $content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction']; |
|
239 | 239 | break; |
240 | 240 | case EEM_Message::status_resend : |
241 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
241 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
242 | 242 | break; |
243 | 243 | case EEM_Message::status_retry : |
244 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction']; |
|
244 | + $content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction']; |
|
245 | 245 | break; |
246 | 246 | case EEM_Message::status_failed : |
247 | 247 | case EEM_Message::status_debug_only : |
248 | - $content = $action_links['error'] . $action_links['view_transaction']; |
|
248 | + $content = $action_links['error'].$action_links['view_transaction']; |
|
249 | 249 | break; |
250 | 250 | case EEM_Message::status_idle : |
251 | - $content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction']; |
|
251 | + $content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction']; |
|
252 | 252 | break; |
253 | 253 | case EEM_Message::status_incomplete; |
254 | - $content = $action_links['generate_now'] . $action_links['view_transaction']; |
|
254 | + $content = $action_links['generate_now'].$action_links['view_transaction']; |
|
255 | 255 | break; |
256 | 256 | } |
257 | 257 | return $content; |
@@ -269,54 +269,54 @@ discard block |
||
269 | 269 | * @return int | EE_Message[] |
270 | 270 | * @throws \EE_Error |
271 | 271 | */ |
272 | - protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) { |
|
272 | + protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) { |
|
273 | 273 | |
274 | - $current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] ) |
|
274 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
275 | 275 | ? $this->_req_data['paged'] |
276 | 276 | : 1; |
277 | 277 | |
278 | - $per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] ) |
|
278 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
279 | 279 | ? $this->_req_data['perpage'] |
280 | 280 | : $perpage; |
281 | 281 | |
282 | - $offset = ( $current_page - 1 ) * $per_page; |
|
283 | - $limit = $all || $count ? null : array( $offset, $per_page ); |
|
282 | + $offset = ($current_page - 1) * $per_page; |
|
283 | + $limit = $all || $count ? null : array($offset, $per_page); |
|
284 | 284 | $query_params = array( |
285 | - 'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ], |
|
286 | - 'order' => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ], |
|
285 | + 'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'], |
|
286 | + 'order' => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'], |
|
287 | 287 | 'limit' => $limit, |
288 | 288 | ); |
289 | 289 | |
290 | 290 | /** |
291 | 291 | * Any filters coming in from other routes? |
292 | 292 | */ |
293 | - if ( isset( $this->_req_data['filterby'] ) ) { |
|
294 | - $query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() ); |
|
295 | - if ( ! $count ) { |
|
293 | + if (isset($this->_req_data['filterby'])) { |
|
294 | + $query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params()); |
|
295 | + if ( ! $count) { |
|
296 | 296 | $query_params['group_by'] = 'MSG_ID'; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | 300 | //view conditionals |
301 | - if ( $view !== 'all' && $count && $all ) { |
|
301 | + if ($view !== 'all' && $count && $all) { |
|
302 | 302 | $query_params[0]['AND*view_conditional'] = array( |
303 | - 'STS_ID' => strtoupper( $view ), |
|
303 | + 'STS_ID' => strtoupper($view), |
|
304 | 304 | ); |
305 | 305 | } |
306 | 306 | |
307 | - if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) { |
|
307 | + if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') { |
|
308 | 308 | $query_params[0]['AND*view_conditional'] = array( |
309 | - 'STS_ID' => strtoupper( $this->_req_data['status'] ), |
|
309 | + 'STS_ID' => strtoupper($this->_req_data['status']), |
|
310 | 310 | ); |
311 | 311 | } |
312 | 312 | |
313 | - if ( ! $all && ! empty( $this->_req_data['s'] ) ) { |
|
314 | - $search_string = '%' . $this->_req_data['s'] . '%'; |
|
313 | + if ( ! $all && ! empty($this->_req_data['s'])) { |
|
314 | + $search_string = '%'.$this->_req_data['s'].'%'; |
|
315 | 315 | $query_params[0]['OR'] = array( |
316 | - 'MSG_to' => array( 'LIKE', $search_string ), |
|
317 | - 'MSG_from' => array( 'LIKE', $search_string ), |
|
318 | - 'MSG_subject' => array( 'LIKE', $search_string ), |
|
319 | - 'MSG_content' => array( 'LIKE', $search_string ), |
|
316 | + 'MSG_to' => array('LIKE', $search_string), |
|
317 | + 'MSG_from' => array('LIKE', $search_string), |
|
318 | + 'MSG_subject' => array('LIKE', $search_string), |
|
319 | + 'MSG_content' => array('LIKE', $search_string), |
|
320 | 320 | ); |
321 | 321 | } |
322 | 322 | |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | //the messages system is in debug mode. |
325 | 325 | //Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only |
326 | 326 | //messages in the database. |
327 | - if ( ! EEM_Message::debug() ) { |
|
327 | + if ( ! EEM_Message::debug()) { |
|
328 | 328 | $query_params[0]['AND*debug_only_conditional'] = array( |
329 | - 'STS_ID' => array( '!=', EEM_Message::status_debug_only ) |
|
329 | + 'STS_ID' => array('!=', EEM_Message::status_debug_only) |
|
330 | 330 | ); |
331 | 331 | } |
332 | 332 | |
333 | 333 | //account for filters |
334 | 334 | if ( |
335 | 335 | ! $all |
336 | - && isset( $this->_req_data['ee_messenger_filter_by'] ) |
|
336 | + && isset($this->_req_data['ee_messenger_filter_by']) |
|
337 | 337 | && $this->_req_data['ee_messenger_filter_by'] !== 'none_selected' |
338 | 338 | ) { |
339 | 339 | $query_params[0]['AND*messenger_filter'] = array( |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | } |
343 | 343 | if ( |
344 | 344 | ! $all |
345 | - && ! empty( $this->_req_data['ee_message_type_filter_by'] ) |
|
345 | + && ! empty($this->_req_data['ee_message_type_filter_by']) |
|
346 | 346 | && $this->_req_data['ee_message_type_filter_by'] !== 'none_selected' |
347 | 347 | ) { |
348 | 348 | $query_params[0]['AND*message_type_filter'] = array( |
@@ -352,17 +352,17 @@ discard block |
||
352 | 352 | |
353 | 353 | if ( |
354 | 354 | ! $all |
355 | - && ! empty( $this->_req_data['ee_context_filter_by'] ) |
|
355 | + && ! empty($this->_req_data['ee_context_filter_by']) |
|
356 | 356 | && $this->_req_data['ee_context_filter_by'] !== 'none_selected' |
357 | 357 | ) { |
358 | 358 | $query_params[0]['AND*context_filter'] = array( |
359 | - 'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) ) |
|
359 | + 'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by'])) |
|
360 | 360 | ); |
361 | 361 | } |
362 | 362 | |
363 | 363 | return $count |
364 | - ? EEM_Message::instance()->count( $query_params, null, true ) |
|
365 | - : EEM_Message::instance()->get_all( $query_params ); |
|
364 | + ? EEM_Message::instance()->count($query_params, null, true) |
|
365 | + : EEM_Message::instance()->get_all($query_params); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -372,15 +372,15 @@ discard block |
||
372 | 372 | */ |
373 | 373 | protected function _get_messengers_dropdown_filter() { |
374 | 374 | $messenger_options = array(); |
375 | - $active_messages_grouped_by_messenger = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) ); |
|
375 | + $active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger')); |
|
376 | 376 | |
377 | 377 | //setup array of messenger options |
378 | - foreach ( $active_messages_grouped_by_messenger as $active_message ) { |
|
379 | - if ( $active_message instanceof EE_Message ) { |
|
380 | - $messenger_options[ $active_message->messenger() ] = ucwords( $active_message->messenger_label() ); |
|
378 | + foreach ($active_messages_grouped_by_messenger as $active_message) { |
|
379 | + if ($active_message instanceof EE_Message) { |
|
380 | + $messenger_options[$active_message->messenger()] = ucwords($active_message->messenger_label()); |
|
381 | 381 | } |
382 | 382 | } |
383 | - return $this->get_admin_page()->get_messengers_select_input( $messenger_options ); |
|
383 | + return $this->get_admin_page()->get_messengers_select_input($messenger_options); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -391,15 +391,15 @@ discard block |
||
391 | 391 | */ |
392 | 392 | protected function _get_message_types_dropdown_filter() { |
393 | 393 | $message_type_options = array(); |
394 | - $active_messages_grouped_by_message_type = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) ); |
|
394 | + $active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type')); |
|
395 | 395 | |
396 | 396 | //setup array of message type options |
397 | - foreach ( $active_messages_grouped_by_message_type as $active_message ) { |
|
398 | - if ( $active_message instanceof EE_Message ) { |
|
399 | - $message_type_options[ $active_message->message_type() ] = ucwords( $active_message->message_type_label() ); |
|
397 | + foreach ($active_messages_grouped_by_message_type as $active_message) { |
|
398 | + if ($active_message instanceof EE_Message) { |
|
399 | + $message_type_options[$active_message->message_type()] = ucwords($active_message->message_type_label()); |
|
400 | 400 | } |
401 | 401 | } |
402 | - return $this->get_admin_page()->get_message_types_select_input( $message_type_options ); |
|
402 | + return $this->get_admin_page()->get_message_types_select_input($message_type_options); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -409,21 +409,21 @@ discard block |
||
409 | 409 | */ |
410 | 410 | protected function _get_contexts_for_message_types_dropdown_filter() { |
411 | 411 | $context_options = array(); |
412 | - $active_messages_grouped_by_context = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) ); |
|
412 | + $active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context')); |
|
413 | 413 | |
414 | 414 | //setup array of context options |
415 | - foreach ( $active_messages_grouped_by_context as $active_message ) { |
|
416 | - if ( $active_message instanceof EE_Message ) { |
|
415 | + foreach ($active_messages_grouped_by_context as $active_message) { |
|
416 | + if ($active_message instanceof EE_Message) { |
|
417 | 417 | $message_type = $active_message->message_type_object(); |
418 | - if ( $message_type instanceof EE_message_type ) { |
|
419 | - foreach ( $message_type->get_contexts() as $context => $context_details ) { |
|
420 | - if ( isset( $context_details['label'] ) ) { |
|
421 | - $context_options[ $context ] = $context_details['label']; |
|
418 | + if ($message_type instanceof EE_message_type) { |
|
419 | + foreach ($message_type->get_contexts() as $context => $context_details) { |
|
420 | + if (isset($context_details['label'])) { |
|
421 | + $context_options[$context] = $context_details['label']; |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | } |
425 | 425 | } |
426 | 426 | } |
427 | - return $this->get_admin_page()->get_contexts_for_message_types_select_input( $context_options ); |
|
427 | + return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options); |
|
428 | 428 | } |
429 | 429 | } //end EE_Message_List_Table class |
430 | 430 | \ No newline at end of file |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | * @throws EE_Error |
28 | 28 | * @access protected |
29 | 29 | */ |
30 | - public function __construct( $data = array() ) { |
|
30 | + public function __construct($data = array()) { |
|
31 | 31 | |
32 | 32 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
33 | - $ctc_chk = reset( $data ); |
|
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
33 | + $ctc_chk = reset($data); |
|
34 | + if ( ! $ctc_chk instanceof EE_Attendee) |
|
35 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso')); |
|
36 | 36 | |
37 | - parent::__construct( $data ); |
|
37 | + parent::__construct($data); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | * @param array $attendees |
44 | 44 | * @return array |
45 | 45 | */ |
46 | - public static function convert_data_for_persistent_storage( $attendees ) { |
|
46 | + public static function convert_data_for_persistent_storage($attendees) { |
|
47 | 47 | $attendee_ids = array_filter( |
48 | 48 | array_map( |
49 | - function( $attendee ) { |
|
50 | - if ( $attendee instanceof EE_Attendee ) { |
|
49 | + function($attendee) { |
|
50 | + if ($attendee instanceof EE_Attendee) { |
|
51 | 51 | return $attendee->ID(); |
52 | 52 | } |
53 | 53 | return false; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | * @param array $attendee_ids |
67 | 67 | * @return EE_Attendee[] |
68 | 68 | */ |
69 | - public static function convert_data_from_persistent_storage( $attendee_ids ) { |
|
69 | + public static function convert_data_from_persistent_storage($attendee_ids) { |
|
70 | 70 | $attendee_ids = (array) $attendee_ids; |
71 | 71 | $attendees = EEM_Attendee::instance()->get_all( |
72 | 72 | array( |
73 | - array( 'ATT_ID' => array( 'IN', $attendee_ids ) ) |
|
73 | + array('ATT_ID' => array('IN', $attendee_ids)) |
|
74 | 74 | ) |
75 | 75 | ); |
76 | 76 | return $attendees; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $this->payment = NULL; |
100 | 100 | $this->billing = array(); |
101 | 101 | $this->reg_objs = array(); |
102 | - $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
102 | + $this->attendees = $this->events = $this->tickets = $this->datetimes = $this->questions = $this->answer = $this->registrations = array(); |
|
103 | 103 | $this->total_ticket_count = 0; |
104 | 104 | $this->primary_attendee_data = array( |
105 | 105 | 'registration_id' => 0, |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'primary_reg_obj' => NULL |
110 | 110 | ); |
111 | 111 | |
112 | - foreach ( $this->_data as $contact ) { |
|
112 | + foreach ($this->_data as $contact) { |
|
113 | 113 | $id = $contact->ID(); |
114 | 114 | $reg = $contact->get_first_related('Registration'); |
115 | 115 | $this->attendees[$id]['att_obj'] = $contact; |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | * @subpackage helpers |
6 | 6 | * @since 4.3.0 |
7 | 7 | */ |
8 | -if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
8 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
9 | + exit('No direct script access allowed'); |
|
10 | +} |
|
9 | 11 | |
10 | 12 | /** |
11 | 13 | * This prepares data for message types that send messages for multiple contacts and handles |
@@ -31,8 +33,9 @@ discard block |
||
31 | 33 | |
32 | 34 | //validate that the first element in the array is an EE_Attendee object. Note that the array may be indexed by REG_ID so we will just shift off the first element. |
33 | 35 | $ctc_chk = reset( $data ); |
34 | - if ( ! $ctc_chk instanceof EE_Attendee ) |
|
35 | - throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
36 | + if ( ! $ctc_chk instanceof EE_Attendee ) { |
|
37 | + throw new EE_Error(__('The EE_Message_Contacts_incoming_data class expects an array of EE_Attendee objects.', 'event_espresso') ); |
|
38 | + } |
|
36 | 39 | |
37 | 40 | parent::__construct( $data ); |
38 | 41 | } |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | |
12 | 12 | $row = 1; |
13 | 13 | $max = 1; |
14 | -$ticket_count = count( $tickets ); |
|
14 | +$ticket_count = count($tickets); |
|
15 | 15 | $ticket_status_display = ''; |
16 | -if ( ! $ticket_count ) { |
|
16 | +if ( ! $ticket_count) { |
|
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $required_ticket_sold_out = FALSE; |
21 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
21 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
22 | 22 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
23 | 23 | : new EE_Ticket_Selector_Config(); |
24 | 24 | |
25 | -$tax_settings = isset ( EE_Registry::instance()->CFG->tax_settings ) |
|
25 | +$tax_settings = isset (EE_Registry::instance()->CFG->tax_settings) |
|
26 | 26 | ? EE_Registry::instance()->CFG->tax_settings |
27 | 27 | : new EE_Tax_Config(); |
28 | 28 | |
@@ -31,22 +31,22 @@ discard block |
||
31 | 31 | |
32 | 32 | ob_start(); |
33 | 33 | |
34 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
35 | - if ( $ticket instanceof EE_Ticket ) { |
|
34 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
35 | + if ($ticket instanceof EE_Ticket) { |
|
36 | 36 | $cols = 2; |
37 | 37 | $max = $ticket->max(); |
38 | 38 | $min = 0; |
39 | 39 | $remaining = $ticket->remaining(); |
40 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
40 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
41 | 41 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
42 | - $max = min( $remaining, $max_atndz ); |
|
42 | + $max = min($remaining, $max_atndz); |
|
43 | 43 | // but... we also want to restrict the number of tickets by the ticket max setting, |
44 | 44 | // however, the max still can't be higher than what was just set above |
45 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
45 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
46 | 46 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
47 | 47 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
48 | 48 | // and if the ticket is required, then make sure that min qty is at least 1 |
49 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
49 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
50 | 50 | } else { |
51 | 51 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
52 | 52 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -58,41 +58,41 @@ discard block |
||
58 | 58 | $taxable_tickets = $ticket->taxable() ? true : $taxable_tickets; |
59 | 59 | $ticket_bundle = FALSE; |
60 | 60 | // for ticket bundles, set min and max qty the same |
61 | - if ( $ticket->min() !== 0 && $ticket->min() === $ticket->max() ) { |
|
61 | + if ($ticket->min() !== 0 && $ticket->min() === $ticket->max()) { |
|
62 | 62 | $ticket_price *= $ticket->min(); |
63 | 63 | $ticket_bundle = TRUE; |
64 | 64 | } |
65 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
65 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
66 | 66 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
67 | 67 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
68 | 68 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
69 | 69 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
70 | 70 | // check ticket status |
71 | - switch ( $tkt_status ) { |
|
71 | + switch ($tkt_status) { |
|
72 | 72 | // sold_out |
73 | 73 | case EE_Ticket::sold_out : |
74 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
74 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
75 | 75 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
76 | 76 | break; |
77 | 77 | // expired |
78 | 78 | case EE_Ticket::expired : |
79 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
79 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
80 | 80 | $status_class = 'ticket-sales-expired lt-grey-text'; |
81 | 81 | break; |
82 | 82 | // archived |
83 | 83 | case EE_Ticket::archived : |
84 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
84 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
85 | 85 | $status_class = 'archived-ticket hidden'; |
86 | 86 | break; |
87 | 87 | // pending |
88 | 88 | case EE_Ticket::pending : |
89 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
89 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
90 | 90 | $status_class = 'ticket-pending'; |
91 | 91 | break; |
92 | 92 | // onsale |
93 | 93 | case EE_Ticket::onsale : |
94 | 94 | default : |
95 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
95 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
96 | 96 | $status_class = 'ticket-on-sale'; |
97 | 97 | break; |
98 | 98 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
133 | 133 | ); |
134 | 134 | ?> |
135 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
135 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
136 | 136 | <?php |
137 | 137 | /** |
138 | 138 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -144,24 +144,24 @@ discard block |
||
144 | 144 | * |
145 | 145 | * @var string|bool |
146 | 146 | */ |
147 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
147 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
148 | 148 | echo $new_row_cells_content; |
149 | 149 | echo '</tr>'; |
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | ?> |
153 | 153 | <td class="tckt-slctr-tbl-td-name"> |
154 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
155 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
156 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
157 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
154 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
155 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
156 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
157 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
158 | 158 | </a> |
159 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
160 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
159 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
160 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
161 | 161 | </a> |
162 | 162 | <?php endif; //end show details check ?> |
163 | - <?php if ( $ticket->required() ) { ?> |
|
164 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
163 | + <?php if ($ticket->required()) { ?> |
|
164 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
165 | 165 | <?php } ?> |
166 | 166 | <?php |
167 | 167 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -177,16 +177,16 @@ discard block |
||
177 | 177 | </td> |
178 | 178 | <?php |
179 | 179 | if ( |
180 | - apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) |
|
180 | + apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE) |
|
181 | 181 | ) { ?> |
182 | 182 | <td class="tckt-slctr-tbl-td-price jst-rght"><?php |
183 | - echo EEH_Template::format_currency( $ticket_price ); |
|
183 | + echo EEH_Template::format_currency($ticket_price); |
|
184 | 184 | echo $ticket->taxable() ? '<span class="taxable-tickets-asterisk grey-text">*</span>' : ''; |
185 | 185 | ?> <span class="smaller-text no-bold"><?php |
186 | - if ( $ticket_bundle ) { |
|
187 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
186 | + if ($ticket_bundle) { |
|
187 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
188 | 188 | } else { |
189 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
189 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
190 | 190 | }?></span> </td> |
191 | 191 | <?php $cols++; ?> |
192 | 192 | <?php } ?> |
@@ -194,28 +194,28 @@ discard block |
||
194 | 194 | <?php |
195 | 195 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
196 | 196 | $ticket_status_display = ''; |
197 | - if ( $max_atndz === 0 ) { |
|
197 | + if ($max_atndz === 0) { |
|
198 | 198 | // registration is CLOSED because admin set max attendees to ZERO |
199 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
199 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
200 | 200 | 'FHEE__ticket_selector_chart_template__ticket_closed_msg', |
201 | - __( 'Closed', 'event_espresso' ) |
|
202 | - ) . '</span>'; |
|
203 | - } else if ( $tkt_status === EE_Ticket::sold_out || $remaining === 0 ) { |
|
201 | + __('Closed', 'event_espresso') |
|
202 | + ).'</span>'; |
|
203 | + } else if ($tkt_status === EE_Ticket::sold_out || $remaining === 0) { |
|
204 | 204 | // SOLD OUT - no tickets remaining |
205 | - $ticket_status_display = '<span class="sold-out">' . apply_filters( |
|
205 | + $ticket_status_display = '<span class="sold-out">'.apply_filters( |
|
206 | 206 | 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', |
207 | - __( 'Sold Out', 'event_espresso' ) |
|
208 | - ) . '</span>'; |
|
209 | - } else if ( $tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived ) { |
|
207 | + __('Sold Out', 'event_espresso') |
|
208 | + ).'</span>'; |
|
209 | + } else if ($tkt_status === EE_Ticket::expired || $tkt_status === EE_Ticket::archived) { |
|
210 | 210 | // expired or archived ticket |
211 | 211 | $ticket_status_display = $ticket_status; |
212 | - } else if ( $tkt_status === EE_Ticket::pending ) { |
|
212 | + } else if ($tkt_status === EE_Ticket::pending) { |
|
213 | 213 | // ticket not on sale yet |
214 | 214 | $ticket_status_display = '<span class="ticket-pending-pg"> |
215 | 215 | <span class="ticket-pending">' |
216 | 216 | . apply_filters( |
217 | 217 | 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', |
218 | - __( 'Goes On Sale', 'event_espresso' ) |
|
218 | + __('Goes On Sale', 'event_espresso') |
|
219 | 219 | ) |
220 | 220 | . '</span><br/> |
221 | 221 | <span class="small-text">' |
@@ -228,36 +228,36 @@ discard block |
||
228 | 228 | ) |
229 | 229 | . '</span> |
230 | 230 | </span>'; |
231 | - } else if ( $ticket->min() > $remaining ) { |
|
231 | + } else if ($ticket->min() > $remaining) { |
|
232 | 232 | // min qty purchasable is less than tickets available |
233 | 233 | $ticket_status_display = ' |
234 | 234 | <div class="archived-ticket-pg"> |
235 | 235 | <span class="archived-ticket small-text">' |
236 | - . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )) |
|
236 | + . apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')) |
|
237 | 237 | . '</span><br/> |
238 | 238 | </div>'; |
239 | - } else if ( $max_atndz === 1 ) { |
|
239 | + } else if ($max_atndz === 1) { |
|
240 | 240 | // only ONE attendee is allowed to register at a time |
241 | 241 | // display submit button since we have tickets available |
242 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
242 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
243 | 243 | ?> |
244 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
244 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row === 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
245 | 245 | <?php |
246 | 246 | $hidden_input_qty = FALSE; |
247 | 247 | |
248 | - } else if ( $max > 0 ) { |
|
248 | + } else if ($max > 0) { |
|
249 | 249 | // display submit button since we have tickets available |
250 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
250 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
251 | 251 | ?> |
252 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
252 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
253 | 253 | <?php |
254 | 254 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
255 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
255 | + if ( ! $ticket->required() && $min !== 0) { |
|
256 | 256 | ?> |
257 | 257 | <option value="0"> 0 </option> |
258 | 258 | <?php } |
259 | 259 | // offer ticket quantities from the min to the max |
260 | - for ( $i = $min; $i <= $max; $i++) { |
|
260 | + for ($i = $min; $i <= $max; $i++) { |
|
261 | 261 | ?> |
262 | 262 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
263 | 263 | <?php } ?> |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | echo $ticket_status_display; |
270 | 270 | // depending on group reg we need to change the format for qty |
271 | - if ( $hidden_input_qty ) { |
|
271 | + if ($hidden_input_qty) { |
|
272 | 272 | ?> |
273 | 273 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
274 | 274 | <?php |
@@ -278,33 +278,33 @@ discard block |
||
278 | 278 | |
279 | 279 | </td> |
280 | 280 | </tr> |
281 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
282 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
281 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
282 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
283 | 283 | <td class="tckt-slctr-tkt-details-td" colspan="<?php echo $cols; ?>" > |
284 | 284 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
285 | 285 | |
286 | 286 | <section class="tckt-slctr-tkt-details-sctn"> |
287 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
287 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
288 | 288 | <p><?php echo $ticket->description(); ?></p> |
289 | 289 | |
290 | - <?php if ( $ticket_price !== 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
290 | + <?php if ($ticket_price !== 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
291 | 291 | <section class="tckt-slctr-tkt-price-sctn"> |
292 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
292 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
293 | 293 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
294 | 294 | <table class="tckt-slctr-tkt-details-tbl"> |
295 | 295 | <thead> |
296 | 296 | <tr> |
297 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
298 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
299 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
297 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
298 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
299 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
300 | 300 | </tr> |
301 | 301 | </thead> |
302 | 302 | <tbody> |
303 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
303 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
304 | 304 | <tr> |
305 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
306 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
307 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
305 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
306 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
307 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
308 | 308 | </tr> |
309 | 309 | <?php |
310 | 310 | $running_total = $ticket->base_price()->amount(); |
@@ -312,44 +312,44 @@ discard block |
||
312 | 312 | $running_total = 0; |
313 | 313 | } |
314 | 314 | // now add price modifiers |
315 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
315 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
316 | 316 | <tr> |
317 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
318 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
319 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
317 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
318 | + <?php if ($price_mod->is_percent()) { ?> |
|
319 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
320 | 320 | <?php |
321 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
321 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
322 | 322 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
323 | 323 | ?> |
324 | 324 | <?php } else { ?> |
325 | 325 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
326 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
326 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
327 | 327 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
328 | 328 | <?php } ?> |
329 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
329 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
330 | 330 | <?php $running_total += $new_sub_total; ?> |
331 | 331 | </tr> |
332 | 332 | <?php } ?> |
333 | - <?php if ( $ticket->taxable() ) { ?> |
|
333 | + <?php if ($ticket->taxable()) { ?> |
|
334 | 334 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
335 | 335 | <tr> |
336 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
337 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
336 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
337 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
338 | 338 | </tr> |
339 | 339 | |
340 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
340 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
341 | 341 | <tr> |
342 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
343 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
344 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
345 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
342 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
343 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
344 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
345 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
346 | 346 | <?php $running_total += $tax_amount; ?> |
347 | 347 | </tr> |
348 | 348 | <?php } ?> |
349 | 349 | <?php } ?> |
350 | 350 | <tr> |
351 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
352 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
351 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
352 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
353 | 353 | </tr> |
354 | 354 | </tbody> |
355 | 355 | </table> |
@@ -359,106 +359,106 @@ discard block |
||
359 | 359 | <?php } ?> |
360 | 360 | |
361 | 361 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
362 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
363 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
364 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
365 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
362 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
363 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
364 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
365 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
366 | 366 | </section> |
367 | 367 | <br/> |
368 | 368 | |
369 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
369 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
370 | 370 | |
371 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
371 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
372 | 372 | <section class="tckt-slctr-tkt-quantities-sctn"> |
373 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
374 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
375 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
376 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
373 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
374 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
375 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
376 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
377 | 377 | <?php //$max = min( $max, $max_atndz );?> |
378 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
378 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
379 | 379 | </section> |
380 | 380 | <br/> |
381 | 381 | <?php } ?> |
382 | 382 | |
383 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
383 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
384 | 384 | <section class="tckt-slctr-tkt-uses-sctn"> |
385 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
385 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
386 | 386 | <span class="drk-grey-text small-text no-bold"> - <?php |
387 | 387 | echo apply_filters( |
388 | 388 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
389 | 389 | sprintf( |
390 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
390 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
391 | 391 | '<br/>', |
392 | 392 | '<strong>', |
393 | 393 | '</strong>' |
394 | 394 | ) |
395 | 395 | ); |
396 | 396 | ?></span><br/> |
397 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
397 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
398 | 398 | </section> |
399 | 399 | <?php } ?> |
400 | 400 | |
401 | 401 | <?php |
402 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
402 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
403 | 403 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
404 | - if ( ! empty( $datetimes )) { ?> |
|
404 | + if ( ! empty($datetimes)) { ?> |
|
405 | 405 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
406 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
407 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
406 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
407 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
408 | 408 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
409 | 409 | <table class="tckt-slctr-tkt-details-tbl"> |
410 | 410 | <thead> |
411 | 411 | <tr> |
412 | 412 | <th class="tckt-slctr-tkt-details-date-th"> |
413 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
413 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
414 | 414 | </th> |
415 | 415 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
416 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
416 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
417 | 417 | </th> |
418 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
418 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
419 | 419 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
420 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
420 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
421 | 421 | </th> |
422 | 422 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
423 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
423 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
424 | 424 | </th> |
425 | 425 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
426 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
426 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
427 | 427 | </th> |
428 | 428 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
429 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
429 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
430 | 430 | </th> |
431 | 431 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
432 | 432 | </tr> |
433 | 433 | </thead> |
434 | 434 | <tbody> |
435 | 435 | <?php |
436 | - foreach ( $datetimes as $datetime ) { |
|
437 | - if ( $datetime instanceof EE_Datetime ) { |
|
436 | + foreach ($datetimes as $datetime) { |
|
437 | + if ($datetime instanceof EE_Datetime) { |
|
438 | 438 | ?> |
439 | 439 | |
440 | 440 | <tr> |
441 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
441 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
442 | 442 | <?php $datetime_name = $datetime->name(); ?> |
443 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
444 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
443 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
444 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
445 | 445 | </td> |
446 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
447 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
446 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
447 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
448 | 448 | </td> |
449 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
450 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
449 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
450 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
451 | 451 | <?php echo $ticket->sold(); ?> |
452 | 452 | </td> |
453 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
454 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
453 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
454 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
455 | 455 | </td> |
456 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
456 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
457 | 457 | <?php echo $datetime->sold(); ?> |
458 | 458 | </td> |
459 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
460 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
461 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
459 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
460 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
461 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
462 | 462 | </td> |
463 | 463 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
464 | 464 | </tr> |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | </div> |
477 | 477 | </td> |
478 | 478 | </tr> |
479 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
479 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
480 | 480 | <?php |
481 | 481 | $row++; |
482 | 482 | } |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | $ticket_row_html = ob_get_clean(); |
486 | 486 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
487 | 487 | $hide_ticket_selector = $ticket_count === 1 && $max_atndz === 1 && $ticket->is_free() ? true : false; |
488 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
489 | -remove_all_filters( 'FHEE__EE_Ticket_Selector__hide_ticket_selector' ); |
|
488 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
489 | +remove_all_filters('FHEE__EE_Ticket_Selector__hide_ticket_selector'); |
|
490 | 490 | // EEH_Debug_Tools::printr( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ), 'display submit', __FILE__, __LINE__ ); |
491 | 491 | // EEH_Debug_Tools::printr( (string) $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
492 | 492 | // EEH_Debug_Tools::printr( (string) $max, '$max', __FILE__, __LINE__ ); |
@@ -500,20 +500,20 @@ discard block |
||
500 | 500 | * @param string '#tkt-slctr-tbl-' . $EVT_ID The html ID to anchor to |
501 | 501 | * @param int $EVT_ID The Event ID |
502 | 502 | */ |
503 | -$anchor_id = apply_filters( 'FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-' . $EVT_ID, $EVT_ID ); |
|
504 | -if ( ! $hide_ticket_selector ) { |
|
503 | +$anchor_id = apply_filters('FHEE__EE_Ticket_Selector__redirect_anchor_id', '#tkt-slctr-tbl-'.$EVT_ID, $EVT_ID); |
|
504 | +if ( ! $hide_ticket_selector) { |
|
505 | 505 | ?> |
506 | 506 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
507 | 507 | |
508 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
508 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
509 | 509 | |
510 | 510 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
511 | 511 | <thead> |
512 | 512 | <tr> |
513 | 513 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
514 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
514 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
515 | 515 | </th> |
516 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE ) ) { ?> |
|
516 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
517 | 517 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
518 | 518 | <?php |
519 | 519 | /** |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * @param string 'Price' The translatable text to display in the table header for price |
525 | 525 | * @param int $EVT_ID The Event ID |
526 | 526 | */ |
527 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
527 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
528 | 528 | ?> |
529 | 529 | </th> |
530 | 530 | <?php } ?> |
@@ -538,77 +538,77 @@ discard block |
||
538 | 538 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
539 | 539 | * @param int $EVT_ID The Event ID |
540 | 540 | */ |
541 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
541 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
542 | 542 | ?> |
543 | 543 | </th> |
544 | 544 | </tr> |
545 | 545 | </thead> |
546 | 546 | <tbody> |
547 | - <?php echo $ticket_row_html;?> |
|
547 | + <?php echo $ticket_row_html; ?> |
|
548 | 548 | </tbody> |
549 | 549 | </table> |
550 | 550 | <?php |
551 | - if ( $taxable_tickets && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', true ) ) { |
|
552 | - if ( $tax_settings->prices_displayed_including_taxes ) { |
|
553 | - $ticket_price_includes_taxes = __( '* price includes taxes', 'event_espresso' ); |
|
551 | + if ($taxable_tickets && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', true)) { |
|
552 | + if ($tax_settings->prices_displayed_including_taxes) { |
|
553 | + $ticket_price_includes_taxes = __('* price includes taxes', 'event_espresso'); |
|
554 | 554 | } else { |
555 | - $ticket_price_includes_taxes = __( '* price does not include taxes', 'event_espresso' ); |
|
555 | + $ticket_price_includes_taxes = __('* price does not include taxes', 'event_espresso'); |
|
556 | 556 | } |
557 | - echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">' . $ticket_price_includes_taxes . '</p>'; |
|
557 | + echo '<p class="small-text lt-grey-text" style="text-align:right; margin: -1em 0 1em;">'.$ticket_price_includes_taxes.'</p>'; |
|
558 | 558 | } |
559 | 559 | ?> |
560 | 560 | |
561 | 561 | <input type="hidden" name="noheader" value="true" /> |
562 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>" /> |
|
562 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>" /> |
|
563 | 563 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
564 | 564 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
565 | 565 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
566 | 566 | |
567 | 567 | <?php |
568 | -if ( $max_atndz > 0 ) { |
|
568 | +if ($max_atndz > 0) { |
|
569 | 569 | echo apply_filters( |
570 | 570 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
571 | 571 | '' |
572 | 572 | ); |
573 | 573 | } |
574 | -if ( ! apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false ) ) { |
|
575 | - add_filter( 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true' ); |
|
574 | +if ( ! apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', false)) { |
|
575 | + add_filter('FHEE__EE_Ticket_Selector__no_ticket_selector_submit', '__return_true'); |
|
576 | 576 | } |
577 | -do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
577 | +do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
578 | 578 | ?> |
579 | 579 | |
580 | 580 | <?php |
581 | -} else if ( isset( $TKT_ID ) ) { |
|
582 | - add_filter( 'FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true' ); |
|
581 | +} else if (isset($TKT_ID)) { |
|
582 | + add_filter('FHEE__EE_Ticket_Selector__hide_ticket_selector', '__return_true'); |
|
583 | 583 | ?> |
584 | 584 | |
585 | 585 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
586 | 586 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
587 | 587 | <input type="hidden" name="noheader" value="true"/> |
588 | -<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url() . $anchor_id; ?>"/> |
|
588 | +<input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url().$anchor_id; ?>"/> |
|
589 | 589 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>"/> |
590 | 590 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
591 | 591 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
592 | 592 | <?php |
593 | - if ( $ticket instanceof EE_Ticket ) { |
|
594 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
593 | + if ($ticket instanceof EE_Ticket) { |
|
594 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
595 | 595 | $ticket_description = $ticket->description(); |
596 | - $ticket_description .= ! empty( $ticket_description ) |
|
597 | - ? '<br />' . $ticket_status_display |
|
596 | + $ticket_description .= ! empty($ticket_description) |
|
597 | + ? '<br />'.$ticket_status_display |
|
598 | 598 | : $ticket_status_display; |
599 | - if ( ! strpos( $ticket_description, '<div' ) ) { |
|
599 | + if ( ! strpos($ticket_description, '<div')) { |
|
600 | 600 | $ticket_description = "<p>{$ticket_description}</p>"; |
601 | 601 | } |
602 | 602 | ?> |
603 | 603 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
604 | 604 | <div class="no-tkt-slctr-ticket-content-dv"> |
605 | 605 | <h5><?php echo $ticket->name(); ?></h5> |
606 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
606 | + <?php if ( ! empty($ticket_description)) { ?> |
|
607 | 607 | <?php echo $ticket_description; ?> |
608 | 608 | <?php } ?> |
609 | 609 | </div> |
610 | 610 | <?php |
611 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
611 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
612 | 612 | } |
613 | 613 | } |
614 | 614 | ?> |
@@ -277,17 +277,17 @@ |
||
277 | 277 | //if we know who the attendee is, and this is a billing form |
278 | 278 | //that uses attendee info, populate it |
279 | 279 | if ( |
280 | - apply_filters( |
|
281 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | - ( |
|
283 | - $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | - && $transaction instanceof EE_Transaction |
|
285 | - && $transaction->primary_registration() instanceof EE_Registration |
|
286 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | - ), |
|
288 | - $this->_billing_form, |
|
289 | - $transaction |
|
290 | - ) |
|
280 | + apply_filters( |
|
281 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
282 | + ( |
|
283 | + $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
284 | + && $transaction instanceof EE_Transaction |
|
285 | + && $transaction->primary_registration() instanceof EE_Registration |
|
286 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
287 | + ), |
|
288 | + $this->_billing_form, |
|
289 | + $transaction |
|
290 | + ) |
|
291 | 291 | ){ |
292 | 292 | $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
293 | 293 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @return EED_Add_New_State |
17 | 17 | */ |
18 | 18 | public static function instance() { |
19 | - return parent::get_instance( __CLASS__ ); |
|
19 | + return parent::get_instance(__CLASS__); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | * @return void |
28 | 28 | */ |
29 | 29 | public static function set_hooks() { |
30 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
31 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'translate_js_strings' ), 0 ); |
|
32 | - add_action( 'wp_enqueue_scripts', array( 'EED_Add_New_State', 'wp_enqueue_scripts' ), 10 ); |
|
33 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
34 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
35 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
36 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
37 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
38 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
39 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
30 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
31 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'translate_js_strings'), 0); |
|
32 | + add_action('wp_enqueue_scripts', array('EED_Add_New_State', 'wp_enqueue_scripts'), 10); |
|
33 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
34 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
35 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
36 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
37 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
38 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
39 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -46,20 +46,20 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | public static function set_hooks_admin() { |
49 | - add_action( 'wp_loaded', array( 'EED_Add_New_State', 'set_definitions' ), 2 ); |
|
50 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
51 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array( 'EED_Add_New_State', 'display_add_new_state_micro_form' ), 1, 1 ); |
|
52 | - add_action( 'wp_ajax_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
53 | - add_action( 'wp_ajax_nopriv_espresso_add_new_state', array( 'EED_Add_New_State', 'add_new_state' )); |
|
54 | - add_filter( 'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array( 'EED_Add_New_State', 'unset_new_state_request_params' ), 10, 1 ); |
|
55 | - add_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
56 | - add_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array( 'EED_Add_New_State', 'update_country_settings' ), 10, 3 ); |
|
57 | - add_filter( 'FHEE__EE_State_Select_Input____construct__state_options', array( 'EED_Add_New_State', 'state_options' ), 10, 1 ); |
|
58 | - add_filter( 'FHEE__EE_Country_Select_Input____construct__country_options', array( 'EED_Add_New_State', 'country_options' ), 10, 1 ); |
|
49 | + add_action('wp_loaded', array('EED_Add_New_State', 'set_definitions'), 2); |
|
50 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
51 | + add_filter('FHEE__EE_SPCO_Reg_Step_Payment_Options___get_billing_form_for_payment_method__billing_form', array('EED_Add_New_State', 'display_add_new_state_micro_form'), 1, 1); |
|
52 | + add_action('wp_ajax_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
53 | + add_action('wp_ajax_nopriv_espresso_add_new_state', array('EED_Add_New_State', 'add_new_state')); |
|
54 | + add_filter('FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item', array('EED_Add_New_State', 'unset_new_state_request_params'), 10, 1); |
|
55 | + add_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
56 | + add_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', array('EED_Add_New_State', 'update_country_settings'), 10, 3); |
|
57 | + add_filter('FHEE__EE_State_Select_Input____construct__state_options', array('EED_Add_New_State', 'state_options'), 10, 1); |
|
58 | + add_filter('FHEE__EE_Country_Select_Input____construct__country_options', array('EED_Add_New_State', 'country_options'), 10, 1); |
|
59 | 59 | //add_filter( 'FHEE__Single_Page_Checkout___check_form_submission__request_params', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
60 | - add_filter( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', array( 'EED_Add_New_State', 'filter_checkout_request_params' ), 10, 1 ); |
|
61 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array( 'EED_Add_New_State', 'inject_new_reg_state_into_options' ), 10, 5 ); |
|
62 | - add_filter( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array( 'EED_Add_New_State', 'inject_new_reg_country_into_options' ), 10, 5 ); |
|
60 | + add_filter('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', array('EED_Add_New_State', 'filter_checkout_request_params'), 10, 1); |
|
61 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__state_options', array('EED_Add_New_State', 'inject_new_reg_state_into_options'), 10, 5); |
|
62 | + add_filter('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__country_options', array('EED_Add_New_State', 'inject_new_reg_country_into_options'), 10, 5); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @return void |
72 | 72 | */ |
73 | 73 | public static function set_definitions() { |
74 | - define( 'ANS_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
75 | - define( 'ANS_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
74 | + define('ANS_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
75 | + define('ANS_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @param \WP $WP |
85 | 85 | * @return void |
86 | 86 | */ |
87 | - public function run( $WP ) { |
|
87 | + public function run($WP) { |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | |
@@ -112,9 +112,9 @@ discard block |
||
112 | 112 | * @return void |
113 | 113 | */ |
114 | 114 | public static function wp_enqueue_scripts() { |
115 | - if ( apply_filters( 'EED_Single_Page_Checkout__SPCO_active', false ) ) { |
|
116 | - wp_register_script( 'add_new_state', ANS_ASSETS_URL . 'add_new_state.js', array( 'espresso_core', 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, true ); |
|
117 | - wp_enqueue_script( 'add_new_state' ); |
|
115 | + if (apply_filters('EED_Single_Page_Checkout__SPCO_active', false)) { |
|
116 | + wp_register_script('add_new_state', ANS_ASSETS_URL.'add_new_state.js', array('espresso_core', 'single_page_checkout'), EVENT_ESPRESSO_VERSION, true); |
|
117 | + wp_enqueue_script('add_new_state'); |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -128,34 +128,34 @@ discard block |
||
128 | 128 | * @return string |
129 | 129 | */ |
130 | 130 | // public static function display_add_new_state_micro_form( $html, EE_Form_Input_With_Options_Base $input ){ |
131 | - public static function display_add_new_state_micro_form( EE_Form_Section_Proper $question_group_reg_form ){ |
|
131 | + public static function display_add_new_state_micro_form(EE_Form_Section_Proper $question_group_reg_form) { |
|
132 | 132 | // only add the 'new_state_micro_form' when displaying reg forms, |
133 | 133 | // not during processing since we process the 'new_state_micro_form' in it's own AJAX request |
134 | - $action = EE_Registry::instance()->REQ->get( 'action', '' ); |
|
134 | + $action = EE_Registry::instance()->REQ->get('action', ''); |
|
135 | 135 | // is the "state" question in this form section? |
136 | - $input = $question_group_reg_form->get_subsection( 'state' ); |
|
137 | - if ( $action === 'process_reg_step' || $action === 'update_reg_step' ) { |
|
136 | + $input = $question_group_reg_form->get_subsection('state'); |
|
137 | + if ($action === 'process_reg_step' || $action === 'update_reg_step') { |
|
138 | 138 | //ok then all we need to do is make sure the input's HTML name is consistent |
139 | 139 | //by forcing it to set it now, like it did while getting the form for display |
140 | - if( $input instanceof EE_State_Select_Input ) { |
|
140 | + if ($input instanceof EE_State_Select_Input) { |
|
141 | 141 | $input->html_name(); |
142 | 142 | } |
143 | 143 | return $question_group_reg_form; |
144 | 144 | } |
145 | 145 | |
146 | 146 | // we're only doing this for state select inputs |
147 | - if ( $input instanceof EE_State_Select_Input ) { |
|
147 | + if ($input instanceof EE_State_Select_Input) { |
|
148 | 148 | // grab any set values from the request |
149 | - $country_name = str_replace( 'state', 'nsmf_new_state_country', $input->html_name() ); |
|
150 | - $state_name = str_replace( 'state', 'nsmf_new_state_name', $input->html_name() ); |
|
151 | - $abbrv_name = str_replace( 'state', 'nsmf_new_state_abbrv', $input->html_name() ); |
|
152 | - $new_state_submit_id = str_replace( 'state', 'new_state', $input->html_id() ); |
|
149 | + $country_name = str_replace('state', 'nsmf_new_state_country', $input->html_name()); |
|
150 | + $state_name = str_replace('state', 'nsmf_new_state_name', $input->html_name()); |
|
151 | + $abbrv_name = str_replace('state', 'nsmf_new_state_abbrv', $input->html_name()); |
|
152 | + $new_state_submit_id = str_replace('state', 'new_state', $input->html_id()); |
|
153 | 153 | $country_options = array(); |
154 | 154 | $countries = EEM_Country::instance()->get_all_countries(); |
155 | - if ( ! empty( $countries )) { |
|
156 | - foreach( $countries as $country ){ |
|
157 | - if ( $country instanceof EE_Country ) { |
|
158 | - $country_options[ $country->ID() ] = $country->name(); |
|
155 | + if ( ! empty($countries)) { |
|
156 | + foreach ($countries as $country) { |
|
157 | + if ($country instanceof EE_Country) { |
|
158 | + $country_options[$country->ID()] = $country->name(); |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | // add hidden input to indicate that a new state is being added |
169 | 169 | 'add_new_state' => new EE_Hidden_Input( |
170 | 170 | array( |
171 | - 'html_name' => str_replace( 'state', 'nsmf_add_new_state', $input->html_name() ), |
|
172 | - 'html_id' => str_replace( 'state', 'nsmf_add_new_state', $input->html_id() ), |
|
171 | + 'html_name' => str_replace('state', 'nsmf_add_new_state', $input->html_name()), |
|
172 | + 'html_id' => str_replace('state', 'nsmf_add_new_state', $input->html_id()), |
|
173 | 173 | 'default' => 0 |
174 | 174 | ) |
175 | 175 | ), |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | '', |
182 | 182 | __('click here to add a new state/province', 'event_espresso'), |
183 | 183 | '', |
184 | - 'display-' . $input->html_id(), |
|
184 | + 'display-'.$input->html_id(), |
|
185 | 185 | 'ee-form-add-new-state-lnk display-the-hidden smaller-text hide-if-no-js', |
186 | 186 | '', |
187 | - 'data-target="' . $input->html_id() . '"' |
|
187 | + 'data-target="'.$input->html_id().'"' |
|
188 | 188 | ) |
189 | 189 | ) |
190 | 190 | ), |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | 'add_new_state_micro_form' =>new EE_Form_Section_HTML( |
193 | 193 | apply_filters( |
194 | 194 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_micro_form', |
195 | - EEH_HTML::div( '', $input->html_id() . '-dv', 'ee-form-add-new-state-dv', 'display: none;' ) . |
|
196 | - EEH_HTML::h6( __('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')) . |
|
197 | - EEH_HTML::ul() . |
|
198 | - EEH_HTML::li( __('first select the Country that your State/Province belongs to', 'event_espresso') ) . |
|
199 | - EEH_HTML::li( __('enter the name of your State/Province', 'event_espresso') ) . |
|
200 | - EEH_HTML::li( __('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso') ) . |
|
201 | - EEH_HTML::li( __('click the ADD button', 'event_espresso') ) . |
|
195 | + EEH_HTML::div('', $input->html_id().'-dv', 'ee-form-add-new-state-dv', 'display: none;'). |
|
196 | + EEH_HTML::h6(__('If your State/Province does not appear in the list above, you can easily add it by doing the following:', 'event_espresso')). |
|
197 | + EEH_HTML::ul(). |
|
198 | + EEH_HTML::li(__('first select the Country that your State/Province belongs to', 'event_espresso')). |
|
199 | + EEH_HTML::li(__('enter the name of your State/Province', 'event_espresso')). |
|
200 | + EEH_HTML::li(__('enter a two to six letter abbreviation for the name of your State/Province', 'event_espresso')). |
|
201 | + EEH_HTML::li(__('click the ADD button', 'event_espresso')). |
|
202 | 202 | EEH_HTML::ulx() |
203 | 203 | ) |
204 | 204 | ), |
@@ -207,10 +207,10 @@ discard block |
||
207 | 207 | $country_options, |
208 | 208 | array( |
209 | 209 | 'html_name' => $country_name, |
210 | - 'html_id' => str_replace( 'state', 'nsmf_new_state_country', $input->html_id() ), |
|
211 | - 'html_class' => $input->html_class() . ' new-state-country', |
|
210 | + 'html_id' => str_replace('state', 'nsmf_new_state_country', $input->html_id()), |
|
211 | + 'html_class' => $input->html_class().' new-state-country', |
|
212 | 212 | 'html_label_text' => __('New State/Province Country', 'event_espresso'), |
213 | - 'default' => EE_Registry::instance()->REQ->get( $country_name, '' ), |
|
213 | + 'default' => EE_Registry::instance()->REQ->get($country_name, ''), |
|
214 | 214 | 'required' => false |
215 | 215 | ) |
216 | 216 | ), |
@@ -218,23 +218,23 @@ discard block |
||
218 | 218 | 'new_state_name' => new EE_Text_Input( |
219 | 219 | array( |
220 | 220 | 'html_name' => $state_name, |
221 | - 'html_id' => str_replace( 'state', 'nsmf_new_state_name', $input->html_id() ), |
|
222 | - 'html_class' => $input->html_class() . ' new-state-state', |
|
221 | + 'html_id' => str_replace('state', 'nsmf_new_state_name', $input->html_id()), |
|
222 | + 'html_class' => $input->html_class().' new-state-state', |
|
223 | 223 | 'html_label_text' => __('New State/Province Name', 'event_espresso'), |
224 | - 'default' => EE_Registry::instance()->REQ->get( $state_name, '' ), |
|
224 | + 'default' => EE_Registry::instance()->REQ->get($state_name, ''), |
|
225 | 225 | 'required' => false |
226 | 226 | ) |
227 | 227 | ), |
228 | - 'spacer' => new EE_Form_Section_HTML( EEH_HTML::br() ), |
|
228 | + 'spacer' => new EE_Form_Section_HTML(EEH_HTML::br()), |
|
229 | 229 | // NEW STATE NAME |
230 | 230 | 'new_state_abbrv' => new EE_Text_Input( |
231 | 231 | array( |
232 | 232 | 'html_name' => $abbrv_name, |
233 | - 'html_id' => str_replace( 'state', 'nsmf_new_state_abbrv', $input->html_id() ), |
|
234 | - 'html_class' => $input->html_class() . ' new-state-abbrv', |
|
233 | + 'html_id' => str_replace('state', 'nsmf_new_state_abbrv', $input->html_id()), |
|
234 | + 'html_class' => $input->html_class().' new-state-abbrv', |
|
235 | 235 | 'html_label_text' => __('New State/Province Abbreviation', 'event_espresso'), |
236 | 236 | 'html_other_attributes' => 'size="24"', |
237 | - 'default' => EE_Registry::instance()->REQ->get( $abbrv_name, '' ), |
|
237 | + 'default' => EE_Registry::instance()->REQ->get($abbrv_name, ''), |
|
238 | 238 | 'required' => false |
239 | 239 | ) |
240 | 240 | ), |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | 'add_new_state_submit_button' => new EE_Form_Section_HTML( |
243 | 243 | apply_filters( |
244 | 244 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_submit_button', |
245 | - EEH_HTML::nbsp(3) . |
|
245 | + EEH_HTML::nbsp(3). |
|
246 | 246 | EEH_HTML::link( |
247 | 247 | '', |
248 | 248 | __('ADD', 'event_espresso'), |
249 | 249 | '', |
250 | - 'submit-' . $new_state_submit_id, |
|
250 | + 'submit-'.$new_state_submit_id, |
|
251 | 251 | 'ee-form-add-new-state-submit button button-secondary', |
252 | 252 | '', |
253 | - 'data-target="' . $new_state_submit_id . '"' |
|
253 | + 'data-target="'.$new_state_submit_id.'"' |
|
254 | 254 | ) |
255 | 255 | ) |
256 | 256 | ), |
@@ -258,18 +258,18 @@ discard block |
||
258 | 258 | 'add_new_state_extra' => new EE_Form_Section_HTML( |
259 | 259 | apply_filters( |
260 | 260 | 'FHEE__EED_Add_New_State__display_add_new_state_micro_form__add_new_state_extra', |
261 | - EEH_HTML::br(2) . |
|
262 | - EEH_HTML::div( '', '', 'small-text' ) . |
|
263 | - EEH_HTML::strong( __('Don\'t know your State/Province Abbreviation?', 'event_espresso') ) . |
|
264 | - EEH_HTML::br() . |
|
261 | + EEH_HTML::br(2). |
|
262 | + EEH_HTML::div('', '', 'small-text'). |
|
263 | + EEH_HTML::strong(__('Don\'t know your State/Province Abbreviation?', 'event_espresso')). |
|
264 | + EEH_HTML::br(). |
|
265 | 265 | sprintf( |
266 | 266 | __('You can look here: %s, for a list of Countries and links to their State/Province Abbreviations ("Subdivisions assigned codes" column).', 'event_espresso'), |
267 | - EEH_HTML::link( 'http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk' ) |
|
268 | - ) . |
|
269 | - EEH_HTML::divx() . |
|
270 | - EEH_HTML::br() . |
|
271 | - EEH_HTML::link( '', __('cancel new state/province', 'event_espresso'), '', 'hide-' . $input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'data-target="' . $input->html_id() . '"' ) . |
|
272 | - EEH_HTML::divx() . |
|
267 | + EEH_HTML::link('http://en.wikipedia.org/wiki/ISO_3166-2', 'http://en.wikipedia.org/wiki/ISO_3166-2', '', '', 'ee-form-add-new-state-wiki-lnk') |
|
268 | + ). |
|
269 | + EEH_HTML::divx(). |
|
270 | + EEH_HTML::br(). |
|
271 | + EEH_HTML::link('', __('cancel new state/province', 'event_espresso'), '', 'hide-'.$input->html_id(), 'ee-form-cancel-new-state-lnk smaller-text', '', 'data-target="'.$input->html_id().'"'). |
|
272 | + EEH_HTML::divx(). |
|
273 | 273 | EEH_HTML::br() |
274 | 274 | ) |
275 | 275 | ) |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ) |
278 | 278 | ) |
279 | 279 | ); |
280 | - $question_group_reg_form->add_subsections( array( 'new_state_micro_form' => $new_state_micro_form ), 'state', false ); |
|
280 | + $question_group_reg_form->add_subsections(array('new_state_micro_form' => $new_state_micro_form), 'state', false); |
|
281 | 281 | } |
282 | 282 | return $question_group_reg_form; |
283 | 283 | } |
@@ -295,50 +295,50 @@ discard block |
||
295 | 295 | public static function add_new_state() { |
296 | 296 | $REQ = EE_Registry::instance()->load_core('Request_Handler'); |
297 | 297 | if ( |
298 | - $REQ->is_set( 'nsmf_add_new_state' ) |
|
299 | - && $REQ->get( 'nsmf_add_new_state' ) == 1 |
|
298 | + $REQ->is_set('nsmf_add_new_state') |
|
299 | + && $REQ->get('nsmf_add_new_state') == 1 |
|
300 | 300 | ) { |
301 | 301 | EE_Registry::instance()->load_model('State'); |
302 | 302 | // grab country ISO code, new state name, and new state abbreviation |
303 | - $state_country = $REQ->is_set( 'nsmf_new_state_country' ) |
|
304 | - ? sanitize_text_field( $REQ->get( 'nsmf_new_state_country' ) ) |
|
303 | + $state_country = $REQ->is_set('nsmf_new_state_country') |
|
304 | + ? sanitize_text_field($REQ->get('nsmf_new_state_country')) |
|
305 | 305 | : false; |
306 | - $state_name = $REQ->is_set( 'nsmf_new_state_name' ) |
|
307 | - ? sanitize_text_field( $REQ->get( 'nsmf_new_state_name' ) ) |
|
306 | + $state_name = $REQ->is_set('nsmf_new_state_name') |
|
307 | + ? sanitize_text_field($REQ->get('nsmf_new_state_name')) |
|
308 | 308 | : false; |
309 | - $state_abbr = $REQ->is_set( 'nsmf_new_state_abbrv' ) |
|
310 | - ? sanitize_text_field( $REQ->get( 'nsmf_new_state_abbrv' ) ) |
|
309 | + $state_abbr = $REQ->is_set('nsmf_new_state_abbrv') |
|
310 | + ? sanitize_text_field($REQ->get('nsmf_new_state_abbrv')) |
|
311 | 311 | : false; |
312 | 312 | //echo '<h4>$state_country : ' . $state_country . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
313 | 313 | //echo '<h4>$state_name : ' . $state_name . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
314 | 314 | //echo '<h4>$state_abbr : ' . $state_abbr . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>'; |
315 | 315 | |
316 | - if ( $state_country && $state_name && $state_abbr ) { |
|
317 | - $new_state = EED_Add_New_State::save_new_state_to_db( array( |
|
318 | - 'CNT_ISO'=> strtoupper( $state_country ), |
|
319 | - 'STA_abbrev' => strtoupper( $state_abbr ), |
|
320 | - 'STA_name' => ucwords( $state_name ), |
|
316 | + if ($state_country && $state_name && $state_abbr) { |
|
317 | + $new_state = EED_Add_New_State::save_new_state_to_db(array( |
|
318 | + 'CNT_ISO'=> strtoupper($state_country), |
|
319 | + 'STA_abbrev' => strtoupper($state_abbr), |
|
320 | + 'STA_name' => ucwords($state_name), |
|
321 | 321 | 'STA_active' => FALSE |
322 | 322 | )); |
323 | 323 | |
324 | - if ( $new_state instanceof EE_State ) { |
|
324 | + if ($new_state instanceof EE_State) { |
|
325 | 325 | // clean house |
326 | - EE_Registry::instance()->REQ->un_set( 'nsmf_add_new_state' ); |
|
327 | - EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_country' ); |
|
328 | - EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_name' ); |
|
329 | - EE_Registry::instance()->REQ->un_set( 'nsmf_new_state_abbrv' ); |
|
326 | + EE_Registry::instance()->REQ->un_set('nsmf_add_new_state'); |
|
327 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_country'); |
|
328 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_name'); |
|
329 | + EE_Registry::instance()->REQ->un_set('nsmf_new_state_abbrv'); |
|
330 | 330 | |
331 | 331 | // get any existing new states |
332 | 332 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
333 | 333 | 'nsmf_new_states' |
334 | 334 | ); |
335 | - $new_states[ $new_state->ID() ] = $new_state; |
|
335 | + $new_states[$new_state->ID()] = $new_state; |
|
336 | 336 | EE_Registry::instance()->SSN->set_session_data( |
337 | - array( 'nsmf_new_states' => $new_states ) |
|
337 | + array('nsmf_new_states' => $new_states) |
|
338 | 338 | ); |
339 | 339 | |
340 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
341 | - echo json_encode( array( |
|
340 | + if (EE_Registry::instance()->REQ->ajax) { |
|
341 | + echo json_encode(array( |
|
342 | 342 | 'success' => TRUE, |
343 | 343 | 'id' => $new_state->ID(), |
344 | 344 | 'name' => $new_state->name(), |
@@ -353,12 +353,12 @@ discard block |
||
353 | 353 | } |
354 | 354 | |
355 | 355 | } else { |
356 | - $error = __( 'A new State/Province could not be added because invalid or missing data was received.', 'event_espresso' ); |
|
357 | - if ( EE_Registry::instance()->REQ->ajax ) { |
|
358 | - echo json_encode( array( 'error' => $error )); |
|
356 | + $error = __('A new State/Province could not be added because invalid or missing data was received.', 'event_espresso'); |
|
357 | + if (EE_Registry::instance()->REQ->ajax) { |
|
358 | + echo json_encode(array('error' => $error)); |
|
359 | 359 | exit(); |
360 | 360 | } else { |
361 | - EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ ); |
|
361 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | } |
@@ -376,11 +376,11 @@ discard block |
||
376 | 376 | * @param array $request_params |
377 | 377 | * @return array |
378 | 378 | */ |
379 | - public static function filter_checkout_request_params ( $request_params ) { |
|
380 | - foreach ( $request_params as $form_section ) { |
|
381 | - if ( is_array( $form_section )) { |
|
382 | - EED_Add_New_State::unset_new_state_request_params( $form_section ); |
|
383 | - EED_Add_New_State::filter_checkout_request_params( $form_section ); |
|
379 | + public static function filter_checkout_request_params($request_params) { |
|
380 | + foreach ($request_params as $form_section) { |
|
381 | + if (is_array($form_section)) { |
|
382 | + EED_Add_New_State::unset_new_state_request_params($form_section); |
|
383 | + EED_Add_New_State::filter_checkout_request_params($form_section); |
|
384 | 384 | } |
385 | 385 | } |
386 | 386 | return $request_params; |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | * @param array $request_params |
396 | 396 | * @return boolean |
397 | 397 | */ |
398 | - public static function unset_new_state_request_params ( $request_params ) { |
|
399 | - unset( $request_params[ 'new_state_micro_form' ] ); |
|
400 | - unset( $request_params[ 'new_state_micro_add_new_state' ] ); |
|
401 | - unset( $request_params[ 'new_state_micro_new_state_country' ] ); |
|
402 | - unset( $request_params[ 'new_state_micro_new_state_name' ] ); |
|
403 | - unset( $request_params[ 'new_state_micro_new_state_abbrv' ] ); |
|
398 | + public static function unset_new_state_request_params($request_params) { |
|
399 | + unset($request_params['new_state_micro_form']); |
|
400 | + unset($request_params['new_state_micro_add_new_state']); |
|
401 | + unset($request_params['new_state_micro_new_state_country']); |
|
402 | + unset($request_params['new_state_micro_new_state_name']); |
|
403 | + unset($request_params['new_state_micro_new_state_abbrv']); |
|
404 | 404 | return $request_params; |
405 | 405 | } |
406 | 406 | |
@@ -413,25 +413,25 @@ discard block |
||
413 | 413 | * @param array $props_n_values |
414 | 414 | * @return boolean |
415 | 415 | */ |
416 | - public static function save_new_state_to_db ( $props_n_values = array() ) { |
|
416 | + public static function save_new_state_to_db($props_n_values = array()) { |
|
417 | 417 | // EEH_Debug_Tools::printr( $props_n_values, '$props_n_values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
418 | - $existing_state = EEM_State::instance()->get_all( array( $props_n_values, 'limit' => 1 )); |
|
419 | - if ( ! empty( $existing_state )) { |
|
420 | - return array_pop( $existing_state ); |
|
418 | + $existing_state = EEM_State::instance()->get_all(array($props_n_values, 'limit' => 1)); |
|
419 | + if ( ! empty($existing_state)) { |
|
420 | + return array_pop($existing_state); |
|
421 | 421 | } |
422 | - $new_state = EE_State::new_instance( $props_n_values ); |
|
423 | - if ( $new_state instanceof EE_State ) { |
|
422 | + $new_state = EE_State::new_instance($props_n_values); |
|
423 | + if ($new_state instanceof EE_State) { |
|
424 | 424 | // if not non-ajax admin |
425 | - $new_state_key = 'new-state-added-' . $new_state->country_iso() . '-' . $new_state->abbrev(); |
|
425 | + $new_state_key = 'new-state-added-'.$new_state->country_iso().'-'.$new_state->abbrev(); |
|
426 | 426 | $new_state_notice = sprintf( |
427 | - __( 'A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso' ), |
|
428 | - '<b>' . $new_state->name() . '</b>', |
|
429 | - '<b>' . $new_state->abbrev() . '</b>', |
|
430 | - '<b>' . $new_state->country()->name() . '</b>', |
|
431 | - '<a href="' . add_query_arg( array( 'page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso() ), admin_url( 'admin.php' )) . '">' . __( 'Event Espresso - General Settings > Countries Tab', 'event_espresso' ) . '</a>', |
|
427 | + __('A new State named "%1$s (%2$s)" was dynamically added from an Event Espresso form for the Country of "%3$s".%5$sTo verify, edit, and/or delete this new State, please go to the %4$s and update the States / Provinces section.%5$sCheck "Yes" to have this new State added to dropdown select lists in forms.', 'event_espresso'), |
|
428 | + '<b>'.$new_state->name().'</b>', |
|
429 | + '<b>'.$new_state->abbrev().'</b>', |
|
430 | + '<b>'.$new_state->country()->name().'</b>', |
|
431 | + '<a href="'.add_query_arg(array('page' => 'espresso_general_settings', 'action' => 'country_settings', 'country' => $new_state->country_iso()), admin_url('admin.php')).'">'.__('Event Espresso - General Settings > Countries Tab', 'event_espresso').'</a>', |
|
432 | 432 | '<br />' |
433 | 433 | ); |
434 | - EE_Error::add_persistent_admin_notice( $new_state_key, $new_state_notice ); |
|
434 | + EE_Error::add_persistent_admin_notice($new_state_key, $new_state_notice); |
|
435 | 435 | $new_state->save(); |
436 | 436 | EEM_State::instance()->reset_cached_states(); |
437 | 437 | return $new_state; |
@@ -450,22 +450,22 @@ discard block |
||
450 | 450 | * @param array $cols_n_values |
451 | 451 | * @return boolean |
452 | 452 | */ |
453 | - public static function update_country_settings( $CNT_ISO = '', $STA_ID = '', $cols_n_values = array() ) { |
|
454 | - $CNT_ISO = ! empty( $CNT_ISO ) ? $CNT_ISO : FALSE; |
|
455 | - if ( ! $CNT_ISO ) { |
|
456 | - EE_Error::add_error( __( 'An invalid or missing Country ISO Code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
453 | + public static function update_country_settings($CNT_ISO = '', $STA_ID = '', $cols_n_values = array()) { |
|
454 | + $CNT_ISO = ! empty($CNT_ISO) ? $CNT_ISO : FALSE; |
|
455 | + if ( ! $CNT_ISO) { |
|
456 | + EE_Error::add_error(__('An invalid or missing Country ISO Code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
457 | 457 | } |
458 | - $STA_abbrev = is_array( $cols_n_values ) && isset( $cols_n_values['STA_abbrev'] ) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
459 | - if ( ! $STA_abbrev && ! empty( $STA_ID )) { |
|
460 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
461 | - if ( $state instanceof EE_State ) { |
|
458 | + $STA_abbrev = is_array($cols_n_values) && isset($cols_n_values['STA_abbrev']) ? $cols_n_values['STA_abbrev'] : FALSE; |
|
459 | + if ( ! $STA_abbrev && ! empty($STA_ID)) { |
|
460 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
461 | + if ($state instanceof EE_State) { |
|
462 | 462 | $STA_abbrev = $state->abbrev(); |
463 | 463 | } |
464 | 464 | } |
465 | - if ( ! $STA_abbrev ) { |
|
466 | - EE_Error::add_error( __( 'An invalid or missing State Abbreviation was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
465 | + if ( ! $STA_abbrev) { |
|
466 | + EE_Error::add_error(__('An invalid or missing State Abbreviation was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
467 | 467 | } |
468 | - EE_Error::dismiss_persistent_admin_notice( $CNT_ISO . '-' . $STA_abbrev, TRUE, TRUE ); |
|
468 | + EE_Error::dismiss_persistent_admin_notice($CNT_ISO.'-'.$STA_abbrev, TRUE, TRUE); |
|
469 | 469 | } |
470 | 470 | |
471 | 471 | |
@@ -481,19 +481,19 @@ discard block |
||
481 | 481 | * @param $answer |
482 | 482 | * @return bool |
483 | 483 | */ |
484 | - public static function inject_new_reg_state_into_options( $state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
485 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state ) { |
|
484 | + public static function inject_new_reg_state_into_options($state_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
485 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_state) { |
|
486 | 486 | $STA_ID = $answer->value(); |
487 | - if ( ! empty( $STA_ID ) ) { |
|
488 | - $state = EEM_State::instance()->get_one_by_ID( $STA_ID ); |
|
489 | - if ( $state instanceof EE_State ) { |
|
487 | + if ( ! empty($STA_ID)) { |
|
488 | + $state = EEM_State::instance()->get_one_by_ID($STA_ID); |
|
489 | + if ($state instanceof EE_State) { |
|
490 | 490 | $country = $state->country(); |
491 | - if ( $country instanceof EE_Country ) { |
|
492 | - if ( ! isset( $state_options[ $country->name() ] )) { |
|
493 | - $state_options[ $country->name() ] = array(); |
|
491 | + if ($country instanceof EE_Country) { |
|
492 | + if ( ! isset($state_options[$country->name()])) { |
|
493 | + $state_options[$country->name()] = array(); |
|
494 | 494 | } |
495 | - if ( ! isset( $state_options[ $country->name() ][ $STA_ID ] )) { |
|
496 | - $state_options[ $country->name() ][ $STA_ID ] = $state->name(); |
|
495 | + if ( ! isset($state_options[$country->name()][$STA_ID])) { |
|
496 | + $state_options[$country->name()][$STA_ID] = $state->name(); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | } |
@@ -515,14 +515,14 @@ discard block |
||
515 | 515 | * @param $answer |
516 | 516 | * @return bool |
517 | 517 | */ |
518 | - public static function inject_new_reg_country_into_options( $country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer ) { |
|
519 | - if ( $answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country ) { |
|
518 | + public static function inject_new_reg_country_into_options($country_options = array(), EE_SPCO_Reg_Step_Attendee_Information $reg_step, EE_Registration $registration, EE_Question $question, $answer) { |
|
519 | + if ($answer instanceof EE_Answer && $question instanceof EE_Question && $question->type() === EEM_Question::QST_type_country) { |
|
520 | 520 | $CNT_ISO = $answer->value(); |
521 | - if ( ! empty( $CNT_ISO ) ) { |
|
522 | - $country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO ); |
|
523 | - if ( $country instanceof EE_Country ) { |
|
524 | - if ( ! isset( $country_options[ $CNT_ISO ] ) ) { |
|
525 | - $country_options[ $CNT_ISO ] = $country->name(); |
|
521 | + if ( ! empty($CNT_ISO)) { |
|
522 | + $country = EEM_Country::instance()->get_one_by_ID($CNT_ISO); |
|
523 | + if ($country instanceof EE_Country) { |
|
524 | + if ( ! isset($country_options[$CNT_ISO])) { |
|
525 | + $country_options[$CNT_ISO] = $country->name(); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | } |
@@ -539,14 +539,14 @@ discard block |
||
539 | 539 | * @param EE_State[] $state_options |
540 | 540 | * @return boolean |
541 | 541 | */ |
542 | - public static function state_options( $state_options = array() ) { |
|
542 | + public static function state_options($state_options = array()) { |
|
543 | 543 | $new_states = EED_Add_New_State::_get_new_states(); |
544 | - foreach ( $new_states as $new_state ) { |
|
544 | + foreach ($new_states as $new_state) { |
|
545 | 545 | if ( |
546 | 546 | $new_state instanceof EE_State |
547 | 547 | && $new_state->country() instanceof EE_Country |
548 | 548 | ) { |
549 | - $state_options[ $new_state->country()->name() ][ $new_state->ID() ] = $new_state->name(); |
|
549 | + $state_options[$new_state->country()->name()][$new_state->ID()] = $new_state->name(); |
|
550 | 550 | } |
551 | 551 | } |
552 | 552 | return $state_options; |
@@ -562,12 +562,12 @@ discard block |
||
562 | 562 | */ |
563 | 563 | protected static function _get_new_states() { |
564 | 564 | $new_states = array(); |
565 | - if ( EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
565 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
566 | 566 | $new_states = EE_Registry::instance()->SSN->get_session_data( |
567 | 567 | 'nsmf_new_states' |
568 | 568 | ); |
569 | 569 | } |
570 | - return is_array( $new_states ) ? $new_states : array(); |
|
570 | + return is_array($new_states) ? $new_states : array(); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | * @param EE_Country[] $country_options |
580 | 580 | * @return boolean |
581 | 581 | */ |
582 | - public static function country_options( $country_options = array() ) { |
|
582 | + public static function country_options($country_options = array()) { |
|
583 | 583 | $new_states = EED_Add_New_State::_get_new_states(); |
584 | - foreach ( $new_states as $new_state ) { |
|
584 | + foreach ($new_states as $new_state) { |
|
585 | 585 | if ( |
586 | 586 | $new_state instanceof EE_State |
587 | 587 | && $new_state->country() instanceof EE_Country |
588 | 588 | ) { |
589 | - $country_options[ $new_state->country()->ID() ] = $new_state->country()->name(); |
|
589 | + $country_options[$new_state->country()->ID()] = $new_state->country()->name(); |
|
590 | 590 | } |
591 | 591 | } |
592 | 592 | return $country_options; |