Completed
Branch BUG-8698-ticket-sellouts (195489)
by
unknown
87:51 queued 71:03
created
core/db_classes/EE_Ticket_Price.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/db_classes/EE_Transaction.class.php 1 patch
Spacing   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/db_classes/EE_Venue.class.php 1 patch
Spacing   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 1 patch
Spacing   +115 added lines, -116 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 1 patch
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 . '&nbsp;&nbsp;&nbsp;</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.'&nbsp;&nbsp;&nbsp;</option>';
833 833
 	}
834 834
 
835 835
 
@@ -853,56 +853,56 @@  discard block
 block discarded – undo
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
 block discarded – undo
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" . ' &nbsp; <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".' &nbsp; <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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( '&#039;', "'", $answer )));
1106
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1105
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_URL.helper.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  *
10 10
  * ------------------------------------------------------------------------
11 11
  */
12
-class EEH_URL{
12
+class EEH_URL {
13 13
 
14 14
 	/**
15 15
 	 * _add_query_arg
@@ -21,30 +21,30 @@  discard block
 block discarded – undo
21 21
 	 * @param bool  $exclude_nonce  If true then the nonce will be excluded from the generated url.
22 22
 	 * @return string
23 23
 	 */
24
-	public static function add_query_args_and_nonce( $args = array(), $url = '', $exclude_nonce = false ) {
25
-		if ( empty( $url ) ) {
26
-			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso' );
27
-			$dev_msg = $user_msg . "\n" . sprintf(
28
-					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso' ),
24
+	public static function add_query_args_and_nonce($args = array(), $url = '', $exclude_nonce = false) {
25
+		if (empty($url)) {
26
+			$user_msg = __('An error occurred. A URL is a required parameter for the add_query_args_and_nonce method.', 'event_espresso');
27
+			$dev_msg = $user_msg."\n".sprintf(
28
+					__('In order to dynamically generate nonces for your actions, you need to supply a valid URL as a second parameter for the %s::add_query_args_and_nonce method.', 'event_espresso'),
29 29
 					__CLASS__
30 30
 				);
31
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
31
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
32 32
 		}
33 33
 		// check that an action exists and add nonce
34
-		if ( ! $exclude_nonce ) {
35
-			if ( isset( $args['action'] ) && ! empty( $args['action'] ) ) {
36
-				$args = array_merge( $args, array( $args['action'] . '_nonce' => wp_create_nonce( $args['action'] . '_nonce' ) ) );
34
+		if ( ! $exclude_nonce) {
35
+			if (isset($args['action']) && ! empty($args['action'])) {
36
+				$args = array_merge($args, array($args['action'].'_nonce' => wp_create_nonce($args['action'].'_nonce')));
37 37
 			} else {
38
-				$args = array_merge( $args, array( 'action' => 'default', 'default_nonce' => wp_create_nonce( 'default_nonce' ) ) );
38
+				$args = array_merge($args, array('action' => 'default', 'default_nonce' => wp_create_nonce('default_nonce')));
39 39
 			}
40 40
 		}
41 41
 
42 42
 		//finally, let's always add a return address (if present) :)
43
-		$args = ! empty( $_REQUEST['action'] ) && ! isset( $_REQUEST[ 'return' ] )
44
-			? array_merge( $args, array( 'return' => $_REQUEST['action'] ) )
43
+		$args = ! empty($_REQUEST['action']) && ! isset($_REQUEST['return'])
44
+			? array_merge($args, array('return' => $_REQUEST['action']))
45 45
 			: $args;
46 46
 
47
-		return add_query_arg( $args, $url );
47
+		return add_query_arg($args, $url);
48 48
 
49 49
 	}
50 50
 
@@ -57,17 +57,17 @@  discard block
 block discarded – undo
57 57
 	 * @param boolean $sslverify whether we care if the SSL certificate for the requested site is setup properly
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function remote_file_exists( $url, $args = array() ){
61
-		$results = wp_remote_request($url,array_merge( array(
60
+	public static function remote_file_exists($url, $args = array()) {
61
+		$results = wp_remote_request($url, array_merge(array(
62 62
 			'method'=>'GET',
63 63
 			'redirection'=>1
64
-		), $args ) );
65
-		if( ! $results instanceof WP_Error &&
64
+		), $args));
65
+		if ( ! $results instanceof WP_Error &&
66 66
 				isset($results['response']) &&
67 67
 				isset($results['response']['code']) &&
68
-				$results['response']['code'] == '200'){
68
+				$results['response']['code'] == '200') {
69 69
 			return true;
70
-		}else{
70
+		} else {
71 71
 			return false;
72 72
 		}
73 73
 	}
@@ -83,29 +83,29 @@  discard block
 block discarded – undo
83 83
 	 * @param bool   $base_url_only - TRUE will only return the scheme and host with no other parameters
84 84
 	 * @return string
85 85
 	 */
86
-	public static function refactor_url( $url = '', $remove_query = TRUE, $base_url_only = FALSE ) {
86
+	public static function refactor_url($url = '', $remove_query = TRUE, $base_url_only = FALSE) {
87 87
 		// break apart incoming URL
88
-		$url_bits = parse_url( $url );
88
+		$url_bits = parse_url($url);
89 89
 		// HTTP or HTTPS ?
90
-		$scheme = isset( $url_bits[ 'scheme' ] ) ? $url_bits[ 'scheme' ] . '://' : 'http://';
90
+		$scheme = isset($url_bits['scheme']) ? $url_bits['scheme'].'://' : 'http://';
91 91
 		// domain
92
-		$host = isset( $url_bits[ 'host' ] ) ? $url_bits[ 'host' ] : '';
92
+		$host = isset($url_bits['host']) ? $url_bits['host'] : '';
93 93
 		// if only the base URL is requested, then return that now
94
-		if ( $base_url_only ) {
95
-			return $scheme . $host;
94
+		if ($base_url_only) {
95
+			return $scheme.$host;
96 96
 		}
97
-		$port = isset( $url_bits[ 'port' ] ) ? ':' . $url_bits[ 'port' ] : '';
98
-		$user = isset( $url_bits[ 'user' ] ) ? $url_bits[ 'user' ] : '';
99
-		$pass = isset( $url_bits[ 'pass' ] ) ? ':' . $url_bits[ 'pass' ] : '';
100
-		$pass = ( $user || $pass ) ? $pass . '@' : '';
101
-		$path = isset( $url_bits[ 'path' ] ) ? $url_bits[ 'path' ] : '';
97
+		$port = isset($url_bits['port']) ? ':'.$url_bits['port'] : '';
98
+		$user = isset($url_bits['user']) ? $url_bits['user'] : '';
99
+		$pass = isset($url_bits['pass']) ? ':'.$url_bits['pass'] : '';
100
+		$pass = ($user || $pass) ? $pass.'@' : '';
101
+		$path = isset($url_bits['path']) ? $url_bits['path'] : '';
102 102
 		// if the query string is not required, then return what we have so far
103
-		if ( $remove_query ) {
104
-			return $scheme . $user . $pass . $host . $port . $path;
103
+		if ($remove_query) {
104
+			return $scheme.$user.$pass.$host.$port.$path;
105 105
 		}
106
-		$query = isset( $url_bits[ 'query' ] ) ? '?' . $url_bits[ 'query' ] : '';
107
-		$fragment = isset( $url_bits[ 'fragment' ] ) ? '#' . $url_bits[ 'fragment' ] : '';
108
-		return $scheme . $user . $pass . $host . $port . $path . $query . $fragment;
106
+		$query = isset($url_bits['query']) ? '?'.$url_bits['query'] : '';
107
+		$fragment = isset($url_bits['fragment']) ? '#'.$url_bits['fragment'] : '';
108
+		return $scheme.$user.$pass.$host.$port.$path.$query.$fragment;
109 109
 	}
110 110
 
111 111
 
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 	 * @param bool   $as_array TRUE (default) will return query params as an array of key value pairs, FALSE will simply return the query string
119 119
 	 * @return string|array
120 120
 	 */
121
-	public static function get_query_string( $url = '', $as_array = TRUE ) {
121
+	public static function get_query_string($url = '', $as_array = TRUE) {
122 122
 		// break apart incoming URL
123
-		$url_bits = parse_url( $url );
123
+		$url_bits = parse_url($url);
124 124
 		// grab query string from URL
125
-		$query = isset( $url_bits[ 'query' ] ) ? $url_bits[ 'query' ] : '';
125
+		$query = isset($url_bits['query']) ? $url_bits['query'] : '';
126 126
 		// if we don't want the query string formatted into an array of key => value pairs, then just return it as is
127
-		if ( ! $as_array ) {
127
+		if ( ! $as_array) {
128 128
 			return $query;
129 129
 		}
130 130
 		// if no query string exists then just return an empty array now
131
-		if ( empty( $query )) {
131
+		if (empty($query)) {
132 132
 			return array();
133 133
 		}
134 134
 		// empty array to hold results
135 135
 		$query_params = array();
136 136
 		// now break apart the query string into separate params
137
-		$query = explode( '&', $query );
137
+		$query = explode('&', $query);
138 138
 		// loop thru our query params
139
-		foreach ( $query as $query_args ) {
139
+		foreach ($query as $query_args) {
140 140
 			// break apart the key value pairs
141
-			$query_args = explode( '=', $query_args );
141
+			$query_args = explode('=', $query_args);
142 142
 			// and add to our results array
143
-			$query_params[ $query_args[0] ] = $query_args[1];
143
+			$query_params[$query_args[0]] = $query_args[1];
144 144
 		}
145 145
 		return $query_params;
146 146
 	}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * prevent_prefetching
152 152
 	 * @return void
153 153
 	 */
154
-	public static function prevent_prefetching(){
154
+	public static function prevent_prefetching() {
155 155
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
156 156
 		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
157 157
 	}
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	 * @param   string $prefix Use this to prefix the string with something.
167 167
 	 * @return string
168 168
 	 */
169
-	public static function generate_unique_token( $prefix = '' ) {
170
-		$token =  md5( uniqid() . mt_rand() );
171
-		return $prefix ? $prefix . '_' . $token : $token;
169
+	public static function generate_unique_token($prefix = '') {
170
+		$token = md5(uniqid().mt_rand());
171
+		return $prefix ? $prefix.'_'.$token : $token;
172 172
 	}
173 173
 
174 174
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * add_nocache_headers
178 178
 	 * @return void
179 179
 	 */
180
-	public static function add_nocache_headers(){
180
+	public static function add_nocache_headers() {
181 181
 		// add no cache headers
182 182
 //		add_action( 'wp_head' , array( 'EED_Single_Page_Checkout', 'nocache_headers' ), 10 );
183 183
 		// plus a little extra for nginx
@@ -194,19 +194,19 @@  discard block
 block discarded – undo
194 194
 	 * @param string $server_variable
195 195
 	 * @return string
196 196
 	 */
197
-	public static function filter_input_server_url( $server_variable = 'REQUEST_URI' ){
197
+	public static function filter_input_server_url($server_variable = 'REQUEST_URI') {
198 198
 		$URL = '';
199 199
 		$server_variables = array(
200 200
 			'REQUEST_URI' => 1,
201 201
 			'HTTP_HOST' => 1,
202 202
 			'PHP_SELF' => 1,
203 203
 		);
204
-		$server_variable = strtoupper( $server_variable );
204
+		$server_variable = strtoupper($server_variable);
205 205
 		// whitelist INPUT_SERVER var
206
-		if ( isset( $server_variables[ $server_variable ] ) ) {
207
-			$URL = filter_input( INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE );
208
-			if ( empty( $URL ) ) {
209
-				$URL = esc_url( $_SERVER[ $server_variable ] );
206
+		if (isset($server_variables[$server_variable])) {
207
+			$URL = filter_input(INPUT_SERVER, $server_variable, FILTER_SANITIZE_URL, FILTER_NULL_ON_FAILURE);
208
+			if (empty($URL)) {
209
+				$URL = esc_url($_SERVER[$server_variable]);
210 210
 			}
211 211
 		}
212 212
 		return $URL;
Please login to merge, or discard this patch.
core/libraries/messages/EE_message_type.lib.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -382,12 +382,12 @@
 block discarded – undo
382 382
 
383 383
 
384 384
 	/**
385
-	* This sets up any action/filter hooks this message type puts in place for a specific messenger.  It's called from the set_messages() method.  Note that by default this does nothing.  Child classes will need to override if they want to add specific hooks for a messenger.
386
-	*
387
-	* @since 1.0.0
388
-	*
389
-	* @return void
390
-	*/
385
+	 * This sets up any action/filter hooks this message type puts in place for a specific messenger.  It's called from the set_messages() method.  Note that by default this does nothing.  Child classes will need to override if they want to add specific hooks for a messenger.
386
+	 *
387
+	 * @since 1.0.0
388
+	 *
389
+	 * @return void
390
+	 */
391 391
 	protected function _do_messenger_hooks() {
392 392
 		return;
393 393
 	}
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
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
 /**
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param  bool   $preview indicate whether a preview is being generated or not.
272 272
 	 * @return void
273 273
 	 */
274
-	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE ) {
274
+	public function set_messages($data, EE_messenger $active_messenger, $context = '', $preview = FALSE) {
275 275
 
276 276
 		$this->_active_messenger = $active_messenger;
277 277
 
@@ -280,10 +280,10 @@  discard block
 block discarded – undo
280 280
 
281 281
 		//this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send).
282 282
 		$exit = $this->_trigger_exit();
283
-		if ( $exit && ! $this->_preview ) return FALSE;
283
+		if ($exit && ! $this->_preview) return FALSE;
284 284
 
285 285
 		//todo: need to move require into registration hook but for now we'll require here.
286
-		EE_Registry::instance()->load_helper( 'Parse_Shortcodes' );
286
+		EE_Registry::instance()->load_helper('Parse_Shortcodes');
287 287
 		//get shortcode_replace instance- set when _get_messages is called in child...
288 288
 		$this->_shortcode_replace = new EEH_Parse_Shortcodes();
289 289
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 		$this->_data_handler = ! $this->_preview ? $this->_data_handler : 'Preview';
295 295
 
296 296
 		//if there is an incoming context then this is a preview so let's ONLY show the given context!
297
-		if ( !empty( $context ) ) {
298
-			$cntxt = ! empty( $this->_contexts[$context] ) ? $this->_contexts[$context] : '';
299
-			if ( ! empty( $cntxt )  ) {
297
+		if ( ! empty($context)) {
298
+			$cntxt = ! empty($this->_contexts[$context]) ? $this->_contexts[$context] : '';
299
+			if ( ! empty($cntxt)) {
300 300
 				$this->_contexts = array();
301 301
 				$this->_contexts[$context] = $cntxt;
302 302
 			}
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 		$exit = $this->_init_data();
306 306
 
307 307
 		//final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated.
308
-		if ( $exit ) return FALSE;
308
+		if ($exit) return FALSE;
309 309
 
310 310
 		$this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database.
311 311
 		$this->_assemble_messages();
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param int      $id 		Optional. Integer corresponding to the value for the primary key of a EE_Base_Class_Object
342 342
 	 * @return mixed ( EE_Base_Class||EE_Base_Class[] )
343 343
 	 */
344
-	abstract protected function _get_data_for_context( $context, EE_Registration $registration, $id );
344
+	abstract protected function _get_data_for_context($context, EE_Registration $registration, $id);
345 345
 
346 346
 
347 347
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 *
374 374
 	 * @return int
375 375
 	 */
376
-	protected function _get_id_for_msg_url( $context, EE_Registration $registration ) {
376
+	protected function _get_id_for_msg_url($context, EE_Registration $registration) {
377 377
 		return 0;
378 378
 	}
379 379
 
@@ -406,28 +406,28 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @return string          generated url
408 408
 	 */
409
-	public function get_url_trigger( $context, $sending_messenger, EE_Registration $registration ) {
409
+	public function get_url_trigger($context, $sending_messenger, EE_Registration $registration) {
410 410
 
411 411
 		//validate context
412 412
 		//valid context?
413
-		if ( !isset( $this->_contexts[$context] ) ) {
414
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
413
+		if ( ! isset($this->_contexts[$context])) {
414
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
415 415
 		}
416 416
 
417 417
 		//valid sending_messenger?
418 418
 		$not_valid_msgr = FALSE;
419
-		foreach ( $this->_with_messengers as $generating => $sendings ) {
420
-			if ( empty( $sendings ) || array_search( $sending_messenger, $sendings ) === FALSE ) {
419
+		foreach ($this->_with_messengers as $generating => $sendings) {
420
+			if (empty($sendings) || array_search($sending_messenger, $sendings) === FALSE) {
421 421
 				$not_valid_msgr = TRUE;
422 422
 			}
423 423
 		}
424 424
 
425
-		if ( $not_valid_msgr ) {
426
-			throw new EE_Error( sprintf( __('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class( $this ) ) );
425
+		if ($not_valid_msgr) {
426
+			throw new EE_Error(sprintf(__('The given sending messenger string (%s) does not match a valid sending messenger with the %s.  If this is incorrect, make sure that the message type has defined this messenger as a sending messenger in its $_with_messengers array.', 'event_espresso'), $sending_messenger, get_class($this)));
427 427
 		}
428 428
 
429 429
 		EE_Registry::instance()->load_helper('MSG_Template');
430
-		return EEH_MSG_Template::generate_url_trigger( $sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url( $context, $registration ) );
430
+		return EEH_MSG_Template::generate_url_trigger($sending_messenger, $this->_active_messenger->name, $context, $this->name, $registration, $this->_GRP_ID, $this->_get_id_for_msg_url($context, $registration));
431 431
 	}
432 432
 
433 433
 
@@ -448,19 +448,19 @@  discard block
 block discarded – undo
448 448
 	 *
449 449
 	 * @return mixed (EE_Base_Class||EE_Base_Class[])
450 450
 	 */
451
-	public function get_data_for_context( $context, EE_Registration $registration, $id = 0 ) {
451
+	public function get_data_for_context($context, EE_Registration $registration, $id = 0) {
452 452
 		//valid context?
453
-		if ( !isset( $this->_contexts[$context] ) ) {
454
-			throw new EE_Error( sprintf( __('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class( $this ) ) );
453
+		if ( ! isset($this->_contexts[$context])) {
454
+			throw new EE_Error(sprintf(__('The context %s is not a valid context for %s.', 'event_espresso'), $context, get_class($this)));
455 455
 		}
456 456
 
457 457
 		//get data and apply global and class specific filters on it.
458
-		$data = apply_filters( 'FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context( $context, $registration, $id ), $this );
459
-		$data = apply_filters( 'FHEE__' . get_class( $this ) . '__get_data_for_context__data', $data, $this );
458
+		$data = apply_filters('FHEE__EE_message_type__get_data_for_context__data', $this->_get_data_for_context($context, $registration, $id), $this);
459
+		$data = apply_filters('FHEE__'.get_class($this).'__get_data_for_context__data', $data, $this);
460 460
 
461 461
 		//if empty then something went wrong!
462
-		if ( empty( $data ) ) {
463
-			throw new EE_Error( sprintf(  __('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name ) );
462
+		if (empty($data)) {
463
+			throw new EE_Error(sprintf(__('There is no data retrieved, it is possible that the id given (%d) does not match any value in the database for the corresponding EE_Base_Class used by the data handler for the %s message type.', 'event_espresso'), $id, $this->name));
464 464
 		}
465 465
 
466 466
 		return $data;
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 	 */
496 496
 	public function with_messengers() {
497 497
 
498
-		return apply_filters( 'FHEE__EE_message_type__get_with_messengers__with_messengers__' . get_class( $this ), $this->_with_messengers);
498
+		return apply_filters('FHEE__EE_message_type__get_with_messengers__with_messengers__'.get_class($this), $this->_with_messengers);
499 499
 	}
500 500
 
501 501
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @access public
514 514
 	 * @return void
515 515
 	 */
516
-	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array() ) {
516
+	public function get_message_type_admin_page_content($page, $action = NULL, $extra = array(), $messengers = array()) {
517 517
 		//we can also further refine the context by action (if present).
518
-		return $this->_get_admin_page_content( $page, $action, $extra, $messengers );
518
+		return $this->_get_admin_page_content($page, $action, $extra, $messengers);
519 519
 	}
520 520
 
521 521
 
@@ -559,8 +559,8 @@  discard block
 block discarded – undo
559 559
 	 */
560 560
 	public function get_master_templates() {
561 561
 		//first class specific filter then filter that by the global filter.
562
-		$master_templates = apply_filters( 'FHEE__' . get_class( $this ) . '__get_master_templates', $this->_master_templates );
563
-		return apply_filters( 'FHEE__EE_message_type__get_master_templates', $master_templates, $this );
562
+		$master_templates = apply_filters('FHEE__'.get_class($this).'__get_master_templates', $this->_master_templates);
563
+		return apply_filters('FHEE__EE_message_type__get_master_templates', $master_templates, $this);
564 564
 	}
565 565
 
566 566
 
@@ -579,31 +579,31 @@  discard block
 block discarded – undo
579 579
 		/**
580 580
 		 * first let's make sure that incoming data isn't empty!
581 581
 		 */
582
-		if ( is_array($this->_data) && empty($this->_data) && !$this->_preview ) {
583
-			$msg = sprintf( __( '"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular'] );
584
-			throw new EE_Error( $msg );
582
+		if (is_array($this->_data) && empty($this->_data) && ! $this->_preview) {
583
+			$msg = sprintf(__('"%s" message type incoming data is empty.  There is nothing to work with so why are you bugging me?', 'event_espresso'), $this->label['singular']);
584
+			throw new EE_Error($msg);
585 585
 		}
586 586
 
587
-		if ( empty( $this->_data_handler) ) {
588
-			$msg = sprintf( __('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__ );
589
-			throw new EE_Error( $msg );
587
+		if (empty($this->_data_handler)) {
588
+			$msg = sprintf(__('Hey %s hasn\'t declared a handler for the incoming data, so I\'m stuck', 'event_espresso'), __CLASS__);
589
+			throw new EE_Error($msg);
590 590
 		}
591 591
 
592 592
 
593 593
 		//setup class name for the data handler
594
-		$classname = 'EE_Messages_' . $this->_data_handler . '_incoming_data';
594
+		$classname = 'EE_Messages_'.$this->_data_handler.'_incoming_data';
595 595
 
596 596
 		//check that the class exists
597
-		if ( !class_exists( $classname ) ) {
597
+		if ( ! class_exists($classname)) {
598 598
 
599 599
 			$msg[] = __('uhoh, Something went wrong and no data handler is found', 'event_espresso');
600
-			$msg[] = sprintf( __('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname );
601
-			throw new EE_error( implode('||', $msg) );
600
+			$msg[] = sprintf(__('The %s class has set the "$_data_handler" property but the string included (%s) does not match any existing "EE_Messages_incoming_data" classes (found in "/includes/core/messages/data_class").  Looking for %s.', 'event_espresso'), __CLASS__, $this->_data_handler, $classname);
601
+			throw new EE_error(implode('||', $msg));
602 602
 		}
603 603
 
604 604
 		//k lets get the prepared data object and replace existing data property with it.
605
-		$a = new ReflectionClass( $classname );
606
-		$this->_data = $a->newInstance( $this->_data );
605
+		$a = new ReflectionClass($classname);
606
+		$this->_data = $a->newInstance($this->_data);
607 607
 
608 608
 		$this->_set_default_addressee_data();
609 609
 		return $this->_process_data();
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	protected function _process_data() {
620 620
 		//at a minimum, we NEED EE_Attendee objects.
621 621
 
622
-		if ( empty( $this->_data->attendees ) )
623
-			return TRUE;  //EXIT!
622
+		if (empty($this->_data->attendees))
623
+			return TRUE; //EXIT!
624 624
 
625 625
 		//process addressees for each context.  Child classes will have to have methods for each context defined to handle the processing of the data object within them
626
-		foreach ( $this->_contexts as $context => $details ) {
627
-			$xpctd_method = '_' . $context . '_addressees';
628
-			if ( !method_exists( $this, $xpctd_method ) )
629
-				throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
630
-			 $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) );
626
+		foreach ($this->_contexts as $context => $details) {
627
+			$xpctd_method = '_'.$context.'_addressees';
628
+			if ( ! method_exists($this, $xpctd_method))
629
+				throw new EE_Error(sprintf(__('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method));
630
+			 $this->_addressees[$context] = call_user_func(array($this, $xpctd_method));
631 631
 		}
632 632
 		return FALSE; //DON'T EXIT
633 633
 	}
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 			'total_ticket_count' => $this->_data->total_ticket_count
663 663
 			);
664 664
 
665
-		if ( is_array( $this->_data->primary_attendee_data ) ) {
666
-			$this->_default_addressee_data = array_merge( $this->_default_addressee_data, $this->_data->primary_attendee_data );
665
+		if (is_array($this->_data->primary_attendee_data)) {
666
+			$this->_default_addressee_data = array_merge($this->_default_addressee_data, $this->_data->primary_attendee_data);
667 667
 			$this->_default_addressee_data['primary_att_obj'] = $this->_data->primary_attendee_data['att_obj'];
668 668
 			$this->_default_addressee_data['primary_reg_obj'] = $this->_data->primary_attendee_data['reg_obj'];
669 669
 		}
@@ -681,26 +681,26 @@  discard block
 block discarded – undo
681 681
 	 * see abstract declaration in parent class for details, children message types can override these valid shortcodes if desired (we include all for all contexts by default).
682 682
 	 */
683 683
 	protected function _set_valid_shortcodes() {
684
-		$all_shortcodes = array( 'attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger' );
684
+		$all_shortcodes = array('attendee_list', 'attendee', 'datetime_list', 'datetime', 'event_list', 'event_meta', 'event', 'organization', 'recipient_details', 'recipient_list', 'ticket_list', 'ticket', 'transaction', 'venue', 'primary_registration_details', 'primary_registration_list', 'event_author', 'email', 'messenger');
685 685
 		$contexts = $this->get_contexts();
686
-		foreach ( $contexts as $context => $details ) {
686
+		foreach ($contexts as $context => $details) {
687 687
 			$this->_valid_shortcodes[$context] = $all_shortcodes;
688 688
 
689 689
 			//make sure non admin context does not include the event_author shortcodes
690
-			if ( $context != 'admin' ) {
691
-				if( ($key = array_search('event_author', $this->_valid_shortcodes[$context] ) ) !== false) {
690
+			if ($context != 'admin') {
691
+				if (($key = array_search('event_author', $this->_valid_shortcodes[$context])) !== false) {
692 692
 					unset($this->_valid_shortcodes[$context][$key]);
693 693
 				}
694 694
 			}
695 695
 		}
696 696
 
697 697
 		//make sure admin context does not include the recipient_details shortcodes IF we have admin context hooked in message types might not have that context.
698
-		if ( !empty( $this->_valid_shortcodes['admin'] ) ) {
699
-			if( ($key = array_search('recipient_details', $this->_valid_shortcodes['admin'] ) ) !== false) {
698
+		if ( ! empty($this->_valid_shortcodes['admin'])) {
699
+			if (($key = array_search('recipient_details', $this->_valid_shortcodes['admin'])) !== false) {
700 700
 					unset($this->_valid_shortcodes['admin'][$key]);
701 701
 				}
702 702
 			//make sure admin context does not include the recipient_details shortcodes
703
-			if( ($key = array_search('recipient_list', $this->_valid_shortcodes['admin'] ) ) !== false) {
703
+			if (($key = array_search('recipient_list', $this->_valid_shortcodes['admin'])) !== false) {
704 704
 					unset($this->_valid_shortcodes['admin'][$key]);
705 705
 				}
706 706
 		}
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 	 * @param  array  $new_config array of valid shortcodes (by context)
714 714
 	 * @return void               sets valid_shortcodes property
715 715
 	 */
716
-	public function reset_valid_shortcodes_config( $new_config ) {
717
-		foreach ( $new_config as $context => $shortcodes ) {
716
+	public function reset_valid_shortcodes_config($new_config) {
717
+		foreach ($new_config as $context => $shortcodes) {
718 718
 			$this->_valid_shortcodes[$context] = $shortcodes;
719 719
 		}
720 720
 	}
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		$addressees = array();
735 735
 
736 736
 		//first we need to get the event admin user id for all the events and setup an addressee object for each unique admin user.
737
-		foreach ( $this->_data->events as $line_ref => $event ) {
737
+		foreach ($this->_data->events as $line_ref => $event) {
738 738
 			$admin_id = $this->_get_event_admin_id($event['ID']);
739 739
 			//get the user_id for the event
740 740
 			$admin_ids[] = $admin_id;
@@ -746,14 +746,14 @@  discard block
 block discarded – undo
746 746
 		$admin_ids = array_unique($admin_ids);
747 747
 
748 748
 		//k now we can loop through the event_admins and setup the addressee data.
749
-		foreach ( $admin_ids as $event_admin ) {
749
+		foreach ($admin_ids as $event_admin) {
750 750
 			$aee = array(
751 751
 				'user_id' => $event_admin,
752 752
 				'events' => $admin_events[$event_admin],
753 753
 				'attendees' => $this->_data->attendees
754 754
 				);
755
-			$aee = array_merge( $this->_default_addressee_data, $aee );
756
-			$addressees[] = new EE_Messages_Addressee( $aee );
755
+			$aee = array_merge($this->_default_addressee_data, $aee);
756
+			$addressees[] = new EE_Messages_Addressee($aee);
757 757
 		}
758 758
 
759 759
 		return $addressees;
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		$aee['attendees'] = $this->_data->attendees;
774 774
 
775 775
 		//great now we can instantiate the $addressee object and return (as an array);
776
-		$add[] = new EE_Messages_Addressee( $aee );
776
+		$add[] = new EE_Messages_Addressee($aee);
777 777
 		return $add;
778 778
 	}
779 779
 
@@ -792,38 +792,38 @@  discard block
 block discarded – undo
792 792
 		//use to verify unique attendee emails... we don't want to sent multiple copies to the same attendee do we?
793 793
 		$already_processed = array();
794 794
 
795
-		foreach ( $this->_data->attendees as $att_id => $details ) {
795
+		foreach ($this->_data->attendees as $att_id => $details) {
796 796
 			//set the attendee array to blank on each loop;
797 797
 			$aee = array();
798 798
 
799
-			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue;
799
+			if (isset($this->_data->reg_obj) && ($this->_data->reg_obj->attendee_ID() != $att_id) && $this->_single_message) continue;
800 800
 
801 801
 			//is $this->_regs_for_sending present?  If so, let's make sure we ONLY generate addressee for registrations in that array.
802
-			if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) {
803
-				$regs_allowed = array_intersect_key( array_flip( $this->_regs_for_sending ), $details['reg_objs'] );
804
-				if ( empty( $regs_allowed ) ) {
802
+			if ( ! empty($this->_regs_for_sending) && is_array($this->_regs_for_sending)) {
803
+				$regs_allowed = array_intersect_key(array_flip($this->_regs_for_sending), $details['reg_objs']);
804
+				if (empty($regs_allowed)) {
805 805
 					continue;
806 806
 				}
807 807
 			}
808 808
 
809 809
 			if (
810
-				in_array( $details['attendee_email'], $already_processed )
811
-				&& apply_filters( 'FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $data, $this )
810
+				in_array($details['attendee_email'], $already_processed)
811
+				&& apply_filters('FHEE__EE_message_type___attendee_addressees__prevent_duplicate_email_sends', true, $data, $this)
812 812
 			) {
813 813
 				continue;
814 814
 			}
815 815
 
816 816
 			$already_processed[] = $details['attendee_email'];
817 817
 
818
-			foreach ( $details as $item => $value ) {
818
+			foreach ($details as $item => $value) {
819 819
 				$aee[$item] = $value;
820
-				if ( $item == 'line_ref' ) {
821
-					foreach ( $value as $event_id ) {
820
+				if ($item == 'line_ref') {
821
+					foreach ($value as $event_id) {
822 822
 						$aee['events'][$event_id] = $this->_data->events[$event_id];
823 823
 					}
824 824
 				}
825 825
 
826
-				if ( $item == 'attendee_email' ) {
826
+				if ($item == 'attendee_email') {
827 827
 					$aee['attendee_email'] = $value;
828 828
 				}
829 829
 
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
 			$aee['attendees'] = $this->_data->attendees;
839 839
 
840 840
 			//merge in the primary attendee data
841
-			$aee = array_merge( $this->_default_addressee_data, $aee );
842
-			$add[] = new EE_Messages_Addressee( $aee );
841
+			$aee = array_merge($this->_default_addressee_data, $aee);
842
+			$add[] = new EE_Messages_Addressee($aee);
843 843
 		}
844 844
 
845 845
 		return $add;
@@ -864,46 +864,46 @@  discard block
 block discarded – undo
864 864
 		);
865 865
 
866 866
 		//in vanilla EE we're assuming there's only one event.  However, if there are multiple events then we'll just use the default templates instead of different templates per event (which could create problems).
867
-		if ( count($this->_data->events) === 1 ) {
868
-			foreach ( $this->_data->events as $event ) {
867
+		if (count($this->_data->events) === 1) {
868
+			foreach ($this->_data->events as $event) {
869 869
 				$EVT_ID = $event['ID'];
870 870
 			}
871 871
 		}
872 872
 		// is there a Group ID in the incoming request?
873
-		EE_Registry::instance()->load_core( 'Request_Handler' );
873
+		EE_Registry::instance()->load_core('Request_Handler');
874 874
 		// if not, set a default value of false
875
-		$GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID', false );
875
+		$GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID', false);
876 876
 		//if this is a preview then we just get whatever message group is for the preview and skip this part!
877
-		if ( $this->_preview && $GRP_ID ) {
878
-			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
877
+		if ($this->_preview && $GRP_ID) {
878
+			$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
879 879
 		} else {
880 880
 			//not a preview or test send so lets continue on our way!
881 881
 			//is there an evt_id?  If so let's get that. template.
882
-			if ( !empty( $EVT_ID )  ) {
882
+			if ( ! empty($EVT_ID)) {
883 883
 				$evt_qa = array(
884 884
 					'Event.EVT_ID' => $EVT_ID
885 885
 				);
886
-				$qa = array_merge( $template_qa, $evt_qa );
887
-				$mtpg = EEM_Message_Template_Group::instance()->get_one( array( $qa ) );
886
+				$qa = array_merge($template_qa, $evt_qa);
887
+				$mtpg = EEM_Message_Template_Group::instance()->get_one(array($qa));
888 888
 			}
889 889
 
890 890
 			//is there a 'GRP_ID' ? if so let's get that.
891 891
 
892 892
 			//if global template is NOT an override, and there is a 'GRP_ID' in the request, then we'll assume a specific template has ben requested.
893
-			if ( $GRP_ID ) {
894
-				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
893
+			if ($GRP_ID) {
894
+				$mtpg = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
895 895
 			}
896 896
 
897 897
 
898 898
 			$template_qa['MTP_is_global'] = TRUE;
899 899
 
900 900
 			//this gets the current global template (message template group) for the active messenger and message type.
901
-			$global_mtpg = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
901
+			$global_mtpg = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
902 902
 
903
-			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get( 'MTP_is_override' ) ? $mtpg : $global_mtpg;
903
+			$mtpg = $mtpg instanceof EE_Message_Template_Group && ! $global_mtpg->get('MTP_is_override') ? $mtpg : $global_mtpg;
904 904
 		}
905 905
 
906
-		if ( ! $mtpg instanceof EE_Message_Template_Group ) {
906
+		if ( ! $mtpg instanceof EE_Message_Template_Group) {
907 907
 			//get out because we can't process anything, there are no message template groups
908 908
 			// and thus some sort of bad setup issues.
909 909
 			return false;
@@ -919,8 +919,8 @@  discard block
 block discarded – undo
919 919
 
920 920
 
921 921
 
922
-		foreach ( $templates as $context => $template_fields ) {
923
-			foreach( $template_fields as $template_field=> $template_obj ) {
922
+		foreach ($templates as $context => $template_fields) {
923
+			foreach ($template_fields as $template_field=> $template_obj) {
924 924
 				$this->_templates[$template_field][$context] = $template_obj->get('MTP_content');
925 925
 			}
926 926
 		}
@@ -935,11 +935,11 @@  discard block
 block discarded – undo
935 935
 	protected function _assemble_messages() {
936 936
 		//make sure any set messages object is cleared
937 937
 		$this->messages = array();
938
-		foreach ( $this->_addressees as $context => $addressees ) {
939
-			foreach ( $addressees as $addressee ) {
938
+		foreach ($this->_addressees as $context => $addressees) {
939
+			foreach ($addressees as $addressee) {
940 940
 				$message = $this->_setup_message_object($context, $addressee);
941 941
 				//only assign message if everything went okay
942
-				if ( $message ) {
942
+				if ($message) {
943 943
 					$message->template_pack = $this->_template_pack;
944 944
 					$message->variation = $this->_variation;
945 945
 					$this->messages[] = $message;
@@ -963,22 +963,22 @@  discard block
 block discarded – undo
963 963
 		$m_shortcodes = $this->_active_messenger->get_valid_shortcodes();
964 964
 
965 965
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing
966
-		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview )
966
+		if ((isset($this->_templates['to'][$context]) && empty($this->_templates['to'][$context])) && ! $this->_preview)
967 967
 			return false;
968 968
 
969
-		if ( empty( $this->_templates ) ) {
969
+		if (empty($this->_templates)) {
970 970
 			//unable to setup any messages because there are no templates.  Some sort of catastrophic setup
971 971
 			//issue exists
972 972
 			return false;
973 973
 		}
974 974
 
975
-		foreach ( $this->_templates as $field => $ctxt ) {
975
+		foreach ($this->_templates as $field => $ctxt) {
976 976
 			//let's setup the valid shortcodes for the incoming context.
977 977
 			$valid_shortcodes = $mt_shortcodes[$context];
978 978
 			//merge in valid shortcodes for the field.
979 979
 			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
980
-			if ( isset( $this->_templates[$field][$context] ) ) {
981
-				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID );
980
+			if (isset($this->_templates[$field][$context])) {
981
+				$message->{$field} = $this->_shortcode_replace->parse_message_template($this->_templates[$field][$context], $addressee, $shortcodes, $this, $this->_active_messenger, $context, $this->_GRP_ID);
982 982
 			}
983 983
 		}
984 984
 		return $message;
Please login to merge, or discard this patch.
Braces   +21 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
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 6
 /**
6 7
  * Event Espresso
@@ -280,7 +281,9 @@  discard block
 block discarded – undo
280 281
 
281 282
 		//this is a special method that allows child message types to trigger an exit from generating messages early (in cases where there may be a delay on send).
282 283
 		$exit = $this->_trigger_exit();
283
-		if ( $exit && ! $this->_preview ) return FALSE;
284
+		if ( $exit && ! $this->_preview ) {
285
+			return FALSE;
286
+		}
284 287
 
285 288
 		//todo: need to move require into registration hook but for now we'll require here.
286 289
 		EE_Registry::instance()->load_helper( 'Parse_Shortcodes' );
@@ -305,7 +308,9 @@  discard block
 block discarded – undo
305 308
 		$exit = $this->_init_data();
306 309
 
307 310
 		//final check for if we exit or not cause child objects may have run conditionals that cleared out data so no addresees generated.
308
-		if ( $exit ) return FALSE;
311
+		if ( $exit ) {
312
+			return FALSE;
313
+		}
309 314
 
310 315
 		$this->_get_templates(); //get the templates that have been set with this type and for the given messenger that have been saved in the database.
311 316
 		$this->_assemble_messages();
@@ -619,14 +624,17 @@  discard block
 block discarded – undo
619 624
 	protected function _process_data() {
620 625
 		//at a minimum, we NEED EE_Attendee objects.
621 626
 
622
-		if ( empty( $this->_data->attendees ) )
623
-			return TRUE;  //EXIT!
627
+		if ( empty( $this->_data->attendees ) ) {
628
+					return TRUE;
629
+		}
630
+		//EXIT!
624 631
 
625 632
 		//process addressees for each context.  Child classes will have to have methods for each context defined to handle the processing of the data object within them
626 633
 		foreach ( $this->_contexts as $context => $details ) {
627 634
 			$xpctd_method = '_' . $context . '_addressees';
628
-			if ( !method_exists( $this, $xpctd_method ) )
629
-				throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
635
+			if ( !method_exists( $this, $xpctd_method ) ) {
636
+							throw new EE_Error( sprintf( __('The data for %1$s message type cannot be prepared because there is no set method for doing so.  The expected method name is "%2$s" please doublecheck the %1$s message type class and make sure that method is present', 'event_espresso'), $this->label['singular'], $xpctd_method) );
637
+			}
630 638
 			 $this->_addressees[$context] = call_user_func( array( $this, $xpctd_method ) );
631 639
 		}
632 640
 		return FALSE; //DON'T EXIT
@@ -796,7 +804,9 @@  discard block
 block discarded – undo
796 804
 			//set the attendee array to blank on each loop;
797 805
 			$aee = array();
798 806
 
799
-			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) continue;
807
+			if ( isset( $this->_data->reg_obj ) && ( $this->_data->reg_obj->attendee_ID() != $att_id ) && $this->_single_message ) {
808
+				continue;
809
+			}
800 810
 
801 811
 			//is $this->_regs_for_sending present?  If so, let's make sure we ONLY generate addressee for registrations in that array.
802 812
 			if ( ! empty( $this->_regs_for_sending ) && is_array( $this->_regs_for_sending ) ) {
@@ -963,8 +973,9 @@  discard block
 block discarded – undo
963 973
 		$m_shortcodes = $this->_active_messenger->get_valid_shortcodes();
964 974
 
965 975
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because this context is turned off) EXCEPT if we're previewing
966
-		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview )
967
-			return false;
976
+		if ( ( isset( $this->_templates['to'][$context] ) && empty( $this->_templates['to'][$context] ) ) && !$this->_preview ) {
977
+					return false;
978
+		}
968 979
 
969 980
 		if ( empty( $this->_templates ) ) {
970 981
 			//unable to setup any messages because there are no templates.  Some sort of catastrophic setup
Please login to merge, or discard this patch.
core/libraries/payment_methods/EE_Payment_Method_Manager.lib.php 2 patches
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 */
36 36
 	public static function instance() {
37 37
 		// check if class object is instantiated, and instantiated properly
38
-		if ( ! self::$_instance instanceof EE_Payment_Method_Manager ) {
38
+		if ( ! self::$_instance instanceof EE_Payment_Method_Manager) {
39 39
 			self::$_instance = new self();
40 40
 		}
41 41
 		EE_Registry::instance()->load_lib('PMT_Base');
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * Resets the instance and returns a new one
47 47
 	 * @return EE_Payment_Method_Manager
48 48
 	 */
49
-	public static function reset(){
49
+	public static function reset() {
50 50
 		self::$_instance = NULL;
51 51
 		return self::instance();
52 52
 	}
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 	 * or just re-use the PMTs we found last time we checked during this request (if
58 58
 	 * we have not yet checked during this request, then we need to check anyways)
59 59
 	 */
60
-	public function maybe_register_payment_methods( $force_recheck = FALSE ){
61
-		if( ! $this->_payment_method_types || $force_recheck ){
60
+	public function maybe_register_payment_methods($force_recheck = FALSE) {
61
+		if ( ! $this->_payment_method_types || $force_recheck) {
62 62
 			$this->_register_payment_methods();
63 63
 			//if in admin lets ensure caps are set.
64
-			if ( is_admin() ) {
65
-				add_filter( 'FHEE__EE_Capabilities__init_caps_map__caps', array( $this, 'add_payment_method_caps' ) );
64
+			if (is_admin()) {
65
+				add_filter('FHEE__EE_Capabilities__init_caps_map__caps', array($this, 'add_payment_method_caps'));
66 66
 				EE_Registry::instance()->CAP->init_caps();
67 67
 			}
68 68
 		}
@@ -75,19 +75,19 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _register_payment_methods() {
77 77
 		// grab list of installed modules
78
-		$pm_to_register = glob( EE_PAYMENT_METHODS . '*', GLOB_ONLYDIR );
78
+		$pm_to_register = glob(EE_PAYMENT_METHODS.'*', GLOB_ONLYDIR);
79 79
 		// filter list of modules to register
80
-		$pm_to_register = apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register );
80
+		$pm_to_register = apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', $pm_to_register);
81 81
 
82 82
 		// loop through folders
83
-		foreach ( $pm_to_register as $pm_path ) {
84
-				$this->register_payment_method( $pm_path );
83
+		foreach ($pm_to_register as $pm_path) {
84
+				$this->register_payment_method($pm_path);
85 85
 		}
86
-		do_action( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods' );
86
+		do_action('FHEE__EE_Payment_Method_Manager__register_payment_methods__registered_payment_methods');
87 87
 		// filter list of installed modules
88 88
 		//keep them organized alphabetically by the payment method type's name
89
-		ksort( $this->_payment_method_types );
90
-		return apply_filters( 'FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types );
89
+		ksort($this->_payment_method_types);
90
+		return apply_filters('FHEE__EE_Payment_Method_Manager__register_payment_methods__installed_payment_methods', $this->_payment_method_types);
91 91
 	}
92 92
 
93 93
 
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 	 * @param string $payment_method_path - full path up to and including payment method folder
100 100
 	 * @return boolean
101 101
 	 */
102
-	public function register_payment_method( $payment_method_path = '' ) {
103
-		do_action( 'AHEE__EE_Payment_Method_Manager__register_payment_method__begin',$payment_method_path );
102
+	public function register_payment_method($payment_method_path = '') {
103
+		do_action('AHEE__EE_Payment_Method_Manager__register_payment_method__begin', $payment_method_path);
104 104
 		$module_ext = '.pm.php';
105 105
 		// make all separators match
106
-		$payment_method_path = rtrim( str_replace( '/\\', DS, $payment_method_path ), DS );
106
+		$payment_method_path = rtrim(str_replace('/\\', DS, $payment_method_path), DS);
107 107
 		// grab and sanitize module name
108
-		$module_dir = basename( $payment_method_path );
108
+		$module_dir = basename($payment_method_path);
109 109
 		// create classname from module directory name
110
-		$module = str_replace( ' ', '_', str_replace( '_', ' ', $module_dir ));
110
+		$module = str_replace(' ', '_', str_replace('_', ' ', $module_dir));
111 111
 		// add class prefix
112
-		$module_class = 'EE_PMT_' . $module;
112
+		$module_class = 'EE_PMT_'.$module;
113 113
 		// does the module exist ?
114
-		if ( ! is_readable( $payment_method_path . DS . $module_class . $module_ext )) {
115
-			$msg = sprintf( __( 'The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso' ), $module );
116
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
114
+		if ( ! is_readable($payment_method_path.DS.$module_class.$module_ext)) {
115
+			$msg = sprintf(__('The requested %s payment method file could not be found or is not readable due to file permissions.', 'event_espresso'), $module);
116
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
117 117
 			return FALSE;
118 118
 		}
119
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->start_timer(); }
119
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->start_timer(); }
120 120
 		// load the module class file
121
-		require_once( $payment_method_path . DS . $module_class . $module_ext );
122
-		if ( WP_DEBUG === TRUE ) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
121
+		require_once($payment_method_path.DS.$module_class.$module_ext);
122
+		if (WP_DEBUG === TRUE) { EEH_Debug_Tools::instance()->stop_timer("Requiring payment method $module_class"); }
123 123
 		// verify that class exists
124
-		if ( ! class_exists( $module_class )) {
125
-			$msg = sprintf( __( 'The requested %s module class does not exist.', 'event_espresso' ), $module_class );
126
-			EE_Error::add_error( $msg . '||' . $msg, __FILE__, __FUNCTION__, __LINE__ );
124
+		if ( ! class_exists($module_class)) {
125
+			$msg = sprintf(__('The requested %s module class does not exist.', 'event_espresso'), $module_class);
126
+			EE_Error::add_error($msg.'||'.$msg, __FILE__, __FUNCTION__, __LINE__);
127 127
 			return FALSE;
128 128
 		}
129 129
 		// add to array of registered modules
130
-		$this->_payment_method_types[ $module ] = $payment_method_path . DS . $module_class . $module_ext;
130
+		$this->_payment_method_types[$module] = $payment_method_path.DS.$module_class.$module_ext;
131 131
 		return TRUE;
132 132
 	}
133 133
 	/**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
137 137
 	 * @return boolean
138 138
 	 */
139
-	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE){
140
-		if ( ! is_array( $this->_payment_method_types ) || ! isset( $this->_payment_method_types[$payment_method_name] )
141
-				|| $force_recheck ) {
139
+	public function payment_method_type_exists($payment_method_name, $force_recheck = FALSE) {
140
+		if ( ! is_array($this->_payment_method_types) || ! isset($this->_payment_method_types[$payment_method_name])
141
+				|| $force_recheck) {
142 142
 			$this->maybe_register_payment_methods($force_recheck);
143 143
 		}
144
-		if(isset($this->_payment_method_types[$payment_method_name])){
144
+		if (isset($this->_payment_method_types[$payment_method_name])) {
145 145
 			require_once($this->_payment_method_types[$payment_method_name]);
146 146
 			return true;
147
-		}else{
147
+		} else {
148 148
 			return false;
149 149
 		}
150 150
 	}
@@ -155,16 +155,16 @@  discard block
 block discarded – undo
155 155
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
156 156
 	 * @return array
157 157
 	 */
158
-	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE ){
158
+	public function payment_method_type_names($with_prefixes = FALSE, $force_recheck = FALSE) {
159 159
 		$this->maybe_register_payment_methods($force_recheck);
160
-		if($with_prefixes){
160
+		if ($with_prefixes) {
161 161
 			$classnames = array_keys($this->_payment_method_types);
162 162
 			$payment_methods = array();
163
-			foreach($classnames as $classname){
163
+			foreach ($classnames as $classname) {
164 164
 				$payment_methods[] = $this->payment_method_class_from_type($classname);
165 165
 			}
166 166
 			return $payment_methods;
167
-		}else{
167
+		} else {
168 168
 			return array_keys($this->_payment_method_types);
169 169
 		}
170 170
 	}
@@ -174,10 +174,10 @@  discard block
 block discarded – undo
174 174
 	 * @param boolean $force_recheck whether to force re-checking for new payment method types
175 175
 	 * @return EE_PMT_Base[]
176 176
 	 */
177
-	public function payment_method_types( $force_recheck = FALSE ){
177
+	public function payment_method_types($force_recheck = FALSE) {
178 178
 		$this->maybe_register_payment_methods($force_recheck);
179 179
 		$pmt_objs = array();
180
-		foreach($this->payment_method_type_names(true) as $classname){
180
+		foreach ($this->payment_method_type_names(true) as $classname) {
181 181
 			$pmt_objs[] = new $classname;
182 182
 		}
183 183
 		return $pmt_objs;
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 	 * @param string $classname
190 190
 	 * @return string
191 191
 	 */
192
-	public function payment_method_type_sans_class_prefix($classname){
193
-		$pmt_name = str_replace("EE_PMT_","",$classname);
192
+	public function payment_method_type_sans_class_prefix($classname) {
193
+		$pmt_name = str_replace("EE_PMT_", "", $classname);
194 194
 		return $pmt_name;
195 195
 	}
196 196
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $type
200 200
 	 * @return string
201 201
 	 */
202
-	public function payment_method_class_from_type($type){
202
+	public function payment_method_class_from_type($type) {
203 203
 		$this->maybe_register_payment_methods();
204 204
 		return "EE_PMT_".$type;
205 205
 	}
@@ -213,38 +213,38 @@  discard block
 block discarded – undo
213 213
 	 * @return \EE_Payment_Method
214 214
 	 * @throws \EE_Error
215 215
 	 */
216
-	public function activate_a_payment_method_of_type( $payment_method_type ){
216
+	public function activate_a_payment_method_of_type($payment_method_type) {
217 217
 		$payment_method = EEM_Payment_Method::instance()->get_one_of_type($payment_method_type);
218
-		if( ! $payment_method instanceof EE_Payment_Method ){
218
+		if ( ! $payment_method instanceof EE_Payment_Method) {
219 219
 			$pm_type_class = $this->payment_method_class_from_type($payment_method_type);
220
-			if(class_exists($pm_type_class)){
220
+			if (class_exists($pm_type_class)) {
221 221
 				/** @var $pm_type_obj EE_PMT_Base */
222 222
 				$pm_type_obj = new $pm_type_class;
223 223
 				$payment_method = EEM_Payment_Method::instance()->get_one_by_slug($pm_type_obj->system_name());
224
-				if( ! $payment_method){
225
-					$payment_method = $this->create_payment_method_of_type( $pm_type_obj );
224
+				if ( ! $payment_method) {
225
+					$payment_method = $this->create_payment_method_of_type($pm_type_obj);
226 226
 				}
227
-				$payment_method->set_type( $payment_method_type );
228
-				$this->initialize_payment_method( $payment_method );
227
+				$payment_method->set_type($payment_method_type);
228
+				$this->initialize_payment_method($payment_method);
229 229
 			} else {
230 230
 				throw new EE_Error(
231 231
 					sprintf(
232
-						__( 'There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
232
+						__('There is no payment method of type %1$s, so it could not be activated', 'event_espresso'),
233 233
 						$pm_type_class )
234 234
 				);
235 235
 			}
236 236
 		}
237 237
 		$payment_method->set_active();
238 238
 		$payment_method->save();
239
-		$this->set_usable_currencies_on_payment_method( $payment_method );
240
-		if( $payment_method->type() == 'Invoice' ){
241
-			$messages = EE_Registry::instance()->load_lib( 'messages' );
242
-			$messages->ensure_message_type_is_active( 'invoice', 'html' );
243
-			$messages->ensure_messenger_is_active( 'pdf' );
239
+		$this->set_usable_currencies_on_payment_method($payment_method);
240
+		if ($payment_method->type() == 'Invoice') {
241
+			$messages = EE_Registry::instance()->load_lib('messages');
242
+			$messages->ensure_message_type_is_active('invoice', 'html');
243
+			$messages->ensure_messenger_is_active('pdf');
244 244
 			EE_Error::add_attention(
245 245
 				sprintf(
246
-					__( 'Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso' ),
247
-					'<a href="' . admin_url( 'admin.php?page=espresso_messages') . '">',
246
+					__('Note, when the invoice payment method is activated, the invoice message type, html messenger, and pdf messenger are activated as well for the %1$smessages system%2$s.', 'event_espresso'),
247
+					'<a href="'.admin_url('admin.php?page=espresso_messages').'">',
248 248
 					'</a>'
249 249
 				)
250 250
 			);
@@ -258,17 +258,17 @@  discard block
 block discarded – undo
258 258
 	 * @param EE_PMT_Base $pm_type_obj
259 259
 	 * @return EE_Payment_Method
260 260
 	 */
261
-	public function create_payment_method_of_type( $pm_type_obj ) {
261
+	public function create_payment_method_of_type($pm_type_obj) {
262 262
 		global $current_user;
263 263
 		$payment_method = EE_Payment_Method::new_instance(
264 264
 			array(
265 265
 				'PMD_type' 		 => $pm_type_obj->system_name(),
266 266
 				'PMD_name' 		 => $pm_type_obj->pretty_name(),
267 267
 				'PMD_admin_name' => $pm_type_obj->pretty_name(),
268
-				'PMD_slug' 		 => $pm_type_obj->system_name(),//automatically converted to slug
268
+				'PMD_slug' 		 => $pm_type_obj->system_name(), //automatically converted to slug
269 269
 				'PMD_wp_user' 	 => $current_user->ID,
270 270
 				'PMD_order' 	 => EEM_Payment_Method::instance()->count(
271
-						array( array( 'PMD_type' => array( '!=', 'Admin_Only' )))
271
+						array(array('PMD_type' => array('!=', 'Admin_Only')))
272 272
 					) * 10,
273 273
 			)
274 274
 		);
@@ -280,21 +280,21 @@  discard block
 block discarded – undo
280 280
 	 * @param EE_Payment_Method $payment_method
281 281
 	 * @return EE_Payment_Method
282 282
 	 */
283
-	public function initialize_payment_method( $payment_method ) {
283
+	public function initialize_payment_method($payment_method) {
284 284
 		$pm_type_obj = $payment_method->type_obj();
285
-		$payment_method->set_description( $pm_type_obj->default_description() );
286
-		if( ! $payment_method->button_url() ){
287
-			$payment_method->set_button_url( $pm_type_obj->default_button_url() );
285
+		$payment_method->set_description($pm_type_obj->default_description());
286
+		if ( ! $payment_method->button_url()) {
287
+			$payment_method->set_button_url($pm_type_obj->default_button_url());
288 288
 		}
289 289
 		//now add setup its default extra meta properties
290 290
 		$extra_metas = $pm_type_obj->settings_form()->extra_meta_inputs();
291
-		if ( ! empty( $extra_metas ) ) {
291
+		if ( ! empty($extra_metas)) {
292 292
 			//verify the payment method has an ID before adding extra meta
293
-			if ( ! $payment_method->ID() ) {
293
+			if ( ! $payment_method->ID()) {
294 294
 				$payment_method->save();
295 295
 			}
296
-			foreach ( $extra_metas as $meta_name => $input ) {
297
-				$payment_method->update_extra_meta( $meta_name, $input->raw_value() );
296
+			foreach ($extra_metas as $meta_name => $input) {
297
+				$payment_method->update_extra_meta($meta_name, $input->raw_value());
298 298
 			}
299 299
 		}
300 300
 		return $payment_method;
@@ -305,8 +305,8 @@  discard block
 block discarded – undo
305 305
 	 * @param EE_Payment_Method $payment_method
306 306
 	 * @return EE_Payment_Method
307 307
 	 */
308
-	public function set_usable_currencies_on_payment_method( $payment_method ) {
309
-		foreach($payment_method->get_all_usable_currencies() as $currency_obj){
308
+	public function set_usable_currencies_on_payment_method($payment_method) {
309
+		foreach ($payment_method->get_all_usable_currencies() as $currency_obj) {
310 310
 			$payment_method->_add_relation_to($currency_obj, 'Currency');
311 311
 		}
312 312
 		return $payment_method;
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 *
325 325
 	 * @return int count of rows updated.
326 326
 	 */
327
-	public function deactivate_payment_method( $payment_method_slug ) {
328
-		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()),array(array('PMD_slug'=>$payment_method_slug)));
327
+	public function deactivate_payment_method($payment_method_slug) {
328
+		$count_updated = EEM_Payment_Method::instance()->update(array('PMD_scope'=>array()), array(array('PMD_slug'=>$payment_method_slug)));
329 329
 		return $count_updated;
330 330
 	}
331 331
 
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
 	 * @param array $caps capabilities being filtered
339 339
 	 * @return array
340 340
 	 */
341
-	public function add_payment_method_caps( $caps ) {
341
+	public function add_payment_method_caps($caps) {
342 342
 		/* add dynamic caps from payment methods
343 343
 		 * at the time of writing, october 20 2014, these are the caps added:
344 344
 		 * ee_payment_method_admin_only
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		 * their related capability automatically added too, so long as they are
354 354
 		 * registered properly using EE_Register_Payment_Method::register()
355 355
 		 */
356
-		foreach( $this->payment_method_types() as $payment_method_type_obj ){
356
+		foreach ($this->payment_method_types() as $payment_method_type_obj) {
357 357
 			$caps['administrator'][] = $payment_method_type_obj->cap_name();
358 358
 		}
359 359
 		return $caps;
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- *
4
- * Class EE_Payment_Method_Manager
5
- *
6
- * Used for finding all payment method types that can be defined.
7
- * Allows addons to easily add other payment methods
8
- *
9
- * @package     Event Espresso
10
- * @subpackage 	core
11
- * @author      Michael Nelson
12
- * @since       4.5
13
- *
14
- */
3
+	 *
4
+	 * Class EE_Payment_Method_Manager
5
+	 *
6
+	 * Used for finding all payment method types that can be defined.
7
+	 * Allows addons to easily add other payment methods
8
+	 *
9
+	 * @package     Event Espresso
10
+	 * @subpackage 	core
11
+	 * @author      Michael Nelson
12
+	 * @since       4.5
13
+	 *
14
+	 */
15 15
 class EE_Payment_Method_Manager {
16 16
 
17 17
 	/**
Please login to merge, or discard this patch.
core/libraries/rest_api/changes/Changes_In_4_8_33.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 		//is for lower than 4.8.33
14 14
 		add_filter( 
15 15
 			'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes',
16
-			array( $this, 'remove_checkin_routes_earlier_than_4_8_33' ),
16
+			array($this, 'remove_checkin_routes_earlier_than_4_8_33'),
17 17
 			10,
18 18
 			2
19 19
 		);
20 20
 		add_filter( 
21 21
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return',
22
-			array( $this, 'dont_add_headers_from_ee_notices' ),
22
+			array($this, 'dont_add_headers_from_ee_notices'),
23 23
 			10,
24 24
 			2
25 25
 		);
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 	 * @param string $version
33 33
 	 * @return array like $routes_on_this_version
34 34
 	 */
35
-	public function remove_checkin_routes_earlier_than_4_8_33( $routes_on_this_version, $version ) {
36
-		if( $this->applies_to_version(  $version ) ) {
37
-			unset( $routes_on_this_version[ 'registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)' ] );
35
+	public function remove_checkin_routes_earlier_than_4_8_33($routes_on_this_version, $version) {
36
+		if ($this->applies_to_version($version)) {
37
+			unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']);
38 38
 		}
39 39
 		return $routes_on_this_version;
40 40
 	}
@@ -45,8 +45,8 @@  discard block
 block discarded – undo
45 45
 	 * @param string $requested_version
46 46
 	 * @return array
47 47
 	 */
48
-	public function dont_add_headers_from_ee_notices( $headers_from_ee_notices, $requested_version ) {
49
-		if( $this->applies_to_version(  $requested_version ) ) {
48
+	public function dont_add_headers_from_ee_notices($headers_from_ee_notices, $requested_version) {
49
+		if ($this->applies_to_version($requested_version)) {
50 50
 			return array();
51 51
 		}
52 52
 		return $headers_from_ee_notices;
Please login to merge, or discard this patch.