Completed
Branch FET-9222-rest-api-writes (64ff44)
by
unknown
95:49 queued 82:41
created
core/db_classes/EE_Registration.class.php 4 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -649,8 +649,9 @@
 block discarded – undo
649 649
 	 * @return EE_Registration
650 650
 	 */
651 651
 	public function get_primary_registration()  {
652
-		if ( $this->is_primary_registrant() )
653
-			return $this;
652
+		if ( $this->is_primary_registrant() ) {
653
+					return $this;
654
+		}
654 655
 
655 656
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
656 657
 		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -921,7 +921,7 @@  discard block
 block discarded – undo
921 921
 	/**
922 922
 	 * Sets deleted
923 923
 	 * @param boolean $deleted
924
-	 * @return boolean
924
+	 * @return boolean|null
925 925
 	 */
926 926
 	public function set_deleted($deleted) {
927 927
 	    if ( $deleted ) {
@@ -969,6 +969,7 @@  discard block
 block discarded – undo
969 969
 	 *
970 970
 	 * @param int | EE_Datetime $DTT_OR_ID The datetime the registration is being checked against
971 971
 	 * @param bool   $check_approved   This is used to indicate whether the caller wants can_checkin to also consider registration status as well as datetime access.
972
+	 * @param integer $DTT_OR_ID
972 973
 	 *
973 974
 	 * @return bool
974 975
 	 */
@@ -1107,7 +1108,7 @@  discard block
 block discarded – undo
1107 1108
      * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1108 1109
      * "Latest" is defined by the `DTT_EVT_start` column.
1109 1110
      *
1110
-     * @return EE_Datetime|null
1111
+     * @return null|EE_Base_Class
1111 1112
      * @throws \EE_Error
1112 1113
      */
1113 1114
 	public function get_latest_related_datetime() {
@@ -1378,7 +1379,7 @@  discard block
 block discarded – undo
1378 1379
 	 * This grabs the payment method corresponding to the last payment made for the amount owing on the registration.
1379 1380
 	 * Note: if there are no payments on the registration there will be no payment method returned.
1380 1381
 	 *
1381
-	 * @return EE_Payment_Method|null
1382
+	 * @return null|EE_Base_Class
1382 1383
 	 */
1383 1384
 	public function payment_method() {
1384 1385
 		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
Please login to merge, or discard this patch.
Indentation   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
 	/**
37 37
 	 * extra meta key for tracking reg status os trashed registrations
38
-     *
38
+	 *
39 39
 	 * @type string
40 40
 	 */
41 41
 	const PRE_TRASH_REG_STATUS_KEY = 'pre_trash_registration_status';
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 
44 44
 	/**
45 45
 	 * extra meta key for tracking if registration has reserved ticket
46
-     *
46
+	 *
47 47
 	 * @type string
48 48
 	 */
49 49
 	const HAS_RESERVED_TICKET_KEY = 'has_reserved_ticket';
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 
90 90
 
91 91
 
92
-    /**
93
-     * Overrides parent set() method so that all calls to set( 'REG_code', $REG_code ) OR set( 'STS_ID', $STS_ID ) can be routed to internal methods
94
-     *
95
-     * @param string $field_name
96
-     * @param mixed  $field_value
97
-     * @param bool   $use_default
98
-     * @throws \EE_Error
99
-     * @throws \RuntimeException
100
-     */
92
+	/**
93
+	 * Overrides parent set() method so that all calls to set( 'REG_code', $REG_code ) OR set( 'STS_ID', $STS_ID ) can be routed to internal methods
94
+	 *
95
+	 * @param string $field_name
96
+	 * @param mixed  $field_value
97
+	 * @param bool   $use_default
98
+	 * @throws \EE_Error
99
+	 * @throws \RuntimeException
100
+	 */
101 101
 	public function set( $field_name, $field_value, $use_default = FALSE ) {
102 102
 		switch( $field_name ) {
103 103
 			case 'REG_code' :
@@ -115,18 +115,18 @@  discard block
 block discarded – undo
115 115
 
116 116
 
117 117
 
118
-    /**
119
-     * Set Status ID
120
-     * updates the registration status and ALSO...
121
-     * calls reserve_registration_space() if the reg status changes TO approved from any other reg status
122
-     * calls release_registration_space() if the reg status changes FROM approved to any other reg status
123
-     *
124
-     * @param string  $new_STS_ID
125
-     * @param boolean $use_default
126
-     * @return bool
127
-     * @throws \RuntimeException
128
-     * @throws \EE_Error
129
-     */
118
+	/**
119
+	 * Set Status ID
120
+	 * updates the registration status and ALSO...
121
+	 * calls reserve_registration_space() if the reg status changes TO approved from any other reg status
122
+	 * calls release_registration_space() if the reg status changes FROM approved to any other reg status
123
+	 *
124
+	 * @param string  $new_STS_ID
125
+	 * @param boolean $use_default
126
+	 * @return bool
127
+	 * @throws \RuntimeException
128
+	 * @throws \EE_Error
129
+	 */
130 130
 	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
131 131
 		// get current REG_Status
132 132
 		$old_STS_ID = $this->status_ID();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 			&& ! empty( $new_STS_ID ) // as well as the new status
138 138
 			&& $this->ID() // ensure registration is in the db
139 139
 		) {
140
-            // TO approved
140
+			// TO approved
141 141
 			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
142 142
 				// reserve a space by incrementing ticket and datetime sold values
143 143
 				$this->_reserve_registration_space();
@@ -148,12 +148,12 @@  discard block
 block discarded – undo
148 148
 				$this->_release_registration_space();
149 149
 				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
150 150
 			}
151
-            // update status
152
-            parent::set('STS_ID', $new_STS_ID, $use_default);
153
-            $this->_update_if_canceled_or_declined($new_STS_ID, $old_STS_ID);
154
-            /** @type EE_Transaction_Payments $transaction_payments */
155
-            $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
156
-            $transaction_payments->recalculate_transaction_total( $this->transaction(), false );
151
+			// update status
152
+			parent::set('STS_ID', $new_STS_ID, $use_default);
153
+			$this->_update_if_canceled_or_declined($new_STS_ID, $old_STS_ID);
154
+			/** @type EE_Transaction_Payments $transaction_payments */
155
+			$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
156
+			$transaction_payments->recalculate_transaction_total( $this->transaction(), false );
157 157
 			$this->transaction()->update_status_based_on_total_paid( true );
158 158
 			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
159 159
 			return TRUE;
@@ -167,60 +167,60 @@  discard block
 block discarded – undo
167 167
 
168 168
 
169 169
 
170
-    /**
171
-     * update REGs and TXN when cancelled or declined registrations involved
172
-     *
173
-     * @param string $new_STS_ID
174
-     * @param string $old_STS_ID
175
-     * @throws \EE_Error
176
-     */
177
-    private function _update_if_canceled_or_declined($new_STS_ID, $old_STS_ID)
178
-    {
179
-        // these reg statuses should not be considered in any calculations involving monies owing
180
-        $closed_reg_statuses = EEM_Registration::closed_reg_statuses();
181
-        // true if registration has been cancelled or declined
182
-        if (
183
-            in_array($new_STS_ID, $closed_reg_statuses, true)
184
-            && ! in_array($old_STS_ID, $closed_reg_statuses, true)
185
-        ) {
186
-            /** @type EE_Registration_Processor $registration_processor */
187
-            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
188
-            /** @type EE_Transaction_Processor $transaction_processor */
189
-            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
190
-            // cancelled or declined registration
191
-            $registration_processor->update_registration_after_being_canceled_or_declined(
192
-                $this,
193
-                $closed_reg_statuses
194
-            );
195
-            $transaction_processor->update_transaction_after_canceled_or_declined_registration(
196
-                $this,
197
-                $closed_reg_statuses,
198
-                false
199
-            );
200
-            do_action('AHEE__EE_Registration__set_status__canceled_or_declined', $this, $old_STS_ID, $new_STS_ID);
201
-            return;
202
-        }
203
-        // true if reinstating cancelled or declined registration
204
-        if (
205
-            in_array($old_STS_ID, $closed_reg_statuses, true)
206
-            && ! in_array($new_STS_ID, $closed_reg_statuses, true)
207
-        ) {
208
-            /** @type EE_Registration_Processor $registration_processor */
209
-            $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
210
-            /** @type EE_Transaction_Processor $transaction_processor */
211
-            $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
212
-            // reinstating cancelled or declined registration
213
-            $registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
214
-                $this,
215
-                $closed_reg_statuses
216
-            );
217
-            $transaction_processor->update_transaction_after_reinstating_canceled_registration(
218
-                $this,
219
-                $closed_reg_statuses,
220
-                false
221
-            );
222
-            do_action('AHEE__EE_Registration__set_status__after_reinstated', $this, $old_STS_ID, $new_STS_ID);
223
-        }
170
+	/**
171
+	 * update REGs and TXN when cancelled or declined registrations involved
172
+	 *
173
+	 * @param string $new_STS_ID
174
+	 * @param string $old_STS_ID
175
+	 * @throws \EE_Error
176
+	 */
177
+	private function _update_if_canceled_or_declined($new_STS_ID, $old_STS_ID)
178
+	{
179
+		// these reg statuses should not be considered in any calculations involving monies owing
180
+		$closed_reg_statuses = EEM_Registration::closed_reg_statuses();
181
+		// true if registration has been cancelled or declined
182
+		if (
183
+			in_array($new_STS_ID, $closed_reg_statuses, true)
184
+			&& ! in_array($old_STS_ID, $closed_reg_statuses, true)
185
+		) {
186
+			/** @type EE_Registration_Processor $registration_processor */
187
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
188
+			/** @type EE_Transaction_Processor $transaction_processor */
189
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
190
+			// cancelled or declined registration
191
+			$registration_processor->update_registration_after_being_canceled_or_declined(
192
+				$this,
193
+				$closed_reg_statuses
194
+			);
195
+			$transaction_processor->update_transaction_after_canceled_or_declined_registration(
196
+				$this,
197
+				$closed_reg_statuses,
198
+				false
199
+			);
200
+			do_action('AHEE__EE_Registration__set_status__canceled_or_declined', $this, $old_STS_ID, $new_STS_ID);
201
+			return;
202
+		}
203
+		// true if reinstating cancelled or declined registration
204
+		if (
205
+			in_array($old_STS_ID, $closed_reg_statuses, true)
206
+			&& ! in_array($new_STS_ID, $closed_reg_statuses, true)
207
+		) {
208
+			/** @type EE_Registration_Processor $registration_processor */
209
+			$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
210
+			/** @type EE_Transaction_Processor $transaction_processor */
211
+			$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
212
+			// reinstating cancelled or declined registration
213
+			$registration_processor->update_canceled_or_declined_registration_after_being_reinstated(
214
+				$this,
215
+				$closed_reg_statuses
216
+			);
217
+			$transaction_processor->update_transaction_after_reinstating_canceled_registration(
218
+				$this,
219
+				$closed_reg_statuses,
220
+				false
221
+			);
222
+			do_action('AHEE__EE_Registration__set_status__after_reinstated', $this, $old_STS_ID, $new_STS_ID);
223
+		}
224 224
 	}
225 225
 
226 226
 
@@ -233,16 +233,16 @@  discard block
 block discarded – undo
233 233
 
234 234
 
235 235
 
236
-    /**
237
-     * increments this registration's related ticket sold and corresponding datetime sold values
238
-     *
239
-     * @return void
240
-     * @throws \EE_Error
241
-     */
236
+	/**
237
+	 * increments this registration's related ticket sold and corresponding datetime sold values
238
+	 *
239
+	 * @return void
240
+	 * @throws \EE_Error
241
+	 */
242 242
 	private function _reserve_registration_space() {
243
-	    // reserved ticket and datetime counts will be decremented as sold counts are incremented
244
-        // so stop tracking that this reg has a ticket reserved
245
-	    $this->release_reserved_ticket();
243
+		// reserved ticket and datetime counts will be decremented as sold counts are incremented
244
+		// so stop tracking that this reg has a ticket reserved
245
+		$this->release_reserved_ticket();
246 246
 		$ticket = $this->ticket();
247 247
 		$ticket->increase_sold();
248 248
 		$ticket->save();
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
 
253 253
 
254 254
 
255
-    /**
256
-     * Gets the ticket this registration is for
257
-     *
258
-     * @param boolean $include_archived whether to include archived tickets or not.
259
-     * @return EE_Ticket|EE_Base_Class
260
-     * @throws \EE_Error
261
-     */
255
+	/**
256
+	 * Gets the ticket this registration is for
257
+	 *
258
+	 * @param boolean $include_archived whether to include archived tickets or not.
259
+	 * @return EE_Ticket|EE_Base_Class
260
+	 * @throws \EE_Error
261
+	 */
262 262
 	public function ticket( $include_archived = TRUE ) {
263 263
 		$query_params = array();
264 264
 		if ( $include_archived ) {
@@ -300,12 +300,12 @@  discard block
 block discarded – undo
300 300
 
301 301
 
302 302
 
303
-    /**
304
-     * decrements (subtracts) this registration's related ticket sold and corresponding datetime sold values
305
-     *
306
-     * @return void
307
-     * @throws \EE_Error
308
-     */
303
+	/**
304
+	 * decrements (subtracts) this registration's related ticket sold and corresponding datetime sold values
305
+	 *
306
+	 * @return void
307
+	 * @throws \EE_Error
308
+	 */
309 309
 	private function _release_registration_space() {
310 310
 		$ticket = $this->ticket();
311 311
 		$ticket->decrease_sold();
@@ -314,46 +314,46 @@  discard block
 block discarded – undo
314 314
 
315 315
 
316 316
 
317
-    /**
318
-     * tracks this registration's ticket reservation in extra meta
319
-     * and can increment related ticket reserved and corresponding datetime reserved values
320
-     *
321
-     * @param bool $update_ticket if true, will increment ticket and datetime reserved count
322
-     * @return void
323
-     * @throws \EE_Error
324
-     */
317
+	/**
318
+	 * tracks this registration's ticket reservation in extra meta
319
+	 * and can increment related ticket reserved and corresponding datetime reserved values
320
+	 *
321
+	 * @param bool $update_ticket if true, will increment ticket and datetime reserved count
322
+	 * @return void
323
+	 * @throws \EE_Error
324
+	 */
325 325
 	public function reserve_ticket($update_ticket = false) {
326
-        if ($this->get_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) === false) {
327
-            // PLZ NOTE: although checking $update_ticket first would be more efficient,
328
-            // we NEED to ALWAYS call update_extra_meta(), which is why that is done first
329
-            if ($this->update_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) && $update_ticket) {
330
-                $ticket = $this->ticket();
331
-                $ticket->increase_reserved();
332
-                $ticket->save();
333
-            }
334
-        }
326
+		if ($this->get_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) === false) {
327
+			// PLZ NOTE: although checking $update_ticket first would be more efficient,
328
+			// we NEED to ALWAYS call update_extra_meta(), which is why that is done first
329
+			if ($this->update_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) && $update_ticket) {
330
+				$ticket = $this->ticket();
331
+				$ticket->increase_reserved();
332
+				$ticket->save();
333
+			}
334
+		}
335 335
 	}
336 336
 
337 337
 
338 338
 
339
-    /**
340
-     * stops tracking this registration's ticket reservation in extra meta
341
-     * decrements (subtracts) related ticket reserved and corresponding datetime reserved values
342
-     *
343
-     * @param bool $update_ticket if true, will decrement ticket and datetime reserved count
344
-     * @return void
345
-     * @throws \EE_Error
346
-     */
347
-    public function release_reserved_ticket($update_ticket = false) {
348
-        if ($this->get_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) !== false) {
349
-            // PLZ NOTE: although checking $update_ticket first would be more efficient,
350
-            // we NEED to ALWAYS call delete_extra_meta(), which is why that is done first
351
-            if ($this->delete_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY) && $update_ticket) {
352
-                $ticket = $this->ticket();
353
-                $ticket->decrease_reserved();
354
-                $ticket->save();
355
-            }
356
-        }
339
+	/**
340
+	 * stops tracking this registration's ticket reservation in extra meta
341
+	 * decrements (subtracts) related ticket reserved and corresponding datetime reserved values
342
+	 *
343
+	 * @param bool $update_ticket if true, will decrement ticket and datetime reserved count
344
+	 * @return void
345
+	 * @throws \EE_Error
346
+	 */
347
+	public function release_reserved_ticket($update_ticket = false) {
348
+		if ($this->get_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY, true, false) !== false) {
349
+			// PLZ NOTE: although checking $update_ticket first would be more efficient,
350
+			// we NEED to ALWAYS call delete_extra_meta(), which is why that is done first
351
+			if ($this->delete_extra_meta(EE_Registration::HAS_RESERVED_TICKET_KEY) && $update_ticket) {
352
+				$ticket = $this->ticket();
353
+				$ticket->decrease_reserved();
354
+				$ticket->save();
355
+			}
356
+		}
357 357
 	}
358 358
 
359 359
 
@@ -742,9 +742,9 @@  discard block
 block discarded – undo
742 742
 
743 743
 
744 744
 	/**
745
-	*		get  Attendee Number
746
-	* 		@access		public
747
-	*/
745
+	 *		get  Attendee Number
746
+	 * 		@access		public
747
+	 */
748 748
 	public function count() {
749 749
 		return $this->get( 'REG_count' );
750 750
 	}
@@ -1021,11 +1021,11 @@  discard block
 block discarded – undo
1021 1021
 	 * @return boolean
1022 1022
 	 */
1023 1023
 	public function set_deleted($deleted) {
1024
-	    if ( $deleted ) {
1025
-	        $this->delete();
1026
-        } else {
1027
-	        $this->restore();
1028
-        }
1024
+		if ( $deleted ) {
1025
+			$this->delete();
1026
+		} else {
1027
+			$this->restore();
1028
+		}
1029 1029
 	}
1030 1030
 
1031 1031
 
@@ -1130,20 +1130,20 @@  discard block
 block discarded – undo
1130 1130
 
1131 1131
 
1132 1132
 
1133
-    /**
1134
-     * toggle Check-in status for this registration
1135
-     * Check-ins are toggled in the following order:
1136
-     * never checked in -> checked in
1137
-     * checked in -> checked out
1138
-     * checked out -> checked in
1139
-     *
1140
-     * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1141
-     *                      If not included or null, then it is assumed latest datetime is being toggled.
1142
-     * @param bool $verify  If true then can_checkin() is used to verify whether the person
1143
-     *                      can be checked in or not.  Otherwise this forces change in checkin status.
1144
-     * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1145
-     * @throws EE_Error
1146
-     */
1133
+	/**
1134
+	 * toggle Check-in status for this registration
1135
+	 * Check-ins are toggled in the following order:
1136
+	 * never checked in -> checked in
1137
+	 * checked in -> checked out
1138
+	 * checked out -> checked in
1139
+	 *
1140
+	 * @param  int $DTT_ID  include specific datetime to toggle Check-in for.
1141
+	 *                      If not included or null, then it is assumed latest datetime is being toggled.
1142
+	 * @param bool $verify  If true then can_checkin() is used to verify whether the person
1143
+	 *                      can be checked in or not.  Otherwise this forces change in checkin status.
1144
+	 * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1145
+	 * @throws EE_Error
1146
+	 */
1147 1147
 	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1148 1148
 		if ( empty( $DTT_ID ) ) {
1149 1149
 			$datetime = $this->get_latest_related_datetime();
@@ -1200,13 +1200,13 @@  discard block
 block discarded – undo
1200 1200
 
1201 1201
 
1202 1202
 
1203
-    /**
1204
-     * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1205
-     * "Latest" is defined by the `DTT_EVT_start` column.
1206
-     *
1207
-     * @return EE_Datetime|null
1208
-     * @throws \EE_Error
1209
-     */
1203
+	/**
1204
+	 * Returns the latest datetime related to this registration (via the ticket attached to the registration).
1205
+	 * "Latest" is defined by the `DTT_EVT_start` column.
1206
+	 *
1207
+	 * @return EE_Datetime|null
1208
+	 * @throws \EE_Error
1209
+	 */
1210 1210
 	public function get_latest_related_datetime() {
1211 1211
 		return EEM_Datetime::instance()->get_one(
1212 1212
 			array(
@@ -1220,12 +1220,12 @@  discard block
 block discarded – undo
1220 1220
 
1221 1221
 
1222 1222
 
1223
-    /**
1224
-     * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1225
-     * "Earliest" is defined by the `DTT_EVT_start` column.
1226
-     *
1227
-     * @throws \EE_Error
1228
-     */
1223
+	/**
1224
+	 * Returns the earliest datetime related to this registration (via the ticket attached to the registration).
1225
+	 * "Earliest" is defined by the `DTT_EVT_start` column.
1226
+	 *
1227
+	 * @throws \EE_Error
1228
+	 */
1229 1229
 	public function get_earliest_related_datetime() {
1230 1230
 		return EEM_Datetime::instance()->get_one(
1231 1231
 			array(
@@ -1239,18 +1239,18 @@  discard block
 block discarded – undo
1239 1239
 
1240 1240
 
1241 1241
 
1242
-    /**
1243
-     * This method simply returns the check-in status for this registration and the given datetime.
1244
-     * If neither the datetime nor the checkin values are provided as arguments,
1245
-     * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1246
-     *
1247
-     * @param  int $DTT_ID        The ID of the datetime we're checking against
1248
-     *                            (if empty we'll get the primary datetime for
1249
-     *                            this registration (via event) and use it's ID);
1250
-     * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1251
-     * @return int                Integer representing Check-in status.
1252
-     * @throws \EE_Error
1253
-     */
1242
+	/**
1243
+	 * This method simply returns the check-in status for this registration and the given datetime.
1244
+	 * If neither the datetime nor the checkin values are provided as arguments,
1245
+	 * then this will return the LATEST check-in status for the registration across all datetimes it belongs to.
1246
+	 *
1247
+	 * @param  int $DTT_ID        The ID of the datetime we're checking against
1248
+	 *                            (if empty we'll get the primary datetime for
1249
+	 *                            this registration (via event) and use it's ID);
1250
+	 * @param EE_Checkin $checkin If present, we use the given checkin object rather than the dtt_id.
1251
+	 * @return int                Integer representing Check-in status.
1252
+	 * @throws \EE_Error
1253
+	 */
1254 1254
 	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1255 1255
 		$checkin_query_params = array(
1256 1256
 			'order_by' => array( 'CHK_timestamp' => 'DESC' )
@@ -1262,8 +1262,8 @@  discard block
 block discarded – undo
1262 1262
 
1263 1263
 		//get checkin object (if exists)
1264 1264
 		$checkin = $checkin instanceof EE_Checkin
1265
-            ? $checkin
1266
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1265
+			? $checkin
1266
+			: $this->get_first_related( 'Checkin', $checkin_query_params );
1267 1267
 		if ( $checkin instanceof EE_Checkin ) {
1268 1268
 			if ( $checkin->get( 'CHK_in' ) ) {
1269 1269
 				return EE_Registration::checkin_status_in; //checked in
@@ -1516,46 +1516,46 @@  discard block
 block discarded – undo
1516 1516
 
1517 1517
 
1518 1518
 
1519
-    /**
1520
-     * Soft Deletes this model object.
1521
-     *
1522
-     * @return boolean | int
1523
-     * @throws \RuntimeException
1524
-     * @throws \EE_Error
1525
-     */
1526
-    public function delete()
1527
-    {
1528
-        if($this->update_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY, $this->status_ID()) === true) {
1529
-            $this->set_status(EEM_Registration::status_id_cancelled);
1530
-        }
1531
-        return parent::delete();
1532
-    }
1519
+	/**
1520
+	 * Soft Deletes this model object.
1521
+	 *
1522
+	 * @return boolean | int
1523
+	 * @throws \RuntimeException
1524
+	 * @throws \EE_Error
1525
+	 */
1526
+	public function delete()
1527
+	{
1528
+		if($this->update_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY, $this->status_ID()) === true) {
1529
+			$this->set_status(EEM_Registration::status_id_cancelled);
1530
+		}
1531
+		return parent::delete();
1532
+	}
1533 1533
 
1534 1534
 
1535 1535
 
1536
-    /**
1537
-     * Restores whatever the previous status was on a registration before it was trashed (if possible)
1538
-     *
1539
-     * @throws \EE_Error
1540
-     * @throws \RuntimeException
1541
-     */
1542
-    public function restore()
1543
-    {
1544
-        $previous_status = $this->get_extra_meta(
1545
-            EE_Registration::PRE_TRASH_REG_STATUS_KEY,
1546
-            true,
1547
-            EEM_Registration::status_id_cancelled
1548
-        );
1549
-        if ($previous_status) {
1550
-            $this->delete_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY);
1551
-            $this->set_status($previous_status);
1552
-        }
1553
-        return parent::restore();
1554
-    }
1536
+	/**
1537
+	 * Restores whatever the previous status was on a registration before it was trashed (if possible)
1538
+	 *
1539
+	 * @throws \EE_Error
1540
+	 * @throws \RuntimeException
1541
+	 */
1542
+	public function restore()
1543
+	{
1544
+		$previous_status = $this->get_extra_meta(
1545
+			EE_Registration::PRE_TRASH_REG_STATUS_KEY,
1546
+			true,
1547
+			EEM_Registration::status_id_cancelled
1548
+		);
1549
+		if ($previous_status) {
1550
+			$this->delete_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY);
1551
+			$this->set_status($previous_status);
1552
+		}
1553
+		return parent::restore();
1554
+	}
1555 1555
 
1556 1556
 
1557 1557
 
1558
-    /*************************** DEPRECATED ***************************/
1558
+	/*************************** DEPRECATED ***************************/
1559 1559
 
1560 1560
 
1561 1561
 
@@ -1605,24 +1605,24 @@  discard block
 block discarded – undo
1605 1605
 
1606 1606
 
1607 1607
 
1608
-    /**
1609
-     * Gets the primary datetime related to this registration via the related Event to this registration
1610
-     *
1611
-     * @deprecated 4.9.17
1612
-     * @return EE_Datetime
1613
-     */
1614
-    public function get_related_primary_datetime() {
1615
-        EE_Error::doing_it_wrong(
1616
-            __METHOD__,
1617
-            esc_html__(
1618
-                'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1619
-                'event_espresso'
1620
-            ),
1621
-            '4.9.17',
1622
-            '5.0.0'
1623
-        );
1624
-        return $this->event()->primary_datetime();
1625
-    }
1608
+	/**
1609
+	 * Gets the primary datetime related to this registration via the related Event to this registration
1610
+	 *
1611
+	 * @deprecated 4.9.17
1612
+	 * @return EE_Datetime
1613
+	 */
1614
+	public function get_related_primary_datetime() {
1615
+		EE_Error::doing_it_wrong(
1616
+			__METHOD__,
1617
+			esc_html__(
1618
+				'Use EE_Registration::get_latest_related_datetime() or EE_Registration::get_earliest_related_datetime()',
1619
+				'event_espresso'
1620
+			),
1621
+			'4.9.17',
1622
+			'5.0.0'
1623
+		);
1624
+		return $this->event()->primary_datetime();
1625
+	}
1626 1626
 
1627 1627
 
1628 1628
 
Please login to merge, or discard this patch.
Spacing   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\exceptions\EntityNotFoundException;
2 2
 
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 /**
7 7
  * EE_Registration class
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 *                             		    date_format and the second value is the time format
60 60
 	 * @return EE_Registration
61 61
 	 */
62
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
63
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
64
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
62
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
63
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
64
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
65 65
 	}
66 66
 
67 67
 
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 	 *                          		the website will be used.
73 73
 	 * @return EE_Registration
74 74
 	 */
75
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
76
-		return new self( $props_n_values, TRUE, $timezone );
75
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
76
+		return new self($props_n_values, TRUE, $timezone);
77 77
 	}
78 78
 
79 79
 
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
 	 *
84 84
 	 * @param        int $EVT_ID Event ID
85 85
 	 */
86
-	public function set_event( $EVT_ID = 0 ) {
87
-		$this->set( 'EVT_ID', $EVT_ID );
86
+	public function set_event($EVT_ID = 0) {
87
+		$this->set('EVT_ID', $EVT_ID);
88 88
 	}
89 89
 
90 90
 
@@ -98,18 +98,18 @@  discard block
 block discarded – undo
98 98
      * @throws \EE_Error
99 99
      * @throws \RuntimeException
100 100
      */
101
-	public function set( $field_name, $field_value, $use_default = FALSE ) {
102
-		switch( $field_name ) {
101
+	public function set($field_name, $field_value, $use_default = FALSE) {
102
+		switch ($field_name) {
103 103
 			case 'REG_code' :
104
-				if ( ! empty( $field_value ) && $this->reg_code() === null ) {
105
-					$this->set_reg_code( $field_value, $use_default );
104
+				if ( ! empty($field_value) && $this->reg_code() === null) {
105
+					$this->set_reg_code($field_value, $use_default);
106 106
 				}
107 107
 				break;
108 108
 			case 'STS_ID' :
109
-				$this->set_status( $field_value, $use_default );
109
+				$this->set_status($field_value, $use_default);
110 110
 				break;
111 111
 			default :
112
-				parent::set( $field_name, $field_value, $use_default );
112
+				parent::set($field_name, $field_value, $use_default);
113 113
 		}
114 114
 	}
115 115
 
@@ -127,40 +127,40 @@  discard block
 block discarded – undo
127 127
      * @throws \RuntimeException
128 128
      * @throws \EE_Error
129 129
      */
130
-	public function set_status( $new_STS_ID = NULL, $use_default = FALSE ) {
130
+	public function set_status($new_STS_ID = NULL, $use_default = FALSE) {
131 131
 		// get current REG_Status
132 132
 		$old_STS_ID = $this->status_ID();
133 133
 		// if status has changed
134 134
 		if (
135 135
 			$old_STS_ID !== $new_STS_ID // and that status has actually changed
136
-			&& ! empty( $old_STS_ID ) // and that old status is actually set
137
-			&& ! empty( $new_STS_ID ) // as well as the new status
136
+			&& ! empty($old_STS_ID) // and that old status is actually set
137
+			&& ! empty($new_STS_ID) // as well as the new status
138 138
 			&& $this->ID() // ensure registration is in the db
139 139
 		) {
140 140
             // TO approved
141
-			if ( $new_STS_ID === EEM_Registration::status_id_approved ) {
141
+			if ($new_STS_ID === EEM_Registration::status_id_approved) {
142 142
 				// reserve a space by incrementing ticket and datetime sold values
143 143
 				$this->_reserve_registration_space();
144
-				do_action( 'AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID );
144
+				do_action('AHEE__EE_Registration__set_status__to_approved', $this, $old_STS_ID, $new_STS_ID);
145 145
 			// OR FROM  approved
146
-			} else if ( $old_STS_ID === EEM_Registration::status_id_approved ) {
146
+			} else if ($old_STS_ID === EEM_Registration::status_id_approved) {
147 147
 				// release a space by decrementing ticket and datetime sold values
148 148
 				$this->_release_registration_space();
149
-				do_action( 'AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID );
149
+				do_action('AHEE__EE_Registration__set_status__from_approved', $this, $old_STS_ID, $new_STS_ID);
150 150
 			}
151 151
             // update status
152 152
             parent::set('STS_ID', $new_STS_ID, $use_default);
153 153
             $this->_update_if_canceled_or_declined($new_STS_ID, $old_STS_ID);
154 154
             /** @type EE_Transaction_Payments $transaction_payments */
155 155
             $transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
156
-            $transaction_payments->recalculate_transaction_total( $this->transaction(), false );
157
-			$this->transaction()->update_status_based_on_total_paid( true );
158
-			do_action( 'AHEE__EE_Registration__set_status__after_update', $this );
156
+            $transaction_payments->recalculate_transaction_total($this->transaction(), false);
157
+			$this->transaction()->update_status_based_on_total_paid(true);
158
+			do_action('AHEE__EE_Registration__set_status__after_update', $this);
159 159
 			return TRUE;
160 160
 		} else {
161 161
 			//even though the old value matches the new value, it's still good to
162 162
 			//allow the parent set method to have a say
163
-			parent::set( 'STS_ID', $new_STS_ID, $use_default );
163
+			parent::set('STS_ID', $new_STS_ID, $use_default);
164 164
 			return TRUE;
165 165
 		}
166 166
 	}
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 	 *        get Status ID
229 229
 	 */
230 230
 	public function status_ID() {
231
-		return $this->get( 'STS_ID' );
231
+		return $this->get('STS_ID');
232 232
 	}
233 233
 
234 234
 
@@ -259,12 +259,12 @@  discard block
 block discarded – undo
259 259
      * @return EE_Ticket|EE_Base_Class
260 260
      * @throws \EE_Error
261 261
      */
262
-	public function ticket( $include_archived = TRUE ) {
262
+	public function ticket($include_archived = TRUE) {
263 263
 		$query_params = array();
264
-		if ( $include_archived ) {
265
-			$query_params[ 'default_where_conditions' ] = 'none';
264
+		if ($include_archived) {
265
+			$query_params['default_where_conditions'] = 'none';
266 266
 		}
267
-		return $this->get_first_related( 'Ticket', $query_params );
267
+		return $this->get_first_related('Ticket', $query_params);
268 268
 	}
269 269
 
270 270
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 */
293 293
 	public function wp_user() {
294 294
 		$event = $this->event();
295
-		if ( $event instanceof EE_Event ) {
295
+		if ($event instanceof EE_Event) {
296 296
 			return $event->wp_user();
297 297
 		}
298 298
 		return 0;
@@ -363,8 +363,8 @@  discard block
 block discarded – undo
363 363
 	 *
364 364
 	 * @param        int $ATT_ID Attendee ID
365 365
 	 */
366
-	public function set_attendee_id( $ATT_ID = 0 ) {
367
-		$this->set( 'ATT_ID', $ATT_ID );
366
+	public function set_attendee_id($ATT_ID = 0) {
367
+		$this->set('ATT_ID', $ATT_ID);
368 368
 	}
369 369
 
370 370
 
@@ -374,8 +374,8 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @param        int $TXN_ID Transaction ID
376 376
 	 */
377
-	public function set_transaction_id( $TXN_ID = 0 ) {
378
-		$this->set( 'TXN_ID', $TXN_ID );
377
+	public function set_transaction_id($TXN_ID = 0) {
378
+		$this->set('TXN_ID', $TXN_ID);
379 379
 	}
380 380
 
381 381
 
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 	 *
386 386
 	 * @param    string $REG_session PHP Session ID
387 387
 	 */
388
-	public function set_session( $REG_session = '' ) {
389
-		$this->set( 'REG_session', $REG_session );
388
+	public function set_session($REG_session = '') {
389
+		$this->set('REG_session', $REG_session);
390 390
 	}
391 391
 
392 392
 
@@ -396,8 +396,8 @@  discard block
 block discarded – undo
396 396
 	 *
397 397
 	 * @param    string $REG_url_link Registration URL Link
398 398
 	 */
399
-	public function set_reg_url_link( $REG_url_link = '' ) {
400
-		$this->set( 'REG_url_link', $REG_url_link );
399
+	public function set_reg_url_link($REG_url_link = '') {
400
+		$this->set('REG_url_link', $REG_url_link);
401 401
 	}
402 402
 
403 403
 
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 	 *
408 408
 	 * @param        int $REG_count Primary Attendee
409 409
 	 */
410
-	public function set_count( $REG_count = 1 ) {
411
-		$this->set( 'REG_count', $REG_count );
410
+	public function set_count($REG_count = 1) {
411
+		$this->set('REG_count', $REG_count);
412 412
 	}
413 413
 
414 414
 
@@ -418,8 +418,8 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param        boolean $REG_group_size Group Registration
420 420
 	 */
421
-	public function set_group_size( $REG_group_size = FALSE ) {
422
-		$this->set( 'REG_group_size', $REG_group_size );
421
+	public function set_group_size($REG_group_size = FALSE) {
422
+		$this->set('REG_group_size', $REG_group_size);
423 423
 	}
424 424
 
425 425
 
@@ -495,8 +495,8 @@  discard block
 block discarded – undo
495 495
 	 *
496 496
 	 * @param        mixed ( int or string ) $REG_date Registration Date - Unix timestamp or string representation of Date
497 497
 	 */
498
-	public function set_reg_date( $REG_date = FALSE ) {
499
-		$this->set( 'REG_date', $REG_date );
498
+	public function set_reg_date($REG_date = FALSE) {
499
+		$this->set('REG_date', $REG_date);
500 500
 	}
501 501
 
502 502
 
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
 	 * @access    public
508 508
 	 * @param    float $REG_final_price
509 509
 	 */
510
-	public function set_final_price( $REG_final_price = 0.00 ) {
511
-		$this->set( 'REG_final_price', $REG_final_price );
510
+	public function set_final_price($REG_final_price = 0.00) {
511
+		$this->set('REG_final_price', $REG_final_price);
512 512
 	}
513 513
 
514 514
 
@@ -519,8 +519,8 @@  discard block
 block discarded – undo
519 519
 	 * @access    public
520 520
 	 * @param    float $REG_paid
521 521
 	 */
522
-	public function set_paid( $REG_paid = 0.00 ) {
523
-		$this->set( 'REG_paid', $REG_paid );
522
+	public function set_paid($REG_paid = 0.00) {
523
+		$this->set('REG_paid', $REG_paid);
524 524
 	}
525 525
 
526 526
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 	 *
531 531
 	 * @param        boolean $REG_att_is_going Attendee Is Going
532 532
 	 */
533
-	public function set_att_is_going( $REG_att_is_going = FALSE ) {
534
-		$this->set( 'REG_att_is_going', $REG_att_is_going );
533
+	public function set_att_is_going($REG_att_is_going = FALSE) {
534
+		$this->set('REG_att_is_going', $REG_att_is_going);
535 535
 	}
536 536
 
537 537
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 	 * @return EE_Attendee
542 542
 	 */
543 543
 	public function attendee() {
544
-		return $this->get_first_related( 'Attendee' );
544
+		return $this->get_first_related('Attendee');
545 545
 	}
546 546
 
547 547
 
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	 *        get Event ID
551 551
 	 */
552 552
 	public function event_ID() {
553
-		return $this->get( 'EVT_ID' );
553
+		return $this->get('EVT_ID');
554 554
 	}
555 555
 
556 556
 
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	 */
561 561
 	public function event_name() {
562 562
 		$event = $this->event_obj();
563
-		if ( $event ) {
563
+		if ($event) {
564 564
 			return $event->name();
565 565
 		} else {
566 566
 			return NULL;
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
 	 * @return EE_Event
575 575
 	 */
576 576
 	public function event_obj() {
577
-		return $this->get_first_related( 'Event' );
577
+		return $this->get_first_related('Event');
578 578
 	}
579 579
 
580 580
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 	 *        get Attendee ID
584 584
 	 */
585 585
 	public function attendee_ID() {
586
-		return $this->get( 'ATT_ID' );
586
+		return $this->get('ATT_ID');
587 587
 	}
588 588
 
589 589
 
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
 	 *        get PHP Session ID
593 593
 	 */
594 594
 	public function session_ID() {
595
-		return $this->get( 'REG_session' );
595
+		return $this->get('REG_session');
596 596
 	}
597 597
 
598 598
 
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
603 603
 	 * @return string
604 604
 	 */
605
-	public function receipt_url( $messenger = 'html' ) {
605
+	public function receipt_url($messenger = 'html') {
606 606
 
607 607
 		/**
608 608
 		 * The below will be deprecated one version after this.  We check first if there is a custom receipt template already in use on old system.  If there is then we just return the standard url for it.
@@ -610,12 +610,12 @@  discard block
 block discarded – undo
610 610
 		 * @since 4.5.0
611 611
 		 */
612 612
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/receipt_body.template.php';
613
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
613
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
614 614
 
615
-		if ( $has_custom ) {
616
-			return add_query_arg( array( 'receipt' => 'true' ), $this->invoice_url( 'launch' ) );
615
+		if ($has_custom) {
616
+			return add_query_arg(array('receipt' => 'true'), $this->invoice_url('launch'));
617 617
 		}
618
-		return apply_filters( 'FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt' );
618
+		return apply_filters('FHEE__EE_Registration__receipt_url__receipt_url', '', $this, $messenger, 'receipt');
619 619
 	}
620 620
 
621 621
 
@@ -626,28 +626,28 @@  discard block
 block discarded – undo
626 626
 	 * @param string $messenger 'pdf' or 'html'.  Default 'html'.
627 627
 	 * @return string
628 628
 	 */
629
-	public function invoice_url( $messenger = 'html' ) {
629
+	public function invoice_url($messenger = 'html') {
630 630
 		/**
631 631
 		 * The below will be deprecated one version after this.  We check first if there is a custom invoice template already in use on old system.  If there is then we just return the standard url for it.
632 632
 		 *
633 633
 		 * @since 4.5.0
634 634
 		 */
635 635
 		$template_relative_path = 'modules/gateways/Invoice/lib/templates/invoice_body.template.php';
636
-		$has_custom = EEH_Template::locate_template( $template_relative_path , array(), TRUE, TRUE, TRUE );
636
+		$has_custom = EEH_Template::locate_template($template_relative_path, array(), TRUE, TRUE, TRUE);
637 637
 
638
-		if ( $has_custom ) {
639
-			if ( $messenger == 'html' ) {
640
-				return $this->invoice_url( 'launch' );
638
+		if ($has_custom) {
639
+			if ($messenger == 'html') {
640
+				return $this->invoice_url('launch');
641 641
 			}
642 642
 			$route = $messenger == 'download' || $messenger == 'pdf' ? 'download_invoice' : 'launch_invoice';
643 643
 
644
-			$query_args = array( 'ee' => $route, 'id' => $this->reg_url_link() );
645
-			if ( $messenger == 'html' ) {
644
+			$query_args = array('ee' => $route, 'id' => $this->reg_url_link());
645
+			if ($messenger == 'html') {
646 646
 				$query_args['html'] = TRUE;
647 647
 			}
648
-			return add_query_arg( $query_args, get_permalink( EE_Registry::instance()->CFG->core->thank_you_page_id ) );
648
+			return add_query_arg($query_args, get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
649 649
 		}
650
-		return apply_filters( 'FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice' );
650
+		return apply_filters('FHEE__EE_Registration__invoice_url__invoice_url', '', $this, $messenger, 'invoice');
651 651
 	}
652 652
 
653 653
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * @throws \EE_Error
661 661
 	 */
662 662
 	public function reg_url_link() {
663
-		return (string)$this->get( 'REG_url_link' );
663
+		return (string) $this->get('REG_url_link');
664 664
 	}
665 665
 
666 666
 
@@ -670,8 +670,8 @@  discard block
 block discarded – undo
670 670
 	 * @param string $type 'download','launch', or 'html' (default is 'launch')
671 671
 	 * @return void
672 672
 	 */
673
-	public function e_invoice_url( $type = 'launch' ) {
674
-		echo $this->invoice_url( $type );
673
+	public function e_invoice_url($type = 'launch') {
674
+		echo $this->invoice_url($type);
675 675
 	}
676 676
 
677 677
 
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 	 * @return string
692 692
 	 */
693 693
 	public function payment_overview_url() {
694
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
694
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'payment_options', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
695 695
 	}
696 696
 
697 697
 
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
 	 * @return string
703 703
 	 */
704 704
 	public function edit_attendee_information_url() {
705
-		return add_query_arg( array( 'e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE ), EE_Registry::instance()->CFG->core->reg_page_url() );
705
+		return add_query_arg(array('e_reg_url_link' => $this->reg_url_link(), 'step' => 'attendee_information', 'revisit' => TRUE), EE_Registry::instance()->CFG->core->reg_page_url());
706 706
 	}
707 707
 
708 708
 
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	 * @return string
713 713
 	 */
714 714
 	public function get_admin_edit_url() {
715
-		return EEH_URL::add_query_args_and_nonce( array( 'page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID() ), admin_url( 'admin.php' ) );
715
+		return EEH_URL::add_query_args_and_nonce(array('page' => 'espresso_registrations', 'action' => 'view_registration', '_REG_ID' => $this->ID()), admin_url('admin.php'));
716 716
 	}
717 717
 
718 718
 
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 	 *    is_primary_registrant?
722 722
 	 */
723 723
 	public function is_primary_registrant() {
724
-		return $this->get( 'REG_count' ) == 1 ? TRUE : FALSE;
724
+		return $this->get('REG_count') == 1 ? TRUE : FALSE;
725 725
 	}
726 726
 
727 727
 
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
 	 * This returns the primary registration object for this registration group (which may be this object).
731 731
 	 * @return EE_Registration
732 732
 	 */
733
-	public function get_primary_registration()  {
734
-		if ( $this->is_primary_registrant() )
733
+	public function get_primary_registration() {
734
+		if ($this->is_primary_registrant())
735 735
 			return $this;
736 736
 
737 737
 		//k reg_count !== 1 so let's get the EE_Registration object matching this txn_id and reg_count == 1
738
-		$primary_registrant = EEM_Registration::instance()->get_one( array( array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1 ) ) );
738
+		$primary_registrant = EEM_Registration::instance()->get_one(array(array('TXN_ID' => $this->transaction_ID(), 'REG_count' => 1)));
739 739
 		return $primary_registrant;
740 740
 	}
741 741
 
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 	* 		@access		public
747 747
 	*/
748 748
 	public function count() {
749
-		return $this->get( 'REG_count' );
749
+		return $this->get('REG_count');
750 750
 	}
751 751
 
752 752
 
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 	 *        get Group Size
756 756
 	 */
757 757
 	public function group_size() {
758
-		return $this->get( 'REG_group_size' );
758
+		return $this->get('REG_group_size');
759 759
 	}
760 760
 
761 761
 
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 	 *        get Registration Date
765 765
 	 */
766 766
 	public function date() {
767
-		return $this->get( 'REG_date' );
767
+		return $this->get('REG_date');
768 768
 	}
769 769
 
770 770
 
@@ -775,8 +775,8 @@  discard block
 block discarded – undo
775 775
 	 * @param string $time_format
776 776
 	 * @return string
777 777
 	 */
778
-	public function pretty_date( $date_format = NULL, $time_format = NULL ) {
779
-		return $this->get_datetime( 'REG_date', $date_format, $time_format );
778
+	public function pretty_date($date_format = NULL, $time_format = NULL) {
779
+		return $this->get_datetime('REG_date', $date_format, $time_format);
780 780
 	}
781 781
 
782 782
 
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
 	 * @return    float
789 789
 	 */
790 790
 	public function final_price() {
791
-		return $this->get( 'REG_final_price' );
791
+		return $this->get('REG_final_price');
792 792
 	}
793 793
 
794 794
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	 * @return string
800 800
 	 */
801 801
 	public function pretty_final_price() {
802
-		return $this->get_pretty( 'REG_final_price' );
802
+		return $this->get_pretty('REG_final_price');
803 803
 	}
804 804
 
805 805
 
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 * @return 	float
810 810
 	 */
811 811
 	public function paid() {
812
-		return $this->get( 'REG_paid' );
812
+		return $this->get('REG_paid');
813 813
 	}
814 814
 
815 815
 
@@ -819,7 +819,7 @@  discard block
 block discarded – undo
819 819
 	 * @return 	float
820 820
 	 */
821 821
 	public function pretty_paid() {
822
-		return $this->get_pretty( 'REG_paid' );
822
+		return $this->get_pretty('REG_paid');
823 823
 	}
824 824
 
825 825
 
@@ -830,11 +830,11 @@  discard block
 block discarded – undo
830 830
 	 * @param array $requires_payment
831 831
 	 * @return bool
832 832
 	 */
833
-	public function owes_monies_and_can_pay( $requires_payment = array()) {
833
+	public function owes_monies_and_can_pay($requires_payment = array()) {
834 834
 		// these reg statuses require payment (if event is not free)
835
-		$requires_payment = ! empty( $requires_payment ) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
835
+		$requires_payment = ! empty($requires_payment) ? $requires_payment : EEM_Registration::reg_statuses_that_allow_payment();
836 836
 		if (
837
-			in_array( $this->status_ID(), $requires_payment ) &&
837
+			in_array($this->status_ID(), $requires_payment) &&
838 838
 			$this->final_price() != 0 &&
839 839
 			$this->final_price() != $this->paid()
840 840
 		) {
@@ -851,8 +851,8 @@  discard block
 block discarded – undo
851 851
 	 * @param bool $show_icons
852 852
 	 * @return void
853 853
 	 */
854
-	public function e_pretty_status( $show_icons = FALSE ) {
855
-		echo $this->pretty_status( $show_icons );
854
+	public function e_pretty_status($show_icons = FALSE) {
855
+		echo $this->pretty_status($show_icons);
856 856
 	}
857 857
 
858 858
 
@@ -863,10 +863,10 @@  discard block
 block discarded – undo
863 863
 	 * @param bool $show_icons
864 864
 	 * @return string
865 865
 	 */
866
-	public function pretty_status( $show_icons = FALSE ) {
867
-		$status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' );
866
+	public function pretty_status($show_icons = FALSE) {
867
+		$status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence');
868 868
 		$icon = '';
869
-		switch ( $this->status_ID() ) {
869
+		switch ($this->status_ID()) {
870 870
 			case EEM_Registration::status_id_approved:
871 871
 				$icon = $show_icons ? '<span class="dashicons dashicons-star-filled ee-icon-size-16 green-text"></span>' : '';
872 872
 				break;
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
 				$icon = $show_icons ? '<span class="dashicons dashicons-clipboard ee-icon-size-16 purple-text"></span>' : '';
890 890
 				break;
891 891
 		}
892
-		return $icon . $status[ $this->status_ID() ];
892
+		return $icon.$status[$this->status_ID()];
893 893
 	}
894 894
 
895 895
 
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
 	 *        get Attendee Is Going
899 899
 	 */
900 900
 	public function att_is_going() {
901
-		return $this->get( 'REG_att_is_going' );
901
+		return $this->get('REG_att_is_going');
902 902
 	}
903 903
 
904 904
 
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 	 * @param array $query_params like EEM_Base::get_all
909 909
 	 * @return EE_Answer[]
910 910
 	 */
911
-	public function answers( $query_params = NULL ) {
912
-		return $this->get_many_related( 'Answer', $query_params );
911
+	public function answers($query_params = NULL) {
912
+		return $this->get_many_related('Answer', $query_params);
913 913
 	}
914 914
 
915 915
 
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 	 * (because the answer might be an array of answer values, so passing pretty_value=true
924 924
 	 * will convert it into some kind of string)
925 925
 	 */
926
-	public function answer_value_to_question( $question, $pretty_value=true ) {
926
+	public function answer_value_to_question($question, $pretty_value = true) {
927 927
 		$question_id = EEM_Question::instance()->ensure_is_ID($question);
928
-		return EEM_Answer::instance()->get_answer_value_to_question($this,$question_id,$pretty_value);
928
+		return EEM_Answer::instance()->get_answer_value_to_question($this, $question_id, $pretty_value);
929 929
 	}
930 930
 
931 931
 
@@ -938,13 +938,13 @@  discard block
 block discarded – undo
938 938
 	 */
939 939
 	public function question_groups() {
940 940
 		$question_groups = array();
941
-		if ( $this->event() instanceof EE_Event ) {
941
+		if ($this->event() instanceof EE_Event) {
942 942
 			$question_groups = $this->event()->question_groups(
943 943
 				array(
944 944
 					array(
945 945
 						'Event_Question_Group.EQG_primary' => $this->count() == 1 ? true : false
946 946
 					),
947
-					'order_by' => array( 'QSG_order' => 'ASC' )
947
+					'order_by' => array('QSG_order' => 'ASC')
948 948
 				)
949 949
 			);
950 950
 		}
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 */
962 962
 	public function count_question_groups() {
963 963
 		$qg_count = 0;
964
-		if ( $this->event() instanceof EE_Event ) {
964
+		if ($this->event() instanceof EE_Event) {
965 965
 			$qg_count = $this->event()->count_related(
966 966
 				'Question_Group',
967 967
 				array(
@@ -982,7 +982,7 @@  discard block
 block discarded – undo
982 982
 	 * @return string
983 983
 	 */
984 984
 	public function reg_date() {
985
-		return $this->get_datetime( 'REG_date' );
985
+		return $this->get_datetime('REG_date');
986 986
 	}
987 987
 
988 988
 
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 	 * @return EE_Datetime_Ticket
995 995
 	 */
996 996
 	public function datetime_ticket() {
997
-		return $this->get_first_related( 'Datetime_Ticket' );
997
+		return $this->get_first_related('Datetime_Ticket');
998 998
 	}
999 999
 
1000 1000
 
@@ -1004,15 +1004,15 @@  discard block
 block discarded – undo
1004 1004
 	 * @param EE_Datetime_Ticket $datetime_ticket
1005 1005
 	 * @return EE_Datetime_Ticket
1006 1006
 	 */
1007
-	public function set_datetime_ticket( $datetime_ticket ) {
1008
-		return $this->_add_relation_to( $datetime_ticket, 'Datetime_Ticket' );
1007
+	public function set_datetime_ticket($datetime_ticket) {
1008
+		return $this->_add_relation_to($datetime_ticket, 'Datetime_Ticket');
1009 1009
 	}
1010 1010
 	/**
1011 1011
 	 * Gets deleted
1012 1012
 	 * @return boolean
1013 1013
 	 */
1014 1014
 	public function deleted() {
1015
-		return $this->get( 'REG_deleted' );
1015
+		return $this->get('REG_deleted');
1016 1016
 	}
1017 1017
 
1018 1018
 	/**
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 	 * @return boolean
1022 1022
 	 */
1023 1023
 	public function set_deleted($deleted) {
1024
-	    if ( $deleted ) {
1024
+	    if ($deleted) {
1025 1025
 	        $this->delete();
1026 1026
         } else {
1027 1027
 	        $this->restore();
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 	 * @return EE_Status
1036 1036
 	 */
1037 1037
 	public function status_obj() {
1038
-		return $this->get_first_related( 'Status' );
1038
+		return $this->get_first_related('Status');
1039 1039
 	}
1040 1040
 
1041 1041
 
@@ -1046,7 +1046,7 @@  discard block
 block discarded – undo
1046 1046
 	 * @return int
1047 1047
 	 */
1048 1048
 	public function count_checkins() {
1049
-		return $this->get_model()->count_related( $this, 'Checkin' );
1049
+		return $this->get_model()->count_related($this, 'Checkin');
1050 1050
 	}
1051 1051
 
1052 1052
 
@@ -1056,7 +1056,7 @@  discard block
 block discarded – undo
1056 1056
 	 * @return int
1057 1057
 	 */
1058 1058
 	public function count_checkins_not_checkedout() {
1059
-		return $this->get_model()->count_related( $this, 'Checkin', array( array( 'CHK_in' => 1 ) ) );
1059
+		return $this->get_model()->count_related($this, 'Checkin', array(array('CHK_in' => 1)));
1060 1060
 	}
1061 1061
 
1062 1062
 
@@ -1069,20 +1069,20 @@  discard block
 block discarded – undo
1069 1069
 	 *
1070 1070
 	 * @return bool
1071 1071
 	 */
1072
-	public function can_checkin( $DTT_OR_ID, $check_approved = TRUE ) {
1073
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1072
+	public function can_checkin($DTT_OR_ID, $check_approved = TRUE) {
1073
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1074 1074
 
1075 1075
 		//first check registration status
1076
-		if (  ( $check_approved && ! $this->is_approved() ) || ! $DTT_ID ) {
1076
+		if (($check_approved && ! $this->is_approved()) || ! $DTT_ID) {
1077 1077
 			return false;
1078 1078
 		}
1079 1079
 		//is there a datetime ticket that matches this dtt_ID?
1080
-		if ( ! ( EEM_Datetime_Ticket::instance()->exists( array( array( 'TKT_ID' => $this->get('TKT_ID' ), 'DTT_ID' => $DTT_ID ) ) ) ) ) {
1080
+		if ( ! (EEM_Datetime_Ticket::instance()->exists(array(array('TKT_ID' => $this->get('TKT_ID'), 'DTT_ID' => $DTT_ID))))) {
1081 1081
 			return false;
1082 1082
 		}
1083 1083
 
1084 1084
 		//final check is against TKT_uses
1085
-		return $this->verify_can_checkin_against_TKT_uses( $DTT_ID );
1085
+		return $this->verify_can_checkin_against_TKT_uses($DTT_ID);
1086 1086
 	}
1087 1087
 
1088 1088
 
@@ -1095,10 +1095,10 @@  discard block
 block discarded – undo
1095 1095
 	 * @param int | EE_Datetime  $DTT_OR_ID  The datetime the registration is being checked against
1096 1096
 	 * @return bool   true means can checkin.  false means cannot checkin.
1097 1097
 	 */
1098
-	public function verify_can_checkin_against_TKT_uses( $DTT_OR_ID ) {
1099
-		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID( $DTT_OR_ID );
1098
+	public function verify_can_checkin_against_TKT_uses($DTT_OR_ID) {
1099
+		$DTT_ID = EEM_Datetime::instance()->ensure_is_ID($DTT_OR_ID);
1100 1100
 
1101
-		if ( ! $DTT_ID ) {
1101
+		if ( ! $DTT_ID) {
1102 1102
 			return false;
1103 1103
 		}
1104 1104
 
@@ -1106,23 +1106,23 @@  discard block
 block discarded – undo
1106 1106
 
1107 1107
 		// if max uses is not set or equals infinity then return true cause its not a factor for whether user can check-in
1108 1108
 		// or not.
1109
-		if ( ! $max_uses || $max_uses === EE_INF ) {
1109
+		if ( ! $max_uses || $max_uses === EE_INF) {
1110 1110
 			return true;
1111 1111
 		}
1112 1112
 
1113 1113
 		//does this datetime have a checkin record?  If so, then the dtt count has already been verified so we can just
1114 1114
 		//go ahead and toggle.
1115
-		if ( EEM_Checkin::instance()->exists( array( array( 'REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID ) ) ) ) {
1115
+		if (EEM_Checkin::instance()->exists(array(array('REG_ID' => $this->ID(), 'DTT_ID' => $DTT_ID)))) {
1116 1116
 			return true;
1117 1117
 		}
1118 1118
 
1119 1119
 		//made it here so the last check is whether the number of checkins per unique datetime on this registration
1120 1120
 		//disallows further check-ins.
1121
-		$count_unique_dtt_checkins = EEM_Checkin::instance()->count( array( array( 'REG_ID' => $this->ID(), 'CHK_in' => true ) ), 'DTT_ID', true );
1121
+		$count_unique_dtt_checkins = EEM_Checkin::instance()->count(array(array('REG_ID' => $this->ID(), 'CHK_in' => true)), 'DTT_ID', true);
1122 1122
 		// checkins have already reached their max number of uses
1123 1123
 		// so registrant can NOT checkin
1124
-		if ( $count_unique_dtt_checkins >= $max_uses ) {
1125
-			EE_Error::add_error( __( 'Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1124
+		if ($count_unique_dtt_checkins >= $max_uses) {
1125
+			EE_Error::add_error(__('Check-in denied because number of datetime uses for the ticket has been reached or exceeded.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1126 1126
 			return false;
1127 1127
 		}
1128 1128
 		return true;
@@ -1144,15 +1144,15 @@  discard block
 block discarded – undo
1144 1144
      * @return bool|int     the chk_in status toggled to OR false if nothing got changed.
1145 1145
      * @throws EE_Error
1146 1146
      */
1147
-	public function toggle_checkin_status( $DTT_ID = null, $verify = false ) {
1148
-		if ( empty( $DTT_ID ) ) {
1147
+	public function toggle_checkin_status($DTT_ID = null, $verify = false) {
1148
+		if (empty($DTT_ID)) {
1149 1149
 			$datetime = $this->get_latest_related_datetime();
1150 1150
 			$DTT_ID = $datetime instanceof EE_Datetime ? $datetime->ID() : 0;
1151 1151
 		// verify the registration can checkin for the given DTT_ID
1152
-		} elseif ( ! $this->can_checkin( $DTT_ID, $verify ) ) {
1152
+		} elseif ( ! $this->can_checkin($DTT_ID, $verify)) {
1153 1153
 			EE_Error::add_error(
1154 1154
 					sprintf(
1155
-						__( 'The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1155
+						__('The given registration (ID:%1$d) can not be checked in to the given DTT_ID (%2$d), because the registration does not have access', 'event_espresso'),
1156 1156
 						$this->ID(),
1157 1157
 						$DTT_ID
1158 1158
 					),
@@ -1166,8 +1166,8 @@  discard block
 block discarded – undo
1166 1166
 			EE_Registration::checkin_status_out => EE_Registration::checkin_status_in
1167 1167
 		);
1168 1168
 		//start by getting the current status so we know what status we'll be changing to.
1169
-		$cur_status = $this->check_in_status_for_datetime( $DTT_ID, NULL );
1170
-		$status_to = $status_paths[ $cur_status ];
1169
+		$cur_status = $this->check_in_status_for_datetime($DTT_ID, NULL);
1170
+		$status_to = $status_paths[$cur_status];
1171 1171
 		// database only records true for checked IN or false for checked OUT
1172 1172
 		// no record ( null ) means checked in NEVER, but we obviously don't save that
1173 1173
 		$new_status = $status_to === EE_Registration::checkin_status_in ? true : false;
@@ -1175,24 +1175,24 @@  discard block
 block discarded – undo
1175 1175
 		// because we are keeping track of Check-ins over time.
1176 1176
 		// Eventually we'll probably want to show a list table
1177 1177
 		// for the individual Check-ins so that they can be managed.
1178
-		$checkin = EE_Checkin::new_instance( array(
1178
+		$checkin = EE_Checkin::new_instance(array(
1179 1179
 				'REG_ID' => $this->ID(),
1180 1180
 				'DTT_ID' => $DTT_ID,
1181 1181
 				'CHK_in' => $new_status
1182
-		) );
1182
+		));
1183 1183
 		// if the record could not be saved then return false
1184
-		if ( $checkin->save() === 0 ) {
1185
-			if ( WP_DEBUG ) {
1184
+		if ($checkin->save() === 0) {
1185
+			if (WP_DEBUG) {
1186 1186
 				global $wpdb;
1187 1187
 				$error = sprintf(
1188
-					__( 'Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso' ),
1188
+					__('Registration check in update failed because of the following database error: %1$s%2$s', 'event_espresso'),
1189 1189
 					'<br />',
1190 1190
 					$wpdb->last_error
1191 1191
 				);
1192 1192
 			} else {
1193
-				$error = __( 'Registration check in update failed because of an unknown database error', 'event_espresso' );
1193
+				$error = __('Registration check in update failed because of an unknown database error', 'event_espresso');
1194 1194
 			}
1195
-			EE_Error::add_error( $error, __FILE__, __FUNCTION__, __LINE__ );
1195
+			EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
1196 1196
 			return false;
1197 1197
 		}
1198 1198
 		return $status_to;
@@ -1213,7 +1213,7 @@  discard block
 block discarded – undo
1213 1213
 				array(
1214 1214
 					'Ticket.Registration.REG_ID' => $this->ID()
1215 1215
 				),
1216
-				'order_by' => array( 'DTT_EVT_start' => 'DESC' )
1216
+				'order_by' => array('DTT_EVT_start' => 'DESC')
1217 1217
 			)
1218 1218
 		);
1219 1219
 	}
@@ -1232,7 +1232,7 @@  discard block
 block discarded – undo
1232 1232
 				array(
1233 1233
 					'Ticket.Registration.REG_ID' => $this->ID()
1234 1234
 				),
1235
-				'order_by' => array( 'DTT_EVT_start' => 'ASC' )
1235
+				'order_by' => array('DTT_EVT_start' => 'ASC')
1236 1236
 			)
1237 1237
 		);
1238 1238
 	}
@@ -1251,21 +1251,21 @@  discard block
 block discarded – undo
1251 1251
      * @return int                Integer representing Check-in status.
1252 1252
      * @throws \EE_Error
1253 1253
      */
1254
-	public function check_in_status_for_datetime( $DTT_ID = 0, $checkin = null ) {
1254
+	public function check_in_status_for_datetime($DTT_ID = 0, $checkin = null) {
1255 1255
 		$checkin_query_params = array(
1256
-			'order_by' => array( 'CHK_timestamp' => 'DESC' )
1256
+			'order_by' => array('CHK_timestamp' => 'DESC')
1257 1257
 		);
1258 1258
 
1259
-		if ( $DTT_ID > 0 ) {
1260
-			$checkin_query_params[0] = array( 'DTT_ID' => $DTT_ID );
1259
+		if ($DTT_ID > 0) {
1260
+			$checkin_query_params[0] = array('DTT_ID' => $DTT_ID);
1261 1261
 		}
1262 1262
 
1263 1263
 		//get checkin object (if exists)
1264 1264
 		$checkin = $checkin instanceof EE_Checkin
1265 1265
             ? $checkin
1266
-            : $this->get_first_related( 'Checkin', $checkin_query_params );
1267
-		if ( $checkin instanceof EE_Checkin ) {
1268
-			if ( $checkin->get( 'CHK_in' ) ) {
1266
+            : $this->get_first_related('Checkin', $checkin_query_params);
1267
+		if ($checkin instanceof EE_Checkin) {
1268
+			if ($checkin->get('CHK_in')) {
1269 1269
 				return EE_Registration::checkin_status_in; //checked in
1270 1270
 			}
1271 1271
 			return EE_Registration::checkin_status_out; //had checked in but is now checked out.
@@ -1281,28 +1281,28 @@  discard block
 block discarded – undo
1281 1281
 	 * @param bool $error  This just flags that you want an error message returned. This is put in so that the error message can be customized with the attendee name.
1282 1282
 	 * @return string         internationalized message
1283 1283
 	 */
1284
-	public function get_checkin_msg( $DTT_ID, $error = FALSE ) {
1284
+	public function get_checkin_msg($DTT_ID, $error = FALSE) {
1285 1285
 		//let's get the attendee first so we can include the name of the attendee
1286
-		$attendee = $this->get_first_related( 'Attendee' );
1287
-		if ( $attendee instanceof EE_Attendee ) {
1288
-			if ( $error ) {
1289
-				return sprintf( __( "%s's check-in status was not changed.", "event_espresso" ), $attendee->full_name() );
1286
+		$attendee = $this->get_first_related('Attendee');
1287
+		if ($attendee instanceof EE_Attendee) {
1288
+			if ($error) {
1289
+				return sprintf(__("%s's check-in status was not changed.", "event_espresso"), $attendee->full_name());
1290 1290
 			}
1291
-			$cur_status = $this->check_in_status_for_datetime( $DTT_ID );
1291
+			$cur_status = $this->check_in_status_for_datetime($DTT_ID);
1292 1292
 			//what is the status message going to be?
1293
-			switch ( $cur_status ) {
1293
+			switch ($cur_status) {
1294 1294
 				case EE_Registration::checkin_status_never :
1295
-					return sprintf( __( "%s has been removed from Check-in records", "event_espresso" ), $attendee->full_name() );
1295
+					return sprintf(__("%s has been removed from Check-in records", "event_espresso"), $attendee->full_name());
1296 1296
 					break;
1297 1297
 				case EE_Registration::checkin_status_in :
1298
-					return sprintf( __( '%s has been checked in', 'event_espresso' ), $attendee->full_name() );
1298
+					return sprintf(__('%s has been checked in', 'event_espresso'), $attendee->full_name());
1299 1299
 					break;
1300 1300
 				case EE_Registration::checkin_status_out :
1301
-					return sprintf( __( '%s has been checked out', 'event_espresso' ), $attendee->full_name() );
1301
+					return sprintf(__('%s has been checked out', 'event_espresso'), $attendee->full_name());
1302 1302
 					break;
1303 1303
 			}
1304 1304
 		}
1305
-		return __( "The check-in status could not be determined.", "event_espresso" );
1305
+		return __("The check-in status could not be determined.", "event_espresso");
1306 1306
 	}
1307 1307
 
1308 1308
 
@@ -1326,7 +1326,7 @@  discard block
 block discarded – undo
1326 1326
 	 *        get Registration Code
1327 1327
 	 */
1328 1328
 	public function reg_code() {
1329
-		return $this->get( 'REG_code' );
1329
+		return $this->get('REG_code');
1330 1330
 	}
1331 1331
 
1332 1332
 
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 	 *        get Transaction ID
1336 1336
 	 */
1337 1337
 	public function transaction_ID() {
1338
-		return $this->get( 'TXN_ID' );
1338
+		return $this->get('TXN_ID');
1339 1339
 	}
1340 1340
 
1341 1341
 
@@ -1344,7 +1344,7 @@  discard block
 block discarded – undo
1344 1344
 	 * @return int
1345 1345
 	 */
1346 1346
 	public function ticket_ID() {
1347
-		return $this->get( 'TKT_ID' );
1347
+		return $this->get('TKT_ID');
1348 1348
 	}
1349 1349
 
1350 1350
 
@@ -1356,17 +1356,17 @@  discard block
 block discarded – undo
1356 1356
 	 * @param    string $REG_code Registration Code
1357 1357
 	 * @param	boolean $use_default
1358 1358
 	 */
1359
-	public function set_reg_code( $REG_code, $use_default = FALSE ) {
1360
-		if ( empty( $REG_code )) {
1361
-			EE_Error::add_error( __( 'REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
1359
+	public function set_reg_code($REG_code, $use_default = FALSE) {
1360
+		if (empty($REG_code)) {
1361
+			EE_Error::add_error(__('REG_code can not be empty.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1362 1362
 			return;
1363 1363
 		}
1364
-		if ( ! $this->reg_code() ) {
1365
-			parent::set( 'REG_code', $REG_code, $use_default );
1364
+		if ( ! $this->reg_code()) {
1365
+			parent::set('REG_code', $REG_code, $use_default);
1366 1366
 		} else {
1367 1367
 			EE_Error::doing_it_wrong(
1368
-				__CLASS__ . '::' . __FUNCTION__,
1369
-				__( 'Can not change a registration REG_code once it has been set.', 'event_espresso' ),
1368
+				__CLASS__.'::'.__FUNCTION__,
1369
+				__('Can not change a registration REG_code once it has been set.', 'event_espresso'),
1370 1370
 				'4.6.0'
1371 1371
 			);
1372 1372
 		}
@@ -1386,17 +1386,17 @@  discard block
 block discarded – undo
1386 1386
 	 * @return EE_Registration[]  or empty array if this isn't a group registration.
1387 1387
 	 */
1388 1388
 	public function get_all_other_registrations_in_group() {
1389
-		if ( $this->group_size() < 2 ) {
1389
+		if ($this->group_size() < 2) {
1390 1390
 			return array();
1391 1391
 		}
1392 1392
 
1393 1393
 		$query[0] = array(
1394 1394
 			'TXN_ID' => $this->transaction_ID(),
1395
-			'REG_ID' => array( '!=', $this->ID() ),
1395
+			'REG_ID' => array('!=', $this->ID()),
1396 1396
 			'TKT_ID' => $this->ticket_ID()
1397 1397
 			);
1398 1398
 
1399
-		$registrations = $this->get_model()->get_all( $query );
1399
+		$registrations = $this->get_model()->get_all($query);
1400 1400
 		return $registrations;
1401 1401
 	}
1402 1402
 
@@ -1405,14 +1405,14 @@  discard block
 block discarded – undo
1405 1405
 	 * @return string
1406 1406
 	 */
1407 1407
 	public function get_admin_details_link() {
1408
-		EE_Registry::instance()->load_helper( 'URL' );
1408
+		EE_Registry::instance()->load_helper('URL');
1409 1409
 		return EEH_URL::add_query_args_and_nonce(
1410 1410
 			array(
1411 1411
 				'page' => 'espresso_registrations',
1412 1412
 				'action' => 'view_registration',
1413 1413
 				'_REG_ID' => $this->ID()
1414 1414
 			),
1415
-			admin_url( 'admin.php' )
1415
+			admin_url('admin.php')
1416 1416
 		);
1417 1417
 	}
1418 1418
 
@@ -1437,12 +1437,12 @@  discard block
 block discarded – undo
1437 1437
 	 * @return string
1438 1438
 	 */
1439 1439
 	public function get_admin_overview_link() {
1440
-		EE_Registry::instance()->load_helper( 'URL' );
1440
+		EE_Registry::instance()->load_helper('URL');
1441 1441
 		return EEH_URL::add_query_args_and_nonce(
1442 1442
 			array(
1443 1443
 				'page' => 'espresso_registrations'
1444 1444
 			),
1445
-			admin_url( 'admin.php' )
1445
+			admin_url('admin.php')
1446 1446
 		);
1447 1447
 	}
1448 1448
 
@@ -1453,8 +1453,8 @@  discard block
 block discarded – undo
1453 1453
 	 * @return \EE_Registration[]
1454 1454
 	 * @throws \EE_Error
1455 1455
 	 */
1456
-	public function payments( $query_params = array() ) {
1457
-		return $this->get_many_related( 'Payment', $query_params );
1456
+	public function payments($query_params = array()) {
1457
+		return $this->get_many_related('Payment', $query_params);
1458 1458
 	}
1459 1459
 
1460 1460
 
@@ -1464,8 +1464,8 @@  discard block
 block discarded – undo
1464 1464
 	 * @return \EE_Registration_Payment[]
1465 1465
 	 * @throws \EE_Error
1466 1466
 	 */
1467
-	public function registration_payments( $query_params = array() ) {
1468
-		return $this->get_many_related( 'Registration_Payment', $query_params );
1467
+	public function registration_payments($query_params = array()) {
1468
+		return $this->get_many_related('Registration_Payment', $query_params);
1469 1469
 	}
1470 1470
 
1471 1471
 
@@ -1478,7 +1478,7 @@  discard block
 block discarded – undo
1478 1478
 	 * @return EE_Payment_Method|null
1479 1479
 	 */
1480 1480
 	public function payment_method() {
1481
-		return EEM_Payment_Method::instance()->get_last_used_for_registration( $this );
1481
+		return EEM_Payment_Method::instance()->get_last_used_for_registration($this);
1482 1482
 	}
1483 1483
 
1484 1484
 
@@ -1525,7 +1525,7 @@  discard block
 block discarded – undo
1525 1525
      */
1526 1526
     public function delete()
1527 1527
     {
1528
-        if($this->update_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY, $this->status_ID()) === true) {
1528
+        if ($this->update_extra_meta(EE_Registration::PRE_TRASH_REG_STATUS_KEY, $this->status_ID()) === true) {
1529 1529
             $this->set_status(EEM_Registration::status_id_cancelled);
1530 1530
         }
1531 1531
         return parent::delete();
Please login to merge, or discard this patch.
core/helpers/EEH_Tabbed_Content.helper.php 2 patches
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * @return string the assembled html string containing the tabbed content for display.
47 47
 	 * @throws \EE_Error
48 48
 	 */
49
-	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE ) {
49
+	public static function display($tabs_contents, $tabs_names = array(), $small_tabs = true, $tabs_content = TRUE) {
50 50
 
51 51
 		//first check if $tabs_names is not empty then the count must match the count of $tabs_content otherwise we've got a problem houston
52
-		if ( !empty( $tabs_names) && ( count( (array) $tabs_names) != count( (array) $tabs_content) ) ) {
53
-			throw new EE_Error( __('The count for $tabs_names and $tabs_content does not match.', 'event_espresso') );
52
+		if ( ! empty($tabs_names) && (count((array) $tabs_names) != count((array) $tabs_content))) {
53
+			throw new EE_Error(__('The count for $tabs_names and $tabs_content does not match.', 'event_espresso'));
54 54
 		}
55 55
 
56 56
 		//make sure we've got incoming data setup properly
57
-		$tabs = !empty( $tabs_names ) ? (array) $tabs_names : array_keys( (array) $tabs_contents );
58
-		$tabs_content = !empty( $tabs_names ) ? array_combine( (array) $tabs_names, (array) $tabs_content ) : $tabs_contents;
57
+		$tabs = ! empty($tabs_names) ? (array) $tabs_names : array_keys((array) $tabs_contents);
58
+		$tabs_content = ! empty($tabs_names) ? array_combine((array) $tabs_names, (array) $tabs_content) : $tabs_contents;
59 59
 
60
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
60
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
61 61
 		$all_tabs_content = '';
62 62
 
63 63
 		$index = 0;
64
-		foreach ( $tabs as $tab ) {
64
+		foreach ($tabs as $tab) {
65 65
 			$active = $index === 0 ? true : false;
66 66
 			$all_tabs .= self::tab($tab, $active);
67 67
 			$all_tabs_content .= self::tab_content($tab, $tabs_content[$tab], $active);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 		$tab_container_class = $small_tabs ? 'ee-nav-tabs ee-nav-tabs-small' : 'ee-nav-tabs';
80 80
 
81
-		return '<div class="'. $tab_container_class . '">' . "\n\t" . $all_tabs . $all_tabs_content . "\n" . '</div>';
81
+		return '<div class="'.$tab_container_class.'">'."\n\t".$all_tabs.$all_tabs_content."\n".'</div>';
82 82
 	}
83 83
 
84 84
 
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 * @throws \EE_Error
103 103
 	 */
104 104
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
105
+		if (empty($nav_tabs))
106
+			throw new EE_Error(__('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso'));
107 107
 
108
-		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109
-		foreach ( $nav_tabs as $slug => $tab ) {
108
+		$all_tabs = '<h2 class="nav-tab-wrapper">'."\n";
109
+		foreach ($nav_tabs as $slug => $tab) {
110 110
 			$all_tabs .= self::tab($slug, false, $tab['link_text'], $tab['url'], $tab['css_class']);
111 111
 		}
112 112
 		$all_tabs .= '</h2>';
@@ -122,13 +122,13 @@  discard block
 block discarded – undo
122 122
 	 * @param bool|string $css If string given then the generated tab will include that as the class.
123 123
 	 * @return string          html for tab
124 124
 	 */
125
-	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE ) {
125
+	private static function tab($name, $active = false, $nice_name = FALSE, $url = FALSE, $css = FALSE) {
126 126
 		$name = str_replace(' ', '-', $name);
127 127
 		$class = $active ? 'nav-tab nav-tab-active' : 'nav-tab';
128
-		$class = $css ? $class . ' ' . $css : $class;
129
-		$nice_name = $nice_name ? $nice_name : ucwords( preg_replace('/(-|_)/', ' ', $name) );
130
-		$url = $url ? $url : '#' . $name;
131
-		$tab = '<a class="' . $class . '" rel="ee-tab-' . $name . '" href="' . $url . '">' . $nice_name . '</a>' . "\n\t";
128
+		$class = $css ? $class.' '.$css : $class;
129
+		$nice_name = $nice_name ? $nice_name : ucwords(preg_replace('/(-|_)/', ' ', $name));
130
+		$url = $url ? $url : '#'.$name;
131
+		$tab = '<a class="'.$class.'" rel="ee-tab-'.$name.'" href="'.$url.'">'.$nice_name.'</a>'."\n\t";
132 132
 		return $tab;
133 133
 	}
134 134
 
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	private static function tab_content($name, $tab_content, $active = false) {
146 146
 		$class = $active ? 'nav-tab-content' : 'nav-tab-content hidden';
147
-		$name = str_replace( ' ', '-', $name);
148
-		$content = "\t" . '<div class="'. $class . '" id="ee-tab-' . $name . '">' . "\n";
149
-		$content .= "\t" . $tab_content . "\n";
147
+		$name = str_replace(' ', '-', $name);
148
+		$content = "\t".'<div class="'.$class.'" id="ee-tab-'.$name.'">'."\n";
149
+		$content .= "\t".$tab_content."\n";
150 150
 		$content .= '<div style="clear:both"></div></div>';
151 151
 		return $content;
152 152
 	}
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
 	 * @param string $default 			You can include a string for the item that will receive the "item_display" class for the js.
173 173
 	 * @return string                  a html snippet of of all the formatted link elements.
174 174
 	 */
175
-	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176
-		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
175
+	public static function tab_text_links($item_array, $container_class = '', $sep = '|', $default = '') {
176
+		$item_array = apply_filters('FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class);
177
+		if ( ! is_array($item_array) || empty($item_array))
178 178
 			return false; //get out we don't have even the basic thing we need!
179 179
 
180 180
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 			'title' => esc_attr__('Link for Item', 'event_espresso'),
186 186
 			'slug' => 'item_slug'
187 187
 		);
188
-		$container_class = !empty($container_class) ? 'ee-text-links ' . $container_class : 'ee-text-links';
189
-		$list = '<ul class="' . $container_class . '">';
188
+		$container_class = ! empty($container_class) ? 'ee-text-links '.$container_class : 'ee-text-links';
189
+		$list = '<ul class="'.$container_class.'">';
190 190
 
191 191
 		$ci = 1;
192
-		foreach ( $item_array as $item ) {
193
-			$item = wp_parse_args( $item, $defaults );
194
-			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
192
+		foreach ($item_array as $item) {
193
+			$item = wp_parse_args($item, $defaults);
194
+			$item['class'] = ! empty($default) && $default == $item['slug'] ? 'item_display '.$item['class'] : $item['class'];
195 195
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
196
+			if ( ! empty($sep) && $ci != count($item_array))
197 197
 				$list .= self::_text_link_item($sep);
198 198
 			$ci++;
199 199
 		}
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 
205 205
 
206 206
 
207
-	private static function _text_link_item( $item ) {
207
+	private static function _text_link_item($item) {
208 208
 		//if this isn't an array then we're doing a separator
209
-		if ( !is_array( $item ) ) {
209
+		if ( ! is_array($item)) {
210 210
 			$label = $item;
211 211
 			$class = 'ee-text-link-sep';
212 212
 			$href = '';
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 			extract($item);
216 216
 		}
217 217
 
218
-		$class = $class != 'ee-text-link-sep'  ? 'class="ee-text-link-li ' . $class . '"' : 'class="ee-text-link-sep"';
218
+		$class = $class != 'ee-text-link-sep' ? 'class="ee-text-link-li '.$class.'"' : 'class="ee-text-link-sep"';
219 219
 
220
-		$content = '<li ' . $class . '>';
221
-		$content .= !empty($href) ? '<a class="ee-text-link" href="#' . $href . '" title="' . $title . '">' : '';
220
+		$content = '<li '.$class.'>';
221
+		$content .= ! empty($href) ? '<a class="ee-text-link" href="#'.$href.'" title="'.$title.'">' : '';
222 222
 		$content .= $label;
223
-		$content .= !empty($href) ? '</a>' : '';
223
+		$content .= ! empty($href) ? '</a>' : '';
224 224
 		$content .= '</li>';
225 225
 		return $content;
226 226
 	}
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -102,8 +103,9 @@  discard block
 block discarded – undo
102 103
 	 * @throws \EE_Error
103 104
 	 */
104 105
 	public static function display_admin_nav_tabs($nav_tabs = array()) {
105
-		if ( empty($nav_tabs) )
106
-			throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
106
+		if ( empty($nav_tabs) ) {
107
+					throw new EE_Error( __('Nav Tabs cannot be generated because the tab array is missing', 'event_espresso' ) );
108
+		}
107 109
 
108 110
 		$all_tabs = '<h2 class="nav-tab-wrapper">' . "\n";
109 111
 		foreach ( $nav_tabs as $slug => $tab ) {
@@ -174,8 +176,10 @@  discard block
 block discarded – undo
174 176
 	 */
175 177
 	public static function tab_text_links( $item_array, $container_class = '', $sep = '|', $default = '' ) {
176 178
 		$item_array = apply_filters( 'FHEE__EEH_Tabbed_Content__tab_text_links', $item_array, $container_class );
177
-		if ( !is_array($item_array) || empty( $item_array ) )
178
-			return false; //get out we don't have even the basic thing we need!
179
+		if ( !is_array($item_array) || empty( $item_array ) ) {
180
+					return false;
181
+		}
182
+		//get out we don't have even the basic thing we need!
179 183
 
180 184
 
181 185
 		$defaults = array(
@@ -193,8 +197,9 @@  discard block
 block discarded – undo
193 197
 			$item = wp_parse_args( $item, $defaults );
194 198
 			$item['class'] = !empty($default) && $default == $item['slug'] ? 'item_display ' . $item['class'] : $item['class'];
195 199
 			$list .= self::_text_link_item($item);
196
-			if ( !empty($sep) && $ci != count($item_array) )
197
-				$list .= self::_text_link_item($sep);
200
+			if ( !empty($sep) && $ci != count($item_array) ) {
201
+							$list .= self::_text_link_item($sep);
202
+			}
198 203
 			$ci++;
199 204
 		}
200 205
 
Please login to merge, or discard this patch.
caffeinated/modules/recaptcha/ReCaptcha/RequestMethod/Post.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -34,37 +34,37 @@
 block discarded – undo
34 34
  */
35 35
 class Post implements RequestMethod
36 36
 {
37
-    /**
38
-     * URL to which requests are POSTed.
39
-     * @const string
40
-     */
41
-    const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
37
+	/**
38
+	 * URL to which requests are POSTed.
39
+	 * @const string
40
+	 */
41
+	const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify';
42 42
 
43
-    /**
44
-     * Submit the POST request with the specified parameters.
45
-     *
46
-     * @param RequestParameters $params Request parameters
47
-     * @return string Body of the reCAPTCHA response
48
-     */
49
-    public function submit(RequestParameters $params)
50
-    {
51
-        /**
52
-         * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
-         * Using "CN_name" will still work, but it will raise deprecated errors.
54
-         */
55
-        $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
-        $options = array(
57
-            'http' => array(
58
-                'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
-                'method' => 'POST',
60
-                'content' => $params->toQueryString(),
61
-                // Force the peer to validate (not needed in 5.6.0+, but still works
62
-                'verify_peer' => true,
63
-                // Force the peer validation to use www.google.com
64
-                $peer_key => 'www.google.com',
65
-            ),
66
-        );
67
-        $context = stream_context_create($options);
68
-        return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
-    }
43
+	/**
44
+	 * Submit the POST request with the specified parameters.
45
+	 *
46
+	 * @param RequestParameters $params Request parameters
47
+	 * @return string Body of the reCAPTCHA response
48
+	 */
49
+	public function submit(RequestParameters $params)
50
+	{
51
+		/**
52
+		 * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53
+		 * Using "CN_name" will still work, but it will raise deprecated errors.
54
+		 */
55
+		$peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name';
56
+		$options = array(
57
+			'http' => array(
58
+				'header' => "Content-type: application/x-www-form-urlencoded\r\n",
59
+				'method' => 'POST',
60
+				'content' => $params->toQueryString(),
61
+				// Force the peer to validate (not needed in 5.6.0+, but still works
62
+				'verify_peer' => true,
63
+				// Force the peer validation to use www.google.com
64
+				$peer_key => 'www.google.com',
65
+			),
66
+		);
67
+		$context = stream_context_create($options);
68
+		return file_get_contents(self::SITE_VERIFY_URL, false, $context);
69
+	}
70 70
 }
Please login to merge, or discard this patch.
registrations/templates/attendee_registrations_main_meta_box.template.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
 		<table class="admin-primary-mbox-tbl">
6 6
 			<thead>
7 7
 				<tr>
8
-					<th class="jst-left"><?php esc_html_e( 'Event Name', 'event_espresso' );?></th>
9
-					<th class="jst-left"><?php esc_html_e( 'REG ID', 'event_espresso' );?></th>
10
-					<th class="jst-left"><?php esc_html_e( 'TXN ID', 'event_espresso' );?></th>
11
-					<th class="jst-left"><?php esc_html_e( 'Reg Code', 'event_espresso' );?></th>
12
-					<th class="jst-rght"><?php esc_html_e( 'Ticket Price', 'event_espresso' );?></th>
8
+					<th class="jst-left"><?php esc_html_e('Event Name', 'event_espresso'); ?></th>
9
+					<th class="jst-left"><?php esc_html_e('REG ID', 'event_espresso'); ?></th>
10
+					<th class="jst-left"><?php esc_html_e('TXN ID', 'event_espresso'); ?></th>
11
+					<th class="jst-left"><?php esc_html_e('Reg Code', 'event_espresso'); ?></th>
12
+					<th class="jst-rght"><?php esc_html_e('Ticket Price', 'event_espresso'); ?></th>
13 13
 				</tr>
14 14
 			</thead>
15 15
 			<tbody>
16
-			<?php foreach( $registrations as $registration ) : ?>
16
+			<?php foreach ($registrations as $registration) : ?>
17 17
 				<tr>
18 18
 					<td class="jst-left">
19 19
 					<?php
20
-						$event_url = add_query_arg( array( 'action' => 'edit', 'post' => $registration->event_ID() ), admin_url( 'admin.php?page=espresso_events' ));
21
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'espresso_events_edit', $registration->event_ID() ) ?  '<a href="'. $event_url .'"  title="'. esc_attr__( 'Edit Event', 'event_espresso' ) .'">' . $registration->event_name() . '</a>' : $registration->event_name();
20
+						$event_url = add_query_arg(array('action' => 'edit', 'post' => $registration->event_ID()), admin_url('admin.php?page=espresso_events'));
21
+						echo EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'espresso_events_edit', $registration->event_ID()) ? '<a href="'.$event_url.'"  title="'.esc_attr__('Edit Event', 'event_espresso').'">'.$registration->event_name().'</a>' : $registration->event_name();
22 22
 					?>
23 23
 					</td>
24 24
 					<td class="jst-left">
25 25
 					<?php
26
-							$reg_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration->ID() ), REG_ADMIN_URL );
27
-							echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_registration', 'espresso_registrations_view_registration', $registration->ID() ) ? '
28
-							<a href="'.$reg_url.'" title="' . esc_attr__( 'View Registration Details', 'event_espresso' ) . '">' . 
29
-								esc_html__( 'View Registration', 'event_espresso' ) .
26
+							$reg_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration->ID()), REG_ADMIN_URL);
27
+							echo EE_Registry::instance()->CAP->current_user_can('ee_read_registration', 'espresso_registrations_view_registration', $registration->ID()) ? '
28
+							<a href="'.$reg_url.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'. 
29
+								esc_html__('View Registration', 'event_espresso').
30 30
 							'</a>' : $registration->ID();
31 31
 					?>
32 32
 					</td>
33 33
 					<td class="jst-left">
34 34
 					<?php
35
-						$txn_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID() ), TXN_ADMIN_URL );
36
-						echo EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ? '
37
-						<a href="'.$txn_url.'" title="' . esc_attr__( 'View Transaction Details', 'event_espresso' ) . '">' .
38
-							sprintf( esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID() ) .
35
+						$txn_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$registration->transaction_ID()), TXN_ADMIN_URL);
36
+						echo EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
37
+						<a href="'.$txn_url.'" title="'.esc_attr__('View Transaction Details', 'event_espresso').'">'.
38
+							sprintf(esc_html__('View Transaction %d', 'event_espresso'), $registration->transaction_ID()).
39 39
 						'</a>' : $registration->transaction_ID();
40 40
 					?>
41 41
 					</td>
42
-					<td class="jst-left"><?php echo $registration->reg_code();?></td>
43
-					<td class="jst-rght"><?php echo EEH_Template::format_currency( $registration->final_price() );?></td>
42
+					<td class="jst-left"><?php echo $registration->reg_code(); ?></td>
43
+					<td class="jst-rght"><?php echo EEH_Template::format_currency($registration->final_price()); ?></td>
44 44
 				</tr>
45 45
 			<?php endforeach; ?>
46 46
 			</tbody>
Please login to merge, or discard this patch.
strategies/validation/EE_Max_Length_Validation_Strategy.strategy.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@
 block discarded – undo
8 8
  * @subpackage	Expression package is undefined on line 19, column 19 in Templates/Scripting/PHPClass.php.
9 9
  * @author				Mike Nelson
10 10
  */
11
-class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base{
11
+class EE_Max_Length_Validation_Strategy extends EE_Validation_Strategy_Base {
12 12
 
13 13
 	protected $_max_length;
14 14
 
15
-	public function __construct( $validation_error_message = NULL, $max_length = EE_INF ) {
15
+	public function __construct($validation_error_message = NULL, $max_length = EE_INF) {
16 16
 		$this->_max_length = $max_length;
17
-		if( $validation_error_message === null ) {
18
-			$validation_error_message = sprintf( __( 'Input is too long. Maximum number of characters is %1$s', 'event_espresso' ), $max_length );
17
+		if ($validation_error_message === null) {
18
+			$validation_error_message = sprintf(__('Input is too long. Maximum number of characters is %1$s', 'event_espresso'), $max_length);
19 19
 		}
20
-		parent::__construct( $validation_error_message );
20
+		parent::__construct($validation_error_message);
21 21
 	}
22 22
 
23 23
 	/**
24 24
 	 * @param $normalized_value
25 25
 	 */
26 26
 	public function validate($normalized_value) {
27
-		if( $this->_max_length !== EE_INF &&
27
+		if ($this->_max_length !== EE_INF &&
28 28
 				$normalized_value &&
29
-				is_string( $normalized_value ) &&
30
-				 strlen( $normalized_value ) > $this->_max_length){
31
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'maxlength' );
29
+				is_string($normalized_value) &&
30
+				 strlen($normalized_value) > $this->_max_length) {
31
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'maxlength');
32 32
 		}
33 33
 	}
34 34
 
35 35
 	/**
36 36
 	 * @return array
37 37
 	 */
38
-	function get_jquery_validation_rule_array(){
39
-		if( $this->_max_length !== EE_INF ) {
40
-			return array( 'maxlength'=> $this->_max_length, 'messages' => array( 'maxlength' => $this->get_validation_error_message() ) );
38
+	function get_jquery_validation_rule_array() {
39
+		if ($this->_max_length !== EE_INF) {
40
+			return array('maxlength'=> $this->_max_length, 'messages' => array('maxlength' => $this->get_validation_error_message()));
41 41
 		} else {
42 42
 			return array();
43 43
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Join.model.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -21,26 +21,26 @@
 block discarded – undo
21 21
  * @since		 	   $VID:$
22 22
  *
23 23
  */
24
-if (!defined('EVENT_ESPRESSO_VERSION')) {
24
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
25 25
 	exit('No direct script access allowed');
26 26
 }
27 27
 
28
-class EEM_Extra_Join extends EEM_Base{
28
+class EEM_Extra_Join extends EEM_Base {
29 29
 	// private instance of the Extra Join object
30 30
 	protected static $_instance = NULL;
31 31
 	
32 32
 	public function __construct($timezone = NULL) {
33
-		$models_this_can_join = array_keys( EE_Registry::instance()->non_abstract_db_models );
33
+		$models_this_can_join = array_keys(EE_Registry::instance()->non_abstract_db_models);
34 34
 		$this->_tables = array(
35
-			'Extra_Join' => new EE_Primary_Table( 'esp_extra_join', 'EXJ_ID' ),
35
+			'Extra_Join' => new EE_Primary_Table('esp_extra_join', 'EXJ_ID'),
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Extra_Join' => array(
39
-				'EXJ_ID' => new EE_Primary_Key_Int_Field( 'EXJ_ID', __( 'Extra Join ID', 'event_espresso' ) ),
40
-				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_first_model_ID', __( 'First Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
41
-				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_first_model_name', __( 'First Model Name', 'event_espresso'), true, '', $models_this_can_join ),
42
-				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field( 'EXJ_second_model_ID', __( 'Second Model ID', 'event_espresso' ), true, 0, $models_this_can_join ),
43
-				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field( 'EXJ_second_model_name', __( 'Second Model Name', 'event_espresso'), true, '', $models_this_can_join ),
39
+				'EXJ_ID' => new EE_Primary_Key_Int_Field('EXJ_ID', __('Extra Join ID', 'event_espresso')),
40
+				'EXJ_first_model_ID' => new EE_Foreign_Key_String_Field('EXJ_first_model_ID', __('First Model ID', 'event_espresso'), true, 0, $models_this_can_join),
41
+				'EXJ_first_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_first_model_name', __('First Model Name', 'event_espresso'), true, '', $models_this_can_join),
42
+				'EXJ_second_model_ID' => new EE_Foreign_Key_String_Field('EXJ_second_model_ID', __('Second Model ID', 'event_espresso'), true, 0, $models_this_can_join),
43
+				'EXJ_second_model_name' => new EE_Any_Foreign_Model_Name_Field('EXJ_second_model_name', __('Second Model Name', 'event_espresso'), true, '', $models_this_can_join),
44 44
 				
45 45
 			)
46 46
 		);
Please login to merge, or discard this patch.
4_9_0_stages/EE_DMS_4_9_0_Answers_With_No_Registration.dmsstage.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION')) {
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5 5
 }
6 6
 
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @author				Brent Christensen
15 15
  *
16 16
  */
17
-class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage{
17
+class EE_DMS_4_9_0_Answers_With_No_Registration extends EE_Data_Migration_Script_Stage {
18 18
 
19 19
 
20 20
 
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	 * @return EE_DMS_4_9_0_Answers_With_No_Registration
25 25
 	 */
26 26
 	public function __construct() {
27
-		$this->_pretty_name = __( 'Answer Cleanup', 'event_espresso' );
27
+		$this->_pretty_name = __('Answer Cleanup', 'event_espresso');
28 28
 		parent::__construct();
29 29
 	}
30 30
 
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	protected function _migration_step($num_items_to_migrate = 50) {
49 49
 		global $wpdb;
50 50
 		$wpdb->delete(
51
-			$wpdb->prefix . 'esp_answer',
52
-			array( 'REG_ID' => 0 ),
53
-			array( '%d' )
51
+			$wpdb->prefix.'esp_answer',
52
+			array('REG_ID' => 0),
53
+			array('%d')
54 54
 		);
55 55
 		$this->set_completed();
56 56
 		return 1;
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Meta.model.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,16 +26,16 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
29
+require_once (EE_MODELS.'EEM_Base.model.php');
30 30
 
31 31
 class EEM_Extra_Meta extends EEM_Base {
32 32
 
33 33
   	// private instance of the Attendee object
34 34
 	protected static $_instance = NULL;
35 35
 
36
-	protected function __construct( $timezone = NULL ) {
37
-		$this->singular_item = __('Extra Meta','event_espresso');
38
-		$this->plural_item = __('Extra Metas','event_espresso');
36
+	protected function __construct($timezone = NULL) {
37
+		$this->singular_item = __('Extra Meta', 'event_espresso');
38
+		$this->plural_item = __('Extra Metas', 'event_espresso');
39 39
 		$this->_tables = array(
40 40
 			'Extra_Meta'=> new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
41 41
 		);
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 			));
52 52
 		$this->_model_relations = array();
53
-		foreach($models_this_can_attach_to as $model){
53
+		foreach ($models_this_can_attach_to as $model) {
54 54
 			$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
55 55
 		}
56
-		foreach( $this->cap_contexts_to_cap_action_map() as $cap_context => $action ) {
57
-			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta( 'EXM_key', 'EXM_value' );
56
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
57
+			$this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
58 58
 		}
59
-		parent::__construct( $timezone );
59
+		parent::__construct($timezone);
60 60
 	}
61 61
 
62 62
 
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/strategies/EE_Restriction_Generator_Meta.strategy.php 1 patch
Spacing   +13 added lines, -13 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,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @author				Mike Nelson
15 15
  *
16 16
  */
17
-class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{
17
+class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base {
18 18
 
19 19
 	/**
20 20
 	 *
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	 * @param string $key_field_name
34 34
 	 * @param string $value_field_name
35 35
 	 */
36
-	public function __construct( $key_field_name, $value_field_name ) {
36
+	public function __construct($key_field_name, $value_field_name) {
37 37
 		$this->_key_field_name = $key_field_name;
38 38
 		$this->_value_field_name = $value_field_name;
39 39
 	}
@@ -45,21 +45,21 @@  discard block
 block discarded – undo
45 45
 	 * @throws EE_Error
46 46
 	 */
47 47
 	protected function _generate_restrictions() {
48
-		$whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() );
49
-		$blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() );
48
+		$whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array());
49
+		$blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array());
50 50
 		$conditions = array(
51
-			$this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and 
51
+			$this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and 
52 52
 			//stripslashes will be called on this because the models assume this is from user input
53
-			$this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$')					
53
+			$this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$')					
54 54
 		);
55
-		if( ! empty( $blacklisted_meta_keys ) ) {
56
-			$conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys );
55
+		if ( ! empty($blacklisted_meta_keys)) {
56
+			$conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys);
57 57
 		}
58
-		if( ! empty( $whitelisted_meta_keys ) ) {
58
+		if ( ! empty($whitelisted_meta_keys)) {
59 59
 			$conditions = array(
60 60
 				'OR*whitelisted-or-normal' => array(
61 61
 					'AND' => $conditions,
62
-					$this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) 
62
+					$this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) 
63 63
 				)
64 64
 			);
65 65
 		}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			//only allow access to non-protected metas if they're an admin
68 68
 			EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(),
69 69
 			//don't allow access to protected metas to anyone. If they want that, don't apply caps to the query
70
-			'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ),
70
+			'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions),
71 71
 		);
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.