Completed
Branch FET-9643-checkin-system-docume... (5f5a9c)
by
unknown
200:04 queued 188:44
created
core/EE_Cron_Tasks.core.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -156,7 +156,7 @@
 block discarded – undo
156 156
 	 * @param int $PAY_ID
157 157
 	 */
158 158
 	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
159
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
159
+			do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
160 160
 		if ( absint( $TXN_ID )) {
161 161
 			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
162 162
 			add_action(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EE_Cron_Tasks
29 29
 	 */
30 30
 	public static function instance() {
31
-		if ( ! self::$_instance instanceof EE_Cron_Tasks ) {
31
+		if ( ! self::$_instance instanceof EE_Cron_Tasks) {
32 32
 			self::$_instance = new self();
33 33
 		}
34 34
 		return self::$_instance;
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
41 41
 	 * @return EE_Cron_Tasks
42 42
 	 */
43 43
 	private function __construct() {
44
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
44
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
45 45
 		// verify that WP Cron is enabled
46
-		if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON && is_admin() ) {
46
+		if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && is_admin()) {
47 47
 			EE_Error::add_persistent_admin_notice(
48 48
 				'wp_cron_disabled',
49 49
 				sprintf(
@@ -58,24 +58,24 @@  discard block
 block discarded – undo
58 58
 		// UPDATE TRANSACTION WITH PAYMENT
59 59
 		add_action(
60 60
 			'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
61
-			array( 'EE_Cron_Tasks', 'setup_update_for_transaction_with_payment' ),
61
+			array('EE_Cron_Tasks', 'setup_update_for_transaction_with_payment'),
62 62
 			10, 2
63 63
 		);
64 64
 		// FINALIZE ABANDONED TRANSACTIONS
65 65
 		add_action(
66 66
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
67
-			array( 'EE_Cron_Tasks', 'check_for_abandoned_transactions' ),
67
+			array('EE_Cron_Tasks', 'check_for_abandoned_transactions'),
68 68
 			10, 1
69 69
 		);
70 70
 		// CLEAN OUT JUNK TRANSACTIONS AND RELATED DATA
71 71
 		add_action(
72 72
 				'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
73
-				array( 'EE_Cron_Tasks', 'clean_out_junk_transactions' )
73
+				array('EE_Cron_Tasks', 'clean_out_junk_transactions')
74 74
 		);
75 75
 		// logging
76 76
 		add_action(
77 77
 			'AHEE__EE_System__load_core_configuration__complete',
78
-			array( 'EE_Cron_Tasks', 'log_scheduled_ee_crons' )
78
+			array('EE_Cron_Tasks', 'log_scheduled_ee_crons')
79 79
 		);
80 80
 	}
81 81
 
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
 			'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
92 92
 			'AHEE__EE_Cron_Tasks__clean_up_junk_transactions',
93 93
 		);
94
-		$crons = get_option( 'cron' );
95
-		if ( ! is_array( $crons ) ) {
94
+		$crons = get_option('cron');
95
+		if ( ! is_array($crons)) {
96 96
 			return;
97 97
 		}
98
-		foreach ( $crons as $timestamp => $cron ) {
99
-			foreach ( $ee_crons as $ee_cron ) {
100
-				if ( isset( $cron[ $ee_cron ] ) ) {
101
-					foreach ( $cron[ $ee_cron ] as $ee_cron_details ) {
102
-						do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron' );
103
-						if ( ! empty( $ee_cron_details[ 'args' ] )) {
104
-							do_action( 'AHEE_log', __CLASS__, __FUNCTION__, print_r( $ee_cron_details[ 'args' ], true ), "$ee_cron args" );
98
+		foreach ($crons as $timestamp => $cron) {
99
+			foreach ($ee_crons as $ee_cron) {
100
+				if (isset($cron[$ee_cron])) {
101
+					foreach ($cron[$ee_cron] as $ee_cron_details) {
102
+						do_action('AHEE_log', __CLASS__, __FUNCTION__, $ee_cron, 'scheduled EE cron');
103
+						if ( ! empty($ee_cron_details['args'])) {
104
+							do_action('AHEE_log', __CLASS__, __FUNCTION__, print_r($ee_cron_details['args'], true), "$ee_cron args");
105 105
 						}
106 106
 					}
107 107
 				}
@@ -138,15 +138,15 @@  discard block
 block discarded – undo
138 138
 		$TXN_ID,
139 139
 		$PAY_ID
140 140
 	) {
141
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
141
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
142 142
 		// validate $TXN_ID and $timestamp
143
-		$TXN_ID = absint( $TXN_ID );
144
-		$timestamp = absint( $timestamp );
145
-		if ( $TXN_ID && $timestamp ) {
143
+		$TXN_ID = absint($TXN_ID);
144
+		$timestamp = absint($timestamp);
145
+		if ($TXN_ID && $timestamp) {
146 146
 			wp_schedule_single_event(
147 147
 				$timestamp,
148 148
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment_2',
149
-				array( $TXN_ID, $PAY_ID )
149
+				array($TXN_ID, $PAY_ID)
150 150
 			);
151 151
 		}
152 152
 	}
@@ -168,13 +168,13 @@  discard block
 block discarded – undo
168 168
 	 * @param int  $TXN_ID
169 169
 	 * @param int $PAY_ID
170 170
 	 */
171
-	public static function setup_update_for_transaction_with_payment( $TXN_ID = 0, $PAY_ID = 0 ) {
172
-            do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
173
-		if ( absint( $TXN_ID )) {
174
-			self::$_update_transactions_with_payment[ $TXN_ID ] = $PAY_ID;
171
+	public static function setup_update_for_transaction_with_payment($TXN_ID = 0, $PAY_ID = 0) {
172
+            do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
173
+		if (absint($TXN_ID)) {
174
+			self::$_update_transactions_with_payment[$TXN_ID] = $PAY_ID;
175 175
 			add_action(
176 176
 				'shutdown',
177
-				array( 'EE_Cron_Tasks', 'update_transaction_with_payment' ),
177
+				array('EE_Cron_Tasks', 'update_transaction_with_payment'),
178 178
 				5
179 179
 			);
180 180
 		}
@@ -191,18 +191,18 @@  discard block
 block discarded – undo
191 191
 	 * returning from an off-site payment gateway
192 192
 	 */
193 193
 	public static function update_transaction_with_payment() {
194
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
194
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
195 195
 		// are there any TXNs that need cleaning up ?
196
-		if ( ! empty( self::$_update_transactions_with_payment ) ) {
196
+		if ( ! empty(self::$_update_transactions_with_payment)) {
197 197
 			/** @type EE_Payment_Processor $payment_processor */
198
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
198
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
199 199
 			// set revisit flag for payment processor
200
-			$payment_processor->set_revisit( false );
200
+			$payment_processor->set_revisit(false);
201 201
 			// load EEM_Transaction
202
-			EE_Registry::instance()->load_model( 'Transaction' );
203
-			foreach ( self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID ) {
202
+			EE_Registry::instance()->load_model('Transaction');
203
+			foreach (self::$_update_transactions_with_payment as $TXN_ID => $PAY_ID) {
204 204
 				// reschedule the cron if we can't hit the db right now
205
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
205
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
206 206
 					// reset cron job for updating the TXN
207 207
 					EE_Cron_Tasks::schedule_update_transaction_with_payment(
208 208
 						time() + EE_Cron_Tasks::reschedule_timeout,
@@ -211,15 +211,15 @@  discard block
 block discarded – undo
211 211
 					);
212 212
 					continue;
213 213
 				}
214
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
215
-				$payment = EEM_Payment::instance()->get_one_by_ID( $PAY_ID );
214
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
215
+				$payment = EEM_Payment::instance()->get_one_by_ID($PAY_ID);
216 216
 				// verify transaction
217
-				if ( $transaction instanceof EE_Transaction &&
218
-						$payment instanceof EE_Payment ) {
217
+				if ($transaction instanceof EE_Transaction &&
218
+						$payment instanceof EE_Payment) {
219 219
 					// now try to update the TXN with any payments
220
-					$payment_processor->update_txn_based_on_payment( $transaction, $payment, true, true );
220
+					$payment_processor->update_txn_based_on_payment($transaction, $payment, true, true);
221 221
 				}
222
-				unset( self::$_update_transactions_with_payment[ $TXN_ID ] );
222
+				unset(self::$_update_transactions_with_payment[$TXN_ID]);
223 223
 			}
224 224
 		}
225 225
 	}
@@ -256,14 +256,14 @@  discard block
 block discarded – undo
256 256
 		$TXN_ID
257 257
 	) {
258 258
 		// validate $TXN_ID and $timestamp
259
-		$TXN_ID = absint( $TXN_ID );
260
-		$timestamp = absint( $timestamp );
261
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
262
-		if ( $TXN_ID && $timestamp ) {
259
+		$TXN_ID = absint($TXN_ID);
260
+		$timestamp = absint($timestamp);
261
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
262
+		if ($TXN_ID && $timestamp) {
263 263
 			wp_schedule_single_event(
264 264
 				$timestamp,
265 265
 				'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions',
266
-				array( $TXN_ID )
266
+				array($TXN_ID)
267 267
 			);
268 268
 		}
269 269
 	}
@@ -285,13 +285,13 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param int $TXN_ID
287 287
 	 */
288
-	public static function check_for_abandoned_transactions(	$TXN_ID = 0 ) {
289
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
290
-		if ( absint( $TXN_ID )) {
291
-			self::$_abandoned_transactions[]  = $TXN_ID;
288
+	public static function check_for_abandoned_transactions($TXN_ID = 0) {
289
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
290
+		if (absint($TXN_ID)) {
291
+			self::$_abandoned_transactions[] = $TXN_ID;
292 292
 			add_action(
293 293
 				'shutdown',
294
-				array( 'EE_Cron_Tasks', 'finalize_abandoned_transactions' ),
294
+				array('EE_Cron_Tasks', 'finalize_abandoned_transactions'),
295 295
 				5
296 296
 			);
297 297
 		}
@@ -308,21 +308,21 @@  discard block
 block discarded – undo
308 308
 	 * returning from an off-site payment gateway
309 309
 	 */
310 310
 	public static function finalize_abandoned_transactions() {
311
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__ );
311
+		do_action('AHEE_log', __CLASS__, __FUNCTION__);
312 312
 		// are there any TXNs that need cleaning up ?
313
-		if ( ! empty( self::$_abandoned_transactions ) ) {
313
+		if ( ! empty(self::$_abandoned_transactions)) {
314 314
 			/** @type EE_Transaction_Processor $transaction_processor */
315
-			$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
315
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
316 316
 			// set revisit flag for txn processor
317
-			$transaction_processor->set_revisit( false );
317
+			$transaction_processor->set_revisit(false);
318 318
 			/** @type EE_Payment_Processor $payment_processor */
319
-			$payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' );
319
+			$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
320 320
 			// load EEM_Transaction
321
-			EE_Registry::instance()->load_model( 'Transaction' );
322
-			foreach ( self::$_abandoned_transactions as $TXN_ID ) {
323
-				do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID' );
321
+			EE_Registry::instance()->load_model('Transaction');
322
+			foreach (self::$_abandoned_transactions as $TXN_ID) {
323
+				do_action('AHEE_log', __CLASS__, __FUNCTION__, $TXN_ID, '$TXN_ID');
324 324
 				// reschedule the cron if we can't hit the db right now
325
-				if ( ! EE_Maintenance_Mode::instance()->models_can_query() ) {
325
+				if ( ! EE_Maintenance_Mode::instance()->models_can_query()) {
326 326
 					// reset cron job for finalizing the TXN
327 327
 					EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check(
328 328
 						time() + EE_Cron_Tasks::reschedule_timeout,
@@ -330,17 +330,17 @@  discard block
 block discarded – undo
330 330
 					);
331 331
 					continue;
332 332
 				}
333
-				$transaction = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID );
333
+				$transaction = EEM_Transaction::instance()->get_one_by_ID($TXN_ID);
334 334
 				// verify transaction
335
-				if ( $transaction instanceof EE_Transaction ) {
335
+				if ($transaction instanceof EE_Transaction) {
336 336
 					// don't finalize the TXN if it has already been completed
337
-					if ( $transaction_processor->all_reg_steps_completed( $transaction ) === true ) {
337
+					if ($transaction_processor->all_reg_steps_completed($transaction) === true) {
338 338
 						continue;
339 339
 					}
340 340
 					// let's simulate an IPN here which will trigger any notifications that need to go out
341
-					$payment_processor->update_txn_based_on_payment( $transaction, $transaction->last_payment(), true, true );
341
+					$payment_processor->update_txn_based_on_payment($transaction, $transaction->last_payment(), true, true);
342 342
 				}
343
-				unset( self::$_abandoned_transactions[ $TXN_ID ] );
343
+				unset(self::$_abandoned_transactions[$TXN_ID]);
344 344
 			}
345 345
 		}
346 346
 	}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 	//when a transaction is initially made, schedule this check.
357 357
 	//if it has NO REG data by the time it has expired, forget about it
358 358
 	public static function clean_out_junk_transactions() {
359
-		if( EE_Maintenance_Mode::instance()->models_can_query() ) {
359
+		if (EE_Maintenance_Mode::instance()->models_can_query()) {
360 360
 			EEM_Transaction::instance('')->delete_junk_transactions();
361 361
 			EEM_Registration::instance('')->delete_registrations_with_no_transaction();
362 362
 			EEM_Line_Item::instance('')->delete_line_items_with_no_transaction();
Please login to merge, or discard this patch.
core/db_models/EEM_Answer.model.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -125,14 +125,14 @@
 block discarded – undo
125 125
 	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128
-                //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
130
-                    //find this question's QST_system value
131
-                    $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
-                } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
-                }
128
+				//backward compat: we still want to find the question's ID
129
+				if( is_numeric( $question_system_id ) ) {
130
+					//find this question's QST_system value
131
+					$question_id = $question_system_id;
132
+					$question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
133
+				} else {
134
+					$question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
135
+				}
136 136
 		//only bother checking if the registration has an attendee
137 137
 		if( $registration->attendee() instanceof EE_Attendee ) {
138 138
 			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -51,18 +51,18 @@  discard block
 block discarded – undo
51 51
 	/**
52 52
 	 * 	constructor
53 53
 	 */
54
-	protected function __construct( $timezone = NULL ){
55
-		$this->singular_item = __('Answer','event_espresso');
56
-		$this->plural_item = __('Answers','event_espresso');
54
+	protected function __construct($timezone = NULL) {
55
+		$this->singular_item = __('Answer', 'event_espresso');
56
+		$this->plural_item = __('Answers', 'event_espresso');
57 57
 		$this->_tables = array(
58 58
 			'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID')
59 59
 		);
60 60
 		$this->_fields = array(
61 61
 			'Answer'=>array(
62
-				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')),
63
-				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'),
64
-				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
65
-				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '')
62
+				'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')),
63
+				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
64
+				'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
65
+				'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')
66 66
 			));
67 67
 		$this->_model_relations = array(
68 68
 			'Registration'=>new EE_Belongs_To_Relation(),
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		);
71 71
 		$this->_model_chain_to_wp_user = 'Registration.Event';
72 72
 		$this->_caps_slug = 'registrations';
73
-		parent::__construct( $timezone );
73
+		parent::__construct($timezone);
74 74
 	}
75 75
 
76 76
 
@@ -83,19 +83,19 @@  discard block
 block discarded – undo
83 83
 	 * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value'
84 84
 	 * @return string
85 85
 	 */
86
-	public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){
87
-		$value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer );
88
-		if (  $value === NULL ){
89
-			$answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer );
90
-			if( $answer_obj instanceof EE_Answer ){
91
-				if($pretty_answer){
86
+	public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) {
87
+		$value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer);
88
+		if ($value === NULL) {
89
+			$answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer);
90
+			if ($answer_obj instanceof EE_Answer) {
91
+				if ($pretty_answer) {
92 92
 					$value = $answer_obj->pretty_value();
93
-				}else{
93
+				} else {
94 94
 					$value = $answer_obj->value();
95 95
 				}
96 96
 			}
97 97
 		}
98
-		return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id );
98
+		return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id);
99 99
 	}
100 100
 
101 101
 
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 	 * @param int $question_id
107 107
 	 * @return EE_Answer
108 108
 	 */
109
-	public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){
110
-		$answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() )));
111
-		return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id );
109
+	public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) {
110
+		$answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID())));
111
+		return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id);
112 112
 	}
113 113
 
114 114
 
@@ -122,39 +122,39 @@  discard block
 block discarded – undo
122 122
 	 * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for 
123 123
 	 * a question corresponding to an attendee field, returns null)
124 124
 	 */
125
-	public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){
125
+	public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) {
126 126
 		$field_name = NULL;
127 127
 		$value = NULL;
128 128
                 //backward compat: we still want to find the question's ID
129
-                if( is_numeric( $question_system_id ) ) {
129
+                if (is_numeric($question_system_id)) {
130 130
                     //find this question's QST_system value
131 131
                     $question_id = $question_system_id;
132
-                    $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' );
132
+                    $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system');
133 133
                 } else {
134
-                    $question_id = intval( EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ) );
134
+                    $question_id = intval(EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID'));
135 135
                 }
136 136
 		//only bother checking if the registration has an attendee
137
-		if( $registration->attendee() instanceof EE_Attendee ) {
138
-			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id );
139
-			if( $field_name ) {
140
-				if( $pretty_answer ) {
141
-					if( $field_name == 'STA_ID' ) {
137
+		if ($registration->attendee() instanceof EE_Attendee) {
138
+			$field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id);
139
+			if ($field_name) {
140
+				if ($pretty_answer) {
141
+					if ($field_name == 'STA_ID') {
142 142
 						$state = $registration->attendee()->state_obj();
143
-						$value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() );
144
-					} else if($field_name == 'CNT_ISO') {
143
+						$value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID());
144
+					} else if ($field_name == 'CNT_ISO') {
145 145
 						$country = $registration->attendee()->country_obj();
146
-						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID());
146
+						$value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID());
147 147
 					} else {
148
-						$value = $registration->attendee()->get_pretty( $field_name );
148
+						$value = $registration->attendee()->get_pretty($field_name);
149 149
 					}
150 150
 					//if field name is blank, leave the value as null too
151
-				}else{
152
-					$value = $registration->attendee()->get( $field_name );
151
+				} else {
152
+					$value = $registration->attendee()->get($field_name);
153 153
 				}
154 154
 			}
155 155
 			//if no field was found, leave value blank
156 156
 		}
157
-		return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id );
157
+		return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id);
158 158
 	}
159 159
 
160 160
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -90,7 +92,7 @@  discard block
 block discarded – undo
90 92
 			if( $answer_obj instanceof EE_Answer ){
91 93
 				if($pretty_answer){
92 94
 					$value = $answer_obj->pretty_value();
93
-				}else{
95
+				} else{
94 96
 					$value = $answer_obj->value();
95 97
 				}
96 98
 			}
@@ -148,7 +150,7 @@  discard block
 block discarded – undo
148 150
 						$value = $registration->attendee()->get_pretty( $field_name );
149 151
 					}
150 152
 					//if field name is blank, leave the value as null too
151
-				}else{
153
+				} else{
152 154
 					$value = $registration->attendee()->get( $field_name );
153 155
 				}
154 156
 			}
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime.model.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	/**
78
-	*		create new blank datetime
79
-	*
80
-	* 		@access		public
81
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
82
-	*/
78
+	 *		create new blank datetime
79
+	 *
80
+	 * 		@access		public
81
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
82
+	 */
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 
102 102
 	/**
103
-	*		get event start date from db
104
-	*
105
-	* 		@access		public
106
-	* 		@param		int 			$EVT_ID
107
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108
-	*/
103
+	 *		get event start date from db
104
+	 *
105
+	 * 		@access		public
106
+	 * 		@param		int 			$EVT_ID
107
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
108
+	 */
109 109
 	public function get_all_event_dates( $EVT_ID = 0 ) {
110 110
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 		/**
253
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
-	 * only by start date
255
-	 * @param int $TKT_ID
256
-	 * @param boolean $include_expired
257
-	 * @param boolean $include_deleted
258
-	 * @param int $limit
259
-	 * @return EE_Datetime[]
260
-	 */
253
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
+		 * only by start date
255
+		 * @param int $TKT_ID
256
+		 * @param boolean $include_expired
257
+		 * @param boolean $include_deleted
258
+		 * @param int $limit
259
+		 * @return EE_Datetime[]
260
+		 */
261 261
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
262 262
 		//sanitize TKT_ID
263 263
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@
 block discarded – undo
443 443
 	/**
444 444
 	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
445 445
 	 *
446
-	 * @param  array $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
446
+	 * @param  string[] $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
447 447
 	 *                               you want counts for as values in the array.  An empty array returns counts for all valid
448 448
 	 *                               stati.
449 449
 	 * @param  array  $query_params  If included can be used to refine the conditions for returning the count (i.e. only for
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,27 +35,27 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, time(), $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, time(), $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
56 56
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
57
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
58
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
57
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
58
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
59 59
 			));
60 60
 		$this->_model_relations = array(
61 61
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -64,11 +64,11 @@  discard block
 block discarded – undo
64 64
 		);
65 65
 		$this->_model_chain_to_wp_user = 'Event';
66 66
 		//this model is generally available for reading
67
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
71
-		parent::__construct( $timezone );
67
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
71
+		parent::__construct($timezone);
72 72
 	}
73 73
 
74 74
 
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
86
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
87
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
86
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
88 88
 				'DTT_order' => 1,
89 89
 				'DTT_reg_limit' => EE_INF
90 90
 			),
91 91
 			$this->_timezone
92 92
 		);
93
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
94
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
95
-		return array( $blank_datetime );
93
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
94
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
95
+		return array($blank_datetime);
96 96
 	}
97 97
 
98 98
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	* 		@param		int 			$EVT_ID
107 107
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108 108
 	*/
109
-	public function get_all_event_dates( $EVT_ID = 0 ) {
110
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
109
+	public function get_all_event_dates($EVT_ID = 0) {
110
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
112 112
 		}
113
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
113
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114 114
 
115
-		if ( empty( $results ) ) {
115
+		if (empty($results)) {
116 116
 			return $this->create_new_blank_datetime();
117 117
 		}
118 118
 
@@ -133,26 +133,26 @@  discard block
 block discarded – undo
133 133
 	 *                        	the given number
134 134
 	 * @return EE_Datetime[]
135 135
 	 */
136
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
136
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
137 137
 
138 138
 		//sanitize EVT_ID
139
-		$EVT_ID = intval( $EVT_ID );
139
+		$EVT_ID = intval($EVT_ID);
140 140
 
141 141
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
142
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
143
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
142
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
143
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
144 144
 
145
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
145
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
146 146
 
147
-		if( ! $include_expired){
148
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
147
+		if ( ! $include_expired) {
148
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
149 149
 		}
150
-		if( $include_deleted){
151
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
150
+		if ($include_deleted) {
151
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
152 152
 		}
153 153
 
154
-		$result = $this->get_all( $query_params );
155
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
154
+		$result = $this->get_all($query_params);
155
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
156 156
 		return $result;
157 157
 	}
158 158
 
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	 * @param int $limit
168 168
 	 * @return EE_Datetime[]
169 169
 	 */
170
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
171
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
170
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
171
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
172 172
 			'limit'=>$limit,
173 173
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
174 174
 			'default_where_conditions' => 'none'));
@@ -183,11 +183,11 @@  discard block
 block discarded – undo
183 183
 	 * @param boolean $include_deleted
184 184
 	 * @return EE_Datetime
185 185
 	 */
186
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
187
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
-		if($results){
186
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
187
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188
+		if ($results) {
189 189
 			return array_shift($results);
190
-		}else{
190
+		} else {
191 191
 			return NULL;
192 192
 		}
193 193
 	}
@@ -201,16 +201,16 @@  discard block
 block discarded – undo
201 201
 	 * @param bool $try_to_exclude_deleted
202 202
 	 * @return \EE_Datetime
203 203
 	 */
204
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
205
-		if($try_to_exclude_expired){
206
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
207
-			if($non_expired){
204
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
205
+		if ($try_to_exclude_expired) {
206
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
207
+			if ($non_expired) {
208 208
 				return $non_expired;
209 209
 			}
210 210
 		}
211
-		if($try_to_exclude_deleted){
211
+		if ($try_to_exclude_deleted) {
212 212
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
213
-			if($expired_even){
213
+			if ($expired_even) {
214 214
 				return $expired_even;
215 215
 			}
216 216
 		}
@@ -229,23 +229,23 @@  discard block
 block discarded – undo
229 229
 	 * @param int $limit
230 230
 	 * @return EE_Datetime[]
231 231
 	 */
232
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
232
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
233 233
 		//sanitize EVT_ID
234
-		$EVT_ID = intval( $EVT_ID );
234
+		$EVT_ID = intval($EVT_ID);
235 235
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
236
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
237
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
238
-		if( ! $include_expired){
239
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
236
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
237
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
238
+		if ( ! $include_expired) {
239
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
240 240
 		}
241
-		if( $include_deleted){
242
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
241
+		if ($include_deleted) {
242
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
243 243
 		}
244
-		if($limit){
244
+		if ($limit) {
245 245
 			$query_params['limit'] = $limit;
246 246
 		}
247
-		$result = $this->get_all( $query_params );
248
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
247
+		$result = $this->get_all($query_params);
248
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
249 249
 		return $result;
250 250
 	}
251 251
 
@@ -258,23 +258,23 @@  discard block
 block discarded – undo
258 258
 	 * @param int $limit
259 259
 	 * @return EE_Datetime[]
260 260
 	 */
261
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
261
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
262 262
 		//sanitize TKT_ID
263
-		$TKT_ID =  intval( $TKT_ID );
263
+		$TKT_ID = intval($TKT_ID);
264 264
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
265
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
266
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
267
-		if( ! $include_expired){
268
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
265
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
266
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
267
+		if ( ! $include_expired) {
268
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
269 269
 		}
270
-		if( $include_deleted){
271
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
270
+		if ($include_deleted) {
271
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
272 272
 		}
273
-		if($limit){
273
+		if ($limit) {
274 274
 			$query_params['limit'] = $limit;
275 275
 		}
276
-		$result = $this->get_all( $query_params );
277
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
276
+		$result = $this->get_all($query_params);
277
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
278 278
 		return $result;
279 279
 	}
280 280
 
@@ -290,24 +290,24 @@  discard block
 block discarded – undo
290 290
 	 *                                  that number
291 291
 	 * @return EE_Datetime[]
292 292
 	 */
293
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
293
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
294 294
 		//sanitize id.
295
-		$TKT_ID =  intval( $TKT_ID );
295
+		$TKT_ID = intval($TKT_ID);
296 296
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
297
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
298
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
299
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
300
-		if( ! $include_expired){
301
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
297
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
298
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
299
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
300
+		if ( ! $include_expired) {
301
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
302 302
 		}
303
-		if( $include_deleted){
304
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
303
+		if ($include_deleted) {
304
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
305 305
 		}
306
-		if($limit){
306
+		if ($limit) {
307 307
 			$query_params['limit'] = $limit;
308 308
 		}
309
-		$result = $this->get_all( $query_params );
310
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
309
+		$result = $this->get_all($query_params);
310
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
311 311
 		return $result;
312 312
 	}
313 313
 
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	 * @param int $EVT_ID
319 319
 	 * @return EE_Datetime
320 320
 	 */
321
-	public function get_most_important_datetime_for_event($EVT_ID){
321
+	public function get_most_important_datetime_for_event($EVT_ID) {
322 322
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323
-		if($results){
323
+		if ($results) {
324 324
 			return array_shift($results);
325
-		}else{
325
+		} else {
326 326
 			return null;
327 327
 		}
328 328
 	}
@@ -341,78 +341,78 @@  discard block
 block discarded – undo
341 341
 	 * 			- inactive = Events that are either not published.
342 342
 	 * @return wpdb results array
343 343
 	 */
344
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
345
-		$current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' );
346
-		$current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' );
344
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
345
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
346
+		$current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end');
347 347
 
348
-		switch ( $evt_active_status ) {
348
+		switch ($evt_active_status) {
349 349
 			case 'upcoming' :
350 350
 					$where_params['Event.status'] = 'publish';
351 351
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
352
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
352
+					if (isset($where_params['DTT_EVT_start'])) {
353 353
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
354 354
 					}
355
-					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start );
355
+					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
356 356
 					break;
357 357
 
358 358
 			case 'expired' :
359
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
359
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
360 360
 				//get events to exclude
361
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
361
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end)));
362 362
 				//first get all events that have datetimes where its not expired.
363
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
364
-				$event_ids = array_keys( $event_ids );
363
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
364
+				$event_ids = array_keys($event_ids);
365 365
 
366
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
366
+				if (isset($where_params['DTT_EVT_end'])) {
367 367
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
368 368
 				}
369
-				$where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end );
370
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
369
+				$where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end);
370
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
371 371
 				break;
372 372
 
373 373
 			case 'active' :
374 374
 				$where_params['Event.status'] = 'publish';
375
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
375
+				if (isset($where_params['DTT_EVT_start'])) {
376 376
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
377 377
 				}
378
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
378
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
379 379
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
380 380
 				}
381
-				$where_params['DTT_EVT_start'] = array('<',  $current_time_for_DTT_EVT_start );
382
-				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end );
381
+				$where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
382
+				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end);
383 383
 				break;
384 384
 
385 385
 			case 'inactive' :
386
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
387
-				if ( isset( $where_params['OR'] ) ) {
386
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
387
+				if (isset($where_params['OR'])) {
388 388
 					$where_params['AND']['OR'] = $where_params['OR'];
389 389
 				}
390
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
390
+				if (isset($where_params['DTT_EVT_end'])) {
391 391
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
392
-					unset( $where_params['DTT_EVT_end'] );
392
+					unset($where_params['DTT_EVT_end']);
393 393
 				}
394 394
 
395
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
395
+				if (isset($where_params['DTT_EVT_start'])) {
396 396
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
397
-					unset( $where_params['DTT_EVT_start'] );
397
+					unset($where_params['DTT_EVT_start']);
398 398
 				}
399
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
399
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
400 400
 				break;
401 401
 		}
402 402
 
403 403
 		$query_params[0] = $where_params;
404 404
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
405
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
405
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
406 406
 
407
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
408
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' );
407
+		EE_Registry::instance()->load_helper('DTT_Helper');
408
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start');
409 409
 
410 410
 		$columns_to_select = array(
411
-			'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'),
412
-			'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'),
413
-			'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s')
411
+			'dtt_year' => array('YEAR('.$query_interval.')', '%s'),
412
+			'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'),
413
+			'dtt_month_num' => array('MONTH('.$query_interval.')', '%s')
414 414
 			);
415
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
415
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	 * for the tickets for each datetime)
421 421
 	 * @param EE_Datetime[] $datetimes
422 422
 	 */
423
-	public function update_sold($datetimes){
424
-		foreach($datetimes as $datetime){
423
+	public function update_sold($datetimes) {
424
+		foreach ($datetimes as $datetime) {
425 425
 			$datetime->update_sold();
426 426
 		}
427 427
 	}
@@ -436,10 +436,10 @@  discard block
 block discarded – undo
436 436
 	 * @param array $query_params
437 437
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
438 438
 	 */
439
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
440
-		$datetime = $this->get_one_by_ID( $DTT_ID );
441
-		if ( $datetime instanceof EE_Datetime ) {
442
-			return $datetime->tickets_remaining( $query_params );
439
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
440
+		$datetime = $this->get_one_by_ID($DTT_ID);
441
+		if ($datetime instanceof EE_Datetime) {
442
+			return $datetime->tickets_remaining($query_params);
443 443
 		}
444 444
 		return 0;
445 445
 	}
@@ -461,36 +461,36 @@  discard block
 block discarded – undo
461 461
 	 *                EE_Datetime::upcoming
462 462
 	 *                EE_Datetime::expired
463 463
 	 */
464
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
464
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
465 465
 		//only accept where conditions for this query.
466
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
466
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
467 467
 		$status_query_args = array(
468 468
 				EE_Datetime::active => array_merge(
469 469
 						$_where,
470
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
470
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
471 471
 				),
472 472
 				EE_Datetime::upcoming => array_merge(
473 473
 						$_where,
474
-						array( 'DTT_EVT_start' => array( '>', time() ) )
474
+						array('DTT_EVT_start' => array('>', time()))
475 475
 				),
476 476
 				EE_Datetime::expired => array_merge(
477 477
 						$_where,
478
-						array( 'DTT_EVT_end' => array('<', time() ) )
478
+						array('DTT_EVT_end' => array('<', time()))
479 479
 				)
480 480
 		);
481 481
 
482
-		if ( ! empty( $stati_to_include ) ) {
483
-			foreach( array_keys( $status_query_args ) as $status ) {
484
-				if ( ! in_array( $status, $stati_to_include ) ) {
485
-					unset( $status_query_args[$status] );
482
+		if ( ! empty($stati_to_include)) {
483
+			foreach (array_keys($status_query_args) as $status) {
484
+				if ( ! in_array($status, $stati_to_include)) {
485
+					unset($status_query_args[$status]);
486 486
 				}
487 487
 			}
488 488
 		}
489 489
 
490 490
 		//loop through and query counts for each stati.
491 491
 		$status_query_results = array();
492
-		foreach( $status_query_args as $status => $status_where_conditions ) {
493
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
492
+		foreach ($status_query_args as $status => $status_where_conditions) {
493
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
494 494
 		}
495 495
 
496 496
 		return $status_query_results;
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 	 * @param array $query_params
505 505
 	 * @return int
506 506
 	 */
507
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
508
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
509
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
507
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
508
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
509
+		return ! empty($count[$status]) ? $count[$status] : 0;
510 510
 	}
511 511
 
512 512
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -187,7 +189,7 @@  discard block
 block discarded – undo
187 189
 		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188 190
 		if($results){
189 191
 			return array_shift($results);
190
-		}else{
192
+		} else{
191 193
 			return NULL;
192 194
 		}
193 195
 	}
@@ -322,7 +324,7 @@  discard block
 block discarded – undo
322 324
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323 325
 		if($results){
324 326
 			return array_shift($results);
325
-		}else{
327
+		} else{
326 328
 			return null;
327 329
 		}
328 330
 	}
@@ -356,7 +358,9 @@  discard block
 block discarded – undo
356 358
 					break;
357 359
 
358 360
 			case 'expired' :
359
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
361
+				if ( isset( $where_params['Event.status'] ) ) {
362
+					unset( $where_params['Event.status'] );
363
+				}
360 364
 				//get events to exclude
361 365
 				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
362 366
 				//first get all events that have datetimes where its not expired.
@@ -383,7 +387,9 @@  discard block
 block discarded – undo
383 387
 				break;
384 388
 
385 389
 			case 'inactive' :
386
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
390
+				if ( isset( $where_params['Event.status'] ) ) {
391
+					unset( $where_params['Event.status'] );
392
+				}
387 393
 				if ( isset( $where_params['OR'] ) ) {
388 394
 					$where_params['AND']['OR'] = $where_params['OR'];
389 395
 				}
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Option.model.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Option.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Option.class.php');
26 26
 
27 27
 
28 28
 class EEM_Question_Option extends EEM_Soft_Delete_Base {
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
   	// private instance of the Attendee object
31 31
 	protected static $_instance = NULL;
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Option','event_espresso');
35
-		$this->plural_item = __('Question Options','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Option', 'event_espresso');
35
+		$this->plural_item = __('Question Options', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID')
38
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Option'=>array(
42
-					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')),
43
-					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
44
-					'QSO_value'=>new EE_Plain_Text_Field('QSO_value',  __("Question Option Value", "event_espresso"),false,''),
45
-					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''),
46
-					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ),
47
-					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option','event_espresso'), TRUE, NULL ),
48
-					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
42
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
43
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
44
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
45
+					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
46
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
47
+					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL),
48
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
49 49
 				)
50 50
 		);
51 51
 		$this->_model_relations = array(
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->_model_chain_to_wp_user = 'Question';
56 56
 		//this model is generally available for reading
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
57
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option');
61 61
 		$this->_caps_slug = 'questions';
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Taxonomy extends EEM_Base {
27 27
 
@@ -29,67 +29,67 @@  discard block
 block discarded – undo
29 29
 	protected static $_instance = NULL;
30 30
 
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Term Taxonomy','event_espresso');
34
-		$this->plural_item = __('Term Taxonomy','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Term Taxonomy', 'event_espresso');
34
+		$this->plural_item = __('Term Taxonomy', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Term_Taxonomy'=>array(
40
-				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')),
41
-				'term_id'=>new EE_Foreign_Key_Int_Field('term_id',  __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'),
43
-				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''),
44
-				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0),
40
+				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')),
41
+				'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'),
43
+				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''),
44
+				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0),
45 45
 				'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Term_Relationship'=>new EE_Has_Many_Relation(),
49 49
 			'Term'=>new EE_Belongs_To_Relation(),
50 50
 		);
51
-		$cpt_models = array_keys( EE_Registry::instance()->cpt_models() );
52
-		foreach( $cpt_models  as $model_name ) {
53
-			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation( 'Term_Relationship' );
51
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
52
+		foreach ($cpt_models  as $model_name) {
53
+			$this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
54 54
 		}
55 55
 		$this->_indexes = array(
56
-			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy'))
56
+			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy'))
57 57
 		);
58 58
 		$path_to_tax_model = '';
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
60
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
61
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
62
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
63 63
 
64 64
 		//add cap restrictions for editing relating to the "ee_edit_*"
65
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
65
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
66 66
 				array(
67
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
67
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
68 68
 				));
69
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
69
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
70 70
 				array(
71
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
71
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
72 72
 				));
