Completed
Branch BUG-6292-conflict-legacy-wp-me... (bf4350)
by
unknown
16:25 queued 19s
created
core/libraries/batch/JobHandlerBaseClasses/JobHandler.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
 use EventEspressoBatchRequest\Helpers\JobParameters;
18 18
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
19 19
 
20
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
21
-	exit( 'No direct script access allowed' );
20
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
21
+	exit('No direct script access allowed');
22 22
 }
23 23
 
24 24
 
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	 * @throws BatchRequestException
35 35
 	 * @return JobStepResponse
36 36
 	 */
37
-	abstract public function create_job( JobParameters $job_parameters );
37
+	abstract public function create_job(JobParameters $job_parameters);
38 38
 
39 39
 	/**
40 40
 	 * Performs another step of the job
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @return JobStepResponse
45 45
 	 * @throws BatchRequestException
46 46
 	 */
47
-	abstract public function continue_job( JobParameters $job_parameters, $batch_size = 50 );
47
+	abstract public function continue_job(JobParameters $job_parameters, $batch_size = 50);
48 48
 
49 49
 
50 50
 
@@ -55,6 +55,6 @@  discard block
 block discarded – undo
55 55
 	 * @return JobStepResponse
56 56
 	 * @throws BatchRequestException
57 57
 	 */
58
-	abstract public function cleanup_job( JobParameters $job_parameters );
58
+	abstract public function cleanup_job(JobParameters $job_parameters);
59 59
 }
60 60
 
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerFile.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -29,8 +29,8 @@  discard block
 block discarded – undo
29 29
 	 */
30 30
 	protected $_file_helper = null;
31 31
 	const temp_folder_name = 'batch_temp_folder';
32
-	public function __construct( EEHI_File $file_helper = null ) {
33
-		if( ! $file_helper ) {
32
+	public function __construct(EEHI_File $file_helper = null) {
33
+		if ( ! $file_helper) {
34 34
 			$this->_file_helper = new \EEH_File();
35 35
 		}
36 36
 	}
@@ -45,30 +45,30 @@  discard block
 block discarded – undo
45 45
 	 * @return string
46 46
 	 * @throws BatchRequestException
47 47
 	 */
48
-	public function create_file_from_job_with_name( $job_id, $filename ) {
48
+	public function create_file_from_job_with_name($job_id, $filename) {
49 49
 		$filepath = '';
50
-		try{
50
+		try {
51 51
 			$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
52
-				EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name
52
+				EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name
53 53
 			);
54
-			if ( $success ) {
54
+			if ($success) {
55 55
 				$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
56
-					EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id
56
+					EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id
57 57
 				);
58 58
 			}
59
-			if( $success ) {
60
-				$filepath = EVENT_ESPRESSO_UPLOAD_DIR . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename;
61
-				$success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath );
59
+			if ($success) {
60
+				$filepath = EVENT_ESPRESSO_UPLOAD_DIR.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename;
61
+				$success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath);
62 62
 			}
63 63
 			//those methods normally fail with an exception, but if not, let's do it
64
-			if( ! $success ) {
65
-				throw new \EE_Error( 'could_not_create_temp_file',
66
-				__( 'An unknown error occurred', 'event_espresso' ));
64
+			if ( ! $success) {
65
+				throw new \EE_Error('could_not_create_temp_file',
66
+				__('An unknown error occurred', 'event_espresso'));
67 67
 			}
68
-		} catch( \EE_Error $e ) {
68
+		} catch (\EE_Error $e) {
69 69
 			throw new BatchRequestException(
70 70
 				sprintf(
71
-					__( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ),
71
+					__('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'),
72 72
 					$job_id,
73 73
 					$e->getMessage()
74 74
 				),
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 * @param string $filepath
85 85
 	 * @return string url to file
86 86
 	 */
87
-	public function get_url_to_file( $filepath ) {
88
-		return str_replace( EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath );
87
+	public function get_url_to_file($filepath) {
88
+		return str_replace(EVENT_ESPRESSO_UPLOAD_DIR, EVENT_ESPRESSO_UPLOAD_URL, $filepath);
89 89
 	}
90 90
 }
91 91
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- *
4
- * Class JobHandlerFile
5
- *
6
- * Base class for common implementations of JobHandlerInterface, but ones
7
- * which write to a temporary file
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    batch
11
- * @author				Mike Nelson
12
- * @since		 	   4.8.26
13
- *
14
- */
3
+	 *
4
+	 * Class JobHandlerFile
5
+	 *
6
+	 * Base class for common implementations of JobHandlerInterface, but ones
7
+	 * which write to a temporary file
8
+	 *
9
+	 * @package         Event Espresso
10
+	 * @subpackage    batch
11
+	 * @author				Mike Nelson
12
+	 * @since		 	   4.8.26
13
+	 *
14
+	 */
15 15
 namespace EventEspressoBatchRequest\JobHandlerBaseClasses;
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerInterface.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,8 +20,8 @@  discard block
 block discarded – undo
20 20
 use EventEspressoBatchRequest\Helpers\JobParameters;
21 21
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
22 22
 
23
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
24
-	exit( 'No direct script access allowed' );
23
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
24
+	exit('No direct script access allowed');
25 25
 }
26 26
 
27 27
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @throws BatchRequestException
36 36
 	 * @return JobStepResponse
37 37
 	 */
38
-	public function create_job( JobParameters $job_parameters );
38
+	public function create_job(JobParameters $job_parameters);
39 39
 
40 40
 	/**
41 41
 	 * Performs another step of the job
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 * @return JobStepResponse
45 45
 	 * @throws BatchRequestException
46 46
 	 */
47
-	public function continue_job( JobParameters $job_parameters, $batch_size = 50 );
47
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50);
48 48
 
49 49
 	/**
50 50
 	 * Performs any clean-up logic when we know the job is completed
@@ -52,5 +52,5 @@  discard block
 block discarded – undo
52 52
 	 * @return JobStepResponse
53 53
 	 * @throws BatchRequestException
54 54
 	 */
55
-	public function cleanup_job( JobParameters $job_parameters );
55
+	public function cleanup_job(JobParameters $job_parameters);
56 56
 }
Please login to merge, or discard this patch.
core/EE_Error.core.php 1 patch
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 		self::$_error_count++;
550 550
 	}
551 551
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564 564
 	* 	@return 		void
565 565
 	*/
566
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
566
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
567
+		self::_add_notice('success', $msg, $file, $func, $line);
568 568
 	}
569 569
 
570 570
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582 582
 	* 	@return 		void
583 583
 	*/
584
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
584
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
585
+		self::_add_notice('attention', $msg, $file, $func, $line);
586 586
 	}
587 587
 
588 588
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601 601
 	* 	@return 		void
602 602
 	*/
