Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
17:38 queued 10s
created
core/db_models/EEM_Line_Item.model.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -103,41 +103,41 @@  discard block
 block discarded – undo
103 103
 	 * @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)
104 104
 	 * @return \EEM_Line_Item
105 105
 	 */
106
-	protected function __construct( $timezone ) {
107
-		$this->singular_item = __('Line Item','event_espresso');
108
-		$this->plural_item = __('Line Items','event_espresso');
106
+	protected function __construct($timezone) {
107
+		$this->singular_item = __('Line Item', 'event_espresso');
108
+		$this->plural_item = __('Line Items', 'event_espresso');
109 109
 
110 110
 		$this->_tables = array(
111
-			'Line_Item'=>new EE_Primary_Table('esp_line_item','LIN_ID')
111
+			'Line_Item'=>new EE_Primary_Table('esp_line_item', 'LIN_ID')
112 112
 		);
113
-		$line_items_can_be_for = apply_filters( 'FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket','Price', 'Event' ) );
113
+		$line_items_can_be_for = apply_filters('FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket', 'Price', 'Event'));
114 114
 		$this->_fields = array(
115 115
 			'Line_Item' => array(
116
-				'LIN_ID' 				=> new EE_Primary_Key_Int_Field( 'LIN_ID', __( "ID", "event_espresso" ) ),
117
-				'LIN_code' 			=> new EE_Slug_Field( 'LIN_code', __( "Code for index into Cart", "event_espresso" ), TRUE ),
118
-				'TXN_ID' 				=> new EE_Foreign_Key_Int_Field( 'TXN_ID', __( "Transaction ID", "event_espresso" ), TRUE, NULL, 'Transaction' ),
119
-				'LIN_name' 			=> new EE_Full_HTML_Field( 'LIN_name', __( "Line Item Name", "event_espresso" ), FALSE, '' ),
120
-				'LIN_desc' 			=> new EE_Full_HTML_Field( 'LIN_desc', __( "Line Item Description", "event_espresso" ), TRUE ),
121
-				'LIN_unit_price' 	=> new EE_Money_Field( 'LIN_unit_price', __( "Unit Price", "event_espresso" ), FALSE, 0 ),
122
-				'LIN_percent' 		=> new EE_Float_Field( 'LIN_percent', __( "Percent", "event_espresso" ), FALSE, 0 ),
123
-				'LIN_is_taxable' 	=> new EE_Boolean_Field( 'LIN_is_taxable', __( "Taxable", "event_espresso" ), FALSE, FALSE ),
124
-				'LIN_order' 			=> new EE_Integer_Field( 'LIN_order', __( "Order of Application towards total of parent", "event_espresso" ), FALSE, 1 ),
125
-				'LIN_total' 			=> new EE_Money_Field( 'LIN_total', __( "Total (unit price x quantity)", "event_espresso" ), FALSE, 0 ),
126
-				'LIN_quantity' 	=> new EE_Integer_Field( 'LIN_quantity', __( "Quantity", "event_espresso" ), TRUE, 1 ),
127
-				'LIN_parent' 		=> new EE_Integer_Field( 'LIN_parent', __( "Parent ID (this item goes towards that Line Item's total)", "event_espresso" ), TRUE, NULL ),
128
-				'LIN_type' 			=> new EE_Enum_Text_Field( 'LIN_type', __( "Type", "event_espresso" ), FALSE, 'line-item', array(
116
+				'LIN_ID' 				=> new EE_Primary_Key_Int_Field('LIN_ID', __("ID", "event_espresso")),
117
+				'LIN_code' 			=> new EE_Slug_Field('LIN_code', __("Code for index into Cart", "event_espresso"), TRUE),
118
+				'TXN_ID' 				=> new EE_Foreign_Key_Int_Field('TXN_ID', __("Transaction ID", "event_espresso"), TRUE, NULL, 'Transaction'),
119
+				'LIN_name' 			=> new EE_Full_HTML_Field('LIN_name', __("Line Item Name", "event_espresso"), FALSE, ''),
120
+				'LIN_desc' 			=> new EE_Full_HTML_Field('LIN_desc', __("Line Item Description", "event_espresso"), TRUE),
121
+				'LIN_unit_price' 	=> new EE_Money_Field('LIN_unit_price', __("Unit Price", "event_espresso"), FALSE, 0),
122
+				'LIN_percent' 		=> new EE_Float_Field('LIN_percent', __("Percent", "event_espresso"), FALSE, 0),
123
+				'LIN_is_taxable' 	=> new EE_Boolean_Field('LIN_is_taxable', __("Taxable", "event_espresso"), FALSE, FALSE),
124
+				'LIN_order' 			=> new EE_Integer_Field('LIN_order', __("Order of Application towards total of parent", "event_espresso"), FALSE, 1),
125
+				'LIN_total' 			=> new EE_Money_Field('LIN_total', __("Total (unit price x quantity)", "event_espresso"), FALSE, 0),
126
+				'LIN_quantity' 	=> new EE_Integer_Field('LIN_quantity', __("Quantity", "event_espresso"), TRUE, 1),
127
+				'LIN_parent' 		=> new EE_Integer_Field('LIN_parent', __("Parent ID (this item goes towards that Line Item's total)", "event_espresso"), TRUE, NULL),
128
+				'LIN_type' 			=> new EE_Enum_Text_Field('LIN_type', __("Type", "event_espresso"), FALSE, 'line-item', array(
129 129
 						self::type_line_item		=>  __("Line Item", "event_espresso"),
130 130
 						self::type_sub_line_item	=>  __("Sub-Item", "event_espresso"),
131 131
 						self::type_sub_total		=>  __("Subtotal", "event_espresso"),
132 132
 						self::type_tax_sub_total 	=> __("Tax Subtotal", "event_espresso"),
133 133
 						self::type_tax					=>  __("Tax", "event_espresso"),
134 134
 						self::type_total				=>  __("Total", "event_espresso"),
135
-						self::type_cancellation	=> __( 'Cancellation', 'event_espresso' )
135
+						self::type_cancellation	=> __('Cancellation', 'event_espresso')
136 136
 					)
137 137
 				),
138
-				'OBJ_ID' 					=> new EE_Foreign_Key_Int_Field( 'OBJ_ID', __( 'ID of Item purchased.', 'event_espresso' ), TRUE, NULL, $line_items_can_be_for ),
139
-				'OBJ_type'				=>new EE_Any_Foreign_Model_Name_Field( 'OBJ_type', __( "Model Name this Line Item is for", "event_espresso" ), TRUE, NULL, $line_items_can_be_for ),
140
-				'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created','event_espresso'), false, time(), $timezone ),
138
+				'OBJ_ID' 					=> new EE_Foreign_Key_Int_Field('OBJ_ID', __('ID of Item purchased.', 'event_espresso'), TRUE, NULL, $line_items_can_be_for),
139
+				'OBJ_type'				=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Model Name this Line Item is for", "event_espresso"), TRUE, NULL, $line_items_can_be_for),
140
+				'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created', 'event_espresso'), false, time(), $timezone),
141 141
 			)
142 142
 		);
143 143
 		$this->_model_relations = array(
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		);
149 149
 		$this->_model_chain_to_wp_user = 'Transaction.Registration.Event';
150 150
 		$this->_caps_slug = 'transactions';
151
-		parent::__construct( $timezone );
151
+		parent::__construct($timezone);
152 152
 	}
153 153
 
154 154
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 	 * @param EE_Transaction|int $transaction
160 160
 	 * @return EE_Line_Item[]
161 161
 	 */