73
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
73
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
74 74
 				array(
75
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
75
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
76 76
 				));
77 77
 
78 78
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
79
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
79
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
80 80
 				array(
81
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
81
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
82 82
 				));
83
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
83
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
84 84
 				array(
85
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
85
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
86 86
 				));
87
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
87
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
88 88
 				array(
89
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
89
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
90 90
 				));
91 91
 
92
-		parent::__construct( $timezone );
92
+		parent::__construct($timezone);
93 93
 	}
94 94
 
95 95
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 /**
4 4
  *
5 5
  * Class EE_Enum_Text_Field
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param mixed $default_value
24 24
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
25 25
 	 */
26
-	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){
26
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) {
27 27
 		$this->_allowed_enum_values = $allowed_enum_values;
28 28
 		parent::__construct($table_column, $nice_name, $nullable, $default_value);
29 29
 	}
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws EE_Error
39 39
 	 */
40
-	function prepare_for_set( $value_inputted_for_field_on_model_object ) {
41
-		if(
40
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
41
+		if (
42 42
 			$value_inputted_for_field_on_model_object !== null
43
-			&& ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )
44
-		){
45
-			if( defined( 'WP_DEBUG' ) &&  WP_DEBUG ){
43
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)
44
+		) {
45
+			if (defined('WP_DEBUG') && WP_DEBUG) {
46 46
 				$msg = sprintf(
47
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
47
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
48 48
 					$value_inputted_for_field_on_model_object,
49 49
 					$this->_name
50 50
 				);
51 51
 				$msg2 = sprintf(
52
-					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"','event_espresso'),
52
+					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
53 53
 					$this->_name,
54
-					implode( ", ", array_keys( $this->_allowed_enum_values ) ),
54
+					implode(", ", array_keys($this->_allowed_enum_values)),
55 55
 					$value_inputted_for_field_on_model_object
56 56
 				);
57
-				EE_Error::add_error( "$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ );
57
+				EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__);
58 58
 			}
59 59
 			return $this->get_default_value();
60 60
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Serialized_Text_Field.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * However, when inserting into the DB, it should be serialized.
8 8
  * Upon retrieval from the DB, it should be unserialized back into an array.
9 9
  */
10
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
11
-class EE_Serialized_Text_Field extends EE_Text_Field_Base{
10
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
11
+class EE_Serialized_Text_Field extends EE_Text_Field_Base {
12 12
 	/**
13 13
 	 * Value SHOULD be an array, and we want to now convert it to a serialized string
14 14
 	 * @param array $value_of_field_on_model_object
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 		return maybe_serialize($value_of_field_on_model_object);
19 19
 	}
20 20
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
21
-		EE_Registry::instance()->load_helper( 'Array' );
22
-		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize( $value_inputted_for_field_on_model_object );
23
-		if(is_string($value_inputted_for_field_on_model_object)){
21
+		EE_Registry::instance()->load_helper('Array');
22
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
23
+		if (is_string($value_inputted_for_field_on_model_object)) {
24 24
 			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
25
-		}elseif(is_array($value_inputted_for_field_on_model_object)){
26
-			return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
-		}else{//so they passed NULL or an INT or something wack
25
+		}elseif (is_array($value_inputted_for_field_on_model_object)) {
26
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
+		} else {//so they passed NULL or an INT or something wack
28 28
 			return $value_inputted_for_field_on_model_object;
29 29
 		}
30 30
 	}
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @return array
35 35
 	 */
36 36
 	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
37
-		EE_Registry::instance()->load_helper( 'Array' );
38
-		return EEH_Array::maybe_unserialize( $value_found_in_db_for_model_object );
37
+		EE_Registry::instance()->load_helper('Array');
38
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
39 39
 	}
40 40
 
41 41
 	/**
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	 * @return string
46 46
 	 */
47 47
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
48
-		switch($schema){
48
+		switch ($schema) {
49 49
 			case 'print_r':
50
-				$pretty_value = print_r($value_on_field_to_be_outputted,true);
50
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
51 51
 				break;
52 52
 			case 'as_table':
53 53
 				EE_Registry::instance()->load_helper('Template');
54 54
 				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
55 55
 				break;
56 56
 			default:
57
-				$pretty_value = implode(", ",$value_on_field_to_be_outputted);
57
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
58 58
 		}
59 59
 		return $pretty_value;
60 60
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
 		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize( $value_inputted_for_field_on_model_object );
22 22
 		if(is_string($value_inputted_for_field_on_model_object)){
23 23
 			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
24
-		}elseif(is_array($value_inputted_for_field_on_model_object)){
24
+		} elseif(is_array($value_inputted_for_field_on_model_object)){
25 25
 			return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object);
26
-		}else{//so they passed NULL or an INT or something wack
26
+		} else{//so they passed NULL or an INT or something wack
27 27
 			return $value_inputted_for_field_on_model_object;
28 28
 		}
29 29
 	}
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
form_sections/payment_methods/EE_Billing_Attendee_Info_Form.form.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -14,31 +14,31 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form{
17
+class EE_Billing_Attendee_Info_Form extends EE_Billing_Info_Form {
18 18
 
19 19
 	/**
20 20
 	 *
21 21
 	 * @param EE_Payment_Method $payment_method
22 22
 	 * @param array $options_array @see EE_Form_Section_Proper::__construct()
23 23
 	 */
24
-	public function __construct( EE_Payment_Method $payment_method, $options_array= array()){
24
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array()) {
25 25
 		$options_array['subsections'] = array_merge(
26 26
 			array(
27
-				'first_name' 	=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __( 'First Name', 'event_espresso' ) ) ),
28
-				'last_name'		=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __( 'Last Name', 'event_espresso' ) ) ),
29
-				'email'				=> new EE_Email_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __( 'Email', 'event_espresso' ) ) ),
30
-				'address'			=> new EE_Text_Input( array( 'html_label_text'=>  __( 'Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address' )),
31
-				'address2'		=> new EE_Text_Input( array( 'html_label_text'=> __( 'Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2' )),
32
-				'city'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __( 'City', 'event_espresso' ) ) ),
33
-				'state' 				=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __( 'State', 'event_espresso' ) ) ) ),
34
-				'country' 			=> apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input( NULL, array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __( 'Country', 'event_espresso' ) ) ) ),
35
-				'zip'					=> new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),
36
-				'phone'			=> new EE_Text_Input( array( 'html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __( 'Phone', 'event_espresso' ) )),
27
+				'first_name' 	=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-fname', 'html_label_text' => __('First Name', 'event_espresso'))),
28
+				'last_name'		=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-lname', 'html_label_text' => __('Last Name', 'event_espresso'))),
29
+				'email'				=> new EE_Email_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-email', 'html_label_text' => __('Email', 'event_espresso'))),
30
+				'address'			=> new EE_Text_Input(array('html_label_text'=>  __('Address', 'event_espresso'), 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-address')),
31
+				'address2'		=> new EE_Text_Input(array('html_label_text'=> __('Address 2', 'event_espresso'), 'html_class' => 'ee-billing-qstn ee-billing-qstn-address2')),
32
+				'city'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-city', 'html_label_text' => __('City', 'event_espresso'))),
33
+				'state' 				=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__state_field', new EE_State_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-state', 'html_label_text' => __('State', 'event_espresso')))),
34
+				'country' 			=> apply_filters('FHEE__EE_Billing_Attendee_Info_Form__country_field', new EE_Country_Select_Input(NULL, array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-country', 'html_label_text' => __('Country', 'event_espresso')))),
35
+				'zip'					=> new EE_Text_Input(array('required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __('Zip', 'event_espresso'))),
36
+				'phone'			=> new EE_Text_Input(array('html_class' => 'ee-billing-qstn ee-billing-qstn-phone', 'html_label_text' => __('Phone', 'event_espresso'))),
37 37
 			),
38
-			isset( $options_array['subsections'] ) ? $options_array['subsections'] : array()
38
+			isset($options_array['subsections']) ? $options_array['subsections'] : array()
39 39
 		);
40 40
 
41
-		parent::__construct( $payment_method, $options_array );
41
+		parent::__construct($payment_method, $options_array);
42 42
 
43 43
 	}
44 44
 
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 	 * Sets the defaults for the billing form according to the attendee's details
47 47
 	 * @param EE_Attendee $attendee
48 48
 	 */
49
-	public function populate_from_attendee( $attendee ){
49
+	public function populate_from_attendee($attendee) {
50 50
 		$attendee = EEM_Attendee::instance()->ensure_is_obj($attendee);
51 51
 		/** @var $attendee EE_Attendee */
52 52
 		$this->populate_defaults( 
53
-				apply_filters( 'FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
53
+				apply_filters('FHEE__EE_Billing_Attendee_Info_Form__populate_from_attendee',
54 54
 					array(
55 55
 						'first_name'=>$attendee->fname(),
56 56
 						'last_name'=>$attendee->lname(),
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 						'zip'=>$attendee->zip(),
64 64
 						'phone'=>$attendee->phone(),
65 65
 					),
66
-					$attendee )
66
+					$attendee)
67 67
 				
68 68
 				);
69 69
 	}
@@ -76,48 +76,48 @@  discard block
 block discarded – undo
76 76
 	 * @param \EE_Attendee $attendee - the attendee object to copy details to
77 77
 	 * @return \EE_Attendee
78 78
 	 */
79
-	public function copy_billing_form_data_to_attendee( EE_Attendee $attendee ){
79
+	public function copy_billing_form_data_to_attendee(EE_Attendee $attendee) {
80 80
 		// grab billing form data
81 81
 		$data = $this->valid_data();
82 82
 		// copy first_name
83
-		if ( ! empty( $data['first_name'] )) {
84
-			$attendee->set_fname( $data['first_name'] );
83
+		if ( ! empty($data['first_name'])) {
84
+			$attendee->set_fname($data['first_name']);
85 85
 		}
86 86
 		// copy last_name
87
-		if ( ! empty( $data['last_name'] )) {
88
-			$attendee->set_lname( $data['last_name'] );
87
+		if ( ! empty($data['last_name'])) {
88
+			$attendee->set_lname($data['last_name']);
89 89
 		}
90 90
 		// copy email
91
-		if ( ! empty( $data['email'] )) {
92
-			$attendee->set_email( $data['email'] );
91
+		if ( ! empty($data['email'])) {
92
+			$attendee->set_email($data['email']);
93 93
 		}
94 94
 		// copy address
95
-		if ( ! empty( $data['address'] )) {
96
-			$attendee->set_address( $data['address'] );
95
+		if ( ! empty($data['address'])) {
96
+			$attendee->set_address($data['address']);
97 97
 		}
98 98
 		// copy address2
99
-		if ( ! empty( $data['address2'] )) {
100
-			$attendee->set_address2( $data['address2'] );
99
+		if ( ! empty($data['address2'])) {
100
+			$attendee->set_address2($data['address2']);
101 101
 		}
102 102
 		// copy city
103
-		if ( ! empty( $data['city'] )) {
104
-			$attendee->set_city( $data['city'] );
103
+		if ( ! empty($data['city'])) {
104
+			$attendee->set_city($data['city']);
105 105
 		}
106 106
 		// copy state
107
-		if ( ! empty( $data['state'] )) {
108
-			$attendee->set_state( $data['state'] );
107
+		if ( ! empty($data['state'])) {
108
+			$attendee->set_state($data['state']);
109 109
 		}
110 110
 		// copy country
111
-		if ( ! empty( $data['country'] )) {
112
-			$attendee->set_country( $data['country'] );
111
+		if ( ! empty($data['country'])) {
112
+			$attendee->set_country($data['country']);
113 113
 		}
114 114
 		// copy zip
115
-		if ( ! empty( $data['zip'] )) {
116
-			$attendee->set_zip( $data['zip'] );
115
+		if ( ! empty($data['zip'])) {
116
+			$attendee->set_zip($data['zip']);
117 117
 		}
118 118
 		// copy phone
119
-		if ( ! empty( $data['phone'] )) {
120
-			$attendee->set_phone( $data['phone'] );
119
+		if ( ! empty($data['phone'])) {
120
+			$attendee->set_phone($data['phone']);
121 121
 		}
122 122
 		return $attendee;
123 123
 	}
@@ -128,20 +128,20 @@  discard block
 block discarded – undo
128 128
 	 * uses info from the billing form to create a new attendee
129 129
 	 * @return \EE_Attendee
130 130
 	 */
131
-	public function create_attendee_from_billing_form_data(){
131
+	public function create_attendee_from_billing_form_data() {
132 132
 		// grab billing form data
133 133
 		$data = $this->valid_data();
134
-		return EE_Attendee::new_instance( array(
135
-			'ATT_fname' 		=> ! empty( $data['first_name'] ) ? $data['first_name'] : '',
136
-			'ATT_lname' 		=> ! empty( $data['last_name'] ) ? $data['last_name'] : '',
137
-			'ATT_email' 		=> ! empty( $data['email'] ) ? $data['email'] : '',
138
-			'ATT_address' 		=> ! empty( $data['address'] ) ? $data['address'] : '',
139
-			'ATT_address2' 	=> ! empty( $data['address2'] ) ? $data['address2'] : '',
140
-			'ATT_city' 			=> ! empty( $data['city'] ) ? $data['city'] : '',
141
-			'STA_ID' 				=> ! empty( $data['state'] ) ? $data['state'] : '',
142
-			'CNT_ISO' 			=> ! empty( $data['country'] ) ? $data['country'] : '',
143
-			'ATT_zip' 				=> ! empty( $data['zip'] ) ? $data['zip'] : '',
144
-			'ATT_phone' 		=> ! empty( $data['phone'] ) ? $data['phone'] : '',
134
+		return EE_Attendee::new_instance(array(
135
+			'ATT_fname' 		=> ! empty($data['first_name']) ? $data['first_name'] : '',
136
+			'ATT_lname' 		=> ! empty($data['last_name']) ? $data['last_name'] : '',
137
+			'ATT_email' 		=> ! empty($data['email']) ? $data['email'] : '',
138
+			'ATT_address' 		=> ! empty($data['address']) ? $data['address'] : '',
139
+			'ATT_address2' 	=> ! empty($data['address2']) ? $data['address2'] : '',
140
+			'ATT_city' 			=> ! empty($data['city']) ? $data['city'] : '',
141
+			'STA_ID' 				=> ! empty($data['state']) ? $data['state'] : '',
142
+			'CNT_ISO' 			=> ! empty($data['country']) ? $data['country'] : '',
143
+			'ATT_zip' 				=> ! empty($data['zip']) ? $data['zip'] : '',
144
+			'ATT_phone' 		=> ! empty($data['phone']) ? $data['phone'] : '',
145 145
 		));
146 146
 	}
147 147
 }
Please login to merge, or discard this patch.