Completed
Branch FET-7988-evertec-needs (20e248)
by
unknown
1119:58 queued 1106:57
created
core/db_models/EEM_Registration.model.php 4 patches
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.
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 
219 219
 
220 220
 	/**
221
-	*		retrieve ALL registrations for a particular Attendee from db
222
-	* 		@access		public
223
-	* 		@param		int		$ATT_ID
224
-	*		@return 	EE_Registration[]
225
-	*/
221
+	 *		retrieve ALL registrations for a particular Attendee from db
222
+	 * 		@access		public
223
+	 * 		@param		int		$ATT_ID
224
+	 *		@return 	EE_Registration[]
225
+	 */
226 226
 	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
227 227
 		if ( ! $ATT_ID ) {
228 228
 			return FALSE;
@@ -249,14 +249,14 @@  discard block
 block discarded – undo
249 249
 
250 250
 
251 251
 	/**
252
-	*		retrieve registration for a specific transaction attendee from db
253
-	*
254
-	* 		@access		public
255
-	* 		@param		$TXN_ID
256
-	* 		@param		$ATT_ID
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
259
-	*/
252
+	 *		retrieve registration for a specific transaction attendee from db
253
+	 *
254
+	 * 		@access		public
255
+	 * 		@param		$TXN_ID
256
+	 * 		@param		$ATT_ID
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
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(
262 262
 			array(
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 
269 269
 
270 270
 	/**
271
-	*		get the number of registrations per day  for the Registration Admin page Reports Tab.
271
+	 *		get the number of registrations per day  for the Registration Admin page Reports Tab.
272 272
 	 *		(doesn't utilize models because it's a fairly specialized query)
273
-	* 		@access		public
273
+	 * 		@access		public
274 274
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
275 275
 	 *		@return stdClass[] with properties regDate and total
276
-	*/
276
+	 */
277 277
 	public function get_registrations_per_day_report( $period = '-1 month' ) {
278 278
 		$sql_date = date("Y-m-d H:i:s", strtotime($period));
279 279
 
@@ -303,10 +303,10 @@  discard block
 block discarded – undo
303 303
 
304 304
 
305 305
 	/**
306
-	*		get the number of registrations per event  for the Registration Admin page Reports Tab
307
-	* 		@access		public
306
+	 *		get the number of registrations per event  for the Registration Admin page Reports Tab
307
+	 * 		@access		public
308 308
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
309
-	*/
309
+	 */
310 310
 	public function get_registrations_per_event_report( $period = '-1 month' ) {
311 311
 		$date_sql = date("Y-m-d H:i:s", strtotime($period));
312 312
 
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 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,30 +92,30 @@  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','event_espresso'), false, 0),
112
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
113
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
114
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
115
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
116
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
117
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
118
-				'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', 'event_espresso'), false, 0),
112
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
113
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
114
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
115
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
116
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
117
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
118
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
119 119
 			)
120 120
 		);
121 121
 		$this->_model_relations = array(
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 		);
130 130
 		$this->_model_chain_to_wp_user = 'Event';
131 131
 
132
-		parent::__construct( $timezone );
132
+		parent::__construct($timezone);
133 133
 	}
134 134
 
135 135
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 *		@param bool  $translated If true will return the values as singular localized strings
144 144
 	 *		@return array
145 145
 	 */
146
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
147
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
148
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
146
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
147
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
148
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
149 149
 	}
150 150
 
151 151
 
@@ -156,18 +156,18 @@  discard block
 block discarded – undo
156 156
 	 * @param array $exclude
157 157
 	 * @return array
158 158
 	 */
