Completed
Branch BUG-8372-txn-meta-box-errors (bac6e5)
by
unknown
17:49 queued 10s
created
admin_pages/messages/EE_Message_List_Table.class.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') ){
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3 3
 	exit('NO direct script access allowed');
4 4
 }
5 5
 /**
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
 	protected function _setup_data() {
29
-		$this->_data = $this->_get_messages( $this->_per_page, $this->_view );
30
-		$this->_all_data_count = $this->_get_messages( $this->_per_page, $this->_view, true );
29
+		$this->_data = $this->_get_messages($this->_per_page, $this->_view);
30
+		$this->_all_data_count = $this->_get_messages($this->_per_page, $this->_view, true);
31 31
 	}
32 32
 
33 33
 
@@ -35,32 +35,32 @@  discard block
 block discarded – undo
35 35
 
36 36
 	protected function _set_properties() {
37 37
 		$this->_wp_list_args = array(
38
-			'singular' => __( 'Message', 'event_espresso' ),
39
-			'plural' => __( 'Messages', 'event_espresso' ),
38
+			'singular' => __('Message', 'event_espresso'),
39
+			'plural' => __('Messages', 'event_espresso'),
40 40
 			'ajax' => true,
41 41
 			'screen' => $this->get_admin_page()->get_current_screen()->id
42 42
 		);
43 43
 
44 44
 		$this->_columns = array(
45 45
 			'cb' => '<input type="checkbox" />',
46
-			'to' => __( 'To', 'event_espresso' ),
47
-			'from' => __( 'From', 'event_espresso' ),
48
-			'messenger' => __( 'Messenger', 'event_espresso' ),
49
-			'message_type' => __( 'Message Type', 'event_espresso' ),
50
-			'context' => __( 'Context', 'event_espresso' ),
51
-			'modified' => __( 'Modified', 'event_espresso' ),
52
-			'action' => __( 'Actions', 'event_espresso' ),
53
-			'msg_id' => __( 'ID', 'event_espresso' ),
46
+			'to' => __('To', 'event_espresso'),
47
+			'from' => __('From', 'event_espresso'),
48
+			'messenger' => __('Messenger', 'event_espresso'),
49
+			'message_type' => __('Message Type', 'event_espresso'),
50
+			'context' => __('Context', 'event_espresso'),
51
+			'modified' => __('Modified', 'event_espresso'),
52
+			'action' => __('Actions', 'event_espresso'),
53
+			'msg_id' => __('ID', 'event_espresso'),
54 54
 		);
55 55
 
56 56
 		$this->_sortable_columns = array(
57
-			'modified' => array( 'MSG_modified' => true ),
58
-			'message_type' => array( 'MSG_message_type' => false ),
59
-			'messenger' => array( 'MSG_messenger' => false ),
60
-			'to' => array( 'MSG_to' => false ),
61
-			'from' => array( 'MSG_from' => false ),
62
-			'context' => array( 'MSG_context' => false ),
63
-			'msg_id' => array( 'MSG_ID', false ),
57
+			'modified' => array('MSG_modified' => true),
58
+			'message_type' => array('MSG_message_type' => false),
59
+			'messenger' => array('MSG_messenger' => false),
60
+			'to' => array('MSG_to' => false),
61
+			'from' => array('MSG_from' => false),
62
+			'context' => array('MSG_context' => false),
63
+			'msg_id' => array('MSG_ID', false),
64 64
 		);
65 65
 
66 66
 		$this->_primary_column = 'to';
@@ -78,11 +78,11 @@  discard block
 block discarded – undo
78 78
 	 * @param  object $item the current item
79 79
 	 * @return string
80 80
 	 */
