Completed
Branch BUG/11361/fix-log-calls-using-... (798dc9)
by
unknown
68:17 queued 54:12
created
core/db_classes/EE_Datetime_Ticket.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
 	 * @param array $props_n_values  incoming values from the database
47 47
 	 * @param string $timezone  incoming timezone as set by the model.  If not set the timezone for
48 48
 	 *                          		the website will be used.
49
-	 * @return EE_Attendee
49
+	 * @return EE_Datetime_Ticket
50 50
 	 */
51 51
 	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52 52
 		return new self( $props_n_values, TRUE, $timezone );
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 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
@@ -35,9 +35,9 @@  discard block
 block discarded – undo
35 35
 	 *                             		    date_format and the second value is the time format
36 36
 	 * @return EE_Attendee
37 37
 	 */
38
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
39
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
40
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
38
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
39
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
40
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
41 41
 	}
42 42
 
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *                          		the website will be used.
49 49
 	 * @return EE_Attendee
50 50
 	 */
51
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
52
-		return new self( $props_n_values, TRUE, $timezone );
51
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
52
+		return new self($props_n_values, TRUE, $timezone);
53 53
 	}
54 54
 } //end EE_Datetime_Ticket class
Please login to merge, or discard this patch.
core/db_classes/EE_Export.class.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	/**
70 70
 	 *			@Export Event Espresso data - routes export requests
71 71
 	 *		  @access public
72
-	 *			@return void | bool
72
+	 *			@return false|null | bool
73 73
 	 */
74 74
 	public function export() {
75 75
 
@@ -605,7 +605,7 @@  discard block
 block discarded – undo
605 605
 	 *	@recursive function for exporting table data and merging the results with the next results
606 606
 	 *	@access private
607 607
 	 *	@param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all
608
-	 *	@return array on success, FALSE on fail
608
+	 *	@return boolean on success, FALSE on fail
609 609
 	 */
610 610
 	private function _get_export_data_for_models( $models_to_export = array() ) {
611 611
 		$table_data = FALSE;
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -500,11 +500,11 @@
 block discarded – undo
500 500
 					}else{
501 501
 						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
502 502
 					}
503
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
504
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
505
-                                        } else {
506
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
507
-                                        }
503
+										if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
504
+											$reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
505
+										} else {
506
+											$reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
507
+										}
508 508
 				}
509 509
 				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
510 510
 			}
Please login to merge, or discard this patch.
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
+do_action('AHEE_log', __FILE__, __FUNCTION__, '');
3 3
 /**
4 4
  * EE_Export class
5 5
  * 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	  * @access private
40 40
 	  * @param array $request_data
41 41
 	  */
42
- 	private function __construct( $request_data = array() ) {
42
+ 	private function __construct($request_data = array()) {
43 43
 		$this->_req_data = $request_data;
44
-		$this->today = date("Y-m-d",time());
45
-		require_once( EE_CLASSES . 'EE_CSV.class.php' );
46
-		$this->EE_CSV= EE_CSV::instance();
44
+		$this->today = date("Y-m-d", time());
45
+		require_once(EE_CLASSES.'EE_CSV.class.php');
46
+		$this->EE_CSV = EE_CSV::instance();
47 47
 	}
48 48
 
49 49
 
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	  * @param array $request_data
56 56
 	  * @return \EE_Export
57 57
 	  */
58
-	public static function instance( $request_data = array() ) {
58
+	public static function instance($request_data = array()) {
59 59
 		// check if class object is instantiated
60
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Export )) {
61
-			self::$_instance = new self( $request_data );
60
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Export)) {
61
+			self::$_instance = new self($request_data);
62 62
 		}
63 63
 		return self::$_instance;
