Completed
Branch TASK-10272-slack-badge (91344b)
by
unknown
117:31 queued 106:02
created
core/db_models/EEM_Datetime.model.php 4 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	/**
78
-	*		create new blank datetime
79
-	*
80
-	* 		@access		public
81
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
82
-	*/
78
+	 *		create new blank datetime
79
+	 *
80
+	 * 		@access		public
81
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
82
+	 */
83 83
 	public function create_new_blank_datetime() {
84 84
 		$blank_datetime = EE_Datetime::new_instance(
85 85
 			array(
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 
102 102
 	/**
103
-	*		get event start date from db
104
-	*
105
-	* 		@access		public
106
-	* 		@param		int 			$EVT_ID
107
-	*		@return 		EE_Datetime[]		array on success, FALSE on fail
108
-	*/
103
+	 *		get event start date from db
104
+	 *
105
+	 * 		@access		public
106
+	 * 		@param		int 			$EVT_ID
107
+	 *		@return 		EE_Datetime[]		array on success, FALSE on fail
108
+	 */
109 109
 	public function get_all_event_dates( $EVT_ID = 0 ) {
110 110
 		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
111 111
 			return $this->create_new_blank_datetime();
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 	}
251 251
 
252 252
 		/**
253
-	 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
-	 * only by start date
255
-	 * @param int $TKT_ID
256
-	 * @param boolean $include_expired
257
-	 * @param boolean $include_deleted
258
-	 * @param int $limit
259
-	 * @return EE_Datetime[]
260
-	 */
253
+		 * Gets ALL the datetimes for an ticket (including trashed ones, for now), ordered
254
+		 * only by start date
255
+		 * @param int $TKT_ID
256
+		 * @param boolean $include_expired
257
+		 * @param boolean $include_deleted
258
+		 * @param int $limit
259
+		 * @return EE_Datetime[]
260
+		 */
261 261
 	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
262 262
 		//sanitize TKT_ID
263 263
 		$TKT_ID =  intval( $TKT_ID );
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -443,7 +443,7 @@
 block discarded – undo
443 443
 	/**
444 444
 	 * This returns an array of counts of datetimes in the database for each Datetime status that can be queried.
445 445
 	 *
446
-	 * @param  array $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
446
+	 * @param  string[] $stati_to_include        If included you can restrict the statuses we return counts for by including the stati
447 447
 	 *                               you want counts for as values in the array.  An empty array returns counts for all valid
448 448
 	 *                               stati.
449 449
 	 * @param  array  $query_params  If included can be used to refine the conditions for returning the count (i.e. only for
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@  discard block
 block discarded – undo
21 21
  *
22 22
  * ------------------------------------------------------------------------
23 23
  */
24
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
25
-require_once ( EE_CLASSES . 'EE_Datetime.class.php' );
24
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
25
+require_once (EE_CLASSES.'EE_Datetime.class.php');
26 26
 
27 27
 class EEM_Datetime extends EEM_Soft_Delete_Base {
28 28
 
@@ -35,28 +35,28 @@  discard block
 block discarded – undo
35 35
 	 *		@access private
36 36
 	 *		@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)
37 37
 	 */
38
-	protected function __construct( $timezone ) {
39
-		$this->singular_item = __('Datetime','event_espresso');
40
-		$this->plural_item = __('Datetimes','event_espresso');
38
+	protected function __construct($timezone) {
39
+		$this->singular_item = __('Datetime', 'event_espresso');
40
+		$this->plural_item = __('Datetimes', 'event_espresso');
41 41
 
42 42
 		$this->_tables = array(
43 43
 			'Datetime'=> new EE_Primary_Table('esp_datetime', 'DTT_ID')
44 44
 		);
45 45
 		$this->_fields = array(
46 46
 			'Datetime'=>array(
47
-				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID','event_espresso')),
48
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
47
+				'DTT_ID'=> new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')),
48
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
49 49
 				'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''),
50 50
 				'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''),
51
-				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
52
-				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event','event_espresso'), false, EE_Datetime_Field::now, $timezone ),
53
-				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time','event_espresso'), true, EE_INF),
54
-				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0 ),
55
-				'DTT_reserved' => new EE_Integer_Field('DTT_reserved',__('Quantity of tickets that are reserved, but not yet fully purchased','event_espresso'),false,0),
56
-				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false,false),
51
+				'DTT_EVT_start'=>new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
52
+				'DTT_EVT_end'=>new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, EE_Datetime_Field::now, $timezone),
53
+				'DTT_reg_limit'=>new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF),
54
+				'DTT_sold'=>new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0),
55
+				'DTT_reserved' => new EE_Integer_Field('DTT_reserved', __('Quantity of tickets that are reserved, but not yet fully purchased', 'event_espresso'), false, 0),
56
+				'DTT_is_primary'=>new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false),
57 57
 				'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0),
58
-				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0 ),
59
-				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false ),
58
+				'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0),
59
+				'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false),
60 60
 			));
61 61
 		$this->_model_relations = array(
62 62
 			'Ticket'=>new EE_HABTM_Relation('Datetime_Ticket'),
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 		);
66 66
 		$this->_model_chain_to_wp_user = 'Event';
67 67
 		//this model is generally available for reading
68
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( 'Event' );
69
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
70
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event' );
71
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected( 'Event', EEM_Base::caps_edit );
72
-		parent::__construct( $timezone );
68
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event');
69
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event');
70
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event');
71
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit);
72
+		parent::__construct($timezone);
73 73
 	}
74 74
 
75 75
 
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
 	public function create_new_blank_datetime() {
85 85
 		$blank_datetime = EE_Datetime::new_instance(
86 86
 			array(
87
-				'DTT_EVT_start' => $this->current_time_for_query( 'DTT_EVT_start', true ) + (60 * 60 * 24 * 30),
88
-				'DTT_EVT_end' => $this->current_time_for_query( 'DTT_EVT_end', true ) + (60 * 60 * 24 * 30),
87
+				'DTT_EVT_start' => $this->current_time_for_query('DTT_EVT_start', true) + (60 * 60 * 24 * 30),
88
+				'DTT_EVT_end' => $this->current_time_for_query('DTT_EVT_end', true) + (60 * 60 * 24 * 30),
89 89
 				'DTT_order' => 1,
90 90
 				'DTT_reg_limit' => EE_INF
91 91
 			),
92 92
 			$this->_timezone
93 93
 		);
94
-		$blank_datetime->set_start_time( $this->convert_datetime_for_query( 'DTT_EVT_start', '8am', 'ga', $this->_timezone ) );
95
-		$blank_datetime->set_end_time( $this->convert_datetime_for_query( 'DTT_EVT_end', '5pm', 'ga', $this->_timezone ) );
96
-		return array( $blank_datetime );
94
+		$blank_datetime->set_start_time($this->convert_datetime_for_query('DTT_EVT_start', '8am', 'ga', $this->_timezone));
95
+		$blank_datetime->set_end_time($this->convert_datetime_for_query('DTT_EVT_end', '5pm', 'ga', $this->_timezone));
96
+		return array($blank_datetime);
97 97
 	}
98 98
 
99 99
 
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	* 		@param		int 			$EVT_ID
108 108
 	*		@return 		EE_Datetime[]		array on success, FALSE on fail
109 109
 	*/