81
-	protected function _get_row_class( $item ) {
82
-		$class = parent::_get_row_class( $item );
81
+	protected function _get_row_class($item) {
82
+		$class = parent::_get_row_class($item);
83 83
 		//add status class
84
-		$class .= ' ee-status-strip msg-status-' . $item->STS_ID();
85
-		if ( $this->_has_checkbox_column ) {
84
+		$class .= ' ee-status-strip msg-status-'.$item->STS_ID();
85
+		if ($this->_has_checkbox_column) {
86 86
 			$class .= ' has-checkbox-column';
87 87
 		}
88 88
 		return $class;
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 		);
111 111
 
112 112
 		//set filters to select inputs if they aren't empty
113
-		foreach ( $select_inputs as $select_input ) {
114
-			if ( $select_input ) {
113
+		foreach ($select_inputs as $select_input) {
114
+			if ($select_input) {
115 115
 				$filters[] = $select_input;
116 116
 			}
117 117
 		}
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 
122 122
 
123 123
 	protected function _add_view_counts() {
124
-		foreach ( $this->_views as $view => $args ) {
125
-			$this->_views[ $view ]['count'] = $this->_get_messages( $this->_per_page, $view, true, true );
124
+		foreach ($this->_views as $view => $args) {
125
+			$this->_views[$view]['count'] = $this->_get_messages($this->_per_page, $view, true, true);
126 126
 		}
127 127
 	}
128 128
 
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
 	 * @return string   checkbox
134 134
 	 * @throws \EE_Error
135 135
 	 */
136
-	public function column_cb( $message ) {
137
-		return sprintf( '<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID() );
136
+	public function column_cb($message) {
137
+		return sprintf('<input type="checkbox" name="MSG_ID[%s]" value="1" />', $message->ID());
138 138
 	}
139 139
 
140 140
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 * @throws \EE_Error
146 146
 	 */
147
-	public function column_msg_id( EE_Message $message ) {
147
+	public function column_msg_id(EE_Message $message) {
148 148
 		return $message->ID();
149 149
 	}
150 150
 
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 	 * @return string    The recipient of the message
156 156
 	 * @throws \EE_Error
157 157
 	 */
158
-	public function column_to( EE_Message $message ) {
159
-		EE_Registry::instance()->load_helper( 'URL' );
158
+	public function column_to(EE_Message $message) {
159
+		EE_Registry::instance()->load_helper('URL');
160 160
 		$actions = array();
161 161
 		$actions['delete'] = '<a href="'
162 162
 			. EEH_URL::add_query_args_and_nonce(
@@ -165,10 +165,10 @@  discard block
 block discarded – undo
165 165
 					'action' => 'delete_ee_message',
166 166
 					'MSG_ID' => $message->ID()
167 167
 				),
168
-				admin_url( 'admin.php' )
168
+				admin_url('admin.php')
169 169
 			)
170
-			. '">' . __( 'Delete', 'event_espresso' ) . '</a>';
171
-		return $message->to() . $this->row_actions( $actions );
170
+			. '">'.__('Delete', 'event_espresso').'</a>';
171
+		return $message->to().$this->row_actions($actions);
172 172
 	}
173 173
 
174 174
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	 * @param EE_Message $message
177 177
 	 * @return string   The sender of the message
178 178
 	 */
179
-	public function column_from( EE_Message $message ) {
179
+	public function column_from(EE_Message $message) {
180 180
 		return $message->from();
181 181
 	}
182 182
 
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
 	 * @param EE_Message $message
187 187
 	 * @return string  The messenger used to send the message.
188 188
 	 */
189
-	public function column_messenger( EE_Message $message ) {
190
-		return ucwords( $message->messenger_label() );
189
+	public function column_messenger(EE_Message $message) {
190
+		return ucwords($message->messenger_label());
191 191
 	}
192 192
 
193 193
 
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
 	 * @param EE_Message $message
196 196
 	 * @return string  The message type used to generate the message.
197 197
 	 */
198
-	public function column_message_type( EE_Message $message ) {
199
-		return ucwords( $message->message_type_label() );
198
+	public function column_message_type(EE_Message $message) {
199
+		return ucwords($message->message_type_label());
200 200
 	}
201 201
 
202 202
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @param EE_Message $message
205 205
 	 * @return string  The context the message was generated for.
206 206
 	 */
207
-	public function column_context( EE_Message $message ) {
207
+	public function column_context(EE_Message $message) {
208 208
 		return $message->context_label();
209 209
 	}
210 210
 
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param EE_Message $message
214 214
 	 * @return string    The timestamp when this message was last modified.
215 215
 	 */
216
-	public function column_modified( EE_Message $message ) {
216
+	public function column_modified(EE_Message $message) {
217 217
 		return $message->modified();
218 218
 	}
219 219
 
@@ -222,36 +222,36 @@  discard block
 block discarded – undo
222 222
 	 * @param EE_Message $message
223 223
 	 * @return string   Actions that can be done on the current message.
224 224
 	 */
225
-	public function column_action( EE_Message $message ) {
226
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
225
+	public function column_action(EE_Message $message) {
226
+		EE_Registry::instance()->load_helper('MSG_Template');
227 227
 		$action_links = array(
228
-			'view' => EEH_MSG_Template::get_message_action_link( 'view', $message ),
229
-			'error' => EEH_MSG_Template::get_message_action_link( 'error', $message ),
230
-			'generate_now' => EEH_MSG_Template::get_message_action_link( 'generate_now', $message ),
231
-			'send_now' => EEH_MSG_Template::get_message_action_link( 'send_now', $message ),
232
-			'queue_for_resending' => EEH_MSG_Template::get_message_action_link( 'queue_for_resending', $message ),
233
-			'view_transaction' => EEH_MSG_Template::get_message_action_link( 'view_transaction', $message ),
228
+			'view' => EEH_MSG_Template::get_message_action_link('view', $message),
229
+			'error' => EEH_MSG_Template::get_message_action_link('error', $message),
230
+			'generate_now' => EEH_MSG_Template::get_message_action_link('generate_now', $message),
231
+			'send_now' => EEH_MSG_Template::get_message_action_link('send_now', $message),
232
+			'queue_for_resending' => EEH_MSG_Template::get_message_action_link('queue_for_resending', $message),
233
+			'view_transaction' => EEH_MSG_Template::get_message_action_link('view_transaction', $message),
234 234
 		);
235 235
 		$content = '';
236
-		switch ( $message->STS_ID() ) {
236
+		switch ($message->STS_ID()) {
237 237
 			case EEM_Message::status_sent :
238
-				$content = $action_links['view'] . $action_links['queue_for_resending'] . $action_links['view_transaction'];
238
+				$content = $action_links['view'].$action_links['queue_for_resending'].$action_links['view_transaction'];
239 239
 				break;
240 240
 			case EEM_Message::status_resend :
241
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
241
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
242 242
 				break;
243 243
 			case EEM_Message::status_retry :
244
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['error'] . $action_links['view_transaction'];
244
+				$content = $action_links['view'].$action_links['send_now'].$action_links['error'].$action_links['view_transaction'];
245 245
 				break;
246 246
 			case EEM_Message::status_failed :
247 247
 			case EEM_Message::status_debug_only :
248
-				$content = $action_links['error'] . $action_links['view_transaction'];
248
+				$content = $action_links['error'].$action_links['view_transaction'];
249 249
 				break;
250 250
 			case EEM_Message::status_idle :
251
-				$content = $action_links['view'] . $action_links['send_now'] . $action_links['view_transaction'];
251
+				$content = $action_links['view'].$action_links['send_now'].$action_links['view_transaction'];
252 252
 				break;
253 253
 			case EEM_Message::status_incomplete;
254
-				$content = $action_links['generate_now'] . $action_links['view_transaction'];
254
+				$content = $action_links['generate_now'].$action_links['view_transaction'];
255 255
 				break;
256 256
 		}
257 257
 		return $content;
@@ -269,54 +269,54 @@  discard block
 block discarded – undo
269 269
 	 * @return int | EE_Message[]
270 270
 	 * @throws \EE_Error
271 271
 	 */
272
-	protected function _get_messages( $perpage = 10, $view = 'all', $count = false, $all = false ) {
272
+	protected function _get_messages($perpage = 10, $view = 'all', $count = false, $all = false) {
273 273
 
274
-		$current_page = isset( $this->_req_data['paged'] ) && ! empty( $this->_req_data['paged'] )
274
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged'])
275 275
 			? $this->_req_data['paged']
276 276
 			: 1;
277 277
 
278
-		$per_page = isset( $this->_req_data['perpage'] ) && ! empty( $this->_req_data['perpage'] )
278
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage'])
279 279
 			? $this->_req_data['perpage']
280 280
 			: $perpage;
281 281
 
282
-		$offset = ( $current_page - 1 ) * $per_page;
283
-		$limit = $all || $count ? null : array( $offset, $per_page );
282
+		$offset = ($current_page - 1) * $per_page;
283
+		$limit = $all || $count ? null : array($offset, $per_page);
284 284
 		$query_params = array(
285
-			'order_by' => empty( $this->_req_data[ 'orderby' ] ) ? 'MSG_modified' : $this->_req_data[ 'orderby' ],
286
-			'order'    => empty( $this->_req_data[ 'order' ] ) ? 'DESC' : $this->_req_data[ 'order' ],
285
+			'order_by' => empty($this->_req_data['orderby']) ? 'MSG_modified' : $this->_req_data['orderby'],
286
+			'order'    => empty($this->_req_data['order']) ? 'DESC' : $this->_req_data['order'],
287 287
 			'limit'    => $limit,
288 288
 		);
289 289
 
290 290
 		/**
291 291
 		 * Any filters coming in from other routes?
292 292
 		 */
293
-		if ( isset( $this->_req_data['filterby'] ) ) {
294
-			$query_params = array_merge( $query_params, EEM_Message::instance()->filter_by_query_params() );
295
-			if ( ! $count ) {
293
+		if (isset($this->_req_data['filterby'])) {
294
+			$query_params = array_merge($query_params, EEM_Message::instance()->filter_by_query_params());
295
+			if ( ! $count) {
296 296
 				$query_params['group_by'] = 'MSG_ID';
297 297
 			}
298 298
 		}
299 299
 
300 300
 		//view conditionals
301
-		if ( $view !== 'all' && $count && $all ) {
301
+		if ($view !== 'all' && $count && $all) {
302 302
 			$query_params[0]['AND*view_conditional'] = array(
303
-				'STS_ID' => strtoupper( $view ),
303
+				'STS_ID' => strtoupper($view),
304 304
 			);
305 305
 		}
306 306
 
307
-		if ( ! $all && ! empty( $this->_req_data['status'] ) && $this->_req_data['status'] !== 'all' ) {
307
+		if ( ! $all && ! empty($this->_req_data['status']) && $this->_req_data['status'] !== 'all') {
308 308
 			$query_params[0]['AND*view_conditional'] = array(
309
-				'STS_ID' => strtoupper( $this->_req_data['status'] ),
309
+				'STS_ID' => strtoupper($this->_req_data['status']),
310 310
 			);
311 311
 		}
312 312
 
313
-		if ( ! $all && ! empty( $this->_req_data['s'] ) ) {
314
-			$search_string = '%' . $this->_req_data['s'] . '%';
313
+		if ( ! $all && ! empty($this->_req_data['s'])) {
314
+			$search_string = '%'.$this->_req_data['s'].'%';
315 315
 			$query_params[0]['OR'] = array(
316
-				'MSG_to' => array( 'LIKE', $search_string ),
317
-				'MSG_from' => array( 'LIKE', $search_string ),
318
-				'MSG_subject' => array( 'LIKE', $search_string ),
319
-				'MSG_content' => array( 'LIKE', $search_string ),
316
+				'MSG_to' => array('LIKE', $search_string),
317
+				'MSG_from' => array('LIKE', $search_string),
318
+				'MSG_subject' => array('LIKE', $search_string),
319
+				'MSG_content' => array('LIKE', $search_string),
320 320
 			);
321 321
 		}
322 322
 
@@ -324,16 +324,16 @@  discard block
 block discarded – undo
324 324
 		//the messages system is in debug mode.
325 325
 		//Note: for backward compat with previous iterations, this is necessary because there may be EEM_Message::status_debug_only
326 326
 		//messages in the database.
327
-		if ( ! EEM_Message::debug() ) {
327
+		if ( ! EEM_Message::debug()) {
328 328
 			$query_params[0]['AND*debug_only_conditional'] = array(
329
-				'STS_ID' => array( '!=', EEM_Message::status_debug_only )
329
+				'STS_ID' => array('!=', EEM_Message::status_debug_only)
330 330
 			);
331 331
 		}
332 332
 
333 333
 		//account for filters
334 334
 		if (
335 335
 			! $all
336
-			&& isset( $this->_req_data['ee_messenger_filter_by'] )
336
+			&& isset($this->_req_data['ee_messenger_filter_by'])
337 337
 			&& $this->_req_data['ee_messenger_filter_by'] !== 'none_selected'
338 338
 		) {
339 339
 			$query_params[0]['AND*messenger_filter'] = array(
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 		}
343 343
 		if (
344 344
 			! $all
345
-			&& ! empty( $this->_req_data['ee_message_type_filter_by'] )
345
+			&& ! empty($this->_req_data['ee_message_type_filter_by'])
346 346
 			&& $this->_req_data['ee_message_type_filter_by'] !== 'none_selected'
347 347
 		) {
348 348
 			$query_params[0]['AND*message_type_filter'] = array(
@@ -352,17 +352,17 @@  discard block
 block discarded – undo
352 352
 
353 353
 		if (
354 354
 			! $all
355
-			&& ! empty( $this->_req_data['ee_context_filter_by'] )
355
+			&& ! empty($this->_req_data['ee_context_filter_by'])
356 356
 			&& $this->_req_data['ee_context_filter_by'] !== 'none_selected'
357 357
 		) {
358 358
 			$query_params[0]['AND*context_filter'] = array(
359
-				'MSG_context' => array( 'IN', explode( ',', $this->_req_data['ee_context_filter_by'] ) )
359
+				'MSG_context' => array('IN', explode(',', $this->_req_data['ee_context_filter_by']))
360 360
 			);
361 361
 		}
362 362
 
363 363
 		return $count
364
-			? EEM_Message::instance()->count( $query_params, null, true )
365
-			: EEM_Message::instance()->get_all( $query_params );
364
+			? EEM_Message::instance()->count($query_params, null, true)
365
+			: EEM_Message::instance()->get_all($query_params);
366 366
 	}
367 367
 
368 368
 
@@ -372,15 +372,15 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	protected function _get_messengers_dropdown_filter() {
374 374
 		$messenger_options = array();
375
-		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_messenger' ) );
375
+		$active_messages_grouped_by_messenger = EEM_Message::instance()->get_all(array('group_by' => 'MSG_messenger'));
376 376
 
377 377
 		//setup array of messenger options
378
-		foreach ( $active_messages_grouped_by_messenger as $active_message ) {
379
-			if ( $active_message instanceof EE_Message ) {
380
-				$messenger_options[ $active_message->messenger() ] = ucwords( $active_message->messenger_label() );
378
+		foreach ($active_messages_grouped_by_messenger as $active_message) {
379
+			if ($active_message instanceof EE_Message) {
380
+				$messenger_options[$active_message->messenger()] = ucwords($active_message->messenger_label());
381 381
 			}
382 382
 		}
383
-		return $this->get_admin_page()->get_messengers_select_input( $messenger_options );
383
+		return $this->get_admin_page()->get_messengers_select_input($messenger_options);
384 384
 	}
385 385
 
386 386
 
@@ -391,15 +391,15 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	protected function _get_message_types_dropdown_filter() {
393 393
 		$message_type_options = array();
394
-		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_message_type' ) );
394
+		$active_messages_grouped_by_message_type = EEM_Message::instance()->get_all(array('group_by' => 'MSG_message_type'));
395 395
 
396 396
 		//setup array of message type options
397
-		foreach ( $active_messages_grouped_by_message_type as $active_message ) {
398
-			if ( $active_message instanceof EE_Message ) {
399
-				$message_type_options[ $active_message->message_type() ] = ucwords( $active_message->message_type_label() );
397
+		foreach ($active_messages_grouped_by_message_type as $active_message) {
398
+			if ($active_message instanceof EE_Message) {
399
+				$message_type_options[$active_message->message_type()] = ucwords($active_message->message_type_label());
400 400
 			}
401 401
 		}
402
-		return $this->get_admin_page()->get_message_types_select_input( $message_type_options );
402
+		return $this->get_admin_page()->get_message_types_select_input($message_type_options);
403 403
 	}
404 404
 
405 405
 
@@ -409,21 +409,21 @@  discard block
 block discarded – undo
409 409
 	 */
410 410
 	protected function _get_contexts_for_message_types_dropdown_filter() {
411 411
 		$context_options = array();
412
-		$active_messages_grouped_by_context = EEM_Message::instance()->get_all( array( 'group_by' => 'MSG_context' ) );
412
+		$active_messages_grouped_by_context = EEM_Message::instance()->get_all(array('group_by' => 'MSG_context'));
413 413
 
414 414
 		//setup array of context options
415
-		foreach ( $active_messages_grouped_by_context as $active_message ) {
416
-			if ( $active_message instanceof EE_Message ) {
415
+		foreach ($active_messages_grouped_by_context as $active_message) {
416
+			if ($active_message instanceof EE_Message) {
417 417
 				$message_type = $active_message->message_type_object();
418
-				if ( $message_type instanceof EE_message_type ) {
419
-					foreach ( $message_type->get_contexts() as $context => $context_details ) {
420
-						if ( isset( $context_details['label'] ) ) {
421
-							$context_options[ $context ] = $context_details['label'];
418
+				if ($message_type instanceof EE_message_type) {
419
+					foreach ($message_type->get_contexts() as $context => $context_details) {
420
+						if (isset($context_details['label'])) {
421
+							$context_options[$context] = $context_details['label'];
422 422
 						}
423 423
 					}
424 424
 				}
425 425
 			}
426 426
 		}
427
-		return $this->get_admin_page()->get_contexts_for_message_types_select_input( $context_options );
427
+		return $this->get_admin_page()->get_contexts_for_message_types_select_input($context_options);
428 428
 	}
429 429
 } //end EE_Message_List_Table class
430 430
\ No newline at end of file
Please login to merge, or discard this patch.
espresso.php 1 patch
Spacing   +93 added lines, -93 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
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<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
+			<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>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.10.rc.000' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.10.rc.000');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.