64 64
 	}
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 	public function export() {
73 73
 
74 74
 		// in case of bulk exports, the "actual" action will be in action2, but first check regular action for "export" keyword
75
-		if ( isset( $this->_req_data['action'] ) && strpos( $this->_req_data['action'], 'export' ) === FALSE ) {
75
+		if (isset($this->_req_data['action']) && strpos($this->_req_data['action'], 'export') === FALSE) {
76 76
 			// check if action2 has export action
77
-			if ( isset( $this->_req_data['action2'] ) && strpos( $this->_req_data['action2'], 'export' ) !== FALSE ) {
77
+			if (isset($this->_req_data['action2']) && strpos($this->_req_data['action2'], 'export') !== FALSE) {
78 78
 				// whoop! there it is!
79 79
 				$this->_req_data['action'] = $this->_req_data['action2'];
80 80
 			}
81 81
 		}
82 82
 
83
-		$this->_req_data['export'] = isset( $this->_req_data['export'] ) ? $this->_req_data['export'] : '';
83
+		$this->_req_data['export'] = isset($this->_req_data['export']) ? $this->_req_data['export'] : '';
84 84
 
85 85
 		switch ($this->_req_data['export']) {
86 86
 			case 'report':
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					break;
95 95
 
96 96
 					case 'registrations_report_for_event':
97
-						$this->report_registrations_for_event( $this->_req_data['EVT_ID'] );
97
+						$this->report_registrations_for_event($this->_req_data['EVT_ID']);
98 98
 					break;
99 99
 
100 100
 					case 'attendees':
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					break;
107 107
 
108 108
 					default:
109
-						EE_Error::add_error(__('An error occurred! The requested export report could not be found.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ ) ;
109
+						EE_Error::add_error(__('An error occurred! The requested export report could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
110 110
 						return FALSE;
111 111
 					break;
112 112
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 	 * Downloads a CSV file with all the columns, but no data. This should be used for importing
125 125
 	 * @return null kills execution
126 126
 	 */
127
-	function export_sample(){
127
+	function export_sample() {
128 128
 		$event = EEM_Event::instance()->get_one();
129 129
 		$this->_req_data['EVT_ID'] = $event->ID();
130 130
 		$this->export_all_event_data();
@@ -150,23 +150,23 @@  discard block
 block discarded – undo
150 150
 		$state_country_query_params = array();
151 151
 		$question_group_query_params = array();
152 152
 		$question_query_params = array();
153
-		if ( isset( $this->_req_data['EVT_ID'] )) {
153
+		if (isset($this->_req_data['EVT_ID'])) {
154 154
 			// do we have an array of IDs ?
155 155
 
156
-			if ( is_array( $this->_req_data['EVT_ID'] )) {
157
-				$EVT_IDs =  array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] );
158
-				$value_to_equal = array('IN',$EVT_IDs);
156
+			if (is_array($this->_req_data['EVT_ID'])) {
157
+				$EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']);
158
+				$value_to_equal = array('IN', $EVT_IDs);
159 159
 				$filename = 'events';
160 160
 			} else {
161 161
 				// generate regular where = clause
162
-				$EVT_ID = absint( $this->_req_data['EVT_ID'] );
162
+				$EVT_ID = absint($this->_req_data['EVT_ID']);
163 163
 				$value_to_equal = $EVT_ID;
164 164
 				$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID);
165 165
 
166
-				$filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) );
166
+				$filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'));
167 167
 
168 168
 			}
169
-			$event_query_params[0]['EVT_ID'] =$value_to_equal;
169
+			$event_query_params[0]['EVT_ID'] = $value_to_equal;
170 170
 			$related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal;
171 171
 			$related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal;
172 172
 			$datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal;
@@ -210,42 +210,42 @@  discard block
 block discarded – undo
210 210
 
211 211
 			);
212 212
 
213
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
213
+		$model_data = $this->_get_export_data_for_models($models_to_export);
214 214
 
215
-		$filename = $this->generate_filename ( $filename );
215
+		$filename = $this->generate_filename($filename);
216 216
 
217
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
218
-			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
217
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
218
+			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
219 219
 		}
220 220
 	}
221 221
 
222
-	function report_attendees(){
222
+	function report_attendees() {
223 223
 		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( 
224 224
 			array( 
225
-				'force_join' => array( 'State', 'Country' ), 
225
+				'force_join' => array('State', 'Country'), 
226 226
 				'caps' => EEM_Base::caps_read_admin 
227 227
 			) 
228 228
 		);
229 229
 		$csv_data = array();
230
-		foreach( $attendee_rows as $attendee_row ){
230
+		foreach ($attendee_rows as $attendee_row) {
231 231
 			$csv_row = array();
232
-			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
233
-				if( $field_name == 'STA_ID' ){
234
-					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
235
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
236
-				}elseif( $field_name == 'CNT_ISO' ){
237
-					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
238
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
239
-				}else{
240
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
232
+			foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
233
+				if ($field_name == 'STA_ID') {
234
+					$state_name_field = EEM_State::instance()->field_settings_for('STA_name');
235
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
236
+				}elseif ($field_name == 'CNT_ISO') {
237
+					$country_name_field = EEM_Country::instance()->field_settings_for('CNT_name');
238
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
239
+				} else {
240
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
241 241
 				}
242 242
 			}
243 243
 			$csv_data[] = $csv_row;
244 244
 		}
245 245
 
246
-		$filename = $this->generate_filename ( 'contact-list-report' );
246
+		$filename = $this->generate_filename('contact-list-report');
247 247
 
248
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
248
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
249 249
 		$this->EE_CSV->write_data_array_to_csv($handle, $csv_data);
250 250
 		$this->EE_CSV->end_sending_csv($handle);
251 251
 	}
@@ -262,18 +262,18 @@  discard block
 block discarded – undo
262 262
 		$countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL'))));
263 263
 //		$states_to_export_query_params
264 264
 		$models_to_export = array(
265
-			'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))),
266
-			'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))),
265
+			'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))),
266
+			'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))),
267 267
 			'Attendee'=>array(),
268 268
 		);
269 269
 
270 270
 
271 271
 
272
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
273
-		$filename = $this->generate_filename ( 'all-attendees' );
272
+		$model_data = $this->_get_export_data_for_models($models_to_export);
273
+		$filename = $this->generate_filename('all-attendees');
274 274
 
275
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data )) {
276
-			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
275
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data)) {
276
+			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
277 277
 		}
278 278
 	}
279 279
 
@@ -285,19 +285,19 @@  discard block
 block discarded – undo
285 285
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
286 286
 	 * @return string
287 287
 	 */
288
-	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
289
-		$field_obj = $model->field_settings_for( $field_name );
290
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
291
-		if( $field_obj instanceof EE_Datetime_Field ) {
292
-			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
293
-			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
288
+	protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
289
+		$field_obj = $model->field_settings_for($field_name);
290
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
291
+		if ($field_obj instanceof EE_Datetime_Field) {
292
+			$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
293
+			$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
294 294
 		}
295
-		if( $pretty_schema === true){
296
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
297
-		}elseif( is_string( $pretty_schema ) ) {
298
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
299
-		}else{
300
-			return $field_obj->prepare_for_get( $value_on_model_obj );
295
+		if ($pretty_schema === true) {
296
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
297
+		}elseif (is_string($pretty_schema)) {
298
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
299
+		} else {
300
+			return $field_obj->prepare_for_get($value_on_model_obj);
301 301
 		}
302 302
 	}
303 303
 
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
 	 * and the questions associated with the registrations
307 307
 	 * @param int $event_id
308 308
 	 */
309
-	function report_registrations_for_event( $event_id = NULL ){
309
+	function report_registrations_for_event($event_id = NULL) {
310 310
 		$reg_fields_to_include = array(
311 311
 				'TXN_ID',
312 312
 				'ATT_ID',
@@ -338,126 +338,126 @@  discard block
 block discarded – undo
338 338
 				array(
339 339
 					'OR' => array(
340 340
 						//don't include registrations from failed or abandoned transactions...
341
-						'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ),
341
+						'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)),
342 342
 						//unless the registration is approved, in which case include it regardless of transaction status
343 343
 						'STS_ID' => EEM_Registration::status_id_approved
344 344
 						),
345
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
345
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
346 346
 					),
347
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
348
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
347
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
348
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
349 349
 				'caps' => EEM_Base::caps_read_admin
350 350
 			),
351 351
 			$event_id
352 352
 		);
353
-		if( $event_id ){
354
-			$query_params[0]['EVT_ID'] =  $event_id;
355
-		}else{
356
-			$query_params[ 'force_join' ][] = 'Event';
353
+		if ($event_id) {
354
+			$query_params[0]['EVT_ID'] = $event_id;
355
+		} else {
356
+			$query_params['force_join'][] = 'Event';
357 357
 		}
358
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
358
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
359 359
 		//get all questions which relate to someone in this group
360 360
 		$registration_ids = array();
361
-		foreach( $registration_rows as $reg_row ) {
362
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
361
+		foreach ($registration_rows as $reg_row) {
362
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
363 363
 		}
364 364
 //		EEM_Question::instance()->show_next_x_db_queries();
365
-		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids))));
366
-		foreach($registration_rows as $reg_row){
367
-			if ( is_array( $reg_row ) ) {
365
+		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids))));
366
+		foreach ($registration_rows as $reg_row) {
367
+			if (is_array($reg_row)) {
368 368
 				$reg_csv_array = array();
369
-				if( ! $event_id ){
369
+				if ( ! $event_id) {
370 370
 					//get the event's name and Id
371
-					$reg_csv_array[ __( 'Event', 'event_espresso' ) ] = sprintf( __( '%1$s (%2$s)', 'event_espresso' ), $this->_prepare_value_from_db_for_display( EEM_Event::instance(), 'EVT_name', $reg_row[ 'Event_CPT.post_title'] ), $reg_row[ 'Event_CPT.ID' ] );
371
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'), $this->_prepare_value_from_db_for_display(EEM_Event::instance(), 'EVT_name', $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
372 372
 				}
373
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
373
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
374 374
 				/*@var $reg_row EE_Registration */
375
-				foreach($reg_fields_to_include as $field_name){
375
+				foreach ($reg_fields_to_include as $field_name) {
376 376
 					$field = $reg_model->field_settings_for($field_name);
377
-					if($field_name == 'REG_final_price'){
378
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
379
-					}elseif( $field_name == 'REG_count' ){
380
-						$value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
381
-					}elseif( $field_name == 'REG_date' ) {
382
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
383
-					}else{
384
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
377
+					if ($field_name == 'REG_final_price') {
378
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
379
+					}elseif ($field_name == 'REG_count') {
380
+						$value = sprintf(__('%s of %s', 'event_espresso'), $this->_prepare_value_from_db_for_display($reg_model, 'REG_count', $reg_row['Registration.REG_count']), $this->_prepare_value_from_db_for_display($reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size']));
381
+					}elseif ($field_name == 'REG_date') {
382
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
383
+					} else {
384
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
385 385
 					}
386 386
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
387
-					if($field_name == 'REG_final_price'){
387
+					if ($field_name == 'REG_final_price') {
388 388
 						//add a column named Currency after the final price
389 389
 						$reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code;
390 390
 					}
391 391
 				}
392 392
 				//get pretty status
393
-				$stati = EEM_Status::instance()->localized_status( array(
394
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
395
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
393
+				$stati = EEM_Status::instance()->localized_status(array(
394
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
395
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
396 396
 						FALSE,
397
-						'sentence' );
398
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
397
+						'sentence');
398
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
399 399
 				//get pretty trnasaction status
400
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
401
-				$reg_csv_array[ __( 'Transaction Amount Due', 'event_espresso' ) ] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_total', $reg_row[ 'TransactionTable.TXN_total' ], 'localized_float' ) : '0.00';
402
-				$reg_csv_array[ __( 'Amount Paid', 'event_espresso' )] = $is_primary_reg ? $this->_prepare_value_from_db_for_display( EEM_Transaction::instance(), 'TXN_paid', $reg_row[ 'TransactionTable.TXN_paid' ], 'localized_float' ) : '0.00';
400
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
401
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_total', $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
402
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg ? $this->_prepare_value_from_db_for_display(EEM_Transaction::instance(), 'TXN_paid', $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
403 403
 				$payment_methods = array();
404 404
 				$gateway_txn_ids_etc = array();
405 405
 				$payment_times = array();
406
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
406
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
407 407
 					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
408 408
 							array(
409 409
 								array(
410
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
410
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
411 411
 									'STS_ID' => EEM_Payment::status_id_approved
412 412
 								),
413
-								'force_join' => array( 'Payment_Method' ),
413
+								'force_join' => array('Payment_Method'),
414 414
 
415 415
 							),
416 416
 							ARRAY_A,
417 417
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
418 418
 
419
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
420
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
421
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
422
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
419
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
420
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
421
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
422
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
423 423
 					}
424 424
 
425 425
 				}
426
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
427
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
428
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
426
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
427
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
428
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
429 429
 
430 430
 				//get whether or not the user has checked in
431
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
431
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
432 432
 				//get ticket of registration and its price
433 433
 				$ticket_model = EE_Registry::instance()->load_model('Ticket');
434
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
435
-					$ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
434
+				if ($reg_row['Ticket.TKT_ID']) {
435
+					$ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
436 436
 					$datetimes_strings = array();
437
-					foreach( EEM_Datetime::instance()->get_all_wpdb_results( array( array( 'Ticket.TKT_ID' => $reg_row[ 'Ticket.TKT_ID' ] ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ), 'default_where_conditions' => 'none' ) ) as $datetime){
438
-						$datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
437
+					foreach (EEM_Datetime::instance()->get_all_wpdb_results(array(array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']), 'order_by' => array('DTT_EVT_start' => 'ASC'), 'default_where_conditions' => 'none')) as $datetime) {
438
+						$datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
439 439
 					}
440 440
 
441 441
 				} else {
442
-					$ticket_name = __( 'Unknown', 'event_espresso' );
443
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
442
+					$ticket_name = __('Unknown', 'event_espresso');
443
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
444 444
 				}
445 445
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
446 446
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
447 447
 				//get datetime(s) of registration
448 448
 
449 449
 				//add attendee columns
450
-				foreach($att_fields_to_include as $att_field_name){
450
+				foreach ($att_fields_to_include as $att_field_name) {
451 451
 					$field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name);
452
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
453
-						if($att_field_name == 'STA_ID'){
454
-							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
455
-						}elseif($att_field_name == 'CNT_ISO'){
456
-							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
457
-						}else{
458
-							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
452
+					if ($reg_row['Attendee_CPT.ID']) {
453
+						if ($att_field_name == 'STA_ID') {
454
+							$value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
455
+						}elseif ($att_field_name == 'CNT_ISO') {
456
+							$value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
457
+						} else {
458
+							$value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
459 459
 						}
460
-					}else{
460
+					} else {
461 461
 						$value = '';
462 462
 					}
463 463
 
@@ -465,56 +465,56 @@  discard block
 block discarded – undo
465 465
 				}
466 466
 
467 467
 				//make sure each registration has the same questions in the same order
468
-				foreach($questions_for_these_regs_rows as $question_row){
469
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
470
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
468
+				foreach ($questions_for_these_regs_rows as $question_row) {
469
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
470
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
471 471
 					}
472 472
 				}
473 473
 				//now fill out the questions THEY answered
474
-				foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){
474
+				foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) {
475 475
 					/* @var $answer EE_Answer */
476
-					if( $answer_row[ 'Question.QST_ID' ] ){
477
-						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
478
-					}else{
479
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
476
+					if ($answer_row['Question.QST_ID']) {
477
+						$question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']);
478
+					} else {
479
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
480 480
 					}
481
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
482
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
481
+                                        if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) {
482
+                                            $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']);
483 483
                                         } else {
484
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
484
+                                            $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']);
485 485
                                         }
486 486
 				}
487
-				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
487
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row);
488 488
 			}
489 489
 		}
490 490
 
491 491
 		//if we couldn't export anything, we want to at least show the column headers
492
-		if(empty($registrations_csv_ready_array)){
492
+		if (empty($registrations_csv_ready_array)) {
493 493
 			$reg_csv_array = array();
494 494
 			$model_and_fields_to_include = array(
495 495
 				'Registration' => $reg_fields_to_include,
496 496
 				'Attendee' => $att_fields_to_include
497 497
 			);
498
-			foreach($model_and_fields_to_include as $model_name => $field_list){
498
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
499 499
 				$model = EE_Registry::instance()->load_model($model_name);
500
-				foreach($field_list as $field_name){
500
+				foreach ($field_list as $field_name) {
501 501
 					$field = $model->field_settings_for($field_name);
502
-					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
502
+					$reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name());
503 503
 				}
504 504
 			}
505 505
 			$registrations_csv_ready_array [] = $reg_csv_array;
506 506
 		}
507
-		if( $event_id ){
508
-			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
509
-			if( ! $event_slug ) {
510
-				$event_slug = __( 'unknown', 'event_espresso' );
507
+		if ($event_id) {
508
+			$event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
509
+			if ( ! $event_slug) {
510
+				$event_slug = __('unknown', 'event_espresso');
511 511
 			}
512
-		}else{
513
-			$event_slug = __( 'all', 'event_espresso' );
512
+		} else {
513
+			$event_slug = __('all', 'event_espresso');
514 514
 		}
515
-		$filename = sprintf( "registrations-for-%s", $event_slug );
515
+		$filename = sprintf("registrations-for-%s", $event_slug);
516 516
 
517
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
517
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
518 518
 		$this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array);
519 519
 		$this->EE_CSV->end_sending_csv($handle);
520 520
 	}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	 * @param EE_Model_Field_Base $field
525 525
 	 * @return string
526 526
 	 */
527
-	protected function _get_column_name_for_field(EE_Model_Field_Base $field){
527
+	protected function _get_column_name_for_field(EE_Model_Field_Base $field) {
528 528
 		return $field->get_nicename()."[".$field->get_name()."]";
529 529
 	}
530 530
 
@@ -537,17 +537,17 @@  discard block
 block discarded – undo
537 537
 	function export_categories() {
538 538
 		// are any Event IDs set?
539 539
 		$query_params = array();
540
-		if ( isset( $this->_req_data['EVT_CAT_ID'] )) {
540
+		if (isset($this->_req_data['EVT_CAT_ID'])) {
541 541
 			// do we have an array of IDs ?
542
-			if ( is_array( $this->_req_data['EVT_CAT_ID'] )) {
542
+			if (is_array($this->_req_data['EVT_CAT_ID'])) {
543 543
 				// generate an "IN (CSV)" where clause
544
-				$EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] );
544
+				$EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']);
545 545
 				$filename = 'event-categories';
546
-				$query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs);
546
+				$query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs);
547 547
 			} else {
548 548
 				// generate regular where = clause
549
-				$EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] );
550
-				$filename = 'event-category#' . $EVT_CAT_ID;
549
+				$EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']);
550
+				$filename = 'event-category#'.$EVT_CAT_ID;
551 551
 				$query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID;
552 552
 			}
553 553
 		} else {
@@ -559,11 +559,11 @@  discard block
 block discarded – undo
559 559
 				'Term_Taxonomy' => $query_params
560 560
 			);
561 561
 
562
-		$table_data = $this->_get_export_data_for_models( $tables_to_export );
563
-		$filename = $this->generate_filename ( $filename );
562
+		$table_data = $this->_get_export_data_for_models($tables_to_export);
563
+		$filename = $this->generate_filename($filename);
564 564
 
565
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) {
566
-			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
565
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) {
566
+			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
567 567
 		}
568 568
 	}
569 569
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *		  @param string - export_name
575 575
 	 *			@return string on success, FALSE on fail
576 576
 	 */
577
-	private function generate_filename ( $export_name = '' ) {
578
-		if ( $export_name != '' ) {
579
-			$filename = get_bloginfo('name') . '-' . $export_name;
580
-			$filename = sanitize_key( $filename ) . '-' . $this->today;
577
+	private function generate_filename($export_name = '') {
578
+		if ($export_name != '') {
579
+			$filename = get_bloginfo('name').'-'.$export_name;
580
+			$filename = sanitize_key($filename).'-'.$this->today;
581 581
 			return $filename;
582
-		}	 else {
583
-			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
582
+		} else {
583
+			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
584 584
 		}
585 585
 		return false;
586 586
 	}
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 *	@param array $models_to_export keys are model names (eg 'Event', 'Attendee', etc.) and values are arrays of query params like on EEM_Base::get_all
594 594
 	 *	@return array on success, FALSE on fail
595 595
 	 */
596
-	private function _get_export_data_for_models( $models_to_export = array() ) {
596
+	private function _get_export_data_for_models($models_to_export = array()) {
597 597
 		$table_data = FALSE;
598
-		if ( is_array( $models_to_export ) ) {
599
-			foreach ( $models_to_export as $model_name => $query_params ) {
598
+		if (is_array($models_to_export)) {
599
+			foreach ($models_to_export as $model_name => $query_params) {
600 600
 				//check for a numerically-indexed array. in that case, $model_name is the value!!
601
-				if(is_int($model_name)){
601
+				if (is_int($model_name)) {
602 602
 					$model_name = $query_params;
603 603
 					$query_params = array();
604 604
 				}
@@ -606,17 +606,17 @@  discard block
 block discarded – undo
606 606
 				$model_objects = $model->get_all($query_params);
607 607
 
608 608
 				$table_data[$model_name] = array();
609
-				foreach($model_objects as $model_object){
609
+				foreach ($model_objects as $model_object) {
610 610
 					$model_data_array = array();
611 611
 					$fields = $model->field_settings();
612
-					foreach($fields as $field){
612
+					foreach ($fields as $field) {
613 613
 						$column_name = $field->get_nicename()."[".$field->get_name()."]";
614
-						if($field instanceof EE_Datetime_Field){
614
+						if ($field instanceof EE_Datetime_Field) {
615 615
 //							$field->set_date_format('Y-m-d');
616 616
 //							$field->set_time_format('H:i:s');
617
-							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
617
+							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s');
618 618
 						}
619
-						else{
619
+						else {
620 620
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
621 621
 						}
622 622
 					}
Please login to merge, or discard this patch.
Braces   +18 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
3 5
 /**
4 6
  * EE_Export class
@@ -233,10 +235,10 @@  discard block
 block discarded – undo
233 235
 				if( $field_name == 'STA_ID' ){
234 236
 					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
235 237
 					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
236
-				}elseif( $field_name == 'CNT_ISO' ){
238
+				} elseif( $field_name == 'CNT_ISO' ){
237 239
 					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
238 240
 					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
239
-				}else{
241
+				} else{
240 242
 					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
241 243
 				}
242 244
 			}
@@ -294,9 +296,9 @@  discard block
 block discarded – undo
294 296
 		}
295 297
 		if( $pretty_schema === true){
296 298
 			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
297
-		}elseif( is_string( $pretty_schema ) ) {
299
+		} elseif( is_string( $pretty_schema ) ) {
298 300
 			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
299
-		}else{
301
+		} else{
300 302
 			return $field_obj->prepare_for_get( $value_on_model_obj );
301 303
 		}
302 304
 	}
@@ -352,7 +354,7 @@  discard block
 block discarded – undo
352 354
 		);
353 355
 		if( $event_id ){
354 356
 			$query_params[0]['EVT_ID'] =  $event_id;
355
-		}else{
357
+		} else{
356 358
 			$query_params[ 'force_join' ][] = 'Event';
357 359
 		}
358 360
 		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
@@ -376,11 +378,11 @@  discard block
 block discarded – undo
376 378
 					$field = $reg_model->field_settings_for($field_name);
377 379
 					if($field_name == 'REG_final_price'){
378 380
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
379
-					}elseif( $field_name == 'REG_count' ){
381
+					} elseif( $field_name == 'REG_count' ){
380 382
 						$value = sprintf( __( '%s of %s', 'event_espresso' ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_count', $reg_row['Registration.REG_count'] ), $this->_prepare_value_from_db_for_display( $reg_model, 'REG_group_size', $reg_row['Registration.REG_group_size' ] ) );
381
-					}elseif( $field_name == 'REG_date' ) {
383
+					} elseif( $field_name == 'REG_date' ) {
382 384
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
383
-					}else{
385
+					} else{
384 386
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
385 387
 					}
386 388
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
@@ -452,12 +454,12 @@  discard block
 block discarded – undo
452 454
 					if( $reg_row[ 'Attendee_CPT.ID' ]){
453 455
 						if($att_field_name == 'STA_ID'){
454 456
 							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
455
-						}elseif($att_field_name == 'CNT_ISO'){
457
+						} elseif($att_field_name == 'CNT_ISO'){
456 458
 							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
457
-						}else{
459
+						} else{
458 460
 							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
459 461
 						}
460
-					}else{
462
+					} else{
461 463
 						$value = '';
462 464
 					}
463 465
 
@@ -475,7 +477,7 @@  discard block
 block discarded – undo
475 477
 					/* @var $answer EE_Answer */
476 478
 					if( $answer_row[ 'Question.QST_ID' ] ){
477 479
 						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
478
-					}else{
480
+					} else{
479 481
 						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
480 482
 					}
481 483
                                         if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
@@ -509,7 +511,7 @@  discard block
 block discarded – undo
509 511
 			if( ! $event_slug ) {
510 512
 				$event_slug = __( 'unknown', 'event_espresso' );
511 513
 			}
512
-		}else{
514
+		} else{
513 515
 			$event_slug = __( 'all', 'event_espresso' );
514 516
 		}
515 517
 		$filename = sprintf( "registrations-for-%s", $event_slug );
@@ -579,7 +581,7 @@  discard block
 block discarded – undo
579 581
 			$filename = get_bloginfo('name') . '-' . $export_name;
580 582
 			$filename = sanitize_key( $filename ) . '-' . $this->today;
581 583
 			return $filename;
582
-		}	 else {
584
+		} else {
583 585
 			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
584 586
 		}
585 587
 		return false;
@@ -615,8 +617,7 @@  discard block
 block discarded – undo
615 617
 //							$field->set_date_format('Y-m-d');
616 618
 //							$field->set_time_format('H:i:s');
617 619
 							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
618
-						}
619
-						else{
620
+						} else{
620 621
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
621 622
 						}
622 623
 					}
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Form_Input.class.php 2 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 *        generate_question_form_inputs_for_object
227 227
 	 *
228 228
 	 * @access    protected
229
-	 * @param bool|object $object $object
229
+	 * @param EE_Base_Class|null $object $object
230 230
 	 * @param    array    $input_types
231 231
 	 * @return        array
232 232
 	 */
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 *    add_temp_option
325 325
 	 * @access public
326 326
 	 * @param \EE_Question_Option $QSO EE_Question_Option
327
-	 * @return boolean
327
+	 * @return boolean|null
328 328
 	 */
329 329
 	public function add_temp_option( EE_Question_Option $QSO ) {
330 330
 		$this->_QST->add_temp_option( $QSO );
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * set property values for question form input
337 337
 	 * @access public
338 338
 	 * @param    string $property
339
-	 * @param    mixed  $value
340
-	 * @return mixed
339
+	 * @param    boolean  $value
340
+	 * @return boolean|null
341 341
 	 */
342 342
 	public function set( $property = NULL, $value = NULL ) {
343 343
 		if ( ! empty( $property ) ) {
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	/**
377 377
 	 *    get_meta
378 378
 	 * @access public
379
-	 * @param mixed $key
379
+	 * @param string $key
380 380
 	 * @return mixed
381 381
 	 */
382 382
 	public function get_meta( $key = FALSE ) {
Please login to merge, or discard this patch.
Spacing   +76 added lines, -76 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
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
 	 * @access public
83 83
 	 * @return \EE_Question_Form_Input
84 84
 	 */
85
-	public function __construct( EE_Question $QST = NULL, EE_Answer $ANS = NULL, $q_meta = array() ) {
86
-		if ( empty( $QST ) || empty( $ANS ) ) {
87
-			EE_Error::add_error( __( 'An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
85
+	public function __construct(EE_Question $QST = NULL, EE_Answer $ANS = NULL, $q_meta = array()) {
86
+		if (empty($QST) || empty($ANS)) {
87
+			EE_Error::add_error(__('An error occurred. A valid EE_Question or EE_Answer object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
88 88
 			return NULL;
89 89
 		}
90 90
 		$this->_QST = $QST;
91 91
 		$this->_ANS = $ANS;
92
-		$this->set_question_form_input_meta( $q_meta );
92
+		$this->set_question_form_input_meta($q_meta);
93 93
 		$this->set_question_form_input_init();
94 94
 	}
95 95
 
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
 	 * @param array $q_meta
102 102
 	 * @return void
103 103
 	 */
104
-	public function set_question_form_input_meta( $q_meta = array() ) {
105
-		$default_q_meta = array( 'att_nmbr' => 1, 'ticket_id' => '', 'date' => '', 'time' => '', 'input_name' => '', 'input_id' => '', 'input_class' => '', 'input_prefix' => 'qstn', 'append_qstn_id' => TRUE, 'htmlentities' => TRUE, 'allow_null' => FALSE );
106
-		$this->_QST_meta = array_merge( $default_q_meta, $q_meta );
104
+	public function set_question_form_input_meta($q_meta = array()) {
105
+		$default_q_meta = array('att_nmbr' => 1, 'ticket_id' => '', 'date' => '', 'time' => '', 'input_name' => '', 'input_id' => '', 'input_class' => '', 'input_prefix' => 'qstn', 'append_qstn_id' => TRUE, 'htmlentities' => TRUE, 'allow_null' => FALSE);
106
+		$this->_QST_meta = array_merge($default_q_meta, $q_meta);
107 107
 	}
108 108
 
109 109
 
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function set_question_form_input_init() {
117 117
 		$qstn_id = $this->_QST->system_ID() ? $this->_QST->system_ID() : $this->_QST->ID();
118
-		$this->_set_input_name( $qstn_id );
119
-		$this->_set_input_id( $qstn_id );
120
-		$this->_set_input_class( $qstn_id );
121
-		$this->set_question_form_input_answer( $qstn_id );
118
+		$this->_set_input_name($qstn_id);
119
+		$this->_set_input_id($qstn_id);
120
+		$this->_set_input_class($qstn_id);
121
+		$this->set_question_form_input_answer($qstn_id);
122 122
 	}
123 123
 
124 124
 
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
 	 * @param $qstn_id
130 130
 	 * @return void
131 131
 	 */
132
-	private function _set_input_name( $qstn_id ) {
133
-		if ( ! empty( $qstn_id ) ) {
134
-			$ANS_ID = $this->get( 'ANS_ID' );
135
-			$qstn_id = ! empty( $ANS_ID ) ? '[' . $qstn_id . '][' . $ANS_ID . ']' : '[' . $qstn_id . ']';
132
+	private function _set_input_name($qstn_id) {
133
+		if ( ! empty($qstn_id)) {
134
+			$ANS_ID = $this->get('ANS_ID');
135
+			$qstn_id = ! empty($ANS_ID) ? '['.$qstn_id.']['.$ANS_ID.']' : '['.$qstn_id.']';
136 136
 		}
137
-		$this->QST_input_name = $this->_QST_meta[ 'append_qstn_id' ] && ! empty( $qstn_id ) ? $this->_QST_meta[ 'input_prefix' ] . $this->_QST_meta[ 'input_name' ] . $qstn_id : $this->_QST_meta[ 'input_prefix' ] . $this->_QST_meta[ 'input_name' ];
137
+		$this->QST_input_name = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id) ? $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'].$qstn_id : $this->_QST_meta['input_prefix'].$this->_QST_meta['input_name'];
138 138
 	}
139 139
 
140 140
 
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 	 * @param    string $property
146 146
 	 * @return mixed
147 147
 	 */
148
-	public function get( $property = NULL ) {
149
-		if ( ! empty( $property ) ) {
150
-			if ( EEM_Question::instance()->has_field( $property ) ) {
151
-				return $this->_QST->get( $property );
152
-			} else if ( EEM_Answer::instance()->has_field( $property ) ) {
153
-				return $this->_ANS->get( $property );
154
-			} else if ( $this->_question_form_input_property_exists( __CLASS__, $property ) ) {
148
+	public function get($property = NULL) {
149
+		if ( ! empty($property)) {
150
+			if (EEM_Question::instance()->has_field($property)) {
151
+				return $this->_QST->get($property);
152
+			} else if (EEM_Answer::instance()->has_field($property)) {
153
+				return $this->_ANS->get($property);
154
+			} else if ($this->_question_form_input_property_exists(__CLASS__, $property)) {
155 155
 				return $this->{$property};
156 156
 			}
157 157
 		}
@@ -167,13 +167,13 @@  discard block
 block discarded – undo
167 167
 	 * @param    string $property
168 168
 	 * @return boolean
169 169
 	 */
170
-	private function _question_form_input_property_exists( $classname, $property ) {
170
+	private function _question_form_input_property_exists($classname, $property) {
171 171
 		// first try regular property exists method which works as expected in PHP 5.3+
172
-		$prop = EEH_Class_Tools::has_property( $classname, $property );
173
-		if ( ! $prop ) {
172
+		$prop = EEH_Class_Tools::has_property($classname, $property);
173
+		if ( ! $prop) {
174 174
 			// use reflection for < PHP 5.3 as a double check when property is not found, possible due to access restriction
175
-			$reflector = new ReflectionClass( $classname );
176
-			$prop = $reflector->hasProperty( $property );
175
+			$reflector = new ReflectionClass($classname);
176
+			$prop = $reflector->hasProperty($property);
177 177
 		}
178 178
 		return $prop;
179 179
 	}
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	 * @param $qstn_id
187 187
 	 * @return void
188 188
 	 */
189
-	private function _set_input_id( $qstn_id ) {
190
-		$input_id = isset( $this->_QST_meta[ 'input_id' ] ) && ! empty( $this->_QST_meta[ 'input_id' ] ) ? $this->_QST_meta[ 'input_id' ] : sanitize_key( strip_tags( $this->_QST->get( 'QST_display_text' ) ) );
191
-		$this->QST_input_id = $this->_QST_meta[ 'append_qstn_id' ] && ! empty( $qstn_id ) ? $input_id . '-' . $qstn_id : $input_id;
189
+	private function _set_input_id($qstn_id) {
190
+		$input_id = isset($this->_QST_meta['input_id']) && ! empty($this->_QST_meta['input_id']) ? $this->_QST_meta['input_id'] : sanitize_key(strip_tags($this->_QST->get('QST_display_text')));
191
+		$this->QST_input_id = $this->_QST_meta['append_qstn_id'] && ! empty($qstn_id) ? $input_id.'-'.$qstn_id : $input_id;
192 192
 	}
193 193
 
194 194
 
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @return void
200 200
 	 */
201 201
 	private function _set_input_class() {
202
-		$this->QST_input_class = isset( $this->_QST_meta[ 'input_class' ] ) ? $this->_QST_meta[ 'input_class' ] : '';
202
+		$this->QST_input_class = isset($this->_QST_meta['input_class']) ? $this->_QST_meta['input_class'] : '';
203 203
 	}
204 204
 
205 205
 
@@ -210,12 +210,12 @@  discard block
 block discarded – undo
210 210
 	 * @param mixed    int | string    $qstn_id
211 211
 	 * @return void
212 212
 	 */
213
-	public function set_question_form_input_answer( $qstn_id ) {
213
+	public function set_question_form_input_answer($qstn_id) {
214 214
 		// check for answer in $_REQUEST in case we are reprocessing a form after an error
215
-		if ( isset( $this->_QST_meta[ 'EVT_ID' ] ) && isset( $this->_QST_meta[ 'att_nmbr' ] ) && isset( $this->_QST_meta[ 'date' ] ) && isset( $this->_QST_meta[ 'time' ] ) && isset( $this->_QST_meta[ 'price_id' ] ) ) {
216
-			if ( isset( $_REQUEST[ 'qstn' ][ $this->_QST_meta[ 'EVT_ID' ] ][ $this->_QST_meta[ 'att_nmbr' ] ][ $this->_QST_meta[ 'date' ] ][ $this->_QST_meta[ 'time' ] ][ $this->_QST_meta[ 'price_id' ] ][ $qstn_id ] ) ) {
217
-				$answer = $_REQUEST[ 'qstn' ][ $this->_QST_meta[ 'EVT_ID' ] ][ $this->_QST_meta[ 'att_nmbr' ] ][ $this->_QST_meta[ 'date' ] ][ $this->_QST_meta[ 'time' ] ][ $this->_QST_meta[ 'price_id' ] ][ $qstn_id ];
218
-				$this->_ANS->set( 'ANS_value', $answer );
215
+		if (isset($this->_QST_meta['EVT_ID']) && isset($this->_QST_meta['att_nmbr']) && isset($this->_QST_meta['date']) && isset($this->_QST_meta['time']) && isset($this->_QST_meta['price_id'])) {
216
+			if (isset($_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id])) {
217
+				$answer = $_REQUEST['qstn'][$this->_QST_meta['EVT_ID']][$this->_QST_meta['att_nmbr']][$this->_QST_meta['date']][$this->_QST_meta['time']][$this->_QST_meta['price_id']][$qstn_id];
218
+				$this->_ANS->set('ANS_value', $answer);
219 219
 			}
220 220
 		}
221 221
 	}
@@ -230,40 +230,40 @@  discard block
 block discarded – undo
230 230
 	 * @param    array    $input_types
231 231
 	 * @return        array
232 232
 	 */
233
-	static function generate_question_form_inputs_for_object( $object = FALSE, $input_types = array() ) {
234
-		if ( ! is_object( $object ) ) {
233
+	static function generate_question_form_inputs_for_object($object = FALSE, $input_types = array()) {
234
+		if ( ! is_object($object)) {
235 235
 			return FALSE;
236 236
 		}
237 237
 		$inputs = array();
238
-		$fields = $object->get_model()->field_settings( FALSE );
238
+		$fields = $object->get_model()->field_settings(FALSE);
239 239
 		//		$pk = $object->ID(); <<< NO!
240 240
 		//		EEH_Debug_Tools::printr( $object, get_class( $object ) . '<br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
241 241
 		//		EEH_Debug_Tools::printr( $fields, '$fields  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
242 242
 		//		EEH_Debug_Tools::printr( $input_types, '$input_types  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
243
-		foreach ( $fields as $field_ID => $field ) {
244
-			if ( $field instanceof EE_Model_Field_Base ) {
243
+		foreach ($fields as $field_ID => $field) {
244
+			if ($field instanceof EE_Model_Field_Base) {
245 245
 				//			echo '<h4>$field_ID : ' . $field_ID . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
246 246
 				//			EEH_Debug_Tools::printr( $field, '$field  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
247
-				if ( isset( $input_types[ $field_ID ] ) ) {
247
+				if (isset($input_types[$field_ID])) {
248 248
 					// get saved value for field
249
-					$value = $object->get( $field_ID );
249
+					$value = $object->get($field_ID);
250 250
 					//				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
251 251
 					// if no saved value, then use default
252 252
 					$value = $value !== NULL ? $value : $field->get_default_value();
253 253
 					//			if ( $field_ID == 'CNT_active' )
254 254
 					//				echo '<h4>$value : ' . $value . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
255 255
 					// determine question type
256
-					$type = isset( $input_types[ $field_ID ] ) ? $input_types[ $field_ID ][ 'type' ] : 'TEXT';
256
+					$type = isset($input_types[$field_ID]) ? $input_types[$field_ID]['type'] : 'TEXT';
257 257
 					// input name
258
-					$input_name = isset( $input_types[ $field_ID ] ) && isset( $input_types[ $field_ID ][ 'input_name' ] ) ? $input_types[ $field_ID ][ 'input_name' ] . '[' . $field_ID . ']' : $field_ID;
258
+					$input_name = isset($input_types[$field_ID]) && isset($input_types[$field_ID]['input_name']) ? $input_types[$field_ID]['input_name'].'['.$field_ID.']' : $field_ID;
259 259
 					// css class for input
260
-					$class = isset( $input_types[ $field_ID ][ 'class' ] ) && ! empty( $input_types[ $field_ID ][ 'class' ] ) ? ' ' . $input_types[ $field_ID ][ 'class' ] : '';
260
+					$class = isset($input_types[$field_ID]['class']) && ! empty($input_types[$field_ID]['class']) ? ' '.$input_types[$field_ID]['class'] : '';
261 261
 					// whether to apply htmlentities to answer
262
-					$htmlentities = isset( $input_types[ $field_ID ][ 'htmlentities' ] ) ? $input_types[ $field_ID ][ 'htmlentities' ] : TRUE;
262
+					$htmlentities = isset($input_types[$field_ID]['htmlentities']) ? $input_types[$field_ID]['htmlentities'] : TRUE;
263 263
 					// whether to apply htmlentities to answer
264
-					$label_b4 = isset( $input_types[ $field_ID ][ 'label_b4' ] ) ? $input_types[ $field_ID ][ 'label_b4' ] : FALSE;
264
+					$label_b4 = isset($input_types[$field_ID]['label_b4']) ? $input_types[$field_ID]['label_b4'] : FALSE;
265 265
 					// whether to apply htmlentities to answer
266
-					$use_desc_4_label = isset( $input_types[ $field_ID ][ 'use_desc_4_label' ] ) ? $input_types[ $field_ID ][ 'use_desc_4_label' ] : FALSE;
266
+					$use_desc_4_label = isset($input_types[$field_ID]['use_desc_4_label']) ? $input_types[$field_ID]['use_desc_4_label'] : FALSE;
267 267
 
268 268
 					// create EE_Question_Form_Input object
269 269
 					$QFI = new EE_Question_Form_Input(
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 							)
284 284
 						),
285 285
 						array(
286
-							'input_id' => $field_ID . '-' . $object->ID(),
286
+							'input_id' => $field_ID.'-'.$object->ID(),
287 287
 							'input_name' => $input_name,
288
-							'input_class' => $field_ID . $class,
288
+							'input_class' => $field_ID.$class,
289 289
 							'input_prefix' => '',
290 290
 							'append_qstn_id' => FALSE,
291 291
 							'htmlentities' => $htmlentities,
@@ -294,21 +294,21 @@  discard block
 block discarded – undo
294 294
 						)
295 295
 					);
296 296
 					// does question type have options ?
297
-					if ( in_array( $type, array( 'DROPDOWN', 'RADIO_BTN', 'CHECKBOX' ) ) && isset ( $input_types[ $field_ID ] ) && isset ( $input_types[ $field_ID ][ 'options' ] ) ) {
298
-						foreach ( $input_types[ $field_ID ][ 'options' ] as $option ) {
299
-							$option = stripslashes_deep( $option );
300
-							$option_id = ! empty( $option[ 'id' ] ) ? $option[ 'id' ] : 0;
301
-							$QSO = EE_Question_Option::new_instance( array( 'QSO_value' => (string)$option_id, 'QSO_desc' => $option[ 'text' ], 'QSO_deleted' => FALSE ) );
297
+					if (in_array($type, array('DROPDOWN', 'RADIO_BTN', 'CHECKBOX')) && isset ($input_types[$field_ID]) && isset ($input_types[$field_ID]['options'])) {
298
+						foreach ($input_types[$field_ID]['options'] as $option) {
299
+							$option = stripslashes_deep($option);
300
+							$option_id = ! empty($option['id']) ? $option['id'] : 0;
301
+							$QSO = EE_Question_Option::new_instance(array('QSO_value' => (string) $option_id, 'QSO_desc' => $option['text'], 'QSO_deleted' => FALSE));
302 302
 							// all QST (and ANS) properties can be accessed indirectly thru QFI
303
-							$QFI->add_temp_option( $QSO );
303
+							$QFI->add_temp_option($QSO);
304 304
 						}
305 305
 					}
306 306
 					// we don't want ppl manually changing primary keys cuz that would just lead to total craziness man
307
-					if ( $field_ID == $object->get_model()->primary_key_name() ) {
308
-						$QFI->set( 'QST_disabled', TRUE );
307
+					if ($field_ID == $object->get_model()->primary_key_name()) {
308
+						$QFI->set('QST_disabled', TRUE);
309 309
 					}
310 310
 					//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
311
-					$inputs[ $field_ID ] = $QFI;
311
+					$inputs[$field_ID] = $QFI;
312 312
 					//			if ( $field_ID == 'CNT_active' ) {
313 313
 					//				EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
314 314
 					//			}
@@ -326,8 +326,8 @@  discard block
 block discarded – undo
326 326
 	 * @param \EE_Question_Option $QSO EE_Question_Option
327 327
 	 * @return boolean
328 328
 	 */
329
-	public function add_temp_option( EE_Question_Option $QSO ) {
330
-		$this->_QST->add_temp_option( $QSO );
329
+	public function add_temp_option(EE_Question_Option $QSO) {
330
+		$this->_QST->add_temp_option($QSO);
331 331
 	}
332 332
 
333 333
 
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 	 * @param    mixed  $value
340 340
 	 * @return mixed
341 341
 	 */
342
-	public function set( $property = NULL, $value = NULL ) {
343
-		if ( ! empty( $property ) ) {
344
-			if ( EEM_Question::instance()->has_field( $property ) ) {
345
-				$this->_QST->set( $property, $value );
346
-			} else if ( EEM_Answer::instance()->has_field( $property ) ) {
347
-				$this->_ANS->set( $property, $value );
348
-			} else if ( $this->_question_form_input_property_exists( __CLASS__, $property ) ) {
342
+	public function set($property = NULL, $value = NULL) {
343
+		if ( ! empty($property)) {
344
+			if (EEM_Question::instance()->has_field($property)) {
345
+				$this->_QST->set($property, $value);
346
+			} else if (EEM_Answer::instance()->has_field($property)) {
347
+				$this->_ANS->set($property, $value);
348
+			} else if ($this->_question_form_input_property_exists(__CLASS__, $property)) {
349 349
 				echo "<hr>$property is a prop of QFI";
350 350
 				$this->{$property} = $value;
351 351
 				return TRUE;
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 	 *                                                       whether it was trashed or not.
367 367
 	 * @return EE_Question_Option
368 368
 	 */
369
-	public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) {
369
+	public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) {
370 370
 		$temp_options = $this->_QST->temp_options();
371
-		return ! empty( $temp_options ) ? $temp_options : $this->_QST->options( $notDeletedOptionsOnly, $selected_value_to_always_include );
371
+		return ! empty($temp_options) ? $temp_options : $this->_QST->options($notDeletedOptionsOnly, $selected_value_to_always_include);
372 372
 	}
373 373
 
374 374
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param mixed $key
380 380
 	 * @return mixed
381 381
 	 */
382
-	public function get_meta( $key = FALSE ) {
383
-		return $key && isset( $this->_QST_meta[ $key ] ) ? $this->_QST_meta[ $key ] : FALSE;
382
+	public function get_meta($key = FALSE) {
383
+		return $key && isset($this->_QST_meta[$key]) ? $this->_QST_meta[$key] : FALSE;
384 384
 	}
385 385
 
386 386
 
Please login to merge, or discard this patch.
core/db_models/EEM_Price_Type.model.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	/**
44 44
 	 * return an array of Base types. Keys are INTs which are used in the database,
45 45
 	 * values are text-representations of the base type.
46
-	 * @return array
46
+	 * @return integer
47 47
 	 */
48 48
 	public function get_base_types(){
49 49
 		return $this->base_types;
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * 		instantiate a new price type object with blank/empty properties
122 122
 	 *
123 123
 	 * 		@access		public
124
-	 * 		@return		mixed		array on success, FALSE on fail
124
+	 * 		@return		EE_Price_Type		array on success, FALSE on fail
125 125
 	 */
126 126
 	public function get_new_price_type() {
127 127
 		return EE_Price_Type::new_instance();
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
 	public $type = NULL;
34 34
 
35 35
 	/**
36
-	*	Price Base types
37
-	*
38
-	*	@access	private
39
-	*	@var int
40
-	*/
36
+	 *	Price Base types
37
+	 *
38
+	 *	@access	private
39
+	 *	@var int
40
+	 */
41 41
 	public $base_types = null;
42 42
 
43 43
 	/**
@@ -144,8 +144,8 @@  discard block
 block discarded – undo
144 144
  *
145 145
  * @param type $query_params
146 146
  * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info
147
-	 * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
148
-	 * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
147
+ * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects
148
+ * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB
149 149
  * @return boolean
150 150
  */
151 151
 	public function delete_permanently($query_params = array(), $allow_blocking = true) {
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 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_Price_Type.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Price_Type.class.php');
26 26
 
27 27
 
28 28
 class EEM_Price_Type extends EEM_Soft_Delete_Base {
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * values are text-representations of the base type.
46 46
 	 * @return array
47 47
 	 */
48
-	public function get_base_types(){
48
+	public function get_base_types() {
49 49
 		return $this->base_types;
50 50
 	}
51 51
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 * @param type $base_type_int
55 55
 	 * @return type
56 56
 	 */
57
-	public function get_base_type_name($base_type_int){
57
+	public function get_base_type_name($base_type_int) {
58 58
 		return $this->base_types[$base_type_int];
59 59
 	}
60 60
 
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
 	 * 		@access protected
80 80
 	 * 		@return void
81 81
 	 */
82
-	protected function __construct( $timezone = NULL ) {
82
+	protected function __construct($timezone = NULL) {
83 83
 		$this->base_types = array(
84
-			EEM_Price_Type::base_type_base_price => __('Price','event_espresso'),
85
-			EEM_Price_Type::base_type_discount => __('Discount','event_espresso'),
86
-			EEM_Price_Type::base_type_surcharge => __('Surcharge','event_espresso'),
87
-			EEM_Price_Type::base_type_tax => __('Tax','event_espresso') );
88
-		$this->singular_item = __('Price Type','event_espresso');
89
-		$this->plural_item = __('Price Types','event_espresso');
84
+			EEM_Price_Type::base_type_base_price => __('Price', 'event_espresso'),
85
+			EEM_Price_Type::base_type_discount => __('Discount', 'event_espresso'),
86
+			EEM_Price_Type::base_type_surcharge => __('Surcharge', 'event_espresso'),
87
+			EEM_Price_Type::base_type_tax => __('Tax', 'event_espresso') );
88
+		$this->singular_item = __('Price Type', 'event_espresso');
89
+		$this->plural_item = __('Price Types', 'event_espresso');
90 90
 
91 91
 		$this->_tables = array(
92
-			'Price_Type'=>new EE_Primary_Table('esp_price_type','PRT_ID')
92
+			'Price_Type'=>new EE_Primary_Table('esp_price_type', 'PRT_ID')
93 93
 		);
94 94
 		$this->_fields = array(
95 95
 			'Price_Type'=>array(
96
-				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID','event_espresso')),
97
-				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name','event_espresso'), false, ''),
98
-				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax','event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
99
-				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage','event_espresso'), false, false),
100
-				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ','event_espresso'), false, 0),
101
-				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed','event_espresso'), false, false),
102
-				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE ),
96
+				'PRT_ID'=>new EE_Primary_Key_Int_Field('PRT_ID', __('Price Type ID', 'event_espresso')),
97
+				'PRT_name'=>new EE_Plain_Text_Field('PRT_name', __('Price Type Name', 'event_espresso'), false, ''),
98
+				'PBT_ID'=>new EE_Enum_Integer_Field('PBT_ID', __('Price Base type ID, 1 = Price , 2 = Discount , 3 = Surcharge , 4 = Tax', 'event_espresso'), false, EEM_Price_Type::base_type_base_price, $this->base_types),
99
+				'PRT_is_percent'=>new EE_Boolean_Field('PRT_is_percent', __('Flag indicating price is a percentage', 'event_espresso'), false, false),
100
+				'PRT_order'=>new EE_Integer_Field('PRT_order', __('Order in which price should be applied. ', 'event_espresso'), false, 0),
101
+				'PRT_deleted'=>new EE_Trashed_Flag_Field('PRT_deleted', __('Flag indicating price type has been trashed', 'event_espresso'), false, false),
102
+				'PRT_wp_user' => new EE_WP_User_Field('PRT_wp_user', __('Price Type Creator ID', 'event_espresso'), FALSE),
103 103
 			)
104 104
 		);
105 105
 		$this->_model_relations = array(
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 			'WP_User' => new EE_Belongs_To_Relation(),
108 108
 		);
109 109
 		//this model is generally available for reading
110
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
110
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
111 111
 		//all price types are "default" in terms of capability names
112 112
 		$this->_caps_slug = 'default_price_types';
113
-		parent::__construct( $timezone );
113
+		parent::__construct($timezone);
114 114
 
115 115
 	}
116 116
 
@@ -156,15 +156,15 @@  discard block
 block discarded – undo
156 156
 		$ID = $query_params[0][$this->get_primary_key_field()->get_name()];
157 157
 
158 158
 		//check if any prices use this price type
159
-		$prc_query_params = array(array('PRT_ID'=>array('IN',$would_be_deleted_price_type_ids)));
160
-		if ( $prices = $this->get_all_related($ID,'Price',$prc_query_params)) {
159
+		$prc_query_params = array(array('PRT_ID'=>array('IN', $would_be_deleted_price_type_ids)));
160
+		if ($prices = $this->get_all_related($ID, 'Price', $prc_query_params)) {
161 161
 			$prices_names_and_ids = array();
162
-			foreach($prices as $price){
162
+			foreach ($prices as $price) {
163 163
 				/* @var $price EE_Price */
164 164
 				$prices_names_and_ids[] = $price->name()."(".$price->ID().")";
165 165
 			}
166
-			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'),implode(",",$prices_names_and_ids));
167
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
166
+			$msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type.  If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'), implode(",", $prices_names_and_ids));
167
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
168 168
 			return FALSE;
169 169
 		}
170 170
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
core/db_models/EEM_System_Status.model.php 4 patches
Doc Comments   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,8 +14,6 @@  discard block
 block discarded – undo
14 14
 	 * 		This function is a singleton method used to instantiate the EEM_Attendee object
15 15
 	 *
16 16
 	 * 		@access public
17
-	 * 		@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)
18
-	 * 		@return EEM_System_Status
19 17
 	 */
20 18
 	public static function instance() {
21 19
 
@@ -147,7 +145,7 @@  discard block
 block discarded – undo
147 145
 
148 146
 	/**
149 147
 	 *
150
-	 * @return array like EE_Config class
148
+	 * @return EE_Config like EE_Config class
151 149
 	 */
152 150
 	function get_ee_config(){
153 151
 		return EE_Config::instance();
@@ -197,7 +195,7 @@  discard block
 block discarded – undo
197 195
 
198 196
 	/**
199 197
 	 * Checks if site responds ot HTTPS
200
-	 * @return boolean
198
+	 * @return string
201 199
 	 */
202 200
 	function get_https_enabled(){
203 201
 		$home = str_replace("http://", "https://", home_url());
Please login to merge, or discard this patch.
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	function get_active_plugins(){
83 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() ) );
84
+		if ( is_multisite() ) {
85
+					$active_plugins = array_merge( $active_plugins, get_site_option( 'active_sitewide_plugins', array() ) );
86
+		}
86 87
 		$active_plugins = array_map( 'strtolower', $active_plugins );
87 88
 		$plugin_info = array();
88 89
 		foreach ( $active_plugins as $plugin ) {
@@ -187,8 +188,9 @@  discard block
 block discarded – undo
187 188
 		  preg_match_all(
188 189
 		  '#%S%(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?(?:<td>(.*?)</td>)?%E%#',
189 190
 			$section, $askapache, PREG_SET_ORDER);
190
-		  foreach($askapache as $m)
191
-			  $m2 = isset($m[2]) ? $m[2] : null;
191
+		  foreach($askapache as $m) {
192
+		  			  $m2 = isset($m[2]) ? $m[2] : null;
193
+		  }
192 194
 			  $pi[$n][$m[1]]=(!isset($m[3])||$m2==$m[3]) ? $m2 : array_slice($m,2);
193 195
 		}
194 196
 
@@ -232,7 +234,7 @@  discard block
 block discarded – undo
232 234
 			$status = __('Your server has fsockopen enabled, cURL is disabled.', 'event_espresso');
233 235
 		} elseif( $curl_works ) {
234 236
 			$status = __('Your server has cURL enabled, fsockopen is disabled.', 'event_espresso');
235
-		}else{
237
+		} else{
236 238
 			$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>';
237 239
 		}
238 240
 		return $status;
Please login to merge, or discard this patch.
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/helpers/EE_Model_Query_Info_Carrier.php 3 patches
Doc Comments   +14 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,16 +43,30 @@  discard block
 block discarded – undo
43 43
    
44 44
    private $_group_by_sql;
45 45
    
46
+   /**
47
+    * @param string $limit_sql
48
+    */
46 49
    function set_limit_sql($limit_sql){
47 50
 	   $this->_limit_sql = $limit_sql;
48 51
 	}
49 52
 	
53
+	/**
54
+	 * @param string $order_by_sql
55
+	 */
50 56
 	function set_order_by_sql($order_by_sql){
51 57
 		$this->_order_by_sql = $order_by_sql;
52 58
 	}
59
+
60
+	/**
61
+	 * @param string $group_by_sql
62
+	 */
53 63
 	function set_group_by_sql($group_by_sql){
54 64
 		$this->_group_by_sql = $group_by_sql;
55 65
 	}
66
+
67
+	/**
68
+	 * @param string $having_sql
69
+	 */
56 70
 	function set_having_sql($having_sql){
57 71
 		$this->_having_sql = $having_sql;
58 72
 	}
@@ -72,7 +86,6 @@  discard block
 block discarded – undo
72 86
     * 
73 87
     * @param type $model_included_name
74 88
     * @param type $join_sql
75
-    * @param type $data_types
76 89
     */
77 90
    public function __construct($model_included_name= array(), $join_sql = ''){
78 91
 	   $this->_models_included = $model_included_name;
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
 */
12 12
 class EE_Model_Query_Info_Carrier extends EE_Base{
13 13
    /**
14
-	* @var string SQL for performing joins (Eg, "INNER JOIN blah ON blah=blah INNER JOIN FOO ON foo=foo...")
15
-	*/
14
+    * @var string SQL for performing joins (Eg, "INNER JOIN blah ON blah=blah INNER JOIN FOO ON foo=foo...")
15
+    */
16 16
    private $_join_sql;
17 17
    /**
18 18
     *
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     * @return string
133 133
     */
134 134
   public function get_main_model_join_sql() {
135
-    return $this->_main_join_sql;
135
+	return $this->_main_join_sql;
136 136
   }
137 137
 
138 138
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 * We could have returned an array
10 10
 * with two keys 'join_sql' and 'data_types', but this better-defines the data being passed around
11 11
 */
12
-class EE_Model_Query_Info_Carrier extends EE_Base{
12
+class EE_Model_Query_Info_Carrier extends EE_Base {
13 13
    /**
14 14
 	* @var string SQL for performing joins (Eg, "INNER JOIN blah ON blah=blah INNER JOIN FOO ON foo=foo...")
15 15
 	*/
@@ -43,29 +43,29 @@  discard block
 block discarded – undo
43 43
    
44 44
    private $_group_by_sql;
45 45
    
46
-   function set_limit_sql($limit_sql){
46
+   function set_limit_sql($limit_sql) {
47 47
 	   $this->_limit_sql = $limit_sql;
48 48
 	}
49 49
 	
50
-	function set_order_by_sql($order_by_sql){
50
+	function set_order_by_sql($order_by_sql) {
51 51
 		$this->_order_by_sql = $order_by_sql;
52 52
 	}
53
-	function set_group_by_sql($group_by_sql){
53
+	function set_group_by_sql($group_by_sql) {
54 54
 		$this->_group_by_sql = $group_by_sql;
55 55
 	}
56
-	function set_having_sql($having_sql){
56
+	function set_having_sql($having_sql) {
57 57
 		$this->_having_sql = $having_sql;
58 58
 	}
59
-	function get_limit_sql(){
59
+	function get_limit_sql() {
60 60
 		return $this->_limit_sql;
61 61
 	}
62
-	function get_order_by_sql(){
62
+	function get_order_by_sql() {
63 63
 		return $this->_order_by_sql;
64 64
 	}
65
-	function get_group_by_sql(){
65
+	function get_group_by_sql() {
66 66
 		return $this->_group_by_sql;
67 67
 	}
68
-	function get_having_sql(){
68
+	function get_having_sql() {
69 69
 		return $this->_having_sql;
70 70
 	}
71 71
    /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     * @param type $join_sql
75 75
     * @param type $data_types
76 76
     */
77
-   public function __construct($model_included_name= array(), $join_sql = ''){
77
+   public function __construct($model_included_name = array(), $join_sql = '') {
78 78
 	   $this->_models_included = $model_included_name;
79 79
 	   $this->_join_sql = $join_sql;
80 80
    }
@@ -83,10 +83,10 @@  discard block
 block discarded – undo
83 83
     * Merges info from the other EEM_Related_Model_Info_Carrier into this one.
84 84
     * @param EE_Model_Query_Info_Carrier $other_model_query_info_carrier
85 85
     */
86
-   public function merge( $other_model_query_info_carrier ){
87
-	   if( $other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())){
88
-			$model_included_on_other_join_sql_and_data_types_carrier =  $other_model_query_info_carrier->get_model_names_included();
89
-			$this->_models_included = array_merge( $this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier );
86
+   public function merge($other_model_query_info_carrier) {
87
+	   if ($other_model_query_info_carrier && ! $this->_have_already_included_one_of_these_models($other_model_query_info_carrier->get_model_names_included())) {
88
+			$model_included_on_other_join_sql_and_data_types_carrier = $other_model_query_info_carrier->get_model_names_included();
89
+			$this->_models_included = array_merge($this->_models_included, $model_included_on_other_join_sql_and_data_types_carrier);
90 90
 			$this->_join_sql .= $other_model_query_info_carrier->_join_sql;
91 91
 	   }
92 92
 	   //otherwise don't merge our data.
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
     * @param array $model_names just like EE_MOdel_QUery_Info_Carrier::_models_included: keys are model chain paths, values are the model names only
101 101
     * @return boolean
102 102
     */
103
-   protected function  _have_already_included_one_of_these_models($model_names){
104
-	   foreach($this->_models_included as $model_relation_path=>$model_included){
105
-		   if(array_key_exists($model_relation_path, $model_names)){
103
+   protected function  _have_already_included_one_of_these_models($model_names) {
104
+	   foreach ($this->_models_included as $model_relation_path=>$model_included) {
105
+		   if (array_key_exists($model_relation_path, $model_names)) {
106 106
 			   return true;
107 107
 		   }
108 108
 	   }
@@ -112,17 +112,17 @@  discard block
 block discarded – undo
112 112
     * Array keys are model names, values are "model relation paths". See EE_Model_Query_Info_Carrier::_models_included for details
113 113
     * @return array like EE_Model_Query_Info_Carrier::_models_included
114 114
     */
115
-   public function get_model_names_included(){
115
+   public function get_model_names_included() {
116 116
 	   return $this->_models_included;
117 117
    }
118 118
    /**
119 119
     * sets the $where_sql for later use from client code
120 120
     * @param string $where_sql
121 121
     */
122
-   public function set_where_sql($where_sql){
122
+   public function set_where_sql($where_sql) {
123 123
 	   $this->_where_sql = $where_sql;
124 124
    }
125
-   public function get_where_sql(){
125
+   public function get_where_sql() {
126 126
 	   return $this->_where_sql;
127 127
    }
128 128
 
@@ -143,10 +143,10 @@  discard block
 block discarded – undo
143 143
     * after the FROM and before the WHERE.)
144 144
     * @param string $join_sql
145 145
     */
146
-   public function set_main_model_join_sql($join_sql){
146
+   public function set_main_model_join_sql($join_sql) {
147 147
 	   $this->_main_join_sql = $join_sql;
148 148
    }
149
-   public function get_full_join_sql(){
150
-	   return $this->_main_join_sql . $this->_join_sql;
149
+   public function get_full_join_sql() {
150
+	   return $this->_main_join_sql.$this->_join_sql;
151 151
    }
152 152
 }
153 153
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/helpers/EE_Secondary_Table.php 2 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 * creates join statement FROM primary table
50 50
 	 * gets SQL like "LEFT JOIN table_name AS table_alias ON other_table_alias.pk = table_alias.fk
51 51
 	 *
52
-	 * @param string $table allows us to set special conditions on the $table_name portion of the join query (i.e. doing a subquery)
52
+	 * @param string $primary_table_alias_with_model_chain_prefix
53 53
 	 * @return string of SQL
54 54
 	 */
55 55
 	function get_join_sql( $primary_table_alias_with_model_chain_prefix  ){
@@ -72,6 +72,7 @@  discard block
 block discarded – undo
72 72
 	 * " LEFT JOIN secondary_table_table AS Secondary ON ..." like get_join_sql, this function returns
73 73
 	 * " LEFT JOIN primary_table AS Primary ON ...".
74 74
 	 * This is useful if the secondary table is already included in the SQL, but the primary table is not yet.
75
+	 * @param string $secondary_table_alias_with_model_chain_prefix
75 76
 	 * @return string
76 77
 	 */
77 78
 	function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix){
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
  * table's rows. Ie, it can't have many rows in the secondary table that point to
6 6
  * a single row in the primary table
7 7
  */
8
-require_once( EE_MODELS . 'helpers/EE_Table_Base.php');
9
-class EE_Secondary_Table extends EE_Table_Base{
8
+require_once(EE_MODELS.'helpers/EE_Table_Base.php');
9
+class EE_Secondary_Table extends EE_Table_Base {
10 10
 	protected $_extra_join_conditions;
11 11
 
12 12
 	/**
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 	 * @param boolean $global whether the table is "global" as in there is only 1 table on an entire multisite install,
20 20
 	 *					or whether each site on a multisite install has a copy of this table
21 21
 	 */
22
-	function __construct($table_name, $pk_column,  $fk_column = null, $extra_join_conditions = null, $global = false ){
22
+	function __construct($table_name, $pk_column, $fk_column = null, $extra_join_conditions = null, $global = false) {
23 23
 		$this->_fk_on_table = $fk_column;
24 24
 		$this->_extra_join_conditions = $extra_join_conditions;
25
-		parent::__construct( $table_name, $pk_column, $global );
25
+		parent::__construct($table_name, $pk_column, $global);
26 26
 	}
27
-	function get_fk_on_table(){
27
+	function get_fk_on_table() {
28 28
 		return $this->_fk_on_table;
29 29
 	}
30
-	function _construct_finalize_set_table_to_join_with(EE_Table_Base $table){
30
+	function _construct_finalize_set_table_to_join_with(EE_Table_Base $table) {
31 31
 		$this->_table_to_join_with = $table;
32 32
 	}
33 33
 	/**
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
 	 * @return string of sql like "Event.post_type = 'event'", which gets added to
36 36
 	 * the end of the join statement with the primary table
37 37
 	 */
38
-	function get_extra_join_conditions(){
38
+	function get_extra_join_conditions() {
39 39
 		return $this->_extra_join_conditions;
40 40
 	}
41 41
 	/**
42 42
 	 *
43 43
 	 * @return EE_Primary_Table
44 44
 	 */
45
-	function get_table_to_join_with(){
45
+	function get_table_to_join_with() {
46 46
 		return $this->_table_to_join_with;
47 47
 	}
48 48
 	/**
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
 	 * @param string $table allows us to set special conditions on the $table_name portion of the join query (i.e. doing a subquery)
53 53
 	 * @return string of SQL
54 54
 	 */
55
-	function get_join_sql( $primary_table_alias_with_model_chain_prefix  ){
55
+	function get_join_sql($primary_table_alias_with_model_chain_prefix) {
56 56
 
57 57
 		$table_name = $this->get_table_name();
58
-		$secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix) . $this->get_table_alias();
58
+		$secondary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($primary_table_alias_with_model_chain_prefix).$this->get_table_alias();
59 59
 		$other_table_pk = $this->get_table_to_join_with()->get_pk_column();
60 60
 		$fk = $this->get_fk_on_table();
61 61
 		$join_sql = " LEFT JOIN $table_name AS $secondary_table_alias ON $primary_table_alias_with_model_chain_prefix.$other_table_pk = $secondary_table_alias.$fk ";
62
-		if($this->get_extra_join_conditions()){
63
-			$join_sql.="AND ".$this->get_extra_join_conditions();
62
+		if ($this->get_extra_join_conditions()) {
63
+			$join_sql .= "AND ".$this->get_extra_join_conditions();
64 64
 		}
65 65
 		return $join_sql;
66 66
 	}
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 	 * This is useful if the secondary table is already included in the SQL, but the primary table is not yet.
75 75
 	 * @return string
76 76
 	 */
77
-	function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix){
78
-		$primary_table_name =$this->get_table_to_join_with()->get_table_name();
79
-		$primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix) . $this->get_table_to_join_with()->get_table_alias();
80
-		$primary_table_pk = $this->get_table_to_join_with()->get_pk_column();//$this->get_pk_column();
77
+	function get_inverse_join_sql($secondary_table_alias_with_model_chain_prefix) {
78
+		$primary_table_name = $this->get_table_to_join_with()->get_table_name();
79
+		$primary_table_alias = EE_Model_Parser::get_prefix_from_table_alias_with_model_relation_chain_prefix($secondary_table_alias_with_model_chain_prefix).$this->get_table_to_join_with()->get_table_alias();
80
+		$primary_table_pk = $this->get_table_to_join_with()->get_pk_column(); //$this->get_pk_column();
81 81
 		$fk = $this->get_fk_on_table();
82 82
 		$join_sql = " LEFT JOIN $primary_table_name AS $primary_table_alias ON $primary_table_alias.$primary_table_pk = $secondary_table_alias_with_model_chain_prefix.$fk ";
83
-		if($this->get_extra_join_conditions()){
84
-			$join_sql.="AND ".$this->get_extra_join_conditions();
83
+		if ($this->get_extra_join_conditions()) {
84
+			$join_sql .= "AND ".$this->get_extra_join_conditions();
85 85
 		}
86 86
 		return $join_sql;
87 87
 	}
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	public function get_select_join_limit_join($limit) {
95 95
 		//first get the select
96 96
 		$select = $this->get_select_join_limit($limit);
97
-		$join_sql = $this->get_join_sql( $select );
97
+		$join_sql = $this->get_join_sql($select);
98 98
 		return $join_sql;
99 99
 	}
100 100
 
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
 	function get_fully_qualified_fk_column() {
104 104
 		$table_alias = $this->get_table_alias();
105 105
 		$fk = $this->get_fk_on_table();
106
-		return $table_alias . '.' . $fk;
106
+		return $table_alias.'.'.$fk;
107 107
 	}
108 108
 
109 109
 	function get_fully_qualified_pk_on_fk_table() {
110 110
 		$table_alias = $this->get_table_to_join_with()->get_table_alias();
111 111
 		$pk = $this->get_table_to_join_with()->get_pk_column();
112
-		return $table_alias . '.' . $pk;
112
+		return $table_alias.'.'.$pk;
113 113
 	}
114 114
 }
115 115
\ No newline at end of file
Please login to merge, or discard this patch.
core/helpers/EEH_Qtip_Loader.helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	 * - registers and enqueues the qtip scripts and styles.
110 110
 	 *
111 111
 	 * @access public
112
-	 * @param  array  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
112
+	 * @param  string[]  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 			foreach ( $this->_qtips as $qtip ) {
82 82
 				$qts = $qtip->get_tips();
83 83
 				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
85
-						continue;
84
+					if ( ! $qt instanceof EE_Qtip ) {
85
+											continue;
86
+					}
86 87
 					$qtips[] = array(
87 88
 						'content_id' => $qt->content_id,
88 89
 						'options' => $qt->options,
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 						);
91 92
 				}
92 93
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
94
+			if ( !empty($qtips) ) {
95
+							wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
96
+			}
95 97
 
96 98
 		} else {
97 99
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -171,16 +173,18 @@  discard block
 block discarded – undo
171 173
 		}
172 174
 
173 175
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
176
+		if ( !class_exists( $config ) ) {
177
+					throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
178
+		}
176 179
 
177 180
 		//made it HERE?  FINALLY, let's get things setup.
178 181
 		$a = new ReflectionClass($config);
179 182
 		$qtip = $a->newInstance();
180 183
 
181 184
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
185
+		if ( ! $qtip instanceof EE_Qtip_Config ) {
186
+					throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
187
+		}
184 188
 
185 189
 		$this->_qtips[] = $a->newInstance();
186 190
 
@@ -196,8 +200,10 @@  discard block
 block discarded – undo
196 200
 	 * @return void
197 201
 	 */
198 202
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
200
-			return; //no qtips!
203
+		if ( empty( $this->_qtips ) ) {
204
+					return;
205
+		}
206
+		//no qtips!
201 207
 
202 208
 		$content = array();
203 209
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 		$qts = $qtip->get_tips();
220 226
 		$content = array();
221 227
 		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
223
-				continue;
228
+			if ( ! $qt instanceof EE_Qtip ) {
229
+							continue;
230
+			}
224 231
 			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
225 232
 		}
226 233
 
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function instance() {
34 34
 		// check if class object is instantiated
35
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EEH_Qtip_Loader )) {
35
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EEH_Qtip_Loader)) {
36 36
 			self::$_instance = new self();
37 37
 		}
38 38
 		return self::$_instance;
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	private function __construct() {
50 50
 		//let's just make sure this is instantiated in the right place.
51
-		if ( did_action( 'wp_print_styles' ) || did_action( 'admin_head' )) {
52
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso' ), '4.1' );
51
+		if (did_action('wp_print_styles') || did_action('admin_head')) {
52
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso'), '4.1');
53 53
 		}
54 54
 	}
55 55
 
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
 	 * @return void
62 62
 	 */
63 63
 	public function register_and_enqueue() {
64
-		$qtips_js = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.js';
65
-		$qtip_images_loaded = EE_THIRD_PARTY_URL . 'qtip/imagesloaded.pkg.min.js';
66
-		$qtip_map = EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.map';
67
-		$qtipcss = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.css';
64
+		$qtips_js = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.js';
65
+		$qtip_images_loaded = EE_THIRD_PARTY_URL.'qtip/imagesloaded.pkg.min.js';
66
+		$qtip_map = EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.map';
67
+		$qtipcss = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.css';
68 68
 
69
-		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE );
70
-		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE );
71
-		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE );
72
-		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS . 'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE );
69
+		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE);
70
+		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE);
71
+		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE);
72
+		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS.'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE);
73 73
 
74
-		wp_register_style('qtip-css', $qtipcss, array(), '2.2' );
74
+		wp_register_style('qtip-css', $qtipcss, array(), '2.2');
75 75
 
76 76
 		//k now let's see if there are any registered qtips.  If there are, then we need to setup the localized script for ee-qtip-helper.js (and enqueue ee-qtip-helper.js of course!)
77
-		if ( !empty( $this->_qtips ) ) {
77
+		if ( ! empty($this->_qtips)) {
78 78
 			wp_enqueue_script('ee-qtip-helper');
79 79
 			wp_enqueue_style('qtip-css');
80 80
 			$qtips = array();
81
-			foreach ( $this->_qtips as $qtip ) {
81
+			foreach ($this->_qtips as $qtip) {
82 82
 				$qts = $qtip->get_tips();
83
-				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
83
+				foreach ($qts as $qt) {
84
+					if ( ! $qt instanceof EE_Qtip)
85 85
 						continue;
86 86
 					$qtips[] = array(
87 87
 						'content_id' => $qt->content_id,
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 						);
91 91
 				}
92 92
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
93
+			if ( ! empty($qtips))
94
+				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array('qtips' => $qtips));
95 95
 
96 96
 		} else {
97 97
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
116
-	public function register( $configname, $paths = array() ) {
116
+	public function register($configname, $paths = array()) {
117 117
 
118 118
 		//let's just make sure this is instantiated in the right place.
119
-		if ( did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts') ) {
120
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso' ), '4.1' );
119
+		if (did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts')) {
120
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso'), '4.1');
121 121
 		}
122 122
 
123 123
 		$configname = (array) $configname; //typecast to array
124
-		foreach ( $configname as $config ) {
125
-			$this->_register( $config, $paths );
124
+		foreach ($configname as $config) {
125
+			$this->_register($config, $paths);
126 126
 		}
127 127
 
128 128
 		//hook into appropriate footer
129 129
 		$footer_action = is_admin() ? 'admin_footer' : 'wp_footer';
130
-		add_action($footer_action, array($this, 'setup_qtip'), 10 );
130
+		add_action($footer_action, array($this, 'setup_qtip'), 10);
131 131
 
132 132
 		//make sure we "turn on" qtip js.
133
-		add_filter('FHEE_load_qtip', '__return_true' );
133
+		add_filter('FHEE_load_qtip', '__return_true');
134 134
 	}
135 135
 
136 136
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 	 * @throws EE_Error
145 145
 	 * @return void
146 146
 	 */
147
-	private function _register( $config, $paths ) {
147
+	private function _register($config, $paths) {
148 148
 		//before doing anything we have to make sure that EE_Qtip_Config parent is required.
149
-		EE_Registry::instance()->load_lib( 'Qtip_Config', array(), TRUE );
149
+		EE_Registry::instance()->load_lib('Qtip_Config', array(), TRUE);
150 150
 
151
-		if ( !empty( $paths ) ) {
151
+		if ( ! empty($paths)) {
152 152
 			$paths = (array) $paths;
153
-			foreach ( $paths as $path ) {
154
-				$path = $path . $config . '.lib.php';
155
-				if ( !is_readable($path ) ) {
153
+			foreach ($paths as $path) {
154
+				$path = $path.$config.'.lib.php';
155
+				if ( ! is_readable($path)) {
156 156
 					continue;
157 157
 				} else {
158 158
 					require_once $path;
@@ -161,26 +161,26 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		//does class exist at this point?  If it does then let's instantiate.  If it doesn't then let's continue with other paths.
164
-		if ( !class_exists($config) ) {
165
-			$path = EE_LIBRARIES . 'qtips/' . $config . '.lib.php';
166
-			if ( !is_readable($path ) ) {
167
-				throw new EE_Error( sprintf( __('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config ) );
164
+		if ( ! class_exists($config)) {
165
+			$path = EE_LIBRARIES.'qtips/'.$config.'.lib.php';
166
+			if ( ! is_readable($path)) {
167
+				throw new EE_Error(sprintf(__('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config));
168 168
 			} else {
169 169
 				require_once $path;
170 170
 			}
171 171
 		}
172 172
 
173 173
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
174
+		if ( ! class_exists($config))
175
+			throw new EE_Error(sprintf(__('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config));
176 176
 
177 177
 		//made it HERE?  FINALLY, let's get things setup.
178 178
 		$a = new ReflectionClass($config);
179 179
 		$qtip = $a->newInstance();
180 180
 
181 181
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( esc_html__( 'The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>' ) );
182
+		if ( ! $qtip instanceof EE_Qtip_Config)
183
+			throw new EE_Error(sprintf(esc_html__('The class given for the Qtip loader (%1$s) is not a child of the %2$sEE_Qtip_Config%3$s class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config, '<strong>', '</strong>'));
184 184
 
185 185
 		$this->_qtips[] = $a->newInstance();
186 186
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	 * @return void
197 197
 	 */
198 198
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
199
+		if (empty($this->_qtips))
200 200
 			return; //no qtips!
201 201
 
202 202
 		$content = array();
203 203
 
204
-		foreach ( $this->_qtips as $qtip ) {
204
+		foreach ($this->_qtips as $qtip) {
205 205
 			$content[] = $this->_generate_content_container($qtip);
206 206
 		}
207 207
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	private function _generate_content_container($qtip) {
219 219
 		$qts = $qtip->get_tips();
220 220
 		$content = array();
221
-		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
221
+		foreach ($qts as $qt) {
222
+			if ( ! $qt instanceof EE_Qtip)
223 223
 				continue;
224
-			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
224
+			$content[] = '<div class="ee-qtip-helper-content hidden" id="'.$qt->content_id.'">'.$qt->content.'</div>';
225 225
 		}
226 226
 
227 227
 		return implode('<br />', $content);
Please login to merge, or discard this patch.
core/helpers/EEH_Template_Validator.helper.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	/**
132 132
 	 * For verifying that a variable is indeed an array, else throw an EE_Error
133 133
 	 * @param type $variable_to_test
134
-	 * @param type $variable_name
134
+	 * @param string $variable_name
135 135
 	 * @param type $allow_empty one of 'allow_empty' or 'do_not_allow_empty'
136 136
 	 * @return void
137 137
 	 * @throws EE_Error
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * for verifying that a variable is one of the string optiosn supplied
160 160
 	 * @param mixed $variable_to_test
161 161
 	 * @param mixed $variable_name the name you've given the variable. Eg, '$foo'. THis helps in producing better error messages
162
-	 * @param array $string_options an array of acceptable values
162
+	 * @param string[] $string_options an array of acceptable values
163 163
 	 * @return void
164 164
 	 * @throws EE_Error
165 165
 	 */
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
 	 * @return void
51 51
 	 * @throws EE_Error (indirectly)
52 52
 	 */
53
-	static function verify_is_array_of($variable_to_test,$name_of_variable,$class_name,$allow_null='allow_null'){
54
-		if(!WP_DEBUG)return;
55
-		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null'));
56
-		if('allow_null' == $allow_null && is_null($variable_to_test)){
53
+	static function verify_is_array_of($variable_to_test, $name_of_variable, $class_name, $allow_null = 'allow_null') {
54
+		if ( ! WP_DEBUG)return;
55
+		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null', 'do_not_allow_null'));
56
+		if ('allow_null' == $allow_null && is_null($variable_to_test)) {
57 57
 			return;
58 58
 		}
59 59
 		self::verify_is_array($variable_to_test, $name_of_variable);
60
-		foreach($variable_to_test as $key=>$array_element){
60
+		foreach ($variable_to_test as $key=>$array_element) {
61 61
 			self::verify_instanceof($array_element, $key, $class_name);
62 62
 		}
63 63
 	}
@@ -73,12 +73,12 @@  discard block
 block discarded – undo
73 73
 	 * @return void
74 74
 	 * @throws EE_Error
75 75
 	 */
76
-	static function verify_isnt_null($variable_to_test,$name_of_variable){
77
-		if(!WP_DEBUG)return;
78
-		if($variable_to_test==null && $variable_to_test!=0 && $variable_to_test!=FALSE){
79
-			$error[]=__('Variable named %s is null.','event_espresso');
80
-			$error[]=__("Consider looking at the stack trace to see why it wasn't set.",'event_espresso');
81
-			throw new EE_Error(sprintf(implode(",",$error),$name_of_variable,$name_of_variable));
76
+	static function verify_isnt_null($variable_to_test, $name_of_variable) {
77
+		if ( ! WP_DEBUG)return;
78
+		if ($variable_to_test == null && $variable_to_test != 0 && $variable_to_test != FALSE) {
79
+			$error[] = __('Variable named %s is null.', 'event_espresso');
80
+			$error[] = __("Consider looking at the stack trace to see why it wasn't set.", 'event_espresso');
81
+			throw new EE_Error(sprintf(implode(",", $error), $name_of_variable, $name_of_variable));
82 82
 		}
83 83
 	}
84 84
 	
@@ -90,12 +90,12 @@  discard block
 block discarded – undo
90 90
 	 * @return void
91 91
 	 * @throws EE_Error
92 92
 	 */
93
-	static function verify_is_true($expression_to_test,$expression_string_representation){
94
-		if(!WP_DEBUG)return;
95
-		if(!$expression_to_test){
96
-			$error[]=__('Template error.','event_espresso');
97
-			$error[]=__("%s evaluated to false, but it must be true!",'event_espresso');
98
-			throw new EE_Error(sprintf(implode(",",$error),$expression_string_representation));
93
+	static function verify_is_true($expression_to_test, $expression_string_representation) {
94
+		if ( ! WP_DEBUG)return;
95
+		if ( ! $expression_to_test) {
96
+			$error[] = __('Template error.', 'event_espresso');
97
+			$error[] = __("%s evaluated to false, but it must be true!", 'event_espresso');
98
+			throw new EE_Error(sprintf(implode(",", $error), $expression_string_representation));
99 99
 		}
100 100
 	}
101 101
 	
@@ -111,16 +111,16 @@  discard block
 block discarded – undo
111 111
 	 * @return void
112 112
 	 * @throws EE_Error
113 113
 	 */
114
-	static function verify_instanceof($variable_to_test,$name_of_variable,$class_name, $allow_null = 'do_not_allow_null'){
115
-		if(!WP_DEBUG)return;
116
-		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null'));
117
-		if($allow_null == 'allow_null' && is_null($variable_to_test)){
114
+	static function verify_instanceof($variable_to_test, $name_of_variable, $class_name, $allow_null = 'do_not_allow_null') {
115
+		if ( ! WP_DEBUG)return;
116
+		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null', 'do_not_allow_null'));
117
+		if ($allow_null == 'allow_null' && is_null($variable_to_test)) {
118 118
 			return;
119 119
 		}
120
-		if( $variable_to_test == NULL ||  ! ( $variable_to_test instanceof $class_name )){
121
-			$msg[]=__('Variable %s is not of the correct type.','event_espresso');
122
-			$msg[]=__("It should be of type %s",'event_espresso');
123
-			throw new EE_Error(sprintf(implode(",",$msg),$name_of_variable,$name_of_variable,$class_name));
120
+		if ($variable_to_test == NULL || ! ($variable_to_test instanceof $class_name)) {
121
+			$msg[] = __('Variable %s is not of the correct type.', 'event_espresso');
122
+			$msg[] = __("It should be of type %s", 'event_espresso');
123
+			throw new EE_Error(sprintf(implode(",", $msg), $name_of_variable, $name_of_variable, $class_name));
124 124
 		}
125 125
 	}
126 126
 	
@@ -136,16 +136,16 @@  discard block
 block discarded – undo
136 136
 	 * @return void
137 137
 	 * @throws EE_Error
138 138
 	 */
139
-	static function verify_is_array($variable_to_test,$variable_name,$allow_empty='allow_empty'){
140
-		if(!WP_DEBUG)return;
141
-		self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty','do_not_allow_empty'));
142
-		if(empty($variable_to_test) && 'allow_empty'==$allow_empty){
139
+	static function verify_is_array($variable_to_test, $variable_name, $allow_empty = 'allow_empty') {
140
+		if ( ! WP_DEBUG)return;
141
+		self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty', 'do_not_allow_empty'));
142
+		if (empty($variable_to_test) && 'allow_empty' == $allow_empty) {
143 143
 			return;
144 144
 		}
145
-		if(!is_array($variable_to_test)){
146
-			$error[]=__('Variable %s should be an array, but it is not.');
147
-			$error[]=__("Its value is, instead '%s'",'event_espresso');
148
-			throw new EE_Error(sprintf(implode(",",$error),$variable_name,$variable_name,$variable_to_test));
145
+		if ( ! is_array($variable_to_test)) {
146
+			$error[] = __('Variable %s should be an array, but it is not.');
147
+			$error[] = __("Its value is, instead '%s'", 'event_espresso');
148
+			throw new EE_Error(sprintf(implode(",", $error), $variable_name, $variable_name, $variable_to_test));
149 149
 		}
150 150
 	}
151 151
 	
@@ -163,12 +163,12 @@  discard block
 block discarded – undo
163 163
 	 * @return void
164 164
 	 * @throws EE_Error
165 165
 	 */
166
-	static function verify_argument_is_one_of($variable_to_test,$variable_name,$string_options){
167
-		if(!WP_DEBUG)return;
168
-		if(!in_array($variable_to_test,$string_options)){
169
-			$msg[0]=__('Malconfigured template.','event_espresso');
170
-			$msg[1]=__("Variable named '%s' was set to '%s'. It can only be one of '%s'",'event_espresso');
171
-			throw new EE_Error(sprintf(implode("||",$msg),$variable_name,$variable_to_test, implode("', '",$string_options)));
166
+	static function verify_argument_is_one_of($variable_to_test, $variable_name, $string_options) {
167
+		if ( ! WP_DEBUG)return;
168
+		if ( ! in_array($variable_to_test, $string_options)) {
169
+			$msg[0] = __('Malconfigured template.', 'event_espresso');
170
+			$msg[1] = __("Variable named '%s' was set to '%s'. It can only be one of '%s'", 'event_espresso');
171
+			throw new EE_Error(sprintf(implode("||", $msg), $variable_name, $variable_to_test, implode("', '", $string_options)));
172 172
 		}
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
Braces   +21 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 
3 5
 /**
4 6
  * Event Espresso
@@ -51,7 +53,9 @@  discard block
 block discarded – undo
51 53
 	 * @throws EE_Error (indirectly)
52 54
 	 */
53 55
 	static function verify_is_array_of($variable_to_test,$name_of_variable,$class_name,$allow_null='allow_null'){
54
-		if(!WP_DEBUG)return;
56
+		if(!WP_DEBUG) {
57
+			return;
58
+		}
55 59
 		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null'));
56 60
 		if('allow_null' == $allow_null && is_null($variable_to_test)){
57 61
 			return;
@@ -74,7 +78,9 @@  discard block
 block discarded – undo
74 78
 	 * @throws EE_Error
75 79
 	 */
76 80
 	static function verify_isnt_null($variable_to_test,$name_of_variable){
77
-		if(!WP_DEBUG)return;
81
+		if(!WP_DEBUG) {
82
+			return;
83
+		}
78 84
 		if($variable_to_test==null && $variable_to_test!=0 && $variable_to_test!=FALSE){
79 85
 			$error[]=__('Variable named %s is null.','event_espresso');
80 86
 			$error[]=__("Consider looking at the stack trace to see why it wasn't set.",'event_espresso');
@@ -91,7 +97,9 @@  discard block
 block discarded – undo
91 97
 	 * @throws EE_Error
92 98
 	 */
93 99
 	static function verify_is_true($expression_to_test,$expression_string_representation){
94
-		if(!WP_DEBUG)return;
100
+		if(!WP_DEBUG) {
101
+			return;
102
+		}
95 103
 		if(!$expression_to_test){
96 104
 			$error[]=__('Template error.','event_espresso');
97 105
 			$error[]=__("%s evaluated to false, but it must be true!",'event_espresso');
@@ -112,7 +120,9 @@  discard block
 block discarded – undo
112 120
 	 * @throws EE_Error
113 121
 	 */
114 122
 	static function verify_instanceof($variable_to_test,$name_of_variable,$class_name, $allow_null = 'do_not_allow_null'){
115
-		if(!WP_DEBUG)return;
123
+		if(!WP_DEBUG) {
124
+			return;
125
+		}
116 126
 		self::verify_argument_is_one_of($allow_null, 'allow_null', array('allow_null','do_not_allow_null'));
117 127
 		if($allow_null == 'allow_null' && is_null($variable_to_test)){
118 128
 			return;
@@ -137,7 +147,9 @@  discard block
 block discarded – undo
137 147
 	 * @throws EE_Error
138 148
 	 */
139 149
 	static function verify_is_array($variable_to_test,$variable_name,$allow_empty='allow_empty'){
140
-		if(!WP_DEBUG)return;
150
+		if(!WP_DEBUG) {
151
+			return;
152
+		}
141 153
 		self::verify_argument_is_one_of($allow_empty, $variable_name, array('allow_empty','do_not_allow_empty'));
142 154
 		if(empty($variable_to_test) && 'allow_empty'==$allow_empty){
143 155
 			return;
@@ -164,7 +176,9 @@  discard block
 block discarded – undo
164 176
 	 * @throws EE_Error
165 177
 	 */
166 178
 	static function verify_argument_is_one_of($variable_to_test,$variable_name,$string_options){
167
-		if(!WP_DEBUG)return;
179
+		if(!WP_DEBUG) {
180
+			return;
181
+		}
168 182
 		if(!in_array($variable_to_test,$string_options)){
169 183
 			$msg[0]=__('Malconfigured template.','event_espresso');
170 184
 			$msg[1]=__("Variable named '%s' was set to '%s'. It can only be one of '%s'",'event_espresso');
Please login to merge, or discard this patch.