Completed
Branch BETA-4.9-messages-queue (3a5d2a)
by
unknown
66:07 queued 66:07
created
core/db_models/EEM_Attendee.model.php 4 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -105,13 +105,13 @@  discard block
 block discarded – undo
105 105
 
106 106
 
107 107
 	/**
108
-	*		retrieve  a single attendee from db via their ID
109
-	*
110
-	* 		@access		public
111
-	* 		@param		$ATT_ID
112
-	*		@return 		mixed		array on success, FALSE on fail
108
+	 *		retrieve  a single attendee from db via their ID
109
+	 *
110
+	 * 		@access		public
111
+	 * 		@param		$ATT_ID
112
+	 *		@return 		mixed		array on success, FALSE on fail
113 113
 	 * 		@deprecated
114
-	*/
114
+	 */
115 115
 	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
116 116
 		// retrieve a particular EE_Attendee
117 117
 		return $this->get_one_by_ID( $ATT_ID );
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	/**
124
-	*		retrieve  a single attendee from db via their ID
125
-	*
126
-	* 		@access		public
127
-	* 		@param		array $where_cols_n_values
128
-	*		@return 		mixed		array on success, FALSE on fail
129
-	*/
124
+	 *		retrieve  a single attendee from db via their ID
125
+	 *
126
+	 * 		@access		public
127
+	 * 		@param		array $where_cols_n_values
128
+	 *		@return 		mixed		array on success, FALSE on fail
129
+	 */
130 130
 	public function get_attendee( $where_cols_n_values = array() ) {
131 131
 
132 132
 		if ( empty( $where_cols_n_values )) {
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
 
175 175
 
176 176
 	/**
177
-             * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
-             * EE_Attendee objects.
179
-             *
180
-             * @since    4.3.0
181
-             * @param  array $ids array of EE_Registration ids
182
-             * @return  EE_Attendee[]
183
-             */
184
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
185
-                $ids = (array) $ids;
186
-                $_where = array(
187
-                    'Registration.REG_ID' => array( 'in', $ids )
188
-                    );
189
-                return $this->get_all( array( $_where ) );
190
-            }
177
+	 * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate
178
+	 * EE_Attendee objects.
179
+	 *
180
+	 * @since    4.3.0
181
+	 * @param  array $ids array of EE_Registration ids
182
+	 * @return  EE_Attendee[]
183
+	 */
184
+			public function get_array_of_contacts_from_reg_ids( $ids ) {
185
+				$ids = (array) $ids;
186
+				$_where = array(
187
+					'Registration.REG_ID' => array( 'in', $ids )
188
+					);
189
+				return $this->get_all( array( $_where ) );
190
+			}
191 191
 
192 192
 
193 193
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -256,7 +256,7 @@
 block discarded – undo
256 256
 	* 		@param	int	$TXN_ID
257 257
 	* 		@param    int		$ATT_ID
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
-	*		@return 		mixed		array on success, FALSE on fail
259
+	*		@return 		EE_Soft_Delete_Base_Class|null		array on success, FALSE on fail
260 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(
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.
Spacing   +51 added lines, -51 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
  *
@@ -19,16 +19,16 @@  discard block
 block discarded – undo
19 19
 	 * QST_ID and QST_systems that relate to attendee attributes.
20 20
 	 * NOTE: this will be deprecated if we remove system questions
21 21
 	 */
22
-	const fname_question_id=1;
23
-	const lname_question_id=2;
24
-	const email_question_id=3;
25
-	const address_question_id=4;
26
-	const address2_question_id=5;
27
-	const city_question_id=6;
28
-	const state_question_id=7;
29
-	const country_question_id=8;
30
-	const zip_question_id=9;
31
-	const phone_question_id=10;
22
+	const fname_question_id = 1;
23
+	const lname_question_id = 2;
24
+	const email_question_id = 3;
25
+	const address_question_id = 4;
26
+	const address2_question_id = 5;
27
+	const city_question_id = 6;
28
+	const state_question_id = 7;
29
+	const country_question_id = 8;
30
+	const zip_question_id = 9;
31
+	const phone_question_id = 10;
32 32
 
33 33
 
34 34
 
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	 * @access protected
40 40
 	 * @param null $timezone
41 41
 	 */
42
-	protected function __construct( $timezone = NULL ) {
43
-		$this->singular_item = __('Attendee','event_espresso');
44
-		$this->plural_item = __('Attendees','event_espresso');
42
+	protected function __construct($timezone = NULL) {
43
+		$this->singular_item = __('Attendee', 'event_espresso');
44
+		$this->plural_item = __('Attendees', 'event_espresso');
45 45
 		$this->_tables = array(
46 46
 			'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'),
47 47
 			'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID')
@@ -55,37 +55,37 @@  discard block
 block discarded – undo
55 55
 				'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()),
56 56
 				'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")),
57 57
 				'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()),
58
-				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ),
58
+				'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false),
59 59
 				'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0),
60
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
60
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'),
61 61
 				'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish')
62 62
 			),
63 63
 			'Attendee_Meta'=>array(
64
-				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false),
64
+				'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false),
65 65
 				'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false),
66
-				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''),
67
-				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''),
68
-				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''),
69
-				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''),
70
-				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''),
71
-				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'),
72
-				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'),
73
-				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''),
74
-				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''),
75
-				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '')
66
+				'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''),
67
+				'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''),
68
+				'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''),
69
+				'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''),
70
+				'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''),
71
+				'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'),
72
+				'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'),
73
+				'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''),
74
+				'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''),
75
+				'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '')
76 76
 			));
77 77
 		$this->_model_relations = array(
78 78
 			'Registration'=>new EE_Has_Many_Relation(),
79 79
 			'State'=>new EE_Belongs_To_Relation(),
80 80
 			'Country'=>new EE_Belongs_To_Relation(),
81
-			'Event'=>new EE_HABTM_Relation('Registration', FALSE ),
81
+			'Event'=>new EE_HABTM_Relation('Registration', FALSE),
82 82
 			'WP_User' => new EE_Belongs_To_Relation(),
83
-			'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them.
83
+			'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them.
84 84
 		);
85 85
 		require_once('strategies/EE_CPT_Where_Conditions.strategy.php');
86 86
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID');
87 87
 		$this->_caps_slug = 'contacts';
88
-		parent::__construct( $timezone );
88
+		parent::__construct($timezone);
89 89
 
90 90
 	}
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID
98 98
 	 * @return EE_Attendee[]
99 99
 	 */
