@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Price|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone, $date_formats ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone, $date_formats); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Price |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @subpackage includes/classes/EE_Transaction.class.php |
27 | 27 | * @author Brent Christensen |
28 | 28 | */ |
29 | -class EE_Transaction extends EE_Base_Class implements EEI_Transaction{ |
|
29 | +class EE_Transaction extends EE_Base_Class implements EEI_Transaction { |
|
30 | 30 | |
31 | 31 | |
32 | 32 | /** |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | * date_format and the second value is the time format |
39 | 39 | * @return EE_Transaction |
40 | 40 | */ |
41 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
42 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
43 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
41 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
42 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
43 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | * the website will be used. |
52 | 52 | * @return EE_Attendee |
53 | 53 | */ |
54 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
55 | - return new self( $props_n_values, TRUE, $timezone ); |
|
54 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
55 | + return new self($props_n_values, TRUE, $timezone); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @return void |
68 | 68 | */ |
69 | 69 | public function lock() { |
70 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
71 | - $locked_transactions[ $this->ID() ] = true; |
|
72 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
70 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
71 | + $locked_transactions[$this->ID()] = true; |
|
72 | + update_option('ee_locked_transactions', $locked_transactions); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -83,9 +83,9 @@ discard block |
||
83 | 83 | * @return void |
84 | 84 | */ |
85 | 85 | public function unlock() { |
86 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
87 | - unset( $locked_transactions[ $this->ID() ] ); |
|
88 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
86 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
87 | + unset($locked_transactions[$this->ID()]); |
|
88 | + update_option('ee_locked_transactions', $locked_transactions); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | * @return boolean |
103 | 103 | */ |
104 | 104 | public function is_locked() { |
105 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
106 | - return isset( $locked_transactions[ $this->ID() ] ) ? true : false; |
|
105 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
106 | + return isset($locked_transactions[$this->ID()]) ? true : false; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @access public |
115 | 115 | * @param float $total total value of transaction |
116 | 116 | */ |
117 | - public function set_total( $total = 0.00 ) { |
|
118 | - $this->set( 'TXN_total', $total ); |
|
117 | + public function set_total($total = 0.00) { |
|
118 | + $this->set('TXN_total', $total); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * @access public |
127 | 127 | * @param float $total_paid total amount paid to date (sum of all payments) |
128 | 128 | */ |
129 | - public function set_paid( $total_paid = 0.00 ) { |
|
130 | - $this->set( 'TXN_paid', $total_paid ); |
|
129 | + public function set_paid($total_paid = 0.00) { |
|
130 | + $this->set('TXN_paid', $total_paid); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @access public |
139 | 139 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
140 | 140 | */ |
141 | - public function set_status( $status = '' ) { |
|
142 | - $this->set( 'STS_ID', $status ); |
|
141 | + public function set_status($status = '') { |
|
142 | + $this->set('STS_ID', $status); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | |
@@ -150,8 +150,8 @@ discard block |
||
150 | 150 | * @access public |
151 | 151 | * @param string $hash_salt required for some payment gateways |
152 | 152 | */ |
153 | - public function set_hash_salt( $hash_salt = '' ) { |
|
154 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
153 | + public function set_hash_salt($hash_salt = '') { |
|
154 | + $this->set('TXN_hash_salt', $hash_salt); |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | * Sets TXN_reg_steps array |
161 | 161 | * @param array $txn_reg_steps |
162 | 162 | */ |
163 | - function set_reg_steps( $txn_reg_steps ) { |
|
164 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
163 | + function set_reg_steps($txn_reg_steps) { |
|
164 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | * @return array |
172 | 172 | */ |
173 | 173 | function reg_steps() { |
174 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
175 | - return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array(); |
|
174 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
175 | + return is_array($TXN_reg_steps) ? $TXN_reg_steps : array(); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @return string of transaction's total cost, with currency symbol and decimal |
183 | 183 | */ |
184 | 184 | public function pretty_total() { |
185 | - return $this->get_pretty( 'TXN_total' ); |
|
185 | + return $this->get_pretty('TXN_total'); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | * @return string |
193 | 193 | */ |
194 | 194 | public function pretty_paid() { |
195 | - return $this->get_pretty( 'TXN_paid' ); |
|
195 | + return $this->get_pretty('TXN_paid'); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | * @return float amount remaining |
205 | 205 | */ |
206 | 206 | public function remaining() { |
207 | - return (float)( $this->total() - $this->paid() ); |
|
207 | + return (float) ($this->total() - $this->paid()); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | * @return float |
216 | 216 | */ |
217 | 217 | public function total() { |
218 | - return $this->get( 'TXN_total' ); |
|
218 | + return $this->get('TXN_total'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @return float |
227 | 227 | */ |
228 | 228 | public function paid() { |
229 | - return $this->get( 'TXN_paid' ); |
|
229 | + return $this->get('TXN_paid'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | |
@@ -236,8 +236,8 @@ discard block |
||
236 | 236 | * @access public |
237 | 237 | */ |
238 | 238 | public function get_cart_session() { |
239 | - $session_data = $this->get( 'TXN_session_data' ); |
|
240 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL; |
|
239 | + $session_data = $this->get('TXN_session_data'); |
|
240 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL; |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | |
@@ -247,9 +247,9 @@ discard block |
||
247 | 247 | * @access public |
248 | 248 | */ |
249 | 249 | public function session_data() { |
250 | - $session_data = $this->get( 'TXN_session_data' ); |
|
251 | - if ( empty( $session_data ) ) { |
|
252 | - $session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() ); |
|
250 | + $session_data = $this->get('TXN_session_data'); |
|
251 | + if (empty($session_data)) { |
|
252 | + $session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array()); |
|
253 | 253 | } |
254 | 254 | return $session_data; |
255 | 255 | } |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | * @access public |
263 | 263 | * @param EE_Session|array $session_data |
264 | 264 | */ |
265 | - public function set_txn_session_data( $session_data ) { |
|
266 | - if ( $session_data instanceof EE_Session ) { |
|
267 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
265 | + public function set_txn_session_data($session_data) { |
|
266 | + if ($session_data instanceof EE_Session) { |
|
267 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
268 | 268 | } else { |
269 | - $this->set( 'TXN_session_data', $session_data ); |
|
269 | + $this->set('TXN_session_data', $session_data); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @access public |
278 | 278 | */ |
279 | 279 | public function hash_salt_() { |
280 | - return $this->get( 'TXN_hash_salt' ); |
|
280 | + return $this->get('TXN_hash_salt'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -297,13 +297,13 @@ discard block |
||
297 | 297 | * @param boolean $gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied |
298 | 298 | * @return string | int |
299 | 299 | */ |
300 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
301 | - if ( $format ) { |
|
302 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
303 | - } else if ( $gmt ) { |
|
304 | - return $this->get_raw( 'TXN_timestamp' ); |
|
300 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
301 | + if ($format) { |
|
302 | + return $this->get_pretty('TXN_timestamp'); |
|
303 | + } else if ($gmt) { |
|
304 | + return $this->get_raw('TXN_timestamp'); |
|
305 | 305 | } else { |
306 | - return $this->get( 'TXN_timestamp' ); |
|
306 | + return $this->get('TXN_timestamp'); |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | * @param boolean $get_cached TRUE to retrieve cached registrations or FALSE to pull from the db |
316 | 316 | * @return EE_Registration[] |
317 | 317 | */ |
318 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
319 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params; |
|
318 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
319 | + $query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params; |
|
320 | 320 | $query_params = $get_cached ? array() : $query_params; |
321 | - return $this->get_many_related( 'Registration', $query_params ); |
|
321 | + return $this->get_many_related('Registration', $query_params); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
330 | 330 | */ |
331 | 331 | public function attendees() { |
332 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
332 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | * @param array $query_params like EEM_Base::get_all |
340 | 340 | * @return EE_Payment[] |
341 | 341 | */ |
342 | - public function payments( $query_params = array() ) { |
|
343 | - return $this->get_many_related( 'Payment', $query_params ); |
|
342 | + public function payments($query_params = array()) { |
|
343 | + return $this->get_many_related('Payment', $query_params); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | * @return EE_Payment[] |
351 | 351 | */ |
352 | 352 | public function approved_payments() { |
353 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
354 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
353 | + EE_Registry::instance()->load_model('Payment'); |
|
354 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -361,8 +361,8 @@ discard block |
||
361 | 361 | * @param bool $show_icons |
362 | 362 | * @return string |
363 | 363 | */ |
364 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
365 | - echo $this->pretty_status( $show_icons ); |
|
364 | + public function e_pretty_status($show_icons = FALSE) { |
|
365 | + echo $this->pretty_status($show_icons); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | * @param bool $show_icons |
373 | 373 | * @return string |
374 | 374 | */ |
375 | - public function pretty_status( $show_icons = FALSE ) { |
|
376 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
375 | + public function pretty_status($show_icons = FALSE) { |
|
376 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
377 | 377 | $icon = ''; |
378 | - switch ( $this->status_ID() ) { |
|
378 | + switch ($this->status_ID()) { |
|
379 | 379 | case EEM_Transaction::complete_status_code: |
380 | 380 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
381 | 381 | break; |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
393 | 393 | break; |
394 | 394 | } |
395 | - return $icon . $status[ $this->status_ID() ]; |
|
395 | + return $icon.$status[$this->status_ID()]; |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @access public |
403 | 403 | */ |
404 | 404 | public function status_ID() { |
405 | - return $this->get( 'STS_ID' ); |
|
405 | + return $this->get('STS_ID'); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * @return boolean |
413 | 413 | */ |
414 | 414 | public function is_free() { |
415 | - return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE; |
|
415 | + return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -480,12 +480,12 @@ discard block |
||
480 | 480 | * @access public |
481 | 481 | * @return string |
482 | 482 | */ |
483 | - public function invoice_url( $type = 'html' ) { |
|
483 | + public function invoice_url($type = 'html') { |
|
484 | 484 | $REG = $this->primary_registration(); |
485 | - if ( ! $REG instanceof EE_Registration ) { |
|
485 | + if ( ! $REG instanceof EE_Registration) { |
|
486 | 486 | return ''; |
487 | 487 | } |
488 | - return $REG->invoice_url( $type ); |
|
488 | + return $REG->invoice_url($type); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * @return EE_Registration |
496 | 496 | */ |
497 | 497 | public function primary_registration() { |
498 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
498 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | |
@@ -505,12 +505,12 @@ discard block |
||
505 | 505 | * @param string $type 'pdf' or 'html' (default is 'html') |
506 | 506 | * @return string |
507 | 507 | */ |
508 | - public function receipt_url( $type = 'html' ) { |
|
508 | + public function receipt_url($type = 'html') { |
|
509 | 509 | $REG = $this->primary_registration(); |
510 | - if ( ! $REG instanceof EE_Registration ) { |
|
510 | + if ( ! $REG instanceof EE_Registration) { |
|
511 | 511 | return ''; |
512 | 512 | } |
513 | - return $REG->receipt_url( $type ); |
|
513 | + return $REG->receipt_url($type); |
|
514 | 514 | } |
515 | 515 | |
516 | 516 | |
@@ -535,15 +535,15 @@ discard block |
||
535 | 535 | * @deprecated |
536 | 536 | * @return boolean |
537 | 537 | */ |
538 | - public function update_based_on_payments(){ |
|
538 | + public function update_based_on_payments() { |
|
539 | 539 | EE_Error::doing_it_wrong( |
540 | - __CLASS__ . '::' . __FUNCTION__, |
|
541 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
540 | + __CLASS__.'::'.__FUNCTION__, |
|
541 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
542 | 542 | '4.6.0' |
543 | 543 | ); |
544 | 544 | /** @type EE_Transaction_Processor $transaction_processor */ |
545 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
546 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this ); |
|
545 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
546 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @return string |
553 | 553 | */ |
554 | 554 | public function gateway_response_on_transaction() { |
555 | - $payment = $this->get_first_related( 'Payment' ); |
|
555 | + $payment = $this->get_first_related('Payment'); |
|
556 | 556 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
557 | 557 | } |
558 | 558 | |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | * @return EE_Status |
564 | 564 | */ |
565 | 565 | public function status_obj() { |
566 | - return $this->get_first_related( 'Status' ); |
|
566 | + return $this->get_first_related('Status'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | * @param array $query_params like EEM_Base::get_all |
574 | 574 | * @return EE_Extra_Meta |
575 | 575 | */ |
576 | - public function extra_meta( $query_params = array() ) { |
|
577 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
576 | + public function extra_meta($query_params = array()) { |
|
577 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | * @param EE_Registration $registration |
585 | 585 | * @return EE_Base_Class the relation was added to |
586 | 586 | */ |
587 | - public function add_registration( EE_Registration $registration ) { |
|
588 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
587 | + public function add_registration(EE_Registration $registration) { |
|
588 | + return $this->_add_relation_to($registration, 'Registration'); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | |
@@ -596,8 +596,8 @@ discard block |
||
596 | 596 | * @param int $registration_or_id |
597 | 597 | * @return EE_Base_Class that was removed from being related |
598 | 598 | */ |
599 | - public function remove_registration_with_id( $registration_or_id ) { |
|
600 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
599 | + public function remove_registration_with_id($registration_or_id) { |
|
600 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | * @return EE_Line_Item[] |
608 | 608 | */ |
609 | 609 | public function items_purchased() { |
610 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
610 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | |
@@ -617,8 +617,8 @@ discard block |
||
617 | 617 | * @param EE_Line_Item $line_item |
618 | 618 | * @return EE_Base_Class the relation was added to |
619 | 619 | */ |
620 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
621 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
620 | + public function add_line_item(EE_Line_Item $line_item) { |
|
621 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
628 | 628 | * @param array $query_params |
629 | 629 | * @return EE_Line_Item[] |
630 | 630 | */ |
631 | - public function line_items( $query_params = array() ) { |
|
632 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
631 | + public function line_items($query_params = array()) { |
|
632 | + return $this->get_many_related('Line_Item', $query_params); |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | * @return EE_Line_Item[] |
640 | 640 | */ |
641 | 641 | public function tax_items() { |
642 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
642 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | |
@@ -650,10 +650,10 @@ discard block |
||
650 | 650 | * @return EE_Line_Item |
651 | 651 | */ |
652 | 652 | public function total_line_item() { |
653 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
654 | - if( ! $item ){ |
|
655 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
656 | - $item = EEH_Line_Item::create_total_line_item( $this ); |
|
653 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
654 | + if ( ! $item) { |
|
655 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
656 | + $item = EEH_Line_Item::create_total_line_item($this); |
|
657 | 657 | } |
658 | 658 | return $item; |
659 | 659 | } |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | */ |
668 | 668 | public function tax_total() { |
669 | 669 | $tax_line_item = $this->tax_total_line_item(); |
670 | - if ( $tax_line_item ) { |
|
670 | + if ($tax_line_item) { |
|
671 | 671 | return $tax_line_item->total(); |
672 | 672 | } else { |
673 | 673 | return 0; |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @return EE_Line_Item |
682 | 682 | */ |
683 | 683 | public function tax_total_line_item() { |
684 | - return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() ); |
|
684 | + return EEH_Line_Item::get_taxes_subtotal($this->total_line_item()); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | |
@@ -690,20 +690,20 @@ discard block |
||
690 | 690 | * Gets the array of billing info for the gateway and for this transaction's primary registration's attendee. |
691 | 691 | * @return EE_Form_Section_Proper |
692 | 692 | */ |
693 | - public function billing_info(){ |
|
693 | + public function billing_info() { |
|
694 | 694 | $payment_method = $this->payment_method(); |
695 | - if ( !$payment_method){ |
|
695 | + if ( ! $payment_method) { |
|
696 | 696 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
697 | 697 | return false; |
698 | 698 | } |
699 | 699 | $primary_reg = $this->primary_registration(); |
700 | - if ( ! $primary_reg ) { |
|
701 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
700 | + if ( ! $primary_reg) { |
|
701 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
702 | 702 | return FALSE; |
703 | 703 | } |
704 | 704 | $attendee = $primary_reg->attendee(); |
705 | - if ( ! $attendee ) { |
|
706 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
705 | + if ( ! $attendee) { |
|
706 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
707 | 707 | return FALSE; |
708 | 708 | } |
709 | 709 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -738,15 +738,15 @@ discard block |
||
738 | 738 | * offline ones, dont' create payments) |
739 | 739 | * @return EE_Payment_Method |
740 | 740 | */ |
741 | - function payment_method(){ |
|
741 | + function payment_method() { |
|
742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
743 | - if( $pm instanceof EE_Payment_Method ){ |
|
743 | + if ($pm instanceof EE_Payment_Method) { |
|
744 | 744 | return $pm; |
745 | - }else{ |
|
745 | + } else { |
|
746 | 746 | $last_payment = $this->last_payment(); |
747 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
747 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
748 | 748 | return $last_payment->payment_method(); |
749 | - }else{ |
|
749 | + } else { |
|
750 | 750 | return NULL; |
751 | 751 | } |
752 | 752 | } |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | * @return EE_Payment |
758 | 758 | */ |
759 | 759 | public function last_payment() { |
760 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
760 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
761 | 761 | } |
762 | 762 | |
763 | 763 | /** |
764 | 764 | * Gets all the line items which are unrelated to tickets on this transaction |
765 | 765 | * @return EE_Line_Item[] |
766 | 766 | */ |
767 | - public function non_ticket_line_items(){ |
|
768 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
767 | + public function non_ticket_line_items() { |
|
768 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
769 | 769 | } |
770 | 770 | |
771 | 771 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * date_format and the second value is the time format |
38 | 38 | * @return EE_Attendee |
39 | 39 | */ |
40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * the website will be used. |
51 | 51 | * @return EE_Attendee |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @return string |
62 | 62 | */ |
63 | 63 | function name() { |
64 | - return $this->get( 'VNU_name' ); |
|
64 | + return $this->get('VNU_name'); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @return string |
71 | 71 | */ |
72 | 72 | function phone() { |
73 | - return $this->get( 'VNU_phone' ); |
|
73 | + return $this->get('VNU_phone'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @return string |
81 | 81 | */ |
82 | 82 | function venue_url() { |
83 | - return $this->get( 'VNU_url' ); |
|
83 | + return $this->get('VNU_url'); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * @return string |
90 | 90 | */ |
91 | 91 | function description() { |
92 | - return $this->get( 'VNU_desc' ); |
|
92 | + return $this->get('VNU_desc'); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * @return string |
100 | 100 | */ |
101 | 101 | function excerpt() { |
102 | - return $this->get( 'VNU_short_desc' ); |
|
102 | + return $this->get('VNU_short_desc'); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return string |
110 | 110 | */ |
111 | 111 | function identifier() { |
112 | - return $this->get( 'VNU_identifier' ); |
|
112 | + return $this->get('VNU_identifier'); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @return string |
120 | 120 | */ |
121 | 121 | function address() { |
122 | - return $this->get( 'VNU_address' ); |
|
122 | + return $this->get('VNU_address'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @return string |
130 | 130 | */ |
131 | 131 | function address2() { |
132 | - return $this->get( 'VNU_address2' ); |
|
132 | + return $this->get('VNU_address2'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return string |
141 | 141 | */ |
142 | 142 | function city() { |
143 | - return $this->get( 'VNU_city' ); |
|
143 | + return $this->get('VNU_city'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @return int |
149 | 149 | */ |
150 | 150 | function state_ID() { |
151 | - return $this->get( 'STA_ID' ); |
|
151 | + return $this->get('STA_ID'); |
|
152 | 152 | } |
153 | 153 | |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return string |
158 | 158 | */ |
159 | 159 | public function state_abbrev() { |
160 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
160 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | * @return string |
167 | 167 | */ |
168 | 168 | public function state_name() { |
169 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
169 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso'); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * @return EE_State |
177 | 177 | */ |
178 | 178 | function state_obj() { |
179 | - return $this->get_first_related( 'State' ); |
|
179 | + return $this->get_first_related('State'); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | * @return string |
189 | 189 | */ |
190 | 190 | public function state() { |
191 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
191 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
192 | 192 | return $this->state_abbrev(); |
193 | 193 | } else { |
194 | 194 | return $this->state_name(); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * @return string |
203 | 203 | */ |
204 | 204 | function country_ID() { |
205 | - return $this->get( 'CNT_ISO' ); |
|
205 | + return $this->get('CNT_ISO'); |
|
206 | 206 | } |
207 | 207 | |
208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * @return string |
212 | 212 | */ |
213 | 213 | public function country_name() { |
214 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
214 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso'); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return EE_Country |
222 | 222 | */ |
223 | 223 | function country_obj() { |
224 | - return $this->get_first_related( 'Country' ); |
|
224 | + return $this->get_first_related('Country'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @return string |
234 | 234 | */ |
235 | 235 | public function country() { |
236 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
236 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
237 | 237 | return $this->country_ID(); |
238 | 238 | } else { |
239 | 239 | return $this->country_name(); |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * @return string |
248 | 248 | */ |
249 | 249 | function zip() { |
250 | - return $this->get( 'VNU_zip' ); |
|
250 | + return $this->get('VNU_zip'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * @return int |
258 | 258 | */ |
259 | 259 | function capacity() { |
260 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
260 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return string |
268 | 268 | */ |
269 | 269 | function created() { |
270 | - return $this->get( 'VNU_created' ); |
|
270 | + return $this->get('VNU_created'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @return string |
278 | 278 | */ |
279 | 279 | function modified() { |
280 | - return $this->get( 'VNU_modified' ); |
|
280 | + return $this->get('VNU_modified'); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @return int |
288 | 288 | */ |
289 | 289 | function order() { |
290 | - return $this->get( 'VNU_order' ); |
|
290 | + return $this->get('VNU_order'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @return int |
298 | 298 | */ |
299 | 299 | function wp_user() { |
300 | - return $this->get( 'VNU_wp_user' ); |
|
300 | + return $this->get('VNU_wp_user'); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @return string |
307 | 307 | */ |
308 | 308 | function virtual_phone() { |
309 | - return $this->get( 'VNU_virtual_phone' ); |
|
309 | + return $this->get('VNU_virtual_phone'); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @return string |
316 | 316 | */ |
317 | 317 | function virtual_url() { |
318 | - return $this->get( 'VNU_virtual_url' ); |
|
318 | + return $this->get('VNU_virtual_url'); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return bool |
325 | 325 | */ |
326 | 326 | function enable_for_gmap() { |
327 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
327 | + return $this->get('VNU_enable_for_gmap'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | * @return string |
334 | 334 | */ |
335 | 335 | function google_map_link() { |
336 | - return $this->get( 'VNU_google_map_link' ); |
|
336 | + return $this->get('VNU_google_map_link'); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | * @param bool $upcoming |
346 | 346 | * @return EE_Event[] |
347 | 347 | */ |
348 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
349 | - if ( $upcoming ) { |
|
348 | + function events($query_params = array(), $upcoming = FALSE) { |
|
349 | + if ($upcoming) { |
|
350 | 350 | $query_params = array( |
351 | 351 | array( |
352 | 352 | 'status' => 'publish', |
353 | - 'Datetime.DTT_EVT_start' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ) |
|
353 | + 'Datetime.DTT_EVT_start' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')) |
|
354 | 354 | ) |
355 | 355 | ); |
356 | 356 | } |
357 | - return $this->get_many_related( 'Event', $query_params ); |
|
357 | + return $this->get_many_related('Event', $query_params); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | |
@@ -372,8 +372,8 @@ discard block |
||
372 | 372 | /** |
373 | 373 | * Sets address |
374 | 374 | */ |
375 | - function set_address( $address = '' ) { |
|
376 | - $this->set( 'VNU_address', $address ); |
|
375 | + function set_address($address = '') { |
|
376 | + $this->set('VNU_address', $address); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
381 | 381 | /** |
382 | 382 | * @param string $address2 |
383 | 383 | */ |
384 | - function set_address2( $address2 = '' ) { |
|
385 | - $this->set( 'VNU_address2', $address2 ); |
|
384 | + function set_address2($address2 = '') { |
|
385 | + $this->set('VNU_address2', $address2); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
390 | 390 | /** |
391 | 391 | * @param string $city |
392 | 392 | */ |
393 | - function set_city( $city = '' ) { |
|
394 | - $this->set( 'VNU_city', $city ); |
|
393 | + function set_city($city = '') { |
|
394 | + $this->set('VNU_city', $city); |
|
395 | 395 | } |
396 | 396 | |
397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
399 | 399 | /** |
400 | 400 | * @param int $state |
401 | 401 | */ |
402 | - function set_state_ID( $state = 0 ) { |
|
403 | - $this->set( 'STA_ID', $state ); |
|
402 | + function set_state_ID($state = 0) { |
|
403 | + $this->set('STA_ID', $state); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | |
@@ -411,8 +411,8 @@ discard block |
||
411 | 411 | * @param EE_State /int $state_id_or_obj |
412 | 412 | * @return EE_State |
413 | 413 | */ |
414 | - function set_state_obj( $state_id_or_obj ) { |
|
415 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
414 | + function set_state_obj($state_id_or_obj) { |
|
415 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * @param int $country_ID |
422 | 422 | */ |
423 | - function set_country_ID( $country_ID = 0 ) { |
|
424 | - $this->set( 'CNT_ISO', $country_ID ); |
|
423 | + function set_country_ID($country_ID = 0) { |
|
424 | + $this->set('CNT_ISO', $country_ID); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | * @param EE_Country /string $country_id_or_obj |
431 | 431 | * @return EE_Country |
432 | 432 | */ |
433 | - function set_country_obj( $country_id_or_obj ) { |
|
433 | + function set_country_obj($country_id_or_obj) { |
|
434 | 434 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
435 | 435 | } |
436 | 436 | |
@@ -439,8 +439,8 @@ discard block |
||
439 | 439 | /** |
440 | 440 | * @param string $zip |
441 | 441 | */ |
442 | - function set_zip( $zip = '' ) { |
|
443 | - $this->set( 'VNU_zip', $zip ); |
|
442 | + function set_zip($zip = '') { |
|
443 | + $this->set('VNU_zip', $zip); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | /** |
449 | 449 | * @param int $capacity |
450 | 450 | */ |
451 | - function set_capacity( $capacity = 0 ) { |
|
452 | - $this->set( 'VNU_capacity', $capacity ); |
|
451 | + function set_capacity($capacity = 0) { |
|
452 | + $this->set('VNU_capacity', $capacity); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | |
@@ -457,8 +457,8 @@ discard block |
||
457 | 457 | /** |
458 | 458 | * @param string $created |
459 | 459 | */ |
460 | - function set_created( $created = '' ) { |
|
461 | - $this->set( 'VNU_created', $created ); |
|
460 | + function set_created($created = '') { |
|
461 | + $this->set('VNU_created', $created); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | /** |
467 | 467 | * @param string $desc |
468 | 468 | */ |
469 | - function set_description( $desc = '' ) { |
|
470 | - $this->set( 'VNU_desc', $desc ); |
|
469 | + function set_description($desc = '') { |
|
470 | + $this->set('VNU_desc', $desc); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | |
@@ -475,8 +475,8 @@ discard block |
||
475 | 475 | /** |
476 | 476 | * @param string $identifier |
477 | 477 | */ |
478 | - function set_identifier( $identifier = '' ) { |
|
479 | - $this->set( 'VNU_identifier', $identifier ); |
|
478 | + function set_identifier($identifier = '') { |
|
479 | + $this->set('VNU_identifier', $identifier); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * @param string $modified |
486 | 486 | */ |
487 | - function set_modified( $modified = '' ) { |
|
488 | - $this->set( 'VNU_modified', $modified ); |
|
487 | + function set_modified($modified = '') { |
|
488 | + $this->set('VNU_modified', $modified); |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | /** |
494 | 494 | * @param string $name |
495 | 495 | */ |
496 | - function set_name( $name = '' ) { |
|
497 | - $this->set( 'VNU_name', $name ); |
|
496 | + function set_name($name = '') { |
|
497 | + $this->set('VNU_name', $name); |
|
498 | 498 | } |
499 | 499 | |
500 | 500 | |
@@ -502,8 +502,8 @@ discard block |
||
502 | 502 | /** |
503 | 503 | * @param int $order |
504 | 504 | */ |
505 | - function set_order( $order = 0 ) { |
|
506 | - $this->set( 'VNU_order', $order ); |
|
505 | + function set_order($order = 0) { |
|
506 | + $this->set('VNU_order', $order); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | /** |
512 | 512 | * @param string $phone |
513 | 513 | */ |
514 | - function set_phone( $phone = '' ) { |
|
515 | - $this->set( 'VNU_phone', $phone ); |
|
514 | + function set_phone($phone = '') { |
|
515 | + $this->set('VNU_phone', $phone); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | /** |
521 | 521 | * @param int $wp_user |
522 | 522 | */ |
523 | - function set_wp_user( $wp_user = 1 ) { |
|
524 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
523 | + function set_wp_user($wp_user = 1) { |
|
524 | + $this->set('VNU_wp_user', $wp_user); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | |
@@ -529,8 +529,8 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @param string $url |
531 | 531 | */ |
532 | - function set_venue_url( $url = '' ) { |
|
533 | - $this->set( 'VNU_url', $url ); |
|
532 | + function set_venue_url($url = '') { |
|
533 | + $this->set('VNU_url', $url); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | /** |
539 | 539 | * @param string $phone |
540 | 540 | */ |
541 | - function set_virtual_phone( $phone = '' ) { |
|
542 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
541 | + function set_virtual_phone($phone = '') { |
|
542 | + $this->set('VNU_virtual_phone', $phone); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -547,8 +547,8 @@ discard block |
||
547 | 547 | /** |
548 | 548 | * @param string $url |
549 | 549 | */ |
550 | - function set_virtual_url( $url = '' ) { |
|
551 | - $this->set( 'VNU_virtual_url', $url ); |
|
550 | + function set_virtual_url($url = '') { |
|
551 | + $this->set('VNU_virtual_url', $url); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | |
@@ -556,8 +556,8 @@ discard block |
||
556 | 556 | /** |
557 | 557 | * @param string $enable |
558 | 558 | */ |
559 | - function set_enable_for_gmap( $enable = '' ) { |
|
560 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
559 | + function set_enable_for_gmap($enable = '') { |
|
560 | + $this->set('VNU_enable_for_gmap', $enable); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | |
@@ -565,8 +565,8 @@ discard block |
||
565 | 565 | /** |
566 | 566 | * @param string $google_map_link |
567 | 567 | */ |
568 | - function set_google_map_link( $google_map_link = '' ) { |
|
569 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
568 | + function set_google_map_link($google_map_link = '') { |
|
569 | + $this->set('VNU_google_map_link', $google_map_link); |
|
570 | 570 | } |
571 | 571 | |
572 | 572 |
@@ -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 | /** |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * @return string |
54 | 54 | * @throws \EE_Error |
55 | 55 | */ |
56 | - public static function get_valid_timezone_string( $timezone_string = '' ) { |
|
56 | + public static function get_valid_timezone_string($timezone_string = '') { |
|
57 | 57 | // if passed a value, then use that, else get WP option |
58 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
58 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
59 | 59 | // value from above exists, use that, else get timezone string from gmt_offset |
60 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | - EEH_DTT_Helper::validate_timezone( $timezone_string ); |
|
60 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset(); |
|
61 | + EEH_DTT_Helper::validate_timezone($timezone_string); |
|
62 | 62 | return $timezone_string; |
63 | 63 | } |
64 | 64 | |
@@ -74,18 +74,18 @@ discard block |
||
74 | 74 | * @return bool |
75 | 75 | * @throws \EE_Error |
76 | 76 | */ |
77 | - public static function validate_timezone( $timezone_string, $throw_error = true ) { |
|
77 | + public static function validate_timezone($timezone_string, $throw_error = true) { |
|
78 | 78 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
79 | 79 | try { |
80 | - new DateTimeZone( $timezone_string ); |
|
81 | - } catch ( Exception $e ) { |
|
80 | + new DateTimeZone($timezone_string); |
|
81 | + } catch (Exception $e) { |
|
82 | 82 | // sometimes we take exception to exceptions |
83 | - if ( ! $throw_error ) { |
|
83 | + if ( ! $throw_error) { |
|
84 | 84 | return false; |
85 | 85 | } |
86 | 86 | throw new EE_Error( |
87 | 87 | sprintf( |
88 | - __( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
88 | + __('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
89 | 89 | $timezone_string, |
90 | 90 | '<a href="http://www.php.net/manual/en/timezones.php">', |
91 | 91 | '</a>' |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | * @param string $gmt_offset |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) { |
|
107 | + public static function get_timezone_string_from_gmt_offset($gmt_offset = '') { |
|
108 | 108 | $timezone_string = 'UTC'; |
109 | - $gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' ); |
|
110 | - if ( $gmt_offset !== '' ) { |
|
109 | + $gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset'); |
|
110 | + if ($gmt_offset !== '') { |
|
111 | 111 | // convert GMT offset to seconds |
112 | 112 | $gmt_offset = $gmt_offset * HOUR_IN_SECONDS; |
113 | 113 | // account for WP offsets that aren't valid UTC |
114 | - $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset ); |
|
114 | + $gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset); |
|
115 | 115 | // although we don't know the TZ abbreviation, we know the UTC offset |
116 | - $timezone_string = timezone_name_from_abbr( null, $gmt_offset ); |
|
116 | + $timezone_string = timezone_name_from_abbr(null, $gmt_offset); |
|
117 | 117 | } |
118 | 118 | // better have a valid timezone string by now, but if not, sigh... loop thru the timezone_abbreviations_list()... |
119 | - $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset ); |
|
119 | + $timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset); |
|
120 | 120 | return $timezone_string; |
121 | 121 | } |
122 | 122 | |
@@ -129,10 +129,10 @@ discard block |
||
129 | 129 | * @param int $gmt_offset |
130 | 130 | * @return int |
131 | 131 | */ |
132 | - public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) { |
|
132 | + public static function adjust_invalid_gmt_offsets($gmt_offset = 0) { |
|
133 | 133 | //make sure $gmt_offset is int |
134 | 134 | $gmt_offset = (int) $gmt_offset; |
135 | - switch ( $gmt_offset ) { |
|
135 | + switch ($gmt_offset) { |
|
136 | 136 | |
137 | 137 | // case -30600 : |
138 | 138 | // $gmt_offset = -28800; |
@@ -184,13 +184,13 @@ discard block |
||
184 | 184 | * @return string |
185 | 185 | * @throws \EE_Error |
186 | 186 | */ |
187 | - public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) { |
|
187 | + public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) { |
|
188 | 188 | $abbreviations = timezone_abbreviations_list(); |
189 | - foreach ( $abbreviations as $abbreviation ) { |
|
190 | - foreach ( $abbreviation as $city ) { |
|
191 | - if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) { |
|
189 | + foreach ($abbreviations as $abbreviation) { |
|
190 | + foreach ($abbreviation as $city) { |
|
191 | + if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) { |
|
192 | 192 | // check if the timezone is valid but don't throw any errors if it isn't |
193 | - if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) { |
|
193 | + if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) { |
|
194 | 194 | return $city['timezone_id']; |
195 | 195 | } |
196 | 196 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | } |
199 | 199 | throw new EE_Error( |
200 | 200 | sprintf( |
201 | - __( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ), |
|
201 | + __('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'), |
|
202 | 202 | $gmt_offset, |
203 | 203 | '<a href="http://www.php.net/manual/en/timezones.php">', |
204 | 204 | '</a>' |
@@ -212,23 +212,23 @@ discard block |
||
212 | 212 | * @access public |
213 | 213 | * @param string $timezone_string |
214 | 214 | */ |
215 | - public static function timezone_select_input( $timezone_string = '' ) { |
|
215 | + public static function timezone_select_input($timezone_string = '') { |
|
216 | 216 | // get WP date time format |
217 | - $datetime_format = get_option('date_format') . ' ' . get_option('time_format'); |
|
217 | + $datetime_format = get_option('date_format').' '.get_option('time_format'); |
|
218 | 218 | // if passed a value, then use that, else get WP option |
219 | - $timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' ); |
|
219 | + $timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string'); |
|
220 | 220 | // check if the timezone is valid but don't throw any errors if it isn't |
221 | - $timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false ); |
|
221 | + $timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false); |
|
222 | 222 | $gmt_offset = get_option('gmt_offset'); |
223 | 223 | |
224 | 224 | $check_zone_info = true; |
225 | - if ( empty( $timezone_string )) { |
|
225 | + if (empty($timezone_string)) { |
|
226 | 226 | // Create a UTC+- zone if no timezone string exists |
227 | 227 | $check_zone_info = false; |
228 | - if ( $gmt_offset > 0 ) { |
|
229 | - $timezone_string = 'UTC+' . $gmt_offset; |
|
230 | - } elseif ( $gmt_offset < 0 ) { |
|
231 | - $timezone_string = 'UTC' . $gmt_offset; |
|
228 | + if ($gmt_offset > 0) { |
|
229 | + $timezone_string = 'UTC+'.$gmt_offset; |
|
230 | + } elseif ($gmt_offset < 0) { |
|
231 | + $timezone_string = 'UTC'.$gmt_offset; |
|
232 | 232 | } else { |
233 | 233 | $timezone_string = 'UTC'; |
234 | 234 | } |
@@ -250,11 +250,11 @@ discard block |
||
250 | 250 | __('%1$sUTC%2$s time is %3$s'), |
251 | 251 | '<abbr title="Coordinated Universal Time">', |
252 | 252 | '</abbr>', |
253 | - '<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>' |
|
253 | + '<code>'.date_i18n($datetime_format, false, 'gmt').'</code>' |
|
254 | 254 | ); |
255 | 255 | ?></span> |
256 | - <?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?> |
|
257 | - <br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span> |
|
256 | + <?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?> |
|
257 | + <br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span> |
|
258 | 258 | <?php endif; ?> |
259 | 259 | |
260 | 260 | <?php if ($check_zone_info && $timezone_string) : ?> |
@@ -286,10 +286,9 @@ discard block |
||
286 | 286 | |
287 | 287 | if ($found) { |
288 | 288 | $message = $tr['isdst'] ? |
289 | - __(' Daylight saving time begins on: %s.' ) : |
|
290 | - __(' Standard time begins on: %s.'); |
|
289 | + __(' Daylight saving time begins on: %s.') : __(' Standard time begins on: %s.'); |
|
291 | 290 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
292 | - printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' ); |
|
291 | + printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >'); |
|
293 | 292 | } else { |
294 | 293 | _e('This timezone does not observe daylight saving time.'); |
295 | 294 | } |
@@ -319,14 +318,14 @@ discard block |
||
319 | 318 | * |
320 | 319 | * @return int $unix_timestamp with the offset applied for the given timezone. |
321 | 320 | */ |
322 | - public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) { |
|
321 | + public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') { |
|
323 | 322 | $unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp; |
324 | - $timezone_string = self::get_valid_timezone_string( $timezone_string ); |
|
325 | - $TimeZone = new DateTimeZone( $timezone_string ); |
|
323 | + $timezone_string = self::get_valid_timezone_string($timezone_string); |
|
324 | + $TimeZone = new DateTimeZone($timezone_string); |
|
326 | 325 | |
327 | - $DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone ); |
|
328 | - $offset = timezone_offset_get( $TimeZone, $DateTime ); |
|
329 | - return (int)$DateTime->format( 'U' ) + (int)$offset; |
|
326 | + $DateTime = new DateTime('@'.$unix_timestamp, $TimeZone); |
|
327 | + $offset = timezone_offset_get($TimeZone, $DateTime); |
|
328 | + return (int) $DateTime->format('U') + (int) $offset; |
|
330 | 329 | } |
331 | 330 | |
332 | 331 | |
@@ -341,17 +340,17 @@ discard block |
||
341 | 340 | * @param string $datetime_field_name the datetime fieldname to be manipulated |
342 | 341 | * @return EE_Base_Class |
343 | 342 | */ |
344 | - protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) { |
|
343 | + protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) { |
|
345 | 344 | // grab current datetime format |
346 | 345 | $current_format = $obj->get_format(); |
347 | 346 | // set new full timestamp format |
348 | - $obj->set_date_format( EE_Datetime_Field::mysql_date_format ); |
|
349 | - $obj->set_time_format( EE_Datetime_Field::mysql_time_format ); |
|
347 | + $obj->set_date_format(EE_Datetime_Field::mysql_date_format); |
|
348 | + $obj->set_time_format(EE_Datetime_Field::mysql_time_format); |
|
350 | 349 | // set the new date value using a full timestamp format so that no data is lost |
351 | - $obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) ); |
|
350 | + $obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format)); |
|
352 | 351 | // reset datetime formats |
353 | - $obj->set_date_format( $current_format[0] ); |
|
354 | - $obj->set_time_format( $current_format[1] ); |
|
352 | + $obj->set_date_format($current_format[0]); |
|
353 | + $obj->set_time_format($current_format[1]); |
|
355 | 354 | return $obj; |
356 | 355 | } |
357 | 356 | |
@@ -368,11 +367,11 @@ discard block |
||
368 | 367 | * @param integer $value what you want to increment the time by |
369 | 368 | * @return EE_Base_Class return the EE_Base_Class object so right away you can do something with it (chaining) |
370 | 369 | */ |
371 | - public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
370 | + public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
372 | 371 | //get the raw UTC date. |
373 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
374 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value ); |
|
375 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
372 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
373 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value); |
|
374 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
376 | 375 | } |
377 | 376 | |
378 | 377 | |
@@ -387,11 +386,11 @@ discard block |
||
387 | 386 | * @param int $value |
388 | 387 | * @return \EE_Base_Class |
389 | 388 | */ |
390 | - public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) { |
|
389 | + public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) { |
|
391 | 390 | //get the raw UTC date |
392 | - $DateTime = $obj->get_DateTime_object( $datetime_field_name ); |
|
393 | - $DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' ); |
|
394 | - return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name ); |
|
391 | + $DateTime = $obj->get_DateTime_object($datetime_field_name); |
|
392 | + $DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-'); |
|
393 | + return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name); |
|
395 | 394 | } |
396 | 395 | |
397 | 396 | |
@@ -404,44 +403,44 @@ discard block |
||
404 | 403 | * @return \DateTime return whatever type came in. |
405 | 404 | * @throws \EE_Error |
406 | 405 | */ |
407 | - protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) { |
|
408 | - if ( ! $DateTime instanceof DateTime ) { |
|
406 | + protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') { |
|
407 | + if ( ! $DateTime instanceof DateTime) { |
|
409 | 408 | throw new EE_Error( |
410 | 409 | sprintf( |
411 | - __( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ), |
|
412 | - print_r( $DateTime, true ) |
|
410 | + __('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'), |
|
411 | + print_r($DateTime, true) |
|
413 | 412 | ) |
414 | 413 | ); |
415 | 414 | } |
416 | - switch ( $period ) { |
|
415 | + switch ($period) { |
|
417 | 416 | case 'years' : |
418 | - $value = 'P' . $value . 'Y'; |
|
417 | + $value = 'P'.$value.'Y'; |
|
419 | 418 | break; |
420 | 419 | case 'months' : |
421 | - $value = 'P' . $value . 'M'; |
|
420 | + $value = 'P'.$value.'M'; |
|
422 | 421 | break; |
423 | 422 | case 'weeks' : |
424 | - $value = 'P' . $value . 'W'; |
|
423 | + $value = 'P'.$value.'W'; |
|
425 | 424 | break; |
426 | 425 | case 'days' : |
427 | - $value = 'P' . $value . 'D'; |
|
426 | + $value = 'P'.$value.'D'; |
|
428 | 427 | break; |
429 | 428 | case 'hours' : |
430 | - $value = 'PT' . $value . 'H'; |
|
429 | + $value = 'PT'.$value.'H'; |
|
431 | 430 | break; |
432 | 431 | case 'minutes' : |
433 | - $value = 'PT' . $value . 'M'; |
|
432 | + $value = 'PT'.$value.'M'; |
|
434 | 433 | break; |
435 | 434 | case 'seconds' : |
436 | - $value = 'PT' . $value . 'S'; |
|
435 | + $value = 'PT'.$value.'S'; |
|
437 | 436 | break; |
438 | 437 | } |
439 | - switch ( $operand ) { |
|
438 | + switch ($operand) { |
|
440 | 439 | case '+': |
441 | - $DateTime->add( new DateInterval( $value ) ); |
|
440 | + $DateTime->add(new DateInterval($value)); |
|
442 | 441 | break; |
443 | 442 | case '-': |
444 | - $DateTime->sub( new DateInterval( $value ) ); |
|
443 | + $DateTime->sub(new DateInterval($value)); |
|
445 | 444 | break; |
446 | 445 | } |
447 | 446 | return $DateTime; |
@@ -457,16 +456,16 @@ discard block |
||
457 | 456 | * @return \DateTime return whatever type came in. |
458 | 457 | * @throws \EE_Error |
459 | 458 | */ |
460 | - protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
461 | - if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) { |
|
459 | + protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
460 | + if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) { |
|
462 | 461 | throw new EE_Error( |
463 | 462 | sprintf( |
464 | - __( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ), |
|
465 | - print_r( $timestamp, true ) |
|
463 | + __('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'), |
|
464 | + print_r($timestamp, true) |
|
466 | 465 | ) |
467 | 466 | ); |
468 | 467 | } |
469 | - switch ( $period ) { |
|
468 | + switch ($period) { |
|
470 | 469 | case 'years' : |
471 | 470 | $value = YEAR_IN_SECONDS * $value; |
472 | 471 | break; |
@@ -486,9 +485,9 @@ discard block |
||
486 | 485 | $value = MINUTE_IN_SECONDS * $value; |
487 | 486 | break; |
488 | 487 | } |
489 | - switch ( $operand ) { |
|
488 | + switch ($operand) { |
|
490 | 489 | case '+': |
491 | - $timestamp += $value; |
|
490 | + $timestamp += $value; |
|
492 | 491 | break; |
493 | 492 | case '-': |
494 | 493 | $timestamp -= $value; |
@@ -508,11 +507,11 @@ discard block |
||
508 | 507 | * @param string $operand What operand you wish to use for the calculation |
509 | 508 | * @return mixed string|DateTime return whatever type came in. |
510 | 509 | */ |
511 | - public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) { |
|
512 | - if ( $DateTime_or_timestamp instanceof DateTime ) { |
|
513 | - return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand ); |
|
514 | - } else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) { |
|
515 | - return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand ); |
|
510 | + public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') { |
|
511 | + if ($DateTime_or_timestamp instanceof DateTime) { |
|
512 | + return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand); |
|
513 | + } else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) { |
|
514 | + return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand); |
|
516 | 515 | } else { |
517 | 516 | //error |
518 | 517 | return $DateTime_or_timestamp; |
@@ -542,24 +541,24 @@ discard block |
||
542 | 541 | * 'moment' => //date and time format. |
543 | 542 | * ) |
544 | 543 | */ |
545 | - public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) { |
|
546 | - if ( $date_format_string === null ) { |
|
547 | - $date_format_string = get_option( 'date_format' ); |
|
544 | + public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) { |
|
545 | + if ($date_format_string === null) { |
|
546 | + $date_format_string = get_option('date_format'); |
|
548 | 547 | } |
549 | 548 | |
550 | - if ( $time_format_string === null ) { |
|
551 | - $time_format_string = get_option( 'time_format' ); |
|
549 | + if ($time_format_string === null) { |
|
550 | + $time_format_string = get_option('time_format'); |
|
552 | 551 | } |
553 | 552 | |
554 | - $date_format = self::_php_to_js_moment_converter( $date_format_string ); |
|
555 | - $time_format = self::_php_to_js_moment_converter( $time_format_string ); |
|
553 | + $date_format = self::_php_to_js_moment_converter($date_format_string); |
|
554 | + $time_format = self::_php_to_js_moment_converter($time_format_string); |
|
556 | 555 | |
557 | 556 | return array( |
558 | 557 | 'js' => array( |
559 | 558 | 'date' => $date_format['js'], |
560 | 559 | 'time' => $time_format['js'] |
561 | 560 | ), |
562 | - 'moment' => $date_format['moment'] . ' ' . $time_format['moment' ] |
|
561 | + 'moment' => $date_format['moment'].' '.$time_format['moment'] |
|
563 | 562 | ); |
564 | 563 | } |
565 | 564 | |
@@ -573,7 +572,7 @@ discard block |
||
573 | 572 | * |
574 | 573 | * @return array js and moment formats. |
575 | 574 | */ |
576 | - protected static function _php_to_js_moment_converter( $format_string ) { |
|
575 | + protected static function _php_to_js_moment_converter($format_string) { |
|
577 | 576 | /** |
578 | 577 | * This is a map of symbols for formats. |
579 | 578 | * The index is the php symbol, the equivalent values are in the array. |
@@ -730,15 +729,15 @@ discard block |
||
730 | 729 | $jquery_ui_format = ""; |
731 | 730 | $moment_format = ""; |
732 | 731 | $escaping = false; |
733 | - for ( $i = 0; $i < strlen($format_string); $i++ ) { |
|
732 | + for ($i = 0; $i < strlen($format_string); $i++) { |
|
734 | 733 | $char = $format_string[$i]; |
735 | - if ( $char === '\\' ) { // PHP date format escaping character |
|
734 | + if ($char === '\\') { // PHP date format escaping character |
|
736 | 735 | $i++; |
737 | - if ( $escaping ) { |
|
736 | + if ($escaping) { |
|
738 | 737 | $jquery_ui_format .= $format_string[$i]; |
739 | 738 | $moment_format .= $format_string[$i]; |
740 | 739 | } else { |
741 | - $jquery_ui_format .= '\'' . $format_string[$i]; |
|
740 | + $jquery_ui_format .= '\''.$format_string[$i]; |
|
742 | 741 | $moment_format .= $format_string[$i]; |
743 | 742 | } |
744 | 743 | $escaping = true; |
@@ -757,7 +756,7 @@ discard block |
||
757 | 756 | } |
758 | 757 | } |
759 | 758 | } |
760 | - return array( 'js' => $jquery_ui_format, 'moment' => $moment_format ); |
|
759 | + return array('js' => $jquery_ui_format, 'moment' => $moment_format); |
|
761 | 760 | } |
762 | 761 | |
763 | 762 | |
@@ -772,25 +771,25 @@ discard block |
||
772 | 771 | * errors is returned. So for client code calling, check for is_array() to |
773 | 772 | * indicate failed validations. |
774 | 773 | */ |
775 | - public static function validate_format_string( $format_string ) { |
|
774 | + public static function validate_format_string($format_string) { |
|
776 | 775 | $error_msg = array(); |
777 | 776 | //time format checks |
778 | - switch ( true ) { |
|
779 | - case strpos( $format_string, 'h' ) !== false : |
|
780 | - case strpos( $format_string, 'g' ) !== false : |
|
777 | + switch (true) { |
|
778 | + case strpos($format_string, 'h') !== false : |
|
779 | + case strpos($format_string, 'g') !== false : |
|
781 | 780 | /** |
782 | 781 | * if the time string has a lowercase 'h' which == 12 hour time format and there |
783 | 782 | * is not any ante meridiem format ('a' or 'A'). Then throw an error because its |
784 | 783 | * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am. |
785 | 784 | */ |
786 | - if ( strpos( strtoupper( $format_string ), 'A' ) === false ) { |
|
787 | - $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' ); |
|
785 | + if (strpos(strtoupper($format_string), 'A') === false) { |
|
786 | + $error_msg[] = __('There is a time format for 12 hour time but no "a" or "A" to indicate am/pm. Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso'); |
|
788 | 787 | } |
789 | 788 | break; |
790 | 789 | |
791 | 790 | } |
792 | 791 | |
793 | - return empty( $error_msg ) ? true : $error_msg; |
|
792 | + return empty($error_msg) ? true : $error_msg; |
|
794 | 793 | } |
795 | 794 | |
796 | 795 | |
@@ -812,11 +811,11 @@ discard block |
||
812 | 811 | * @param mixed $date_2 |
813 | 812 | * @return bool |
814 | 813 | */ |
815 | - public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) { |
|
814 | + public static function dates_represent_one_24_hour_date($date_1, $date_2) { |
|
816 | 815 | |
817 | 816 | if ( |
818 | - ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) || |
|
819 | - ( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' ) |
|
817 | + ( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) || |
|
818 | + ($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00') |
|
820 | 819 | ) { |
821 | 820 | return false; |
822 | 821 | } |
@@ -833,11 +832,11 @@ discard block |
||
833 | 832 | * @param string $field_for_interval The Database field that is the interval is applied to in the query. |
834 | 833 | * @return string |
835 | 834 | */ |
836 | - public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) { |
|
835 | + public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) { |
|
837 | 836 | try { |
838 | 837 | /** need to account for timezone offset on the selects */ |
839 | - $DateTimeZone = new DateTimeZone( $timezone_string ); |
|
840 | - } catch ( Exception $e ) { |
|
838 | + $DateTimeZone = new DateTimeZone($timezone_string); |
|
839 | + } catch (Exception $e) { |
|
841 | 840 | $DateTimeZone = null; |
842 | 841 | } |
843 | 842 | |
@@ -845,10 +844,10 @@ discard block |
||
845 | 844 | * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds. |
846 | 845 | * Hence we do the calc for DateTimeZone::getOffset. |
847 | 846 | */ |
848 | - $offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' ); |
|
847 | + $offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset'); |
|
849 | 848 | $query_interval = $offset < 0 |
850 | - ? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)' |
|
851 | - : 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)'; |
|
849 | + ? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)' |
|
850 | + : 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)'; |
|
852 | 851 | return $query_interval; |
853 | 852 | } |
854 | 853 |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * @return string |
70 | 70 | * @todo: at some point we can break this down into other static methods to abstract it a bit better. |
71 | 71 | */ |
72 | - static public function get_form_fields( $input_vars = array(), $id = FALSE ) { |
|
72 | + static public function get_form_fields($input_vars = array(), $id = FALSE) { |
|
73 | 73 | |
74 | - if ( empty($input_vars) ) { |
|
75 | - EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
74 | + if (empty($input_vars)) { |
|
75 | + EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
76 | 76 | return FALSE; |
77 | 77 | } |
78 | 78 | |
@@ -98,25 +98,25 @@ discard block |
||
98 | 98 | 'append_content' => '' |
99 | 99 | ); |
100 | 100 | |
101 | - $input_value = wp_parse_args( $input_value, $defaults ); |
|
101 | + $input_value = wp_parse_args($input_value, $defaults); |
|
102 | 102 | |
103 | 103 | // required fields get a * |
104 | 104 | $required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': '; |
105 | 105 | // and the css class "required" |
106 | - $css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : ''; |
|
107 | - $styles = $input_value['required'] ? 'required ' . $css_class : $css_class; |
|
106 | + $css_class = isset($input_value['css_class']) ? $input_value['css_class'] : ''; |
|
107 | + $styles = $input_value['required'] ? 'required '.$css_class : $css_class; |
|
108 | 108 | |
109 | - $field_id = ($id) ? $id . '-' . $input_key : $input_key; |
|
110 | - $tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : ''; |
|
109 | + $field_id = ($id) ? $id.'-'.$input_key : $input_key; |
|
110 | + $tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : ''; |
|
111 | 111 | |
112 | 112 | //rows or cols? |
113 | - $rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10'; |
|
114 | - $cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80'; |
|
113 | + $rows = isset($input_value['rows']) ? $input_value['rows'] : '10'; |
|
114 | + $cols = isset($input_value['cols']) ? $input_value['cols'] : '80'; |
|
115 | 115 | |
116 | 116 | //any content? |
117 | 117 | $append_content = $input_value['append_content']; |
118 | 118 | |
119 | - $output .= (!$close) ? '<ul>' : ''; |
|
119 | + $output .= ( ! $close) ? '<ul>' : ''; |
|
120 | 120 | $output .= '<li>'; |
121 | 121 | |
122 | 122 | // what type of input are we dealing with ? |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | |
125 | 125 | // text inputs |
126 | 126 | case 'text' : |
127 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
128 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
127 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
128 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
129 | 129 | break; |
130 | 130 | |
131 | 131 | // dropdowns |
132 | 132 | case 'select' : |
133 | 133 | |
134 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
135 | - $output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>'; |
|
134 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
135 | + $output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>'; |
|
136 | 136 | |
137 | 137 | if (is_array($input_value['options'])) { |
138 | 138 | $options = $input_value['options']; |
@@ -141,30 +141,30 @@ discard block |
||
141 | 141 | } |
142 | 142 | |
143 | 143 | foreach ($options as $key => $value) { |
144 | - $selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
144 | + $selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : ''; |
|
145 | 145 | //$key = str_replace( ' ', '_', sanitize_key( $value )); |
146 | - $output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>'; |
|
146 | + $output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>'; |
|
147 | 147 | } |
148 | - $output .= "\n\t\t\t" . '</select>'; |
|
148 | + $output .= "\n\t\t\t".'</select>'; |
|
149 | 149 | |
150 | 150 | break; |
151 | 151 | |
152 | 152 | case 'textarea' : |
153 | 153 | |
154 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
155 | - $output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>'; |
|
154 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
155 | + $output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>'; |
|
156 | 156 | break; |
157 | 157 | |
158 | 158 | case 'hidden' : |
159 | 159 | $close = false; |
160 | 160 | $output .= "</li></ul>"; |
161 | - $output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">'; |
|
161 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">'; |
|
162 | 162 | break; |
163 | 163 | |
164 | 164 | case 'checkbox' : |
165 | - $checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : ''; |
|
166 | - $output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>'; |
|
167 | - $output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />'; |
|
165 | + $checked = ($input_value['value'] == 1) ? 'checked="checked"' : ''; |
|
166 | + $output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>'; |
|
167 | + $output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />'; |
|
168 | 168 | break; |
169 | 169 | |
170 | 170 | case 'wp_editor' : |
@@ -177,19 +177,19 @@ discard block |
||
177 | 177 | ); |
178 | 178 | $output .= '</li>'; |
179 | 179 | $output .= '</ul>'; |
180 | - $output .= '<h4>' . $input_value['label'] . '</h4>'; |
|
181 | - if ( $append_content ) { |
|
180 | + $output .= '<h4>'.$input_value['label'].'</h4>'; |
|
181 | + if ($append_content) { |
|
182 | 182 | $output .= $append_content; |
183 | 183 | } |
184 | 184 | ob_start(); |
185 | - wp_editor( $input_value['value'], $field_id, $editor_settings); |
|
185 | + wp_editor($input_value['value'], $field_id, $editor_settings); |
|
186 | 186 | $editor = ob_get_contents(); |
187 | 187 | ob_end_clean(); |
188 | 188 | $output .= $editor; |
189 | 189 | break; |
190 | 190 | |
191 | 191 | } |
192 | - if ( $append_content && $input_value['input'] !== 'wp_editor' ) { |
|
192 | + if ($append_content && $input_value['input'] !== 'wp_editor') { |
|
193 | 193 | $output .= $append_content; |
194 | 194 | } |
195 | 195 | $output .= ($close) ? '</li>' : ''; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $form_fields = array(); |
231 | 231 | $fields = (array) $fields; |
232 | 232 | |
233 | - foreach ( $fields as $field_name => $field_atts ) { |
|
233 | + foreach ($fields as $field_name => $field_atts) { |
|
234 | 234 | //defaults: |
235 | 235 | $defaults = array( |
236 | 236 | 'label' => '', |
@@ -248,67 +248,67 @@ discard block |
||
248 | 248 | 'wpeditor_args' => array() |
249 | 249 | ); |
250 | 250 | // merge defaults with passed arguments |
251 | - $_fields = wp_parse_args( $field_atts, $defaults); |
|
252 | - extract( $_fields ); |
|
251 | + $_fields = wp_parse_args($field_atts, $defaults); |
|
252 | + extract($_fields); |
|
253 | 253 | // generate label |
254 | - $label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>'; |
|
254 | + $label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>'; |
|
255 | 255 | // generate field name |
256 | - $f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name; |
|
256 | + $f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name; |
|
257 | 257 | |
258 | 258 | //tabindex |
259 | - $tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : ''; |
|
259 | + $tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : ''; |
|
260 | 260 | |
261 | 261 | //we determine what we're building based on the type |
262 | - switch ( $type ) { |
|
262 | + switch ($type) { |
|
263 | 263 | |
264 | 264 | case 'textarea' : |
265 | - $fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>'; |
|
265 | + $fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>'; |
|
266 | 266 | $fld .= $extra_desc; |
267 | 267 | break; |
268 | 268 | |
269 | 269 | case 'checkbox' : |
270 | 270 | $c_input = ''; |
271 | - if ( is_array($value) ) { |
|
272 | - foreach ( $value as $key => $val ) { |
|
273 | - $c_id = $field_name . '_' . $value; |
|
274 | - $c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : ''; |
|
275 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
276 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
277 | - $c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
271 | + if (is_array($value)) { |
|
272 | + foreach ($value as $key => $val) { |
|
273 | + $c_id = $field_name.'_'.$value; |
|
274 | + $c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : ''; |
|
275 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
276 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
277 | + $c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
278 | 278 | } |
279 | 279 | $fld = $c_input; |
280 | 280 | } else { |
281 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
282 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
281 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
282 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
283 | 283 | } |
284 | 284 | break; |
285 | 285 | |
286 | 286 | case 'radio' : |
287 | 287 | $c_input = ''; |
288 | - if ( is_array($value) ) { |
|
289 | - foreach ( $value as $key => $val ) { |
|
290 | - $c_id = $field_name . '_' . $value; |
|
291 | - $c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : ''; |
|
292 | - $c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : ''; |
|
293 | - $checked = !empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
294 | - $c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label; |
|
288 | + if (is_array($value)) { |
|
289 | + foreach ($value as $key => $val) { |
|
290 | + $c_id = $field_name.'_'.$value; |
|
291 | + $c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : ''; |
|
292 | + $c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : ''; |
|
293 | + $checked = ! empty($default) && $default == $val ? ' checked="checked" ' : ''; |
|
294 | + $c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label; |
|
295 | 295 | } |
296 | 296 | $fld = $c_input; |
297 | 297 | } else { |
298 | - $checked = !empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
299 | - $fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n"; |
|
298 | + $checked = ! empty($default) && $default == $val ? 'checked="checked" ' : ''; |
|
299 | + $fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n"; |
|
300 | 300 | } |
301 | 301 | break; |
302 | 302 | |
303 | 303 | case 'hidden' : |
304 | - $fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n"; |
|
304 | + $fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n"; |
|
305 | 305 | break; |
306 | 306 | |
307 | 307 | case 'select' : |
308 | - $fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n"; |
|
309 | - foreach ( $value as $key => $val ) { |
|
310 | - $checked = !empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
311 | - $fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n"; |
|
308 | + $fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n"; |
|
309 | + foreach ($value as $key => $val) { |
|
310 | + $checked = ! empty($default) && $default == $val ? ' selected="selected"' : ''; |
|
311 | + $fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n"; |
|
312 | 312 | } |
313 | 313 | $fld .= '</select>'; |
314 | 314 | break; |
@@ -320,21 +320,21 @@ discard block |
||
320 | 320 | 'editor_class' => $class, |
321 | 321 | 'tabindex' => $tabindex |
322 | 322 | ); |
323 | - $editor_settings = array_merge( $wpeditor_args, $editor_settings ); |
|
323 | + $editor_settings = array_merge($wpeditor_args, $editor_settings); |
|
324 | 324 | ob_start(); |
325 | - wp_editor( $value, $id, $editor_settings ); |
|
325 | + wp_editor($value, $id, $editor_settings); |
|
326 | 326 | $editor = ob_get_contents(); |
327 | 327 | ob_end_clean(); |
328 | 328 | $fld = $editor; |
329 | 329 | break; |
330 | 330 | |
331 | 331 | default : //'text fields' |
332 | - $fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n"; |
|
332 | + $fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n"; |
|
333 | 333 | $fld .= $extra_desc; |
334 | 334 | |
335 | 335 | } |
336 | 336 | |
337 | - $form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld ); |
|
337 | + $form_fields[$field_name] = array('label' => $label, 'field' => $fld); |
|
338 | 338 | } |
339 | 339 | |
340 | 340 | return $form_fields; |
@@ -363,22 +363,22 @@ discard block |
||
363 | 363 | */ |
364 | 364 | static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) { |
365 | 365 | //if $values was submitted in the wrong format, convert it over |
366 | - if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){ |
|
367 | - $converted_values=array(); |
|
368 | - foreach($values as $id=>$text){ |
|
369 | - $converted_values[]=array('id'=>$id,'text'=>$text); |
|
366 | + if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) { |
|
367 | + $converted_values = array(); |
|
368 | + foreach ($values as $id=>$text) { |
|
369 | + $converted_values[] = array('id'=>$id, 'text'=>$text); |
|
370 | 370 | } |
371 | - $values=$converted_values; |
|
371 | + $values = $converted_values; |
|
372 | 372 | } |
373 | 373 | //load formatter helper |
374 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
374 | + EE_Registry::instance()->load_helper('Formatter'); |
|
375 | 375 | //EE_Registry::instance()->load_helper( 'Formatter' ); |
376 | 376 | |
377 | - $field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"'; |
|
377 | + $field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"'; |
|
378 | 378 | //Debug |
379 | 379 | //EEH_Debug_Tools::printr( $values, '$values <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
380 | - if ( EEH_Formatter::ee_tep_not_null($parameters)) |
|
381 | - $field .= ' ' . $parameters; |
|
380 | + if (EEH_Formatter::ee_tep_not_null($parameters)) |
|
381 | + $field .= ' '.$parameters; |
|
382 | 382 | if ($autosize) { |
383 | 383 | $size = 'med'; |
384 | 384 | for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) { |
@@ -391,21 +391,21 @@ discard block |
||
391 | 391 | $size = ''; |
392 | 392 | } |
393 | 393 | |
394 | - $field .= ' class="' . $class . ' ' . $size . '">'; |
|
394 | + $field .= ' class="'.$class.' '.$size.'">'; |
|
395 | 395 | |
396 | 396 | if (empty($default) && isset($GLOBALS[$name])) |
397 | 397 | $default = stripslashes($GLOBALS[$name]); |
398 | 398 | |
399 | 399 | |
400 | 400 | for ($i = 0, $n = sizeof($values); $i < $n; $i++) { |
401 | - $field .= '<option value="' . $values[$i]['id'] . '"'; |
|
401 | + $field .= '<option value="'.$values[$i]['id'].'"'; |
|
402 | 402 | if ($default == $values[$i]['id']) { |
403 | 403 | $field .= ' selected = "selected"'; |
404 | 404 | } |
405 | - if ( isset( $values[$i]['class'] ) ) { |
|
406 | - $field .= ' class="' . $values[$i]['class'] . '"'; |
|
405 | + if (isset($values[$i]['class'])) { |
|
406 | + $field .= ' class="'.$values[$i]['class'].'"'; |
|
407 | 407 | } |
408 | - $field .= '>' . $values[$i]['text'] . '</option>'; |
|
408 | + $field .= '>'.$values[$i]['text'].'</option>'; |
|
409 | 409 | } |
410 | 410 | $field .= '</select>'; |
411 | 411 | |
@@ -423,38 +423,38 @@ discard block |
||
423 | 423 | * @param string $question_groups |
424 | 424 | * @return string HTML |
425 | 425 | */ |
426 | - static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) { |
|
426 | + static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') { |
|
427 | 427 | |
428 | 428 | $html = ''; |
429 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
430 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
429 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
430 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
431 | 431 | |
432 | - if ( ! empty( $question_groups )) { |
|
432 | + if ( ! empty($question_groups)) { |
|
433 | 433 | //EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
434 | 434 | // loop thru question groups |
435 | - foreach ( $question_groups as $QSG ) { |
|
435 | + foreach ($question_groups as $QSG) { |
|
436 | 436 | // check that questions exist |
437 | - if ( ! empty( $QSG['QSG_questions'] )) { |
|
437 | + if ( ! empty($QSG['QSG_questions'])) { |
|
438 | 438 | // use fieldsets |
439 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">'; |
|
439 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">'; |
|
440 | 440 | // group_name |
441 | - $html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : ''; |
|
441 | + $html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : ''; |
|
442 | 442 | // group_desc |
443 | - $html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : ''; |
|
443 | + $html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : ''; |
|
444 | 444 | |
445 | 445 | $html .= $before_question_group_questions; |
446 | 446 | // loop thru questions |
447 | - foreach ( $QSG['QSG_questions'] as $question ) { |
|
447 | + foreach ($QSG['QSG_questions'] as $question) { |
|
448 | 448 | // EEH_Debug_Tools::printr( $question, '$question <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
449 | 449 | $QFI = new EE_Question_Form_Input( |
450 | 450 | $question['qst_obj'], |
451 | 451 | $question['ans_obj'], |
452 | 452 | $question |
453 | 453 | ); |
454 | - $html .= self::generate_form_input( $QFI ); |
|
454 | + $html .= self::generate_form_input($QFI); |
|
455 | 455 | } |
456 | 456 | $html .= $after_question_group_questions; |
457 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
457 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
458 | 458 | } |
459 | 459 | } |
460 | 460 | } |
@@ -474,11 +474,11 @@ discard block |
||
474 | 474 | * @param string $group_wrapper |
475 | 475 | * @return string HTML |
476 | 476 | */ |
477 | - static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset' ) { |
|
477 | + static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') { |
|
478 | 478 | |
479 | 479 | $html = ''; |
480 | - $before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' ); |
|
481 | - $after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' ); |
|
480 | + $before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', ''); |
|
481 | + $after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', ''); |
|
482 | 482 | |
483 | 483 | $default_q_meta = array( |
484 | 484 | 'att_nmbr' => 1, |
@@ -487,55 +487,55 @@ discard block |
||
487 | 487 | 'input_id' => '', |
488 | 488 | 'input_class' => '' |
489 | 489 | ); |
490 | - $q_meta = array_merge( $default_q_meta, $q_meta ); |
|
490 | + $q_meta = array_merge($default_q_meta, $q_meta); |
|
491 | 491 | //EEH_Debug_Tools::printr( $q_meta, '$q_meta <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
492 | 492 | |
493 | - if ( ! empty( $question_groups )) { |
|
493 | + if ( ! empty($question_groups)) { |
|
494 | 494 | // EEH_Debug_Tools::printr( $question_groups, '$question_groups <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
495 | 495 | // loop thru question groups |
496 | - foreach ( $question_groups as $QSG ) { |
|
497 | - if ( $QSG instanceof EE_Question_Group ) { |
|
496 | + foreach ($question_groups as $QSG) { |
|
497 | + if ($QSG instanceof EE_Question_Group) { |
|
498 | 498 | // check that questions exist |
499 | 499 | |
500 | - $where = array( 'QST_deleted' => 0 ); |
|
501 | - if ( ! $from_admin ) { |
|
500 | + $where = array('QST_deleted' => 0); |
|
501 | + if ( ! $from_admin) { |
|
502 | 502 | $where['QST_admin_only'] = 0; |
503 | 503 | } |
504 | - $questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ))); |
|
505 | - if ( ! empty( $questions )) { |
|
504 | + $questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC'))); |
|
505 | + if ( ! empty($questions)) { |
|
506 | 506 | // use fieldsets |
507 | - $html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">'; |
|
507 | + $html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">'; |
|
508 | 508 | // group_name |
509 | - if ( $QSG->show_group_name() ) { |
|
510 | - $html .= "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>'; |
|
509 | + if ($QSG->show_group_name()) { |
|
510 | + $html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>'; |
|
511 | 511 | } |
512 | 512 | // group_desc |
513 | - if ( $QSG->show_group_desc() ) { |
|
514 | - $html .= '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc' ) . '</div>'; |
|
513 | + if ($QSG->show_group_desc()) { |
|
514 | + $html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>'; |
|
515 | 515 | } |
516 | 516 | |
517 | 517 | $html .= $before_question_group_questions; |
518 | 518 | // loop thru questions |
519 | - foreach ( $questions as $QST ) { |
|
519 | + foreach ($questions as $QST) { |
|
520 | 520 | $qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID(); |
521 | 521 | |
522 | 522 | $answer = NULL; |
523 | 523 | |
524 | - if ( isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) { |
|
524 | + if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) { |
|
525 | 525 | // check for answer in $_GET in case we are reprocessing a form after an error |
526 | - if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) { |
|
527 | - $answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ); |
|
526 | + if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) { |
|
527 | + $answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]); |
|
528 | 528 | } |
529 | - } else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) { |
|
529 | + } else if (isset($q_meta['attendee']) && $q_meta['attendee']) { |
|
530 | 530 | //attendee data from the session |
531 | - $answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL; |
|
531 | + $answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
535 | 535 | |
536 | 536 | $QFI = new EE_Question_Form_Input( |
537 | 537 | $QST, |
538 | - EE_Answer::new_instance ( array( |
|
538 | + EE_Answer::new_instance(array( |
|
539 | 539 | 'ANS_ID'=> 0, |
540 | 540 | 'QST_ID'=> 0, |
541 | 541 | 'REG_ID'=> 0, |
@@ -544,10 +544,10 @@ discard block |
||
544 | 544 | $q_meta |
545 | 545 | ); |
546 | 546 | //EEH_Debug_Tools::printr( $QFI, '$QFI <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); |
547 | - $html .= self::generate_form_input( $QFI ); |
|
547 | + $html .= self::generate_form_input($QFI); |
|
548 | 548 | } |
549 | 549 | $html .= $after_question_group_questions; |
550 | - $html .= "\n\t" . '</' . $group_wrapper . '>'; |
|
550 | + $html .= "\n\t".'</'.$group_wrapper.'>'; |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
@@ -567,63 +567,63 @@ discard block |
||
567 | 567 | * @param EE_Question_Form_Input $QFI |
568 | 568 | * @return string HTML |
569 | 569 | */ |
570 | - static function generate_form_input( EE_Question_Form_Input $QFI ) { |
|
571 | - if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) { |
|
570 | + static function generate_form_input(EE_Question_Form_Input $QFI) { |
|
571 | + if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) { |
|
572 | 572 | return ''; |
573 | 573 | } |
574 | 574 | |
575 | - $QFI = self::_load_system_dropdowns( $QFI ); |
|
576 | - $QFI = self::_load_specialized_dropdowns( $QFI ); |
|
575 | + $QFI = self::_load_system_dropdowns($QFI); |
|
576 | + $QFI = self::_load_specialized_dropdowns($QFI); |
|
577 | 577 | |
578 | 578 | //we also need to verify |
579 | 579 | |
580 | 580 | $display_text = $QFI->get('QST_display_text'); |
581 | 581 | $input_name = $QFI->get('QST_input_name'); |
582 | - $answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value'); |
|
582 | + $answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value'); |
|
583 | 583 | $input_id = $QFI->get('QST_input_id'); |
584 | 584 | $input_class = $QFI->get('QST_input_class'); |
585 | 585 | // $disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : ''; |
586 | 586 | $disabled = $QFI->get('QST_disabled') ? TRUE : FALSE; |
587 | - $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' ); |
|
587 | + $required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>'); |
|
588 | 588 | $QST_required = $QFI->get('QST_required'); |
589 | - $required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array(); |
|
590 | - $use_html_entities = $QFI->get_meta( 'htmlentities' ); |
|
591 | - $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' ); |
|
592 | - $required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : ''; |
|
589 | + $required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array(); |
|
590 | + $use_html_entities = $QFI->get_meta('htmlentities'); |
|
591 | + $required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso'); |
|
592 | + $required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : ''; |
|
593 | 593 | $label_class = 'espresso-form-input-lbl'; |
594 | - $QST_options = $QFI->options(true,$answer); |
|
595 | - $options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array(); |
|
594 | + $QST_options = $QFI->options(true, $answer); |
|
595 | + $options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array(); |
|
596 | 596 | $system_ID = $QFI->get('QST_system'); |
597 | - $label_b4 = $QFI->get_meta( 'label_b4' ); |
|
598 | - $use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' ); |
|
597 | + $label_b4 = $QFI->get_meta('label_b4'); |
|
598 | + $use_desc_4_label = $QFI->get_meta('use_desc_4_label'); |
|
599 | 599 | |
600 | 600 | |
601 | - switch ( $QFI->get('QST_type') ){ |
|
601 | + switch ($QFI->get('QST_type')) { |
|
602 | 602 | |
603 | 603 | case 'TEXTAREA' : |
604 | - return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
604 | + return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
605 | 605 | break; |
606 | 606 | |
607 | 607 | case 'DROPDOWN' : |
608 | - return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE ); |
|
608 | + return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE); |
|
609 | 609 | break; |
610 | 610 | |
611 | 611 | |
612 | 612 | case 'RADIO_BTN' : |
613 | - return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label ); |
|
613 | + return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label); |
|
614 | 614 | break; |
615 | 615 | |
616 | 616 | case 'CHECKBOX' : |
617 | - return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities ); |
|
617 | + return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $label_b4, $system_ID, $use_html_entities); |
|
618 | 618 | break; |
619 | 619 | |
620 | 620 | case 'DATE' : |
621 | - return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
621 | + return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
622 | 622 | break; |
623 | 623 | |
624 | 624 | case 'TEXT' : |
625 | 625 | default: |
626 | - return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities ); |
|
626 | + return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities); |
|
627 | 627 | break; |
628 | 628 | |
629 | 629 | } |
@@ -649,31 +649,31 @@ discard block |
||
649 | 649 | * @param string $disabled disabled="disabled" or null |
650 | 650 | * @return string HTML |
651 | 651 | */ |
652 | - static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
652 | + static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
653 | 653 | // need these |
654 | - if ( ! $question || ! $name ) { |
|
654 | + if ( ! $question || ! $name) { |
|
655 | 655 | return NULL; |
656 | 656 | } |
657 | 657 | // prep the answer |
658 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
658 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
659 | 659 | // prep the required array |
660 | - $required = self::prep_required( $required ); |
|
660 | + $required = self::prep_required($required); |
|
661 | 661 | // set disabled tag |
662 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
662 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
663 | 663 | // ya gots ta have style man!!! |
664 | 664 | $txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp'; |
665 | - $class = empty( $class ) ? $txt_class : $class; |
|
666 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
667 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
665 | + $class = empty($class) ? $txt_class : $class; |
|
666 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
667 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
668 | 668 | |
669 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
669 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
670 | 670 | // filter label but ensure required text comes before it |
671 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
671 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
672 | 672 | |
673 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . esc_attr( $answer ) . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>'; |
|
673 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.esc_attr($answer).'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
674 | 674 | |
675 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
676 | - return $label_html . $input_html; |
|
675 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
676 | + return $label_html.$input_html; |
|
677 | 677 | |
678 | 678 | } |
679 | 679 | |
@@ -695,35 +695,35 @@ discard block |
||
695 | 695 | * @param string $disabled disabled="disabled" or null |
696 | 696 | * @return string HTML |
697 | 697 | */ |
698 | - static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
698 | + static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
699 | 699 | // need these |
700 | - if ( ! $question || ! $name ) { |
|
700 | + if ( ! $question || ! $name) { |
|
701 | 701 | return NULL; |
702 | 702 | } |
703 | 703 | // prep the answer |
704 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
704 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
705 | 705 | // prep the required array |
706 | - $required = self::prep_required( $required ); |
|
706 | + $required = self::prep_required($required); |
|
707 | 707 | // make sure $dimensions is an array |
708 | - $dimensions = is_array( $dimensions ) ? $dimensions : array(); |
|
708 | + $dimensions = is_array($dimensions) ? $dimensions : array(); |
|
709 | 709 | // and set some defaults |
710 | - $dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions ); |
|
710 | + $dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions); |
|
711 | 711 | // set disabled tag |
712 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
712 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
713 | 713 | // ya gots ta have style man!!! |
714 | 714 | $txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp'; |
715 | - $class = empty( $class ) ? $txt_class : $class; |
|
716 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
717 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
715 | + $class = empty($class) ? $txt_class : $class; |
|
716 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
717 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
718 | 718 | |
719 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
719 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
720 | 720 | // filter label but ensure required text comes before it |
721 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
721 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
722 | 722 | |
723 | - $input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '" title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>'; |
|
723 | + $input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'" title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>'; |
|
724 | 724 | |
725 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
726 | - return $label_html . $input_html; |
|
725 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
726 | + return $label_html.$input_html; |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | |
@@ -746,47 +746,47 @@ discard block |
||
746 | 746 | * @param string $disabled disabled="disabled" or null |
747 | 747 | * @return string HTML |
748 | 748 | */ |
749 | - static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) { |
|
749 | + static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) { |
|
750 | 750 | |
751 | 751 | // need these |
752 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
752 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
753 | 753 | return NULL; |
754 | 754 | } |
755 | 755 | // prep the answer |
756 | - $answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer ), $use_html_entities) : self::prep_answer( $answer, $use_html_entities ); |
|
756 | + $answer = is_array($answer) ? self::prep_answer(array_shift($answer), $use_html_entities) : self::prep_answer($answer, $use_html_entities); |
|
757 | 757 | // prep the required array |
758 | - $required = self::prep_required( $required ); |
|
758 | + $required = self::prep_required($required); |
|
759 | 759 | // set disabled tag |
760 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
760 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
761 | 761 | // ya gots ta have style man!!! |
762 | 762 | $txt_class = is_admin() ? 'wide' : 'espresso-select-inp'; |
763 | - $class = empty( $class ) ? $txt_class : $class; |
|
764 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
765 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
763 | + $class = empty($class) ? $txt_class : $class; |
|
764 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
765 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
766 | 766 | |
767 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
767 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
768 | 768 | // filter label but ensure required text comes before it |
769 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
769 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
770 | 770 | |
771 | - $input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>'; |
|
771 | + $input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>'; |
|
772 | 772 | // recursively count array elements, to determine total number of options |
773 | - $only_option = count( $options, 1 ) == 1 ? TRUE : FALSE; |
|
774 | - if ( ! $only_option ) { |
|
773 | + $only_option = count($options, 1) == 1 ? TRUE : FALSE; |
|
774 | + if ( ! $only_option) { |
|
775 | 775 | // if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected |
776 | 776 | $selected = $answer === NULL ? ' selected="selected"' : ''; |
777 | - $input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : ''; |
|
777 | + $input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : ''; |
|
778 | 778 | } |
779 | - foreach ( $options as $key => $value ) { |
|
779 | + foreach ($options as $key => $value) { |
|
780 | 780 | // if value is an array, then create option groups, else create regular ol' options |
781 | - $input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer, $use_html_entities ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option, $use_html_entities ); |
|
781 | + $input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer, $use_html_entities) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option, $use_html_entities); |
|
782 | 782 | } |
783 | 783 | |
784 | - $input_html .= "\n\t\t\t" . '</select>'; |
|
784 | + $input_html .= "\n\t\t\t".'</select>'; |
|
785 | 785 | |
786 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID ); |
|
786 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID); |
|
787 | 787 | |
788 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
789 | - return $label_html . $input_html; |
|
788 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
789 | + return $label_html.$input_html; |
|
790 | 790 | |
791 | 791 | } |
792 | 792 | |
@@ -804,12 +804,12 @@ discard block |
||
804 | 804 | * @param boolean $use_html_entities |
805 | 805 | * @return string |
806 | 806 | */ |
807 | - private static function _generate_select_option_group( $opt_group, $QSOs, $answer, $use_html_entities = true ){ |
|
808 | - $html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">'; |
|
809 | - foreach ( $QSOs as $QSO ) { |
|
810 | - $html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer, false, $use_html_entities ); |
|
807 | + private static function _generate_select_option_group($opt_group, $QSOs, $answer, $use_html_entities = true) { |
|
808 | + $html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">'; |
|
809 | + foreach ($QSOs as $QSO) { |
|
810 | + $html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer, false, $use_html_entities); |
|
811 | 811 | } |
812 | - $html .= "\n\t\t\t\t" . '</optgroup>'; |
|
812 | + $html .= "\n\t\t\t\t".'</optgroup>'; |
|
813 | 813 | return $html; |
814 | 814 | } |
815 | 815 | |
@@ -824,12 +824,12 @@ discard block |
||
824 | 824 | * @param boolean $use_html_entities |
825 | 825 | * @return string |
826 | 826 | */ |
827 | - private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE, $use_html_entities = true ){ |
|
828 | - $key = self::prep_answer( $key, $use_html_entities ); |
|
829 | - $value = self::prep_answer( $value, $use_html_entities ); |
|
830 | - $value = ! empty( $value ) ? $value : $key; |
|
831 | - $selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : ''; |
|
832 | - return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . ' </option>'; |
|
827 | + private static function _generate_select_option($key, $value, $answer, $only_option = FALSE, $use_html_entities = true) { |
|
828 | + $key = self::prep_answer($key, $use_html_entities); |
|
829 | + $value = self::prep_answer($value, $use_html_entities); |
|
830 | + $value = ! empty($value) ? $value : $key; |
|
831 | + $selected = ($answer == $key || $only_option) ? ' selected="selected"' : ''; |
|
832 | + return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.' </option>'; |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | |
@@ -853,56 +853,56 @@ discard block |
||
853 | 853 | * @param bool $use_desc_4_label |
854 | 854 | * @return string HTML |
855 | 855 | */ |
856 | - static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) { |
|
856 | + static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) { |
|
857 | 857 | // need these |
858 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
858 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
859 | 859 | return NULL; |
860 | 860 | } |
861 | 861 | // prep the answer |
862 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
862 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
863 | 863 | // prep the required array |
864 | - $required = self::prep_required( $required ); |
|
864 | + $required = self::prep_required($required); |
|
865 | 865 | // set disabled tag |
866 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
866 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
867 | 867 | // ya gots ta have style man!!! |
868 | 868 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
869 | - $class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp'; |
|
870 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
869 | + $class = ! empty($class) ? $class : 'espresso-radio-btn-inp'; |
|
870 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
871 | 871 | |
872 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
872 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
873 | 873 | // filter label but ensure required text comes before it |
874 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
874 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
875 | 875 | |
876 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
876 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">'; |
|
877 | 877 | |
878 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
879 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
878 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
879 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
880 | 880 | |
881 | - foreach ( $options as $OPT ) { |
|
882 | - if ( $OPT instanceof EE_Question_Option ) { |
|
883 | - $value = self::prep_option_value( $OPT->value() ); |
|
881 | + foreach ($options as $OPT) { |
|
882 | + if ($OPT instanceof EE_Question_Option) { |
|
883 | + $value = self::prep_option_value($OPT->value()); |
|
884 | 884 | $label = $use_desc_4_label ? $OPT->desc() : $OPT->value(); |
885 | - $size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() ); |
|
886 | - $desc = $OPT->desc();//no self::prep_answer |
|
887 | - $answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer; |
|
888 | - $checked = (string)$value == (string)$answer ? ' checked="checked"' : ''; |
|
889 | - $opt = '-' . sanitize_key( $value ); |
|
890 | - |
|
891 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
892 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">'; |
|
893 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : ''; |
|
894 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
895 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : ''; |
|
896 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
897 | - $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>'; |
|
898 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
885 | + $size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value()); |
|
886 | + $desc = $OPT->desc(); //no self::prep_answer |
|
887 | + $answer = is_numeric($value) && empty($answer) ? 0 : $answer; |
|
888 | + $checked = (string) $value == (string) $answer ? ' checked="checked"' : ''; |
|
889 | + $opt = '-'.sanitize_key($value); |
|
890 | + |
|
891 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
892 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">'; |
|
893 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : ''; |
|
894 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
895 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : ''; |
|
896 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
897 | + $input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>'; |
|
898 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
899 | 899 | } |
900 | 900 | } |
901 | 901 | |
902 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
902 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
903 | 903 | |
904 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
905 | - return $label_html . $input_html; |
|
904 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
905 | + return $label_html.$input_html; |
|
906 | 906 | |
907 | 907 | } |
908 | 908 | |
@@ -925,65 +925,65 @@ discard block |
||
925 | 925 | * @param string $disabled disabled="disabled" or null |
926 | 926 | * @return string HTML |
927 | 927 | */ |
928 | - static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
928 | + static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
929 | 929 | // need these |
930 | - if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) { |
|
930 | + if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) { |
|
931 | 931 | return NULL; |
932 | 932 | } |
933 | - $answer = maybe_unserialize( $answer ); |
|
933 | + $answer = maybe_unserialize($answer); |
|
934 | 934 | |
935 | 935 | // prep the answer(s) |
936 | - $answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer ); |
|
936 | + $answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer); |
|
937 | 937 | |
938 | - foreach ( $answer as $key => $value ) { |
|
939 | - $key = self::prep_option_value( $key ); |
|
940 | - $answer[$key] = self::prep_answer( $value, $use_html_entities ); |
|
938 | + foreach ($answer as $key => $value) { |
|
939 | + $key = self::prep_option_value($key); |
|
940 | + $answer[$key] = self::prep_answer($value, $use_html_entities); |
|
941 | 941 | } |
942 | 942 | |
943 | 943 | // prep the required array |
944 | - $required = self::prep_required( $required ); |
|
944 | + $required = self::prep_required($required); |
|
945 | 945 | // set disabled tag |
946 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
946 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
947 | 947 | // ya gots ta have style man!!! |
948 | 948 | $radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class; |
949 | - $class = empty( $class ) ? 'espresso-radio-btn-inp' : $class; |
|
950 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
949 | + $class = empty($class) ? 'espresso-radio-btn-inp' : $class; |
|
950 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
951 | 951 | |
952 | - $label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> '; |
|
952 | + $label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> '; |
|
953 | 953 | // filter label but ensure required text comes before it |
954 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
955 | - |
|
956 | - $input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">'; |
|
957 | - |
|
958 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
959 | - $class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : ''; |
|
960 | - |
|
961 | - foreach ( $options as $OPT ) { |
|
962 | - $value = $OPT->value();//self::prep_option_value( $OPT->value() ); |
|
963 | - $size = self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ); |
|
964 | - $text = self::prep_answer( $OPT->value() ); |
|
965 | - $desc = $OPT->desc() ; |
|
966 | - $opt = '-' . sanitize_key( $value ); |
|
967 | - |
|
968 | - $checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : ''; |
|
969 | - |
|
970 | - $input_html .= "\n\t\t\t\t" . '<li' . $size . '>'; |
|
971 | - $input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">'; |
|
972 | - $input_html .= $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
973 | - $input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>'; |
|
974 | - $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : ''; |
|
975 | - $input_html .= "\n\t\t\t\t\t" . '</label>'; |
|
976 | - if ( ! empty( $desc ) && $desc != $text ) { |
|
977 | - $input_html .= "\n\t\t\t\t\t" . ' <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>'; |
|
954 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
955 | + |
|
956 | + $input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">'; |
|
957 | + |
|
958 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
959 | + $class .= ! empty($required['class']) ? ' '.$required['class'] : ''; |
|
960 | + |
|
961 | + foreach ($options as $OPT) { |
|
962 | + $value = $OPT->value(); //self::prep_option_value( $OPT->value() ); |
|
963 | + $size = self::get_label_size_class($OPT->value().' '.$OPT->desc()); |
|
964 | + $text = self::prep_answer($OPT->value()); |
|
965 | + $desc = $OPT->desc(); |
|
966 | + $opt = '-'.sanitize_key($value); |
|
967 | + |
|
968 | + $checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : ''; |
|
969 | + |
|
970 | + $input_html .= "\n\t\t\t\t".'<li'.$size.'>'; |
|
971 | + $input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">'; |
|
972 | + $input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
973 | + $input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>'; |
|
974 | + $input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : ''; |
|
975 | + $input_html .= "\n\t\t\t\t\t".'</label>'; |
|
976 | + if ( ! empty($desc) && $desc != $text) { |
|
977 | + $input_html .= "\n\t\t\t\t\t".' <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>'; |
|
978 | 978 | } |
979 | - $input_html .= "\n\t\t\t\t" . '</li>'; |
|
979 | + $input_html .= "\n\t\t\t\t".'</li>'; |
|
980 | 980 | |
981 | 981 | } |
982 | 982 | |
983 | - $input_html .= "\n\t\t\t" . '</ul>'; |
|
983 | + $input_html .= "\n\t\t\t".'</ul>'; |
|
984 | 984 | |
985 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
986 | - return $label_html . $input_html; |
|
985 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
986 | + return $label_html.$input_html; |
|
987 | 987 | |
988 | 988 | } |
989 | 989 | |
@@ -1005,36 +1005,36 @@ discard block |
||
1005 | 1005 | * @param string $disabled disabled="disabled" or null |
1006 | 1006 | * @return string HTML |
1007 | 1007 | */ |
1008 | - static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) { |
|
1008 | + static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) { |
|
1009 | 1009 | // need these |
1010 | - if ( ! $question || ! $name ) { |
|
1010 | + if ( ! $question || ! $name) { |
|
1011 | 1011 | return NULL; |
1012 | 1012 | } |
1013 | 1013 | // prep the answer |
1014 | - $answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities ); |
|
1014 | + $answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities); |
|
1015 | 1015 | // prep the required array |
1016 | - $required = self::prep_required( $required ); |
|
1016 | + $required = self::prep_required($required); |
|
1017 | 1017 | // set disabled tag |
1018 | - $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1018 | + $disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"'; |
|
1019 | 1019 | // ya gots ta have style man!!! |
1020 | 1020 | $txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp'; |
1021 | - $class = empty( $class ) ? $txt_class : $class; |
|
1022 | - $class .= ! empty( $system_ID ) ? ' ' . $system_ID : ''; |
|
1023 | - $extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' ); |
|
1021 | + $class = empty($class) ? $txt_class : $class; |
|
1022 | + $class .= ! empty($system_ID) ? ' '.$system_ID : ''; |
|
1023 | + $extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', ''); |
|
1024 | 1024 | |
1025 | - $label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>'; |
|
1025 | + $label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>'; |
|
1026 | 1026 | // filter label but ensure required text comes before it |
1027 | - $label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text ); |
|
1027 | + $label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text); |
|
1028 | 1028 | |
1029 | - $input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>'; |
|
1029 | + $input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'" title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>'; |
|
1030 | 1030 | |
1031 | 1031 | // enqueue scripts |
1032 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION ); |
|
1033 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
1034 | - wp_enqueue_script( 'jquery-ui-datepicker' ); |
|
1032 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION); |
|
1033 | + wp_enqueue_style('espresso-ui-theme'); |
|
1034 | + wp_enqueue_script('jquery-ui-datepicker'); |
|
1035 | 1035 | |
1036 | - $input_html = apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id ); |
|
1037 | - return $label_html . $input_html; |
|
1036 | + $input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id); |
|
1037 | + return $label_html.$input_html; |
|
1038 | 1038 | |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | * @access public |
1047 | 1047 | * @return string |
1048 | 1048 | */ |
1049 | - public static function remove_label_keep_required_msg( $label_html, $required_text ) { |
|
1049 | + public static function remove_label_keep_required_msg($label_html, $required_text) { |
|
1050 | 1050 | return $required_text; |
1051 | 1051 | } |
1052 | 1052 | |
@@ -1060,9 +1060,9 @@ discard block |
||
1060 | 1060 | * @param string $value |
1061 | 1061 | * @return string HTML |
1062 | 1062 | */ |
1063 | - static function hidden_input( $name, $value, $id = '' ){ |
|
1064 | - $id = ! empty( $id ) ? $id : $name; |
|
1065 | - return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' . $value . '"/>'; |
|
1063 | + static function hidden_input($name, $value, $id = '') { |
|
1064 | + $id = ! empty($id) ? $id : $name; |
|
1065 | + return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>'; |
|
1066 | 1066 | } |
1067 | 1067 | |
1068 | 1068 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | * @param string $question |
1075 | 1075 | * @return string |
1076 | 1076 | */ |
1077 | - static function prep_question( $question ){ |
|
1077 | + static function prep_question($question) { |
|
1078 | 1078 | return $question; |
1079 | 1079 | // $link = ''; |
1080 | 1080 | // // does this label have a help link attached ? |
@@ -1097,13 +1097,13 @@ discard block |
||
1097 | 1097 | * @param mixed $answer |
1098 | 1098 | * @return string |
1099 | 1099 | */ |
1100 | - static function prep_answer( $answer, $use_html_entities = TRUE ){ |
|
1100 | + static function prep_answer($answer, $use_html_entities = TRUE) { |
|
1101 | 1101 | //make sure we convert bools first. Otherwise (bool) false becomes an empty string which is NOT desired, we want "0". |
1102 | - if ( is_bool( $answer ) ) { |
|
1102 | + if (is_bool($answer)) { |
|
1103 | 1103 | $answer = $answer ? 1 : 0; |
1104 | 1104 | } |
1105 | - $answer = trim( stripslashes( str_replace( ''', "'", $answer ))); |
|
1106 | - return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer; |
|
1105 | + $answer = trim(stripslashes(str_replace(''', "'", $answer))); |
|
1106 | + return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer; |
|
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | |
@@ -1113,18 +1113,18 @@ discard block |
||
1113 | 1113 | * @param array $QSOs array of EE_Question_Option objects |
1114 | 1114 | * @return array |
1115 | 1115 | */ |
1116 | - public static function prep_answer_options( $QSOs = array() ){ |
|
1116 | + public static function prep_answer_options($QSOs = array()) { |
|
1117 | 1117 | $prepped_answer_options = array(); |
1118 | - if ( is_array( $QSOs ) && ! empty( $QSOs )) { |
|
1119 | - foreach( $QSOs as $key => $QSO ) { |
|
1120 | - if ( ! $QSO instanceof EE_Question_Option ) { |
|
1121 | - $QSO = EE_Question_Option::new_instance( array( |
|
1122 | - 'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key, |
|
1123 | - 'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO |
|
1118 | + if (is_array($QSOs) && ! empty($QSOs)) { |
|
1119 | + foreach ($QSOs as $key => $QSO) { |
|
1120 | + if ( ! $QSO instanceof EE_Question_Option) { |
|
1121 | + $QSO = EE_Question_Option::new_instance(array( |
|
1122 | + 'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key, |
|
1123 | + 'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO |
|
1124 | 1124 | )); |
1125 | 1125 | } |
1126 | - if ( $QSO->opt_group() ) { |
|
1127 | - $prepped_answer_options[ $QSO->opt_group() ][] = $QSO; |
|
1126 | + if ($QSO->opt_group()) { |
|
1127 | + $prepped_answer_options[$QSO->opt_group()][] = $QSO; |
|
1128 | 1128 | } else { |
1129 | 1129 | $prepped_answer_options[] = $QSO; |
1130 | 1130 | } |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | * @param string $option_value |
1141 | 1141 | * @return string |
1142 | 1142 | */ |
1143 | - static function prep_option_value( $option_value ){ |
|
1144 | - return esc_attr( trim( stripslashes( $option_value ) ) ); |
|
1143 | + static function prep_option_value($option_value) { |
|
1144 | + return esc_attr(trim(stripslashes($option_value))); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | |
@@ -1152,11 +1152,11 @@ discard block |
||
1152 | 1152 | * @param string|array $required |
1153 | 1153 | * @return array |
1154 | 1154 | */ |
1155 | - static function prep_required( $required = array() ){ |
|
1155 | + static function prep_required($required = array()) { |
|
1156 | 1156 | // make sure required is an array |
1157 | - $required = is_array( $required ) ? $required : array(); |
|
1157 | + $required = is_array($required) ? $required : array(); |
|
1158 | 1158 | // and set some defaults |
1159 | - $required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required ); |
|
1159 | + $required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required); |
|
1160 | 1160 | return $required; |
1161 | 1161 | } |
1162 | 1162 | |
@@ -1167,30 +1167,30 @@ discard block |
||
1167 | 1167 | * @param string $value |
1168 | 1168 | * @return string |
1169 | 1169 | */ |
1170 | - static function get_label_size_class( $value = FALSE ){ |
|
1171 | - if ( $value === FALSE || $value == '' ) { |
|
1170 | + static function get_label_size_class($value = FALSE) { |
|
1171 | + if ($value === FALSE || $value == '') { |
|
1172 | 1172 | return ' class="medium-lbl"'; |
1173 | 1173 | } |
1174 | 1174 | // determine length of option value |
1175 | - $val_size = strlen( $value ); |
|
1176 | - switch( $val_size ){ |
|
1175 | + $val_size = strlen($value); |
|
1176 | + switch ($val_size) { |
|
1177 | 1177 | case $val_size < 3 : |
1178 | - $size = ' class="nano-lbl"'; |
|
1178 | + $size = ' class="nano-lbl"'; |
|
1179 | 1179 | break; |
1180 | 1180 | case $val_size < 6 : |
1181 | - $size = ' class="micro-lbl"'; |
|
1181 | + $size = ' class="micro-lbl"'; |
|
1182 | 1182 | break; |
1183 | 1183 | case $val_size < 12 : |
1184 | - $size = ' class="tiny-lbl"'; |
|
1184 | + $size = ' class="tiny-lbl"'; |
|
1185 | 1185 | break; |
1186 | 1186 | case $val_size < 25 : |
1187 | - $size = ' class="small-lbl"'; |
|
1187 | + $size = ' class="small-lbl"'; |
|
1188 | 1188 | break; |
1189 | 1189 | case $val_size > 100 : |
1190 | - $size = ' class="big-lbl"'; |
|
1190 | + $size = ' class="big-lbl"'; |
|
1191 | 1191 | break; |
1192 | 1192 | default: |
1193 | - $size = ' class="medium-lbl"'; |
|
1193 | + $size = ' class="medium-lbl"'; |
|
1194 | 1194 | break; |
1195 | 1195 | } |
1196 | 1196 | return $size; |
@@ -1204,20 +1204,20 @@ discard block |
||
1204 | 1204 | * @param array $QFI |
1205 | 1205 | * @return array |
1206 | 1206 | */ |
1207 | - private static function _load_system_dropdowns( $QFI ){ |
|
1207 | + private static function _load_system_dropdowns($QFI) { |
|
1208 | 1208 | $QST_system = $QFI->get('QST_system'); |
1209 | - switch ( $QST_system ) { |
|
1209 | + switch ($QST_system) { |
|
1210 | 1210 | case 'state' : |
1211 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1211 | + $QFI = self::generate_state_dropdown($QFI); |
|
1212 | 1212 | break; |
1213 | 1213 | case 'country' : |
1214 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1214 | + $QFI = self::generate_country_dropdown($QFI); |
|
1215 | 1215 | break; |
1216 | 1216 | case 'admin-state' : |
1217 | - $QFI = self::generate_state_dropdown( $QFI, TRUE ); |
|
1217 | + $QFI = self::generate_state_dropdown($QFI, TRUE); |
|
1218 | 1218 | break; |
1219 | 1219 | case 'admin-country' : |
1220 | - $QFI = self::generate_country_dropdown( $QFI, TRUE ); |
|
1220 | + $QFI = self::generate_country_dropdown($QFI, TRUE); |
|
1221 | 1221 | break; |
1222 | 1222 | } |
1223 | 1223 | return $QFI; |
@@ -1234,13 +1234,13 @@ discard block |
||
1234 | 1234 | * |
1235 | 1235 | * @return EE_Question_Form_Input |
1236 | 1236 | */ |
1237 | - protected static function _load_specialized_dropdowns( $QFI ) { |
|
1238 | - switch( $QFI->get( 'QST_type' ) ) { |
|
1237 | + protected static function _load_specialized_dropdowns($QFI) { |
|
1238 | + switch ($QFI->get('QST_type')) { |
|
1239 | 1239 | case 'STATE' : |
1240 | - $QFI = self::generate_state_dropdown( $QFI ); |
|
1240 | + $QFI = self::generate_state_dropdown($QFI); |
|
1241 | 1241 | break; |
1242 | 1242 | case 'COUNTRY' : |
1243 | - $QFI = self::generate_country_dropdown( $QFI ); |
|
1243 | + $QFI = self::generate_country_dropdown($QFI); |
|
1244 | 1244 | break; |
1245 | 1245 | } |
1246 | 1246 | return $QFI; |
@@ -1254,23 +1254,23 @@ discard block |
||
1254 | 1254 | * @param bool $get_all |
1255 | 1255 | * @return array |
1256 | 1256 | */ |
1257 | - public static function generate_state_dropdown( $QST, $get_all = FALSE ){ |
|
1257 | + public static function generate_state_dropdown($QST, $get_all = FALSE) { |
|
1258 | 1258 | $states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries(); |
1259 | - if ( $states && count( $states ) != count( $QST->options() )) { |
|
1260 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1259 | + if ($states && count($states) != count($QST->options())) { |
|
1260 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1261 | 1261 | // if multiple countries, we'll create option groups within the dropdown |
1262 | - foreach ( $states as $state ) { |
|
1263 | - if ( $state instanceof EE_State ) { |
|
1264 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1262 | + foreach ($states as $state) { |
|
1263 | + if ($state instanceof EE_State) { |
|
1264 | + $QSO = EE_Question_Option::new_instance(array( |
|
1265 | 1265 | 'QSO_value' => $state->ID(), |
1266 | 1266 | 'QSO_desc' => $state->name(), |
1267 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1267 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1268 | 1268 | 'QSO_deleted' => FALSE |
1269 | 1269 | )); |
1270 | 1270 | // set option group |
1271 | - $QSO->set_opt_group( $state->country()->name() ); |
|
1271 | + $QSO->set_opt_group($state->country()->name()); |
|
1272 | 1272 | // add option to question |
1273 | - $QST->add_temp_option( $QSO ); |
|
1273 | + $QST->add_temp_option($QSO); |
|
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | } |
@@ -1286,20 +1286,20 @@ discard block |
||
1286 | 1286 | * @internal param array $question |
1287 | 1287 | * @return array |
1288 | 1288 | */ |
1289 | - public static function generate_country_dropdown( $QST, $get_all = FALSE ){ |
|
1289 | + public static function generate_country_dropdown($QST, $get_all = FALSE) { |
|
1290 | 1290 | $countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries(); |
1291 | - if ( $countries && count( $countries ) != count( $QST->options() ) ) { |
|
1292 | - $QST->set( 'QST_type', 'DROPDOWN' ); |
|
1291 | + if ($countries && count($countries) != count($QST->options())) { |
|
1292 | + $QST->set('QST_type', 'DROPDOWN'); |
|
1293 | 1293 | // now add countries |
1294 | - foreach ( $countries as $country ) { |
|
1295 | - if ( $country instanceof EE_Country ) { |
|
1296 | - $QSO = EE_Question_Option::new_instance ( array ( |
|
1294 | + foreach ($countries as $country) { |
|
1295 | + if ($country instanceof EE_Country) { |
|
1296 | + $QSO = EE_Question_Option::new_instance(array( |
|
1297 | 1297 | 'QSO_value' => $country->ID(), |
1298 | 1298 | 'QSO_desc' => $country->name(), |
1299 | - 'QST_ID' => $QST->get( 'QST_ID' ), |
|
1299 | + 'QST_ID' => $QST->get('QST_ID'), |
|
1300 | 1300 | 'QSO_deleted' => FALSE |
1301 | 1301 | )); |
1302 | - $QST->add_temp_option( $QSO ); |
|
1302 | + $QST->add_temp_option($QSO); |
|
1303 | 1303 | } |
1304 | 1304 | } |
1305 | 1305 | } |
@@ -1316,11 +1316,11 @@ discard block |
||
1316 | 1316 | */ |
1317 | 1317 | public static function two_digit_months_dropdown_options() { |
1318 | 1318 | $options = array(); |
1319 | - for ( $x = 1; $x <= 12; $x++ ) { |
|
1320 | - $mm = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1321 | - $options[ (string)$mm ] = (string)$mm; |
|
1319 | + for ($x = 1; $x <= 12; $x++) { |
|
1320 | + $mm = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1321 | + $options[(string) $mm] = (string) $mm; |
|
1322 | 1322 | } |
1323 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1323 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1324 | 1324 | } |
1325 | 1325 | |
1326 | 1326 | |
@@ -1335,11 +1335,11 @@ discard block |
||
1335 | 1335 | $options = array(); |
1336 | 1336 | $current_year = date('y'); |
1337 | 1337 | $next_decade = $current_year + 10; |
1338 | - for ( $x = $current_year; $x <= $next_decade; $x++ ) { |
|
1339 | - $yy = str_pad( $x, 2, '0', STR_PAD_LEFT ); |
|
1340 | - $options[ (string)$yy ] = (string)$yy; |
|
1338 | + for ($x = $current_year; $x <= $next_decade; $x++) { |
|
1339 | + $yy = str_pad($x, 2, '0', STR_PAD_LEFT); |
|
1340 | + $options[(string) $yy] = (string) $yy; |
|
1341 | 1341 | } |
1342 | - return EEH_Form_Fields::prep_answer_options( $options ); |
|
1342 | + return EEH_Form_Fields::prep_answer_options($options); |
|
1343 | 1343 | } |
1344 | 1344 | |
1345 | 1345 | |
@@ -1353,17 +1353,17 @@ discard block |
||
1353 | 1353 | * @param integer $evt_category Event Category ID if the Event Category filter is selected |
1354 | 1354 | * @return string html |
1355 | 1355 | */ |
1356 | - public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) { |
|
1356 | + public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) { |
|
1357 | 1357 | $_where = array(); |
1358 | - if ( !empty( $status ) ) { |
|
1358 | + if ( ! empty($status)) { |
|
1359 | 1359 | $_where['STS_ID'] = $status; |
1360 | 1360 | } |
1361 | 1361 | |
1362 | - if ( $evt_category > 0 ) { |
|
1362 | + if ($evt_category > 0) { |
|
1363 | 1363 | $_where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1364 | 1364 | } |
1365 | 1365 | |
1366 | - $regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where ); |
|
1366 | + $regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where); |
|
1367 | 1367 | |
1368 | 1368 | //setup vals for select input helper |
1369 | 1369 | $options = array( |
@@ -1373,15 +1373,15 @@ discard block |
||
1373 | 1373 | ) |
1374 | 1374 | ); |
1375 | 1375 | |
1376 | - foreach ( $regdtts as $regdtt ) { |
|
1377 | - $date = $regdtt->reg_month. ' ' . $regdtt->reg_year; |
|
1376 | + foreach ($regdtts as $regdtt) { |
|
1377 | + $date = $regdtt->reg_month.' '.$regdtt->reg_year; |
|
1378 | 1378 | $options[] = array( |
1379 | 1379 | 'text' => $date, |
1380 | 1380 | 'id' => $date |
1381 | 1381 | ); |
1382 | 1382 | } |
1383 | 1383 | |
1384 | - return self::select_input('month_range', $options, $cur_date, '', 'wide' ); |
|
1384 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1385 | 1385 | } |
1386 | 1386 | |
1387 | 1387 | |
@@ -1395,18 +1395,18 @@ discard block |
||
1395 | 1395 | * @param string $evt_active_status "upcoming", "expired", "active", or "inactive" |
1396 | 1396 | * @return string html |
1397 | 1397 | */ |
1398 | - public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) { |
|
1398 | + public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) { |
|
1399 | 1399 | //determine what post_status our condition will have for the query. |
1400 | - switch ( $status ) { |
|
1400 | + switch ($status) { |
|
1401 | 1401 | case 'month' : |
1402 | 1402 | case 'today' : |
1403 | 1403 | case NULL : |
1404 | 1404 | case 'all' : |
1405 | - $where['Event.status'] = array( 'NOT IN', array('trash') ); |
|
1405 | + $where['Event.status'] = array('NOT IN', array('trash')); |
|
1406 | 1406 | break; |
1407 | 1407 | |
1408 | 1408 | case 'draft' : |
1409 | - $where['Event.status'] = array( 'IN', array('draft', 'auto-draft') ); |
|
1409 | + $where['Event.status'] = array('IN', array('draft', 'auto-draft')); |
|
1410 | 1410 | |
1411 | 1411 | default : |
1412 | 1412 | $where['Event.status'] = $status; |
@@ -1415,7 +1415,7 @@ discard block |
||
1415 | 1415 | //categories? |
1416 | 1416 | |
1417 | 1417 | |
1418 | - if ( !empty ( $evt_category ) ) { |
|
1418 | + if ( ! empty ($evt_category)) { |
|
1419 | 1419 | $where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories'; |
1420 | 1420 | $where['Event.Term_Taxonomy.term_id'] = $evt_category; |
1421 | 1421 | } |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | |
1424 | 1424 | // $where['DTT_is_primary'] = 1; |
1425 | 1425 | |
1426 | - $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status ); |
|
1426 | + $DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status); |
|
1427 | 1427 | |
1428 | 1428 | //let's setup vals for select input helper |
1429 | 1429 | $options = array( |
@@ -1438,9 +1438,9 @@ discard block |
||
1438 | 1438 | //translate month and date |
1439 | 1439 | global $wp_locale; |
1440 | 1440 | |
1441 | - foreach ( $DTTS as $DTT ) { |
|
1442 | - $localized_date = $wp_locale->get_month( $DTT->dtt_month_num ) . ' ' . $DTT->dtt_year; |
|
1443 | - $id = $DTT->dtt_month . ' ' . $DTT->dtt_year; |
|
1441 | + foreach ($DTTS as $DTT) { |
|
1442 | + $localized_date = $wp_locale->get_month($DTT->dtt_month_num).' '.$DTT->dtt_year; |
|
1443 | + $id = $DTT->dtt_month.' '.$DTT->dtt_year; |
|
1444 | 1444 | $options[] = array( |
1445 | 1445 | 'text' => $localized_date, |
1446 | 1446 | 'id' => $id |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | } |
1449 | 1449 | |
1450 | 1450 | |
1451 | - return self::select_input( 'month_range', $options, $cur_date, '', 'wide' ); |
|
1451 | + return self::select_input('month_range', $options, $cur_date, '', 'wide'); |
|
1452 | 1452 | } |
1453 | 1453 | |
1454 | 1454 | |
@@ -1459,7 +1459,7 @@ discard block |
||
1459 | 1459 | * @param integer $current_cat currently selected category |
1460 | 1460 | * @return string html for dropdown |
1461 | 1461 | */ |
1462 | - public static function generate_event_category_dropdown( $current_cat = -1 ) { |
|
1462 | + public static function generate_event_category_dropdown($current_cat = -1) { |
|
1463 | 1463 | $categories = EEM_Term::instance()->get_all_ee_categories(TRUE); |
1464 | 1464 | $options = array( |
1465 | 1465 | '0' => array( |
@@ -1469,14 +1469,14 @@ discard block |
||
1469 | 1469 | ); |
1470 | 1470 | |
1471 | 1471 | //setup categories for dropdown |
1472 | - foreach ( $categories as $category ) { |
|
1472 | + foreach ($categories as $category) { |
|
1473 | 1473 | $options[] = array( |
1474 | 1474 | 'text' => $category->get('name'), |
1475 | 1475 | 'id' => $category->ID() |
1476 | 1476 | ); |
1477 | 1477 | } |
1478 | 1478 | |
1479 | - return self::select_input( 'EVT_CAT', $options, $current_cat ); |
|
1479 | + return self::select_input('EVT_CAT', $options, $current_cat); |
|
1480 | 1480 | } |
1481 | 1481 | |
1482 | 1482 | |
@@ -1495,20 +1495,20 @@ discard block |
||
1495 | 1495 | * @param string $extra_attributes - any extra attributes that need to be attached to the form input |
1496 | 1496 | * @return void |
1497 | 1497 | */ |
1498 | - public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) { |
|
1498 | + public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') { |
|
1499 | 1499 | $btn = ''; |
1500 | - if ( empty( $url ) || empty( $ID )) { |
|
1500 | + if (empty($url) || empty($ID)) { |
|
1501 | 1501 | return $btn; |
1502 | 1502 | } |
1503 | - $text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' ); |
|
1504 | - $btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>'; |
|
1505 | - if ( ! $input_only ) { |
|
1506 | - $btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">'; |
|
1507 | - $btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : ''; |
|
1503 | + $text = ! empty($text) ? $text : __('Submit', 'event_espresso'); |
|
1504 | + $btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>'; |
|
1505 | + if ( ! $input_only) { |
|
1506 | + $btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">'; |
|
1507 | + $btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : ''; |
|
1508 | 1508 | $btn_frm .= $btn; |
1509 | 1509 | $btn_frm .= '</form>'; |
1510 | 1510 | $btn = $btn_frm; |
1511 | - unset ( $btn_frm ); |
|
1511 | + unset ($btn_frm); |
|
1512 | 1512 | } |
1513 | 1513 | return $btn; |
1514 | 1514 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * |
21 | 21 | * ------------------------------------------------------------------------ |
22 | 22 | */ |
23 | -class EEH_Money extends EEH_Base { |
|
23 | +class EEH_Money extends EEH_Base { |
|
24 | 24 | |
25 | 25 | |
26 | 26 | /** |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | * @param int|string $incoming_value |
30 | 30 | * @return float |
31 | 31 | */ |
32 | - public static function convert_to_float_from_localized_money( $incoming_value ) { |
|
32 | + public static function convert_to_float_from_localized_money($incoming_value) { |
|
33 | 33 | //remove thousands separator |
34 | - $money_value = str_replace( EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value ); |
|
34 | + $money_value = str_replace(EE_Registry::instance()->CFG->currency->thsnds, '', $incoming_value); |
|
35 | 35 | |
36 | 36 | //replace decimal place with standard decimal. |
37 | - $money_value = str_replace( EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value ); |
|
37 | + $money_value = str_replace(EE_Registry::instance()->CFG->currency->dec_mrk, '.', $money_value); |
|
38 | 38 | |
39 | 39 | //float it! and round to three decimal places |
40 | - $money_value = round ( (float) $money_value, 3 ); |
|
40 | + $money_value = round((float) $money_value, 3); |
|
41 | 41 | return $money_value; |
42 | 42 | } |
43 | 43 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * @throws \EE_Error |
58 | 58 | */ |
59 | 59 | |
60 | - public static function compare_floats( $float1, $float2, $operator='=' ) { |
|
60 | + public static function compare_floats($float1, $float2, $operator = '=') { |
|
61 | 61 | // Check numbers to 5 digits of precision |
62 | 62 | $epsilon = 0.00001; |
63 | 63 | |
64 | - $float1 = (float)$float1; |
|
65 | - $float2 = (float)$float2; |
|
64 | + $float1 = (float) $float1; |
|
65 | + $float2 = (float) $float2; |
|
66 | 66 | |
67 | 67 | switch ($operator) { |
68 | 68 | // equal |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | } |
117 | 117 | break; |
118 | 118 | default: |
119 | - throw new EE_Error(__( "Unknown operator '" . $operator . "' in EEH_Money::compare_floats()", 'event_espresso' ) ); |
|
119 | + throw new EE_Error(__("Unknown operator '".$operator."' in EEH_Money::compare_floats()", 'event_espresso')); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | return false; |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | * |
132 | 132 | * @return string |
133 | 133 | */ |
134 | - public static function get_format_for_jqplot( $CNT_ISO = '') { |
|
134 | + public static function get_format_for_jqplot($CNT_ISO = '') { |
|
135 | 135 | //default format |
136 | 136 | $format = 'f'; |
137 | 137 | //if CNT_ISO passed lets try to get currency settings for it. |
138 | - $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null; |
|
138 | + $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null; |
|
139 | 139 | //default currency settings for site if not set |
140 | - if ( ! $currency_config instanceof EE_Currency_Config ) { |
|
140 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
141 | 141 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
142 | 142 | } |
143 | 143 | |
144 | 144 | //first get the decimal place and number of places |
145 | - $format = "%'." . $currency_config->dec_plc . $format; |
|
145 | + $format = "%'.".$currency_config->dec_plc.$format; |
|
146 | 146 | |
147 | 147 | //currency symbol on right side. |
148 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
148 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
149 | 149 | return $format; |
150 | 150 | } |
151 | 151 | |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @return string |
162 | 162 | */ |
163 | - public static function get_format_for_google_charts( $CNT_ISO = '' ) { |
|
163 | + public static function get_format_for_google_charts($CNT_ISO = '') { |
|
164 | 164 | //if CNT_ISO passed lets try to get currency settings for it. |
165 | - $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : null; |
|
165 | + $currency_config = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : null; |
|
166 | 166 | //default currency settings for site if not set |
167 | - if ( ! $currency_config instanceof EE_Currency_Config ) { |
|
167 | + if ( ! $currency_config instanceof EE_Currency_Config) { |
|
168 | 168 | $currency_config = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
169 | 169 | } |
170 | 170 | |
171 | - $decimal_places_placeholder = str_pad( '', $currency_config->dec_plc, '0' ); |
|
171 | + $decimal_places_placeholder = str_pad('', $currency_config->dec_plc, '0'); |
|
172 | 172 | |
173 | 173 | //first get the decimal place and number of places |
174 | - $format = '#,##0.' . $decimal_places_placeholder; |
|
174 | + $format = '#,##0.'.$decimal_places_placeholder; |
|
175 | 175 | |
176 | 176 | //currency symbol on right side. |
177 | - $format = $currency_config->sign_b4 ? $currency_config->sign . $format : $format . $currency_config->sign; |
|
177 | + $format = $currency_config->sign_b4 ? $currency_config->sign.$format : $format.$currency_config->sign; |
|
178 | 178 | $formatterObject = array( |
179 | 179 | 'decimalSymbol' => $currency_config->dec_mrk, |
180 | 180 | 'groupingSymbol' => $currency_config->thsnds, |
181 | 181 | 'fractionDigits' => $currency_config->dec_plc, |
182 | 182 | ); |
183 | - if ( $currency_config->sign_b4 ) { |
|
183 | + if ($currency_config->sign_b4) { |
|
184 | 184 | $formatterObject['prefix'] = $currency_config->sign; |
185 | 185 | } else { |
186 | 186 | $formatterObject['suffix'] = $currency_config->sign; |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | * @param array $request_data |
97 | 97 | * @param array $extra_data |
98 | 98 | */ |
99 | - function __construct( $job_id, $classname, $request_data, $extra_data = array() ) { |
|
100 | - $this->set_job_id( $job_id ); |
|
101 | - $this->set_classname( $classname ); |
|
102 | - $this->set_request_data( $request_data ); |
|
103 | - $this->set_extra_data( $extra_data ); |
|
104 | - $this->set_status( JobParameters::status_continue ); |
|
99 | + function __construct($job_id, $classname, $request_data, $extra_data = array()) { |
|
100 | + $this->set_job_id($job_id); |
|
101 | + $this->set_classname($classname); |
|
102 | + $this->set_request_data($request_data); |
|
103 | + $this->set_extra_data($extra_data); |
|
104 | + $this->set_status(JobParameters::status_continue); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | * @param boolean $first |
127 | 127 | * @return boolean success |
128 | 128 | */ |
129 | - function save( $first = false ) { |
|
130 | - $object_vars = wp_json_encode( get_object_vars( $this ) ); |
|
131 | - if( $first ) { |
|
132 | - return add_option( $this->option_name(), $object_vars, null, 'no' ); |
|
133 | - } else{ |
|
134 | - return update_option( $this->option_name(), $object_vars ); |
|
129 | + function save($first = false) { |
|
130 | + $object_vars = wp_json_encode(get_object_vars($this)); |
|
131 | + if ($first) { |
|
132 | + return add_option($this->option_name(), $object_vars, null, 'no'); |
|
133 | + } else { |
|
134 | + return update_option($this->option_name(), $object_vars); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @return boolean |
144 | 144 | */ |
145 | 145 | function delete() { |
146 | - return delete_option( $this->option_name() ); |
|
146 | + return delete_option($this->option_name()); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | |
@@ -154,26 +154,26 @@ discard block |
||
154 | 154 | * @return JobParameters |
155 | 155 | * @throws BatchRequestException |
156 | 156 | */ |
157 | - static function load( $job_id ) { |
|
158 | - $job_parameter_vars = json_decode( get_option( JobParameters::wp_option_prefix . $job_id ), true ); |
|
159 | - if( |
|
160 | - ! is_array( $job_parameter_vars ) || |
|
161 | - ! isset( $job_parameter_vars[ '_classname' ] ) || |
|
162 | - ! isset( $job_parameter_vars[ '_request_data' ] ) |
|
157 | + static function load($job_id) { |
|
158 | + $job_parameter_vars = json_decode(get_option(JobParameters::wp_option_prefix.$job_id), true); |
|
159 | + if ( |
|
160 | + ! is_array($job_parameter_vars) || |
|
161 | + ! isset($job_parameter_vars['_classname']) || |
|
162 | + ! isset($job_parameter_vars['_request_data']) |
|
163 | 163 | ) { |
164 | 164 | throw new BatchRequestException( |
165 | 165 | sprintf( |
166 | 166 | __('Could not retrieve job %1$s from the Wordpress options table, and so the job could not continue. The wordpress option was %2$s', 'event_espresso'), |
167 | 167 | $job_id, |
168 | - get_option( JobParameters::wp_option_prefix . $job_id ) |
|
168 | + get_option(JobParameters::wp_option_prefix.$job_id) |
|
169 | 169 | ) |
170 | 170 | ); |
171 | 171 | } |
172 | 172 | $job_parameters = new JobParameters( |
173 | 173 | $job_id, |
174 | - $job_parameter_vars[ '_classname' ], |
|
175 | - $job_parameter_vars[ '_request_data'] ); |
|
176 | - foreach( $job_parameter_vars as $key => $value ) { |
|
174 | + $job_parameter_vars['_classname'], |
|
175 | + $job_parameter_vars['_request_data'] ); |
|
176 | + foreach ($job_parameter_vars as $key => $value) { |
|
177 | 177 | $job_parameters->{$key} = $value; |
178 | 178 | } |
179 | 179 | return $job_parameters; |
@@ -217,9 +217,9 @@ discard block |
||
217 | 217 | * @param string|array $default |
218 | 218 | * @return string|array |
219 | 219 | */ |
220 | - function request_datum( $key, $default = '' ) { |
|
221 | - if( isset( $this->_request_data[ $key ] ) ) { |
|
222 | - return $this->_request_data[ $key ]; |
|
220 | + function request_datum($key, $default = '') { |
|
221 | + if (isset($this->_request_data[$key])) { |
|
222 | + return $this->_request_data[$key]; |
|
223 | 223 | } else { |
224 | 224 | return $default; |
225 | 225 | } |
@@ -233,9 +233,9 @@ discard block |
||
233 | 233 | * @param string|array $default |
234 | 234 | * @return string|array |
235 | 235 | */ |
236 | - function extra_datum( $key, $default = '' ) { |
|
237 | - if( isset( $this->_extra_data[ $key ] ) ) { |
|
238 | - return $this->_extra_data[ $key ]; |
|
236 | + function extra_datum($key, $default = '') { |
|
237 | + if (isset($this->_extra_data[$key])) { |
|
238 | + return $this->_extra_data[$key]; |
|
239 | 239 | } else { |
240 | 240 | return $default; |
241 | 241 | } |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | * @param string $key |
249 | 249 | * @param string|int|array|null $value almost any extra data you want to store |
250 | 250 | */ |
251 | - function add_extra_data( $key, $value ) { |
|
252 | - $this->_extra_data[ $key ] = $value; |
|
251 | + function add_extra_data($key, $value) { |
|
252 | + $this->_extra_data[$key] = $value; |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * Sets the job size. You decide what units to use |
279 | 279 | * @param int $size |
280 | 280 | */ |
281 | - function set_job_size( $size ) { |
|
281 | + function set_job_size($size) { |
|
282 | 282 | $this->_job_size = $size; |
283 | 283 | } |
284 | 284 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @param int $newly_processed |
300 | 300 | * @return int updated units processed |
301 | 301 | */ |
302 | - function mark_processed( $newly_processed ) { |
|
302 | + function mark_processed($newly_processed) { |
|
303 | 303 | $this->_units_processed += $newly_processed; |
304 | 304 | return $this->_units_processed; |
305 | 305 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * Sets the total count of units processed. You might prefer to use mark_processed |
311 | 311 | * @param int $total_units_processed |
312 | 312 | */ |
313 | - function set_units_processed( $total_units_processed ) { |
|
313 | + function set_units_processed($total_units_processed) { |
|
314 | 314 | $this->_units_processed = $total_units_processed; |
315 | 315 | } |
316 | 316 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * Sets the job's ID |
321 | 321 | * @param string $job_id |
322 | 322 | */ |
323 | - function set_job_id( $job_id ) { |
|
323 | + function set_job_id($job_id) { |
|
324 | 324 | $this->_job_id = $job_id; |
325 | 325 | } |
326 | 326 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | * sets the classname |
331 | 331 | * @param string $classname |
332 | 332 | */ |
333 | - function set_classname( $classname ) { |
|
333 | + function set_classname($classname) { |
|
334 | 334 | $this->_classname = $classname; |
335 | 335 | } |
336 | 336 | |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * Sets the request data |
341 | 341 | * @param array $request_data |
342 | 342 | */ |
343 | - function set_request_data( $request_data ) { |
|
343 | + function set_request_data($request_data) { |
|
344 | 344 | $this->_request_data = $request_data; |
345 | 345 | } |
346 | 346 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | * Sets the array of extra data we want to store on this request |
351 | 351 | * @param array $extra_data |
352 | 352 | */ |
353 | - function set_extra_data( $extra_data ) { |
|
353 | + function set_extra_data($extra_data) { |
|
354 | 354 | $this->_extra_data = $extra_data; |
355 | 355 | } |
356 | 356 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return string |
362 | 362 | */ |
363 | 363 | function option_name() { |
364 | - return JobParameters::wp_option_prefix . $this->job_id(); |
|
364 | + return JobParameters::wp_option_prefix.$this->job_id(); |
|
365 | 365 | } |
366 | 366 | |
367 | 367 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @param string $status on eof JobParameters::valid_stati() |
382 | 382 | */ |
383 | - public function set_status( $status ) { |
|
383 | + public function set_status($status) { |
|
384 | 384 | $this->_status = $status; |
385 | 385 | } |
386 | 386 |
@@ -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 | /** |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | * @type $name string the name for this form section, if you want to explicitly define it |
96 | 96 | * } |
97 | 97 | */ |
98 | - function __construct( $options_array = array() ) { |
|
98 | + function __construct($options_array = array()) { |
|
99 | 99 | // used by display strategies |
100 | 100 | EE_Registry::instance()->load_helper('HTML'); |
101 | 101 | // assign incoming values to properties |
102 | - foreach( $options_array as $key => $value ) { |
|
103 | - $key = '_' . $key; |
|
104 | - if ( property_exists( $this, $key ) && empty( $this->{$key} )) { |
|
102 | + foreach ($options_array as $key => $value) { |
|
103 | + $key = '_'.$key; |
|
104 | + if (property_exists($this, $key) && empty($this->{$key} )) { |
|
105 | 105 | $this->{$key} = $value; |
106 | 106 | } |
107 | 107 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * @param $parent_form_section |
114 | 114 | * @param $name |
115 | 115 | */ |
116 | - protected function _construct_finalize( $parent_form_section, $name ){ |
|
116 | + protected function _construct_finalize($parent_form_section, $name) { |
|
117 | 117 | $this->_construction_finalized = TRUE; |
118 | 118 | $this->_parent_section = $parent_form_section; |
119 | 119 | $this->_name = $name; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | /** |
135 | 135 | * @param string $action |
136 | 136 | */ |
137 | - public function set_action( $action ) { |
|
137 | + public function set_action($action) { |
|
138 | 138 | $this->_action = $action; |
139 | 139 | } |
140 | 140 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @return string |
145 | 145 | */ |
146 | 146 | public function method() { |
147 | - return ! empty( $this->_method ) ? $this->_method : 'POST'; |
|
147 | + return ! empty($this->_method) ? $this->_method : 'POST'; |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | /** |
153 | 153 | * @param string $method |
154 | 154 | */ |
155 | - public function set_method( $method ) { |
|
156 | - switch ( $method ) { |
|
155 | + public function set_method($method) { |
|
156 | + switch ($method) { |
|
157 | 157 | case 'get' : |
158 | 158 | case 'GET' : |
159 | 159 | $this->_method = 'GET'; |
@@ -171,12 +171,12 @@ discard block |
||
171 | 171 | * Calculation involves using the name and the parent's html id |
172 | 172 | * return void |
173 | 173 | */ |
174 | - protected function _set_default_html_id_if_empty(){ |
|
175 | - if( ! $this->_html_id ){ |
|
176 | - if( $this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper ){ |
|
177 | - $this->_html_id = $this->_parent_section->html_id() . '-' . $this->_prep_name_for_html_id( $this->name() ); |
|
178 | - }else{ |
|
179 | - $this->_html_id = $this->_prep_name_for_html_id( $this->name() ); |
|
174 | + protected function _set_default_html_id_if_empty() { |
|
175 | + if ( ! $this->_html_id) { |
|
176 | + if ($this->_parent_section && $this->_parent_section instanceof EE_Form_Section_Proper) { |
|
177 | + $this->_html_id = $this->_parent_section->html_id().'-'.$this->_prep_name_for_html_id($this->name()); |
|
178 | + } else { |
|
179 | + $this->_html_id = $this->_prep_name_for_html_id($this->name()); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | * @param $name |
189 | 189 | * @return string |
190 | 190 | */ |
191 | - private function _prep_name_for_html_id( $name ) { |
|
192 | - return sanitize_key( str_replace( array( ' ', ' ', '_' ), '-', $name )); |
|
191 | + private function _prep_name_for_html_id($name) { |
|
192 | + return sanitize_key(str_replace(array(' ', ' ', '_'), '-', $name)); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | * @param bool $add_pound_sign |
207 | 207 | * @return string |
208 | 208 | */ |
209 | - public function html_id( $add_pound_sign = FALSE ){ |
|
210 | - return $add_pound_sign ? '#' . $this->_html_id : $this->_html_id; |
|
209 | + public function html_id($add_pound_sign = FALSE) { |
|
210 | + return $add_pound_sign ? '#'.$this->_html_id : $this->_html_id; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | /** |
216 | 216 | * @return string |
217 | 217 | */ |
218 | - public function html_class(){ |
|
218 | + public function html_class() { |
|
219 | 219 | return $this->_html_class; |
220 | 220 | } |
221 | 221 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * @return string |
226 | 226 | */ |
227 | - public function html_style(){ |
|
227 | + public function html_style() { |
|
228 | 228 | return $this->_html_style; |
229 | 229 | } |
230 | 230 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | /** |
234 | 234 | * @param mixed $html_class |
235 | 235 | */ |
236 | - public function set_html_class( $html_class ) { |
|
236 | + public function set_html_class($html_class) { |
|
237 | 237 | $this->_html_class = $html_class; |
238 | 238 | } |
239 | 239 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | /** |
243 | 243 | * @param mixed $html_id |
244 | 244 | */ |
245 | - public function set_html_id( $html_id ) { |
|
245 | + public function set_html_id($html_id) { |
|
246 | 246 | $this->_html_id = $html_id; |
247 | 247 | } |
248 | 248 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | /** |
252 | 252 | * @param mixed $html_style |
253 | 253 | */ |
254 | - public function set_html_style( $html_style ) { |
|
254 | + public function set_html_style($html_style) { |
|
255 | 255 | $this->_html_style = $html_style; |
256 | 256 | } |
257 | 257 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | /** |
261 | 261 | * @param string $other_html_attributes |
262 | 262 | */ |
263 | - public function set_other_html_attributes( $other_html_attributes ) { |
|
263 | + public function set_other_html_attributes($other_html_attributes) { |
|
264 | 264 | $this->_other_html_attributes = $other_html_attributes; |
265 | 265 | } |
266 | 266 | |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | * @throws EE_Error |
281 | 281 | * @return string |
282 | 282 | */ |
283 | - function name(){ |
|
284 | - if( ! $this->_construction_finalized ){ |
|
285 | - 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) ) ); |
|
283 | + function name() { |
|
284 | + if ( ! $this->_construction_finalized) { |
|
285 | + 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))); |
|
286 | 286 | } |
287 | 287 | return $this->_name; |
288 | 288 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * Gets the parent section |
294 | 294 | * @return EE_Form_Section_Proper |
295 | 295 | */ |
296 | - function parent_section(){ |
|
296 | + function parent_section() { |
|
297 | 297 | return $this->_parent_section; |
298 | 298 | } |
299 | 299 | |
@@ -306,18 +306,18 @@ discard block |
||
306 | 306 | * @param string $other_attributes anything else added to the form open tag, MUST BE VALID HTML |
307 | 307 | * @return string |
308 | 308 | */ |
309 | - public function form_open( $action = '', $method = '', $other_attributes = '' ) { |
|
310 | - if ( ! empty( $action )) { |
|
311 | - $this->set_action( $action ); |
|
309 | + public function form_open($action = '', $method = '', $other_attributes = '') { |
|
310 | + if ( ! empty($action)) { |
|
311 | + $this->set_action($action); |
|
312 | 312 | } |
313 | - if ( ! empty( $method )) { |
|
314 | - $this->set_method( $method ); |
|
313 | + if ( ! empty($method)) { |
|
314 | + $this->set_method($method); |
|
315 | 315 | } |
316 | - $html = EEH_HTML::nl( 1, 'form' ) . '<form'; |
|
317 | - $html .= $this->html_id() !== '' ? ' id="' . $this->html_id() . '"' : ''; |
|
318 | - $html .= ' action="' . $this->action() . '"'; |
|
319 | - $html .= ' method="' . $this->method() . '"'; |
|
320 | - $html .= $other_attributes . '>'; |
|
316 | + $html = EEH_HTML::nl(1, 'form').'<form'; |
|
317 | + $html .= $this->html_id() !== '' ? ' id="'.$this->html_id().'"' : ''; |
|
318 | + $html .= ' action="'.$this->action().'"'; |
|
319 | + $html .= ' method="'.$this->method().'"'; |
|
320 | + $html .= $other_attributes.'>'; |
|
321 | 321 | return $html; |
322 | 322 | } |
323 | 323 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | * @return string |
329 | 329 | */ |
330 | 330 | public function form_close() { |
331 | - return EEH_HTML::nl( -1, 'form' ) . '</form>' . EEH_HTML::nl() . '<!-- end of ee-' . $this->html_id() . '-form -->' . EEH_HTML::nl(); |
|
331 | + return EEH_HTML::nl( -1, 'form' ).'</form>'.EEH_HTML::nl().'<!-- end of ee-'.$this->html_id().'-form -->'.EEH_HTML::nl(); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts). |
8 | 8 | * However, you may output the form (usually by calling get_html_and_js) anywhere you like. |
9 | 9 | */ |
10 | -class EE_Form_Section_Proper extends EE_Form_Section_Validatable{ |
|
10 | +class EE_Form_Section_Proper extends EE_Form_Section_Validatable { |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Subsections |
@@ -68,38 +68,38 @@ discard block |
||
68 | 68 | * } @see EE_Form_Section_Validatable::__construct() |
69 | 69 | * |
70 | 70 | */ |
71 | - public function __construct( $options_array = array() ){ |
|
71 | + public function __construct($options_array = array()) { |
|
72 | 72 | EE_Registry::instance()->load_helper('Formatter'); |
73 | - $options_array = apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this ); |
|
73 | + $options_array = apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this); |
|
74 | 74 | //call parent first, as it may be setting the name |
75 | 75 | parent::__construct($options_array); |
76 | 76 | //if they've included subsections in the constructor, add them now |
77 | - if( isset( $options_array['include'] )){ |
|
77 | + if (isset($options_array['include'])) { |
|
78 | 78 | //we are going to make sure we ONLY have those subsections to include |
79 | 79 | //AND we are going to make sure they're in that specified order |
80 | 80 | $reordered_subsections = array(); |
81 | - foreach($options_array['include'] as $input_name){ |
|
82 | - if(isset($this->_subsections[$input_name])){ |
|
81 | + foreach ($options_array['include'] as $input_name) { |
|
82 | + if (isset($this->_subsections[$input_name])) { |
|
83 | 83 | $reordered_subsections[$input_name] = $this->_subsections[$input_name]; |
84 | 84 | } |
85 | 85 | } |
86 | 86 | $this->_subsections = $reordered_subsections; |
87 | 87 | } |
88 | - if(isset($options_array['exclude'])){ |
|
88 | + if (isset($options_array['exclude'])) { |
|
89 | 89 | $exclude = $options_array['exclude']; |
90 | 90 | $this->_subsections = array_diff_key($this->_subsections, array_flip($exclude)); |
91 | 91 | } |
92 | - if(isset($options_array['layout_strategy'])){ |
|
92 | + if (isset($options_array['layout_strategy'])) { |
|
93 | 93 | $this->_layout_strategy = $options_array['layout_strategy']; |
94 | 94 | } |
95 | - if( ! $this->_layout_strategy){ |
|
95 | + if ( ! $this->_layout_strategy) { |
|
96 | 96 | $this->_layout_strategy = new EE_Two_Column_Layout(); |
97 | 97 | } |
98 | 98 | $this->_layout_strategy->_construct_finalize($this); |
99 | 99 | |
100 | - add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
101 | - add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' )); |
|
102 | - add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 ); |
|
100 | + add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
101 | + add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts')); |
|
102 | + add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -111,25 +111,25 @@ discard block |
||
111 | 111 | * @param string $name |
112 | 112 | * @throws \EE_Error |
113 | 113 | */ |
114 | - public function _construct_finalize( $parent_form_section, $name ) { |
|
114 | + public function _construct_finalize($parent_form_section, $name) { |
|
115 | 115 | parent::_construct_finalize($parent_form_section, $name); |
116 | 116 | $this->_set_default_name_if_empty(); |
117 | 117 | $this->_set_default_html_id_if_empty(); |
118 | - foreach( $this->_subsections as $subsection_name => $subsection ){ |
|
119 | - if ( $subsection instanceof EE_Form_Section_Base ) { |
|
120 | - $subsection->_construct_finalize( $this, $subsection_name ); |
|
118 | + foreach ($this->_subsections as $subsection_name => $subsection) { |
|
119 | + if ($subsection instanceof EE_Form_Section_Base) { |
|
120 | + $subsection->_construct_finalize($this, $subsection_name); |
|
121 | 121 | } else { |
122 | 122 | throw new EE_Error( |
123 | 123 | sprintf( |
124 | - __( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ), |
|
124 | + __('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'), |
|
125 | 125 | $subsection_name, |
126 | 126 | get_class($this), |
127 | - $subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' ) |
|
127 | + $subsection ? get_class($subsection) : __('NULL', 'event_espresso') |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | } |
131 | 131 | } |
132 | - do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name ); |
|
132 | + do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Gets the layout strategy for this form section |
139 | 139 | * @return EE_Form_Section_Layout_Base |
140 | 140 | */ |
141 | - public function get_layout_strategy(){ |
|
141 | + public function get_layout_strategy() { |
|
142 | 142 | return $this->_layout_strategy; |
143 | 143 | } |
144 | 144 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | * @param EE_Form_Input_Base $input |
151 | 151 | * @return string |
152 | 152 | */ |
153 | - public function get_html_for_input($input){ |
|
153 | + public function get_html_for_input($input) { |
|
154 | 154 | return $this->_layout_strategy->layout_input($input); |
155 | 155 | } |
156 | 156 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param null $form_data |
164 | 164 | * @return boolean |
165 | 165 | */ |
166 | - public function was_submitted($form_data = NULL){ |
|
166 | + public function was_submitted($form_data = NULL) { |
|
167 | 167 | return $this->form_data_present_in($form_data); |
168 | 168 | } |
169 | 169 | |
@@ -184,16 +184,16 @@ discard block |
||
184 | 184 | * to skip this step. |
185 | 185 | * @return void |
186 | 186 | */ |
187 | - public function receive_form_submission($req_data = NULL, $validate = TRUE){ |
|
188 | - $req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate ); |
|
189 | - if( $req_data === NULL){ |
|
187 | + public function receive_form_submission($req_data = NULL, $validate = TRUE) { |
|
188 | + $req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate); |
|
189 | + if ($req_data === NULL) { |
|
190 | 190 | $req_data = $_REQUEST; |
191 | 191 | } |
192 | 192 | $this->_normalize($req_data); |
193 | - if( $validate ){ |
|
193 | + if ($validate) { |
|
194 | 194 | $this->_validate(); |
195 | 195 | } |
196 | - do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate ); |
|
196 | + do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | * the value being an array formatted in teh same way |
207 | 207 | * @param array $default_data |
208 | 208 | */ |
209 | - public function populate_defaults($default_data){ |
|
210 | - foreach($this->subsections() as $subsection_name => $subsection){ |
|
211 | - if(isset($default_data[$subsection_name])){ |
|
212 | - if($subsection instanceof EE_Form_Input_Base){ |
|
209 | + public function populate_defaults($default_data) { |
|
210 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
211 | + if (isset($default_data[$subsection_name])) { |
|
212 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
213 | 213 | $subsection->set_default($default_data[$subsection_name]); |
214 | - }elseif($subsection instanceof EE_Form_Section_Proper){ |
|
214 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
215 | 215 | $subsection->populate_defaults($default_data[$subsection_name]); |
216 | 216 | } |
217 | 217 | } |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | * (realizing that the subsections' html names might not be set yet, etc.) |
230 | 230 | * @return EE_Form_Section_Base |
231 | 231 | */ |
232 | - public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
233 | - if( $require_construction_to_be_finalized ){ |
|
232 | + public function get_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
233 | + if ($require_construction_to_be_finalized) { |
|
234 | 234 | $this->ensure_construct_finalized_called(); |
235 | 235 | } |
236 | 236 | return isset($this->_subsections[$name]) ? $this->_subsections[$name] : NULL; |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | * Gets all the validatable subsections of this form section |
243 | 243 | * @return EE_Form_Section_Validatable[] |
244 | 244 | */ |
245 | - public function get_validatable_subsections(){ |
|
245 | + public function get_validatable_subsections() { |
|
246 | 246 | $validatable_subsections = array(); |
247 | - foreach($this->subsections() as $name=>$obj){ |
|
248 | - if($obj instanceof EE_Form_Section_Validatable){ |
|
247 | + foreach ($this->subsections() as $name=>$obj) { |
|
248 | + if ($obj instanceof EE_Form_Section_Validatable) { |
|
249 | 249 | $validatable_subsections[$name] = $obj; |
250 | 250 | } |
251 | 251 | } |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | * @return EE_Form_Input_Base |
266 | 266 | * @throws EE_Error |
267 | 267 | */ |
268 | - public function get_input($name, $require_construction_to_be_finalized = TRUE ){ |
|
268 | + public function get_input($name, $require_construction_to_be_finalized = TRUE) { |
|
269 | 269 | $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
270 | - if( ! $subsection instanceof EE_Form_Input_Base){ |
|
271 | - throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'),$name, get_class($this),$subsection ? get_class($subsection) : __("NULL", 'event_espresso'))); |
|
270 | + if ( ! $subsection instanceof EE_Form_Input_Base) { |
|
271 | + throw new EE_Error(sprintf(__("Subsection '%s' is not an instanceof EE_Form_Input_Base on form '%s'. It is a '%s'", 'event_espresso'), $name, get_class($this), $subsection ? get_class($subsection) : __("NULL", 'event_espresso'))); |
|
272 | 272 | } |
273 | 273 | return $subsection; |
274 | 274 | } |
@@ -286,10 +286,10 @@ discard block |
||
286 | 286 | * @return EE_Form_Section_Proper |
287 | 287 | * @throws EE_Error |
288 | 288 | */ |
289 | - public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){ |
|
290 | - $subsection = $this->get_subsection( $name, $require_construction_to_be_finalized ); |
|
291 | - if( ! $subsection instanceof EE_Form_Section_Proper){ |
|
292 | - throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),$name, get_class($this))); |
|
289 | + public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) { |
|
290 | + $subsection = $this->get_subsection($name, $require_construction_to_be_finalized); |
|
291 | + if ( ! $subsection instanceof EE_Form_Section_Proper) { |
|
292 | + throw new EE_Error(sprintf(__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'), $name, get_class($this))); |
|
293 | 293 | } |
294 | 294 | return $subsection; |
295 | 295 | } |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | * @param string $name |
303 | 303 | * @return mixed depending on the input's type and its normalization strategy |
304 | 304 | */ |
305 | - public function get_input_value($name){ |
|
305 | + public function get_input_value($name) { |
|
306 | 306 | $input = $this->get_input($name); |
307 | 307 | return $input->normalized_value(); |
308 | 308 | } |
@@ -315,16 +315,16 @@ discard block |
||
315 | 315 | * @return boolean |
316 | 316 | */ |
317 | 317 | public function is_valid() { |
318 | - if( ! $this->has_received_submission()){ |
|
318 | + if ( ! $this->has_received_submission()) { |
|
319 | 319 | throw new EE_Error(sprintf(__("You cannot check if a form is valid before receiving the form submission using receive_form_submission", "event_espresso"))); |
320 | 320 | } |
321 | - if( ! parent::is_valid()){ |
|
321 | + if ( ! parent::is_valid()) { |
|
322 | 322 | return false; |
323 | 323 | } |
324 | 324 | //ok so no errors general to this entire form section. so let's check the subsections |
325 | - foreach( $this->get_validatable_subsections() as $subsection ){ |
|
326 | - if( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '' ){ |
|
327 | - $this->set_submission_error_message( $subsection->get_validation_error_string() ); |
|
325 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
326 | + if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() != '') { |
|
327 | + $this->set_submission_error_message($subsection->get_validation_error_string()); |
|
328 | 328 | return false; |
329 | 329 | } |
330 | 330 | } |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * gets teh default name of this form section if none is specified |
338 | 338 | * @return string |
339 | 339 | */ |
340 | - protected function _set_default_name_if_empty(){ |
|
341 | - if( ! $this->_name ){ |
|
340 | + protected function _set_default_name_if_empty() { |
|
341 | + if ( ! $this->_name) { |
|
342 | 342 | $classname = get_class($this); |
343 | 343 | $default_name = str_replace("EE_", "", $classname); |
344 | - $this->_name = $default_name; |
|
344 | + $this->_name = $default_name; |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * Also returns the HTML for the form, except for the form opening and closing tags |
353 | 353 | * (as the form section doesn't know where you necessarily want to send the information to), and except for a submit button. |
354 | 354 | */ |
355 | - public function get_html_and_js(){ |
|
355 | + public function get_html_and_js() { |
|
356 | 356 | $this->enqueue_js(); |
357 | 357 | return $this->get_html(); |
358 | 358 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * returns HTML for displaying this form section. recursively calls display_section() on all subsections |
364 | 364 | * @return string |
365 | 365 | */ |
366 | - public function get_html(){ |
|
366 | + public function get_html() { |
|
367 | 367 | $this->ensure_construct_finalized_called(); |
368 | 368 | return $this->_layout_strategy->layout_form(); |
369 | 369 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * enqueues JS for the form |
375 | 375 | * @return string |
376 | 376 | */ |
377 | - public function enqueue_js(){ |
|
377 | + public function enqueue_js() { |
|
378 | 378 | $this->_enqueue_and_localize_form_js(); |
379 | 379 | } |
380 | 380 | |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | * @param boolean $init_form_validation_automatically whether or not we want the form validation to be triggered automatically or not |
391 | 391 | * @return void |
392 | 392 | */ |
393 | - public static function wp_enqueue_scripts( $init_form_validation_automatically = false ){ |
|
394 | - add_filter( 'FHEE_load_jquery_validate', '__return_true' ); |
|
395 | - wp_register_script( 'ee_form_section_validation', EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js', array( 'jquery-validate', 'jquery-ui-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
393 | + public static function wp_enqueue_scripts($init_form_validation_automatically = false) { |
|
394 | + add_filter('FHEE_load_jquery_validate', '__return_true'); |
|
395 | + wp_register_script('ee_form_section_validation', EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js', array('jquery-validate', 'jquery-ui-datepicker'), EVENT_ESPRESSO_VERSION, TRUE); |
|
396 | 396 | |
397 | - wp_localize_script( 'ee_form_section_validation', 'ee_form_section_validation_init', array( 'init' => $init_form_validation_automatically ) ); |
|
397 | + wp_localize_script('ee_form_section_validation', 'ee_form_section_validation_init', array('init' => $init_form_validation_automatically)); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | |
@@ -404,14 +404,14 @@ discard block |
||
404 | 404 | * This needs to be called AFTER we've called $this->_enqueue_jquery_validate_script, |
405 | 405 | * but before the wordpress hook wp_loaded |
406 | 406 | */ |
407 | - public function _enqueue_and_localize_form_js(){ |
|
407 | + public function _enqueue_and_localize_form_js() { |
|
408 | 408 | $this->ensure_construct_finalized_called(); |
409 | 409 | //actually, we don't want to localize just yet. There may be other forms on the page. |
410 | 410 | //so we need to add our form section data to a static variable accessible by all form sections |
411 | 411 | //and localize it just before the footer |
412 | 412 | $this->localize_validation_rules(); |
413 | - add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 ); |
|
414 | - add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) ); |
|
413 | + add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2); |
|
414 | + add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms')); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | |
@@ -421,11 +421,11 @@ discard block |
||
421 | 421 | * @param bool $return_for_subsection |
422 | 422 | * @return void |
423 | 423 | */ |
424 | - public function localize_validation_rules( $return_for_subsection = FALSE ){ |
|
424 | + public function localize_validation_rules($return_for_subsection = FALSE) { |
|
425 | 425 | // we only want to localize vars ONCE for the entire form, so if the form section doesn't have a parent, then it must be the top dog |
426 | - if ( ! $this->parent_section() || $return_for_subsection ) { |
|
427 | - EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array( |
|
428 | - 'form_section_id'=> $this->html_id( TRUE ), |
|
426 | + if ( ! $this->parent_section() || $return_for_subsection) { |
|
427 | + EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array( |
|
428 | + 'form_section_id'=> $this->html_id(TRUE), |
|
429 | 429 | 'validation_rules'=> $this->get_jquery_validation_rules(), |
430 | 430 | 'errors'=> $this->subsection_validation_errors_by_html_name() |
431 | 431 | ); |
@@ -440,12 +440,12 @@ discard block |
||
440 | 440 | * Keys are their form names, and values are the inputs themselves |
441 | 441 | * @return EE_Form_Input_Base |
442 | 442 | */ |
443 | - public function inputs_in_subsections(){ |
|
443 | + public function inputs_in_subsections() { |
|
444 | 444 | $inputs = array(); |
445 | - foreach($this->subsections() as $subsection){ |
|
446 | - if( $subsection instanceof EE_Form_Input_Base ){ |
|
447 | - $inputs[ $subsection->html_name() ] = $subsection; |
|
448 | - }elseif($subsection instanceof EE_Form_Section_Proper ){ |
|
445 | + foreach ($this->subsections() as $subsection) { |
|
446 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
447 | + $inputs[$subsection->html_name()] = $subsection; |
|
448 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
449 | 449 | $inputs += $subsection->inputs_in_subsections(); |
450 | 450 | } |
451 | 451 | } |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | * and values are a string of all their validation errors |
459 | 459 | * @return string[] |
460 | 460 | */ |
461 | - public function subsection_validation_errors_by_html_name(){ |
|
461 | + public function subsection_validation_errors_by_html_name() { |
|
462 | 462 | $inputs = $this->inputs(); |
463 | 463 | $errors = array(); |
464 | - foreach( $inputs as $form_input ){ |
|
465 | - if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){ |
|
466 | - $errors[ $form_input->html_name() ] = $form_input->get_validation_error_string(); |
|
464 | + foreach ($inputs as $form_input) { |
|
465 | + if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) { |
|
466 | + $errors[$form_input->html_name()] = $form_input->get_validation_error_string(); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | return $errors; |
@@ -475,12 +475,12 @@ discard block |
||
475 | 475 | * passes all the form data required by the JS to the JS, and enqueues the few required JS files. |
476 | 476 | * Should be setup by each form during the _enqueues_and_localize_form_js |
477 | 477 | */ |
478 | - public static function localize_script_for_all_forms(){ |
|
478 | + public static function localize_script_for_all_forms() { |
|
479 | 479 | //allow inputs and stuff to hook in their JS and stuff here |
480 | 480 | do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin'); |
481 | 481 | EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages(); |
482 | - wp_enqueue_script( 'ee_form_section_validation' ); |
|
483 | - wp_localize_script( 'ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization ); |
|
482 | + wp_enqueue_script('ee_form_section_validation'); |
|
483 | + wp_localize_script('ee_form_section_validation', 'ee_form_section_vars', EE_Form_Section_Proper::$_js_localization); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | |
@@ -488,8 +488,8 @@ discard block |
||
488 | 488 | /** |
489 | 489 | * ensure_scripts_localized |
490 | 490 | */ |
491 | - public function ensure_scripts_localized(){ |
|
492 | - if ( ! EE_Form_Section_Proper::$_scripts_localized ) { |
|
491 | + public function ensure_scripts_localized() { |
|
492 | + if ( ! EE_Form_Section_Proper::$_scripts_localized) { |
|
493 | 493 | $this->_enqueue_and_localize_form_js(); |
494 | 494 | } |
495 | 495 | } |
@@ -501,10 +501,10 @@ discard block |
||
501 | 501 | * is that the key here should be the same as the custom validation rule put in the JS file |
502 | 502 | * @return array keys are custom validation rules, and values are internationalized strings |
503 | 503 | */ |
504 | - private static function _get_localized_error_messages(){ |
|
504 | + private static function _get_localized_error_messages() { |
|
505 | 505 | return array( |
506 | 506 | 'validUrl'=> __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"), |
507 | - 'regex' => __( 'Please check your input', 'event_espresso' ), |
|
507 | + 'regex' => __('Please check your input', 'event_espresso'), |
|
508 | 508 | ); |
509 | 509 | } |
510 | 510 | |
@@ -532,10 +532,10 @@ discard block |
||
532 | 532 | * Gets the JS to put inside the jquery validation rules for subsection of this form section. See parent function for more... |
533 | 533 | * @return array |
534 | 534 | */ |
535 | - function get_jquery_validation_rules(){ |
|
535 | + function get_jquery_validation_rules() { |
|
536 | 536 | $jquery_validation_rules = array(); |
537 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
538 | - $jquery_validation_rules = array_merge( $jquery_validation_rules, $subsection->get_jquery_validation_rules() ); |
|
537 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
538 | + $jquery_validation_rules = array_merge($jquery_validation_rules, $subsection->get_jquery_validation_rules()); |
|
539 | 539 | } |
540 | 540 | return $jquery_validation_rules; |
541 | 541 | } |
@@ -550,11 +550,11 @@ discard block |
||
550 | 550 | protected function _normalize($req_data) { |
551 | 551 | $this->_received_submission = TRUE; |
552 | 552 | $this->_validation_errors = array(); |
553 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
554 | - try{ |
|
553 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
554 | + try { |
|
555 | 555 | $subsection->_normalize($req_data); |
556 | - }catch( EE_Validation_Error $e ){ |
|
557 | - $subsection->add_validation_error( $e ); |
|
556 | + } catch (EE_Validation_Error $e) { |
|
557 | + $subsection->add_validation_error($e); |
|
558 | 558 | } |
559 | 559 | } |
560 | 560 | } |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | * calling parent::_validate() first. |
569 | 569 | */ |
570 | 570 | protected function _validate() { |
571 | - foreach($this->get_validatable_subsections() as $subsection_name => $subsection){ |
|
572 | - if(method_exists($this,'_validate_'.$subsection_name)){ |
|
573 | - call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection)); |
|
571 | + foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) { |
|
572 | + if (method_exists($this, '_validate_'.$subsection_name)) { |
|
573 | + call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection)); |
|
574 | 574 | } |
575 | 575 | $subsection->_validate(); |
576 | 576 | } |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | * Gets all the validated inputs for the form section |
583 | 583 | * @return array |
584 | 584 | */ |
585 | - public function valid_data(){ |
|
585 | + public function valid_data() { |
|
586 | 586 | $inputs = array(); |
587 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
588 | - if ( $subsection instanceof EE_Form_Section_Proper ) { |
|
589 | - $inputs[ $subsection_name ] = $subsection->valid_data(); |
|
590 | - } else if ( $subsection instanceof EE_Form_Input_Base ){ |
|
591 | - $inputs[ $subsection_name ] = $subsection->normalized_value(); |
|
587 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
588 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
589 | + $inputs[$subsection_name] = $subsection->valid_data(); |
|
590 | + } else if ($subsection instanceof EE_Form_Input_Base) { |
|
591 | + $inputs[$subsection_name] = $subsection->normalized_value(); |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | return $inputs; |
@@ -600,11 +600,11 @@ discard block |
||
600 | 600 | * Gets all the inputs on this form section |
601 | 601 | * @return EE_Form_Input_Base[] |
602 | 602 | */ |
603 | - public function inputs(){ |
|
603 | + public function inputs() { |
|
604 | 604 | $inputs = array(); |
605 | - foreach( $this->subsections() as $subsection_name =>$subsection ){ |
|
606 | - if ( $subsection instanceof EE_Form_Input_Base ){ |
|
607 | - $inputs[ $subsection_name ] = $subsection; |
|
605 | + foreach ($this->subsections() as $subsection_name =>$subsection) { |
|
606 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
607 | + $inputs[$subsection_name] = $subsection; |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | return $inputs; |
@@ -616,10 +616,10 @@ discard block |
||
616 | 616 | * Gets all the subsections which are a proper form |
617 | 617 | * @return EE_Form_Section_Proper[] |
618 | 618 | */ |
619 | - public function subforms(){ |
|
619 | + public function subforms() { |
|
620 | 620 | $form_sections = array(); |
621 | - foreach($this->subsections() as $name=>$obj){ |
|
622 | - if($obj instanceof EE_Form_Section_Proper){ |
|
621 | + foreach ($this->subsections() as $name=>$obj) { |
|
622 | + if ($obj instanceof EE_Form_Section_Proper) { |
|
623 | 623 | $form_sections[$name] = $obj; |
624 | 624 | } |
625 | 625 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | * if you only want form inputs or proper form sections. |
635 | 635 | * @return EE_Form_Section_Proper[] |
636 | 636 | */ |
637 | - public function subsections(){ |
|
637 | + public function subsections() { |
|
638 | 638 | $this->ensure_construct_finalized_called(); |
639 | 639 | return $this->_subsections; |
640 | 640 | } |
@@ -652,8 +652,8 @@ discard block |
||
652 | 652 | * it can be a multidimensional array where keys are always subsection names and values are either the |
653 | 653 | * input's normalized value, or an array like the top-level array |
654 | 654 | */ |
655 | - public function input_values( $include_subform_inputs = false, $flatten = false ){ |
|
656 | - return $this->_input_values( false, $include_subform_inputs, $flatten ); |
|
655 | + public function input_values($include_subform_inputs = false, $flatten = false) { |
|
656 | + return $this->_input_values(false, $include_subform_inputs, $flatten); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | /** |
@@ -669,8 +669,8 @@ discard block |
||
669 | 669 | * it can be a multidimensional array where keys are always subsection names and values are either the |
670 | 670 | * input's normalized value, or an array like the top-level array |
671 | 671 | */ |
672 | - public function input_pretty_values( $include_subform_inputs = false, $flatten = false ){ |
|
673 | - return $this->_input_values( true, $include_subform_inputs, $flatten ); |
|
672 | + public function input_pretty_values($include_subform_inputs = false, $flatten = false) { |
|
673 | + return $this->_input_values(true, $include_subform_inputs, $flatten); |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | /** |
@@ -683,17 +683,17 @@ discard block |
||
683 | 683 | * it can be a multidimensional array where keys are always subsection names and values are either the |
684 | 684 | * input's normalized value, or an array like the top-level array |
685 | 685 | */ |
686 | - public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) { |
|
686 | + public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) { |
|
687 | 687 | $input_values = array(); |
688 | - foreach( $this->subsections() as $subsection_name => $subsection ) { |
|
689 | - if( $subsection instanceof EE_Form_Input_Base ) { |
|
690 | - $input_values[ $subsection_name ] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value(); |
|
691 | - } else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) { |
|
692 | - $subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten ); |
|
693 | - if( $flatten ) { |
|
694 | - $input_values = array_merge( $input_values, $subform_input_values ); |
|
688 | + foreach ($this->subsections() as $subsection_name => $subsection) { |
|
689 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
690 | + $input_values[$subsection_name] = $pretty ? $subsection->pretty_value() : $subsection->normalized_value(); |
|
691 | + } else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) { |
|
692 | + $subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten); |
|
693 | + if ($flatten) { |
|
694 | + $input_values = array_merge($input_values, $subform_input_values); |
|
695 | 695 | } else { |
696 | - $input_values[ $subsection_name ] = $subform_input_values; |
|
696 | + $input_values[$subsection_name] = $subform_input_values; |
|
697 | 697 | } |
698 | 698 | } |
699 | 699 | } |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | * (ie, had receive_form_submission called on it yet) |
708 | 708 | * @return boolean |
709 | 709 | */ |
710 | - public function has_received_submission(){ |
|
710 | + public function has_received_submission() { |
|
711 | 711 | $this->ensure_construct_finalized_called(); |
712 | 712 | return $this->_received_submission; |
713 | 713 | } |
@@ -720,8 +720,8 @@ discard block |
||
720 | 720 | * @param array $inputs_to_exclude values are the input names |
721 | 721 | * @return void |
722 | 722 | */ |
723 | - public function exclude($inputs_to_exclude = array()){ |
|
724 | - foreach($inputs_to_exclude as $input_to_exclude_name){ |
|
723 | + public function exclude($inputs_to_exclude = array()) { |
|
724 | + foreach ($inputs_to_exclude as $input_to_exclude_name) { |
|
725 | 725 | unset($this->_subsections[$input_to_exclude_name]); |
726 | 726 | } |
727 | 727 | } |
@@ -731,8 +731,8 @@ discard block |
||
731 | 731 | /** |
732 | 732 | * @param array $inputs_to_hide |
733 | 733 | */ |
734 | - public function hide($inputs_to_hide= array()){ |
|
735 | - foreach($inputs_to_hide as $input_to_hide){ |
|
734 | + public function hide($inputs_to_hide = array()) { |
|
735 | + foreach ($inputs_to_hide as $input_to_hide) { |
|
736 | 736 | $input = $this->get_input($input_to_hide); |
737 | 737 | |
738 | 738 | $input->set_display_strategy(new EE_Hidden_Display_Strategy()); |
@@ -757,13 +757,13 @@ discard block |
||
757 | 757 | * or if $subsection_name_to_target is null, before or after entire subsections array |
758 | 758 | * @return void |
759 | 759 | */ |
760 | - public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){ |
|
761 | - foreach($new_subsections as $subsection_name => $subsection){ |
|
762 | - if( ! $subsection instanceof EE_Form_Section_Base){ |
|
760 | + public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) { |
|
761 | + foreach ($new_subsections as $subsection_name => $subsection) { |
|
762 | + if ( ! $subsection instanceof EE_Form_Section_Base) { |
|
763 | 763 | EE_Error::add_error( |
764 | 764 | sprintf( |
765 | 765 | __("Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.", "event_espresso"), |
766 | - get_class( $subsection ), |
|
766 | + get_class($subsection), |
|
767 | 767 | $subsection_name, |
768 | 768 | $this->name() |
769 | 769 | ) |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | } |
773 | 773 | } |
774 | 774 | |
775 | - EE_Registry::instance()->load_helper( 'Array' ); |
|
776 | - $this->_subsections = EEH_Array::insert_into_array( $this->_subsections, $new_subsections, $subsection_name_to_target, $add_before ); |
|
775 | + EE_Registry::instance()->load_helper('Array'); |
|
776 | + $this->_subsections = EEH_Array::insert_into_array($this->_subsections, $new_subsections, $subsection_name_to_target, $add_before); |
|
777 | 777 | |
778 | 778 | /*$subsections_before = array(); |
779 | 779 | if( $subsection_name_to_target ){ |
@@ -804,8 +804,8 @@ discard block |
||
804 | 804 | $this->_subsections = $new_subsections; |
805 | 805 | } |
806 | 806 | }*/ |
807 | - if( $this->_construction_finalized ){ |
|
808 | - foreach($this->_subsections as $name => $subsection){ |
|
807 | + if ($this->_construction_finalized) { |
|
808 | + foreach ($this->_subsections as $name => $subsection) { |
|
809 | 809 | $subsection->_construct_finalize($this, $name); |
810 | 810 | } |
811 | 811 | } |
@@ -816,8 +816,8 @@ discard block |
||
816 | 816 | /** |
817 | 817 | * Just gets all validatable subsections to clean their sensitive data |
818 | 818 | */ |
819 | - public function clean_sensitive_data(){ |
|
820 | - foreach($this->get_validatable_subsections() as $subsection){ |
|
819 | + public function clean_sensitive_data() { |
|
820 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
821 | 821 | $subsection->clean_sensitive_data(); |
822 | 822 | } |
823 | 823 | } |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | /** |
828 | 828 | * @param string $form_submission_error_message |
829 | 829 | */ |
830 | - public function set_submission_error_message( $form_submission_error_message = '' ) { |
|
831 | - $this->_form_submission_error_message .= ! empty( $form_submission_error_message ) ? $form_submission_error_message : __( 'Form submission failed due to errors', 'event_espresso' ); |
|
830 | + public function set_submission_error_message($form_submission_error_message = '') { |
|
831 | + $this->_form_submission_error_message .= ! empty($form_submission_error_message) ? $form_submission_error_message : __('Form submission failed due to errors', 'event_espresso'); |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | |
@@ -845,8 +845,8 @@ discard block |
||
845 | 845 | /** |
846 | 846 | * @param string $form_submission_success_message |
847 | 847 | */ |
848 | - public function set_submission_success_message( $form_submission_success_message ) { |
|
849 | - $this->_form_submission_success_message .= ! empty( $form_submission_success_message ) ? $form_submission_success_message : __( 'Form submitted successfully', 'event_espresso' ); |
|
848 | + public function set_submission_success_message($form_submission_success_message) { |
|
849 | + $this->_form_submission_success_message .= ! empty($form_submission_success_message) ? $form_submission_success_message : __('Form submitted successfully', 'event_espresso'); |
|
850 | 850 | } |
851 | 851 | |
852 | 852 | |
@@ -868,10 +868,10 @@ discard block |
||
868 | 868 | * EE_Form_Input_Base::_set_default_html_name_if_empty |
869 | 869 | * @return string |
870 | 870 | */ |
871 | - public function html_name_prefix(){ |
|
872 | - if( $this->parent_section() instanceof EE_Form_Section_Proper ){ |
|
873 | - return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']'; |
|
874 | - }else{ |
|
871 | + public function html_name_prefix() { |
|
872 | + if ($this->parent_section() instanceof EE_Form_Section_Proper) { |
|
873 | + return $this->parent_section()->html_name_prefix().'['.$this->name().']'; |
|
874 | + } else { |
|
875 | 875 | return $this->name(); |
876 | 876 | } |
877 | 877 | } |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | * was set, which is probably nothing, or the classname) |
883 | 883 | * @return string |
884 | 884 | */ |
885 | - public function name(){ |
|
885 | + public function name() { |
|
886 | 886 | $this->ensure_construct_finalized_called(); |
887 | 887 | return parent::name(); |
888 | 888 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | * |
892 | 892 | * @return EE_Form_Section_Proper |
893 | 893 | */ |
894 | - public function parent_section(){ |
|
894 | + public function parent_section() { |
|
895 | 895 | $this->ensure_construct_finalized_called(); |
896 | 896 | return parent::parent_section(); |
897 | 897 | } |
@@ -900,9 +900,9 @@ discard block |
||
900 | 900 | * make sure construction finalized was called, otherwise children might not be ready |
901 | 901 | * @return void |
902 | 902 | */ |
903 | - public function ensure_construct_finalized_called(){ |
|
904 | - if( ! $this->_construction_finalized ){ |
|
905 | - $this->_construct_finalize($this->_parent_section, $this->_name ); |
|
903 | + public function ensure_construct_finalized_called() { |
|
904 | + if ( ! $this->_construction_finalized) { |
|
905 | + $this->_construct_finalize($this->_parent_section, $this->_name); |
|
906 | 906 | } |
907 | 907 | } |
908 | 908 | |
@@ -914,17 +914,17 @@ discard block |
||
914 | 914 | * @param array $req_data |
915 | 915 | * @return boolean |
916 | 916 | */ |
917 | - public function form_data_present_in( $req_data = NULL ) { |
|
918 | - if( $req_data === NULL){ |
|
917 | + public function form_data_present_in($req_data = NULL) { |
|
918 | + if ($req_data === NULL) { |
|
919 | 919 | $req_data = $_POST; |
920 | 920 | } |
921 | - foreach( $this->subsections() as $subsection ) { |
|
922 | - if($subsection instanceof EE_Form_Input_Base ) { |
|
923 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
921 | + foreach ($this->subsections() as $subsection) { |
|
922 | + if ($subsection instanceof EE_Form_Input_Base) { |
|
923 | + if ($subsection->form_data_present_in($req_data)) { |
|
924 | 924 | return TRUE; |
925 | 925 | } |
926 | - }elseif( $subsection instanceof EE_Form_Section_Proper ) { |
|
927 | - if( $subsection->form_data_present_in( $req_data ) ) { |
|
926 | + }elseif ($subsection instanceof EE_Form_Section_Proper) { |
|
927 | + if ($subsection->form_data_present_in($req_data)) { |
|
928 | 928 | return TRUE; |
929 | 929 | } |
930 | 930 | } |
@@ -941,14 +941,14 @@ discard block |
||
941 | 941 | */ |
942 | 942 | public function get_validation_errors_accumulated() { |
943 | 943 | $validation_errors = $this->get_validation_errors(); |
944 | - foreach($this->get_validatable_subsections() as $subsection ) { |
|
945 | - if( $subsection instanceof EE_Form_Section_Proper ) { |
|
944 | + foreach ($this->get_validatable_subsections() as $subsection) { |
|
945 | + if ($subsection instanceof EE_Form_Section_Proper) { |
|
946 | 946 | $validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated(); |
947 | 947 | } else { |
948 | - $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
948 | + $validation_errors_on_this_subsection = $subsection->get_validation_errors(); |
|
949 | 949 | } |
950 | - if( $validation_errors_on_this_subsection ){ |
|
951 | - $validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection ); |
|
950 | + if ($validation_errors_on_this_subsection) { |
|
951 | + $validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection); |
|
952 | 952 | } |
953 | 953 | } |
954 | 954 | return $validation_errors; |