159
-	private function _get_registration_status_array( $exclude = array() ) {
159
+	private function _get_registration_status_array($exclude = array()) {
160 160
 		//in the very rare circumstance that we are deleting a model's table's data
161 161
 		//and the table hasn't actually been created, this could have an error
162 162
 		global $wpdb;
163
-		EE_Registry::instance()->load_helper( 'Activation' );
164
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
165
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
166
-			$results = $wpdb->get_results( $SQL );
163
+		EE_Registry::instance()->load_helper('Activation');
164
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
165
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
166
+			$results = $wpdb->get_results($SQL);
167 167
 			self::$_reg_status = array();
168
-			foreach ( $results as $status ) {
169
-				if ( ! in_array( $status->STS_ID, $exclude )) {
170
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
168
+			foreach ($results as $status) {
169
+				if ( ! in_array($status->STS_ID, $exclude)) {
170
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
171 171
 				}
172 172
 			}
173 173
 		}
@@ -182,15 +182,15 @@  discard block
 block discarded – undo
182 182
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
183 183
 	 * @return wpdb results array
184 184
 	 */
185
-	public function get_reg_months_and_years( $where_params ) {
185
+	public function get_reg_months_and_years($where_params) {
186 186
 		$query_params[0] = $where_params;
187 187
 		$query_params['group_by'] = array('reg_year', 'reg_month');
188
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
188
+		$query_params['order_by'] = array('REG_date' => 'DESC');
189 189
 		$columns_to_select = array(
190 190
 			'reg_year' => array('YEAR(REG_date)', '%s'),
191 191
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
192 192
 			);
193
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
193
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
194 194
 	}
195 195
 
196 196
 
@@ -202,11 +202,11 @@  discard block
 block discarded – undo
202 202
 	* 		@param		int		$ATT_ID
203 203
 	*		@return 	EE_Registration[]
204 204
 	*/
205
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
206
-		if ( ! $ATT_ID ) {
205
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
206
+		if ( ! $ATT_ID) {
207 207
 			return FALSE;
208 208
 		}
209
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
209
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
210 210
 	}
211 211
 
212 212
 
@@ -217,8 +217,8 @@  discard block
 block discarded – undo
217 217
 	 * @param string $REG_url_link
218 218
 	 * @return EE_Registration
219 219
 	 */
220
-	public function get_registration_for_reg_url_link($REG_url_link){
221
-		if(!$REG_url_link){
220
+	public function get_registration_for_reg_url_link($REG_url_link) {
221
+		if ( ! $REG_url_link) {
222 222
 			return false;
223 223
 		}
224 224
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	* 		@param		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
237 237
 	*		@return 		mixed		array on success, FALSE on fail
238 238
 	*/
239
-	public function get_registration_for_transaction_attendee( $TXN_ID = FALSE, $ATT_ID = FALSE, $att_nmbr = FALSE ) {
239
+	public function get_registration_for_transaction_attendee($TXN_ID = FALSE, $ATT_ID = FALSE, $att_nmbr = FALSE) {
240 240
 		return $this->get_one(array(
241 241
 			array(
242 242
 				'TXN_ID'=>$TXN_ID,
243 243
 				'ATT_ID'=>$ATT_ID),
244
-			'limit'=>array($att_nmbr-1,1)
244
+			'limit'=>array($att_nmbr - 1, 1)
245 245
 		));
246 246
 	}
247 247
 
@@ -253,11 +253,11 @@  discard block
 block discarded – undo
253 253
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
254 254
 	 *		@return stdClass[] with properties regDate and total
255 255
 	*/
256
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
256
+	public function get_registrations_per_day_report($period = '-1 month') {
257 257
 		$sql_date = date("Y-m-d H:i:s", strtotime($period));
258
-		$where = array('REG_date'=>array('>=',$sql_date) );
258
+		$where = array('REG_date'=>array('>=', $sql_date));
259 259
 
260
-		if ( ! EE_Registry::instance()->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
260
+		if ( ! EE_Registry::instance()->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
261 261
 			$where['Event.EVT_wp_user'] = get_current_user_id();
262 262
 		}
263 263
 
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				),
270 270
 				OBJECT,
271 271
 				array(
272
-					'regDate'=>array('DATE(Registration.REG_date)','%s'),
273
-					'total'=>array('count(REG_ID)','%d')
272
+					'regDate'=>array('DATE(Registration.REG_date)', '%s'),
273
+					'total'=>array('count(REG_ID)', '%d')
274 274
 				));
275 275
 		return $results;
276 276
 	}
@@ -284,21 +284,21 @@  discard block
 block discarded – undo
284 284
 	* 		@access		public
285 285
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
286 286
 	*/
287
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
287
+	public function get_registrations_per_event_report($period = '-1 month') {
288 288
 		$date_sql = date("Y-m-d H:i:s", strtotime($period));
289
-		$where = array( 'REG_date'=>array('>=',$date_sql ) );
290
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
289
+		$where = array('REG_date'=>array('>=', $date_sql));
290
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
291 291
 			$where['Event.EVT_wp_user'] = get_current_user_id();
292 292
 		}
293 293
 		$results = $this->_get_all_wpdb_results(array(
294 294
 			$where,
295 295
 			'group_by'=>'Event.EVT_name',
296 296
 			'order_by'=>'Event.EVT_name',
297
-			'limit'=>array(0,24)),
297
+			'limit'=>array(0, 24)),
298 298
 			OBJECT,
299 299
 			array(
300
-				'event_name'=>array('Event_CPT.post_title','%s'),
301
-				'total'=>array('COUNT(REG_ID)','%s')
300
+				'event_name'=>array('Event_CPT.post_title', '%s'),
301
+				'total'=>array('COUNT(REG_ID)', '%s')
302 302
 			)
303 303
 		);
304 304
 
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
 	 * @param int $TXN_ID
313 313
 	 * @return EE_Registration
314 314
 	 */
315
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = FALSE){
316
-		if( ! $TXN_ID ){
315
+	public function get_primary_registration_for_transaction_ID($TXN_ID = FALSE) {
316
+		if ( ! $TXN_ID) {
317 317
 			return false;
318 318
 		}
319
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
319
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
320 320
 	}
321 321
 
322 322
 
@@ -328,11 +328,11 @@  discard block
 block discarded – undo
328 328
 	 *		@param boolean $for_incomplete_payments
329 329
 	 *		@return int
330 330
 	 */
331
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
331
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
332 332
 		// we only count approved registrations towards registration limits
333
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
334
-		if( $for_incomplete_payments ){
335
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
333
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
334
+		if ($for_incomplete_payments) {
335
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
336 336
 		}
337 337
 
338 338
 		return $this->count($query_params);
Please login to merge, or discard this patch.
core/db_models/EEM_Term.model.php 2 patches
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.
Spacing   +31 added lines, -31 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,17 +20,17 @@  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(
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 			'slug'=>new EE_Unique_Index(array('slug'))
41 41
 		);
42 42
 
43
-		parent::__construct( $timezone );
43
+		parent::__construct($timezone);
44 44
 	}
45 45
 
46 46
 
@@ -51,20 +51,20 @@  discard block
 block discarded – undo
51 51
 	 *
52 52
 	 * @access public
53 53
 	 */
54
-	public function get_all_ee_categories( $show_uncategorized = FALSE ) {
54
+	public function get_all_ee_categories($show_uncategorized = FALSE) {
55 55
 
56 56
 		$where_params = array(
57 57
 			'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
58
-			'NOT' => array( 'name' => __( 'Uncategorized', 'event_espresso' ))
58
+			'NOT' => array('name' => __('Uncategorized', 'event_espresso'))
59 59
 		);
60 60
 
61
-		if ( $show_uncategorized ) {
62
-			unset( $where_params['NOT'] );
61
+		if ($show_uncategorized) {
62
+			unset($where_params['NOT']);
63 63
 		}
64 64
 
65
-	 	return EEM_Term::instance()->get_all( array(
65
+	 	return EEM_Term::instance()->get_all(array(
66 66
 			$where_params,
67
-			'order_by' => array( 'name' => 'ASC' )
67
+			'order_by' => array('name' => 'ASC')
68 68
 		));
69 69
 	}
70 70
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param string $post_type
78 78
 	 * @return array
79 79
 	 */
80
-	public function get_all_CPT_post_tags( $post_type = '' ) {
81
-		switch( $post_type ) {
80
+	public function get_all_CPT_post_tags($post_type = '') {
81
+		switch ($post_type) {
82 82
 			case 'espresso_events' :
83 83
 				return $this->get_all_event_post_tags();
84 84
 				break;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 			default :
89 89
 				$event_tags = $this->get_all_event_post_tags();
90 90
 				$venue_tags = $this->get_all_venue_post_tags();
91
-				return array_merge( $event_tags, $venue_tags );
91
+				return array_merge($event_tags, $venue_tags);
92 92
 		}
93 93
 		return array();
94 94
 	}
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 	 * @return EE_Soft_Delete_Base_Class[]
102 102
 	 */
103 103
 	public function get_all_event_post_tags() {
104
-	 	$post_tags = EEM_Term::instance()->get_all( array(
104
+	 	$post_tags = EEM_Term::instance()->get_all(array(
105 105
 			array(
106 106
 				'Term_Taxonomy.taxonomy' => 'post_tag',
107 107
 				'Term_Taxonomy.Event.post_type' => 'espresso_events',
108 108
 			),
109
-			'order_by' => array( 'name' => 'ASC' ),
110
-			'force_join' => array( 'Term_Taxonomy.Event' )
109
+			'order_by' => array('name' => 'ASC'),
110
+			'force_join' => array('Term_Taxonomy.Event')
111 111
 		));
112
-		foreach ( $post_tags as $key => $post_tag ) {
113
-			if ( ! isset( $post_tags[ $key ]->post_type )) {
114
-				$post_tags[ $key ]->post_type = array();
112
+		foreach ($post_tags as $key => $post_tag) {
113
+			if ( ! isset($post_tags[$key]->post_type)) {
114
+				$post_tags[$key]->post_type = array();
115 115
 			}
116
-			$post_tags[ $key ]->post_type[] = 'espresso_events';
116
+			$post_tags[$key]->post_type[] = 'espresso_events';
117 117
 		}
118 118
 		return $post_tags;
119 119
 //		return array( 'espresso_events' => $post_tags );
@@ -127,19 +127,19 @@  discard block
 block discarded – undo
127 127
 	 * @return EE_Soft_Delete_Base_Class[]
128 128
 	 */
129 129
 	public function get_all_venue_post_tags() {
130
-		$post_tags = EEM_Term::instance()->get_all( array(
130
+		$post_tags = EEM_Term::instance()->get_all(array(
131 131
 			array(
132 132
 				'Term_Taxonomy.taxonomy' => 'post_tag',
133 133
 				'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
134 134
 			),
135
-			'order_by' => array( 'name' => 'ASC' ),
136
-			'force_join' => array( 'Term_Taxonomy' )
135
+			'order_by' => array('name' => 'ASC'),
136
+			'force_join' => array('Term_Taxonomy')
137 137
 		));
138
-		foreach ( $post_tags as $key => $post_tag ) {
139
-			if ( ! isset( $post_tags[ $key ]->post_type )) {
140
-				$post_tags[ $key ]->post_type = array();
138
+		foreach ($post_tags as $key => $post_tag) {
139
+			if ( ! isset($post_tags[$key]->post_type)) {
140
+				$post_tags[$key]->post_type = array();
141 141
 			}
142
-			$post_tags[ $key ]->post_type[] = 'espresso_venues';
142
+			$post_tags[$key]->post_type[] = 'espresso_venues';
143 143
 		}
144 144
 		return $post_tags;
145 145
 //		return array( 'espresso_venues' => $post_tags );
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Relationship.model.php 2 patches
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.
Spacing   +20 added lines, -20 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,10 +47,10 @@  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
 
53
-		parent::__construct( $timezone );
53
+		parent::__construct($timezone);
54 54
 	}
55 55
 
56 56
 	/**
@@ -59,17 +59,17 @@  discard block
 block discarded – undo
59 59
 	 * @global type $wpdb
60 60
 	 * @return int the number of rows affected
61 61
 	 */
62
-	public function update_term_taxonomy_counts($term_taxonomy_id = NULL){
62
+	public function update_term_taxonomy_counts($term_taxonomy_id = NULL) {
63 63
 		//because this uses a subquery and sometimes assigning to column to be another column's
64 64
 		//value, we just write the SQL directly.
65 65
 		global $wpdb;
66
-		if( $term_taxonomy_id ){
67
-			$second_operand = $wpdb->prepare('%d',$term_taxonomy_id);
68
-		}else{
66
+		if ($term_taxonomy_id) {
67
+			$second_operand = $wpdb->prepare('%d', $term_taxonomy_id);
68
+		} else {
69 69
 			$second_operand = 'tr.term_taxonomy_id';
70 70
 		}
71
-		$rows_affected = $this->_do_wpdb_query( 'query' , array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
72
-from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)" ) );
71
+		$rows_affected = $this->_do_wpdb_query('query', array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
72
+from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)"));
73 73
 		return $rows_affected;
74 74
 	}
75 75
 
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function insert($field_n_values) {
83 83
 		$return = parent::insert($field_n_values);
84
-		if( isset( $field_n_values[ 'term_taxonomy_id' ] ) ) {
85
-			$this->update_term_taxonomy_counts($field_n_values[ 'term_taxonomy_id' ] );
84
+		if (isset($field_n_values['term_taxonomy_id'])) {
85
+			$this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']);
86 86
 		}
87 87
 		return $return;
88 88
 	}
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 	 * @return int
99 99
 	 */
100 100
 	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
101
-		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync );
102
-		if( $count ){
101
+		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync);
102
+		if ($count) {
103 103
 			$this->update_term_taxonomy_counts();
104 104
 		}
105 105
 		return $count;
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 	 */
114 114
 	public function delete($query_params, $allow_blocking = true) {
115 115
 		$count = parent::delete($query_params, $allow_blocking);
116
-		if( $count ){
116
+		if ($count) {
117 117
 			$this->update_term_taxonomy_counts();
118 118
 		}
119 119
 		return $count;
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
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.
Spacing   +11 added lines, -11 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_Simple_HTML_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_Simple_HTML_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,10 +52,10 @@  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
 
58
-		parent::__construct( $timezone );
58
+		parent::__construct($timezone);
59 59
 	}
60 60
 
61 61
 
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket_Price.model.php 2 patches
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.
Spacing   +7 added lines, -7 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(
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			'Ticket'=>new EE_Belongs_To_Relation(),
56 56
 			'Price'=>new EE_Belongs_To_Relation()
57 57
 		);
58
-		parent::__construct( $timezone );
58
+		parent::__construct($timezone);
59 59
 
60 60
 	}
61 61
 
Please login to merge, or discard this patch.
core/db_models/EEM_Ticket_Template.model.php 2 patches
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.
Spacing   +10 added lines, -10 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_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Ticket_Template.class.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Ticket_Template.class.php');
26 26
 
27 27
 class EEM_Ticket_Template extends EEM_Base {
28 28
 
@@ -38,25 +38,25 @@  discard block
 block discarded – undo
38 38
 	 *		@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)
39 39
 	 *		@return void
40 40
 	 */
41
-	protected function __construct( $timezone ) {
42
-		$this->singular_item = __('Ticket Template','event_espresso');
43
-		$this->plural_item = __('Ticket Templates','event_espresso');
41
+	protected function __construct($timezone) {
42
+		$this->singular_item = __('Ticket Template', 'event_espresso');
43
+		$this->plural_item = __('Ticket Templates', 'event_espresso');
44 44
 
45 45
 		$this->_tables = array(
46 46
 			'Ticket_Template'=> new EE_Primary_Table('esp_ticket_template', 'TTM_ID')
47 47
 		);
48 48
 		$this->_fields = array(
49 49
 			'Ticket_Template'=>array(
50
-				'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso')),
51
-				'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template','event_espresso'), false, '' ),
52
-				'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template','event_espresso'), true, '' ),
53
-				'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk','event_espresso'), true, '' ),
50
+				'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso')),
51
+				'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template', 'event_espresso'), false, ''),
52
+				'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template', 'event_espresso'), true, ''),
53
+				'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk', 'event_espresso'), true, ''),
54 54
 			));
55 55
 		$this->_model_relations = array(
56 56
 			'Ticket'=>new EE_Has_Many_Relation()
57 57
 		);
58 58
 		$this->_model_chain_to_wp_user = 'Ticket';
59 59
 
60
-		parent::__construct( $timezone );
60
+		parent::__construct($timezone);
61 61
 	}
62 62
 } //end EEM_Ticket_Template class
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/EEM_Transaction.model.php 2 patches
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.
Spacing   +33 added lines, -33 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
  * Transaction Model
@@ -68,35 +68,35 @@  discard block
 block discarded – undo
68 68
 	 * 		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)
69 69
 	 *	@return EEM_Transaction
70 70
 	 */
71
-	protected function __construct( $timezone ) {
72
-		$this->singular_item = __('Transaction','event_espresso');
73
-		$this->plural_item = __('Transactions','event_espresso');
71
+	protected function __construct($timezone) {
72
+		$this->singular_item = __('Transaction', 'event_espresso');
73
+		$this->plural_item = __('Transactions', 'event_espresso');
74 74
 
75 75
 		$this->_tables = array(
76
-			'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID')
76
+			'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
77 77
 		);
78 78
 		$this->_fields = array(
79 79
 			'Transaction'=>array(
80
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
81
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, current_time('timestamp'), $timezone ),
82
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
83
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
84
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
86
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
80
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
81
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, current_time('timestamp'), $timezone),
82
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
83
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
84
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
86
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
87 87
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
88
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
88
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
89 89
 			)
90 90
 		);
91 91
 		$this->_model_relations = array(
92 92
 			'Registration'=>new EE_Has_Many_Relation(),
93 93
 			'Payment'=>new EE_Has_Many_Relation(),
94 94
 			'Status'=>new EE_Belongs_To_Relation(),
95
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
95
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
96 96
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
97 97
 		);
98 98
 		$this->_model_chain_to_wp_user = 'Registration.Event';
99
-		parent::__construct( $timezone );
99
+		parent::__construct($timezone);
100 100
 
101 101
 	}
102 102
 
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
107 107
 	 * @param string $period
108 108
 	 * @return \stdClass[]
109 109
 	 */
110
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
110
+	public function get_revenue_per_day_report($period = '-1 month') {
111 111
 
112
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
112
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
113 113
 		$results = $this->_get_all_wpdb_results(
114 114
 			array(
115 115
 				array(
116 116
 					'TXN_timestamp' => array('>=', $sql_date)),
117 117
 					'group_by' => 'txnDate',
118
-					'order_by' => array('TXN_timestamp' => 'DESC' )
118
+					'order_by' => array('TXN_timestamp' => 'DESC')
119 119
 					),
120 120
 				OBJECT,
121 121
 				array(
122
-					'txnDate' => array('DATE(Transaction.TXN_timestamp)','%s'),
122
+					'txnDate' => array('DATE(Transaction.TXN_timestamp)', '%s'),
123 123
 					'revenue' => array('SUM(Transaction.TXN_paid)', '%d')
124 124
 					));
125 125
 		return $results;
@@ -135,21 +135,21 @@  discard block
 block discarded – undo
135 135
 	 * @throws \EE_Error
136 136
 	 * @return mixed
137 137
 	 */
138
-	public function get_revenue_per_event_report( $period = 'month' ) {
138
+	public function get_revenue_per_event_report($period = 'month') {
139 139
 		global $wpdb;
140
-		$date_mod = strtotime( '-1 ' . $period );
140
+		$date_mod = strtotime('-1 '.$period);
141 141
 
142 142
 		$SQL = 'SELECT post_title as event_name, SUM(TXN_paid) AS revenue';
143
-		$SQL .= ' FROM ' . $this->_get_main_table()->get_table_name() . ' txn';
144
-		$SQL .= ' LEFT JOIN ' . $wpdb->prefix . 'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
145
-		$SQL .= ' LEFT JOIN ' . $wpdb->posts . ' evt ON evt.ID = reg.EVT_ID';
143
+		$SQL .= ' FROM '.$this->_get_main_table()->get_table_name().' txn';
144
+		$SQL .= ' LEFT JOIN '.$wpdb->prefix.'esp_registration reg ON reg.TXN_ID = txn.TXN_ID';
145
+		$SQL .= ' LEFT JOIN '.$wpdb->posts.' evt ON evt.ID = reg.EVT_ID';
146 146
 		$SQL .= ' WHERE REG_count = 1';
147 147
 		$SQL .= ' AND REG_date >= %d';
148 148
 		$SQL .= ' GROUP BY event_name';
149 149
 		$SQL .= ' ORDER BY event_name';
150 150
 		$SQL .= ' LIMIT 0, 24';
151 151
 
152
-		return $this->_do_wpdb_query( 'get_results', array(  $wpdb->prepare( $SQL, $date_mod ) ) );
152
+		return $this->_do_wpdb_query('get_results', array($wpdb->prepare($SQL, $date_mod)));
153 153
 
154 154
 	}
155 155
 
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 	 * @param string $reg_url_link
166 166
 	 * @return EE_Transaction
167 167
 	 */
168
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
169
-		return $this->get_one( array(
168
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
169
+		return $this->get_one(array(
170 170
 			array(
171
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
171
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
172 172
 			)
173 173
 		));
174 174
 	}
@@ -188,15 +188,15 @@  discard block
 block discarded – undo
188 188
 	 * @param boolean $save_txn whether or not to save the transaction during this function call
189 189
 	 * @return boolean
190 190
 	 */
191
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
191
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
192 192
 		EE_Error::doing_it_wrong(
193
-			__CLASS__ . '::' . __FUNCTION__,
194
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
193
+			__CLASS__.'::'.__FUNCTION__,
194
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
195 195
 			'4.6.0'
196 196
 		);
197 197
 		/** @type EE_Transaction_Processor $transaction_processor */
198
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
199
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id ));
198
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
199
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id));
200 200
 	}
201 201
 
202 202
 
Please login to merge, or discard this patch.
core/db_models/EEM_Venue.model.php 2 patches
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.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,16 +21,16 @@  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_Venue extends EEM_CPT_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 = __('Venue','event_espresso');
33
-		$this->plural_item = __('Venues','event_espresso');
31
+	protected function __construct($timezone = NULL) {
32
+		$this->singular_item = __('Venue', 'event_espresso');
33
+		$this->plural_item = __('Venues', 'event_espresso');
34 34
 		$this->_tables = array(
35 35
 			'Venue_CPT'=> new EE_Primary_Table('posts', 'ID'),
36 36
 			'Venue_Meta'=>new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID')
@@ -39,32 +39,32 @@  discard block
 block discarded – undo
39 39
 			'Venue_CPT'=>array(
40 40
 				'VNU_ID'=>new EE_Primary_Key_Int_Field('ID', __("Venue ID", "event_espresso")),
41 41
 				'VNU_name'=>new EE_Plain_Text_Field('post_title', __("Venue Name", "event_espresso"), false, ''),
42
-				'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false,''),
43
-				'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false,''),
44
-				'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE,current_time('timestamp')),
45
-				'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true,''),
46
-				'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE,current_time('timestamp')),
47
-				'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false ),
48
-				'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false,0),
42
+				'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false, ''),
43
+				'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false, ''),
44
+				'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, current_time('timestamp')),
45
+				'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true, ''),
46
+				'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, current_time('timestamp')),
47
+				'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false),
48
+				'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false, 0),
49 49
 				'VNU_order'=>new EE_Integer_Field('menu_order', __("Venue order", "event_espresso"), false, 1),
50
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'),// EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'),
50
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'), // EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'),
51 51
 				),
52 52
 			'Venue_Meta'=>array(
53 53
 				'VNUM_ID'=>new EE_DB_Only_Int_Field('VNUM_ID', __("ID of Venue Meta Row", "event_espresso"), false),
54 54
 				'VNU_ID_fk'=>new EE_DB_Only_Int_Field('VNU_ID', __("Foreign Key to Venue Post ", "event_espresso"), false),
55 55
 				'VNU_address'=>new EE_Plain_Text_Field('VNU_address', __("Venue Address line 1", "event_espresso"), true, ''),
56
-				'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true,''),
56
+				'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true, ''),
57 57
 				'VNU_city'=>new EE_Plain_Text_Field('VNU_city', __("Venue City", "event_espresso"), true, ''),
58 58
 				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __("State ID", "event_espresso"), true, null, 'State'),
59 59
 				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __("Country Code", "event_espresso"), true, null, 'Country'),
60 60
 				'VNU_zip'=>new EE_Plain_Text_Field('VNU_zip', __("Venue Zip/Postal Code", "event_espresso"), true),
61 61
 				'VNU_phone'=>new EE_Plain_Text_Field('VNU_phone', __("Venue Phone", "event_espresso"), true),
62
-				'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true,INF),
62
+				'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true, INF),
63 63
 				'VNU_url'=>new EE_Plain_Text_Field('VNU_url', __('Venue Website', 'event_espresso'), true),
64 64
 				'VNU_virtual_phone'=>new EE_Plain_Text_Field('VNU_virtual_phone', __('Call in Number', 'event_espresso'), true),
65
-				'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true ),
66
-				'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true ),
67
-				'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false )
65
+				'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true),
66
+				'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true),
67
+				'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false)
68 68
 
69 69
 			));
