Completed
Branch BUG-8698-ticket-sellouts (195489)
by
unknown
116:46 queued 100:40
created
core/libraries/rest_api/changes/Changes_In_4_8_36.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,28 +15,28 @@  discard block
 block discarded – undo
15 15
 		//set a hook to remove the "calculate" query param
16 16
 		add_filter(
17 17
 			'FHEE__EED_Core_Rest_Api___get_response_selection_query_params',
18
-			array( $this, 'remove_calculate_query_param' ),
18
+			array($this, 'remove_calculate_query_param'),
19 19
 			10,
20 20
 			3
21 21
 		);
22 22
 		//don't add the _calculated_fields either
23 23
 		add_filter(
24 24
 			'FHEE__Read__create_entity_from_wpdb_results__entity_before_inaccessible_field_removal',
25
-			array( $this, 'remove_calculated_fields_from_response' ),
25
+			array($this, 'remove_calculated_fields_from_response'),
26 26
 			10,
27 27
 			5
28 28
 		);
29 29
 		//and also don't add the count headers
30 30
 		add_filter(
31 31
 			'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers',
32
-			array( $this, 'remove_headers_new_in_this_version' ),
32
+			array($this, 'remove_headers_new_in_this_version'),
33 33
 			10,
34 34
 			3
35 35
 		);
36 36
 		//remove the old featured_image part of the response...
37 37
 		add_filter(
38 38
 			'FHEE__Read__create_entity_from_wpdb_results__entity_before_inaccessible_field_removal',
39
-			array( $this, 'remove_old_featured_image_part_of_cpt_entities' ),
39
+			array($this, 'remove_old_featured_image_part_of_cpt_entities'),
40 40
 			10,
41 41
 			5
42 42
 		);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		//before this, infinity was -1, now it's null
47 47
 		add_filter(
48 48
 			'FHEE__EventEspresso\core\libraries\rest_api\Model_Data_Translator__prepare_field_for_rest_api',
49
-			array( $this, 'use_negative_one_for_infinity_before_this_version' ),
49
+			array($this, 'use_negative_one_for_infinity_before_this_version'),
50 50
 			10,
51 51
 			4
52 52
 		);
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	 * @param string $version
60 60
 	 * @return array
61 61
 	 */
62
-	public function remove_calculate_query_param( $query_params, \EEM_Base $model, $version ) {
63
-		if( $this->applies_to_version( $version ) ) {
64
-			unset( $query_params[ 'calculate' ] );
62
+	public function remove_calculate_query_param($query_params, \EEM_Base $model, $version) {
63
+		if ($this->applies_to_version($version)) {
64
+			unset($query_params['calculate']);
65 65
 		}
66 66
 		return $query_params;
67 67
 	}
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 		\WP_REST_Request $request,
83 83
 		Read $controller
84 84
 	) {
85
-		if( $this->applies_to_version( $controller->get_model_version_info()->requested_version() ) ) {
86
-			unset( $entity_response_array[ '_calculated_fields' ] );
85
+		if ($this->applies_to_version($controller->get_model_version_info()->requested_version())) {
86
+			unset($entity_response_array['_calculated_fields']);
87 87
 		}
88 88
 		return $entity_response_array;
89 89
 	}
@@ -101,14 +101,14 @@  discard block
 block discarded – undo
101 101
 		Base $controller,
102 102
 		$version
103 103
 	) {
104
-		if( $this->applies_to_version( $version ) ) {
104
+		if ($this->applies_to_version($version)) {
105 105
 			$headers = array_diff_key(
106 106
 				$headers,
107 107
 				array_flip(
108 108
 					array(
109
-						Base::header_prefix_for_wp . 'Total',
110
-						Base::header_prefix_for_wp . 'TotalPages',
111
-						Base::header_prefix_for_wp . 'PageSize'
109
+						Base::header_prefix_for_wp.'Total',
110
+						Base::header_prefix_for_wp.'TotalPages',
111
+						Base::header_prefix_for_wp.'PageSize'
112 112
 					)));
113 113
 		}
114 114
 		return $headers;
@@ -130,14 +130,14 @@  discard block
 block discarded – undo
130 130
 		\WP_REST_Request $request,
131 131
 		Read $controller
132 132
 	) {
133
-		if( $this->applies_to_version( $controller->get_model_version_info()->requested_version() )
133
+		if ($this->applies_to_version($controller->get_model_version_info()->requested_version())
134 134
 			&& $model instanceof \EEM_CPT_Base
135 135
 		) {
136 136
 			$attachment = wp_get_attachment_image_src(
137
-				get_post_thumbnail_id( $entity_response_array[ $model->primary_key_name() ] ),
137
+				get_post_thumbnail_id($entity_response_array[$model->primary_key_name()]),
138 138
 				'full'
139 139
 			);
140
-			$entity_response_array[ 'featured_image_url' ] = !empty( $attachment ) ? $attachment[ 0 ] : null;
140
+			$entity_response_array['featured_image_url'] = ! empty($attachment) ? $attachment[0] : null;
141 141
 		}
142 142
 		return $entity_response_array;
143 143
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	 * @param string $requested_value
153 153
 	 * @return mixed
154 154
 	 */
155
-	public function use_negative_one_for_infinity_before_this_version( $new_value, $field_obj, $original_value, $requested_value ) {
156
-		if( $this->applies_to_version( $requested_value )
157
-			&& $original_value === EE_INF ) {
155
+	public function use_negative_one_for_infinity_before_this_version($new_value, $field_obj, $original_value, $requested_value) {
156
+		if ($this->applies_to_version($requested_value)
157
+			&& $original_value === EE_INF) {
158 158
 			//return the old representation of infinity in the JSON
159 159
 			return -1;
160 160
 		}
Please login to merge, or discard this patch.
core/db_models/EEM_Registration.model.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
3
-require_once ( EE_CLASSES . 'EE_Registration.class.php' );
2
+require_once (EE_MODELS.'EEM_Soft_Delete_Base.model.php');
3
+require_once (EE_CLASSES.'EE_Registration.class.php');
4 4
 /**
5 5
  *
6 6
  * Registration Model
@@ -92,31 +92,31 @@  discard block
 block discarded – undo
92 92
 	 *    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)
93 93
 	 * @return \EEM_Registration
94 94
 	 */
95
-	protected function __construct( $timezone ) {
96
-		$this->singular_item = __('Registration','event_espresso');
97
-		$this->plural_item = __('Registrations','event_espresso');
95
+	protected function __construct($timezone) {
96
+		$this->singular_item = __('Registration', 'event_espresso');
97
+		$this->plural_item = __('Registrations', 'event_espresso');
98 98
 
99 99
 		$this->_tables = array(
100
-			'Registration'=>new EE_Primary_Table('esp_registration','REG_ID')
100
+			'Registration'=>new EE_Primary_Table('esp_registration', 'REG_ID')
101 101
 		);
102 102
 		$this->_fields = array(
103 103
 			'Registration'=>array(
104
-				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID','event_espresso')),
105
-				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID','event_espresso'), false, 0, 'Event'),
106
-				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID','event_espresso'), false, 0, 'Attendee'),
107
-				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'),
108
-				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID','event_espresso'), false, 0, 'Ticket'),
109
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
-				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred','event_espresso'), false, time(), $timezone ),
111
-				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total','event_espresso'), false, 0),
112
-				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration','event_espresso'), false, 0),
113
-				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration','event_espresso'), false, ''),
114
-				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration','event_espresso'), false, ''),
115
-				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration','event_espresso'), false, ''),
116
-				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ','event_espresso'), true, 1),
117
-				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group','event_espresso'), false, 1),
118
-				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending','event_espresso'), false, false),
119
-				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false )
104
+				'REG_ID'=>new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')),
105
+				'EVT_ID'=>new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'),
106
+				'ATT_ID'=>new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'),
107
+				'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'),
108
+				'TKT_ID'=>new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'),
109
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'),
110
+				'REG_date'=>new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, time(), $timezone),
111
+				'REG_final_price'=>new EE_Money_Field('REG_final_price', __('Registration\'s share of the transaction total', 'event_espresso'), false, 0),
112
+				'REG_paid'=>new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0),
113
+				'REG_session'=>new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''),
114
+				'REG_code'=>new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''),
115
+				'REG_url_link'=>new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''),
116
+				'REG_count'=>new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1),
117
+				'REG_group_size'=>new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1),
118
+				'REG_att_is_going'=>new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false),
119
+				'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false)
120 120
 			)
121 121
 		);
122 122
 		$this->_model_relations = array(
@@ -128,11 +128,11 @@  discard block
 block discarded – undo
128 128
 			'Answer'=>new EE_Has_Many_Relation(),
129 129
 			'Checkin'=>new EE_Has_Many_Relation(),
130 130
 			'Registration_Payment' => new EE_Has_Many_Relation(),
131
-			'Payment'=>new EE_HABTM_Relation( 'Registration_Payment' ),
131
+			'Payment'=>new EE_HABTM_Relation('Registration_Payment'),
132 132
 		);
133 133
 		$this->_model_chain_to_wp_user = 'Event';
134 134
 
135
-		parent::__construct( $timezone );
135
+		parent::__construct($timezone);
136 136
 	}
137 137
 
138 138
 
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 	 *		@param bool  $translated If true will return the values as singular localized strings
166 166
 	 *		@return array
167 167
 	 */
