Completed
Branch BUG-7537 (60d82a)
by
unknown
25:26 queued 10:39
created
core/db_classes/EE_Checkin.class.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * Event Espresso
5 5
  *
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
  * @subpackage		includes/classes/EE_Checkin.class.php
24 24
  * @author				Darren Ethier
25 25
  */
26
-class EE_Checkin extends EE_Base_Class{
26
+class EE_Checkin extends EE_Base_Class {
27 27
 
28 28
 	/**
29 29
 	 *
@@ -34,9 +34,9 @@  discard block
 block discarded – undo
34 34
 	 *                             		    date_format and the second value is the time format
35 35
 	 * @return EE_Checkin
36 36
 	 */
37
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
38
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
39
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
37
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
38
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
39
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
40 40
 	}
41 41
 
42 42
 
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 	 *                          		the website will be used.
48 48
 	 * @return EE_Checkin
49 49
 	 */
50
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
51
-		return new self( $props_n_values, TRUE, $timezone );
50
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
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_Currency.class.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EE_Currency extends EE_Base_Class{
28
+class EE_Currency extends EE_Base_Class {
29 29
 
30 30
 		/** Currency COde @var CUR_code*/ protected $_CUR_code = NULL;
31 31
 		/** Currency Name Singular @var CUR_single*/ protected $_CUR_single = NULL;
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	 *                             		    date_format and the second value is the time format
44 44
 	 * @return EE_Attendee
45 45
 	 */
46
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
47
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
48
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
46
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
47
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
48
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
49 49
 	}
50 50
 
51 51
 
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 	 *                          		the website will be used.
57 57
 	 * @return EE_Attendee
58 58
 	 */
59
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
60
-		return new self( $props_n_values, TRUE, $timezone );
59
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
60
+		return new self($props_n_values, TRUE, $timezone);
61 61
 	}
62 62
 	/**
63 63
 	 * Gets code
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 	 * Gets a prettier name
160 160
 	 * @return string
161 161
 	 */
162
-	function name(){
163
-		return sprintf(__("%s (%s)", "event_espresso"),$this->code(),$this->plural_name());
162
+	function name() {
163
+		return sprintf(__("%s (%s)", "event_espresso"), $this->code(), $this->plural_name());
164 164
 	}
165 165
 
166 166
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Currency_Payment_Method.class.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-class EE_Currency_Payment_Method extends EE_Base_Class{
29
+class EE_Currency_Payment_Method extends EE_Base_Class {
30 30
 
31 31
 	/** Currency to Payment Method Link ID @var CPM_ID*/
32 32
 	protected $_CPM_ID = NULL;
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 *                             		    date_format and the second value is the time format
49 49
 	 * @return EE_Attendee
50 50
 	 */
51
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
52
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
53
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
51
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
52
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
53
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
54 54
 	}
55 55
 
56 56
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 *                          		the website will be used.
62 62
 	 * @return EE_Attendee
63 63
 	 */
64
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
65
-		return new self( $props_n_values, TRUE, $timezone );
64
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
65
+		return new self($props_n_values, TRUE, $timezone);
66 66
 	}
67 67
 
68 68
 }
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime.class.php 1 patch
Spacing   +126 added lines, -126 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
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 	 *                             		    date_format and the second value is the time format
75 75
 	 * @return EE_Datetime
76 76
 	 */
77
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
78
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
79
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
77
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
78
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
79
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
80 80
 	}
81 81
 
82 82
 
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 	 *                          		the website will be used.
88 88
 	 * @return EE_Datetime
89 89
 	 */
90
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
91
-		return new self( $props_n_values, TRUE, $timezone );
90
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
91
+		return new self($props_n_values, TRUE, $timezone);
92 92
 	}
93 93
 
94 94
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	/**
97 97
 	 * @param $name
98 98
 	 */
