Completed
Branch BUG-7537 (2c2d2f)
by
unknown
20:37 queued 10:27
created
core/db_classes/EE_Currency_Payment_Method.class.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 * @param array $props_n_values  incoming values from the database
60 60
 	 * @param string $timezone  incoming timezone as set by the model.  If not set the timezone for
61 61
 	 *                          		the website will be used.
62
-	 * @return EE_Attendee
62
+	 * @return EE_Currency_Payment_Method
63 63
 	 */
64 64
 	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
65 65
 		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,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * ------------------------------------------------------------------------
28 28
  */
29
-class EE_Currency_Payment_Method extends EE_Base_Class{
29
+class EE_Currency_Payment_Method extends EE_Base_Class {
30 30
 
31 31
 	/** Currency to Payment Method Link ID @var CPM_ID*/
32 32
 	protected $_CPM_ID = NULL;
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 	 *                             		    date_format and the second value is the time format
49 49
 	 * @return EE_Attendee
50 50
 	 */
51
-	public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) {
52
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats );
53
-		return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats );
51
+	public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) {
52
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats);
53
+		return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats);
54 54
 	}
55 55
 
56 56
 
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 	 *                          		the website will be used.
62 62
 	 * @return EE_Attendee
63 63
 	 */
64
-	public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) {
65
-		return new self( $props_n_values, TRUE, $timezone );
64
+	public static function new_instance_from_db($props_n_values = array(), $timezone = null) {
65
+		return new self($props_n_values, TRUE, $timezone);
66 66
 	}
67 67
 
68 68
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
Please login to merge, or discard this patch.
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   +188 added lines, -188 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();
@@ -151,23 +151,23 @@  discard block
 block discarded – undo
151 151
 		$question_group_query_params = array();
152 152
 		$question_query_params = array();
153 153
 		$related_through_mtg_params = array();
154
-		if ( isset( $this->_req_data['EVT_ID'] )) {
154
+		if (isset($this->_req_data['EVT_ID'])) {
155 155
 			// do we have an array of IDs ?
156 156
 
157
-			if ( is_array( $this->_req_data['EVT_ID'] )) {
158
-				$EVT_IDs =  array_map( 'sanitize_text_field', $this->_req_data['EVT_ID'] );
159
-				$value_to_equal = array('IN',$EVT_IDs);
157
+			if (is_array($this->_req_data['EVT_ID'])) {
158
+				$EVT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_ID']);
159
+				$value_to_equal = array('IN', $EVT_IDs);
160 160
 				$filename = 'events';
161 161
 			} else {
162 162
 				// generate regular where = clause
163
-				$EVT_ID = absint( $this->_req_data['EVT_ID'] );
163
+				$EVT_ID = absint($this->_req_data['EVT_ID']);
164 164
 				$value_to_equal = $EVT_ID;
165 165
 				$event = EE_Registry::instance()->load_model('Event')->get_one_by_ID($EVT_ID);
166 166
 
167
-				$filename = 'event-' . ( $event instanceof EE_Event ? $event->slug() : __( 'unknown', 'event_espresso' ) );
167
+				$filename = 'event-'.($event instanceof EE_Event ? $event->slug() : __('unknown', 'event_espresso'));
168 168
 
169 169
 			}
170
-			$event_query_params[0]['EVT_ID'] =$value_to_equal;
170
+			$event_query_params[0]['EVT_ID'] = $value_to_equal;
171 171
 			$related_models_query_params[0]['Event.EVT_ID'] = $value_to_equal;
172 172
 			$related_through_reg_query_params[0]['Registration.EVT_ID'] = $value_to_equal;
173 173
 			$datetime_ticket_query_params[0]['Datetime.EVT_ID'] = $value_to_equal;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			$state_country_query_params[0]['Venue.Event.EVT_ID'] = $value_to_equal;
178 178
 			$question_group_query_params[0]['Event.EVT_ID'] = $value_to_equal;
179 179
 			$question_query_params[0]['Question_Group.Event.EVT_ID'] = $value_to_equal;
180
-			$related_through_mtg_params[0]['Message_Template_Group.Event.EVT_ID' ] = $value_to_equal;
180
+			$related_through_mtg_params[0]['Message_Template_Group.Event.EVT_ID'] = $value_to_equal;
181 181
 
182 182
 		} else {
183 183
 			$filename = 'all-events';
@@ -218,18 +218,18 @@  discard block
 block discarded – undo
218 218
 		//and we want to specify what things we want to update (because some of that data we'd rather
219 219
 		//not update, just insert if it doesn't exist
220 220
 		$models_to_update = $models_to_export;
221
-		unset( $models_to_update['Ticket_Template'] );
222
-		unset( $models_to_update['Price_Type'] );
223
-		unset( $models_to_update['Term'] );
224
-		unset( $models_to_update['Country'] );
225
-		unset( $models_to_update['State'] );
226
-		unset( $models_to_update['Question_Group'] );
227
-		unset( $models_to_update['Event_Question_Group'] );
228
-		unset( $models_to_update['Question'] );
229
-		unset( $models_to_update['Question_Group_Question'] );
230
-		unset( $models_to_update['Message_Template_Group'] );
231
-		unset( $models_to_update['Message_Template'] );
232
-		$models_to_update = array_keys( $models_to_update );
221
+		unset($models_to_update['Ticket_Template']);
222
+		unset($models_to_update['Price_Type']);
223
+		unset($models_to_update['Term']);
224
+		unset($models_to_update['Country']);
225
+		unset($models_to_update['State']);
226
+		unset($models_to_update['Question_Group']);
227
+		unset($models_to_update['Event_Question_Group']);
228
+		unset($models_to_update['Question']);
229
+		unset($models_to_update['Question_Group_Question']);
230
+		unset($models_to_update['Message_Template_Group']);
231
+		unset($models_to_update['Message_Template']);
232
+		$models_to_update = array_keys($models_to_update);
233 233
 
234 234
 
235 235
 
@@ -238,42 +238,42 @@  discard block
 block discarded – undo
238 238
 		//and won't get any non-events; also
239 239
 		//we can forego the default query params
240 240
 
241
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
241
+		$model_data = $this->_get_export_data_for_models($models_to_export);
242 242
 
243
-		$filename = $this->generate_filename ( $filename );
243
+		$filename = $this->generate_filename($filename);
244 244
 
245
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data, $models_to_update )) {
246
-			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
245
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data, $models_to_update)) {
246
+			EE_Error::add_error(__("'An error occurred and the Event details could not be exported from the database.'", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
247 247
 		}
248 248
 	}
249 249
 
250
-	function report_attendees(){
250
+	function report_attendees() {
251 251
 		$attendee_rows = EEM_Attendee::instance()->get_all_wpdb_results( 
252 252
 			array( 
253
-				'force_join' => array( 'State', 'Country' ), 
253
+				'force_join' => array('State', 'Country'), 
254 254
 				'caps' => EEM_Base::caps_read_admin 
255 255
 			) 
256 256
 		);
257 257
 		$csv_data = array();
258
-		foreach( $attendee_rows as $attendee_row ){
258
+		foreach ($attendee_rows as $attendee_row) {
259 259
 			$csv_row = array();
260
-			foreach( EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
261
-				if( $field_name == 'STA_ID' ){
262
-					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
263
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
264
-				}elseif( $field_name == 'CNT_ISO' ){
265
-					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
266
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
267
-				}else{
268
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
260
+			foreach (EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
261
+				if ($field_name == 'STA_ID') {
262
+					$state_name_field = EEM_State::instance()->field_settings_for('STA_name');
263
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
264
+				}elseif ($field_name == 'CNT_ISO') {
265
+					$country_name_field = EEM_Country::instance()->field_settings_for('CNT_name');
266
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
267
+				} else {
268
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
269 269
 				}
270 270
 			}
271 271
 			$csv_data[] = $csv_row;
272 272
 		}
273 273
 
274
-		$filename = $this->generate_filename ( 'contact-list-report' );
274
+		$filename = $this->generate_filename('contact-list-report');
275 275
 
276
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
276
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
277 277
 		$this->EE_CSV->write_data_array_to_csv($handle, $csv_data);
278 278
 		$this->EE_CSV->end_sending_csv($handle);
279 279
 	}
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
 		$countries_that_have_an_attendee = EEM_Country::instance()->get_all(array(0=>array('Attendee.ATT_ID'=>array('IS NOT NULL'))));
291 291
 //		$states_to_export_query_params
292 292
 		$models_to_export = array(
293
-			'Country'=>array(array('CNT_ISO'=>array('IN',array_keys($countries_that_have_an_attendee)))),
294
-			'State'=>array(array('STA_ID'=>array('IN',array_keys($states_that_have_an_attendee)))),
293
+			'Country'=>array(array('CNT_ISO'=>array('IN', array_keys($countries_that_have_an_attendee)))),
294
+			'State'=>array(array('STA_ID'=>array('IN', array_keys($states_that_have_an_attendee)))),
295 295
 			'Attendee'=>array(),
296 296
 		);
297
-		$models_to_update = array( 'Attendee' );
297
+		$models_to_update = array('Attendee');
298 298
 
299 299
 
300 300
 
301
-		$model_data = $this->_get_export_data_for_models( $models_to_export );
302
-		$filename = $this->generate_filename ( 'all-attendees' );
301
+		$model_data = $this->_get_export_data_for_models($models_to_export);
302
+		$filename = $this->generate_filename('all-attendees');
303 303
 
304
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $model_data, $models_to_update )) {
305
-			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
304
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $model_data, $models_to_update)) {
305
+			EE_Error::add_error(__('An error occurred and the Attendee data could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
306 306
 		}
307 307
 	}
308 308
 
@@ -314,19 +314,19 @@  discard block
 block discarded – undo
314 314
 	 * @param boolean|string $pretty_schema true to display pretty, a string to use a specific "Schema", or false to NOT display pretty
315 315
 	 * @return string
316 316
 	 */
317
-	protected function _prepare_value_from_db_for_display( $model, $field_name,  $raw_db_value, $pretty_schema = true ) {
318
-		$field_obj = $model->field_settings_for( $field_name );
319
-		$value_on_model_obj = $field_obj->prepare_for_set_from_db( $raw_db_value );
320
-		if( $field_obj instanceof EE_Datetime_Field ) {
321
-			$field_obj->set_date_format( EE_CSV::instance()->get_date_format_for_csv( $field_obj->get_date_format( $pretty_schema ) ), $pretty_schema );
322
-			$field_obj->set_time_format( EE_CSV::instance()->get_time_format_for_csv( $field_obj->get_time_format( $pretty_schema ) ), $pretty_schema );
317
+	protected function _prepare_value_from_db_for_display($model, $field_name, $raw_db_value, $pretty_schema = true) {
318
+		$field_obj = $model->field_settings_for($field_name);
319
+		$value_on_model_obj = $field_obj->prepare_for_set_from_db($raw_db_value);
320
+		if ($field_obj instanceof EE_Datetime_Field) {
321
+			$field_obj->set_date_format(EE_CSV::instance()->get_date_format_for_csv($field_obj->get_date_format($pretty_schema)), $pretty_schema);
322
+			$field_obj->set_time_format(EE_CSV::instance()->get_time_format_for_csv($field_obj->get_time_format($pretty_schema)), $pretty_schema);
323 323
 		}
324
-		if( $pretty_schema === true){
325
-			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
326
-		}elseif( is_string( $pretty_schema ) ) {
327
-			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
328
-		}else{
329
-			return $field_obj->prepare_for_get( $value_on_model_obj );
324
+		if ($pretty_schema === true) {
325
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj);
326
+		}elseif (is_string($pretty_schema)) {
327
+			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema);
328
+		} else {
329
+			return $field_obj->prepare_for_get($value_on_model_obj);
330 330
 		}
331 331
 	}
332 332
 
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 	 * and the questions associated with the registrations
336 336
 	 * @param int $event_id
337 337
 	 */
338
-	function report_registrations_for_event( $event_id = NULL ){
338
+	function report_registrations_for_event($event_id = NULL) {
339 339
 		$reg_fields_to_include = array(
340 340
 				'TXN_ID',
341 341
 				'ATT_ID',
@@ -367,126 +367,126 @@  discard block
 block discarded – undo
367 367
 				array(
368 368
 					'OR' => array(
369 369
 						//don't include registrations from failed or abandoned transactions...
370
-						'Transaction.STS_ID' => array( 'NOT IN', array( EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code ) ),
370
+						'Transaction.STS_ID' => array('NOT IN', array(EEM_Transaction::failed_status_code, EEM_Transaction::abandoned_status_code)),
371 371
 						//unless the registration is approved, in which case include it regardless of transaction status
372 372
 						'STS_ID' => EEM_Registration::status_id_approved
373 373
 						),
374
-					'Ticket.TKT_deleted' => array( 'IN', array( true, false ) )
374
+					'Ticket.TKT_deleted' => array('IN', array(true, false))
375 375
 					),
376
-				'order_by' => array('Transaction.TXN_ID'=>'asc','REG_count'=>'asc'),
377
-				'force_join' => array( 'Transaction', 'Ticket', 'Attendee' ),
376
+				'order_by' => array('Transaction.TXN_ID'=>'asc', 'REG_count'=>'asc'),
377
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
378 378
 				'caps' => EEM_Base::caps_read_admin
379 379
 			),
380 380
 			$event_id
381 381
 		);
382
-		if( $event_id ){
383
-			$query_params[0]['EVT_ID'] =  $event_id;
384
-		}else{
385
-			$query_params[ 'force_join' ][] = 'Event';
382
+		if ($event_id) {
383
+			$query_params[0]['EVT_ID'] = $event_id;
384
+		} else {
385
+			$query_params['force_join'][] = 'Event';
386 386
 		}
387
-		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
387
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
388 388
 		//get all questions which relate to someone in this group
389 389
 		$registration_ids = array();
390
-		foreach( $registration_rows as $reg_row ) {
391
-			$registration_ids[] = intval( $reg_row[ 'Registration.REG_ID'] );
390
+		foreach ($registration_rows as $reg_row) {
391
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
392 392
 		}
393 393
 //		EEM_Question::instance()->show_next_x_db_queries();
394
-		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN',$registration_ids))));
395
-		foreach($registration_rows as $reg_row){
396
-			if ( is_array( $reg_row ) ) {
394
+		$questions_for_these_regs_rows = EEM_Question::instance()->get_all_wpdb_results(array(array('Answer.REG_ID'=>array('IN', $registration_ids))));
395
+		foreach ($registration_rows as $reg_row) {
396
+			if (is_array($reg_row)) {
397 397
 				$reg_csv_array = array();
398
-				if( ! $event_id ){
398
+				if ( ! $event_id) {
399 399
 					//get the event's name and Id
400
-					$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' ] );
400
+					$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']);
401 401
 				}
402
-				$is_primary_reg = $reg_row[ 'Registration.REG_count' ] == '1' ? true : false;
402
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
403 403
 				/*@var $reg_row EE_Registration */
404
-				foreach($reg_fields_to_include as $field_name){
404
+				foreach ($reg_fields_to_include as $field_name) {
405 405
 					$field = $reg_model->field_settings_for($field_name);
406
-					if($field_name == 'REG_final_price'){
407
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
408
-					}elseif( $field_name == 'REG_count' ){
409
-						$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' ] ) );
410
-					}elseif( $field_name == 'REG_date' ) {
411
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
412
-					}else{
413
-						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
406
+					if ($field_name == 'REG_final_price') {
407
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_final_price'], 'localized_float');
408
+					}elseif ($field_name == 'REG_count') {
409
+						$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']));
410
+					}elseif ($field_name == 'REG_date') {
411
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row['Registration.REG_date'], 'no_html');
412
+					} else {
413
+						$value = $this->_prepare_value_from_db_for_display($reg_model, $field_name, $reg_row[$field->get_qualified_column()]);
414 414
 					}
415 415
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
416
-					if($field_name == 'REG_final_price'){
416
+					if ($field_name == 'REG_final_price') {
417 417
 						//add a column named Currency after the final price
418 418
 						$reg_csv_array[__("Currency", "event_espresso")] = EE_Config::instance()->currency->code;
419 419
 					}
420 420
 				}
421 421
 				//get pretty status
422
-				$stati = EEM_Status::instance()->localized_status( array(
423
-					$reg_row[ 'Registration.STS_ID' ] => __( 'unknown', 'event_espresso' ),
424
-					$reg_row[ 'TransactionTable.STS_ID' ] => __( 'unknown', 'event_espresso' ) ),
422
+				$stati = EEM_Status::instance()->localized_status(array(
423
+					$reg_row['Registration.STS_ID'] => __('unknown', 'event_espresso'),
424
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso') ),
425 425
 						FALSE,
426
-						'sentence' );
427
-				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[ $reg_row[ 'Registration.STS_ID' ] ];
426
+						'sentence');
427
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
428 428
 				//get pretty trnasaction status
429
-				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[ $reg_row[ 'TransactionTable.STS_ID' ] ];
430
-				$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';
431
-				$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';
429
+				$reg_csv_array[__("Transaction Status", 'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
430
+				$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';
431
+				$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';
432 432
 				$payment_methods = array();
433 433
 				$gateway_txn_ids_etc = array();
434 434
 				$payment_times = array();
435
-				if( $is_primary_reg && $reg_row[ 'TransactionTable.TXN_ID' ] ){
435
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
436 436
 					$payments_info = EEM_Payment::instance()->get_all_wpdb_results(
437 437
 							array(
438 438
 								array(
439
-									'TXN_ID' => $reg_row[ 'TransactionTable.TXN_ID' ],
439
+									'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
440 440
 									'STS_ID' => EEM_Payment::status_id_approved
441 441
 								),
442
-								'force_join' => array( 'Payment_Method' ),
442
+								'force_join' => array('Payment_Method'),
443 443
 
444 444
 							),
445 445
 							ARRAY_A,
446 446
 							'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time' );
447 447
 
448
-					foreach( $payments_info as $payment_method_and_gateway_txn_id ){
449
-						$payment_methods[] = isset( $payment_method_and_gateway_txn_id[ 'name' ] ) ? $payment_method_and_gateway_txn_id[ 'name' ] : __( 'Unknown', 'event_espresso' );
450
-						$gateway_txn_ids_etc[] = isset( $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] ) ? $payment_method_and_gateway_txn_id[ 'gateway_txn_id' ] : '';
451
-						$payment_times[] = isset( $payment_method_and_gateway_txn_id[ 'payment_time' ] ) ? $payment_method_and_gateway_txn_id[ 'payment_time' ] : '';
448
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
449
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name']) ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
450
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id']) ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
451
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time']) ? $payment_method_and_gateway_txn_id['payment_time'] : '';
452 452
 					}
453 453
 
454 454
 				}
455
-				$reg_csv_array[ __( 'Payment Date(s)', 'event_espresso' ) ] = implode( ',', $payment_times );
456
-				$reg_csv_array[ __( 'Payment Method(s)', 'event_espresso' ) ] = implode( ",", $payment_methods );
457
-				$reg_csv_array[ __( 'Gateway Transaction ID(s)', 'event_espresso' )] = implode( ',', $gateway_txn_ids_etc );
455
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
456
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
457
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
458 458
 
459 459
 				//get whether or not the user has checked in
460
-				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related( $reg_row[ 'Registration.REG_ID'] , 'Checkin' );
460
+				$reg_csv_array[__("Check-Ins", "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
461 461
 				//get ticket of registration and its price
462 462
 				$ticket_model = EE_Registry::instance()->load_model('Ticket');
463
-				if( $reg_row[ 'Ticket.TKT_ID'] ) {
464
-					$ticket_name = $this->_prepare_value_from_db_for_display( $ticket_model, 'TKT_name', $reg_row[ 'Ticket.TKT_name' ] );
463
+				if ($reg_row['Ticket.TKT_ID']) {
464
+					$ticket_name = $this->_prepare_value_from_db_for_display($ticket_model, 'TKT_name', $reg_row['Ticket.TKT_name']);
465 465
 					$datetimes_strings = array();
466
-					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){
467
-						$datetimes_strings[] = $this->_prepare_value_from_db_for_display( EEM_Datetime::instance(), 'DTT_EVT_start', $datetime[ 'Datetime.DTT_EVT_start'] );
466
+					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) {
467
+						$datetimes_strings[] = $this->_prepare_value_from_db_for_display(EEM_Datetime::instance(), 'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
468 468
 					}
469 469
 
470 470
 				} else {
471
-					$ticket_name = __( 'Unknown', 'event_espresso' );
472
-					$datetimes_strings = array( __( 'Unknown', 'event_espresso' ) );
471
+					$ticket_name = __('Unknown', 'event_espresso');
472
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
473 473
 				}
474 474
 				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
475 475
 				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
476 476
 				//get datetime(s) of registration
477 477
 
478 478
 				//add attendee columns
479
-				foreach($att_fields_to_include as $att_field_name){
479
+				foreach ($att_fields_to_include as $att_field_name) {
480 480
 					$field_obj = EEM_Attendee::instance()->field_settings_for($att_field_name);
481
-					if( $reg_row[ 'Attendee_CPT.ID' ]){
482
-						if($att_field_name == 'STA_ID'){
483
-							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
484
-						}elseif($att_field_name == 'CNT_ISO'){
485
-							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
486
-						}else{
487
-							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
481
+					if ($reg_row['Attendee_CPT.ID']) {
482
+						if ($att_field_name == 'STA_ID') {
483
+							$value = EEM_State::instance()->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])), 'STA_name');
484
+						}elseif ($att_field_name == 'CNT_ISO') {
485
+							$value = EEM_Country::instance()->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])), 'CNT_name');
486
+						} else {
487
+							$value = $this->_prepare_value_from_db_for_display(EEM_Attendee::instance(), $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
488 488
 						}
489
-					}else{
489
+					} else {
490 490
 						$value = '';
491 491
 					}
492 492
 
@@ -494,56 +494,56 @@  discard block
 block discarded – undo
494 494
 				}
495 495
 
496 496
 				//make sure each registration has the same questions in the same order
497
-				foreach($questions_for_these_regs_rows as $question_row){
498
-					if( ! isset($reg_csv_array[$question_row[ 'Question.QST_admin_label']])){
499
-						$reg_csv_array[$question_row[ 'Question.QST_admin_label' ] ] = null;
497
+				foreach ($questions_for_these_regs_rows as $question_row) {
498
+					if ( ! isset($reg_csv_array[$question_row['Question.QST_admin_label']])) {
499
+						$reg_csv_array[$question_row['Question.QST_admin_label']] = null;
500 500
 					}
501 501
 				}
502 502
 				//now fill out the questions THEY answered
503
-				foreach( EEM_Answer::instance()->get_all_wpdb_results( array( array( 'REG_ID' => $reg_row[ 'Registration.REG_ID' ] ), 'force_join' => array( 'Question' ) ) ) as $answer_row){
503
+				foreach (EEM_Answer::instance()->get_all_wpdb_results(array(array('REG_ID' => $reg_row['Registration.REG_ID']), 'force_join' => array('Question'))) as $answer_row) {
504 504
 					/* @var $answer EE_Answer */
505
-					if( $answer_row[ 'Question.QST_ID' ] ){
506
-						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
507
-					}else{
508
-						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
505
+					if ($answer_row['Question.QST_ID']) {
506
+						$question_label = $this->_prepare_value_from_db_for_display(EEM_Question::instance(), 'QST_admin_label', $answer_row['Question.QST_admin_label']);
507
+					} else {
508
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
509 509
 					}
510
-                                        if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
511
-                                            $reg_csv_array[ $question_label ] = EEM_State::instance()->get_state_name_by_ID( $answer_row[ 'Answer.ANS_value' ] );
510
+                                        if (isset($answer_row['Question.QST_type']) && $answer_row['Question.QST_type'] == EEM_Question::QST_type_state) {
511
+                                            $reg_csv_array[$question_label] = EEM_State::instance()->get_state_name_by_ID($answer_row['Answer.ANS_value']);
512 512
                                         } else {
513
-                                            $reg_csv_array[ $question_label ] = $this->_prepare_value_from_db_for_display( EEM_Answer::instance(), 'ANS_value', $answer_row[ 'Answer.ANS_value' ] );
513
+                                            $reg_csv_array[$question_label] = $this->_prepare_value_from_db_for_display(EEM_Answer::instance(), 'ANS_value', $answer_row['Answer.ANS_value']);
514 514
                                         }
515 515
 				}
516
-				$registrations_csv_ready_array[] = apply_filters( 'FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row );
516
+				$registrations_csv_ready_array[] = apply_filters('FHEE__EE_Export__report_registrations__reg_csv_array', $reg_csv_array, $reg_row);
517 517
 			}
518 518
 		}
519 519
 
520 520
 		//if we couldn't export anything, we want to at least show the column headers
521
-		if(empty($registrations_csv_ready_array)){
521
+		if (empty($registrations_csv_ready_array)) {
522 522
 			$reg_csv_array = array();
523 523
 			$model_and_fields_to_include = array(
524 524
 				'Registration' => $reg_fields_to_include,
525 525
 				'Attendee' => $att_fields_to_include
526 526
 			);
527
-			foreach($model_and_fields_to_include as $model_name => $field_list){
527
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
528 528
 				$model = EE_Registry::instance()->load_model($model_name);
529
-				foreach($field_list as $field_name){
529
+				foreach ($field_list as $field_name) {
530 530
 					$field = $model->field_settings_for($field_name);
531
-					$reg_csv_array[$this->_get_column_name_for_field($field)] = null;//$registration->get($field->get_name());
531
+					$reg_csv_array[$this->_get_column_name_for_field($field)] = null; //$registration->get($field->get_name());
532 532
 				}
533 533
 			}
534 534
 			$registrations_csv_ready_array [] = $reg_csv_array;
535 535
 		}
536
-		if( $event_id ){
537
-			$event_slug =  EEM_Event::instance()->get_var( array( array( 'EVT_ID' => $event_id ) ), 'EVT_slug' );
538
-			if( ! $event_slug ) {
539
-				$event_slug = __( 'unknown', 'event_espresso' );
536
+		if ($event_id) {
537
+			$event_slug = EEM_Event::instance()->get_var(array(array('EVT_ID' => $event_id)), 'EVT_slug');
538
+			if ( ! $event_slug) {
539
+				$event_slug = __('unknown', 'event_espresso');
540 540
 			}
541
-		}else{
542
-			$event_slug = __( 'all', 'event_espresso' );
541
+		} else {
542
+			$event_slug = __('all', 'event_espresso');
543 543
 		}
544
-		$filename = sprintf( "registrations-for-%s", $event_slug );
544
+		$filename = sprintf("registrations-for-%s", $event_slug);
545 545
 
546
-		$handle = $this->EE_CSV->begin_sending_csv( $filename);
546
+		$handle = $this->EE_CSV->begin_sending_csv($filename);
547 547
 		$this->EE_CSV->write_data_array_to_csv($handle, $registrations_csv_ready_array);
548 548
 		$this->EE_CSV->end_sending_csv($handle);
549 549
 	}
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 	 * @param EE_Model_Field_Base $field
554 554
 	 * @return string
555 555
 	 */
556
-	protected function _get_column_name_for_field(EE_Model_Field_Base $field){
556
+	protected function _get_column_name_for_field(EE_Model_Field_Base $field) {
557 557
 		return $field->get_nicename()."[".$field->get_name()."]";
558 558
 	}
559 559
 
@@ -566,17 +566,17 @@  discard block
 block discarded – undo
566 566
 	function export_categories() {
567 567
 		// are any Event IDs set?
568 568
 		$query_params = array();
569
-		if ( isset( $this->_req_data['EVT_CAT_ID'] )) {
569
+		if (isset($this->_req_data['EVT_CAT_ID'])) {
570 570
 			// do we have an array of IDs ?
571
-			if ( is_array( $this->_req_data['EVT_CAT_ID'] )) {
571
+			if (is_array($this->_req_data['EVT_CAT_ID'])) {
572 572
 				// generate an "IN (CSV)" where clause
573
-				$EVT_CAT_IDs = array_map( 'sanitize_text_field', $this->_req_data['EVT_CAT_ID'] );
573
+				$EVT_CAT_IDs = array_map('sanitize_text_field', $this->_req_data['EVT_CAT_ID']);
574 574
 				$filename = 'event-categories';
575
-				$query_params[0]['term_taxonomy_id'] = array('IN',$EVT_CAT_IDs);
575
+				$query_params[0]['term_taxonomy_id'] = array('IN', $EVT_CAT_IDs);
576 576
 			} else {
577 577
 				// generate regular where = clause
578
-				$EVT_CAT_ID = absint( $this->_req_data['EVT_CAT_ID'] );
579
-				$filename = 'event-category#' . $EVT_CAT_ID;
578
+				$EVT_CAT_ID = absint($this->_req_data['EVT_CAT_ID']);
579
+				$filename = 'event-category#'.$EVT_CAT_ID;
580 580
 				$query_params[0]['term_taxonomy_id'] = $EVT_CAT_ID;
581 581
 			}
582 582
 		} else {
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 				'Term_Taxonomy' => $query_params
589 589
 			);
590 590
 
591
-		$table_data = $this->_get_export_data_for_models( $tables_to_export );
592
-		$filename = $this->generate_filename ( $filename );
591
+		$table_data = $this->_get_export_data_for_models($tables_to_export);
592
+		$filename = $this->generate_filename($filename);
593 593
 
594
-		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv( $filename, $table_data )) {
595
-			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.','event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
594
+		if ( ! $this->EE_CSV->export_multiple_model_data_to_csv($filename, $table_data)) {
595
+			EE_Error::add_error(__('An error occurred and the Category details could not be exported from the database.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
596 596
 		}
597 597
 	}
598 598
 
@@ -603,13 +603,13 @@  discard block
 block discarded – undo
603 603
 	 *		  @param string - export_name
604 604
 	 *			@return string on success, FALSE on fail
605 605
 	 */
606
-	private function generate_filename ( $export_name = '' ) {
607
-		if ( $export_name != '' ) {
608
-			$filename = get_bloginfo('name') . '-' . $export_name;
609
-			$filename = sanitize_key( $filename ) . '-' . $this->today;
606
+	private function generate_filename($export_name = '') {
607
+		if ($export_name != '') {
608
+			$filename = get_bloginfo('name').'-'.$export_name;
609
+			$filename = sanitize_key($filename).'-'.$this->today;
610 610
 			return $filename;
611
-		}	 else {
612
-			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
611
+		} else {
612
+			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
613 613
 		}
614 614
 		return false;
615 615
 	}
@@ -622,37 +622,37 @@  discard block
 block discarded – undo
622 622
 	 *	@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
623 623
 	 *	@return array on success, FALSE on fail
624 624
 	 */
625
-	private function _get_export_data_for_models( $models_to_export = array() ) {
625
+	private function _get_export_data_for_models($models_to_export = array()) {
626 626
 		$table_data = FALSE;
627
-		if ( is_array( $models_to_export ) ) {
628
-			foreach ( $models_to_export as $model_name => $query_params ) {
627
+		if (is_array($models_to_export)) {
628
+			foreach ($models_to_export as $model_name => $query_params) {
629 629
 				//check for a numerically-indexed array. in that case, $model_name is the value!!
630
-				if(is_int($model_name)){
630
+				if (is_int($model_name)) {
631 631
 					$model_name = $query_params;
632 632
 					$query_params = array();
633 633
 				}
634
-				if( ! isset( $query_params[ 'default_where_conditions'] ) ) {
635
-					$query_params[ 'default_where_conditions' ] = 'minimum';
634
+				if ( ! isset($query_params['default_where_conditions'])) {
635
+					$query_params['default_where_conditions'] = 'minimum';
636 636
 				}
637 637
 				$model = EE_Registry::instance()->load_model($model_name);
638 638
 				$model_objects = $model->get_all($query_params);
639 639
 
640 640
 
641 641
 				$table_data[$model_name] = array();
642
-				foreach($model_objects as $model_object){
642
+				foreach ($model_objects as $model_object) {
643 643
 					$model_data_array = array();
644 644
 					$fields = $model->field_settings();
645
-					foreach($fields as $field){
645
+					foreach ($fields as $field) {
646 646
 						$column_name = $field->get_nicename()."[".$field->get_name()."]";
647
-						if($field instanceof EE_Datetime_Field){
647
+						if ($field instanceof EE_Datetime_Field) {
648 648
 //							$field->set_date_format('Y-m-d');
649 649
 //							$field->set_time_format('H:i:s');
650
-							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(),'Y-m-d','H:i:s');
651
-						} elseif( $field instanceof EE_Infinite_Integer_Field &&
652
-								$model_object->get( $field->get_name() ) === EE_INF ) {
650
+							$model_data_array[$column_name] = $model_object->get_datetime($field->get_name(), 'Y-m-d', 'H:i:s');
651
+						} elseif ($field instanceof EE_Infinite_Integer_Field &&
652
+								$model_object->get($field->get_name()) === EE_INF) {
653 653
 							$model_data_array[$column_name] = "";
654 654
 						}
655
-						else{
655
+						else {
656 656
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
657 657
 						}
658 658
 					}
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
@@ -261,10 +263,10 @@  discard block
 block discarded – undo
261 263
 				if( $field_name == 'STA_ID' ){
262 264
 					$state_name_field = EEM_State::instance()->field_settings_for( 'STA_name' );
263 265
 					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
264
-				}elseif( $field_name == 'CNT_ISO' ){
266
+				} elseif( $field_name == 'CNT_ISO' ){
265 267
 					$country_name_field = EEM_Country::instance()->field_settings_for( 'CNT_name' );
266 268
 					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
267
-				}else{
269
+				} else{
268 270
 					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
269 271
 				}
270 272
 			}
@@ -323,9 +325,9 @@  discard block
 block discarded – undo
323 325
 		}
324 326
 		if( $pretty_schema === true){
325 327
 			return $field_obj->prepare_for_pretty_echoing( $value_on_model_obj );
326
-		}elseif( is_string( $pretty_schema ) ) {
328
+		} elseif( is_string( $pretty_schema ) ) {
327 329
 			return $field_obj->prepare_for_pretty_echoing($value_on_model_obj, $pretty_schema );
328
-		}else{
330
+		} else{
329 331
 			return $field_obj->prepare_for_get( $value_on_model_obj );
330 332
 		}
331 333
 	}
@@ -381,7 +383,7 @@  discard block
 block discarded – undo
381 383
 		);
382 384
 		if( $event_id ){
383 385
 			$query_params[0]['EVT_ID'] =  $event_id;
384
-		}else{
386
+		} else{
385 387
 			$query_params[ 'force_join' ][] = 'Event';
386 388
 		}
387 389
 		$registration_rows = $reg_model->get_all_wpdb_results( $query_params );
@@ -405,11 +407,11 @@  discard block
 block discarded – undo
405 407
 					$field = $reg_model->field_settings_for($field_name);
406 408
 					if($field_name == 'REG_final_price'){
407 409
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_final_price'], 'localized_float' );
408
-					}elseif( $field_name == 'REG_count' ){
410
+					} elseif( $field_name == 'REG_count' ){
409 411
 						$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' ] ) );
410
-					}elseif( $field_name == 'REG_date' ) {
412
+					} elseif( $field_name == 'REG_date' ) {
411 413
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ 'Registration.REG_date'], 'no_html' );
412
-					}else{
414
+					} else{
413 415
 						$value = $this->_prepare_value_from_db_for_display( $reg_model, $field_name, $reg_row[ $field->get_qualified_column() ] );
414 416
 					}
415 417
 					$reg_csv_array[$this->_get_column_name_for_field($field)] = $value;
@@ -481,12 +483,12 @@  discard block
 block discarded – undo
481 483
 					if( $reg_row[ 'Attendee_CPT.ID' ]){
482 484
 						if($att_field_name == 'STA_ID'){
483 485
 							$value = EEM_State::instance()->get_var( array( array( 'STA_ID' => $reg_row[ 'Attendee_Meta.STA_ID' ] ) ), 'STA_name' );
484
-						}elseif($att_field_name == 'CNT_ISO'){
486
+						} elseif($att_field_name == 'CNT_ISO'){
485 487
 							$value = EEM_Country::instance()->get_var( array( array( 'CNT_ISO' => $reg_row[ 'Attendee_Meta.CNT_ISO' ] ) ), 'CNT_name' );
486
-						}else{
488
+						} else{
487 489
 							$value = $this->_prepare_value_from_db_for_display( EEM_Attendee::instance(), $att_field_name, $reg_row[ $field_obj->get_qualified_column() ] );
488 490
 						}
489
-					}else{
491
+					} else{
490 492
 						$value = '';
491 493
 					}
492 494
 
@@ -504,7 +506,7 @@  discard block
 block discarded – undo
504 506
 					/* @var $answer EE_Answer */
505 507
 					if( $answer_row[ 'Question.QST_ID' ] ){
506 508
 						$question_label = $this->_prepare_value_from_db_for_display( EEM_Question::instance(), 'QST_admin_label', $answer_row[ 'Question.QST_admin_label' ] );
507
-					}else{
509
+					} else{
508 510
 						$question_label = sprintf( __( 'Question $s', 'event_espresso' ), $answer_row[ 'Answer.QST_ID' ] );
509 511
 					}
510 512
                                         if( isset( $answer_row[ 'Question.QST_type'] ) && $answer_row[ 'Question.QST_type' ] == EEM_Question::QST_type_state ) {
@@ -538,7 +540,7 @@  discard block
 block discarded – undo
538 540
 			if( ! $event_slug ) {
539 541
 				$event_slug = __( 'unknown', 'event_espresso' );
540 542
 			}
541
-		}else{
543
+		} else{
542 544
 			$event_slug = __( 'all', 'event_espresso' );
543 545
 		}
544 546
 		$filename = sprintf( "registrations-for-%s", $event_slug );
@@ -608,7 +610,7 @@  discard block
 block discarded – undo
608 610
 			$filename = get_bloginfo('name') . '-' . $export_name;
609 611
 			$filename = sanitize_key( $filename ) . '-' . $this->today;
610 612
 			return $filename;
611
-		}	 else {
613
+		} else {
612 614
 			EE_Error::add_error(__("No filename was provided", "event_espresso"), __FILE__, __FUNCTION__, __LINE__ );
613 615
 		}
614 616
 		return false;
@@ -651,8 +653,7 @@  discard block
 block discarded – undo
651 653
 						} elseif( $field instanceof EE_Infinite_Integer_Field &&
652 654
 								$model_object->get( $field->get_name() ) === EE_INF ) {
653 655
 							$model_data_array[$column_name] = "";
654
-						}
655
-						else{
656
+						} else{
656 657
 							$model_data_array[$column_name] = $model_object->get($field->get_name());
657 658
 						}
658 659
 					}
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_Change_Log.model.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 	 * @param string $log_type !see the acceptable values of LOG_type in EEM__Change_Log::__construct
118 118
 	 * @param mixed $message array|string of the message you want to record
119 119
 	 * @param EE_Base_Class $related_model_obj
120
-	 * @return EE_Change_Log
120
+	 * @return EE_Attendee
121 121
 	 */
122 122
 	public function log($log_type,$message,$related_model_obj){
123 123
 		if($related_model_obj instanceof EE_Base_Class){
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 * @param mixed $related_obj_id
146 146
 	 * @param string $related_obj_type
147 147
 	 * @throws EE_Error
148
-	 * @return EE_Change_Log
148
+	 * @return EE_Attendee
149 149
 	 */
150 150
 	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
151 151
 		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEM_Change_Log extends EEM_Base{
28
+class EEM_Change_Log extends EEM_Base {
29 29
 
30 30
 	/**
31 31
 	 * the related object was created log type
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
 	 *	@access protected
69 69
 	 *	@return EEM_Change_Log
70 70
 	 */
71
-	protected function __construct( $timezone = null ){
71
+	protected function __construct($timezone = null) {
72 72
 		global $current_user;
73
-		$this->singular_item = __('Log','event_espresso');
74
-		$this->plural_item = __('Logs','event_espresso');
73
+		$this->singular_item = __('Log', 'event_espresso');
74
+		$this->plural_item = __('Logs', 'event_espresso');
75 75
 		$this->_tables = array(
76 76
 			'Log'=> new EE_Primary_Table('esp_log', 'LOG_ID')
77 77
 		);
78 78
 		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
79 79
 		$this->_fields = array(
80 80
 			'Log'=>array(
81
-				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID','event_espresso')),
81
+				'LOG_ID'=> new EE_Primary_Key_Int_Field('LOG_ID', __('Log ID', 'event_espresso')),
82 82
 				'LOG_time'=>new EE_Datetime_Field('LOG_time', __("Log Time", 'event_espresso'), false, time()),
83
-				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL,$models_this_can_attach_to),
83
+				'OBJ_ID'=>new EE_Foreign_Key_String_Field('OBJ_ID', __("Object ID (int or string)", 'event_espresso'), true, NULL, $models_this_can_attach_to),
84 84
 				'OBJ_type'=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Object Type", 'event_espresso'), true, NULL, $models_this_can_attach_to),
85 85
 				'LOG_type'=>new EE_Enum_Text_Field('LOG_type', __("Type of log entry", "event_espresso"), false, self::type_debug,
86 86
 						array(
@@ -92,24 +92,24 @@  discard block
 block discarded – undo
92 92
 							self::type_gateway=> __("Gateway Interaction (IPN or Direct Payment)", 'event_espresso'),
93 93
 							)),
94 94
 				'LOG_message'=>new EE_Maybe_Serialized_Text_Field('LOG_message', __("Log Message (body)", 'event_espresso'), true),
95
-				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true ),
95
+				'LOG_wp_user' => new EE_WP_User_Field('LOG_wp_user', __("User who was logged in while this occurred", 'event_espresso'), true),
96 96
 
97 97
 			));
98 98
 		$this->_model_relations = array();
99
-		foreach($models_this_can_attach_to as $model){
100
-			if( $model == 'WP_User' ){
101
-				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
99
+		foreach ($models_this_can_attach_to as $model) {
100
+			if ($model == 'WP_User') {
101
+				$this->_model_relations[$model] = new EE_Belongs_To_Relation();
102
+			}elseif ($model != 'Change_Log') {
103 103
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 104
 			}
105 105
 		}
106 106
 		//use completely custom caps for this
107 107
 		$this->_cap_restriction_generators = false;
108 108
 		//caps-wise this is all-or-nothing: if you have the default role you can access anything, otherwise nothing
109
-		foreach( $this->_cap_contexts_to_cap_action_map as $cap_context => $action ) {
110
-			$this->_cap_restrictions[ $cap_context ][ EE_Restriction_Generator_Base::get_default_restrictions_cap() ] = new EE_Return_None_Where_Conditions();
109
+		foreach ($this->_cap_contexts_to_cap_action_map as $cap_context => $action) {
110
+			$this->_cap_restrictions[$cap_context][EE_Restriction_Generator_Base::get_default_restrictions_cap()] = new EE_Return_None_Where_Conditions();
111 111
 		}
112
-		parent::__construct( $timezone );
112
+		parent::__construct($timezone);
113 113
 	}
114 114
 
115 115
 	/**
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 * @param EE_Base_Class $related_model_obj
120 120
 	 * @return EE_Change_Log
121 121
 	 */
122
-	public function log($log_type,$message,$related_model_obj){
123
-		if($related_model_obj instanceof EE_Base_Class){
122
+	public function log($log_type, $message, $related_model_obj) {
123
+		if ($related_model_obj instanceof EE_Base_Class) {
124 124
 			$obj_id = $related_model_obj->ID();
125 125
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
126
+		} else {
127 127
 			$obj_id = NULL;
128 128
 			$obj_type = NULL;
129 129
 		}
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 	 * @throws EE_Error
148 148
 	 * @return EE_Change_Log
149 149
 	 */
150
-	public function gateway_log( $message, $related_obj_id, $related_obj_type ){
151
-		if( ! EE_Registry::instance()->is_model_name($related_obj_type)){
152
-			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"),$related_obj_type));
150
+	public function gateway_log($message, $related_obj_id, $related_obj_type) {
151
+		if ( ! EE_Registry::instance()->is_model_name($related_obj_type)) {
152
+			throw new EE_Error(sprintf(__("'%s' is not a model name. A model name must be provided when making a gateway log. Eg, 'Payment', 'Payment_Method', etc", "event_espresso"), $related_obj_type));
153 153
 		}
154 154
 		$log = EE_Change_Log::new_instance(array(
155 155
 				'LOG_type'=>EEM_Change_Log::type_gateway,
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * @param array $query_params @see EEM_Base::get_all
169 169
 	 * @return array of arrays
170 170
 	 */
171
-	public function get_all_efficiently($query_params){
171
+	public function get_all_efficiently($query_params) {
172 172
 		return $this->_get_all_wpdb_results($query_params);
173 173
 	}
174 174
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 
6 7
 /**
7 8
  * Event Espresso
@@ -99,7 +100,7 @@  discard block
 block discarded – undo
99 100
 		foreach($models_this_can_attach_to as $model){
100 101
 			if( $model == 'WP_User' ){
101 102
 				$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
102
-			}elseif( $model != 'Change_Log' ) {
103
+			} elseif( $model != 'Change_Log' ) {
103 104
 				$this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
104 105
 			}
105 106
 		}
@@ -123,7 +124,7 @@  discard block
 block discarded – undo
123 124
 		if($related_model_obj instanceof EE_Base_Class){
124 125
 			$obj_id = $related_model_obj->ID();
125 126
 			$obj_type = $related_model_obj->get_model()->get_this_model_name();
126
-		}else{
127
+		} else{
127 128
 			$obj_id = NULL;
128 129
 			$obj_type = NULL;
129 130
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Line_Item.model.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@
 block discarded – undo
292 292
 	 * which would happen if some of the registrations had a price modifier while others didn't.
293 293
 	 * In order to support that, we'd probably need a LIN_ID on registrations or something.
294 294
 	 * @param EE_Registration $registration
295
-	 * @return EEM_Line_ITem
295
+	 * @return EE_Base_Class|null
296 296
 	 */
297 297
 	public function get_line_item_for_registration( EE_Registration $registration ) {
298 298
 		return $this->get_one( $this->line_item_for_registration_query_params( $registration ));
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -103,41 +103,41 @@  discard block
 block discarded – undo
103 103
 	 * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved).  Note this just sends the timezone info to the date time model field objects.  Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option)
104 104
 	 * @return \EEM_Line_Item
105 105
 	 */
106
-	protected function __construct( $timezone ) {
107
-		$this->singular_item = __('Line Item','event_espresso');
108
-		$this->plural_item = __('Line Items','event_espresso');
106
+	protected function __construct($timezone) {
107
+		$this->singular_item = __('Line Item', 'event_espresso');
108
+		$this->plural_item = __('Line Items', 'event_espresso');
109 109
 
110 110
 		$this->_tables = array(
111
-			'Line_Item'=>new EE_Primary_Table('esp_line_item','LIN_ID')
111
+			'Line_Item'=>new EE_Primary_Table('esp_line_item', 'LIN_ID')
112 112
 		);
113
-		$line_items_can_be_for = apply_filters( 'FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket','Price', 'Event' ) );
113
+		$line_items_can_be_for = apply_filters('FHEE__EEM_Line_Item__line_items_can_be_for', array('Ticket', 'Price', 'Event'));
114 114
 		$this->_fields = array(
115 115
 			'Line_Item' => array(
116
-				'LIN_ID' 				=> new EE_Primary_Key_Int_Field( 'LIN_ID', __( "ID", "event_espresso" ) ),
117
-				'LIN_code' 			=> new EE_Slug_Field( 'LIN_code', __( "Code for index into Cart", "event_espresso" ), TRUE ),
118
-				'TXN_ID' 				=> new EE_Foreign_Key_Int_Field( 'TXN_ID', __( "Transaction ID", "event_espresso" ), TRUE, NULL, 'Transaction' ),
119
-				'LIN_name' 			=> new EE_Full_HTML_Field( 'LIN_name', __( "Line Item Name", "event_espresso" ), FALSE, '' ),
120
-				'LIN_desc' 			=> new EE_Full_HTML_Field( 'LIN_desc', __( "Line Item Description", "event_espresso" ), TRUE ),
121
-				'LIN_unit_price' 	=> new EE_Money_Field( 'LIN_unit_price', __( "Unit Price", "event_espresso" ), FALSE, 0 ),
122
-				'LIN_percent' 		=> new EE_Float_Field( 'LIN_percent', __( "Percent", "event_espresso" ), FALSE, 0 ),
123
-				'LIN_is_taxable' 	=> new EE_Boolean_Field( 'LIN_is_taxable', __( "Taxable", "event_espresso" ), FALSE, FALSE ),
124
-				'LIN_order' 			=> new EE_Integer_Field( 'LIN_order', __( "Order of Application towards total of parent", "event_espresso" ), FALSE, 1 ),
125
-				'LIN_total' 			=> new EE_Money_Field( 'LIN_total', __( "Total (unit price x quantity)", "event_espresso" ), FALSE, 0 ),
126
-				'LIN_quantity' 	=> new EE_Integer_Field( 'LIN_quantity', __( "Quantity", "event_espresso" ), TRUE, 1 ),
127
-				'LIN_parent' 		=> new EE_Integer_Field( 'LIN_parent', __( "Parent ID (this item goes towards that Line Item's total)", "event_espresso" ), TRUE, NULL ),
128
-				'LIN_type' 			=> new EE_Enum_Text_Field( 'LIN_type', __( "Type", "event_espresso" ), FALSE, 'line-item', array(
116
+				'LIN_ID' 				=> new EE_Primary_Key_Int_Field('LIN_ID', __("ID", "event_espresso")),
117
+				'LIN_code' 			=> new EE_Slug_Field('LIN_code', __("Code for index into Cart", "event_espresso"), TRUE),
118
+				'TXN_ID' 				=> new EE_Foreign_Key_Int_Field('TXN_ID', __("Transaction ID", "event_espresso"), TRUE, NULL, 'Transaction'),
119
+				'LIN_name' 			=> new EE_Full_HTML_Field('LIN_name', __("Line Item Name", "event_espresso"), FALSE, ''),
120
+				'LIN_desc' 			=> new EE_Full_HTML_Field('LIN_desc', __("Line Item Description", "event_espresso"), TRUE),
121
+				'LIN_unit_price' 	=> new EE_Money_Field('LIN_unit_price', __("Unit Price", "event_espresso"), FALSE, 0),
122
+				'LIN_percent' 		=> new EE_Float_Field('LIN_percent', __("Percent", "event_espresso"), FALSE, 0),
123
+				'LIN_is_taxable' 	=> new EE_Boolean_Field('LIN_is_taxable', __("Taxable", "event_espresso"), FALSE, FALSE),
124
+				'LIN_order' 			=> new EE_Integer_Field('LIN_order', __("Order of Application towards total of parent", "event_espresso"), FALSE, 1),
125
+				'LIN_total' 			=> new EE_Money_Field('LIN_total', __("Total (unit price x quantity)", "event_espresso"), FALSE, 0),
126
+				'LIN_quantity' 	=> new EE_Integer_Field('LIN_quantity', __("Quantity", "event_espresso"), TRUE, 1),
127
+				'LIN_parent' 		=> new EE_Integer_Field('LIN_parent', __("Parent ID (this item goes towards that Line Item's total)", "event_espresso"), TRUE, NULL),
128
+				'LIN_type' 			=> new EE_Enum_Text_Field('LIN_type', __("Type", "event_espresso"), FALSE, 'line-item', array(
129 129
 						self::type_line_item		=>  __("Line Item", "event_espresso"),
130 130
 						self::type_sub_line_item	=>  __("Sub-Item", "event_espresso"),
131 131
 						self::type_sub_total		=>  __("Subtotal", "event_espresso"),
132 132
 						self::type_tax_sub_total 	=> __("Tax Subtotal", "event_espresso"),
133 133
 						self::type_tax					=>  __("Tax", "event_espresso"),
134 134
 						self::type_total				=>  __("Total", "event_espresso"),
135
-						self::type_cancellation	=> __( 'Cancellation', 'event_espresso' )
135
+						self::type_cancellation	=> __('Cancellation', 'event_espresso')
136 136
 					)
137 137
 				),
138
-				'OBJ_ID' 					=> new EE_Foreign_Key_Int_Field( 'OBJ_ID', __( 'ID of Item purchased.', 'event_espresso' ), TRUE, NULL, $line_items_can_be_for ),
139
-				'OBJ_type'				=>new EE_Any_Foreign_Model_Name_Field( 'OBJ_type', __( "Model Name this Line Item is for", "event_espresso" ), TRUE, NULL, $line_items_can_be_for ),
140
-				'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created','event_espresso'), false, time(), $timezone ),
138
+				'OBJ_ID' 					=> new EE_Foreign_Key_Int_Field('OBJ_ID', __('ID of Item purchased.', 'event_espresso'), TRUE, NULL, $line_items_can_be_for),
139
+				'OBJ_type'				=>new EE_Any_Foreign_Model_Name_Field('OBJ_type', __("Model Name this Line Item is for", "event_espresso"), TRUE, NULL, $line_items_can_be_for),
140
+				'LIN_timestamp' => new EE_Datetime_Field('LIN_timestamp', __('When the line item was created', 'event_espresso'), false, time(), $timezone),
141 141
 			)
142 142
 		);
143 143
 		$this->_model_relations = array(
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 		);
149 149
 		$this->_model_chain_to_wp_user = 'Transaction.Registration.Event';
150 150
 		$this->_caps_slug = 'transactions';
151
-		parent::__construct( $timezone );
151
+		parent::__construct($timezone);
152 152
 	}
153 153
 
154 154
 
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 	 * @param EE_Transaction|int $transaction
160 160
 	 * @return EE_Line_Item[]
161 161
 	 */
162
-	public function get_all_of_type_for_transaction( $line_item_type, $transaction ){
163
-		$transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction );
164
-		return $this->get_all( array( array(
162
+	public function get_all_of_type_for_transaction($line_item_type, $transaction) {
163
+		$transaction = EEM_Transaction::instance()->ensure_is_ID($transaction);
164
+		return $this->get_all(array(array(
165 165
 			'LIN_type' => $line_item_type,
166 166
 			'TXN_ID' => $transaction
167 167
 		)));
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * @param EE_Transaction|int $transaction
176 176
 	 * @return \EE_Base_Class[]
177 177
 	 */
178
-	public function get_all_non_ticket_line_items_for_transaction( $transaction ) {
179
-		$transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction );
180
-		return $this->get_all( array( array(
178
+	public function get_all_non_ticket_line_items_for_transaction($transaction) {
179
+		$transaction = EEM_Transaction::instance()->ensure_is_ID($transaction);
180
+		return $this->get_all(array(array(
181 181
 			'LIN_type' => self::type_line_item,
182 182
 			'TXN_ID' => $transaction,
183 183
 			'OR' => array(
184
-				'OBJ_type*notticket' => array( '!=', 'Ticket'),
185
-				'OBJ_type*null' => array( 'IS_NULL' ))
184
+				'OBJ_type*notticket' => array('!=', 'Ticket'),
185
+				'OBJ_type*null' => array('IS_NULL'))
186 186
 		)));
187 187
 	}
188 188
 
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * because if there are spam bots afoot there will be LOTS of line items
193 193
 	 * @return int count of how many deleted
194 194
 	 */
195
-	public function delete_line_items_with_no_transaction(){
195
+	public function delete_line_items_with_no_transaction() {
196 196
 		/** @type WPDB $wpdb */
197 197
 		global $wpdb;
198 198
 		$time_to_leave_alone = apply_filters(
@@ -200,13 +200,13 @@  discard block
 block discarded – undo
200 200
 		);
201 201
 		$query = $wpdb->prepare(
202 202
 				'DELETE li
203
-				FROM ' . $this->table() . ' li
204
-				LEFT JOIN ' . EEM_Transaction::instance()->table(). ' t ON li.TXN_ID = t.TXN_ID
203
+				FROM ' . $this->table().' li
204
+				LEFT JOIN ' . EEM_Transaction::instance()->table().' t ON li.TXN_ID = t.TXN_ID
205 205
 				WHERE t.TXN_ID IS NULL AND li.LIN_timestamp < %s',
206 206
 				// use GMT time because that's what TXN_timestamps are in
207
-				gmdate(  'Y-m-d H:i:s', time() - $time_to_leave_alone )
207
+				gmdate('Y-m-d H:i:s', time() - $time_to_leave_alone)
208 208
 				);
209
-		return $wpdb->query( $query );
209
+		return $wpdb->query($query);
210 210
 	}
211 211
 
212 212
 
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 	 * @param \EE_Base_Class $object
220 220
 	 * @return EE_Line_Item[]
221 221
 	 */
222
-	public function get_line_item_for_transaction_object( $TXN_ID, EE_Base_Class $object ){
223
-		return $this->get_all( array( array(
222
+	public function get_line_item_for_transaction_object($TXN_ID, EE_Base_Class $object) {
223
+		return $this->get_all(array(array(
224 224
 			'TXN_ID' 		=> $TXN_ID,
225
-			'OBJ_type' 	=> str_replace( 'EE_', '', get_class( $object )),
225
+			'OBJ_type' 	=> str_replace('EE_', '', get_class($object)),
226 226
 			'OBJ_ID' 		=> $object->ID()
227 227
 		)));
228 228
 	}
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 	 * @param array $OBJ_IDs
239 239
 	 * @return EE_Line_Item[]
240 240
 	 */
241
-	public function get_object_line_items_for_transaction( $TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array() ){
241
+	public function get_object_line_items_for_transaction($TXN_ID, $OBJ_type = 'Event', $OBJ_IDs = array()) {
242 242
 		$query_params = array(
243 243
 			'OBJ_type' 	=> $OBJ_type,
244 244
 			// if incoming $OBJ_IDs is an array, then make sure it is formatted correctly for the query
245
-			'OBJ_ID' 		=> is_array( $OBJ_IDs ) && ! isset( $OBJ_IDs['IN'] ) ? array( 'IN', $OBJ_IDs ) : $OBJ_IDs
245
+			'OBJ_ID' 		=> is_array($OBJ_IDs) && ! isset($OBJ_IDs['IN']) ? array('IN', $OBJ_IDs) : $OBJ_IDs
246 246
 		);
247
-		if ( $TXN_ID ) {
247
+		if ($TXN_ID) {
248 248
 			$query_params['TXN_ID'] = $TXN_ID;
249 249
 		}
250
-		return $this->get_all( array( $query_params ));
250
+		return $this->get_all(array($query_params));
251 251
 	}
252 252
 
253 253
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param EE_Promotion $promotion
263 263
 	 * @return EE_Line_Item
264 264
 	 */
265
-	public function get_existing_promotion_line_item( EE_Line_Item $parent_line_item, EE_Promotion $promotion ) {
266
-		return $this->get_one( array(
265
+	public function get_existing_promotion_line_item(EE_Line_Item $parent_line_item, EE_Promotion $promotion) {
266
+		return $this->get_one(array(
267 267
 			array(
268 268
 				'TXN_ID' 			=> $parent_line_item->TXN_ID(),
269 269
 				'LIN_parent' 	=> $parent_line_item->ID(),
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	 * @param EE_Line_Item $parent_line_item
285 285
 	 * @return EE_Line_Item[]
286 286
 	 */
287
-	public function get_all_promotion_line_items( EE_Line_Item $parent_line_item ) {
288
-		return $this->get_all( array(
287
+	public function get_all_promotion_line_items(EE_Line_Item $parent_line_item) {
288
+		return $this->get_all(array(
289 289
 			array(
290 290
 				'TXN_ID' 			=> $parent_line_item->TXN_ID(),
291 291
 				'LIN_parent' 	=> $parent_line_item->ID(),
@@ -302,8 +302,8 @@  discard block
 block discarded – undo
302 302
 	 * @param EE_Registration $registration
303 303
 	 * @return EEM_Line_ITem
304 304
 	 */
305
-	public function get_line_item_for_registration( EE_Registration $registration ) {
306
-		return $this->get_one( $this->line_item_for_registration_query_params( $registration ));
305
+	public function get_line_item_for_registration(EE_Registration $registration) {
306
+		return $this->get_one($this->line_item_for_registration_query_params($registration));
307 307
 	}
308 308
 
309 309
 	/**
@@ -312,14 +312,14 @@  discard block
 block discarded – undo
312 312
 	 * @param array $original_query_params any extra query params you'd like to be merged with
313 313
 	 * @return array like EEM_Base::get_all()'s $query_params
314 314
 	 */
315
-	public function line_item_for_registration_query_params( EE_Registration $registration, $original_query_params = array() ) {
316
-		return array_replace_recursive( $original_query_params, array(
315
+	public function line_item_for_registration_query_params(EE_Registration $registration, $original_query_params = array()) {
316
+		return array_replace_recursive($original_query_params, array(
317 317
 			array(
318 318
 				'OBJ_ID' => $registration->ticket_ID(),
319 319
 				'OBJ_type' => 'Ticket',
320 320
 				'TXN_ID' => $registration->transaction_ID()
321 321
 			)
322
-		) );
322
+		));
323 323
 	}
324 324
 
325 325
 
Please login to merge, or discard this patch.
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/fields/EE_Datetime_Field.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@
 block discarded – undo
503 503
 	 * This prepares the datetime for internal usage as a PHP DateTime object OR null (if nullable is
504 504
 	 * allowed)
505 505
 	 * @param string $datetime_string mysql timestamp in UTC
506
-	 * @return  mixed null | DateTime
506
+	 * @return  null|DateTime null | DateTime
507 507
 	 */
508 508
 	public function prepare_for_set_from_db( $datetime_string ) {
509 509
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@
 block discarded – undo
459 459
 				//must be explicit because schema could equal true.
460 460
 				if( $schema === 'no_html' ){
461 461
 					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
462
-				}else{
462
+				} else{
463 463
 					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
464 464
 				}
465 465
 			} else {
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 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
  * EE_Datetime_Field
@@ -111,15 +111,15 @@  discard block
 block discarded – undo
111 111
 	 * @param string 	$pretty_date_format
112 112
 	 * @param string 	$pretty_time_format
113 113
 	 */
114
-	public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '' ){
114
+	public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone_string = '', $date_format = '', $time_format = '', $pretty_date_format = '', $pretty_time_format = '') {
115 115
 
116
-		$this->_date_format = ! empty( $date_format ) ? $date_format : get_option('date_format');
117
-		$this->_time_format = ! empty( $time_format ) ? $time_format : get_option('time_format');
118
-		$this->_pretty_date_format = ! empty( $pretty_date_format ) ? $pretty_date_format : get_option('date_format');
119
-		$this->_pretty_time_format = ! empty( $pretty_time_format ) ? $pretty_time_format : get_option('time_format');
116
+		$this->_date_format = ! empty($date_format) ? $date_format : get_option('date_format');
117
+		$this->_time_format = ! empty($time_format) ? $time_format : get_option('time_format');
118
+		$this->_pretty_date_format = ! empty($pretty_date_format) ? $pretty_date_format : get_option('date_format');
119
+		$this->_pretty_time_format = ! empty($pretty_time_format) ? $pretty_time_format : get_option('time_format');
120 120
 
121
-		parent::__construct( $table_column, $nice_name, $nullable, $default_value );
122
-		$this->set_timezone( $timezone_string );
121
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
122
+		$this->set_timezone($timezone_string);
123 123
 
124 124
 	}
125 125
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 	 * @return DateTimeZone
139 139
 	 */
140 140
 	public function get_UTC_DateTimeZone() {
141
-		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string( 'UTC' );
141
+		return $this->_UTC_DateTimeZone instanceof DateTimeZone ? $this->_UTC_DateTimeZone : $this->_create_timezone_object_from_timezone_string('UTC');
142 142
 	}
143 143
 
144 144
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return DateTimeZone
148 148
 	 */
149 149
 	public function get_blog_DateTimeZone() {
150
-		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string( '' );
150
+		return $this->_blog_DateTimeZone instanceof DateTimeZone ? $this->_blog_DateTimeZone : $this->_create_timezone_object_from_timezone_string('');
151 151
 	}
152 152
 
153 153
 
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
 	 * @param  string|int $value_inputted_for_field_on_model_object could be a string formatted date time or int unix timestamp
158 158
 	 * @return DateTime
159 159
 	 */
160
-	public function prepare_for_set( $value_inputted_for_field_on_model_object ) {
161
-		return $this->_get_date_object( $value_inputted_for_field_on_model_object );
160
+	public function prepare_for_set($value_inputted_for_field_on_model_object) {
161
+		return $this->_get_date_object($value_inputted_for_field_on_model_object);
162 162
 	}
163 163
 
164 164
 
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 	 * @param bool $pretty If we're returning the pretty formats or standard format string.
175 175
 	 * @return string    The final assembled format string.
176 176
 	 */
177
-	protected function _get_date_time_output( $pretty = FALSE ) {
177
+	protected function _get_date_time_output($pretty = FALSE) {
178 178
 
179
-		switch ( $this->_date_time_output ) {
179
+		switch ($this->_date_time_output) {
180 180
 			case 'time' :
181 181
 				return $pretty ? $this->_pretty_time_format : $this->_time_format;
182 182
 				break;
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 				break;
187 187
 
188 188
 			default :
189
-				return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format;
189
+				return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format;
190 190
 		}
191 191
 	}
192 192
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @param string $what acceptable values are 'time' or 'date'.  Any other value will be set but will always result in both 'date' and 'time' being returned.
201 201
 	 * @return void
202 202
 	 */
203
-	public function set_date_time_output( $what = NULL ) {
203
+	public function set_date_time_output($what = NULL) {
204 204
 		$this->_date_time_output = $what;
205 205
 	}
206 206
 
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 	 * @param string $timezone_string A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php
217 217
 	 * @return void
218 218
 	 */
219
-	public function set_timezone( $timezone_string ) {
220
-		if( empty( $timezone_string ) && $this->_timezone_string != NULL ){
219
+	public function set_timezone($timezone_string) {
220
+		if (empty($timezone_string) && $this->_timezone_string != NULL) {
221 221
 			// leave the timezone AS-IS if we already have one and
222 222
 			// the function arg didn't provide one
223 223
 			return;
224 224
 		}
225
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
226
-		$this->_timezone_string = ! empty( $timezone_string ) ? $timezone_string : 'UTC';
227
-		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string( $this->_timezone_string );
225
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
226
+		$this->_timezone_string = ! empty($timezone_string) ? $timezone_string : 'UTC';
227
+		$this->_DateTimeZone = $this->_create_timezone_object_from_timezone_string($this->_timezone_string);
228 228
 	}
229 229
 
230 230
 
@@ -236,8 +236,8 @@  discard block
 block discarded – undo
236 236
 	 * @param string $timezone_string
237 237
 	 * @return \DateTimeZone
238 238
 	 */
239
-	protected function _create_timezone_object_from_timezone_string( $timezone_string = '' ) {
240
-		return new DateTimeZone( EEH_DTT_Helper::get_valid_timezone_string( $timezone_string ) );
239
+	protected function _create_timezone_object_from_timezone_string($timezone_string = '') {
240
+		return new DateTimeZone(EEH_DTT_Helper::get_valid_timezone_string($timezone_string));
241 241
 	}
242 242
 
243 243
 
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	 * @param bool   $pretty Whether to set pretty format or not.
263 263
 	 * @return void
264 264
 	 */
265
-	public function set_date_format( $format, $pretty = false ) {
266
-		if ( $pretty ) {
265
+	public function set_date_format($format, $pretty = false) {
266
+		if ($pretty) {
267 267
 			$this->_pretty_date_format = $format;
268 268
 		} else {
269 269
 			$this->_date_format = $format;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @param bool   $pretty Whether to get pretty format or not.
279 279
 	 * @return string
280 280
 	 */
281
-	public function get_date_format( $pretty = false ) {
281
+	public function get_date_format($pretty = false) {
282 282
 		return $pretty ? $this->_pretty_date_format : $this->_date_format;
283 283
 	}
284 284
 
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 * @param bool   $pretty Whether to set pretty format or not.
294 294
 	 * @return void
295 295
 	 */
296
-	public function set_time_format( $format, $pretty = false ) {
297
-		if ( $pretty ) {
296
+	public function set_time_format($format, $pretty = false) {
297
+		if ($pretty) {
298 298
 			$this->_pretty_time_format = $format;
299 299
 		} else {
300 300
 			$this->_time_format = $format;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 	 * @param bool   $pretty Whether to get pretty format or not.
310 310
 	 * @return string
311 311
 	 */
312
-	public function get_time_format( $pretty = false ) {
312
+	public function get_time_format($pretty = false) {
313 313
 		return $pretty ? $this->_pretty_time_format : $this->_time_format;
314 314
 	}
315 315
 
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 	 * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function)
325 325
 	 * @return void
326 326
 	 */
327
-	public function set_pretty_date_format( $format ) {
327
+	public function set_pretty_date_format($format) {
328 328
 		$this->_pretty_date_format = $format;
329 329
 	}
330 330
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 	 * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function)
342 342
 	 * @return void
343 343
 	 */
344
-	public function set_pretty_time_format( $format ) {
344
+	public function set_pretty_time_format($format) {
345 345
 		$this->_pretty_time_format = $format;
346 346
 	}
347 347
 
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
 	 * @param DateTime    $current current DateTime object for the datetime field
354 354
 	 * @return DateTime
355 355
 	 */
356
-	public function prepare_for_set_with_new_time( $time_to_set_string, DateTime $current ){
356
+	public function prepare_for_set_with_new_time($time_to_set_string, DateTime $current) {
357 357
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
358
-		if ( $time_to_set_string instanceof DateTime ) {
358
+		if ($time_to_set_string instanceof DateTime) {
359 359
 			$parsed = array(
360 360
 				'hour' => $time_to_set_string->format('H'),
361 361
 				'minute' => $time_to_set_string->format('i'),
@@ -363,12 +363,12 @@  discard block
 block discarded – undo
363 363
 				);
364 364
 		} else {
365 365
 			//parse incoming string
366
-			$parsed = date_parse_from_format( $this->_time_format, $time_to_set_string );
366
+			$parsed = date_parse_from_format($this->_time_format, $time_to_set_string);
367 367
 		}
368 368
 
369 369
 		//make sure $current is in the correct timezone.
370
-		$current->setTimezone( $this->_DateTimeZone );
371
-		return $current->setTime( $parsed['hour'], $parsed['minute'], $parsed['second'] );
370
+		$current->setTimezone($this->_DateTimeZone);
371
+		return $current->setTime($parsed['hour'], $parsed['minute'], $parsed['second']);
372 372
 	}
373 373
 
374 374
 
@@ -379,9 +379,9 @@  discard block
 block discarded – undo
379 379
 	 * @param DateTime    $current current DateTime object for the datetime field
380 380
 	 * @return DateTime
381 381
 	 */
382
-	public function prepare_for_set_with_new_date( $date_to_set_string, DateTime $current ){
382
+	public function prepare_for_set_with_new_date($date_to_set_string, DateTime $current) {
383 383
 		//if $time_to_set_string is datetime object, then let's use it to set the parse array.  Otherwise parse the string.
384
-		if ( $date_to_set_string instanceof DateTime ) {
384
+		if ($date_to_set_string instanceof DateTime) {
385 385
 			$parsed = array(
386 386
 				'year' => $date_to_set_string->format('Y'),
387 387
 				'month' => $date_to_set_string->format('m'),
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 				);
390 390
 		} else {
391 391
 			//parse incoming string
392
-			$parsed = date_parse_from_format( $this->_date_format, $date_to_set_string );
392
+			$parsed = date_parse_from_format($this->_date_format, $date_to_set_string);
393 393
 		}
394 394
 
395 395
 		//make sure $current is in the correct timezone
396
-		$current->setTimezone( $this->_DateTimeZone );
397
-		return $current->setDate( $parsed['year'], $parsed['month'], $parsed['day'] );
396
+		$current->setTimezone($this->_DateTimeZone);
397
+		return $current->setDate($parsed['year'], $parsed['month'], $parsed['day']);
398 398
 	}
399 399
 
400 400
 
@@ -406,8 +406,8 @@  discard block
 block discarded – undo
406 406
 	 * @param  DateTime $DateTime
407 407
 	 * @return string formatted date time for given timezone
408 408
 	 */
409
-	public function prepare_for_get( $DateTime ) {
410
-		return $this->_prepare_for_display( $DateTime  );
409
+	public function prepare_for_get($DateTime) {
410
+		return $this->_prepare_for_display($DateTime);
411 411
 	}
412 412
 
413 413
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	 * @param null     $schema
423 423
 	 * @return string
424 424
 	 */
425
-	public function prepare_for_pretty_echoing( $DateTime, $schema = null ) {
426
-		return $this->_prepare_for_display( $DateTime, $schema ? $schema : true );
425
+	public function prepare_for_pretty_echoing($DateTime, $schema = null) {
426
+		return $this->_prepare_for_display($DateTime, $schema ? $schema : true);
427 427
 	}
428 428
 
429 429
 
@@ -437,36 +437,36 @@  discard block
 block discarded – undo
437 437
 	 * @return string
438 438
 	 * @throws \EE_Error
439 439
 	 */
440
-	protected function _prepare_for_display( $DateTime, $schema = false ) {
441
-		if ( ! $DateTime instanceof DateTime  ) {
442
-			if ( $this->_nullable ) {
440
+	protected function _prepare_for_display($DateTime, $schema = false) {
441
+		if ( ! $DateTime instanceof DateTime) {
442
+			if ($this->_nullable) {
443 443
 				return '';
444 444
 			} else {
445
-				if ( WP_DEBUG ) {
446
-					throw new EE_Error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso' ), $this->_nicename ) );
445
+				if (WP_DEBUG) {
446
+					throw new EE_Error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.', 'event_espresso'), $this->_nicename));
447 447
 				} else {
448
-					$DateTime = new DateTime( "now" );
449
-					EE_Error::add_error( sprintf( __('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso' ), $this->_nicename ) );
448
+					$DateTime = new DateTime("now");
449
+					EE_Error::add_error(sprintf(__('EE_Datetime_Field::_prepare_for_display requires a DateTime class to be the value for the $DateTime argument because the %s field is not nullable.  When WP_DEBUG is false, the value is set to "now" instead of throwing an exception.', 'event_espresso'), $this->_nicename));
450 450
 				}
451 451
 			}
452 452
 		}
453
-		$format_string = $this->_get_date_time_output( $schema );
453
+		$format_string = $this->_get_date_time_output($schema);
454 454
 		//make sure datetime_value is in the correct timezone (in case that's been updated).
455
-		$DateTime->setTimezone( $this->_DateTimeZone );
456
-		if ( $schema ) {
457
-			if( $this->_display_timezone() ) {
455
+		$DateTime->setTimezone($this->_DateTimeZone);
456
+		if ($schema) {
457
+			if ($this->_display_timezone()) {
458 458
 				//must be explicit because schema could equal true.
459
-				if( $schema === 'no_html' ){
460
-					$timezone_string = ' (' . $DateTime->format( 'T' )  . ')';
461
-				}else{
462
-					$timezone_string = ' <span class="ee_dtt_timezone_string">(' . $DateTime->format( 'T' ) . ')</span>';
459
+				if ($schema === 'no_html') {
460
+					$timezone_string = ' ('.$DateTime->format('T').')';
461
+				} else {
462
+					$timezone_string = ' <span class="ee_dtt_timezone_string">('.$DateTime->format('T').')</span>';
463 463
 				}
464 464
 			} else {
465 465
 				$timezone_string = '';
466 466
 			}
467
-			return $DateTime->format( $format_string ) . $timezone_string;
467
+			return $DateTime->format($format_string).$timezone_string;
468 468
 		} else {
469
-			return $DateTime->format( $format_string );
469
+			return $DateTime->format($format_string);
470 470
 		}
471 471
 	}
472 472
 
@@ -480,18 +480,18 @@  discard block
 block discarded – undo
480 480
 	 * @return string mysql timestamp in UTC
481 481
 	 * @throws \EE_Error
482 482
 	 */
483
-	public function prepare_for_use_in_db( $datetime_value ) {
483
+	public function prepare_for_use_in_db($datetime_value) {
484 484
 		//we allow an empty value or DateTime object, but nothing else.
485
-		if ( ! empty( $datetime_value ) && ! $datetime_value instanceof DateTime ) {
486
-			throw new EE_Error( __('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso' ) );
485
+		if ( ! empty($datetime_value) && ! $datetime_value instanceof DateTime) {
486
+			throw new EE_Error(__('The incoming value being prepared for setting in the database must either be empty or a php DateTime object', 'event_espresso'));
487 487
 		}
488 488
 
489
-		if ( $datetime_value instanceof DateTime ) {
490
-			return $datetime_value->setTimezone( $this->get_UTC_DateTimeZone() )->format( EE_Datetime_Field::mysql_timestamp_format );
489
+		if ($datetime_value instanceof DateTime) {
490
+			return $datetime_value->setTimezone($this->get_UTC_DateTimeZone())->format(EE_Datetime_Field::mysql_timestamp_format);
491 491
 		}
492 492
 
493 493
 		// if $datetime_value is empty, and ! $this->_nullable, use current_time() but set the GMT flag to true
494
-		return ! $this->_nullable && empty( $datetime_value ) ? current_time( 'mysql', true ) : null;
494
+		return ! $this->_nullable && empty($datetime_value) ? current_time('mysql', true) : null;
495 495
 	}
496 496
 
497 497
 
@@ -504,20 +504,20 @@  discard block
 block discarded – undo
504 504
 	 * @param string $datetime_string mysql timestamp in UTC
505 505
 	 * @return  mixed null | DateTime
506 506
 	 */
507
-	public function prepare_for_set_from_db( $datetime_string ) {
507
+	public function prepare_for_set_from_db($datetime_string) {
508 508
 		//if $datetime_value is empty, and ! $this->_nullable, just use time()
509
-		if ( empty( $datetime_string) && $this->_nullable ) {
509
+		if (empty($datetime_string) && $this->_nullable) {
510 510
 			return null;
511 511
 		}
512 512
 		// datetime strings from the db should ALWAYS be in UTC+0, so use UTC_DateTimeZone when creating
513
-		$DateTime = empty( $datetime_string ) ? new DateTime( 'now', $this->get_UTC_DateTimeZone() ) : DateTime::createFromFormat( EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone() );
513
+		$DateTime = empty($datetime_string) ? new DateTime('now', $this->get_UTC_DateTimeZone()) : DateTime::createFromFormat(EE_Datetime_Field::mysql_timestamp_format, $datetime_string, $this->get_UTC_DateTimeZone());
514 514
 
515
-		if ( ! $DateTime instanceof DateTime ) {
515
+		if ( ! $DateTime instanceof DateTime) {
516 516
 			//if still no datetime object, then let's just use now
517
-			$DateTime = new DateTime( 'now', $this->get_UTC_DateTimeZone() );
517
+			$DateTime = new DateTime('now', $this->get_UTC_DateTimeZone());
518 518
 		}
519 519
 		// THEN apply the field's set DateTimeZone
520
-		$DateTime->setTimezone( $this->_DateTimeZone );
520
+		$DateTime->setTimezone($this->_DateTimeZone);
521 521
 		return $DateTime;
522 522
 	}
523 523
 
@@ -534,15 +534,15 @@  discard block
 block discarded – undo
534 534
 	protected function _display_timezone() {
535 535
 
536 536
 		// first let's do a comparison of timezone strings.  If they match then we can get out without any further calculations
537
-		$blog_string = get_option( 'timezone_string' );
538
-		if ( $blog_string == $this->_timezone_string ) {
537
+		$blog_string = get_option('timezone_string');
538
+		if ($blog_string == $this->_timezone_string) {
539 539
 			return FALSE;
540 540
 		}
541 541
 		// now we need to calc the offset for the timezone string so we can compare with the blog offset.
542
-		$this_offset = $this->get_timezone_offset( $this->_DateTimeZone );
543
-		$blog_offset = $this->get_timezone_offset( $this->get_blog_DateTimeZone() );
542
+		$this_offset = $this->get_timezone_offset($this->_DateTimeZone);
543
+		$blog_offset = $this->get_timezone_offset($this->get_blog_DateTimeZone());
544 544
 		// now compare
545
-		if ( $blog_offset === $this_offset ) {
545
+		if ($blog_offset === $this_offset) {
546 546
 			return FALSE;
547 547
 		}
548 548
 		return TRUE;
@@ -560,24 +560,24 @@  discard block
 block discarded – undo
560 560
 	 *
561 561
 	 * @return DateTime
562 562
 	 */
563
-	protected function _get_date_object( $date_string ) {
563
+	protected function _get_date_object($date_string) {
564 564
 		//first if this is an empty date_string and nullable is allowed, just return null.
565
-		if ( $this->_nullable && empty( $date_string ) ) {
565
+		if ($this->_nullable && empty($date_string)) {
566 566
 			return null;
567 567
 		}
568 568
 
569 569
 		// if incoming date
570
-		if ( $date_string instanceof DateTime ) {
571
-			$date_string->setTimezone( $this->_DateTimeZone );
570
+		if ($date_string instanceof DateTime) {
571
+			$date_string->setTimezone($this->_DateTimeZone);
572 572
 			return $date_string;
573 573
 		}
574 574
 		// if empty date_string and made it here.
575 575
 		// Return a datetime object for now in the given timezone.
576
-		if ( empty( $date_string ) ) {
577
-			return new DateTime( "now", $this->_DateTimeZone );
576
+		if (empty($date_string)) {
577
+			return new DateTime("now", $this->_DateTimeZone);
578 578
 		}
579 579
 		// if $date_string is matches something that looks like a Unix timestamp let's just use it.
580
-		if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $date_string ) ) {
580
+		if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $date_string)) {
581 581
 			try {
582 582
 				/**
583 583
 				 * This is operating under the assumption that the incoming Unix timestamp is
@@ -585,29 +585,29 @@  discard block
 block discarded – undo
585 585
 				 * current_time('timestamp');
586 586
 				 *
587 587
 				 */
588
-				$DateTime = new DateTime( "now", $this->_DateTimeZone );
589
-				return $DateTime->setTimestamp( $date_string );
590
-			 } catch ( Exception $e )  {
588
+				$DateTime = new DateTime("now", $this->_DateTimeZone);
589
+				return $DateTime->setTimestamp($date_string);
590
+			 } catch (Exception $e) {
591 591
 			 	// should be rare, but if things got fooled then let's just continue
592 592
 			 }
593 593
 		}
594 594
 		//not a unix timestamp.  So we will use the set format on this object and set timezone to
595 595
 		//create the DateTime object.
596
-		$format = $this->_date_format . ' ' . $this->_time_format;
596
+		$format = $this->_date_format.' '.$this->_time_format;
597 597
 		try {
598
-			$DateTime = DateTime::createFromFormat( $format, $date_string, $this->_DateTimeZone );
599
-			if ( ! $DateTime instanceof DateTime ) {
598
+			$DateTime = DateTime::createFromFormat($format, $date_string, $this->_DateTimeZone);
599
+			if ( ! $DateTime instanceof DateTime) {
600 600
 				throw new EE_Error(
601 601
 					sprintf(
602
-						__( '"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso' ),
602
+						__('"%1$s" does not represent a valid Date Time in the format "%2$s".', 'event_espresso'),
603 603
 						$date_string,
604 604
 						$format
605 605
 					)
606 606
 				);
607 607
 			}
608
-		} catch ( Exception $e ) {
608
+		} catch (Exception $e) {
609 609
 			// if we made it here then likely then something went really wrong.  Instead of throwing an exception, let's just return a DateTime object for now, in the set timezone.
610
-			$DateTime = new DateTime( "now", $this->_DateTimeZone );
610
+			$DateTime = new DateTime("now", $this->_DateTimeZone);
611 611
 		}
612 612
 		return $DateTime;
613 613
 	}
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 	 * @param null          $time
622 622
 	 * @return mixed
623 623
 	 */
624
-	public function get_timezone_offset( DateTimeZone $DateTimeZone, $time = null ) {
625
-		$time = preg_match( EE_Datetime_Field::unix_timestamp_regex, $time ) ? $time : time();
626
-		$transitions = $DateTimeZone->getTransitions( $time );
624
+	public function get_timezone_offset(DateTimeZone $DateTimeZone, $time = null) {
625
+		$time = preg_match(EE_Datetime_Field::unix_timestamp_regex, $time) ? $time : time();
626
+		$transitions = $DateTimeZone->getTransitions($time);
627 627
 		return $transitions[0]['offset'];
628 628
 	}
629 629
 
@@ -635,10 +635,10 @@  discard block
 block discarded – undo
635 635
 	 * @param  string $timezone_string
636 636
 	 * @return string           abbreviation
637 637
 	 */
638
-	public function get_timezone_abbrev( $timezone_string ) {
639
-		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string( $timezone_string );
640
-		$dateTime = new DateTime( 'now', new DateTimeZone( $timezone_string ) );
641
-		return $dateTime->format( 'T' );
638
+	public function get_timezone_abbrev($timezone_string) {
639
+		$timezone_string = EEH_DTT_Helper::get_valid_timezone_string($timezone_string);
640
+		$dateTime = new DateTime('now', new DateTimeZone($timezone_string));
641
+		return $dateTime->format('T');
642 642
 	}
643 643
 
644 644
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Field_With_Model_Name.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Returns the name of the model(s) pointed to
29 29
 	 * @deprecated since version 4.6.7
30
-	 * @return mixed string or array of strings
30
+	 * @return string string or array of strings
31 31
 	 */
32 32
 	function get_model_name_pointed_to(){
33 33
 		EE_Error::doing_it_wrong( 'get_model_name_pointed_to', __( 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', 'event_espresso' ), '4.6.7' );
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * with the EE_Foreign_Key_Field to create a relation between any two models)
6 6
  * also required basically the exact same functionality, except NOT be a foreign key.
7 7
  */
8
-abstract class EE_Field_With_Model_Name extends EE_Model_Field_Base{
8
+abstract class EE_Field_With_Model_Name extends EE_Model_Field_Base {
9 9
 	/**
10 10
 	 * Usually the name of a single model. However, as in the case for custom post types,
11 11
 	 * it can actually be an array of models
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param mixed $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul dbe a string
21 21
 	 * @param string $model_name eg 'Event','Answer','Term', etc. Basically its the model class's name without the "EEM_"
22 22
 	 */
23
-	function __construct($table_column, $nicename, $nullable, $default_value,$model_name){
23
+	function __construct($table_column, $nicename, $nullable, $default_value, $model_name) {
24 24
 		$this->_model_name_pointed_to = $model_name;
25 25
 		parent::__construct($table_column, $nicename, $nullable, $default_value);
26 26
 	}
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 * @deprecated since version 4.6.7
30 30
 	 * @return mixed string or array of strings
31 31
 	 */
32
-	function get_model_name_pointed_to(){
33
-		EE_Error::doing_it_wrong( 'get_model_name_pointed_to', __( 'This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', 'event_espresso' ), '4.6.7' );
32
+	function get_model_name_pointed_to() {
33
+		EE_Error::doing_it_wrong('get_model_name_pointed_to', __('This method has been deprecated in favour of instead using get_model_names_pointed_to, which consistently returns an array', 'event_espresso'), '4.6.7');
34 34
 		return $this->_model_name_pointed_to;
35 35
 	}
36 36
 	/**
@@ -39,31 +39,31 @@  discard block
 block discarded – undo
39 39
 	 * @return array of model names pointed to by this field
40 40
 	 */
41 41
 	function get_model_names_pointed_to() {
42
-		if( is_array( $this->_model_name_pointed_to ) ) {
42
+		if (is_array($this->_model_name_pointed_to)) {
43 43
 			return $this->_model_name_pointed_to;
44
-		}else{
45
-			return array( $this->_model_name_pointed_to );
44
+		} else {
45
+			return array($this->_model_name_pointed_to);
46 46
 		}
47 47
 	}
48 48
 	/**
49 49
 	 * Returns the model's classname (eg EE_Event instead of just Event)
50 50
 	 * @return array
51 51
 	 */
52
-	function get_model_class_names_pointed_to(){
52
+	function get_model_class_names_pointed_to() {
53 53
 		$model_names = array();
54
-		if(is_array($this->_model_name_pointed_to)){
55
-			foreach($this->_model_name_pointed_to as $model_name){
54
+		if (is_array($this->_model_name_pointed_to)) {
55
+			foreach ($this->_model_name_pointed_to as $model_name) {
56 56
 				$model_names[] = "EE_".$model_name;
57 57
 			}
58
-		}else{
58
+		} else {
59 59
 			$model_names = array("EE_".$this->_model_name_pointed_to);
60 60
 		}
61 61
 		return $model_names;
62 62
 	}
63 63
 
64
-	function is_model_obj_of_type_pointed_to($model_obj_or_ID){
65
-		foreach($this->get_model_class_names_pointed_to() as $model_obj_classname){
66
-			if($model_obj_or_ID instanceof $model_obj_classname){
64
+	function is_model_obj_of_type_pointed_to($model_obj_or_ID) {
65
+		foreach ($this->get_model_class_names_pointed_to() as $model_obj_classname) {
66
+			if ($model_obj_or_ID instanceof $model_obj_classname) {
67 67
 				return true;
68 68
 			}
69 69
 		}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	function get_model_names_pointed_to() {
42 42
 		if( is_array( $this->_model_name_pointed_to ) ) {
43 43
 			return $this->_model_name_pointed_to;
44
-		}else{
44
+		} else{
45 45
 			return array( $this->_model_name_pointed_to );
46 46
 		}
47 47
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			foreach($this->_model_name_pointed_to as $model_name){
56 56
 				$model_names[] = "EE_".$model_name;
57 57
 			}
58
-		}else{
58
+		} else{
59 59
 			$model_names = array("EE_".$this->_model_name_pointed_to);
60 60
 		}
61 61
 		return $model_names;
Please login to merge, or discard this patch.