70 70
 		$this->_model_relations = array(
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 			'Event_Venue'=>new EE_Has_Many_Relation(),
75 75
 			'WP_User' => new EE_Belongs_To_Relation()
76 76
 		);
77
-		require_once( EE_CLASSES . 'EE_Venue.class.php');
78
-		require_once( EE_MODELS . 'strategies/EE_CPT_Where_Conditions.strategy.php');
77
+		require_once(EE_CLASSES.'EE_Venue.class.php');
78
+		require_once(EE_MODELS.'strategies/EE_CPT_Where_Conditions.strategy.php');
79 79
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_venues', 'VNUM_ID');
80
-		parent::__construct( $timezone );
80
+		parent::__construct($timezone);
81 81
 	}
82 82
 
83 83
 }
Please login to merge, or discard this patch.
core/db_models/EEM_WP_User.model.php 2 patches
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.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,24 +22,24 @@  discard block
 block discarded – undo
22 22
 	 * @param null $timezone
23 23
 	 * @throws \EE_Error
24 24
 	 */
25
-	protected function __construct( $timezone = NULL ){
26
-		$this->singular_item = __('WP_User','event_espresso');
27
-		$this->plural_item = __('WP_Users','event_espresso');
25
+	protected function __construct($timezone = NULL) {
26
+		$this->singular_item = __('WP_User', 'event_espresso');
27
+		$this->plural_item = __('WP_Users', 'event_espresso');
28 28
 		global $wpdb;
29 29
 		$this->_tables = array(
30
-			'WP_User'=> new EE_Primary_Table( $wpdb->users, 'ID', true)
30
+			'WP_User'=> new EE_Primary_Table($wpdb->users, 'ID', true)
31 31
 		);
32 32
 		$this->_fields = array(
33 33
 			'WP_User'=>array(
34
-				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID','event_espresso')),
35
-				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login','event_espresso'), false, '' ),
36
-				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password','event_espresso'), false, '' ),
37
-				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name','event_espresso'), false, ''),
38
-				'user_email' => new EE_Email_Field('user_email', __( 'User Email', 'event_espresso' ), false),
39
-				'user_registered' => new EE_Datetime_Field( 'user_registered', __( 'Date User Registered', 'event_espresso' ), false, current_time('timestamp'), $timezone ),
40
-				'user_activation_key' => new EE_Plain_Text_Field( 'user_activation_key', __( 'User Activation Key', 'event_espresso' ), false, '' ),
41
-				'user_status' => new EE_Integer_Field( 'user_status', __( 'User Status', 'event_espresso' ), false, 0 ),
42
-				'display_name' => new EE_Plain_Text_Field( 'display_name', __( 'Display Name', 'event_espresso' ), false, '' )
34
+				'ID'=> new EE_Primary_Key_Int_Field('ID', __('WP_User ID', 'event_espresso')),
35
+				'user_login'=>new EE_Plain_Text_Field('user_login', __('User Login', 'event_espresso'), false, ''),
36
+				'user_pass'=>new EE_Plain_Text_Field('user_pass', __('User Password', 'event_espresso'), false, ''),
37
+				'user_nicename'=>new EE_Plain_Text_Field('user_nicename', __(' User Nice Name', 'event_espresso'), false, ''),
38
+				'user_email' => new EE_Email_Field('user_email', __('User Email', 'event_espresso'), false),
39
+				'user_registered' => new EE_Datetime_Field('user_registered', __('Date User Registered', 'event_espresso'), false, current_time('timestamp'), $timezone),
40
+				'user_activation_key' => new EE_Plain_Text_Field('user_activation_key', __('User Activation Key', 'event_espresso'), false, ''),
41
+				'user_status' => new EE_Integer_Field('user_status', __('User Status', 'event_espresso'), false, 0),
42
+				'display_name' => new EE_Plain_Text_Field('display_name', __('Display Name', 'event_espresso'), false, '')
43 43
 			));
44 44
 		$this->_model_relations = array(
45 45
 			'Attendee' => new EE_Has_Many_Relation(),
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			'Venue' => new EE_Has_Many_Relation(),
55 55
 		);
56 56
 
57
-		parent::__construct( $timezone );
57
+		parent::__construct($timezone);
58 58
 	}
59 59
 }
60 60
 // End of file EEM_WP_User.model.php
Please login to merge, or discard this patch.