168
-	public static function reg_status_array( $exclude = array(), $translated = FALSE ) {
169
-		EEM_Registration::instance()->_get_registration_status_array( $exclude );
170
-		return $translated ? EEM_Status::instance()->localized_status( self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
168
+	public static function reg_status_array($exclude = array(), $translated = FALSE) {
169
+		EEM_Registration::instance()->_get_registration_status_array($exclude);
170
+		return $translated ? EEM_Status::instance()->localized_status(self::$_reg_status, FALSE, 'sentence') : self::$_reg_status;
171 171
 	}
172 172
 
173 173
 
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
 	 * @param array $exclude
179 179
 	 * @return array
180 180
 	 */
181
-	private function _get_registration_status_array( $exclude = array() ) {
181
+	private function _get_registration_status_array($exclude = array()) {
182 182
 		//in the very rare circumstance that we are deleting a model's table's data
183 183
 		//and the table hasn't actually been created, this could have an error
184 184
 		/** @type WPDB $wpdb */
185 185
 		global $wpdb;
186
-		EE_Registry::instance()->load_helper( 'Activation' );
187
-		if( EEH_Activation::table_exists( $wpdb->prefix . 'esp_status' ) ){
188
-			$SQL = 'SELECT STS_ID, STS_code FROM '. $wpdb->prefix . 'esp_status WHERE STS_type = "registration"';
189
-			$results = $wpdb->get_results( $SQL );
186
+		EE_Registry::instance()->load_helper('Activation');
187
+		if (EEH_Activation::table_exists($wpdb->prefix.'esp_status')) {
188
+			$SQL = 'SELECT STS_ID, STS_code FROM '.$wpdb->prefix.'esp_status WHERE STS_type = "registration"';
189
+			$results = $wpdb->get_results($SQL);
190 190
 			self::$_reg_status = array();
191
-			foreach ( $results as $status ) {
192
-				if ( ! in_array( $status->STS_ID, $exclude )) {
193
-					self::$_reg_status[ $status->STS_ID ] = $status->STS_code;
191
+			foreach ($results as $status) {
192
+				if ( ! in_array($status->STS_ID, $exclude)) {
193
+					self::$_reg_status[$status->STS_ID] = $status->STS_code;
194 194
 				}
195 195
 			}
196 196
 		}
@@ -205,15 +205,15 @@  discard block
 block discarded – undo
205 205
 	 * @param  array  $where_params Array of query_params as described in the comments for EEM_Base::get_all()
206 206
 	 * @return wpdb results array
207 207
 	 */
208
-	public function get_reg_months_and_years( $where_params ) {
208
+	public function get_reg_months_and_years($where_params) {
209 209
 		$query_params[0] = $where_params;
210 210
 		$query_params['group_by'] = array('reg_year', 'reg_month');
211
-		$query_params['order_by'] = array( 'REG_date' => 'DESC' );
211
+		$query_params['order_by'] = array('REG_date' => 'DESC');
212 212
 		$columns_to_select = array(
213 213
 			'reg_year' => array('YEAR(REG_date)', '%s'),
214 214
 			'reg_month' => array('MONTHNAME(REG_date)', '%s')
215 215
 			);
216
-		return $this->_get_all_wpdb_results( $query_params, OBJECT, $columns_to_select );
216
+		return $this->_get_all_wpdb_results($query_params, OBJECT, $columns_to_select);
217 217
 	}
218 218
 
219 219
 
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	* 		@param		int		$ATT_ID
226 226
 	*		@return 	EE_Registration[]
227 227
 	*/
228
-	public function get_all_registrations_for_attendee( $ATT_ID = 0 ) {
229
-		if ( ! $ATT_ID ) {
228
+	public function get_all_registrations_for_attendee($ATT_ID = 0) {
229
+		if ( ! $ATT_ID) {
230 230
 			return FALSE;
231 231
 		}
232
-		return $this->get_all( array( array( 'ATT_ID' => $ATT_ID )));
232
+		return $this->get_all(array(array('ATT_ID' => $ATT_ID)));
233 233
 	}
234 234
 
235 235
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	 * @param string $REG_url_link
241 241
 	 * @return EE_Registration
242 242
 	 */
243
-	public function get_registration_for_reg_url_link($REG_url_link){
244
-		if(!$REG_url_link){
243
+	public function get_registration_for_reg_url_link($REG_url_link) {
244
+		if ( ! $REG_url_link) {
245 245
 			return false;
246 246
 		}
247 247
 		return $this->get_one(array(array('REG_url_link'=>$REG_url_link)));
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 	* 		@param    int		$att_nmbr 	in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required
260 260
 	*		@return 		mixed		array on success, FALSE on fail
261 261
 	*/
262
-	public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) {
262
+	public function get_registration_for_transaction_attendee($TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0) {
263 263
 		return $this->get_one(array(
264 264
 			array(
265 265
 				'TXN_ID'=>$TXN_ID,
266 266
 				'ATT_ID'=>$ATT_ID
267 267
 			),
268
-			'limit'=>array( min( ( $att_nmbr-1 ), 0 ), 1 )
268
+			'limit'=>array(min(($att_nmbr - 1), 0), 1)
269 269
 		));
270 270
 	}
271 271
 
@@ -277,17 +277,17 @@  discard block
 block discarded – undo
277 277
 	 *		@param $period string which can be passed to php's strtotime function (eg "-1 month")
278 278
 	 *		@return stdClass[] with properties regDate and total
279 279
 	*/
280
-	public function get_registrations_per_day_report( $period = '-1 month' ) {
280
+	public function get_registrations_per_day_report($period = '-1 month') {
281 281
 
282
-		$sql_date = $this->convert_datetime_for_query( 'REG_date', date("Y-m-d H:i:s", strtotime($period) ), 'Y-m-d H:i:s', 'UTC' );
283
-		$where = array( 'REG_date' => array( '>=', $sql_date ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
282
+		$sql_date = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
283
+		$where = array('REG_date' => array('>=', $sql_date), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
284 284
 
285
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_day_report' ) ) {
285
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_day_report')) {
286 286
 			$where['Event.EVT_wp_user'] = get_current_user_id();
287 287
 		}
288 288
 
289
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
290
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'REG_date' );
289
+		EE_Registry::instance()->load_helper('DTT_Helper');
290
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'REG_date');
291 291
 
292 292
 		$results = $this->_get_all_wpdb_results(
293 293
 				array(
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 				),
298 298
 				OBJECT,
299 299
 				array(
300
-					'regDate'=>array( 'DATE(' . $query_interval . ')','%s'),
301
-					'total'=>array('count(REG_ID)','%d')
300
+					'regDate'=>array('DATE('.$query_interval.')', '%s'),
301
+					'total'=>array('count(REG_ID)', '%d')
302 302
 				));
303 303
 		return $results;
304 304
 	}
@@ -313,23 +313,23 @@  discard block
 block discarded – undo
313 313
 	 * @return stdClass[] with properties Registration_REG_date and a column for each registration status as the STS_ID
314 314
 	 *                    (i.e. RAP)
315 315
 	 */
316
-	public function get_registrations_per_day_and_per_status_report( $period = '-1 month' ) {
316
+	public function get_registrations_per_day_and_per_status_report($period = '-1 month') {
317 317
 		global $wpdb;
318
-		$registration_table = $wpdb->prefix . 'esp_registration';
318
+		$registration_table = $wpdb->prefix.'esp_registration';
319 319
 		$event_table = $wpdb->posts;
320
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
320
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
321 321
 
322 322
 		//prepare the query interval for displaying offset
323
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
324
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'dates.REG_date' );
323
+		EE_Registry::instance()->load_helper('DTT_Helper');
324
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'dates.REG_date');
325 325
 
326 326
 		//inner date query
327 327
 		$inner_date_query = "SELECT DISTINCT REG_date from $registration_table ";
328 328
 		$inner_where = " WHERE";
329 329
 		//exclude events not authored by user if permissions in effect
330
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
330
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
331 331
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
332
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
332
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
333 333
 		}
334 334
 		$inner_where .= " REG_date >= '$sql_date'";
335 335
 		$inner_date_query .= $inner_where;
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 		$select_parts = array();
342 342
 
343 343
 		//loop through registration stati to do parts for each status.
344
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
345
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
344
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
345
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
346 346
 				continue;
347 347
 			}
348 348
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -350,14 +350,14 @@  discard block
 block discarded – undo
350 350
 		}
351 351
 
352 352
 		//setup the selects
353
-		$select .= implode(', ', $select_parts );
353
+		$select .= implode(', ', $select_parts);
354 354
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN ";
355 355
 
356 356
 		//setup the joins
357
-		$join .= implode( " LEFT JOIN ", $join_parts );
357
+		$join .= implode(" LEFT JOIN ", $join_parts);
358 358
 
359 359
 		//now let's put it all together
360
-		$query = $select . $join . ' GROUP BY Registration_REG_date';
360
+		$query = $select.$join.' GROUP BY Registration_REG_date';
361 361
 
362 362
 		//and execute it
363 363
 		$results = $wpdb->get_results(
@@ -378,23 +378,23 @@  discard block
 block discarded – undo
378 378
 	 * @param $period string which can be passed to php's strtotime function (eg "-1 month")
379 379
 	 *		@return stdClass[] each with properties event_name, reg_limit, and total
380 380
 	*/
381
-	public function get_registrations_per_event_report( $period = '-1 month' ) {
381
+	public function get_registrations_per_event_report($period = '-1 month') {
382 382
 
383
-		$date_sql = $this->convert_datetime_for_query( 'REG_date', date( "Y-m-d H:i:s", strtotime( $period )), 'Y-m-d H:i:s', 'UTC' );
384
-		$where = array( 'REG_date' => array( '>=', $date_sql ), 'STS_ID' => array( '!=', EEM_Registration::status_id_incomplete ) );
383
+		$date_sql = $this->convert_datetime_for_query('REG_date', date("Y-m-d H:i:s", strtotime($period)), 'Y-m-d H:i:s', 'UTC');
384
+		$where = array('REG_date' => array('>=', $date_sql), 'STS_ID' => array('!=', EEM_Registration::status_id_incomplete));
385 385
 
386
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
386
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
387 387
 			$where['Event.EVT_wp_user'] = get_current_user_id();
388 388
 		}
389 389
 		$results = $this->_get_all_wpdb_results(array(
390 390
 			$where,
391 391
 			'group_by'=>'Event.EVT_name',
392 392
 			'order_by'=>'Event.EVT_name',
393
-			'limit'=>array(0,24)),
393
+			'limit'=>array(0, 24)),
394 394
 			OBJECT,
395 395
 			array(
396
-				'event_name'=>array('Event_CPT.post_title','%s'),
397
-				'total'=>array('COUNT(REG_ID)','%s')
396
+				'event_name'=>array('Event_CPT.post_title', '%s'),
397
+				'total'=>array('COUNT(REG_ID)', '%s')
398 398
 			)
399 399
 		);
400 400
 
@@ -412,19 +412,19 @@  discard block
 block discarded – undo
412 412
 	 * @return stdClass[] with properties `Registration_Event` and a column for each registration status as the STS_ID
413 413
 	 *                    (i.e. RAP)
414 414
 	 */
415
-	public function get_registrations_per_event_and_per_status_report( $period = '-1 month' ) {
415
+	public function get_registrations_per_event_and_per_status_report($period = '-1 month') {
416 416
 		global $wpdb;
417
-		$registration_table = $wpdb->prefix . 'esp_registration';
417
+		$registration_table = $wpdb->prefix.'esp_registration';
418 418
 		$event_table = $wpdb->posts;
419
-		$sql_date = date("Y-m-d H:i:s", strtotime($period) );
419
+		$sql_date = date("Y-m-d H:i:s", strtotime($period));
420 420
 
421 421
 		//inner date query
422 422
 		$inner_date_query = "SELECT DISTINCT EVT_ID, REG_date from $registration_table ";
423 423
 		$inner_where = " WHERE";
424 424
 		//exclude events not authored by user if permissions in effect
425
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
425
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
426 426
 			$inner_date_query .= "LEFT JOIN $event_table ON ID = EVT_ID";
427
-			$inner_where .= " post_author = " . get_current_user_id() . " AND";
427
+			$inner_where .= " post_author = ".get_current_user_id()." AND";
428 428
 		}
429 429
 		$inner_where .= " REG_date >= '$sql_date'";
430 430
 		$inner_date_query .= $inner_where;
@@ -436,8 +436,8 @@  discard block
 block discarded – undo
436 436
 		$select_parts = array();
437 437
 
438 438
 		//loop through registration stati to do parts for each status.
439
-		foreach ( EEM_Registration::reg_status_array() as $STS_ID => $STS_code ) {
440
-			if ( $STS_ID === EEM_Registration::status_id_incomplete ) {
439
+		foreach (EEM_Registration::reg_status_array() as $STS_ID => $STS_code) {
440
+			if ($STS_ID === EEM_Registration::status_id_incomplete) {
441 441
 				continue;
442 442
 			}
443 443
 			$select_parts[] = "COUNT($STS_code.REG_ID) as $STS_ID";
@@ -445,14 +445,14 @@  discard block
 block discarded – undo
445 445
 		}
446 446
 
447 447
 		//setup the selects
448
-		$select .= implode( ', ', $select_parts );
448
+		$select .= implode(', ', $select_parts);
449 449
 		$select .= " FROM ($inner_date_query) AS dates LEFT JOIN $event_table as Event ON Event.ID = dates.EVT_ID LEFT JOIN ";
450 450
 
451 451
 		//setup remaining joins
452
-		$join .= implode( " LEFT JOIN ", $join_parts );
452
+		$join .= implode(" LEFT JOIN ", $join_parts);
453 453
 
454 454
 		//now put it all together
455
-		$query = $select . $join . ' GROUP BY Registration_Event';
455
+		$query = $select.$join.' GROUP BY Registration_Event';
456 456
 
457 457
 		//and execute
458 458
 		$results = $wpdb->get_results(
@@ -468,11 +468,11 @@  discard block
 block discarded – undo
468 468
 	 * @param int $TXN_ID
469 469
 	 * @return EE_Registration
470 470
 	 */
471
-	public function get_primary_registration_for_transaction_ID( $TXN_ID = 0){
472
-		if( ! $TXN_ID ){
471
+	public function get_primary_registration_for_transaction_ID($TXN_ID = 0) {
472
+		if ( ! $TXN_ID) {
473 473
 			return false;
474 474
 		}
475
-		return $this->get_one(array(array('TXN_ID'=>$TXN_ID,'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
475
+		return $this->get_one(array(array('TXN_ID'=>$TXN_ID, 'REG_count'=>  EEM_Registration::PRIMARY_REGISTRANT_COUNT)));
476 476
 	}
477 477
 
478 478
 
@@ -484,11 +484,11 @@  discard block
 block discarded – undo
484 484
 	 *		@param boolean $for_incomplete_payments
485 485
 	 *		@return int
486 486
 	 */
487
-	public function get_event_registration_count ( $EVT_ID, $for_incomplete_payments = FALSE ) {
487
+	public function get_event_registration_count($EVT_ID, $for_incomplete_payments = FALSE) {
488 488
 		// we only count approved registrations towards registration limits
489
-		$query_params = array( array( 'EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved ) );
490
-		if( $for_incomplete_payments ){
491
-			$query_params[0]['Transaction.STS_ID']=array('!=',  EEM_Transaction::complete_status_code);
489
+		$query_params = array(array('EVT_ID' => $EVT_ID, 'STS_ID' => self::status_id_approved));
490
+		if ($for_incomplete_payments) {
491
+			$query_params[0]['Transaction.STS_ID'] = array('!=', EEM_Transaction::complete_status_code);
492 492
 		}
493 493
 
494 494
 		return $this->count($query_params);
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 		/** @type WPDB $wpdb */
505 505
 		global $wpdb;
506 506
 		return $wpdb->query(
507
-				'DELETE r FROM ' . $this->table() . ' r LEFT JOIN ' . EEM_Transaction::instance()->table() . ' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
507
+				'DELETE r FROM '.$this->table().' r LEFT JOIN '.EEM_Transaction::instance()->table().' t ON r.TXN_ID = t.TXN_ID WHERE t.TXN_ID IS NULL' );
508 508
 	}
509 509
 
510 510
 	/**
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
515 515
 	 * @return int
516 516
 	 */
517
-	public function count_registrations_checked_into_datetime( $DTT_ID, $checked_in = true) {
517
+	public function count_registrations_checked_into_datetime($DTT_ID, $checked_in = true) {
518 518
 		return $this->count(
519 519
 			array(
520 520
 				array(
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 	 * @param boolean $checked_in whether to count registrations checked IN or OUT
533 533
 	 * @return int
534 534
 	 */
535
-	public function count_registrations_checked_into_event( $EVT_ID, $checked_in = true ) {
535
+	public function count_registrations_checked_into_event($EVT_ID, $checked_in = true) {
536 536
 		return $this->count(
537 537
 			array(
538 538
 				array(
Please login to merge, or discard this patch.
core/CPTs/EE_CPT_Strategy.core.php 1 patch
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 */
79 79
 	public static function instance() {
80 80
 		// check if class object is instantiated
81
-		if ( ! self::$_instance instanceof EE_CPT_Strategy ) {
81
+		if ( ! self::$_instance instanceof EE_CPT_Strategy) {
82 82
 			self::$_instance = new self();
83 83
 		}
84 84
 		return self::$_instance;
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 //		d( $this->_CPT_endpoints );
102 102
 //		d( $this->_CPT_taxonomies );
103 103
 
104
-		add_action( 'pre_get_posts', array( $this, 'pre_get_posts' ), 5 );
104
+		add_action('pre_get_posts', array($this, 'pre_get_posts'), 5);
105 105
 	}
106 106
 
107 107
 
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	private function _set_CPT_endpoints() {
116 116
 		$_CPT_endpoints = array();
117
-		if ( is_array( $this->_CPTs )) {
118
-			foreach ( $this->_CPTs as $CPT_type => $CPT ) {
119
-				$_CPT_endpoints [ $CPT['plural_slug'] ] = $CPT_type;
117
+		if (is_array($this->_CPTs)) {
118
+			foreach ($this->_CPTs as $CPT_type => $CPT) {
119
+				$_CPT_endpoints [$CPT['plural_slug']] = $CPT_type;
120 120
 			}
121 121
 		}
122 122
 		return $_CPT_endpoints;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @param WP_Query $WP_Query
132 132
 	 * @return void
133 133
 	 */
134
-	private function _set_EE_tags_on_WP_Query( WP_Query $WP_Query) {
134
+	private function _set_EE_tags_on_WP_Query(WP_Query $WP_Query) {
135 135
 		$WP_Query->is_espresso_event_single = FALSE;
136 136
 		$WP_Query->is_espresso_event_archive = FALSE;
137 137
 		$WP_Query->is_espresso_event_taxonomy = FALSE;
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	private function _set_CPT_taxonomies() {
160 160
 		// check if taxonomies have already been set
161
-		if ( empty( $this->_CPT_taxonomies )) {
161
+		if (empty($this->_CPT_taxonomies)) {
162 162
 			// and that this CPT has taxonomies registered for it
163
-			if ( isset( $this->CPT['args'] ) && isset( $this->CPT['args']['taxonomies'] )) {
163
+			if (isset($this->CPT['args']) && isset($this->CPT['args']['taxonomies'])) {
164 164
 				// if so then grab them, but we want the taxonomy name as the key
165
-				$taxonomies = array_flip( $this->CPT['args']['taxonomies'] );
165
+				$taxonomies = array_flip($this->CPT['args']['taxonomies']);
166 166
 				// then grab the list of ALL taxonomies
167 167
 				$all_taxonomies = EE_Register_CPTs::get_taxonomies();
168
-				foreach ( $taxonomies as $taxonomy => $details ) {
168
+				foreach ($taxonomies as $taxonomy => $details) {
169 169
 					// add details to our taxonomies if they exist
170
-					$taxonomies[ $taxonomy ] = isset( $all_taxonomies[ $taxonomy ] ) ? $all_taxonomies[ $taxonomy ] : NULL;
170
+					$taxonomies[$taxonomy] = isset($all_taxonomies[$taxonomy]) ? $all_taxonomies[$taxonomy] : NULL;
171 171
 				}
172 172
 				$this->_CPT_taxonomies = $taxonomies;
173 173
 			}
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 	 * @return void
193 193
 	 */
194 194
 	private function _set_CPT_terms() {
195
-		if ( empty( $this->_CPT_terms )) {
195
+		if (empty($this->_CPT_terms)) {
196 196
 			$terms = EEM_Term::instance()->get_all_CPT_post_tags();
197
-			foreach ( $terms as $term ) {
198
-				if ( $term instanceof EE_Term ) {
199
-					$this->_CPT_terms[ $term->slug() ] = $term;
197
+			foreach ($terms as $term) {
198
+				if ($term instanceof EE_Term) {
199
+					$this->_CPT_terms[$term->slug()] = $term;
200 200
 				}
201 201
 			}
202 202
 		}
@@ -211,24 +211,24 @@  discard block
 block discarded – undo
211 211
 	 * @param $WP_Query
212 212
 	 * @return void
213 213
 	 */
214
-	private function _set_post_type_for_terms( WP_Query $WP_Query ) {
214
+	private function _set_post_type_for_terms(WP_Query $WP_Query) {
215 215
 		// is a tag set ?
216
-		if ( isset( $WP_Query->query['tag'] )) {
216
+		if (isset($WP_Query->query['tag'])) {
217 217
 			// set post_tags
218 218
 			$this->_set_CPT_terms();
219 219
 			// is this tag archive term in the list of terms used by our CPTs ?
220
-			$term = isset ( $this->_CPT_terms[ $WP_Query->query['tag'] ] ) ? $this->_CPT_terms[ $WP_Query->query['tag'] ] : NULL;
220
+			$term = isset ($this->_CPT_terms[$WP_Query->query['tag']]) ? $this->_CPT_terms[$WP_Query->query['tag']] : NULL;
221 221
 			// verify the term
222
-			if ( $term instanceof EE_Term ) {
223
-				$term->post_type  = array_merge( array( 'post', 'page' ), (array)$term->post_type );
224
-				$term->post_type = apply_filters( 'FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term );
222
+			if ($term instanceof EE_Term) {
223
+				$term->post_type = array_merge(array('post', 'page'), (array) $term->post_type);
224
+				$term->post_type = apply_filters('FHEE__EE_CPT_Strategy___set_post_type_for_terms__term_post_type', $term->post_type, $term);
225 225
 				// if a post type is already set
226
-				if ( isset( $WP_Query->query_vars['post_type'] )) {
226
+				if (isset($WP_Query->query_vars['post_type'])) {
227 227
 						// add to existing array
228
-						$term->post_type = array_merge ( (array)$WP_Query->query_vars['post_type'], $term->post_type );
228
+						$term->post_type = array_merge((array) $WP_Query->query_vars['post_type'], $term->post_type);
229 229
 				}
230 230
 				// just set post_type to our CPT
231
-				$WP_Query->set( 'post_type', $term->post_type );
231
+				$WP_Query->set('post_type', $term->post_type);
232 232
 			}
233 233
 		}
234 234
 	}
@@ -243,17 +243,17 @@  discard block
 block discarded – undo
243 243
 	 * in order for is_archive() and is_single() methods to work properly.
244 244
 	 * @return void
245 245
 	 */
246
-	public function _possibly_set_ee_request_var(){
246
+	public function _possibly_set_ee_request_var() {
247 247
 		// check if ee action var has been set
248
-		if ( ! EE_Registry::instance()->REQ->is_set( 'ee' )) {
248
+		if ( ! EE_Registry::instance()->REQ->is_set('ee')) {
249 249
 			// check that route exists for CPT archive slug
250
-			if ( is_archive() && EE_Config::get_route( $this->CPT['plural_slug'] )) {
250
+			if (is_archive() && EE_Config::get_route($this->CPT['plural_slug'])) {
251 251
 				// ie: set "ee" to "events"
252
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['plural_slug'] );
252
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['plural_slug']);
253 253
 			// or does it match a single page CPT like /event/
254
-			} else if ( is_single() && EE_Config::get_route( $this->CPT['singular_slug'] )) {
254
+			} else if (is_single() && EE_Config::get_route($this->CPT['singular_slug'])) {
255 255
 				// ie: set "ee" to "event"
256
-				EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
256
+				EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
257 257
 			}
258 258
 		}
259 259
 	}
@@ -267,11 +267,11 @@  discard block
 block discarded – undo
267 267
 	 * @param WP_Query $WP_Query
268 268
 	 * @return void
269 269
 	 */
270
-	public function _set_paging( $WP_Query ) {
271
-		if ( $WP_Query->is_main_query() && apply_filters( 'FHEE__EE_CPT_Strategy___set_paging', TRUE )) {
272
-			$page = ( get_query_var('page') ) ? get_query_var('page') : NULL;
273
-			$paged = ( get_query_var('paged') ) ? get_query_var('paged') : $page;
274
-			$WP_Query->set( 'paged', $paged );
270
+	public function _set_paging($WP_Query) {
271
+		if ($WP_Query->is_main_query() && apply_filters('FHEE__EE_CPT_Strategy___set_paging', TRUE)) {
272
+			$page = (get_query_var('page')) ? get_query_var('page') : NULL;
273
+			$paged = (get_query_var('paged')) ? get_query_var('paged') : $page;
274
+			$WP_Query->set('paged', $paged);
275 275
 		}
276 276
 	}
277 277
 
@@ -288,35 +288,35 @@  discard block
 block discarded – undo
288 288
 	 * @param WP_Query $WP_Query
289 289
 	 * @return void
290 290
 	 */
291
-	public function pre_get_posts( $WP_Query ) {
291
+	public function pre_get_posts($WP_Query) {
292 292
 		// check that post-type is set
293
-		if ( ! $WP_Query instanceof WP_Query ) {
293
+		if ( ! $WP_Query instanceof WP_Query) {
294 294
 			return;
295 295
 		}
296 296
 
297 297
 		// add our conditionals
298
-		$this->_set_EE_tags_on_WP_Query( $WP_Query );
298
+		$this->_set_EE_tags_on_WP_Query($WP_Query);
299 299
 		// check for terms
300
-		$this->_set_post_type_for_terms( $WP_Query );
300
+		$this->_set_post_type_for_terms($WP_Query);
301 301
 		// make sure paging is always set
302
-		$this->_set_paging( $WP_Query );
302
+		$this->_set_paging($WP_Query);
303 303
 
304 304
 		// is a taxonomy set ?
305
-		if ( $WP_Query->is_tax ) {
305
+		if ($WP_Query->is_tax) {
306 306
 			// loop thru our taxonomies
307
-			foreach ( $this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details ) {
307
+			foreach ($this->_CPT_taxonomies as $CPT_taxonomy => $CPT_taxonomy_details) {
308 308
 				// check if one of our taxonomies is set as a query var
309
-				if ( isset( $WP_Query->query[ $CPT_taxonomy ] )) {
309
+				if (isset($WP_Query->query[$CPT_taxonomy])) {
310 310
 					// but which CPT does that correspond to??? hmmm... guess we gotta go looping
311
-					foreach ( $this->_CPTs as $post_type => $CPT ) {
311
+					foreach ($this->_CPTs as $post_type => $CPT) {
312 312
 						// verify our CPT has args, is public and has taxonomies set
313
-						if ( isset( $CPT['args'] ) && $CPT['args']['public'] && ! empty( $CPT['args']['taxonomies'] )) {
313
+						if (isset($CPT['args']) && $CPT['args']['public'] && ! empty($CPT['args']['taxonomies'])) {
314 314
 							// does the captured taxonomy belong to this CPT ?
315
-							if ( in_array( $CPT_taxonomy, $CPT['args']['taxonomies'] )) {
315
+							if (in_array($CPT_taxonomy, $CPT['args']['taxonomies'])) {
316 316
 								// if so, then add this CPT post_type to the current query's array of post_types'
317
-								$WP_Query->query_vars['post_type'] = isset( $WP_Query->query_vars['post_type'] ) ? (array)$WP_Query->query_vars['post_type'] : array();
317
+								$WP_Query->query_vars['post_type'] = isset($WP_Query->query_vars['post_type']) ? (array) $WP_Query->query_vars['post_type'] : array();
318 318
 								$WP_Query->query_vars['post_type'][] = $post_type;
319
-								switch( $post_type ) {
319
+								switch ($post_type) {
320 320
 									case 'espresso_events' :
321 321
 										$WP_Query->is_espresso_event_taxonomy = TRUE;
322 322
 										break;
@@ -337,27 +337,27 @@  discard block
 block discarded – undo
337 337
 //		d( $CPT_taxonomy );
338 338
 //		d( $WP_Query );
339 339
 
340
-		if ( isset( $WP_Query->query_vars['post_type'] )) {
340
+		if (isset($WP_Query->query_vars['post_type'])) {
341 341
 			// loop thru post_types as array
342
-			foreach ( (array)$WP_Query->query_vars['post_type'] as $post_type ) {
342
+			foreach ((array) $WP_Query->query_vars['post_type'] as $post_type) {
343 343
 
344 344
 				// is current query for an EE CPT ?
345
-				if ( isset( $this->_CPTs[ $post_type ] )) {
345
+				if (isset($this->_CPTs[$post_type])) {
346 346
 					// is EE on or off ?
347
-					if ( EE_Maintenance_Mode::instance()->level() ) {
347
+					if (EE_Maintenance_Mode::instance()->level()) {
348 348
 						// reroute CPT template view to maintenance_mode.template.php
349
-						if( ! has_filter( 'template_include',array( 'EE_Maintenance_Mode', 'template_include' ))){
350
-							add_filter( 'template_include', array( 'EE_Maintenance_Mode', 'template_include' ), 99999 );
349
+						if ( ! has_filter('template_include', array('EE_Maintenance_Mode', 'template_include'))) {
350
+							add_filter('template_include', array('EE_Maintenance_Mode', 'template_include'), 99999);
351 351
 						}
352
-						if( has_filter( 'the_content',array( EE_Maintenance_Mode::instance(), 'the_content' ) ) ) {
353
-							add_filter( 'the_content', array( $this, 'inject_EE_shortcode_placeholder' ), 1 );
352
+						if (has_filter('the_content', array(EE_Maintenance_Mode::instance(), 'the_content'))) {
353
+							add_filter('the_content', array($this, 'inject_EE_shortcode_placeholder'), 1);
354 354
 						}
355 355
 						return;
356 356
 					}
357 357
 					// load EE_Request_Handler (this was added as a result of https://events.codebasehq.com/projects/event-espresso/tickets/9037
358
-					EE_Registry::instance()->load_core( 'Request_Handler' );
358
+					EE_Registry::instance()->load_core('Request_Handler');
359 359
 					// grab details for the CPT the current query is for
360
-					$this->CPT = $this->_CPTs[ $post_type ];
360
+					$this->CPT = $this->_CPTs[$post_type];
361 361
 					// set post type
362 362
 					$this->CPT['post_type'] = $post_type;
363 363
 					// set taxonomies
@@ -365,27 +365,27 @@  discard block
 block discarded – undo
365 365
 					// the post or category or term that is triggering EE
366 366
 					$this->CPT['espresso_page'] = EE_Registry::instance()->REQ->is_espresso_page();
367 367
 					// requested post name
368
-					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get( 'post_name' );
368
+					$this->CPT['post_name'] = EE_Registry::instance()->REQ->get('post_name');
369 369
 					//d( $this->CPT );
370 370
 					// add support for viewing 'private', 'draft', or 'pending' posts
371
-					if ( is_user_logged_in() && isset( $WP_Query->query_vars['p'] ) && $WP_Query->query_vars['p'] != 0 && current_user_can( 'edit_post', $WP_Query->query_vars['p'] )) {
371
+					if (is_user_logged_in() && isset($WP_Query->query_vars['p']) && $WP_Query->query_vars['p'] != 0 && current_user_can('edit_post', $WP_Query->query_vars['p'])) {
372 372
 						// we can just inject directly into the WP_Query object
373
-						$WP_Query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
373
+						$WP_Query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
374 374
 						// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
375
-						EE_Registry::instance()->REQ->set( 'ee', $this->CPT['singular_slug'] );
375
+						EE_Registry::instance()->REQ->set('ee', $this->CPT['singular_slug']);
376 376
 					}
377 377
 					$this->_possibly_set_ee_request_var();
378 378
 					// convert post_type to model name
379
-					$model_name = str_replace( 'EE_', '', $this->CPT['class_name'] );
379
+					$model_name = str_replace('EE_', '', $this->CPT['class_name']);
380 380
 					// get CPT table data via CPT Model
381
-					$this->CPT_model = EE_Registry::instance()->load_model( $model_name );
381
+					$this->CPT_model = EE_Registry::instance()->load_model($model_name);
382 382
 					$this->CPT['tables'] = $this->CPT_model->get_tables();
383 383
 					// is there a Meta Table for this CPT?
384
-					$this->CPT['meta_table'] = isset( $this->CPT['tables'][ $model_name . '_Meta' ] ) ? $this->CPT['tables'][ $model_name . '_Meta' ] : FALSE;
384
+					$this->CPT['meta_table'] = isset($this->CPT['tables'][$model_name.'_Meta']) ? $this->CPT['tables'][$model_name.'_Meta'] : FALSE;
385 385
 					// creates classname like:  CPT_Event_Strategy
386
-					$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
386
+					$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
387 387
 					// load and instantiate
388
-					 $CPT_Strategy = EE_Registry::instance()->load_core ( $CPT_Strategy_class_name, array( 'WP_Query' => $WP_Query, 'CPT' => $this->CPT ));
388
+					 $CPT_Strategy = EE_Registry::instance()->load_core($CPT_Strategy_class_name, array('WP_Query' => $WP_Query, 'CPT' => $this->CPT));
389 389
 
390 390
 					// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
391 391
 					// here's the list of available filters in the WP_Query object
@@ -397,13 +397,13 @@  discard block
 block discarded – undo
397 397
 					// 'post_limits'
398 398
 					// 'posts_fields'
399 399
 					// 'posts_join'
400
-					add_filter( 'posts_fields', array( $this, 'posts_fields' ));
401
-					add_filter( 'posts_join',	array( $this, 'posts_join' ));
402
-					add_filter( 'get_' . $this->CPT['post_type'] . '_metadata', array( $CPT_Strategy, 'get_EE_post_type_metadata' ), 1, 4 );
403
-					add_filter( 'the_posts',	array( $this, 'the_posts' ), 1, 1 );
404
-					add_filter( 'get_edit_post_link', array( $this, 'get_edit_post_link' ), 10, 2 );
400
+					add_filter('posts_fields', array($this, 'posts_fields'));
401
+					add_filter('posts_join', array($this, 'posts_join'));
402
+					add_filter('get_'.$this->CPT['post_type'].'_metadata', array($CPT_Strategy, 'get_EE_post_type_metadata'), 1, 4);
403
+					add_filter('the_posts', array($this, 'the_posts'), 1, 1);
404
+					add_filter('get_edit_post_link', array($this, 'get_edit_post_link'), 10, 2);
405 405
 
406
-					$this->_do_template_filters( $WP_Query );
406
+					$this->_do_template_filters($WP_Query);
407 407
 				}
408 408
 			}
409 409
 		}
@@ -418,13 +418,13 @@  discard block
 block discarded – undo
418 418
 	 * @param $SQL
419 419
 	 * @return    string
420 420
 	 */
421
-	public function posts_fields( $SQL ) {
421
+	public function posts_fields($SQL) {
422 422
 		// does this CPT have a meta table ?
423
-		if ( ! empty( $this->CPT['meta_table'] )) {
423
+		if ( ! empty($this->CPT['meta_table'])) {
424 424
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
425
-			$SQL .= ', ' . $this->CPT['meta_table']->get_table_name() . '.* ' ;
425
+			$SQL .= ', '.$this->CPT['meta_table']->get_table_name().'.* ';
426 426
 		}
427
-		remove_filter( 'posts_fields', array( $this, 'posts_fields' ));
427
+		remove_filter('posts_fields', array($this, 'posts_fields'));
428 428
 		return $SQL;
429 429
 	}
430 430
 
@@ -452,14 +452,14 @@  discard block
 block discarded – undo
452 452
 	 * @param $SQL
453 453
 	 * @return    string
454 454
 	 */
455
-	public function posts_join( $SQL ) {
455
+	public function posts_join($SQL) {
456 456
 		// does this CPT have a meta table ?
457
-		if ( ! empty( $this->CPT['meta_table'] )) {
457
+		if ( ! empty($this->CPT['meta_table'])) {
458 458
 			global $wpdb;
459 459
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
460
-			$SQL .= ' LEFT JOIN ' . $this->CPT['meta_table']->get_table_name() . ' ON ( ' . $this->CPT['meta_table']->get_table_name() . '.' . $this->CPT['meta_table']->get_fk_on_table() . ' = ' . $wpdb->posts . '.ID ) ';
460
+			$SQL .= ' LEFT JOIN '.$this->CPT['meta_table']->get_table_name().' ON ( '.$this->CPT['meta_table']->get_table_name().'.'.$this->CPT['meta_table']->get_fk_on_table().' = '.$wpdb->posts.'.ID ) ';
461 461
 		}
462
-		remove_filter( 'posts_join',	array( $this, 'posts_join' ));
462
+		remove_filter('posts_join', array($this, 'posts_join'));
463 463
 		return $SQL;
464 464
 	}
465 465
 
@@ -472,18 +472,18 @@  discard block
 block discarded – undo
472 472
 	 * @param 	\WP_Post[] 	$posts
473 473
 	 * @return 	\WP_Post[]
474 474
 	 */
475
-	public function the_posts( $posts ) {
475
+	public function the_posts($posts) {
476 476
 //		d( $posts );
477 477
 		$CPT_class = $this->CPT['class_name'];
478 478
 		// loop thru posts
479
-		if ( is_array( $posts )) {
480
-			foreach( $posts as $key => $post ) {
481
-				if ( isset( $this->_CPTs[ $post->post_type ] )) {
482
-					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object( $post );
479
+		if (is_array($posts)) {
480
+			foreach ($posts as $key => $post) {
481
+				if (isset($this->_CPTs[$post->post_type])) {
482
+					$post->{$CPT_class} = $this->CPT_model->instantiate_class_from_post_object($post);
483 483
 				}
484 484
 			}
485 485
 		}
486
-		remove_filter( 'the_posts',	array( $this, 'the_posts' ), 1 );
486
+		remove_filter('the_posts', array($this, 'the_posts'), 1);
487 487
 		return $posts;
488 488
 	}
489 489
 
@@ -494,17 +494,17 @@  discard block
 block discarded – undo
494 494
 	 * @param $ID
495 495
 	 * @return string
496 496
 	 */
497
-	function get_edit_post_link( $url, $ID ) {
497
+	function get_edit_post_link($url, $ID) {
498 498
 		//need to make sure we only edit links if our cpt
499 499
 		global $post;
500
-		if ( ! isset( $this->_CPTs[ $post->post_type ] )) {
500
+		if ( ! isset($this->_CPTs[$post->post_type])) {
501 501
 			return $url;
502 502
 		}
503 503
 		//k made it here so all is good.
504 504
 		$scheme = is_ssl() ? 'https' : 'http';
505
-		$url = get_admin_url( EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme );
505
+		$url = get_admin_url(EE_Config::instance()->core->current_blog_id, 'admin.php', $scheme);
506 506
 		// http://example.com/wp-admin/admin.php?page=espresso_events&action=edit&post=205&edit_nonce=0d403530d6
507
-		return wp_nonce_url( add_query_arg( array( 'page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit' ), $url ), 'edit', 'edit_nonce' );
507
+		return wp_nonce_url(add_query_arg(array('page' => $this->CPT['post_type'], 'post' =>$ID, 'action' =>'edit'), $url), 'edit', 'edit_nonce');
508 508
 	}
509 509
 
510 510
 
@@ -518,11 +518,11 @@  discard block
 block discarded – undo
518 518
 	 * @param WP_Query $WP_Query
519 519
 	 * @return void
520 520
 	 */
521
-	protected function _do_template_filters( WP_Query $WP_Query ) {
521
+	protected function _do_template_filters(WP_Query $WP_Query) {
522 522
 		// if it's the main query  and requested cpt supports page_templates,
523
-		if ( $WP_Query->is_main_query() && ! empty( $this->CPT['args']['page_templates'] ) ) {
523
+		if ($WP_Query->is_main_query() && ! empty($this->CPT['args']['page_templates'])) {
524 524
 			// then let's hook into the appropriate query_template hook
525
-			add_filter( 'single_template', array( $this, 'single_cpt_template' ) );
525
+			add_filter('single_template', array($this, 'single_cpt_template'));
526 526
 		}
527 527
 	}
528 528
 
@@ -536,17 +536,17 @@  discard block
 block discarded – undo
536 536
 	 * @param string $current_template Existing default template path derived for this page call.
537 537
 	 * @return string the path to the full template file.
538 538
 	 */
539
-	public function single_cpt_template( $current_template ) {
539
+	public function single_cpt_template($current_template) {
540 540
 		$object = get_queried_object();
541 541
 		//does this called object HAVE a page template set that is something other than the default.
542
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
542
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
543 543
 
544 544
 		//exit early if default or not set or invalid path (accounts for theme changes)
545
-		if ( $template == 'default' || empty( $template ) || ! is_readable( get_stylesheet_directory() . '/' . $template ) ) {
545
+		if ($template == 'default' || empty($template) || ! is_readable(get_stylesheet_directory().'/'.$template)) {
546 546
 			return $current_template;
547 547
 		}
548 548
 		//made it here so we SHOULD be able to just locate the template and then return it.
549
-		$template = locate_template( array($template)  );
549
+		$template = locate_template(array($template));
550 550
 
551 551
 		return $template;
552 552
 	}
@@ -594,9 +594,9 @@  discard block
 block discarded – undo
594 594
 	 * @param 	array 	$arguments
595 595
 	 * @return 	\EE_CPT_Default_Strategy
596 596
 	 */
597
-	public function __construct( $arguments = array() ) {
598
-		$this->CPT = isset( $arguments['CPT'] ) ? $arguments['CPT'] : NULL;
599
-		$WP_Query = isset( $arguments['WP_Query'] ) ? $arguments['WP_Query'] : NULL;
597
+	public function __construct($arguments = array()) {
598
+		$this->CPT = isset($arguments['CPT']) ? $arguments['CPT'] : NULL;
599
+		$WP_Query = isset($arguments['WP_Query']) ? $arguments['WP_Query'] : NULL;
600 600
 		//EEH_Debug_Tools::printr( $this->CPT, '$this->CPT  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
601 601
 //		add_filter( 'pre_get_posts', array( $this, 'pre_get_posts' ), 999 );
602 602
 //		add_filter( 'the_posts', array( $this, 'the_posts' ), 1, 2 );
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	 * @param 	\WP_Query $WP_Query
612 612
 	 * @return 	\WP_Query
613 613
 	 */
614
-	public function pre_get_posts(  WP_Query $WP_Query  ) {
614
+	public function pre_get_posts(WP_Query $WP_Query) {
615 615
 		//EEH_Debug_Tools::printr( $WP_Query, '$WP_Query  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
616
-		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive() ) {
616
+		if ( ! $WP_Query->is_main_query() && ! $WP_Query->is_archive()) {
617 617
 			return $WP_Query;
618 618
 		}
619 619
 //		$WP_Query->set( 'post_type', array( $this->CPT['post_type'] ));
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * @param 	\WP_Query $WP_Query
632 632
 	 * @return 	\WP_Post[]
633 633
 	 */
634
-	public function the_posts(  $posts, WP_Query $WP_Query ) {
634
+	public function the_posts($posts, WP_Query $WP_Query) {
635 635
 		return $posts;
636 636
 	}
637 637
 
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 * @param 	string 	$single
648 648
 	 * @return 	mixed
649 649
 	 */
650
-	public function get_EE_post_type_metadata( $meta_value = NULL, $post_id, $meta_key, $single ) {
650
+	public function get_EE_post_type_metadata($meta_value = NULL, $post_id, $meta_key, $single) {
651 651
 		return $meta_value;
652 652
 	}
653 653
 
Please login to merge, or discard this patch.
core/EES_Shortcode.shortcode.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 	 * @param WP $WP
43 43
 	 * @return    void
44 44
 	 */
45
-	public abstract function run( WP $WP );
45
+	public abstract function run(WP $WP);
46 46
 
47 47
 
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	 *  @param		array 	$attributes
55 55
 	 *  @return 	mixed
56 56
 	 */
57
-	public abstract function process_shortcode( $attributes = array() );
57
+	public abstract function process_shortcode($attributes = array());
58 58
 
59 59
 
60 60
 
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	 * @param 	string $shortcode_class
66 66
 	 * @return 	\EES_Shortcode
67 67
 	 */
68
-	final public static function instance( $shortcode_class = NULL ) {
69
-		$shortcode_class = ! empty( $shortcode_class ) ? $shortcode_class : get_called_class();
70
-		if ( $shortcode_class == 'EES_Shortcode' || empty( $shortcode_class )) {
68
+	final public static function instance($shortcode_class = NULL) {
69
+		$shortcode_class = ! empty($shortcode_class) ? $shortcode_class : get_called_class();
70
+		if ($shortcode_class == 'EES_Shortcode' || empty($shortcode_class)) {
71 71
 			return NULL;
72 72
 		}
73
-		$shortcode = str_replace( 'EES_', '', strtoupper( $shortcode_class ));
74
-		$shortcode_obj = isset( EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL;
73
+		$shortcode = str_replace('EES_', '', strtoupper($shortcode_class));
74
+		$shortcode_obj = isset(EE_Registry::instance()->shortcodes->{$shortcode} ) ? EE_Registry::instance()->shortcodes->{$shortcode} : NULL;
75 75
 		return $shortcode_obj instanceof $shortcode_class || $shortcode_class == 'self' ? $shortcode_obj : new $shortcode_class();
76 76
 	}
77 77
 
@@ -86,23 +86,23 @@  discard block
 block discarded – undo
86 86
 	 * @param 	$attributes
87 87
 	 * @return 	mixed
88 88
 	 */
89
-	final public static function fallback_shortcode_processor( $attributes ) {
90
-		if ( EE_Maintenance_Mode::disable_frontend_for_maintenance() ) {
89
+	final public static function fallback_shortcode_processor($attributes) {
90
+		if (EE_Maintenance_Mode::disable_frontend_for_maintenance()) {
91 91
 			return null;
92 92
 		}
93 93
 		// what shortcode was actually parsed ?
94 94
 		$shortcode_class = get_called_class();
95 95
 		// notify rest of system that fallback processor was triggered
96
-		add_filter( 'FHEE__fallback_shortcode_processor__' . $shortcode_class, '__return_true' );
96
+		add_filter('FHEE__fallback_shortcode_processor__'.$shortcode_class, '__return_true');
97 97
 		// get instance of actual shortcode
98
-		$shortcode_obj = self::instance( $shortcode_class );
98
+		$shortcode_obj = self::instance($shortcode_class);
99 99
 		// verify class
100
-		if ( $shortcode_obj instanceof EES_Shortcode ) {
100
+		if ($shortcode_obj instanceof EES_Shortcode) {
101 101
 			global $wp;
102
-			$shortcode_obj->run( $wp );
102
+			$shortcode_obj->run($wp);
103 103
 			// set attributes and run the shortcode
104
-			$shortcode_obj->_attributes = (array)$attributes;
105
-			return $shortcode_obj->process_shortcode( $shortcode_obj->_attributes );
104
+			$shortcode_obj->_attributes = (array) $attributes;
105
+			return $shortcode_obj->process_shortcode($shortcode_obj->_attributes);
106 106
 		} else {
107 107
 			return NULL;
108 108
 		}
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 	 * @param 	$attributes
119 119
 	 * @return 	string
120 120
 	 */
121
-	final public static function invalid_shortcode_processor( $attributes ) {
121
+	final public static function invalid_shortcode_processor($attributes) {
122 122
 		return '';
123 123
 	}
124 124
 
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	 */
133 133
 	final public function __construct() {
134 134
 		// get classname, remove EES_prefix, and convert to UPPERCASE
135
-		$shortcode = strtoupper( str_replace( 'EES_', '', get_class( $this )));
135
+		$shortcode = strtoupper(str_replace('EES_', '', get_class($this)));
136 136
 		// assign shortcode to the preferred callback, which overwrites the "fallback shortcode processor" assigned earlier
137
-		add_shortcode( $shortcode, array( $this, 'process_shortcode' ));
137
+		add_shortcode($shortcode, array($this, 'process_shortcode'));
138 138
 		// make sure system knows this is an EE page
139
-		EE_Registry::instance()->REQ->set_espresso_page( TRUE );
139
+		EE_Registry::instance()->REQ->set_espresso_page(TRUE);
140 140
 	}
141 141
 
142 142
 
Please login to merge, or discard this patch.
core/helpers/EEH_Template.helper.php 1 patch
Spacing   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 
18
-if ( ! function_exists( 'espresso_get_template_part' )) {
18
+if ( ! function_exists('espresso_get_template_part')) {
19 19
 	/**
20 20
 	 * espresso_get_template_part
21 21
 	 * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
 	 * @param string $name The name of the specialised template.
26 26
 	 * @return string        the html output for the formatted money value
27 27
 	 */
28
-	function espresso_get_template_part( $slug = NULL, $name = NULL ) {
29
-		EEH_Template::get_template_part( $slug, $name );
28
+	function espresso_get_template_part($slug = NULL, $name = NULL) {
29
+		EEH_Template::get_template_part($slug, $name);
30 30
 	}
31 31
 }
32 32
 
33 33
 
34 34
 
35
-if ( ! function_exists( 'espresso_get_object_css_class' )) {
35
+if ( ! function_exists('espresso_get_object_css_class')) {
36 36
 	/**
37 37
 	 * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed
38 38
 	 *
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	 * @param  string $suffix added to the end of the generated class
43 43
 	 * @return string
44 44
 	 */
45
-	function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
46
-		return EEH_Template::get_object_css_class( $object, $prefix, $suffix );
45
+	function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
46
+		return EEH_Template::get_object_css_class($object, $prefix, $suffix);
47 47
 	}
48 48
 }
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * 	@return boolean
71 71
 	 */
72 72
 	public static function is_espresso_theme() {
73
-		return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE;
73
+		return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE;
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
 	 * 	@return void
80 80
 	 */
81 81
 	public static function load_espresso_theme_functions() {
82
-		if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) {
83
-			if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) {
84
-				require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' );
82
+		if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) {
83
+			if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) {
84
+				require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php');
85 85
 			}
86 86
 		}
87 87
 	}
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 	 * 	@return array
94 94
 	 */
95 95
 	public static function get_espresso_themes() {
96
-		if ( empty( EEH_Template::$_espresso_themes )) {
97
-			$espresso_themes =  glob( EE_PUBLIC . '*', GLOB_ONLYDIR );
98
-			if ( empty( $espresso_themes ) ) {
96
+		if (empty(EEH_Template::$_espresso_themes)) {
97
+			$espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR);
98
+			if (empty($espresso_themes)) {
99 99
 				return array();
100 100
 			}
101
-			if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) {
102
-			    unset( $espresso_themes[ $key ] );
101
+			if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) {
102
+			    unset($espresso_themes[$key]);
103 103
 			}
104 104
 			EEH_Template::$_espresso_themes = array();
105
-			foreach ( $espresso_themes as $espresso_theme ) {
106
-				EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme;
105
+			foreach ($espresso_themes as $espresso_theme) {
106
+				EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme;
107 107
 			}
108 108
 		}
109 109
 		return EEH_Template::$_espresso_themes;
@@ -122,16 +122,16 @@  discard block
 block discarded – undo
122 122
 	 * @param bool   $return_string
123 123
 	 * @return string        the html output for the formatted money value
124 124
 	 */
125
-	public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE  ) {
126
-		do_action( "get_template_part_{$slug}-{$name}", $slug, $name );
125
+	public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) {
126
+		do_action("get_template_part_{$slug}-{$name}", $slug, $name);
127 127
 		$templates = array();
128 128
 		$name = (string) $name;
129
-		if ( $name != '' ) {
129
+		if ($name != '') {
130 130
 			$templates[] = "{$slug}-{$name}.php";
131 131
 		}
132 132
 		// allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' );
133
-		if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) {
134
-			EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string );
133
+		if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) {
134
+			EEH_Template::locate_template($templates, $template_args, TRUE, $return_string);
135 135
 		}
136 136
 	}
137 137
 
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	 * 				Used in places where you don't actually load the template, you just want to know if there's a custom version of it.
183 183
 	 * @return mixed
184 184
 	 */
185
-	public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) {
185
+	public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) {
186 186
 		// first use WP locate_template to check for template in the current theme folder
187
-		$template_path = locate_template( $templates );
187
+		$template_path = locate_template($templates);
188 188
 
189
-		if ( $check_if_custom && !empty( $template_path ) )
189
+		if ($check_if_custom && ! empty($template_path))
190 190
 			return TRUE;
191 191
 
192 192
 		// not in the theme
193
-		if ( empty( $template_path )) {
193
+		if (empty($template_path)) {
194 194
 			// not even a template to look for ?
195
-			if ( empty( $templates )) {
195
+			if (empty($templates)) {
196 196
 				// get post_type
197
-				$post_type = EE_Registry::instance()->REQ->get( 'post_type' );
197
+				$post_type = EE_Registry::instance()->REQ->get('post_type');
198 198
 				// get array of EE Custom Post Types
199 199
 				$EE_CPTs = EE_Register_CPTs::get_CPTs();
200 200
 				// build template name based on request
201
-				if ( isset( $EE_CPTs[ $post_type ] )) {
202
-					$archive_or_single =  is_archive() ? 'archive' : '';
203
-					$archive_or_single =  is_single() ? 'single' : $archive_or_single;
204
-					$templates = $archive_or_single . '-' . $post_type . '.php';
201
+				if (isset($EE_CPTs[$post_type])) {
202
+					$archive_or_single = is_archive() ? 'archive' : '';
203
+					$archive_or_single = is_single() ? 'single' : $archive_or_single;
204
+					$templates = $archive_or_single.'-'.$post_type.'.php';
205 205
 				}
206 206
 			}
207 207
 			// currently active EE template theme
@@ -210,80 +210,80 @@  discard block
 block discarded – undo
210 210
 			// array of paths to folders that may contain templates
211 211
 			$template_folder_paths = array(
212 212
 				// first check the /wp-content/uploads/espresso/templates/(current EE theme)/  folder for an EE theme template file
213
-				EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme,
213
+				EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme,
214 214
 				// then in the root of the /wp-content/uploads/espresso/templates/ folder
215 215
 				EVENT_ESPRESSO_TEMPLATE_DIR
216 216
 			);
217 217
 
218 218
 			//add core plugin folders for checking only if we're not $check_if_custom
219
-			if ( ! $check_if_custom ) {
219
+			if ( ! $check_if_custom) {
220 220
 				$core_paths = array(
221 221
 					// in the  /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin
222
-					EE_PUBLIC . $current_theme,
222
+					EE_PUBLIC.$current_theme,
223 223
 					// in the  /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin
224
-					EE_TEMPLATES . $current_theme,
224
+					EE_TEMPLATES.$current_theme,
225 225
 					// or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/
226 226
 					EE_PLUGIN_DIR_PATH
227 227
 					);
228
-				$template_folder_paths = array_merge( $template_folder_paths, $core_paths );
228
+				$template_folder_paths = array_merge($template_folder_paths, $core_paths);
229 229
 			}
230 230
 
231 231
 			// now filter that array
232
-			$template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths );
233
-			$templates = is_array( $templates ) ? $templates : array( $templates );
234
-			$template_folder_paths = is_array( $template_folder_paths ) ? $template_folder_paths : array( $template_folder_paths );
232
+			$template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths);
233
+			$templates = is_array($templates) ? $templates : array($templates);
234
+			$template_folder_paths = is_array($template_folder_paths) ? $template_folder_paths : array($template_folder_paths);
235 235
 			// array to hold all possible template paths
236 236
 			$full_template_paths = array();
237 237
 
238 238
 			EE_Registry::instance()->load_helper('File');
239 239
 			// loop through $templates
240
-			foreach ( $templates as $template ) {
240
+			foreach ($templates as $template) {
241 241
 				// normalize directory separators
242
-				$template = EEH_File::standardise_directory_separators( $template );
243
-				$file_name = basename( $template );
244
-				$template_path_minus_file_name = substr( $template, 0, ( strlen( $file_name ) * -1 ) );
242
+				$template = EEH_File::standardise_directory_separators($template);
243
+				$file_name = basename($template);
244
+				$template_path_minus_file_name = substr($template, 0, (strlen($file_name) * -1));
245 245
 				// while looping through all template folder paths
246
-				foreach ( $template_folder_paths as $template_folder_path ) {
246
+				foreach ($template_folder_paths as $template_folder_path) {
247 247
 					// normalize directory separators
248
-					$template_folder_path = EEH_File::standardise_directory_separators( $template_folder_path );
248
+					$template_folder_path = EEH_File::standardise_directory_separators($template_folder_path);
249 249
 					// determine if any common base path exists between the two paths
250 250
 					$common_base_path = EEH_Template::_find_common_base_path(
251
-						array( $template_folder_path, $template_path_minus_file_name )
251
+						array($template_folder_path, $template_path_minus_file_name)
252 252
 					);
253
-					if ( $common_base_path !== '' ) {
253
+					if ($common_base_path !== '') {
254 254
 						// both paths have a common base, so just tack the filename onto our search path
255
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $file_name;
255
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$file_name;
256 256
 					} else {
257 257
 						// no common base path, so let's just concatenate
258
-						$resolved_path = EEH_File::end_with_directory_separator( $template_folder_path ) . $template;
258
+						$resolved_path = EEH_File::end_with_directory_separator($template_folder_path).$template;
259 259
 					}
260 260
 					// build up our template locations array by adding our resolved paths
261 261
 					$full_template_paths[] = $resolved_path;
262 262
 				}
263 263
 				// if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first
264
-				array_unshift( $full_template_paths, $template );
264
+				array_unshift($full_template_paths, $template);
265 265
 				// path to the directory of the current theme: /wp-content/themes/(current WP theme)/
266
-				array_unshift( $full_template_paths, get_stylesheet_directory() . DS . $file_name );
266
+				array_unshift($full_template_paths, get_stylesheet_directory().DS.$file_name);
267 267
 			}
268 268
 			// filter final array of full template paths
269
-			$full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name );
269
+			$full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths, $file_name);
270 270
 			// now loop through our final array of template location paths and check each location
271
-			foreach ( (array)$full_template_paths as $full_template_path ) {
272
-				if ( is_readable( $full_template_path )) {
273
-					$template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path );
271
+			foreach ((array) $full_template_paths as $full_template_path) {
272
+				if (is_readable($full_template_path)) {
273
+					$template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path);
274 274
 					break;
275 275
 				}
276 276
 			}
277 277
 		}
278 278
 		// if we got it and you want to see it...
279
-		if ( $template_path && $load && ! $check_if_custom  ) {
280
-			if ( $return_string ) {
281
-				return EEH_Template::display_template( $template_path, $template_args, TRUE );
279
+		if ($template_path && $load && ! $check_if_custom) {
280
+			if ($return_string) {
281
+				return EEH_Template::display_template($template_path, $template_args, TRUE);
282 282
 			} else {
283
-				EEH_Template::display_template( $template_path, $template_args, FALSE );
283
+				EEH_Template::display_template($template_path, $template_args, FALSE);
284 284
 			}
285 285
 		}
286
-		return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path;
286
+		return $check_if_custom && ! empty($template_path) ? TRUE : $template_path;
287 287
 	}
288 288
 
289 289
 
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 	 * @param array $paths
297 297
 	 * @return string
298 298
 	 */
299
-	protected static function _find_common_base_path( $paths ) {
299
+	protected static function _find_common_base_path($paths) {
300 300
 		$last_offset = 0;
301 301
 		$common_base_path = '';
302
-		while ( ( $index = strpos( $paths[ 0 ], DS, $last_offset ) ) !== false ) {
302
+		while (($index = strpos($paths[0], DS, $last_offset)) !== false) {
303 303
 			$dir_length = $index - $last_offset + 1;
304
-			$directory = substr( $paths[ 0 ], $last_offset, $dir_length );
305
-			foreach ( $paths as $path ) {
306
-				if ( substr( $path, $last_offset, $dir_length ) != $directory ) {
304
+			$directory = substr($paths[0], $last_offset, $dir_length);
305
+			foreach ($paths as $path) {
306
+				if (substr($path, $last_offset, $dir_length) != $directory) {
307 307
 					return $common_base_path;
308 308
 				}
309 309
 			}
310 310
 			$common_base_path .= $directory;
311 311
 			$last_offset = $index + 1;
312 312
 		}
313
-		return substr( $common_base_path, 0, -1 );
313
+		return substr($common_base_path, 0, -1);
314 314
 	}
315 315
 
316 316
 
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
 	 * @param  boolean    $return_string whether to send output immediately to screen, or capture and return as a string
323 323
 	 * @return mixed string
324 324
 	 */
325
-	public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) {
325
+	public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) {
326 326
 		//require the template validator for verifying variables are set according to how the template requires
327
-		EE_Registry::instance()->load_helper( 'Template_Validator' );
327
+		EE_Registry::instance()->load_helper('Template_Validator');
328 328
 
329 329
 		/**
330 330
 		 * These two filters are intended for last minute changes to templates being loaded and/or template arg
@@ -335,26 +335,26 @@  discard block
 block discarded – undo
335 335
 		 *
336 336
 		 * @since 4.6.0
337 337
 		 */
338
-		$template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path );
339
-		$template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args );
338
+		$template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path);
339
+		$template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args);
340 340
 
341 341
 		// you gimme nuttin - YOU GET NUTTIN !!
342
-		if ( ! $template_path || ! is_readable( $template_path )) {
342
+		if ( ! $template_path || ! is_readable($template_path)) {
343 343
 			return '';
344 344
 		}
345 345
 		// if $template_args are not in an array, then make it so
346
-		if ( ! is_array( $template_args ) && ! is_object( $template_args )) {
347
-			$template_args = array( $template_args );
346
+		if ( ! is_array($template_args) && ! is_object($template_args)) {
347
+			$template_args = array($template_args);
348 348
 		}
349
-		extract( (array) $template_args);
349
+		extract((array) $template_args);
350 350
 
351
-		if ( $return_string ) {
351
+		if ($return_string) {
352 352
 			// because we want to return a string, we are going to capture the output
353 353
 			ob_start();
354
-			include( $template_path );
354
+			include($template_path);
355 355
 			return ob_get_clean();
356 356
 		} else {
357
-			include( $template_path );
357
+			include($template_path);
358 358
 		}
359 359
 		return '';
360 360
 	}
@@ -372,27 +372,27 @@  discard block
 block discarded – undo
372 372
 	 * @param  string $suffix added to the end of the generated class
373 373
 	 * @return string
374 374
 	 */
375
-	public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) {
375
+	public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') {
376 376
 		// in the beginning...
377
-		$prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : '';
377
+		$prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : '';
378 378
 		// da muddle
379 379
 		$class = '';
380 380
 		// the end
381
-		$suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : '';
381
+		$suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : '';
382 382
 		// is the passed object an EE object ?
383
-		if ( $object instanceof EE_Base_Class ) {
383
+		if ($object instanceof EE_Base_Class) {
384 384
 			// grab the exact type of object
385
-			$obj_class = get_class( $object );
385
+			$obj_class = get_class($object);
386 386
 			// depending on the type of object...
387
-			switch ( $obj_class ) {
387
+			switch ($obj_class) {
388 388
 				// no specifics just yet...
389 389
 				default :
390
-					$class = strtolower( str_replace( '_', '-', $obj_class ));
391
-					$class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : '';
390
+					$class = strtolower(str_replace('_', '-', $obj_class));
391
+					$class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : '';
392 392
 
393 393
 			}
394 394
 		}
395
-		return $prefix . $class . $suffix;
395
+		return $prefix.$class.$suffix;
396 396
 	}
397 397
 
398 398
 
@@ -408,50 +408,50 @@  discard block
 block discarded – undo
408 408
 	 * @param string      $cur_code_span_class
409 409
 	 * @return string        the html output for the formatted money value
410 410
 	 */
411
-	public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) {
411
+	public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') {
412 412
 		// ensure amount was received
413
-		if ( is_null( $amount ) ) {
414
-			$msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' );
415
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
413
+		if (is_null($amount)) {
414
+			$msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso');
415
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
416 416
 			return '';
417 417
 		}
418 418
 		//ensure amount is float
419 419
 		$amount = (float) $amount;
420 420
 		// filter raw amount (allows 0.00 to be changed to "free" for example)
421
-		$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw );
421
+		$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw);
422 422
 		// still a number or was amount converted to a string like "free" ?
423
-		if ( is_float( $amount_formatted )) {
423
+		if (is_float($amount_formatted)) {
424 424
 			// was a country ISO code passed ? if so generate currency config object for that country
425
-			$mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL;
425
+			$mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL;
426 426
 			// verify results
427
-			if ( ! $mny instanceof EE_Currency_Config ) {
427
+			if ( ! $mny instanceof EE_Currency_Config) {
428 428
 				// set default config country currency settings
429 429
 				$mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config();
430 430
 			}
431 431
 			// format float
432
-			$amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds );
432
+			$amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds);
433 433
 			// add formatting ?
434
-			if ( ! $return_raw ) {
434
+			if ( ! $return_raw) {
435 435
 				// add currency sign
436
-				if( $mny->sign_b4 ){
437
-					if( $amount >= 0 ){
438
-						$amount_formatted = $mny->sign . $amount_formatted;
439
-					}else{
440
-						$amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted );
436
+				if ($mny->sign_b4) {
437
+					if ($amount >= 0) {
438
+						$amount_formatted = $mny->sign.$amount_formatted;
439
+					} else {
440
+						$amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted);
441 441
 					}
442 442
 
443
-				}else{
444
-					$amount_formatted =  $amount_formatted . $mny->sign;
443
+				} else {
444
+					$amount_formatted = $amount_formatted.$mny->sign;
445 445
 				}
446 446
 
447 447
 				// add currency code ?
448
-				$amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted;
448
+				$amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted;
449 449
 			}
450 450
 			// filter results
451
-			$amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw );
451
+			$amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw);
452 452
 		}
453 453
 		// clean up vars
454
-		unset( $mny );
454
+		unset($mny);
455 455
 		// return formatted currency amount
456 456
 		return $amount_formatted;
457 457
 	}
@@ -466,11 +466,11 @@  discard block
 block discarded – undo
466 466
 	 * @param  string  $schema    'UPPER', 'lower', or 'Sentence'
467 467
 	 * @return string             The localized label for the status id.
468 468
 	 */
469
-	public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) {
469
+	public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') {
470 470
 		/** @type EEM_Status $EEM_Status */
471
-		$EEM_Status = EE_Registry::instance()->load_model( 'Status' );
472
-		$status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema );
473
-		return $status[ $status_id ];
471
+		$EEM_Status = EE_Registry::instance()->load_model('Status');
472
+		$status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema);
473
+		return $status[$status_id];
474 474
 	}
475 475
 
476 476
 
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
 	 * @param string  $icon
484 484
 	 * @return string 	the html output for the button
485 485
 	 */
486
-	public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) {
487
-		$label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label;
488
-		$button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>';
486
+	public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') {
487
+		$label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label;
488
+		$button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>';
489 489
 		return $button;
490 490
 	}
491 491
 
@@ -502,21 +502,21 @@  discard block
 block discarded – undo
502 502
 	 * @param bool|string $help_text   (optional) send help text you want to use for the link if default not to be used
503 503
 	 * @return string              generated link
504 504
 	 */
505
-	public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) {
505
+	public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) {
506 506
 
507
-		if ( ! $page )
508
-			$page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page;
507
+		if ( ! $page)
508
+			$page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page;
509 509
 
510
-		if ( ! $action )
511
-			$action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action;
510
+		if ( ! $action)
511
+			$action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action;
512 512
 
513 513
 		$action = empty($action) ? 'default' : $action;
514 514
 
515 515
 
516
-		$help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id;
517
-		$icon = !$icon_style ? ' dashicons-editor-help' : $icon_style;
518
-		$help_text = !$help_text ? '' : $help_text;
519
-		return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>';
516
+		$help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id;
517
+		$icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style;
518
+		$help_text = ! $help_text ? '' : $help_text;
519
+		return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>';
520 520
 	}
521 521
 
522 522
 
@@ -528,31 +528,31 @@  discard block
 block discarded – undo
528 528
 	 * @param EE_Help_Tour
529 529
 	 * @return string         html
530 530
 	 */
531
-	public static function help_tour_stops_generator( EE_Help_Tour $tour ) {
531
+	public static function help_tour_stops_generator(EE_Help_Tour $tour) {
532 532
 		$id = $tour->get_slug();
533 533
 		$stops = $tour->get_stops();
534 534
 
535
-		$content = '<ol style="display:none" id="' . $id . '">';
535
+		$content = '<ol style="display:none" id="'.$id.'">';
536 536
 
537
-		foreach ( $stops as $stop ) {
538
-			$data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : '';
539
-			$data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : '';
537
+		foreach ($stops as $stop) {
538
+			$data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : '';
539
+			$data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : '';
540 540
 
541 541
 			//if container is set to modal then let's make sure we set the options accordingly
542
-			if ( empty( $data_id ) && empty( $data_class ) ) {
542
+			if (empty($data_id) && empty($data_class)) {
543 543
 				$stop['options']['modal'] = true;
544 544
 				$stop['options']['expose'] = true;
545 545
 			}
546 546
 
547
-			$custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : '';
548
-			$button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : '';
547
+			$custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : '';
548
+			$button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : '';
549 549
 			$inner_content = isset($stop['content']) ? $stop['content'] : '';
550 550
 
551 551
 			//options
552
-			if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) {
552
+			if (isset($stop['options']) && is_array($stop['options'])) {
553 553
 				$options = ' data-options="';
554
-				foreach ( $stop['options'] as $option => $value ) {
555
-					$options .= $option . ':' . $value . ';';
554
+				foreach ($stop['options'] as $option => $value) {
555
+					$options .= $option.':'.$value.';';
556 556
 				}
557 557
 				$options .= '"';
558 558
 			} else {
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 			}
561 561
 
562 562
 			//let's put all together
563
-			$content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>';
563
+			$content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>';
564 564
 		}
565 565
 
566 566
 		$content .= '</ol>';
@@ -581,31 +581,31 @@  discard block
 block discarded – undo
581 581
 	 * @throws EE_Error
582 582
 	 * @return string               html structure for status.
583 583
 	 */
584
-	public static function status_legend( $status_array, $active_status = '' ) {
585
-		if ( !is_array( $status_array ) )
586
-			throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') );
584
+	public static function status_legend($status_array, $active_status = '') {
585
+		if ( ! is_array($status_array))
586
+			throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso'));
587 587
 
588 588
 		$setup_array = array();
589
-		foreach ( $status_array as $item => $status ) {
589
+		foreach ($status_array as $item => $status) {
590 590
 			$setup_array[$item] = array(
591
-					'class' => 'ee-status-legend ee-status-legend-' . $status,
592
-					'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ),
591
+					'class' => 'ee-status-legend ee-status-legend-'.$status,
592
+					'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'),
593 593
 					'status' => $status
594 594
 				);
595 595
 		}
596 596
 
597
-		$content = '<div class="ee-list-table-legend-container">' . "\n";
598
-		$content .= '<h3>' . __('Status Legend', 'event_espresso') . '</h3>' . "\n";
599
-		$content .= '<dl class="ee-list-table-legend">' . "\n\t";
600
-		foreach ( $setup_array as $item => $details ) {
597
+		$content = '<div class="ee-list-table-legend-container">'."\n";
598
+		$content .= '<h3>'.__('Status Legend', 'event_espresso').'</h3>'."\n";
599
+		$content .= '<dl class="ee-list-table-legend">'."\n\t";
600
+		foreach ($setup_array as $item => $details) {
601 601
 			$active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : '';
602
-			$content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t";
603
-			$content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t";
604
-			$content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t";
605
-			$content .= '</dt>' . "\n";
602
+			$content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t";
603
+			$content .= '<span class="'.$details['class'].'"></span>'."\n\t\t";
604
+			$content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t";
605
+			$content .= '</dt>'."\n";
606 606
 		}
607
-		$content .= '</dl>' . "\n";
608
-		$content .= '</div>' . "\n";
607
+		$content .= '</dl>'."\n";
608
+		$content .= '</div>'."\n";
609 609
 		return $content;
610 610
 	}
611 611
 
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 	 * @return string
619 619
 	 */
620 620
 	public static function layout_array_as_table($data) {
621
-	if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) {
622
-		$data = (array)$data;
621
+	if (is_object($data) || $data instanceof __PHP_Incomplete_Class) {
622
+		$data = (array) $data;
623 623
 	}
624 624
 	EE_Registry::instance()->load_helper('Array');
625 625
 	ob_start();
@@ -633,10 +633,10 @@  discard block
 block discarded – undo
633 633
 						?>
634 634
 						<tr>
635 635
 							<td>
636
-								<?php echo $data_key;?>
636
+								<?php echo $data_key; ?>
637 637
 							</td>
638 638
 							<td>
639
-								<?php echo self::layout_array_as_table($data_values);?>
639
+								<?php echo self::layout_array_as_table($data_values); ?>
640 640
 							</td>
641 641
 						</tr>
642 642
 						<?php
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			<ul>
651 651
 				<?php
652 652
 				foreach ($data as $datum) {
653
-					echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>";
653
+					echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>";
654 654
 				}?>
655 655
 			</ul>
656 656
 			<?php
@@ -680,8 +680,8 @@  discard block
 block discarded – undo
680 680
 	 *
681 681
 	 * @return string
682 682
 	 */
683
-	public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
684
-		echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label );
683
+	public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
684
+		echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field, $paged_arg_name, $items_label);
685 685
 	}
686 686
 
687 687
 
@@ -705,13 +705,13 @@  discard block
 block discarded – undo
705 705
 	 *                                 )
706 706
 	 * @return  string
707 707
 	 */
708
-	public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array() ) {
708
+	public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE, $paged_arg_name = 'paged', $items_label = array()) {
709 709
 		$page_links = array();
710 710
 		$disable_first = $disable_last = '';
711 711
 		$total_items = (int) $total_items;
712 712
 		$per_page = (int) $per_page;
713 713
 		$current = (int) $current;
714
-		$paged_arg_name = empty( $paged_arg_name ) ? 'paged' : sanitize_key( $paged_arg_name );
714
+		$paged_arg_name = empty($paged_arg_name) ? 'paged' : sanitize_key($paged_arg_name);
715 715
 
716 716
 		//filter items_label
717 717
 		$items_label = apply_filters(
@@ -719,68 +719,68 @@  discard block
 block discarded – undo
719 719
 			$items_label
720 720
 		);
721 721
 
722
-		if ( empty( $items_label )
723
-		     || ! is_array( $items_label )
724
-		     || ! isset( $items_label['single'] )
725
-		     || ! isset( $items_label['plural'] ) ) {
722
+		if (empty($items_label)
723
+		     || ! is_array($items_label)
724
+		     || ! isset($items_label['single'])
725
+		     || ! isset($items_label['plural'])) {
726 726
 			$items_label = array(
727
-				'single' => __( '1 item', 'event_espresso' ),
728
-				'plural' => __( '%s items', 'event_espresso' )
727
+				'single' => __('1 item', 'event_espresso'),
728
+				'plural' => __('%s items', 'event_espresso')
729 729
 			);
730 730
 		} else {
731 731
 			$items_label = array(
732
-				'single' => '1 ' . esc_html( $items_label['single'] ),
733
-				'plural' => '%s ' . esc_html( $items_label['plural'] )
732
+				'single' => '1 '.esc_html($items_label['single']),
733
+				'plural' => '%s '.esc_html($items_label['plural'])
734 734
 			);
735 735
 		}
736 736
 
737
-		$total_pages = ceil( $total_items / $per_page );
737
+		$total_pages = ceil($total_items / $per_page);
738 738
 
739
-		if ( $total_pages <= 1 )
739
+		if ($total_pages <= 1)
740 740
 			return '';
741 741
 
742
-		$item_label = $total_items > 1 ? sprintf( $items_label['plural'], $total_items ) : $items_label['single'];
742
+		$item_label = $total_items > 1 ? sprintf($items_label['plural'], $total_items) : $items_label['single'];
743 743
 
744
-		$output = '<span class="displaying-num">' . $item_label . '</span>';
744
+		$output = '<span class="displaying-num">'.$item_label.'</span>';
745 745
 
746
-		if ( $current === 1 ) {
746
+		if ($current === 1) {
747 747
 			$disable_first = ' disabled';
748 748
 		}
749
-		if ( $current == $total_pages ) {
749
+		if ($current == $total_pages) {
750 750
 			$disable_last = ' disabled';
751 751
 		}
752 752
 
753
-		$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
754
-			'first-page' . $disable_first,
755
-			esc_attr__( 'Go to the first page' ),
756
-			esc_url( remove_query_arg( $paged_arg_name, $url ) ),
753
+		$page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>",
754
+			'first-page'.$disable_first,
755
+			esc_attr__('Go to the first page'),
756
+			esc_url(remove_query_arg($paged_arg_name, $url)),
757 757
 			'&laquo;'
758 758
 		);
759 759
 
760 760
 		$page_links[] = sprintf(
761 761
 			'<a class="%s" title="%s" href="%s">%s</a>',
762
-			'prev-page' . $disable_first,
763
-			esc_attr__( 'Go to the previous page' ),
764
-			esc_url( add_query_arg( $paged_arg_name, max( 1, $current-1 ), $url ) ),
762
+			'prev-page'.$disable_first,
763
+			esc_attr__('Go to the previous page'),
764
+			esc_url(add_query_arg($paged_arg_name, max(1, $current - 1), $url)),
765 765
 			'&lsaquo;'
766 766
 		);
767 767
 
768
-		if ( ! $show_num_field ) {
768
+		if ( ! $show_num_field) {
769 769
 			$html_current_page = $current;
770 770
 		} else {
771
-			$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
-				esc_attr__( 'Current page' ),
771
+			$html_current_page = sprintf("<input class='current-page' title='%s' type='text' name=$paged_arg_name value='%s' size='%d' />",
772
+				esc_attr__('Current page'),
773 773
 				$current,
774
-				strlen( $total_pages )
774
+				strlen($total_pages)
775 775
 			);
776 776
 		}
777 777
 
778 778
 		$html_total_pages = sprintf(
779 779
 			'<span class="total-pages">%s</span>',
780
-			number_format_i18n( $total_pages )
780
+			number_format_i18n($total_pages)
781 781
 		);
782 782
 		$page_links[] = sprintf(
783
-			_x( '%3$s%1$s of %2$s%4$s', 'paging' ),
783
+			_x('%3$s%1$s of %2$s%4$s', 'paging'),
784 784
 			$html_current_page,
785 785
 			$html_total_pages,
786 786
 			'<span class="paging-input">',
@@ -789,29 +789,29 @@  discard block
 block discarded – undo
789 789
 
790 790
 		$page_links[] = sprintf(
791 791
 			'<a class="%s" title="%s" href="%s">%s</a>',
792
-			'next-page' . $disable_last,
793
-			esc_attr__( 'Go to the next page' ),
794
-			esc_url( add_query_arg( $paged_arg_name, min( $total_pages, $current+1 ), $url ) ),
792
+			'next-page'.$disable_last,
793
+			esc_attr__('Go to the next page'),
794
+			esc_url(add_query_arg($paged_arg_name, min($total_pages, $current + 1), $url)),
795 795
 			'&rsaquo;'
796 796
 		);
797 797
 
798 798
 		$page_links[] = sprintf(
799 799
 			'<a class="%s" title="%s" href="%s">%s</a>',
800
-			'last-page' . $disable_last,
801
-			esc_attr__( 'Go to the last page' ),
802
-			esc_url( add_query_arg( $paged_arg_name, $total_pages, $url ) ),
800
+			'last-page'.$disable_last,
801
+			esc_attr__('Go to the last page'),
802
+			esc_url(add_query_arg($paged_arg_name, $total_pages, $url)),
803 803
 			'&raquo;'
804 804
 		);
805 805
 
806
-		$output .= "\n" . '<span class="pagination-links">' . join( "\n", $page_links ) . '</span>';
806
+		$output .= "\n".'<span class="pagination-links">'.join("\n", $page_links).'</span>';
807 807
 		// set page class
808
-		if ( $total_pages ) {
808
+		if ($total_pages) {
809 809
 			$page_class = $total_pages < 2 ? ' one-page' : '';
810 810
 		} else {
811 811
 			$page_class = ' no-pages';
812 812
 		}
813 813
 
814
-		return '<div class="tablenav"><div class="tablenav-pages' . $page_class . '">' . $output . '</div></div>';
814
+		return '<div class="tablenav"><div class="tablenav-pages'.$page_class.'">'.$output.'</div></div>';
815 815
 	}
816 816
 
817 817
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 //add_filter( 'FHEE__EEH_Template__format_currency__amount', 'convert_zero_to_free', 10, 2 );
828 828
 
829 829
 
830
-if ( ! function_exists( 'espresso_pagination' ) ) {
830
+if ( ! function_exists('espresso_pagination')) {
831 831
 	/**
832 832
 	 *    espresso_pagination
833 833
 	 *
@@ -839,21 +839,21 @@  discard block
 block discarded – undo
839 839
 		$big = 999999999; // need an unlikely integer
840 840
 		$pagination = paginate_links(
841 841
 		array(
842
-		'base'         => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
842
+		'base'         => str_replace($big, '%#%', esc_url(get_pagenum_link($big))),
843 843
 		'format'       => '?paged=%#%',
844
-		'current'      => max( 1, get_query_var( 'paged' ) ),
844
+		'current'      => max(1, get_query_var('paged')),
845 845
 		'total'        => $wp_query->max_num_pages,
846 846
 		'show_all'     => true,
847 847
 		'end_size'     => 10,
848 848
 		'mid_size'     => 6,
849 849
 		'prev_next'    => true,
850
-		'prev_text'    => __( '&lsaquo; PREV', 'event_espresso' ),
851
-		'next_text'    => __( 'NEXT &rsaquo;', 'event_espresso' ),
850
+		'prev_text'    => __('&lsaquo; PREV', 'event_espresso'),
851
+		'next_text'    => __('NEXT &rsaquo;', 'event_espresso'),
852 852
 		'type'         => 'plain',
853 853
 		'add_args'     => false,
854 854
 		'add_fragment' => ''
855 855
 		)
856 856
 		);
857
-		echo ! empty( $pagination ) ? '<div class="ee-pagination-dv clear">' . $pagination . '</div>' : '';
857
+		echo ! empty($pagination) ? '<div class="ee-pagination-dv clear">'.$pagination.'</div>' : '';
858 858
 	}
859 859
 }
860 860
\ No newline at end of file
Please login to merge, or discard this patch.
core/EE_Maintenance_Mode.core.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function instance() {
75 75
 		// check if class object is instantiated
76
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) {
76
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) {
77 77
 			self::$_instance = new self();
78 78
 		}
79 79
 		return self::$_instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode)
84 84
 	 * @return EE_Maintenance_Mode
85 85
 	 */
86
-	public static function reset(){
86
+	public static function reset() {
87 87
 		self::instance()->set_maintenance_mode_if_db_old();
88 88
 		return self::instance();
89 89
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	private function __construct() {
100 100
 		// if M-Mode level 2 is engaged, we still need basic assets loaded
101
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' ));
101
+		add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode'));
102 102
 		// shut 'er down down for maintenance ?
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 2 );
103
+		add_filter('the_content', array($this, 'the_content'), 2);
104 104
 		// add powered by EE msg
105
-		add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 );
105
+		add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * retrieves the maintenance mode option value from the db
113 113
 	 * @return int
114 114
 	 */
115
-	public function real_level(){
116
-		return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance );
115
+	public function real_level() {
116
+		return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * thinks their tables are present and up-to-date).
122 122
 	 * @return boolean
123 123
 	 */
124
-	public function models_can_query(){
124
+	public function models_can_query() {
125 125
 		return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance;
126 126
 	}
127 127
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode
135 135
 	 * @return int
136 136
 	 */
137
-	public function level(){
137
+	public function level() {
138 138
 		$real_maintenance_mode_level = $this->real_level();
139 139
 		//if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend
140
-		if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
140
+		if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
141 141
 			current_user_can('administrator') && //when the user is an admin
142
-			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
142
+			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else {
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	 * Determines if we need to put EE in maintenance mode because the database needs updating
152 152
 	 * @return boolean true if DB is old and maintenance mode was triggered; false otherwise
153 153
 	 */
154
-	public function set_maintenance_mode_if_db_old(){
155
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
156
-		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
154
+	public function set_maintenance_mode_if_db_old() {
155
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
156
+		if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		}elseif ($this->level() == self::level_2_complete_maintenance) {
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162
-			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
162
+			update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance);
163 163
 			return false;
164
-		}else{
164
+		} else {
165 165
 			return false;
166 166
 		}
167 167
 	}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param int $level
172 172
 	 * @return void
173 173
 	 */
174
-	public function set_maintenance_level($level){
175
-		do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level );
174
+	public function set_maintenance_level($level) {
175
+		do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level);
176 176
 		update_option(self::option_name_maintenance_mode, intval($level));
177 177
 	}
178 178
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *  @return 	string
200 200
 	 */
201 201
 	public function load_assets_required_for_m_mode() {
202
-		if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) {
203
-			wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
202
+		if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) {
203
+			wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
204 204
 			wp_enqueue_style('espresso_default');
205
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
206
-			wp_enqueue_script( 'espresso_core' );
205
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
206
+			wp_enqueue_script('espresso_core');
207 207
 		}
208 208
 	}
209 209
 
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	 */
222 222
 	public static function template_include() {
223 223
 		// shut 'er down down for maintenance ? then don't use any of our templates for our endpoints
224
-		return get_template_directory() . '/index.php';
224
+		return get_template_directory().'/index.php';
225 225
 	}
226 226
 
227 227
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param    string $the_content
236 236
 	 * @return    string
237 237
 	 */
238
-	public function the_content( $the_content ) {
238
+	public function the_content($the_content) {
239 239
 		// check if M-mode is engaged and for EE shortcode
240
-		if ( $this->level() && strpos( $the_content, '[ESPRESSO_' ) !== false ) {
240
+		if ($this->level() && strpos($the_content, '[ESPRESSO_') !== false) {
241 241
 			// this can eventually be moved to a template, or edited via admin. But for now...
242 242
 			$the_content = sprintf(
243
-				__( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ),
243
+				__('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'),
244 244
 				'<h3>',
245 245
 				'</h3><p>',
246 246
 				'</p>'
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 		// check if M-mode is engaged and for EE shortcode
265 265
 		if (
266 266
 			$this->real_level() &&
267
-			current_user_can( 'administrator' ) &&
267
+			current_user_can('administrator') &&
268 268
 			! is_admin() &&
269
-			! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
269
+			! (defined('DOING_AJAX') && DOING_AJAX)
270 270
 			&& EE_Registry::instance()->REQ->is_espresso_page()
271 271
 		) {
272 272
 			printf(
273
-				__( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ),
273
+				__('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'),
274 274
 				'<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="',
275 275
 				'">&times;</a><p>',
276
-				' &raquo; <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">',
276
+				' &raquo; <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">',
277 277
 				'</a></p></div>'
278 278
 			);
279 279
 		}
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	 *		@ return void
292 292
 	 */
293 293
 	final function __destruct() {}
294
-	final function __call($a,$b) {}
294
+	final function __call($a, $b) {}
295 295
 	final function __get($a) {}
296
-	final function __set($a,$b) {}
296
+	final function __set($a, $b) {}
297 297
 	final function __isset($a) {}
298 298
 	final function __unset($a) {}
299 299
 	final function __sleep() {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	final function __invoke() {}
305 305
 	final function __set_state() {}
306 306
 	final function __clone() {}
307
-	final static function __callStatic($a,$b) {}
307
+	final static function __callStatic($a, $b) {}
308 308
 
309 309
 }
310 310
 // End of file EE_Maintenance_Mode.core.php
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  */
43 43
 
44
-if ( function_exists( 'espresso_version' ) ) {
44
+if (function_exists('espresso_version')) {
45 45
 
46 46
 	/**
47 47
 	 *    espresso_duplicate_plugin_error
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 	function espresso_duplicate_plugin_error() {
51 51
 		?>
52 52
 		<div class="error">
53
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
53
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
54 54
 		</div>
55 55
 		<?php
56
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
56
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
57 57
 	}
58
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
58
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
59 59
 
60 60
 } else {
61 61
 
@@ -70,98 +70,98 @@  discard block
 block discarded – undo
70 70
 	}
71 71
 
72 72
 	// define versions
73
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
74
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
75
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
76
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
77
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
78
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
79
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
73
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
74
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
75
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
76
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
77
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
78
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
79
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
80 80
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
81
-	if ( ! defined( 'DS' ) ) {
82
-		define( 'DS', '/' );
81
+	if ( ! defined('DS')) {
82
+		define('DS', '/');
83 83
 	}
84
-	if ( ! defined( 'PS' ) ) {
85
-		define( 'PS', PATH_SEPARATOR );
84
+	if ( ! defined('PS')) {
85
+		define('PS', PATH_SEPARATOR);
86 86
 	}
87
-	if ( ! defined( 'SP' ) ) {
88
-		define( 'SP', ' ' );
87
+	if ( ! defined('SP')) {
88
+		define('SP', ' ');
89 89
 	}
90
-	if ( ! defined( 'EENL' ) ) {
91
-		define( 'EENL', "\n" );
90
+	if ( ! defined('EENL')) {
91
+		define('EENL', "\n");
92 92
 	}
93
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
93
+	define('EE_SUPPORT_EMAIL', '[email protected]');
94 94
 	// define the plugin directory and URL
95
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
96
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
95
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
96
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
98 98
 	// main root folder paths
99
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
100
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
101
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
102
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
103
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
104
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
105
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
106
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
99
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
100
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
101
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
102
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
103
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
104
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
105
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
106
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
107 107
 	// core system paths
108
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
109
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
110
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
111
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
112
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
113
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
114
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
115
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
116
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
117
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
118
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
119
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
108
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
109
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
110
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
111
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
112
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
113
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
114
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
115
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
116
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
117
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
118
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
119
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
120 120
 	// gateways
121
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
122
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
121
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
122
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
123 123
 	// asset URL paths
124
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
125
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
126
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
127
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
128
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
129
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
124
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
125
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
126
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
127
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
128
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
129
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
130 130
 	// define upload paths
131 131
 	$uploads = wp_upload_dir();
132 132
 	// define the uploads directory and URL
133
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
134
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
133
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
134
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
135 135
 	// define the templates directory and URL
136
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
136
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
137
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
138 138
 	// define the gateway directory and URL
139
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
139
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
140
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
141 141
 	// languages folder/path
142
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
143
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
142
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
143
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
144 144
 	//check for dompdf fonts in uploads
145
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
146
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
145
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
146
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
147 147
 	}
148 148
 	//ajax constants
149
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
150
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
149
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
150
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
151 151
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
152 152
 	//you're better to use this than its straight value (currently -1) in case you ever
153 153
 	//want to change its default value! or find when -1 means infinity
154
-	define( 'EE_INF_IN_DB', -1 );
155
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
154
+	define('EE_INF_IN_DB', -1);
155
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
156 156
 
157 157
 	/**
158 158
 	 *    espresso_plugin_activation
159 159
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
160 160
 	 */
161 161
 	function espresso_plugin_activation() {
162
-		update_option( 'ee_espresso_activation', true );
162
+		update_option('ee_espresso_activation', true);
163 163
 	}
164
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
164
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
165 165
 
166 166
 
167 167
 
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		//	}
176 176
 		//
177 177
 	}
178
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
178
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
179 179
 
180 180
 
181 181
 
@@ -185,15 +185,15 @@  discard block
 block discarded – undo
185 185
 	 */
186 186
 	function espresso_load_error_handling() {
187 187
 		// load debugging tools
188
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
189
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
188
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
189
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
190 190
 			EEH_Debug_Tools::instance();
191 191
 		}
192 192
 		// load error handling
193
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
194
-			require_once( EE_CORE . 'EE_Error.core.php' );
193
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
194
+			require_once(EE_CORE.'EE_Error.core.php');
195 195
 		} else {
196
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
196
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
197 197
 		}
198 198
 	}
199 199
 
@@ -207,25 +207,25 @@  discard block
 block discarded – undo
207 207
 	 * @param    string $full_path_to_file
208 208
 	 * @throws    EE_Error
209 209
 	 */
210
-	function espresso_load_required( $classname, $full_path_to_file ) {
210
+	function espresso_load_required($classname, $full_path_to_file) {
211 211
 		static $error_handling_loaded = false;
212
-		if ( ! $error_handling_loaded ) {
212
+		if ( ! $error_handling_loaded) {
213 213
 			espresso_load_error_handling();
214 214
 			$error_handling_loaded = true;
215 215
 		}
216
-		if ( is_readable( $full_path_to_file ) ) {
217
-			require_once( $full_path_to_file );
216
+		if (is_readable($full_path_to_file)) {
217
+			require_once($full_path_to_file);
218 218
 		} else {
219
-			throw new EE_Error ( sprintf(
220
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
219
+			throw new EE_Error(sprintf(
220
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
221 221
 				$classname
222
-			) );
222
+			));
223 223
 		}
224 224
 	}
225 225
 
226
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
227
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
228
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
226
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
227
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
228
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
229 229
 	new EE_Bootstrap();
230 230
 
231 231
 
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 
235 235
 
236 236
 
237
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
237
+if ( ! function_exists('espresso_deactivate_plugin')) {
238 238
 	/**
239 239
 	*    deactivate_plugin
240 240
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -243,12 +243,12 @@  discard block
 block discarded – undo
243 243
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
244 244
 	* @return    void
245 245
 	*/
246
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
247
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
248
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
246
+	function espresso_deactivate_plugin($plugin_basename = '') {
247
+		if ( ! function_exists('deactivate_plugins')) {
248
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
249 249
 		}
250
-		unset( $_GET[ 'activate' ] );
251
-		unset( $_REQUEST[ 'activate' ] );
252
-		deactivate_plugins( $plugin_basename );
250
+		unset($_GET['activate']);
251
+		unset($_REQUEST['activate']);
252
+		deactivate_plugins($plugin_basename);
253 253
 	}
254 254
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Transaction.model.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2
-require_once ( EE_MODELS . 'EEM_Base.model.php' );
2
+require_once (EE_MODELS.'EEM_Base.model.php');
3 3
 /**
4 4
  *
5 5
  * Transaction Model
@@ -68,36 +68,36 @@  discard block
 block discarded – undo
68 68
 	 * 		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)
69 69
 	 *	@return EEM_Transaction
70 70
 	 */
71
-	protected function __construct( $timezone ) {
72
-		$this->singular_item = __('Transaction','event_espresso');
73
-		$this->plural_item = __('Transactions','event_espresso');
71
+	protected function __construct($timezone) {
72
+		$this->singular_item = __('Transaction', 'event_espresso');
73
+		$this->plural_item = __('Transactions', 'event_espresso');
74 74
 
75 75
 		$this->_tables = array(
76
-			'Transaction'=>new EE_Primary_Table('esp_transaction','TXN_ID')
76
+			'Transaction'=>new EE_Primary_Table('esp_transaction', 'TXN_ID')
77 77
 		);
78 78
 		$this->_fields = array(
79 79
 			'Transaction'=>array(
80
-				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso')),
81
-				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created','event_espresso'), false, time(), $timezone ),
82
-				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction','event_espresso'), false, 0),
83
-				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date','event_espresso'), false, 0),
84
-				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
-				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data','event_espresso'), true, ''),
86
-				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt','event_espresso'), true, ''),
80
+				'TXN_ID'=>new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')),
81
+				'TXN_timestamp'=>new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, time(), $timezone),
82
+				'TXN_total'=>new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0),
83
+				'TXN_paid'=>new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0),
84
+				'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::failed_status_code, 'Status'),
85
+				'TXN_session_data'=>new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''),
86
+				'TXN_hash_salt'=>new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, ''),
87 87
 				'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Last Used Payment Method", 'event_espresso'), true, NULL, 'Payment_Method'),
88
-				'TXN_reg_steps' => new EE_Serialized_Text_Field( 'TXN_reg_steps', __( 'Registration Steps', 'event_espresso' ), FALSE, array() ),
88
+				'TXN_reg_steps' => new EE_Serialized_Text_Field('TXN_reg_steps', __('Registration Steps', 'event_espresso'), FALSE, array()),
89 89
 			)
90 90
 		);
91 91
 		$this->_model_relations = array(
92 92
 			'Registration'=>new EE_Has_Many_Relation(),
93 93
 			'Payment'=>new EE_Has_Many_Relation(),
94 94
 			'Status'=>new EE_Belongs_To_Relation(),
95
-			'Line_Item'=>new EE_Has_Many_Relation(false),//you can delete a transaction without needing to delete its line items
95
+			'Line_Item'=>new EE_Has_Many_Relation(false), //you can delete a transaction without needing to delete its line items
96 96
 			'Payment_Method'=>new EE_Belongs_To_Relation(),
97 97
 			'Message' => new EE_Has_Many_Relation()
98 98
 		);
99 99
 		$this->_model_chain_to_wp_user = 'Registration.Event';
100
-		parent::__construct( $timezone );
100
+		parent::__construct($timezone);
101 101
 
102 102
 	}
103 103
 
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 	 * @param string $period
109 109
 	 * @return \stdClass[]
110 110
 	 */
111
-	public function get_revenue_per_day_report( $period = '-1 month' ) {
112
-		$sql_date = $this->convert_datetime_for_query( 'TXN_timestamp', date( 'Y-m-d H:i:s', strtotime( $period ) ), 'Y-m-d H:i:s', 'UTC' );
111
+	public function get_revenue_per_day_report($period = '-1 month') {
112
+		$sql_date = $this->convert_datetime_for_query('TXN_timestamp', date('Y-m-d H:i:s', strtotime($period)), 'Y-m-d H:i:s', 'UTC');
113 113
 
114
-		EE_Registry::instance()->load_helper( 'DTT_Helper' );
115
-		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset( $this->get_timezone(), 'TXN_timestamp' );
114
+		EE_Registry::instance()->load_helper('DTT_Helper');
115
+		$query_interval = EEH_DTT_Helper::get_sql_query_interval_for_offset($this->get_timezone(), 'TXN_timestamp');
116 116
 
117 117
 		$results = $this->_get_all_wpdb_results(
118 118
 			array(
119 119
 				array(
120
-				'TXN_timestamp' => array( '>=', $sql_date ) ),
120
+				'TXN_timestamp' => array('>=', $sql_date) ),
121 121
 				'group_by' => 'txnDate',
122
-				'order_by' => array( 'TXN_timestamp' => 'ASC' )
122
+				'order_by' => array('TXN_timestamp' => 'ASC')
123 123
 			),
124 124
 			OBJECT,
125 125
 			array(
126
-				'txnDate' => array( 'DATE(' . $query_interval . ')', '%s' ),
127
-				'revenue' => array( 'SUM(Transaction.TXN_paid)', '%d' )
126
+				'txnDate' => array('DATE('.$query_interval.')', '%s'),
127
+				'revenue' => array('SUM(Transaction.TXN_paid)', '%d')
128 128
 			)
129 129
 		);
130 130
 		return $results;
@@ -140,17 +140,17 @@  discard block
 block discarded – undo
140 140
 	 * @throws \EE_Error
141 141
 	 * @return mixed
142 142
 	 */
143
-	public function get_revenue_per_event_report( $period = '-1 month' ) {
143
+	public function get_revenue_per_event_report($period = '-1 month') {
144 144
 		global $wpdb;
145
-		$transaction_table = $wpdb->prefix . 'esp_transaction';
146
-		$registration_table = $wpdb->prefix . 'esp_registration';
145
+		$transaction_table = $wpdb->prefix.'esp_transaction';
146
+		$registration_table = $wpdb->prefix.'esp_registration';
147 147
 		$event_table = $wpdb->posts;
148
-		$payment_table = $wpdb->prefix . 'esp_payment';
149
-		$sql_date = date( 'Y-m-d H:i:s', strtotime( $period ) );
148
+		$payment_table = $wpdb->prefix.'esp_payment';
149
+		$sql_date = date('Y-m-d H:i:s', strtotime($period));
150 150
 		$extra_event_on_join = '';
151 151
 		//exclude events not authored by user if permissions in effect
152
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_registrations', 'reg_per_event_report' ) ) {
153
-			$extra_event_on_join = ' AND Event.post_author = ' . get_current_user_id();
152
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_registrations', 'reg_per_event_report')) {
153
+			$extra_event_on_join = ' AND Event.post_author = '.get_current_user_id();
154 154
 		}
155 155
 
156 156
 		$approved_payment_status = EEM_Payment::status_id_approved;
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 	 * @param string $reg_url_link
197 197
 	 * @return EE_Transaction
198 198
 	 */
199
-	public function get_transaction_from_reg_url_link( $reg_url_link = '' ){
200
-		return $this->get_one( array(
199
+	public function get_transaction_from_reg_url_link($reg_url_link = '') {
200
+		return $this->get_one(array(
201 201
 			array(
202
-				'Registration.REG_url_link' => ! empty( $reg_url_link ) ? $reg_url_link : EE_Registry::instance()->REQ->get( 'e_reg_url_link', '' )
202
+				'Registration.REG_url_link' => ! empty($reg_url_link) ? $reg_url_link : EE_Registry::instance()->REQ->get('e_reg_url_link', '')
203 203
 			)
204 204
 		));
205 205
 	}
@@ -219,15 +219,15 @@  discard block
 block discarded – undo
219 219
 	 * @param boolean $save_txn whether or not to save the transaction during this function call
220 220
 	 * @return boolean
221 221
 	 */
222
-	public function update_based_on_payments( $transaction_obj_or_id, $save_txn = TRUE ){
222
+	public function update_based_on_payments($transaction_obj_or_id, $save_txn = TRUE) {
223 223
 		EE_Error::doing_it_wrong(
224
-			__CLASS__ . '::' . __FUNCTION__,
225
-			sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ),
224
+			__CLASS__.'::'.__FUNCTION__,
225
+			sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'),
226 226
 			'4.6.0'
227 227
 		);
228 228
 		/** @type EE_Transaction_Processor $transaction_processor */
229
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
230
-		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this->ensure_is_obj( $transaction_obj_or_id ));
229
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
230
+		return  $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this->ensure_is_obj($transaction_obj_or_id));
231 231
 	}
232 232
 
233 233
 	/**
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 			array(
259 259
 				0 => array(
260 260
 					'STS_ID' => EEM_Transaction::failed_status_code,
261
-					'TXN_timestamp' => array( '<', time() - $time_to_leave_alone )
261
+					'TXN_timestamp' => array('<', time() - $time_to_leave_alone)
262 262
 				)
263 263
 			),
264 264
 			$time_to_leave_alone
@@ -271,26 +271,26 @@  discard block
 block discarded – undo
271 271
 		 */
272 272
 		$txn_ids = apply_filters(
273 273
 			'FHEE__EEM_Transaction__delete_junk_transactions__transaction_ids_to_delete',
274
-			EEM_Transaction::instance()->get_col( $ids_query, 'TXN_ID' ),
274
+			EEM_Transaction::instance()->get_col($ids_query, 'TXN_ID'),
275 275
 			$time_to_leave_alone
276 276
 		);
277 277
 
278 278
 		//now that we have the ids to delete, let's get deletin'
279 279
 		//Why no wpdb->prepare?  Because the data is trusted.  We got the ids from the original query to get them FROM
280 280
 		//the db (which is sanitized) so no need to prepare them again.
281
-		if ( $txn_ids ) {
282
-			$query   = '
281
+		if ($txn_ids) {
282
+			$query = '
283 283
 				DELETE
284
-				FROM ' . $this->table() . '
284
+				FROM ' . $this->table().'
285 285
 				WHERE
286
-					TXN_ID IN ( ' . implode( ",", $txn_ids ) . ')';
287
-			$deleted = $wpdb->query( $query );
286
+					TXN_ID IN ( ' . implode(",", $txn_ids).')';
287
+			$deleted = $wpdb->query($query);
288 288
 		}
289
-		if ( $deleted ) {
289
+		if ($deleted) {
290 290
 			/**
291 291
 			 * Allows code to do something after the transactions have been deleted.
292 292
 			 */
293
-			do_action( 'AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids );
293
+			do_action('AHEE__EEM_Transaction__delete_junk_transactions__successful_deletion', $txn_ids);
294 294
 		}
295 295
 		return $deleted;
296 296
 	}
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +264 added lines, -264 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function instance() {
104 104
 		// check if class object is instantiated
105
-		if ( ! self::$_instance instanceof EE_System ) {
105
+		if ( ! self::$_instance instanceof EE_System) {
106 106
 			self::$_instance = new self();
107 107
 		}
108 108
 		return self::$_instance;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	 * resets the instance and returns it
114 114
 	 * @return EE_System
115 115
 	 */
116
-	public static function reset(){
116
+	public static function reset() {
117 117
 		self::$_instance->_req_type = NULL;
118 118
 		//we need to reset the migration manager in order for it to detect DMSs properly
119 119
 		EE_Data_Migration_Manager::reset();
120 120
 		//make sure none of the old hooks are left hanging around
121
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
121
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
122 122
 		self::instance()->detect_activations_or_upgrades();
123 123
 		self::instance()->perform_activations_upgrades_and_migrations();
124 124
 		return self::instance();
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	 * @access    private
135 135
 	 */
136 136
 	private function __construct() {
137
-		do_action( 'AHEE__EE_System__construct__begin', $this );
137
+		do_action('AHEE__EE_System__construct__begin', $this);
138 138
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
139
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
139
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
140 140
 		// when an ee addon is activated, we want to call the core hook(s) again
141 141
 		// because the newly-activated addon didn't get a chance to run at all
142
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
142
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
143 143
 		// detect whether install or upgrade
144
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
144
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
145 145
 		// load EE_Config, EE_Textdomain, etc
146
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
146
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
147 147
 		// load EE_Config, EE_Textdomain, etc
148
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
148
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
149 149
 		// you wanna get going? I wanna get going... let's get going!
150
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
150
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
151 151
 		//other housekeeping
152 152
 		//exclude EE critical pages from wp_list_pages
153
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
153
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
154 154
 		// ALL EE Addons should use the following hook point to attach their initial setup too
155 155
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
156
-		do_action( 'AHEE__EE_System__construct__complete', $this );
156
+		do_action('AHEE__EE_System__construct__complete', $this);
157 157
 	}
158 158
 
159 159
 
@@ -173,30 +173,30 @@  discard block
 block discarded – undo
173 173
 	public function load_espresso_addons() {
174 174
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
175 175
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
176
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
176
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
177 177
 		//load and setup EE_Capabilities
178
-		EE_Registry::instance()->load_core( 'Capabilities' );
178
+		EE_Registry::instance()->load_core('Capabilities');
179 179
 		//caps need to be initialized on every request so that capability maps are set.
180 180
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
181 181
 		EE_Registry::instance()->CAP->init_caps();
182
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
182
+		do_action('AHEE__EE_System__load_espresso_addons');
183 183
 		//if the WP API basic auth plugin isn't already loaded, load it now.
184 184
 		//We want it for mobile apps. Just include the entire plugin
185 185
 		//also, don't load the basic auth when a plugin is getting activated, because
186 186
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
187 187
 		//and causes a fatal error
188
-		if( !function_exists( 'json_basic_auth_handler' )
189
-			&& ! function_exists( 'json_basic_auth_error' )
188
+		if ( ! function_exists('json_basic_auth_handler')
189
+			&& ! function_exists('json_basic_auth_error')
190 190
 			&& ! (
191
-				isset( $_GET[ 'action'] )
192
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
191
+				isset($_GET['action'])
192
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
193 193
 			)
194 194
 			&& ! (
195
-				isset( $_GET['activate' ] )
196
-				&& $_GET['activate' ] === 'true'
195
+				isset($_GET['activate'])
196
+				&& $_GET['activate'] === 'true'
197 197
 			)
198 198
 		) {
199
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
199
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
200 200
 		}
201 201
 	}
202 202
 
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @access public
213 213
 	 * @return void
214 214
 	 */
215
-	public function detect_activations_or_upgrades(){
215
+	public function detect_activations_or_upgrades() {
216 216
 		//first off: let's make sure to handle core
217 217
 		$this->detect_if_activation_or_upgrade();
218
-		foreach(EE_Registry::instance()->addons as $addon){
218
+		foreach (EE_Registry::instance()->addons as $addon) {
219 219
 			//detect teh request type for that addon
220 220
 			$addon->detect_activation_or_upgrade();
221 221
 		}
@@ -236,44 +236,44 @@  discard block
 block discarded – undo
236 236
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
237 237
 
238 238
 		// load M-Mode class
239
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
239
+		EE_Registry::instance()->load_core('Maintenance_Mode');
240 240
 		// check if db has been updated, or if its a brand-new installation
241 241
 
242 242
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
243
-		$request_type =  $this->detect_req_type($espresso_db_update);
243
+		$request_type = $this->detect_req_type($espresso_db_update);
244 244
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
245
-		if( $request_type != EE_System::req_type_normal){
245
+		if ($request_type != EE_System::req_type_normal) {
246 246
 			EE_Registry::instance()->load_helper('Activation');
247 247
 		}
248 248
 
249
-		switch($request_type){
249
+		switch ($request_type) {
250 250
 			case EE_System::req_type_new_activation:
251
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
252
-				$this->_handle_core_version_change( $espresso_db_update );
251
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
252
+				$this->_handle_core_version_change($espresso_db_update);
253 253
 				break;
254 254
 			case EE_System::req_type_reactivation:
255
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
256
-				$this->_handle_core_version_change( $espresso_db_update );
255
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
256
+				$this->_handle_core_version_change($espresso_db_update);
257 257
 				break;
258 258
 			case EE_System::req_type_upgrade:
259
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
259
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
260 260
 				//migrations may be required now that we've upgraded
261 261
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
262
-				$this->_handle_core_version_change( $espresso_db_update );
262
+				$this->_handle_core_version_change($espresso_db_update);
263 263
 //				echo "done upgrade";die;
264 264
 				break;
265 265
 			case EE_System::req_type_downgrade:
266
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
266
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
267 267
 				//its possible migrations are no longer required
268 268
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
269
-				$this->_handle_core_version_change( $espresso_db_update );
269
+				$this->_handle_core_version_change($espresso_db_update);
270 270
 				break;
271 271
 			case EE_System::req_type_normal:
272 272
 			default:
273 273
 //				$this->_maybe_redirect_to_ee_about();
274 274
 				break;
275 275
 		}
276
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
276
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
277 277
 	}
278 278
 
279 279
 	/**
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 	 * initializing the database later during the request
282 282
 	 * @param array $espresso_db_update
283 283
 	 */
284
-	protected function _handle_core_version_change( $espresso_db_update ){
285
-		$this->update_list_of_installed_versions( $espresso_db_update );
284
+	protected function _handle_core_version_change($espresso_db_update) {
285
+		$this->update_list_of_installed_versions($espresso_db_update);
286 286
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
287
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
287
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
288 288
 	}
289 289
 
290 290
 
@@ -299,44 +299,44 @@  discard block
 block discarded – undo
299 299
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
300 300
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
301 301
 	 */
302
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
303
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
304
-		if( ! $espresso_db_update){
305
-			$espresso_db_update = get_option( 'espresso_db_update' );
302
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
303
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
304
+		if ( ! $espresso_db_update) {
305
+			$espresso_db_update = get_option('espresso_db_update');
306 306
 		}
307 307
 		// check that option is an array
308
-		if( ! is_array( $espresso_db_update )) {
308
+		if ( ! is_array($espresso_db_update)) {
309 309
 			// if option is FALSE, then it never existed
310
-			if ( $espresso_db_update === FALSE ) {
310
+			if ($espresso_db_update === FALSE) {
311 311
 				// make $espresso_db_update an array and save option with autoload OFF
312
-				$espresso_db_update =  array();
313
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
312
+				$espresso_db_update = array();
313
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
314 314
 			} else {
315 315
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
316
-				$espresso_db_update =  array( $espresso_db_update=>array() );
317
-				update_option( 'espresso_db_update', $espresso_db_update );
316
+				$espresso_db_update = array($espresso_db_update=>array());
317
+				update_option('espresso_db_update', $espresso_db_update);
318 318
 			}
319
-		}else{
319
+		} else {
320 320
 			$corrected_db_update = array();
321 321
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
322
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
323
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
322
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
323
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
324 324
 					//the key is an int, and the value IS NOT an array
325 325
 					//so it must be numerically-indexed, where values are versions installed...
326 326
 					//fix it!
327 327
 					$version_string = $should_be_array;
328 328
 					$corrected_db_update[$version_string] = array('unknown-date');
329
-				}else{
329
+				} else {
330 330
 					//ok it checks out
331 331
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
332 332
 				}
333 333
 			}
334 334
 			$espresso_db_update = $corrected_db_update;
335
-			update_option( 'espresso_db_update', $espresso_db_update );
335
+			update_option('espresso_db_update', $espresso_db_update);
336 336
 
337 337
 		}
338 338
 
339
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
339
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
340 340
 		return $espresso_db_update;
341 341
 	}
342 342
 
@@ -355,34 +355,34 @@  discard block
 block discarded – undo
355 355
 	 * so we prefer to only do it when necessary
356 356
 	 * @return void
357 357
 	 */
358
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
358
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
359 359
 		$request_type = $this->detect_req_type();
360 360
 		//only initialize system if we're not in maintenance mode.
361
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
362
-			update_option( 'ee_flush_rewrite_rules', TRUE );
361
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
362
+			update_option('ee_flush_rewrite_rules', TRUE);
363 363
 
364
-			if( $verify_schema ) {
364
+			if ($verify_schema) {
365 365
 				EEH_Activation::initialize_db_and_folders();
366 366
 			}
367 367
 			EEH_Activation::initialize_db_content();
368 368
 			EEH_Activation::system_initialization();
369
-			if( $initialize_addons_too ) {
369
+			if ($initialize_addons_too) {
370 370
 				$this->initialize_addons();
371 371
 			}
372
-		}else{
373
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
372
+		} else {
373
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
374 374
 		}
375
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
376
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
375
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
376
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
377 377
 		}
378 378
 	}
379 379
 
380 380
 	/**
381 381
 	 * Initializes the db for all registered addons
382 382
 	 */
383
-	public function initialize_addons(){
383
+	public function initialize_addons() {
384 384
 		//foreach registered addon, make sure its db is up-to-date too
385
-		foreach(EE_Registry::instance()->addons as $addon){
385
+		foreach (EE_Registry::instance()->addons as $addon) {
386 386
 			$addon->initialize_db_if_no_migrations_required();
387 387
 		}
388 388
 	}
@@ -394,16 +394,16 @@  discard block
 block discarded – undo
394 394
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
395 395
 	 * @return 	boolean success as to whether or not this option was changed
396 396
 	 */
397
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
398
-		if( ! $version_history ) {
397
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
398
+		if ( ! $version_history) {
399 399
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
400 400
 		}
401
-		if( $current_version_to_add == NULL){
401
+		if ($current_version_to_add == NULL) {
402 402
 			$current_version_to_add = espresso_version();
403 403
 		}
404
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
404
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
405 405
 		// re-save
406
-		return update_option( 'espresso_db_update', $version_history );
406
+		return update_option('espresso_db_update', $version_history);
407 407
 	}
408 408
 
409 409
 
@@ -420,10 +420,10 @@  discard block
 block discarded – undo
420 420
 	 *                            but still know if this is a new install or not
421 421
 	 * @return int one of the constants on EE_System::req_type_
422 422
 	 */
423
-	public function detect_req_type( $espresso_db_update = NULL ){
424
-		if ( $this->_req_type === NULL ){
425
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
426
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
423
+	public function detect_req_type($espresso_db_update = NULL) {
424
+		if ($this->_req_type === NULL) {
425
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
426
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
427 427
 		}
428 428
 		return $this->_req_type;
429 429
 	}
@@ -439,39 +439,39 @@  discard block
 block discarded – undo
439 439
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
440 440
 	 * @return int one of the constants on EE_System::req_type_*
441 441
 	 */
442
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
443
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
444
-		if( $activation_history_for_addon ){
442
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
443
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
444
+		if ($activation_history_for_addon) {
445 445
 			//it exists, so this isn't a completely new install
446 446
 			//check if this version already in that list of previously installed versions
447
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
447
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
448 448
 				//it a version we haven't seen before
449
-				if( $version_is_higher === 1 ){
449
+				if ($version_is_higher === 1) {
450 450
 					$req_type = EE_System::req_type_upgrade;
451
-				}else{
451
+				} else {
452 452
 					$req_type = EE_System::req_type_downgrade;
453 453
 				}
454
-				delete_option( $activation_indicator_option_name );
454
+				delete_option($activation_indicator_option_name);
455 455
 			} else {
456 456
 				// its not an update. maybe a reactivation?
457
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
458
-					if ( $version_is_higher === -1 ){
457
+				if (get_option($activation_indicator_option_name, FALSE)) {
458
+					if ($version_is_higher === -1) {
459 459
 						$req_type = EE_System::req_type_downgrade;
460
-					}elseif( $version_is_higher === 0 ){
460
+					}elseif ($version_is_higher === 0) {
461 461
 						//we've seen this version before, but it's an activation. must be a reactivation
462 462
 						$req_type = EE_System::req_type_reactivation;
463
-					}else{//$version_is_higher === 1
463
+					} else {//$version_is_higher === 1
464 464
 						$req_type = EE_System::req_type_upgrade;
465 465
 					}
466
-					delete_option( $activation_indicator_option_name );
466
+					delete_option($activation_indicator_option_name);
467 467
 				} else {
468 468
 					//we've seen this version before and the activation indicate doesn't show it was just activated
469
-					if ( $version_is_higher === -1 ){
469
+					if ($version_is_higher === -1) {
470 470
 						$req_type = EE_System::req_type_downgrade;
471
-					}elseif( $version_is_higher === 0 ){
471
+					}elseif ($version_is_higher === 0) {
472 472
 						//we've seen this version before and it's not an activation. its normal request
473 473
 						$req_type = EE_System::req_type_normal;
474
-					}else{//$version_is_higher === 1
474
+					} else {//$version_is_higher === 1
475 475
 						$req_type = EE_System::req_type_upgrade;
476 476
 					}
477 477
 				}
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 		} else {
480 480
 			//brand new install
481 481
 			$req_type = EE_System::req_type_new_activation;
482
-			delete_option( $activation_indicator_option_name );
482
+			delete_option($activation_indicator_option_name);
483 483
 		}
484 484
 		return $req_type;
485 485
 	}
@@ -497,30 +497,30 @@  discard block
 block discarded – undo
497 497
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
498 498
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
499 499
 	 */
500
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
500
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
501 501
 		//find the most recently-activated version
502 502
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
503 503
 		$most_recently_active_version = '0.0.0.dev.000';
504
-		if( is_array( $activation_history_for_addon ) ){
505
-			foreach( $activation_history_for_addon as $version => $times_activated ){
504
+		if (is_array($activation_history_for_addon)) {
505
+			foreach ($activation_history_for_addon as $version => $times_activated) {
506 506
 				//check there is a record of when this version was activated. Otherwise,
507 507
 				//mark it as unknown
508
-				if( ! $times_activated ){
509
-					$times_activated = array( 'unknown-date');
508
+				if ( ! $times_activated) {
509
+					$times_activated = array('unknown-date');
510 510
 				}
511
-				if( is_string( $times_activated ) ){
512
-					$times_activated = array( $times_activated );
511
+				if (is_string($times_activated)) {
512
+					$times_activated = array($times_activated);
513 513
 				}
514
-				foreach( $times_activated as $an_activation ){
515
-					if( $an_activation != 'unknown-date' &&
516
-							$an_activation > $most_recently_active_version_activation  ){
514
+				foreach ($times_activated as $an_activation) {
515
+					if ($an_activation != 'unknown-date' &&
516
+							$an_activation > $most_recently_active_version_activation) {
517 517
 						$most_recently_active_version = $version;
518 518
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
519 519
 					}
520 520
 				}
521 521
 			}
522 522
 		}
523
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
523
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
524 524
 	}
525 525
 
526 526
 
@@ -530,20 +530,20 @@  discard block
 block discarded – undo
530 530
 	 * @return void
531 531
 	 */
532 532
 	public function redirect_to_about_ee() {
533
-		$notices = EE_Error::get_notices( FALSE );
533
+		$notices = EE_Error::get_notices(FALSE);
534 534
 		//if current user is an admin and it's not an ajax request
535
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
536
-			$query_params =  array( 'page' => 'espresso_about' );
535
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
536
+			$query_params = array('page' => 'espresso_about');
537 537
 
538
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
538
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
539 539
 			    $query_params['new_activation'] = TRUE;
540 540
 			}
541 541
 
542
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
542
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
543 543
 			    $query_params['reactivation'] = TRUE;
544 544
 			}
545
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
546
-			wp_safe_redirect( $url );
545
+			$url = add_query_arg($query_params, admin_url('admin.php'));
546
+			wp_safe_redirect($url);
547 547
 			exit();
548 548
 		}
549 549
 	}
@@ -557,31 +557,31 @@  discard block
 block discarded – undo
557 557
 	 *
558 558
 	 * @return void
559 559
 	 */
560
-	public function load_core_configuration(){
561
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
562
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
560
+	public function load_core_configuration() {
561
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
562
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
563 563
 		//load textdomain
564 564
 		EE_Load_Textdomain::load_textdomain();
565 565
 		// load and setup EE_Config and EE_Network_Config
566
-		EE_Registry::instance()->load_core( 'Config' );
567
-		EE_Registry::instance()->load_core( 'Network_Config' );
566
+		EE_Registry::instance()->load_core('Config');
567
+		EE_Registry::instance()->load_core('Network_Config');
568 568
 		// setup autoloaders
569 569
 		// enable logging?
570
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
571
-			EE_Registry::instance()->load_core( 'Log' );
570
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
571
+			EE_Registry::instance()->load_core('Log');
572 572
 		}
573 573
 		// check for activation errors
574
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
575
-		if ( $activation_errors ) {
576
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
577
-			update_option( 'ee_plugin_activation_errors', FALSE );
574
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
575
+		if ($activation_errors) {
576
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
577
+			update_option('ee_plugin_activation_errors', FALSE);
578 578
 		}
579 579
 		// get model names
580 580
 		$this->_parse_model_names();
581 581
 
582 582
 		//load caf stuff a chance to play during the activation process too.
583 583
 		$this->_maybe_brew_regular();
584
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
584
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
585 585
 	}
586 586
 
587 587
 
@@ -590,23 +590,23 @@  discard block
 block discarded – undo
590 590
 	 *
591 591
 	 * @return void
592 592
 	 */
593
-	private function _parse_model_names(){
593
+	private function _parse_model_names() {
594 594
 		//get all the files in the EE_MODELS folder that end in .model.php
595
-		$models = glob( EE_MODELS.'*.model.php');
595
+		$models = glob(EE_MODELS.'*.model.php');
596 596
 		$model_names = array();
597 597
 		$non_abstract_db_models = array();
598
-		foreach( $models as $model ){
598
+		foreach ($models as $model) {
599 599
 			// get model classname
600
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
601
-			$shortname = str_replace( 'EEM_', '', $classname );
600
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
601
+			$shortname = str_replace('EEM_', '', $classname);
602 602
 			$reflectionClass = new ReflectionClass($classname);
603
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
603
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
604 604
 				$non_abstract_db_models[$shortname] = $classname;
605 605
 			}
606
-			$model_names[ $shortname ] = $classname;
606
+			$model_names[$shortname] = $classname;
607 607
 		}
608
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
609
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
608
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
609
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
610 610
 	}
611 611
 
612 612
 
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 	 * @return void
617 617
 	 */
618 618
 	private function _maybe_brew_regular() {
619
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
620
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
619
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
620
+			require_once EE_CAFF_PATH.'brewing_regular.php';
621 621
 		}
622 622
 	}
623 623
 
@@ -634,9 +634,9 @@  discard block
 block discarded – undo
634 634
 	 * @return void
635 635
 	 */
636 636
 	public function register_shortcodes_modules_and_widgets() {
637
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
637
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
638 638
 		// check for addons using old hookpoint
639
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
639
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
640 640
 			$this->_incompatible_addon_error();
641 641
 		}
642 642
 	}
@@ -650,19 +650,19 @@  discard block
 block discarded – undo
650 650
 	*/
651 651
 	private function _incompatible_addon_error() {
652 652
 		// get array of classes hooking into here
653
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
654
-		if ( ! empty( $class_names )) {
655
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
653
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
654
+		if ( ! empty($class_names)) {
655
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
656 656
 			$msg .= '<ul>';
657
-			foreach ( $class_names as $class_name ) {
658
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
657
+			foreach ($class_names as $class_name) {
658
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
659 659
 			}
660 660
 			$msg .= '</ul>';
661
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
661
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
662 662
 			// save list of incompatible addons to wp-options for later use
663
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
664
-			if ( is_admin() ) {
665
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
663
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
664
+			if (is_admin()) {
665
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
666 666
 			}
667 667
 		}
668 668
 	}
@@ -679,25 +679,25 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @return void
681 681
 	 */
682
-	public function brew_espresso(){
683
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
682
+	public function brew_espresso() {
683
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
684 684
 		// load some final core systems
685
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
686
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
687
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
688
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
689
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
690
-		add_action( 'init', array( $this, 'initialize' ), 10 );
691
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
692
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
693
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
694
-
695
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
685
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
686
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
687
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
688
+		add_action('init', array($this, 'load_controllers'), 7);
689
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
690
+		add_action('init', array($this, 'initialize'), 10);
691
+		add_action('init', array($this, 'initialize_last'), 100);
692
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
693
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
694
+
695
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
696 696
 			// pew pew pew
697
-			EE_Registry::instance()->load_core( 'PUE' );
698
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
697
+			EE_Registry::instance()->load_core('PUE');
698
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
699 699
 		}
700
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
700
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
701 701
 	}
702 702
 
703 703
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 */
712 712
 	public function set_hooks_for_core() {
713 713
 		$this->_deactivate_incompatible_addons();
714
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
714
+		do_action('AHEE__EE_System__set_hooks_for_core');
715 715
 	}
716 716
 
717 717
 
@@ -720,15 +720,15 @@  discard block
 block discarded – undo
720 720
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
721 721
 	 * deactivates any addons considered incompatible with the current version of EE
722 722
 	 */
723
-	private function _deactivate_incompatible_addons(){
724
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
725
-		if ( ! empty( $incompatible_addons )) {
726
-			$active_plugins = get_option( 'active_plugins', array() );
727
-			foreach ( $active_plugins as $active_plugin ) {
728
-				foreach ( $incompatible_addons as $incompatible_addon ) {
729
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
730
-						unset( $_GET['activate'] );
731
-						espresso_deactivate_plugin( $active_plugin );
723
+	private function _deactivate_incompatible_addons() {
724
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
725
+		if ( ! empty($incompatible_addons)) {
726
+			$active_plugins = get_option('active_plugins', array());
727
+			foreach ($active_plugins as $active_plugin) {
728
+				foreach ($incompatible_addons as $incompatible_addon) {
729
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
730
+						unset($_GET['activate']);
731
+						espresso_deactivate_plugin($active_plugin);
732 732
 					}
733 733
 				}
734 734
 			}
@@ -745,10 +745,10 @@  discard block
 block discarded – undo
745 745
 	 */
746 746
 	public function perform_activations_upgrades_and_migrations() {
747 747
 		//first check if we had previously attempted to setup EE's directories but failed
748
-		if( EEH_Activation::upload_directories_incomplete() ) {
748
+		if (EEH_Activation::upload_directories_incomplete()) {
749 749
 			EEH_Activation::create_upload_directories();
750 750
 		}
751
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
751
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
752 752
 	}
753 753
 
754 754
 
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 	 *  	@return 	void
761 761
 	 */
762 762
 	public function load_CPTs_and_session() {
763
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
763
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
764 764
 		// register Custom Post Types
765
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
766
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
765
+		EE_Registry::instance()->load_core('Register_CPTs');
766
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
767 767
 	}
768 768
 
769 769
 
@@ -778,19 +778,19 @@  discard block
 block discarded – undo
778 778
 	* @return void
779 779
 	*/
780 780
 	public function load_controllers() {
781
-		do_action( 'AHEE__EE_System__load_controllers__start' );
781
+		do_action('AHEE__EE_System__load_controllers__start');
782 782
 		// let's get it started
783
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
784
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
785
-			EE_Registry::instance()->load_core( 'Front_Controller' );
786
-		} else if ( ! EE_FRONT_AJAX ) {
787
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
788
-			EE_Registry::instance()->load_core( 'Admin' );
789
-		} else if ( EE_Maintenance_Mode::instance()->level() ) {
783
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
784
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
785
+			EE_Registry::instance()->load_core('Front_Controller');
786
+		} else if ( ! EE_FRONT_AJAX) {
787
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
788
+			EE_Registry::instance()->load_core('Admin');
789
+		} else if (EE_Maintenance_Mode::instance()->level()) {
790 790
 			// still need to make sure template helper functions are loaded in M-Mode
791
-			EE_Registry::instance()->load_helper( 'Template' );
791
+			EE_Registry::instance()->load_helper('Template');
792 792
 		}
793
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
793
+		do_action('AHEE__EE_System__load_controllers__complete');
794 794
 	}
795 795
 
796 796
 
@@ -804,10 +804,10 @@  discard block
 block discarded – undo
804 804
 	* @return void
805 805
 	*/
806 806
 	public function core_loaded_and_ready() {
807
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
808
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
807
+		do_action('AHEE__EE_System__core_loaded_and_ready');
808
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
809 809
 //		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
810
-		EE_Registry::instance()->load_core( 'Session' );
810
+		EE_Registry::instance()->load_core('Session');
811 811
 	}
812 812
 
813 813
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	* @return void
822 822
 	*/
823 823
 	public function initialize() {
824
-		do_action( 'AHEE__EE_System__initialize' );
824
+		do_action('AHEE__EE_System__initialize');
825 825
 	}
826 826
 
827 827
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
 	* @return void
836 836
 	*/
837 837
 	public function initialize_last() {
838
-		do_action( 'AHEE__EE_System__initialize_last' );
838
+		do_action('AHEE__EE_System__initialize_last');
839 839
 	}
840 840
 
841 841
 
@@ -867,21 +867,21 @@  discard block
 block discarded – undo
867 867
 	*/
868 868
 	public static function do_not_cache() {
869 869
 		// set no cache constants
870
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
871
-			define( 'DONOTCACHEPAGE', true );
870
+		if ( ! defined('DONOTCACHEPAGE')) {
871
+			define('DONOTCACHEPAGE', true);
872 872
 		}
873
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
874
-			define( 'DONOTCACHCEOBJECT', true );
873
+		if ( ! defined('DONOTCACHCEOBJECT')) {
874
+			define('DONOTCACHCEOBJECT', true);
875 875
 		}
876
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
877
-			define( 'DONOTCACHEDB', true );
876
+		if ( ! defined('DONOTCACHEDB')) {
877
+			define('DONOTCACHEDB', true);
878 878
 		}
879 879
 		// add no cache headers
880
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
880
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
881 881
 		// plus a little extra for nginx and Google Chrome
882
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
882
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
883 883
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
884
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
884
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
885 885
 	}
886 886
 
887 887
 
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
 	 * @param $headers
894 894
 	 * @return    array
895 895
 	 */
896
-	public static function extra_nocache_headers ( $headers ) {
896
+	public static function extra_nocache_headers($headers) {
897 897
 		// for NGINX
898 898
 		$headers['X-Accel-Expires'] = 0;
899 899
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -922,15 +922,15 @@  discard block
 block discarded – undo
922 922
 	 * @param $admin_bar
923 923
 	 * @return    void
924 924
 	 */
925
-	public function espresso_toolbar_items( $admin_bar ) {
925
+	public function espresso_toolbar_items($admin_bar) {
926 926
 
927 927
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
928
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
928
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
929 929
 			return;
930 930
 		}
931 931
 
932
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
933
-		EE_Registry::instance()->load_helper( 'URL' );
932
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
933
+		EE_Registry::instance()->load_helper('URL');
934 934
 		$menu_class = 'espresso_menu_item_class';
935 935
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
936 936
 		//because they're only defined in each of their respective constructors
@@ -942,20 +942,20 @@  discard block
 block discarded – undo
942 942
 		//Top Level
943 943
 		$admin_bar->add_menu(array(
944 944
 				'id' => 'espresso-toolbar',
945
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
945
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
946 946
 				'href' => $events_admin_url,
947 947
 				'meta' => array(
948 948
 						'title' => __('Event Espresso', 'event_espresso'),
949
-						'class' => $menu_class . 'first'
949
+						'class' => $menu_class.'first'
950 950
 				),
951 951
 		));
952 952
 
953 953
 		//Events
954
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
954
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
955 955
 			$admin_bar->add_menu(array(
956 956
 					'id' => 'espresso-toolbar-events',
957 957
 					'parent' => 'espresso-toolbar',
958
-					'title' => __( 'Events', 'event_espresso' ),
958
+					'title' => __('Events', 'event_espresso'),
959 959
 					'href' => $events_admin_url,
960 960
 					'meta' => array(
961 961
 							'title' => __('Events', 'event_espresso'),
@@ -966,13 +966,13 @@  discard block
 block discarded – undo
966 966
 		}
967 967
 
968 968
 
969
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
969
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
970 970
 			//Events Add New
971 971
 			$admin_bar->add_menu(array(
972 972
 					'id' => 'espresso-toolbar-events-new',
973 973
 					'parent' => 'espresso-toolbar-events',
974 974
 					'title' => __('Add New', 'event_espresso'),
975
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
975
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
976 976
 					'meta' => array(
977 977
 							'title' => __('Add New', 'event_espresso'),
978 978
 							'target' => '',
@@ -981,18 +981,18 @@  discard block
 block discarded – undo
981 981
 			));
982 982
 		}
983 983
 
984
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
984
+		if (is_single() && (get_post_type() == 'espresso_events')) {
985 985
 
986 986
 			//Current post
987 987
 			global $post;
988 988
 
989
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
989
+	    	if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
990 990
 				//Events Edit Current Event
991 991
 				$admin_bar->add_menu(array(
992 992
 						'id' => 'espresso-toolbar-events-edit',
993 993
 						'parent' => 'espresso-toolbar-events',
994 994
 						'title' => __('Edit Event', 'event_espresso'),
995
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
995
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
996 996
 						'meta' => array(
997 997
 								'title' => __('Edit Event', 'event_espresso'),
998 998
 								'target' => '',
@@ -1004,11 +1004,11 @@  discard block
 block discarded – undo
1004 1004
 		}
1005 1005
 
1006 1006
 		//Events View
1007
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
1007
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1008 1008
 			$admin_bar->add_menu(array(
1009 1009
 					'id' => 'espresso-toolbar-events-view',
1010 1010
 					'parent' => 'espresso-toolbar-events',
1011
-					'title' => __( 'View', 'event_espresso' ),
1011
+					'title' => __('View', 'event_espresso'),
1012 1012
 					'href' => $events_admin_url,
1013 1013
 					'meta' => array(
1014 1014
 							'title' => __('View', 'event_espresso'),
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 			));
1019 1019
 		}
1020 1020
 
1021
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1021
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1022 1022
 			//Events View All
1023 1023
 			$admin_bar->add_menu(array(
1024 1024
 					'id' => 'espresso-toolbar-events-all',
1025 1025
 					'parent' => 'espresso-toolbar-events-view',
1026
-					'title' => __( 'All', 'event_espresso' ),
1026
+					'title' => __('All', 'event_espresso'),
1027 1027
 					'href' => $events_admin_url,
1028 1028
 					'meta' => array(
1029 1029
 							'title' => __('All', 'event_espresso'),
@@ -1034,13 +1034,13 @@  discard block
 block discarded – undo
1034 1034
 		}
1035 1035
 
1036 1036
 
1037
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1037
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1038 1038
 			//Events View Today
1039 1039
 			$admin_bar->add_menu(array(
1040 1040
 					'id' => 'espresso-toolbar-events-today',
1041 1041
 					'parent' => 'espresso-toolbar-events-view',
1042 1042
 					'title' => __('Today', 'event_espresso'),
1043
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1043
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1044 1044
 					'meta' => array(
1045 1045
 							'title' => __('Today', 'event_espresso'),
1046 1046
 							'target' => '',
@@ -1050,13 +1050,13 @@  discard block
 block discarded – undo
1050 1050
 		}
1051 1051
 
1052 1052
 
1053
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1053
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1054 1054
 			//Events View This Month
1055 1055
 			$admin_bar->add_menu(array(
1056 1056
 					'id' => 'espresso-toolbar-events-month',
1057 1057
 					'parent' => 'espresso-toolbar-events-view',
1058
-					'title' => __( 'This Month', 'event_espresso'),
1059
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1058
+					'title' => __('This Month', 'event_espresso'),
1059
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1060 1060
 					'meta' => array(
1061 1061
 							'title' => __('This Month', 'event_espresso'),
1062 1062
 							'target' => '',
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
 		}
1067 1067
 
1068 1068
 		//Registration Overview
1069
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1069
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1070 1070
 			$admin_bar->add_menu(array(
1071 1071
 					'id' => 'espresso-toolbar-registrations',
1072 1072
 					'parent' => 'espresso-toolbar',
1073
-					'title' => __( 'Registrations', 'event_espresso' ),
1073
+					'title' => __('Registrations', 'event_espresso'),
1074 1074
 					'href' => $reg_admin_url,
1075 1075
 					'meta' => array(
1076 1076
 							'title' => __('Registrations', 'event_espresso'),
@@ -1081,12 +1081,12 @@  discard block
 block discarded – undo
1081 1081
 		}
1082 1082
 
1083 1083
 		//Registration Overview Today
1084
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1084
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1085 1085
 			$admin_bar->add_menu(array(
1086 1086
 					'id' => 'espresso-toolbar-registrations-today',
1087 1087
 					'parent' => 'espresso-toolbar-registrations',
1088
-					'title' => __( 'Today', 'event_espresso'),
1089
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1088
+					'title' => __('Today', 'event_espresso'),
1089
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1090 1090
 					'meta' => array(
1091 1091
 							'title' => __('Today', 'event_espresso'),
1092 1092
 							'target' => '',
@@ -1096,14 +1096,14 @@  discard block
 block discarded – undo
1096 1096
 		}
1097 1097
 
1098 1098
 		//Registration Overview Today Completed
1099
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1099
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1100 1100
 			$admin_bar->add_menu(array(
1101 1101
 					'id' => 'espresso-toolbar-registrations-today-approved',
1102 1102
 					'parent' => 'espresso-toolbar-registrations-today',
1103
-					'title' => __( 'Approved', 'event_espresso' ),
1104
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1103
+					'title' => __('Approved', 'event_espresso'),
1104
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1105 1105
 					'meta' => array(
1106
-							'title' => __('Approved', 'event_espresso' ),
1106
+							'title' => __('Approved', 'event_espresso'),
1107 1107
 							'target' => '',
1108 1108
 							'class' => $menu_class
1109 1109
 					),
@@ -1111,14 +1111,14 @@  discard block
 block discarded – undo
1111 1111
 		}
1112 1112
 
1113 1113
 		//Registration Overview Today Pending\
1114
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1114
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1115 1115
 			$admin_bar->add_menu(array(
1116 1116
 					'id' => 'espresso-toolbar-registrations-today-pending',
1117 1117
 					'parent' => 'espresso-toolbar-registrations-today',
1118
-					'title' => __( 'Pending', 'event_espresso' ),
1119
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1118
+					'title' => __('Pending', 'event_espresso'),
1119
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1120 1120
 					'meta' => array(
1121
-							'title' => __('Pending Payment', 'event_espresso' ),
1121
+							'title' => __('Pending Payment', 'event_espresso'),
1122 1122
 							'target' => '',
1123 1123
 							'class' => $menu_class
1124 1124
 					),
@@ -1126,14 +1126,14 @@  discard block
 block discarded – undo
1126 1126
 		}
1127 1127
 
1128 1128
 		//Registration Overview Today Incomplete
1129
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1129
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1130 1130
 			$admin_bar->add_menu(array(
1131 1131
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1132 1132
 					'parent' => 'espresso-toolbar-registrations-today',
1133
-					'title' => __( 'Not Approved', 'event_espresso' ),
1134
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1133
+					'title' => __('Not Approved', 'event_espresso'),
1134
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1135 1135
 					'meta' => array(
1136
-							'title' => __('Not Approved', 'event_espresso' ),
1136
+							'title' => __('Not Approved', 'event_espresso'),
1137 1137
 							'target' => '',
1138 1138
 							'class' => $menu_class
1139 1139
 					),
@@ -1141,12 +1141,12 @@  discard block
 block discarded – undo
1141 1141
 		}
1142 1142
 
1143 1143
 		//Registration Overview Today Incomplete
1144
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1144
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1145 1145
 			$admin_bar->add_menu(array(
1146 1146
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1147 1147
 					'parent' => 'espresso-toolbar-registrations-today',
1148
-					'title' => __( 'Cancelled', 'event_espresso'),
1149
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1148
+					'title' => __('Cancelled', 'event_espresso'),
1149
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1150 1150
 					'meta' => array(
1151 1151
 							'title' => __('Cancelled', 'event_espresso'),
1152 1152
 							'target' => '',
@@ -1156,12 +1156,12 @@  discard block
 block discarded – undo
1156 1156
 		}
1157 1157
 
1158 1158
 		//Registration Overview This Month
1159
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1159
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1160 1160
 			$admin_bar->add_menu(array(
1161 1161
 					'id' => 'espresso-toolbar-registrations-month',
1162 1162
 					'parent' => 'espresso-toolbar-registrations',
1163
-					'title' => __( 'This Month', 'event_espresso' ),
1164
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1163
+					'title' => __('This Month', 'event_espresso'),
1164
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1165 1165
 					'meta' => array(
1166 1166
 							'title' => __('This Month', 'event_espresso'),
1167 1167
 							'target' => '',
@@ -1171,12 +1171,12 @@  discard block
 block discarded – undo
1171 1171
 		}
1172 1172
 
1173 1173
 		//Registration Overview This Month Approved
1174
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1174
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1175 1175
 			$admin_bar->add_menu(array(
1176 1176
 					'id' => 'espresso-toolbar-registrations-month-approved',
1177 1177
 					'parent' => 'espresso-toolbar-registrations-month',
1178
-					'title' => __( 'Approved', 'event_espresso' ),
1179
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1178
+					'title' => __('Approved', 'event_espresso'),
1179
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1180 1180
 					'meta' => array(
1181 1181
 							'title' => __('Approved', 'event_espresso'),
1182 1182
 							'target' => '',
@@ -1186,12 +1186,12 @@  discard block
 block discarded – undo
1186 1186
 		}
1187 1187
 
1188 1188
 		//Registration Overview This Month Pending
1189
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1189
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1190 1190
 			$admin_bar->add_menu(array(
1191 1191
 					'id' => 'espresso-toolbar-registrations-month-pending',
1192 1192
 					'parent' => 'espresso-toolbar-registrations-month',
1193
-					'title' => __( 'Pending', 'event_espresso'),
1194
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1193
+					'title' => __('Pending', 'event_espresso'),
1194
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1195 1195
 					'meta' => array(
1196 1196
 							'title' => __('Pending', 'event_espresso'),
1197 1197
 							'target' => '',
@@ -1201,14 +1201,14 @@  discard block
 block discarded – undo
1201 1201
 		}
1202 1202
 
1203 1203
 		//Registration Overview This Month Not Approved
1204
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1204
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1205 1205
 			$admin_bar->add_menu(array(
1206 1206
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1207 1207
 					'parent' => 'espresso-toolbar-registrations-month',
1208
-					'title' => __( 'Not Approved', 'event_espresso'),
1209
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1208
+					'title' => __('Not Approved', 'event_espresso'),
1209
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1210 1210
 					'meta' => array(
1211
-							'title' => __('Not Approved', 'event_espresso' ),
1211
+							'title' => __('Not Approved', 'event_espresso'),
1212 1212
 							'target' => '',
1213 1213
 							'class' => $menu_class
1214 1214
 					),
@@ -1217,12 +1217,12 @@  discard block
 block discarded – undo
1217 1217
 
1218 1218
 
1219 1219
 		//Registration Overview This Month Cancelled
1220
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1220
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1221 1221
 			$admin_bar->add_menu(array(
1222 1222
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1223 1223
 					'parent' => 'espresso-toolbar-registrations-month',
1224 1224
 					'title' => __('Cancelled', 'event_espresso'),
1225
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1225
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1226 1226
 					'meta' => array(
1227 1227
 							'title' => __('Cancelled', 'event_espresso'),
1228 1228
 							'target' => '',
@@ -1232,11 +1232,11 @@  discard block
 block discarded – undo
1232 1232
 		}
1233 1233
 
1234 1234
 		//Extensions & Services
1235
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1235
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1236 1236
 			$admin_bar->add_menu(array(
1237 1237
 					'id' => 'espresso-toolbar-extensions-and-services',
1238 1238
 					'parent' => 'espresso-toolbar',
1239
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1239
+					'title' => __('Extensions & Services', 'event_espresso'),
1240 1240
 					'href' => $extensions_admin_url,
1241 1241
 					'meta' => array(
1242 1242
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1259 1259
 	 * @return array
1260 1260
 	 */
1261
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1262
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1261
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1262
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1263 1263
 	}
1264 1264
 
1265 1265
 
@@ -1279,11 +1279,11 @@  discard block
 block discarded – undo
1279 1279
 	 */
1280 1280
 	public function wp_enqueue_scripts() {
1281 1281
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1282
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1282
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1283 1283
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1284
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1284
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1285 1285
 				// register jQuery Validate
1286
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE );
1286
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1287 1287
 			}
1288 1288
 		}
1289 1289
 	}
Please login to merge, or discard this patch.