110
-	public function get_all_event_dates( $EVT_ID = 0 ) {
111
-		if ( ! $EVT_ID ) { // on add_new_event event_id gets set to 0
110
+	public function get_all_event_dates($EVT_ID = 0) {
111
+		if ( ! $EVT_ID) { // on add_new_event event_id gets set to 0
112 112
 			return $this->create_new_blank_datetime();
113 113
 		}
114
-		$results =  $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
114
+		$results = $this->get_datetimes_for_event_ordered_by_DTT_order($EVT_ID);
115 115
 
116
-		if ( empty( $results ) ) {
116
+		if (empty($results)) {
117 117
 			return $this->create_new_blank_datetime();
118 118
 		}
119 119
 
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	 *                        	the given number
135 135
 	 * @return EE_Datetime[]
136 136
 	 */
137
-	public function get_datetimes_for_event_ordered_by_DTT_order( $EVT_ID, $include_expired = TRUE, $include_deleted= TRUE, $limit = NULL  ) {
137
+	public function get_datetimes_for_event_ordered_by_DTT_order($EVT_ID, $include_expired = TRUE, $include_deleted = TRUE, $limit = NULL) {
138 138
 
139 139
 		//sanitize EVT_ID
140
-		$EVT_ID = intval( $EVT_ID );
140
+		$EVT_ID = intval($EVT_ID);
141 141
 
142 142
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
143
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
144
-		$where_params = array( 'Event.EVT_ID' => $EVT_ID );
143
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
144
+		$where_params = array('Event.EVT_ID' => $EVT_ID);
145 145
 
146
-		$query_params = ! empty( $limit ) ? array( $where_params, 'limit' => $limit, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' ) : array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ), 'default_where_conditions' => 'none' );
146
+		$query_params = ! empty($limit) ? array($where_params, 'limit' => $limit, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none') : array($where_params, 'order_by' => array('DTT_order' => 'ASC'), 'default_where_conditions' => 'none');
147 147
 
148
-		if( ! $include_expired){
149
-			$query_params[0]['DTT_EVT_end'] = array( '>=', current_time( 'mysql', TRUE ) );
148
+		if ( ! $include_expired) {
149
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
150 150
 		}
151
-		if( $include_deleted){
152
-			$query_params[0]['DTT_deleted'] = array( 'IN', array( TRUE, FALSE ));
151
+		if ($include_deleted) {
152
+			$query_params[0]['DTT_deleted'] = array('IN', array(TRUE, FALSE));
153 153
 		}
154 154
 
155
-		$result = $this->get_all( $query_params );
156
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
155
+		$result = $this->get_all($query_params);
156
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
157 157
 		return $result;
158 158
 	}
159 159
 
@@ -168,8 +168,8 @@  discard block
 block discarded – undo
168 168
 	 * @param int $limit
169 169
 	 * @return EE_Datetime[]
170 170
 	 */
171
-	public function get_datetimes_for_event_ordered_by_importance( $EVT_ID = 0, $limit = NULL){
172
-		return $this->get_all( array(array('Event.EVT_ID'=>$EVT_ID),
171
+	public function get_datetimes_for_event_ordered_by_importance($EVT_ID = 0, $limit = NULL) {
172
+		return $this->get_all(array(array('Event.EVT_ID'=>$EVT_ID),
173 173
 			'limit'=>$limit,
174 174
 			'order_by'=>array('DTT_EVT_start'=>'ASC'),
175 175
 			'default_where_conditions' => 'none'));
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
 	 * @param boolean $include_deleted
185 185
 	 * @return EE_Datetime
186 186
 	 */
187
-	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false,$include_deleted = false){
188
-		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
189
-		if($results){
187
+	public function get_oldest_datetime_for_event($EVT_ID, $include_expired = false, $include_deleted = false) {
188
+		$results = $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
189
+		if ($results) {
190 190
 			return array_shift($results);
191
-		}else{
191
+		} else {
192 192
 			return NULL;
193 193
 		}
194 194
 	}
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
 	 * @param bool $try_to_exclude_deleted
203 203
 	 * @return \EE_Datetime
204 204
 	 */
205
-	public function get_primary_datetime_for_event($EVT_ID,$try_to_exclude_expired = true, $try_to_exclude_deleted = true){
206
-		if($try_to_exclude_expired){
207
-			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false,false);
208
-			if($non_expired){
205
+	public function get_primary_datetime_for_event($EVT_ID, $try_to_exclude_expired = true, $try_to_exclude_deleted = true) {
206
+		if ($try_to_exclude_expired) {
207
+			$non_expired = $this->get_oldest_datetime_for_event($EVT_ID, false, false);
208
+			if ($non_expired) {
209 209
 				return $non_expired;
210 210
 			}
211 211
 		}
212
-		if($try_to_exclude_deleted){
212
+		if ($try_to_exclude_deleted) {
213 213
 			$expired_even = $this->get_oldest_datetime_for_event($EVT_ID, true);
214
-			if($expired_even){
214
+			if ($expired_even) {
215 215
 				return $expired_even;
216 216
 			}
217 217
 		}
@@ -230,23 +230,23 @@  discard block
 block discarded – undo
230 230
 	 * @param int $limit
231 231
 	 * @return EE_Datetime[]
232 232
 	 */
233
-	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted= true, $limit = NULL ){
233
+	public function get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
234 234
 		//sanitize EVT_ID
235
-		$EVT_ID = intval( $EVT_ID );
235
+		$EVT_ID = intval($EVT_ID);
236 236
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
237
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
238
-		$query_params =array(array('Event.EVT_ID'=>$EVT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
239
-		if( ! $include_expired){
240
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
237
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
238
+		$query_params = array(array('Event.EVT_ID'=>$EVT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
239
+		if ( ! $include_expired) {
240
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
241 241
 		}
242
-		if( $include_deleted){
243
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
242
+		if ($include_deleted) {
243
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
244 244
 		}
245
-		if($limit){
245
+		if ($limit) {
246 246
 			$query_params['limit'] = $limit;
247 247
 		}
248
-		$result = $this->get_all( $query_params );
249
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
248
+		$result = $this->get_all($query_params);
249
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
250 250
 		return $result;
251 251
 	}
252 252
 
@@ -259,23 +259,23 @@  discard block
 block discarded – undo
259 259
 	 * @param int $limit
260 260
 	 * @return EE_Datetime[]
261 261
 	 */
262
-	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted= true, $limit = NULL){
262
+	public function get_datetimes_for_ticket_ordered_by_start_time($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
263 263
 		//sanitize TKT_ID
264
-		$TKT_ID =  intval( $TKT_ID );
264
+		$TKT_ID = intval($TKT_ID);
265 265
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
266
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
267
-		$query_params =array(array('Ticket.TKT_ID'=>$TKT_ID),'order_by'=>array('DTT_EVT_start'=>'asc'));
268
-		if( ! $include_expired){
269
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
266
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
267
+		$query_params = array(array('Ticket.TKT_ID'=>$TKT_ID), 'order_by'=>array('DTT_EVT_start'=>'asc'));
268
+		if ( ! $include_expired) {
269
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
270 270
 		}
271
-		if( $include_deleted){
272
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
271
+		if ($include_deleted) {
272
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
273 273
 		}
274
-		if($limit){
274
+		if ($limit) {
275 275
 			$query_params['limit'] = $limit;
276 276
 		}
277
-		$result = $this->get_all( $query_params );
278
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
277
+		$result = $this->get_all($query_params);
278
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
279 279
 		return $result;
280 280
 	}
281 281
 
@@ -291,24 +291,24 @@  discard block
 block discarded – undo
291 291
 	 *                                  that number
292 292
 	 * @return EE_Datetime[]
293 293
 	 */
294
-	public function get_datetimes_for_ticket_ordered_by_DTT_order( $TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL ) {
294
+	public function get_datetimes_for_ticket_ordered_by_DTT_order($TKT_ID, $include_expired = true, $include_deleted = true, $limit = NULL) {
295 295
 		//sanitize id.
296
-		$TKT_ID =  intval( $TKT_ID );
296
+		$TKT_ID = intval($TKT_ID);
297 297
 		$old_assumption = $this->get_assumption_concerning_values_already_prepared_by_model_object();
298
-		$this->assume_values_already_prepared_by_model_object( EEM_Base::prepared_for_use_in_db );
299
-		$where_params = array( 'Ticket.TKT_ID' => $TKT_ID );
300
-		$query_params = array( $where_params, 'order_by' => array( 'DTT_order' => 'ASC' ) );
301
-		if( ! $include_expired){
302
-			$query_params[0]['DTT_EVT_end'] = array('>=',current_time('mysql', TRUE));
298
+		$this->assume_values_already_prepared_by_model_object(EEM_Base::prepared_for_use_in_db);
299
+		$where_params = array('Ticket.TKT_ID' => $TKT_ID);
300
+		$query_params = array($where_params, 'order_by' => array('DTT_order' => 'ASC'));
301
+		if ( ! $include_expired) {
302
+			$query_params[0]['DTT_EVT_end'] = array('>=', current_time('mysql', TRUE));
303 303
 		}
304
-		if( $include_deleted){
305
-			$query_params[0]['DTT_deleted'] = array('IN',array(true,false));
304
+		if ($include_deleted) {
305
+			$query_params[0]['DTT_deleted'] = array('IN', array(true, false));
306 306
 		}
307
-		if($limit){
307
+		if ($limit) {
308 308
 			$query_params['limit'] = $limit;
309 309
 		}
310
-		$result = $this->get_all( $query_params );
311
-		$this->assume_values_already_prepared_by_model_object( $old_assumption );
310
+		$result = $this->get_all($query_params);
311
+		$this->assume_values_already_prepared_by_model_object($old_assumption);
312 312
 		return $result;
313 313
 	}
314 314
 
@@ -319,11 +319,11 @@  discard block
 block discarded – undo
319 319
 	 * @param int $EVT_ID
320 320
 	 * @return EE_Datetime
321 321
 	 */
322
-	public function get_most_important_datetime_for_event($EVT_ID){
322
+	public function get_most_important_datetime_for_event($EVT_ID) {
323 323
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
324
-		if($results){
324
+		if ($results) {
325 325
 			return array_shift($results);
326
-		}else{
326
+		} else {
327 327
 			return null;
328 328
 		}
329 329
 	}
@@ -342,77 +342,77 @@  discard block
 block discarded – undo
342 342
 	 * 			- inactive = Events that are either not published.
343 343
 	 * @return wpdb results array
344 344
 	 */
345
-	public function get_dtt_months_and_years( $where_params, $evt_active_status = '' ) {
346
-		$current_time_for_DTT_EVT_start = $this->current_time_for_query( 'DTT_EVT_start' );
347
-		$current_time_for_DTT_EVT_end = $this->current_time_for_query( 'DTT_EVT_end' );
345
+	public function get_dtt_months_and_years($where_params, $evt_active_status = '') {
346
+		$current_time_for_DTT_EVT_start = $this->current_time_for_query('DTT_EVT_start');
347
+		$current_time_for_DTT_EVT_end = $this->current_time_for_query('DTT_EVT_end');
348 348
 
349
-		switch ( $evt_active_status ) {
349
+		switch ($evt_active_status) {
350 350
 			case 'upcoming' :
351 351
 					$where_params['Event.status'] = 'publish';
352 352
 					//if there are already query_params matching DTT_EVT_start then we need to modify that to add them.
353
-					if ( isset( $where_params['DTT_EVT_start'] ) ) {
353
+					if (isset($where_params['DTT_EVT_start'])) {
354 354
 						$where_params['DTT_EVT_start*****'] = $where_params['DTT_EVT_start'];
355 355
 					}
356
-					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start );
356
+					$where_params['DTT_EVT_start'] = array('>', $current_time_for_DTT_EVT_start);
357 357
 					break;
358 358
 
359 359
 			case 'expired' :
360
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
360
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
361 361
 				//get events to exclude
362
-				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
362
+				$exclude_query[0] = array_merge($where_params, array('DTT_EVT_end' => array('>', $current_time_for_DTT_EVT_end)));
363 363
 				//first get all events that have datetimes where its not expired.
364
-				$event_ids = $this->_get_all_wpdb_results( $exclude_query, OBJECT_K, 'Datetime.EVT_ID' );
365
-				$event_ids = array_keys( $event_ids );
364
+				$event_ids = $this->_get_all_wpdb_results($exclude_query, OBJECT_K, 'Datetime.EVT_ID');
365
+				$event_ids = array_keys($event_ids);
366 366
 
367
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
367
+				if (isset($where_params['DTT_EVT_end'])) {
368 368
 					$where_params['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
369 369
 				}
370
-				$where_params['DTT_EVT_end'] = array( '<', $current_time_for_DTT_EVT_end );
371
-				$where_params['Event.EVT_ID'] = array( 'NOT IN', $event_ids );
370
+				$where_params['DTT_EVT_end'] = array('<', $current_time_for_DTT_EVT_end);
371
+				$where_params['Event.EVT_ID'] = array('NOT IN', $event_ids);
372 372
 				break;
373 373
 
374 374
 			case 'active' :
375 375
 				$where_params['Event.status'] = 'publish';
376
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
376
+				if (isset($where_params['DTT_EVT_start'])) {
377 377
 					$where_params['Datetime.DTT_EVT_start******'] = $where_params['DTT_EVT_start'];
378 378
 				}
379
-				if ( isset( $where_params['Datetime.DTT_EVT_end'] ) ) {
379
+				if (isset($where_params['Datetime.DTT_EVT_end'])) {
380 380
 					$where_params['Datetime.DTT_EVT_end*****'] = $where_params['DTT_EVT_end'];
381 381
 				}
382
-				$where_params['DTT_EVT_start'] = array('<',  $current_time_for_DTT_EVT_start );
383
-				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end );
382
+				$where_params['DTT_EVT_start'] = array('<', $current_time_for_DTT_EVT_start);
383
+				$where_params['DTT_EVT_end'] = array('>', $current_time_for_DTT_EVT_end);
384 384
 				break;
385 385
 
386 386
 			case 'inactive' :
387
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
388
-				if ( isset( $where_params['OR'] ) ) {
387
+				if (isset($where_params['Event.status'])) unset($where_params['Event.status']);
388
+				if (isset($where_params['OR'])) {
389 389
 					$where_params['AND']['OR'] = $where_params['OR'];
390 390
 				}
391
-				if ( isset( $where_params['DTT_EVT_end'] ) ) {
391
+				if (isset($where_params['DTT_EVT_end'])) {
392 392
 					$where_params['AND']['DTT_EVT_end****'] = $where_params['DTT_EVT_end'];
393
-					unset( $where_params['DTT_EVT_end'] );
393
+					unset($where_params['DTT_EVT_end']);
394 394
 				}
395 395
 
396
-				if ( isset( $where_params['DTT_EVT_start'] ) ) {
396
+				if (isset($where_params['DTT_EVT_start'])) {
397 397
 					$where_params['AND']['DTT_EVT_start'] = $where_params['DTT_EVT_start'];
398
-					unset( $where_params['DTT_EVT_start'] );
398
+					unset($where_params['DTT_EVT_start']);
399 399
 				}
400
-				$where_params['AND']['Event.status'] = array( '!=', 'publish' );
400
+				$where_params['AND']['Event.status'] = array('!=', 'publish');
401 401
 				break;
402 402
 		}
403 403
 
404 404
 		$query_params[0] = $where_params;
405 405
 		$query_params['group_by'] = array('dtt_year', 'dtt_month');
406
-		$query_params['order_by'] = array( 'DTT_EVT_start' => 'DESC' );
406
+		$query_params['order_by'] = array('DTT_EVT_start' => 'DESC');
407 407
 
408
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'DTT_EVT_start' );
408
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'DTT_EVT_start');
409 409
 
410 410
 		$columns_to_select = array(
411
-			'dtt_year' => array('YEAR(' . $query_interval . ')', '%s'),
412
-			'dtt_month' => array('MONTHNAME(' . $query_interval . ')', '%s'),
413
-			'dtt_month_num' => array('MONTH(' . $query_interval .')', '%s')
411
+			'dtt_year' => array('YEAR('.$query_interval.')', '%s'),
412
+			'dtt_month' => array('MONTHNAME('.$query_interval.')', '%s'),
413
+			'dtt_month_num' => array('MONTH('.$query_interval.')', '%s')
414 414
 			);
415
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
415
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	 * for the tickets for each datetime)
421 421
 	 * @param EE_Datetime[] $datetimes
422 422
 	 */
423
-	public function update_sold($datetimes){
424
-		foreach($datetimes as $datetime){
423
+	public function update_sold($datetimes) {
424
+		foreach ($datetimes as $datetime) {
425 425
 			$datetime->update_sold();
426 426
 		}
427 427
 	}
@@ -436,10 +436,10 @@  discard block
 block discarded – undo
436 436
 	 * @param array $query_params
437 437
 	 * @return int of tickets available. If sold out, return less than 1. If infinite, returns EE_INF,  IF there are NO tickets attached to datetime then FALSE is returned.
438 438
 	 */
439
-	public function sum_tickets_currently_available_at_datetime( $DTT_ID, $query_params = array() ) {
440
-		$datetime = $this->get_one_by_ID( $DTT_ID );
441
-		if ( $datetime instanceof EE_Datetime ) {
442
-			return $datetime->tickets_remaining( $query_params );
439
+	public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) {
440
+		$datetime = $this->get_one_by_ID($DTT_ID);
441
+		if ($datetime instanceof EE_Datetime) {
442
+			return $datetime->tickets_remaining($query_params);
443 443
 		}
444 444
 		return 0;
445 445
 	}
@@ -461,36 +461,36 @@  discard block
 block discarded – undo
461 461
 	 *                EE_Datetime::upcoming
462 462
 	 *                EE_Datetime::expired
463 463
 	 */
464
-	public function get_datetime_counts_by_status( $stati_to_include = array(), $query_params = array() ) {
464
+	public function get_datetime_counts_by_status($stati_to_include = array(), $query_params = array()) {
465 465
 		//only accept where conditions for this query.
466
-		$_where = isset( $query_params[0] ) ? $query_params[0] : array();
466
+		$_where = isset($query_params[0]) ? $query_params[0] : array();
467 467
 		$status_query_args = array(
468 468
 				EE_Datetime::active => array_merge(
469 469
 						$_where,
470
-						array( 'DTT_EVT_start' => array( '<', time() ), 'DTT_EVT_end' => array( '>', time() ) )
470
+						array('DTT_EVT_start' => array('<', time()), 'DTT_EVT_end' => array('>', time()))
471 471
 				),
472 472
 				EE_Datetime::upcoming => array_merge(
473 473
 						$_where,
474
-						array( 'DTT_EVT_start' => array( '>', time() ) )
474
+						array('DTT_EVT_start' => array('>', time()))
475 475
 				),
476 476
 				EE_Datetime::expired => array_merge(
477 477
 						$_where,
478
-						array( 'DTT_EVT_end' => array('<', time() ) )
478
+						array('DTT_EVT_end' => array('<', time()))
479 479
 				)
480 480
 		);
481 481
 
482
-		if ( ! empty( $stati_to_include ) ) {
483
-			foreach( array_keys( $status_query_args ) as $status ) {
484
-				if ( ! in_array( $status, $stati_to_include ) ) {
485
-					unset( $status_query_args[$status] );
482
+		if ( ! empty($stati_to_include)) {
483
+			foreach (array_keys($status_query_args) as $status) {
484
+				if ( ! in_array($status, $stati_to_include)) {
485
+					unset($status_query_args[$status]);
486 486
 				}
487 487
 			}
488 488
 		}
489 489
 
490 490
 		//loop through and query counts for each stati.
491 491
 		$status_query_results = array();
492
-		foreach( $status_query_args as $status => $status_where_conditions ) {
493
-			$status_query_results[ $status ] = EEM_Datetime::count( array( $status_where_conditions ), 'DTT_ID', true );
492
+		foreach ($status_query_args as $status => $status_where_conditions) {
493
+			$status_query_results[$status] = EEM_Datetime::count(array($status_where_conditions), 'DTT_ID', true);
494 494
 		}
495 495
 
496 496
 		return $status_query_results;
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 	 * @param array $query_params
505 505
 	 * @return int
506 506
 	 */
507
-	public function get_datetime_count_for_status( $status = EE_Datetime::active, $query_params = array() ) {
508
-		$count = $this->get_datetime_counts_by_status( array( $status ), $query_params );
509
-		return ! empty( $count[$status] ) ? $count[$status] : 0;
507
+	public function get_datetime_count_for_status($status = EE_Datetime::active, $query_params = array()) {
508
+		$count = $this->get_datetime_counts_by_status(array($status), $query_params);
509
+		return ! empty($count[$status]) ? $count[$status] : 0;
510 510
 	}
511 511
 
512 512
 
Please login to merge, or discard this patch.
Braces   +11 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -187,7 +189,7 @@  discard block
 block discarded – undo
187 189
 		$results =  $this->get_datetimes_for_event_ordered_by_start_time($EVT_ID, $include_expired, $include_deleted, 1);
188 190
 		if($results){
189 191
 			return array_shift($results);
190
-		}else{
192
+		} else{
191 193
 			return NULL;
192 194
 		}
193 195
 	}
@@ -322,7 +324,7 @@  discard block
 block discarded – undo
322 324
 		$results = $this->get_datetimes_for_event_ordered_by_importance($EVT_ID, 1);
323 325
 		if($results){
324 326
 			return array_shift($results);
325
-		}else{
327
+		} else{
326 328
 			return null;
327 329
 		}
328 330
 	}
@@ -356,7 +358,9 @@  discard block
 block discarded – undo
356 358
 					break;
357 359
 
358 360
 			case 'expired' :
359
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
361
+				if ( isset( $where_params['Event.status'] ) ) {
362
+					unset( $where_params['Event.status'] );
363
+				}
360 364
 				//get events to exclude
361 365
 				$exclude_query[0] = array_merge( $where_params, array( 'DTT_EVT_end' => array( '>', $current_time_for_DTT_EVT_end ) ) );
362 366
 				//first get all events that have datetimes where its not expired.
@@ -383,7 +387,9 @@  discard block
 block discarded – undo
383 387
 				break;
384 388
 
385 389
 			case 'inactive' :
386
-				if ( isset( $where_params['Event.status'] ) ) unset( $where_params['Event.status'] );
390
+				if ( isset( $where_params['Event.status'] ) ) {
391
+					unset( $where_params['Event.status'] );
392
+				}
387 393
 				if ( isset( $where_params['OR'] ) ) {
388 394
 					$where_params['AND']['OR'] = $where_params['OR'];
389 395
 				}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 /**
4 4
  *
5 5
  * Class EE_Enum_Text_Field
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param mixed $default_value
24 24
 	 * @param array $allowed_enum_values  keys are values to be used in the DB, values are how they should be displayed
25 25
 	 */
26
-	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){
26
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) {
27 27
 		$this->_allowed_enum_values = $allowed_enum_values;
28 28
 		parent::__construct($table_column, $nice_name, $nullable, $default_value);
29 29
 	}
@@ -37,24 +37,24 @@  discard block
 block discarded – undo
37 37
 	 * @return string
38 38
 	 * @throws EE_Error
39 39
 	 */
40
-	function prepare_for_set( $value_inputted_for_field_on_model_object ) {
41
-		if(
40
+	function prepare_for_set($value_inputted_for_field_on_model_object) {
41
+		if (
42 42
 			$value_inputted_for_field_on_model_object !== null
43
-			&& ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )
44
-		){
45
-			if( defined( 'WP_DEBUG' ) &&  WP_DEBUG ){
43
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)
44
+		) {
45
+			if (defined('WP_DEBUG') && WP_DEBUG) {
46 46
 				$msg = sprintf(
47
-					__('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'),
47
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
48 48
 					$value_inputted_for_field_on_model_object,
49 49
 					$this->_name
50 50
 				);
51 51
 				$msg2 = sprintf(
52
-					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"','event_espresso'),
52
+					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
53 53
 					$this->_name,
54
-					implode( ", ", array_keys( $this->_allowed_enum_values ) ),
54
+					implode(", ", array_keys($this->_allowed_enum_values)),
55 55
 					$value_inputted_for_field_on_model_object
56 56
 				);
57
-				EE_Error::add_error( "$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ );
57
+				EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__);
58 58
 			}
59 59
 			return $this->get_default_value();
60 60
 
Please login to merge, or discard this patch.
core/interfaces/EEI_Duplicatable.interface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	 *	with the exception of a particular attribute
27 27
 	 * @return object of the same class as what was called on
28 28
 	 */
29
-	public function duplicate( $options = array() );
29
+	public function duplicate($options = array());
30 30
 
31 31
 
32 32
 
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/email_main_wrapper.template.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@
 block discarded – undo
7 7
 	<!-- Facebook sharing information tags -->
8 8
 	<meta property="og:title" content="<?php echo $subject; ?>" />
9 9
 	<title><?php echo $subject; ?></title>
10
-	<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?>
10
+	<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?>
11 11
 </head>
12
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?>
12
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?>
13 13
 <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
14
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?>
14
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?>
15 15
 <?php echo $main_body; ?>
16
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?>
16
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?>
17 17
 </body>
18
-<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?>
18
+<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?>
19 19
 </html>
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/messages/defaults/default/html_main_wrapper.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,21 +27,21 @@
 block discarded – undo
27 27
 		<!-- Primary Style Sheet -->
28 28
 		<link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" />
29 29
 		<!-- Make sure the buttons don't print -->
30
-		<?php if ( isset( $extra_css )) : ?>
30
+		<?php if (isset($extra_css)) : ?>
31 31
 		<!-- Additional Style Sheet -->
32 32
 		<link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" />
33 33
 		<?php endif; ?>
34 34
 		<style type="text/css">
35 35
 		@media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }}
36 36
 		</style>
37
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
37
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
38 38
 	</head>
39
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
39
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
40 40
 	<body>
41
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
41
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
42 42
 		<?php echo $main_body; ?>
43
-		<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
43
+		<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
44 44
 	</body>
45
-	<?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
45
+	<?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?>
46 46
 	<?php wp_footer(); ?>
47 47
 </html>
48 48
\ No newline at end of file
Please login to merge, or discard this patch.
caffeinated/modules/event_single_caff/EED_Event_Single_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 	 * @access    	public
117 117
 	 * @param 		EE_Template_Config $CFG
118 118
 	 * @param 		array $REQ
119
-	 * @return    	EE_Event_Single_Config
119
+	 * @return    	EE_Template_Config
120 120
 	 */
121 121
 	public static function update_template_settings( $CFG, $REQ ) {
122 122
 		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Event_Single_Caff
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -50,34 +50,34 @@  discard block
 block discarded – undo
50 50
 	 *  @return 	void
51 51
 	 */
52 52
 	public static function set_hooks_admin() {
53
-		define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
54
-		define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
53
+		define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
54
+		define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
55 55
 		add_action(
56 56
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings',
57
-			array( 'EED_Event_Single_Caff', 'load_scripts_styles' ),
57
+			array('EED_Event_Single_Caff', 'load_scripts_styles'),
58 58
 			10
59 59
 		);
60
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 );
61
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 );
60
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10);
61
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2);
62 62
 		// AJAX
63
-		add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
64
-		add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
63
+		add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
64
+		add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
65 65
 
66 66
 	}
67 67
 
68 68
 
69 69
 
70 70
 	public static function load_scripts_styles() {
71
-		add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 );
71
+		add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10);
72 72
 	}
73 73
 
74 74
 
75 75
 
76 76
 	public static function enqueue_scripts_styles() {
77
-		wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION );
78
-		wp_enqueue_style( 'eed-event-single-sortable' );
79
-		wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true );
80
-		wp_enqueue_script( 'eed-event-single-sortable' );
77
+		wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION);
78
+		wp_enqueue_style('eed-event-single-sortable');
79
+		wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
80
+		wp_enqueue_script('eed-event-single-sortable');
81 81
 	}
82 82
 
83 83
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function template_settings_form() {
93 93
 		$config = EE_Registry::instance()->CFG->template_settings;
94
-		$config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false;
96
-		$config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config );
94
+		$config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
96
+		$config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config);
97 97
 
98 98
 		$event_single_order_array = array();
99
-		$event_single_order_array[ $config->display_order_tickets ] = 'tickets';
100
-		$event_single_order_array[ $config->display_order_datetimes ] = 'datetimes';
101
-		$event_single_order_array[ $config->display_order_event ] = 'event';
102
-		$event_single_order_array[ $config->display_order_venue ] = 'venue';
99
+		$event_single_order_array[$config->display_order_tickets] = 'tickets';
100
+		$event_single_order_array[$config->display_order_datetimes] = 'datetimes';
101
+		$event_single_order_array[$config->display_order_event] = 'event';
102
+		$event_single_order_array[$config->display_order_venue] = 'venue';
103 103
 		// get template parts
104
-		$template_parts = EED_Event_Single::instance()->initialize_template_parts( $config );
104
+		$template_parts = EED_Event_Single::instance()->initialize_template_parts($config);
105 105
 		// convert to array so that we can add more properties
106
-		$config = get_object_vars( $config );
107
-		$config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' );
108
-		EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config );
106
+		$config = get_object_vars($config);
107
+		$config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js');
108
+		EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config);
109 109
 	}
110 110
 
111 111
 
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param 		array $REQ
119 119
 	 * @return    	EE_Event_Single_Config
120 120
 	 */
121
-	public static function update_template_settings( $CFG, $REQ ) {
122
-		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
-		$display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
-		$display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120;
125
-		$display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130;
121
+	public static function update_template_settings($CFG, $REQ) {
122
+		$display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
+		$display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
+		$display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120;
125
+		$display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130;
126 126
 		$CFG->EED_Event_Single = new EE_Event_Single_Config();
127
-		$CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
-		$CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE;
129
-		$CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0;
127
+		$CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
+		$CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE;
129
+		$CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0;
130 130
 		$CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100;
131 131
 		$CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110;
132 132
 		$CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120;
133 133
 		$CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130;
134
-		do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ );
134
+		do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ);
135 135
 		return $CFG;
136 136
 	}
137 137
 
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public static function update_event_single_order() {
147 147
 		$config_saved = false;
148
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
149
-		if ( ! empty( $template_parts ) ) {
150
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
151
-			foreach ( $template_parts as $key => $template_part ) {
148
+		$template_parts = sanitize_text_field($_POST['elements']);
149
+		if ( ! empty($template_parts)) {
150
+			$template_parts = explode(',', trim($template_parts, ','));
151
+			foreach ($template_parts as $key => $template_part) {
152 152
 				$template_part = "display_order_$template_part";
153
-				$priority = ( $key * 10 ) + 100;
153
+				$priority = ($key * 10) + 100;
154 154
 				EE_Registry::instance()->CFG->template_settings->EED_Event_Single->{$template_part} = $priority;
155
-				do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority );
155
+				do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority);
156 156
 			}
157
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
157
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
158 158
 		}
159
-		if ( $config_saved ) {
160
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
159
+		if ($config_saved) {
160
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
161 161
 		} else {
162
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
162
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
163 163
 		}
164
-		echo wp_json_encode( EE_Error::get_notices( false ));
164
+		echo wp_json_encode(EE_Error::get_notices(false));
165 165
 		exit();
166 166
 	}
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param WP $WP
175 175
 	 * @return    void
176 176
 	 */
177
-	public function run( $WP ) {
177
+	public function run($WP) {
178 178
 	}
179 179
 
180 180
 
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.
caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 	 *  @access 	public
124 124
 	 *  @param    EE_Template_Config $CFG
125 125
 	 *  @param 	array $REQ
126
-	 *  @return    EE_Events_Archive_Config
126
+	 *  @return    EE_Template_Config
127 127
 	 */
128 128
 	public static function update_template_settings( $CFG, $REQ ) {
129 129
 		$config = new EE_Events_Archive_Config();
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EED_Events_Archive_Caff
29 29
 	 */
30 30
 	public static function instance() {
31
-		return parent::get_instance( __CLASS__ );
31
+		return parent::get_instance(__CLASS__);
32 32
 	}
33 33
 
34 34
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_hooks_admin() {
52
-		define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
53
-		define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
54
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 );
55
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 );
52
+		define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53
+		define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
54
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10);
55
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2);
56 56
 		// AJAX
57
-		add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
58
-		add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
57
+		add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
58
+		add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
59 59
 	}
60 60
 
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param    WP $WP
69 69
 	 * @return    void
70 70
 	 */
71
-	public function run( $WP ) {
71
+	public function run($WP) {
72 72
 	}
73 73
 
74 74
 
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public static function template_settings_form() {
85 85
 		// grab general settings admin page and remove the existing hook callback
86
-		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' );
87
-		if ( $gen_set_admin instanceof General_Settings_Admin_Page ) {
88
-			remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 );
86
+		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings');
87
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
88
+			remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100);
89 89
 		}
90 90
 		// first just grab the template settings
91 91
 		$config = EE_Registry::instance()->CFG->template_settings;
92 92
 		// then if the Event Archive config is valid, use that, else create a new one
93
-		$config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
-		$config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config );
95
-		$config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0;
96
-		$config->display_description = isset( $config->display_description ) ? $config->display_description : 1;
97
-		$config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0;
98
-		$config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1;
99
-		$config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0;
100
-		$config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0;
93
+		$config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
+		$config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config);
95
+		$config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0;
96
+		$config->display_description = isset($config->display_description) ? $config->display_description : 1;
97
+		$config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0;
98
+		$config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1;
99
+		$config->display_venue = isset($config->display_venue) ? $config->display_venue : 0;
100
+		$config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0;
101 101
 		// display order options
102
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order  )? $config->use_sortable_display_order : false;
103
-		$config->display_order_tickets = isset( $config->display_order_tickets  )? $config->display_order_tickets : 100;
104
-		$config->display_order_datetimes = isset( $config->display_order_datetimes  )? $config->display_order_datetimes : 110;
105
-		$config->display_order_event = isset( $config->display_order_event  )? $config->display_order_event : 120;
106
-		$config->display_order_venue = isset( $config->display_order_venue  )? $config->display_order_venue : 130;
102
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
103
+		$config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100;
104
+		$config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110;
105
+		$config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120;
106
+		$config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130;
107 107
 		// get template parts
108
-		$template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config );
108
+		$template_parts = EED_Events_Archive::instance()->initialize_template_parts($config);
109 109
 		// convert to array so that we can add more properties
110
-		$config = get_object_vars( $config );
111
-		$config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' );
112
-		EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config );
110
+		$config = get_object_vars($config);
111
+		$config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js');
112
+		EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config);
113 113
 	}
114 114
 
115 115
 
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 *  @param 	array $REQ
126 126
 	 *  @return    EE_Events_Archive_Config
127 127
 	 */
128
-	public static function update_template_settings( $CFG, $REQ ) {
128
+	public static function update_template_settings($CFG, $REQ) {
129 129
 		$config = new EE_Events_Archive_Config();
130 130
 		// unless we are resetting the config...
131
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
132
-			$config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
133
-			$config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
134
-			$config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
135
-			$config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
136
-			$config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
137
-			$config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;
138
-			$config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0;
139
-			$config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
-			$config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
-			$config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
-			$config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
131
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
132
+			$config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
133
+			$config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
134
+			$config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
135
+			$config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
136
+			$config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
137
+			$config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0;
138
+			$config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0;
139
+			$config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
+			$config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
+			$config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
+			$config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
143 143
 		}
144 144
 		$CFG->EED_Events_Archive = $config;
145
-		do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ );
145
+		do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ);
146 146
 		return $CFG;
147 147
 	}
148 148
 
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public static function update_event_archive_order() {
158 158
 		$config_saved = false;
159
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
160
-		if ( ! empty( $template_parts ) ) {
161
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
162
-			foreach ( $template_parts as $key => $template_part ) {
159
+		$template_parts = sanitize_text_field($_POST['elements']);
160
+		if ( ! empty($template_parts)) {
161
+			$template_parts = explode(',', trim($template_parts, ','));
162
+			foreach ($template_parts as $key => $template_part) {
163 163
 				$template_part = "display_order_$template_part";
164
-				$priority = ( $key * 10 ) + 100;
164
+				$priority = ($key * 10) + 100;
165 165
 				if (
166 166
 					property_exists(
167 167
 						EE_Registry::instance()->CFG->template_settings->EED_Events_Archive,
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 				) {
171 171
 					EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->{$template_part} = $priority;
172 172
 				}
173
-				do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority );
173
+				do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority);
174 174
 			}
175
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
175
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
176 176
 		}
177
-		if ( $config_saved ) {
178
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
177
+		if ($config_saved) {
178
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
179 179
 		} else {
180
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
180
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
181 181
 		}
182
-		echo wp_json_encode( EE_Error::get_notices( false ) );
182
+		echo wp_json_encode(EE_Error::get_notices(false));
183 183
 		exit();
184 184
 	}
185 185
 
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/libraries/payment_methods/EE_PMT_Base.lib.php 3 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	protected function _get_billing_values_from_form( $billing_form ){
443 443
 		if($billing_form instanceof EE_Form_Section_Proper ){
444 444
 			return $billing_form->input_pretty_values( true );
445
-		}else{
445
+		} else{
446 446
 			return NULL;
447 447
 		}
448 448
 	}
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
 	public function supports_sending_refunds(){
551 551
 		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
552 552
 			return $this->_gateway->supports_sending_refunds();
553
-		}else{
553
+		} else{
554 554
 			return false;
555 555
 		}
556 556
 	}
@@ -588,11 +588,11 @@  discard block
 block discarded – undo
588 588
 	public function payment_occurs(){
589 589
 		if( ! $this->_gateway){
590 590
 			return EE_PMT_Base::offline;
591
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
591
+		} elseif($this->_gateway instanceof EE_Onsite_Gateway){
592 592
 			return EE_PMT_Base::onsite;
593
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
593
+		} elseif($this->_gateway instanceof EE_Offsite_Gateway){
594 594
 			return EE_PMT_Base::offsite;
595
-		}else{
595
+		} else{
596 596
 			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
597 597
 		}
598 598
 	}
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -277,17 +277,17 @@
 block discarded – undo
277 277
 		//if we know who the attendee is, and this is a billing form
278 278
 		//that uses attendee info, populate it
279 279
 		if (
280
-            apply_filters(
281
-                'FHEE__populate_billing_form_fields_from_attendee',
282
-                (
283
-                    $this->_billing_form instanceof EE_Billing_Attendee_Info_Form
284
-                    && $transaction instanceof EE_Transaction
285
-                    && $transaction->primary_registration() instanceof EE_Registration
286
-                    && $transaction->primary_registration()->attendee() instanceof EE_Attendee
287
-                ),
288
-                $this->_billing_form,
289
-                $transaction
290
-            )
280
+			apply_filters(
281
+				'FHEE__populate_billing_form_fields_from_attendee',
282
+				(
283
+					$this->_billing_form instanceof EE_Billing_Attendee_Info_Form
284
+					&& $transaction instanceof EE_Transaction
285
+					&& $transaction->primary_registration() instanceof EE_Registration
286
+					&& $transaction->primary_registration()->attendee() instanceof EE_Attendee
287
+				),
288
+				$this->_billing_form,
289
+				$transaction
290
+			)
291 291
 		){
292 292
 			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
293 293
 		}
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
  * @since 				$VID:$
15 15
  *
16 16
  */
17
-abstract class EE_PMT_Base{
17
+abstract class EE_PMT_Base {
18 18
 
19 19
 	const onsite = 'on-site';
20 20
 	const offsite = 'off-site';
@@ -95,31 +95,31 @@  discard block
 block discarded – undo
95 95
 	 * @return EE_PMT_Base
96 96
 	 */
97 97
 	function __construct($pm_instance = NULL) {
98
-		if ( $pm_instance instanceof EE_Payment_Method ){
98
+		if ($pm_instance instanceof EE_Payment_Method) {
99 99
 			$this->set_instance($pm_instance);
100 100
 		}
101
-		if($this->_gateway){
102
-			$this->_gateway->set_payment_model( EEM_Payment::instance() );
103
-			$this->_gateway->set_payment_log( EEM_Change_Log::instance() );
104
-			$this->_gateway->set_template_helper( new EEH_Template() );
105
-			$this->_gateway->set_line_item_helper( new EEH_Line_Item() );
106
-			$this->_gateway->set_money_helper( new EEH_Money() );
101
+		if ($this->_gateway) {
102
+			$this->_gateway->set_payment_model(EEM_Payment::instance());
103
+			$this->_gateway->set_payment_log(EEM_Change_Log::instance());
104
+			$this->_gateway->set_template_helper(new EEH_Template());
105
+			$this->_gateway->set_line_item_helper(new EEH_Line_Item());
106
+			$this->_gateway->set_money_helper(new EEH_Money());
107 107
 		}
108
-		if ( ! isset( $this->_has_billing_form ) ) {
108
+		if ( ! isset($this->_has_billing_form)) {
109 109
 			// by default, On Site gateways have a billing form
110
-			if ( $this->payment_occurs() == EE_PMT_Base::onsite ) {
111
-				$this->set_has_billing_form( true );
110
+			if ($this->payment_occurs() == EE_PMT_Base::onsite) {
111
+				$this->set_has_billing_form(true);
112 112
 			} else {
113
-				$this->set_has_billing_form( false );
113
+				$this->set_has_billing_form(false);
114 114
 			}
115 115
 		}
116 116
 
117
-		if( ! $this->_pretty_name){
117
+		if ( ! $this->_pretty_name) {
118 118
 			throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso")));
119 119
 		}
120 120
 		//if the child didn't specify a default button, use the credit card one
121
-		if( $this->_default_button_url === NULL){
122
-			$this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png';
121
+		if ($this->_default_button_url === NULL) {
122
+			$this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png';
123 123
 		}
124 124
 	}
125 125
 
@@ -128,8 +128,8 @@  discard block
 block discarded – undo
128 128
 	/**
129 129
 	 * @param boolean $has_billing_form
130 130
 	 */
131
-	public function set_has_billing_form( $has_billing_form ) {
132
-		$this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN );
131
+	public function set_has_billing_form($has_billing_form) {
132
+		$this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN);
133 133
 	}
134 134
 
135 135
 
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * sets the file_folder property
139 139
 	 */
140
-	protected function _set_file_folder(){
140
+	protected function _set_file_folder() {
141 141
 		$reflector = new ReflectionClass(get_class($this));
142 142
 		$fn = $reflector->getFileName();
143
-		$this->_file_folder =  dirname($fn).DS;
143
+		$this->_file_folder = dirname($fn).DS;
144 144
 	}
145 145
 
146 146
 
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
 	/**
149 149
 	 * sets the file URL with a trailing slash for this PMT
150 150
 	 */
151
-	protected function _set_file_url(){
152
-		$plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR);
153
-		$file_folder_fixed = str_replace('\\',DS,$this->file_folder());
154
-		$file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed);
151
+	protected function _set_file_url() {
152
+		$plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR);
153
+		$file_folder_fixed = str_replace('\\', DS, $this->file_folder());
154
+		$file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed);
155 155
 		$this->_file_url = $file_path;
156 156
 	}
157 157
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 * Gets the default description on all payment methods of this type
160 160
 	 * @return string
161 161
 	 */
162
-	public function default_description(){
162
+	public function default_description() {
163 163
 		return $this->_default_description;
164 164
 	}
165 165
 
@@ -169,8 +169,8 @@  discard block
 block discarded – undo
169 169
 	 * Returns the folder containing the PMT child class, with a trailing slash
170 170
 	 * @return string
171 171
 	 */
172
-	public function file_folder(){
173
-		if( ! $this->_file_folder ) {
172
+	public function file_folder() {
173
+		if ( ! $this->_file_folder) {
174 174
 			$this->_set_file_folder();
175 175
 		}
176 176
 		return $this->_file_folder;
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	/**
182 182
 	 * @return string
183 183
 	 */
184
-	public function file_url(){
185
-		if( ! $this->_file_url ) {
184
+	public function file_url() {
185
+		if ( ! $this->_file_url) {
186 186
 			$this->_set_file_url();
187 187
 		}
188 188
 		return $this->_file_url;
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 	 * Its important teh payment method instance is set before
196 196
 	 * @param EE_Payment_Method $payment_method_instance
197 197
 	 */
198
-	function set_instance($payment_method_instance){
198
+	function set_instance($payment_method_instance) {
199 199
 		$this->_pm_instance = $payment_method_instance;
200 200
 		//if they have already requested the settings form, make sure its
201 201
 		//data matches this model object
202
-		if($this->_settings_form){
202
+		if ($this->_settings_form) {
203 203
 			$this->settings_form()->populate_model_obj($payment_method_instance);
204 204
 		}
205
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
205
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
206 206
 			$this->_gateway->set_settings($payment_method_instance->settings_array());
207 207
 		}
208 208
 	}
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
 	 * Gets teh form for displaying to admins where they setup the payment method
214 214
 	 * @return EE_Payment_Method_Form
215 215
 	 */
216
-	function settings_form(){
217
-		if( ! $this->_settings_form){
216
+	function settings_form() {
217
+		if ( ! $this->_settings_form) {
218 218
 			$this->_settings_form = $this->generate_new_settings_form();
219
-			$this->_settings_form->set_payment_method_type( $this );
220
-			$this->_settings_form->_construct_finalize(NULL, NULL );
219
+			$this->_settings_form->set_payment_method_type($this);
220
+			$this->_settings_form->_construct_finalize(NULL, NULL);
221 221
 			//if we have already assigned a model object to this pmt, make
222 222
 			//sure its reflected in teh form we just generated
223
-			if($this->_pm_instance){
223
+			if ($this->_pm_instance) {
224 224
 				$this->_settings_form->populate_model_obj($this->_pm_instance);
225 225
 			}
226 226
 		}
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 * this payment method type's settings form later in the request
247 247
 	 * @param EE_Payment_Method_Form $form
248 248
 	 */
249
-	public function set_settings_form($form){
249
+	public function set_settings_form($form) {
250 250
 		$this->_settings_form = $form;
251 251
 	}
252 252
 
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 	 * @param array $extra_args
270 270
 	 * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null
271 271
 	 */
272
-	public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){
272
+	public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) {
273 273
 		// has billing form already been regenerated ? or overwrite cache?
274
-		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){
275
-			$this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args );
274
+		if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) {
275
+			$this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args);
276 276
 		}
277 277
 		//if we know who the attendee is, and this is a billing form
278 278
 		//that uses attendee info, populate it
@@ -288,8 +288,8 @@  discard block
 block discarded – undo
288 288
                 $this->_billing_form,
289 289
                 $transaction
290 290
             )
291
-		){
292
-			$this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() );
291
+		) {
292
+			$this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee());
293 293
 		}
294 294
 		return $this->_billing_form;
295 295
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param \EE_Transaction $transaction
301 301
 	 * @return \EE_Billing_Info_Form
302 302
 	 */
303
-	abstract function generate_new_billing_form( EE_Transaction $transaction = NULL );
303
+	abstract function generate_new_billing_form(EE_Transaction $transaction = NULL);
304 304
 
305 305
 
306 306
 
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 * @param \EE_Billing_Info_Form $billing_form
312 312
 	 * @return \EE_Billing_Info_Form
313 313
 	 */
314
-	public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) {
314
+	public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) {
315 315
 		return $billing_form;
316 316
 	}
317 317
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	 * if you have form
323 323
 	 * @param EE_Payment_Method $form
324 324
 	 */
325
-	public function set_billing_form($form){
325
+	public function set_billing_form($form) {
326 326
 		$this->_billing_form = $form;
327 327
 	}
328 328
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	 * Returns whether or not this payment method requires HTTPS to be used
333 333
 	 * @return boolean
334 334
 	 */
335
-	function requires_https(){
335
+	function requires_https() {
336 336
 		return $this->_requires_https;
337 337
 	}
338 338
 
@@ -350,9 +350,9 @@  discard block
 block discarded – undo
350 350
 	 * @return EE_Payment
351 351
 	 * @throws EE_Error
352 352
 	 */
353
-	function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){
353
+	function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) {
354 354
 		// @todo: add surcharge for the payment method, if any
355
-		if ( $this->_gateway ) {
355
+		if ($this->_gateway) {
356 356
 			//there is a gateway, so we're going to make a payment object
357 357
 			//but wait! do they already have a payment in progress that we thought was failed?
358 358
 			$duplicate_properties = array(
@@ -363,10 +363,10 @@  discard block
 block discarded – undo
363 363
 				'PAY_amount' 					=> $amount !== null ? $amount : $transaction->remaining(),
364 364
 				'PAY_gateway_response' 	=> null,
365 365
 			);
366
-			$payment = EEM_Payment::instance()->get_one( array( $duplicate_properties ));
366
+			$payment = EEM_Payment::instance()->get_one(array($duplicate_properties));
367 367
 			//if we didn't already have a payment in progress for the same thing,
368 368
 			//then we actually want to make a new payment
369
-			if ( ! $payment instanceof EE_Payment ){
369
+			if ( ! $payment instanceof EE_Payment) {
370 370
 				$payment = EE_Payment::new_instance(
371 371
 					array_merge(
372 372
 						$duplicate_properties,
@@ -382,10 +382,10 @@  discard block
 block discarded – undo
382 382
 			}
383 383
 			//make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it
384 384
 			$payment->save();
385
-			$billing_values = $this->_get_billing_values_from_form( $billing_info );
385
+			$billing_values = $this->_get_billing_values_from_form($billing_info);
386 386
 
387 387
 			//  Offsite Gateway
388
-			if( $this->_gateway instanceof EE_Offsite_Gateway ){
388
+			if ($this->_gateway instanceof EE_Offsite_Gateway) {
389 389
 
390 390
 				$payment = $this->_gateway->set_redirection_info(
391 391
 					$payment,
@@ -401,17 +401,17 @@  discard block
 block discarded – undo
401 401
 				);
402 402
 				$payment->save();
403 403
 			//  Onsite Gateway
404
-			} elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) {
404
+			} elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
405 405
 
406
-				$payment = $this->_gateway->do_direct_payment($payment,$billing_values);
406
+				$payment = $this->_gateway->do_direct_payment($payment, $billing_values);
407 407
 				$payment->save();
408 408
 
409 409
 			} else {
410 410
 				throw new EE_Error(
411 411
 					sprintf(
412
-						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ),
412
+						__('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'),
413 413
 						get_class($this),
414
-						gettype( $this->_gateway )
414
+						gettype($this->_gateway)
415 415
 					)
416 416
 				);
417 417
 			}
@@ -433,8 +433,8 @@  discard block
 block discarded – undo
433 433
 		}
434 434
 
435 435
 		// if there is billing info, clean it and save it now
436
-		if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){
437
-			$this->_save_billing_info_to_attendee( $billing_info, $transaction );
436
+		if ($billing_info instanceof EE_Billing_Attendee_Info_Form) {
437
+			$this->_save_billing_info_to_attendee($billing_info, $transaction);
438 438
 		}
439 439
 
440 440
 		return $payment;
@@ -447,10 +447,10 @@  discard block
 block discarded – undo
447 447
 	 * @param EE_Billing_Info_Form $billing_form
448 448
 	 * @return array
449 449
 	 */
450
-	protected function _get_billing_values_from_form( $billing_form ){
451
-		if($billing_form instanceof EE_Form_Section_Proper ){
452
-			return $billing_form->input_pretty_values( true );
453
-		}else{
450
+	protected function _get_billing_values_from_form($billing_form) {
451
+		if ($billing_form instanceof EE_Form_Section_Proper) {
452
+			return $billing_form->input_pretty_values(true);
453
+		} else {
454 454
 			return NULL;
455 455
 		}
456 456
 	}
@@ -464,13 +464,13 @@  discard block
 block discarded – undo
464 464
 	 * @return EE_Payment
465 465
 	 * @throws EE_Error
466 466
 	 */
467
-	public function handle_ipn($req_data,$transaction){
467
+	public function handle_ipn($req_data, $transaction) {
468 468
 		$transaction = EEM_Transaction::instance()->ensure_is_obj($transaction);
469
-		if( ! $this->_gateway instanceof EE_Offsite_Gateway){
470
-			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE )));
469
+		if ( ! $this->_gateway instanceof EE_Offsite_Gateway) {
470
+			throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE)));
471 471
 
472 472
 		}
473
-		$payment = $this->_gateway->handle_payment_update( $req_data, $transaction );
473
+		$payment = $this->_gateway->handle_payment_update($req_data, $transaction);
474 474
 		return $payment;
475 475
 	}
476 476
 
@@ -483,22 +483,22 @@  discard block
 block discarded – undo
483 483
 	 * @param EE_Transaction $transaction
484 484
 	 * @return boolean success
485 485
 	 */
486
-	protected function _save_billing_info_to_attendee($billing_form, $transaction){
487
-		if( ! $transaction || ! $transaction instanceof EE_Transaction){
486
+	protected function _save_billing_info_to_attendee($billing_form, $transaction) {
487
+		if ( ! $transaction || ! $transaction instanceof EE_Transaction) {
488 488
 			EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
489 489
 			return false;
490 490
 		}
491 491
 		$primary_reg = $transaction->primary_registration();
492
-		if( ! $primary_reg ){
492
+		if ( ! $primary_reg) {
493 493
 			EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
494 494
 			return false;
495 495
 		}
496 496
 		$attendee = $primary_reg->attendee();
497
-		if( ! $attendee ){
497
+		if ( ! $attendee) {
498 498
 			EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__);
499 499
 			return false;
500 500
 		}
501
-		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() );
501
+		return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method());
502 502
 
503 503
 	}
504 504
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 	 * @param array $req_data
512 512
 	 * @return EE_Payment
513 513
 	 */
514
-	protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){
514
+	protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) {
515 515
 		return $transaction->last_payment();
516 516
 	}
517 517
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 	 * and identifies the IPN as being for this payment method (not just fo ra payment method of this type)
529 529
 	 * @throws EE_Error
530 530
 	 */
531
-	public function handle_unclaimed_ipn( $req_data = array() ){
532
-		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) ));
531
+	public function handle_unclaimed_ipn($req_data = array()) {
532
+		throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this)));
533 533
 	}
534 534
 
535 535
 
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 * @param EE_Transaction $transaction
546 546
 	 * @return EE_Payment
547 547
 	 */
548
-	public function finalize_payment_for($transaction){
548
+	public function finalize_payment_for($transaction) {
549 549
 		return $transaction->last_payment();
550 550
 	}
551 551
 
@@ -555,10 +555,10 @@  discard block
 block discarded – undo
555 555
 	 * Whether or not this payment method's gateway supports sending refund requests
556 556
 	 * @return boolean
557 557
 	 */
558
-	public function supports_sending_refunds(){
559
-		if($this->_gateway && $this->_gateway instanceof EE_Gateway){
558
+	public function supports_sending_refunds() {
559
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
560 560
 			return $this->_gateway->supports_sending_refunds();
561
-		}else{
561
+		} else {
562 562
 			return false;
563 563
 		}
564 564
 	}
@@ -572,14 +572,14 @@  discard block
 block discarded – undo
572 572
 	 * @throws EE_Error
573 573
 	 * @return EE_Payment
574 574
 	 */
575
-	public function process_refund( EE_Payment $payment, $refund_info = array()){
576
-		if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) {
577
-			return $this->_gateway->do_direct_refund( $payment, $refund_info );
575
+	public function process_refund(EE_Payment $payment, $refund_info = array()) {
576
+		if ($this->_gateway && $this->_gateway instanceof EE_Gateway) {
577
+			return $this->_gateway->do_direct_refund($payment, $refund_info);
578 578
 		} else {
579 579
 			throw new EE_Error(
580 580
 				sprintf(
581
-					__( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ),
582
-					get_class( $this )
581
+					__('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'),
582
+					get_class($this)
583 583
 				)
584 584
 			);
585 585
 		}
@@ -593,15 +593,15 @@  discard block
 block discarded – undo
593 593
 	 * @return string
594 594
 	 * @throws EE_Error
595 595
 	 */
596
-	public function payment_occurs(){
597
-		if( ! $this->_gateway){
596
+	public function payment_occurs() {
597
+		if ( ! $this->_gateway) {
598 598
 			return EE_PMT_Base::offline;
599
-		}elseif($this->_gateway instanceof EE_Onsite_Gateway){
599
+		}elseif ($this->_gateway instanceof EE_Onsite_Gateway) {
600 600
 			return EE_PMT_Base::onsite;
601
-		}elseif($this->_gateway instanceof EE_Offsite_Gateway){
601
+		}elseif ($this->_gateway instanceof EE_Offsite_Gateway) {
602 602
 			return EE_PMT_Base::offsite;
603
-		}else{
604
-			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this)));
603
+		} else {
604
+			throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this)));
605 605
 		}
606 606
 	}
607 607
 
@@ -614,8 +614,8 @@  discard block
 block discarded – undo
614 614
 	 * @param EE_Payment $payment
615 615
 	 * @return string
616 616
 	 */
617
-	public function payment_overview_content(EE_Payment $payment){
618
-		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true);
617
+	public function payment_overview_content(EE_Payment $payment) {
618
+		return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true);
619 619
 	}
620 620
 
621 621
 
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 	 *	@type array $template_args any arguments you want passed to the template file while rendering.
629 629
 	 *				Keys will be variable names and values with be their values.
630 630
 	 */
631
-	public function help_tabs_config(){
631
+	public function help_tabs_config() {
632 632
 		return array();
633 633
 	}
634 634
 
@@ -639,9 +639,9 @@  discard block
 block discarded – undo
639 639
 	 * the payment method's table's PMT_type column)
640 640
 	 * @return string
641 641
 	 */
642
-	public function system_name(){
642
+	public function system_name() {
643 643
 		$classname = get_class($this);
644
-		return str_replace("EE_PMT_",'',$classname);
644
+		return str_replace("EE_PMT_", '', $classname);
645 645
 	}
646 646
 
647 647
 
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	 * A pretty i18n version of the PMT name
651 651
 	 * @return string
652 652
 	 */
653
-	public function pretty_name(){
653
+	public function pretty_name() {
654 654
 		return $this->_pretty_name;
655 655
 	}
656 656
 
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	 * Gets the default absolute URL to the payment method type's button
661 661
 	 * @return string
662 662
 	 */
663
-	public function default_button_url(){
663
+	public function default_button_url() {
664 664
 		return $this->_default_button_url;
665 665
 	}
666 666
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 	 * Gets the gateway used by this payment method (if any)
671 671
 	 * @return EE_Gateway
672 672
 	 */
673
-	public function get_gateway(){
673
+	public function get_gateway() {
674 674
 		return $this->_gateway;
675 675
 	}
676 676
 
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
 	/**
680 680
 	 * @return string html for the link to a help tab
681 681
 	 */
682
-	public function get_help_tab_link(){
683
-		return EEH_Template::get_help_tab_link( $this->get_help_tab_name() );
682
+	public function get_help_tab_link() {
683
+		return EEH_Template::get_help_tab_link($this->get_help_tab_name());
684 684
 	}
685 685
 
686 686
 
@@ -689,8 +689,8 @@  discard block
 block discarded – undo
689 689
 	 * Returns the name of the help tab for this PMT
690 690
 	 * @return string
691 691
 	 */
692
-	public function get_help_tab_name(){
693
-		return 'ee_' . strtolower( $this->system_name() ) . '_help_tab';
692
+	public function get_help_tab_name() {
693
+		return 'ee_'.strtolower($this->system_name()).'_help_tab';
694 694
 	}
695 695
 
696 696
 	/**
@@ -698,8 +698,8 @@  discard block
 block discarded – undo
698 698
 	 * this PMT by an admin
699 699
 	 * @return string
700 700
 	 */
701
-	public function cap_name(){
702
-		return 'ee_payment_method_' . strtolower( $this->system_name() );
701
+	public function cap_name() {
702
+		return 'ee_payment_method_'.strtolower($this->system_name());
703 703
 	}
704 704
 
705 705
 	/**
@@ -711,9 +711,9 @@  discard block
 block discarded – undo
711 711
 	 * @param EE_Payment $payment
712 712
 	 * @return void
713 713
 	 */
714
-	public function update_txn_based_on_payment( $payment ){
715
-		if( $this->_gateway instanceof EE_Gateway ){
716
-			$this->_gateway->update_txn_based_on_payment( $payment );
714
+	public function update_txn_based_on_payment($payment) {
715
+		if ($this->_gateway instanceof EE_Gateway) {
716
+			$this->_gateway->update_txn_based_on_payment($payment);
717 717
 		}
718 718
 	}
719 719
 
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 	 * @return string
729 729
 	 */
730 730
 	public function introductory_html() {
731
-		return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) );
731
+		return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance));
732 732
 	}
733 733
 
734 734
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_Shortcodes.lib.php 2 patches
Spacing   +13 added lines, -13 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
 /**
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param string $shortcode
62 62
 	 * @return string
63 63
 	 */
64
-	protected function _parser( $shortcode ) {
64
+	protected function _parser($shortcode) {
65 65
 
66
-		if ( ! $this->_data instanceof EE_Datetime ) {
66
+		if ( ! $this->_data instanceof EE_Datetime) {
67 67
 			return ''; //get out cause we can only parse with the datetime object.
68 68
 		}
69 69
 
70
-		switch ( $shortcode ) {
70
+		switch ($shortcode) {
71 71
 
72 72
 			case '[DATETIME_START]' :
73 73
 				return $this->_data->get_i18n_datetime('DTT_EVT_start');
@@ -81,27 +81,27 @@  discard block
 block discarded – undo
81 81
 				return $this->_data->get_timezone();
82 82
 				break;
83 83
 			case '[DATE_START]' :
84
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'date_format' ) );
84
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format'));
85 85
 				break;
86 86
 			case '[DATE_END]' :
87
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'date_format' ) );
87
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format'));
88 88
 				break;
89 89
 			case '[TIME_START]' :
90
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'time_format' ) );
90
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format'));
91 91
 				break;
92 92
 			case '[TIME_END]' :
93
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'time_format' ) );
93
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format'));
94 94
 				break;
95 95
 		}
96 96
 
97
-		if ( strpos( $shortcode, '[ICAL_LINK_*') !== FALSE  ) {
98
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
97
+		if (strpos($shortcode, '[ICAL_LINK_*') !== FALSE) {
98
+			$attrs = $this->_get_shortcode_attrs($shortcode);
99 99
 			
100
-			$link_text = empty( $attrs['link_text'] ) ?  __( 'Add to iCal Calendar', 'event_espresso' ) : $attrs['link_text'];
100
+			$link_text = empty($attrs['link_text']) ? __('Add to iCal Calendar', 'event_espresso') : $attrs['link_text'];
101 101
 			
102
-			$URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $this->_data->ID() ), site_url() );
102
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url());
103 103
 		
104
-			return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>';
104
+			return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>';
105 105
 			
106 106
 		}
107 107
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
3 3
 	exit('NO direct script access allowed');
4
+}
4 5
 
5 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.