162
-	public function get_all_of_type_for_transaction( $line_item_type, $transaction ){
163
-		$transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction );
164
-		return $this->get_all( array( array(
162
+	public function get_all_of_type_for_transaction($line_item_type, $transaction) {
163
+		$transaction = EEM_Transaction::instance()->ensure_is_ID($transaction);
164
+		return $this->get_all(array(array(
165 165
 			'LIN_type' => $line_item_type,
166 166
 			'TXN_ID' => $transaction
167 167
 		)));
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * @param EE_Transaction|int $transaction
176 176
 	 * @return \EE_Base_Class[]
177 177
 	 */
178
-	public function get_all_non_ticket_line_items_for_transaction( $transaction ) {
179
-		$transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction );
180
-		return $this->get_all( array( array(
178
+	public function get_all_non_ticket_line_items_for_transaction($transaction) {
179
+		$transaction = EEM_Transaction::instance()->ensure_is_ID($transaction);
180
+		return $this->get_all(array(array(
181 181
 			'LIN_type' => self::type_line_item,
182 182
 			'TXN_ID' => $transaction,
183 183
 			'OR' => array(
184
-				'OBJ_type*notticket' => array( '!=', 'Ticket'),
185
-				'OBJ_type*null' => array( 'IS_NULL' ))
184
+				'OBJ_type*notticket' => array('!=', 'Ticket'),
185
+				'OBJ_type*null' => array('IS_NULL'))
186 186
 		)));
187 187
 	}
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * because if there are spam bots afoot there will be LOTS of line items
193 193
 	 * @return int count of how many deleted
194 194
 	 */
195
-	public function delete_line_items_with_no_transaction(){
195
+	public function delete_line_items_with_no_transaction() {
196 196
 		/** @type WPDB $wpdb */
197 197
 		global $wpdb;
198 198
 		$time_to_leave_alone = apply_filters(
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 		);
201 201
 		$query = $wpdb->prepare(
202 202
 				'DELETE li
203
-				FROM ' . $this->table() . ' li
204
-				LEFT JOIN ' . EEM_Transaction::instance()->table(). ' t ON li.TXN_ID = t.TXN_ID
203
+				FROM ' . $this->table().' li
204
+				LEFT JOIN ' . EEM_Transaction::instance()->table().' t ON li.TXN_ID = t.TXN_ID
205 205
 				WHERE t.TXN_ID IS NULL AND li.LIN_timestamp < %s',
206 206
 				// use GMT time because that's what TXN_timestamps are in
207
-				gmdate(  'Y-m-d H:i:s', time() - $time_to_leave_alone )
207
+				gmdate('Y-m-d H:i:s', time() - $time_to_leave_alone)
208 208
 				);
209
-		return $wpdb->query( $query );
209
+		return $wpdb->query($query);
210 210
 	}
211 211
 
212 212
 
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @param \EE_Base_Class $object
220 220
 	 * @return EE_Line_Item[]
221 221
 	 */
222
-	public function get_line_item_for_transaction_object( $TXN_ID, EE_Base_Class $object ){
223
-		return $this->get_all( array( array(
222
+	public function get_line_item_for_transaction_object($TXN_ID, EE_Base_Class $object) {
223
+		return $this->get_all(array(array(
224 224
 			'TXN_ID' 		=> $TXN_ID,
225
-			'OBJ_type' 	=> str_replace( 'EE_', '', get_class( $object )),
225
+			'OBJ_type' 	=> str_replace('EE_', '', get_class($object)),
226 226
 			'OBJ_ID' 		=> $object->ID()
227 227
 		)));
228 228
 	}
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 	 * @param array $OBJ_IDs
239 239
 	 * @return EE_Line_Item[]
240 240
 	 */
241
-	public function get_object_line_items_for_transaction( $TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array() ){
241
+	public function get_object_line_items_for_transaction($TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array()) {
242 242
 		$query_params = array(
243 243
 			'OBJ_type' 	=> $OBJ_type,
244 244
 			// if incoming $OBJ_IDs is an array, then make sure it is formatted correctly for the query
245
-			'OBJ_ID' 		=> is_array( $OBJ_IDs ) && ! isset( $OBJ_IDs['IN'] ) ? array( 'IN', $OBJ_IDs ) : $OBJ_IDs
245
+			'OBJ_ID' 		=> is_array($OBJ_IDs) && ! isset($OBJ_IDs['IN']) ? array('IN', $OBJ_IDs) : $OBJ_IDs
246 246
 		);
247
-		if ( $TXN_ID ) {
247
+		if ($TXN_ID) {
248 248
 			$query_params['TXN_ID'] = $TXN_ID;
249 249
 		}
250
-		return $this->get_all( array( $query_params ));
250
+		return $this->get_all(array($query_params));
251 251
 	}
252 252
 
253 253
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param EE_Promotion $promotion
263 263
 	 * @return EE_Line_Item
264 264
 	 */
265
-	public function get_existing_promotion_line_item( EE_Line_Item $parent_line_item, EE_Promotion $promotion ) {
266
-		return $this->get_one( array(
265
+	public function get_existing_promotion_line_item(EE_Line_Item $parent_line_item, EE_Promotion $promotion) {
266
+		return $this->get_one(array(
267 267
 			array(
268 268
 				'TXN_ID' 			=> $parent_line_item->TXN_ID(),
269 269
 				'LIN_parent' 	=> $parent_line_item->ID(),
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param EE_Line_Item $parent_line_item
285 285
 	 * @return EE_Line_Item[]
286 286
 	 */
287
-	public function get_all_promotion_line_items( EE_Line_Item $parent_line_item ) {
288
-		return $this->get_all( array(
287
+	public function get_all_promotion_line_items(EE_Line_Item $parent_line_item) {
288
+		return $this->get_all(array(
289 289
 			array(
290 290
 				'TXN_ID' 			=> $parent_line_item->TXN_ID(),
291 291
 				'LIN_parent' 	=> $parent_line_item->ID(),
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param EE_Registration $registration
303 303
 	 * @return EEM_Line_ITem
304 304
 	 */
305
-	public function get_line_item_for_registration( EE_Registration $registration ) {
306
-		return $this->get_one( $this->line_item_for_registration_query_params( $registration ));
305
+	public function get_line_item_for_registration(EE_Registration $registration) {
306
+		return $this->get_one($this->line_item_for_registration_query_params($registration));
307 307
 	}
308 308
 
309 309
 	/**
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
 	 * @param array $original_query_params any extra query params you'd like to be merged with
313 313
 	 * @return array like EEM_Base::get_all()'s $query_params
314 314
 	 */
315
-	public function line_item_for_registration_query_params( EE_Registration $registration, $original_query_params = array() ) {
316
-		return array_replace_recursive( $original_query_params, array(
315
+	public function line_item_for_registration_query_params(EE_Registration $registration, $original_query_params = array()) {
316
+		return array_replace_recursive($original_query_params, array(
317 317
 			array(
318 318
 				'OBJ_ID' => $registration->ticket_ID(),
319 319
 				'OBJ_type' => 'Ticket',
320 320
 				'TXN_ID' => $registration->transaction_ID()
321 321
 			)
322
-		) );
322
+		));
323 323
 	}
324 324
 
325 325
 
Please login to merge, or discard this patch.
core/db_models/EEM_Question_Option.model.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once( EE_CLASSES . 'EE_Question_Option.class.php');
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once(EE_CLASSES.'EE_Question_Option.class.php');
26 26
 
27 27
 
28 28
 class EEM_Question_Option extends EEM_Soft_Delete_Base {
@@ -30,22 +30,22 @@  discard block
 block discarded – undo
30 30
   	// private instance of the Attendee object
31 31
 	protected static $_instance = NULL;
32 32
 
33
-	protected function __construct( $timezone = NULL ) {
34
-		$this->singular_item = __('Question Option','event_espresso');
35
-		$this->plural_item = __('Question Options','event_espresso');
33
+	protected function __construct($timezone = NULL) {
34
+		$this->singular_item = __('Question Option', 'event_espresso');
35
+		$this->plural_item = __('Question Options', 'event_espresso');
36 36
 
37 37
 		$this->_tables = array(
38
-			'Question_Option'=>new EE_Primary_Table('esp_question_option','QSO_ID')
38
+			'Question_Option'=>new EE_Primary_Table('esp_question_option', 'QSO_ID')
39 39
 		);
40 40
 		$this->_fields = array(
41 41
 			'Question_Option'=>array(
42
-					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID','event_espresso')),
43
-					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'),
44
-					'QSO_value'=>new EE_Plain_Text_Field('QSO_value',  __("Question Option Value", "event_espresso"),false,''),
45
-					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description','event_espresso'), false, ''),
46
-					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso' ), false, 0 ),
47
-					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option','event_espresso'), TRUE, NULL ),
48
-					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed','event_espresso'), false, false)
42
+					'QSO_ID'=>new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')),
43
+					'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'),
44
+					'QSO_value'=>new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''),
45
+					'QSO_desc'=>new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''),
46
+					'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0),
47
+					'QSO_system'=>new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL),
48
+					'QSO_deleted'=>new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false)
49 49
 				)
50 50
 		);
51 51
 		$this->_model_relations = array(
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->_model_chain_to_wp_user = 'Question';
56 56
 		//this model is generally available for reading
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
58
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('Question_Option');
57
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
58
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option');
59
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option');
60
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option');
61 61
 		$this->_caps_slug = 'questions';
62
-		parent::__construct( $timezone );
62
+		parent::__construct($timezone);
63 63
 	}
64 64
 
65 65
 
Please login to merge, or discard this patch.
core/db_models/EEM_System_Status.model.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -215,17 +215,17 @@
 block discarded – undo
215 215
 	 * Whether or not a .maintenance file is detected
216 216
 	 * @return string descripting wp_maintenance_mode status
217 217
 	 */
218
-    function get_wp_maintenance_mode() {
219
-        $opened = file_exists( ABSPATH . '.maintenance' );
220
-        return $opened ? sprintf( __('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>','</strong>' ) : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
221
-    }
218
+	function get_wp_maintenance_mode() {
219
+		$opened = file_exists( ABSPATH . '.maintenance' );
220
+		return $opened ? sprintf( __('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>','</strong>' ) : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
221
+	}
222 222
 	/**
223 223
 	 * Whether or not logging is enabled
224 224
 	 * @return string descripting logging's status
225 225
 	 */
226 226
 	function get_logging_enabled(){
227
-            $opened = @fopen( EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a' );
228
-            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf( __('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"','</mark>' ) ;
227
+			$opened = @fopen( EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a' );
228
+			return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf( __('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"','</mark>' ) ;
229 229
 	}
230 230
 	/**
231 231
 	 *  Whether curl ro fsock works
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 /**
4 4
  * Model for retrieving Information about the Event Espresso status.
5 5
  */
6
-class EEM_System_Status{
6
+class EEM_System_Status {
7 7
 
8 8
 	// private instance of the EEM_System_Status object
9 9
 	protected static $_instance = NULL;
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		}
27 27
 		return self::$_instance;
28 28
 	}
29
-	private function __construct(){
29
+	private function __construct() {
30 30
 
31 31
 	}
32 32
 	/**
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @return array where each key is a function name on this class, and each value is SOMETHING--
35 35
 	 * it might be a value, an array, or an object
36 36
 	 */
37
-	function get_system_stati(){
37
+	function get_system_stati() {
38 38
 		return array(
39 39
 				'ee_version'=>$this->get_ee_version(),
40 40
 				'ee_activation_history'=>$this->get_ee_activation_history(),
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	 *
56 56
 	 * @return string
57 57
 	 */
58
-	function get_ee_version(){
58
+	function get_ee_version() {
59 59
 		return espresso_version();
60 60
 	}
61 61
 	/**
62 62
 	 *
63 63
 	 * @return string
64 64
 	 */
65
-	function php_version(){
65
+	function php_version() {
66 66
 		return phpversion();
67 67
 	}
68 68
 	/**
@@ -79,16 +79,16 @@  discard block
 block discarded – undo
79 79
 		'DomainPath' => 'Domain Path',
80 80
 		'Network' => 'Network',
81 81
 	 */
82
-	function get_active_plugins(){
83
-		$active_plugins = (array) get_option( 'active_plugins', array() );
84
-		if ( is_multisite() )
85
-			$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
86
-		$active_plugins = array_map( 'strtolower', $active_plugins );
82
+	function get_active_plugins() {
83
+		$active_plugins = (array) get_option('active_plugins', array());
84
+		if (is_multisite())
85
+			$active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
86
+		$active_plugins = array_map('strtolower', $active_plugins);
87 87
 		$plugin_info = array();
88
-		foreach ( $active_plugins as $plugin ) {
89
-				$plugin_data = @get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin );
88
+		foreach ($active_plugins as $plugin) {
89
+				$plugin_data = @get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin);
90 90
 
91
-				$plugin_info[ $plugin ] = $plugin_data;
91
+				$plugin_info[$plugin] = $plugin_data;
92 92
 		}
93 93
 		return $plugin_info;
94 94
 	}
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	 *
98 98
 	 * @return array with keys 'home_url' and 'site_url'
99 99
 	 */
100
-	function get_wp_settings(){
101
-		$wp_memory_int = $this->let_to_num( WP_MEMORY_LIMIT );
102
-		if ( $wp_memory_int < 67108864 ) {
103
-			$wp_memory_to_display = '<mark class="error">' . sprintf( __('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"' ) . '</mark>';
100
+	function get_wp_settings() {
101
+		$wp_memory_int = $this->let_to_num(WP_MEMORY_LIMIT);
102
+		if ($wp_memory_int < 67108864) {
103
+			$wp_memory_to_display = '<mark class="error">'.sprintf(__('%s - We recommend setting memory to at least 64MB. See: %s Increasing memory allocated to PHP %s', 'event_espresso'), WP_MEMORY_LIMIT, '<a href="http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP">', '</a>"').'</mark>';
104 104
 		} else {
105
-			$wp_memory_to_display = '<mark class="yes">' . size_format( $wp_memory_int ) . '</mark>';
105
+			$wp_memory_to_display = '<mark class="yes">'.size_format($wp_memory_int).'</mark>';
106 106
 		}
107 107
 		return array(
108
-			'name'=>get_bloginfo('name','display'),
108
+			'name'=>get_bloginfo('name', 'display'),
109 109
 			'is_multisite'=>is_multisite(),
110
-			'version'=>  get_bloginfo( 'version', 'display' ),
110
+			'version'=>  get_bloginfo('version', 'display'),
111 111
 			'home_url'=>home_url(),
112 112
 			'site_url'=>site_url(),
113 113
 			'WP_DEBUG'=>WP_DEBUG,
@@ -116,8 +116,8 @@  discard block
 block discarded – undo
116 116
 			'gmt_offset'=>get_option('gmt_offset'),
117 117
 			'timezone_string'=>get_option('timezone_string'),
118 118
 			'admin_email'=>  get_bloginfo('admin_email', 'display'),
119
-			'language'=>get_bloginfo('language','display'),
120
-			'wp_max_upload_size' => size_format( wp_max_upload_size() ),
119
+			'language'=>get_bloginfo('language', 'display'),
120
+			'wp_max_upload_size' => size_format(wp_max_upload_size()),
121 121
 			'wp_memory' => $wp_memory_to_display
122 122
 			);
123 123
 	}
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * Gets an array of information about the history of ee versions installed
127 127
 	 * @return array
128 128
 	 */
129
-	function get_ee_activation_history(){
129
+	function get_ee_activation_history() {
130 130
 		return get_option('espresso_db_update');
131 131
 	}
132 132
 
@@ -135,11 +135,11 @@  discard block
 block discarded – undo
135 135
 	 * Gets an array where keys are ee versions, and their values are arrays indicating all the different times that version was installed
136 136
 	 * @return EE_Data_Migration_Script_Base[]
137 137
 	 */
138
-	function get_ee_migration_history(){
138
+	function get_ee_migration_history() {
139 139
 		$options = EE_Data_Migration_Manager::instance()->get_all_migration_script_options();
140 140
 		$presentable_migration_scripts = array();
141
-		foreach($options as $option_array){
142
-			$presentable_migration_scripts[str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix,"",$option_array['option_name'])] = maybe_unserialize($option_array['option_value']);
141
+		foreach ($options as $option_array) {
142
+			$presentable_migration_scripts[str_replace(EE_Data_Migration_Manager::data_migration_script_option_prefix, "", $option_array['option_name'])] = maybe_unserialize($option_array['option_value']);
143 143
 		}
144 144
 		return $presentable_migration_scripts;
145 145
 //		return get_option(EE_Data_Migration_Manager::data_migrations_option_name);//EE_Data_Migration_Manager::instance()->get_data_migrations_ran();
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 	 *
150 150
 	 * @return array like EE_Config class
151 151
 	 */
152
-	function get_ee_config(){
152
+	function get_ee_config() {
153 153
 		return EE_Config::instance();
154 154
 	}
155 155
 
@@ -157,24 +157,24 @@  discard block
 block discarded – undo
157 157
 	 * Gets an array of php setup info, pilfered from http://www.php.net/manual/en/function.phpinfo.php#87463
158 158
 	 * @return array like the output of phpinfo(), but in an array
159 159
 	 */
160
-	function get_php_info(){
160
+	function get_php_info() {
161 161
 		ob_start();
162 162
 		phpinfo(-1);
163 163
 
164 164
 		$pi = preg_replace(
165 165
 		array('#^.*<body>(.*)</body>.*$#ms', '#<h2>PHP License</h2>.*$#ms',
166
-		'#<h1>Configuration</h1>#',  "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
166
+		'#<h1>Configuration</h1>#', "#\r?\n#", "#</(h1|h2|h3|tr)>#", '# +<#',
167 167
 		"#[ \t]+#", '#&nbsp;#', '#  +#', '# class=".*?"#', '%&#039;%',
168 168
 		 '#<tr>(?:.*?)" src="(?:.*?)=(.*?)" alt="PHP Logo" /></a>'
169 169
 		 .'<h1>PHP Version (.*?)</h1>(?:\n+?)</td></tr>#',
170 170
 		 '#<h1><a href="(?:.*?)\?=(.*?)">PHP Credits</a></h1>#',
171 171
 		 '#<tr>(?:.*?)" src="(?:.*?)=(.*?)"(?:.*?)Zend Engine (.*?),(?:.*?)</tr>#',
172 172
 		 "# +#", '#<tr>#', '#</tr>#'),
173
-		array('$1', '', '', '', '</$1>' . "\n", '<', ' ', ' ', ' ', '', ' ',
173
+		array('$1', '', '', '', '</$1>'."\n", '<', ' ', ' ', ' ', '', ' ',
174 174
 		 '<h2>PHP Configuration</h2>'."\n".'<tr><td>PHP Version</td><td>$2</td></tr>'.
175 175
 		 "\n".'<tr><td>PHP Egg</td><td>$1</td></tr>',
176 176
 		 '<tr><td>PHP Credits Egg</td><td>$1</td></tr>',
177
-		 '<tr><td>Zend Engine</td><td>$2</td></tr>' . "\n" .
177
+		 '<tr><td>Zend Engine</td><td>$2</td></tr>'."\n".
178 178
 		 '<tr><td>Zend Egg</td><td>$1</td></tr>', ' ', '%S%', '%E%'),
179 179
 		ob_get_clean());
180 180
 
@@ -182,14 +182,14 @@  discard block
 block discarded – undo
182 182
 		unset($sections[0]);
183 183
 
184 184
 		$pi = array();
185
-		foreach($sections as $section){
185
+		foreach ($sections as $section) {
186 186
 		  $n = substr($section, 0, strpos($section, '</h2>'));
187 187
 		  preg_match_all(
188 188
 		  '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
189 189
 			$section, $askapache, PREG_SET_ORDER);
190
-		  foreach($askapache as $m)
190
+		  foreach ($askapache as $m)
191 191
 			  $m2 = isset($m[2]) ? $m[2] : null;
192
-			  $pi[$n][$m[1]]=(!isset($m[3])||$m2==$m[3]) ? $m2 : array_slice($m,2);
192
+			  $pi[$n][$m[1]] = ( ! isset($m[3]) || $m2 == $m[3]) ? $m2 : array_slice($m, 2);
193 193
 		}
194 194
 
195 195
 		return $pi;
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
 	 * Checks if site responds ot HTTPS
200 200
 	 * @return boolean
201 201
 	 */
202
-	function get_https_enabled(){
202
+	function get_https_enabled() {
203 203
 		$home = str_replace("http://", "https://", home_url());
204 204
 		$response = wp_remote_get($home);
205
-		if($response instanceof WP_Error){
205
+		if ($response instanceof WP_Error) {
206 206
 			$error_string = '';
207
-			foreach($response->errors as $short_name => $description_array){
208
-				$error_string .= "<b>$short_name</b>: ".implode(", ",$description_array);
207
+			foreach ($response->errors as $short_name => $description_array) {
208
+				$error_string .= "<b>$short_name</b>: ".implode(", ", $description_array);
209 209
 			}
210 210
 			return $error_string;
211 211
 		}
@@ -216,32 +216,32 @@  discard block
 block discarded – undo
216 216
 	 * @return string descripting wp_maintenance_mode status
217 217
 	 */
218 218
     function get_wp_maintenance_mode() {
219
-        $opened = file_exists( ABSPATH . '.maintenance' );
220
-        return $opened ? sprintf( __('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>','</strong>' ) : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso')  ;
219
+        $opened = file_exists(ABSPATH.'.maintenance');
220
+        return $opened ? sprintf(__('%s.maintenance file detected.%s Wordpress may have a failed auto-update which could prevent Event Espresso from updating the database correctly.', 'event_espresso'), '<strong>', '</strong>') : __('.maintenance file not detected. WordPress is not in maintenance mode.', 'event_espresso');
221 221
     }
222 222
 	/**
223 223
 	 * Whether or not logging is enabled
224 224
 	 * @return string descripting logging's status
225 225
 	 */
226
-	function get_logging_enabled(){
227
-            $opened = @fopen( EVENT_ESPRESSO_UPLOAD_DIR . '/logs/espresso_log.txt', 'a' );
228
-            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf( __('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"','</mark>' ) ;
226
+	function get_logging_enabled() {
227
+            $opened = @fopen(EVENT_ESPRESSO_UPLOAD_DIR.'/logs/espresso_log.txt', 'a');
228
+            return $opened ? __('Log Directory is writable', 'event_espresso') : sprintf(__('%sLog directory is NOT writable%s', 'event_espresso'), '<mark class="error"', '</mark>');
229 229
 	}
230 230
 	/**
231 231
 	 *  Whether curl ro fsock works
232 232
 	 * @return string describing posting's status
233 233
 	 */
234
-	function get_remote_posting(){
235
-		$fsock_works = function_exists( 'fsockopen' );
236
-		$curl_works = function_exists( 'curl_init' );
237
-		if ( $fsock_works && $curl_works ) {
234
+	function get_remote_posting() {
235
+		$fsock_works = function_exists('fsockopen');
236
+		$curl_works = function_exists('curl_init');
237
+		if ($fsock_works && $curl_works) {
238 238
 			$status = __('Your server has fsockopen and cURL enabled.', 'event_espresso');
239
-		} elseif ( $fsock_works ) {
239
+		} elseif ($fsock_works) {
240 240
 			$status = __('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso');
241
-		} elseif( $curl_works ) {
241
+		} elseif ($curl_works) {
242 242
 			$status = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
243
-		}else{
244
-			$status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso'). '</mark>';
243
+		} else {
244
+			$status = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'event_espresso').'</mark>';
245 245
 		}
246 246
 		return $status;
247 247
 
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * Gets all the php.ini settings
251 251
 	 * @return array
252 252
 	 */
253
-	function get_php_ini_all(){
253
+	function get_php_ini_all() {
254 254
 		return ini_get_all();
255 255
 	}
256 256
 	/**
@@ -259,10 +259,10 @@  discard block
 block discarded – undo
259 259
 	 * @param type $size
260 260
 	 * @return int
261 261
 	 */
262
-	function let_to_num( $size ) {
263
-		$l 		= substr( $size, -1 );
264
-		$ret 	= substr( $size, 0, -1 );
265
-		switch( strtoupper( $l ) ) {
262
+	function let_to_num($size) {
263
+		$l = substr($size, -1);
264
+		$ret = substr($size, 0, -1);
265
+		switch (strtoupper($l)) {
266 266
 			case 'P':
267 267
 				$ret *= 1024;
268 268
 			case 'T':
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Relationship.model.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -21,61 +21,61 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Relationship extends EEM_Base {
27 27
 
28 28
   	// private instance of the Attendee object
29 29
 	protected static $_instance = NULL;
30 30
 
31
-	protected function __construct( $timezone = NULL ) {
32
-		$this->singular_item = __('Term Relationship','event_espresso');
33
-		$this->plural_item = __('Term Relationships','event_espresso');
31
+	protected function __construct($timezone = NULL) {
32
+		$this->singular_item = __('Term Relationship', 'event_espresso');
33
+		$this->plural_item = __('Term Relationships', 'event_espresso');
34 34
 		$this->_tables = array(
35 35
 			'Term_Relationship'=> new EE_Primary_Table('term_relationships')
36 36
 		);
37
-		$models_this_can_attach_to = array_keys( EE_Registry::instance()->cpt_models() );
37
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
38 38
 		$this->_fields = array(
39 39
 			'Term_Relationship'=>array(
40
-				'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID','event_espresso'), false,0, $models_this_can_attach_to ),
41
-				'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'term_order'=>new EE_Integer_Field('term_order', __('Term Order','event_espresso'), false, 0)
40
+				'object_id'=> new EE_Foreign_Key_Int_Field('object_id', __('Object(Post) ID', 'event_espresso'), false, 0, $models_this_can_attach_to),
41
+				'term_taxonomy_id'=>new EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID', 'event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'term_order'=>new EE_Integer_Field('term_order', __('Term Order', 'event_espresso'), false, 0)
43 43
 			));
44 44
 		$this->_model_relations = array(
45 45
 			'Term_Taxonomy'=>new EE_Belongs_To_Relation()
46 46
 		);
47
-		foreach( $models_this_can_attach_to as $model_name ) {
48
-			$this->_model_relations[ $model_name ] = new EE_Belongs_To_Relation();
47
+		foreach ($models_this_can_attach_to as $model_name) {
48
+			$this->_model_relations[$model_name] = new EE_Belongs_To_Relation();
49 49
 		}
50 50
 		$this->_indexes = array(
51
-			'PRIMARY'=>new EE_Primary_Key_Index(array('object_id','term_taxonomy_id'))
51
+			'PRIMARY'=>new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id'))
52 52
 		);
53 53
 		$path_to_event_model = 'Event.';
54
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( $path_to_event_model );
55
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model );
56
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model );
57
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( $path_to_event_model, EEM_Base::caps_edit );
54
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event_model);
55
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
56
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model);
57
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event_model, EEM_Base::caps_edit);
58 58
 
59 59
 		$path_to_tax_model = 'Term_Taxonomy.';
60 60
 		//add cap restrictions for editing term relations to the "ee_assign_*"
61 61
 		//and for deleting term relations too
62
-		$cap_contexts_affected = array( EEM_Base::caps_edit, EEM_Base::caps_delete );
63
-		foreach( $cap_contexts_affected as $cap_context_affected ) {
64
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_category'] = new EE_Default_Where_Conditions(
62
+		$cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete);
63
+		foreach ($cap_contexts_affected as $cap_context_affected) {
64
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_event_category'] = new EE_Default_Where_Conditions(
65 65
 					array(
66
-						$path_to_tax_model . 'taxonomy*ee_assign_event_category' => array( '!=', 'espresso_event_categories' )
66
+						$path_to_tax_model.'taxonomy*ee_assign_event_category' => array('!=', 'espresso_event_categories')
67 67
 					));
68
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_venue_category'] = new EE_Default_Where_Conditions(
68
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_venue_category'] = new EE_Default_Where_Conditions(
69 69
 					array(
70
-						$path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array( '!=', 'espresso_venue_categories' )
70
+						$path_to_tax_model.'taxonomy*ee_assign_venue_category' => array('!=', 'espresso_venue_categories')
71 71
 					));
72
-			$this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_type'] = new EE_Default_Where_Conditions(
72
+			$this->_cap_restrictions[$cap_context_affected]['ee_assign_event_type'] = new EE_Default_Where_Conditions(
73 73
 					array(
74
-						$path_to_tax_model . 'taxonomy*ee_assign_event_type' => array( '!=', 'espresso_event_type' )
74
+						$path_to_tax_model.'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type')
75 75
 					));
76 76
 		}
77 77
 
78
-		parent::__construct( $timezone );
78
+		parent::__construct($timezone);
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,17 +84,17 @@  discard block
 block discarded – undo
84 84
 	 * @global type $wpdb
85 85
 	 * @return int the number of rows affected
86 86
 	 */
87
-	public function update_term_taxonomy_counts($term_taxonomy_id = NULL){
87
+	public function update_term_taxonomy_counts($term_taxonomy_id = NULL) {
88 88
 		//because this uses a subquery and sometimes assigning to column to be another column's
89 89
 		//value, we just write the SQL directly.
90 90
 		global $wpdb;
91
-		if( $term_taxonomy_id ){
92
-			$second_operand = $wpdb->prepare('%d',$term_taxonomy_id);
93
-		}else{
91
+		if ($term_taxonomy_id) {
92
+			$second_operand = $wpdb->prepare('%d', $term_taxonomy_id);
93
+		} else {
94 94
 			$second_operand = 'tr.term_taxonomy_id';
95 95
 		}
96
-		$rows_affected = $this->_do_wpdb_query( 'query' , array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
97
-from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)" ) );
96
+		$rows_affected = $this->_do_wpdb_query('query', array("UPDATE {$wpdb->term_taxonomy} AS tt SET count = (select count(*) as proper_count
97
+from {$wpdb->term_relationships} AS tr WHERE tt.term_taxonomy_id = $second_operand)"));
98 98
 		return $rows_affected;
99 99
 	}
100 100
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function insert($field_n_values) {
108 108
 		$return = parent::insert($field_n_values);
109
-		if( isset( $field_n_values[ 'term_taxonomy_id' ] ) ) {
110
-			$this->update_term_taxonomy_counts($field_n_values[ 'term_taxonomy_id' ] );
109
+		if (isset($field_n_values['term_taxonomy_id'])) {
110
+			$this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']);
111 111
 		}
112 112
 		return $return;
113 113
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 	 * @return int
124 124
 	 */
125 125
 	public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = TRUE) {
126
-		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync );
127
-		if( $count ){
126
+		$count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync);
127
+		if ($count) {
128 128
 			$this->update_term_taxonomy_counts();
129 129
 		}
130 130
 		return $count;
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function delete($query_params, $allow_blocking = true) {
140 140
 		$count = parent::delete($query_params, $allow_blocking);
141
-		if( $count ){
141
+		if ($count) {
142 142
 			$this->update_term_taxonomy_counts();
143 143
 		}
144 144
 		return $count;
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
24
+require_once (EE_MODELS.'EEM_Base.model.php');
25 25
 
26 26
 class EEM_Term_Taxonomy extends EEM_Base {
27 27
 
@@ -29,67 +29,67 @@  discard block
 block discarded – undo
29 29
 	protected static $_instance = NULL;
30 30
 
31 31
 
32
-	protected function __construct( $timezone = NULL ) {
33
-		$this->singular_item = __('Term Taxonomy','event_espresso');
34
-		$this->plural_item = __('Term Taxonomy','event_espresso');
32
+	protected function __construct($timezone = NULL) {
33
+		$this->singular_item = __('Term Taxonomy', 'event_espresso');
34
+		$this->plural_item = __('Term Taxonomy', 'event_espresso');
35 35
 		$this->_tables = array(
36 36
 			'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id')
37 37
 		);
38 38
 		$this->_fields = array(
39 39
 			'Term_Taxonomy'=>array(
40
-				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')),
41
-				'term_id'=>new EE_Foreign_Key_Int_Field('term_id',  __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
-				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'),
43
-				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false,''),
44
-				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0),
40
+				'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')),
41
+				'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'),
42
+				'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'),
43
+				'description'=>new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''),
44
+				'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0),
45 45
 				'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)
46 46
 			));
47 47
 		$this->_model_relations = array(
48 48
 			'Term_Relationship'=>new EE_Has_Many_Relation(),
49 49
 			'Term'=>new EE_Belongs_To_Relation(),
50 50
 		);
51
-		$cpt_models = array_keys( EE_Registry::instance()->cpt_models() );
52
-		foreach( $cpt_models  as $model_name ) {
53
-			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation( 'Term_Relationship' );
51
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
52
+		foreach ($cpt_models  as $model_name) {
53
+			$this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
54 54
 		}
55 55
 		$this->_indexes = array(
56
-			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy'))
56
+			'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy'))
57 57
 		);
58 58
 		$path_to_tax_model = '';
59
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
60
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected( $path_to_tax_model );
61
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
62
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
59
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
60
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected($path_to_tax_model);
61
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
62
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
63 63
 
64 64
 		//add cap restrictions for editing relating to the "ee_edit_*"
65
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
65
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
66 66
 				array(
67
-					$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array( '!=', 'espresso_event_categories' )
67
+					$path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')
68 68
 				));
69
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
69
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
70 70
 				array(
71
-					$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array( '!=', 'espresso_venue_categories' )
71
+					$path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')
72 72
 				));
73
-		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
73
+		$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
74 74
 				array(
75
-					$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array( '!=', 'espresso_event_type' )
75
+					$path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')
76 76
 				));
77 77
 
78 78
 		//add cap restrictions for deleting relating to the "ee_deleting_*"
79
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
79
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
80 80
 				array(
81
-					$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array( '!=', 'espresso_event_categories' )
81
+					$path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')
82 82
 				));
83
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
83
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
84 84
 				array(
85
-					$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array( '!=', 'espresso_venue_categories' )
85
+					$path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')
86 86
 				));
87
-		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
87
+		$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
88 88
 				array(
89
-					$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array( '!=', 'espresso_event_type' )
89
+					$path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')
90 90
 				));
91 91
 
92
-		parent::__construct( $timezone );
92
+		parent::__construct($timezone);
93 93
 	}
94 94
 
95 95
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 /**
4 4
  *
5 5
  * Class EE_Enum_Text_Field
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param mixed $default_value
24 24
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
25 25
 	 */
26
-	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){
26
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) {
27 27
 		$this->_allowed_enum_values = $allowed_enum_values;
28 28
 		parent::__construct($table_column, $nice_name, $nullable, $default_value);
29 29
 	}
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws EE_Error
39 39
 	 */
40
-	function prepare_for_set( $value_inputted_for_field_on_model_object ) {
41
-		if(
40
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
41
+		if (
42 42
 			$value_inputted_for_field_on_model_object !== null
43
-			&& ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )
44
-		){
45
-			if( defined( 'WP_DEBUG' ) &&  WP_DEBUG ){
43
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)
44
+		) {
45
+			if (defined('WP_DEBUG') && WP_DEBUG) {
46 46
 				$msg = sprintf(
47
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
47
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
48 48
 					$value_inputted_for_field_on_model_object,
49 49
 					$this->_name
50 50
 				);
51 51
 				$msg2 = sprintf(
52
-					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"','event_espresso'),
52
+					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
53 53
 					$this->_name,
54
-					implode( ", ", array_keys( $this->_allowed_enum_values ) ),
54
+					implode(", ", array_keys($this->_allowed_enum_values)),
55 55
 					$value_inputted_for_field_on_model_object
56 56
 				);
57
-				EE_Error::add_error( "$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ );
57
+				EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__);
58 58
 			}
59 59
 			return $this->get_default_value();
60 60
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Serialized_Text_Field.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * However, when inserting into the DB, it should be serialized.
8 8
  * Upon retrieval from the DB, it should be unserialized back into an array.
9 9
  */
10
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
11
-class EE_Serialized_Text_Field extends EE_Text_Field_Base{
10
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
11
+class EE_Serialized_Text_Field extends EE_Text_Field_Base {
12 12
 	/**
13 13
 	 * Value SHOULD be an array, and we want to now convert it to a serialized string
14 14
 	 * @param array $value_of_field_on_model_object
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 		return maybe_serialize($value_of_field_on_model_object);
19 19
 	}
20 20
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
21
-		EE_Registry::instance()->load_helper( 'Array' );
22
-		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize( $value_inputted_for_field_on_model_object );
23
-		if(is_string($value_inputted_for_field_on_model_object)){
21
+		EE_Registry::instance()->load_helper('Array');
22
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
23
+		if (is_string($value_inputted_for_field_on_model_object)) {
24 24
 			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
25
-		}elseif(is_array($value_inputted_for_field_on_model_object)){
26
-			return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
-		}else{//so they passed NULL or an INT or something wack
25
+		}elseif (is_array($value_inputted_for_field_on_model_object)) {
26
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
+		} else {//so they passed NULL or an INT or something wack
28 28
 			return $value_inputted_for_field_on_model_object;
29 29
 		}
30 30
 	}
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @return array
35 35
 	 */
36 36
 	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
37
-		EE_Registry::instance()->load_helper( 'Array' );
38
-		return EEH_Array::maybe_unserialize( $value_found_in_db_for_model_object );
37
+		EE_Registry::instance()->load_helper('Array');
38
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
39 39
 	}
40 40
 
41 41
 	/**
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	 * @return string
46 46
 	 */
47 47
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
48
-		switch($schema){
48
+		switch ($schema) {
49 49
 			case 'print_r':
50
-				$pretty_value = print_r($value_on_field_to_be_outputted,true);
50
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
51 51
 				break;
52 52
 			case 'as_table':
53 53
 				EE_Registry::instance()->load_helper('Template');
54 54
 				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
55 55
 				break;
56 56
 			default:
57
-				$pretty_value = implode(", ",$value_on_field_to_be_outputted);
57
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
58 58
 		}
59 59
 		return $pretty_value;
60 60
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Array.helper.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param array $arr
36 36
 	 * @return boolean
37 37
 	 */
38
-	public static function is_associative_array($arr){
38
+	public static function is_associative_array($arr) {
39 39
 		return  array_keys($arr) !== range(0, count($arr) - 1);
40 40
 	}
41 41
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @param array $arr
46 46
 	 * @return mixed what ever is in the array
47 47
 	 */
48
-	public static function get_one_item_from_array($arr){
48
+	public static function get_one_item_from_array($arr) {
49 49
 		$item = end($arr);
50 50
 		reset($arr);
51 51
 		return $item;
@@ -56,16 +56,16 @@  discard block
 block discarded – undo
56 56
 	 * @param mixed $arr
57 57
 	 * @return boolean
58 58
 	 */
59
-	public static function is_multi_dimensional_array($arr){
60
-		if(is_array($arr)){
59
+	public static function is_multi_dimensional_array($arr) {
60
+		if (is_array($arr)) {
61 61
 			$first_item = reset($arr);
62
-			if(is_array($first_item)){
63
-				return true;//yep, there's at least 2 levels to this array
64
-			}else{
65
-				return false;//nope, only 1 level
62
+			if (is_array($first_item)) {
63
+				return true; //yep, there's at least 2 levels to this array
64
+			} else {
65
+				return false; //nope, only 1 level
66 66
 			}
67
-		}else{
68
-			return false;//its not an array at all!
67
+		} else {
68
+			return false; //its not an array at all!
69 69
 		}
70 70
 	}
71 71
 
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 	 * @param mixed $default
77 77
 	 * @return mixed
78 78
 	 */
79
-	public static function is_set( $arr, $index, $default ) {
80
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
79
+	public static function is_set($arr, $index, $default) {
80
+		return isset($arr[$index]) ? $arr[$index] : $default;
81 81
 	}
82 82
 
83 83
 	/**
@@ -85,12 +85,12 @@  discard block
 block discarded – undo
85 85
 	 * @param mixed $value usually a string, but could be an array or object
86 86
 	 * @return mixed the UNserialized data
87 87
 	 */
88
-	public static function maybe_unserialize( $value ) {
88
+	public static function maybe_unserialize($value) {
89 89
 		$data = maybe_unserialize($value);
90 90
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
91 91
 		$token = 'C';
92 92
 		$data = is_string($data) ? trim($data) : $data;
93
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
93
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
94 94
 			return unserialize($data);
95 95
 		} else {
96 96
 			return $data;
@@ -109,30 +109,30 @@  discard block
 block discarded – undo
109 109
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
110 110
 	 * @return array
111 111
 	 */
112
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
112
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
113 113
 		// ensure incoming arrays are actually arrays
114
-		$target_array 		= (array)$target_array;
115
-		$array_to_insert	= (array)$array_to_insert;
114
+		$target_array = (array) $target_array;
115
+		$array_to_insert = (array) $array_to_insert;
116 116
 		// if no offset key was supplied
117
-		if ( empty( $offset )) {
117
+		if (empty($offset)) {
118 118
 			// use start or end of $target_array based on whether we are adding before or not
119
-			$offset = $add_before ? 0 : count( $target_array );
119
+			$offset = $add_before ? 0 : count($target_array);
120 120
 		}
121 121
 		// if offset key is a string, then find the corresponding numeric location for that element
122
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
122
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
123 123
 		// add one to the offset if adding after
124 124
 		$offset = $add_before ? $offset : $offset + 1;
125 125
 		// but ensure offset does not exceed the length of the array
126
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
126
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
127 127
 		// reindex array ???
128
-		if ( $preserve_keys ) {
128
+		if ($preserve_keys) {
129 129
 			// take a slice of the target array from the beginning till the offset,
130 130
 			// then add the new data
131 131
 			// then add another slice that starts at the offset and goes till the end
132
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
132
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
133 133
 		} else {
134 134
 			// since we don't want to preserve keys, we can use array_splice
135
-			array_splice( $target_array, $offset, 0, $array_to_insert );
135
+			array_splice($target_array, $offset, 0, $array_to_insert);
136 136
 			return $target_array;
137 137
 		}
138 138
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Event_Query.helper.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /**
5 5
  * Event Espresso
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public static function add_query_filters() {
87 87
 		//add query filters
88
-		add_action( 'pre_get_posts', array( 'EEH_Event_Query', 'filter_query_parts' ), 10, 1 );
88
+		add_action('pre_get_posts', array('EEH_Event_Query', 'filter_query_parts'), 10, 1);
89 89
 	}
90 90
 
91 91
 
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 	 * @param \WP_Query $WP_Query
98 98
 	 * @return bool
99 99
 	 */
100
-	public static function apply_query_filters( WP_Query $WP_Query ) {
101
-		return ( isset( $WP_Query->query, $WP_Query->query['post_type'] ) && $WP_Query->query['post_type'] == 'espresso_events' ) ||  apply_filters( 'FHEE__EEH_Event_Query__apply_query_filters', false ) ? true : false;
100
+	public static function apply_query_filters(WP_Query $WP_Query) {
101
+		return (isset($WP_Query->query, $WP_Query->query['post_type']) && $WP_Query->query['post_type'] == 'espresso_events') || apply_filters('FHEE__EEH_Event_Query__apply_query_filters', false) ? true : false;
102 102
 	}
103 103
 
104 104
 
@@ -108,15 +108,15 @@  discard block
 block discarded – undo
108 108
 	 * @access    public
109 109
 	 * @param \WP_Query $WP_Query
110 110
 	 */
111
-	public static function filter_query_parts( WP_Query $WP_Query ) {
111
+	public static function filter_query_parts(WP_Query $WP_Query) {
112 112
 		//ONLY add our filters if this isn't the main wp_query, because if this is the main wp_query we already have our cpt strategies take care of adding things in.
113
-		if ( $WP_Query instanceof WP_Query && ! $WP_Query->is_main_query() ) {
113
+		if ($WP_Query instanceof WP_Query && ! $WP_Query->is_main_query()) {
114 114
 			// build event list query
115
-			add_filter( 'posts_fields', array( 'EEH_Event_Query', 'posts_fields' ), 10, 2 );
116
-			add_filter( 'posts_join', array( 'EEH_Event_Query', 'posts_join' ), 10, 2 );
117
-			add_filter( 'posts_where', array( 'EEH_Event_Query', 'posts_where' ), 10, 2 );
118
-			add_filter( 'posts_orderby', array( 'EEH_Event_Query', 'posts_orderby' ), 10, 2 );
119
-			add_filter( 'posts_clauses_request', array( 'EEH_Event_Query', 'posts_clauses' ), 10, 2 );
115
+			add_filter('posts_fields', array('EEH_Event_Query', 'posts_fields'), 10, 2);
116
+			add_filter('posts_join', array('EEH_Event_Query', 'posts_join'), 10, 2);
117
+			add_filter('posts_where', array('EEH_Event_Query', 'posts_where'), 10, 2);
118
+			add_filter('posts_orderby', array('EEH_Event_Query', 'posts_orderby'), 10, 2);
119
+			add_filter('posts_clauses_request', array('EEH_Event_Query', 'posts_clauses'), 10, 2);
120 120
 		}
121 121
 	}
122 122
 
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 	 * @param string $orderby
132 132
 	 * @param string $sort
133 133
 	 */
134
-	public static function set_query_params( $month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC' ) {
134
+	public static function set_query_params($month = '', $category = '', $show_expired = FALSE, $orderby = 'start_date', $sort = 'ASC') {
135 135
 		self::$_query_params = array();
136
-		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month( $month );
137
-		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug( $category );
138
-		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired( $show_expired );
139
-		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby( $orderby );
140
-		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort( $sort );
136
+		EEH_Event_Query::$_event_query_month = EEH_Event_Query::_display_month($month);
137
+		EEH_Event_Query::$_event_query_category = EEH_Event_Query::_event_category_slug($category);
138
+		EEH_Event_Query::$_event_query_show_expired = EEH_Event_Query::_show_expired($show_expired);
139
+		EEH_Event_Query::$_event_query_orderby = EEH_Event_Query::_orderby($orderby);
140
+		EEH_Event_Query::$_event_query_sort = EEH_Event_Query::_sort($sort);
141 141
 	}
142 142
 
143 143
 
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @param string $month
150 150
 	 * @return    string
151 151
 	 */
152
-	private static function _display_month( $month = '' ) {
153
-		return EE_Registry::instance()->REQ->is_set( 'event_query_month' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_month' ) ) : $month;
152
+	private static function _display_month($month = '') {
153
+		return EE_Registry::instance()->REQ->is_set('event_query_month') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_month')) : $month;
154 154
 	}
155 155
 
156 156
 
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 	 * @param string $category
163 163
 	 * @return    string
164 164
 	 */
165
-	private static function _event_category_slug( $category = '' ) {
166
-		return EE_Registry::instance()->REQ->is_set( 'event_query_category' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_category' ) ) : $category;
165
+	private static function _event_category_slug($category = '') {
166
+		return EE_Registry::instance()->REQ->is_set('event_query_category') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_category')) : $category;
167 167
 	}
168 168
 
169 169
 
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	 * @param bool $show_expired
176 176
 	 * @return    boolean
177 177
 	 */
178
-	private static function _show_expired( $show_expired = FALSE ) {
178
+	private static function _show_expired($show_expired = FALSE) {
179 179
 		// override default expired option if set via filter
180
-		$_event_query_show_expired =EE_Registry::instance()->REQ->is_set( 'event_query_show_expired' ) ? EE_Registry::instance()->REQ->get( 'event_query_show_expired' ) : $show_expired;
181
-		return filter_var( $_event_query_show_expired, FILTER_VALIDATE_BOOLEAN );
180
+		$_event_query_show_expired = EE_Registry::instance()->REQ->is_set('event_query_show_expired') ? EE_Registry::instance()->REQ->get('event_query_show_expired') : $show_expired;
181
+		return filter_var($_event_query_show_expired, FILTER_VALIDATE_BOOLEAN);
182 182
 	}
183 183
 
184 184
 
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
 	 * @param    string $orderby
191 191
 	 * @return    array
192 192
 	 */
193
-	private static function _orderby( $orderby = 'start_date' ) {
194
-		$event_query_orderby = EE_Registry::instance()->REQ->is_set( 'event_query_orderby' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_orderby' ) ) : $orderby;
195
-		$event_query_orderby = is_array( $event_query_orderby ) ? $event_query_orderby : explode( ',', $event_query_orderby );
196
-		$event_query_orderby = array_map( 'trim', $event_query_orderby );
193
+	private static function _orderby($orderby = 'start_date') {
194
+		$event_query_orderby = EE_Registry::instance()->REQ->is_set('event_query_orderby') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_orderby')) : $orderby;
195
+		$event_query_orderby = is_array($event_query_orderby) ? $event_query_orderby : explode(',', $event_query_orderby);
196
+		$event_query_orderby = array_map('trim', $event_query_orderby);
197 197
 		return $event_query_orderby;
198 198
 	}
199 199
 
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
 	 * @param string $sort
207 207
 	 * @return    array
208 208
 	 */
209
-	private static function _sort( $sort = 'ASC' ) {
210
-		$sort = EE_Registry::instance()->REQ->is_set( 'event_query_sort' ) ? sanitize_text_field( EE_Registry::instance()->REQ->get( 'event_query_sort' ) ) : $sort;
211
-		return in_array( $sort, array( 'ASC', 'asc', 'DESC', 'desc' )) ? strtoupper( $sort ) : 'ASC';
209
+	private static function _sort($sort = 'ASC') {
210
+		$sort = EE_Registry::instance()->REQ->is_set('event_query_sort') ? sanitize_text_field(EE_Registry::instance()->REQ->get('event_query_sort')) : $sort;
211
+		return in_array($sort, array('ASC', 'asc', 'DESC', 'desc')) ? strtoupper($sort) : 'ASC';
212 212
 	}
213 213
 
214 214
 
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @return array   array of clauses
223 223
 	 */
224
-	public static function posts_clauses( $clauses, WP_Query $wp_query ) {
225
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
224
+	public static function posts_clauses($clauses, WP_Query $wp_query) {
225
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
226 226
 			global $wpdb;
227
-			$clauses['groupby'] = $wpdb->posts . '.ID ';
227
+			$clauses['groupby'] = $wpdb->posts.'.ID ';
228 228
 		}
229 229
 		return $clauses;
230 230
 	}
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param WP_Query $wp_query
240 240
 	 * @return    string
241 241
 	 */
242
-	public static function posts_fields( $SQL, WP_Query $wp_query ) {
243
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
242
+	public static function posts_fields($SQL, WP_Query $wp_query) {
243
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
244 244
 			// adds something like ", wp_esp_datetime.* " to WP Query SELECT statement
245
-			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby( EEH_Event_Query::$_event_query_orderby );
245
+			$SQL .= EEH_Event_Query::posts_fields_sql_for_orderby(EEH_Event_Query::$_event_query_orderby);
246 246
 		}
247 247
 		return $SQL;
248 248
 	}
@@ -257,29 +257,29 @@  discard block
 block discarded – undo
257 257
 	 * @internal  param bool|string $mixed $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
258 258
 	 * @return    string
259 259
 	 */
260
-	public static function posts_fields_sql_for_orderby( $orderby_params = array() ) {
261
-		$SQL = ', MIN( ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start ) as event_start_date ' ;
262
-		foreach( (array)$orderby_params as $orderby ) {
263
-			switch ( $orderby ) {
260
+	public static function posts_fields_sql_for_orderby($orderby_params = array()) {
261
+		$SQL = ', MIN( '.EEM_Datetime::instance()->table().'.DTT_EVT_start ) as event_start_date ';
262
+		foreach ((array) $orderby_params as $orderby) {
263
+			switch ($orderby) {
264 264
 
265 265
 				case 'ticket_start' :
266
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_start_date' ;
266
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_start_date';
267 267
 					break;
268 268
 
269 269
 				case 'ticket_end' :
270
-					$SQL .= ', ' . EEM_Ticket::instance()->table() . '.TKT_end_date' ;
270
+					$SQL .= ', '.EEM_Ticket::instance()->table().'.TKT_end_date';
271 271
 					break;
272 272
 
273 273
 				case 'venue_title' :
274
-					$SQL .= ', Venue.post_title AS venue_title' ;
274
+					$SQL .= ', Venue.post_title AS venue_title';
275 275
 					break;
276 276
 
277 277
 				case 'city' :
278
-					$SQL .= ', ' . EEM_Venue::instance()->second_table() . '.VNU_city' ;
278
+					$SQL .= ', '.EEM_Venue::instance()->second_table().'.VNU_city';
279 279
 					break;
280 280
 
281 281
 				case 'state' :
282
-					$SQL .= ', ' . EEM_State::instance()->table() . '.STA_name' ;
282
+					$SQL .= ', '.EEM_State::instance()->table().'.STA_name';
283 283
 					break;
284 284
 
285 285
 			}
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 	 * @param WP_Query $wp_query
298 298
 	 * @return    string
299 299
 	 */
300
-	public static function posts_join( $SQL = '', WP_Query $wp_query ) {
301
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
300
+	public static function posts_join($SQL = '', WP_Query $wp_query) {
301
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
302 302
 			// Category
303
-			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired( $SQL, EEH_Event_Query::$_event_query_show_expired );
304
-			$SQL = EEH_Event_Query::posts_join_sql_for_terms( $SQL, EEH_Event_Query::$_event_query_category );
305
-			$SQL = EEH_Event_Query::posts_join_for_orderby( $SQL, EEH_Event_Query::$_event_query_orderby );
303
+			$SQL = EEH_Event_Query::posts_join_sql_for_show_expired($SQL, EEH_Event_Query::$_event_query_show_expired);
304
+			$SQL = EEH_Event_Query::posts_join_sql_for_terms($SQL, EEH_Event_Query::$_event_query_category);
305
+			$SQL = EEH_Event_Query::posts_join_for_orderby($SQL, EEH_Event_Query::$_event_query_orderby);
306 306
 		}
307 307
 		return $SQL;
308 308
 	}
@@ -317,11 +317,11 @@  discard block
 block discarded – undo
317 317
 	 * @param    boolean $show_expired if TRUE, then displayed past events
318 318
 	 * @return string
319 319
 	 */
320
-	public static function posts_join_sql_for_show_expired( $SQL = '', $show_expired = FALSE ) {
321
-		if ( ! $show_expired ) {
322
-			$join = EEM_Event::instance()->table() . '.ID = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
323
-			if ( strpos( $SQL, $join ) === FALSE ) {
324
-				$SQL .= ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' ) ';
320
+	public static function posts_join_sql_for_show_expired($SQL = '', $show_expired = FALSE) {
321
+		if ( ! $show_expired) {
322
+			$join = EEM_Event::instance()->table().'.ID = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
323
+			if (strpos($SQL, $join) === FALSE) {
324
+				$SQL .= ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' ) ';
325 325
 			}
326 326
 		}
327 327
 		return $SQL;
@@ -337,8 +337,8 @@  discard block
 block discarded – undo
337 337
 	 * @param 	string $join_terms pass TRUE or term string, doesn't really matter since this value doesn't really get used for anything yet
338 338
 	 * @return 	string
339 339
 	 */
340
-	public static function posts_join_sql_for_terms( $SQL = '', $join_terms = '' ) {
341
-		if ( ! empty( $join_terms ) ) {
340
+	public static function posts_join_sql_for_terms($SQL = '', $join_terms = '') {
341
+		if ( ! empty($join_terms)) {
342 342
 			global $wpdb;
343 343
 			$SQL .= " LEFT JOIN $wpdb->term_relationships ON ($wpdb->posts.ID = $wpdb->term_relationships.object_id)";
344 344
 			$SQL .= " LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 	 * @param 	array $orderby_params
359 359
 	 * @return 	string
360 360
 	 */
361
-	public static function posts_join_for_orderby( $SQL = '', $orderby_params = array() ) {
362
-		foreach ( (array)$orderby_params as $orderby ) {
363
-			switch ( $orderby ) {
361
+	public static function posts_join_for_orderby($SQL = '', $orderby_params = array()) {
362
+		foreach ((array) $orderby_params as $orderby) {
363
+			switch ($orderby) {
364 364
 				case 'ticket_start' :
365 365
 				case 'ticket_end' :
366
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Datetime::instance()->primary_key_name() );
367
-					$SQL .= ' LEFT JOIN ' . EEM_Ticket::instance()->table() . ' ON (' . EEM_Datetime_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' = ' . EEM_Ticket::instance()->table() . '.' . EEM_Ticket::instance()->primary_key_name() . ' )';
366
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Datetime_Ticket::instance()->table().'.'.EEM_Datetime::instance()->primary_key_name());
367
+					$SQL .= ' LEFT JOIN '.EEM_Ticket::instance()->table().' ON ('.EEM_Datetime_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' = '.EEM_Ticket::instance()->table().'.'.EEM_Ticket::instance()->primary_key_name().' )';
368 368
 					break;
369 369
 				case 'venue_title' :
370 370
 				case 'city' :
371
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
371
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
372 372
 					break;
373 373
 				case 'state' :
374
-					$SQL .= EEH_Event_Query::_posts_join_for_event_venue( $SQL );
375
-					$SQL .= EEH_Event_Query::_posts_join_for_venue_state( $SQL );
374
+					$SQL .= EEH_Event_Query::_posts_join_for_event_venue($SQL);
375
+					$SQL .= EEH_Event_Query::_posts_join_for_venue_state($SQL);
376 376
 					break;
377 377
 				case 'start_date' :
378 378
 				default :
379
-					$SQL .= EEH_Event_Query::_posts_join_for_datetime( $SQL, EEM_Event::instance()->table() . '.ID' );
379
+					$SQL .= EEH_Event_Query::_posts_join_for_datetime($SQL, EEM_Event::instance()->table().'.ID');
380 380
 					break;
381 381
 
382 382
 			}
@@ -394,11 +394,11 @@  discard block
 block discarded – undo
394 394
 	 * @param string $join
395 395
 	 * @return string
396 396
 	 */
397
-	protected static function _posts_join_for_datetime( $SQL = '', $join = '' ) {
398
-		if ( ! empty( $join )) {
399
-			$join .= ' = ' . EEM_Datetime::instance()->table() . '.' . EEM_Event::instance()->primary_key_name();
400
-			if ( strpos( $SQL, $join ) === FALSE ) {
401
-				return ' INNER JOIN ' . EEM_Datetime::instance()->table() . ' ON ( ' . $join . ' )';
397
+	protected static function _posts_join_for_datetime($SQL = '', $join = '') {
398
+		if ( ! empty($join)) {
399
+			$join .= ' = '.EEM_Datetime::instance()->table().'.'.EEM_Event::instance()->primary_key_name();
400
+			if (strpos($SQL, $join) === FALSE) {
401
+				return ' INNER JOIN '.EEM_Datetime::instance()->table().' ON ( '.$join.' )';
402 402
 			}
403 403
 		}
404 404
 		return '';
@@ -413,13 +413,13 @@  discard block
 block discarded – undo
413 413
 	 * @param string $SQL
414 414
 	 * @return string
415 415
 	 */
416
-	protected static function _posts_join_for_event_venue( $SQL = '' ) {
416
+	protected static function _posts_join_for_event_venue($SQL = '') {
417 417
 		// Event Venue table name
418 418
 		$event_venue_table = EEM_Event_Venue::instance()->table();
419 419
 		// generate conditions for:  Event <=> Event Venue  JOIN clause
420
-		$event_to_event_venue_join = EEM_Event::instance()->table() . '.ID = ' . $event_venue_table . '.' . EEM_Event::instance()->primary_key_name();
420
+		$event_to_event_venue_join = EEM_Event::instance()->table().'.ID = '.$event_venue_table.'.'.EEM_Event::instance()->primary_key_name();
421 421
 		// don't add joins if they have already been added
422
-		if ( strpos( $SQL, $event_to_event_venue_join ) === FALSE ) {
422
+		if (strpos($SQL, $event_to_event_venue_join) === FALSE) {
423 423
 			// Venue table name
424 424
 			$venue_table = EEM_Venue::instance()->table();
425 425
 			// Venue table pk
@@ -432,10 +432,10 @@  discard block
 block discarded – undo
432 432
 			$venue_SQL .= " LEFT JOIN $venue_table as Venue ON ( $event_venue_table.$venue_table_pk = Venue.ID )";
433 433
 			// generate JOIN clause for: Venue <=> Venue Meta
434 434
 			$venue_SQL .= " LEFT JOIN $venue_meta_table ON ( Venue.ID = $venue_meta_table.$venue_table_pk )";
435
-			unset( $event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table );
435
+			unset($event_venue_table, $event_to_event_venue_join, $venue_table, $venue_table_pk, $venue_meta_table);
436 436
 			return $venue_SQL;
437 437
 		}
438
-		unset( $event_venue_table, $event_to_event_venue_join );
438
+		unset($event_venue_table, $event_to_event_venue_join);
439 439
 		return '';
440 440
 	}
441 441
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	 * @param string $SQL
449 449
 	 * @return string
450 450
 	 */
451
-	protected static function _posts_join_for_venue_state( $SQL = '' ) {
451
+	protected static function _posts_join_for_venue_state($SQL = '') {
452 452
 		// Venue Meta table name
453 453
 		$venue_meta_table = EEM_Venue::instance()->second_table();
454 454
 		// State table name
@@ -456,16 +456,16 @@  discard block
 block discarded – undo
456 456
 		// State table pk
457 457
 		$state_table_pk = EEM_State::instance()->primary_key_name();
458 458
 		// verify vars
459
-		if ( $venue_meta_table && $state_table && $state_table_pk ) {
459
+		if ($venue_meta_table && $state_table && $state_table_pk) {
460 460
 			// like: wp_esp_venue_meta.STA_ID = wp_esp_state.STA_ID
461 461
 			$join = "$venue_meta_table.$state_table_pk = $state_table.$state_table_pk";
462 462
 			// don't add join if it has already been added
463
-			if ( strpos( $SQL, $join ) === FALSE ) {
464
-				unset( $state_table_pk, $venue_meta_table, $venue_table_pk );
463
+			if (strpos($SQL, $join) === FALSE) {
464
+				unset($state_table_pk, $venue_meta_table, $venue_table_pk);
465 465
 				return " LEFT JOIN $state_table ON ( $join )";
466 466
 			}
467 467
 		}
468
-		unset( $join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk );
468
+		unset($join, $state_table, $state_table_pk, $venue_meta_table, $venue_table_pk);
469 469
 		return '';
470 470
 	}
471 471
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	 * @param WP_Query $wp_query
480 480
 	 * @return    string
481 481
 	 */
482
-	public static function posts_where( $SQL = '', WP_Query $wp_query ) {
483
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
482
+	public static function posts_where($SQL = '', WP_Query $wp_query) {
483
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
484 484
 			// Show Expired ?
485
-			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired( EEH_Event_Query::$_event_query_show_expired  );
485
+			$SQL .= EEH_Event_Query::posts_where_sql_for_show_expired(EEH_Event_Query::$_event_query_show_expired);
486 486
 			// Category
487
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug( EEH_Event_Query::$_event_query_category  );
487
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_category_slug(EEH_Event_Query::$_event_query_category);
488 488
 			// Start Date
489
-			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month( EEH_Event_Query::$_event_query_month );
489
+			$SQL .= EEH_Event_Query::posts_where_sql_for_event_list_month(EEH_Event_Query::$_event_query_month);
490 490
 		}
491 491
 		return $SQL;
492 492
 	}
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 	 * @param    boolean $show_expired if TRUE, then displayed past events
501 501
 	 * @return    string
502 502
 	 */
503
-	public static function posts_where_sql_for_show_expired( $show_expired = FALSE ) {
504
-		return ! $show_expired ? ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end > "' . current_time( 'mysql', TRUE ) . '" ' : '';
503
+	public static function posts_where_sql_for_show_expired($show_expired = FALSE) {
504
+		return ! $show_expired ? ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end > "'.current_time('mysql', TRUE).'" ' : '';
505 505
 	}
506 506
 
507 507
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param    boolean $event_category_slug
514 514
 	 * @return    string
515 515
 	 */
516
-	public static function posts_where_sql_for_event_category_slug( $event_category_slug = NULL ) {
516
+	public static function posts_where_sql_for_event_category_slug($event_category_slug = NULL) {
517 517
 		global $wpdb;
518
-		return ! empty( $event_category_slug ) ? ' AND ' . $wpdb->terms . '.slug = "' . $event_category_slug . '" ' : '';
518
+		return ! empty($event_category_slug) ? ' AND '.$wpdb->terms.'.slug = "'.$event_category_slug.'" ' : '';
519 519
 	}
520 520
 
521 521
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 	 * @param    boolean $month
528 528
 	 * @return    string
529 529
 	 */
530
-	public static function posts_where_sql_for_event_list_month( $month = NULL ) {
530
+	public static function posts_where_sql_for_event_list_month($month = NULL) {
531 531
 		$SQL = '';
532
-		if ( ! empty( $month ) ) {
532
+		if ( ! empty($month)) {
533 533
 			// event start date is LESS than the end of the month ( so nothing that doesn't start until next month )
534
-			$SQL = ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_start <= "' . gmdate( 'Y-m-t 23:59:59', strtotime( $month ) ) . '"';
534
+			$SQL = ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_start <= "'.gmdate('Y-m-t 23:59:59', strtotime($month)).'"';
535 535
 			// event end date is GREATER than the start of the month ( so nothing that ended before this month )
536
-			$SQL .= ' AND ' . EEM_Datetime::instance()->table() . '.DTT_EVT_end >= "' . gmdate( 'Y-m-01 0:0:00', strtotime( $month ) ) . '" ';
536
+			$SQL .= ' AND '.EEM_Datetime::instance()->table().'.DTT_EVT_end >= "'.gmdate('Y-m-01 0:0:00', strtotime($month)).'" ';
537 537
 		}
538 538
 		return $SQL;
539 539
 	}
@@ -548,9 +548,9 @@  discard block
 block discarded – undo
548 548
 	 * @param WP_Query $wp_query
549 549
 	 * @return    string
550 550
 	 */
551
-	public static function posts_orderby( $SQL = '', WP_Query $wp_query ) {
552
-		if ( EEH_Event_Query::apply_query_filters( $wp_query ) ) {
553
-			$SQL = EEH_Event_Query::posts_orderby_sql( EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort );
551
+	public static function posts_orderby($SQL = '', WP_Query $wp_query) {
552
+		if (EEH_Event_Query::apply_query_filters($wp_query)) {
553
+			$SQL = EEH_Event_Query::posts_orderby_sql(EEH_Event_Query::$_event_query_orderby, EEH_Event_Query::$_event_query_sort);
554 554
 		}
555 555
 		return $SQL;
556 556
 	}
@@ -581,63 +581,63 @@  discard block
 block discarded – undo
581 581
 	 * @param string     $sort
582 582
 	 * @return string
583 583
 	 */
584
-	public static function posts_orderby_sql( $orderby_params = array(), $sort = 'ASC' ) {
584
+	public static function posts_orderby_sql($orderby_params = array(), $sort = 'ASC') {
585 585
 		global $wpdb;
586 586
 		$SQL = '';
587 587
 		$counter = 0;
588 588
 		//make sure 'orderby' is set in query params
589
-		if ( ! isset( self::$_query_params['orderby'] )) {
589
+		if ( ! isset(self::$_query_params['orderby'])) {
590 590
 			self::$_query_params['orderby'] = array();
591 591
 		}
592 592
 		// loop thru $orderby_params (type cast as array)
593
-		foreach ( (array)$orderby_params as $orderby ) {
593
+		foreach ((array) $orderby_params as $orderby) {
594 594
 			// check if we have already added this param
595
-			if ( isset( self::$_query_params['orderby'][ $orderby ] )) {
595
+			if (isset(self::$_query_params['orderby'][$orderby])) {
596 596
 				// if so then remove from the $orderby_params so that the count() method below is accurate
597
-				unset( $orderby_params[ $orderby ] );
597
+				unset($orderby_params[$orderby]);
598 598
 				// then bump ahead to the next param
599 599
 				continue;
600 600
 			}
601 601
 			// this will ad a comma depending on whether this is the first or last param
602
-			$glue = $counter == 0 || $counter == count( $orderby_params ) ? ' ' : ', ';
602
+			$glue = $counter == 0 || $counter == count($orderby_params) ? ' ' : ', ';
603 603
 			// ok what's we dealing with?
604
-			switch ( $orderby ) {
604
+			switch ($orderby) {
605 605
 				case 'id' :
606 606
 				case 'ID' :
607
-					$SQL .= $glue . $wpdb->posts . '.ID ' . $sort;
607
+					$SQL .= $glue.$wpdb->posts.'.ID '.$sort;
608 608
 					break;
609 609
 				case 'end_date' :
610
-					$SQL .= $glue . EEM_Datetime::instance()->table() . '.DTT_EVT_end ' . $sort;
610
+					$SQL .= $glue.EEM_Datetime::instance()->table().'.DTT_EVT_end '.$sort;
611 611
 					break;
612 612
 				case 'event_name' :
613
-					$SQL .= $glue . $wpdb->posts . '.post_title ' . $sort;
613
+					$SQL .= $glue.$wpdb->posts.'.post_title '.$sort;
614 614
 					break;
615 615
 				case 'category_slug' :
616
-					$SQL .= $glue . $wpdb->terms . '.slug ' . $sort;
616
+					$SQL .= $glue.$wpdb->terms.'.slug '.$sort;
617 617
 					break;
618 618
 				case 'ticket_start' :
619
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_start_date ' . $sort;
619
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_start_date '.$sort;
620 620
 					break;
621 621
 				case 'ticket_end' :
622
-					$SQL .= $glue . EEM_Ticket::instance()->table() . '.TKT_end_date ' . $sort;
622
+					$SQL .= $glue.EEM_Ticket::instance()->table().'.TKT_end_date '.$sort;
623 623
 					break;
624 624
 				case 'venue_title' :
625
-					$SQL .= $glue . 'venue_title ' . $sort;
625
+					$SQL .= $glue.'venue_title '.$sort;
626 626
 					break;
627 627
 				case 'city' :
628
-					$SQL .= $glue . EEM_Venue::instance()->second_table() . '.VNU_city ' . $sort;
628
+					$SQL .= $glue.EEM_Venue::instance()->second_table().'.VNU_city '.$sort;
629 629
 					break;
630 630
 				case 'state' :
631
-					$SQL .= $glue . EEM_State::instance()->table() . '.STA_name ' . $sort;
631
+					$SQL .= $glue.EEM_State::instance()->table().'.STA_name '.$sort;
632 632
 					break;
633 633
 				case 'start_date' :
634 634
 				default :
635
-					$SQL .= $glue . ' event_start_date ' . $sort;
635
+					$SQL .= $glue.' event_start_date '.$sort;
636 636
 					break;
637 637
 			}
638 638
 			// add to array of orderby params that have been added
639
-			self::$_query_params['orderby'][ $orderby ] = TRUE;
640
-			$counter ++;
639
+			self::$_query_params['orderby'][$orderby] = TRUE;
640
+			$counter++;
641 641
 		}
642 642
 		return $SQL;
643 643
 	}
Please login to merge, or discard this patch.