603
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604
-		if ( empty( $msg )) {
603
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
604
+		if (empty($msg)) {
605 605
 			EE_Error::doing_it_wrong(
606
-				'EE_Error::add_' . $type . '()',
606
+				'EE_Error::add_'.$type.'()',
607 607
 				sprintf(
608
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
608
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
609 609
 					$type,
610 610
 					$file,
611 611
 					$line
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
 				EVENT_ESPRESSO_VERSION
614 614
 			);
615 615
 		}
616
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
616
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
617 617
 			EE_Error::doing_it_wrong(
618 618
 				'EE_Error::add_error()',
619
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
619
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
620 620
 				EVENT_ESPRESSO_VERSION
621 621
 			);
622 622
 		}
623 623
 		// get separate user and developer messages if they exist
624
-		$msg = explode( '||', $msg );
624
+		$msg = explode('||', $msg);
625 625
 		$user_msg = $msg[0];
626
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
626
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
627 627
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
628 628
 		// add notice if message exists
629
-		if ( ! empty( $msg )) {
629
+		if ( ! empty($msg)) {
630 630
 			// get error code, but only on error
631
-			if ( WP_DEBUG && $type == 'errors' ) {
632
-				$msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>';
631
+			if (WP_DEBUG && $type == 'errors') {
632
+				$msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>';
633 633
 			}
634 634
 			// add notice
635
-			self::$_espresso_notices[ $type ][] = $msg;
636
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
635
+			self::$_espresso_notices[$type][] = $msg;
636
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
637 637
 		}
638 638
 
639 639
 	}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	*	@access private
688 688
 	*	@return void
689 689
 	*/
690
-	public static function reset_notices(){
690
+	public static function reset_notices() {
691 691
     	self::$_espresso_notices['success'] = FALSE;
692 692
     	self::$_espresso_notices['attention'] = FALSE;
693 693
     	self::$_espresso_notices['errors'] = FALSE;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	*	@access public
701 701
 	*	@return int
702 702
 	*/
703
-    public static function has_notices(){
703
+    public static function has_notices() {
704 704
 		$has_notices = 0;
705 705
 		// check for success messages
706
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
707 707
 		// check for attention messages
708
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
709 709
 		// check for error messages
710
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
710
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
711 711
 		return $has_notices;
712 712
 	}
713 713
 
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
723 723
 	* 	@return 		array
724 724
 	*/
725
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
726
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
725
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
726
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
727 727
 
728 728
 		$success_messages = '';
729 729
 		$attention_messages = '';
@@ -733,44 +733,44 @@  discard block
 block discarded – undo
733 733
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
734 734
 
735 735
 		// either save notices to the db
736
-		if ( $save_to_transient ) {
737
-			update_option( 'ee_notices', self::$_espresso_notices );
736
+		if ($save_to_transient) {
737
+			update_option('ee_notices', self::$_espresso_notices);
738 738
 			return;
739 739
 		}
740 740
 		// grab any notices that have been previously saved
741
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
742
-			foreach ( $notices as $type => $notice ) {
743
-				if ( is_array( $notice ) && ! empty( $notice )) {
741
+		if ($notices = get_option('ee_notices', FALSE)) {
742
+			foreach ($notices as $type => $notice) {
743
+				if (is_array($notice) && ! empty($notice)) {
744 744
 					// make sure that existsing notice type is an array
745
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
745
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
746 746
 					// merge stored notices with any newly created ones
747
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
747
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
748 748
 					$print_scripts = TRUE;
749 749
 				}
750 750
 			}
751 751
 			// now clear any stored notices
752
-			update_option( 'ee_notices', FALSE );
752
+			update_option('ee_notices', FALSE);
753 753
 		}
754 754
 
755 755
 		// check for success messages
756
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
756
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
757 757
 			// combine messages
758
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
758
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
759 759
 			$print_scripts = TRUE;
760 760
 		}
761 761
 
762 762
 		// check for attention messages
763
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
763
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
764 764
 			// combine messages
765
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
765
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
766 766
 			$print_scripts = TRUE;
767 767
 		}
768 768
 
769 769
 		// check for error messages
770
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
771
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
770
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
771
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
772 772
 			// combine messages
773
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
773
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
774 774
 			$print_scripts = TRUE;
775 775
 		}
776 776
 
@@ -784,21 +784,21 @@  discard block
 block discarded – undo
784 784
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
785 785
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
786 786
 				//showMessage( $success_messages );
787
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
787
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
788 788
 			}
789 789
 
790 790
 			if ($attention_messages != '') {
791 791
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
792 792
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
793 793
 				//showMessage( $error_messages, TRUE );
794
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
794
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
795 795
 			}
796 796
 
797 797
 			if ($error_messages != '') {
798 798
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
799 799
 				$css_class = is_admin() ? 'error' : 'error fade-away';
800 800
 				//showMessage( $error_messages, TRUE );
801
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
801
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
802 802
 			}
803 803
 
804 804
 			$notices .= '</div>';
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					'errors' => $error_messages
812 812
 			);
813 813
 
814
-			if ( $remove_empty ) {
814
+			if ($remove_empty) {
815 815
 				// remove empty notices
816 816
 				foreach ($notices as $type => $notice) {
817 817
 					if (empty($notice)) {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 			}
822 822
 		}
823 823
 
824
-		if ( $print_scripts ) {
824
+		if ($print_scripts) {
825 825
 			self::_print_scripts();
826 826
 		}
827 827
 
@@ -841,17 +841,17 @@  discard block
 block discarded – undo
841 841
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
842 842
 	* 	@return 		void
843 843
 	*/
844
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
845
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
846
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
844
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
845
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
846
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
847 847
 			//maybe initialize persistent_admin_notices
848
-			if ( empty( $persistent_admin_notices )) {
849
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
848
+			if (empty($persistent_admin_notices)) {
849
+				add_option('ee_pers_admin_notices', array(), '', 'no');
850 850
 			}
851
-			$pan_name = sanitize_key( $pan_name );
852
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
853
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
854
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
851
+			$pan_name = sanitize_key($pan_name);
852
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
853
+				$persistent_admin_notices[$pan_name] = $pan_message;
854
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
855 855
 			}
856 856
 		}
857 857
 	}
@@ -867,34 +867,34 @@  discard block
 block discarded – undo
867 867
 	 * @param bool          $return_immediately
868 868
 	 * @return        void
869 869
 	 */
870
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
871
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
872
-		if ( ! empty( $pan_name )) {
873
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
870
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
871
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
872
+		if ( ! empty($pan_name)) {
873
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
874 874
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
875
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
875
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
876 876
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
877
-				if ( $purge ) {
878
-					unset( $persistent_admin_notices[ $pan_name ] );
877
+				if ($purge) {
878
+					unset($persistent_admin_notices[$pan_name]);
879 879
 				} else {
880
-					$persistent_admin_notices[ $pan_name ] = NULL;
880
+					$persistent_admin_notices[$pan_name] = NULL;
881 881
 				}
882
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
883
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
882
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
883
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
884 884
 				}
885 885
 			}
886 886
 		}
887
-		if ( $return_immediately ) {
887
+		if ($return_immediately) {
888 888
 			return;
889
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
889
+		} else if (EE_Registry::instance()->REQ->ajax) {
890 890
 			// grab any notices and concatenate into string
891
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
891
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
892 892
 			exit();
893 893
 		} else {
894 894
 			// save errors to a transient to be displayed on next request (after redirect)
895
-			EE_Error::get_notices( FALSE, TRUE );
896
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
897
-			wp_safe_redirect( urldecode( $return_url ));
895
+			EE_Error::get_notices(FALSE, TRUE);
896
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
897
+			wp_safe_redirect(urldecode($return_url));
898 898
 		}
899 899
 	}
900 900
 
@@ -909,20 +909,20 @@  discard block
 block discarded – undo
909 909
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
910 910
 	 *  	@return 		string
911 911
 	 */
912
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
913
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
912
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
913
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
914 914
 			$args = array(
915 915
 				'nag_notice' => $pan_name,
916
-				'return_url' => urlencode( $return_url ),
916
+				'return_url' => urlencode($return_url),
917 917
 				'ajax_url' => WP_AJAX_URL,
918
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
918
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
919 919
 			);
920
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
920
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
921 921
 			return '
922
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
-				<p>' . $pan_message . '</p>
924
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
925
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
922
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
+				<p>' . $pan_message.'</p>
924
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
925
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
926 926
 				</a>
927 927
 				<div style="clear:both;"></div>
928 928
 			</div>';
@@ -938,17 +938,17 @@  discard block
 block discarded – undo
938 938
 	 * @param string $return_url
939 939
 	 * @return    array
940 940
 	 */
941
-	public static function get_persistent_admin_notices( $return_url = '' ) {
941
+	public static function get_persistent_admin_notices($return_url = '') {
942 942
 		$notices = '';
943 943
 		// check for persistent admin notices
944
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
944
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
945 945
 			// load scripts
946
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
947
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
948
-			wp_enqueue_script( 'ee_error_js' );
946
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
947
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
948
+			wp_enqueue_script('ee_error_js');
949 949
 			// and display notices
950
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
951
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
950
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
951
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
952 952
 			}
953 953
 		}
954 954
 		return $notices;
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 	 * @param 	bool $force_print
964 964
 	 * @return 	void
965 965
 	 */
966
-	private static function _print_scripts( $force_print = FALSE ) {
967
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
968
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
966
+	private static function _print_scripts($force_print = FALSE) {
967
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
968
+			if (wp_script_is('ee_error_js', 'enqueued')) {
969 969
 				return;
970
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
971
-				add_filter( 'FHEE_load_css', '__return_true' );
972
-				add_filter( 'FHEE_load_js', '__return_true' );
973
-				wp_enqueue_script( 'ee_error_js' );
974
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
970
+			} else if (wp_script_is('ee_error_js', 'registered')) {
971
+				add_filter('FHEE_load_css', '__return_true');
972
+				add_filter('FHEE_load_js', '__return_true');
973
+				wp_enqueue_script('ee_error_js');
974
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
975 975
 			}
976 976
 		} else {
977 977
 			return '
978 978
 <script>
979 979
 /* <![CDATA[ */
980
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
980
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
981 981
 /* ]]> */
982 982
 </script>
983
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
984
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
985
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
983
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
984
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
985
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
986 986
 ';
987 987
 
988 988
 		}
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 	*	@ param string $line
1017 1017
 	*	@ return string
1018 1018
 	*/
1019
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1020
-		$file = explode( '.', basename( $file ));
1021
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1022
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1023
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1019
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1020
+		$file = explode('.', basename($file));
1021
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1022
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1023
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1024 1024
 		return $error_code;
1025 1025
 	}
1026 1026
 
@@ -1036,37 +1036,37 @@  discard block
 block discarded – undo
1036 1036
 	*	@ param object $ex
1037 1037
 	*	@ return void
1038 1038
 	*/
1039
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1039
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1040 1040
 
1041
-		if ( ! $ex ) {
1041
+		if ( ! $ex) {
1042 1042
 			return;
1043 1043
 		}
1044 1044
 
1045
-		if ( ! $time ) {
1045
+		if ( ! $time) {
1046 1046
 			$time = time();
1047 1047
 		}
1048 1048
 
1049
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1050
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1051
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1052
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1053
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1054
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1055
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1056
-		$exception_log .= $ex['string'] . PHP_EOL;
1057
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1058
-
1059
-		EE_Registry::instance()->load_helper( 'File' );
1049
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1050
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1051
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1052
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1053
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1054
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1055
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1056
+		$exception_log .= $ex['string'].PHP_EOL;
1057
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1058
+
1059
+		EE_Registry::instance()->load_helper('File');
1060 1060
 		try {
1061
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1062
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); 
1063
-			if ( ! $clear ) {
1061
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1062
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); 
1063
+			if ( ! $clear) {
1064 1064
 				//get existing log file and append new log info
1065
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1065
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1066 1066
 			}
1067
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1068
-		} catch( EE_Error $e ){
1069
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1067
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1068
+		} catch (EE_Error $e) {
1069
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1070 1070
 			return;
1071 1071
 		}
1072 1072
 
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 	 * @param int     $error_type
1091 1091
 	 * @return void
1092 1092
 	 */
1093
-	public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
1094
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1093
+	public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
1094
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1095 1095
 			EE_Registry::instance()->load_helper('Debug_Tools');
1096
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type );
1096
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type);
1097 1097
 		}
1098 1098
 	}
1099 1099
 
@@ -1113,13 +1113,13 @@  discard block
 block discarded – undo
1113 1113
  */
1114 1114
 function espresso_error_enqueue_scripts() {
1115 1115
 	// js for error handling
1116
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1117
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1116
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1117
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1118 1118
 }
1119
-if ( is_admin() ) {
1120
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1119
+if (is_admin()) {
1120
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1121 1121
 } else {
1122
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1122
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1123 1123
 }
1124 1124
 
1125 1125
 
Please login to merge, or discard this patch.
core/EE_Log.core.php 2 patches
Spacing   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Class EE_Log
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 * @return EE_Log
63 63
 	 */
64 64
 	public static function instance() {
65
-		if ( ! self::$_instance instanceof EE_Log ) {
65
+		if ( ! self::$_instance instanceof EE_Log) {
66 66
 			self::$_instance = new self();
67 67
 		}
68 68
 		return self::$_instance;
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
 	 */
75 75
 	private function __construct() {
76 76
 
77
-		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging ) {
77
+		if ( ! EE_Registry::instance()->CFG->admin->use_full_logging && ! EE_Registry::instance()->CFG->admin->use_remote_logging) {
78 78
 			return;
79 79
 		}
80 80
 
81
-		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS;
81
+		$this->_logs_folder = EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS;
82 82
 		$this->_log_file = EE_Registry::instance()->CFG->admin->log_file_name();
83 83
 		$this->_log = '';
84 84
 		$this->_debug_file = EE_Registry::instance()->CFG->admin->debug_file_name();
@@ -86,15 +86,15 @@  discard block
 block discarded – undo
86 86
 		$this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url;
87 87
 		$this->_remote_log = '';
88 88
 
89
-		add_action( 'admin_init', array( $this, 'verify_filesystem' ), -10 );
90
-		add_action( 'AHEE_log', array( $this, 'log' ), 10, 4 );
91
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
92
-			add_action( 'shutdown', array( $this, 'write_log' ), 9999 );
89
+		add_action('admin_init', array($this, 'verify_filesystem'), -10);
90
+		add_action('AHEE_log', array($this, 'log'), 10, 4);
91
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
92
+			add_action('shutdown', array($this, 'write_log'), 9999);
93 93
 			// if WP_DEBUG
94
-			add_action( 'shutdown', array( $this, 'write_debug' ), 9999 );
94
+			add_action('shutdown', array($this, 'write_debug'), 9999);
95 95
 		}
96
-		if ( EE_Registry::instance()->CFG->admin->use_remote_logging ) {
97
-			add_action( 'shutdown', array( $this, 'send_log' ), 9999 );
96
+		if (EE_Registry::instance()->CFG->admin->use_remote_logging) {
97
+			add_action('shutdown', array($this, 'send_log'), 9999);
98 98
 		}
99 99
 
100 100
 	}
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function verify_filesystem() {
110 110
 		try {
111
-			EE_Registry::instance()->load_helper( 'File' );
112
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_log_file );
113
-			EEH_File::ensure_file_exists_and_is_writable( $this->_logs_folder . $this->_debug_file );
114
-			EEH_File::add_htaccess_deny_from_all( $this->_logs_folder );
115
-		} catch( EE_Error $e ){
116
-			EE_Error::add_error( sprintf( __(  'Event Espresso logging could not be setup because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
111
+			EE_Registry::instance()->load_helper('File');
112
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_log_file);
113
+			EEH_File::ensure_file_exists_and_is_writable($this->_logs_folder.$this->_debug_file);
114
+			EEH_File::add_htaccess_deny_from_all($this->_logs_folder);
115
+		} catch (EE_Error $e) {
116
+			EE_Error::add_error(sprintf(__('Event Espresso logging could not be setup because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
117 117
 			return;
118 118
 		}
119 119
 	}
@@ -130,15 +130,15 @@  discard block
 block discarded – undo
130 130
 	 * @param string $type
131 131
 	 * @return string
132 132
 	 */
133
-	private function _format_message( $file = '', $function = '', $message = '', $type = '' ) {
134
-		$msg = '----------------------------------------------------------------------------------------' . PHP_EOL;
135
-		$msg .= '[' . current_time( 'mysql' ) . '] ';
136
-		$msg .= ! empty( $file ) ? basename( $file ) : '';
137
-		$msg .= ! empty( $file ) && ! empty( $function ) ? ' -> ' : '';
138
-		$msg .= ! empty( $function ) ? $function . '()' : '';
133
+	private function _format_message($file = '', $function = '', $message = '', $type = '') {
134
+		$msg = '----------------------------------------------------------------------------------------'.PHP_EOL;
135
+		$msg .= '['.current_time('mysql').'] ';
136
+		$msg .= ! empty($file) ? basename($file) : '';
137
+		$msg .= ! empty($file) && ! empty($function) ? ' -> ' : '';
138
+		$msg .= ! empty($function) ? $function.'()' : '';
139 139
 		$msg .= PHP_EOL;
140
-		$type = ! empty( $type ) ? $type : 'log message';
141
-		$msg .= ! empty( $message ) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : '';
140
+		$type = ! empty($type) ? $type : 'log message';
141
+		$msg .= ! empty($message) ? "\t".'['.$type.'] '.$message.PHP_EOL : '';
142 142
 		return $msg;
143 143
 	}
144 144
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
 	 * @param string $message
154 154
 	 * @param string $type
155 155
 	 */
156
-	public function log( $file = '', $function = '', $message = '', $type = '' ) {
157
-		$this->_log .= $this->_format_message( $file, $function, $message, $type );
156
+	public function log($file = '', $function = '', $message = '', $type = '') {
157
+		$this->_log .= $this->_format_message($file, $function, $message, $type);
158 158
 	}
159 159
 
160 160
 
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
 	public function write_log() {
167 167
 		try {
168 168
 			//get existing log file and append new log info
169
-			$this->_log = EEH_File::get_file_contents( $this->_logs_folder . $this->_log_file ) . $this->_log;
170
-			EEH_File::write_to_file( $this->_logs_folder . $this->_log_file, $this->_log, 'Event Espresso Log' );
171
-		} catch( EE_Error $e ){
172
-			EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
169
+			$this->_log = EEH_File::get_file_contents($this->_logs_folder.$this->_log_file).$this->_log;
170
+			EEH_File::write_to_file($this->_logs_folder.$this->_log_file, $this->_log, 'Event Espresso Log');
171
+		} catch (EE_Error $e) {
172
+			EE_Error::add_error(sprintf(__('Could not write to the Event Espresso log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
173 173
 			return;
174 174
 		}
175 175
 	}
@@ -182,31 +182,31 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 	public function send_log() {
184 184
 
185
-		if ( empty( $this->_remote_logging_url )) {
185
+		if (empty($this->_remote_logging_url)) {
186 186
 			return;
187 187
 		}
188 188
 
189
-		$data = 'domain=' . $_SERVER['HTTP_HOST'];
190
-		$data .= '&ip=' . $_SERVER['SERVER_ADDR'];
191
-		$data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE'];
192
-		$data .= '&time=' . time();
193
-		$data .= '&remote_log=' . $this->_log;
194
-		$data .= '&request_array=' . json_encode( $_REQUEST );
189
+		$data = 'domain='.$_SERVER['HTTP_HOST'];
190
+		$data .= '&ip='.$_SERVER['SERVER_ADDR'];
191
+		$data .= '&server_type='.$_SERVER['SERVER_SOFTWARE'];
192
+		$data .= '&time='.time();
193
+		$data .= '&remote_log='.$this->_log;
194
+		$data .= '&request_array='.json_encode($_REQUEST);
195 195
 		$data .= '&action=save';
196 196
 
197
-		if ( defined( 'EELOGGING_PASS' )) {
198
-			$data .= '&pass=' . EELOGGING_PASS;
197
+		if (defined('EELOGGING_PASS')) {
198
+			$data .= '&pass='.EELOGGING_PASS;
199 199
 		}
200
-		if ( defined( 'EELOGGING_KEY' )) {
201
-			$data .= '&key=' . EELOGGING_KEY;
200
+		if (defined('EELOGGING_KEY')) {
201
+			$data .= '&key='.EELOGGING_KEY;
202 202
 		}
203 203
 
204
-		$c = curl_init( $this->_remote_logging_url );
205
-		curl_setopt( $c, CURLOPT_POST, TRUE );
206
-		curl_setopt( $c, CURLOPT_POSTFIELDS, $data );
207
-		curl_setopt( $c, CURLOPT_RETURNTRANSFER, TRUE );
208
-		curl_exec( $c );
209
-		curl_close( $c );
204
+		$c = curl_init($this->_remote_logging_url);
205
+		curl_setopt($c, CURLOPT_POST, TRUE);
206
+		curl_setopt($c, CURLOPT_POSTFIELDS, $data);
207
+		curl_setopt($c, CURLOPT_RETURNTRANSFER, TRUE);
208
+		curl_exec($c);
209
+		curl_close($c);
210 210
 	}
211 211
 
212 212
 
@@ -217,18 +217,18 @@  discard block
 block discarded – undo
217 217
 	 * previous entries are overwritten
218 218
 	 */
219 219
 	public function write_debug() {
220
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
220
+		if (defined('WP_DEBUG') && WP_DEBUG) {
221 221
 			$this->_debug_log = '';
222
-			foreach ( $_GET as $key => $value ) {
223
-				$this->_debug_log .= '$_GET["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
222
+			foreach ($_GET as $key => $value) {
223
+				$this->_debug_log .= '$_GET["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
224 224
 			}
225
-			foreach ( $_POST as $key => $value ) {
226
-				$this->_debug_log .= '$_POST["' . $key . '"] = "' . serialize($value) . '"' . PHP_EOL;
225
+			foreach ($_POST as $key => $value) {
226
+				$this->_debug_log .= '$_POST["'.$key.'"] = "'.serialize($value).'"'.PHP_EOL;
227 227
 			}
228 228
 			try {
229
-				EEH_File::write_to_file( $this->_logs_folder . $this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log' );
230
-			} catch( EE_Error $e ){
231
-				EE_Error::add_error( sprintf( __(  'Could not write to the Event Espresso debug log file because: %s', 'event_espresso' ), ' &nbsp; &nbsp; ' . $e->getMessage() ), __FILE__, __FUNCTION__, __LINE__ );
229
+				EEH_File::write_to_file($this->_logs_folder.$this->_debug_file, $this->_debug_log, 'Event Espresso Debug Log');
230
+			} catch (EE_Error $e) {
231
+				EE_Error::add_error(sprintf(__('Could not write to the Event Espresso debug log file because: %s', 'event_espresso'), ' &nbsp; &nbsp; '.$e->getMessage()), __FILE__, __FUNCTION__, __LINE__);
232 232
 				return;
233 233
 			}
234 234
 		}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * __clone
241 241
 	 */
242 242
 	public function __clone() {
243
-		trigger_error( __( 'Clone is not allowed.', 'event_espresso' ), E_USER_ERROR );
243
+		trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR);
244 244
 	}
245 245
 
246 246
 
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- *
4
- * Class EE_Log
5
- *
6
- * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file.
7
- * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt
8
- * Usage:
9
- * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' );
10
- *
11
- * @package 			Event Espresso
12
- * @subpackage 	core
13
- * @author 				Sidney Harrel, Brent Christensen
14
- *
15
- */
3
+  *
4
+  * Class EE_Log
5
+  *
6
+  * Singleton logging class. Can be called from anywhere in the plugin to log data to a log file.
7
+  * Defaults to wp-content/uploads/espresso/logs/espresso_log.txt
8
+  * Usage:
9
+  * do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'logging message' );
10
+  *
11
+  * @package 			Event Espresso
12
+  * @subpackage 	core
13
+  * @author 				Sidney Harrel, Brent Christensen
14
+  *
15
+  */
16 16
 class EE_Log {
17 17
 
18 18
 	/**
Please login to merge, or discard this patch.
core/helpers/EEH_File.helper.php 1 patch
Spacing   +179 added lines, -179 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@  discard block
 block discarded – undo
12 12
  * @ version		 	4.0
13 13
  *
14 14
  */
15
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
16
-require_once( EE_INTERFACES . 'EEI_Interfaces.php' );
15
+require_once(EE_HELPERS.'EEH_Base.helper.php');
16
+require_once(EE_INTERFACES.'EEI_Interfaces.php');
17 17
 /**
18 18
  *
19 19
  * Class EEH_File
@@ -42,30 +42,30 @@  discard block
 block discarded – undo
42 42
 	 * @throws EE_Error
43 43
 	 * @return WP_Filesystem_Base
44 44
 	 */
45
-	private static function _get_wp_filesystem( $filepath = null) {
46
-		if( apply_filters( 
45
+	private static function _get_wp_filesystem($filepath = null) {
46
+		if (apply_filters( 
47 47
 				'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', 
48
-				$filepath && EEH_File::is_in_uploads_folder( $filepath ), 
49
-				$filepath ) ) {
50
-			if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) {
51
-				require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
48
+				$filepath && EEH_File::is_in_uploads_folder($filepath), 
49
+				$filepath )) {
50
+			if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) {
51
+				require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
52 52
 				$method = 'direct';
53
-				$wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
53
+				$wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
54 54
 				//check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem()
55
-				if ( ! defined('FS_CHMOD_DIR') ) {
56
-					define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
55
+				if ( ! defined('FS_CHMOD_DIR')) {
56
+					define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
57 57
 				}
58
-				if ( ! defined('FS_CHMOD_FILE') ) {
59
-					define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
58
+				if ( ! defined('FS_CHMOD_FILE')) {
59
+					define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
60 60
 				}
61
-				require_once( $wp_filesystem_direct_file );
62
-				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() );
61
+				require_once($wp_filesystem_direct_file);
62
+				EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array());
63 63
 			}
64 64
 			return EEH_File::$_wp_filesystem_direct;
65 65
 		}
66 66
 		global $wp_filesystem;
67 67
 		// no filesystem setup ???
68
-		if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) {
68
+		if ( ! $wp_filesystem instanceof WP_Filesystem_Base) {
69 69
 			// if some eager beaver's just trying to get in there too early...
70 70
 			// let them do it, because we are one of those eager beavers! :P
71 71
 			/**
@@ -78,34 +78,34 @@  discard block
 block discarded – undo
78 78
 			 * and there may be troubles if the WP files are owned by a different user
79 79
 			 * than the server user. But both of these issues should exist in 4.4 and earlier too
80 80
 			 */
81
-			if ( FALSE && ! did_action( 'wp_loaded' )) {
81
+			if (FALSE && ! did_action('wp_loaded')) {
82 82
 				$msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso');
83
-				if ( WP_DEBUG ) {
84
-					$msg .= '<br />' .  __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
83
+				if (WP_DEBUG) {
84
+					$msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso');
85 85
 				}
86
-				throw new EE_Error( $msg );
86
+				throw new EE_Error($msg);
87 87
 			} else {
88 88
 				// should be loaded if we are past the wp_loaded hook...
89
-				if ( ! function_exists( 'WP_Filesystem' )) {
90
-					require_once( ABSPATH . 'wp-admin/includes/file.php' );
91
-					require_once( ABSPATH . 'wp-admin/includes/template.php' );
89
+				if ( ! function_exists('WP_Filesystem')) {
90
+					require_once(ABSPATH.'wp-admin/includes/file.php');
91
+					require_once(ABSPATH.'wp-admin/includes/template.php');
92 92
 				}
93 93
 				// turn on output buffering so that we can capture the credentials form
94 94
 				ob_start();
95
-				$credentials = request_filesystem_credentials( '' );
95
+				$credentials = request_filesystem_credentials('');
96 96
 				// store credentials form for the time being
97 97
 				EEH_File::$_credentials_form = ob_get_clean();
98 98
 				// basically check for direct or previously configured access
99
-				if ( ! WP_Filesystem( $credentials ) ) {
99
+				if ( ! WP_Filesystem($credentials)) {
100 100
 					// if credentials do NOT exist
101
-					if ( $credentials === FALSE ) {
102
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
103
-						throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
104
-					} elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
105
-						add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 );
101
+					if ($credentials === FALSE) {
102
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
103
+						throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'));
104
+					} elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) {
105
+						add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999);
106 106
 						throw new EE_Error(
107 107
 								sprintf(
108
-										__( 'WP Filesystem Error: $1%s', 'event_espresso' ),
108
+										__('WP Filesystem Error: $1%s', 'event_espresso'),
109 109
 										$wp_filesystem->errors->get_error_message() ) );
110 110
 					}
111 111
 				}
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 * display_request_filesystem_credentials_form
119 119
 	 */
120 120
 	public static function display_request_filesystem_credentials_form() {
121
-		if ( ! empty( EEH_File::$_credentials_form )) {
122
-			echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>';
121
+		if ( ! empty(EEH_File::$_credentials_form)) {
122
+			echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>';
123 123
 		}
124 124
 	}
125 125
 
@@ -137,29 +137,29 @@  discard block
 block discarded – undo
137 137
 	 * @throws EE_Error
138 138
 	 * @return bool
139 139
 	 */
140
-	public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) {
140
+	public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') {
141 141
 		// load WP_Filesystem and set file permissions
142
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
143
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
144
-		if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) {
145
-			$file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name;
146
-			$file_name .= ! empty( $file_ext ) ? ' file' : ' folder';
142
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
143
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
144
+		if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
145
+			$file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name;
146
+			$file_name .= ! empty($file_ext) ? ' file' : ' folder';
147 147
 			$msg = sprintf(
148
-				__( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ),
148
+				__('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'),
149 149
 				$file_name,
150 150
 				'<br />'
151 151
 			);
152
-			if ( EEH_File::exists( $full_file_path )) {
153
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file );
152
+			if (EEH_File::exists($full_file_path)) {
153
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file);
154 154
 			} else {
155 155
 				// no file permissions means the file was not found
156 156
 				$msg .= sprintf(
157
-					__( 'Please ensure the following path is correct: "%s".', 'event_espresso' ),
157
+					__('Please ensure the following path is correct: "%s".', 'event_espresso'),
158 158
 					$full_file_path
159 159
 				);
160 160
 			}
161
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
162
-				throw new EE_Error( $msg . '||' . $msg );
161
+			if (defined('WP_DEBUG') && WP_DEBUG) {
162
+				throw new EE_Error($msg.'||'.$msg);
163 163
 			}
164 164
 			return FALSE;
165 165
 		}
@@ -176,24 +176,24 @@  discard block
 block discarded – undo
176 176
 	 * @param string $type_of_file - general type of file (ie: "module"), this is only used to improve error messages
177 177
 	 * @return string
178 178
 	 */
179
-	private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){
179
+	private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') {
180 180
 		// load WP_Filesystem and set file permissions
181
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
181
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
182 182
 		// check file permissions
183
-		$perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
184
-		if ( $perms ) {
183
+		$perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
184
+		if ($perms) {
185 185
 			// file permissions exist, but way be set incorrectly
186
-			$type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : '';
187
-			$type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder';
186
+			$type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : '';
187
+			$type_of_file .= ! empty($type_of_file) ? 'file' : 'folder';
188 188
 			return sprintf(
189
-				__( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ),
189
+				__('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'),
190 190
 				$type_of_file,
191 191
 				$perms
192 192
 			);
193 193
 		} else {
194 194
 			// file exists but file permissions could not be read ?!?!
195 195
 			return sprintf(
196
-				__( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ),
196
+				__('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'),
197 197
 				$full_file_path
198 198
 			);
199 199
 		}
@@ -211,35 +211,35 @@  discard block
 block discarded – undo
211 211
 	 * can't write to it
212 212
 	 * @return bool false if folder isn't writable; true if it exists and is writeable,
213 213
 	 */
214
-	public static function ensure_folder_exists_and_is_writable( $folder = '' ){
215
-		if ( empty( $folder )) {
214
+	public static function ensure_folder_exists_and_is_writable($folder = '') {
215
+		if (empty($folder)) {
216 216
 			return false;
217 217
 		}
218 218
 		// remove ending DS
219
-		$folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' ));
220
-		$parent_folder = EEH_File::get_parent_folder( $folder );
219
+		$folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\'));
220
+		$parent_folder = EEH_File::get_parent_folder($folder);
221 221
 		// add DS to folder
222
-		$folder = EEH_File::end_with_directory_separator( $folder );
223
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $folder );
224
-		if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) {
222
+		$folder = EEH_File::end_with_directory_separator($folder);
223
+		$wp_filesystem = EEH_File::_get_wp_filesystem($folder);
224
+		if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
225 225
 			//ok so it doesn't exist. Does its parent? Can we write to it?
226
-			if(	! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
226
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
227 227
 				return false;
228 228
 			}
229
-			if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) {
229
+			if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) {
230 230
 				return false;
231 231
 			} else {
232
-				if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath(  $folder ) ) ) {
233
-					if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
234
-						$msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder );
235
-						$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder );
236
-						throw new EE_Error( $msg );
232
+				if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) {
233
+					if (defined('WP_DEBUG') && WP_DEBUG) {
234
+						$msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder);
235
+						$msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder);
236
+						throw new EE_Error($msg);
237 237
 					}
238 238
 					return false;
239 239
 				}
240
-				EEH_File::add_index_file( $folder );
240
+				EEH_File::add_index_file($folder);
241 241
 			}
242
-		} elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
242
+		} elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) {
243 243
 			return false;
244 244
 		}
245 245
 		return true;
@@ -254,15 +254,15 @@  discard block
 block discarded – undo
254 254
 	 * @throws EE_Error
255 255
 	 * @return bool
256 256
 	 */
257
-	public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){
257
+	public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') {
258 258
 		// load WP_Filesystem and set file permissions
259
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_path );
260
-		$full_path = EEH_File::standardise_directory_separators( $full_path );
261
-		if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) {
262
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
263
-				$msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder );
264
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path );
265
-				throw new EE_Error( $msg );
259
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_path);
260
+		$full_path = EEH_File::standardise_directory_separators($full_path);
261
+		if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) {
262
+			if (defined('WP_DEBUG') && WP_DEBUG) {
263
+				$msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder);
264
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path);
265
+				throw new EE_Error($msg);
266 266
 			}
267 267
 			return FALSE;
268 268
 		}
@@ -279,25 +279,25 @@  discard block
 block discarded – undo
279 279
 	 * @throws EE_Error
280 280
 	 * @return bool
281 281
 	 */
282
-	public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) {
282
+	public static function ensure_file_exists_and_is_writable($full_file_path = '') {
283 283
 		// load WP_Filesystem and set file permissions
284
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
285
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
286
-		$parent_folder = EEH_File::get_parent_folder( $full_file_path );
287
-		if ( ! EEH_File::exists( $full_file_path )) {
288
-			if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) {
284
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
285
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
286
+		$parent_folder = EEH_File::get_parent_folder($full_file_path);
287
+		if ( ! EEH_File::exists($full_file_path)) {
288
+			if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) {
289 289
 				return false;
290 290
 			}
291
-			if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) {
292
-				if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
293
-					$msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path );
294
-					$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
295
-					throw new EE_Error( $msg );
291
+			if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
292
+				if (defined('WP_DEBUG') && WP_DEBUG) {
293
+					$msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path);
294
+					$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
295
+					throw new EE_Error($msg);
296 296
 				}
297 297
 				return false;
298 298
 			}
299 299
 		}
300
-		if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) {
300
+		if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) {
301 301
 			return false;
302 302
 		}
303 303
 		return true;
@@ -309,15 +309,15 @@  discard block
 block discarded – undo
309 309
 	 * @param string $file_or_folder_path
310 310
 	 * @return string parent folder, ENDING with a directory separator
311 311
 	 */
312
-	public static function get_parent_folder( $file_or_folder_path ) {
312
+	public static function get_parent_folder($file_or_folder_path) {
313 313
 		//find the last DS, ignoring a DS on the very end
314 314
 		//eg if given "/var/something/somewhere/", we want to get "somewhere"'s
315 315
 		//parent folder, "/var/something/"
316
-		$ds = strrpos( $file_or_folder_path, DS, -2 );
317
-		return substr( $file_or_folder_path, 0, $ds + 1 );
316
+		$ds = strrpos($file_or_folder_path, DS, -2);
317
+		return substr($file_or_folder_path, 0, $ds + 1);
318 318
 	}
319 319
 	
320
-	public static function ensure_folder_exists_recursively( $folder ) {
320
+	public static function ensure_folder_exists_recursively($folder) {
321 321
 		
322 322
 	}
323 323
 
@@ -328,12 +328,12 @@  discard block
 block discarded – undo
328 328
 	 * @param string $full_file_path
329 329
 	 * @return string
330 330
 	 */
331
-	public static function get_file_contents( $full_file_path = '' ){
332
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
333
-		if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) {
331
+	public static function get_file_contents($full_file_path = '') {
332
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
333
+		if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) {
334 334
 			// load WP_Filesystem and set file permissions
335
-			$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
336
-			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) );
335
+			$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
336
+			return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path));
337 337
 		}
338 338
 		return '';
339 339
 	}
@@ -348,26 +348,26 @@  discard block
 block discarded – undo
348 348
 	 * @throws EE_Error
349 349
 	 * @return bool
350 350
 	 */
351
-	public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){
352
-		$full_file_path = EEH_File::standardise_directory_separators( $full_file_path );
353
-		$file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : '';
354
-		$folder = EEH_File::remove_filename_from_filepath( $full_file_path );
355
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
356
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
357
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path );
358
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path );
359
-				throw new EE_Error( $msg );
351
+	public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') {
352
+		$full_file_path = EEH_File::standardise_directory_separators($full_file_path);
353
+		$file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : '';
354
+		$folder = EEH_File::remove_filename_from_filepath($full_file_path);
355
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
356
+			if (defined('WP_DEBUG') && WP_DEBUG) {
357
+				$msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path);
358
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path);
359
+				throw new EE_Error($msg);
360 360
 			}