100
-	public function get_attendees_for_transaction( $transaction_id_or_obj ){
101
-		return $this->get_all( array( array(
100
+	public function get_attendees_for_transaction($transaction_id_or_obj) {
101
+		return $this->get_all(array(array(
102 102
 			  'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj
103 103
 		  )));
104 104
 	}
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 	*		@return 		mixed		array on success, FALSE on fail
114 114
 	 * 		@deprecated
115 115
 	*/
116
-	public function get_attendee_by_ID( $ATT_ID = FALSE ) {
116
+	public function get_attendee_by_ID($ATT_ID = FALSE) {
117 117
 		// retrieve a particular EE_Attendee
118
-		return $this->get_one_by_ID( $ATT_ID );
118
+		return $this->get_one_by_ID($ATT_ID);
119 119
 	}
120 120
 
121 121
 
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
 	* 		@param		array $where_cols_n_values
129 129
 	*		@return 		mixed		array on success, FALSE on fail
130 130
 	*/
131
-	public function get_attendee( $where_cols_n_values = array() ) {
131
+	public function get_attendee($where_cols_n_values = array()) {
132 132
 
133
-		if ( empty( $where_cols_n_values )) {
133
+		if (empty($where_cols_n_values)) {
134 134
 			return FALSE;
135 135
 		}
136
-		$attendee = $this->get_all( array($where_cols_n_values ));
137
-		if ( ! empty( $attendee )) {
138
-			return array_shift( $attendee );
136
+		$attendee = $this->get_all(array($where_cols_n_values));
137
+		if ( ! empty($attendee)) {
138
+			return array_shift($attendee);
139 139
 		} else {
140 140
 			return FALSE;
141 141
 		}
@@ -151,20 +151,20 @@  discard block
 block discarded – undo
151 151
 	 * @param array $where_cols_n_values
152 152
 	 * @return bool|mixed
153 153
 	 */
154
-	public function find_existing_attendee( $where_cols_n_values = NULL ) {
154
+	public function find_existing_attendee($where_cols_n_values = NULL) {
155 155
 		// search by combo of first and last names plus the email address
156
-		$attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email );
156
+		$attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email);
157 157
 		// no search params means attendee object already exists.
158
-		$where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys;
158
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys;
159 159
 		$valid_data = TRUE;
160 160
 		// check for required values
161
-		$valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE;
162
-		$valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE;
163
-		$valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE;
161
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE;
162
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE;
163
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE;
164 164
 
165
-		if ( $valid_data ) {
166
-			$attendee = $this->get_attendee( $where_cols_n_values );
167
-			if ( $attendee instanceof EE_Attendee ) {
165
+		if ($valid_data) {
166
+			$attendee = $this->get_attendee($where_cols_n_values);
167
+			if ($attendee instanceof EE_Attendee) {
168 168
 				return $attendee;
169 169
 			}
170 170
 		}
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
              * @param  array $ids array of EE_Registration ids
183 183
              * @return  EE_Attendee[]
184 184
              */
185
-            public function get_array_of_contacts_from_reg_ids( $ids ) {
185
+            public function get_array_of_contacts_from_reg_ids($ids) {
186 186
                 $ids = (array) $ids;
187 187
                 $_where = array(
188
-                    'Registration.REG_ID' => array( 'in', $ids )
188
+                    'Registration.REG_ID' => array('in', $ids)
189 189
                     );
190
-                return $this->get_all( array( $_where ) );
190
+                return $this->get_all(array($_where));
191 191
             }
192 192
 
193 193
 
Please login to merge, or discard this patch.
core/db_models/EEM_CPT_Base.model.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 define('EE_Event_Category_Taxonomy','espresso_event_category');
3 3
 /**
4
- *
5
- * EEM_CPT_Base
6
- *
7
- * For shared functionality between models internally implemented
8
- * as Custom Post Types. Subclass of EEM_Soft_Delete_Base, meaning that when you 'delete' one of these model objects
9
- * we actually default ot just trashing it. (It works differently than EEM_Soft_Delete under the hood,because there's a post status field
10
- * instead of a soft-delete flag, but the functionality is the same)
11
- * Note: if you add a new subclass of EEM_CPT_Base, you should add it as a relation
12
- * on EEM_Term_Taxonomy and EEM_Term_Relationship
13
- *
14
- * @package 			Event Espresso
15
- * @subpackage 	core
16
- * @author 				Mike Nelson
17
- *
18
- */
4
+	 *
5
+	 * EEM_CPT_Base
6
+	 *
7
+	 * For shared functionality between models internally implemented
8
+	 * as Custom Post Types. Subclass of EEM_Soft_Delete_Base, meaning that when you 'delete' one of these model objects
9
+	 * we actually default ot just trashing it. (It works differently than EEM_Soft_Delete under the hood,because there's a post status field
10
+	 * instead of a soft-delete flag, but the functionality is the same)
11
+	 * Note: if you add a new subclass of EEM_CPT_Base, you should add it as a relation
12
+	 * on EEM_Term_Taxonomy and EEM_Term_Relationship
13
+	 *
14
+	 * @package 			Event Espresso
15
+	 * @subpackage 	core
16
+	 * @author 				Mike Nelson
17
+	 *
18
+	 */
19 19
 abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{
20 20
 
21 21
 	/**
Please login to merge, or discard this patch.
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-define('EE_Event_Category_Taxonomy','espresso_event_category');
2
+define('EE_Event_Category_Taxonomy', 'espresso_event_category');
3 3
 /**
4 4
  *
5 5
  * EEM_CPT_Base
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @author 				Mike Nelson
17 17
  *
18 18
  */
19
-abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{
19
+abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base {
20 20
 
21 21
 	/**
22 22
 	 * @var string post_status_trashed - the wp post status for trashed cpts
@@ -44,42 +44,42 @@  discard block
 block discarded – undo
44 44
 	 * @param string $timezone
45 45
 	 * @throws \EE_Error
46 46
 	 */
47
-	protected function __construct( $timezone = NULL ){
47
+	protected function __construct($timezone = NULL) {
48 48
 
49 49
 		//adds a relationship to Term_Taxonomy for all these models. For this to work
50 50
 		//Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly
51 51
 		//eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry
52 52
 		//with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value
53 53
 		//must also be new EE_HABTM_Relation('Term_Relationship');
54
-		$this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship');
54
+		$this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship');
55 55
 		$primary_table_name = NULL;
56 56
 		//add  the common _status field to all CPT primary tables.
57
-		foreach ( $this->_tables as $alias => $table_obj ) {
58
-			if ( $table_obj instanceof EE_Primary_Table ) {
57
+		foreach ($this->_tables as $alias => $table_obj) {
58
+			if ($table_obj instanceof EE_Primary_Table) {
59 59
 				$primary_table_name = $alias;
60 60
 			}
61 61
 		}
62 62
 		//set default wp post statuses if child has not already set.
63
-		if ( ! isset( $this->_fields[$primary_table_name]['status'] )) {
63
+		if ( ! isset($this->_fields[$primary_table_name]['status'])) {
64 64
 			$this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft');
65 65
 		}
66
-		if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){
67
-			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, '');
66
+		if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) {
67
+			$this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, '');
68 68
 		}
69
-		if( ! isset( $this->_fields[$primary_table_name]['pinged'])){
70
-			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, '');
69
+		if ( ! isset($this->_fields[$primary_table_name]['pinged'])) {
70
+			$this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, '');
71 71
 		}
72 72
 
73
-		if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){
74
-			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open');
73
+		if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) {
74
+			$this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open');
75 75
 		}
76 76
 
77
-		if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){
77
+		if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) {
78 78
 			$this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open');
79 79
 		}
80 80
 
81
-		if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){
82
-			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, '');
81
+		if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) {
82
+			$this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, '');
83 83
 		}
84 84
 		parent::__construct($timezone);
85 85
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 	 */
93 93
 	public function public_event_stati() {
94 94
 		// @see wp-includes/post.php
95
-		return get_post_stati( array( 'public' => TRUE ));
95
+		return get_post_stati(array('public' => TRUE));
96 96
 	}
97 97
 
98 98
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	 * @return string
104 104
 	 * @throws EE_Error
105 105
 	 */
106
-	public function deleted_field_name(){
106
+	public function deleted_field_name() {
107 107
 		throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso")));
108 108
 	}
109 109
 
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 	 * @return string
115 115
 	 * @throws EE_Error
116 116
 	 */
117
-	public function post_status_field_name(){
117
+	public function post_status_field_name() {
118 118
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
119
-		if($field){
119
+		if ($field) {
120 120
 			return $field->get_name();
121
-		}else{
122
-			throw new EE_Error(sprintf(__('We are trying to find the post status 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)));
121
+		} else {
122
+			throw new EE_Error(sprintf(__('We are trying to find the post status 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)));
123 123
 		}
124 124
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @param array $query_params like EEM_Base::get_all's $query_params
131 131
 	 * @return array like EEM_Base::get_all's $query_params
132 132
 	 */
133
-	protected function _alter_query_params_so_only_trashed_items_included($query_params){
134
-		$post_status_field_name=$this->post_status_field_name();
135
-		$query_params[0][$post_status_field_name]=self::post_status_trashed;
133
+	protected function _alter_query_params_so_only_trashed_items_included($query_params) {
134
+		$post_status_field_name = $this->post_status_field_name();
135
+		$query_params[0][$post_status_field_name] = self::post_status_trashed;
136 136
 		return $query_params;
137 137
 	}
138 138
 
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 	 * @param array $query_params
144 144
 	 * @return array
145 145
 	 */
146
-	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){
147
-		$post_status_field_name=$this->post_status_field_name();
148
-		$query_params[0][$post_status_field_name]=array('IN',array_keys($this->get_status_array()));
146
+	protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) {
147
+		$post_status_field_name = $this->post_status_field_name();
148
+		$query_params[0][$post_status_field_name] = array('IN', array_keys($this->get_status_array()));
149 149
 		return $query_params;
150 150
 	}
151 151
 
@@ -157,11 +157,11 @@  discard block
 block discarded – undo
157 157
 	 * @param array $query_params like EEM_Base::get_all
158 158
 	 * @return boolean success
159 159
 	 */
160
-	function delete_or_restore($delete=true,$query_params = array()){
161
-		$post_status_field_name=$this->post_status_field_name();
160
+	function delete_or_restore($delete = true, $query_params = array()) {
161
+		$post_status_field_name = $this->post_status_field_name();
162 162
 		$query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params);
163 163
 		$new_status = $delete ? self::post_status_trashed : 'draft';
164
-		if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) {
164
+		if ($this->update(array($post_status_field_name=>$new_status), $query_params)) {
165 165
 			return TRUE;
166 166
 		} else {
167 167
 			return FALSE;
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public function meta_table() {
180 180
 		$meta_table = $this->_get_other_tables();
181
-		$meta_table = reset( $meta_table );
181
+		$meta_table = reset($meta_table);
182 182
 		return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL;
183 183
 	}
184 184
 
@@ -190,16 +190,16 @@  discard block
 block discarded – undo
190 190
 	 * @param  bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields.  Defaults to false (no db only fields)
191 191
 	 * @return array
192 192
 	 */
193
-	public function get_meta_table_fields( $all = FALSE ) {
193
+	public function get_meta_table_fields($all = FALSE) {
194 194
 		$all_fields = $fields_to_return = array();
195
-		foreach ( $this->_tables as $alias => $table_obj ) {
196
-			if ( $table_obj instanceof EE_Secondary_Table )
197
-				$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
195
+		foreach ($this->_tables as $alias => $table_obj) {
196
+			if ($table_obj instanceof EE_Secondary_Table)
197
+				$all_fields = array_merge($this->_get_fields_for_table($alias), $all_fields);
198 198
 		}
199 199
 
200
-		if ( !$all ) {
201
-			foreach ( $all_fields as $name => $obj ) {
202
-				if ( $obj instanceof EE_DB_Only_Field_Base )
200
+		if ( ! $all) {
201
+			foreach ($all_fields as $name => $obj) {
202
+				if ($obj instanceof EE_DB_Only_Field_Base)
203 203
 					continue;
204 204
 				$fields_to_return[] = $name;
205 205
 			}
@@ -222,13 +222,13 @@  discard block
 block discarded – undo
222 222
 	 * @param int $parent_term_taxonomy_id
223 223
 	 * @return EE_Term_Taxonomy
224 224
 	 */
225
-	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){
225
+	function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) {
226 226
 		//create term
227
-		require_once( EE_MODELS . 'EEM_Term.model.php');
227
+		require_once(EE_MODELS.'EEM_Term.model.php');
228 228
 		//first, check for a term by the same name or slug
229 229
 		$category_slug = sanitize_title($category_name);
230
-		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug))));
231
-		if( ! $term ){
230
+		$term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug))));
231
+		if ( ! $term) {
232 232
 			$term = EE_Term::new_instance(array(
233 233
 				'name'=>$category_name,
234 234
 				'slug'=>$category_slug
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 			$term->save();
237 237
 		}
238 238
 		//make sure there's a term-taxonomy entry too
239
-		require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php');
240
-		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy)));
239
+		require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php');
240
+		$term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy)));
241 241
 		/** @var $term_taxonomy EE_Term_Taxonomy */
242
-		if( ! $term_taxonomy ){
242
+		if ( ! $term_taxonomy) {
243 243
 			$term_taxonomy = EE_Term_Taxonomy::new_instance(array(
244 244
 				'term_id'=>$term->ID(),
245 245
 				'taxonomy'=>EE_Event_Category_Taxonomy,
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 				'parent'=>$parent_term_taxonomy_id
249 249
 			));
250 250
 			$term_taxonomy->save();
251
-		}else{
251
+		} else {
252 252
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
253 253
 			$term_taxonomy->save();
254 254
 		}
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	 * @param string $category_name name of the event category (term)
264 264
 	 * @return bool
265 265
 	 */
266
-	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){
266
+	function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) {
267 267
 		//find the term_taxonomy by that name
268
-		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy)));
268
+		$term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy)));
269 269
 		/** @var $term_taxonomy EE_Term_Taxonomy */
270
-		if( $term_taxonomy ){
270
+		if ($term_taxonomy) {
271 271
 			$term_taxonomy->set_count($term_taxonomy->count() - 1);
272 272
 			$term_taxonomy->save();
273 273
 		}
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 	 * @param string|array $attr Optional. Query string or array of attributes.
288 288
 	 * @return string HTML image element
289 289
 	 */
290
-	public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) {
291
-		return get_the_post_thumbnail( $id, $size, $attr );
290
+	public function get_feature_image($id, $size = 'thumbnail', $attr = '') {
291
+		return get_the_post_thumbnail($id, $size, $attr);
292 292
 	}
293 293
 
294 294
 
@@ -301,10 +301,10 @@  discard block
 block discarded – undo
301 301
 	 * @global array $wp_post_statuses set in wp core for storing all the post stati
302 302
 	 * @return array
303 303
 	 */
304
-	public function get_post_statuses(){
304
+	public function get_post_statuses() {
305 305
 		global $wp_post_statuses;
306 306
 		$statuses = array();
307
-		foreach($wp_post_statuses as $post_status => $args_object){
307
+		foreach ($wp_post_statuses as $post_status => $args_object) {
308 308
 			$statuses[$post_status] = $args_object->label;
309 309
 		}
310 310
 		return $statuses;
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
 	public function get_status_array() {
320 320
 		$statuses = $this->get_post_statuses();
321 321
 		//first the global filter
322
-		$statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses );
322
+		$statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses);
323 323
 		//now the class specific filter
324
-		$statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses );
324
+		$statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses);
325 325
 		return $statuses;
326 326
 	}
327 327
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	 */
334 334
 	public function get_custom_post_statuses() {
335 335
 		$new_stati = array();
336
-		foreach ( $this->_custom_stati as $status => $props ) {
336
+		foreach ($this->_custom_stati as $status => $props) {
337 337
 			$new_stati[$status] = $props['label'];
338 338
 		}
339 339
 		return $new_stati;
@@ -349,24 +349,24 @@  discard block
 block discarded – undo
349 349
 	 * @param WP_Post|array $post
350 350
 	 * @return EE_CPT_Base
351 351
 	 */
352
-	public function instantiate_class_from_post_object_orig($post){
353
-		$post = (array)$post;
352
+	public function instantiate_class_from_post_object_orig($post) {
353
+		$post = (array) $post;
354 354
 		$has_all_necessary_fields_for_table = true;
355 355
 		//check if the post has fields on the meta table already
356
-		foreach($this->_get_other_tables() as $table_obj){
356
+		foreach ($this->_get_other_tables() as $table_obj) {
357 357
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
358
-			foreach($fields_for_that_table as $field_obj){
359
-				if( ! isset($post[$field_obj->get_table_column()])
360
-					&& ! isset($post[$field_obj->get_qualified_column()])){
358
+			foreach ($fields_for_that_table as $field_obj) {
359
+				if ( ! isset($post[$field_obj->get_table_column()])
360
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
361 361
 					$has_all_necessary_fields_for_table = false;
362 362
 				}
363 363
 			}
364 364
 		}
365 365
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
366
-		if( ! $has_all_necessary_fields_for_table){
366
+		if ( ! $has_all_necessary_fields_for_table) {
367 367
 
368 368
 			return $this->get_one_by_ID($post['ID']);
369
-		}else{
369
+		} else {
370 370
 			return $this->instantiate_class_from_array_or_object($post);
371 371
 		}
372 372
 	}
@@ -377,30 +377,30 @@  discard block
 block discarded – undo
377 377
 	 * @param null $post
378 378
 	 * @return EE_Base_Class|EE_Soft_Delete_Base_Class
379 379
 	 */
380
-	public function instantiate_class_from_post_object( $post = NULL ){
381
-		if ( empty( $post )) {
380
+	public function instantiate_class_from_post_object($post = NULL) {
381
+		if (empty($post)) {
382 382
 			global $post;
383 383
 		}
384
-		$post = (array)$post;
384
+		$post = (array) $post;
385 385
 		$tables_needing_to_be_queried = array();
386 386
 		//check if the post has fields on the meta table already
387
-		foreach($this->get_tables() as $table_obj){
387
+		foreach ($this->get_tables() as $table_obj) {
388 388
 			$fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias());
389
-			foreach($fields_for_that_table as $field_obj){
390
-				if( ! isset($post[$field_obj->get_table_column()])
391
-					&& ! isset($post[$field_obj->get_qualified_column()])){
389
+			foreach ($fields_for_that_table as $field_obj) {
390
+				if ( ! isset($post[$field_obj->get_table_column()])
391
+					&& ! isset($post[$field_obj->get_qualified_column()])) {
392 392
 					$tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj;
393 393
 				}
394 394
 			}
395 395
 		}
396 396
 		//if we don't have all the fields we need, then just fetch the proper model from the DB
397
-		if( $tables_needing_to_be_queried){
398
-			if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){
397
+		if ($tables_needing_to_be_queried) {
398
+			if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) {
399 399
 				//so we're only missing data from a secondary table. Well that's not too hard to query for
400 400
 				$table_to_query = reset($tables_needing_to_be_queried);
401
-				$missing_data = $this->_do_wpdb_query( 'get_row', array( 'SELECT * FROM ' . $table_to_query->get_table_name() . ' WHERE ' . $table_to_query->get_fk_on_table() . ' = ' . $post['ID'], ARRAY_A ));
402
-				if ( ! empty( $missing_data )) {
403
-					$post = array_merge( $post, $missing_data );
401
+				$missing_data = $this->_do_wpdb_query('get_row', array('SELECT * FROM '.$table_to_query->get_table_name().' WHERE '.$table_to_query->get_fk_on_table().' = '.$post['ID'], ARRAY_A));
402
+				if ( ! empty($missing_data)) {
403
+					$post = array_merge($post, $missing_data);
404 404
 				}
405 405
 			} else {
406 406
 				return $this->get_one_by_ID($post['ID']);
@@ -417,15 +417,15 @@  discard block
 block discarded – undo
417 417
 	 * @throws EE_Error
418 418
 	 * @return string
419 419
 	 */
420
-	public function post_type(){
420
+	public function post_type() {
421 421
 		$post_type_field = NULL;
422
-		foreach($this->field_settings(true) as $field_obj){
423
-			if($field_obj instanceof EE_WP_Post_Type_Field){
424
-				$post_type_field = $field_obj;break;
422
+		foreach ($this->field_settings(true) as $field_obj) {
423
+			if ($field_obj instanceof EE_WP_Post_Type_Field) {
424
+				$post_type_field = $field_obj; break;
425 425
 			}
426 426
 		}
427
-		if($post_type_field == NULL){
428
-			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"),get_class($this)));
427
+		if ($post_type_field == NULL) {
428
+			throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"), get_class($this)));
429 429
 		}
430 430
 		return $post_type_field->get_default_value();
431 431
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -7 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		$field = $this->get_a_field_of_type('EE_WP_Post_Status_Field');
119 119
 		if($field){
120 120
 			return $field->get_name();
121
-		}else{
121
+		} else{
122 122
 			throw new EE_Error(sprintf(__('We are trying to find the post status 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)));
123 123
 		}
124 124
 	}
@@ -193,14 +193,16 @@  discard block
 block discarded – undo
193 193
 	public function get_meta_table_fields( $all = FALSE ) {
194 194
 		$all_fields = $fields_to_return = array();
195 195
 		foreach ( $this->_tables as $alias => $table_obj ) {
196
-			if ( $table_obj instanceof EE_Secondary_Table )
197
-				$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
196
+			if ( $table_obj instanceof EE_Secondary_Table ) {
197
+							$all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields );
198
+			}
198 199
 		}
199 200
 
200 201
 		if ( !$all ) {
201 202
 			foreach ( $all_fields as $name => $obj ) {
202
-				if ( $obj instanceof EE_DB_Only_Field_Base )
203
-					continue;
203
+				if ( $obj instanceof EE_DB_Only_Field_Base ) {
204
+									continue;
205
+				}
204 206
 				$fields_to_return[] = $name;
205 207
 			}
206 208
 		} else {
@@ -248,7 +250,7 @@  discard block
 block discarded – undo
248 250
 				'parent'=>$parent_term_taxonomy_id
249 251
 			));
250 252
 			$term_taxonomy->save();
251
-		}else{
253
+		} else{
252 254
 			$term_taxonomy->set_count($term_taxonomy->count() + 1);
253 255
 			$term_taxonomy->save();
254 256
 		}
@@ -366,7 +368,7 @@  discard block
 block discarded – undo
366 368
 		if( ! $has_all_necessary_fields_for_table){
367 369
 
368 370
 			return $this->get_one_by_ID($post['ID']);
369
-		}else{
371
+		} else{
370 372
 			return $this->instantiate_class_from_array_or_object($post);
371 373
 		}
372 374
 	}
Please login to merge, or discard this patch.
core/db_models/EEM_Checkin.model.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * ------------------------------------------------------------------------
25 25
  */
26
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
27
-require_once ( EE_CLASSES . 'EE_Checkin.class.php' );
26
+require_once (EE_MODELS.'EEM_Base.model.php');
27
+require_once (EE_CLASSES.'EE_Checkin.class.php');
28 28
 
29 29
 class EEM_Checkin extends EEM_Base {
30 30
 
@@ -40,12 +40,12 @@  discard block
 block discarded – undo
40 40
 	 * 		@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)
41 41
 	 * 		@return void
42 42
 	 */
43
-	protected function __construct( $timezone = NULL ) {
44
-		$this->singular_item = __('Check-In','event_espresso');
45
-		$this->plural_item = __('Check-Ins','event_espresso');
43
+	protected function __construct($timezone = NULL) {
44
+		$this->singular_item = __('Check-In', 'event_espresso');
45
+		$this->plural_item = __('Check-Ins', 'event_espresso');
46 46
 
47 47
 		$this->_tables = array(
48
-			'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID')
48
+			'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID')
49 49
 		);
50 50
 		$this->_fields = array(
51 51
 			'Checkin'=> array(
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 				'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'),
54 54
 				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'),
55 55
 				'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true),
56
-				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, time(), $timezone )
56
+				'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, time(), $timezone)
57 57
 			)
58 58
 		);
59 59
 		$this->_model_relations = array(
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			'Datetime'=>new EE_Belongs_To_Relation()
62 62
 		);
63 63
 		$this->_model_chain_to_wp_user = 'Registration.Event';
64
-		parent::__construct( $timezone );
64
+		parent::__construct($timezone);
65 65
 
66 66
 	}
67 67
 
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_Country.model.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 
84 84
 
85 85
 	/**
86
-	*		_get_countries
87
-	*
88
-	* 		@access		public
89
-	*		@return 		array
90
-	*/
86
+	 *		_get_countries
87
+	 *
88
+	 * 		@access		public
89
+	 *		@return 		array
90
+	 */
91 91
 	public function get_all_countries() {
92 92
 		if ( ! self::$_all_countries ) {
93 93
 			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 	}
97 97
 
98 98
 	/**
99
-	*		_get_countries
100
-	*		Gets and caches the list of active countries. If you know the list of active countries
101
-	*		has changed during this request, first use EEM_Country::reset() to flush the cache
102
-	* 		@access		public
103
-	*		@return 		array
104
-	*/
99
+	 *		_get_countries
100
+	 *		Gets and caches the list of active countries. If you know the list of active countries
101
+	 *		has changed during this request, first use EEM_Country::reset() to flush the cache
102
+	 * 		@access		public
103
+	 *		@return 		array
104
+	 */
105 105
 	public function get_all_active_countries() {
106 106
 		if ( ! self::$_active_countries ) {
107 107
 			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
 	 * Resets the country
37 37
 	 * @return EEM_Country
38 38
 	 */
39
-	public static function reset( $timezone = NULL ){
39
+	public static function reset($timezone = NULL) {
40 40
 		self::$_active_countries = NULL;
41 41
 		self::$_all_countries = NULL;
42
-		return parent::reset( $timezone );
42
+		return parent::reset($timezone);
43 43
 	}
44 44
 
45
-	protected function __construct( $timezone = NULL ){
46
-		$this->singular_item = __('Country','event_espresso');
47
-		$this->plural_item = __('Countries','event_espresso');
45
+	protected function __construct($timezone = NULL) {
46
+		$this->singular_item = __('Country', 'event_espresso');
47
+		$this->plural_item = __('Countries', 'event_espresso');
48 48
 
49 49
 
50 50
 		$this->_tables = array(
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 		);
53 53
 		$this->_fields = array(
54 54
 			'Country'=>array(
55
-				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists','event_espresso'), false, true),
56
-				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code','event_espresso')),
57
-				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code','event_espresso'), false,''),
58
-				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID','event_espresso'), false,0),//should be a foreign key, but no region table exists yet
59
-				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name','event_espresso'), false,''),
60
-				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code','event_espresso'), false),
61
-				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular','event_espresso'), false),
62
-				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural','event_espresso'), false),
63
-				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign','event_espresso'), false),
64
-				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number','event_espresso'), false, true),
65
-				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
66
-				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark','event_espresso'), false, '.'),
67
-				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator','event_espresso'), false, ','),
68
-				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code','event_espresso'), false, ''),
69
-				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU','event_espresso'), false, false)
55
+				'CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true),
56
+				'CNT_ISO'=> new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')),
57
+				'CNT_ISO3'=>new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''),
58
+				'RGN_ID'=>new EE_Integer_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), //should be a foreign key, but no region table exists yet
59
+				'CNT_name'=>new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''),
60
+				'CNT_cur_code'=>new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false),
61
+				'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false),
62
+				'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false),
63
+				'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false),
64
+				'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true),
65
+				'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
66
+				'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'),
67
+				'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','),
68
+				'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''),
69
+				'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)
70 70
 			));
71 71
 		$this->_model_relations = array(
72 72
 			'Attendee'=>new EE_Has_Many_Relation(),
@@ -74,9 +74,9 @@  discard block
 block discarded – undo
74 74
 			'Venue'=>new EE_Has_Many_Relation(),
75 75
 		);
76 76
 		//only anyone to view, but only those with the default role can do anything
77
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
77
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
78 78
 
79
-		parent::__construct( $timezone );
79
+		parent::__construct($timezone);
80 80
 	}
81 81
 
82 82
 
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 	*		@return 		array
90 90
 	*/
91 91
 	public function get_all_countries() {
92
-		if ( ! self::$_all_countries ) {
93
-			self::$_all_countries = $this->get_all( array( 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array( 0,99999 )));
92
+		if ( ! self::$_all_countries) {
93
+			self::$_all_countries = $this->get_all(array('order_by'=>array('CNT_name'=>'ASC'), 'limit'=> array(0, 99999)));
94 94
 		}
95 95
 		return self::$_all_countries;
96 96
 	}
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	*		@return 		array
104 104
 	*/
105 105
 	public function get_all_active_countries() {
106
-		if ( ! self::$_active_countries ) {
107
-			self::$_active_countries =  $this->get_all( array( array( 'CNT_active' => TRUE ), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array( 0, 99999 )));
106
+		if ( ! self::$_active_countries) {
107
+			self::$_active_countries = $this->get_all(array(array('CNT_active' => TRUE), 'order_by'=>array('CNT_name'=>'ASC'), 'limit'=>array(0, 99999)));
108 108
 		}
109 109
 		return self::$_active_countries;
110 110
 	}
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 * @param string $country_ISO
115 115
 	 * @return string
116 116
 	 */
117
-	public function get_country_name_by_ISO( $country_ISO ){
118
-		if( isset( self::$_all_countries[ $country_ISO ] ) &&
119
-				self::$_all_countries[ $country_ISO ] instanceof EE_Country ){
120
-			return self::$_all_countries[ $country_ISO ]->name();
117
+	public function get_country_name_by_ISO($country_ISO) {
118
+		if (isset(self::$_all_countries[$country_ISO]) &&
119
+				self::$_all_countries[$country_ISO] instanceof EE_Country) {
120
+			return self::$_all_countries[$country_ISO]->name();
121 121
 		}
122
-		$names = $this->get_col( array( array( 'CNT_ISO' => $country_ISO ), 'limit' => 1), 'CNT_name' );
123
-		if( is_array( $names ) && ! empty( $names ) ){
124
-			return reset( $names );
125
-		}else{
122
+		$names = $this->get_col(array(array('CNT_ISO' => $country_ISO), 'limit' => 1), 'CNT_name');
123
+		if (is_array($names) && ! empty($names)) {
124
+			return reset($names);
125
+		} else {
126 126
 			return '';
127 127
 		}
128 128
 	}
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_Currency.model.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,32 +25,32 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency extends EEM_Base{
28
+class EEM_Currency extends EEM_Base {
29 29
 		// private instance of the Attendee object
30 30
 	protected static $_instance = NULL;
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Currency','event_espresso');
34
-		$this->plural_item = __('Currencies','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Currency', 'event_espresso');
34
+		$this->plural_item = __('Currencies', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Currency'=> new EE_Primary_Table('esp_currency', 'CUR_code')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Currency'=>array(
40
-				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency COde','event_espresso')),
41
-				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular','event_espresso'), false),
42
-				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural','event_espresso'), false),
43
-				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign','event_espresso'), false),
44
-				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places','event_espresso'), false, 2),
45
-				'CUR_active'=>new EE_Boolean_Field('CUR_active', __("Active?", 'event_espresso'), false,true),
40
+				'CUR_code'=> new EE_Primary_Key_String_Field('CUR_code', __('Currency COde', 'event_espresso')),
41
+				'CUR_single' => new EE_Plain_Text_Field('CUR_single', __('Currency Name Singular', 'event_espresso'), false),
42
+				'CUR_plural' => new EE_Plain_Text_Field('CUR_plural', __('Currency Name Plural', 'event_espresso'), false),
43
+				'CUR_sign' => new EE_Plain_Text_Field('CUR_sign', __('Currency Sign', 'event_espresso'), false),
44
+				'CUR_dec_plc' => new EE_Integer_Field('CUR_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2),
45
+				'CUR_active'=>new EE_Boolean_Field('CUR_active', __("Active?", 'event_espresso'), false, true),
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Payment_Method'=>new EE_HABTM_Relation('Currency_Payment_Method'),
49 49
 		);
50 50
 		//this model is generally available for reading
51
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
51
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
52 52
 
53
-		parent::__construct( $timezone );
53
+		parent::__construct($timezone);
54 54
 	}
55 55
 
56 56
 	/**
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * @param array $query_params see EEM_Base::get_all
60 60
 	 * @return EE_Currency[]
61 61
 	 */
62
-	public function get_all_active($query_params = array()){
62
+	public function get_all_active($query_params = array()) {
63 63
 		$query_params[0]['CUR_active'] = true;
64
-		if( ! isset($query_params['order_by'])){
65
-			$query_params['order_by'] = array('CUR_code'=>'ASC','CUR_single'=>'ASC');
64
+		if ( ! isset($query_params['order_by'])) {
65
+			$query_params['order_by'] = array('CUR_code'=>'ASC', 'CUR_single'=>'ASC');
66 66
 		}
67 67
 		return $this->get_all($query_params);
68 68
 	}
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 * @param EE_PMT_Base $payment_method_type
72 72
 	 * @return EE_Currency[]
73 73
 	 */
74
-	public function get_all_currencies_usable_by($payment_method_type){
75
-		if($payment_method_type instanceof EE_PMT_Base &&
76
-				$payment_method_type->get_gateway()){
74
+	public function get_all_currencies_usable_by($payment_method_type) {
75
+		if ($payment_method_type instanceof EE_PMT_Base &&
76
+				$payment_method_type->get_gateway()) {
77 77
 			$currencies_supported = $payment_method_type->get_gateway()->currencies_supported();
78
-		}else{
78
+		} else {
79 79
 			$currencies_supported = EE_Gateway::all_currencies_supported;
80 80
 		}
81
-		if($currencies_supported == EE_Gateway::all_currencies_supported || empty( $currencies_supported ) ) {
81
+		if ($currencies_supported == EE_Gateway::all_currencies_supported || empty($currencies_supported)) {
82 82
 			$currencies = $this->get_all_active();
83
-		}else{
84
-			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN',$currencies_supported))));
83
+		} else {
84
+			$currencies = $this->get_all_active(array(array('CUR_code'=>array('IN', $currencies_supported))));
85 85
 		}
86 86
 		return $currencies;
87 87
 	}
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if (!defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('No direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
@@ -84,7 +85,7 @@  discard block
 block discarded – undo
84 85
 	public function is_valid() {
85 86
 		if(count($this->_validation_errors)){
86 87
 			return false;
87
-		}else{
88
+		} else{
88 89
 			return true;
89 90
 		}
90 91
 	}
@@ -113,7 +114,7 @@  discard block
 block discarded – undo
113 114
 		if($message_or_object instanceof EE_Validation_Error){
114 115
 			$validation_error= $message_or_object;
115 116
 			$validation_error->set_form_section($this);
116
-		}else{
117
+		} else{
117 118
 			$validation_error = new EE_Validation_Error($message_or_object, $error_code, $this, $previous_exception);
118 119
 		}
119 120
 		$this->_validation_errors[] = $validation_error;
Please login to merge, or discard this patch.
core/db_models/EEM_Currency_Payment_Method.model.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Currency_Payment_Method extends EEM_Base{
28
+class EEM_Currency_Payment_Method extends EEM_Base {
29 29
 	// private instance of the Attendee object
30 30
 	protected static $_instance = NULL;
31 31
 
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Currency Usable by Payment Method','event_espresso');
35
-		$this->plural_item = __('Currencies Usable by Payment Methods','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Currency Usable by Payment Method', 'event_espresso');
35
+		$this->plural_item = __('Currencies Usable by Payment Methods', 'event_espresso');
36 36
 		$this->_tables = array(
37
-			'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method','CPM_ID')
37
+			'Currency_Payment_Method'=>new EE_Primary_Table('esp_currency_payment_method', 'CPM_ID')
38 38
 		);
39 39
 		$this->_fields = array(
40 40
 			'Currency_Payment_Method'=>array(
41
-				'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID','event_espresso')),
42
-				'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code','event_espresso'), false, 0, 'Currency'),
43
-				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID','event_espresso'), false, 0, 'Payment_Method')
41
+				'CPM_ID'=>new EE_Primary_Key_Int_Field('CPM_ID', __('Currency to Payment Method LInk ID', 'event_espresso')),
42
+				'CUR_code'=>new EE_Foreign_Key_String_Field('CUR_code', __('Currency Code', 'event_espresso'), false, 0, 'Currency'),
43
+				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __('Paymetn Method ID', 'event_espresso'), false, 0, 'Payment_Method')
44 44
 			)
45 45
 		);
46 46
 		$this->_model_relations = array(
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 			'Payment_Method'=>new EE_Belongs_To_Relation()
49 49
 		);
50 50
 		//this model is generally available for reading
51
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
51
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
52 52
 		$this->_caps_slug = 'payment_methods';
53
-		parent::__construct( $timezone );
53
+		parent::__construct($timezone);
54 54
 	}
55 55
 }
56 56
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
core/db_models/EEM_Datetime_Ticket.model.php 2 patches
Spacing   +13 added lines, -13 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_Datetime_Ticket.class.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime_Ticket.class.php');
26 26
 
27 27
 class EEM_Datetime_Ticket extends EEM_Base {
28 28
 
@@ -37,28 +37,28 @@  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 = __('Datetime Ticket','event_espresso');
42
-		$this->plural_item = __('Datetime Tickets','event_espresso');
40
+	protected function __construct($timezone) {
41
+		$this->singular_item = __('Datetime Ticket', 'event_espresso');
42
+		$this->plural_item = __('Datetime Tickets', 'event_espresso');
43 43
 
44 44
 		$this->_tables = array(
45 45
 			'Datetime_Ticket'=> new EE_Primary_Table('esp_datetime_ticket', 'DTK_ID')
46 46
 		);
47 47
 		$this->_fields = array(
48 48
 			'Datetime_Ticket'=>array(
49
-				'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID','event_espresso')),
50
-				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime','event_espresso'), false, 0, 'Datetime' ),
51
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket','event_espresso'), false, 0, 'Ticket' )
49
+				'DTK_ID'=>new EE_Primary_Key_Int_Field('DTK_ID', __('Datetime Ticket ID', 'event_espresso')),
50
+				'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', __('The ID to the Datetime', 'event_espresso'), false, 0, 'Datetime'),
51
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('The ID to the Ticket', 'event_espresso'), false, 0, 'Ticket')
52 52
 			));
53 53
 		$this->_model_relations = array(
54 54
 			'Ticket'=>new EE_Belongs_To_Relation(),
55 55
 			'Datetime'=>new EE_Belongs_To_Relation()
56 56
 		);
57 57
 		//this model is generally available for reading
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Datetime.Event' );
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' );
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event' );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Datetime.Event', EEM_Base::caps_edit );
62
-		parent::__construct( $timezone );
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Datetime.Event');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event');
61
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Datetime.Event', EEM_Base::caps_edit);
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 } //end EEM_Datetime_Ticket class
65 65
\ No newline at end of file
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_Event.model.php 3 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
3 3
 /**
4
- *
5
- * EEM_Event Model
6
- *
7
- * extends EEM_CPT_Base which extends EEM_Base
8
- *
9
- * @package			Event Espresso
10
- * @subpackage		includes/models/
11
- * @author				Michael Nelson, Brent Christensen
12
- *
13
- */
4
+	 *
5
+	 * EEM_Event Model
6
+	 *
7
+	 * extends EEM_CPT_Base which extends EEM_Base
8
+	 *
9
+	 * @package			Event Espresso
10
+	 * @subpackage		includes/models/
11
+	 * @author				Michael Nelson, Brent Christensen
12
+	 *
13
+	 */
14 14
 class EEM_Event  extends EEM_CPT_Base{
15 15
 
16 16
 	/**
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 
173 173
 
174 174
 	/**
175
-	*		get_question_groups
176
-	*
177
-	* 		@access		public
178
-	*		@return 		array
179
-	*/
175
+	 *		get_question_groups
176
+	 *
177
+	 * 		@access		public
178
+	 *		@return 		array
179
+	 */
180 180
 	public function get_all_question_groups() {
181 181
 		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
182 182
 			array( 'QSG_deleted' => FALSE ),
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
190 190
 
191 191
 
192 192
 	/**
193
-	*		get_question_groups
194
-	*
195
-	* 		@access		public
196
-	* 		@param		int $EVT_ID
197
-	*		@return 		array
198
-	*/
193
+	 *		get_question_groups
194
+	 *
195
+	 * 		@access		public
196
+	 * 		@param		int $EVT_ID
197
+	 *		@return 		array
198
+	 */
199 199
 	public function get_all_event_question_groups( $EVT_ID = 0 ) {
200 200
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
201 201
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -211,13 +211,13 @@  discard block
 block discarded – undo
211 211
 
212 212
 
213 213
 	/**
214
-	*		get_question_groups
215
-	*
216
-	* 		@access		public
217
-	* 		@param		int $EVT_ID
218
-	* 		@param		boolean	$for_primary_attendee
219
-	*		@return 		array
220
-	*/
214
+	 *		get_question_groups
215
+	 *
216
+	 * 		@access		public
217
+	 * 		@param		int $EVT_ID
218
+	 * 		@param		boolean	$for_primary_attendee
219
+	 *		@return 		array
220
+	 */
221 221
 	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
222 222
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
223 223
 			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
@@ -234,13 +234,13 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 	/**
237
-	*		get_question_groups
238
-	*
239
-	* 		@access		public
240
-	* 		@param		int $EVT_ID
241
-	* 		@param		EE_Registration 	$registration
242
-	*		@return 		array
243
-	*/
237
+	 *		get_question_groups
238
+	 *
239
+	 * 		@access		public
240
+	 * 		@param		int $EVT_ID
241
+	 * 		@param		EE_Registration 	$registration
242
+	 *		@return 		array
243
+	 */
244 244
 	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
245 245
 
246 246
 		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
 
269 269
 
270 270
 	/**
271
-	*		get_question_target_db_column
272
-	*
273
-	* 		@access		public
274
-	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
275
-	*		@return 		array
276
-	*/
271
+	 *		get_question_target_db_column
272
+	 *
273
+	 * 		@access		public
274
+	 * 		@param		string		$QSG_IDs  csv list of $QSG IDs
275
+	 *		@return 		array
276
+	 */
277 277
 	public function get_questions_in_groups( $QSG_IDs = '' ) {
278 278
 
279 279
 		if ( empty( $QSG_IDs )) {
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 
300 300
 
301 301
 	/**
302
-	*		get_options_for_question
303
-	*
304
-	* 		@access		public
305
-	* 		@param		string		$QST_IDs  csv list of $QST IDs
306
-	*		@return 		array
307
-	*/
302
+	 *		get_options_for_question
303
+	 *
304
+	 * 		@access		public
305
+	 * 		@param		string		$QST_IDs  csv list of $QST IDs
306
+	 *		@return 		array
307
+	 */
308 308
 	public function get_options_for_question( $QST_IDs ) {
309 309
 
310 310
 		if ( empty( $QST_IDs )) {
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 
390 390
 
391 391
 	/**
392
-	*		_get_question_target_db_column
393
-	*
394
-	* 		@access		private
395
-	* 		@param		$QST
396
-	*		@return 		string		string
397
-	*/
392
+	 *		_get_question_target_db_column
393
+	 *
394
+	 * 		@access		private
395
+	 * 		@param		$QST
396
+	 *		@return 		string		string
397
+	 */
398 398
 	private function _generate_question_input_name( $QST ) {
399 399
 
400 400
 		if ( $QST->QST_system ) {
Please login to merge, or discard this patch.
Spacing   +157 added lines, -157 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_CPT_Base.model.php');
2
+require_once(EE_MODELS.'EEM_CPT_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * EEM_Event Model
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  * @author				Michael Nelson, Brent Christensen
12 12
  *
13 13
  */
14
-class EEM_Event  extends EEM_CPT_Base{
14
+class EEM_Event  extends EEM_CPT_Base {
15 15
 
16 16
 	/**
17 17
 	 * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event
@@ -51,15 +51,15 @@  discard block
 block discarded – undo
51 51
 	 * @param string $timezone
52 52
 	 * @return EEM_Event
53 53
 	 */
54
-	public static function instance( $timezone = NULL ){
54
+	public static function instance($timezone = NULL) {
55 55
 
56 56
 		// check if instance of EEM_Event already exists
57
-		if ( ! self::$_instance instanceof EEM_Event ) {
57
+		if ( ! self::$_instance instanceof EEM_Event) {
58 58
 			// instantiate Espresso_model
59
-			self::$_instance = new self( $timezone );
59
+			self::$_instance = new self($timezone);
60 60
 		}
61 61
 		//we might have a timezone set, let set_timezone decide what to do with it
62
-		self::$_instance->set_timezone( $timezone );
62
+		self::$_instance->set_timezone($timezone);
63 63
 		// EEM_Event object
64 64
 		return self::$_instance;
65 65
 	}
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 	 * @param string $timezone
71 71
 	 * @return EEM_Event
72 72
 	 */
73
-	protected function __construct($timezone = null){
73
+	protected function __construct($timezone = null) {
74 74
 
75
-		EE_Registry::instance()->load_model( 'Registration' );
75
+		EE_Registry::instance()->load_model('Registration');
76 76
 
77
-		$this->singular_item = __('Event','event_espresso');
78
-		$this->plural_item = __('Events','event_espresso');
77
+		$this->singular_item = __('Event', 'event_espresso');
78
+		$this->plural_item = __('Events', 'event_espresso');
79 79
 
80 80
 		// to remove Cancelled events from the frontend, copy the following filter to your functions.php file
81 81
 		// add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' );
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 			array(
90 90
 				EEM_Event::cancelled => array(
91 91
 					'label' => __('Cancelled', 'event_espresso'),
92
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE )
92
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE)
93 93
 				),
94 94
 				EEM_Event::postponed => array(
95 95
 					'label' => __('Postponed', 'event_espresso'),
96
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE )
96
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE)
97 97
 				),
98 98
 				EEM_Event::sold_out => array(
99 99
 					'label' => __('Sold Out', 'event_espresso'),
100
-					'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE )
100
+					'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE)
101 101
 				)
102 102
 			)
103 103
 		);
@@ -105,41 +105,41 @@  discard block
 block discarded – undo
105 105
 		EEM_Event::$_default_reg_status = EEM_Registration::status_id_pending_payment;
106 106
 
107 107
 		$this->_tables = array(
108
-			'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ),
109
-			'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' )
108
+			'Event_CPT'=>new EE_Primary_Table('posts', 'ID'),
109
+			'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID')
110 110
 		);
111 111
 
112 112
 		$this->_fields = array(
113 113
 			'Event_CPT'=>array(
114
-				'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )),
115
-				'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ),
116
-				'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ),
117
-				'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ),
118
-				'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, time()),
119
-				'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ),
120
-				'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, time()),
121
-				'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE),
122
-				'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ),
123
-				'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ),
124
-				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
-				'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati )
114
+				'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')),
115
+				'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''),
116
+				'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''),
117
+				'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''),
118
+				'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, time()),
119
+				'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''),
120
+				'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, time()),
121
+				'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE),
122
+				'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0),
123
+				'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1),
124
+				'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ),
125
+				'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati)
126 126
 			),
127 127
 			'Event_Meta'=>array(
128
-				'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ),
129
-				'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ),
130
-				'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ),
131
-				'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ),
132
-				'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, time()),
133
-				'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ),
128
+				'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE),
129
+				'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE),
130
+				'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1),
131
+				'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1),
132
+				'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, time()),
133
+				'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10),
134 134
 				'EVT_default_registration_status'=>new EE_Enum_Text_Field(
135
-					'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
135
+					'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, EEM_Event::$_default_reg_status, EEM_Registration::reg_status_array()
136 136
 				),
137
-				'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ),
138
-				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ),
139
-				'EVT_allow_overflow'=>new EE_Boolean_Field(  'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ),
140
-				'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ),
141
-				'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ),
142
-				'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE )
137
+				'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE),
138
+				'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE),
139
+				'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE),
140
+				'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE),
141
+				'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE),
142
+				'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE)
143 143
 
144 144
 			));
145 145
 
@@ -156,8 +156,8 @@  discard block
 block discarded – undo
156 156
 
157 157
 		$this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_events', 'EVTM_ID');
158 158
 		//this model is generally available for reading
159
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
160
-		parent::__construct( $timezone );
159
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
160
+		parent::__construct($timezone);
161 161
 	}
162 162
 
163 163
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	/**
166 166
 	 * @param string $default_reg_status
167 167
 	 */
168
-	public static function set_default_reg_status( $default_reg_status ) {
168
+	public static function set_default_reg_status($default_reg_status) {
169 169
 		self::$_default_reg_status = $default_reg_status;
170 170
 	}
171 171
 
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 	*		@return 		array
179 179
 	*/
180 180
 	public function get_all_question_groups() {
181
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
182
-			array( 'QSG_deleted' => FALSE ),
183
-			'order_by' => array( 'QSG_order' => 'ASC' )
181
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
182
+			array('QSG_deleted' => FALSE),
183
+			'order_by' => array('QSG_order' => 'ASC')
184 184
 		));
185 185
 	}
186 186
 
@@ -196,13 +196,13 @@  discard block
 block discarded – undo
196 196
 	* 		@param		int $EVT_ID
197 197
 	*		@return 		array
198 198
 	*/
199
-	public function get_all_event_question_groups( $EVT_ID = 0 ) {
200
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
201
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
199
+	public function get_all_event_question_groups($EVT_ID = 0) {
200
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
201
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
202 202
 			return FALSE;
203 203
 		}
204
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
205
-			array( 'EVT_ID' => $EVT_ID )
204
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
205
+			array('EVT_ID' => $EVT_ID)
206 206
 		));
207 207
 	}
208 208
 
@@ -218,13 +218,13 @@  discard block
 block discarded – undo
218 218
 	* 		@param		boolean	$for_primary_attendee
219 219
 	*		@return 		array
220 220
 	*/
221
-	public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) {
222
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
223
-			EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
221
+	public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) {
222
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
223
+			EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
224 224
 			return FALSE;
225 225
 		}
226
-		return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array(
227
-			array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee )
226
+		return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array(
227
+			array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee)
228 228
 		));
229 229
 	}
230 230
 
@@ -241,10 +241,10 @@  discard block
 block discarded – undo
241 241
 	* 		@param		EE_Registration 	$registration
242 242
 	*		@return 		array
243 243
 	*/
244
-	public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) {
244
+	public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) {
245 245
 
246
-		if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) {
247
-			EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
246
+		if ( ! isset($EVT_ID) || ! absint($EVT_ID)) {
247
+			EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
248 248
 			return FALSE;
249 249
 		}
250 250
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 			'QSG_deleted' => FALSE
255 255
 		);
256 256
 
257
-		return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array(
257
+		return EE_Registry::instance()->load_model('Question_Group')->get_all(array(
258 258
 			$where_params,
259 259
 			'order_by' => array('QSG_order' => 'ASC')
260 260
 		));
@@ -274,16 +274,16 @@  discard block
 block discarded – undo
274 274
 	* 		@param		string		$QSG_IDs  csv list of $QSG IDs
275 275
 	*		@return 		array
276 276
 	*/
277
-	public function get_questions_in_groups( $QSG_IDs = '' ) {
277
+	public function get_questions_in_groups($QSG_IDs = '') {
278 278
 
279
-		if ( empty( $QSG_IDs )) {
280
-			EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
279
+		if (empty($QSG_IDs)) {
280
+			EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
281 281
 			return FALSE;
282 282
 		}
283 283
 
284
-		return EE_Registry::instance()->load_model( 'Question' )->get_all( array(
284
+		return EE_Registry::instance()->load_model('Question')->get_all(array(
285 285
 			array(
286
-				'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ),
286
+				'Question_Group.QSG_ID' => array('IN', $QSG_IDs),
287 287
 				'QST_deleted' => FALSE,
288 288
 				'QST_admin_only' => is_admin()
289 289
 			),
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 	* 		@param		string		$QST_IDs  csv list of $QST IDs
306 306
 	*		@return 		array
307 307
 	*/
308
-	public function get_options_for_question( $QST_IDs ) {
308
+	public function get_options_for_question($QST_IDs) {
309 309
 
310
-		if ( empty( $QST_IDs )) {
311
-			EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
310
+		if (empty($QST_IDs)) {
311
+			EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
312 312
 			return FALSE;
313 313
 		}
314 314
 
315
-		return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array(
315
+		return EE_Registry::instance()->load_model('Question_Option')->get_all(array(
316 316
 			array(
317
-				'Question.QST_ID' => array( 'IN', $QST_IDs ),
317
+				'Question.QST_ID' => array('IN', $QST_IDs),
318 318
 				'QSO_deleted' => FALSE
319 319
 			),
320 320
 			'order_by' => 'QSO_ID'
@@ -333,45 +333,45 @@  discard block
 block discarded – undo
333 333
 	 * @throws EE_Error
334 334
 	 * @return 	array
335 335
 	 */
336
-	public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) {
336
+	public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) {
337 337
 
338
-		if ( empty( $EVT_ID ) ) {
339
-			throw new EE_Error( __( 'An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso' ) );
338
+		if (empty($EVT_ID)) {
339
+			throw new EE_Error(__('An error occurred. No EVT_ID is included.  Needed to know which question groups to retrieve.', 'event_espresso'));
340 340
 		}
341 341
 
342 342
 		$questions = array();
343 343
 
344 344
 		// get all question groups for event
345
-		$qgs = $this->get_question_groups_for_event( $EVT_ID, $registration );
346
-		if ( !empty( $qgs ) ) {
347
-			foreach ( $qgs as $qg ) {
345
+		$qgs = $this->get_question_groups_for_event($EVT_ID, $registration);
346
+		if ( ! empty($qgs)) {
347
+			foreach ($qgs as $qg) {
348 348
 			 	$qsts = $qg->questions();
349
-			 	$questions[ $qg->ID() ] = $qg->model_field_array();
350
-			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
351
-			 	foreach ( $qsts as $qst ) {
352
-			 		if ( $qst->is_system_question() )
349
+			 	$questions[$qg->ID()] = $qg->model_field_array();
350
+			 	$questions[$qg->ID()]['QSG_questions'] = array();
351
+			 	foreach ($qsts as $qst) {
352
+			 		if ($qst->is_system_question())
353 353
 			 			continue;
354
-			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
354
+			 		$answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID())));
355 355
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
356 356
 			 		$qst_name = $qstn_id = $qst->ID();
357 357
 			 		$ans_id = $answer->ID();
358
-			 		$qst_name = !empty( $ans_id ) ?  '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']';
358
+			 		$qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']';
359 359
 			 		$input_name = '';
360
-			 		$input_id = sanitize_key( $qst->display_text() );
360
+			 		$input_id = sanitize_key($qst->display_text());
361 361
 			 		$input_class = '';
362 362
 			 		$questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array();
363
-		 			$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name;
364
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id;
365
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class;
366
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array();
367
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst;
368
-					$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer;
369
-
370
-					if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) {
371
-						$QSOs = $qst->options(TRUE,$answer->value());
372
-						if ( is_array( $QSOs ) ) {
373
-							foreach ( $QSOs as $QSO_ID => $QSO ) {
374
-								$questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array();
363
+		 			$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name;
364
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id;
365
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class;
366
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array();
367
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst;
368
+					$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer;
369
+
370
+					if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') {
371
+						$QSOs = $qst->options(TRUE, $answer->value());
372
+						if (is_array($QSOs)) {
373
+							foreach ($QSOs as $QSO_ID => $QSO) {
374
+								$questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array();
375 375
 							}
376 376
 						}
377 377
 					}
@@ -395,9 +395,9 @@  discard block
 block discarded – undo
395 395
 	* 		@param		$QST
396 396
 	*		@return 		string		string
397 397
 	*/
398
-	private function _generate_question_input_name( $QST ) {
398
+	private function _generate_question_input_name($QST) {
399 399
 
400
-		if ( $QST->QST_system ) {
400
+		if ($QST->QST_system) {
401 401
 			$qst_name = $QST->QST_system;
402 402
 /*			switch( $QST->QST_system ) {
403 403
 
@@ -464,36 +464,36 @@  discard block
 block discarded – undo
464 464
 	 * @param bool    $count whether to return the count or not (default FALSE)
465 465
 	 * @return array 	EE_Event objects
466 466
 	 */
467
-	public function get_active_events( $query_params, $count = FALSE ) {
468
-		if ( array_key_exists( 0, $query_params ) ) {
467
+	public function get_active_events($query_params, $count = FALSE) {
468
+		if (array_key_exists(0, $query_params)) {
469 469
 			$where_params = $query_params[0];
470
-			unset( $query_params[0] );
470
+			unset($query_params[0]);
471 471
 		} else {
472 472
 			$where_params = array();
473 473
 		}
474 474
 
475 475
 		//if we have count make sure we don't include group by
476
-		if ( $count && isset( $query_params['group_by'] ) ) {
477
-			unset( $query_params['group_by'] );
476
+		if ($count && isset($query_params['group_by'])) {
477
+			unset($query_params['group_by']);
478 478
 		}
479 479
 
480 480
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
481 481
 		$where_params['status'] = 'publish';
482 482
 		//if already have where params for DTT_EVT_start or DTT_EVT_end then append these conditions
483
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
484
-			$where_params['Datetime.DTT_EVT_start******'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
483
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
484
+			$where_params['Datetime.DTT_EVT_start******'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
485 485
 		} else {
486
-			$where_params['Datetime.DTT_EVT_start'] = array('<',  EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
486
+			$where_params['Datetime.DTT_EVT_start'] = array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
487 487
 		}
488 488
 
489
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
490
-			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
489
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
490
+			$where_params['Datetime.DTT_EVT_end*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
491 491
 		} else {
492
-			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
492
+			$where_params['Datetime.DTT_EVT_end'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
493 493
 		}
494 494
 		$query_params[0] = $where_params;
495 495
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
496
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
496
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
497 497
 	}
498 498
 
499 499
 
@@ -508,30 +508,30 @@  discard block
 block discarded – undo
508 508
 	 * @param bool    $count whether to return the count or not (default FALSE)
509 509
 	 * @return array               EE_Event objects
510 510
 	 */
511
-	public function get_upcoming_events( $query_params, $count = FALSE ) {
512
-		if ( array_key_exists( 0, $query_params ) ) {
511
+	public function get_upcoming_events($query_params, $count = FALSE) {
512
+		if (array_key_exists(0, $query_params)) {
513 513
 			$where_params = $query_params[0];
514
-			unset( $query_params[0] );
514
+			unset($query_params[0]);
515 515
 		} else {
516 516
 			$where_params = array();
517 517
 		}
518 518
 
519 519
 		//if we have count make sure we don't include group by
520
-		if ( $count && isset( $query_params['group_by'] ) ) {
521
-			unset( $query_params['group_by'] );
520
+		if ($count && isset($query_params['group_by'])) {
521
+			unset($query_params['group_by']);
522 522
 		}
523 523
 
524 524
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
525 525
 		$where_params['status'] = 'publish';
526 526
 		//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
527
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
528
-			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
527
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
528
+			$where_params['Datetime.DTT_EVT_start*****'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
529 529
 		} else {
530
-			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) );
530
+			$where_params['Datetime.DTT_EVT_start'] = array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start'));
531 531
 		}
532 532
 		$query_params[0] = $where_params;
533 533
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
534
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
534
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
535 535
 	}
536 536
 
537 537
 
@@ -543,56 +543,56 @@  discard block
 block discarded – undo
543 543
 	 * @param bool    $count whether to return the count or not (default FALSE)
544 544
 	 * @return array 	EE_Event objects
545 545
 	 */
546
-	public function get_expired_events( $query_params, $count = FALSE ) {
546
+	public function get_expired_events($query_params, $count = FALSE) {
547 547
 
548
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
548
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
549 549
 
550 550
 		//if we have count make sure we don't include group by
551
-		if ( $count && isset( $query_params['group_by'] ) ) {
552
-			unset( $query_params['group_by'] );
551
+		if ($count && isset($query_params['group_by'])) {
552
+			unset($query_params['group_by']);
553 553
 		}
554 554
 
555 555
 		//let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries.
556
-		if ( isset( $where_params['status'] ) ) {
557
-			unset( $where_params['status'] );
556
+		if (isset($where_params['status'])) {
557
+			unset($where_params['status']);
558 558
 		}
559 559
 		$exclude_query = $query_params;
560
-		if ( isset( $exclude_query[0] ) ) {
561
-			unset( $exclude_query[0] );
560
+		if (isset($exclude_query[0])) {
561
+			unset($exclude_query[0]);
562 562
 		}
563
-		$exclude_query[0] = array( 'Datetime.DTT_EVT_end' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) );
563
+		$exclude_query[0] = array('Datetime.DTT_EVT_end' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')));
564 564
 		//first get all events that have datetimes where its not expired.
565
-		$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Event_CPT.ID' );
566
-		$event_ids = array_keys( $event_ids );
565
+		$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Event_CPT.ID');
566
+		$event_ids = array_keys($event_ids);
567 567
 
568 568
 		//if we have any additional query_params, let's add them to the 'AND' condition
569 569
 		$and_condition = array(
570
-			'Datetime.DTT_EVT_end' => array( '<', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ),
571
-			'EVT_ID' =>  array( 'NOT IN', $event_ids )
570
+			'Datetime.DTT_EVT_end' => array('<', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end')),
571
+			'EVT_ID' =>  array('NOT IN', $event_ids)
572 572
 			);
573 573
 
574
-		if ( isset( $where_params['OR'] ) ) {
574
+		if (isset($where_params['OR'])) {
575 575
 			$and_condition['OR'] = $where_params['OR'];
576
-			unset( $where_params['OR'] );
576
+			unset($where_params['OR']);
577 577
 		}
578 578
 
579
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
579
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
580 580
 			$and_condition['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
581
-			unset( $where_params['Datetime.DTT_EVT_end'] );
581
+			unset($where_params['Datetime.DTT_EVT_end']);
582 582
 		}
583 583
 
584
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
584
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
585 585
 			$and_condition['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
586
-			unset( $where_params['Datetime.DTT_EVT_start'] );
586
+			unset($where_params['Datetime.DTT_EVT_start']);
587 587
 		}
588 588
 
589 589
 		//merge remaining $where params with the and conditions.
590
-		$and_condtion = array_merge( $and_condition, $where_params );
590
+		$and_condtion = array_merge($and_condition, $where_params);
591 591
 
592 592
 		$where_params['AND'] = $and_condition;
593 593
 		$query_params[0] = $where_params;
594 594
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
595
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
595
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
596 596
 	}
597 597
 
598 598
 
@@ -603,40 +603,40 @@  discard block
 block discarded – undo
603 603
 	 * @param  boolean $count        whether to return the count or not (default FALSE)
604 604
 	 * @return EE_Event[]            array of EE_Event objects
605 605
 	 */
606
-	public function get_inactive_events( $query_params, $count = FALSE ) {
607
-		$where_params = isset( $query_params[0] ) ? $query_params[0] : array();
606
+	public function get_inactive_events($query_params, $count = FALSE) {
607
+		$where_params = isset($query_params[0]) ? $query_params[0] : array();
608 608
 
609 609
 		//let's add in specific query_params for inactive events.
610
-		if ( isset( $where_params['status'] ) ) {
611
-			unset( $where_params['status'] );
610
+		if (isset($where_params['status'])) {
611
+			unset($where_params['status']);
612 612
 		}
613 613
 
614 614
 		//if we have count make sure we don't include group by
615
-		if ( $count && isset( $query_params['group_by'] ) ) {
616
-			unset( $query_params['group_by'] );
615
+		if ($count && isset($query_params['group_by'])) {
616
+			unset($query_params['group_by']);
617 617
 		}
618 618
 
619 619
 		//if we have any additional query_params, let's add them to the 'AND' condition
620
-		$where_params['AND']['status'] = array( '!=', 'publish' );
620
+		$where_params['AND']['status'] = array('!=', 'publish');
621 621
 
622
-		if ( isset( $where_params['OR'] ) ) {
622
+		if (isset($where_params['OR'])) {
623 623
 			$where_params['AND']['OR'] = $where_params['OR'];
624
-			unset( $where_params['OR'] );
624
+			unset($where_params['OR']);
625 625
 		}
626 626
 
627
-		if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
627
+		if (isset($where_params['Datetime.DTT_EVT_end'])) {
628 628
 			$where_params['AND']['Datetime.DTT_EVT_end****'] = $where_params['Datetime.DTT_EVT_end'];
629
-			unset( $where_params['Datetime.DTT_EVT_end'] );
629
+			unset($where_params['Datetime.DTT_EVT_end']);
630 630
 		}
631 631
 
632
-		if ( isset( $where_params['Datetime.DTT_EVT_start'] ) ) {
632
+		if (isset($where_params['Datetime.DTT_EVT_start'])) {
633 633
 			$where_params['AND']['Datetime.DTT_EVT_start'] = $where_params['Datetime.DTT_EVT_start'];
634
-			unset( $where_params['Datetime.DTT_EVT_start'] );
634
+			unset($where_params['Datetime.DTT_EVT_start']);
635 635
 		}
636 636
 
637 637
 		$query_params[0] = $where_params;
638 638
 		// don't use $query_params with count() because we don't want to include additional query clauses like "GROUP BY" 
639
-		return $count ? $this->count( array( $where_params ), 'EVT_ID', true ) : $this->get_all( $query_params );
639
+		return $count ? $this->count(array($where_params), 'EVT_ID', true) : $this->get_all($query_params);
640 640
 	}
641 641
 
642 642
 
@@ -644,13 +644,13 @@  discard block
 block discarded – undo
644 644
 	 * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event.
645 645
 	 * See parent for param descriptions
646 646
 	 */
647
-	public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){
647
+	public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) {
648 648
 
649
-		if ( $relationName == 'Price' ) {
649
+		if ($relationName == 'Price') {
650 650
 			//let's get the PRC object for the given ID to make sure that we aren't dealing with a default
651 651
 			$prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj);
652 652
 			//if EVT_ID = 0, then this is a default
653
-			if ( $prc_chk->get('EVT_ID') == 0 ) {
653
+			if ($prc_chk->get('EVT_ID') == 0) {
654 654
 				//let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation
655 655
 				$prc_chk->set('PRC_ID', 0);
656 656
 			}
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 		}
661 661
 
662 662
 		//otherwise carry on as normal
663
-		return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query);
663
+		return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query);
664 664
 	}
665 665
 
666 666
 
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
 require_once( EE_MODELS . 'EEM_CPT_Base.model.php');
3 5
 /**
4 6
  *
@@ -349,8 +351,9 @@  discard block
 block discarded – undo
349 351
 			 	$questions[ $qg->ID() ] = $qg->model_field_array();
350 352
 			 	$questions[ $qg->ID() ]['QSG_questions'] = array();
351 353
 			 	foreach ( $qsts as $qst ) {
352
-			 		if ( $qst->is_system_question() )
353
-			 			continue;
354
+			 		if ( $qst->is_system_question() ) {
355
+			 					 			continue;
356
+			 		}
354 357
 			 		$answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) );
355 358
 			 		$answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object();
356 359
 			 		$qst_name = $qstn_id = $qst->ID();
Please login to merge, or discard this patch.
core/db_models/EEM_Event_Message_Template.model.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@
 block discarded – undo
7 7
  */
8 8
  if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
9 9
  /**
10
- *	EEM_Event_Message_Template
11
- *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
- *
13
- * @package		Event Espresso
14
- * @subpackage 	models
15
- * @since 			4.3.0
16
- * @author			 Darren Ethier
17
- *
18
- * ------------------------------------------------------------------------
19
- */
10
+  *	EEM_Event_Message_Template
11
+  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
12
+  *
13
+  * @package		Event Espresso
14
+  * @subpackage 	models
15
+  * @since 			4.3.0
16
+  * @author			 Darren Ethier
17
+  *
18
+  * ------------------------------------------------------------------------
19
+  */
20 20
 require_once( EE_MODELS . 'EEM_Base.model.php' );
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  *
18 18
  * ------------------------------------------------------------------------
19 19
  */
20
-require_once( EE_MODELS . 'EEM_Base.model.php' );
20
+require_once(EE_MODELS.'EEM_Base.model.php');
21 21
 
22 22
 class EEM_Event_Message_Template extends EEM_Base {
23 23
 
@@ -30,29 +30,29 @@  discard block
 block discarded – undo
30 30
 	 * @access private
31 31
 	 * @return void
32 32
 	 */
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singlular_item = __('Event Message Template','event_espresso');
35
-		$this->plural_item = __('Event Message Templates','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singlular_item = __('Event Message Template', 'event_espresso');
35
+		$this->plural_item = __('Event Message Templates', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38 38
 			'Event_Message_Template'=> new EE_Primary_Table('esp_event_message_template', 'EMT_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Event_Message_Template'=>array(
42
-				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID','event_espresso')),
43
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event','event_espresso'), false, 0, 'Event' ),
44
-				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group','event_espresso'), false, 0, 'Message_Template_Group' )
42
+				'EMT_ID'=>new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID', 'event_espresso')),
43
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event', 'event_espresso'), false, 0, 'Event'),
44
+				'GRP_ID'=>new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group', 'event_espresso'), false, 0, 'Message_Template_Group')
45 45
 			));
46 46
 		$this->_model_relations = array(
47 47
 			'Event'=>new EE_Belongs_To_Relation(),
48 48
 			'Message_Template_Group'=>new EE_Belongs_To_Relation()
49 49
 		);
50
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
51
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
52
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
53
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
50
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
51
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
52
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
53
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
54 54
 
55
-		parent::__construct( $timezone );
55
+		parent::__construct($timezone);
56 56
 	}
57 57
 
58 58
 
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @param  int    $GRP_ID The MTP group we want attached events for.
67 67
 	 * @return  array               An array of event ids.
68 68
 	 */
69
-	public function get_attached_event_ids( $GRP_ID ) {
70
-		$event_ids = $this->_get_all_wpdb_results( array( array( 'GRP_ID' => $GRP_ID ) ), ARRAY_N, 'EVT_ID' );
71
-		$event_ids = call_user_func_array( 'array_merge', $event_ids );
69
+	public function get_attached_event_ids($GRP_ID) {
70
+		$event_ids = $this->_get_all_wpdb_results(array(array('GRP_ID' => $GRP_ID)), ARRAY_N, 'EVT_ID');
71
+		$event_ids = call_user_func_array('array_merge', $event_ids);
72 72
 		return $event_ids;
73 73
 	}
74 74
 
@@ -81,17 +81,17 @@  discard block
 block discarded – undo
81 81
 	 *                         	       GRPIDs.
82 82
 	 * @return int 		       How many rows were deleted.
83 83
 	 */
84
-	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
85
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
86
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
84
+	public function delete_event_group_relations($GRP_IDs = array(), $EVT_IDs = array()) {
85
+		if (empty($GRP_IDs) && empty($EVT_IDs))
86
+			throw new EE_Error(sprintf(__('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso'), __METHOD__));
87 87
 
88
-		if ( !empty( $GRP_IDs ) )
89
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
88
+		if ( ! empty($GRP_IDs))
89
+			$where['GRP_ID'] = array('IN', (array) $GRP_IDs);
90 90
 
91
-		if ( !empty( $EVT_IDs ) )
92
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
91
+		if ( ! empty($EVT_IDs))
92
+			$where['EVT_ID'] = array('IN', (array) $EVT_IDs);
93 93
 
94
-		return $this->delete( array( $where ), FALSE );
94
+		return $this->delete(array($where), FALSE);
95 95
 	}
96 96
 
97 97
 } //end class EEM_Event_Message_Template
Please login to merge, or discard this patch.
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
  * @subpackage 	models
6 6
  * @since 			4.3.0
7 7
  */
8
- if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+ if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+ 	exit('No direct script access allowed');
10
+ }
9 11
  /**
10 12
  *	EEM_Event_Message_Template
11 13
  *	Model for relation table between EEM_Message_Template_Group and EEM_Event
@@ -82,14 +84,17 @@  discard block
 block discarded – undo
82 84
 	 * @return int 		       How many rows were deleted.
83 85
 	 */
84 86
 	public function delete_event_group_relations( $GRP_IDs = array(), $EVT_IDs = array() ) {
85
-		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) )
86
-			throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
87
+		if ( empty( $GRP_IDs ) && empty( $EVT_IDs ) ) {
88
+					throw new EE_Error( sprintf( __('%s requires either an array of GRP_IDs or EVT_IDs or both, but both cannot be empty.', 'event_espresso' ), __METHOD__ ) );
89
+		}
87 90
 
88
-		if ( !empty( $GRP_IDs ) )
89
-			$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
91
+		if ( !empty( $GRP_IDs ) ) {
92
+					$where['GRP_ID'] = array( 'IN', (array) $GRP_IDs );
93
+		}
90 94
 
91
-		if ( !empty( $EVT_IDs ) )
92
-			$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
95
+		if ( !empty( $EVT_IDs ) ) {
96
+					$where['EVT_ID'] = array( 'IN', (array) $EVT_IDs );
97
+		}
93 98
 
94 99
 		return $this->delete( array( $where ), FALSE );
95 100
 	}
Please login to merge, or discard this patch.