Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
19:19
created
core/libraries/form_sections/form_handlers/SequentialStepForm.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 use InvalidArgumentException;
6 6
 
7
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
8
-	exit( 'No direct script access allowed' );
7
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 		$form_config = 'add_form_tags_and_submit',
87 87
 		\EE_Registry $registry
88 88
 	) {
89
-		$this->setOrder( $order );
90
-		parent::__construct( $form_name, $admin_name, $slug, $form_action, $form_config, $registry );
89
+		$this->setOrder($order);
90
+		parent::__construct($form_name, $admin_name, $slug, $form_action, $form_config, $registry);
91 91
 	}
92 92
 
93 93
 
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	 * @param int $order
106 106
 	 * @throws InvalidArgumentException
107 107
 	 */
108
-	public function setOrder( $order ) {
109
-		$order = absint( $order );
110
-		if ( ! $order > 0 ) {
108
+	public function setOrder($order) {
109
+		$order = absint($order);
110
+		if ( ! $order > 0) {
111 111
 			throw new InvalidArgumentException(
112
-				__( 'The form order property must be a positive integer.', 'event_espresso' )
112
+				__('The form order property must be a positive integer.', 'event_espresso')
113 113
 			);
114 114
 		}
115 115
 		$this->order = $order;
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @return string
123 123
 	 */
124 124
 	public function redirectUrl() {
125
-		return ! empty( $this->redirect_args )
126
-			? add_query_arg( $this->redirect_args, $this->redirect_url )
125
+		return ! empty($this->redirect_args)
126
+			? add_query_arg($this->redirect_args, $this->redirect_url)
127 127
 			: $this->redirect_url;
128 128
 	}
129 129
 
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	 * @throws InvalidDataTypeException
135 135
 	 * @throws InvalidArgumentException
136 136
 	 */
137
-	public function setRedirectUrl( $redirect_url ) {
138
-		if ( ! is_string( $redirect_url ) ) {
139
-			throw new InvalidDataTypeException( '$redirect_url', $redirect_url, 'string' );
137
+	public function setRedirectUrl($redirect_url) {
138
+		if ( ! is_string($redirect_url)) {
139
+			throw new InvalidDataTypeException('$redirect_url', $redirect_url, 'string');
140 140
 		}
141
-		if ( empty( $redirect_url ) ) {
141
+		if (empty($redirect_url)) {
142 142
 			throw new InvalidArgumentException(
143
-				__( 'The redirect URL can not be an empty string.', 'event_espresso' )
143
+				__('The redirect URL can not be an empty string.', 'event_espresso')
144 144
 			);
145 145
 		}
146 146
 		$this->redirect_url = $redirect_url;
@@ -153,20 +153,20 @@  discard block
 block discarded – undo
153 153
 	 * @throws InvalidDataTypeException
154 154
 	 * @throws InvalidArgumentException
155 155
 	 */
156
-	public function addRedirectArgs( $redirect_args = array() ) {
157
-		if ( is_object( $redirect_args ) ) {
156
+	public function addRedirectArgs($redirect_args = array()) {
157
+		if (is_object($redirect_args)) {
158 158
 			throw new InvalidDataTypeException(
159 159
 				'$redirect_args',
160 160
 				$redirect_args,
161 161
 				'anything other than an object was expected.'
162 162
 			);
163 163
 		}
164
-		if ( empty( $redirect_args ) ) {
164
+		if (empty($redirect_args)) {
165 165
 			throw new InvalidArgumentException(
166
-				__( 'The redirect argument can not be an empty array.', 'event_espresso' )
166
+				__('The redirect argument can not be an empty array.', 'event_espresso')
167 167
 			);
168 168
 		}
169
-		$this->redirect_args = array_merge( $this->redirect_args, (array) $redirect_args );
169
+		$this->redirect_args = array_merge($this->redirect_args, (array) $redirect_args);
170 170
 	}
171 171
 
172 172
 
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
 	 * @throws InvalidDataTypeException
177 177
 	 * @throws InvalidArgumentException
178 178
 	 */
179
-	public function removeRedirectArgs( $redirect_arg_keys_to_remove = array() ) {
180
-		if ( is_object( $redirect_arg_keys_to_remove ) ) {
179
+	public function removeRedirectArgs($redirect_arg_keys_to_remove = array()) {
180
+		if (is_object($redirect_arg_keys_to_remove)) {
181 181
 			throw new InvalidDataTypeException(
182 182
 				'$redirect_arg_keys_to_remove',
183 183
 				$redirect_arg_keys_to_remove,
184 184
 				'anything other than an object was expected.'
185 185
 			);
186 186
 		}
187
-		if ( empty( $redirect_arg_keys_to_remove ) ) {
187
+		if (empty($redirect_arg_keys_to_remove)) {
188 188
 			throw new InvalidArgumentException(
189
-				__( 'The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso' )
189
+				__('The $redirect_arg_keys_to_remove argument can not be an empty array.', 'event_espresso')
190 190
 			);
191 191
 		}
192
-		foreach ( $redirect_arg_keys_to_remove as $redirect_arg_key ) {
193
-			unset( $this->redirect_args[ $redirect_arg_key ] );
192
+		foreach ($redirect_arg_keys_to_remove as $redirect_arg_key) {
193
+			unset($this->redirect_args[$redirect_arg_key]);
194 194
 		}
195 195
 	}
196 196
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	/**
209 209
 	 * @param string $redirect_to
210 210
 	 */
211
-	public function setRedirectTo( $redirect_to ) {
211
+	public function setRedirectTo($redirect_to) {
212 212
 		if (
213 213
 			! in_array(
214 214
 				$redirect_to,
Please login to merge, or discard this patch.
core/libraries/form_sections/base/EE_Form_Section_Proper.form.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			if(isset($default_data[$subsection_name])){
300 300
 				if($subsection instanceof EE_Form_Input_Base){
301 301
 					$subsection->set_default($default_data[$subsection_name]);
302
-				}elseif($subsection instanceof EE_Form_Section_Proper){
302
+				} elseif($subsection instanceof EE_Form_Section_Proper){
303 303
 					$subsection->populate_defaults($default_data[$subsection_name]);
304 304
 				}
305 305
 			}
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 		foreach($this->subsections() as $subsection){
626 626
 			if( $subsection instanceof EE_Form_Input_Base ){
627 627
 				$inputs[ $subsection->html_name() ] = $subsection;
628
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
628
+			} elseif($subsection instanceof EE_Form_Section_Proper ){
629 629
 				$inputs += $subsection->inputs_in_subsections();
630 630
 			}
631 631
 		}
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	public function html_name_prefix(){
1117 1117
 		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1118 1118
 			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1119
-		}else{
1119
+		} else{
1120 1120
 			return $this->name();
1121 1121
 		}
1122 1122
 	}
@@ -1178,7 +1178,7 @@  discard block
 block discarded – undo
1178 1178
 				if( $subsection->form_data_present_in( $req_data ) ) {
1179 1179
 					return TRUE;
1180 1180
 				}
1181
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1181
+			} elseif( $subsection instanceof EE_Form_Section_Proper ) {
1182 1182
 				if( $subsection->form_data_present_in( $req_data ) ) {
1183 1183
 					return TRUE;
1184 1184
 				}
Please login to merge, or discard this patch.
Spacing   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * before the hook wp_enqueue_scripts is called (so that the form section can enqueue its needed scripts).
8 8
  * However, you may output the form (usually by calling get_html) anywhere you like.
9 9
  */
10
-class EE_Form_Section_Proper extends EE_Form_Section_Validatable{
10
+class EE_Form_Section_Proper extends EE_Form_Section_Validatable {
11 11
 
12 12
 	const SUBMITTED_FORM_DATA_SSN_KEY = 'submitted_form_data';
13 13
 
@@ -71,49 +71,49 @@  discard block
 block discarded – undo
71 71
 	 *                               } @see EE_Form_Section_Validatable::__construct()
72 72
 	 * @throws \EE_Error
73 73
 	 */
74
-	public function __construct( $options_array = array() ){
75
-		$options_array = (array) apply_filters( 'FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this );
74
+	public function __construct($options_array = array()) {
75
+		$options_array = (array) apply_filters('FHEE__EE_Form_Section_Proper___construct__options_array', $options_array, $this);
76 76
 		//call parent first, as it may be setting the name
77 77
 		parent::__construct($options_array);
78 78
 		//if they've included subsections in the constructor, add them now
79
-		if( isset( $options_array['include'] )){
79
+		if (isset($options_array['include'])) {
80 80
 			//we are going to make sure we ONLY have those subsections to include
81 81
 			//AND we are going to make sure they're in that specified order
82 82
 			$reordered_subsections = array();
83
-			foreach($options_array['include'] as $input_name){
84
-				if(isset($this->_subsections[$input_name])){
83
+			foreach ($options_array['include'] as $input_name) {
84
+				if (isset($this->_subsections[$input_name])) {
85 85
 					$reordered_subsections[$input_name] = $this->_subsections[$input_name];
86 86
 				}
87 87
 			}
88 88
 			$this->_subsections = $reordered_subsections;
89 89
 		}
90
-		if(isset($options_array['exclude'])){
90
+		if (isset($options_array['exclude'])) {
91 91
 			$exclude = $options_array['exclude'];
92 92
 			$this->_subsections = array_diff_key($this->_subsections, array_flip($exclude));
93 93
 		}
94
-		if(isset($options_array['layout_strategy'])){
94
+		if (isset($options_array['layout_strategy'])) {
95 95
 			$this->_layout_strategy = $options_array['layout_strategy'];
96 96
 		}
97
-		if( ! $this->_layout_strategy){
97
+		if ( ! $this->_layout_strategy) {
98 98
 			$this->_layout_strategy = is_admin() ? new EE_Admin_Two_Column_Layout() : new EE_Two_Column_Layout();
99 99
 		}
100 100
 		$this->_layout_strategy->_construct_finalize($this);
101 101
 
102 102
 		//ok so we are definitely going to want the forms JS,
103 103
 		//so enqueue it or remember to enqueue it during wp_enqueue_scripts
104
-		if( did_action( 'wp_enqueue_scripts' )
105
-			|| did_action( 'admin_enqueue_scripts' ) ) {
104
+		if (did_action('wp_enqueue_scripts')
105
+			|| did_action('admin_enqueue_scripts')) {
106 106
 			//ok so they've constructed this object after when they should have.
107 107
 			//just enqueue the generic form scripts and initialize the form immediately in the JS
108
-			\EE_Form_Section_Proper::wp_enqueue_scripts( true );
108
+			\EE_Form_Section_Proper::wp_enqueue_scripts(true);
109 109
 		} else {
110
-			add_action( 'wp_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
111
-			add_action( 'admin_enqueue_scripts', array( 'EE_Form_Section_Proper', 'wp_enqueue_scripts' ));
110
+			add_action('wp_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
111
+			add_action('admin_enqueue_scripts', array('EE_Form_Section_Proper', 'wp_enqueue_scripts'));
112 112
 		}
113
-		add_action( 'wp_footer', array( $this, 'ensure_scripts_localized' ), 1 );
113
+		add_action('wp_footer', array($this, 'ensure_scripts_localized'), 1);
114 114
 
115
-		if( isset( $options_array[ 'name' ] ) ) {
116
-			$this->_construct_finalize( null, $options_array[ 'name' ] );
115
+		if (isset($options_array['name'])) {
116
+			$this->_construct_finalize(null, $options_array['name']);
117 117
 		}
118 118
 	}
119 119
 
@@ -126,25 +126,25 @@  discard block
 block discarded – undo
126 126
 	 * @param string                 $name
127 127
 	 * @throws \EE_Error
128 128
 	 */
129
-	public function _construct_finalize( $parent_form_section, $name ) {
129
+	public function _construct_finalize($parent_form_section, $name) {
130 130
 		parent::_construct_finalize($parent_form_section, $name);
131 131
 		$this->_set_default_name_if_empty();
132 132
 		$this->_set_default_html_id_if_empty();
133
-		foreach( $this->_subsections as $subsection_name => $subsection ){
134
-			if ( $subsection instanceof EE_Form_Section_Base ) {
135
-				$subsection->_construct_finalize( $this, $subsection_name );
133
+		foreach ($this->_subsections as $subsection_name => $subsection) {
134
+			if ($subsection instanceof EE_Form_Section_Base) {
135
+				$subsection->_construct_finalize($this, $subsection_name);
136 136
 			} else {
137 137
 				throw new EE_Error(
138 138
 					sprintf(
139
-						__( 'Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso' ),
139
+						__('Subsection "%s" is not an instanceof EE_Form_Section_Base on form "%s". It is a "%s"', 'event_espresso'),
140 140
 						$subsection_name,
141 141
 						get_class($this),
142
-						$subsection ? get_class($subsection) : __( 'NULL', 'event_espresso' )
142
+						$subsection ? get_class($subsection) : __('NULL', 'event_espresso')
143 143
 					)
144 144
 				);
145 145
 			}
146 146
 		}
147
-		do_action( 'AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name );
147
+		do_action('AHEE__EE_Form_Section_Proper___construct_finalize__end', $this, $parent_form_section, $name);
148 148
 	}
149 149
 
150 150
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * Gets the layout strategy for this form section
154 154
 	 * @return EE_Form_Section_Layout_Base
155 155
 	 */
156
-	public function get_layout_strategy(){
156
+	public function get_layout_strategy() {
157 157
 		return $this->_layout_strategy;
158 158
 	}
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @param EE_Form_Input_Base $input
166 166
 	 * @return string
167 167
 	 */
168
-	public function get_html_for_input($input){
168
+	public function get_html_for_input($input) {
169 169
 		return $this->_layout_strategy->layout_input($input);
170 170
 	}
171 171
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @param null $form_data
179 179
 	 * @return boolean
180 180
 	 */
181
-	public function was_submitted($form_data = NULL){
181
+	public function was_submitted($form_data = NULL) {
182 182
 		return $this->form_data_present_in($form_data);
183 183
 	}
184 184
 
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
 	 *                             (eg you validated the data then stored it in the DB)
204 204
 	 *                             you may want to skip this step.
205 205
 	 */
206
-	public function receive_form_submission( $req_data = null, $validate = true ){
207
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate );
208
-		if( $req_data === null ){
209
-			$req_data = array_merge( $_GET, $_POST );
206
+	public function receive_form_submission($req_data = null, $validate = true) {
207
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__req_data', $req_data, $this, $validate);
208
+		if ($req_data === null) {
209
+			$req_data = array_merge($_GET, $_POST);
210 210
 		}
211
-		$req_data = apply_filters( 'FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this );
212
-		$this->_normalize( $req_data );
213
-		if( $validate ){
211
+		$req_data = apply_filters('FHEE__EE_Form_Section_Proper__receive_form_submission__request_data', $req_data, $this);
212
+		$this->_normalize($req_data);
213
+		if ($validate) {
214 214
 			$this->_validate();
215 215
 			//if it's invalid, we're going to want to re-display so remember what they submitted
216
-			if ( ! $this->is_valid() ) {
216
+			if ( ! $this->is_valid()) {
217 217
 				$this->store_submitted_form_data_in_session();
218 218
 			}
219 219
 		}
220
-		do_action( 'AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate );
220
+		do_action('AHEE__EE_Form_Section_Proper__receive_form_submission__end', $req_data, $this, $validate);
221 221
 	}
222 222
 
223 223
 
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	protected function store_submitted_form_data_in_session() {
232 232
 		return EE_Registry::instance()->SSN->set_session_data(
233 233
 			array(
234
-				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values( true )
234
+				\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY => $this->submitted_values(true)
235 235
 			)
236 236
 		);
237 237
 	}
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	 */
260 260
 	protected function flush_submitted_form_data_from_session() {
261 261
 		return EE_Registry::instance()->SSN->reset_data(
262
-			array( \EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY )
262
+			array(\EE_Form_Section_Proper::SUBMITTED_FORM_DATA_SSN_KEY)
263 263
 		);
264 264
 	}
265 265
 
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
 	 */
276 276
 	public function populate_from_session() {
277 277
 		$form_data_in_session = $this->get_submitted_form_data_from_session();
278
-		if ( empty( $form_data_in_session ) ) {
278
+		if (empty($form_data_in_session)) {
279 279
 			return false;
280 280
 		}
281
-		$this->receive_form_submission( $form_data_in_session );
281
+		$this->receive_form_submission($form_data_in_session);
282 282
 		$this->flush_submitted_form_data_from_session();
283
-		if ( $this->form_data_present_in( $form_data_in_session ) ) {
283
+		if ($this->form_data_present_in($form_data_in_session)) {
284 284
 			return true;
285 285
 		} else {
286 286
 			return false;
@@ -297,12 +297,12 @@  discard block
 block discarded – undo
297 297
 	 * the value being an array formatted in teh same way
298 298
 	 * @param array $default_data
299 299
 	 */
300
-	public function populate_defaults($default_data){
301
-		foreach($this->subsections() as $subsection_name => $subsection){
302
-			if(isset($default_data[$subsection_name])){
303
-				if($subsection instanceof EE_Form_Input_Base){
300
+	public function populate_defaults($default_data) {
301
+		foreach ($this->subsections() as $subsection_name => $subsection) {
302
+			if (isset($default_data[$subsection_name])) {
303
+				if ($subsection instanceof EE_Form_Input_Base) {
304 304
 					$subsection->set_default($default_data[$subsection_name]);
305
-				}elseif($subsection instanceof EE_Form_Section_Proper){
305
+				}elseif ($subsection instanceof EE_Form_Section_Proper) {
306 306
 					$subsection->populate_defaults($default_data[$subsection_name]);
307 307
 				}
308 308
 			}
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
 	 * @param string $name
318 318
 	 * @return boolean
319 319
 	 */
320
-	public function subsection_exists( $name ){
321
-		return isset( $this->_subsections[ $name ] ) ? true : false;
320
+	public function subsection_exists($name) {
321
+		return isset($this->_subsections[$name]) ? true : false;
322 322
 	}
323 323
 
324 324
 
@@ -336,11 +336,11 @@  discard block
 block discarded – undo
336 336
 	 * @return EE_Form_Section_Base
337 337
 	 * @throws \EE_Error
338 338
 	 */
339
-	public function get_subsection($name, $require_construction_to_be_finalized = TRUE ){
340
-		if( $require_construction_to_be_finalized ){
339
+	public function get_subsection($name, $require_construction_to_be_finalized = TRUE) {
340
+		if ($require_construction_to_be_finalized) {
341 341
 			$this->ensure_construct_finalized_called();
342 342
 		}
343
-		return $this->subsection_exists( $name ) ? $this->_subsections[$name] : NULL;
343
+		return $this->subsection_exists($name) ? $this->_subsections[$name] : NULL;
344 344
 	}
345 345
 
346 346
 
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 	 * Gets all the validatable subsections of this form section
350 350
 	 * @return EE_Form_Section_Validatable[]
351 351
 	 */
352
-	public function get_validatable_subsections(){
352
+	public function get_validatable_subsections() {
353 353
 		$validatable_subsections = array();
354
-		foreach($this->subsections() as $name=>$obj){
355
-			if($obj instanceof EE_Form_Section_Validatable){
354
+		foreach ($this->subsections() as $name=>$obj) {
355
+			if ($obj instanceof EE_Form_Section_Validatable) {
356 356
 				$validatable_subsections[$name] = $obj;
357 357
 			}
358 358
 		}
@@ -372,9 +372,9 @@  discard block
 block discarded – undo
372 372
 	 * @return EE_Form_Input_Base
373 373
 	 * @throws EE_Error
374 374
 	 */
375
-	public function get_input($name, $require_construction_to_be_finalized = TRUE ){
375
+	public function get_input($name, $require_construction_to_be_finalized = TRUE) {
376 376
 		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
377
-		if( ! $subsection instanceof EE_Form_Input_Base){
377
+		if ( ! $subsection instanceof EE_Form_Input_Base) {
378 378
 			throw new EE_Error(
379 379
 				sprintf(
380 380
 					__(
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 						'event_espresso'
383 383
 					),
384 384
 					$name,
385
-					get_class( $this ),
386
-					$subsection ? get_class( $subsection ) : __( "NULL", 'event_espresso' )
385
+					get_class($this),
386
+					$subsection ? get_class($subsection) : __("NULL", 'event_espresso')
387 387
 				)
388 388
 			);
389 389
 		}
@@ -403,14 +403,14 @@  discard block
 block discarded – undo
403 403
 	 * @return EE_Form_Section_Proper
404 404
 	 * @throws EE_Error
405 405
 	 */
406
-	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE ){
407
-		$subsection = $this->get_subsection( $name, $require_construction_to_be_finalized );
408
-		if( ! $subsection instanceof EE_Form_Section_Proper){
406
+	public function get_proper_subsection($name, $require_construction_to_be_finalized = TRUE) {
407
+		$subsection = $this->get_subsection($name, $require_construction_to_be_finalized);
408
+		if ( ! $subsection instanceof EE_Form_Section_Proper) {
409 409
 			throw new EE_Error(
410 410
 				sprintf(
411
-					__( "Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso' ),
411
+					__("Subsection '%'s is not an instanceof EE_Form_Section_Proper on form '%s'", 'event_espresso'),
412 412
 					$name,
413
-					get_class( $this )
413
+					get_class($this)
414 414
 				)
415 415
 			);
416 416
 		}
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @return mixed depending on the input's type and its normalization strategy
428 428
 	 * @throws \EE_Error
429 429
 	 */
430
-	public function get_input_value($name){
430
+	public function get_input_value($name) {
431 431
 		$input = $this->get_input($name);
432 432
 		return $input->normalized_value();
433 433
 	}
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @return boolean
441 441
 	 */
442 442
 	public function is_valid() {
443
-		if( ! $this->has_received_submission()){
443
+		if ( ! $this->has_received_submission()) {
444 444
 			throw new EE_Error(
445 445
 				sprintf(
446 446
 					__(
@@ -450,16 +450,16 @@  discard block
 block discarded – undo
450 450
 				)
451 451
 			);
452 452
 		}
453
-		if( ! parent::is_valid() ) {
453
+		if ( ! parent::is_valid()) {
454 454
 			return false;
455 455
 		}
456 456
 		// ok so no general errors to this entire form section.
457 457
 		// so let's check the subsections, but only set errors if that hasn't been done yet
458 458
 		$set_submission_errors = $this->submission_error_message() === '' ? true : false;
459
-		foreach( $this->get_validatable_subsections() as $subsection ){
460
-			if( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '' ){
461
-				if ( $set_submission_errors ) {
462
-					$this->set_submission_error_message( $subsection->get_validation_error_string() );
459
+		foreach ($this->get_validatable_subsections() as $subsection) {
460
+			if ( ! $subsection->is_valid() || $subsection->get_validation_error_string() !== '') {
461
+				if ($set_submission_errors) {
462
+					$this->set_submission_error_message($subsection->get_validation_error_string());
463 463
 				}
464 464
 				return false;
465 465
 			}
@@ -473,11 +473,11 @@  discard block
 block discarded – undo
473 473
 	 * gets teh default name of this form section if none is specified
474 474
 	 * @return string
475 475
 	 */
476
-	protected function _set_default_name_if_empty(){
477
-		if( ! $this->_name ){
476
+	protected function _set_default_name_if_empty() {
477
+		if ( ! $this->_name) {
478 478
 			$classname = get_class($this);
479 479
 			$default_name = str_replace("EE_", "", $classname);
480
-			$this->_name =  $default_name;
480
+			$this->_name = $default_name;
481 481
 		}
482 482
 	}
483 483
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	 *             and get_html when you are about to display the form.
494 494
 	 * @throws \EE_Error
495 495
 	 */
496
-	public function get_html_and_js(){
496
+	public function get_html_and_js() {
497 497
 		//no doing_it_wrong yet because we ourselves are still doing it wrong...
498 498
 		//and theoretically this CAN be used properly, provided its used during "wp_enqueue_scripts"
499 499
 		$this->enqueue_js();
@@ -508,9 +508,9 @@  discard block
 block discarded – undo
508 508
 	 * @param bool $display_previously_submitted_data
509 509
 	 * @return string
510 510
 	 */
511
-	public function get_html( $display_previously_submitted_data = true ){
511
+	public function get_html($display_previously_submitted_data = true) {
512 512
 		$this->ensure_construct_finalized_called();
513
-		if ( $display_previously_submitted_data ) {
513
+		if ($display_previously_submitted_data) {
514 514
 			$this->populate_from_session();
515 515
 		}
516 516
 		return $this->_layout_strategy->layout_form();
@@ -524,9 +524,9 @@  discard block
 block discarded – undo
524 524
 	 * @return string
525 525
 	 * @throws \EE_Error
526 526
 	 */
527
-	public function enqueue_js(){
527
+	public function enqueue_js() {
528 528
 		$this->_enqueue_and_localize_form_js();
529
-		foreach( $this->subsections() as $subsection ) {
529
+		foreach ($this->subsections() as $subsection) {
530 530
 			$subsection->enqueue_js();
531 531
 		}
532 532
 	}
@@ -545,19 +545,19 @@  discard block
 block discarded – undo
545 545
 	 *                                                    to be triggered automatically or not
546 546
 	 * @return void
547 547
 	 */
548
-	public static function wp_enqueue_scripts( $init_form_validation_automatically = true ){
549
-		add_filter( 'FHEE_load_jquery_validate', '__return_true' );
548
+	public static function wp_enqueue_scripts($init_form_validation_automatically = true) {
549
+		add_filter('FHEE_load_jquery_validate', '__return_true');
550 550
 		wp_register_script(
551 551
 			'ee_form_section_validation',
552
-			EE_GLOBAL_ASSETS_URL . 'scripts' . DS . 'form_section_validation.js',
553
-			array( 'jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods' ),
552
+			EE_GLOBAL_ASSETS_URL.'scripts'.DS.'form_section_validation.js',
553
+			array('jquery-validate', 'jquery-ui-datepicker', 'jquery-validate-extra-methods'),
554 554
 			EVENT_ESPRESSO_VERSION,
555 555
 			true
556 556
 		);
557 557
 		wp_localize_script(
558 558
 			'ee_form_section_validation',
559 559
 			'ee_form_section_validation_init',
560
-			array( 'init' => $init_form_validation_automatically ? true : false )
560
+			array('init' => $init_form_validation_automatically ? true : false)
561 561
 		);
562 562
 	}
563 563
 
@@ -570,14 +570,14 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @throws \EE_Error
572 572
 	 */
573
-	public function _enqueue_and_localize_form_js(){
573
+	public function _enqueue_and_localize_form_js() {
574 574
 		$this->ensure_construct_finalized_called();
575 575
 		//actually, we don't want to localize just yet. There may be other forms on the page.
576 576
 		//so we need to add our form section data to a static variable accessible by all form sections
577 577
 		//and localize it just before the footer
578 578
 		$this->localize_validation_rules();
579
-		add_action( 'wp_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ), 2 );
580
-		add_action( 'admin_footer', array( 'EE_Form_Section_Proper', 'localize_script_for_all_forms' ) );
579
+		add_action('wp_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'), 2);
580
+		add_action('admin_footer', array('EE_Form_Section_Proper', 'localize_script_for_all_forms'));
581 581
 	}
582 582
 
583 583
 
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 	 * @return void
590 590
 	 * @throws \EE_Error
591 591
 	 */
592
-	public function localize_validation_rules( $return_for_subsection = FALSE ){
592
+	public function localize_validation_rules($return_for_subsection = FALSE) {
593 593
 		// we only want to localize vars ONCE for the entire form,
594 594
 		// so if the form section doesn't have a parent, then it must be the top dog
595
-		if ( $return_for_subsection || ! $this->parent_section() ) {
596
-			EE_Form_Section_Proper::$_js_localization['form_data'][ $this->html_id() ] = array(
597
-				'form_section_id'=> $this->html_id( TRUE ),
595
+		if ($return_for_subsection || ! $this->parent_section()) {
596
+			EE_Form_Section_Proper::$_js_localization['form_data'][$this->html_id()] = array(
597
+				'form_section_id'=> $this->html_id(TRUE),
598 598
 				'validation_rules'=> $this->get_jquery_validation_rules(),
599 599
 				'other_data' => $this->get_other_js_data(),
600 600
 				'errors'=> $this->subsection_validation_errors_by_html_name()
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
 	 * @param array $form_other_js_data
611 611
 	 * @return array
612 612
 	 */
613
-	public function get_other_js_data( $form_other_js_data = array() ) {
614
-		foreach( $this->subsections() as $subsection ) {
615
-			$form_other_js_data = $subsection->get_other_js_data( $form_other_js_data );
613
+	public function get_other_js_data($form_other_js_data = array()) {
614
+		foreach ($this->subsections() as $subsection) {
615
+			$form_other_js_data = $subsection->get_other_js_data($form_other_js_data);
616 616
 		}
617 617
 		return $form_other_js_data;
618 618
 	}
@@ -623,12 +623,12 @@  discard block
 block discarded – undo
623 623
 	 * Keys are their form names, and values are the inputs themselves
624 624
 	 * @return EE_Form_Input_Base
625 625
 	 */
626
-	public function inputs_in_subsections(){
626
+	public function inputs_in_subsections() {
627 627
 		$inputs = array();
628
-		foreach($this->subsections() as $subsection){
629
-			if( $subsection instanceof EE_Form_Input_Base ){
630
-				$inputs[ $subsection->html_name() ] = $subsection;
631
-			}elseif($subsection instanceof EE_Form_Section_Proper ){
628
+		foreach ($this->subsections() as $subsection) {
629
+			if ($subsection instanceof EE_Form_Input_Base) {
630
+				$inputs[$subsection->html_name()] = $subsection;
631
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
632 632
 				$inputs += $subsection->inputs_in_subsections();
633 633
 			}
634 634
 		}
@@ -641,12 +641,12 @@  discard block
 block discarded – undo
641 641
 	 * and values are a string of all their validation errors
642 642
 	 * @return string[]
643 643
 	 */
644
-	public function subsection_validation_errors_by_html_name(){
644
+	public function subsection_validation_errors_by_html_name() {
645 645
 		$inputs = $this->inputs();
646 646
 		$errors = array();
647
-		foreach( $inputs as $form_input ){
648
-			if ( $form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors() ){
649
-				$errors[ $form_input->html_name() ] = $form_input->get_validation_error_string();
647
+		foreach ($inputs as $form_input) {
648
+			if ($form_input instanceof EE_Form_Input_Base && $form_input->get_validation_errors()) {
649
+				$errors[$form_input->html_name()] = $form_input->get_validation_error_string();
650 650
 			}
651 651
 		}
652 652
 		return $errors;
@@ -658,15 +658,15 @@  discard block
 block discarded – undo
658 658
 	 * passes all the form data required by the JS to the JS, and enqueues the few required JS files.
659 659
 	 * Should be setup by each form during the _enqueues_and_localize_form_js
660 660
 	 */
661
-	public static function localize_script_for_all_forms(){
661
+	public static function localize_script_for_all_forms() {
662 662
 		//allow inputs and stuff to hook in their JS and stuff here
663
-		do_action( 'AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin' );
663
+		do_action('AHEE__EE_Form_Section_Proper__localize_script_for_all_forms__begin');
664 664
 		EE_Form_Section_Proper::$_js_localization['localized_error_messages'] = EE_Form_Section_Proper::_get_localized_error_messages();
665
-		$email_validation_level = isset( EE_Registry::instance()->CFG->registration->email_validation_level )
665
+		$email_validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
666 666
 			? EE_Registry::instance()->CFG->registration->email_validation_level
667 667
 			: 'wp_default';
668 668
 		EE_Form_Section_Proper::$_js_localization['email_validation_level'] = $email_validation_level;
669
-		wp_enqueue_script( 'ee_form_section_validation' );
669
+		wp_enqueue_script('ee_form_section_validation');
670 670
 		wp_localize_script(
671 671
 			'ee_form_section_validation',
672 672
 			'ee_form_section_vars',
@@ -679,8 +679,8 @@  discard block
 block discarded – undo
679 679
 	/**
680 680
 	 * ensure_scripts_localized
681 681
 	 */
682
-	public function ensure_scripts_localized(){
683
-		if ( ! EE_Form_Section_Proper::$_scripts_localized ) {
682
+	public function ensure_scripts_localized() {
683
+		if ( ! EE_Form_Section_Proper::$_scripts_localized) {
684 684
 			$this->_enqueue_and_localize_form_js();
685 685
 		}
686 686
 	}
@@ -692,10 +692,10 @@  discard block
 block discarded – undo
692 692
 	 * is that the key here should be the same as the custom validation rule put in the JS file
693 693
 	 * @return array keys are custom validation rules, and values are internationalized strings
694 694
 	 */
695
-	private static function _get_localized_error_messages(){
695
+	private static function _get_localized_error_messages() {
696 696
 		return array(
697 697
 			'validUrl'=>  __("This is not a valid absolute URL. Eg, http://domain.com/monkey.jpg", "event_espresso"),
698
-			'regex' => __( 'Please check your input', 'event_espresso' ),
698
+			'regex' => __('Please check your input', 'event_espresso'),
699 699
 		);
700 700
 	}
701 701
 
@@ -725,9 +725,9 @@  discard block
 block discarded – undo
725 725
 	 *
726 726
 	 * @return array
727 727
 	 */
728
-	public function get_jquery_validation_rules(){
728
+	public function get_jquery_validation_rules() {
729 729
 		$jquery_validation_rules = array();
730
-		foreach($this->get_validatable_subsections() as $subsection){
730
+		foreach ($this->get_validatable_subsections() as $subsection) {
731 731
 			$jquery_validation_rules = array_merge(
732 732
 				$jquery_validation_rules,
733 733
 				$subsection->get_jquery_validation_rules()
@@ -744,14 +744,14 @@  discard block
 block discarded – undo
744 744
 	 * @param array $req_data like $_POST
745 745
 	 * @return void
746 746
 	 */
747
-	protected function _normalize( $req_data ) {
747
+	protected function _normalize($req_data) {
748 748
 		$this->_received_submission = true;
749 749
 		$this->_validation_errors = array();
750
-		foreach ( $this->get_validatable_subsections() as $subsection ) {
750
+		foreach ($this->get_validatable_subsections() as $subsection) {
751 751
 			try {
752
-				$subsection->_normalize( $req_data );
753
-			} catch ( EE_Validation_Error $e ) {
754
-				$subsection->add_validation_error( $e );
752
+				$subsection->_normalize($req_data);
753
+			} catch (EE_Validation_Error $e) {
754
+				$subsection->add_validation_error($e);
755 755
 			}
756 756
 		}
757 757
 	}
@@ -768,9 +768,9 @@  discard block
 block discarded – undo
768 768
 	 * calling parent::_validate() first.
769 769
 	 */
770 770
 	protected function _validate() {
771
-		foreach($this->get_validatable_subsections() as $subsection_name => $subsection){
772
-			if(method_exists($this,'_validate_'.$subsection_name)){
773
-				call_user_func_array(array($this,'_validate_'.$subsection_name), array($subsection));
771
+		foreach ($this->get_validatable_subsections() as $subsection_name => $subsection) {
772
+			if (method_exists($this, '_validate_'.$subsection_name)) {
773
+				call_user_func_array(array($this, '_validate_'.$subsection_name), array($subsection));
774 774
 			}
775 775
 			$subsection->_validate();
776 776
 		}
@@ -782,13 +782,13 @@  discard block
 block discarded – undo
782 782
 	 * Gets all the validated inputs for the form section
783 783
 	 * @return array
784 784
 	 */
785
-	public function valid_data(){
785
+	public function valid_data() {
786 786
 		$inputs = array();
787
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
788
-			if ( $subsection instanceof EE_Form_Section_Proper ) {
789
-				$inputs[ $subsection_name ] = $subsection->valid_data();
790
-			} else if ( $subsection instanceof EE_Form_Input_Base ){
791
-				$inputs[ $subsection_name ] = $subsection->normalized_value();
787
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
788
+			if ($subsection instanceof EE_Form_Section_Proper) {
789
+				$inputs[$subsection_name] = $subsection->valid_data();
790
+			} else if ($subsection instanceof EE_Form_Input_Base) {
791
+				$inputs[$subsection_name] = $subsection->normalized_value();
792 792
 			}
793 793
 		}
794 794
 		return $inputs;
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
 	 * Gets all the inputs on this form section
801 801
 	 * @return EE_Form_Input_Base[]
802 802
 	 */
803
-	public function inputs(){
803
+	public function inputs() {
804 804
 		$inputs = array();
805
-		foreach( $this->subsections() as $subsection_name =>$subsection ){
806
-			if ( $subsection instanceof EE_Form_Input_Base ){
807
-				$inputs[ $subsection_name ] = $subsection;
805
+		foreach ($this->subsections() as $subsection_name =>$subsection) {
806
+			if ($subsection instanceof EE_Form_Input_Base) {
807
+				$inputs[$subsection_name] = $subsection;
808 808
 			}
809 809
 		}
810 810
 		return $inputs;
@@ -816,10 +816,10 @@  discard block
 block discarded – undo
816 816
 	 * Gets all the subsections which are a proper form
817 817
 	 * @return EE_Form_Section_Proper[]
818 818
 	 */
819
-	public function subforms(){
819
+	public function subforms() {
820 820
 		$form_sections = array();
821
-		foreach($this->subsections() as $name=>$obj){
822
-			if($obj instanceof EE_Form_Section_Proper){
821
+		foreach ($this->subsections() as $name=>$obj) {
822
+			if ($obj instanceof EE_Form_Section_Proper) {
823 823
 				$form_sections[$name] = $obj;
824 824
 			}
825 825
 		}
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 	 * if you only want form inputs or proper form sections.
835 835
 	 * @return EE_Form_Section_Proper[]
836 836
 	 */
837
-	public function subsections(){
837
+	public function subsections() {
838 838
 		$this->ensure_construct_finalized_called();
839 839
 		return $this->_subsections;
840 840
 	}
@@ -856,8 +856,8 @@  discard block
 block discarded – undo
856 856
 	 *                                        where keys are always subsection names and values are either
857 857
 	 *                                        the input's normalized value, or an array like the top-level array
858 858
 	 */
859
-	public function input_values( $include_subform_inputs = false, $flatten = false ){
860
-		return $this->_input_values( false, $include_subform_inputs, $flatten );
859
+	public function input_values($include_subform_inputs = false, $flatten = false) {
860
+		return $this->_input_values(false, $include_subform_inputs, $flatten);
861 861
 	}
862 862
 
863 863
 	/**
@@ -877,8 +877,8 @@  discard block
 block discarded – undo
877 877
 	 *                                        where keys are always subsection names and values are either
878 878
 	 *                                        the input's normalized value, or an array like the top-level array
879 879
 	 */
880
-	public function input_pretty_values(  $include_subform_inputs = false, $flatten = false ){
881
-		return $this->_input_values( true, $include_subform_inputs, $flatten );
880
+	public function input_pretty_values($include_subform_inputs = false, $flatten = false) {
881
+		return $this->_input_values(true, $include_subform_inputs, $flatten);
882 882
 	}
883 883
 
884 884
 	/**
@@ -896,19 +896,19 @@  discard block
 block discarded – undo
896 896
 	 *                                        where keys are always subsection names and values are either
897 897
 	 *                                        the input's normalized value, or an array like the top-level array
898 898
 	 */
899
-	public function _input_values( $pretty = false, $include_subform_inputs = false, $flatten = false ) {
899
+	public function _input_values($pretty = false, $include_subform_inputs = false, $flatten = false) {
900 900
 		$input_values = array();
901
-		foreach( $this->subsections() as $subsection_name => $subsection ) {
902
-			if( $subsection instanceof EE_Form_Input_Base ) {
903
-				$input_values[ $subsection_name ] = $pretty
901
+		foreach ($this->subsections() as $subsection_name => $subsection) {
902
+			if ($subsection instanceof EE_Form_Input_Base) {
903
+				$input_values[$subsection_name] = $pretty
904 904
 					? $subsection->pretty_value()
905 905
 					: $subsection->normalized_value();
906
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subform_inputs ) {
907
-				$subform_input_values = $subsection->_input_values( $pretty, $include_subform_inputs, $flatten );
908
-				if( $flatten ) {
909
-					$input_values = array_merge( $input_values, $subform_input_values );
906
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subform_inputs) {
907
+				$subform_input_values = $subsection->_input_values($pretty, $include_subform_inputs, $flatten);
908
+				if ($flatten) {
909
+					$input_values = array_merge($input_values, $subform_input_values);
910 910
 				} else {
911
-					$input_values[ $subsection_name ] = $subform_input_values;
911
+					$input_values[$subsection_name] = $subform_input_values;
912 912
 				}
913 913
 			}
914 914
 		}
@@ -929,23 +929,23 @@  discard block
 block discarded – undo
929 929
 	 *                                   where keys are always subsection names and values are either
930 930
 	 *                                   the input's normalized value, or an array like the top-level array
931 931
 	 */
932
-	public function submitted_values( $include_subforms = false ) {
932
+	public function submitted_values($include_subforms = false) {
933 933
 		$submitted_values = array();
934
-		foreach( $this->subsections() as $subsection ) {
935
-			if( $subsection instanceof EE_Form_Input_Base ) {
934
+		foreach ($this->subsections() as $subsection) {
935
+			if ($subsection instanceof EE_Form_Input_Base) {
936 936
 				// is this input part of an array of inputs?
937
-				if ( strpos( $subsection->html_name(), '[' ) !== false ) {
937
+				if (strpos($subsection->html_name(), '[') !== false) {
938 938
 					$full_input_name = \EEH_Array::convert_array_values_to_keys(
939
-						explode( '[', str_replace( ']', '', $subsection->html_name() ) ),
939
+						explode('[', str_replace(']', '', $subsection->html_name())),
940 940
 						$subsection->raw_value()
941 941
 					);
942
-					$submitted_values = array_replace_recursive( $submitted_values, $full_input_name );
942
+					$submitted_values = array_replace_recursive($submitted_values, $full_input_name);
943 943
 				} else {
944
-					$submitted_values[ $subsection->html_name() ] = $subsection->raw_value();
944
+					$submitted_values[$subsection->html_name()] = $subsection->raw_value();
945 945
 				}
946
-			} else if( $subsection instanceof EE_Form_Section_Proper && $include_subforms ) {
947
-				$subform_input_values = $subsection->submitted_values( $include_subforms );
948
-				$submitted_values = array_replace_recursive( $submitted_values, $subform_input_values );
946
+			} else if ($subsection instanceof EE_Form_Section_Proper && $include_subforms) {
947
+				$subform_input_values = $subsection->submitted_values($include_subforms);
948
+				$submitted_values = array_replace_recursive($submitted_values, $subform_input_values);
949 949
 			}
950 950
 		}
951 951
 		return $submitted_values;
@@ -960,7 +960,7 @@  discard block
 block discarded – undo
960 960
 	 * @return boolean
961 961
 	 * @throws \EE_Error
962 962
 	 */
963
-	public function has_received_submission(){
963
+	public function has_received_submission() {
964 964
 		$this->ensure_construct_finalized_called();
965 965
 		return $this->_received_submission;
966 966
 	}
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
 	 * @param array $inputs_to_exclude values are the input names
974 974
 	 * @return void
975 975
 	 */
976
-	public function exclude($inputs_to_exclude = array()){
977
-		foreach($inputs_to_exclude as $input_to_exclude_name){
976
+	public function exclude($inputs_to_exclude = array()) {
977
+		foreach ($inputs_to_exclude as $input_to_exclude_name) {
978 978
 			unset($this->_subsections[$input_to_exclude_name]);
979 979
 		}
980 980
 	}
@@ -985,8 +985,8 @@  discard block
 block discarded – undo
985 985
 	 * @param array $inputs_to_hide
986 986
 	 * @throws \EE_Error
987 987
 	 */
988
-	public function hide($inputs_to_hide= array()){
989
-		foreach($inputs_to_hide as $input_to_hide){
988
+	public function hide($inputs_to_hide = array()) {
989
+		foreach ($inputs_to_hide as $input_to_hide) {
990 990
 			$input = $this->get_input($input_to_hide);
991 991
 
992 992
 			$input->set_display_strategy(new EE_Hidden_Display_Strategy());
@@ -1016,21 +1016,21 @@  discard block
 block discarded – undo
1016 1016
 	 * @return void
1017 1017
 	 * @throws \EE_Error
1018 1018
 	 */
1019
-	public function add_subsections( $new_subsections, $subsection_name_to_target = NULL, $add_before = true ){
1020
-		foreach( $new_subsections as $subsection_name => $subsection ){
1021
-			if( ! $subsection instanceof EE_Form_Section_Base ){
1019
+	public function add_subsections($new_subsections, $subsection_name_to_target = NULL, $add_before = true) {
1020
+		foreach ($new_subsections as $subsection_name => $subsection) {
1021
+			if ( ! $subsection instanceof EE_Form_Section_Base) {
1022 1022
 				EE_Error::add_error(
1023 1023
 					sprintf(
1024 1024
 						__(
1025 1025
 							"Trying to add a %s as a subsection (it was named '%s') to the form section '%s'. It was removed.",
1026 1026
 							"event_espresso"
1027 1027
 						),
1028
-						get_class( $subsection ),
1028
+						get_class($subsection),
1029 1029
 						$subsection_name,
1030 1030
 						$this->name()
1031 1031
 					)
1032 1032
 				);
1033
-				unset( $new_subsections[ $subsection_name ] );
1033
+				unset($new_subsections[$subsection_name]);
1034 1034
 			}
1035 1035
 		}
1036 1036
 		$this->_subsections = EEH_Array::insert_into_array(
@@ -1041,8 +1041,8 @@  discard block
 block discarded – undo
1041 1041
 		);
1042 1042
 
1043 1043
 
1044
-		if( $this->_construction_finalized ){
1045
-			foreach($this->_subsections as $name => $subsection){
1044
+		if ($this->_construction_finalized) {
1045
+			foreach ($this->_subsections as $name => $subsection) {
1046 1046
 				$subsection->_construct_finalize($this, $name);
1047 1047
 			}
1048 1048
 		}
@@ -1053,8 +1053,8 @@  discard block
 block discarded – undo
1053 1053
 	/**
1054 1054
 	 * Just gets all validatable subsections to clean their sensitive data
1055 1055
 	 */
1056
-	public function clean_sensitive_data(){
1057
-		foreach($this->get_validatable_subsections() as $subsection){
1056
+	public function clean_sensitive_data() {
1057
+		foreach ($this->get_validatable_subsections() as $subsection) {
1058 1058
 			$subsection->clean_sensitive_data();
1059 1059
 		}
1060 1060
 	}
@@ -1064,10 +1064,10 @@  discard block
 block discarded – undo
1064 1064
 	/**
1065 1065
 	 * @param string $form_submission_error_message
1066 1066
 	 */
1067
-	public function set_submission_error_message( $form_submission_error_message = '' ) {
1068
-		$this->_form_submission_error_message .= ! empty( $form_submission_error_message )
1067
+	public function set_submission_error_message($form_submission_error_message = '') {
1068
+		$this->_form_submission_error_message .= ! empty($form_submission_error_message)
1069 1069
 			? $form_submission_error_message
1070
-			: __( 'Form submission failed due to errors', 'event_espresso' );
1070
+			: __('Form submission failed due to errors', 'event_espresso');
1071 1071
 	}
1072 1072
 
1073 1073
 
@@ -1084,10 +1084,10 @@  discard block
 block discarded – undo
1084 1084
 	/**
1085 1085
 	 * @param string $form_submission_success_message
1086 1086
 	 */
1087
-	public function set_submission_success_message( $form_submission_success_message ) {
1088
-		$this->_form_submission_success_message .= ! empty( $form_submission_success_message )
1087
+	public function set_submission_success_message($form_submission_success_message) {
1088
+		$this->_form_submission_success_message .= ! empty($form_submission_success_message)
1089 1089
 			? $form_submission_success_message
1090
-			: __( 'Form submitted successfully', 'event_espresso' );
1090
+			: __('Form submitted successfully', 'event_espresso');
1091 1091
 	}
1092 1092
 
1093 1093
 
@@ -1110,10 +1110,10 @@  discard block
 block discarded – undo
1110 1110
 	 * @return string
1111 1111
 	 * @throws \EE_Error
1112 1112
 	 */
1113
-	public function html_name_prefix(){
1114
-		if( $this->parent_section() instanceof EE_Form_Section_Proper ){
1115
-			return $this->parent_section()->html_name_prefix() . '[' . $this->name() . ']';
1116
-		}else{
1113
+	public function html_name_prefix() {
1114
+		if ($this->parent_section() instanceof EE_Form_Section_Proper) {
1115
+			return $this->parent_section()->html_name_prefix().'['.$this->name().']';
1116
+		} else {
1117 1117
 			return $this->name();
1118 1118
 		}
1119 1119
 	}
@@ -1128,7 +1128,7 @@  discard block
 block discarded – undo
1128 1128
 	 * @return string
1129 1129
 	 * @throws \EE_Error
1130 1130
 	 */
1131
-	public function name(){
1131
+	public function name() {
1132 1132
 		$this->ensure_construct_finalized_called();
1133 1133
 		return parent::name();
1134 1134
 	}
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 	 * @return EE_Form_Section_Proper
1140 1140
 	 * @throws \EE_Error
1141 1141
 	 */
1142
-	public function parent_section(){
1142
+	public function parent_section() {
1143 1143
 		$this->ensure_construct_finalized_called();
1144 1144
 		return parent::parent_section();
1145 1145
 	}
@@ -1152,9 +1152,9 @@  discard block
 block discarded – undo
1152 1152
 	 * @return void
1153 1153
 	 * @throws \EE_Error
1154 1154
 	 */
1155
-	public function ensure_construct_finalized_called(){
1156
-		if( ! $this->_construction_finalized ){
1157
-			$this->_construct_finalize($this->_parent_section, $this->_name );
1155
+	public function ensure_construct_finalized_called() {
1156
+		if ( ! $this->_construction_finalized) {
1157
+			$this->_construct_finalize($this->_parent_section, $this->_name);
1158 1158
 		}
1159 1159
 	}
1160 1160
 
@@ -1166,17 +1166,17 @@  discard block
 block discarded – undo
1166 1166
 	 * @param array $req_data
1167 1167
 	 * @return boolean
1168 1168
 	 */
1169
-	public function form_data_present_in( $req_data = NULL ) {
1170
-		if( $req_data === NULL){
1169
+	public function form_data_present_in($req_data = NULL) {
1170
+		if ($req_data === NULL) {
1171 1171
 			$req_data = $_POST;
1172 1172
 		}
1173
-		foreach( $this->subsections() as $subsection ) {
1174
-			if($subsection instanceof EE_Form_Input_Base ) {
1175
-				if( $subsection->form_data_present_in( $req_data ) ) {
1173
+		foreach ($this->subsections() as $subsection) {
1174
+			if ($subsection instanceof EE_Form_Input_Base) {
1175
+				if ($subsection->form_data_present_in($req_data)) {
1176 1176
 					return TRUE;
1177 1177
 				}
1178
-			}elseif( $subsection instanceof EE_Form_Section_Proper ) {
1179
-				if( $subsection->form_data_present_in( $req_data ) ) {
1178
+			}elseif ($subsection instanceof EE_Form_Section_Proper) {
1179
+				if ($subsection->form_data_present_in($req_data)) {
1180 1180
 					return TRUE;
1181 1181
 				}
1182 1182
 			}
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 	 */
1194 1194
 	public function get_validation_errors_accumulated() {
1195 1195
 		$validation_errors = $this->get_validation_errors();
1196
-		foreach($this->get_validatable_subsections() as $subsection ) {
1197
-			if( $subsection instanceof EE_Form_Section_Proper ) {
1196
+		foreach ($this->get_validatable_subsections() as $subsection) {
1197
+			if ($subsection instanceof EE_Form_Section_Proper) {
1198 1198
 				$validation_errors_on_this_subsection = $subsection->get_validation_errors_accumulated();
1199 1199
 			} else {
1200
-				$validation_errors_on_this_subsection =  $subsection->get_validation_errors();
1200
+				$validation_errors_on_this_subsection = $subsection->get_validation_errors();
1201 1201
 			}
1202
-			if( $validation_errors_on_this_subsection ){
1203
-				$validation_errors = array_merge( $validation_errors, $validation_errors_on_this_subsection );
1202
+			if ($validation_errors_on_this_subsection) {
1203
+				$validation_errors = array_merge($validation_errors, $validation_errors_on_this_subsection);
1204 1204
 			}
1205 1205
 		}
1206 1206
 		return $validation_errors;
@@ -1222,24 +1222,24 @@  discard block
 block discarded – undo
1222 1222
 	 * @param string|false $form_section_path we accept false also because substr( '../', '../' ) = false
1223 1223
 	 * @return EE_Form_Section_Base
1224 1224
 	 */
1225
-	public function find_section_from_path( $form_section_path ) {
1225
+	public function find_section_from_path($form_section_path) {
1226 1226
 		//check if we can find the input from purely going straight up the tree
1227
-		$input = parent::find_section_from_path( $form_section_path );
1228
-		if( $input instanceof EE_Form_Section_Base ) {
1227
+		$input = parent::find_section_from_path($form_section_path);
1228
+		if ($input instanceof EE_Form_Section_Base) {
1229 1229
 			return $input;
1230 1230
 		}
1231 1231
 
1232
-		$next_slash_pos = strpos( $form_section_path, '/' );
1233
-		if( $next_slash_pos !== false ) {
1234
-			$child_section_name = substr( $form_section_path, 0, $next_slash_pos );
1235
-			$subpath = substr( $form_section_path, $next_slash_pos + 1 );
1232
+		$next_slash_pos = strpos($form_section_path, '/');
1233
+		if ($next_slash_pos !== false) {
1234
+			$child_section_name = substr($form_section_path, 0, $next_slash_pos);
1235
+			$subpath = substr($form_section_path, $next_slash_pos + 1);
1236 1236
 		} else {
1237 1237
 			$child_section_name = $form_section_path;
1238 1238
 			$subpath = '';
1239 1239
 		}
1240
-		$child_section =  $this->get_subsection( $child_section_name );
1241
-		if ( $child_section instanceof EE_Form_Section_Base ) {
1242
-			return $child_section->find_section_from_path( $subpath );
1240
+		$child_section = $this->get_subsection($child_section_name);
1241
+		if ($child_section instanceof EE_Form_Section_Base) {
1242
+			return $child_section->find_section_from_path($subpath);
1243 1243
 		} else {
1244 1244
 			return null;
1245 1245
 		}
Please login to merge, or discard this patch.
core/services/commands/CommandHandlerManager.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@
 block discarded – undo
59 59
 	 *      "Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler"
60 60
 	 *      then the following code:
61 61
 	 *
62
-     *      $CommandHandlerManager = EE_Registry::instance()->create( 'CommandHandlerManagerInterface' );
62
+	 *      $CommandHandlerManager = EE_Registry::instance()->create( 'CommandHandlerManagerInterface' );
63 63
 	 *      $CommandHandlerManager->addCommandHandler(
64 64
 	 *          new Vendor\a\totally\different\namespace\for\DoSomethingCommandHandler(),
65 65
 	 *          'Vendor\some\namespace\DoSomethingCommand'
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\commands;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *
38 38
 	 * @param \EE_Registry $registry
39 39
 	 */
40
-	public function __construct( \EE_Registry $registry ) {
40
+	public function __construct(\EE_Registry $registry) {
41 41
 		$this->registry = $registry;
42 42
 	}
43 43
 
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 	 * @param string $fqcn_for_command Fully Qualified ClassName for Command
72 72
 	 * @return mixed
73 73
 	 */
74
-	public function addCommandHandler( CommandHandlerInterface $command_handler, $fqcn_for_command = '' )
74
+	public function addCommandHandler(CommandHandlerInterface $command_handler, $fqcn_for_command = '')
75 75
 	{
76
-		$command = ! empty( $fqcn_for_command )
76
+		$command = ! empty($fqcn_for_command)
77 77
 			? $fqcn_for_command
78
-			: str_replace( 'CommandHandler', 'Command', get_class( $command_handler ) );
79
-		if ( empty( $command ) ) {
80
-			throw new InvalidCommandHandlerException( $command );
78
+			: str_replace('CommandHandler', 'Command', get_class($command_handler));
79
+		if (empty($command)) {
80
+			throw new InvalidCommandHandlerException($command);
81 81
 		}
82
-		$this->commandHandlers[ $command ] = $command_handler;
82
+		$this->commandHandlers[$command] = $command_handler;
83 83
 	}
84 84
 
85 85
 
@@ -88,18 +88,18 @@  discard block
 block discarded – undo
88 88
 	 * @param \EventEspresso\core\services\commands\CommandInterface $command
89 89
 	 * @return mixed
90 90
 	 */
91
-	public function getCommandHandler( CommandInterface $command )
91
+	public function getCommandHandler(CommandInterface $command)
92 92
 	{
93
-		$command_name = get_class( $command );
94
-		$command_handler = str_replace( 'Command', 'CommandHandler', $command_name );
93
+		$command_name = get_class($command);
94
+		$command_handler = str_replace('Command', 'CommandHandler', $command_name);
95 95
 		// has a command handler already been set for this class ?
96 96
 		// if not, can we find one via the FQCN ?
97
-		if ( isset( $this->commandHandlers[ $command_name ] ) ) {
98
-			return $this->commandHandlers[ $command_name ];
99
-		} else if ( class_exists( $command_handler ) ) {
100
-			return $this->registry->create( $command_handler );
97
+		if (isset($this->commandHandlers[$command_name])) {
98
+			return $this->commandHandlers[$command_name];
99
+		} else if (class_exists($command_handler)) {
100
+			return $this->registry->create($command_handler);
101 101
 		}
102
-		throw new CommandHandlerNotFoundException( $command_handler );
102
+		throw new CommandHandlerNotFoundException($command_handler);
103 103
 	}
104 104
 
105 105
 
Please login to merge, or discard this patch.
admin_pages/support/Support_Admin_Page.core.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Support_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
 				'nav' => array(
85 85
 					'label' => __('Shortcodes', 'event_espresso'),
86 86
 					'order' => 30),
87
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_shortcodes_boxes' ) ),
87
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_shortcodes_boxes')),
88 88
 				'require_nonce' => FALSE
89 89
 				),
90 90
 			'contact_support' => array(
91 91
 				'nav' => array(
92 92
 					'label' => __('Support', 'event_espresso'),
93 93
 					'order' => 40),
94
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_support_boxes' ) ),
94
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_support_boxes')),
95 95
 				'require_nonce' => FALSE
96 96
 				),
97 97
 			'developers' => array(
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
 
120 120
 
121 121
 	protected function _installation() {
122
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_installation.template.php';
123
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
122
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_installation.template.php';
123
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
124 124
 		$this->display_admin_page_with_sidebar();
125 125
 	}
126 126
 
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 			'other_resources' => __('Other Resources', 'event_espresso')
146 146
 			);
147 147
 
148
-		foreach ( $boxes as $box => $label ) {
149
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
148
+		foreach ($boxes as $box => $label) {
149
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
150 150
 			$callback_args = array('template_path' => $template_path);
151
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
151
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
152 152
 		}
153 153
 	}
154 154
 
@@ -169,15 +169,15 @@  discard block
 block discarded – undo
169 169
 			'shortcodes_event_listings' => __('Event Listings', 'event_espresso'),
170 170
 			'shortcodes_ticket_selector' => __('Event Ticket Selector', 'event_espresso'),
171 171
 			'shortcodes_category' => __('Event Categories', 'event_espresso'),
172
-			'shortcodes_attendee' => __( 'Event Attendees', 'event_espresso' )
172
+			'shortcodes_attendee' => __('Event Attendees', 'event_espresso')
173 173
 			/*'shortcodes_single_events' => __('Single Events', 'event_espresso'),*/
174 174
 			/*'shortcodes_attendee_listings' => __('Attendee Listings', 'event_espresso'),*/
175 175
 			);
176 176
 
177
-		foreach ( $boxes as $box => $label ) {
178
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
177
+		foreach ($boxes as $box => $label) {
178
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
179 179
 			$callback_args = array('template_path' => $template_path);
180
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
180
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
181 181
 		}
182 182
 	}
183 183
 
@@ -196,17 +196,17 @@  discard block
 block discarded – undo
196 196
 			'important_information' => __('Important Information', 'event_espresso')
197 197
 			);
198 198
 
199
-		foreach ( $boxes as $box => $label ) {
200
-			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'support_admin_details_' . $box . '.template.php';
199
+		foreach ($boxes as $box => $label) {
200
+			$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'support_admin_details_'.$box.'.template.php';
201 201
 			$callback_args = array('template_path' => $template_path, 'template_args' => $this->_template_args);
202
-			add_meta_box( 'espresso_' . $box . '_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
202
+			add_meta_box('espresso_'.$box.'_settings', $label, create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], $metabox["args"]["template_args"], TRUE );'), $this->_current_screen->id, 'normal', 'high', $callback_args);
203 203
 		}
204 204
 	}
205 205
 
206 206
 
207 207
 	protected function _developers() {
208
-		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH . 'developers_admin_details.template.php';
209
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true );
208
+		$template_path = EE_SUPPORT_ADMIN_TEMPLATE_PATH.'developers_admin_details.template.php';
209
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, array(), true);
210 210
 		$this->display_admin_page_with_sidebar();
211 211
 	}
212 212
 } //end Support_Admin_Page class
Please login to merge, or discard this patch.
caffeinated/admin/extend/support/Extend_Support_Admin_Page.core.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
29 29
  */
30 30
 class Extend_Support_Admin_Page extends Support_Admin_Page {
31 31
 
32
-	public function __construct( $routing = TRUE ) {
33
-		parent::__construct( $routing );
34
-		define( 'EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'support/templates/' );
32
+	public function __construct($routing = TRUE) {
33
+		parent::__construct($routing);
34
+		define('EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'support/templates/');
35 35
 	}
36 36
 
37 37
 
38 38
 
39 39
 
40 40
 	protected function _extend_page_config() {
41
-		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'support';
41
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'support';
42 42
 		//new routes and new configs (or overrides )
43 43
 		$new_page_routes = array(
44 44
 			'faq' => array(
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 				'capability' => 'ee_read_ee'
47 47
 				)
48 48
 			);
49
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
49
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
50 50
 
51 51
 		$new_page_config = array(
52 52
 			'faq' => array(
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				'require_nonce' => FALSE
58 58
 				)
59 59
 			);
60
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
60
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
61 61
 
62 62
 		$this->_page_config['default']['metaboxes'][] = '_installation_boxes';
63 63
 	}
@@ -66,8 +66,8 @@  discard block
 block discarded – undo
66 66
 
67 67
 
68 68
 	protected function _faq() {
69
-		$template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_faq.template.php';
70
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( $template_path, '', TRUE);
69
+		$template_path = EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_faq.template.php';
70
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($template_path, '', TRUE);
71 71
 		$this->display_admin_page_with_sidebar();
72 72
 
73 73
 	}
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 
76 76
 
77 77
 	protected function _installation_boxes() {
78
-		$callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH . 'support_admin_details_additional_information.template.php');
79
-		add_meta_box( 'espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);' ), $this->_current_screen->id, 'normal', 'high', $callback_args);
78
+		$callback_args = array('template_path' => EE_SUPPORT_CAF_ADMIN_TEMPLATE_PATH.'support_admin_details_additional_information.template.php');
79
+		add_meta_box('espresso_additional_information_support', __('Additional Information', 'event_espresso'), create_function('$post, $metabox', 'echo EEH_Template::display_template( $metabox["args"]["template_path"], "", TRUE);'), $this->_current_screen->id, 'normal', 'high', $callback_args);
80 80
 	}
81 81
 
82 82
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Processor.lib.php 1 patch
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 *
36 36
 	 * @param EE_Message_Resource_Manager $message_resource_manager
37 37
 	 */
38
-	public function __construct( EE_Message_Resource_Manager $message_resource_manager ) {
38
+	public function __construct(EE_Message_Resource_Manager $message_resource_manager) {
39 39
 		$this->_message_resource_manager = $message_resource_manager;
40 40
 		$this->_init_queue_and_generator();
41 41
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * - $_generator = holds the messages generator
51 51
 	 */
52 52
 	protected function _init_queue_and_generator() {
53
-		$this->_generator = EE_Registry::factory( 'EE_Messages_Generator' );
53
+		$this->_generator = EE_Registry::factory('EE_Messages_Generator');
54 54
 		$this->_queue = $this->_generator->generation_queue();
55 55
 	}
56 56
 
@@ -75,31 +75,31 @@  discard block
 block discarded – undo
75 75
 	 * @param EE_Messages_Queue $queue_to_process
76 76
 	 * @return bool  true for success false for error.
77 77
 	 */
78
-	public function process_immediately_from_queue( EE_Messages_Queue $queue_to_process ) {
78
+	public function process_immediately_from_queue(EE_Messages_Queue $queue_to_process) {
79 79
 		$success = false;
80 80
 		$messages_to_send = array();
81 81
 		$messages_to_generate = array();
82 82
 		//loop through and setup the various messages from the queue so we know what is being processed
83 83
 		$queue_to_process->get_message_repository()->rewind();
84
-		foreach ( $queue_to_process->get_message_repository() as $message ) {
85
-			if ( $message->STS_ID() === EEM_Message::status_incomplete ) {
84
+		foreach ($queue_to_process->get_message_repository() as $message) {
85
+			if ($message->STS_ID() === EEM_Message::status_incomplete) {
86 86
 				$messages_to_generate[] = $message;
87 87
 				continue;
88 88
 			}
89 89
 
90
-			if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) {
90
+			if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) {
91 91
 				$messages_to_send[] = $message;
92 92
 				continue;
93 93
 			}
94 94
 		}
95 95
 
96 96
 		//do generation/sends
97
-		if ( $messages_to_generate ) {
98
-			$success = $this->batch_generate_from_queue( $messages_to_generate, true );
97
+		if ($messages_to_generate) {
98
+			$success = $this->batch_generate_from_queue($messages_to_generate, true);
99 99
 		}
100 100
 
101
-		if ( $messages_to_send ) {
102
-			$sent = $this->batch_send_from_queue( $messages_to_send, true );
101
+		if ($messages_to_send) {
102
+			$sent = $this->batch_send_from_queue($messages_to_send, true);
103 103
 			//if there was messages to generate and it failed, then we override any success value for the sending process
104 104
 			//otherwise we just use the return from batch send.  The intent is that there is a simple response for success/fail.
105 105
 			//Either everything was successful or we consider it a fail.  To be clear, this is a limitation of doing
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 * @return bool|EE_Messages_Queue return false if nothing generated.  This returns a new EE_Message_Queue with
120 120
 	 *                                   generated messages.
121 121
 	 */
122
-	public function batch_generate_from_queue( $messages = array(), $clear_queue = false ) {
123
-		if ( $this->_build_queue_for_generation( $messages, $clear_queue ) ) {
122
+	public function batch_generate_from_queue($messages = array(), $clear_queue = false) {
123
+		if ($this->_build_queue_for_generation($messages, $clear_queue)) {
124 124
 			$new_queue = $this->_generator->generate();
125
-			if ( $new_queue instanceof EE_Messages_Queue ) {
125
+			if ($new_queue instanceof EE_Messages_Queue) {
126 126
 				//unlock queue
127 127
 				$this->_queue->unlock_queue();
128
-				$new_queue->initiate_request_by_priority( 'send' );
128
+				$new_queue->initiate_request_by_priority('send');
129 129
 				return $new_queue;
130 130
 			}
131 131
 		}
@@ -146,24 +146,24 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @return bool true means queue prepped, false means there was a lock so no generation please.
148 148
 	 */
149
-	protected function _build_queue_for_generation( $messages = array(), $clear_queue = false ) {
149
+	protected function _build_queue_for_generation($messages = array(), $clear_queue = false) {
150 150
 
151
-		if ( $clear_queue ) {
151
+		if ($clear_queue) {
152 152
 			$this->_init_queue_and_generator();
153 153
 		}
154 154
 
155
-		if ( $messages ) {
155
+		if ($messages) {
156 156
 			//if generation is locked then get out now because that means processing is already happening.
157
-			if ( $this->_queue->is_locked() ) {
157
+			if ($this->_queue->is_locked()) {
158 158
 				return false;
159 159
 			}
160 160
 
161 161
 			$this->_queue->lock_queue();
162
-			$messages = is_array( $messages ) ? $messages : array( $messages );
163
-			foreach ( $messages as $message ) {
164
-				if ( $message instanceof EE_Message ) {
162
+			$messages = is_array($messages) ? $messages : array($messages);
163
+			foreach ($messages as $message) {
164
+				if ($message instanceof EE_Message) {
165 165
 					$data = $message->all_extra_meta_array();
166
-					$this->_queue->add( $message, $data );
166
+					$this->_queue->add($message, $data);
167 167
 				}
168 168
 			}
169 169
 			return true;
@@ -181,22 +181,22 @@  discard block
 block discarded – undo
181 181
 	 *
182 182
 	 * @return bool true means queue prepped, false means there was a lock so no queue prepped.
183 183
 	 */
184
-	protected function _build_queue_for_sending( $messages, $clear_queue = false ) {
184
+	protected function _build_queue_for_sending($messages, $clear_queue = false) {
185 185
 		//if sending is locked then get out now because that means processing is already happening.
186
-		if ( $this->_queue->is_locked( EE_Messages_Queue::action_sending ) ) {
186
+		if ($this->_queue->is_locked(EE_Messages_Queue::action_sending)) {
187 187
 			return false;
188 188
 		}
189 189
 
190
-		$this->_queue->lock_queue( EE_Messages_Queue::action_sending );
190
+		$this->_queue->lock_queue(EE_Messages_Queue::action_sending);
191 191
 
192
-		if ( $clear_queue ) {
192
+		if ($clear_queue) {
193 193
 			$this->_init_queue_and_generator();
194 194
 		}
195 195
 
196
-		$messages = is_array( $messages ) ? $messages : array( $messages );
196
+		$messages = is_array($messages) ? $messages : array($messages);
197 197
 
198
-		foreach ( $messages as $message ) {
199
-			$this->_queue->add( $message );
198
+		foreach ($messages as $message) {
199
+			$this->_queue->add($message);
200 200
 		}
201 201
 		return true;
202 202
 	}
@@ -212,11 +212,11 @@  discard block
 block discarded – undo
212 212
 	 *
213 213
 	 * @return EE_Messages_Queue
214 214
 	 */
215
-	public function batch_send_from_queue( $messages = array(), $clear_queue = false ) {
215
+	public function batch_send_from_queue($messages = array(), $clear_queue = false) {
216 216
 
217
-		if ( $messages && $this->_build_queue_for_sending( $messages, $clear_queue ) ) {
217
+		if ($messages && $this->_build_queue_for_sending($messages, $clear_queue)) {
218 218
 			$this->_queue->execute();
219
-			$this->_queue->unlock_queue( EE_Messages_Queue::action_sending );
219
+			$this->_queue->unlock_queue(EE_Messages_Queue::action_sending);
220 220
 		} else {
221 221
 			//get messages to send and execute.
222 222
 			$this->_queue->get_to_send_batch_and_send();
@@ -239,10 +239,10 @@  discard block
 block discarded – undo
239 239
 	 * @param EE_Message_To_Generate[] $messages_to_generate
240 240
 	 * @return EE_Messages_Queue
241 241
 	 */
242
-	public function generate_and_return(  $messages_to_generate ) {
242
+	public function generate_and_return($messages_to_generate) {
243 243
 		$this->_init_queue_and_generator();
244
-		$this->_queue_for_generation_loop( $messages_to_generate );
245
-		return $this->_generator->generate( false );
244
+		$this->_queue_for_generation_loop($messages_to_generate);
245
+		return $this->_generator->generate(false);
246 246
 	}
247 247
 
248 248
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 * @param  bool     $persist    Indicate whether to instruct the generator to persist the generated queue (true) or not (false).
254 254
 	 * @return EE_Messages_Queue
255 255
 	 */
256
-	public function generate_queue( $persist = true ) {
257
-		return $this->_generator->generate( $persist );
256
+	public function generate_queue($persist = true) {
257
+		return $this->_generator->generate($persist);
258 258
 	}
259 259
 
260 260
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 	 * @param bool                   $test_send             Whether this item is for a test send or not.
268 268
 	 * @return  EE_Messages_Queue
269 269
 	 */
270
-	public function queue_for_generation( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
271
-		if ( $message_to_generate->valid() ) {
272
-			$this->_generator->create_and_add_message_to_queue( $message_to_generate, $test_send );
270
+	public function queue_for_generation(EE_Message_To_Generate $message_to_generate, $test_send = false) {
271
+		if ($message_to_generate->valid()) {
272
+			$this->_generator->create_and_add_message_to_queue($message_to_generate, $test_send);
273 273
 		}
274 274
 	}
275 275
 
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
 	 *
286 286
 	 * @param EE_Message_To_Generate[] $messages_to_generate
287 287
 	 */
288
-	public function batch_queue_for_generation_and_persist( $messages_to_generate ) {
288
+	public function batch_queue_for_generation_and_persist($messages_to_generate) {
289 289
 		$this->_init_queue_and_generator();
290
-		$this->_queue_for_generation_loop( $messages_to_generate );
290
+		$this->_queue_for_generation_loop($messages_to_generate);
291 291
 		$this->_queue->save();
292 292
 	}
293 293
 
@@ -303,9 +303,9 @@  discard block
 block discarded – undo
303 303
 	 *
304 304
 	 * @param EE_Message_To_Generate[]  $messages_to_generate
305 305
 	 */
306
-	public function batch_queue_for_generation_no_persist( $messages_to_generate ) {
306
+	public function batch_queue_for_generation_no_persist($messages_to_generate) {
307 307
 		$this->_init_queue_and_generator();
308
-		$this->_queue_for_generation_loop( $messages_to_generate );
308
+		$this->_queue_for_generation_loop($messages_to_generate);
309 309
 	}
310 310
 
311 311
 
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @param EE_Message_To_Generate[] $messages_to_generate
319 319
 	 */
320
-	protected function _queue_for_generation_loop( $messages_to_generate ) {
320
+	protected function _queue_for_generation_loop($messages_to_generate) {
321 321
 		//make sure is in an array.
322
-		if ( ! is_array( $messages_to_generate ) ) {
323
-			$messages_to_generate = array( $messages_to_generate );
322
+		if ( ! is_array($messages_to_generate)) {
323
+			$messages_to_generate = array($messages_to_generate);
324 324
 		}
325 325
 
326
-		foreach ( $messages_to_generate as $message_to_generate ) {
327
-			if ( $message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid() ) {
328
-				$this->queue_for_generation( $message_to_generate );
326
+		foreach ($messages_to_generate as $message_to_generate) {
327
+			if ($message_to_generate instanceof EE_Message_To_Generate && $message_to_generate->valid()) {
328
+				$this->queue_for_generation($message_to_generate);
329 329
 			}
330 330
 		}
331 331
 	}
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 	 * @param  EE_Message_To_Generate[]
341 341
 	 * @return EE_Messages_Queue
342 342
 	 */
343
-	public function generate_and_queue_for_sending( $messages_to_generate ) {
343
+	public function generate_and_queue_for_sending($messages_to_generate) {
344 344
 		$this->_init_queue_and_generator();
345
-		$this->_queue_for_generation_loop( $messages_to_generate );
346
-		return $this->_generator->generate( true );
345
+		$this->_queue_for_generation_loop($messages_to_generate);
346
+		return $this->_generator->generate(true);
347 347
 	}
348 348
 
349 349
 
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 	 * @param   bool                   $test_send                Whether this is a test send or not.
358 358
 	 * @return  EE_Messages_Queue | bool   false if unable to generate otherwise the generated queue.
359 359
 	 */
360
-	public function generate_for_preview( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
361
-		if ( ! $message_to_generate->valid() ) {
360
+	public function generate_for_preview(EE_Message_To_Generate $message_to_generate, $test_send = false) {
361
+		if ( ! $message_to_generate->valid()) {
362 362
 			EE_Error::add_error(
363
-				__( 'Unable to generate preview because of invalid data', 'event_espresso' ),
363
+				__('Unable to generate preview because of invalid data', 'event_espresso'),
364 364
 				__FILE__,
365 365
 				__FUNCTION__,
366 366
 				__LINE__
@@ -368,14 +368,14 @@  discard block
 block discarded – undo
368 368
 			return false;
369 369
 		}
370 370
 		//just make sure preview is set on the $message_to_generate (in case client forgot)
371
-		$message_to_generate->set_preview( true );
371
+		$message_to_generate->set_preview(true);
372 372
 		$this->_init_queue_and_generator();
373
-		$this->queue_for_generation( $message_to_generate, $test_send );
374
-		$generated_queue = $this->_generator->generate( false );
375
-		if ( $generated_queue->execute( false ) ) {
373
+		$this->queue_for_generation($message_to_generate, $test_send);
374
+		$generated_queue = $this->_generator->generate(false);
375
+		if ($generated_queue->execute(false)) {
376 376
 			//the first queue item should be the preview
377 377
 			$generated_queue->get_message_repository()->rewind();
378
-			if ( ! $generated_queue->get_message_repository()->valid() ) {
378
+			if ( ! $generated_queue->get_message_repository()->valid()) {
379 379
 				return $generated_queue;
380 380
 			}
381 381
 			return $generated_queue->get_message_repository()->is_test_send() ? true : $generated_queue;
@@ -392,15 +392,15 @@  discard block
 block discarded – undo
392 392
 	 * @param EE_Message_To_Generate $message_to_generate
393 393
 	 * @return bool true or false for success.
394 394
 	 */
395
-	public function queue_for_sending( EE_Message_To_Generate $message_to_generate ) {
396
-		if ( ! $message_to_generate->valid() ) {
395
+	public function queue_for_sending(EE_Message_To_Generate $message_to_generate) {
396
+		if ( ! $message_to_generate->valid()) {
397 397
 			return false;
398 398
 		}
399 399
 		$this->_init_queue_and_generator();
400 400
 		$message = $message_to_generate->get_EE_Message();
401
-		$this->_queue->add( $message );
402
-		if ( $message->send_now() ) {
403
-			$this->_queue->execute( false );
401
+		$this->_queue->add($message);
402
+		if ($message->send_now()) {
403
+			$this->_queue->execute(false);
404 404
 		} else {
405 405
 			$this->_queue->save();
406 406
 		}
@@ -413,12 +413,12 @@  discard block
 block discarded – undo
413 413
 	 * @param EE_Message_To_Generate $message_to_generate
414 414
 	 * @return EE_Messages_Queue | null
415 415
 	 */
416
-	public function generate_and_send_now( EE_Message_To_Generate $message_to_generate ) {
417
-		if ( ! $message_to_generate->valid() ) {
416
+	public function generate_and_send_now(EE_Message_To_Generate $message_to_generate) {
417
+		if ( ! $message_to_generate->valid()) {
418 418
 			return null;
419 419
 		}
420 420
 		// is there supposed to be a sending messenger for this message?
421
-		if ( $message_to_generate instanceof EEI_Has_Sending_Messenger ) {
421
+		if ($message_to_generate instanceof EEI_Has_Sending_Messenger) {
422 422
 			// make sure it's valid, but if it's not,
423 423
 			// then set the value of $sending_messenger to an EE_Error object
424 424
 			// so that downstream code can easily see that things went wrong.
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
 			$sending_messenger = null;
435 435
 		}
436 436
 
437
-		if ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle ) {
437
+		if ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_idle) {
438 438
 			$this->_init_queue_and_generator();
439
-			$this->_queue->add( $message_to_generate->get_EE_Message() );
440
-			$this->_queue->execute( false, $sending_messenger );
439
+			$this->_queue->add($message_to_generate->get_EE_Message());
440
+			$this->_queue->execute(false, $sending_messenger);
441 441
 			return $this->_queue;
442
-		} elseif ( $message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete ) {
443
-			$generated_queue = $this->generate_and_return( array( $message_to_generate ) );
444
-			$generated_queue->execute( false, $sending_messenger );
442
+		} elseif ($message_to_generate->get_EE_Message()->STS_ID() === EEM_Message::status_incomplete) {
443
+			$generated_queue = $this->generate_and_return(array($message_to_generate));
444
+			$generated_queue->execute(false, $sending_messenger);
445 445
 			return $generated_queue;
446 446
 		}
447 447
 		return null;
@@ -458,13 +458,13 @@  discard block
 block discarded – undo
458 458
 	 * @param mixed  $data   The data being used for generation.
459 459
 	 * @param bool   $persist   Whether to persist the queued messages to the db or not.
460 460
 	 */
461
-	public function generate_for_all_active_messengers( $message_type, $data, $persist = true ) {
462
-		$messages_to_generate = $this->setup_mtgs_for_all_active_messengers( $message_type, $data );
463
-		if ( $persist ) {
464
-			$this->batch_queue_for_generation_and_persist( $messages_to_generate );
461
+	public function generate_for_all_active_messengers($message_type, $data, $persist = true) {
462
+		$messages_to_generate = $this->setup_mtgs_for_all_active_messengers($message_type, $data);
463
+		if ($persist) {
464
+			$this->batch_queue_for_generation_and_persist($messages_to_generate);
465 465
 			$this->_queue->initiate_request_by_priority();
466 466
 		} else {
467
-			$this->batch_queue_for_generation_no_persist( $messages_to_generate );
467
+			$this->batch_queue_for_generation_no_persist($messages_to_generate);
468 468
 		}
469 469
 	}
470 470
 
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
 	 *
480 480
 	 * @return EE_Message_To_Generate[]
481 481
 	 */
482
-	public function setup_mtgs_for_all_active_messengers( $message_type, $data ) {
482
+	public function setup_mtgs_for_all_active_messengers($message_type, $data) {
483 483
 		$messages_to_generate = array();
484
-		foreach ( $this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object  ) {
485
-			$message_to_generate = new EE_Message_To_Generate( $messenger_slug, $message_type, $data );
486
-			if ( $message_to_generate->valid() ) {
484
+		foreach ($this->_message_resource_manager->active_messengers() as $messenger_slug => $messenger_object) {
485
+			$message_to_generate = new EE_Message_To_Generate($messenger_slug, $message_type, $data);
486
+			if ($message_to_generate->valid()) {
487 487
 				$messages_to_generate[] = $message_to_generate;
488 488
 			}
489 489
 		}
@@ -498,29 +498,29 @@  discard block
 block discarded – undo
498 498
 	 * and send.
499 499
 	 * @param array $message_ids
500 500
 	 */
501
-	public function setup_messages_from_ids_and_send( $message_ids ) {
501
+	public function setup_messages_from_ids_and_send($message_ids) {
502 502
 		$this->_init_queue_and_generator();
503
-		$messages = EEM_Message::instance()->get_all( array(
503
+		$messages = EEM_Message::instance()->get_all(array(
504 504
 			array(
505
-				'MSG_ID' => array( 'IN', $message_ids ),
505
+				'MSG_ID' => array('IN', $message_ids),
506 506
 				'STS_ID' => array(
507 507
 					'IN',
508 508
 					array_merge(
509 509
 						EEM_Message::instance()->stati_indicating_sent(),
510
-						array( EEM_Message::status_retry )
510
+						array(EEM_Message::status_retry)
511 511
 					),
512 512
 				),
513 513
 			),
514 514
 		));
515 515
 		//set the Messages to resend.
516
-		foreach ( $messages as $message ) {
517
-			if ( $message instanceof EE_Message ) {
518
-				$message->set_STS_ID( EEM_Message::status_resend );
519
-				$this->_queue->add( $message );
516
+		foreach ($messages as $message) {
517
+			if ($message instanceof EE_Message) {
518
+				$message->set_STS_ID(EEM_Message::status_resend);
519
+				$this->_queue->add($message);
520 520
 			}
521 521
 		}
522 522
 
523
-		$this->_queue->initiate_request_by_priority( 'send' );
523
+		$this->_queue->initiate_request_by_priority('send');
524 524
 	}
525 525
 
526 526
 
@@ -534,23 +534,23 @@  discard block
 block discarded – undo
534 534
 	 *
535 535
 	 * @return EE_Message_To_Generate[]
536 536
 	 */
537
-	public function setup_messages_to_generate_from_registration_ids_in_request( $registration_ids_key = '_REG_ID' ) {
538
-		EE_Registry::instance()->load_core( 'Request_Handler' );
539
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
537
+	public function setup_messages_to_generate_from_registration_ids_in_request($registration_ids_key = '_REG_ID') {
538
+		EE_Registry::instance()->load_core('Request_Handler');
539
+		EE_Registry::instance()->load_helper('MSG_Template');
540 540
 		$regs_to_send = array();
541
-		$regIDs = EE_Registry::instance()->REQ->get( $registration_ids_key );
542
-		if ( empty( $regIDs ) ) {
543
-			EE_Error::add_error( __('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
541
+		$regIDs = EE_Registry::instance()->REQ->get($registration_ids_key);
542
+		if (empty($regIDs)) {
543
+			EE_Error::add_error(__('Something went wrong because we\'re missing the registration ID', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
544 544
 			return false;
545 545
 		}
546 546
 
547 547
 		//make sure is an array
548
-		$regIDs = is_array( $regIDs ) ? $regIDs : array( $regIDs );
548
+		$regIDs = is_array($regIDs) ? $regIDs : array($regIDs);
549 549
 
550
-		foreach( $regIDs as $regID ) {
551
-			$reg = EEM_Registration::instance()->get_one_by_ID( $regID );
552
-			if ( ! $reg instanceof EE_Registration ) {
553
-				EE_Error::add_error( sprintf( __('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID ) );
550
+		foreach ($regIDs as $regID) {
551
+			$reg = EEM_Registration::instance()->get_one_by_ID($regID);
552
+			if ( ! $reg instanceof EE_Registration) {
553
+				EE_Error::add_error(sprintf(__('Unable to retrieve a registration object for the given reg id (%s)', 'event_espresso'), $regID));
554 554
 				return false;
555 555
 			}
556 556
 			$regs_to_send[$reg->transaction_ID()][$reg->status_ID()][] = $reg;
@@ -558,13 +558,13 @@  discard block
 block discarded – undo
558 558
 
559 559
 		$messages_to_generate = array();
560 560
 
561
-		foreach ( $regs_to_send as $status_group ) {
562
-			foreach ( $status_group as $status_id => $registrations ) {
561
+		foreach ($regs_to_send as $status_group) {
562
+			foreach ($status_group as $status_id => $registrations) {
563 563
 				$messages_to_generate = array_merge(
564 564
 					$messages_to_generate,
565 565
 					$this->setup_mtgs_for_all_active_messengers(
566
-						EEH_MSG_Template::convert_reg_status_to_message_type( $status_id ),
567
-						array( $registrations, $status_id )
566
+						EEH_MSG_Template::convert_reg_status_to_message_type($status_id),
567
+						array($registrations, $status_id)
568 568
 					)
569 569
 				);
570 570
 			}
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Queue.lib.php 1 patch
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param \EE_Message_Repository       $message_repository
73 73
 	 */
74
-	public function __construct( EE_Message_Repository $message_repository ) {
75
-		$this->_batch_count        = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 );
74
+	public function __construct(EE_Message_Repository $message_repository) {
75
+		$this->_batch_count        = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50);
76 76
 		$this->_rate_limit         = $this->get_rate_limit();
77 77
 		$this->_message_repository = $message_repository;
78 78
 	}
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 *                                 use the messenger send method but typically is based on preview data.
92 92
 	 * @return bool          Whether the message was successfully added to the repository or not.
93 93
 	 */
94
-	public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) {
94
+	public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) {
95 95
 		$data['preview'] = $preview;
96 96
 		$data['test_send'] = $test_send;
97
-		return $this->_message_repository->add( $message, $data );
97
+		return $this->_message_repository->add($message, $data);
98 98
 	}
99 99
 
100 100
 
@@ -106,13 +106,13 @@  discard block
 block discarded – undo
106 106
 	 * @param bool          $persist    This flag indicates whether to attempt to delete the object from the db as well.
107 107
 	 * @return bool
108 108
 	 */
109
-	public function remove( EE_Message $message, $persist = false ) {
110
-		if ( $persist && $this->_message_repository->current() !== $message ) {
109
+	public function remove(EE_Message $message, $persist = false) {
110
+		if ($persist && $this->_message_repository->current() !== $message) {
111 111
 			//get pointer on right message
112
-			if ( $this->_message_repository->has( $message ) ) {
112
+			if ($this->_message_repository->has($message)) {
113 113
 				$this->_message_repository->rewind();
114
-				while( $this->_message_repository->valid() ) {
115
-					if ( $this->_message_repository->current() === $message ) {
114
+				while ($this->_message_repository->valid()) {
115
+					if ($this->_message_repository->current() === $message) {
116 116
 						break;
117 117
 					}
118 118
 					$this->_message_repository->next();
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 				return false;
122 122
 			}
123 123
 		}
124
-		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove( $message );
124
+		return $persist ? $this->_message_repository->delete() : $this->_message_repository->remove($message);
125 125
 	}
126 126
 
127 127
 
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
 	 * @return bool  true if successfully retrieved batch, false no batch ready.
162 162
 	 */
163 163
 	public function get_batch_to_generate() {
164
-		if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) {
164
+		if ($this->is_locked(EE_Messages_Queue::action_generating)) {
165 165
 			return false;
166 166
 		}
167 167
 
168 168
 		//lock batch generation to prevent race conditions.
169
-		$this->lock_queue( EE_Messages_Queue::action_generating );
169
+		$this->lock_queue(EE_Messages_Queue::action_generating);
170 170
 
171 171
 		$query_args = array(
172 172
 			// key 0 = where conditions
173
-			0 => array( 'STS_ID' => EEM_Message::status_incomplete ),
173
+			0 => array('STS_ID' => EEM_Message::status_incomplete),
174 174
 			'order_by' => $this->_get_priority_orderby(),
175 175
 			'limit' => $this->_batch_count
176 176
 		);
177
-		$messages = EEM_Message::instance()->get_all( $query_args );
177
+		$messages = EEM_Message::instance()->get_all($query_args);
178 178
 
179
-		if ( ! $messages ) {
179
+		if ( ! $messages) {
180 180
 			return false; //nothing to generate
181 181
 		}
182 182
 
183
-		foreach ( $messages as $message ) {
184
-			if ( $message instanceof EE_Message ) {
183
+		foreach ($messages as $message) {
184
+			if ($message instanceof EE_Message) {
185 185
 				$data = $message->all_extra_meta_array();
186
-				$this->add( $message, $data );
186
+				$this->add($message, $data);
187 187
 			}
188 188
 		}
189 189
 		return true;
@@ -206,34 +206,34 @@  discard block
 block discarded – undo
206 206
 	 *               to assist with notifying user.
207 207
 	 */
208 208
 	public function get_to_send_batch_and_send() {
209
-		if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) {
209
+		if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) {
210 210
 			return false;
211 211
 		}
212 212
 
213
-		$this->lock_queue( EE_Messages_Queue::action_sending );
213
+		$this->lock_queue(EE_Messages_Queue::action_sending);
214 214
 
215 215
 		$batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit;
216 216
 
217 217
 		$query_args = array(
218 218
 			// key 0 = where conditions
219
-			0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ),
219
+			0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())),
220 220
 			'order_by' => $this->_get_priority_orderby(),
221 221
 			'limit' => $batch
222 222
 		);
223 223
 
224
-		$messages_to_send = EEM_Message::instance()->get_all( $query_args );
224
+		$messages_to_send = EEM_Message::instance()->get_all($query_args);
225 225
 
226 226
 
227 227
 		//any to send?
228
-		if ( ! $messages_to_send ) {
229
-			$this->unlock_queue( EE_Messages_Queue::action_sending );
228
+		if ( ! $messages_to_send) {
229
+			$this->unlock_queue(EE_Messages_Queue::action_sending);
230 230
 			return false;
231 231
 		}
232 232
 
233 233
 		//add to queue.
234
-		foreach ( $messages_to_send as $message ) {
235
-			if ( $message instanceof EE_Message ) {
236
-				$this->add( $message );
234
+		foreach ($messages_to_send as $message) {
235
+			if ($message instanceof EE_Message) {
236
+				$this->add($message);
237 237
 			}
238 238
 		}
239 239
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		$this->execute();
242 242
 
243 243
 		//release lock
244
-		$this->unlock_queue( EE_Messages_Queue::action_sending );
244
+		$this->unlock_queue(EE_Messages_Queue::action_sending);
245 245
 		return true;
246 246
 	}
247 247
 
@@ -253,8 +253,8 @@  discard block
 block discarded – undo
253 253
 	 *
254 254
 	 * @param   string  $type   The type of queue being locked.
255 255
 	 */
256
-	public function lock_queue( $type = EE_Messages_Queue::action_generating ) {
257
-		set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) );
256
+	public function lock_queue($type = EE_Messages_Queue::action_generating) {
257
+		set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type));
258 258
 	}
259 259
 
260 260
 
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
 	 *
266 266
 	 * @param   string  $type   The type of queue being unlocked.
267 267
 	 */
268
-	public function unlock_queue( $type = EE_Messages_Queue::action_generating ) {
269
-		delete_transient( $this->_get_lock_key( $type ) );
268
+	public function unlock_queue($type = EE_Messages_Queue::action_generating) {
269
+		delete_transient($this->_get_lock_key($type));
270 270
 	}
271 271
 
272 272
 
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	 * @param string $type  The type of lock.
278 278
 	 * @return string
279 279
 	 */
280
-	protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) {
281
-		return '_ee_lock_' . $type;
280
+	protected function _get_lock_key($type = EE_Messages_Queue::action_generating) {
281
+		return '_ee_lock_'.$type;
282 282
 	}
283 283
 
284 284
 
@@ -289,8 +289,8 @@  discard block
 block discarded – undo
289 289
 	 * @param string $type  The type of lock
290 290
 	 * @return int   time to expiry in seconds.
291 291
 	 */
292
-	protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) {
293
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type );
292
+	protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) {
293
+		return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type);
294 294
 	}
295 295
 
296 296
 
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	 * @return int
309 309
 	 */
310 310
 	protected function _get_rate_limit_expiry() {
311
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS );
311
+		return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS);
312 312
 	}
313 313
 
314 314
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 	 * @return int
320 320
 	 */
321 321
 	protected function _default_rate_limit() {
322
-		return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 );
322
+		return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200);
323 323
 	}
324 324
 
325 325
 
@@ -345,14 +345,14 @@  discard block
 block discarded – undo
345 345
 	 * @param  string $type The type of lock being checked for.
346 346
 	 * @return bool
347 347
 	 */
348
-	public function is_locked( $type = EE_Messages_Queue::action_generating ) {
348
+	public function is_locked($type = EE_Messages_Queue::action_generating) {
349 349
 		/**
350 350
 		 * This filters the default is_locked behaviour.
351 351
 		 */
352 352
 		$is_locked = filter_var(
353 353
 			apply_filters(
354 354
 				'FHEE__EE_Messages_Queue__is_locked',
355
-				get_transient( $this->_get_lock_key( $type ) ),
355
+				get_transient($this->_get_lock_key($type)),
356 356
 				$this
357 357
 			),
358 358
 			FILTER_VALIDATE_BOOLEAN
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 		 *            Also implemented here because messages processed on the same request should not have any locks applied.
364 364
 		 */
365 365
 		if (
366
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
366
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
367 367
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
368 368
 		) {
369 369
 			$is_locked = false;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 	 * @return int
386 386
 	 */
387 387
 	public function get_rate_limit() {
388
-		if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) {
388
+		if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) {
389 389
 			$rate_limit = $this->_default_rate_limit();
390
-			set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() );
390
+			set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key());
391 391
 		}
392 392
 		return $rate_limit;
393 393
 	}
@@ -399,12 +399,12 @@  discard block
 block discarded – undo
399 399
 	 * This updates existing rate limit with the new limit which is the old minus the batch.
400 400
 	 * @param int $batch_completed  This sets the new rate limit based on the given batch that was completed.
401 401
 	 */
402
-	public function set_rate_limit( $batch_completed ) {
402
+	public function set_rate_limit($batch_completed) {
403 403
 		//first get the most up to date rate limit (in case its expired and reset)
404 404
 		$rate_limit = $this->get_rate_limit();
405 405
 		$new_limit = $rate_limit - $batch_completed;
406 406
 		//updating the transient option directly to avoid resetting the expiry.
407
-		update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit );
407
+		update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit);
408 408
 	}
409 409
 
410 410
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	 * @param string $task This indicates what type of request is going to be initiated.
418 418
 	 * @param int    $priority  This indicates the priority that triggers initiating the request.
419 419
 	 */
420
-	public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) {
420
+	public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) {
421 421
 		//determine what status is matched with the priority as part of the trigger conditions.
422 422
 		$status = $task == 'generate'
423 423
 			? EEM_Message::status_incomplete
@@ -437,19 +437,19 @@  discard block
 block discarded – undo
437 437
 		 *   the same request.
438 438
 		 */
439 439
 		if (
440
-			apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
440
+			apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
441 441
 			|| EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
442 442
 		) {
443
-			$messages_processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
444
-			if ( $messages_processor instanceof EE_Messages_Processor ) {
445
-				return $messages_processor->process_immediately_from_queue( $this );
443
+			$messages_processor = EE_Registry::instance()->load_lib('Messages_Processor');
444
+			if ($messages_processor instanceof EE_Messages_Processor) {
445
+				return $messages_processor->process_immediately_from_queue($this);
446 446
 			}
447 447
 			//if we get here then that means the messages processor couldn't be loaded so messages will just remain
448 448
 			//queued for manual triggering by end user.
449 449
 		}
450 450
 
451
-		if ( $this->_message_repository->count_by_priority_and_status( $priority, $status ) ) {
452
-			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task );
451
+		if ($this->_message_repository->count_by_priority_and_status($priority, $status)) {
452
+			EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task);
453 453
 		}
454 454
 	}
455 455
 
@@ -474,53 +474,53 @@  discard block
 block discarded – undo
474 474
 	 *                    Also, if the messenger is an request type messenger (or a preview),
475 475
 	 * 					  its entirely possible that the messenger will exit before
476 476
 	 */
477
-	public function execute( $save = true, $sending_messenger = null, $by_priority = false ) {
477
+	public function execute($save = true, $sending_messenger = null, $by_priority = false) {
478 478
 		$messages_sent = 0;
479 479
 		$this->_did_hook = array();
480 480
 		$this->_message_repository->rewind();
481 481
 
482
-		while ( $this->_message_repository->valid() ) {
482
+		while ($this->_message_repository->valid()) {
483 483
 			$error_messages = array();
484 484
 			/** @type EE_Message $message */
485 485
 			$message = $this->_message_repository->current();
486 486
 			//only process things that are queued for sending
487
-			if ( ! in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send() ) ) {
487
+			if ( ! in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_to_send())) {
488 488
 				$this->_message_repository->next();
489 489
 				continue;
490 490
 			}
491 491
 			//if $by_priority is set and does not match then continue;
492
-			if ( $by_priority && $by_priority != $message->priority() ) {
492
+			if ($by_priority && $by_priority != $message->priority()) {
493 493
 				$this->_message_repository->next();
494 494
 				continue;
495 495
 			}
496 496
 			//error checking
497
-			if ( ! $message->valid_messenger() ) {
497
+			if ( ! $message->valid_messenger()) {
498 498
 				$error_messages[] = sprintf(
499
-					__( 'The %s messenger is not active at time of sending.', 'event_espresso' ),
499
+					__('The %s messenger is not active at time of sending.', 'event_espresso'),
500 500
 					$message->messenger()
501 501
 				);
502 502
 			}
503
-			if ( ! $message->valid_message_type() ) {
503
+			if ( ! $message->valid_message_type()) {
504 504
 				$error_messages[] = sprintf(
505
-					__( 'The %s message type is not active at the time of sending.', 'event_espresso' ),
505
+					__('The %s message type is not active at the time of sending.', 'event_espresso'),
506 506
 					$message->message_type()
507 507
 				);
508 508
 			}
509 509
 			// if there was supposed to be a sending messenger for this message, but it was invalid/inactive,
510 510
 			// then it will instead be an EE_Error object, so let's check for that
511
-			if ( $sending_messenger instanceof EE_Error ) {
511
+			if ($sending_messenger instanceof EE_Error) {
512 512
 				$error_messages[] = $sending_messenger->getMessage();
513 513
 			}
514 514
 			// if there are no errors, then let's process the message
515
-			if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) {
515
+			if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) {
516 516
 				$messages_sent++;
517 517
 			}
518
-			$this->_set_error_message( $message, $error_messages );
518
+			$this->_set_error_message($message, $error_messages);
519 519
 			//add modified time
520
-			$message->set_modified( time() );
520
+			$message->set_modified(time());
521 521
 			$this->_message_repository->next();
522 522
 		}
523
-		if ( $save ) {
523
+		if ($save) {
524 524
 			$this->save();
525 525
 		}
526 526
 		return $messages_sent;
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	 * @param mixed 	 $sending_messenger (optional)
536 536
 	 * @return bool
537 537
 	 */
538
-	protected function _process_message( EE_Message $message, $sending_messenger = null ) {
538
+	protected function _process_message(EE_Message $message, $sending_messenger = null) {
539 539
 		// these *should* have been validated in the execute() method above
540 540
 		$messenger = $message->messenger_object();
541 541
 		$message_type = $message->message_type_object();
@@ -545,20 +545,20 @@  discard block
 block discarded – undo
545 545
 			&& $messenger instanceof EE_messenger
546 546
 			&& $sending_messenger->name != $messenger->name
547 547
 		) {
548
-			$messenger->do_secondary_messenger_hooks( $sending_messenger->name );
548
+			$messenger->do_secondary_messenger_hooks($sending_messenger->name);
549 549
 			$messenger = $sending_messenger;
550 550
 		}
551 551
 		// send using messenger, but double check objects
552
-		if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) {
552
+		if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) {
553 553
 			//set hook for message type (but only if not using another messenger to send).
554
-			if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) {
555
-				$message_type->do_messenger_hooks( $messenger );
556
-				$this->_did_hook[ $message_type->name ] = 1;
554
+			if ( ! isset($this->_did_hook[$message_type->name])) {
555
+				$message_type->do_messenger_hooks($messenger);
556
+				$this->_did_hook[$message_type->name] = 1;
557 557
 			}
558 558
 			//if preview then use preview method
559 559
 			return $this->_message_repository->is_preview()
560
-				? $this->_do_preview( $message, $messenger, $message_type, $this->_message_repository->is_test_send() )
561
-				: $this->_do_send( $message, $messenger, $message_type );
560
+				? $this->_do_preview($message, $messenger, $message_type, $this->_message_repository->is_test_send())
561
+				: $this->_do_send($message, $messenger, $message_type);
562 562
 		}
563 563
 		return false;
564 564
 	}
@@ -576,12 +576,12 @@  discard block
 block discarded – undo
576 576
 	 * @param array $status  Stati to check for in queue
577 577
 	 * @return int  Count of EE_Message's matching the given status.
578 578
 	 */
579
-	public function count_STS_in_queue( $status ) {
579
+	public function count_STS_in_queue($status) {
580 580
 		$count = 0;
581
-		$status = is_array( $status ) ? $status : array( $status );
581
+		$status = is_array($status) ? $status : array($status);
582 582
 		$this->_message_repository->rewind();
583
-		foreach( $this->_message_repository as $message ) {
584
-			if ( in_array( $message->STS_ID(), $status ) ) {
583
+		foreach ($this->_message_repository as $message) {
584
+			if (in_array($message->STS_ID(), $status)) {
585 585
 				$count++;
586 586
 			}
587 587
 		}
@@ -598,15 +598,15 @@  discard block
 block discarded – undo
598 598
 	 * @param $test_send
599 599
 	 * @return bool   true means all went well, false means, not so much.
600 600
 	 */
601
-	protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) {
602
-		if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) {
603
-			if ( ! $test_send ) {
604
-				$message->set_content( $preview );
601
+	protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) {
602
+		if ($preview = $messenger->get_preview($message, $message_type, $test_send)) {
603
+			if ( ! $test_send) {
604
+				$message->set_content($preview);
605 605
 			}
606
-			$message->set_STS_ID( EEM_Message::status_sent );
606
+			$message->set_STS_ID(EEM_Message::status_sent);
607 607
 			return true;
608 608
 		} else {
609
-			$message->set_STS_ID( EEM_Message::status_failed );
609
+			$message->set_STS_ID(EEM_Message::status_failed);
610 610
 			return false;
611 611
 		}
612 612
 	}
@@ -622,12 +622,12 @@  discard block
 block discarded – undo
622 622
 	 * @param EE_message_type $message_type
623 623
 	 * @return bool true means all went well, false means, not so much.
624 624
 	 */
625
-	protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) {
626
-		if ( $messenger->send_message( $message, $message_type ) ) {
627
-			$message->set_STS_ID( EEM_Message::status_sent );
625
+	protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) {
626
+		if ($messenger->send_message($message, $message_type)) {
627
+			$message->set_STS_ID(EEM_Message::status_sent);
628 628
 			return true;
629 629
 		} else {
630
-			$message->set_STS_ID( EEM_Message::status_retry );
630
+			$message->set_STS_ID(EEM_Message::status_retry);
631 631
 			return false;
632 632
 		}
633 633
 	}
@@ -641,21 +641,21 @@  discard block
 block discarded – undo
641 641
 	 * @param EE_Message $message
642 642
 	 * @param array      $error_messages the response from the messenger.
643 643
 	 */
644
-	protected function _set_error_message( EE_Message $message, $error_messages ) {
644
+	protected function _set_error_message(EE_Message $message, $error_messages) {
645 645
 		$error_messages = (array) $error_messages;
646
-		if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) {
646
+		if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) {
647 647
 			$notices = EE_Error::has_notices();
648
-			$error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' );
649
-			if ( $notices === 1 ) {
648
+			$error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso');
649
+			if ($notices === 1) {
650 650
 				$notices = EE_Error::get_vanilla_notices();
651
-				$notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array();
652
-				$error_messages[] = implode( "\n", $notices['errors'] );
651
+				$notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array();
652
+				$error_messages[] = implode("\n", $notices['errors']);
653 653
 			}
654 654
 		}
655
-		if ( count( $error_messages ) > 0 ) {
656
-			$msg = __( 'Message was not executed successfully.', 'event_espresso' );
657
-			$msg = $msg . "\n" . implode( "\n", $error_messages );
658
-			$message->set_error_message( $msg );
655
+		if (count($error_messages) > 0) {
656
+			$msg = __('Message was not executed successfully.', 'event_espresso');
657
+			$msg = $msg."\n".implode("\n", $error_messages);
658
+			$message->set_error_message($msg);
659 659
 		}
660 660
 	}
661 661
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Scheduler.lib.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	 */
24 24
 	public function __construct() {
25 25
 		//register tasks (and make sure only registered once).
26
-		if ( ! has_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ) ) ) {
27
-			add_action( 'FHEE__EEH_Activation__get_cron_tasks', array( $this, 'register_scheduled_tasks' ), 10 );
26
+		if ( ! has_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'))) {
27
+			add_action('FHEE__EEH_Activation__get_cron_tasks', array($this, 'register_scheduled_tasks'), 10);
28 28
 		}
29 29
 
30 30
 		//register callbacks for scheduled events (but make sure they are set only once).
31
-		if ( ! has_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation' ) ) ) {
32
-			add_action( 'AHEE__EE_Messages_Scheduler__generation', array( 'EE_Messages_Scheduler', 'batch_generation') );
33
-			add_action( 'AHEE__EE_Messages_Scheduler__sending', array( 'EE_Messages_Scheduler', 'batch_sending' ) );
31
+		if ( ! has_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'))) {
32
+			add_action('AHEE__EE_Messages_Scheduler__generation', array('EE_Messages_Scheduler', 'batch_generation'));
33
+			add_action('AHEE__EE_Messages_Scheduler__sending', array('EE_Messages_Scheduler', 'batch_sending'));
34 34
 		}
35 35
 
36 36
 		//add custom schedules
37
-		add_filter( 'cron_schedules', array( $this, 'custom_schedules' ) );
37
+		add_filter('cron_schedules', array($this, 'custom_schedules'));
38 38
 	}
39 39
 
40 40
 
@@ -44,10 +44,10 @@  discard block
 block discarded – undo
44 44
 	 * Add custom schedules for wp_cron
45 45
 	 * @param $schedules
46 46
 	 */
47
-	public function custom_schedules( $schedules ) {
47
+	public function custom_schedules($schedules) {
48 48
 		$schedules['ee_message_cron'] = array(
49 49
 			'interval' => self::message_cron_schedule,
50
-			'display' => __( 'This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso' )
50
+			'display' => __('This is the cron time interval for EE Message schedules (defaults to once every 5 minutes)', 'event_espresso')
51 51
 		);
52 52
 		return $schedules;
53 53
 	}
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 * @param array $tasks  already existing scheduled tasks
59 59
 	 * @return array
60 60
 	 */
61
-	public function register_scheduled_tasks( $tasks ) {
61
+	public function register_scheduled_tasks($tasks) {
62 62
 		$tasks['AHEE__EE_Messages_Scheduler__generation'] = 'ee_message_cron';
63 63
 		$tasks['AHEE__EE_Messages_Scheduler__sending'] = 'ee_message_cron';
64 64
 		return $tasks;
@@ -70,27 +70,27 @@  discard block
 block discarded – undo
70 70
 	 * Note: The EED_Messages module has the handlers for these requests.
71 71
 	 * @param string $task  The task the request is being generated for.
72 72
 	 */
73
-	public static function initiate_scheduled_non_blocking_request( $task ) {
74
-		if ( apply_filters( 'EE_Messages_Scheduler__initiate_scheduled_non_blocking_request__do_separate_request', true ) ) {
75
-			$request_url  = add_query_arg(
73
+	public static function initiate_scheduled_non_blocking_request($task) {
74
+		if (apply_filters('EE_Messages_Scheduler__initiate_scheduled_non_blocking_request__do_separate_request', true)) {
75
+			$request_url = add_query_arg(
76 76
 				array_merge(
77
-					array( 'ee' => 'msg_cron_trigger' ),
78
-					EE_Messages_Scheduler::get_request_params( $task )
77
+					array('ee' => 'msg_cron_trigger'),
78
+					EE_Messages_Scheduler::get_request_params($task)
79 79
 				),
80 80
 				site_url()
81 81
 			);
82 82
 			$request_args = array(
83 83
 				'timeout'     => 300,
84
-				'blocking'    => ( defined( 'DOING_CRON' ) && DOING_CRON ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ? true : false,
84
+				'blocking'    => (defined('DOING_CRON') && DOING_CRON) || (defined('DOING_AJAX') && DOING_AJAX) ? true : false,
85 85
 				'sslverify'   => false,
86 86
 				'redirection' => 10,
87 87
 			);
88
-			$response     = wp_remote_get( $request_url, $request_args );
89
-			if ( is_wp_error( $response ) ) {
90
-				trigger_error( $response->get_error_message() );
88
+			$response = wp_remote_get($request_url, $request_args);
89
+			if (is_wp_error($response)) {
90
+				trigger_error($response->get_error_message());
91 91
 			}
92 92
 		} else {
93
-			EE_Messages_Scheduler::initiate_immediate_request_on_cron( $task );
93
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron($task);
94 94
 		}
95 95
 	}
96 96
 
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 * @param string $task The task the request is for.
104 104
 	 * @return array
105 105
 	 */
106
-	public static function get_request_params( $task ) {
106
+	public static function get_request_params($task) {
107 107
 		//transient is used for flood control on msg_cron_trigger requests
108
-		$transient_key = 'ee_trans_' . uniqid( $task );
109
-		set_transient( $transient_key, 1, 5 * MINUTE_IN_SECONDS );
108
+		$transient_key = 'ee_trans_'.uniqid($task);
109
+		set_transient($transient_key, 1, 5 * MINUTE_IN_SECONDS);
110 110
 		return array(
111 111
 			'type' => $task,
112 112
 			'key' => $transient_key,
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 	 * This is used to execute an immediate call to the run_cron task performed by EED_Messages
121 121
 	 * @param string $task The task the request is being generated for.
122 122
 	 */
123
-	public static function initiate_immediate_request_on_cron( $task ) {
124
-		$request_args = EE_Messages_Scheduler::get_request_params( $task );
123
+	public static function initiate_immediate_request_on_cron($task) {
124
+		$request_args = EE_Messages_Scheduler::get_request_params($task);
125 125
 		//set those request args in the request so it gets picked up
126
-		foreach ( $request_args as $request_key => $request_value ) {
127
-			EE_Registry::instance()->REQ->set( $request_key, $request_value );
126
+		foreach ($request_args as $request_key => $request_value) {
127
+			EE_Registry::instance()->REQ->set($request_key, $request_value);
128 128
 		}
129 129
 		EED_Messages::instance()->run_cron();
130 130
 	}
@@ -141,10 +141,10 @@  discard block
 block discarded – undo
141 141
 		 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
142 142
 		 */
143 143
 		if (
144
-			! apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
144
+			! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
145 145
 			|| ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
146 146
 		) {
147
-			EE_Messages_Scheduler::initiate_immediate_request_on_cron( 'generate' );
147
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron('generate');
148 148
 		}
149 149
 	}
150 150
 
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 		 * @see filter usage in EE_Messages_Queue::initiate_request_by_priority()
160 160
 		 */
161 161
 		if (
162
-			! apply_filters( 'FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false )
162
+			! apply_filters('FHEE__EE_Messages_Processor__initiate_request_by_priority__do_immediate_processing', false)
163 163
 			|| ! EE_Registry::instance()->NET_CFG->core->do_messages_on_same_request
164 164
 		) {
165
-			EE_Messages_Scheduler::initiate_immediate_request_on_cron( 'send' );
165
+			EE_Messages_Scheduler::initiate_immediate_request_on_cron('send');
166 166
 		}
167 167
 	}
168 168
 
Please login to merge, or discard this patch.
core/EE_Error.core.php 2 patches
Indentation   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -18,52 +18,52 @@  discard block
 block discarded – undo
18 18
 
19 19
 
20 20
 	/**
21
-	* 	name of the file to log exceptions to
22
-	* 	@access	private
23
-    *	@var string
24
-	*/
21
+	 * 	name of the file to log exceptions to
22
+	 * 	@access	private
23
+	 *	@var string
24
+	 */
25 25
 	private static $_exception_log_file = 'espresso_error_log.txt';
26 26
 
27 27
 	/**
28
-	* 	the exception
29
-	* 	@access	private
30
-    *	@var object
31
-	*/
28
+	 * 	the exception
29
+	 * 	@access	private
30
+	 *	@var object
31
+	 */
32 32
 	private $_exception;
33 33
 
34 34
 	/**
35
-	* 	stores details for all exception
36
-	* 	@access	private
37
-    *	@var array
38
-	*/
35
+	 * 	stores details for all exception
36
+	 * 	@access	private
37
+	 *	@var array
38
+	 */
39 39
 	private static $_all_exceptions = array();
40 40
 
41 41
 	/**
42
-	* 	tracks number of errors
43
-	* 	@access	private
44
-    *	@var int
45
-	*/
42
+	 * 	tracks number of errors
43
+	 * 	@access	private
44
+	 *	@var int
45
+	 */
46 46
 	private static $_error_count = 0;
47 47
 
48 48
 	/**
49
-	* 	has JS been loaded ?
50
-	* 	@access	private
51
-    *	@var boolean
52
-	*/
49
+	 * 	has JS been loaded ?
50
+	 * 	@access	private
51
+	 *	@var boolean
52
+	 */
53 53
 	private static $_js_loaded = FALSE;
54 54
 
55 55
 	/**
56
-	* 	has shutdown action been added ?
57
-	* 	@access	private
58
-    *	@var boolean
59
-	*/
56
+	 * 	has shutdown action been added ?
57
+	 * 	@access	private
58
+	 *	@var boolean
59
+	 */
60 60
 	private static $_action_added = FALSE;
61 61
 
62 62
 	/**
63
-	* 	has shutdown action been added ?
64
-	* 	@access	private
65
-    *	@var boolean
66
-	*/
63
+	 * 	has shutdown action been added ?
64
+	 * 	@access	private
65
+	 *	@var boolean
66
+	 */
67 67
 	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
68 68
 
69 69
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
 
72 72
 
73 73
 	/**
74
-	*	@override default exception handling
75
-	*	@access public
76
-	*	@echo string
77
-	*/
74
+	 *	@override default exception handling
75
+	 *	@access public
76
+	 *	@echo string
77
+	 */
78 78
 	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79 79
 		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80 80
 			parent::__construct( $message, $code );
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 	/**
176
-	*	fatal_error_handler
177
-	*	@access public
178
-	*	@return void
179
-	*/
176
+	 *	fatal_error_handler
177
+	 *	@access public
178
+	 *	@return void
179
+	 */
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182 182
 		if ( $last_error['type'] === E_ERROR ) {
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 
222 222
 
223 223
 	/**
224
-	*	_add_actions
225
-	*	@access public
226
-	*	@return void
227
-	*/
228
-    public function get_error() {
224
+	 *	_add_actions
225
+	 *	@access public
226
+	 *	@return void
227
+	 */
228
+	public function get_error() {
229 229
 
230 230
 		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
231 231
 			throw $this;
@@ -261,27 +261,27 @@  discard block
 block discarded – undo
261 261
 	 * @param bool $check_stored
262 262
 	 * @return bool
263 263
 	 */
264
-    public static function has_error( $check_stored = false ){
265
-	    $has_error = self::$_error_count ? true : false;
266
-	    if ( $check_stored && ! $has_error ) {
267
-		    $notices = (array) get_option( 'ee_notices', array() );
268
-		    foreach ( $notices as $type => $notice ) {
269
-			    if ( $type === 'errors' && $notice ) {
270
-				    return true;
271
-			    }
272
-		    }
273
-	    }
274
-	    return $has_error;
275
-    }
264
+	public static function has_error( $check_stored = false ){
265
+		$has_error = self::$_error_count ? true : false;
266
+		if ( $check_stored && ! $has_error ) {
267
+			$notices = (array) get_option( 'ee_notices', array() );
268
+			foreach ( $notices as $type => $notice ) {
269
+				if ( $type === 'errors' && $notice ) {
270
+					return true;
271
+				}
272
+			}
273
+		}
274
+		return $has_error;
275
+	}
276 276
 
277 277
 
278 278
 
279 279
 	/**
280
-	*	display_errors
281
-	*	@access public
282
-	*	@echo string
283
-	*/
284
-    public function display_errors(){
280
+	 *	display_errors
281
+	 *	@access public
282
+	 *	@echo string
283
+	 */
284
+	public function display_errors(){
285 285
 
286 286
 		$trace_details = '';
287 287
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			// process trace info
354 354
 			if ( empty( $ex['trace'] )) {
355 355
 
356
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
356
+				$trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
357 357
 
358 358
 			} else {
359 359
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
 					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
406 406
 					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
407 407
 
408
-		              $trace_details .= '
408
+					  $trace_details .= '
409 409
 					<tr>
410 410
 						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
411 411
 						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
 				}
419 419
 
420
-	            $trace_details .= '
420
+				$trace_details .= '
421 421
 			 </table>
422 422
 			</div>';
423 423
 
@@ -497,12 +497,12 @@  discard block
 block discarded – undo
497 497
 
498 498
 
499 499
 	/**
500
-	*	generate string from exception trace args
501
-	*
502
-	*	@access private
503
-	*	@ param array $arguments
504
-	*	@ return string
505
-	*/
500
+	 *	generate string from exception trace args
501
+	 *
502
+	 *	@access private
503
+	 *	@ param array $arguments
504
+	 *	@ return string
505
+	 */
506 506
 	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
507 507
 
508 508
 		$arg_string = '';
@@ -546,15 +546,15 @@  discard block
 block discarded – undo
546 546
 
547 547
 
548 548
 	/**
549
-	* 	add error message
550
-	*
551
-	*	@access public
552
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
553
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
554
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
555
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
556
-	* 	@return 		void
557
-	*/
549
+	 * 	add error message
550
+	 *
551
+	 *	@access public
552
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
553
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
554
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
555
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
556
+	 * 	@return 		void
557
+	 */
558 558
 	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
559 559
 		self::_add_notice ( 'errors', $msg, $file, $func, $line );
560 560
 		self::$_error_count++;
@@ -582,15 +582,15 @@  discard block
 block discarded – undo
582 582
 
583 583
 
584 584
 	/**
585
-	* 	add success message
586
-	*
587
-	*	@access public
588
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
589
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
590
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
591
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
592
-	* 	@return 		void
593
-	*/
585
+	 * 	add success message
586
+	 *
587
+	 *	@access public
588
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
589
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
590
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
591
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
592
+	 * 	@return 		void
593
+	 */
594 594
 	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
595 595
 		self::_add_notice ( 'success', $msg, $file, $func, $line );
596 596
 	}
@@ -600,15 +600,15 @@  discard block
 block discarded – undo
600 600
 
601 601
 
602 602
 	/**
603
-	* 	add attention message
604
-	*
605
-	*	@access public
606
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
607
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
608
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
609
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
610
-	* 	@return 		void
611
-	*/
603
+	 * 	add attention message
604
+	 *
605
+	 *	@access public
606
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
607
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
608
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
609
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
610
+	 * 	@return 		void
611
+	 */
612 612
 	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
613 613
 		self::_add_notice ( 'attention', $msg, $file, $func, $line );
614 614
 	}
@@ -618,16 +618,16 @@  discard block
 block discarded – undo
618 618
 
619 619
 
620 620
 	/**
621
-	* 	add success message
622
-	*
623
-	*	@access public
624
-	* 	@param		string		$type	whether the message is for a success or error notification
625
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
626
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
627
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
628
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
629
-	* 	@return 		void
630
-	*/
621
+	 * 	add success message
622
+	 *
623
+	 *	@access public
624
+	 * 	@param		string		$type	whether the message is for a success or error notification
625
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
626
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
627
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
628
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
629
+	 * 	@return 		void
630
+	 */
631 631
 	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
632 632
 		if ( empty( $msg )) {
633 633
 			EE_Error::doing_it_wrong(
@@ -686,11 +686,11 @@  discard block
 block discarded – undo
686 686
 
687 687
 
688 688
 	/**
689
-	* 	in some case it may be necessary to overwrite the existing success messages
690
-	*
691
-	*	@access public
692
-	* 	@return 		void
693
-	*/
689
+	 * 	in some case it may be necessary to overwrite the existing success messages
690
+	 *
691
+	 *	@access public
692
+	 * 	@return 		void
693
+	 */
694 694
 	public static function overwrite_success() {
695 695
 		self::$_espresso_notices['success'] = FALSE;
696 696
 	}
@@ -700,11 +700,11 @@  discard block
 block discarded – undo
700 700
 
701 701
 
702 702
 	/**
703
-	* 	in some case it may be necessary to overwrite the existing attention messages
704
-	*
705
-	*	@access public
706
-	* 	@return 		void
707
-	*/
703
+	 * 	in some case it may be necessary to overwrite the existing attention messages
704
+	 *
705
+	 *	@access public
706
+	 * 	@return 		void
707
+	 */
708 708
 	public static function overwrite_attention() {
709 709
 		self::$_espresso_notices['attention'] = FALSE;
710 710
 	}
@@ -714,11 +714,11 @@  discard block
 block discarded – undo
714 714
 
715 715
 
716 716
 	/**
717
-	* 	in some case it may be necessary to overwrite the existing error messages
718
-	*
719
-	*	@access public
720
-	* 	@return 		void
721
-	*/
717
+	 * 	in some case it may be necessary to overwrite the existing error messages
718
+	 *
719
+	 *	@access public
720
+	 * 	@return 		void
721
+	 */
722 722
 	public static function overwrite_errors() {
723 723
 		self::$_espresso_notices['errors'] = FALSE;
724 724
 	}
@@ -726,24 +726,24 @@  discard block
 block discarded – undo
726 726
 
727 727
 
728 728
 	/**
729
-	*	reset_notices
730
-	*	@access private
731
-	*	@return void
732
-	*/
729
+	 *	reset_notices
730
+	 *	@access private
731
+	 *	@return void
732
+	 */
733 733
 	public static function reset_notices(){
734
-    	self::$_espresso_notices['success'] = FALSE;
735
-    	self::$_espresso_notices['attention'] = FALSE;
736
-    	self::$_espresso_notices['errors'] = FALSE;
737
-    }
734
+		self::$_espresso_notices['success'] = FALSE;
735
+		self::$_espresso_notices['attention'] = FALSE;
736
+		self::$_espresso_notices['errors'] = FALSE;
737
+	}
738 738
 
739 739
 
740 740
 
741 741
 	/**
742
-	*	has_errors
743
-	*	@access public
744
-	*	@return int
745
-	*/
746
-    public static function has_notices(){
742
+	 *	has_errors
743
+	 *	@access public
744
+	 *	@return int
745
+	 */
746
+	public static function has_notices(){
747 747
 		$has_notices = 0;
748 748
 		// check for success messages
749 749
 		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
@@ -774,15 +774,15 @@  discard block
 block discarded – undo
774 774
 
775 775
 
776 776
 	/**
777
-	* 	compile all error or success messages into one string
778
-	*	@see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them
779
-	*
780
-	*	@access public
781
-	* 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
782
-	* 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
783
-	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
784
-	* 	@return 		array
785
-	*/
777
+	 * 	compile all error or success messages into one string
778
+	 *	@see EE_Error::get_raw_notices if you want the raw notices without any preparations made to them
779
+	 *
780
+	 *	@access public
781
+	 * 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
782
+	 * 	@param		boolean		$save_to_transient	whether or not to save notices to the db for retrieval on next request - ONLY do this just before redirecting
783
+	 * 	@param		boolean		$remove_empty		whether or not to unset empty messages
784
+	 * 	@return 		array
785
+	 */
786 786
 	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
787 787
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
788 788
 
@@ -894,14 +894,14 @@  discard block
 block discarded – undo
894 894
 
895 895
 
896 896
 	/**
897
-	* 	add_persistent_admin_notice
898
-	*
899
-	*	@access 	public
900
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
901
-	* 	@param		string	$pan_message	the message to be stored persistently until dismissed
902
-	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
903
-	* 	@return 		void
904
-	*/
897
+	 * 	add_persistent_admin_notice
898
+	 *
899
+	 *	@access 	public
900
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
901
+	 * 	@param		string	$pan_message	the message to be stored persistently until dismissed
902
+	 * 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
903
+	 * 	@return 		void
904
+	 */
905 905
 	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
906 906
 		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
907 907
 			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
@@ -1064,11 +1064,11 @@  discard block
 block discarded – undo
1064 1064
 
1065 1065
 
1066 1066
 	/**
1067
-	* 	enqueue_error_scripts
1068
-	*
1069
-	*	@access public
1070
-	* 	@return 		void
1071
-	*/
1067
+	 * 	enqueue_error_scripts
1068
+	 *
1069
+	 *	@access public
1070
+	 * 	@return 		void
1071
+	 */
1072 1072
 	public static function enqueue_error_scripts() {
1073 1073
 		self::_print_scripts();
1074 1074
 	}
@@ -1076,15 +1076,15 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
 
1078 1078
 	/**
1079
-	*	create error code from filepath, function name,
1080
-	*	and line number where exception or error was thrown
1081
-	*
1082
-	*	@access public
1083
-	*	@param string $file
1084
-	*	@param string $func
1085
-	*	@param string $line
1086
-	*	@return string
1087
-	*/
1079
+	 *	create error code from filepath, function name,
1080
+	 *	and line number where exception or error was thrown
1081
+	 *
1082
+	 *	@access public
1083
+	 *	@param string $file
1084
+	 *	@param string $func
1085
+	 *	@param string $line
1086
+	 *	@return string
1087
+	 */
1088 1088
 	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1089 1089
 		$file = explode( '.', basename( $file ));
1090 1090
 		$error_code = ! empty( $file[0] ) ? $file[0] : '';
@@ -1098,13 +1098,13 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
 
1100 1100
 	/**
1101
-	*	write exception details to log file
1102
-	*
1103
-	*	@access public
1104
-	*	@ param timestamp $time
1105
-	*	@ param object $ex
1106
-	*	@ return void
1107
-	*/
1101
+	 *	write exception details to log file
1102
+	 *
1103
+	 *	@access public
1104
+	 *	@ param timestamp $time
1105
+	 *	@ param object $ex
1106
+	 *	@ return void
1107
+	 */
1108 1108
 	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1109 1109
 
1110 1110
 		if ( ! $ex ) {
Please login to merge, or discard this patch.
Spacing   +247 added lines, -247 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' ));
@@ -261,12 +261,12 @@  discard block
 block discarded – undo
261 261
 	 * @param bool $check_stored
262 262
 	 * @return bool
263 263
 	 */
264
-    public static function has_error( $check_stored = false ){
264
+    public static function has_error($check_stored = false) {
265 265
 	    $has_error = self::$_error_count ? true : false;
266
-	    if ( $check_stored && ! $has_error ) {
267
-		    $notices = (array) get_option( 'ee_notices', array() );
268
-		    foreach ( $notices as $type => $notice ) {
269
-			    if ( $type === 'errors' && $notice ) {
266
+	    if ($check_stored && ! $has_error) {
267
+		    $notices = (array) get_option('ee_notices', array());
268
+		    foreach ($notices as $type => $notice) {
269
+			    if ($type === 'errors' && $notice) {
270 270
 				    return true;
271 271
 			    }
272 272
 		    }
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	*	@access public
282 282
 	*	@echo string
283 283
 	*/
284
-    public function display_errors(){
284
+    public function display_errors() {
285 285
 
286 286
 		$trace_details = '';
287 287
 
@@ -342,18 +342,18 @@  discard block
 block discarded – undo
342 342
 </style>
343 343
 <div id="ee-error-message" class="error">';
344 344
 
345
-		if ( ! WP_DEBUG ) {
345
+		if ( ! WP_DEBUG) {
346 346
 			$output .= '
347 347
 	<p>';
348 348
 		}
349 349
 
350 350
 		// cycle thru errors
351
-		foreach ( self::$_all_exceptions as $time => $ex ) {
351
+		foreach (self::$_all_exceptions as $time => $ex) {
352 352
 
353 353
 			// process trace info
354
-			if ( empty( $ex['trace'] )) {
354
+			if (empty($ex['trace'])) {
355 355
 
356
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
356
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
357 357
 
358 358
 			} else {
359 359
 
@@ -368,50 +368,50 @@  discard block
 block discarded – undo
368 368
 					<th scope="col" align="left">Method( arguments )</th>
369 369
 				</tr>';
370 370
 
371
-				$last_on_stack = count( $ex['trace'] ) - 1;
371
+				$last_on_stack = count($ex['trace']) - 1;
372 372
 				// reverse array so that stack is in proper chronological order
373
-				$sorted_trace = array_reverse( $ex['trace'] );
373
+				$sorted_trace = array_reverse($ex['trace']);
374 374
 
375
-				foreach ( $sorted_trace as $nmbr => $trace ) {
375
+				foreach ($sorted_trace as $nmbr => $trace) {
376 376
 
377
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
378
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
379
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
380
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
381
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
382
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
377
+					$file = isset($trace['file']) ? $trace['file'] : '';
378
+					$class = isset($trace['class']) ? $trace['class'] : '';
379
+					$type = isset($trace['type']) ? $trace['type'] : '';
380
+					$function = isset($trace['function']) ? $trace['function'] : '';
381
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
382
+					$line = isset($trace['line']) ? $trace['line'] : '';
383 383
 					$zebra = $nmbr % 2 ? ' odd' : '';
384 384
 
385
-					if ( empty( $file ) && ! empty( $class )) {
386
-						$a = new ReflectionClass( $class );
385
+					if (empty($file) && ! empty($class)) {
386
+						$a = new ReflectionClass($class);
387 387
 						$file = $a->getFileName();
388
-						if ( empty( $line ) && ! empty( $function )) {
389
-							$b = new ReflectionMethod( $class, $function );
388
+						if (empty($line) && ! empty($function)) {
389
+							$b = new ReflectionMethod($class, $function);
390 390
 							$line = $b->getStartLine();
391 391
 						}
392 392
 					}
393 393
 
394
-					if ( $nmbr == $last_on_stack ) {
394
+					if ($nmbr == $last_on_stack) {
395 395
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
396 396
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
397
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
397
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
398 398
 					}
399 399
 
400
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
401
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
402
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
403
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
404
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
405
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
406
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
400
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
401
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
402
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
403
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
404
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
405
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
406
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
407 407
 
408 408
 		              $trace_details .= '
409 409
 					<tr>
410
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
411
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
412
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
413
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
414
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
410
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
411
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
412
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
413
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
414
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
415 415
 					</tr>';
416 416
 
417 417
 
@@ -426,9 +426,9 @@  discard block
 block discarded – undo
426 426
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
427 427
 
428 428
 			// add generic non-identifying messages for non-privileged uesrs
429
-			if ( ! WP_DEBUG ) {
429
+			if ( ! WP_DEBUG) {
430 430
 
431
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
431
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
432 432
 
433 433
 			} else {
434 434
 
@@ -436,24 +436,24 @@  discard block
 block discarded – undo
436 436
 				$output .= '
437 437
 		<div class="ee-error-dev-msg-dv">
438 438
 			<p class="ee-error-dev-msg-pg">
439
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
440
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
441
-				<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 . '">
442
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
439
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
440
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
441
+				<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.'">
442
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
443 443
 				</a><br />
444 444
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
445 445
 			</p>
446
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
446
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
447 447
 				' . $trace_details;
448 448
 
449
-				if ( ! empty( $class )) {
449
+				if ( ! empty($class)) {
450 450
 					$output .= '
451 451
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
452 452
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
453 453
 						<h3>Class Details</h3>';
454
-						$a = new ReflectionClass( $class );
454
+						$a = new ReflectionClass($class);
455 455
 						$output .= '
456
-						<pre>' . $a . '</pre>
456
+						<pre>' . $a.'</pre>
457 457
 					</div>
458 458
 				</div>';
459 459
 				}
@@ -465,14 +465,14 @@  discard block
 block discarded – undo
465 465
 
466 466
 			}
467 467
 
468
-			$this->write_to_error_log( $time, $ex );
468
+			$this->write_to_error_log($time, $ex);
469 469
 
470 470
 		}
471 471
 
472 472
 		// remove last linebreak
473
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
473
+		$output = substr($output, 0, (count($output) - 7));
474 474
 
475
-		if ( ! WP_DEBUG ) {
475
+		if ( ! WP_DEBUG) {
476 476
 			$output .= '
477 477
 	</p>';
478 478
 		}
@@ -480,10 +480,10 @@  discard block
 block discarded – undo
480 480
 		$output .= '
481 481
 </div>';
482 482
 
483
-		$output .= self::_print_scripts( TRUE );
483
+		$output .= self::_print_scripts(TRUE);
484 484
 
485
-		if ( defined( 'DOING_AJAX' )) {
486
-			echo json_encode( array( 'error' => $output ));
485
+		if (defined('DOING_AJAX')) {
486
+			echo json_encode(array('error' => $output));
487 487
 			exit();
488 488
 		}
489 489
 
@@ -503,29 +503,29 @@  discard block
 block discarded – undo
503 503
 	*	@ param array $arguments
504 504
 	*	@ return string
505 505
 	*/
506
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
506
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
507 507
 
508 508
 		$arg_string = '';
509
-		if ( ! empty( $arguments )) {
509
+		if ( ! empty($arguments)) {
510 510
 
511 511
 			$args = array();
512 512
 
513
-			foreach ( $arguments as $arg ) {
513
+			foreach ($arguments as $arg) {
514 514
 
515
-				if ( ! empty( $arg )) {
515
+				if ( ! empty($arg)) {
516 516
 
517
-					if ( is_string( $arg )) {
518
-						$args[] = " '" . $arg . "'";
519
-					} elseif ( is_array( $arg )) {
520
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
521
-					} elseif ( is_null( $arg )) {
517
+					if (is_string($arg)) {
518
+						$args[] = " '".$arg."'";
519
+					} elseif (is_array($arg)) {
520
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
521
+					} elseif (is_null($arg)) {
522 522
 						$args[] = ' NULL';
523
-					} elseif ( is_bool( $arg )) {
524
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
525
-					} elseif ( is_object( $arg )) {
526
-						$args[] = ' OBJECT ' . get_class( $arg );
527
-					} elseif ( is_resource( $arg )) {
528
-						$args[] = get_resource_type( $arg );
523
+					} elseif (is_bool($arg)) {
524
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
525
+					} elseif (is_object($arg)) {
526
+						$args[] = ' OBJECT '.get_class($arg);
527
+					} elseif (is_resource($arg)) {
528
+						$args[] = get_resource_type($arg);
529 529
 					} else {
530 530
 						$args[] = $arg;
531 531
 					}
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
 				}
534 534
 
535 535
 			}
536
-			$arg_string = implode( ', ', $args );
536
+			$arg_string = implode(', ', $args);
537 537
 		}
538
-		if ( $array ) {
538
+		if ($array) {
539 539
 			$arg_string .= ' )';
540 540
 		}
541 541
 		return $arg_string;
@@ -555,8 +555,8 @@  discard block
 block discarded – undo
555 555
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
556 556
 	* 	@return 		void
557 557
 	*/
558
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
559
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
558
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
559
+		self::_add_notice('errors', $msg, $file, $func, $line);
560 560
 		self::$_error_count++;
561 561
 	}
562 562
 
@@ -569,11 +569,11 @@  discard block
 block discarded – undo
569 569
 	 * @param string $line
570 570
 	 * @throws EE_Error
571 571
 	 */
572
-	public static function throw_exception_if_debugging( $msg = null, $file = null, $func = null, $line = null ) {
573
-		if( WP_DEBUG ) {
574
-			throw new EE_Error( $msg );
575
-		} else  {
576
-			EE_Error::add_error( $msg, $file, $func, $line );
572
+	public static function throw_exception_if_debugging($msg = null, $file = null, $func = null, $line = null) {
573
+		if (WP_DEBUG) {
574
+			throw new EE_Error($msg);
575
+		} else {
576
+			EE_Error::add_error($msg, $file, $func, $line);
577 577
 		}
578 578
 	}
579 579
 
@@ -591,8 +591,8 @@  discard block
 block discarded – undo
591 591
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
592 592
 	* 	@return 		void
593 593
 	*/
594
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
595
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
594
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
595
+		self::_add_notice('success', $msg, $file, $func, $line);
596 596
 	}
597 597
 
598 598
 
@@ -609,8 +609,8 @@  discard block
 block discarded – undo
609 609
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
610 610
 	* 	@return 		void
611 611
 	*/
612
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
613
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
612
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
613
+		self::_add_notice('attention', $msg, $file, $func, $line);
614 614
 	}
615 615
 
616 616
 
@@ -628,12 +628,12 @@  discard block
 block discarded – undo
628 628
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
629 629
 	* 	@return 		void
630 630
 	*/
631
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
632
-		if ( empty( $msg )) {
631
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
632
+		if (empty($msg)) {
633 633
 			EE_Error::doing_it_wrong(
634
-				'EE_Error::add_' . $type . '()',
634
+				'EE_Error::add_'.$type.'()',
635 635
 				sprintf(
636
-					__( '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' ),
636
+					__('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'),
637 637
 					$type,
638 638
 					$file,
639 639
 					$line
@@ -641,17 +641,17 @@  discard block
 block discarded – undo
641 641
 				EVENT_ESPRESSO_VERSION
642 642
 			);
643 643
 		}
644
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
644
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
645 645
 			EE_Error::doing_it_wrong(
646 646
 				'EE_Error::add_error()',
647
-				__('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' ),
647
+				__('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'),
648 648
 				EVENT_ESPRESSO_VERSION
649 649
 			);
650 650
 		}
651 651
 		// get separate user and developer messages if they exist
652
-		$msg = explode( '||', $msg );
652
+		$msg = explode('||', $msg);
653 653
 		$user_msg = $msg[0];
654
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
654
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
655 655
 		/**
656 656
 		 * Do an action so other code can be triggered when a notice is created
657 657
 		 * @param string $type can be 'errors', 'attention', or 'success'
@@ -661,22 +661,22 @@  discard block
 block discarded – undo
661 661
 		 * @param string $func function where error was generated
662 662
 		 * @param string $line line where error was generated
663 663
 		 */
664
-		do_action( 'AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line );
664
+		do_action('AHEE__EE_Error___add_notice', $type, $user_msg, $dev_msg, $file, $func, $line);
665 665
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
666 666
 		// add notice if message exists
667
-		if ( ! empty( $msg )) {
667
+		if ( ! empty($msg)) {
668 668
 			// get error code
669
-			$notice_code = EE_Error::generate_error_code( $file, $func, $line );
670
-			if ( WP_DEBUG && $type == 'errors' ) {
671
-				$msg .= '<br/><span class="tiny-text">' . $notice_code . '</span>';
669
+			$notice_code = EE_Error::generate_error_code($file, $func, $line);
670
+			if (WP_DEBUG && $type == 'errors') {
671
+				$msg .= '<br/><span class="tiny-text">'.$notice_code.'</span>';
672 672
 			}
673 673
 			// add notice. Index by code if it's not blank
674
-			if( $notice_code ) {
675
-				self::$_espresso_notices[ $type ][ $notice_code ] = $msg;
674
+			if ($notice_code) {
675
+				self::$_espresso_notices[$type][$notice_code] = $msg;
676 676
 			} else {
677
-				self::$_espresso_notices[ $type ][] = $msg;
677
+				self::$_espresso_notices[$type][] = $msg;
678 678
 			}
679
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
679
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
680 680
 		}
681 681
 
682 682
 	}
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	*	@access private
731 731
 	*	@return void
732 732
 	*/
733
-	public static function reset_notices(){
733
+	public static function reset_notices() {
734 734
     	self::$_espresso_notices['success'] = FALSE;
735 735
     	self::$_espresso_notices['attention'] = FALSE;
736 736
     	self::$_espresso_notices['errors'] = FALSE;
@@ -743,14 +743,14 @@  discard block
 block discarded – undo
743 743
 	*	@access public
744 744
 	*	@return int
745 745
 	*/
746
-    public static function has_notices(){
746
+    public static function has_notices() {
747 747
 		$has_notices = 0;
748 748
 		// check for success messages
749
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
749
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
750 750
 		// check for attention messages
751
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
751
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
752 752
 		// check for error messages
753
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
753
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
754 754
 		return $has_notices;
755 755
 	}
756 756
 
@@ -765,9 +765,9 @@  discard block
 block discarded – undo
765 765
 	 */
766 766
 	public static function get_vanilla_notices() {
767 767
 		return array(
768
-			'success' => isset( self::$_espresso_notices['success'] ) ? self::$_espresso_notices['success'] : array(),
769
-			'attention' => isset( self::$_espresso_notices['attention'] )  ? self::$_espresso_notices['attention'] : array(),
770
-			'errors' => isset( self::$_espresso_notices['errors'] ) ? self::$_espresso_notices['errors'] : array(),
768
+			'success' => isset(self::$_espresso_notices['success']) ? self::$_espresso_notices['success'] : array(),
769
+			'attention' => isset(self::$_espresso_notices['attention']) ? self::$_espresso_notices['attention'] : array(),
770
+			'errors' => isset(self::$_espresso_notices['errors']) ? self::$_espresso_notices['errors'] : array(),
771 771
 		);
772 772
 	}
773 773
 
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
784 784
 	* 	@return 		array
785 785
 	*/
786
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
787
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
786
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
787
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788 788
 
789 789
 		$success_messages = '';
790 790
 		$attention_messages = '';
@@ -794,44 +794,44 @@  discard block
 block discarded – undo
794 794
 		// 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' );
795 795
 
796 796
 		// either save notices to the db
797
-		if ( $save_to_transient ) {
798
-			update_option( 'ee_notices', self::$_espresso_notices );
797
+		if ($save_to_transient) {
798
+			update_option('ee_notices', self::$_espresso_notices);
799 799
 			return;
800 800
 		}
801 801
 		// grab any notices that have been previously saved
802
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
803
-			foreach ( $notices as $type => $notice ) {
804
-				if ( is_array( $notice ) && ! empty( $notice )) {
802
+		if ($notices = get_option('ee_notices', FALSE)) {
803
+			foreach ($notices as $type => $notice) {
804
+				if (is_array($notice) && ! empty($notice)) {
805 805
 					// make sure that existing notice type is an array
806
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
806
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
807 807
 					// merge stored notices with any newly created ones
808
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
808
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
809 809
 					$print_scripts = TRUE;
810 810
 				}
811 811
 			}
812 812
 			// now clear any stored notices
813
-			update_option( 'ee_notices', FALSE );
813
+			update_option('ee_notices', FALSE);
814 814
 		}
815 815
 
816 816
 		// check for success messages
817
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
817
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
818 818
 			// combine messages
819
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
819
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
820 820
 			$print_scripts = TRUE;
821 821
 		}
822 822
 
823 823
 		// check for attention messages
824
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
824
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
825 825
 			// combine messages
826
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
826
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
827 827
 			$print_scripts = TRUE;
828 828
 		}
829 829
 
830 830
 		// check for error messages
831
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
832
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
831
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
832
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
833 833
 			// combine messages
834
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
834
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
835 835
 			$print_scripts = TRUE;
836 836
 		}
837 837
 
@@ -845,21 +845,21 @@  discard block
 block discarded – undo
845 845
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
846 846
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
847 847
 				//showMessage( $success_messages );
848
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
848
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
849 849
 			}
850 850
 
851 851
 			if ($attention_messages != '') {
852 852
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
853 853
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
854 854
 				//showMessage( $error_messages, TRUE );
855
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
855
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
856 856
 			}
857 857
 
858 858
 			if ($error_messages != '') {
859 859
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
860 860
 				$css_class = is_admin() ? 'error' : 'error fade-away';
861 861
 				//showMessage( $error_messages, TRUE );
862
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
862
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
863 863
 			}
864 864
 
865 865
 			$notices .= '</div>';
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 					'errors' => $error_messages
873 873
 			);
874 874
 
875
-			if ( $remove_empty ) {
875
+			if ($remove_empty) {
876 876
 				// remove empty notices
877 877
 				foreach ($notices as $type => $notice) {
878 878
 					if (empty($notice)) {
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 			}
883 883
 		}
884 884
 
885
-		if ( $print_scripts ) {
885
+		if ($print_scripts) {
886 886
 			self::_print_scripts();
887 887
 		}
888 888
 
@@ -902,17 +902,17 @@  discard block
 block discarded – undo
902 902
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
903 903
 	* 	@return 		void
904 904
 	*/
905
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
906
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
907
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
905
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
906
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
907
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
908 908
 			//maybe initialize persistent_admin_notices
909
-			if ( empty( $persistent_admin_notices )) {
910
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
909
+			if (empty($persistent_admin_notices)) {
910
+				add_option('ee_pers_admin_notices', array(), '', 'no');
911 911
 			}
912
-			$pan_name = sanitize_key( $pan_name );
913
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
914
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
915
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
912
+			$pan_name = sanitize_key($pan_name);
913
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
914
+				$persistent_admin_notices[$pan_name] = $pan_message;
915
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
916 916
 			}
917 917
 		}
918 918
 	}
@@ -928,34 +928,34 @@  discard block
 block discarded – undo
928 928
 	 * @param bool          $return_immediately
929 929
 	 * @return        void
930 930
 	 */
931
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
932
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
933
-		if ( ! empty( $pan_name )) {
934
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
931
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
932
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
933
+		if ( ! empty($pan_name)) {
934
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
935 935
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
936
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
936
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
937 937
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
938
-				if ( $purge ) {
939
-					unset( $persistent_admin_notices[ $pan_name ] );
938
+				if ($purge) {
939
+					unset($persistent_admin_notices[$pan_name]);
940 940
 				} else {
941
-					$persistent_admin_notices[ $pan_name ] = NULL;
941
+					$persistent_admin_notices[$pan_name] = NULL;
942 942
 				}
943
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
944
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
943
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
944
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
945 945
 				}
946 946
 			}
947 947
 		}
948
-		if ( $return_immediately ) {
948
+		if ($return_immediately) {
949 949
 			return;
950
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
950
+		} else if (EE_Registry::instance()->REQ->ajax) {
951 951
 			// grab any notices and concatenate into string
952
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
952
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
953 953
 			exit();
954 954
 		} else {
955 955
 			// save errors to a transient to be displayed on next request (after redirect)
956
-			EE_Error::get_notices( FALSE, TRUE );
957
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
958
-			wp_safe_redirect( urldecode( $return_url ));
956
+			EE_Error::get_notices(FALSE, TRUE);
957
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
958
+			wp_safe_redirect(urldecode($return_url));
959 959
 		}
960 960
 	}
961 961
 
@@ -970,20 +970,20 @@  discard block
 block discarded – undo
970 970
 	 * @param  string $return_url  URL to go back to after nag notice is dismissed
971 971
 	 * @return string
972 972
 	 */
973
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
974
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
973
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
974
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
975 975
 			$args = array(
976 976
 				'nag_notice' => $pan_name,
977
-				'return_url' => urlencode( $return_url ),
977
+				'return_url' => urlencode($return_url),
978 978
 				'ajax_url' => WP_AJAX_URL,
979
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
979
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
980 980
 			);
981
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
981
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
982 982
 			return '
983
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
984
-				<p>' . $pan_message . '</p>
985
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
986
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
983
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
984
+				<p>' . $pan_message.'</p>
985
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
986
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
987 987
 				</a>
988 988
 				<div style="clear:both;"></div>
989 989
 			</div>';
@@ -1000,24 +1000,24 @@  discard block
 block discarded – undo
1000 1000
 	 * @param string $return_url
1001 1001
 	 * @return    array
1002 1002
 	 */
1003
-	public static function get_persistent_admin_notices( $return_url = '' ) {
1003
+	public static function get_persistent_admin_notices($return_url = '') {
1004 1004
 		$notices = '';
1005 1005
 		// check for persistent admin notices
1006 1006
 		//filter the list though so plugins can notify the admin in a different way if they want
1007 1007
 		$persistent_admin_notices = apply_filters(
1008 1008
 			'FHEE__EE_Error__get_persistent_admin_notices',
1009
-			get_option( 'ee_pers_admin_notices', FALSE ),
1009
+			get_option('ee_pers_admin_notices', FALSE),
1010 1010
 			'ee_pers_admin_notices',
1011 1011
 			$return_url
1012 1012
 		);
1013
-		if ( $persistent_admin_notices ) {
1013
+		if ($persistent_admin_notices) {
1014 1014
 			// load scripts
1015
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
1016
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
1017
-			wp_enqueue_script( 'ee_error_js' );
1015
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
1016
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
1017
+			wp_enqueue_script('ee_error_js');
1018 1018
 			// and display notices
1019
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
1020
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
1019
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
1020
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
1021 1021
 			}
1022 1022
 		}
1023 1023
 		return $notices;
@@ -1032,26 +1032,26 @@  discard block
 block discarded – undo
1032 1032
 	 * @param 	bool $force_print
1033 1033
 	 * @return 	void
1034 1034
 	 */
1035
-	private static function _print_scripts( $force_print = FALSE ) {
1036
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
1037
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
1035
+	private static function _print_scripts($force_print = FALSE) {
1036
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
1037
+			if (wp_script_is('ee_error_js', 'enqueued')) {
1038 1038
 				return;
1039
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
1040
-				add_filter( 'FHEE_load_css', '__return_true' );
1041
-				add_filter( 'FHEE_load_js', '__return_true' );
1042
-				wp_enqueue_script( 'ee_error_js' );
1043
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
1039
+			} else if (wp_script_is('ee_error_js', 'registered')) {
1040
+				add_filter('FHEE_load_css', '__return_true');
1041
+				add_filter('FHEE_load_js', '__return_true');
1042
+				wp_enqueue_script('ee_error_js');
1043
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
1044 1044
 			}
1045 1045
 		} else {
1046 1046
 			return '
1047 1047
 <script>
1048 1048
 /* <![CDATA[ */
1049
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
1049
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
1050 1050
 /* ]]> */
1051 1051
 </script>
1052
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
1053
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1054
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
1052
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
1053
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1054
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
1055 1055
 ';
1056 1056
 
1057 1057
 		}
@@ -1085,11 +1085,11 @@  discard block
 block discarded – undo
1085 1085
 	*	@param string $line
1086 1086
 	*	@return string
1087 1087
 	*/
1088
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1089
-		$file = explode( '.', basename( $file ));
1090
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1091
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1092
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1088
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1089
+		$file = explode('.', basename($file));
1090
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1091
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1092
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1093 1093
 		return $error_code;
1094 1094
 	}
1095 1095
 
@@ -1105,36 +1105,36 @@  discard block
 block discarded – undo
1105 1105
 	*	@ param object $ex
1106 1106
 	*	@ return void
1107 1107
 	*/
1108
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1108
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1109 1109
 
1110
-		if ( ! $ex ) {
1110
+		if ( ! $ex) {
1111 1111
 			return;
1112 1112
 		}
1113 1113
 
1114
-		if ( ! $time ) {
1114
+		if ( ! $time) {
1115 1115
 			$time = time();
1116 1116
 		}
1117 1117
 
1118
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1119
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1120
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1121
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1122
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1123
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1124
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1125
-		$exception_log .= $ex['string'] . PHP_EOL;
1126
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1118
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1119
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1120
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1121
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1122
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1123
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1124
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1125
+		$exception_log .= $ex['string'].PHP_EOL;
1126
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1127 1127
 
1128 1128
 		try {
1129
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1130
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' );
1131
-			if ( ! $clear ) {
1129
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1130
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs');
1131
+			if ( ! $clear) {
1132 1132
 				//get existing log file and append new log info
1133
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1133
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1134 1134
 			}
1135
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1136
-		} catch( EE_Error $e ){
1137
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1135
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1136
+		} catch (EE_Error $e) {
1137
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1138 1138
 			return;
1139 1139
 		}
1140 1140
 
@@ -1170,8 +1170,8 @@  discard block
 block discarded – undo
1170 1170
 		$applies_when = '',
1171 1171
 		$error_type = null
1172 1172
 	) {
1173
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1174
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $applies_when, $error_type );
1173
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1174
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $applies_when, $error_type);
1175 1175
 		}
1176 1176
 	}
1177 1177
 
@@ -1205,13 +1205,13 @@  discard block
 block discarded – undo
1205 1205
  */
1206 1206
 function espresso_error_enqueue_scripts() {
1207 1207
 	// js for error handling
1208
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1209
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1208
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1209
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1210 1210
 }
1211
-if ( is_admin() ) {
1212
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1211
+if (is_admin()) {
1212
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1213 1213
 } else {
1214
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1214
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1215 1215
 }
1216 1216
 
1217 1217
 
Please login to merge, or discard this patch.