361 361
 			return FALSE;
362 362
 		}
363 363
 		// load WP_Filesystem and set file permissions
364
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
364
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
365 365
 		// write the file
366
-		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) {
367
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
368
-				$msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path );
369
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' );
370
-				throw new EE_Error( $msg );
366
+		if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) {
367
+			if (defined('WP_DEBUG') && WP_DEBUG) {
368
+				$msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path);
369
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f');
370
+				throw new EE_Error($msg);
371 371
 			}
372 372
 			return FALSE;
373 373
 		}
@@ -382,9 +382,9 @@  discard block
 block discarded – undo
382 382
 	 * @param boolean|string $type 'd' for directory, 'f' for file
383 383
 	 * @return boolean
384 384
 	 */
385
-	public static function delete( $filepath, $recursive = false, $type = false ) {
385
+	public static function delete($filepath, $recursive = false, $type = false) {
386 386
 		$wp_filesystem = EEH_File::_get_wp_filesystem();
387
-		return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE;
387
+		return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE;
388 388
 	}
389 389
 
390 390
 
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	 * @param string $full_file_path
397 397
 	 * @return bool
398 398
 	 */
399
-	public static function exists( $full_file_path = '' ) {
400
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
401
-		return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE;
399
+	public static function exists($full_file_path = '') {
400
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
401
+		return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE;
402 402
 	}
403 403
 
404 404
 
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 	 * @param string $full_file_path
411 411
 	 * @return bool
412 412
 	 */
413
-	public static function is_readable( $full_file_path = '' ) {
414
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path );
415
-		if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath(  $full_file_path ) ) ) {
413
+	public static function is_readable($full_file_path = '') {
414
+		$wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path);
415
+		if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) {
416 416
 			return true;
417 417
 		} else {
418 418
 			return false;
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
 	 * @param string $full_file_path
429 429
 	 * @return string
430 430
 	 */
431
-	public static function remove_filename_from_filepath( $full_file_path = '' ) {
432
-		return pathinfo( $full_file_path, PATHINFO_DIRNAME );
431
+	public static function remove_filename_from_filepath($full_file_path = '') {
432
+		return pathinfo($full_file_path, PATHINFO_DIRNAME);
433 433
 	}
434 434
 
435 435
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 	 * @param string $full_file_path
440 440
 	 * @return string
441 441
 	 */
442
-	public static function get_filename_from_filepath( $full_file_path = '' ) {
443
-		return pathinfo( $full_file_path, PATHINFO_BASENAME );
442
+	public static function get_filename_from_filepath($full_file_path = '') {
443
+		return pathinfo($full_file_path, PATHINFO_BASENAME);
444 444
 	}
445 445
 
446 446
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param string $full_file_path
451 451
 	 * @return string
452 452
 	 */
453
-	public static function get_file_extension( $full_file_path = '' ) {
454
-		return pathinfo( $full_file_path, PATHINFO_EXTENSION );
453
+	public static function get_file_extension($full_file_path = '') {
454
+		return pathinfo($full_file_path, PATHINFO_EXTENSION);
455 455
 	}
456 456
 
457 457
 
@@ -461,10 +461,10 @@  discard block
 block discarded – undo
461 461
 	 * @param string $folder
462 462
 	 * @return bool
463 463
 	 */
464
-	public static function add_htaccess_deny_from_all( $folder = '' ) {
465
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
466
-		if ( ! EEH_File::exists( $folder . '.htaccess' ) ) {
467
-			if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) {
464
+	public static function add_htaccess_deny_from_all($folder = '') {
465
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
466
+		if ( ! EEH_File::exists($folder.'.htaccess')) {
467
+			if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) {
468 468
 				return FALSE;
469 469
 			}
470 470
 		}
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
 	 * @param string $folder
478 478
 	 * @return boolean
479 479
 	 */
480
-	public static function add_index_file( $folder ) {
481
-		$folder = EEH_File::standardise_and_end_with_directory_separator( $folder );
482
-		if ( ! EEH_File::exists( $folder . 'index.php' ) ) {
483
-			if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) {
480
+	public static function add_index_file($folder) {
481
+		$folder = EEH_File::standardise_and_end_with_directory_separator($folder);
482
+		if ( ! EEH_File::exists($folder.'index.php')) {
483
+			if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) {
484 484
 				return false;
485 485
 			}
486 486
 		}
@@ -495,11 +495,11 @@  discard block
 block discarded – undo
495 495
 	 * @param string $file_path
496 496
 	 * @return string
497 497
 	 */
498
-	public static function get_classname_from_filepath_with_standard_filename( $file_path ){
498
+	public static function get_classname_from_filepath_with_standard_filename($file_path) {
499 499
 		//extract file from path
500
-		$filename = basename( $file_path );
500
+		$filename = basename($file_path);
501 501
 		//now remove the first period and everything after
502
-		$pos_of_first_period = strpos( $filename,'.' );
502
+		$pos_of_first_period = strpos($filename, '.');
503 503
 		return substr($filename, 0, $pos_of_first_period);
504 504
 	}
505 505
 
@@ -511,8 +511,8 @@  discard block
 block discarded – undo
511 511
 	 * @param string $file_path
512 512
 	 * @return string
513 513
 	 */
514
-	public static function standardise_directory_separators( $file_path ){
515
-		return str_replace( array( '\\', '/' ), DS, $file_path );
514
+	public static function standardise_directory_separators($file_path) {
515
+		return str_replace(array('\\', '/'), DS, $file_path);
516 516
 	}
517 517
 
518 518
 
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @param string $file_path
524 524
 	 * @return string
525 525
 	 */
526
-	public static function end_with_directory_separator( $file_path ){
527
-		return rtrim( $file_path, '/\\' ) . DS;
526
+	public static function end_with_directory_separator($file_path) {
527
+		return rtrim($file_path, '/\\').DS;
528 528
 	}
529 529
 
530 530
 
@@ -534,8 +534,8 @@  discard block
 block discarded – undo
534 534
 	 * @param $file_path
535 535
 	 * @return string
536 536
 	 */
537
-	public static function standardise_and_end_with_directory_separator( $file_path ){
538
-		return self::end_with_directory_separator( self::standardise_directory_separators( $file_path ));
537
+	public static function standardise_and_end_with_directory_separator($file_path) {
538
+		return self::end_with_directory_separator(self::standardise_directory_separators($file_path));
539 539
 	}
540 540
 
541 541
 
@@ -552,21 +552,21 @@  discard block
 block discarded – undo
552 552
 	 *		if $index_numerically == FALSE (Default) keys are what the class names SHOULD be;
553 553
 	 *		 and values are their filepaths
554 554
 	 */
555
-	public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){
555
+	public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) {
556 556
 		$class_to_folder_path = array();
557
-		foreach( $folder_paths as $folder_path ){
558
-			$folder_path = self::standardise_and_end_with_directory_separator( $folder_path );
557
+		foreach ($folder_paths as $folder_path) {
558
+			$folder_path = self::standardise_and_end_with_directory_separator($folder_path);
559 559
 			// load WP_Filesystem and set file permissions
560
-			$files_in_folder = glob( $folder_path . '*' );
560
+			$files_in_folder = glob($folder_path.'*');
561 561
 			$class_to_folder_path = array();
562
-			if ( $files_in_folder ) {
563
-				foreach( $files_in_folder as $file_path ){
562
+			if ($files_in_folder) {
563
+				foreach ($files_in_folder as $file_path) {
564 564
 					//only add files, not folders
565
-					if ( ! is_dir( $file_path )) {
566
-						if ( $index_numerically ) {
565
+					if ( ! is_dir($file_path)) {
566
+						if ($index_numerically) {
567 567
 							$class_to_folder_path[] = $file_path;
568 568
 						} else {
569
-							$classname = self::get_classname_from_filepath_with_standard_filename( $file_path );
569
+							$classname = self::get_classname_from_filepath_with_standard_filename($file_path);
570 570
 							$class_to_folder_path[$classname] = $file_path;
571 571
 						}
572 572
 					}
@@ -586,39 +586,39 @@  discard block
 block discarded – undo
586 586
 	 * @return boolean success
587 587
 	 * @throws EE_Error
588 588
 	 */
589
-	public static function copy( $source_file, $destination_file, $overwrite = FALSE ){
590
-		$full_source_path = EEH_File::standardise_directory_separators( $source_file );
591
-		if( ! EEH_File::exists( $full_source_path ) ){
592
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
593
-				$msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path );
594
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path );
595
-				throw new EE_Error( $msg );
589
+	public static function copy($source_file, $destination_file, $overwrite = FALSE) {
590
+		$full_source_path = EEH_File::standardise_directory_separators($source_file);
591
+		if ( ! EEH_File::exists($full_source_path)) {
592
+			if (defined('WP_DEBUG') && WP_DEBUG) {
593
+				$msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path);
594
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path);
595
+				throw new EE_Error($msg);
596 596
 			}
597 597
 			return FALSE;
598 598
 		}
599 599
 
600
-		$full_dest_path = EEH_File::standardise_directory_separators( $destination_file );
601
-		$folder = EEH_File::remove_filename_from_filepath( $full_dest_path );
602
-		if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) {
603
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
604
-				$msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path );
605
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path );
606
-				throw new EE_Error( $msg );
600
+		$full_dest_path = EEH_File::standardise_directory_separators($destination_file);
601
+		$folder = EEH_File::remove_filename_from_filepath($full_dest_path);
602
+		if ( ! EEH_File::verify_is_writable($folder, 'folder')) {
603
+			if (defined('WP_DEBUG') && WP_DEBUG) {
604
+				$msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path);
605
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path);
606
+				throw new EE_Error($msg);
607 607
 			}
608 608
 			return FALSE;
609 609
 		}
610 610
 
611 611
 		// load WP_Filesystem and set file permissions
612
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file );
612
+		$wp_filesystem = EEH_File::_get_wp_filesystem($destination_file);
613 613
 		// write the file
614 614
 		if ( ! $wp_filesystem->copy( 
615
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), 
616
-						EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), 
615
+						EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), 
616
+						EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), 
617 617
 						$overwrite )) {
618
-			if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
619
-				$msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path );
620
-				$msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' );
621
-				throw new EE_Error( $msg );
618
+			if (defined('WP_DEBUG') && WP_DEBUG) {
619
+				$msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path);
620
+				$msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f');
621
+				throw new EE_Error($msg);
622 622
 			}
623 623
 			return FALSE;
624 624
 		}
@@ -630,9 +630,9 @@  discard block
 block discarded – undo
630 630
 	 * @param string $filepath
631 631
 	 * @return boolean
632 632
 	 */
633
-	public static function is_in_uploads_folder( $filepath ) {
633
+	public static function is_in_uploads_folder($filepath) {
634 634
 		$uploads = wp_upload_dir();
635
-		return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false;
635
+		return strpos($filepath, $uploads['basedir']) === 0 ? true : false;
636 636
 	}
637 637
 	
638 638
 	/**
@@ -646,9 +646,9 @@  discard block
 block discarded – undo
646 646
 	 * @return string the remote filepath (eg the filepath the filesystem method, eg 
647 647
 	 * ftp or ssh, will use to access the folder
648 648
 	 */
649
-	public static function convert_local_filepath_to_remote_filepath( $local_filepath ) {
650
-		$wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath );
651
-		return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath );
649
+	public static function convert_local_filepath_to_remote_filepath($local_filepath) {
650
+		$wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath);
651
+		return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath);
652 652
 	}
653 653
 }
654 654
 // End of file EEH_File.helper.php
Please login to merge, or discard this patch.