Completed
Branch DECAF-4.7 (a62460)
by
unknown
357:16 queued 343:55
created
core/db_models/EEM_Registration.model.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -219,11 +219,11 @@  discard block
 block discarded – undo
219 219
 
220 220
 
221 221
 	/**
222
-	*		retrieve ALL registrations for a particular Attendee from db
223
-	* 		@access		public
224
-	* 		@param		int		$ATT_ID
225
-	*		@return 	EE_Registration[]
226
-	*/
222
+	 *		retrieve ALL registrations for a particular Attendee from db
223
+	 * 		@access		public
224
+	 * 		@param		int		$ATT_ID
225
+	 *		@return 	EE_Registration[]
226
+	 */
227 227
 	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
228 228
 		if ( ! $ATT_ID ) {
229 229
 			return FALSE;
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 
251 251
 
252 252
 	/**
253
-	*		retrieve registration for a specific transaction attendee from db
254
-	*
255
-	* 		@access		public
256
-	* 		@param	int	$TXN_ID
257
-	* 		@param    int		$ATT_ID
258
-	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
-	*		@return 		mixed		array on success, FALSE on fail
260
-	*/
253
+	 *		retrieve registration for a specific transaction attendee from db
254
+	 *
255
+	 * 		@access		public
256
+	 * 		@param	int	$TXN_ID
257
+	 * 		@param    int		$ATT_ID
258
+	 * 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259
+	 *		@return 		mixed		array on success, FALSE on fail
260
+	 */
261 261
 	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262 262
 		return $this->get_one(array(
263 263
 			array(
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 
271 271
 
272 272
 	/**
273
-	*		get the number of registrations per day  for the Registration Admin page Reports Tab.
273
+	 *		get the number of registrations per day  for the Registration Admin page Reports Tab.
274 274
 	 *		(doesn't utilize models because it's a fairly specialized query)
275
-	* 		@access		public
275
+	 * 		@access		public
276 276
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
277 277
 	 *		@return stdClass[] with properties regDate and total
278
-	*/
278
+	 */
279 279
 	public function get_registrations_per_day_report( $period = '-1 month' ) {
280 280
 
281 281
 		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 
305 305
 
306 306
 	/**
307
-	*		get the number of registrations per event  for the Registration Admin page Reports Tab
308
-	* 		@access		public
307
+	 *		get the number of registrations per event  for the Registration Admin page Reports Tab
308
+	 * 		@access		public
309 309
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
310 310
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
311
-	*/
311
+	 */
312 312
 	public function get_registrations_per_event_report( $period = '-1 month' ) {
313 313
 
314 314
 		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
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.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	/**
202 202
 	 * This returns a wpdb->results array of all registration date month and years matching the incoming query params and grouped by month and year.
203 203
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
204
-	 * @return wpdb results array
204
+	 * @return stdClass[] results array
205 205
 	 */
206 206
 	public function get_reg_months_and_years( $where_params ) {
207 207
 		$query_params[0] = $where_params;
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	* 		@param		$TXN_ID
256 256
 	* 		@param		$ATT_ID
257 257
 	* 		@param		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
258
-	*		@return 		mixed		array on success, FALSE on fail
258
+	*		@return 		EE_Soft_Delete_Base_Class|null		array on success, FALSE on fail
259 259
 	*/
260 260
 	public function get_registration_for_transaction_attendee( $TXN_ID = FALSE, $ATT_ID = FALSE, $att_nmbr = FALSE ) {
261 261
 		return $this->get_one(array(
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 	 *    Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
93 93
 	 * @return \EEM_Registration
94 94
 	 */
95
-	protected function __construct( $timezone ) {
96
-		$this->singular_item = __('Registration','event_espresso');
97
-		$this->plural_item = __('Registrations','event_espresso');
95
+	protected function __construct($timezone) {
96
+		$this->singular_item = __('Registration', 'event_espresso');
97
+		$this->plural_item = __('Registrations', 'event_espresso');
98 98
 
99 99
 		$this->_tables = array(
100
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
100
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
101 101
 		);
102 102
 		$this->_fields = array(
103 103
 			'Registration'=>array(
104
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
105
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID','event_espresso'), false, 0, 'Event'),
106
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
107
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
108
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
109
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, current_time('timestamp'), $timezone ),
111
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications','event_espresso'), false, 0),
112
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
113
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
114
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
115
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
116
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
117
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
118
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
119
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
104
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
105
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID', 'event_espresso'), false, 0, 'Event'),
106
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
107
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
108
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
109
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, current_time('timestamp'), $timezone),
111
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications', 'event_espresso'), false, 0),
112
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
113
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
114
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
115
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
116
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
117
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
118
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
119
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 			'Status'=>new EE_Belongs_To_Relation(),
128 128
 			'Answer'=>new EE_Has_Many_Relation(),
129 129
 			'Checkin'=>new EE_Has_Many_Relation(),
130
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
130
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
131 131
 		);
132 132
 		$this->_model_chain_to_wp_user = 'Event';
133 133
 
134
-		parent::__construct( $timezone );
134
+		parent::__construct($timezone);
135 135
 	}
136 136
 
137 137
 
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
 	 *		@param bool  $translated If true will return the values as singular localized strings
165 165
 	 *		@return array
166 166
 	 */
167
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
168
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
169
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
167
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
168
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
169
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
170 170
 	}
171 171
 
172 172
 
@@ -177,19 +177,19 @@  discard block
 block discarded – undo
177 177
 	 * @param array $exclude
178 178
 	 * @return array
179 179
 	 */
180
-	private function _get_registration_status_array( $exclude = array() ) {
180
+	private function _get_registration_status_array($exclude = array()) {
181 181
 		//in the very rare circumstance that we are deleting a model's table's data
182 182
 		//and the table hasn't actually been created, this could have an error
183 183
 		/** @type WPDB $wpdb */
184 184
 		global $wpdb;
185
-		EE_Registry::instance()->load_helper( 'Activation' );
186
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
187
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
188
-			$results = $wpdb->get_results( $SQL );
185
+		EE_Registry::instance()->load_helper('Activation');
186
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
187
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
188
+			$results = $wpdb->get_results($SQL);
189 189
 			self::$_reg_status = array();
190
-			foreach ( $results as $status ) {
191
-				if ( ! in_array( $status->STS_ID, $exclude )) {
192
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
190
+			foreach ($results as $status) {
191
+				if ( ! in_array($status->STS_ID, $exclude)) {
192
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
193 193
 				}
194 194
 			}
195 195
 		}
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
205 205
 	 * @return wpdb results array
206 206
 	 */
207
-	public function get_reg_months_and_years( $where_params ) {
207
+	public function get_reg_months_and_years($where_params) {
208 208
 		$query_params[0] = $where_params;
209 209
 		$query_params['group_by'] = array('reg_year', 'reg_month');
210
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
210
+		$query_params['order_by'] = array('REG_date' => 'DESC');
211 211
 		$columns_to_select = array(
212 212
 			'reg_year' => array('YEAR(REG_date)', '%s'),
213 213
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
214 214
 			);
215
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
215
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
216 216
 	}
217 217
 
218 218
 
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 	* 		@param		int		$ATT_ID
225 225
 	*		@return 	EE_Registration[]
226 226
 	*/
227
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
228
-		if ( ! $ATT_ID ) {
227
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
228
+		if ( ! $ATT_ID) {
229 229
 			return FALSE;
230 230
 		}
231
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
231
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
232 232
 	}
233 233
 
234 234
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param string $REG_url_link
240 240
 	 * @return EE_Registration
241 241
 	 */
242
-	public function get_registration_for_reg_url_link($REG_url_link){
243
-		if(!$REG_url_link){
242
+	public function get_registration_for_reg_url_link($REG_url_link) {
243
+		if ( ! $REG_url_link) {
244 244
 			return false;
245 245
 		}
246 246
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
259 259
 	*		@return 		mixed		array on success, FALSE on fail
260 260
 	*/
261
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
261
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
262 262
 		return $this->get_one(array(
263 263
 			array(
264 264
 				'TXN_ID'=>$TXN_ID,
265 265
 				'ATT_ID'=>$ATT_ID
266 266
 			),
267
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
267
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
268 268
 		));
269 269
 	}
270 270
 
@@ -276,13 +276,13 @@  discard block
 block discarded – undo
276 276
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
277 277
 	 *		@return stdClass[] with properties regDate and total
278 278
 	*/
279
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
279
+	public function get_registrations_per_day_report($period = '-1 month') {
280 280
 		$sql_date = date("Y-m-d H:i:s", strtotime($period));
281 281
 
282 282
 		//don't include incomplete regs by default
283
-		$where = array('REG_date'=>array('>=',$sql_date), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
283
+		$where = array('REG_date'=>array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
284 284
 
285
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
285
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
286 286
 			$where['Event.EVT_wp_user'] = get_current_user_id();
287 287
 		}
288 288
 
@@ -294,8 +294,8 @@  discard block
 block discarded – undo
294 294
 				),
295 295
 				OBJECT,
296 296
 				array(
297
-					'regDate'=>array('DATE(Registration.REG_date)','%s'),
298
-					'total'=>array('count(REG_ID)','%d')
297
+					'regDate'=>array('DATE(Registration.REG_date)', '%s'),
298
+					'total'=>array('count(REG_ID)', '%d')
299 299
 				));
300 300
 		return $results;
301 301
 	}
@@ -310,24 +310,24 @@  discard block
 block discarded – undo
310 310
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
311 311
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
312 312
 	*/
313
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
313
+	public function get_registrations_per_event_report($period = '-1 month') {
314 314
 		$date_sql = date("Y-m-d H:i:s", strtotime($period));
315 315
 
316 316
 		//do not include incomplete registrations by default
317 317
 
318
-		$where = array( 'REG_date'=>array('>=',$date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
319
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
318
+		$where = array('REG_date'=>array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
319
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
320 320
 			$where['Event.EVT_wp_user'] = get_current_user_id();
321 321
 		}
322 322
 		$results = $this->_get_all_wpdb_results(array(
323 323
 			$where,
324 324
 			'group_by'=>'Event.EVT_name',
325 325
 			'order_by'=>'Event.EVT_name',
326
-			'limit'=>array(0,24)),
326
+			'limit'=>array(0, 24)),
327 327
 			OBJECT,
328 328
 			array(
329
-				'event_name'=>array('Event_CPT.post_title','%s'),
330
-				'total'=>array('COUNT(REG_ID)','%s')
329
+				'event_name'=>array('Event_CPT.post_title', '%s'),
330
+				'total'=>array('COUNT(REG_ID)', '%s')
331 331
 			)
332 332
 		);
333 333
 
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
 	 * @param int $TXN_ID
342 342
 	 * @return EE_Registration
343 343
 	 */
344
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
345
-		if( ! $TXN_ID ){
344
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
345
+		if ( ! $TXN_ID) {
346 346
 			return false;
347 347
 		}
348
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
348
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
349 349
 	}
350 350
 
351 351
 
@@ -357,11 +357,11 @@  discard block
 block discarded – undo
357 357
 	 *		@param boolean $for_incomplete_payments
358 358
 	 *		@return int
359 359
 	 */
360
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
360
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
361 361
 		// we only count approved registrations towards registration limits
362
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
363
-		if( $for_incomplete_payments ){
364
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
362
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
363
+		if ($for_incomplete_payments) {
364
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
365 365
 		}
366 366
 
367 367
 		return $this->count($query_params);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 		/** @type WPDB $wpdb */
378 378
 		global $wpdb;
379 379
 		return $wpdb->query(
380
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
380
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
381 381
 	}
382 382
 
383 383
 
Please login to merge, or discard this patch.
core/db_models/EEM_Registration_Payment.model.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
 	protected static $_instance = NULL;
16 16
 
17 17
 
18
-	protected function __construct( $timezone = NULL ) {
18
+	protected function __construct($timezone = NULL) {
19 19
 
20
-		$this->singular_item = __( 'Registration Payment', 'event_espresso' );
21
-		$this->plural_item 	= __( 'Registration Payments', 'event_espresso' );
20
+		$this->singular_item = __('Registration Payment', 'event_espresso');
21
+		$this->plural_item = __('Registration Payments', 'event_espresso');
22 22
 
23 23
 		$this->_tables = array(
24
-			'Registration_Payment' => new EE_Primary_Table( 'esp_registration_payment', 'RPY_ID' )
24
+			'Registration_Payment' => new EE_Primary_Table('esp_registration_payment', 'RPY_ID')
25 25
 		);
26 26
 
27 27
 		$this->_fields = array(
28 28
 			'Registration_Payment'=>array(
29
-				'RPY_ID' 				=> new EE_Primary_Key_Int_Field( 'RPY_ID', __( 'Registration Payment ID', 'event_espresso' )),
30
-				'REG_ID' 				=> new EE_Foreign_Key_Int_Field( 'REG_ID', __( 'Registration ID', 'event_espresso' ), false, 0, 'Registration' ),
31
-				'PAY_ID' 				=> new EE_Foreign_Key_Int_Field( 'PAY_ID', __( 'Payment ID', 'event_espresso' ), true, null, 'Payment' ),
32
-				'RPY_amount' 	=> new EE_Money_Field( 'RPY_amount', __( 'Amount attributed to the registration', 'event_espresso' ), false, 0 ),
29
+				'RPY_ID' 				=> new EE_Primary_Key_Int_Field('RPY_ID', __('Registration Payment ID', 'event_espresso')),
30
+				'REG_ID' 				=> new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'),
31
+				'PAY_ID' 				=> new EE_Foreign_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso'), true, null, 'Payment'),
32
+				'RPY_amount' 	=> new EE_Money_Field('RPY_amount', __('Amount attributed to the registration', 'event_espresso'), false, 0),
33 33
 			)
34 34
 		);
35 35
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 			'Payment' 		=> new EE_Belongs_To_Relation(),
39 39
 		);
40 40
 
41
-		parent::__construct( $timezone );
41
+		parent::__construct($timezone);
42 42
 	}
43 43
 
44 44
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Soft_Delete_Base.model.php 3 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once( EE_MODELS . 'EEM_Base.model.php');
2
+require_once(EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  * EEM_Soft_Delete_Base
5 5
  *
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
  * @subpackage		includes/models/
26 26
  * @author				Michael Nelson
27 27
  */
28
-abstract class EEM_Soft_Delete_Base extends EEM_Base{
28
+abstract class EEM_Soft_Delete_Base extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * @param null $timezone
32 32
 	 */
33 33
 	protected function __construct($timezone = NULL) {
34
-		require_once( EE_MODELS . 'strategies/EE_Soft_Delete_Where_Conditions.strategy.php');
35
-		if( ! $this->_default_where_conditions_strategy){
34
+		require_once(EE_MODELS.'strategies/EE_Soft_Delete_Where_Conditions.strategy.php');
35
+		if ( ! $this->_default_where_conditions_strategy) {
36 36
 			$this->_default_where_conditions_strategy = new EE_Soft_Delete_Where_Conditions();
37 37
 		}
38 38
 		parent::__construct($timezone);
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 * @return string
44 44
 	 * @throws EE_Error
45 45
 	 */
46
-	public function deleted_field_name(){
46
+	public function deleted_field_name() {
47 47
 		$field = $this->get_a_field_of_type('EE_Trashed_Flag_Field');
48
-		if($field){
48
+		if ($field) {
49 49
 			return $field->get_name();
50
-		}else{
51
-			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this)));
50
+		} else {
51
+			throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this)));
52 52
 		}
53 53
 	}
54 54
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param array $query_params like EEM_Base::get_all
60 60
 	 * @return EE_Soft_Delete_Base_Class[]
61 61
 	 */
62
-	public function get_all($query_params = array()){
62
+	public function get_all($query_params = array()) {
63 63
 		return parent::get_all($query_params);
64 64
 	}
65 65
 
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	 * @param array $query_params like EEM_Base::get_all's $query_params
70 70
 	 * @return EE_Soft_Delete_Base_Class
71 71
 	 */
72
-	public function get_one($query_params = array()){
72
+	public function get_one($query_params = array()) {
73 73
 		return parent::get_one($query_params);
74 74
 	}
75 75
 	/**
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @param array $query_params like EEM_Base::get_all's $query_params
78 78
 	 * @return EE_Soft_Delete_Base_Class
79 79
 	 */
80
-	public function get_one_deleted($query_params = array()){
80
+	public function get_one_deleted($query_params = array()) {
81 81
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
82 82
 		return parent::get_one($query_params);
83 83
 	}
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @param array $query_params like EEM_base::get_all's $query_params
88 88
 	 * @return EE_Soft_Delete_Base_Class
89 89
 	 */
90
-	public function get_one_deleted_or_undeleted($query_params = array()){
90
+	public function get_one_deleted_or_undeleted($query_params = array()) {
91 91
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
92 92
 		return parent::get_one($query_params);
93 93
 	}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 * @param int|string $id
109 109
 	 * @return EE_Soft_Delete_Base_Class
110 110
 	 */
111
-	public function get_one_by_ID_but_ignore_deleted($id){
111
+	public function get_one_by_ID_but_ignore_deleted($id) {
112 112
 		return parent::get_one_by_ID($id);
113 113
 	}
114 114
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param boolean $distinct
120 120
 	 * @return int count
121 121
 	 */
122
-	public function count($query_params = array(), $field_to_count = null, $distinct = false){
122
+	public function count($query_params = array(), $field_to_count = null, $distinct = false) {
123 123
 		//just calls parent, but changes PHP docs for this function
124 124
 		return parent::count($query_params, $field_to_count, $distinct);
125 125
 	}
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
132 132
 	 * @return int
133 133
 	 */
134
-	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE){
134
+	public function count_deleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
135 135
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
136 136
 		return parent::count($query_params, $field_to_count, $distinct);
137 137
 	}
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	 * @param array $query_params like EEM_Base::get_all's $query_params
142 142
 	 * @return array like EEM_Base::get_all's $query_params
143 143
 	 */
144
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
145
-		$deletedFlagFieldName=$this->deleted_field_name();
146
-		$query_params[0][$deletedFlagFieldName]=true;
144
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
145
+		$deletedFlagFieldName = $this->deleted_field_name();
146
+		$query_params[0][$deletedFlagFieldName] = true;
147 147
 		return $query_params;
148 148
 	}
149 149
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @param array $query_params
153 153
 	 * @return array
154 154
 	 */
155
-	public function alter_query_params_so_deleted_and_undeleted_items_included( $query_params = array() ){
155
+	public function alter_query_params_so_deleted_and_undeleted_items_included($query_params = array()) {
156 156
 		return $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
157 157
 	}
158 158
 
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 	 * @param array $query_params
162 162
 	 * @return array
163 163
 	 */
164
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
164
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
165 165
 		$query_params['default_where_conditions'] = 'other_models_only';
166 166
 		return $query_params;
167 167
 	}
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 	 * @param bool 	 $distinct if we want to only count the distinct values for the column then you can trigger that by the setting $distinct to TRUE;
174 174
 	 * @return int
175 175
 	 */
176
-	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE){
176
+	public function count_deleted_and_undeleted($query_params = null, $field_to_count = null, $distinct = FALSE) {
177 177
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
178
-		return parent::count($query_params,$field_to_count, $distinct);
178
+		return parent::count($query_params, $field_to_count, $distinct);
179 179
 	}
180 180
 
181 181
 	/**
@@ -184,9 +184,9 @@  discard block
 block discarded – undo
184 184
 	 * @param string $field_to_sum name of field
185 185
 	 * @return int count
186 186
 	 */
187
-	public function sum($query_params =null,$field_to_sum= null){
187
+	public function sum($query_params = null, $field_to_sum = null) {
188 188
 		//just calls parent, but changes PHP doc
189
-		return parent::sum($query_params,$field_to_sum);
189
+		return parent::sum($query_params, $field_to_sum);
190 190
 	}
191 191
 
192 192
 
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @param string $field_to_sum
197 197
 	 * @return int
198 198
 	 */
199
-	public function sum_deleted($query_params = null, $field_to_sum = null){
199
+	public function sum_deleted($query_params = null, $field_to_sum = null) {
200 200
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
201 201
 		return parent::sum($query_params, $field_to_sum);
202 202
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param string $field_to_sum
208 208
 	 * @reutrn int
209 209
 	 */
210
-	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null){
210
+	public function sum_deleted_and_undeleted($query_params = null, $field_to_sum = null) {
211 211
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
212 212
 		parent::sum($query_params, $field_to_sum);
213 213
 	}
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
 	 * @param array $query_params like EEM_Base::get_all
218 218
 	 * @return EE_Soft_Delete_Base_Class[]
219 219
 	 */
220
-	public function get_all_deleted_and_undeleted($query_params = array()){
220
+	public function get_all_deleted_and_undeleted($query_params = array()) {
221 221
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
222 222
 		return parent::get_all($query_params);
223 223
 	}
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 	 * @param array $query_params like EEM_Base::get_all
228 228
 	 * @return EE_Soft_Delete_Base_Class[]
229 229
 	 */
230
-	public function get_all_deleted($query_params = array()){
230
+	public function get_all_deleted($query_params = array()) {
231 231
 		$query_params = $this->_alter_query_params_so_only_trashed_items_included($query_params);
232 232
 		return parent::get_all($query_params);
233 233
 	}
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
246 246
 	 * @return boolean success
247 247
 	 */
248
-	public function delete_permanently($query_params = array(), $allow_blocking = true){
248
+	public function delete_permanently($query_params = array(), $allow_blocking = true) {
249 249
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
250 250
 		return parent::delete($query_params, $allow_blocking);
251 251
 	}
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
261 261
 	 * @return boolean success
262 262
 	 */
263
-	public function delete_permanently_by_ID($ID=FALSE, $allow_blocking = true){
263
+	public function delete_permanently_by_ID($ID = FALSE, $allow_blocking = true) {
264 264
 		$query_params = array();
265 265
 		$query_params[0] = array($this->get_primary_key_field()->get_name() => $ID);
266 266
 		$query_params['limit'] = 1;
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 	 * @param mixed $ID value of the primary_key or primary_text_key
275 275
 	 * @return boolean success
276 276
 	 */
277
-	public function delete_by_ID($ID){
278
-		return $this->delete_or_restore_by_ID(true,$ID);
277
+	public function delete_by_ID($ID) {
278
+		return $this->delete_or_restore_by_ID(true, $ID);
279 279
 	}
280 280
 	/**
281 281
 	 * Restores a particular item by its ID (primary key). Ignores the fact whether the item
@@ -283,8 +283,8 @@  discard block
 block discarded – undo
283 283
 	 * @param mixed $ID int if primary key is an int, string otherwise
284 284
 	 * @return boolean success
285 285
 	 */
286
-	public function restore_by_ID($ID=FALSE){
287
-		return $this->delete_or_restore_by_ID(false,$ID);
286
+	public function restore_by_ID($ID = FALSE) {
287
+		return $this->delete_or_restore_by_ID(false, $ID);
288 288
 	}
289 289
 	/**
290 290
 	 * For deleting or restoring a particular item. Note that this model is a SOFT-DELETABLE model! However,
@@ -293,15 +293,15 @@  discard block
 block discarded – undo
293 293
 	 * @param mixed $ID int if primary key is an int, string otherwise
294 294
 	 * @return boolean
295 295
 	 */
296
-	public function delete_or_restore_by_ID($delete=true,$ID=FALSE){
297
-		if ( ! $ID ) {
296
+	public function delete_or_restore_by_ID($delete = true, $ID = FALSE) {
297
+		if ( ! $ID) {
298 298
 			return FALSE;
299 299
 		}
300
-		$primaryKeyName=$this->primary_key_name();
300
+		$primaryKeyName = $this->primary_key_name();
301 301
 		// retrieve a particular transaction
302 302
 		$query_params = array();
303
-		$query_params[0] = array( $primaryKeyName => $ID );
304
-		if ( $this->delete_or_restore ($delete, $query_params )) {
303
+		$query_params[0] = array($primaryKeyName => $ID);
304
+		if ($this->delete_or_restore($delete, $query_params)) {
305 305
 			return TRUE;
306 306
 		} else {
307 307
 			return FALSE;
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @param bool  $block_deletes
320 320
 	 * @return boolean
321 321
 	 */
322
-	public function delete($query_params = array(), $block_deletes = false){
322
+	public function delete($query_params = array(), $block_deletes = false) {
323 323
 		//no matter what, we WON'T block soft deletes.
324 324
 		return $this->delete_or_restore(true, $query_params);
325 325
 	}
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 	 * @param array $query_params like EEM_Base::get_all
331 331
 	 * @return boolean
332 332
 	 */
333
-	public function restore($query_params = array()){
333
+	public function restore($query_params = array()) {
334 334
 		return $this->delete_or_restore(false, $query_params);
335 335
 	}
336 336
 	/**
@@ -339,10 +339,10 @@  discard block
 block discarded – undo
339 339
 	 * @param array $query_params like EEM_Base::get_all
340 340
 	 * @return boolean
341 341
 	 */
342
-	function delete_or_restore($delete=true,$query_params = array()){
343
-		$deletedFlagFieldName=$this->deleted_field_name();
342
+	function delete_or_restore($delete = true, $query_params = array()) {
343
+		$deletedFlagFieldName = $this->deleted_field_name();
344 344
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
345
-		if ( $this->update (array($deletedFlagFieldName=>$delete), $query_params )) {
345
+		if ($this->update(array($deletedFlagFieldName=>$delete), $query_params)) {
346 346
 			return TRUE;
347 347
 		} else {
348 348
 			return FALSE;
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 	 * be aware that model objects being used could get out-of-sync with the database
361 361
 	 * @return int number of items updated
362 362
 	 */
363
-	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){
363
+	public function update_deleted_and_undeleted($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
364 364
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
365
-		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync );
365
+		return $this->update($fields_n_values, $query_params, $keep_model_objs_in_sync);
366 366
 	}
367 367
 
368 368
 	/**
@@ -377,8 +377,8 @@  discard block
 block discarded – undo
377 377
 	 * be aware that model objects being used could get out-of-sync with the database
378 378
 	 * @return int how many items were updated
379 379
 	 */
380
-	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE ){
381
-		return parent::update($fields_n_values,$query_params, $keep_model_objs_in_sync );
380
+	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
381
+		return parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync);
382 382
 	}
383 383
 
384 384
 
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 	 * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
244 244
 	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
245 245
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
246
-	 * @return boolean success
246
+	 * @return integer success
247 247
 	 */
248 248
 	public function delete_permanently($query_params = array(), $allow_blocking = true){
249 249
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
259 259
 	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
260 260
 	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
261
-	 * @return boolean success
261
+	 * @return integer success
262 262
 	 */
263 263
 	public function delete_permanently_by_ID($ID=FALSE, $allow_blocking = true){
264 264
 		$query_params = array();
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	/**
353 353
 	 * Updates all the items of this model which match the $query params, regardless of whether
354 354
 	 * they've been soft-deleted or not
355
-	 * @param array $field_n_values like EEM_Base::update's $fields_n_value
355
+	 * @param array $fields_n_values like EEM_Base::update's $fields_n_value
356 356
 	 * @param array $query_params like EEM_base::get_all's $query_params
357 357
 	 * @param boolean $keep_model_objs_in_sync if TRUE, makes sure we ALSO update model objects
358 358
 	 * in this model's entity map according to $fields_n_values that match $query_params. This
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Status.model.php 3 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	public function localized_status(  $statuses, $plural = FALSE, $schema = 'upper' ) {
79 79
 		//note these are all in lower case because ucwords() on upper case will NOT convert.
80 80
 		$translation_array = array(
81
-	     	EEM_Registration::status_id_pending_payment => array(
81
+		 	EEM_Registration::status_id_pending_payment => array(
82 82
 				__('pending payment', 'event_espresso'), //singular
83 83
 				__('pending payments', 'event_espresso') //plural
84 84
 				),
@@ -203,37 +203,37 @@  discard block
 block discarded – undo
203 203
 	  			__('postponed', 'event_espresso'),
204 204
 	  			__('postponed', 'event_espresso')
205 205
 	  			)
206
-	    );
206
+		);
207 207
 
208 208
 		$translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array );
209 209
 
210 210
 		if ( !is_array($statuses) )
211 211
 			throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') );
212 212
 
213
-	    $translation = array();
213
+		$translation = array();
214 214
 
215
-	    foreach ( $statuses as $id => $code ) {
216
-	    	if ( isset( $translation_array[$id] ) ) {
217
-	    		$translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0];
218
-	    	} else {
219
-	    		$translation[$id] = $code;
220
-	    	}
215
+		foreach ( $statuses as $id => $code ) {
216
+			if ( isset( $translation_array[$id] ) ) {
217
+				$translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0];
218
+			} else {
219
+				$translation[$id] = $code;
220
+			}
221 221
 
222
-	    	//schema
223
-	    	switch ( $schema ) {
224
-	    		case 'lower' :
225
-	    			$translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter.
226
-	    			break;
227
-	    		case 'sentence' :
228
-	    			$translation[$id] = ucwords( $translation[$id] );
229
-	    			break;
230
-	    		case 'upper' :
231
-	    			$translation[$id] = strtoupper( $translation[$id] );
232
-	    			break;
233
-	    	}
234
-	    }
222
+			//schema
223
+			switch ( $schema ) {
224
+				case 'lower' :
225
+					$translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter.
226
+					break;
227
+				case 'sentence' :
228
+					$translation[$id] = ucwords( $translation[$id] );
229
+					break;
230
+				case 'upper' :
231
+					$translation[$id] = strtoupper( $translation[$id] );
232
+					break;
233
+			}
234
+		}
235 235
 
236
-	    return $translation;
236
+		return $translation;
237 237
 	}
238 238
 
239 239
 
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * ------------------------------------------------------------------------
15 15
  */
16
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
16
+require_once (EE_MODELS.'EEM_Base.model.php');
17 17
 /**
18 18
  *
19 19
  * Class EEM_Status
@@ -32,27 +32,27 @@  discard block
 block discarded – undo
32 32
 	/**
33 33
 	 * @return EEM_Status
34 34
 	 */
35
-	protected function __construct( $timezone = NULL ) {
36
-		$this->singular_item = __('Status','event_espresso');
37
-		$this->plural_item = __('Stati','event_espresso');
35
+	protected function __construct($timezone = NULL) {
36
+		$this->singular_item = __('Status', 'event_espresso');
37
+		$this->plural_item = __('Stati', 'event_espresso');
38 38
 		$this->_tables = array(
39 39
 			'Status'=> new EE_Primary_Table('esp_status', 'STS_ID')
40 40
 		);
41 41
 		$this->_fields = array(
42 42
 			'Status'=>array(
43
-				'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID','event_espresso')),
44
-				'STS_code'=>new EE_Plain_Text_Field('STS_code',__('Status Code','event_espresso'),false, ''),
43
+				'STS_ID'=> new EE_Primary_Key_String_Field('STS_ID', __('Status ID', 'event_espresso')),
44
+				'STS_code'=>new EE_Plain_Text_Field('STS_code', __('Status Code', 'event_espresso'), false, ''),
45 45
 				'STS_type'=>new EE_Enum_Text_Field('STS_type', __("Type", "event_espresso"), false, 'event',
46 46
 						array(
47
-							'event'=> __("Event", "event_espresso"),//deprecated
47
+							'event'=> __("Event", "event_espresso"), //deprecated
48 48
 							'registration'=>  __("Registration", "event_espresso"),
49 49
 							'transaction'=>  __("Transaction", "event_espresso"),
50 50
 							'payment'=>  __("Payment", "event_espresso"),
51 51
 							'email'=>  __("Email", "event_espresso")
52 52
 						)),
53
-				'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?','event_espresso'), false),
53
+				'STS_can_edit'=>new EE_Boolean_Field('STS_can_edit', __('Editable?', 'event_espresso'), false),
54 54
 				'STS_desc'=>new EE_Simple_HTML_Field('STS_desc', __("Description", "event_espresso"), false, ''),
55
-				'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false,false)
55
+				'STS_open'=>new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false, false)
56 56
 			));
57 57
 		$this->_model_relations = array(
58 58
 			'Registration'=>new EE_Has_Many_Relation(),
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 			'Payment'=>new EE_Has_Many_Relation()
61 61
 		);
62 62
 		//this model is generally available for reading
63
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
63
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
64 64
 
65
-		parent::__construct( $timezone );
65
+		parent::__construct($timezone);
66 66
 	}
67 67
 
68 68
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @throws EE_Error
76 76
 	 * @return array             an array of translated strings for the incoming status id.
77 77
 	 */
78
-	public function localized_status(  $statuses, $plural = FALSE, $schema = 'upper' ) {
78
+	public function localized_status($statuses, $plural = FALSE, $schema = 'upper') {
79 79
 		//note these are all in lower case because ucwords() on upper case will NOT convert.
80 80
 		$translation_array = array(
81 81
 	     	EEM_Registration::status_id_pending_payment => array(
@@ -205,30 +205,30 @@  discard block
 block discarded – undo
205 205
 	  			)
206 206
 	    );
207 207
 
208
-		$translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array );
208
+		$translation_array = apply_filters('FHEE__EEM_Status__localized_status__translation_array', $translation_array);
209 209
 
210
-		if ( !is_array($statuses) )
211
-			throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') );
210
+		if ( ! is_array($statuses))
211
+			throw new EE_Error(__('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso'));
212 212
 
213 213
 	    $translation = array();
214 214
 
215
-	    foreach ( $statuses as $id => $code ) {
216
-	    	if ( isset( $translation_array[$id] ) ) {
215
+	    foreach ($statuses as $id => $code) {
216
+	    	if (isset($translation_array[$id])) {
217 217
 	    		$translation[$id] = $plural ? $translation_array[$id][1] : $translation_array[$id][0];
218 218
 	    	} else {
219 219
 	    		$translation[$id] = $code;
220 220
 	    	}
221 221
 
222 222
 	    	//schema
223
-	    	switch ( $schema ) {
223
+	    	switch ($schema) {
224 224
 	    		case 'lower' :
225
-	    			$translation[$id] = strtolower( $translation[$id] ); //even though these start in lower case, this will catch any statuses added via filter.
225
+	    			$translation[$id] = strtolower($translation[$id]); //even though these start in lower case, this will catch any statuses added via filter.
226 226
 	    			break;
227 227
 	    		case 'sentence' :
228
-	    			$translation[$id] = ucwords( $translation[$id] );
228
+	    			$translation[$id] = ucwords($translation[$id]);
229 229
 	    			break;
230 230
 	    		case 'upper' :
231
-	    			$translation[$id] = strtoupper( $translation[$id] );
231
+	    			$translation[$id] = strtoupper($translation[$id]);
232 232
 	    			break;
233 233
 	    	}
234 234
 	    }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -207,8 +209,9 @@  discard block
 block discarded – undo
207 209
 
208 210
 		$translation_array = apply_filters( 'FHEE__EEM_Status__localized_status__translation_array', $translation_array );
209 211
 
210
-		if ( !is_array($statuses) )
211
-			throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') );
212
+		if ( !is_array($statuses) ) {
213
+					throw new EE_Error( __('The incoming statuses argument must be an array with keys as the $status_id and values as the $status_code', 'event_espresso') );
214
+		}
212 215
 
213 216
 	    $translation = array();
214 217
 
Please login to merge, or discard this patch.
core/db_models/EEM_Term.model.php 2 patches
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 
4 4
 /**
5 5
  *
@@ -20,58 +20,58 @@  discard block
 block discarded – undo
20 20
 	/**
21 21
 	 *__construct
22 22
 	 */
23
-	protected function __construct( $timezone = NULL ) {
24
-		$this->singular_item = __('Term','event_espresso');
25
-		$this->plural_item = __('Terms','event_espresso');
23
+	protected function __construct($timezone = NULL) {
24
+		$this->singular_item = __('Term', 'event_espresso');
25
+		$this->plural_item = __('Terms', 'event_espresso');
26 26
 		$this->_tables = array(
27 27
 			'Term'=> new EE_Primary_Table('terms', 'term_id')
28 28
 		);
29 29
 		$this->_fields = array(
30 30
 			'Term'=>array(
31
-				'term_id'=> new EE_Primary_Key_Int_Field('term_id', __('Term ID','event_espresso')),
32
-				'name'=>new EE_Plain_Text_Field('name',__('Term Name','event_espresso'),false, ''),
33
-				'slug'=>new EE_Slug_Field('slug', __('Term Slug','event_espresso'), false),
31
+				'term_id'=> new EE_Primary_Key_Int_Field('term_id', __('Term ID', 'event_espresso')),
32
+				'name'=>new EE_Plain_Text_Field('name', __('Term Name', 'event_espresso'), false, ''),
33
+				'slug'=>new EE_Slug_Field('slug', __('Term Slug', 'event_espresso'), false),
34 34
 				'term_group'=>new EE_Integer_Field('term_group', __("Term Group", "event_espresso"), false, 0)
35 35
 			));
36 36
 		$this->_model_relations = array(
37 37
 			'Term_Taxonomy'=>new EE_Has_Many_Relation(),
38 38
 		);
39 39
 		$path_to_tax_model = 'Term_Taxonomy';
40
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
41
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
42
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
43
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
40
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
41
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
42
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
43
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
44 44
 
45
-		$path_to_tax_model = $path_to_tax_model . '.';
45
+		$path_to_tax_model = $path_to_tax_model.'.';
46 46
 		//add cap restrictions for editing relating to the "ee_edit_*"
47
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
47
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
48 48
 				array(
49
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
49
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
50 50
 				));
51
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
51
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
52 52
 				array(
53
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
53
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
54 54
 				));
55
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
55
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
56 56
 				array(
57
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
57
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
58 58
 				));
59 59
 
60 60
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
61
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
61
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
62 62
 				array(
63
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
63
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
64 64
 				));
65
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
65
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
66 66
 				array(
67
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
67
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
68 68
 				));
69
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
69
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
70 70
 				array(
71
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
71
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
72 72
 				));
73 73
 
74
-		parent::__construct( $timezone );
74
+		parent::__construct($timezone);
75 75
 	}
76 76
 
77 77
 
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
 	 *
83 83
 	 * @access public
84 84
 	 */
85
-	public function get_all_ee_categories( $show_uncategorized = FALSE ) {
85
+	public function get_all_ee_categories($show_uncategorized = FALSE) {
86 86
 
87 87
 		$where_params = array(
88 88
 			'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
89
-			'NOT' => array( 'name' => __( 'Uncategorized', 'event_espresso' ))
89
+			'NOT' => array('name' => __('Uncategorized', 'event_espresso'))
90 90
 		);
91 91
 
92
-		if ( $show_uncategorized ) {
93
-			unset( $where_params['NOT'] );
92
+		if ($show_uncategorized) {
93
+			unset($where_params['NOT']);
94 94
 		}
95 95
 
96
-	 	return EEM_Term::instance()->get_all( array(
96
+	 	return EEM_Term::instance()->get_all(array(
97 97
 			$where_params,
98
-			'order_by' => array( 'name' => 'ASC' )
98
+			'order_by' => array('name' => 'ASC')
99 99
 		));
100 100
 	}
101 101
 
@@ -108,8 +108,8 @@  discard block
 block discarded – undo
108 108
 	 * @param string $post_type
109 109
 	 * @return array
110 110
 	 */
111
-	public function get_all_CPT_post_tags( $post_type = '' ) {
112
-		switch( $post_type ) {
111
+	public function get_all_CPT_post_tags($post_type = '') {
112
+		switch ($post_type) {
113 113
 			case 'espresso_events' :
114 114
 				return $this->get_all_event_post_tags();
115 115
 				break;
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 			default :
120 120
 				$event_tags = $this->get_all_event_post_tags();
121 121
 				$venue_tags = $this->get_all_venue_post_tags();
122
-				return array_merge( $event_tags, $venue_tags );
122
+				return array_merge($event_tags, $venue_tags);
123 123
 		}
124 124
 		return array();
125 125
 	}
@@ -132,19 +132,19 @@  discard block
 block discarded – undo
132 132
 	 * @return EE_Soft_Delete_Base_Class[]
133 133
 	 */
134 134
 	public function get_all_event_post_tags() {
135
-	 	$post_tags = EEM_Term::instance()->get_all( array(
135
+	 	$post_tags = EEM_Term::instance()->get_all(array(
136 136
 			array(
137 137
 				'Term_Taxonomy.taxonomy' => 'post_tag',
138 138
 				'Term_Taxonomy.Event.post_type' => 'espresso_events',
139 139
 			),
140
-			'order_by' => array( 'name' => 'ASC' ),
141
-			'force_join' => array( 'Term_Taxonomy.Event' )
140
+			'order_by' => array('name' => 'ASC'),
141
+			'force_join' => array('Term_Taxonomy.Event')
142 142
 		));
143
-		foreach ( $post_tags as $key => $post_tag ) {
144
-			if ( ! isset( $post_tags[ $key ]->post_type )) {
145
-				$post_tags[ $key ]->post_type = array();
143
+		foreach ($post_tags as $key => $post_tag) {
144
+			if ( ! isset($post_tags[$key]->post_type)) {
145
+				$post_tags[$key]->post_type = array();
146 146
 			}
147
-			$post_tags[ $key ]->post_type[] = 'espresso_events';
147
+			$post_tags[$key]->post_type[] = 'espresso_events';
148 148
 		}
149 149
 		return $post_tags;
150 150
 //		return array( 'espresso_events' => $post_tags );
@@ -158,19 +158,19 @@  discard block
 block discarded – undo
158 158
 	 * @return EE_Soft_Delete_Base_Class[]
159 159
 	 */
160 160
 	public function get_all_venue_post_tags() {
161
-		$post_tags = EEM_Term::instance()->get_all( array(
161
+		$post_tags = EEM_Term::instance()->get_all(array(
162 162
 			array(
163 163
 				'Term_Taxonomy.taxonomy' => 'post_tag',
164 164
 				'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
165 165
 			),
166
-			'order_by' => array( 'name' => 'ASC' ),
167
-			'force_join' => array( 'Term_Taxonomy' )
166
+			'order_by' => array('name' => 'ASC'),
167
+			'force_join' => array('Term_Taxonomy')
168 168
 		));
169
-		foreach ( $post_tags as $key => $post_tag ) {
170
-			if ( ! isset( $post_tags[ $key ]->post_type )) {
171
-				$post_tags[ $key ]->post_type = array();
169
+		foreach ($post_tags as $key => $post_tag) {
170
+			if ( ! isset($post_tags[$key]->post_type)) {
171
+				$post_tags[$key]->post_type = array();
172 172
 			}
173
-			$post_tags[ $key ]->post_type[] = 'espresso_venues';
173
+			$post_tags[$key]->post_type[] = 'espresso_venues';
174 174
 		}
175 175
 		return $post_tags;
176 176
 //		return array( 'espresso_venues' => $post_tags );
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Relationship.model.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -21,24 +21,24 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Relationship extends EEM_Base {
27 27
 
28 28
   	// private instance of the Attendee object
29 29
 	protected static $_instance = NULL;
30 30
 
31
-	protected function __construct( $timezone = NULL ) {
32
-		$this->singular_item = __('Term Relationship','event_espresso');
33
-		$this->plural_item = __('Term Relationships','event_espresso');
31
+	protected function __construct($timezone = NULL) {
32
+		$this->singular_item = __('Term Relationship', 'event_espresso');
33
+		$this->plural_item = __('Term Relationships', 'event_espresso');
34 34
 		$this->_tables = array(
35 35
 			'Term_Relationship'=> new EE_Primary_Table('term_relationships')
36 36
 		);
37 37
 		$this->_fields = array(
38 38
 			'Term_Relationship'=>array(
39
-				'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID','event_espresso'), false,0,array('Event','Venue','Attendee')),
40
-				'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
41
-				'term_order'=>new EE_Integer_Field('term_order', __('Term Order','event_espresso'), false, 0)
39
+				'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID', 'event_espresso'), false, 0, array('Event', 'Venue', 'Attendee')),
40
+				'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID', 'event_espresso'), false, 0, 'Term_Taxonomy'),
41
+				'term_order'=>new EE_Integer_Field('term_order', __('Term Order', 'event_espresso'), false, 0)
42 42
 			));
43 43
 		$this->_model_relations = array(
44 44
 			'Event'=>new EE_Belongs_To_Relation(),
@@ -47,34 +47,34 @@  discard block
 block discarded – undo
47 47
 			'Term_Taxonomy'=>new EE_Belongs_To_Relation()
48 48
 		);
49 49
 		$this->_indexes = array(
50
-			'PRIMARY'=>new EE_Primary_Key_Index(array('object_id','term_taxonomy_id'))
50
+			'PRIMARY'=>new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id'))
51 51
 		);
52 52
 		$path_to_event_model = 'Event.';
53
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( $path_to_event_model );
54
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model );
55
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model );
56
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model, EEM_Base::caps_edit );
53
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event_model);
54
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
55
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
56
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model, EEM_Base::caps_edit);
57 57
 
58 58
 		$path_to_tax_model = 'Term_Taxonomy.';
59 59
 		//add cap restrictions for editing term relations to the "ee_assign_*"
60 60
 		//and for deleting term relations too
61
-		$cap_contexts_affected = array( EEM_Base::caps_edit, EEM_Base::caps_delete );
62
-		foreach( $cap_contexts_affected as $cap_context_affected ) {
63
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_category'] = new EE_Default_Where_Conditions(
61
+		$cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete);
62
+		foreach ($cap_contexts_affected as $cap_context_affected) {
63
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_event_category'] = new EE_Default_Where_Conditions(
64 64
 					array(
65
-						$path_to_tax_model . 'taxonomy*ee_assign_event_category' => array( '!=', 'espresso_event_categories' )
65
+						$path_to_tax_model.'taxonomy*ee_assign_event_category' => array('!=', 'espresso_event_categories')
66 66
 					));
67
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_venue_category'] = new EE_Default_Where_Conditions(
67
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_venue_category'] = new EE_Default_Where_Conditions(
68 68
 					array(
69
-						$path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array( '!=', 'espresso_venue_categories' )
69
+						$path_to_tax_model.'taxonomy*ee_assign_venue_category' => array('!=', 'espresso_venue_categories')
70 70
 					));
71
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_type'] = new EE_Default_Where_Conditions(
71
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_event_type'] = new EE_Default_Where_Conditions(
72 72
 					array(
73
-						$path_to_tax_model . 'taxonomy*ee_assign_event_type' => array( '!=', 'espresso_event_type' )
73
+						$path_to_tax_model.'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type')
74 74
 					));
75 75
 		}
76 76
 
77
-		parent::__construct( $timezone );
77
+		parent::__construct($timezone);
78 78
 	}
79 79
 
80 80
 	/**
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 	 * @global type $wpdb
84 84
 	 * @return int the number of rows affected
85 85
 	 */
86
-	public function update_term_taxonomy_counts($term_taxonomy_id = NULL){
86
+	public function update_term_taxonomy_counts($term_taxonomy_id = NULL) {
87 87
 		//because this uses a subquery and sometimes assigning to column to be another column's
88 88
 		//value, we just write the SQL directly.
89 89
 		global $wpdb;
90
-		if( $term_taxonomy_id ){
91
-			$second_operand = $wpdb->prepare('%d',$term_taxonomy_id);
92
-		}else{
90
+		if ($term_taxonomy_id) {
91
+			$second_operand = $wpdb->prepare('%d', $term_taxonomy_id);
92
+		} else {
93 93
 			$second_operand = 'tr.term_taxonomy_id';
94 94
 		}
95
-		$rows_affected = $this->_do_wpdb_query( 'query' , array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
96
-from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)" ) );
95
+		$rows_affected = $this->_do_wpdb_query('query', array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
96
+from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)"));
97 97
 		return $rows_affected;
98 98
 	}
99 99
 
@@ -105,8 +105,8 @@  discard block
 block discarded – undo
105 105
 	 */
106 106
 	public function insert($field_n_values) {
107 107
 		$return = parent::insert($field_n_values);
108
-		if( isset( $field_n_values[ 'term_taxonomy_id' ] ) ) {
109
-			$this->update_term_taxonomy_counts($field_n_values[ 'term_taxonomy_id' ] );
108
+		if (isset($field_n_values['term_taxonomy_id'])) {
109
+			$this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']);
110 110
 		}
111 111
 		return $return;
112 112
 	}
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @return int
123 123
 	 */
124 124
 	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
125
-		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync );
126
-		if( $count ){
125
+		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync);
126
+		if ($count) {
127 127
 			$this->update_term_taxonomy_counts();
128 128
 		}
129 129
 		return $count;
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 */
138 138
 	public function delete($query_params, $allow_blocking = true) {
139 139
 		$count = parent::delete($query_params, $allow_blocking);
140
-		if( $count ){
140
+		if ($count) {
141 141
 			$this->update_term_taxonomy_counts();
142 142
 		}
143 143
 		return $count;
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * EEH_URL helper
4 6
  * Helper class for URL-related PHP functions
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 				isset($results['response']['code']) &&
63 65
 				$results['response']['code'] == '200'){
64 66
 			return true;
65
-		}else{
67
+		} else{
66 68
 			return false;
67 69
 		}
68 70
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Taxonomy extends EEM_Base {
27 27
 
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
 	protected static $_instance = NULL;
30 30
 
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Term Taxonomy','event_espresso');
34
-		$this->plural_item = __('Term Taxonomy','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Term Taxonomy', 'event_espresso');
34
+		$this->plural_item = __('Term Taxonomy', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Term_Taxonomy'=>array(
40
-				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')),
41
-				'term_id'=>new EE_Foreign_Key_Int_Field('term_id',  __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'),
43
-				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''),
44
-				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0),
40
+				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')),
41
+				'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'),
43
+				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''),
44
+				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0),
45 45
 				'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)
46 46
 			));
47 47
 		$this->_model_relations = array(
@@ -52,43 +52,43 @@  discard block
 block discarded – undo
52 52
 			'Attendee'=>new EE_HABTM_Relation('Term_Relationship')
53 53
 		);
54 54
 		$this->_indexes = array(
55
-			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy'))
55
+			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy'))
56 56
 		);
57 57
 		$path_to_tax_model = '';
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
60
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
61
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
62 62
 
63 63
 		//add cap restrictions for editing relating to the "ee_edit_*"
64
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
64
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
65 65
 				array(
66
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
66
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
67 67
 				));
68
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
68
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
69 69
 				array(
70
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
70
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
71 71
 				));
72
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
72
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
73 73
 				array(
74
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
74
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
75 75
 				));
76 76
 
77 77
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
78
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
78
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
79 79
 				array(
80
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
80
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
81 81
 				));
82
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
82
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
83 83
 				array(
84
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
84
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
85 85
 				));
86
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
86
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
87 87
 				array(
88
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
88
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
89 89
 				));
90 90
 
91
-		parent::__construct( $timezone );
91
+		parent::__construct($timezone);
92 92
 	}
93 93
 
94 94
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket.model.php 2 patches
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -131,8 +133,9 @@  discard block
 block discarded – undo
131 133
 					'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold','%d'),//note! calculations based on TKT_qty are dangerous because -1 means infinity in the db!
132 134
 					'initially_available'=>array('Ticket.TKT_qty','%d')));
133 135
 
134
-		if ( empty( $remaining_per_ticket ) )
135
-			return FALSE;
136
+		if ( empty( $remaining_per_ticket ) ) {
137
+					return FALSE;
138
+		}
136 139
 
137 140
 
138 141
 		foreach($remaining_per_ticket as $remaining){
Please login to merge, or discard this patch.
Spacing   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket.class.php');
26 26
 
27 27
 class EEM_Ticket extends EEM_Soft_Delete_Base {
28 28
 
@@ -36,35 +36,35 @@  discard block
 block discarded – undo
36 36
 	 *		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
37 37
 	 *		@return void
38 38
 	 */
39
-	protected function __construct( $timezone ) {
40
-		$this->singular_item = __('Ticket','event_espresso');
41
-		$this->plural_item = __('Tickets','event_espresso');
39
+	protected function __construct($timezone) {
40
+		$this->singular_item = __('Ticket', 'event_espresso');
41
+		$this->plural_item = __('Tickets', 'event_espresso');
42 42
 
43 43
 		$this->_tables = array(
44 44
 			'Ticket'=> new EE_Primary_Table('esp_ticket', 'TKT_ID')
45 45
 		);
46 46
 		$this->_fields = array(
47 47
 			'Ticket'=>array(
48
-				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso')),
49
-				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso'), false, 0, 'Ticket_Template'),
48
+				'TKT_ID'=> new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')),
49
+				'TTM_ID'=>new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'),
50 50
 				'TKT_name'=>new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''),
51
-				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, '' ),
52
-				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket','event_espresso'), false, current_time('timestamp'), $timezone ),
53
-				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket','event_espresso'), false, current_time('timestamp'), $timezone ),
54
-				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0 ),
55
-				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, INF ),
51
+				'TKT_description'=>new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''),
52
+				'TKT_start_date'=>new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone),
53
+				'TKT_end_date'=>new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone),
54
+				'TKT_min'=>new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0),
55
+				'TKT_max'=>new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, INF),
56 56
 				'TKT_price'=> new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0),
57 57
 				'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0),
58
-				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available','event_espresso'), false, INF),
59
-				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, INF ),
60
-				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false ),
61
-				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false,false),
62
-				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false ),
58
+				'TKT_qty'=>new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, INF),
59
+				'TKT_uses'=>new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, INF),
60
+				'TKT_required'=>new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false),
61
+				'TKT_taxable'=>new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false),
62
+				'TKT_is_default'=>new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false),
63 63
 				'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0),
64
-				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0 ),
64
+				'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0),
65 65
 				'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false),
66
-				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE ),
67
-				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0 )
66
+				'TKT_wp_user' => new EE_WP_User_Field('TKT_wp_user', __('Ticket Creator ID', 'event_espresso'), FALSE),
67
+				'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0)
68 68
 			));
69 69
 		$this->_model_relations = array(
70 70
 			'Datetime'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 		);
77 77
 
78 78
 		//this model is generally available for reading
79
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
79
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('TKT_is_default', 'Datetime.Event');
80 80
 		//account for default tickets in the caps
81
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
82
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
83
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'TKT_is_default', 'Datetime.Event' );
84
-		parent::__construct( $timezone );
81
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
82
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
83
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('TKT_is_default', 'Datetime.Event');
84
+		parent::__construct($timezone);
85 85
 	}
86 86
 
87 87
 
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 * @return EE_Ticket[]
92 92
 	 */
93 93
 	public function get_all_default_tickets() {
94
-		$tickets = $this->get_all( array( array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')) );
94
+		$tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_order' => 'ASC')));
95 95
 
96 96
 		//we need to set the start date and end date to today's date and the start of the default dtt
97
-		return $this->_set_default_dates( $tickets );
97
+		return $this->_set_default_dates($tickets);
98 98
 	}
99 99
 
100 100
 
@@ -104,10 +104,10 @@  discard block
 block discarded – undo
104 104
 	 * @param EE_Ticket[] $tickets
105 105
 	 * @return EE_Ticket[]
106 106
 	 */
107
-	private function _set_default_dates( $tickets ) {
108
-		foreach ( $tickets as $ticket ) {
109
-			$ticket->set('TKT_start_date', current_time('timestamp') );
110
-			$ticket->set('TKT_end_date', current_time('timestamp') + (60 * 60 * 24 * 30 ) );
107
+	private function _set_default_dates($tickets) {
108
+		foreach ($tickets as $ticket) {
109
+			$ticket->set('TKT_start_date', current_time('timestamp'));
110
+			$ticket->set('TKT_end_date', current_time('timestamp') + (60 * 60 * 24 * 30));
111 111
 			$ticket->set_end_time("12am");
112 112
 		}
113 113
 
@@ -121,25 +121,25 @@  discard block
 block discarded – undo
121 121
 	 * @param array $query_params
122 122
 	 * @return int|boolean of tickets available. If sold out, return less than 1. If infinite, returns INF,  IF there are NO tickets attached to datetime then FALSE is returned.
123 123
 	 */
124
-	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()){
124
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
125 125
 		$sum = 0;
126 126
 		$query_params[0]['Datetime.DTT_ID'] = $DTT_ID;
127 127
 		$remaining_per_ticket = $this->_get_all_wpdb_results(
128 128
 				$query_params,
129 129
 				ARRAY_A,
130 130
 				array(
131
-					'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold','%d'),//note! calculations based on TKT_qty are dangerous because -1 means infinity in the db!
132
-					'initially_available'=>array('Ticket.TKT_qty','%d')));
131
+					'tickets_remaining'=>array('Ticket.TKT_qty-Ticket.TKT_sold', '%d'), //note! calculations based on TKT_qty are dangerous because -1 means infinity in the db!
132
+					'initially_available'=>array('Ticket.TKT_qty', '%d')));
133 133
 
134
-		if ( empty( $remaining_per_ticket ) )
134
+		if (empty($remaining_per_ticket))
135 135
 			return FALSE;
136 136
 
137 137
 
138
-		foreach($remaining_per_ticket as $remaining){
139
-			if(intval($remaining['initially_available'])==EE_INF_IN_DB){//infinite in DB
138
+		foreach ($remaining_per_ticket as $remaining) {
139
+			if (intval($remaining['initially_available']) == EE_INF_IN_DB) {//infinite in DB
140 140
 				return INF;
141 141
 			}
142
-			$sum+=intval($remaining['tickets_remaining']);
142
+			$sum += intval($remaining['tickets_remaining']);
143 143
 		}
144 144
 
145 145
 		return $sum;
@@ -150,8 +150,8 @@  discard block
 block discarded – undo
150 150
 	 * @param EE_Ticket[] $tickets
151 151
 	 * @return void
152 152
 	 */
153
-	public function update_tickets_sold($tickets){
154
-		foreach($tickets as $ticket){
153
+	public function update_tickets_sold($tickets) {
154
+		foreach ($tickets as $ticket) {
155 155
 			/* @var  $ticket EE_Ticket */
156 156
 			$ticket->update_tickets_sold();
157 157
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket_Price.model.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
  * ------------------------------------------------------------------------
23 23
  */
24 24
 
25
-require_once ( EE_CLASSES . 'EE_Ticket_Price.class.php' );
26
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
25
+require_once (EE_CLASSES.'EE_Ticket_Price.class.php');
26
+require_once (EE_MODELS.'EEM_Base.model.php');
27 27
 
28 28
 class EEM_Ticket_Price extends EEM_Base {
29 29
 
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	 * 		@param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
38 38
 	 * 		@return void
39 39
 	 */
40
-	protected function __construct( $timezone ) {
41
-		$this->singular_item = __('Ticket Price','event_espresso');
42
-		$this->plural_item = __('Ticket Prices','event_espresso');
40
+	protected function __construct($timezone) {
41
+		$this->singular_item = __('Ticket Price', 'event_espresso');
42
+		$this->plural_item = __('Ticket Prices', 'event_espresso');
43 43
 
44 44
 		$this->_tables = array(
45
-			'Ticket_Price'=>new EE_Primary_Table('esp_ticket_price','TKP_ID')
45
+			'Ticket_Price'=>new EE_Primary_Table('esp_ticket_price', 'TKP_ID')
46 46
 		);
47 47
 		$this->_fields = array(
48 48
 			'Ticket_Price'=> array(
@@ -56,14 +56,14 @@  discard block
 block discarded – undo
56 56
 			'Price'=>new EE_Belongs_To_Relation()
57 57
 		);
58 58
 		$this->_model_chain_to_wp_user = 'Ticket';
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('Ticket.TKT_is_default', 'Ticket.Datetime.Event' );
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('Ticket.TKT_is_default', 'Ticket.Datetime.Event');
60 60
 		//account for default tickets in the caps
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event');
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event');
63
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event');
61
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event');
62
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event');
63
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event');
64 64
 		//follow the caps of the ticket
65 65
 		$this->_caps_slug = 'tickets';
66
-		parent::__construct( $timezone );
66
+		parent::__construct($timezone);
67 67
 
68 68
 	}
69 69
 
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.