99
-	public function set_name( $name ) {
100
-		$this->set( 'DTT_name', $name );
99
+	public function set_name($name) {
100
+		$this->set('DTT_name', $name);
101 101
 	}
102 102
 
103 103
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	/**
106 106
 	 * @param $description
107 107
 	 */
108
-	public function set_description( $description ) {
109
-		$this->set( 'DTT_description', $description );
108
+	public function set_description($description) {
109
+		$this->set('DTT_description', $description);
110 110
 	}
111 111
 
112 112
 
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 	 * @access        public
120 120
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
121 121
 	 */
122
-	public function set_start_date( $date ) {
123
-		$this->_set_date_for( $date, 'DTT_EVT_start' );
122
+	public function set_start_date($date) {
123
+		$this->_set_date_for($date, 'DTT_EVT_start');
124 124
 	}
125 125
 
126 126
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @access        public
134 134
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
135 135
 	 */
136
-	public function set_start_time( $time ) {
137
-		$this->_set_time_for( $time, 'DTT_EVT_start' );
136
+	public function set_start_time($time) {
137
+		$this->_set_time_for($time, 'DTT_EVT_start');
138 138
 	}
139 139
 
140 140
 
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @access        public
148 148
 	 * @param        string $date a string representation of the event's date ex:  Dec. 25, 2025 or 12-25-2025
149 149
 	 */
150
-	public function set_end_date( $date ) {
151
-		$this->_set_date_for( $date, 'DTT_EVT_end' );
150
+	public function set_end_date($date) {
151
+		$this->_set_date_for($date, 'DTT_EVT_end');
152 152
 	}
153 153
 
154 154
 
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
 	 * @access        public
162 162
 	 * @param        string $time a string representation of the event time ex:  9am  or  7:30 PM
163 163
 	 */
164
-	public function set_end_time( $time ) {
165
-		$this->_set_time_for( $time, 'DTT_EVT_end' );
164
+	public function set_end_time($time) {
165
+		$this->_set_time_for($time, 'DTT_EVT_end');
166 166
 	}
167 167
 
168 168
 
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 	 * @access        public
176 176
 	 * @param        int $reg_limit
177 177
 	 */
178
-	public function set_reg_limit( $reg_limit ) {
179
-		$this->set( 'DTT_reg_limit', $reg_limit );
178
+	public function set_reg_limit($reg_limit) {
179
+		$this->set('DTT_reg_limit', $reg_limit);
180 180
 	}
181 181
 
182 182
 
@@ -187,10 +187,10 @@  discard block
 block discarded – undo
187 187
 	 * @access        public
188 188
 	 * @param        int $sold
189 189
 	 */
190
-	public function set_sold( $sold ) {
190
+	public function set_sold($sold) {
191 191
 		// sold can not go below zero
192
-		$sold = max( 0, $sold );
193
-		$this->set( 'DTT_sold', $sold );
192
+		$sold = max(0, $sold);
193
+		$this->set('DTT_sold', $sold);
194 194
 	}
195 195
 
196 196
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * increments sold by amount passed by $qty
200 200
 	 * @param int $qty
201 201
 	 */
202
-	function increase_sold( $qty = 1 ) {
202
+	function increase_sold($qty = 1) {
203 203
 		$sold = $this->sold() + $qty;
204
-		$this->set_sold( $sold );
204
+		$this->set_sold($sold);
205 205
 	}
206 206
 
207 207
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 	 * decrements (subtracts) sold amount passed by $qty
211 211
 	 * @param int $qty
212 212
 	 */
213
-	function decrease_sold( $qty = 1 ) {
213
+	function decrease_sold($qty = 1) {
214 214
 		$sold = $this->sold() - $qty;
215
-		$this->set_sold( $sold );
215
+		$this->set_sold($sold);
216 216
 	}
217 217
 
218 218
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return string
223 223
 	 */
224 224
 	public function name() {
225
-		return $this->get( 'DTT_name' );
225
+		return $this->get('DTT_name');
226 226
 	}
227 227
 
228 228
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
 	 * @return string
233 233
 	 */
234 234
 	public function description() {
235
-		return $this->get( 'DTT_description' );
235
+		return $this->get('DTT_description');
236 236
 	}
237 237
 
238 238
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	 * @return boolean          TRUE if is primary, FALSE if not.
243 243
 	 */
244 244
 	public function is_primary() {
245
-		return $this->get( 'DTT_is_primary' );
245
+		return $this->get('DTT_is_primary');
246 246
 	}
247 247
 
248 248
 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @return int         The order of the datetime for this event.
253 253
 	 */
254 254
 	public function order() {
255
-		return $this->get( 'DTT_order' );
255
+		return $this->get('DTT_order');
256 256
 	}
257 257
 
258 258
 
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 	 * @return int
263 263
 	 */
264 264
 	public function parent() {
265
-		return $this->get( 'DTT_parent' );
265
+		return $this->get('DTT_parent');
266 266
 	}
267 267
 
268 268
 
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	 * @param    bool   $echo         - whether we echo or return (note echoing uses "pretty" formats, otherwise we use the standard formats)
279 279
 	 * @return    string|bool|void  string on success, FALSE on fail
280 280
 	 */
281
-	private function _show_datetime( $date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE ) {
281
+	private function _show_datetime($date_or_time = NULL, $start_or_end = 'start', $dt_frmt = '', $tm_frmt = '', $echo = FALSE) {
282 282
 		$field_name = "DTT_EVT_{$start_or_end}";
283
-		$dtt = $this->_get_datetime( $field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo );
284
-		if ( ! $echo ) {
283
+		$dtt = $this->_get_datetime($field_name, $dt_frmt, $tm_frmt, $date_or_time, $echo);
284
+		if ( ! $echo) {
285 285
 			return $dtt;
286 286
 		}
287 287
 		return '';
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
298 298
 	 * @return        mixed        string on success, FALSE on fail
299 299
 	 */
300
-	public function start_date( $dt_frmt = NULL ) {
301
-		return $this->_show_datetime( 'D', 'start', $dt_frmt );
300
+	public function start_date($dt_frmt = NULL) {
301
+		return $this->_show_datetime('D', 'start', $dt_frmt);
302 302
 	}
303 303
 
304 304
 
@@ -307,8 +307,8 @@  discard block
 block discarded – undo
307 307
 	 * Echoes start_date()
308 308
 	 * @param string $dt_frmt
309 309
 	 */
310
-	public function e_start_date( $dt_frmt = NULL ) {
311
-		$this->_show_datetime( 'D', 'start', $dt_frmt, NULL, TRUE );
310
+	public function e_start_date($dt_frmt = NULL) {
311
+		$this->_show_datetime('D', 'start', $dt_frmt, NULL, TRUE);
312 312
 	}
313 313
 
314 314
 
@@ -321,8 +321,8 @@  discard block
 block discarded – undo
321 321
 	 * @param null $dt_frmt - string representation of date format defaults to 'F j, Y'
322 322
 	 * @return        mixed        string on success, FALSE on fail
323 323
 	 */
324
-	public function end_date( $dt_frmt = NULL ) {
325
-		return $this->_show_datetime( 'D', 'end', $dt_frmt );
324
+	public function end_date($dt_frmt = NULL) {
325
+		return $this->_show_datetime('D', 'end', $dt_frmt);
326 326
 	}
327 327
 
328 328
 
@@ -331,8 +331,8 @@  discard block
 block discarded – undo
331 331
 	 * Echoes the end date. See end_date()
332 332
 	 * @param string $dt_frmt
333 333
 	 */
334
-	public function e_end_date( $dt_frmt = NULL ) {
335
-		$this->_show_datetime( 'D', 'end', $dt_frmt, NULL, TRUE );
334
+	public function e_end_date($dt_frmt = NULL) {
335
+		$this->_show_datetime('D', 'end', $dt_frmt, NULL, TRUE);
336 336
 	}
337 337
 
338 338
 
@@ -345,11 +345,11 @@  discard block
 block discarded – undo
345 345
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
346 346
 	 * @return        mixed        string on success, FALSE on fail
347 347
 	 */
348
-	public function date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
349
-		$dt_frmt = ! empty( $dt_frmt ) ? $dt_frmt : $this->_dt_frmt;
350
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $dt_frmt ) );
351
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end', $dt_frmt ) );
352
-		return $start != $end ? $start . $conjunction . $end : $start;
348
+	public function date_range($dt_frmt = NULL, $conjunction = ' - ') {
349
+		$dt_frmt = ! empty($dt_frmt) ? $dt_frmt : $this->_dt_frmt;
350
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $dt_frmt));
351
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $dt_frmt));
352
+		return $start != $end ? $start.$conjunction.$end : $start;
353 353
 	}
354 354
 
355 355
 
@@ -358,8 +358,8 @@  discard block
 block discarded – undo
358 358
 	 * @param null   $dt_frmt
359 359
 	 * @param string $conjunction
360 360
 	 */
361
-	public function e_date_range( $dt_frmt = NULL, $conjunction = ' - ' ) {
362
-		echo $this->date_range( $dt_frmt, $conjunction );
361
+	public function e_date_range($dt_frmt = NULL, $conjunction = ' - ') {
362
+		echo $this->date_range($dt_frmt, $conjunction);
363 363
 	}
364 364
 
365 365
 
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
372 372
 	 * @return        mixed        string on success, FALSE on fail
373 373
 	 */
374
-	public function start_time( $tm_format = NULL ) {
375
-		return $this->_show_datetime( 'T', 'start', NULL, $tm_format );
374
+	public function start_time($tm_format = NULL) {
375
+		return $this->_show_datetime('T', 'start', NULL, $tm_format);
376 376
 	}
377 377
 
378 378
 
@@ -380,8 +380,8 @@  discard block
 block discarded – undo
380 380
 	/**
381 381
 	 * @param null $tm_format
382 382
 	 */
383
-	public function e_start_time( $tm_format = NULL ) {
384
-		$this->_show_datetime( 'T', 'start', NULL, $tm_format, TRUE );
383
+	public function e_start_time($tm_format = NULL) {
384
+		$this->_show_datetime('T', 'start', NULL, $tm_format, TRUE);
385 385
 	}
386 386
 
387 387
 
@@ -393,8 +393,8 @@  discard block
 block discarded – undo
393 393
 	 * @param        string $tm_format - string representation of time format defaults to 'g:i a'
394 394
 	 * @return        mixed        string on success, FALSE on fail
395 395
 	 */
396
-	public function end_time( $tm_format = NULL ) {
397
-		return $this->_show_datetime( 'T', 'end', NULL, $tm_format );
396
+	public function end_time($tm_format = NULL) {
397
+		return $this->_show_datetime('T', 'end', NULL, $tm_format);
398 398
 	}
399 399
 
400 400
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	/**
403 403
 	 * @param null $tm_format
404 404
 	 */
405
-	public function e_end_time( $tm_format = NULL ) {
406
-		$this->_show_datetime( 'T', 'end', NULL, $tm_format, TRUE );
405
+	public function e_end_time($tm_format = NULL) {
406
+		$this->_show_datetime('T', 'end', NULL, $tm_format, TRUE);
407 407
 	}
408 408
 
409 409
 
@@ -416,12 +416,12 @@  discard block
 block discarded – undo
416 416
 	 * @param        string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31
417 417
 	 * @return        mixed        string on success, FALSE on fail
418 418
 	 */
419
-	public function time_range( $tm_format = NULL, $conjunction = ' - ' ) {
420
-		$tm_format = !empty( $tm_format ) ? $tm_format : $this->_tm_frmt;
419
+	public function time_range($tm_format = NULL, $conjunction = ' - ') {
420
+		$tm_format = ! empty($tm_format) ? $tm_format : $this->_tm_frmt;
421 421
 
422
-		$start = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_start', $tm_format ) );
423
-		$end = str_replace( ' ', '&nbsp;', $this->get_i18n_datetime( 'DTT_EVT_end',  $tm_format ) );
424
-		return $start != $end ? $start . $conjunction . $end : $start;
422
+		$start = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_start', $tm_format));
423
+		$end = str_replace(' ', '&nbsp;', $this->get_i18n_datetime('DTT_EVT_end', $tm_format));
424
+		return $start != $end ? $start.$conjunction.$end : $start;
425 425
 	}
426 426
 
427 427
 
@@ -430,8 +430,8 @@  discard block
 block discarded – undo
430 430
 	 * @param null   $tm_format
431 431
 	 * @param string $conjunction
432 432
 	 */
433
-	public function e_time_range( $tm_format = NULL, $conjunction = ' - ' ) {
434
-		echo $this->time_range( $tm_format, $conjunction );
433
+	public function e_time_range($tm_format = NULL, $conjunction = ' - ') {
434
+		echo $this->time_range($tm_format, $conjunction);
435 435
 	}
436 436
 
437 437
 
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
 	 * @param 	string 	$tm_format - string representation of time format defaults to 'g:i a'
445 445
 	 * @return 	mixed 	string on success, FALSE on fail
446 446
 	 */
447
-	public function start_date_and_time( $dt_format = NULL, $tm_format = NULL ) {
448
-		return $this->_show_datetime( '', 'start', $dt_format, $tm_format );
447
+	public function start_date_and_time($dt_format = NULL, $tm_format = NULL) {
448
+		return $this->_show_datetime('', 'start', $dt_format, $tm_format);
449 449
 	}
450 450
 
451 451
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	 * @param null $dt_frmt
455 455
 	 * @param null $tm_format
456 456
 	 */
457
-	public function e_start_date_and_time( $dt_frmt = NULL, $tm_format = NULL ) {
458
-		$this->_show_datetime( '', 'start', $dt_frmt, $tm_format, TRUE );
457
+	public function e_start_date_and_time($dt_frmt = NULL, $tm_format = NULL) {
458
+		$this->_show_datetime('', 'start', $dt_frmt, $tm_format, TRUE);
459 459
 	}
460 460
 
461 461
 
@@ -469,11 +469,11 @@  discard block
 block discarded – undo
469 469
 	 * @param bool   $round_up
470 470
 	 * @return float|int|mixed
471 471
 	 */
472
-	public function length( $units = 'seconds', $round_up = FALSE ) {
473
-		$start = $this->get_raw( 'DTT_EVT_start' );
474
-		$end = $this->get_raw( 'DTT_EVT_end' );
472
+	public function length($units = 'seconds', $round_up = FALSE) {
473
+		$start = $this->get_raw('DTT_EVT_start');
474
+		$end = $this->get_raw('DTT_EVT_end');
475 475
 		$length_in_units = $end - $start;
476
-		switch ( $units ) {
476
+		switch ($units) {
477 477
 			//NOTE: We purposefully don't use "break;" in order to chain the divisions
478 478
 			/** @noinspection PhpMissingBreakStatementInspection */
479 479
 			case 'days':
@@ -486,10 +486,10 @@  discard block
 block discarded – undo
486 486
 				$length_in_units /= 60;
487 487
 			case 'seconds':
488 488
 			default:
489
-				$length_in_units = ceil( $length_in_units );
489
+				$length_in_units = ceil($length_in_units);
490 490
 		}
491
-		if ( $round_up ) {
492
-			$length_in_units = max( $length_in_units, 1 );
491
+		if ($round_up) {
492
+			$length_in_units = max($length_in_units, 1);
493 493
 		}
494 494
 		return $length_in_units;
495 495
 	}
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
 	 * @param bool | string 	$tm_format - string representation of time format defaults to 'g:i a'
505 505
 	 * @return 	mixed        		string on success, FALSE on fail
506 506
 	 */
507
-	public function end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
508
-		return $this->_show_datetime( '', 'end', $dt_frmt, $tm_format );
507
+	public function end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
508
+		return $this->_show_datetime('', 'end', $dt_frmt, $tm_format);
509 509
 	}
510 510
 
511 511
 
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 	 * @param bool $dt_frmt
515 515
 	 * @param bool $tm_format
516 516
 	 */
517
-	public function e_end_date_and_time( $dt_frmt = FALSE, $tm_format = FALSE ) {
518
-		$this->_show_datetime( '', 'end', $dt_frmt, $tm_format, TRUE );
517
+	public function e_end_date_and_time($dt_frmt = FALSE, $tm_format = FALSE) {
518
+		$this->_show_datetime('', 'end', $dt_frmt, $tm_format, TRUE);
519 519
 	}
520 520
 
521 521
 
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 	 * @return        int
528 528
 	 */
529 529
 	public function start() {
530
-		return $this->get_raw( 'DTT_EVT_start' );
530
+		return $this->get_raw('DTT_EVT_start');
531 531
 	}
532 532
 
533 533
 
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	 * @return        int
540 540
 	 */
541 541
 	public function end() {
542
-		return $this->get_raw( 'DTT_EVT_end' );
542
+		return $this->get_raw('DTT_EVT_end');
543 543
 	}
544 544
 
545 545
 
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 	 * @return        mixed        int on success, FALSE on fail
552 552
 	 */
553 553
 	public function reg_limit() {
554
-		return $this->get_raw( 'DTT_reg_limit' );
554
+		return $this->get_raw('DTT_reg_limit');
555 555
 	}
556 556
 
557 557
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 	 * @return        mixed        int on success, FALSE on fail
564 564
 	 */
565 565
 	public function sold() {
566
-		return $this->get_raw( 'DTT_sold' );
566
+		return $this->get_raw('DTT_sold');
567 567
 	}
568 568
 
569 569
 
@@ -592,15 +592,15 @@  discard block
 block discarded – undo
592 592
 	 * 																	the spaces remaining for this particular datetime, hence the flag.
593 593
 	 * @return 	int
594 594
 	 */
595
-	public function spaces_remaining( $consider_tickets = FALSE ) {
595
+	public function spaces_remaining($consider_tickets = FALSE) {
596 596
 		// tickets remaining available for purchase
597 597
 		//no need for special checks for infinite, because if DTT_reg_limit == EE_INF, then EE_INF - x = EE_INF
598 598
 		$dtt_remaining = $this->reg_limit() - $this->sold();
599
-		if ( ! $consider_tickets ) {
599
+		if ( ! $consider_tickets) {
600 600
 			return $dtt_remaining;
601 601
 		}
602 602
 		$tickets_remaining = $this->tickets_remaining();
603
-		return min( $dtt_remaining, $tickets_remaining );
603
+		return min($dtt_remaining, $tickets_remaining);
604 604
 	}
605 605
 
606 606
 
@@ -611,19 +611,19 @@  discard block
 block discarded – undo
611 611
 	 * @param array $query_params like EEM_Base::get_all's
612 612
 	 * @return int
613 613
 	 */
614
-	public function tickets_remaining( $query_params = array() ) {
614
+	public function tickets_remaining($query_params = array()) {
615 615
 		$sum = 0;
616
-		$tickets = $this->tickets( $query_params );
617
-		if ( ! empty( $tickets ) ) {
618
-			foreach ( $tickets as $ticket ) {
619
-				if ( $ticket instanceof EE_Ticket ) {
616
+		$tickets = $this->tickets($query_params);
617
+		if ( ! empty($tickets)) {
618
+			foreach ($tickets as $ticket) {
619
+				if ($ticket instanceof EE_Ticket) {
620 620
 					// get the actual amount of tickets that can be sold
621
-					$qty = $ticket->qty( 'saleable' );
622
-					if ( $qty === EE_INF ) {
621
+					$qty = $ticket->qty('saleable');
622
+					if ($qty === EE_INF) {
623 623
 						return EE_INF;
624 624
 					}
625 625
 					// no negative ticket quantities plz
626
-					if ( $qty > 0 ) {
626
+					if ($qty > 0) {
627 627
 						$sum += $qty;
628 628
 					}
629 629
 				}
@@ -640,8 +640,8 @@  discard block
 block discarded – undo
640 640
 	 * @param array $query_params like EEM_Base::get_all's
641 641
 	 * @return int
642 642
 	 */
643
-	public function sum_tickets_initially_available( $query_params = array() ) {
644
-		return $this->sum_related( 'Ticket', $query_params, 'TKT_qty' );
643
+	public function sum_tickets_initially_available($query_params = array()) {
644
+		return $this->sum_related('Ticket', $query_params, 'TKT_qty');
645 645
 	}
646 646
 
647 647
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @return int
654 654
 	 */
655 655
 	public function total_tickets_available_at_this_datetime() {
656
-		return $this->spaces_remaining( true );
656
+		return $this->spaces_remaining(true);
657 657
 	}
658 658
 
659 659
 
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return boolean
665 665
 	 */
666 666
 	public function is_upcoming() {
667
-		return ( $this->get_raw( 'DTT_EVT_start' ) > time() );
667
+		return ($this->get_raw('DTT_EVT_start') > time());
668 668
 	}
669 669
 
670 670
 
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 	 * @return boolean
675 675
 	 */
676 676
 	public function is_active() {
677
-		return ( $this->get_raw( 'DTT_EVT_start' ) < time() && $this->get_raw( 'DTT_EVT_end' ) > time() );
677
+		return ($this->get_raw('DTT_EVT_start') < time() && $this->get_raw('DTT_EVT_end') > time());
678 678
 	}
679 679
 
680 680
 
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 	 * @return boolean
685 685
 	 */
686 686
 	public function is_expired() {
687
-		return ( $this->get_raw( 'DTT_EVT_end' ) < time() );
687
+		return ($this->get_raw('DTT_EVT_end') < time());
688 688
 	}
689 689
 
690 690
 
@@ -695,16 +695,16 @@  discard block
 block discarded – undo
695 695
 	 */
696 696
 	public function get_active_status() {
697 697
 		$total_tickets_for_this_dtt = $this->total_tickets_available_at_this_datetime();
698
-		if ( $total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1 ) {
698
+		if ($total_tickets_for_this_dtt !== FALSE && $total_tickets_for_this_dtt < 1) {
699 699
 			return EE_Datetime::sold_out;
700 700
 		}
701
-		if ( $this->is_expired() ) {
701
+		if ($this->is_expired()) {
702 702
 			return EE_Datetime::expired;
703 703
 		}
704
-		if ( $this->is_upcoming() ) {
704
+		if ($this->is_upcoming()) {
705 705
 			return EE_Datetime::upcoming;
706 706
 		}
707
-		if ( $this->is_active() ) {
707
+		if ($this->is_active()) {
708 708
 			return EE_Datetime::active;
709 709
 		}
710 710
 		return NULL;
@@ -718,24 +718,24 @@  discard block
 block discarded – undo
718 718
 	 * @param  boolean $use_dtt_name if TRUE then we'll use DTT->name() if its not empty.
719 719
 	 * @return string
720 720
 	 */
721
-	public function get_dtt_display_name( $use_dtt_name = FALSE ) {
722
-		if ( $use_dtt_name ) {
721
+	public function get_dtt_display_name($use_dtt_name = FALSE) {
722
+		if ($use_dtt_name) {
723 723
 			$dtt_name = $this->name();
724
-			if ( !empty( $dtt_name ) ) {
724
+			if ( ! empty($dtt_name)) {
725 725
 				return $dtt_name;
726 726
 			}
727 727
 		}
728 728
 		//first condition is to see if the months are different
729
-		if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) ) {
730
-			$display_date = $this->start_date( 'M j\, Y g:i a' ) . ' - ' . $this->end_date( 'M j\, Y g:i a' );
729
+		if (date('m', $this->get_raw('DTT_EVT_start')) != date('m', $this->get_raw('DTT_EVT_end'))) {
730
+			$display_date = $this->start_date('M j\, Y g:i a').' - '.$this->end_date('M j\, Y g:i a');
731 731
 			//next condition is if its the same month but different day
732 732
 		}
733 733
 		else {
734
-			if ( date( 'm', $this->get_raw( 'DTT_EVT_start' ) ) == date( 'm', $this->get_raw( 'DTT_EVT_end' ) ) && date( 'd', $this->get_raw( 'DTT_EVT_start' ) ) != date( 'd', $this->get_raw( 'DTT_EVT_end' ) ) ) {
735
-				$display_date = $this->start_date( 'M j\, g:i a' ) . ' - ' . $this->end_date( 'M j\, g:i a Y' );
734
+			if (date('m', $this->get_raw('DTT_EVT_start')) == date('m', $this->get_raw('DTT_EVT_end')) && date('d', $this->get_raw('DTT_EVT_start')) != date('d', $this->get_raw('DTT_EVT_end'))) {
735
+				$display_date = $this->start_date('M j\, g:i a').' - '.$this->end_date('M j\, g:i a Y');
736 736
 			}
737 737
 			else {
738
-				$display_date = $this->start_date( 'F j\, Y' ) . ' @ ' . $this->start_date( 'g:i a' ) . ' - ' . $this->end_date( 'g:i a' );
738
+				$display_date = $this->start_date('F j\, Y').' @ '.$this->start_date('g:i a').' - '.$this->end_date('g:i a');
739 739
 			}
740 740
 		}
741 741
 		return $display_date;
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 *@param array $query_params see EEM_Base::get_all()
750 750
 	 * @return EE_Ticket[]
751 751
 	 */
752
-	public function tickets( $query_params = array() ) {
753
-		return $this->get_many_related( 'Ticket', $query_params );
752
+	public function tickets($query_params = array()) {
753
+		return $this->get_many_related('Ticket', $query_params);
754 754
 	}
755 755
 
756 756
 
@@ -760,21 +760,21 @@  discard block
 block discarded – undo
760 760
 	 * @param array $query_params like EEM_Base::get_all's
761 761
 	 * @return EE_Ticket[]
762 762
 	 */
763
-	public function ticket_types_available_for_purchase( $query_params = array() ) {
763
+	public function ticket_types_available_for_purchase($query_params = array()) {
764 764
 		// first check if datetime is valid
765
-		if ( ! ( $this->is_upcoming() || $this->is_active() ) || $this->sold_out() ) {
765
+		if ( ! ($this->is_upcoming() || $this->is_active()) || $this->sold_out()) {
766 766
 			return array();
767 767
 		}
768
-		if ( empty( $query_params ) ) {
768
+		if (empty($query_params)) {
769 769
 			$query_params = array(
770 770
 				array(
771
-					'TKT_start_date' => array( '<=', EEM_Ticket::instance()->current_time_for_query( 'TKT_start_date' ) ),
772
-					'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
771
+					'TKT_start_date' => array('<=', EEM_Ticket::instance()->current_time_for_query('TKT_start_date')),
772
+					'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
773 773
 					'TKT_deleted'    => false
774 774
 				)
775 775
 			);
776 776
 		}
777
-		return $this->tickets( $query_params );
777
+		return $this->tickets($query_params);
778 778
 	}
779 779
 
780 780
 
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 	 * @return EE_Event
785 785
 	 */
786 786
 	public function event() {
787
-		return $this->get_first_related( 'Event' );
787
+		return $this->get_first_related('Event');
788 788
 	}
789 789
 
790 790
 
@@ -796,13 +796,13 @@  discard block
 block discarded – undo
796 796
 	 */
797 797
 	public function update_sold() {
798 798
 		$count_regs_for_this_datetime = EEM_Registration::instance()->count(
799
-			array( array(
799
+			array(array(
800 800
 				'STS_ID' 					=> EEM_Registration::status_id_approved,
801 801
 				'REG_deleted' 				=> 0,
802 802
 				'Ticket.Datetime.DTT_ID' 	=> $this->ID(),
803
-			) )
803
+			))
804 804
 		);
805
-		$this->set( 'DTT_sold', $count_regs_for_this_datetime );
805
+		$this->set('DTT_sold', $count_regs_for_this_datetime);
806 806
 		$this->save();
807 807
 		return $count_regs_for_this_datetime;
808 808
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Datetime_Ticket.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
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Attendee
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $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 = null, $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
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Attendee
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 } //end EE_Datetime_Ticket class
Please login to merge, or discard this patch.
core/db_classes/EE_Event.class.php 1 patch
Spacing   +216 added lines, -216 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
 /**
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Event
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $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 = null, $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
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Event
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param mixed  $field_value
62 62
 	 * @param bool   $use_default
63 63
 	 */
64
-	public function set( $field_name, $field_value, $use_default = false ) {
65
-		switch ( $field_name ) {
64
+	public function set($field_name, $field_value, $use_default = false) {
65
+		switch ($field_name) {
66 66
 			case 'status' :
67
-				$this->set_status( $field_value, $use_default );
67
+				$this->set_status($field_value, $use_default);
68 68
 				break;
69 69
 			default :
70
-				parent::set( $field_name, $field_value, $use_default );
70
+				parent::set($field_name, $field_value, $use_default);
71 71
 		}
72 72
 	}
73 73
 
@@ -86,29 +86,29 @@  discard block
 block discarded – undo
86 86
 	 * @return bool|void
87 87
 	 * @throws \EE_Error
88 88
 	 */
89
-	public function set_status( $new_status = null, $use_default = false ) {
89
+	public function set_status($new_status = null, $use_default = false) {
90 90
 		// get current Event status
91 91
 		$old_status = $this->status();
92 92
 		// if status has changed
93
-		if ( $old_status != $new_status ) {
93
+		if ($old_status != $new_status) {
94 94
 			// TO sold_out
95
-			if ( $new_status == EEM_Event::sold_out ) {
95
+			if ($new_status == EEM_Event::sold_out) {
96 96
 				// save the previous event status so that we can revert if the event is no longer sold out
97
-				$this->add_post_meta( '_previous_event_status', $old_status );
98
-				do_action( 'AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status );
97
+				$this->add_post_meta('_previous_event_status', $old_status);
98
+				do_action('AHEE__EE_Event__set_status__to_sold_out', $this, $old_status, $new_status);
99 99
 				// OR FROM  sold_out
100
-			} else if ( $old_status == EEM_Event::sold_out ) {
101
-				$this->delete_post_meta( '_previous_event_status' );
102
-				do_action( 'AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status );
100
+			} else if ($old_status == EEM_Event::sold_out) {
101
+				$this->delete_post_meta('_previous_event_status');
102
+				do_action('AHEE__EE_Event__set_status__from_sold_out', $this, $old_status, $new_status);
103 103
 			}
104 104
 			// update status
105
-			parent::set( 'status', $new_status, $use_default );
106
-			do_action( 'AHEE__EE_Event__set_status__after_update', $this );
105
+			parent::set('status', $new_status, $use_default);
106
+			do_action('AHEE__EE_Event__set_status__after_update', $this);
107 107
 			return true;
108 108
 		} else {
109 109
 			// even though the old value matches the new value, it's still good to
110 110
 			// allow the parent set method to have a say
111
-			parent::set( 'status', $new_status, $use_default );
111
+			parent::set('status', $new_status, $use_default);
112 112
 			return true;
113 113
 		}
114 114
 	}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params like EEM_Base::get_all
122 122
 	 * @return EE_Datetime[]
123 123
 	 */
124
-	public function datetimes( $query_params = array() ) {
125
-		return $this->get_many_related( 'Datetime', $query_params );
124
+	public function datetimes($query_params = array()) {
125
+		return $this->get_many_related('Datetime', $query_params);
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return EE_Datetime[]
134 134
 	 */
135 135
 	public function datetimes_in_chronological_order() {
136
-		return $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) );
136
+		return $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC')));
137 137
 	}
138 138
 
139 139
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param null $limit
150 150
 	 * @return \EE_Datetime[]
151 151
 	 */
152
-	public function datetimes_ordered( $show_expired = true, $show_deleted = false, $limit = null ) {
153
-		return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_event_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted, $limit );
152
+	public function datetimes_ordered($show_expired = true, $show_deleted = false, $limit = null) {
153
+		return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_event_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted, $limit);
154 154
 	}
155 155
 
156 156
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 * @return EE_Datetime
161 161
 	 */
162 162
 	public function first_datetime() {
163
-		return $this->get_first_related( 'Datetime' );
163
+		return $this->get_first_related('Datetime');
164 164
 	}
165 165
 
166 166
 
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	 * @param bool $try_to_exclude_deleted
172 172
 	 * @return EE_Datetime
173 173
 	 */
174
-	public function primary_datetime( $try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE ) {
175
-		if ( !empty ( $this->_Primary_Datetime ) ) {
174
+	public function primary_datetime($try_to_exclude_expired = TRUE, $try_to_exclude_deleted = TRUE) {
175
+		if ( ! empty ($this->_Primary_Datetime)) {
176 176
 			return $this->_Primary_Datetime;
177 177
 		}
178
-		$this->_Primary_Datetime = EEM_Datetime::instance( $this->_timezone )->get_primary_datetime_for_event( $this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted );
178
+		$this->_Primary_Datetime = EEM_Datetime::instance($this->_timezone)->get_primary_datetime_for_event($this->ID(), $try_to_exclude_expired, $try_to_exclude_deleted);
179 179
 		return $this->_Primary_Datetime;
180 180
 	}
181 181
 
@@ -186,30 +186,30 @@  discard block
 block discarded – undo
186 186
 	 * @param array $query_params like EEM_Base::get_all
187 187
 	 * @return EE_Ticket[]
188 188
 	 */
189
-	public function tickets( $query_params = array() ) {
189
+	public function tickets($query_params = array()) {
190 190
 		//first get all datetimes
191 191
 		$datetimes = $this->datetimes_ordered();
192
-		if ( ! $datetimes ) {
192
+		if ( ! $datetimes) {
193 193
 			return array();
194 194
 		}
195 195
 
196 196
 		$datetime_ids = array();
197
-		foreach ( $datetimes as $datetime ) {
197
+		foreach ($datetimes as $datetime) {
198 198
 			$datetime_ids[] = $datetime->ID();
199 199
 		}
200 200
 
201
-		$where_params = array( 'Datetime.DTT_ID' => array( 'IN', $datetime_ids ) );
201
+		$where_params = array('Datetime.DTT_ID' => array('IN', $datetime_ids));
202 202
 
203 203
 		//if incoming $query_params has where conditions let's merge but not override existing.
204
-		if ( is_array( $query_params ) && isset( $query_params[0]) ) {
205
-			$where_params = array_merge( $query_params[0], $where_params );
206
-			unset( $query_params[0] );
204
+		if (is_array($query_params) && isset($query_params[0])) {
205
+			$where_params = array_merge($query_params[0], $where_params);
206
+			unset($query_params[0]);
207 207
 		}
208 208
 
209 209
 		//now add $where_params to $query_params
210 210
 		$query_params[0] = $where_params;
211 211
 
212
-		return EEM_Ticket::instance()->get_all( $query_params );
212
+		return EEM_Ticket::instance()->get_all($query_params);
213 213
 	}
214 214
 
215 215
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 	 * @return bool
219 219
 	 */
220 220
 	function additional_limit() {
221
-		return $this->get( 'EVT_additional_limit' );
221
+		return $this->get('EVT_additional_limit');
222 222
 	}
223 223
 
224 224
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @return bool
228 228
 	 */
229 229
 	function allow_overflow() {
230
-		return $this->get( 'EVT_allow_overflow' );
230
+		return $this->get('EVT_allow_overflow');
231 231
 	}
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 	 * @return bool
237 237
 	 */
238 238
 	function created() {
239
-		return $this->get( 'EVT_created' );
239
+		return $this->get('EVT_created');
240 240
 	}
241 241
 
242 242
 
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * @return bool
246 246
 	 */
247 247
 	function description() {
248
-		return $this->get( 'EVT_desc' );
248
+		return $this->get('EVT_desc');
249 249
 	}
250 250
 
251 251
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	 * @return string of html
256 256
 	 */
257 257
 	function description_filtered() {
258
-		return $this->get_pretty( 'EVT_desc' );
258
+		return $this->get_pretty('EVT_desc');
259 259
 	}
260 260
 
261 261
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @return bool
265 265
 	 */
266 266
 	function display_description() {
267
-		return $this->get( 'EVT_display_desc' );
267
+		return $this->get('EVT_display_desc');
268 268
 	}
269 269
 
270 270
 
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	 * @return bool
274 274
 	 */
275 275
 	function display_ticket_selector() {
276
-		return (bool)$this->get( 'EVT_display_ticket_selector' );
276
+		return (bool) $this->get('EVT_display_ticket_selector');
277 277
 	}
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	 * @return bool
283 283
 	 */
284 284
 	function external_url() {
285
-		return $this->get( 'EVT_external_URL' );
285
+		return $this->get('EVT_external_URL');
286 286
 	}
287 287
 
288 288
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	 * @return bool
292 292
 	 */
293 293
 	function member_only() {
294
-		return $this->get( 'EVT_member_only' );
294
+		return $this->get('EVT_member_only');
295 295
 	}
296 296
 
297 297
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @return bool
301 301
 	 */
302 302
 	function phone() {
303
-		return $this->get( 'EVT_phone' );
303
+		return $this->get('EVT_phone');
304 304
 	}
305 305
 
306 306
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @return bool
310 310
 	 */
311 311
 	function modified() {
312
-		return $this->get( 'EVT_modified' );
312
+		return $this->get('EVT_modified');
313 313
 	}
314 314
 
315 315
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 	 * @return bool
319 319
 	 */
320 320
 	function name() {
321
-		return $this->get( 'EVT_name' );
321
+		return $this->get('EVT_name');
322 322
 	}
323 323
 
324 324
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @return bool
328 328
 	 */
329 329
 	function order() {
330
-		return $this->get( 'EVT_order' );
330
+		return $this->get('EVT_order');
331 331
 	}
332 332
 
333 333
 
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @return bool|string
337 337
 	 */
338 338
 	function default_registration_status() {
339
-		$event_default_registration_status = $this->get( 'EVT_default_registration_status' );
340
-		return !empty( $event_default_registration_status ) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
339
+		$event_default_registration_status = $this->get('EVT_default_registration_status');
340
+		return ! empty($event_default_registration_status) ? $event_default_registration_status : EE_Registry::instance()->CFG->registration->default_STS_ID;
341 341
 	}
342 342
 
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param bool $not_full_desc
349 349
 	 * @return bool|string
350 350
 	 */
351
-	function short_description( $num_words = 55, $more = NULL, $not_full_desc = FALSE ) {
352
-		$short_desc = $this->get( 'EVT_short_desc' );
353
-		if ( !empty( $short_desc ) || $not_full_desc ) {
351
+	function short_description($num_words = 55, $more = NULL, $not_full_desc = FALSE) {
352
+		$short_desc = $this->get('EVT_short_desc');
353
+		if ( ! empty($short_desc) || $not_full_desc) {
354 354
 			return $short_desc;
355 355
 		}
356 356
 		else {
357
-			$full_desc = $this->get( 'EVT_desc' );
358
-			return wp_trim_words( $full_desc, $num_words, $more );
357
+			$full_desc = $this->get('EVT_desc');
358
+			return wp_trim_words($full_desc, $num_words, $more);
359 359
 		}
360 360
 	}
361 361
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 * @return bool
366 366
 	 */
367 367
 	function slug() {
368
-		return $this->get( 'EVT_slug' );
368
+		return $this->get('EVT_slug');
369 369
 	}
370 370
 
371 371
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return bool
375 375
 	 */
376 376
 	function timezone_string() {
377
-		return $this->get( 'EVT_timezone_string' );
377
+		return $this->get('EVT_timezone_string');
378 378
 	}
379 379
 
380 380
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return bool
384 384
 	 */
385 385
 	function visible_on() {
386
-		return $this->get( 'EVT_visible_on' );
386
+		return $this->get('EVT_visible_on');
387 387
 	}
388 388
 
389 389
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 * @return bool
393 393
 	 */
394 394
 	function wp_user() {
395
-		return $this->get( 'EVT_wp_user' );
395
+		return $this->get('EVT_wp_user');
396 396
 	}
397 397
 
398 398
 
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	 * @return bool
402 402
 	 */
403 403
 	function donations() {
404
-		return $this->get( 'EVT_donations' );
404
+		return $this->get('EVT_donations');
405 405
 	}
406 406
 
407 407
 
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 	/**
410 410
 	 * @param $limit
411 411
 	 */
412
-	function set_additional_limit( $limit ) {
413
-		$this->set( 'EVT_additional_limit', $limit );
412
+	function set_additional_limit($limit) {
413
+		$this->set('EVT_additional_limit', $limit);
414 414
 	}
415 415
 
416 416
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	/**
419 419
 	 * @param $created
420 420
 	 */
421
-	function set_created( $created ) {
422
-		$this->set( 'EVT_created', $created );
421
+	function set_created($created) {
422
+		$this->set('EVT_created', $created);
423 423
 	}
424 424
 
425 425
 
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param $desc
429 429
 	 */
430
-	function set_description( $desc ) {
431
-		$this->set( 'EVT_desc', $desc );
430
+	function set_description($desc) {
431
+		$this->set('EVT_desc', $desc);
432 432
 	}
433 433
 
434 434
 
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 	/**
437 437
 	 * @param $display_desc
438 438
 	 */
439
-	function set_display_description( $display_desc ) {
440
-		$this->set( 'EVT_display_desc', $display_desc );
439
+	function set_display_description($display_desc) {
440
+		$this->set('EVT_display_desc', $display_desc);
441 441
 	}
442 442
 
443 443
 
@@ -445,8 +445,8 @@  discard block
 block discarded – undo
445 445
 	/**
446 446
 	 * @param $display_ticket_selector
447 447
 	 */
448
-	function set_display_ticket_selector( $display_ticket_selector ) {
449
-		$this->set( 'EVT_display_ticket_selector', $display_ticket_selector );
448
+	function set_display_ticket_selector($display_ticket_selector) {
449
+		$this->set('EVT_display_ticket_selector', $display_ticket_selector);
450 450
 	}
451 451
 
452 452
 
@@ -454,8 +454,8 @@  discard block
 block discarded – undo
454 454
 	/**
455 455
 	 * @param $external_url
456 456
 	 */
457
-	function set_external_url( $external_url ) {
458
-		$this->set( 'EVT_external_URL', $external_url );
457
+	function set_external_url($external_url) {
458
+		$this->set('EVT_external_URL', $external_url);
459 459
 	}
460 460
 
461 461
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 	/**
464 464
 	 * @param $member_only
465 465
 	 */
466
-	function set_member_only( $member_only ) {
467
-		$this->set( 'EVT_member_only', $member_only );
466
+	function set_member_only($member_only) {
467
+		$this->set('EVT_member_only', $member_only);
468 468
 	}
469 469
 
470 470
 
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	/**
473 473
 	 * @param $event_phone
474 474
 	 */
475
-	function set_event_phone( $event_phone ) {
476
-		$this->set( 'EVT_phone', $event_phone );
475
+	function set_event_phone($event_phone) {
476
+		$this->set('EVT_phone', $event_phone);
477 477
 	}
478 478
 
479 479
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 	/**
482 482
 	 * @param $modified
483 483
 	 */
484
-	function set_modified( $modified ) {
485
-		$this->set( 'EVT_modified', $modified );
484
+	function set_modified($modified) {
485
+		$this->set('EVT_modified', $modified);
486 486
 	}
487 487
 
488 488
 
@@ -490,8 +490,8 @@  discard block
 block discarded – undo
490 490
 	/**
491 491
 	 * @param $name
492 492
 	 */
493
-	function set_name( $name ) {
494
-		$this->set( 'EVT_name', $name );
493
+	function set_name($name) {
494
+		$this->set('EVT_name', $name);
495 495
 	}
496 496
 
497 497
 
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
 	/**
500 500
 	 * @param $order
501 501
 	 */
502
-	function set_order( $order ) {
503
-		$this->set( 'EVT_order', $order );
502
+	function set_order($order) {
503
+		$this->set('EVT_order', $order);
504 504
 	}
505 505
 
506 506
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	/**
509 509
 	 * @param $short_desc
510 510
 	 */
511
-	function set_short_description( $short_desc ) {
512
-		$this->set( 'EVT_short_desc', $short_desc );
511
+	function set_short_description($short_desc) {
512
+		$this->set('EVT_short_desc', $short_desc);
513 513
 	}
514 514
 
515 515
 
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 	/**
518 518
 	 * @param $slug
519 519
 	 */
520
-	function set_slug( $slug ) {
521
-		$this->set( 'EVT_slug', $slug );
520
+	function set_slug($slug) {
521
+		$this->set('EVT_slug', $slug);
522 522
 	}
523 523
 
524 524
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 	/**
527 527
 	 * @param $timezone_string
528 528
 	 */
529
-	function set_timezone_string( $timezone_string ) {
530
-		$this->set( 'EVT_timezone_string', $timezone_string );
529
+	function set_timezone_string($timezone_string) {
530
+		$this->set('EVT_timezone_string', $timezone_string);
531 531
 	}
532 532
 
533 533
 
@@ -535,8 +535,8 @@  discard block
 block discarded – undo
535 535
 	/**
536 536
 	 * @param $visible_on
537 537
 	 */
538
-	function set_visible_on( $visible_on ) {
539
-		$this->set( 'EVT_visible_on', $visible_on );
538
+	function set_visible_on($visible_on) {
539
+		$this->set('EVT_visible_on', $visible_on);
540 540
 	}
541 541
 
542 542
 
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	/**
545 545
 	 * @param $wp_user
546 546
 	 */
547
-	function set_wp_user( $wp_user ) {
548
-		$this->set( 'EVT_wp_user', $wp_user );
547
+	function set_wp_user($wp_user) {
548
+		$this->set('EVT_wp_user', $wp_user);
549 549
 	}
550 550
 
551 551
 
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 	/**
554 554
 	 * @param $default_registration_status
555 555
 	 */
556
-	function set_default_registration_status( $default_registration_status ) {
557
-		$this->set( 'EVT_default_registration_status', $default_registration_status );
556
+	function set_default_registration_status($default_registration_status) {
557
+		$this->set('EVT_default_registration_status', $default_registration_status);
558 558
 	}
559 559
 
560 560
 
@@ -562,8 +562,8 @@  discard block
 block discarded – undo
562 562
 	/**
563 563
 	 * @param $donations
564 564
 	 */
565
-	function set_donations( $donations ) {
566
-		$this->set( 'EVT_donations', $donations );
565
+	function set_donations($donations) {
566
+		$this->set('EVT_donations', $donations);
567 567
 	}
568 568
 
569 569
 
@@ -573,8 +573,8 @@  discard block
 block discarded – undo
573 573
 	 * @param EE_Venue /int $venue_id_or_obj
574 574
 	 * @return EE_Venue
575 575
 	 */
576
-	function add_venue( $venue_id_or_obj ) {
577
-		return $this->_add_relation_to( $venue_id_or_obj, 'Venue' );
576
+	function add_venue($venue_id_or_obj) {
577
+		return $this->_add_relation_to($venue_id_or_obj, 'Venue');
578 578
 	}
579 579
 
580 580
 
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 * @param EE_Venue /int $venue_id_or_obj
585 585
 	 * @return EE_Venue
586 586
 	 */
587
-	function remove_venue( $venue_id_or_obj ) {
588
-		return $this->_remove_relation_to( $venue_id_or_obj, 'Venue' );
587
+	function remove_venue($venue_id_or_obj) {
588
+		return $this->_remove_relation_to($venue_id_or_obj, 'Venue');
589 589
 	}
590 590
 
591 591
 
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 	 * @param array $query_params like EEM_Base::get_all's $query_params
596 596
 	 * @return EE_Venue[]
597 597
 	 */
598
-	function venues( $query_params = array() ) {
599
-		return $this->get_many_related( 'Venue', $query_params );
598
+	function venues($query_params = array()) {
599
+		return $this->get_many_related('Venue', $query_params);
600 600
 	}
601 601
 
602 602
 
@@ -608,7 +608,7 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	private function _has_ID_and_is_published() {
610 610
 		// first check if event id is present and not NULL, then check if this event is published (or any of the equivalent "published" statuses)
611
-		return ( $this->ID() && $this->ID() !== NULL && ( $this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled ) ) ? TRUE : FALSE;
611
+		return ($this->ID() && $this->ID() !== NULL && ($this->status() == 'publish' || $this->status() == EEM_Event::sold_out || $this->status() == EEM_Event::postponed || $this->status() == EEM_Event::cancelled)) ? TRUE : FALSE;
612 612
 	}
613 613
 
614 614
 
@@ -620,21 +620,21 @@  discard block
 block discarded – undo
620 620
 	 */
621 621
 	public function is_upcoming() {
622 622
 		// check if event id is present and if this event is published
623
-		if ( $this->is_inactive() ) {
623
+		if ($this->is_inactive()) {
624 624
 			return FALSE;
625 625
 		}
626 626
 		// set initial value
627 627
 		$upcoming = FALSE;
628 628
 		//next let's get all datetimes and loop through them
629 629
 		$datetimes = $this->datetimes_in_chronological_order();
630
-		foreach ( $datetimes as $datetime ) {
631
-			if ( $datetime instanceof EE_Datetime ) {
630
+		foreach ($datetimes as $datetime) {
631
+			if ($datetime instanceof EE_Datetime) {
632 632
 				//if this dtt is expired then we continue cause one of the other datetimes might be upcoming.
633
-				if ( $datetime->is_expired() ) {
633
+				if ($datetime->is_expired()) {
634 634
 					continue;
635 635
 				}
636 636
 				//if this dtt is active then we return false.
637
-				if ( $datetime->is_active() ) {
637
+				if ($datetime->is_active()) {
638 638
 					return FALSE;
639 639
 				}
640 640
 				//otherwise let's check upcoming status
@@ -651,21 +651,21 @@  discard block
 block discarded – undo
651 651
 	 */
652 652
 	public function is_active() {
653 653
 		// check if event id is present and if this event is published
654
-		if ( $this->is_inactive() ) {
654
+		if ($this->is_inactive()) {
655 655
 			return FALSE;
656 656
 		}
657 657
 		// set initial value
658 658
 		$active = FALSE;
659 659
 		//next let's get all datetimes and loop through them
660 660
 		$datetimes = $this->datetimes_in_chronological_order();
661
-		foreach ( $datetimes as $datetime ) {
662
-			if ( $datetime instanceof EE_Datetime ) {
661
+		foreach ($datetimes as $datetime) {
662
+			if ($datetime instanceof EE_Datetime) {
663 663
 				//if this dtt is expired then we continue cause one of the other datetimes might be active.
664
-				if ( $datetime->is_expired() ) {
664
+				if ($datetime->is_expired()) {
665 665
 					continue;
666 666
 				}
667 667
 				//if this dtt is upcoming then we return false.
668
-				if ( $datetime->is_upcoming() ) {
668
+				if ($datetime->is_upcoming()) {
669 669
 					return FALSE;
670 670
 				}
671 671
 				//otherwise let's check active status
@@ -682,17 +682,17 @@  discard block
 block discarded – undo
682 682
 	 */
683 683
 	public function is_expired() {
684 684
 		// check if event id is present and if this event is published
685
-		if ( $this->is_inactive() ) {
685
+		if ($this->is_inactive()) {
686 686
 			return FALSE;
687 687
 		}
688 688
 		// set initial value
689 689
 		$expired = FALSE;
690 690
 		//first let's get all datetimes and loop through them
691 691
 		$datetimes = $this->datetimes_in_chronological_order();
692
-		foreach ( $datetimes as $datetime ) {
693
-			if ( $datetime instanceof EE_Datetime ) {
692
+		foreach ($datetimes as $datetime) {
693
+			if ($datetime instanceof EE_Datetime) {
694 694
 				//if this dtt is upcoming or active then we return false.
695
-				if ( $datetime->is_upcoming() || $datetime->is_active() ) {
695
+				if ($datetime->is_upcoming() || $datetime->is_active()) {
696 696
 					return FALSE;
697 697
 				}
698 698
 				//otherwise let's check active status
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 	 */
710 710
 	public function is_inactive() {
711 711
 		// check if event id is present and if this event is published
712
-		if ( $this->_has_ID_and_is_published() ) {
712
+		if ($this->_has_ID_and_is_published()) {
713 713
 			return FALSE;
714 714
 		}
715 715
 		return TRUE;
@@ -727,37 +727,37 @@  discard block
 block discarded – undo
727 727
 	 */
728 728
 	public function perform_sold_out_status_check() {
729 729
 		// get all unexpired untrashed tickets
730
-		$tickets = $this->tickets( array(
730
+		$tickets = $this->tickets(array(
731 731
 			array(
732
-				'TKT_end_date'   => array( '>=', EEM_Ticket::instance()->current_time_for_query( 'TKT_end_date' ) ),
732
+				'TKT_end_date'   => array('>=', EEM_Ticket::instance()->current_time_for_query('TKT_end_date')),
733 733
 				'TKT_deleted'    => false
734 734
 			)
735 735
 		));
736 736
 		// if all the tickets are just expired, then don't update the event status to sold out
737
-		if ( empty( $tickets )) {
737
+		if (empty($tickets)) {
738 738
 			return true;
739 739
 		}
740 740
 		// set initial value
741 741
 		$spaces_remaining = 0;
742
-		foreach( $tickets as $ticket ) {
743
-			if ( $ticket instanceof EE_Ticket ) {
744
-				$spaces_remaining += $ticket->qty( 'saleable' );
742
+		foreach ($tickets as $ticket) {
743
+			if ($ticket instanceof EE_Ticket) {
744
+				$spaces_remaining += $ticket->qty('saleable');
745 745
 			}
746 746
 		}
747
-		if ( $spaces_remaining === 0 ) {
748
-			$this->set_status( EEM_Event::sold_out );
749
-			if ( !is_admin() || ( is_admin() && defined( 'DOING_AJAX' ) ) ) {
747
+		if ($spaces_remaining === 0) {
748
+			$this->set_status(EEM_Event::sold_out);
749
+			if ( ! is_admin() || (is_admin() && defined('DOING_AJAX'))) {
750 750
 				$this->save();
751 751
 			}
752 752
 			$sold_out = TRUE;
753 753
 		} else {
754 754
 			$sold_out = FALSE;
755 755
 			// was event previously marked as sold out ?
756
-			if ( $this->status() == EEM_Event::sold_out ) {
756
+			if ($this->status() == EEM_Event::sold_out) {
757 757
 				// revert status to previous value, if it was set
758
-				$previous_event_status = $this->get_post_meta( '_previous_event_status', true );
759
-				if ( $previous_event_status ) {
760
-					$this->set_status( $previous_event_status );
758
+				$previous_event_status = $this->get_post_meta('_previous_event_status', true);
759
+				if ($previous_event_status) {
760
+					$this->set_status($previous_event_status);
761 761
 				}
762 762
 			}
763 763
 		}
@@ -781,15 +781,15 @@  discard block
 block discarded – undo
781 781
 	 */
782 782
 	public function spaces_remaining_for_sale() {
783 783
 		//first get total available spaces including consideration for tickets that have already sold.
784
-		$spaces_available = $this->total_available_spaces( true );
784
+		$spaces_available = $this->total_available_spaces(true);
785 785
 
786 786
 		//if total available = 0, then exit right away because that means everything is expired.
787
-		if ( $spaces_available === 0 ) {
787
+		if ($spaces_available === 0) {
788 788
 			return 0;
789 789
 		}
790 790
 
791 791
 		//subtract total approved registrations from spaces available to get how many are remaining.
792
-		$spots_taken = EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
792
+		$spots_taken = EEM_Registration::instance()->count(array(array('EVT_ID' => $this->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
793 793
 		$spaces_remaining = $spaces_available - $spots_taken;
794 794
 
795 795
 		return $spaces_remaining > 0 ? $spaces_remaining : 0;
@@ -822,29 +822,29 @@  discard block
 block discarded – undo
822 822
 	 *
823 823
 	 * @return  int|float  (Note: if EE_INF is returned its considered a float by PHP)
824 824
 	 */
825
-	public function total_available_spaces( $current_total_available = false ) {
825
+	public function total_available_spaces($current_total_available = false) {
826 826
 		$spaces_available = 0;
827 827
 
828 828
 		//first get all tickets on the event and include expired tickets
829
-		$tickets = $this->tickets( array( 'default_where_conditions' => 'none' ) );
829
+		$tickets = $this->tickets(array('default_where_conditions' => 'none'));
830 830
 		$ticket_sums = array();
831 831
 		$datetime_limits = array();
832 832
 
833 833
 		//loop through tickets and normalize them
834
-		foreach ( $tickets as $ticket ) {
835
-			$datetimes = $ticket->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
834
+		foreach ($tickets as $ticket) {
835
+			$datetimes = $ticket->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
836 836
 
837
-			if ( empty( $datetimes ) ) {
837
+			if (empty($datetimes)) {
838 838
 				continue;
839 839
 			}
840 840
 
841 841
 			//first datetime should be the lowest datetime
842
-			$least_datetime = reset( $datetimes );
842
+			$least_datetime = reset($datetimes);
843 843
 
844 844
 			//lets reset the ticket quantity to be the lower of either the lowest datetime reg limit or the ticket quantity
845 845
 			//IF datetimes sold (and we're not doing current live total available, then use spaces remaining for datetime, not reg_limit.
846
-			if ( $current_total_available ) {
847
-				if ( $ticket->is_remaining() ) {
846
+			if ($current_total_available) {
847
+				if ($ticket->is_remaining()) {
848 848
 					$remaining = $ticket->remaining();
849 849
 				} else {
850 850
 					$spaces_available += $ticket->sold();
@@ -852,23 +852,23 @@  discard block
 block discarded – undo
852 852
 					continue;
853 853
 				}
854 854
 			} else {
855
-				$remaining = min( $ticket->qty(), $least_datetime->reg_limit() );
855
+				$remaining = min($ticket->qty(), $least_datetime->reg_limit());
856 856
 			}
857 857
 
858 858
 			//if $ticket_limit == infinity then let's drop out right away and just return that because any infinity amount trumps all other "available" amounts.
859
-			if ( $remaining == EE_INF ) {
859
+			if ($remaining == EE_INF) {
860 860
 				return EE_INF;
861 861
 			}
862 862
 
863 863
 			//multiply normalized $tkt quantity by the number of datetimes on the ticket as the "sum"
864 864
 			//also include the sum of all the datetime reg limits on the ticket for breaking ties.
865
-			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count( $datetimes );
865
+			$ticket_sums[$ticket->ID()]['sum'] = $remaining * count($datetimes);
866 866
 			$ticket_sums[$ticket->ID()]['datetime_sums'] = 0;
867
-			foreach ( $datetimes as $datetime ) {
868
-				if ( $datetime->reg_limit() === EE_INF ) {
867
+			foreach ($datetimes as $datetime) {
868
+				if ($datetime->reg_limit() === EE_INF) {
869 869
 					$ticket_sums[$ticket->ID()]['datetime_sums'] = EE_INF;
870 870
 				} else {
871
-					$ticket_sums[ $ticket->ID() ]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
871
+					$ticket_sums[$ticket->ID()]['datetime_sums'] += $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
872 872
 				}
873 873
 				$datetime_limits[$datetime->ID()] = $current_total_available ? $datetime->spaces_remaining() : $datetime->reg_limit();
874 874
 			}
@@ -879,74 +879,74 @@  discard block
 block discarded – undo
879 879
 		//ticket quantity by the number of datetimes on the ticket).  For tie-breakers, then the next sort is based on the
880 880
 		//ticket with the greatest sum of all remaining datetime->spaces_remaining() ( or $datetime->reg_limit() if not
881 881
 		//$current_total_available ) for the datetimes on the ticket.
882
-		usort( $ticket_sums, function( $a, $b ) {
883
-			if ( $a['sum'] == $b['sum'] ) {
884
-				if ( $a['datetime_sums'] == $b['datetime_sums'] ) {
882
+		usort($ticket_sums, function($a, $b) {
883
+			if ($a['sum'] == $b['sum']) {
884
+				if ($a['datetime_sums'] == $b['datetime_sums']) {
885 885
 					return 0;
886 886
 				}
887 887
 
888 888
 				return $a['datetime_sums'] < $b['datetime_sums'] ? 1 : -1;
889 889
 			}
890
-			return ( $a['sum'] < $b['sum'] ) ? -1 : 1;
890
+			return ($a['sum'] < $b['sum']) ? -1 : 1;
891 891
 		});
892 892
 
893 893
 		//now let's loop through the sorted tickets and simulate sellouts
894
-		foreach ( $ticket_sums as $ticket_info ) {
895
-			if ( $ticket_info['ticket'] instanceof EE_Ticket ) {
894
+		foreach ($ticket_sums as $ticket_info) {
895
+			if ($ticket_info['ticket'] instanceof EE_Ticket) {
896 896
 
897
-				$datetimes = $ticket_info['ticket']->datetimes( array( 'order_by' => array( 'DTT_reg_limit' => 'ASC' ) ) );
897
+				$datetimes = $ticket_info['ticket']->datetimes(array('order_by' => array('DTT_reg_limit' => 'ASC')));
898 898
 				//need to sort these $datetimes by remaining (only if $current_total_available)
899 899
 				//setup datetimes for simulation
900 900
 				$ticket_datetimes_remaining = array();
901
-				foreach( $datetimes as $datetime ) {
901
+				foreach ($datetimes as $datetime) {
902 902
 					$ticket_datetimes_remaining[$datetime->ID()]['rem'] = $datetime_limits[$datetime->ID()];
903 903
 					$ticket_datetimes_remaining[$datetime->ID()]['datetime'] = $datetime;
904 904
 				}
905
-				usort( $ticket_datetimes_remaining, function( $a, $b ) {
906
-					if ( $a['rem'] == $b['rem'] ) {
905
+				usort($ticket_datetimes_remaining, function($a, $b) {
906
+					if ($a['rem'] == $b['rem']) {
907 907
 						return 0;
908 908
 					}
909
-					return ( $a['rem'] < $b['rem'] ) ? -1 : 1;
909
+					return ($a['rem'] < $b['rem']) ? -1 : 1;
910 910
 				});
911 911
 
912 912
 
913 913
 				//get the remaining on the first datetime (which should be the one with the least remaining) and that is
914 914
 				//what we add to the spaces_available running total.  Then we need to decrease the remaining on our datetime tracker.
915
-				$lowest_datetime = reset( $ticket_datetimes_remaining );
915
+				$lowest_datetime = reset($ticket_datetimes_remaining);
916 916
 
917 917
 				//need to get the lower of; what the remaining is on the lowest datetime, and the remaining on the ticket.
918 918
 				// If this ends up being 0 (because of previous tickets in our simulation selling out), then it has already
919 919
 				// been tracked on $spaces available and this ticket is now sold out for the simulation, so we can continue
920 920
 				// to the next ticket.
921
-				if ( $current_total_available ) {
922
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->remaining() );
921
+				if ($current_total_available) {
922
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->remaining());
923 923
 				} else {
924
-					$remaining = min( $lowest_datetime['rem'], $ticket_info['ticket']->qty() );
924
+					$remaining = min($lowest_datetime['rem'], $ticket_info['ticket']->qty());
925 925
 				}
926 926
 
927 927
 				//if $remaining is infinite that means that all datetimes on this ticket are infinite but we've made it here because all
928 928
 				//tickets have a quantity.  So we don't have to track datetimes, we can just use ticket quantities for total
929 929
 				//available.
930
-				if ( $remaining === EE_INF ) {
930
+				if ($remaining === EE_INF) {
931 931
 					$spaces_available += $ticket_info['ticket']->qty();
932 932
 					continue;
933 933
 				}
934 934
 
935 935
 				//if ticket has sold amounts then we also need to add that (but only if doing live counts)
936
-				if ( $current_total_available ) {
936
+				if ($current_total_available) {
937 937
 					$spaces_available += $ticket_info['ticket']->sold();
938 938
 				}
939 939
 
940
-				if ( $remaining <= 0 ) {
940
+				if ($remaining <= 0) {
941 941
 					continue;
942 942
 				} else {
943 943
 					$spaces_available += $remaining;
944 944
 				}
945 945
 
946 946
 				//loop through the datetimes and sell them out!
947
-				foreach ( $ticket_datetimes_remaining as $datetime_info ) {
948
-					if ( $datetime_info['datetime'] instanceof EE_Datetime ) {
949
-						$datetime_limits[ $datetime_info['datetime']->ID() ] += - $remaining;
947
+				foreach ($ticket_datetimes_remaining as $datetime_info) {
948
+					if ($datetime_info['datetime'] instanceof EE_Datetime) {
949
+						$datetime_limits[$datetime_info['datetime']->ID()] += - $remaining;
950 950
 					}
951 951
 				}
952 952
 			}
@@ -962,8 +962,8 @@  discard block
 block discarded – undo
962 962
 	 * @param  bool $actual whether or not to perform calculations to not only figure the actual status but also to flip the status if necessary to sold out If false, we just check the existing status of the event
963 963
 	 * @return boolean
964 964
 	 */
965
-	public function is_sold_out( $actual = FALSE ) {
966
-		if ( ! $actual ) {
965
+	public function is_sold_out($actual = FALSE) {
966
+		if ( ! $actual) {
967 967
 			return $this->status() == EEM_Event::sold_out;
968 968
 		}
969 969
 		else {
@@ -1008,30 +1008,30 @@  discard block
 block discarded – undo
1008 1008
 	 *
1009 1009
 	 * @return bool | string - based on EE_Datetime active constants or FALSE if error.
1010 1010
 	 */
1011
-	public function get_active_status( $reset = false ) {
1011
+	public function get_active_status($reset = false) {
1012 1012
 		// if the active status has already been set, then just use that value (unless we are resetting it)
1013
-		if ( ! empty( $this->_active_status ) && ! $reset ) {
1013
+		if ( ! empty($this->_active_status) && ! $reset) {
1014 1014
 			return $this->_active_status;
1015 1015
 		}
1016 1016
 		//first check if event id is present on this object
1017
-		if ( ! $this->ID() ) {
1017
+		if ( ! $this->ID()) {
1018 1018
 			return false;
1019 1019
 		}
1020 1020
 
1021
-		$where_params_for_event  = array( array( 'EVT_ID' => $this->ID() ) );
1021
+		$where_params_for_event = array(array('EVT_ID' => $this->ID()));
1022 1022
 
1023 1023
 		//if event is published:
1024
-		if ( $this->status() === 'publish' ) {
1024
+		if ($this->status() === 'publish') {
1025 1025
 			//active?
1026
-			if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::active, $where_params_for_event ) > 0 ) {
1026
+			if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::active, $where_params_for_event) > 0) {
1027 1027
 				$this->_active_status = EE_Datetime::active;
1028 1028
 			} else {
1029 1029
 				//upcoming?
1030
-				if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::upcoming, $where_params_for_event  ) > 0 ) {
1030
+				if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::upcoming, $where_params_for_event) > 0) {
1031 1031
 					$this->_active_status = EE_Datetime::upcoming;
1032 1032
 				} else {
1033 1033
 					//expired?
1034
-					if ( EEM_Datetime::instance()->get_datetime_count_for_status( EE_Datetime::expired, $where_params_for_event  ) > 0 ) {
1034
+					if (EEM_Datetime::instance()->get_datetime_count_for_status(EE_Datetime::expired, $where_params_for_event) > 0) {
1035 1035
 						$this->_active_status = EE_Datetime::expired;
1036 1036
 					} else {
1037 1037
 						//it would be odd if things make it this far because it basically means there are no datetime's
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 			}
1043 1043
 		} else {
1044 1044
 			//the event is not published, so let's just set it's active status according to its' post status
1045
-			switch ( $this->status() ) {
1045
+			switch ($this->status()) {
1046 1046
 				case EEM_Event::sold_out :
1047 1047
 					$this->_active_status = EE_Datetime::sold_out;
1048 1048
 					break;
@@ -1068,10 +1068,10 @@  discard block
 block discarded – undo
1068 1068
 	 * @param boolean $echo     whether to return (FALSE), or echo out the result (TRUE)
1069 1069
 	 * @return mixed void|string
1070 1070
 	 */
1071
-	public function pretty_active_status( $echo = TRUE ) {
1071
+	public function pretty_active_status($echo = TRUE) {
1072 1072
 		$active_status = $this->get_active_status();
1073
-		$status = '<span class="ee-status event-active-status-' . $active_status . '">' . EEH_Template::pretty_status( $active_status, FALSE, 'sentence' ) . '</span>';
1074
-		if ( $echo ) {
1073
+		$status = '<span class="ee-status event-active-status-'.$active_status.'">'.EEH_Template::pretty_status($active_status, FALSE, 'sentence').'</span>';
1074
+		if ($echo) {
1075 1075
 			echo $status;
1076 1076
 			return '';
1077 1077
 		}
@@ -1085,12 +1085,12 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_number_of_tickets_sold() {
1087 1087
 		$tkt_sold = 0;
1088
-		if ( !$this->ID() ) {
1088
+		if ( ! $this->ID()) {
1089 1089
 			return 0;
1090 1090
 		}
1091 1091
 		$datetimes = $this->datetimes();
1092
-		foreach ( $datetimes as $datetime ) {
1093
-			if ( $datetime instanceof EE_Datetime ) {
1092
+		foreach ($datetimes as $datetime) {
1093
+			if ($datetime instanceof EE_Datetime) {
1094 1094
 				$tkt_sold += $datetime->sold();
1095 1095
 			}
1096 1096
 		}
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 	 * @return int
1106 1106
 	 */
1107 1107
 	public function get_count_of_all_registrations() {
1108
-		return EEM_Event::instance()->count_related( $this, 'Registration' );
1108
+		return EEM_Event::instance()->count_related($this, 'Registration');
1109 1109
 	}
1110 1110
 
1111 1111
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
 	 * @return EE_Ticket
1116 1116
 	 */
1117 1117
 	public function get_ticket_with_earliest_start_time() {
1118
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1119
-		$query_params = array( $where, 'order_by' => array( 'TKT_start_date' => 'ASC' ) );
1120
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1118
+		$where['Datetime.EVT_ID'] = $this->ID();
1119
+		$query_params = array($where, 'order_by' => array('TKT_start_date' => 'ASC'));
1120
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1121 1121
 	}
1122 1122
 
1123 1123
 
@@ -1127,9 +1127,9 @@  discard block
 block discarded – undo
1127 1127
 	 * @return EE_Ticket
1128 1128
 	 */
1129 1129
 	public function get_ticket_with_latest_end_time() {
1130
-		$where[ 'Datetime.EVT_ID' ] = $this->ID();
1131
-		$query_params = array( $where, 'order_by' => array( 'TKT_end_date' => 'DESC' ) );
1132
-		return EE_Registry::instance()->load_model( 'Ticket' )->get_one( $query_params );
1130
+		$where['Datetime.EVT_ID'] = $this->ID();
1131
+		$query_params = array($where, 'order_by' => array('TKT_end_date' => 'DESC'));
1132
+		return EE_Registry::instance()->load_model('Ticket')->get_one($query_params);
1133 1133
 	}
1134 1134
 
1135 1135
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 	public function tickets_on_sale() {
1142 1142
 		$earliest_ticket = $this->get_ticket_with_earliest_start_time();
1143 1143
 		$latest_ticket = $this->get_ticket_with_latest_end_time();
1144
-		if ( !$latest_ticket instanceof EE_Ticket && !$earliest_ticket instanceof EE_Ticket ) {
1144
+		if ( ! $latest_ticket instanceof EE_Ticket && ! $earliest_ticket instanceof EE_Ticket) {
1145 1145
 			return FALSE;
1146 1146
 		}
1147 1147
 		//check on sale for these two tickets.
1148
-		if ( $latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale() ) {
1148
+		if ($latest_ticket->is_on_sale() || $earliest_ticket->is_on_sale()) {
1149 1149
 			return TRUE;
1150 1150
 		}
1151 1151
 		return FALSE;
@@ -1159,7 +1159,7 @@  discard block
 block discarded – undo
1159 1159
 	 * @return string
1160 1160
 	 */
1161 1161
 	public function get_permalink() {
1162
-		if ( $this->external_url() ) {
1162
+		if ($this->external_url()) {
1163 1163
 			return $this->external_url();
1164 1164
 		}
1165 1165
 		else {
@@ -1174,10 +1174,10 @@  discard block
 block discarded – undo
1174 1174
 	 * @param array $query_params like EEM_Base::get_all
1175 1175
 	 * @return EE_Term
1176 1176
 	 */
1177
-	public function first_event_category( $query_params = array() ) {
1178
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1179
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1180
-		return EEM_Term::instance()->get_one( $query_params );
1177
+	public function first_event_category($query_params = array()) {
1178
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1179
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1180
+		return EEM_Term::instance()->get_one($query_params);
1181 1181
 	}
1182 1182
 
1183 1183
 
@@ -1187,10 +1187,10 @@  discard block
 block discarded – undo
1187 1187
 	 * @param array $query_params
1188 1188
 	 * @return EE_Term[]
1189 1189
 	 */
1190
-	public function get_all_event_categories( $query_params = array() ) {
1191
-		$query_params[ 0 ][ 'Term_Taxonomy.taxonomy' ] = 'espresso_event_categories';
1192
-		$query_params[ 0 ][ 'Term_Taxonomy.Event.EVT_ID' ] = $this->ID();
1193
-		return EEM_Term::instance()->get_all( $query_params );
1190
+	public function get_all_event_categories($query_params = array()) {
1191
+		$query_params[0]['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1192
+		$query_params[0]['Term_Taxonomy.Event.EVT_ID'] = $this->ID();
1193
+		return EEM_Term::instance()->get_all($query_params);
1194 1194
 	}
1195 1195
 
1196 1196
 	/**
@@ -1198,8 +1198,8 @@  discard block
 block discarded – undo
1198 1198
 	 * @param array $query_params @see EEM_Base::get_all
1199 1199
 	 * @return EE_Question_Group[]
1200 1200
 	 */
1201
-	public function question_groups($query_params = array()){
1202
-		$query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'QSG_order' => 'ASC' ));
1201
+	public function question_groups($query_params = array()) {
1202
+		$query_params = ! empty($query_params) ? $query_params : array('order_by' => array('QSG_order' => 'ASC'));
1203 1203
 		return $this->get_many_related('Question_Group', $query_params);
1204 1204
 	}
1205 1205
 
@@ -1239,12 +1239,12 @@  discard block
 block discarded – undo
1239 1239
 	 */
1240 1240
 	public function get_admin_edit_link() {
1241 1241
 		EE_Registry::instance()->load_helper('URL');
1242
-		return EEH_URL::add_query_args_and_nonce( array(
1242
+		return EEH_URL::add_query_args_and_nonce(array(
1243 1243
 			'page' => 'espresso_events',
1244 1244
 			'action' => 'edit',
1245 1245
 			'post' => $this->ID()
1246 1246
 			),
1247
-			admin_url( 'admin.php' )
1247
+			admin_url('admin.php')
1248 1248
 		);
1249 1249
 	}
1250 1250
 
@@ -1257,11 +1257,11 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	public function get_admin_settings_link() {
1259 1259
 		EE_Registry::instance()->load_helper('URL');
1260
-		return EEH_URL::add_query_args_and_nonce( array(
1260
+		return EEH_URL::add_query_args_and_nonce(array(
1261 1261
 			'page' => 'espresso_events',
1262 1262
 			'action' => 'default_event_settings'
1263 1263
 			),
1264
-			admin_url( 'admin.php' )
1264
+			admin_url('admin.php')
1265 1265
 		);
1266 1266
 	}
1267 1267
 
@@ -1277,11 +1277,11 @@  discard block
 block discarded – undo
1277 1277
 	public function get_admin_overview_link() {
1278 1278
 
1279 1279
 		EE_Registry::instance()->load_helper('URL');
1280
-		return EEH_URL::add_query_args_and_nonce( array(
1280
+		return EEH_URL::add_query_args_and_nonce(array(
1281 1281
 			'page' => 'espresso_events',
1282 1282
 			'action' => 'default'
1283 1283
 		),
1284
-			admin_url( 'admin.php' )
1284
+			admin_url('admin.php')
1285 1285
 		);
1286 1286
 	}
1287 1287
 
Please login to merge, or discard this patch.
core/db_classes/EE_Line_Item.class.php 1 patch
Spacing   +212 added lines, -212 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
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 *                             		    date_format and the second value is the time format
51 51
 	 * @return EE_Line_Item
52 52
 	 */
53
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
54
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
55
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
53
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
54
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
55
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
56 56
 	}
57 57
 
58 58
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 *                          		the website will be used.
64 64
 	 * @return EE_Line_Item
65 65
 	 */
66
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
67
-		return new self( $props_n_values, TRUE, $timezone );
66
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
67
+		return new self($props_n_values, TRUE, $timezone);
68 68
 	}
69 69
 
70 70
 
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
 	 * @param bool   $bydb
76 76
 	 * @param string $timezone
77 77
 	 */
78
-	protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) {
79
-		parent::__construct( $fieldValues, $bydb, $timezone );
80
-		if ( ! $this->get( 'LIN_code' ) ) {
81
-			$this->set_code( $this->generate_code() );
78
+	protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') {
79
+		parent::__construct($fieldValues, $bydb, $timezone);
80
+		if ( ! $this->get('LIN_code')) {
81
+			$this->set_code($this->generate_code());
82 82
 		}
83 83
 	}
84 84
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * @return int
90 90
 	 */
91 91
 	function ID() {
92
-		return $this->get( 'LIN_ID' );
92
+		return $this->get('LIN_ID');
93 93
 	}
94 94
 
95 95
 
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 * @return int
100 100
 	 */
101 101
 	function TXN_ID() {
102
-		return $this->get( 'TXN_ID' );
102
+		return $this->get('TXN_ID');
103 103
 	}
104 104
 
105 105
 
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 	 * @param int $TXN_ID
110 110
 	 * @return boolean
111 111
 	 */
112
-	function set_TXN_ID( $TXN_ID ) {
113
-		$this->set( 'TXN_ID', $TXN_ID );
112
+	function set_TXN_ID($TXN_ID) {
113
+		$this->set('TXN_ID', $TXN_ID);
114 114
 	}
115 115
 
116 116
 
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
 	 * @return string
121 121
 	 */
122 122
 	function name() {
123
-		$name =  $this->get( 'LIN_name' );
124
-		if( ! $name ){
125
-			$name = ucwords( str_replace( '-', ' ', $this->type() ) );
123
+		$name = $this->get('LIN_name');
124
+		if ( ! $name) {
125
+			$name = ucwords(str_replace('-', ' ', $this->type()));
126 126
 		}
127 127
 		return $name;
128 128
 	}
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
 	 * @param string $name
135 135
 	 * @return boolean
136 136
 	 */
137
-	function set_name( $name ) {
138
-		$this->set( 'LIN_name', $name );
137
+	function set_name($name) {
138
+		$this->set('LIN_name', $name);
139 139
 	}
140 140
 
141 141
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @return string
146 146
 	 */
147 147
 	function desc() {
148
-		return $this->get( 'LIN_desc' );
148
+		return $this->get('LIN_desc');
149 149
 	}
150 150
 
151 151
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @param string $desc
156 156
 	 * @return boolean
157 157
 	 */
158
-	function set_desc( $desc ) {
159
-		$this->set( 'LIN_desc', $desc );
158
+	function set_desc($desc) {
159
+		$this->set('LIN_desc', $desc);
160 160
 	}
161 161
 
162 162
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @return int
167 167
 	 */
168 168
 	function quantity() {
169
-		return $this->get( 'LIN_quantity' );
169
+		return $this->get('LIN_quantity');
170 170
 	}
171 171
 
172 172
 
@@ -176,8 +176,8 @@  discard block
 block discarded – undo
176 176
 	 * @param int $quantity
177 177
 	 * @return boolean
178 178
 	 */
179
-	function set_quantity( $quantity ) {
180
-		$this->set( 'LIN_quantity', $quantity );
179
+	function set_quantity($quantity) {
180
+		$this->set('LIN_quantity', $quantity);
181 181
 	}
182 182
 
183 183
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @return string
188 188
 	 */
189 189
 	function OBJ_ID() {
190
-		return $this->get( 'OBJ_ID' );
190
+		return $this->get('OBJ_ID');
191 191
 	}
192 192
 
193 193
 
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 	 * @param string $item_id
198 198
 	 * @return boolean
199 199
 	 */
200
-	function set_OBJ_ID( $item_id ) {
201
-		$this->set( 'OBJ_ID', $item_id );
200
+	function set_OBJ_ID($item_id) {
201
+		$this->set('OBJ_ID', $item_id);
202 202
 	}
203 203
 
204 204
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @return string
209 209
 	 */
210 210
 	function OBJ_type() {
211
-		return $this->get( 'OBJ_type' );
211
+		return $this->get('OBJ_type');
212 212
 	}
213 213
 
214 214
 
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 	 * @param string $OBJ_type
219 219
 	 * @return boolean
220 220
 	 */
221
-	function set_OBJ_type( $OBJ_type ) {
222
-		$this->set( 'OBJ_type', $OBJ_type );
221
+	function set_OBJ_type($OBJ_type) {
222
+		$this->set('OBJ_type', $OBJ_type);
223 223
 	}
224 224
 
225 225
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return float
230 230
 	 */
231 231
 	function unit_price() {
232
-		return $this->get( 'LIN_unit_price' );
232
+		return $this->get('LIN_unit_price');
233 233
 	}
234 234
 
235 235
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param float $unit_price
240 240
 	 * @return boolean
241 241
 	 */
242
-	function set_unit_price( $unit_price ) {
243
-		$this->set( 'LIN_unit_price', $unit_price );
242
+	function set_unit_price($unit_price) {
243
+		$this->set('LIN_unit_price', $unit_price);
244 244
 	}
245 245
 
246 246
 
@@ -251,19 +251,19 @@  discard block
 block discarded – undo
251 251
 	 * @return boolean
252 252
 	 */
253 253
 	function is_percent() {
254
-		if( $this->is_tax_sub_total() ) {
254
+		if ($this->is_tax_sub_total()) {
255 255
 			//tax subtotals HAVE a percent on them, that percentage only applies
256 256
 			//to taxable items, so its' an exception. Treat it like a flat line item
257 257
 			return false;
258 258
 		}
259
-		$unit_price = abs( $this->get( 'LIN_unit_price' ) );
260
-		$percent = abs( $this->get( 'LIN_percent' ) );
261
-		if ( $unit_price < .001 && $percent ) {
259
+		$unit_price = abs($this->get('LIN_unit_price'));
260
+		$percent = abs($this->get('LIN_percent'));
261
+		if ($unit_price < .001 && $percent) {
262 262
 			return TRUE;
263
-		} elseif ( $unit_price >= .001 && !$percent ) {
263
+		} elseif ($unit_price >= .001 && ! $percent) {
264 264
 			return FALSE;
265
-		} elseif ( $unit_price >= .001 && $percent ) {
266
-			throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) );
265
+		} elseif ($unit_price >= .001 && $percent) {
266
+			throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent));
267 267
 		} else {
268 268
 			// if they're both 0, assume its not a percent item
269 269
 			return FALSE;
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 	 * @return float
278 278
 	 */
279 279
 	function percent() {
280
-		return $this->get( 'LIN_percent' );
280
+		return $this->get('LIN_percent');
281 281
 	}
282 282
 
283 283
 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param float $percent
288 288
 	 * @return boolean
289 289
 	 */
290
-	function set_percent( $percent ) {
291
-		$this->set( 'LIN_percent', $percent );
290
+	function set_percent($percent) {
291
+		$this->set('LIN_percent', $percent);
292 292
 	}
293 293
 
294 294
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	 * @return float
299 299
 	 */
300 300
 	function total() {
301
-		return $this->get( 'LIN_total' );
301
+		return $this->get('LIN_total');
302 302
 	}
303 303
 
304 304
 
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 	 * @param float $total
309 309
 	 * @return boolean
310 310
 	 */
311
-	function set_total( $total ) {
312
-		$this->set( 'LIN_total', $total );
311
+	function set_total($total) {
312
+		$this->set('LIN_total', $total);
313 313
 	}
314 314
 
315 315
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	function order() {
322
-		return $this->get( 'LIN_order' );
322
+		return $this->get('LIN_order');
323 323
 	}
324 324
 
325 325
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * Sets order
329 329
 	 * @param int $order
330 330
 	 */
331
-	function set_order( $order ) {
332
-		$this->set( 'LIN_order', $order );
331
+	function set_order($order) {
332
+		$this->set('LIN_order', $order);
333 333
 	}
334 334
 
335 335
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 	 * @return int
340 340
 	 */
341 341
 	function parent_ID() {
342
-		return $this->get( 'LIN_parent' );
342
+		return $this->get('LIN_parent');
343 343
 	}
344 344
 
345 345
 
@@ -349,8 +349,8 @@  discard block
 block discarded – undo
349 349
 	 * @param int $parent
350 350
 	 * @return boolean
351 351
 	 */
352
-	function set_parent_ID( $parent ) {
353
-		$this->set( 'LIN_parent', $parent );
352
+	function set_parent_ID($parent) {
353
+		$this->set('LIN_parent', $parent);
354 354
 	}
355 355
 
356 356
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	 * @return string
361 361
 	 */
362 362
 	function type() {
363
-		return $this->get( 'LIN_type' );
363
+		return $this->get('LIN_type');
364 364
 	}
365 365
 
366 366
 
@@ -370,8 +370,8 @@  discard block
 block discarded – undo
370 370
 	 * @param string $type
371 371
 	 * @return boolean
372 372
 	 */
373
-	function set_type( $type ) {
374
-		$this->set( 'LIN_type', $type );
373
+	function set_type($type) {
374
+		$this->set('LIN_type', $type);
375 375
 	}
376 376
 
377 377
 
@@ -384,8 +384,8 @@  discard block
 block discarded – undo
384 384
 	 * @return EE_Line_Item
385 385
 	 */
386 386
 	public function parent() {
387
-		if( $this->ID() ) {
388
-			return $this->get_model()->get_one_by_ID( $this->parent_ID() );
387
+		if ($this->ID()) {
388
+			return $this->get_model()->get_one_by_ID($this->parent_ID());
389 389
 		} else {
390 390
 			return $this->_parent;
391 391
 		}
@@ -398,13 +398,13 @@  discard block
 block discarded – undo
398 398
 	 * @return EE_Line_Item[]
399 399
 	 */
400 400
 	public function children() {
401
-		if ( $this->ID() ) {
401
+		if ($this->ID()) {
402 402
 			return $this->get_model()->get_all(
403 403
 					array(
404
-						array( 'LIN_parent' => $this->ID() ),
405
-						'order_by' => array( 'LIN_order' => 'ASC' ) ) );
404
+						array('LIN_parent' => $this->ID()),
405
+						'order_by' => array('LIN_order' => 'ASC') ) );
406 406
 		} else {
407
-			if ( ! is_array( $this->_children ) ) {
407
+			if ( ! is_array($this->_children)) {
408 408
 				$this->_children = array();
409 409
 			}
410 410
 			return $this->_children;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	 * @return string
419 419
 	 */
420 420
 	function code() {
421
-		return $this->get( 'LIN_code' );
421
+		return $this->get('LIN_code');
422 422
 	}
423 423
 
424 424
 
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param string $code
429 429
 	 * @return boolean
430 430
 	 */
431
-	function set_code( $code ) {
432
-		$this->set( 'LIN_code', $code );
431
+	function set_code($code) {
432
+		$this->set('LIN_code', $code);
433 433
 	}
434 434
 
435 435
 
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 	 * @return boolean
440 440
 	 */
441 441
 	function is_taxable() {
442
-		return $this->get( 'LIN_is_taxable' );
442
+		return $this->get('LIN_is_taxable');
443 443
 	}
444 444
 
445 445
 
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
 	 * @param boolean $is_taxable
450 450
 	 * @return boolean
451 451
 	 */
452
-	function set_is_taxable( $is_taxable ) {
453
-		$this->set( 'LIN_is_taxable', $is_taxable );
452
+	function set_is_taxable($is_taxable) {
453
+		$this->set('LIN_is_taxable', $is_taxable);
454 454
 	}
455 455
 
456 456
 
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	function get_object() {
467 467
 		$model_name_of_related_obj = $this->OBJ_type();
468
-		return $this->get_model()->has_relation(  $model_name_of_related_obj ) ? $this->get_first_related( $model_name_of_related_obj ) : NULL;
468
+		return $this->get_model()->has_relation($model_name_of_related_obj) ? $this->get_first_related($model_name_of_related_obj) : NULL;
469 469
 	}
470 470
 
471 471
 
@@ -476,11 +476,11 @@  discard block
 block discarded – undo
476 476
 	 * @param array $query_params
477 477
 	 * @return EE_Ticket
478 478
 	 */
479
-	function ticket( $query_params = array() ) {
479
+	function ticket($query_params = array()) {
480 480
 		//we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived.  This can be overridden via the incoming $query_params argument
481
-		$remove_defaults = array( 'default_where_conditions' => 'none' );
482
-		$query_params = array_merge( $remove_defaults, $query_params );
483
-		return $this->get_first_related( 'Ticket', $query_params );
481
+		$remove_defaults = array('default_where_conditions' => 'none');
482
+		$query_params = array_merge($remove_defaults, $query_params);
483
+		return $this->get_first_related('Ticket', $query_params);
484 484
 	}
485 485
 
486 486
 
@@ -490,11 +490,11 @@  discard block
 block discarded – undo
490 490
 	 * @return EE_Datetime | NULL
491 491
 	 */
492 492
 	function get_ticket_datetime() {
493
-		if ( $this->OBJ_type() === 'Ticket' ) {
493
+		if ($this->OBJ_type() === 'Ticket') {
494 494
 			$ticket = $this->ticket();
495
-			if ( $ticket instanceof EE_Ticket ) {
495
+			if ($ticket instanceof EE_Ticket) {
496 496
 				$datetime = $ticket->first_datetime();
497
-				if ( $datetime instanceof EE_Datetime ) {
497
+				if ($datetime instanceof EE_Datetime) {
498 498
 					return $datetime;
499 499
 				}
500 500
 			}
@@ -510,9 +510,9 @@  discard block
 block discarded – undo
510 510
 	 * @return string
511 511
 	 */
512 512
 	function ticket_event_name() {
513
-		$event_name = __( "Unknown", "event_espresso" );
513
+		$event_name = __("Unknown", "event_espresso");
514 514
 		$event = $this->ticket_event();
515
-		if ( $event instanceof EE_Event ) {
515
+		if ($event instanceof EE_Event) {
516 516
 			$event_name = $event->name();
517 517
 		}
518 518
 		return $event_name;
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	function ticket_event() {
527 527
 		$event = null;
528 528
 		$ticket = $this->ticket();
529
-		if ( $ticket instanceof EE_Ticket ) {
529
+		if ($ticket instanceof EE_Ticket) {
530 530
 			$datetime = $ticket->first_datetime();
531
-			if ( $datetime instanceof EE_Datetime ) {
531
+			if ($datetime instanceof EE_Datetime) {
532 532
 				$event = $datetime->event();
533 533
 			}
534 534
 		}
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
 	 * @param string $time_format
544 544
 	 * @return string
545 545
 	 */
546
-	function ticket_datetime_start( $date_format = '', $time_format = '' ) {
547
-		$first_datetime_string = __( "Unknown", "event_espresso" );
546
+	function ticket_datetime_start($date_format = '', $time_format = '') {
547
+		$first_datetime_string = __("Unknown", "event_espresso");
548 548
 		$datetime = $this->get_ticket_datetime();
549
-		if ( $datetime ) {
550
-			$first_datetime_string = $datetime->start_date_and_time( $date_format, $time_format );
549
+		if ($datetime) {
550
+			$first_datetime_string = $datetime->start_date_and_time($date_format, $time_format);
551 551
 		}
552 552
 		return $first_datetime_string;
553 553
 	}
@@ -562,26 +562,26 @@  discard block
 block discarded – undo
562 562
 	 * @return bool success
563 563
 	 * @throws \EE_Error
564 564
 	 */
565
-	function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ) {
565
+	function add_child_line_item(EEI_Line_Item $line_item, $set_order = true) {
566 566
 		// should we calculate the LIN_order for this line item ?
567
-		if ( $set_order || $line_item->order() === null ) {
568
-			$line_item->set_order( count( $this->children() ) );
567
+		if ($set_order || $line_item->order() === null) {
568
+			$line_item->set_order(count($this->children()));
569 569
 		}
570
-		if ( $this->ID() ) {
570
+		if ($this->ID()) {
571 571
 			//check for any duplicate line items (with the same code), if so, this replaces it
572
-			$line_item_with_same_code = $this->get_child_line_item(  $line_item->code() );
573
-			if( $line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item ) {
574
-				$this->delete_child_line_item( $line_item_with_same_code->code() );
572
+			$line_item_with_same_code = $this->get_child_line_item($line_item->code());
573
+			if ($line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item) {
574
+				$this->delete_child_line_item($line_item_with_same_code->code());
575 575
 			}
576
-			$line_item->set_parent_ID( $this->ID() );
577
-			if( $this->TXN_ID() ){
578
-				$line_item->set_TXN_ID( $this->TXN_ID() );
576
+			$line_item->set_parent_ID($this->ID());
577
+			if ($this->TXN_ID()) {
578
+				$line_item->set_TXN_ID($this->TXN_ID());
579 579
 			}
580 580
 			return $line_item->save();
581 581
 		} else {
582
-			$this->_children[ $line_item->code() ] = $line_item;
583
-			if( $line_item->parent() != $this ) {
584
-				$line_item->set_parent( $this );
582
+			$this->_children[$line_item->code()] = $line_item;
583
+			if ($line_item->parent() != $this) {
584
+				$line_item->set_parent($this);
585 585
 			}
586 586
 			return TRUE;
587 587
 		}
@@ -595,16 +595,16 @@  discard block
 block discarded – undo
595 595
 	 * @param EE_Line_Item $line_item
596 596
 	 *
597 597
 	 */
598
-	public function set_parent( $line_item ) {
599
-		if ( $this->ID() ) {
600
-			if( ! $line_item->ID() ) {
598
+	public function set_parent($line_item) {
599
+		if ($this->ID()) {
600
+			if ( ! $line_item->ID()) {
601 601
 				$line_item->save();
602 602
 			}
603
-			$this->set_parent_ID( $line_item->ID() );
603
+			$this->set_parent_ID($line_item->ID());
604 604
 			$this->save();
605 605
 		} else {
606 606
 			$this->_parent = $line_item;
607
-			$this->set_parent_ID( $line_item->ID() );
607
+			$this->set_parent_ID($line_item->ID());
608 608
 		}
609 609
 	}
610 610
 
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
 	 * @param string $code
618 618
 	 * @return EE_Line_Item
619 619
 	 */
620
-	function get_child_line_item( $code ) {
621
-		if ( $this->ID() ) {
622
-			return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) );
620
+	function get_child_line_item($code) {
621
+		if ($this->ID()) {
622
+			return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code)));
623 623
 		} else {
624
-			return isset( $this->_children[ $code ] ) ? $this->_children[ $code ] : null;
624
+			return isset($this->_children[$code]) ? $this->_children[$code] : null;
625 625
 		}
626 626
 	}
627 627
 
@@ -632,10 +632,10 @@  discard block
 block discarded – undo
632 632
 	 * @return int
633 633
 	 */
634 634
 	function delete_children_line_items() {
635
-		if ( $this->ID() ) {
636
-			return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) );
635
+		if ($this->ID()) {
636
+			return $this->get_model()->delete(array(array('LIN_parent' => $this->ID())));
637 637
 		} else {
638
-			$count = count( $this->_children );
638
+			$count = count($this->_children);
639 639
 			$this->_children = array();
640 640
 			return $count;
641 641
 		}
@@ -652,25 +652,25 @@  discard block
 block discarded – undo
652 652
 	 * @param bool $stop_search_once_found
653 653
 	 * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet)
654 654
 	 */
655
-	function delete_child_line_item( $code, $stop_search_once_found = true ) {
656
-		if ( $this->ID() ) {
655
+	function delete_child_line_item($code, $stop_search_once_found = true) {
656
+		if ($this->ID()) {
657 657
 			$items_deleted = 0;
658
-			if( $this->code() == $code ) {
659
-				$items_deleted += EEH_Line_Item::delete_all_child_items( $this );
660
-				$items_deleted += intval( $this->delete() );
661
-				if( $stop_search_once_found ){
658
+			if ($this->code() == $code) {
659
+				$items_deleted += EEH_Line_Item::delete_all_child_items($this);
660
+				$items_deleted += intval($this->delete());
661
+				if ($stop_search_once_found) {
662 662
 					return $items_deleted;
663 663
 				}
664 664
 			}
665
-			foreach( $this->children() as $child_line_item ) {
666
-				$items_deleted += $child_line_item->delete_child_line_item( $code, $stop_search_once_found );
665
+			foreach ($this->children() as $child_line_item) {
666
+				$items_deleted += $child_line_item->delete_child_line_item($code, $stop_search_once_found);
667 667
 			}
668 668
 			return $items_deleted;
669 669
 		} else {
670
-			if( isset( $this->_children[ $code ] ) ) {
671
-				unset( $this->_children[ $code ] );
670
+			if (isset($this->_children[$code])) {
671
+				unset($this->_children[$code]);
672 672
 				return 1;
673
-			}else{
673
+			} else {
674 674
 				return 0;
675 675
 			}
676 676
 		}
@@ -683,9 +683,9 @@  discard block
 block discarded – undo
683 683
 	 * @return boolean
684 684
 	 */
685 685
 	public function delete_if_childless_subtotal() {
686
-		if( $this->ID() &&
686
+		if ($this->ID() &&
687 687
 				$this->type() == EEM_Line_Item::type_sub_total &&
688
-				! $this->children() ) {
688
+				! $this->children()) {
689 689
 			return $this->delete();
690 690
 		} else {
691 691
 			return false;
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 */
701 701
 	function generate_code() {
702 702
 		// each line item in the cart requires a unique identifier
703
-		return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . microtime() );
703
+		return md5($this->get('OBJ_type').$this->get('OBJ_ID').microtime());
704 704
 	}
705 705
 
706 706
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 	 * @return string like '2, 004.00', formatted according to the localized currency
765 765
 	 */
766 766
 	function unit_price_no_code() {
767
-		return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' );
767
+		return $this->get_pretty('LIN_unit_price', 'no_currency_code');
768 768
 	}
769 769
 
770 770
 
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 * @return string like '2, 004.00', formatted according to the localized currency
775 775
 	 */
776 776
 	function total_no_code() {
777
-		return $this->get_pretty( 'LIN_total', 'no_currency_code' );
777
+		return $this->get_pretty('LIN_total', 'no_currency_code');
778 778
 	}
779 779
 
780 780
 
@@ -793,17 +793,17 @@  discard block
 block discarded – undo
793 793
 
794 794
 		$total = $pre_tax_total + $tax_total;
795 795
 		// no negative totals plz
796
-		$total = max( $total, 0 );
797
-		$this->set_total( $total );
796
+		$total = max($total, 0);
797
+		$this->set_total($total);
798 798
 		//only update the related transaction's total
799 799
 		//if we intend to save this line item and its a grand total
800
-		if(
800
+		if (
801 801
 			$this->allow_persist() &&
802 802
 			$this->type() == EEM_Line_Item::type_total &&
803 803
 			$this->transaction() instanceof EE_Transaction
804
-		){
805
-			$this->transaction()->set_total( $total );
806
-			if ( $this->transaction()->ID() ) {
804
+		) {
805
+			$this->transaction()->set_total($total);
806
+			if ($this->transaction()->ID()) {
807 807
 				$this->transaction()->save();
808 808
 			}
809 809
 		}
@@ -824,42 +824,42 @@  discard block
 block discarded – undo
824 824
 		$total = 0;
825 825
 		$my_children = $this->children();
826 826
 		//completely ignore tax and tax sub-totals when calculating the pre-tax-total
827
-		if ( $this->is_tax_sub_total() || $this->is_tax() ) {
827
+		if ($this->is_tax_sub_total() || $this->is_tax()) {
828 828
 			return 0;
829 829
 		} elseif (
830
-			( $this->is_sub_line_item() || $this->is_line_item() )
831
-			&& empty( $my_children )
830
+			($this->is_sub_line_item() || $this->is_line_item())
831
+			&& empty($my_children)
832 832
 		) {
833 833
 			$total = $this->unit_price() * $this->quantity();
834
-		} elseif( $this->is_sub_total() || $this->is_total() ) {
835
-			$total = $this->_recalculate_pretax_total_for_subtotal( $total, $my_children );
836
-		} elseif (  $this->is_line_item() && ! empty( $my_children ) ) {
837
-			$total = $this->_recalculate_pretax_total_for_line_item( $total, $my_children );
834
+		} elseif ($this->is_sub_total() || $this->is_total()) {
835
+			$total = $this->_recalculate_pretax_total_for_subtotal($total, $my_children);
836
+		} elseif ($this->is_line_item() && ! empty($my_children)) {
837
+			$total = $this->_recalculate_pretax_total_for_line_item($total, $my_children);
838 838
 		}
839 839
 		//ensure all non-line items and non-sub-line-items have a quantity of 1
840
-		if( ! $this->is_line_item() && ! $this->is_sub_line_item() ) {
841
-			$this->set_quantity( 1 );
842
-			if( ! $this->is_percent() ) {
843
-				$this->set_unit_price( $this->total() );
840
+		if ( ! $this->is_line_item() && ! $this->is_sub_line_item()) {
841
+			$this->set_quantity(1);
842
+			if ( ! $this->is_percent()) {
843
+				$this->set_unit_price($this->total());
844 844
 			}
845 845
 		}
846 846
 
847 847
 		//we don't want to bother saving grand totals, because that needs to factor in taxes anyways
848 848
 		//so it ought to be
849
-		if( ! $this->is_total() ) {
850
-			$this->set_total( $total );
849
+		if ( ! $this->is_total()) {
850
+			$this->set_total($total);
851 851
 			//if not a percent line item, make sure we keep the unit price in sync
852
-			if(
852
+			if (
853 853
 				$this->is_line_item() &&
854
-				! empty( $my_children ) &&
854
+				! empty($my_children) &&
855 855
 				! $this->is_percent()
856 856
 			) {
857
-				if( $this->quantity() === 0 ){
857
+				if ($this->quantity() === 0) {
858 858
 					$new_unit_price = 0;
859 859
 				} else {
860 860
 					$new_unit_price = $this->total() / $this->quantity();
861 861
 				}
862
-				$this->set_unit_price( $new_unit_price );
862
+				$this->set_unit_price($new_unit_price);
863 863
 			}
864 864
 			$this->maybe_save();
865 865
 		}
@@ -875,34 +875,34 @@  discard block
 block discarded – undo
875 875
 	 * @param EE_Line_Item[] $my_children
876 876
 	 * @return float
877 877
 	 */
878
-	protected function _recalculate_pretax_total_for_subtotal( $calculated_total_so_far, $my_children = null ) {
879
-		if( $my_children === null ) {
878
+	protected function _recalculate_pretax_total_for_subtotal($calculated_total_so_far, $my_children = null) {
879
+		if ($my_children === null) {
880 880
 			$my_children = $this->children();
881 881
 		}
882 882
 		//get the total of all its children
883
-		foreach ( $my_children as $child_line_item ) {
884
-			if ( $child_line_item instanceof EE_Line_Item ) {
885
-				if ( $child_line_item->is_percent() ) {
883
+		foreach ($my_children as $child_line_item) {
884
+			if ($child_line_item instanceof EE_Line_Item) {
885
+				if ($child_line_item->is_percent()) {
886 886
 					$percent_total = $calculated_total_so_far * $child_line_item->percent() / 100;
887
-					$child_line_item->set_total( $percent_total );
887
+					$child_line_item->set_total($percent_total);
888 888
 					//so far all percent line items should have a quantity of 1
889 889
 					//(ie, no double percent discounts. Although that might be requested someday)
890
-					$child_line_item->set_quantity( 1 );
890
+					$child_line_item->set_quantity(1);
891 891
 					$child_line_item->maybe_save();
892 892
 					$calculated_total_so_far += $percent_total;
893 893
 				} else {
894 894
 					//verify flat sub-line-item quantities match their parent
895
-					if( $child_line_item->is_sub_line_item() ) {
896
-						$child_line_item->set_quantity( $this->quantity() );
895
+					if ($child_line_item->is_sub_line_item()) {
896
+						$child_line_item->set_quantity($this->quantity());
897 897
 					}
898 898
 					$calculated_total_so_far += $child_line_item->recalculate_pre_tax_total();
899 899
 				}
900 900
 			}
901 901
 		}
902 902
 
903
-		if( $this->is_sub_total() ){
903
+		if ($this->is_sub_total()) {
904 904
 			// no negative totals plz
905
-			$calculated_total_so_far = max( $calculated_total_so_far, 0 );
905
+			$calculated_total_so_far = max($calculated_total_so_far, 0);
906 906
 		}
907 907
 		return $calculated_total_so_far;
908 908
 	}
@@ -916,8 +916,8 @@  discard block
 block discarded – undo
916 916
 	 * @param EE_Line_Item[] $my_children
917 917
 	 * @return float
918 918
 	 */
919
-	protected function _recalculate_pretax_total_for_line_item( $calculated_total_so_far, $my_children = null ) {
920
-		if( $my_children === null ) {
919
+	protected function _recalculate_pretax_total_for_line_item($calculated_total_so_far, $my_children = null) {
920
+		if ($my_children === null) {
921 921
 			$my_children = $this->children();
922 922
 		}
923 923
 		//we need to keep track of the running total for a single item,
@@ -925,9 +925,9 @@  discard block
 block discarded – undo
925 925
 		$unit_price_for_total = 0;
926 926
 		$quantity_for_total = 1;
927 927
 		//get the total of all its children
928
-		foreach ( $my_children as $child_line_item ) {
929
-			if ( $child_line_item instanceof EE_Line_Item ) {
930
-				if ( $child_line_item->is_percent() ) {
928
+		foreach ($my_children as $child_line_item) {
929
+			if ($child_line_item instanceof EE_Line_Item) {
930
+				if ($child_line_item->is_percent()) {
931 931
 					//it should be the unit-price-so-far multiplied by teh percent multiplied by the quantity
932 932
 					//not total multiplied by percent, because that ignores rounding along-the-way
933 933
 					$percent_unit_price = round(
@@ -935,17 +935,17 @@  discard block
 block discarded – undo
935 935
 						EE_Registry::instance()->CFG->currency->dec_plc
936 936
 					);
937 937
 					$percent_total = $percent_unit_price * $quantity_for_total;
938
-					$child_line_item->set_total( $percent_total );
938
+					$child_line_item->set_total($percent_total);
939 939
 					//so far all percent line items should have a quantity of 1
940 940
 					//(ie, no double percent discounts. Although that might be requested someday)
941
-					$child_line_item->set_quantity( 1 );
941
+					$child_line_item->set_quantity(1);
942 942
 					$child_line_item->maybe_save();
943 943
 					$calculated_total_so_far += $percent_total;
944 944
 					$unit_price_for_total += $percent_unit_price;
945 945
 				} else {
946 946
 					//verify flat sub-line-item quantities match their parent
947
-					if( $child_line_item->is_sub_line_item() ) {
948
-						$child_line_item->set_quantity( $this->quantity() );
947
+					if ($child_line_item->is_sub_line_item()) {
948
+						$child_line_item->set_quantity($this->quantity());
949 949
 					}
950 950
 					$quantity_for_total = $child_line_item->quantity();
951 951
 					$calculated_total_so_far += $child_line_item->recalculate_pre_tax_total();
@@ -969,10 +969,10 @@  discard block
 block discarded – undo
969 969
 		//calculate the pretax total
970 970
 		$taxable_total = $this->taxable_total();
971 971
 		$tax_total = 0;
972
-		foreach ( $taxes as $tax ) {
972
+		foreach ($taxes as $tax) {
973 973
 			$total_on_this_tax = $taxable_total * $tax->percent() / 100;
974 974
 			//remember the total on this line item
975
-			$tax->set_total( $total_on_this_tax );
975
+			$tax->set_total($total_on_this_tax);
976 976
 			$tax_total += $tax->total();
977 977
 		}
978 978
 		$this->_recalculate_tax_sub_total();
@@ -986,21 +986,21 @@  discard block
 block discarded – undo
986 986
 	 * @return void
987 987
 	 */
988 988
 	private function _recalculate_tax_sub_total() {
989
-		if ( $this->is_tax_sub_total() ) {
989
+		if ($this->is_tax_sub_total()) {
990 990
 			$total = 0;
991 991
 			$total_percent = 0;
992 992
 			//simply loop through all its children (which should be taxes) and sum their total
993
-			foreach ( $this->children() as $child_tax ) {
994
-				if ( $child_tax instanceof EE_Line_Item ) {
993
+			foreach ($this->children() as $child_tax) {
994
+				if ($child_tax instanceof EE_Line_Item) {
995 995
 					$total += $child_tax->total();
996 996
 					$total_percent += $child_tax->percent();
997 997
 				}
998 998
 			}
999
-			$this->set_total( $total );
1000
-			$this->set_percent( $total_percent );
1001
-		} elseif ( $this->is_total() ) {
1002
-			foreach ( $this->children() as $maybe_tax_subtotal ) {
1003
-				if ( $maybe_tax_subtotal instanceof EE_Line_Item ) {
999
+			$this->set_total($total);
1000
+			$this->set_percent($total_percent);
1001
+		} elseif ($this->is_total()) {
1002
+			foreach ($this->children() as $maybe_tax_subtotal) {
1003
+				if ($maybe_tax_subtotal instanceof EE_Line_Item) {
1004 1004
 					$maybe_tax_subtotal->_recalculate_tax_sub_total();
1005 1005
 				}
1006 1006
 			}
@@ -1016,8 +1016,8 @@  discard block
 block discarded – undo
1016 1016
 	public function get_total_tax() {
1017 1017
 		$this->_recalculate_tax_sub_total();
1018 1018
 		$total = 0;
1019
-		foreach ( $this->tax_descendants() as $tax_line_item ) {
1020
-			if ( $tax_line_item instanceof EE_Line_Item ) {
1019
+		foreach ($this->tax_descendants() as $tax_line_item) {
1020
+			if ($tax_line_item instanceof EE_Line_Item) {
1021 1021
 				$total += $tax_line_item->total();
1022 1022
 			}
1023 1023
 		}
@@ -1031,8 +1031,8 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	public function get_items_total() {
1033 1033
 		$total = 0;
1034
-		foreach ( $this->get_items() as $item ) {
1035
-			if ( $item instanceof EE_Line_Item ) {
1034
+		foreach ($this->get_items() as $item) {
1035
+			if ($item instanceof EE_Line_Item) {
1036 1036
 				$total += $item->total();
1037 1037
 			}
1038 1038
 		}
@@ -1047,8 +1047,8 @@  discard block
 block discarded – undo
1047 1047
 	 * @return EE_Line_Item[]
1048 1048
 	 */
1049 1049
 	function tax_descendants() {
1050
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1051
-		return EEH_Line_Item::get_tax_descendants( $this );
1050
+		EE_Registry::instance()->load_helper('Line_Item');
1051
+		return EEH_Line_Item::get_tax_descendants($this);
1052 1052
 	}
1053 1053
 
1054 1054
 
@@ -1058,8 +1058,8 @@  discard block
 block discarded – undo
1058 1058
 	 * @return EE_Line_Item[]
1059 1059
 	 */
1060 1060
 	function get_items() {
1061
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1062
-		return EEH_Line_Item::get_line_item_descendants( $this );
1061
+		EE_Registry::instance()->load_helper('Line_Item');
1062
+		return EEH_Line_Item::get_line_item_descendants($this);
1063 1063
 	}
1064 1064
 
1065 1065
 
@@ -1073,22 +1073,22 @@  discard block
 block discarded – undo
1073 1073
 	 */
1074 1074
 	function taxable_total() {
1075 1075
 		$total = 0;
1076
-		if ( $this->children() ) {
1077
-			foreach ( $this->children() as $child_line_item ) {
1078
-				if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
1076
+		if ($this->children()) {
1077
+			foreach ($this->children() as $child_line_item) {
1078
+				if ($child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) {
1079 1079
 					//if it's a percent item, only take into account the percent
1080 1080
 					//that's taxable too (the taxable total so far)
1081
-					if( $child_line_item->is_percent() ) {
1082
-						$total = $total + ( $total * $child_line_item->percent() / 100 );
1083
-					}else{
1081
+					if ($child_line_item->is_percent()) {
1082
+						$total = $total + ($total * $child_line_item->percent() / 100);
1083
+					} else {
1084 1084
 						$total += $child_line_item->total();
1085 1085
 					}
1086
-				}elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){
1086
+				}elseif ($child_line_item->type() == EEM_Line_Item::type_sub_total) {
1087 1087
 					$total += $child_line_item->taxable_total();
1088 1088
 				}
1089 1089
 			}
1090 1090
 		}
1091
-		return max( $total, 0 );
1091
+		return max($total, 0);
1092 1092
 	}
1093 1093
 
1094 1094
 
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
 	 * @return EE_Transaction
1099 1099
 	 */
1100 1100
 	public function transaction() {
1101
-		return $this->get_first_related( 'Transaction' );
1101
+		return $this->get_first_related('Transaction');
1102 1102
 	}
1103 1103
 
1104 1104
 
@@ -1111,17 +1111,17 @@  discard block
 block discarded – undo
1111 1111
 	 * @param int $txn_id if none is provided, assumes $this->TXN_ID()
1112 1112
 	 * @return int count of items saved
1113 1113
 	 */
1114
-	public function save_this_and_descendants_to_txn( $txn_id = NULL ) {
1115
-		if ( ! $txn_id ) {
1114
+	public function save_this_and_descendants_to_txn($txn_id = NULL) {
1115
+		if ( ! $txn_id) {
1116 1116
 			$txn_id = $this->TXN_ID();
1117 1117
 		}
1118
-		$this->set_TXN_ID( $txn_id );
1118
+		$this->set_TXN_ID($txn_id);
1119 1119
 		$children = $this->children();
1120 1120
 		$this->save();
1121
-		foreach ( $children as $child_line_item ) {
1122
-			if ( $child_line_item instanceof EE_Line_Item ) {
1123
-				$child_line_item->set_parent_ID( $this->ID() );
1124
-				$child_line_item->save_this_and_descendants_to_txn( $txn_id );
1121
+		foreach ($children as $child_line_item) {
1122
+			if ($child_line_item instanceof EE_Line_Item) {
1123
+				$child_line_item->set_parent_ID($this->ID());
1124
+				$child_line_item->save_this_and_descendants_to_txn($txn_id);
1125 1125
 			}
1126 1126
 		}
1127 1127
 	}
@@ -1133,10 +1133,10 @@  discard block
 block discarded – undo
1133 1133
 	 * @param string $type one of the constants on EEM_Line_Item
1134 1134
 	 * @return EE_Line_Item[]
1135 1135
 	 */
1136
-	protected function _get_descendants_of_type( $type ) {
1137
-		EE_Error::doing_it_wrong( 'EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0' );
1138
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1139
-		return EEH_Line_Item::get_descendants_of_type( $this, $type );
1136
+	protected function _get_descendants_of_type($type) {
1137
+		EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0');
1138
+		EE_Registry::instance()->load_helper('Line_Item');
1139
+		return EEH_Line_Item::get_descendants_of_type($this, $type);
1140 1140
 	}
1141 1141
 
1142 1142
 
@@ -1146,10 +1146,10 @@  discard block
 block discarded – undo
1146 1146
 	 * @param string $type like one of the EEM_Line_Item::type_*
1147 1147
 	 * @return EE_Line_Item
1148 1148
 	 */
1149
-	public function get_nearest_descendant_of_type( $type ) {
1150
-		EE_Error::doing_it_wrong( 'EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0' );
1151
-		EE_Registry::instance()->load_helper( 'Line_Item' );
1152
-		return EEH_Line_Item::get_nearest_descendant_of_type( $this, $type );
1149
+	public function get_nearest_descendant_of_type($type) {
1150
+		EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0');
1151
+		EE_Registry::instance()->load_helper('Line_Item');
1152
+		return EEH_Line_Item::get_nearest_descendant_of_type($this, $type);
1153 1153
 	}
1154 1154
 
1155 1155
 
@@ -1160,7 +1160,7 @@  discard block
 block discarded – undo
1160 1160
 	 * @return int count of items saved
1161 1161
 	 */
1162 1162
 	public function maybe_save() {
1163
-		if ( $this->ID() ) {
1163
+		if ($this->ID()) {
1164 1164
 			return $this->save();
1165 1165
 		}
1166 1166
 		return false;
Please login to merge, or discard this patch.
core/db_classes/EE_Price.class.php 2 patches
Spacing   +32 added lines, -32 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
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Attendee
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $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 = null, $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
 
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Attendee
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 
55 55
 
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 	 * @access        public
61 61
 	 * @param        int $PRT_ID
62 62
 	 */
63
-	public function set_type( $PRT_ID = 0 ) {
64
-		$this->set( 'PRT_ID', $PRT_ID );
63
+	public function set_type($PRT_ID = 0) {
64
+		$this->set('PRT_ID', $PRT_ID);
65 65
 	}
66 66
 
67 67
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 * @access        public
73 73
 	 * @param        float $PRC_amount
74 74
 	 */
75
-	public function set_amount( $PRC_amount = 0.00 ) {
76
-		$this->set( 'PRC_amount', $PRC_amount );
75
+	public function set_amount($PRC_amount = 0.00) {
76
+		$this->set('PRC_amount', $PRC_amount);
77 77
 	}
78 78
 
79 79
 
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @access        public
85 85
 	 * @param        string $PRC_name
86 86
 	 */
87
-	public function set_name( $PRC_name = '' ) {
88
-		$this->set( 'PRC_name', $PRC_name );
87
+	public function set_name($PRC_name = '') {
88
+		$this->set('PRC_name', $PRC_name);
89 89
 	}
90 90
 
91 91
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 	 * @access        public
97 97
 	 * @param        string $PRC_desc
98 98
 	 */
99
-	public function set_description( $PRC_desc = '' ) {
100
-		$this->Set( 'PRC_desc', $PRC_desc );
99
+	public function set_description($PRC_desc = '') {
100
+		$this->Set('PRC_desc', $PRC_desc);
101 101
 	}
102 102
 
103 103
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	* 		@access		public
109 109
 	*		@param		bool		$PRC_is_default
110 110
 	*/
111
-	public function set_is_default( $PRC_is_default = FALSE ) {
112
-		$this->set( 'PRC_is_default', $PRC_is_default );
111
+	public function set_is_default($PRC_is_default = FALSE) {
112
+		$this->set('PRC_is_default', $PRC_is_default);
113 113
 	}
114 114
 
115 115
 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
 	* 		@access		public
121 121
 	*		@param		bool		$PRC_deleted
122 122
 	*/
123
-	public function set_deleted( $PRC_deleted = NULL ) {
124
-		$this->set( 'PRC_deleted', $PRC_deleted );
123
+	public function set_deleted($PRC_deleted = NULL) {
124
+		$this->set('PRC_deleted', $PRC_deleted);
125 125
 	}
126 126
 
127 127
 
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	 * @return        int
133 133
 	 */
134 134
 	public function type() {
135
-		return $this->get( 'PRT_ID' );
135
+		return $this->get('PRT_ID');
136 136
 	}
137 137
 
138 138
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 * @return        float
144 144
 	 */
145 145
 	public function amount() {
146
-		return $this->get( 'PRC_amount' );
146
+		return $this->get('PRC_amount');
147 147
 	}
148 148
 
149 149
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @return        string
155 155
 	 */
156 156
 	public function name() {
157
-		return $this->get( 'PRC_name' );
157
+		return $this->get('PRC_name');
158 158
 	}
159 159
 
160 160
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return        string
166 166
 	 */
167 167
 	public function desc() {
168
-		return $this->get( 'PRC_desc' );
168
+		return $this->get('PRC_desc');
169 169
 	}
170 170
 
171 171
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @return        int
177 177
 	 */
178 178
 	public function overrides() {
179
-		return $this->get( 'PRC_overrides' );
179
+		return $this->get('PRC_overrides');
180 180
 	}
181 181
 
182 182
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @return        int
188 188
 	 */
189 189
 	public function order() {
190
-		return $this->get( 'PRC_order' );
190
+		return $this->get('PRC_order');
191 191
 	}
192 192
 
193 193
 
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	 * @return        bool
212 212
 	 */
213 213
 	public function is_default() {
214
-		return $this->get( 'PRC_is_default' );
214
+		return $this->get('PRC_is_default');
215 215
 	}
216 216
 
217 217
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 	 * @return        bool
223 223
 	 */
224 224
 	public function deleted() {
225
-		return $this->get( 'PRC_deleted' );
225
+		return $this->get('PRC_deleted');
226 226
 	}
227 227
 
228 228
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return bool
232 232
 	 */
233 233
 	public function parent() {
234
-		return $this->get( 'PRC_parent' );
234
+		return $this->get('PRC_parent');
235 235
 	}
236 236
 
237 237
 
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	 * @return EE_Price_Type
254 254
 	 */
255 255
 	public function type_obj() {
256
-		return $this->get_first_related( 'Price_Type' );
256
+		return $this->get_first_related('Price_Type');
257 257
 	}
258 258
 
259 259
 
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function is_percent() {
277 277
 		$price_type = $this->type_obj();
278
-		return $price_type->get( 'PRT_is_percent' );
278
+		return $price_type->get('PRT_is_percent');
279 279
 	}
280 280
 
281 281
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @return string
288 288
 	 */
289 289
 	public function pretty_price() {
290
-		return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount') . '%';
290
+		return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount').'%';
291 291
 	}
292 292
 
293 293
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * @return mixed
297 297
 	 */
298 298
 	public function get_price_without_currency_symbol() {
299
-		return str_replace( EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty( 'PRC_amount' ) );
299
+		return str_replace(EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty('PRC_amount'));
300 300
 	}
301 301
 }
302 302
 
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -103,11 +103,11 @@  discard block
 block discarded – undo
103 103
 
104 104
 
105 105
 	/**
106
-	*		set is_default
107
-	*
108
-	* 		@access		public
109
-	*		@param		bool		$PRC_is_default
110
-	*/
106
+	 *		set is_default
107
+	 *
108
+	 * 		@access		public
109
+	 *		@param		bool		$PRC_is_default
110
+	 */
111 111
 	public function set_is_default( $PRC_is_default = FALSE ) {
112 112
 		$this->set( 'PRC_is_default', $PRC_is_default );
113 113
 	}
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 
116 116
 
117 117
 	/**
118
-	*		set deleted
119
-	*
120
-	* 		@access		public
121
-	*		@param		bool		$PRC_deleted
122
-	*/
118
+	 *		set deleted
119
+	 *
120
+	 * 		@access		public
121
+	 *		@param		bool		$PRC_deleted
122
+	 */
123 123
 	public function set_deleted( $PRC_deleted = NULL ) {
124 124
 		$this->set( 'PRC_deleted', $PRC_deleted );
125 125
 	}
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Option.class.php 1 patch
Spacing   +28 added lines, -28 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
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 *                             		    date_format and the second value is the time format
46 46
 	 * @return EE_Attendee
47 47
 	 */
48
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
49
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
50
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
48
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
49
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
50
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
51 51
 	}
52 52
 
53 53
 
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 	 *                          		the website will be used.
59 59
 	 * @return EE_Attendee
60 60
 	 */
61
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
62
-		return new self( $props_n_values, TRUE, $timezone );
61
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
62
+		return new self($props_n_values, TRUE, $timezone);
63 63
 	}
64 64
 
65 65
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 	 * @param string $value
70 70
 	 * @return bool success
71 71
 	 */
72
-	public function set_value( $value ) {
73
-		$this->set( 'QSO_value', $value );
72
+	public function set_value($value) {
73
+		$this->set('QSO_value', $value);
74 74
 	}
75 75
 
76 76
 
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 	 * @param string $text
81 81
 	 * @return bool success
82 82
 	 */
83
-	public function set_desc( $text ) {
84
-		$this->set( 'QSO_desc', $text );
83
+	public function set_desc($text) {
84
+		$this->set('QSO_desc', $text);
85 85
 	}
86 86
 
87 87
 
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 * @param integer $order
94 94
 	 * @return bool      $success
95 95
 	 */
96
-	public function set_order( $order ) {
97
-		$this->set( 'QSO_order', $order );
96
+	public function set_order($order) {
97
+		$this->set('QSO_order', $order);
98 98
 	}
99 99
 
100 100
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param int $question_ID
105 105
 	 * @return bool success
106 106
 	 */
107
-	public function set_question_ID( $question_ID ) {
108
-		$this->set( 'QST_ID', $question_ID );
107
+	public function set_question_ID($question_ID) {
108
+		$this->set('QST_ID', $question_ID);
109 109
 	}
110 110
 
111 111
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @param string $text
116 116
 	 * @return bool success
117 117
 	 */
118
-	public function set_opt_group( $text ) {
118
+	public function set_opt_group($text) {
119 119
 		return $this->_QSO_opt_group = $text;
120 120
 	}
121 121
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return string
127 127
 	 */
128 128
 	public function value() {
129
-		return $this->get( 'QSO_value' );
129
+		return $this->get('QSO_value');
130 130
 	}
131 131
 
132 132
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 * @return string
137 137
 	 */
138 138
 	public function desc() {
139
-		return $this->get( 'QSO_desc' );
139
+		return $this->get('QSO_desc');
140 140
 	}
141 141
 
142 142
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return boolean
147 147
 	 */
148 148
 	public function deleted() {
149
-		return $this->get( 'QSO_deleted' );
149
+		return $this->get('QSO_deleted');
150 150
 	}
151 151
 
152 152
 
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	 * @return integer
159 159
 	 */
160 160
 	public function order() {
161
-		return $this->get( 'QSO_option' );
161
+		return $this->get('QSO_option');
162 162
 	}
163 163
 
164 164
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @return int
169 169
 	 */
170 170
 	public function question_ID() {
171
-		return $this->get( 'QST_ID' );
171
+		return $this->get('QST_ID');
172 172
 	}
173 173
 
174 174
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @return EE_Question
179 179
 	 */
180 180
 	public function question() {
181
-		return $this->get_first_related( 'Question' );
181
+		return $this->get_first_related('Question');
182 182
 	}
183 183
 
184 184
 
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 	 * @param array $options {
198 198
 	 *	@type int $QST_ID the QST_ID attribute of this question option, otherwise it will be for the same question as the original
199 199
 	 */
200
-	public function duplicate( $options = array() ) {
200
+	public function duplicate($options = array()) {
201 201
 		$new_question_option = clone $this;
202
-		$new_question_option->set( 'QSO_ID', null );
203
-		if( array_key_exists( 'QST_ID', $options ) ) {//use array_key_exists instead of isset because NULL might be a valid value
204
-			$new_question_option->set_question_ID( $options[ 'QST_ID' ] );
202
+		$new_question_option->set('QSO_ID', null);
203
+		if (array_key_exists('QST_ID', $options)) {//use array_key_exists instead of isset because NULL might be a valid value
204
+			$new_question_option->set_question_ID($options['QST_ID']);
205 205
 		}
206 206
 		$new_question_option->save();
207 207
 	}
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	 * @param string $QSO_system
220 220
 	 * @return bool
221 221
 	 */
222
-	public function set_system( $QSO_system ) {
223
-		return $this->set( 'QSO_system', $QSO_system );
222
+	public function set_system($QSO_system) {
223
+		return $this->set('QSO_system', $QSO_system);
224 224
 	}
225 225
 }
226 226
 
Please login to merge, or discard this patch.