Completed
Branch FET-8284-automagic-dependency-... (a299cf)
by
unknown
519:08 queued 506:02
created
core/EE_Deprecated.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -319,7 +319,7 @@
 block discarded – undo
319 319
 	}
320 320
 
321 321
 	/**
322
-	 * @param $method_name
322
+	 * @param string $method_name
323 323
 	 */
324 324
 	public static function doing_it_wrong_call( $method_name ) {
325 325
 		EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0.  All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED );
Please login to merge, or discard this patch.
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @param \EE_Checkout $checkout
14 14
  * @return string
15 15
  */
16
-function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) {
16
+function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) {
17 17
 	// list of old filters
18 18
 	$deprecated_filters = array(
19 19
 		'update_registration_details' => true,
@@ -23,16 +23,16 @@  discard block
 block discarded – undo
23 23
 		'proceed_to' => true,
24 24
 	);
25 25
 	// loop thru and call doing_it_wrong() or remove any that aren't being used
26
-	foreach ( $deprecated_filters as $deprecated_filter => $on ) {
26
+	foreach ($deprecated_filters as $deprecated_filter => $on) {
27 27
 		// was this filter called ?
28
-		if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) {
28
+		if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) {
29 29
 			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
30
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) {
30
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) {
31 31
 				EE_Error::doing_it_wrong(
32
-					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
32
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
33 33
 					sprintf(
34
-						__( 'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ),
35
-						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
34
+						__('The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'),
35
+						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
36 36
 						'<br />',
37 37
 						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
38 38
 						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
@@ -42,24 +42,24 @@  discard block
 block discarded – undo
42 42
 				);
43 43
 			}
44 44
 		} else {
45
-			unset( $deprecated_filters[ $deprecated_filter ] );
45
+			unset($deprecated_filters[$deprecated_filter]);
46 46
 		}
47 47
 	}
48
-	if ( ! empty( $deprecated_filters )) {
49
-
50
-		if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) {
51
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text );
52
-		} else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) {
53
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text );
54
-		} else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) {
55
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text );
48
+	if ( ! empty($deprecated_filters)) {
49
+
50
+		if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
51
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text);
52
+		} else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
53
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text);
54
+		} else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
55
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text);
56 56
 		}
57
-		if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
58
-			if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) {
59
-				$submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text );
57
+		if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
58
+			if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
59
+				$submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text);
60 60
 			}
61
-			if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) {
62
-				$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name();
61
+			if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
62
+				$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name();
63 63
 			}
64 64
 		}
65 65
 
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	return $submit_button_text;
68 68
 
69 69
 }
70
-add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 );
70
+add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2);
71 71
 
72 72
 
73 73
 
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
  * @param \EE_Checkout $checkout
79 79
  * @param boolean $status_updates
80 80
  */
81
-function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) {
81
+function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) {
82 82
 	$action_ref = NULL;
83
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
84
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
85
-	if ( $action_ref ) {
83
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
84
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
85
+	if ($action_ref) {
86 86
 
87 87
 		EE_Error::doing_it_wrong(
88 88
 			$action_ref,
89 89
 			sprintf(
90
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ),
90
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'),
91 91
 				'<br />',
92 92
 				'/core/business/EE_Transaction_Processor.class.php',
93 93
 				'AHEE__EE_Transaction_Processor__finalize',
@@ -98,29 +98,29 @@  discard block
 block discarded – undo
98 98
 			'4.6.0',
99 99
 			E_USER_DEPRECATED
100 100
 		);
101
-		switch ( $action_ref ) {
101
+		switch ($action_ref) {
102 102
 			case 'AHEE__EE_Transaction__finalize__new_transaction' :
103
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request );
103
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request);
104 104
 				break;
105 105
 			case 'AHEE__EE_Transaction__finalize__all_transaction' :
106
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request );
106
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request);
107 107
 				break;
108 108
 		}
109 109
 	}
110 110
 }
111
-add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 );
111
+add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2);
112 112
 /**
113 113
  * ee_deprecated_finalize_registration
114 114
  *
115 115
  * @param EE_Registration $registration
116 116
  */
117
-function ee_deprecated_finalize_registration( EE_Registration $registration ) {
118
-	$action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
119
-	if ( $action_ref ) {
117
+function ee_deprecated_finalize_registration(EE_Registration $registration) {
118
+	$action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
119
+	if ($action_ref) {
120 120
 		EE_Error::doing_it_wrong(
121 121
 			$action_ref,
122 122
 			sprintf(
123
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ),
123
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'),
124 124
 				'<br />',
125 125
 				'/core/business/EE_Registration_Processor.class.php',
126 126
 				'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 			'4.6.0',
129 129
 			E_USER_DEPRECATED
130 130
 		);
131
-		do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )));
131
+		do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)));
132 132
 	}
133 133
 }
134
-add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 );
134
+add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1);
135 135
 
136 136
 
137 137
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
  *
153 153
  * @return array
154 154
  */
155
-function ee_deprecated_get_templates( $templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack ) {
155
+function ee_deprecated_get_templates($templates, EE_messenger $messenger, EE_message_type $message_type, EE_Messages_Template_Pack $template_pack) {
156 156
 	$old_default_classnames = array(
157 157
 		'EE_Messages_Email_Cancelled_Registration_Defaults',
158 158
 		'EE_Messages_Email_Declined_Registration_Defaults',
@@ -168,23 +168,23 @@  discard block
 block discarded – undo
168 168
 
169 169
 	$old_class_instance = new stdClass();
170 170
 
171
-	foreach ( $old_default_classnames as $classname ) {
172
-		$filter_ref = 'FHEE__' . $classname . '___create_new_templates___templates';
173
-		if ( has_filter( $filter_ref ) ) {
174
-			EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED );
171
+	foreach ($old_default_classnames as $classname) {
172
+		$filter_ref = 'FHEE__'.$classname.'___create_new_templates___templates';
173
+		if (has_filter($filter_ref)) {
174
+			EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the new filter provided which is "FHEE__EE_Template_Pack___get_templates__templates" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED);
175 175
 		}
176
-		$templates = apply_filters( $filter_ref, $templates, $old_class_instance );
176
+		$templates = apply_filters($filter_ref, $templates, $old_class_instance);
177 177
 	}
178 178
 
179 179
 	return $templates;
180 180
 }
181
-add_filter( 'FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4 );
181
+add_filter('FHEE__EE_Template_Pack___get_templates__templates', 'ee_deprecated_get_templates', 10, 4);
182 182
 
183 183
 /**
184 184
  * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called.
185 185
  * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately.
186 186
  */
187
-function ee_deprecated_hooks(){
187
+function ee_deprecated_hooks() {
188 188
 	/**
189 189
 	 * @var $hooks array where keys are hook names, and their values are array{
190 190
 	 *			@type string $version  when deprecated
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 	$hooks = array(
196 196
 		'AHEE__EE_System___do_setup_validations' => array(
197 197
 			'version' => '4.6.0',
198
-			'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ),
198
+			'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'),
199 199
 			'still_works' => FALSE
200 200
 		)
201 201
 	);
202
-	foreach( $hooks as $name => $deprecation_info ){
203
-		if( has_action( $name ) ){
202
+	foreach ($hooks as $name => $deprecation_info) {
203
+		if (has_action($name)) {
204 204
 			EE_Error::doing_it_wrong(
205 205
 				$name,
206 206
 				sprintf(
207
-					__('This filter is deprecated. %1$s%2$s','event_espresso'),
208
-					$deprecation_info[ 'still_works' ] ?  __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ),
209
-					isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' )
207
+					__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
208
+					$deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'),
209
+					isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso')
210 210
 				),
211
-				isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' ),
211
+				isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso'),
212 212
 				E_USER_DEPRECATED
213 213
 			);
214 214
 		}
215 215
 	}
216 216
 }
217
-add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' );
217
+add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks');
218 218
 
219 219
 
220 220
 
@@ -237,25 +237,25 @@  discard block
 block discarded – undo
237 237
  *
238 238
  * @return string                    The default contents for the messenger, message type, context and field.
239 239
  */
240
-function ee_deprecated_get_default_field_content( $contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack ) {
240
+function ee_deprecated_get_default_field_content($contents, $actual_path, EE_messenger $messenger, EE_message_type $message_type, $field, $context, EE_Messages_Template_Pack $template_pack) {
241 241
 
242 242
 	$classnames_to_try = array(
243
-		get_class( $messenger ) => $messenger,
244
-		get_class( $message_type ) => $message_type,
243
+		get_class($messenger) => $messenger,
244
+		get_class($message_type) => $message_type,
245 245
 		'EE_Messages_Base' => $message_type
246 246
 		);
247 247
 
248
-	foreach ( $classnames_to_try as $classname => $obj ) {
249
-		$filter_ref = 'FHEE__' . $classname . '__get_default_field_content';
250
-		if ( has_filter( $filter_ref ) ) {
251
-			EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED );
248
+	foreach ($classnames_to_try as $classname => $obj) {
249
+		$filter_ref = 'FHEE__'.$classname.'__get_default_field_content';
250
+		if (has_filter($filter_ref)) {
251
+			EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_specific_template__contents" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED);
252 252
 		}
253
-		$contents = apply_filters( $filter_ref, $contents, $obj );
253
+		$contents = apply_filters($filter_ref, $contents, $obj);
254 254
 	}
255 255
 
256 256
 	return $contents;
257 257
 }
258
-add_filter( 'FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7 );
258
+add_filter('FHEE__EE_Messages_Template_Pack__get_specific_template__contents', 'ee_deprecated_get_default_field_content', 10, 7);
259 259
 
260 260
 
261 261
 
@@ -283,23 +283,23 @@  discard block
 block discarded – undo
283 283
  *
284 284
  * @return string                    The path to the file being used.
285 285
  */
286
-function ee_deprecated_get_inline_css_template_filters( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url,  EE_Messages_Template_Pack $template_pack ) {
286
+function ee_deprecated_get_inline_css_template_filters($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) {
287 287
 
288
-	if ( $messenger == 'email' ) {
288
+	if ($messenger == 'email') {
289 289
 		$filter_ref = $url ? 'FHEE__EE_Email_Messenger__get_inline_css_template__css_url' : 'FHEE__EE_Email_Messenger__get_inline_css_template__css_path';
290
-	} elseif ( $messenger == 'html' ) {
290
+	} elseif ($messenger == 'html') {
291 291
 		$filter_ref = $url ? 'FHEE__EE_Html_messenger__get_inline_css_template__css_url' : 'FHEE__EE_Html_messenger__get_inline_css_template__css_path';
292 292
 	} else {
293 293
 		return $variation_path;
294 294
 	}
295 295
 
296
-	if ( has_filter( $filter_ref ) ) {
297
-		EE_Error::doing_it_wrong( $filter_ref, __('This filter is deprecated.  It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED );
296
+	if (has_filter($filter_ref)) {
297
+		EE_Error::doing_it_wrong($filter_ref, __('This filter is deprecated.  It is recommended to use the new filter provided which is "FHEE__EE_Messages_Template_Pack__get_variation" found in the EE_Messages_Template_Pack class.', 'event_espresso'), '4.5.0', E_USER_DEPRECATED);
298 298
 	}
299 299
 
300
-	return apply_filters( $filter_ref, $variation_path, $url, $type );
300
+	return apply_filters($filter_ref, $variation_path, $url, $type);
301 301
 }
302
-add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8 );
302
+add_filter('FHEE__EE_Messages_Template_Pack__get_variation', 'ee_deprecated_get_inline_css_template_filters', 10, 8);
303 303
 
304 304
 
305 305
 
@@ -315,78 +315,78 @@  discard block
 block discarded – undo
315 315
 class EE_Messages_Init extends EE_Base {
316 316
 
317 317
 	public function __construct() {
318
-		self::doing_it_wrong_call( __METHOD__ );
318
+		self::doing_it_wrong_call(__METHOD__);
319 319
 	}
320 320
 
321 321
 	/**
322 322
 	 * @param $method_name
323 323
 	 */
324
-	public static function doing_it_wrong_call( $method_name ) {
325
-		EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0.  All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED );
324
+	public static function doing_it_wrong_call($method_name) {
325
+		EE_Error::doing_it_wrong(__CLASS__, sprintf(__('The %s in this class is deprecated as of EE4.5.0.  All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name), '4.5.0', E_USER_DEPRECATED);
326 326
 	}
327 327
 
328 328
 	/**
329 329
 	 * @deprecated 4.5.0
330 330
 	 */
331 331
 	public static function set_autoloaders() {
332
-		self::doing_it_wrong_call( __METHOD__ );
332
+		self::doing_it_wrong_call(__METHOD__);
333 333
 		EED_Messages::set_autoloaders();
334 334
 	}
335 335
 
336 336
 	/**
337 337
 	 * @deprecated 4.5.0
338 338
 	 */
339
-	public function payment_reminder( $transaction ) {
340
-		self::doing_it_wrong_call( __METHOD__ );
341
-		EED_Messages::payment_reminder( $transaction );
339
+	public function payment_reminder($transaction) {
340
+		self::doing_it_wrong_call(__METHOD__);
341
+		EED_Messages::payment_reminder($transaction);
342 342
 	}
343 343
 
344 344
 	/**
345 345
 	 * @deprecated 4.5.0
346 346
 	 */
347
-	public function payment( $transaction, $payment ) {
348
-		self::doing_it_wrong_call( __METHOD__ );
349
-		EED_Messages::payment( $transaction, $payment );
347
+	public function payment($transaction, $payment) {
348
+		self::doing_it_wrong_call(__METHOD__);
349
+		EED_Messages::payment($transaction, $payment);
350 350
 	}
351 351
 
352 352
 	/**
353 353
 	 * @deprecated 4.5.0
354 354
 	 */
355
-	public function cancelled_registration( $transaction ) {
356
-		self::doing_it_wrong_call( __METHOD__ );
357
-		EED_Messages::cancelled_registration( $transaction );
355
+	public function cancelled_registration($transaction) {
356
+		self::doing_it_wrong_call(__METHOD__);
357
+		EED_Messages::cancelled_registration($transaction);
358 358
 	}
359 359
 
360 360
 	/**
361 361
 	 * @deprecated 4.5.0
362 362
 	 */
363
-	public function maybe_registration( $transaction, $reg_msg, $from_admin ) {
364
-		self::doing_it_wrong_call( __METHOD__ );
365
-		EED_Messages::maybe_registration( $transaction, $reg_msg, $from_admin );
363
+	public function maybe_registration($transaction, $reg_msg, $from_admin) {
364
+		self::doing_it_wrong_call(__METHOD__);
365
+		EED_Messages::maybe_registration($transaction, $reg_msg, $from_admin);
366 366
 	}
367 367
 
368 368
 	/**
369 369
 	 * @deprecated 4.5.0
370 370
 	 */
371
-	public function process_resend( $success, $req_data ) {
372
-		self::doing_it_wrong_call( __METHOD__ );
373
-		EED_Messages::process_resend( $req_data );
371
+	public function process_resend($success, $req_data) {
372
+		self::doing_it_wrong_call(__METHOD__);
373
+		EED_Messages::process_resend($req_data);
374 374
 	}
375 375
 
376 376
 	/**
377 377
 	 * @deprecated 4.5.0
378 378
 	 */
379
-	public function process_admin_payment( $success, $payment ) {
380
-		self::doing_it_wrong_call( __METHOD__ );
381
-		EED_Messages::process_admin_payment( $success, $payment );
379
+	public function process_admin_payment($success, $payment) {
380
+		self::doing_it_wrong_call(__METHOD__);
381
+		EED_Messages::process_admin_payment($success, $payment);
382 382
 	}
383 383
 
384 384
 	/**
385 385
 	 * @deprecated 4.5.0
386 386
 	 */
387
-	public function send_newsletter_message( $contacts, $grp_id ) {
388
-		self::doing_it_wrong_call( __METHOD__ );
389
-		EED_Messages::send_newsletter_message( $contacts, $grp_id );
387
+	public function send_newsletter_message($contacts, $grp_id) {
388
+		self::doing_it_wrong_call(__METHOD__);
389
+		EED_Messages::send_newsletter_message($contacts, $grp_id);
390 390
 	}
391 391
 
392 392
 
@@ -407,13 +407,13 @@  discard block
 block discarded – undo
407 407
  *
408 408
  * @return array additional cpts.
409 409
  */
410
-function ee_deprecated_get_cpts( $cpts ) {
411
-	if ( has_filter( 'FHEE__EE_Register_CPTs__construct__CPTs' ) ) {
412
-		EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being.  However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED );
410
+function ee_deprecated_get_cpts($cpts) {
411
+	if (has_filter('FHEE__EE_Register_CPTs__construct__CPTs')) {
412
+		EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__CPTs', __('This filter is deprecated. It will still work for the time being.  However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_CPTs__cpts" found in EE_Register_CPTs::get_CPTs()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED);
413 413
 	}
414
-	return apply_filters( 'FHEE__EE_Register_CPTs__construct__CPTs', $cpts );
414
+	return apply_filters('FHEE__EE_Register_CPTs__construct__CPTs', $cpts);
415 415
 }
416
-add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10 );
416
+add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', 'ee_deprecated_get_cpts', 10);
417 417
 
418 418
 
419 419
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
  *
428 428
  * @return array additional custom taxonomies.
429 429
  */
430
-function ee_deprecated_get_taxonomies( $cts ) {
431
-	if ( has_filter( 'FHEE__EE_Register_CPTs__construct__taxonomies' ) ) {
432
-		EE_Error::doing_it_wrong( 'FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being.  However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED );
430
+function ee_deprecated_get_taxonomies($cts) {
431
+	if (has_filter('FHEE__EE_Register_CPTs__construct__taxonomies')) {
432
+		EE_Error::doing_it_wrong('FHEE__EE_Register_CPTs__construct__taxonomies', __('This filter is deprecated. It will still work for the time being.  However, it is recommended to use the new filter provided which is "FHEE__EE_Register_CPTs__get_taxonomies__taxonomies" found in EE_Register_CPTs::get_taxonomies()', 'event_espresso'), '4.5.0', E_USER_DEPRECATED);
433 433
 	}
434
-	return apply_filters( 'FHEE__EE_Register_CPTs__construct__taxonomies', $cts );
434
+	return apply_filters('FHEE__EE_Register_CPTs__construct__taxonomies', $cts);
435 435
 }
436
-add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10 );
436
+add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', 'ee_deprecated_get_taxonomies', 10);
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
  * @subpackage plugin api, messages
6 6
  * @since           4.5.0
7 7
  */
8
-if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
8
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
9
+	exit('No direct script access allowed');
10
+}
9 11
 
10 12
 /**
11 13
  * Use this to register or deregister a new message template pack variation for the EE messages system.
Please login to merge, or discard this patch.
core/EE_Error.core.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	/**
89 89
 	 *    error_handler
90 90
 	 * @access public
91
-	 * @param $code
91
+	 * @param integer $code
92 92
 	 * @param $message
93 93
 	 * @param $file
94 94
 	 * @param $line
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	/**
190 190
 	 *    _format_error
191 191
 	 * @access private
192
-	 * @param $code
192
+	 * @param string $code
193 193
 	 * @param $message
194 194
 	 * @param $file
195 195
 	 * @param $line
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 	 *
937 937
 	 * @access    public
938 938
 	 * @param string $return_url
939
-	 * @return    array
939
+	 * @return    string
940 940
 	 */
941 941
 	public static function get_persistent_admin_notices( $return_url = '' ) {
942 942
 		$notices = '';
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
 	 *
962 962
 	 * @access 	public
963 963
 	 * @param 	bool $force_print
964
-	 * @return 	void
964
+	 * @return 	null|string
965 965
 	 */
966 966
 	private static function _print_scripts( $force_print = FALSE ) {
967 967
 		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 // if you're a dev and want to receive all errors via email add this to your wp-config.php: define( 'EE_ERROR_EMAILS', TRUE );
3
-if ( defined( 'WP_DEBUG' ) && WP_DEBUG === TRUE && defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS === TRUE ) {
4
-	set_error_handler( array( 'EE_Error', 'error_handler' ));
5
-	register_shutdown_function( array( 'EE_Error', 'fatal_error_handler' ));
3
+if (defined('WP_DEBUG') && WP_DEBUG === TRUE && defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS === TRUE) {
4
+	set_error_handler(array('EE_Error', 'error_handler'));
5
+	register_shutdown_function(array('EE_Error', 'fatal_error_handler'));
6 6
 }
7 7
 /**
8 8
  *
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	* 	@access	private
65 65
     *	@var boolean
66 66
 	*/
67
-	private static $_espresso_notices = array( 'success' => FALSE, 'errors' => FALSE, 'attention' => FALSE );
67
+	private static $_espresso_notices = array('success' => FALSE, 'errors' => FALSE, 'attention' => FALSE);
68 68
 
69 69
 
70 70
 
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
 	*	@access public
76 76
 	*	@echo string
77 77
 	*/
78
-	function __construct( $message, $code = 0, Exception $previous = NULL ) {
79
-		if ( version_compare( phpversion(), '5.3.0', '<' )) {
80
-			parent::__construct( $message, $code );
78
+	function __construct($message, $code = 0, Exception $previous = NULL) {
79
+		if (version_compare(phpversion(), '5.3.0', '<')) {
80
+			parent::__construct($message, $code);
81 81
 		} else {
82
-			parent::__construct( $message, $code, $previous );
82
+			parent::__construct($message, $code, $previous);
83 83
 		}
84 84
 	}
85 85
 
@@ -94,10 +94,10 @@  discard block
 block discarded – undo
94 94
 	 * @param $line
95 95
 	 * @return void
96 96
 	 */
97
-	public static function error_handler( $code, $message, $file, $line ) {
98
-		$type = EE_Error::error_type( $code );
97
+	public static function error_handler($code, $message, $file, $line) {
98
+		$type = EE_Error::error_type($code);
99 99
 		$site = site_url();
100
-		switch ( $site ) {
100
+		switch ($site) {
101 101
 			case 'http://ee4.eventespresso.com/' :
102 102
 			case 'http://ee4decaf.eventespresso.com/' :
103 103
 			case 'http://ee4hf.eventespresso.com/' :
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 				$to = '[email protected]';
111 111
 				break;
112 112
 			default :
113
-				$to = get_option( 'admin_email' );
113
+				$to = get_option('admin_email');
114 114
 		}
115
-		$subject = $type . ' ' . $message . ' in ' . EVENT_ESPRESSO_VERSION . ' on ' . site_url();
116
-		$msg = EE_Error::_format_error( $type, $message, $file, $line );
117
-		if ( function_exists( 'wp_mail' )) {
118
-			add_filter( 'wp_mail_content_type', array( 'EE_Error', 'set_content_type' ));
119
-			wp_mail( $to, $subject, $msg );
115
+		$subject = $type.' '.$message.' in '.EVENT_ESPRESSO_VERSION.' on '.site_url();
116
+		$msg = EE_Error::_format_error($type, $message, $file, $line);
117
+		if (function_exists('wp_mail')) {
118
+			add_filter('wp_mail_content_type', array('EE_Error', 'set_content_type'));
119
+			wp_mail($to, $subject, $msg);
120 120
 		}
121 121
 		echo '<div id="message" class="espresso-notices error"><p>';
122
-		echo $type . ': ' . $message . '<br />' . $file . ' line ' . $line;
122
+		echo $type.': '.$message.'<br />'.$file.' line '.$line;
123 123
 		echo '<br /></p></div>';
124 124
 	}
125 125
 
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
 	 * @param $code
133 133
 	 * @return string
134 134
 	 */
135
-	public static function error_type( $code ) {
136
-		switch( $code ) {
135
+	public static function error_type($code) {
136
+		switch ($code) {
137 137
 			case E_ERROR: // 1 //
138 138
 			return 'E_ERROR';
139 139
 			case E_WARNING: // 2 //
@@ -179,8 +179,8 @@  discard block
 block discarded – undo
179 179
 	*/
180 180
 	public static function fatal_error_handler() {
181 181
 		$last_error = error_get_last();
182
-		if ( $last_error['type'] === E_ERROR ) {
183
-			EE_Error::error_handler( E_ERROR, $last_error['message'], $last_error['file'], $last_error['line'] );
182
+		if ($last_error['type'] === E_ERROR) {
183
+			EE_Error::error_handler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
184 184
 		}
185 185
 	}
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 	 * @param $line
196 196
 	 * @return string
197 197
 	 */
198
-	private static function _format_error( $code, $message, $file, $line ) {
198
+	private static function _format_error($code, $message, $file, $line) {
199 199
 		$html  = "<table cellpadding='5'><thead bgcolor='#f8f8f8'><th>Item</th><th align='left'>Details</th></thead><tbody>";
200 200
 		$html .= "<tr valign='top'><td><b>Code</b></td><td>$code</td></tr>";
201 201
 		$html .= "<tr valign='top'><td><b>Error</b></td><td>$message</td></tr>";
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	 * @param $content_type
214 214
 	 * @return string
215 215
 	 */
216
-	public static function set_content_type( $content_type ) {
216
+	public static function set_content_type($content_type) {
217 217
 		return 'text/html';
218 218
 	}
219 219
 
@@ -227,24 +227,24 @@  discard block
 block discarded – undo
227 227
 	*/
228 228
     public function get_error() {
229 229
 
230
-		if( apply_filters( 'FHEE__EE_Error__get_error__show_normal_exceptions', FALSE ) ){
230
+		if (apply_filters('FHEE__EE_Error__get_error__show_normal_exceptions', FALSE)) {
231 231
 			throw $this;
232 232
 		}
233 233
 		// get separate user and developer messages if they exist
234
-		$msg = explode( '||', $this->getMessage() );
234
+		$msg = explode('||', $this->getMessage());
235 235
 		$user_msg = $msg[0];
236
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
236
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
237 237
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
238 238
 
239 239
 		// add details to _all_exceptions array
240 240
 		$x_time = time();
241
-		self::$_all_exceptions[ $x_time ]['name'] 	= get_class( $this );
242
-		self::$_all_exceptions[ $x_time ]['file'] 		= $this->getFile();
243
-		self::$_all_exceptions[ $x_time ]['line'] 		= $this->getLine();
244
-		self::$_all_exceptions[ $x_time ]['msg'] 	= $msg;
245
-		self::$_all_exceptions[ $x_time ]['code'] 	= $this->getCode();
246
-		self::$_all_exceptions[ $x_time ]['trace'] 	= $this->getTrace();
247
-		self::$_all_exceptions[ $x_time ]['string'] 	= $this->getTraceAsString();
241
+		self::$_all_exceptions[$x_time]['name'] = get_class($this);
242
+		self::$_all_exceptions[$x_time]['file'] 		= $this->getFile();
243
+		self::$_all_exceptions[$x_time]['line'] 		= $this->getLine();
244
+		self::$_all_exceptions[$x_time]['msg'] = $msg;
245
+		self::$_all_exceptions[$x_time]['code'] = $this->getCode();
246
+		self::$_all_exceptions[$x_time]['trace'] 	= $this->getTrace();
247
+		self::$_all_exceptions[$x_time]['string'] = $this->getTraceAsString();
248 248
 		self::$_error_count++;
249 249
 
250 250
 		//add_action( 'shutdown', array( $this, 'display_errors' ));
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	*	@access public
260 260
 	*	@return boolean
261 261
 	*/
262
-    public static function has_error(){
262
+    public static function has_error() {
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	*	@access public
271 271
 	*	@echo string
272 272
 	*/
273
-    public function display_errors(){
273
+    public function display_errors() {
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -331,18 +331,18 @@  discard block
 block discarded – undo
331 331
 </style>
332 332
 <div id="ee-error-message" class="error">';
333 333
 
334
-		if ( ! WP_DEBUG ) {
334
+		if ( ! WP_DEBUG) {
335 335
 			$output .= '
336 336
 	<p>';
337 337
 		}
338 338
 
339 339
 		// cycle thru errors
340
-		foreach ( self::$_all_exceptions as $time => $ex ) {
340
+		foreach (self::$_all_exceptions as $time => $ex) {
341 341
 
342 342
 			// process trace info
343
-			if ( empty( $ex['trace'] )) {
343
+			if (empty($ex['trace'])) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+	            $trace_details .= __('Sorry, but no trace information was available for this exception.', 'event_espresso');
346 346
 
347 347
 			} else {
348 348
 
@@ -357,50 +357,50 @@  discard block
 block discarded – undo
357 357
 					<th scope="col" align="left">Method( arguments )</th>
358 358
 				</tr>';
359 359
 
360
-				$last_on_stack = count( $ex['trace'] ) - 1;
360
+				$last_on_stack = count($ex['trace']) - 1;
361 361
 				// reverse array so that stack is in proper chronological order
362
-				$sorted_trace = array_reverse( $ex['trace'] );
362
+				$sorted_trace = array_reverse($ex['trace']);
363 363
 
364
-				foreach ( $sorted_trace as $nmbr => $trace ) {
364
+				foreach ($sorted_trace as $nmbr => $trace) {
365 365
 
366
-					$file = isset( $trace['file'] ) ? $trace['file'] : '' ;
367
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
368
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
369
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
370
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
371
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
366
+					$file = isset($trace['file']) ? $trace['file'] : '';
367
+					$class = isset($trace['class']) ? $trace['class'] : '';
368
+					$type = isset($trace['type']) ? $trace['type'] : '';
369
+					$function = isset($trace['function']) ? $trace['function'] : '';
370
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
371
+					$line = isset($trace['line']) ? $trace['line'] : '';
372 372
 					$zebra = $nmbr % 2 ? ' odd' : '';
373 373
 
374
-					if ( empty( $file ) && ! empty( $class )) {
375
-						$a = new ReflectionClass( $class );
374
+					if (empty($file) && ! empty($class)) {
375
+						$a = new ReflectionClass($class);
376 376
 						$file = $a->getFileName();
377
-						if ( empty( $line ) && ! empty( $function )) {
378
-							$b = new ReflectionMethod( $class, $function );
377
+						if (empty($line) && ! empty($function)) {
378
+							$b = new ReflectionMethod($class, $function);
379 379
 							$line = $b->getStartLine();
380 380
 						}
381 381
 					}
382 382
 
383
-					if ( $nmbr == $last_on_stack ) {
383
+					if ($nmbr == $last_on_stack) {
384 384
 						$file = $ex['file'] != '' ? $ex['file'] : $file;
385 385
 						$line = $ex['line'] != '' ? $ex['line'] : $line;
386
-						$error_code = self::generate_error_code ( $file, $trace['function'], $line );
386
+						$error_code = self::generate_error_code($file, $trace['function'], $line);
387 387
 					}
388 388
 
389
-					$nmbr_dsply = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
390
-					$line_dsply = ! empty( $line ) ? $line : '&nbsp;';
391
-					$file_dsply = ! empty( $file ) ? $file : '&nbsp;';
392
-					$class_dsply = ! empty( $class ) ? $class : '&nbsp;';
393
-					$type_dsply = ! empty( $type ) ? $type : '&nbsp;';
394
-					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395
-					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
389
+					$nmbr_dsply = ! empty($nmbr) ? $nmbr : '&nbsp;';
390
+					$line_dsply = ! empty($line) ? $line : '&nbsp;';
391
+					$file_dsply = ! empty($file) ? $file : '&nbsp;';
392
+					$class_dsply = ! empty($class) ? $class : '&nbsp;';
393
+					$type_dsply = ! empty($type) ? $type : '&nbsp;';
394
+					$function_dsply = ! empty($function) ? $function : '&nbsp;';
395
+					$args_dsply = ! empty($args) ? '( '.$args.' )' : '';
396 396
 
397 397
 		              $trace_details .= '
398 398
 					<tr>
399
-						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400
-						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
401
-						<td align="left" class="' . $zebra . '">' . $file_dsply . '</td>
402
-						<td align="left" class="' . $zebra . '">' . $class_dsply . '</td>
403
-						<td align="left" class="' . $zebra . '">' . $type_dsply . $function_dsply . $args_dsply . '</td>
399
+						<td align="right" class="' . $zebra.'">'.$nmbr_dsply.'</td>
400
+						<td align="right" class="' . $zebra.'">'.$line_dsply.'</td>
401
+						<td align="left" class="' . $zebra.'">'.$file_dsply.'</td>
402
+						<td align="left" class="' . $zebra.'">'.$class_dsply.'</td>
403
+						<td align="left" class="' . $zebra.'">'.$type_dsply.$function_dsply.$args_dsply.'</td>
404 404
 					</tr>';
405 405
 
406 406
 
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
 			$ex['code'] = $ex['code'] ? $ex['code'] : $error_code;
416 416
 
417 417
 			// add generic non-identifying messages for non-privileged uesrs
418
-			if ( ! WP_DEBUG ) {
418
+			if ( ! WP_DEBUG) {
419 419
 
420
-				$output .= '<span class="ee-error-user-msg-spn">' . trim( $ex['msg'] )  . '</span> &nbsp; <sup>' . $ex['code'] . '</sup><br />';
420
+				$output .= '<span class="ee-error-user-msg-spn">'.trim($ex['msg']).'</span> &nbsp; <sup>'.$ex['code'].'</sup><br />';
421 421
 
422 422
 			} else {
423 423
 
@@ -425,24 +425,24 @@  discard block
 block discarded – undo
425 425
 				$output .= '
426 426
 		<div class="ee-error-dev-msg-dv">
427 427
 			<p class="ee-error-dev-msg-pg">
428
-				<strong class="ee-error-dev-msg-str">An ' . $ex['name'] . ' exception was thrown!</strong>  &nbsp; <span>code: ' . $ex['code'] . '</span><br />
429
-				<span class="big-text">"' . trim( $ex['msg'] ) . '"</span><br/>
430
-				<a id="display-ee-error-trace-' . self::$_error_count . $time . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-' . self::$_error_count . $time . '">
431
-					' . __( 'click to view backtrace and class/method details', 'event_espresso' ) . '
428
+				<strong class="ee-error-dev-msg-str">An ' . $ex['name'].' exception was thrown!</strong>  &nbsp; <span>code: '.$ex['code'].'</span><br />
429
+				<span class="big-text">"' . trim($ex['msg']).'"</span><br/>
430
+				<a id="display-ee-error-trace-' . self::$_error_count.$time.'" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-'.self::$_error_count.$time.'">
431
+					' . __('click to view backtrace and class/method details', 'event_espresso').'
432 432
 				</a><br />
433 433
 				<span class="small-text lt-grey-text">'.$ex['file'].' &nbsp; ( line no: '.$ex['line'].' )</span>
434 434
 			</p>
435
-			<div id="ee-error-trace-' . self::$_error_count . $time . '-dv" class="ee-error-trace-dv" style="display: none;">
435
+			<div id="ee-error-trace-' . self::$_error_count.$time.'-dv" class="ee-error-trace-dv" style="display: none;">
436 436
 				' . $trace_details;
437 437
 
438
-				if ( ! empty( $class )) {
438
+				if ( ! empty($class)) {
439 439
 					$output .= '
440 440
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #666; background:#fff; border-radius:3px;">
441 441
 					<div style="padding:1em 2em; border:1px solid #666; background:#f9f9f9;">
442 442
 						<h3>Class Details</h3>';
443
-						$a = new ReflectionClass( $class );
443
+						$a = new ReflectionClass($class);
444 444
 						$output .= '
445
-						<pre>' . $a . '</pre>
445
+						<pre>' . $a.'</pre>
446 446
 					</div>
447 447
 				</div>';
448 448
 				}
@@ -454,14 +454,14 @@  discard block
 block discarded – undo
454 454
 
455 455
 			}
456 456
 
457
-			$this->write_to_error_log( $time, $ex );
457
+			$this->write_to_error_log($time, $ex);
458 458
 
459 459
 		}
460 460
 
461 461
 		// remove last linebreak
462
-		$output = substr( $output, 0, ( count( $output ) - 7 ));
462
+		$output = substr($output, 0, (count($output) - 7));
463 463
 
464
-		if ( ! WP_DEBUG ) {
464
+		if ( ! WP_DEBUG) {
465 465
 			$output .= '
466 466
 	</p>';
467 467
 		}
@@ -469,10 +469,10 @@  discard block
 block discarded – undo
469 469
 		$output .= '
470 470
 </div>';
471 471
 
472
-		$output .= self::_print_scripts( TRUE );
472
+		$output .= self::_print_scripts(TRUE);
473 473
 
474
-		if ( defined( 'DOING_AJAX' )) {
475
-			echo json_encode( array( 'error' => $output ));
474
+		if (defined('DOING_AJAX')) {
475
+			echo json_encode(array('error' => $output));
476 476
 			exit();
477 477
 		}
478 478
 
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 	*	@ param array $arguments
493 493
 	*	@ return string
494 494
 	*/
495
-	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
495
+	private function _convert_args_to_string($arguments = array(), $array = FALSE) {
496 496
 
497 497
 		$arg_string = '';
498
-		if ( ! empty( $arguments )) {
498
+		if ( ! empty($arguments)) {
499 499
 
500 500
 			$args = array();
501 501
 
502
-			foreach ( $arguments as $arg ) {
502
+			foreach ($arguments as $arg) {
503 503
 
504
-				if ( ! empty( $arg )) {
504
+				if ( ! empty($arg)) {
505 505
 
506
-					if ( is_string( $arg )) {
507
-						$args[] = " '" . $arg . "'";
508
-					} elseif ( is_array( $arg )) {
509
-						$args[] = 'ARRAY(' . $this->_convert_args_to_string( $arg, TRUE );
510
-					} elseif ( is_null( $arg )) {
506
+					if (is_string($arg)) {
507
+						$args[] = " '".$arg."'";
508
+					} elseif (is_array($arg)) {
509
+						$args[] = 'ARRAY('.$this->_convert_args_to_string($arg, TRUE);
510
+					} elseif (is_null($arg)) {
511 511
 						$args[] = ' NULL';
512
-					} elseif ( is_bool( $arg )) {
513
-						$args[] = ( $arg ) ? ' TRUE' : ' FALSE';
514
-					} elseif ( is_object( $arg )) {
515
-						$args[] = ' OBJECT ' . get_class( $arg );
516
-					} elseif ( is_resource( $arg )) {
517
-						$args[] = get_resource_type( $arg );
512
+					} elseif (is_bool($arg)) {
513
+						$args[] = ($arg) ? ' TRUE' : ' FALSE';
514
+					} elseif (is_object($arg)) {
515
+						$args[] = ' OBJECT '.get_class($arg);
516
+					} elseif (is_resource($arg)) {
517
+						$args[] = get_resource_type($arg);
518 518
 					} else {
519 519
 						$args[] = $arg;
520 520
 					}
@@ -522,9 +522,9 @@  discard block
 block discarded – undo
522 522
 				}
523 523
 
524 524
 			}
525
-			$arg_string = implode( ', ', $args );
525
+			$arg_string = implode(', ', $args);
526 526
 		}
527
-		if ( $array ) {
527
+		if ($array) {
528 528
 			$arg_string .= ' )';
529 529
 		}
530 530
 		return $arg_string;
@@ -544,8 +544,8 @@  discard block
 block discarded – undo
544 544
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545 545
 	* 	@return 		void
546 546
 	*/
547
-	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548
-		self::_add_notice ( 'errors', $msg, $file, $func, $line );
547
+	public static function add_error($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
548
+		self::_add_notice('errors', $msg, $file, $func, $line);
549 549
 		self::$_error_count++;
550 550
 	}
551 551
 
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564 564
 	* 	@return 		void
565 565
 	*/
566
-	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567
-		self::_add_notice ( 'success', $msg, $file, $func, $line );
566
+	public static function add_success($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
567
+		self::_add_notice('success', $msg, $file, $func, $line);
568 568
 	}
569 569
 
570 570
 
@@ -581,8 +581,8 @@  discard block
 block discarded – undo
581 581
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582 582
 	* 	@return 		void
583 583
 	*/
584
-	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585
-		self::_add_notice ( 'attention', $msg, $file, $func, $line );
584
+	public static function add_attention($msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
585
+		self::_add_notice('attention', $msg, $file, $func, $line);
586 586
 	}
587 587
 
588 588
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601 601
 	* 	@return 		void
602 602
 	*/
603
-	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604
-		if ( empty( $msg )) {
603
+	private static function _add_notice($type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL) {
604
+		if (empty($msg)) {
605 605
 			EE_Error::doing_it_wrong(
606
-				'EE_Error::add_' . $type . '()',
606
+				'EE_Error::add_'.$type.'()',
607 607
 				sprintf(
608
-					__( 'Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso' ),
608
+					__('Notifications are not much use without a message! Please add a message to the EE_Error::add_%s() call made in %s on line %d', 'event_espresso'),
609 609
 					$type,
610 610
 					$file,
611 611
 					$line
@@ -613,27 +613,27 @@  discard block
 block discarded – undo
613 613
 				EVENT_ESPRESSO_VERSION
614 614
 			);
615 615
 		}
616
-		if ( $type == 'errors' && ( empty( $file ) || empty( $func ) || empty( $line ))) {
616
+		if ($type == 'errors' && (empty($file) || empty($func) || empty($line))) {
617 617
 			EE_Error::doing_it_wrong(
618 618
 				'EE_Error::add_error()',
619
-				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso' ),
619
+				__('You need to provide the file name, function name, and line number that the error occurred on in order to better assist with debugging.', 'event_espresso'),
620 620
 				EVENT_ESPRESSO_VERSION
621 621
 			);
622 622
 		}
623 623
 		// get separate user and developer messages if they exist
624
-		$msg = explode( '||', $msg );
624
+		$msg = explode('||', $msg);
625 625
 		$user_msg = $msg[0];
626
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
626
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
627 627
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
628 628
 		// add notice if message exists
629
-		if ( ! empty( $msg )) {
629
+		if ( ! empty($msg)) {
630 630
 			// get error code, but only on error
631
-			if ( WP_DEBUG && $type == 'errors' ) {
632
-				$msg .= '<br/><span class="tiny-text">' . EE_Error::generate_error_code( $file, $func, $line ) . '</span>';
631
+			if (WP_DEBUG && $type == 'errors') {
632
+				$msg .= '<br/><span class="tiny-text">'.EE_Error::generate_error_code($file, $func, $line).'</span>';
633 633
 			}
634 634
 			// add notice
635
-			self::$_espresso_notices[ $type ][] = $msg;
636
-			add_action( 'wp_footer', array( 'EE_Error', 'enqueue_error_scripts' ), 1 );
635
+			self::$_espresso_notices[$type][] = $msg;
636
+			add_action('wp_footer', array('EE_Error', 'enqueue_error_scripts'), 1);
637 637
 		}
638 638
 
639 639
 	}
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	*	@access private
688 688
 	*	@return void
689 689
 	*/
690
-	public static function reset_notices(){
690
+	public static function reset_notices() {
691 691
     	self::$_espresso_notices['success'] = FALSE;
692 692
     	self::$_espresso_notices['attention'] = FALSE;
693 693
     	self::$_espresso_notices['errors'] = FALSE;
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	*	@access public
701 701
 	*	@return int
702 702
 	*/
703
-    public static function has_notices(){
703
+    public static function has_notices() {
704 704
 		$has_notices = 0;
705 705
 		// check for success messages
706
-		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
706
+		$has_notices = self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success']) ? 3 : $has_notices;
707 707
 		// check for attention messages
708
-		$has_notices = self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ? 2 : $has_notices;
708
+		$has_notices = self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention']) ? 2 : $has_notices;
709 709
 		// check for error messages
710
-		$has_notices = self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ? 1 : $has_notices;
710
+		$has_notices = self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors']) ? 1 : $has_notices;
711 711
 		return $has_notices;
712 712
 	}
713 713
 
@@ -722,8 +722,8 @@  discard block
 block discarded – undo
722 722
 	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
723 723
 	* 	@return 		array
724 724
 	*/
725
-	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
726
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
725
+	public static function get_notices($format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE) {
726
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
727 727
 
728 728
 		$success_messages = '';
729 729
 		$attention_messages = '';
@@ -733,44 +733,44 @@  discard block
 block discarded – undo
733 733
 		// EEH_Debug_Tools::printr( self::$_espresso_notices, 'espresso_notices  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
734 734
 
735 735
 		// either save notices to the db
736
-		if ( $save_to_transient ) {
737
-			update_option( 'ee_notices', self::$_espresso_notices );
736
+		if ($save_to_transient) {
737
+			update_option('ee_notices', self::$_espresso_notices);
738 738
 			return;
739 739
 		}
740 740
 		// grab any notices that have been previously saved
741
-		if ( $notices = get_option( 'ee_notices', FALSE )) {
742
-			foreach ( $notices as $type => $notice ) {
743
-				if ( is_array( $notice ) && ! empty( $notice )) {
741
+		if ($notices = get_option('ee_notices', FALSE)) {
742
+			foreach ($notices as $type => $notice) {
743
+				if (is_array($notice) && ! empty($notice)) {
744 744
 					// make sure that existsing notice type is an array
745
-					self::$_espresso_notices[ $type ] =  is_array( self::$_espresso_notices[ $type ] ) && ! empty( self::$_espresso_notices[ $type ] ) ? self::$_espresso_notices[ $type ] : array();
745
+					self::$_espresso_notices[$type] = is_array(self::$_espresso_notices[$type]) && ! empty(self::$_espresso_notices[$type]) ? self::$_espresso_notices[$type] : array();
746 746
 					// merge stored notices with any newly created ones
747
-					self::$_espresso_notices[ $type ] = array_merge( self::$_espresso_notices[ $type ], $notice );
747
+					self::$_espresso_notices[$type] = array_merge(self::$_espresso_notices[$type], $notice);
748 748
 					$print_scripts = TRUE;
749 749
 				}
750 750
 			}
751 751
 			// now clear any stored notices
752
-			update_option( 'ee_notices', FALSE );
752
+			update_option('ee_notices', FALSE);
753 753
 		}
754 754
 
755 755
 		// check for success messages
756
-		if ( self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] )) {
756
+		if (self::$_espresso_notices['success'] && ! empty(self::$_espresso_notices['success'])) {
757 757
 			// combine messages
758
-			$success_messages .= implode( self::$_espresso_notices['success'], '<br />' );
758
+			$success_messages .= implode(self::$_espresso_notices['success'], '<br />');
759 759
 			$print_scripts = TRUE;
760 760
 		}
761 761
 
762 762
 		// check for attention messages
763
-		if ( self::$_espresso_notices['attention'] && ! empty(  self::$_espresso_notices['attention'] ) ) {
763
+		if (self::$_espresso_notices['attention'] && ! empty(self::$_espresso_notices['attention'])) {
764 764
 			// combine messages
765
-			$attention_messages .= implode( self::$_espresso_notices['attention'], '<br />' );
765
+			$attention_messages .= implode(self::$_espresso_notices['attention'], '<br />');
766 766
 			$print_scripts = TRUE;
767 767
 		}
768 768
 
769 769
 		// check for error messages
770
-		if ( self::$_espresso_notices['errors'] && ! empty(  self::$_espresso_notices['errors'] ) ) {
771
-			$error_messages .= count( self::$_espresso_notices['errors'] ) > 1 ? __( 'The following errors have occurred:<br />', 'event_espresso' ) : __( 'An error has occurred:<br />', 'event_espresso' );
770
+		if (self::$_espresso_notices['errors'] && ! empty(self::$_espresso_notices['errors'])) {
771
+			$error_messages .= count(self::$_espresso_notices['errors']) > 1 ? __('The following errors have occurred:<br />', 'event_espresso') : __('An error has occurred:<br />', 'event_espresso');
772 772
 			// combine messages
773
-			$error_messages .= implode( self::$_espresso_notices['errors'], '<br />' );
773
+			$error_messages .= implode(self::$_espresso_notices['errors'], '<br />');
774 774
 			$print_scripts = TRUE;
775 775
 		}
776 776
 
@@ -784,21 +784,21 @@  discard block
 block discarded – undo
784 784
 				$css_id = is_admin() ? 'message' : 'espresso-notices-success';
785 785
 				$css_class = is_admin() ? 'updated fade' : 'success fade-away';
786 786
 				//showMessage( $success_messages );
787
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $success_messages . '</p>' . $close . '</div>';
787
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$success_messages.'</p>'.$close.'</div>';
788 788
 			}
789 789
 
790 790
 			if ($attention_messages != '') {
791 791
 				$css_id = is_admin() ? 'message' : 'espresso-notices-attention';
792 792
 				$css_class = is_admin() ? 'updated ee-notices-attention' : 'attention fade-away';
793 793
 				//showMessage( $error_messages, TRUE );
794
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $attention_messages . '</p>' . $close . '</div>';
794
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$attention_messages.'</p>'.$close.'</div>';
795 795
 			}
796 796
 
797 797
 			if ($error_messages != '') {
798 798
 				$css_id = is_admin() ? 'message' : 'espresso-notices-error';
799 799
 				$css_class = is_admin() ? 'error' : 'error fade-away';
800 800
 				//showMessage( $error_messages, TRUE );
801
-				$notices .= '<div id="' . $css_id . '" class="espresso-notices ' . $css_class . '" style="display:none;"><p>' . $error_messages . '</p>' . $close . '</div>';
801
+				$notices .= '<div id="'.$css_id.'" class="espresso-notices '.$css_class.'" style="display:none;"><p>'.$error_messages.'</p>'.$close.'</div>';
802 802
 			}
803 803
 
804 804
 			$notices .= '</div>';
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
 					'errors' => $error_messages
812 812
 			);
813 813
 
814
-			if ( $remove_empty ) {
814
+			if ($remove_empty) {
815 815
 				// remove empty notices
816 816
 				foreach ($notices as $type => $notice) {
817 817
 					if (empty($notice)) {
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 			}
822 822
 		}
823 823
 
824
-		if ( $print_scripts ) {
824
+		if ($print_scripts) {
825 825
 			self::_print_scripts();
826 826
 		}
827 827
 
@@ -841,17 +841,17 @@  discard block
 block discarded – undo
841 841
 	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
842 842
 	* 	@return 		void
843 843
 	*/
844
-	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
845
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
846
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
844
+	public static function add_persistent_admin_notice($pan_name = '', $pan_message, $force_update = FALSE) {
845
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
846
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
847 847
 			//maybe initialize persistent_admin_notices
848
-			if ( empty( $persistent_admin_notices )) {
849
-				add_option( 'ee_pers_admin_notices', array(), '', 'no' );
848
+			if (empty($persistent_admin_notices)) {
849
+				add_option('ee_pers_admin_notices', array(), '', 'no');
850 850
 			}
851
-			$pan_name = sanitize_key( $pan_name );
852
-			if ( ! array_key_exists( $pan_name, $persistent_admin_notices ) || $force_update ) {
853
-				$persistent_admin_notices[ $pan_name ] = $pan_message;
854
-				update_option( 'ee_pers_admin_notices', $persistent_admin_notices );
851
+			$pan_name = sanitize_key($pan_name);
852
+			if ( ! array_key_exists($pan_name, $persistent_admin_notices) || $force_update) {
853
+				$persistent_admin_notices[$pan_name] = $pan_message;
854
+				update_option('ee_pers_admin_notices', $persistent_admin_notices);
855 855
 			}
856 856
 		}
857 857
 	}
@@ -867,34 +867,34 @@  discard block
 block discarded – undo
867 867
 	 * @param bool          $return_immediately
868 868
 	 * @return        void
869 869
 	 */
870
-	public static function dismiss_persistent_admin_notice( $pan_name = '', $purge = FALSE, $return_immediately = FALSE ) {
871
-		$pan_name = EE_Registry::instance()->REQ->is_set( 'ee_nag_notice' ) ? EE_Registry::instance()->REQ->get( 'ee_nag_notice' ) : $pan_name;
872
-		if ( ! empty( $pan_name )) {
873
-			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
870
+	public static function dismiss_persistent_admin_notice($pan_name = '', $purge = FALSE, $return_immediately = FALSE) {
871
+		$pan_name = EE_Registry::instance()->REQ->is_set('ee_nag_notice') ? EE_Registry::instance()->REQ->get('ee_nag_notice') : $pan_name;
872
+		if ( ! empty($pan_name)) {
873
+			$persistent_admin_notices = get_option('ee_pers_admin_notices', array());
874 874
 			// check if notice we wish to dismiss is actually in the $persistent_admin_notices array
875
-			if ( is_array( $persistent_admin_notices ) && isset( $persistent_admin_notices[ $pan_name ] )) {
875
+			if (is_array($persistent_admin_notices) && isset($persistent_admin_notices[$pan_name])) {
876 876
 				// completely delete nag notice, or just NULL message so that it can NOT be added again ?
877
-				if ( $purge ) {
878
-					unset( $persistent_admin_notices[ $pan_name ] );
877
+				if ($purge) {
878
+					unset($persistent_admin_notices[$pan_name]);
879 879
 				} else {
880
-					$persistent_admin_notices[ $pan_name ] = NULL;
880
+					$persistent_admin_notices[$pan_name] = NULL;
881 881
 				}
882
-				if ( update_option( 'ee_pers_admin_notices', $persistent_admin_notices ) === FALSE ) {
883
-					EE_Error::add_error( sprintf( __( 'The persistent admin notice for "%s" could not be deleted.', 'event_espresso' ), $pan_name ), __FILE__, __FUNCTION__, __LINE__ );
882
+				if (update_option('ee_pers_admin_notices', $persistent_admin_notices) === FALSE) {
883
+					EE_Error::add_error(sprintf(__('The persistent admin notice for "%s" could not be deleted.', 'event_espresso'), $pan_name), __FILE__, __FUNCTION__, __LINE__);
884 884
 				}
885 885
 			}
886 886
 		}
887
-		if ( $return_immediately ) {
887
+		if ($return_immediately) {
888 888
 			return;
889
-		} else if ( EE_Registry::instance()->REQ->ajax ) {
889
+		} else if (EE_Registry::instance()->REQ->ajax) {
890 890
 			// grab any notices and concatenate into string
891
-			echo json_encode( array( 'errors' => implode( '<br />', EE_Error::get_notices( FALSE ))));
891
+			echo json_encode(array('errors' => implode('<br />', EE_Error::get_notices(FALSE))));
892 892
 			exit();
893 893
 		} else {
894 894
 			// save errors to a transient to be displayed on next request (after redirect)
895
-			EE_Error::get_notices( FALSE, TRUE );
896
-			$return_url = EE_Registry::instance()->REQ->is_set( 'return_url' ) ? EE_Registry::instance()->REQ->get( 'return_url' ) : '';
897
-			wp_safe_redirect( urldecode( $return_url ));
895
+			EE_Error::get_notices(FALSE, TRUE);
896
+			$return_url = EE_Registry::instance()->REQ->is_set('return_url') ? EE_Registry::instance()->REQ->get('return_url') : '';
897
+			wp_safe_redirect(urldecode($return_url));
898 898
 		}
899 899
 	}
900 900
 
@@ -909,20 +909,20 @@  discard block
 block discarded – undo
909 909
 	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
910 910
 	 *  	@return 		string
911 911
 	 */
912
-	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
913
-		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
912
+	public static function display_persistent_admin_notices($pan_name = '', $pan_message = '', $return_url = '') {
913
+		if ( ! empty($pan_name) && ! empty($pan_message)) {
914 914
 			$args = array(
915 915
 				'nag_notice' => $pan_name,
916
-				'return_url' => urlencode( $return_url ),
916
+				'return_url' => urlencode($return_url),
917 917
 				'ajax_url' => WP_AJAX_URL,
918
-				'unknown_error' => __( 'An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso' )
918
+				'unknown_error' => __('An unknown error has occurred on the server while attempting to dismiss this notice.', 'event_espresso')
919 919
 			);
920
-			wp_localize_script( 'espresso_core', 'ee_dismiss', $args );
920
+			wp_localize_script('espresso_core', 'ee_dismiss', $args);
921 921
 			return '
922
-			<div id="' . $pan_name . '" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
-				<p>' . $pan_message . '</p>
924
-				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name . '">
925
-					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__( 'Dismiss', 'event_espresso' ) .'
922
+			<div id="' . $pan_name.'" class="espresso-notices updated ee-nag-notice clearfix" style="border-left: 4px solid #fcb93c;">
923
+				<p>' . $pan_message.'</p>
924
+				<a class="dismiss-ee-nag-notice hide-if-no-js" style="float: right; cursor: pointer; text-decoration:none;" rel="' . $pan_name.'">
925
+					<span class="dashicons dashicons-dismiss" style="position:relative; top:-1px; margin-right:.25em;"></span>'.__('Dismiss', 'event_espresso').'
926 926
 				</a>
927 927
 				<div style="clear:both;"></div>
928 928
 			</div>';
@@ -938,17 +938,17 @@  discard block
 block discarded – undo
938 938
 	 * @param string $return_url
939 939
 	 * @return    array
940 940
 	 */
941
-	public static function get_persistent_admin_notices( $return_url = '' ) {
941
+	public static function get_persistent_admin_notices($return_url = '') {
942 942
 		$notices = '';
943 943
 		// check for persistent admin notices
944
-		if ( $persistent_admin_notices = get_option( 'ee_pers_admin_notices', FALSE )) {
944
+		if ($persistent_admin_notices = get_option('ee_pers_admin_notices', FALSE)) {
945 945
 			// load scripts
946
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
947
-			wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE );
948
-			wp_enqueue_script( 'ee_error_js' );
946
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
947
+			wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, TRUE);
948
+			wp_enqueue_script('ee_error_js');
949 949
 			// and display notices
950
-			foreach( $persistent_admin_notices as $pan_name => $pan_message ) {
951
-				$notices .= self::display_persistent_admin_notices( $pan_name, $pan_message, $return_url );
950
+			foreach ($persistent_admin_notices as $pan_name => $pan_message) {
951
+				$notices .= self::display_persistent_admin_notices($pan_name, $pan_message, $return_url);
952 952
 			}
953 953
 		}
954 954
 		return $notices;
@@ -963,26 +963,26 @@  discard block
 block discarded – undo
963 963
 	 * @param 	bool $force_print
964 964
 	 * @return 	void
965 965
 	 */
966
-	private static function _print_scripts( $force_print = FALSE ) {
967
-		if (( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' )) && ! $force_print ) {
968
-			if ( wp_script_is( 'ee_error_js', 'enqueued' )) {
966
+	private static function _print_scripts($force_print = FALSE) {
967
+		if ((did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts')) && ! $force_print) {
968
+			if (wp_script_is('ee_error_js', 'enqueued')) {
969 969
 				return;
970
-			} else if ( wp_script_is( 'ee_error_js', 'registered' )) {
971
-				add_filter( 'FHEE_load_css', '__return_true' );
972
-				add_filter( 'FHEE_load_js', '__return_true' );
973
-				wp_enqueue_script( 'ee_error_js' );
974
-				wp_localize_script( 'ee_error_js','ee_settings', array( 'wp_debug'=>WP_DEBUG ));
970
+			} else if (wp_script_is('ee_error_js', 'registered')) {
971
+				add_filter('FHEE_load_css', '__return_true');
972
+				add_filter('FHEE_load_js', '__return_true');
973
+				wp_enqueue_script('ee_error_js');
974
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug'=>WP_DEBUG));
975 975
 			}
976 976
 		} else {
977 977
 			return '
978 978
 <script>
979 979
 /* <![CDATA[ */
980
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
980
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
981 981
 /* ]]> */
982 982
 </script>
983
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
984
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
985
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
983
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
984
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
985
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
986 986
 ';
987 987
 
988 988
 		}
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 	*	@ param string $line
1017 1017
 	*	@ return string
1018 1018
 	*/
1019
-	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1020
-		$file = explode( '.', basename( $file ));
1021
-		$error_code = ! empty( $file[0] ) ? $file[0] : '';
1022
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
1023
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
1019
+	public static function generate_error_code($file = '', $func = '', $line = '') {
1020
+		$file = explode('.', basename($file));
1021
+		$error_code = ! empty($file[0]) ? $file[0] : '';
1022
+		$error_code .= ! empty($func) ? ' - '.$func : '';
1023
+		$error_code .= ! empty($line) ? ' - '.$line : '';
1024 1024
 		return $error_code;
1025 1025
 	}
1026 1026
 
@@ -1036,37 +1036,37 @@  discard block
 block discarded – undo
1036 1036
 	*	@ param object $ex
1037 1037
 	*	@ return void
1038 1038
 	*/
1039
-	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1039
+	public function write_to_error_log($time = FALSE, $ex = FALSE, $clear = FALSE) {
1040 1040
 
1041
-		if ( ! $ex ) {
1041
+		if ( ! $ex) {
1042 1042
 			return;
1043 1043
 		}
1044 1044
 
1045
-		if ( ! $time ) {
1045
+		if ( ! $time) {
1046 1046
 			$time = time();
1047 1047
 		}
1048 1048
 
1049
-		$exception_log = '----------------------------------------------------------------------------------------' . PHP_EOL;
1050
-		$exception_log .= '[' . date( 'Y-m-d H:i:s', $time ) . ']  Exception Details' . PHP_EOL;
1051
-		$exception_log .= 'Message: ' . $ex['msg'] . PHP_EOL;
1052
-		$exception_log .= 'Code: '. $ex['code'] . PHP_EOL;
1053
-		$exception_log .= 'File: '. $ex['file'] . PHP_EOL;
1054
-		$exception_log .= 'Line No: ' . $ex['line'] . PHP_EOL;
1055
-		$exception_log .= 'Stack trace: ' . PHP_EOL;
1056
-		$exception_log .= $ex['string'] . PHP_EOL;
1057
-		$exception_log .= '----------------------------------------------------------------------------------------' . PHP_EOL;
1058
-
1059
-		EE_Registry::instance()->load_helper( 'File' );
1049
+		$exception_log = '----------------------------------------------------------------------------------------'.PHP_EOL;
1050
+		$exception_log .= '['.date('Y-m-d H:i:s', $time).']  Exception Details'.PHP_EOL;
1051
+		$exception_log .= 'Message: '.$ex['msg'].PHP_EOL;
1052
+		$exception_log .= 'Code: '.$ex['code'].PHP_EOL;
1053
+		$exception_log .= 'File: '.$ex['file'].PHP_EOL;
1054
+		$exception_log .= 'Line No: '.$ex['line'].PHP_EOL;
1055
+		$exception_log .= 'Stack trace: '.PHP_EOL;
1056
+		$exception_log .= $ex['string'].PHP_EOL;
1057
+		$exception_log .= '----------------------------------------------------------------------------------------'.PHP_EOL;
1058
+
1059
+		EE_Registry::instance()->load_helper('File');
1060 1060
 		try {
1061
-			EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file );
1062
-			EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' ); 
1063
-			if ( ! $clear ) {
1061
+			EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file);
1062
+			EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs'); 
1063
+			if ( ! $clear) {
1064 1064
 				//get existing log file and append new log info
1065
-				$exception_log = EEH_File::get_file_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file ) . $exception_log;
1065
+				$exception_log = EEH_File::get_file_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file).$exception_log;
1066 1066
 			}
1067
-			EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . self::$_exception_log_file, $exception_log );
1068
-		} catch( EE_Error $e ){
1069
-			EE_Error::add_error( sprintf( __(  'Event Espresso error logging could not be setup because: %s', 'event_espresso' ), $e->getMessage() ));
1067
+			EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.self::$_exception_log_file, $exception_log);
1068
+		} catch (EE_Error $e) {
1069
+			EE_Error::add_error(sprintf(__('Event Espresso error logging could not be setup because: %s', 'event_espresso'), $e->getMessage()));
1070 1070
 			return;
1071 1071
 		}
1072 1072
 
@@ -1090,10 +1090,10 @@  discard block
 block discarded – undo
1090 1090
 	 * @param int     $error_type
1091 1091
 	 * @return void
1092 1092
 	 */
1093
-	public static function doing_it_wrong( $function, $message, $version, $error_type = E_USER_NOTICE ) {
1094
-		if ( defined('WP_DEBUG') && WP_DEBUG ) {
1093
+	public static function doing_it_wrong($function, $message, $version, $error_type = E_USER_NOTICE) {
1094
+		if (defined('WP_DEBUG') && WP_DEBUG) {
1095 1095
 			EE_Registry::instance()->load_helper('Debug_Tools');
1096
-			EEH_Debug_Tools::instance()->doing_it_wrong( $function, $message, $version, $error_type );
1096
+			EEH_Debug_Tools::instance()->doing_it_wrong($function, $message, $version, $error_type);
1097 1097
 		}
1098 1098
 	}
1099 1099
 
@@ -1113,13 +1113,13 @@  discard block
 block discarded – undo
1113 1113
  */
1114 1114
 function espresso_error_enqueue_scripts() {
1115 1115
 	// js for error handling
1116
-	wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE );
1117
-	wp_register_script( 'ee_error_js', EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE );
1116
+	wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, FALSE);
1117
+	wp_register_script('ee_error_js', EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js', array('espresso_core'), EVENT_ESPRESSO_VERSION, FALSE);
1118 1118
 }
1119
-if ( is_admin() ) {
1120
-	add_action( 'admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1119
+if (is_admin()) {
1120
+	add_action('admin_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1121 1121
 } else {
1122
-	add_action( 'wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2 );
1122
+	add_action('wp_enqueue_scripts', 'espresso_error_enqueue_scripts', 2);
1123 1123
 }
1124 1124
 
1125 1125
 
Please login to merge, or discard this patch.
Indentation   +165 added lines, -165 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;
@@ -255,22 +255,22 @@  discard block
 block discarded – undo
255 255
 
256 256
 
257 257
 	/**
258
-	*	has_error
259
-	*	@access public
260
-	*	@return boolean
261
-	*/
262
-    public static function has_error(){
258
+	 *	has_error
259
+	 *	@access public
260
+	 *	@return boolean
261
+	 */
262
+	public static function has_error(){
263 263
 		return self::$_error_count ? TRUE : FALSE;
264 264
 	}
265 265
 
266 266
 
267 267
 
268 268
 	/**
269
-	*	display_errors
270
-	*	@access public
271
-	*	@echo string
272
-	*/
273
-    public function display_errors(){
269
+	 *	display_errors
270
+	 *	@access public
271
+	 *	@echo string
272
+	 */
273
+	public function display_errors(){
274 274
 
275 275
 		$trace_details = '';
276 276
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 			// process trace info
343 343
 			if ( empty( $ex['trace'] )) {
344 344
 
345
-	            $trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
345
+				$trace_details .= __( 'Sorry, but no trace information was available for this exception.', 'event_espresso' );
346 346
 
347 347
 			} else {
348 348
 
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 					$function_dsply = ! empty( $function ) ? $function : '&nbsp;';
395 395
 					$args_dsply = ! empty( $args ) ? '( ' . $args . ' )' : '';
396 396
 
397
-		              $trace_details .= '
397
+					  $trace_details .= '
398 398
 					<tr>
399 399
 						<td align="right" class="' . $zebra . '">' . $nmbr_dsply . '</td>
400 400
 						<td align="right" class="' . $zebra . '">' . $line_dsply . '</td>
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 
407 407
 				}
408 408
 
409
-	            $trace_details .= '
409
+				$trace_details .= '
410 410
 			 </table>
411 411
 			</div>';
412 412
 
@@ -486,12 +486,12 @@  discard block
 block discarded – undo
486 486
 
487 487
 
488 488
 	/**
489
-	*	generate string from exception trace args
490
-	*
491
-	*	@access private
492
-	*	@ param array $arguments
493
-	*	@ return string
494
-	*/
489
+	 *	generate string from exception trace args
490
+	 *
491
+	 *	@access private
492
+	 *	@ param array $arguments
493
+	 *	@ return string
494
+	 */
495 495
 	private function _convert_args_to_string ( $arguments = array(), $array = FALSE ) {
496 496
 
497 497
 		$arg_string = '';
@@ -535,15 +535,15 @@  discard block
 block discarded – undo
535 535
 
536 536
 
537 537
 	/**
538
-	* 	add error message
539
-	*
540
-	*	@access public
541
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
-	* 	@return 		void
546
-	*/
538
+	 * 	add error message
539
+	 *
540
+	 *	@access public
541
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
542
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
543
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
544
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
545
+	 * 	@return 		void
546
+	 */
547 547
 	public static function add_error( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
548 548
 		self::_add_notice ( 'errors', $msg, $file, $func, $line );
549 549
 		self::$_error_count++;
@@ -554,15 +554,15 @@  discard block
 block discarded – undo
554 554
 
555 555
 
556 556
 	/**
557
-	* 	add success message
558
-	*
559
-	*	@access public
560
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
561
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
562
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
563
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
564
-	* 	@return 		void
565
-	*/
557
+	 * 	add success message
558
+	 *
559
+	 *	@access public
560
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
561
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
562
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
563
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
564
+	 * 	@return 		void
565
+	 */
566 566
 	public static function add_success( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
567 567
 		self::_add_notice ( 'success', $msg, $file, $func, $line );
568 568
 	}
@@ -572,15 +572,15 @@  discard block
 block discarded – undo
572 572
 
573 573
 
574 574
 	/**
575
-	* 	add attention message
576
-	*
577
-	*	@access public
578
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
579
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
580
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
581
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
582
-	* 	@return 		void
583
-	*/
575
+	 * 	add attention message
576
+	 *
577
+	 *	@access public
578
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
579
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
580
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
581
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
582
+	 * 	@return 		void
583
+	 */
584 584
 	public static function add_attention( $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
585 585
 		self::_add_notice ( 'attention', $msg, $file, $func, $line );
586 586
 	}
@@ -590,16 +590,16 @@  discard block
 block discarded – undo
590 590
 
591 591
 
592 592
 	/**
593
-	* 	add success message
594
-	*
595
-	*	@access public
596
-	* 	@param		string		$type	whether the message is for a success or error notification
597
-	* 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
598
-	* 	@param		string		$file		the file that the error occurred in - just use __FILE__
599
-	* 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
600
-	* 	@param		string		$line	the line number where the error occurred - just use __LINE__
601
-	* 	@return 		void
602
-	*/
593
+	 * 	add success message
594
+	 *
595
+	 *	@access public
596
+	 * 	@param		string		$type	whether the message is for a success or error notification
597
+	 * 	@param		string		$msg	the message to display to users or developers - adding a double pipe || (OR) creates separate messages for user || dev
598
+	 * 	@param		string		$file		the file that the error occurred in - just use __FILE__
599
+	 * 	@param		string		$func	the function/method that the error occurred in - just use __FUNCTION__
600
+	 * 	@param		string		$line	the line number where the error occurred - just use __LINE__
601
+	 * 	@return 		void
602
+	 */
603 603
 	private static function _add_notice( $type = 'success', $msg = NULL, $file = NULL, $func = NULL, $line = NULL ) {
604 604
 		if ( empty( $msg )) {
605 605
 			EE_Error::doing_it_wrong(
@@ -643,11 +643,11 @@  discard block
 block discarded – undo
643 643
 
644 644
 
645 645
 	/**
646
-	* 	in some case it may be necessary to overwrite the existing success messages
647
-	*
648
-	*	@access public
649
-	* 	@return 		void
650
-	*/
646
+	 * 	in some case it may be necessary to overwrite the existing success messages
647
+	 *
648
+	 *	@access public
649
+	 * 	@return 		void
650
+	 */
651 651
 	public static function overwrite_success() {
652 652
 		self::$_espresso_notices['success'] = FALSE;
653 653
 	}
@@ -657,11 +657,11 @@  discard block
 block discarded – undo
657 657
 
658 658
 
659 659
 	/**
660
-	* 	in some case it may be necessary to overwrite the existing attention messages
661
-	*
662
-	*	@access public
663
-	* 	@return 		void
664
-	*/
660
+	 * 	in some case it may be necessary to overwrite the existing attention messages
661
+	 *
662
+	 *	@access public
663
+	 * 	@return 		void
664
+	 */
665 665
 	public static function overwrite_attention() {
666 666
 		self::$_espresso_notices['attention'] = FALSE;
667 667
 	}
@@ -671,11 +671,11 @@  discard block
 block discarded – undo
671 671
 
672 672
 
673 673
 	/**
674
-	* 	in some case it may be necessary to overwrite the existing error messages
675
-	*
676
-	*	@access public
677
-	* 	@return 		void
678
-	*/
674
+	 * 	in some case it may be necessary to overwrite the existing error messages
675
+	 *
676
+	 *	@access public
677
+	 * 	@return 		void
678
+	 */
679 679
 	public static function overwrite_errors() {
680 680
 		self::$_espresso_notices['errors'] = FALSE;
681 681
 	}
@@ -683,24 +683,24 @@  discard block
 block discarded – undo
683 683
 
684 684
 
685 685
 	/**
686
-	*	reset_notices
687
-	*	@access private
688
-	*	@return void
689
-	*/
686
+	 *	reset_notices
687
+	 *	@access private
688
+	 *	@return void
689
+	 */
690 690
 	public static function reset_notices(){
691
-    	self::$_espresso_notices['success'] = FALSE;
692
-    	self::$_espresso_notices['attention'] = FALSE;
693
-    	self::$_espresso_notices['errors'] = FALSE;
694
-    }
691
+		self::$_espresso_notices['success'] = FALSE;
692
+		self::$_espresso_notices['attention'] = FALSE;
693
+		self::$_espresso_notices['errors'] = FALSE;
694
+	}
695 695
 
696 696
 
697 697
 
698 698
 	/**
699
-	*	has_errors
700
-	*	@access public
701
-	*	@return int
702
-	*/
703
-    public static function has_notices(){
699
+	 *	has_errors
700
+	 *	@access public
701
+	 *	@return int
702
+	 */
703
+	public static function has_notices(){
704 704
 		$has_notices = 0;
705 705
 		// check for success messages
706 706
 		$has_notices = self::$_espresso_notices['success'] && ! empty(  self::$_espresso_notices['success'] ) ? 3 : $has_notices;
@@ -714,14 +714,14 @@  discard block
 block discarded – undo
714 714
 
715 715
 
716 716
 	/**
717
-	* 	compile all error or success messages into one string
718
-	*
719
-	*	@access public
720
-	* 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
721
-	* 	@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
722
-	* 	@param		boolean		$remove_empty		whether or not to unset empty messages
723
-	* 	@return 		array
724
-	*/
717
+	 * 	compile all error or success messages into one string
718
+	 *
719
+	 *	@access public
720
+	 * 	@param		boolean		$format_output		whether or not to format the messages for display in the WP admin
721
+	 * 	@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
722
+	 * 	@param		boolean		$remove_empty		whether or not to unset empty messages
723
+	 * 	@return 		array
724
+	 */
725 725
 	public static function get_notices( $format_output = TRUE, $save_to_transient = FALSE, $remove_empty = TRUE ) {
726 726
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
727 727
 
@@ -833,14 +833,14 @@  discard block
 block discarded – undo
833 833
 
834 834
 
835 835
 	/**
836
-	* 	add_persistent_admin_notice
837
-	*
838
-	*	@access 	public
839
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
840
-	* 	@param		string	$pan_message	the message to be stored persistently until dismissed
841
-	* 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
842
-	* 	@return 		void
843
-	*/
836
+	 * 	add_persistent_admin_notice
837
+	 *
838
+	 *	@access 	public
839
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
840
+	 * 	@param		string	$pan_message	the message to be stored persistently until dismissed
841
+	 * 	@param bool $force_update allows one to enforce the reappearance of a persistent message.
842
+	 * 	@return 		void
843
+	 */
844 844
 	public static function add_persistent_admin_notice( $pan_name = '', $pan_message, $force_update = FALSE ) {
845 845
 		if ( ! empty( $pan_name ) && ! empty( $pan_message )) {
846 846
 			$persistent_admin_notices = get_option( 'ee_pers_admin_notices', array() );
@@ -904,9 +904,9 @@  discard block
 block discarded – undo
904 904
 	 * 	display_persistent_admin_notices
905 905
 	 *
906 906
 	 *  	@access 	public
907
-	* 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
908
-	* 	@param		string	$pan_name	the message to be stored persistently until dismissed
909
-	* 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
907
+	 * 	@param		string	$pan_name	the name, or key of the Persistent Admin Notice to be stored
908
+	 * 	@param		string	$pan_name	the message to be stored persistently until dismissed
909
+	 * 	@param		string	$return_url	URL to go back to aftger nag notice is dismissed
910 910
 	 *  	@return 		string
911 911
 	 */
912 912
 	public static function display_persistent_admin_notices( $pan_name = '', $pan_message = '', $return_url = '' ) {
@@ -995,11 +995,11 @@  discard block
 block discarded – undo
995 995
 
996 996
 
997 997
 	/**
998
-	* 	enqueue_error_scripts
999
-	*
1000
-	*	@access public
1001
-	* 	@return 		void
1002
-	*/
998
+	 * 	enqueue_error_scripts
999
+	 *
1000
+	 *	@access public
1001
+	 * 	@return 		void
1002
+	 */
1003 1003
 	public static function enqueue_error_scripts() {
1004 1004
 		self::_print_scripts();
1005 1005
 	}
@@ -1007,15 +1007,15 @@  discard block
 block discarded – undo
1007 1007
 
1008 1008
 
1009 1009
 	/**
1010
-	*	create error code from filepath, function name,
1011
-	*	and line number where exception or error was thrown
1012
-	*
1013
-	*	@access public
1014
-	*	@ param string $file
1015
-	*	@ param string $func
1016
-	*	@ param string $line
1017
-	*	@ return string
1018
-	*/
1010
+	 *	create error code from filepath, function name,
1011
+	 *	and line number where exception or error was thrown
1012
+	 *
1013
+	 *	@access public
1014
+	 *	@ param string $file
1015
+	 *	@ param string $func
1016
+	 *	@ param string $line
1017
+	 *	@ return string
1018
+	 */
1019 1019
 	public static function generate_error_code ( $file = '', $func = '', $line = '' ) {
1020 1020
 		$file = explode( '.', basename( $file ));
1021 1021
 		$error_code = ! empty( $file[0] ) ? $file[0] : '';
@@ -1029,13 +1029,13 @@  discard block
 block discarded – undo
1029 1029
 
1030 1030
 
1031 1031
 	/**
1032
-	*	write exception details to log file
1033
-	*
1034
-	*	@access public
1035
-	*	@ param timestamp $time
1036
-	*	@ param object $ex
1037
-	*	@ return void
1038
-	*/
1032
+	 *	write exception details to log file
1033
+	 *
1034
+	 *	@access public
1035
+	 *	@ param timestamp $time
1036
+	 *	@ param object $ex
1037
+	 *	@ return void
1038
+	 */
1039 1039
 	public function write_to_error_log ( $time = FALSE, $ex = FALSE, $clear = FALSE ) {
1040 1040
 
1041 1041
 		if ( ! $ex ) {
Please login to merge, or discard this patch.
core/EE_Maintenance_Mode.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -184,7 +184,7 @@
 block discarded – undo
184 184
 	 *   returns TRUE if M-Mode is engaged and the current request is not for the admin
185 185
 	 *
186 186
 	 * @access    public
187
-	 * @return    string
187
+	 * @return    boolean
188 188
 	 */
189 189
 	public static function disable_frontend_for_maintenance() {
190 190
 		return ! is_admin() && EE_Maintenance_Mode::instance()->level() ? TRUE : FALSE;
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,10 +48,10 @@
 block discarded – undo
48 48
 	 */
49 49
 	const option_name_maintenance_mode = 'ee_maintenance_mode';
50 50
    /**
51
-     * 	EE_Maintenance_Mode Object
52
-     * 	@var EE_Maintenance_Mode $_instance
53
-	 * 	@access 	private
54
-     */
51
+    * 	EE_Maintenance_Mode Object
52
+    * 	@var EE_Maintenance_Mode $_instance
53
+    * 	@access 	private
54
+    */
55 55
 	private static $_instance = NULL;
56 56
 
57 57
 	/**
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 			current_user_can('administrator') && //when the user is an admin
142 142
 			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else{
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		} elseif( $this->level() == self::level_2_complete_maintenance ){
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162 162
 			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
163 163
 			return false;
164
-		}else{
164
+		} else{
165 165
 			return false;
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public static function instance() {
75 75
 		// check if class object is instantiated
76
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EE_Maintenance_Mode )) {
76
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EE_Maintenance_Mode)) {
77 77
 			self::$_instance = new self();
78 78
 		}
79 79
 		return self::$_instance;
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
 	 * Resets maintenance mode (mostly just re-checks whether or not we should be in maintenance mode)
84 84
 	 * @return EE_Maintenance_Mode
85 85
 	 */
86
-	public static function reset(){
86
+	public static function reset() {
87 87
 		self::instance()->set_maintenance_mode_if_db_old();
88 88
 		return self::instance();
89 89
 	}
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
 	 */
99 99
 	private function __construct() {
100 100
 		// if M-Mode level 2 is engaged, we still need basic assets loaded
101
-		add_action( 'wp_enqueue_scripts', array( $this, 'load_assets_required_for_m_mode' ));
101
+		add_action('wp_enqueue_scripts', array($this, 'load_assets_required_for_m_mode'));
102 102
 		// shut 'er down down for maintenance ?
103
-		add_filter( 'the_content', array( $this, 'the_content' ), 999 );
103
+		add_filter('the_content', array($this, 'the_content'), 999);
104 104
 		// add powered by EE msg
105
-		add_action( 'shutdown', array( $this, 'display_maintenance_mode_notice' ), 10 );
105
+		add_action('shutdown', array($this, 'display_maintenance_mode_notice'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -112,8 +112,8 @@  discard block
 block discarded – undo
112 112
 	 * retrieves the maintenance mode option value from the db
113 113
 	 * @return int
114 114
 	 */
115
-	public function real_level(){
116
-		return get_option( self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance );
115
+	public function real_level() {
116
+		return get_option(self::option_name_maintenance_mode, EE_Maintenance_Mode::level_0_not_in_maintenance);
117 117
 	}
118 118
 
119 119
 	/**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * thinks their tables are present and up-to-date).
122 122
 	 * @return boolean
123 123
 	 */
124
-	public function models_can_query(){
124
+	public function models_can_query() {
125 125
 		return $this->real_level() != EE_Maintenance_Mode::level_2_complete_maintenance;
126 126
 	}
127 127
 
@@ -134,14 +134,14 @@  discard block
 block discarded – undo
134 134
 	 * EE_Maintenance_Mode::level_2_complete_maintenance => frontend and backend maintenance mode
135 135
 	 * @return int
136 136
 	 */
137
-	public function level(){
137
+	public function level() {
138 138
 		$real_maintenance_mode_level = $this->real_level();
139 139
 		//if this is an admin request, we'll be honest... except if it's ajax, because that might be from the frontend
140
-		if( ( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
140
+		if (( ! is_admin() || (defined('DOING_AJAX') && DOING_AJAX)) && //only on frontend or ajax requests
141 141
 			current_user_can('administrator') && //when the user is an admin
142
-			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance){//and we're in level 1
142
+			$real_maintenance_mode_level == EE_Maintenance_Mode::level_1_frontend_only_maintenance) {//and we're in level 1
143 143
 			$maintenance_mode_level = EE_Maintenance_Mode::level_0_not_in_maintenance;
144
-		}else{
144
+		} else {
145 145
 			$maintenance_mode_level = $real_maintenance_mode_level;
146 146
 		}
147 147
 		return $maintenance_mode_level;
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 	 * Determines if we need to put EE in maintenance mode because the database needs updating
152 152
 	 * @return boolean true if DB is old and maintenance mode was triggered; false otherwise
153 153
 	 */
154
-	public function set_maintenance_mode_if_db_old(){
155
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
156
-		if( EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
154
+	public function set_maintenance_mode_if_db_old() {
155
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
156
+		if (EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
157 157
 			update_option(self::option_name_maintenance_mode, self::level_2_complete_maintenance);
158 158
 			return true;
159
-		}elseif( $this->level() == self::level_2_complete_maintenance ){
159
+		}elseif ($this->level() == self::level_2_complete_maintenance) {
160 160
 			//we also want to handle the opposite: if the site is mm2, but there aren't any migrations to run
161 161
 			//then we shouldn't be in mm2. (Maybe an addon got deactivated?)
162
-			update_option( self::option_name_maintenance_mode, self::level_0_not_in_maintenance );
162
+			update_option(self::option_name_maintenance_mode, self::level_0_not_in_maintenance);
163 163
 			return false;
164
-		}else{
164
+		} else {
165 165
 			return false;
166 166
 		}
167 167
 	}
@@ -171,8 +171,8 @@  discard block
 block discarded – undo
171 171
 	 * @param int $level
172 172
 	 * @return void
173 173
 	 */
174
-	public function set_maintenance_level($level){
175
-		do_action( 'AHEE__EE_Maintenance_Mode__set_maintenance_level', $level );
174
+	public function set_maintenance_level($level) {
175
+		do_action('AHEE__EE_Maintenance_Mode__set_maintenance_level', $level);
176 176
 		update_option(self::option_name_maintenance_mode, intval($level));
177 177
 	}
178 178
 
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	 *  @return 	string
200 200
 	 */
201 201
 	public function load_assets_required_for_m_mode() {
202
-		if ( $this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is( 'espresso_core', 'enqueued' )) {
203
-			wp_register_style( 'espresso_default', EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css', array( 'dashicons' ), EVENT_ESPRESSO_VERSION );
202
+		if ($this->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance && ! wp_script_is('espresso_core', 'enqueued')) {
203
+			wp_register_style('espresso_default', EE_GLOBAL_ASSETS_URL.'css/espresso_default.css', array('dashicons'), EVENT_ESPRESSO_VERSION);
204 204
 			wp_enqueue_style('espresso_default');
205
-			wp_register_script( 'espresso_core', EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE );
206
-			wp_enqueue_script( 'espresso_core' );
205
+			wp_register_script('espresso_core', EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE);
206
+			wp_enqueue_script('espresso_core');
207 207
 		}
208 208
 	}
209 209
 
@@ -218,9 +218,9 @@  discard block
 block discarded – undo
218 218
 	 * @param    string $template_path
219 219
 	 * @return    string
220 220
 	 */
221
-	public static function template_include( $template_path ) {
222
-		EE_Registry::instance()->load_helper( 'Template' );
223
-		$template_located = EEH_Template::locate_template( EE_TEMPLATES . 'maintenance_mode.template.php', FALSE, FALSE );
221
+	public static function template_include($template_path) {
222
+		EE_Registry::instance()->load_helper('Template');
223
+		$template_located = EEH_Template::locate_template(EE_TEMPLATES.'maintenance_mode.template.php', FALSE, FALSE);
224 224
 		return $template_located ? $template_located : $template_path;
225 225
 	}
226 226
 
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 	 * @param    string $the_content
236 236
 	 * @return    string
237 237
 	 */
238
-	public function the_content( $the_content ) {
238
+	public function the_content($the_content) {
239 239
 		// check if M-mode is engaged and for EE shortcode
240
-		if ( $this->level() && strpos( $the_content, '[ESPRESSO_' )) {
240
+		if ($this->level() && strpos($the_content, '[ESPRESSO_')) {
241 241
 			// this can eventually be moved to a template, or edited via admin. But for now...
242 242
 			$the_content = sprintf(
243
-				__( '%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso' ),
243
+				__('%sMaintenance Mode%sEvent Registration has been temporarily closed while system maintenance is being performed. We\'re sorry for any inconveniences this may have caused. Please try back again later.%s', 'event_espresso'),
244 244
 				'<h2>',
245 245
 				'</h2><p>',
246 246
 				'</p>'
@@ -264,16 +264,16 @@  discard block
 block discarded – undo
264 264
 		// check if M-mode is engaged and for EE shortcode
265 265
 		if (
266 266
 			$this->real_level() &&
267
-			current_user_can( 'administrator' ) &&
267
+			current_user_can('administrator') &&
268 268
 			! is_admin() &&
269
-			! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
269
+			! (defined('DOING_AJAX') && DOING_AJAX)
270 270
 			&& EE_Registry::instance()->REQ->is_espresso_page()
271 271
 		) {
272 272
 			printf(
273
-				__( '%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso' ),
273
+				__('%sclose%sEvent Registration is currently disabled because Event Espresso has been placed into Maintenance Mode. To change Maintenance Mode settings, click here %sEE Maintenance Mode Admin Page%s', 'event_espresso'),
274 274
 				'<div id="ee-m-mode-admin-notice-dv" class="ee-really-important-notice-dv"><a class="close-espresso-notice" title="',
275 275
 				'">&times;</a><p>',
276
-				' &raquo; <a href="' . add_query_arg( array( 'page' => 'espresso_maintenance_settings' ), admin_url( 'admin.php' )) . '">',
276
+				' &raquo; <a href="'.add_query_arg(array('page' => 'espresso_maintenance_settings'), admin_url('admin.php')).'">',
277 277
 				'</a></p></div>'
278 278
 			);
279 279
 		}
@@ -291,9 +291,9 @@  discard block
 block discarded – undo
291 291
 	 *		@ return void
292 292
 	 */
293 293
 	final function __destruct() {}
294
-	final function __call($a,$b) {}
294
+	final function __call($a, $b) {}
295 295
 	final function __get($a) {}
296
-	final function __set($a,$b) {}
296
+	final function __set($a, $b) {}
297 297
 	final function __isset($a) {}
298 298
 	final function __unset($a) {}
299 299
 	final function __sleep() {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	final function __invoke() {}
305 305
 	final function __set_state() {}
306 306
 	final function __clone() {}
307
-	final static function __callStatic($a,$b) {}
307
+	final static function __callStatic($a, $b) {}
308 308
 
309 309
 }
310 310
 // End of file EE_Maintenance_Mode.core.php
Please login to merge, or discard this patch.
core/EE_Request_Handler.core.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *    is_espresso_page
272 272
 	 *
273 273
 	 * @access    public
274
-	 * @param null $value
274
+	 * @param boolean $value
275 275
 	 * @return    mixed
276 276
 	 */
277 277
 	public function set_espresso_page( $value = null ) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *    setter
308 308
 	 *
309 309
 	 * @access    public
310
-	 * @param      $key
310
+	 * @param      string $key
311 311
 	 * @param      $value
312 312
 	 * @param bool $override_ee
313 313
 	 * @return    void
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 *    remove param
353 353
 	 *
354 354
 	 * @access    public
355
-	 * @param $key
355
+	 * @param string $key
356 356
 	 * @return    void
357 357
 	 */
358 358
 	public function un_set( $key ) {
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	 *    add_output
393 393
 	 *
394 394
 	 * @access    public
395
-	 * @param $string
395
+	 * @param string $string
396 396
 	 * @return    void
397 397
 	 */
398 398
 	public function add_output( $string ) {
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	 * @param WP $wp
66 66
 	 * @return \EE_Request_Handler
67 67
 	 */
68
-	public function __construct( $wp = null ) {
68
+	public function __construct($wp = null) {
69 69
 		// grab request vars
70 70
 		$this->_params = $_REQUEST;
71 71
 		// AJAX ???
72
-		$this->ajax = defined( 'DOING_AJAX' ) ? true : false;
73
-		$this->front_ajax = $this->is_set( 'ee_front_ajax' ) && $this->get( 'ee_front_ajax' ) == 1 ? true : false;
74
-		do_action( 'AHEE__EE_Request_Handler__construct__complete' );
72
+		$this->ajax = defined('DOING_AJAX') ? true : false;
73
+		$this->front_ajax = $this->is_set('ee_front_ajax') && $this->get('ee_front_ajax') == 1 ? true : false;
74
+		do_action('AHEE__EE_Request_Handler__construct__complete');
75 75
 	}
76 76
 
77 77
 
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 	 * @param WP $wp
84 84
 	 * @return void
85 85
 	 */
86
-	public function parse_request( $wp = null ) {
86
+	public function parse_request($wp = null) {
87 87
 		//if somebody forgot to provide us with WP, that's ok because its global
88
-		if ( ! $wp instanceof WP ) {
88
+		if ( ! $wp instanceof WP) {
89 89
 			global $wp;
90 90
 		}
91
-		$this->set_request_vars( $wp );
91
+		$this->set_request_vars($wp);
92 92
 	}
93 93
 
94 94
 
@@ -100,14 +100,14 @@  discard block
 block discarded – undo
100 100
 	 * @param WP $wp
101 101
 	 * @return void
102 102
 	 */
103
-	public function set_request_vars( $wp = null ) {
104
-		if ( ! is_admin() ) {
103
+	public function set_request_vars($wp = null) {
104
+		if ( ! is_admin()) {
105 105
 			// set request post_id
106
-			$this->set( 'post_id', $this->get_post_id_from_request( $wp ));
106
+			$this->set('post_id', $this->get_post_id_from_request($wp));
107 107
 			// set request post name
108
-			$this->set( 'post_name', $this->get_post_name_from_request( $wp ));
108
+			$this->set('post_name', $this->get_post_name_from_request($wp));
109 109
 			// set request post_type
110
-			$this->set( 'post_type', $this->get_post_type_from_request( $wp ));
110
+			$this->set('post_type', $this->get_post_type_from_request($wp));
111 111
 			// true or false ? is this page being used by EE ?
112 112
 			$this->set_espresso_page();
113 113
 		}
@@ -122,20 +122,20 @@  discard block
 block discarded – undo
122 122
 	 * @param WP $wp
123 123
 	 * @return int
124 124
 	 */
125
-	public function get_post_id_from_request( $wp = null ) {
126
-		if ( ! $wp instanceof WP ){
125
+	public function get_post_id_from_request($wp = null) {
126
+		if ( ! $wp instanceof WP) {
127 127
 			global $wp;
128 128
 		}
129 129
 		$post_id = null;
130
-		if ( isset( $wp->query_vars['p'] )) {
130
+		if (isset($wp->query_vars['p'])) {
131 131
 			$post_id = $wp->query_vars['p'];
132 132
 		}
133
-		if ( ! $post_id && isset( $wp->query_vars['page_id'] )) {
133
+		if ( ! $post_id && isset($wp->query_vars['page_id'])) {
134 134
 			$post_id = $wp->query_vars['page_id'];
135 135
 		}
136
-		if ( ! $post_id && isset( $wp->request )) {
137
-			if ( is_numeric( basename( $wp->request ))) {
138
-				$post_id = basename( $wp->request );
136
+		if ( ! $post_id && isset($wp->request)) {
137
+			if (is_numeric(basename($wp->request))) {
138
+				$post_id = basename($wp->request);
139 139
 			}
140 140
 		}
141 141
 		return $post_id;
@@ -150,35 +150,35 @@  discard block
 block discarded – undo
150 150
 	 * @param WP $wp
151 151
 	 * @return string
152 152
 	 */
153
-	public function get_post_name_from_request( $wp = null ) {
154
-		if ( ! $wp instanceof WP ){
153
+	public function get_post_name_from_request($wp = null) {
154
+		if ( ! $wp instanceof WP) {
155 155
 			global $wp;
156 156
 		}
157 157
 		$post_name = null;
158
-		if ( isset( $wp->query_vars['name'] ) && ! empty( $wp->query_vars['name'] )) {
158
+		if (isset($wp->query_vars['name']) && ! empty($wp->query_vars['name'])) {
159 159
 			$post_name = $wp->query_vars['name'];
160 160
 		}
161
-		if ( ! $post_name && isset( $wp->query_vars['pagename'] ) && ! empty( $wp->query_vars['pagename'] )) {
161
+		if ( ! $post_name && isset($wp->query_vars['pagename']) && ! empty($wp->query_vars['pagename'])) {
162 162
 			$post_name = $wp->query_vars['pagename'];
163 163
 		}
164
-		if ( ! $post_name && isset( $wp->request ) && ! empty( $wp->request )) {
165
-			$possible_post_name = basename( $wp->request );
166
-			if ( ! is_numeric( $possible_post_name )) {
164
+		if ( ! $post_name && isset($wp->request) && ! empty($wp->request)) {
165
+			$possible_post_name = basename($wp->request);
166
+			if ( ! is_numeric($possible_post_name)) {
167 167
 				/** @type WPDB $wpdb */
168 168
 				global $wpdb;
169 169
 				$SQL = "SELECT ID from $wpdb->posts WHERE post_status='publish' AND post_name=%s";
170
-				$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $possible_post_name ));
171
-				if ( $possible_post_name ) {
170
+				$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $possible_post_name));
171
+				if ($possible_post_name) {
172 172
 					$post_name = $possible_post_name;
173 173
 				}
174 174
 			}
175 175
 		}
176
-		if ( ! $post_name && $this->get( 'post_id' )) {
176
+		if ( ! $post_name && $this->get('post_id')) {
177 177
 			/** @type WPDB $wpdb */
178 178
 			global $wpdb;
179 179
 			$SQL = "SELECT post_name from $wpdb->posts WHERE post_status='publish' AND ID=%d";
180
-			$possible_post_name = $wpdb->get_var( $wpdb->prepare( $SQL, $this->get( 'post_id' )));
181
-			if( $possible_post_name ) {
180
+			$possible_post_name = $wpdb->get_var($wpdb->prepare($SQL, $this->get('post_id')));
181
+			if ($possible_post_name) {
182 182
 				$post_name = $possible_post_name;
183 183
 			}
184 184
 		}
@@ -194,11 +194,11 @@  discard block
 block discarded – undo
194 194
 	 * @param WP $wp
195 195
 	 * @return mixed
196 196
 	 */
197
-	public function get_post_type_from_request( $wp = null ) {
198
-		if ( ! $wp instanceof WP ){
197
+	public function get_post_type_from_request($wp = null) {
198
+		if ( ! $wp instanceof WP) {
199 199
 			global $wp;
200 200
 		}
201
-		return isset( $wp->query_vars['post_type'] ) ? $wp->query_vars['post_type'] : null;
201
+		return isset($wp->query_vars['post_type']) ? $wp->query_vars['post_type'] : null;
202 202
 	}
203 203
 
204 204
 
@@ -208,18 +208,18 @@  discard block
 block discarded – undo
208 208
 	 * @param  WP $wp
209 209
 	 * @return bool|string|void
210 210
 	 */
211
-	public function get_current_page_permalink( $wp = null ) {
212
-		$post_id = $this->get_post_id_from_request( $wp );
213
-		if ( $post_id ) {
214
-			$current_page_permalink = get_permalink( $post_id );
211
+	public function get_current_page_permalink($wp = null) {
212
+		$post_id = $this->get_post_id_from_request($wp);
213
+		if ($post_id) {
214
+			$current_page_permalink = get_permalink($post_id);
215 215
 		} else {
216
-			if ( ! $wp instanceof WP ) {
216
+			if ( ! $wp instanceof WP) {
217 217
 				global $wp;
218 218
 			}
219
-			if ( $wp->request ) {
220
-				$current_page_permalink = site_url( $wp->request );
219
+			if ($wp->request) {
220
+				$current_page_permalink = site_url($wp->request);
221 221
 			} else {
222
-				$current_page_permalink = esc_url( site_url( $_SERVER[ 'REQUEST_URI' ] ) );
222
+				$current_page_permalink = esc_url(site_url($_SERVER['REQUEST_URI']));
223 223
 			}
224 224
 		}
225 225
 		return $current_page_permalink;
@@ -236,41 +236,41 @@  discard block
 block discarded – undo
236 236
 	public function test_for_espresso_page() {
237 237
 		global $wp;
238 238
 		/** @type EE_CPT_Strategy $EE_CPT_Strategy */
239
-		$EE_CPT_Strategy = EE_Registry::instance()->load_core( 'CPT_Strategy' );
239
+		$EE_CPT_Strategy = EE_Registry::instance()->load_core('CPT_Strategy');
240 240
 		$espresso_CPT_taxonomies = $EE_CPT_Strategy->get_CPT_taxonomies();
241
-		if ( is_array( $espresso_CPT_taxonomies ) ) {
242
-			foreach ( $espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details ) {
243
-				if ( isset( $wp->query_vars, $wp->query_vars[ $espresso_CPT_taxonomy ] ) ) {
241
+		if (is_array($espresso_CPT_taxonomies)) {
242
+			foreach ($espresso_CPT_taxonomies as $espresso_CPT_taxonomy =>$details) {
243
+				if (isset($wp->query_vars, $wp->query_vars[$espresso_CPT_taxonomy])) {
244 244
 					return true;
245 245
 				}
246 246
 			}
247 247
 		}
248 248
 		// load espresso CPT endpoints
249 249
 		$espresso_CPT_endpoints = $EE_CPT_Strategy->get_CPT_endpoints();
250
-		$post_type_CPT_endpoints = array_flip( $espresso_CPT_endpoints );
251
-		$post_types = (array)$this->get( 'post_type' );
252
-		foreach ( $post_types as $post_type ) {
250
+		$post_type_CPT_endpoints = array_flip($espresso_CPT_endpoints);
251
+		$post_types = (array) $this->get('post_type');
252
+		foreach ($post_types as $post_type) {
253 253
 			// was a post name passed ?
254
-			if ( isset( $post_type_CPT_endpoints[ $post_type ] ) ) {
254
+			if (isset($post_type_CPT_endpoints[$post_type])) {
255 255
 				// kk we know this is an espresso page, but is it a specific post ?
256
-				if ( ! $this->get( 'post_name' ) ) {
256
+				if ( ! $this->get('post_name')) {
257 257
 					// there's no specific post name set, so maybe it's one of our endpoints like www.domain.com/events
258
-					$post_name = isset( $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] ) ? $post_type_CPT_endpoints[ $this->get( 'post_type' ) ] : null;
258
+					$post_name = isset($post_type_CPT_endpoints[$this->get('post_type')]) ? $post_type_CPT_endpoints[$this->get('post_type')] : null;
259 259
 					// if the post type matches on of our then set the endpoint
260
-					if ( $post_name ) {
261
-						$this->set( 'post_name', $post_name );
260
+					if ($post_name) {
261
+						$this->set('post_name', $post_name);
262 262
 					}
263 263
 				}
264 264
 				return true;
265 265
 			}
266 266
 		}
267
-		if ( $this->get( 'post_name' )) {
267
+		if ($this->get('post_name')) {
268 268
 			// load all pages using espresso shortcodes
269
-			$post_shortcodes = isset( EE_Registry::instance()->CFG->core->post_shortcodes ) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
269
+			$post_shortcodes = isset(EE_Registry::instance()->CFG->core->post_shortcodes) ? EE_Registry::instance()->CFG->core->post_shortcodes : array();
270 270
 			// make sure core pages are included
271
-			$espresso_pages = array_merge( $espresso_CPT_endpoints, $post_shortcodes );
271
+			$espresso_pages = array_merge($espresso_CPT_endpoints, $post_shortcodes);
272 272
 			// was a post name passed ?
273
-			if (  isset( $espresso_pages[ $this->get( 'post_name' ) ] )) {
273
+			if (isset($espresso_pages[$this->get('post_name')])) {
274 274
 				 return true;
275 275
 			}
276 276
 		}
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 	 * @param null $value
287 287
 	 * @return    mixed
288 288
 	 */
289
-	public function set_espresso_page( $value = null ) {
289
+	public function set_espresso_page($value = null) {
290 290
 		$value = $value ? $value : $this->test_for_espresso_page();
291 291
 		$this->_params['is_espresso_page'] = $value;
292 292
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 *  @return 	mixed
301 301
 	 */
302 302
 	public function is_espresso_page() {
303
-		return isset( $this->_params['is_espresso_page'] ) ? $this->_params['is_espresso_page'] : false;
303
+		return isset($this->_params['is_espresso_page']) ? $this->_params['is_espresso_page'] : false;
304 304
 	}
305 305
 
306 306
 
@@ -324,10 +324,10 @@  discard block
 block discarded – undo
324 324
 	 * @param bool $override_ee
325 325
 	 * @return    void
326 326
 	 */
327
-	public function set( $key, $value, $override_ee = false ) {
327
+	public function set($key, $value, $override_ee = false) {
328 328
 		// don't allow "ee" to be overwritten unless explicitly instructed to do so
329
-		if ( $key != 'ee' || ( $key == 'ee' && empty( $this->_params['ee'] )) || ( $key == 'ee' && ! empty( $this->_params['ee'] ) && $override_ee )) {
330
-			$this->_params[ $key ] = $value;
329
+		if ($key != 'ee' || ($key == 'ee' && empty($this->_params['ee'])) || ($key == 'ee' && ! empty($this->_params['ee']) && $override_ee)) {
330
+			$this->_params[$key] = $value;
331 331
 		}
332 332
 	}
333 333
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param null $default
342 342
 	 * @return    mixed
343 343
 	 */
344
-	public function get( $key, $default = null ) {
345
-		return isset( $this->_params[ $key ] ) ? $this->_params[ $key ] : $default;
344
+	public function get($key, $default = null) {
345
+		return isset($this->_params[$key]) ? $this->_params[$key] : $default;
346 346
 	}
347 347
 
348 348
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param $key
355 355
 	 * @return    boolean
356 356
 	 */
357
-	public function is_set( $key ) {
358
-		return isset( $this->_params[ $key ] ) ? true : false;
357
+	public function is_set($key) {
358
+		return isset($this->_params[$key]) ? true : false;
359 359
 	}
360 360
 
361 361
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param $key
368 368
 	 * @return    void
369 369
 	 */
370
-	public function un_set( $key ) {
371
-		unset( $this->_params[ $key ] );
370
+	public function un_set($key) {
371
+		unset($this->_params[$key]);
372 372
 	}
373 373
 
374 374
 
@@ -381,8 +381,8 @@  discard block
 block discarded – undo
381 381
 	 * @param $value
382 382
 	 * @return    void
383 383
 	 */
384
-	public function set_notice( $key, $value ) {
385
-		$this->_notice[ $key ] = $value;
384
+	public function set_notice($key, $value) {
385
+		$this->_notice[$key] = $value;
386 386
 	}
387 387
 
388 388
 
@@ -394,8 +394,8 @@  discard block
 block discarded – undo
394 394
 	 * @param $key
395 395
 	 * @return    mixed
396 396
 	 */
397
-	public function get_notice( $key ) {
398
-		return isset( $this->_notice[ $key ] ) ? $this->_notice[ $key ] : null;
397
+	public function get_notice($key) {
398
+		return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
399 399
 	}
400 400
 
401 401
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 	 * @param $string
408 408
 	 * @return    void
409 409
 	 */
410
-	public function add_output( $string ) {
410
+	public function add_output($string) {
411 411
 		$this->_output .= $string;
412 412
 	}
413 413
 
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 * @param $item
430 430
 	 * @param $key
431 431
 	 */
432
-	function sanitize_text_field_for_array_walk( &$item, &$key ) {
433
-		$item = strpos( $item, 'email' ) !== false ? sanitize_email( $item ) : sanitize_text_field( $item );
432
+	function sanitize_text_field_for_array_walk(&$item, &$key) {
433
+		$item = strpos($item, 'email') !== false ? sanitize_email($item) : sanitize_text_field($item);
434 434
 	}
435 435
 
436 436
 
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param $b
441 441
 	 * @return bool
442 442
 	 */
443
-	public function __set($a,$b) { return false; }
443
+	public function __set($a, $b) { return false; }
444 444
 
445 445
 
446 446
 
Please login to merge, or discard this patch.
core/EE_Session.core.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 	 /**
337 337
 	  * retrieve session data
338 338
 	  * @access    public
339
-	  * @param null $key
339
+	  * @param string|null $key
340 340
 	  * @param bool $reset_cache
341 341
 	  * @return    array
342 342
 	  */
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
 	  * set session data
361 361
 	  * @access 	public
362 362
 	  * @param 	array $data
363
-	  * @return 	TRUE on success, FALSE on fail
363
+	  * @return 	boolean on success, FALSE on fail
364 364
 	  */
365 365
 	public function set_session_data( $data ) {
366 366
 
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 	 /**
391 391
 	  * @initiate session
392 392
 	  * @access   private
393
-	  * @return TRUE on success, FALSE on fail
393
+	  * @return boolean on success, FALSE on fail
394 394
 	  * @throws \EE_Error
395 395
 	  */
396 396
 	private function _espresso_session() {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 	  * @update session data  prior to saving to the db
522 522
 	  * @access public
523 523
 	  * @param bool $new_session
524
-	  * @return TRUE on success, FALSE on fail
524
+	  * @return boolean on success, FALSE on fail
525 525
 	  */
526 526
 	public function update( $new_session = FALSE ) {
527 527
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 	  * @access public
792 792
 	  * @param array $data_to_reset
793 793
 	  * @param bool  $show_all_notices
794
-	  * @return TRUE on success, FALSE on fail
794
+	  * @return boolean on success, FALSE on fail
795 795
 	  */
796 796
 	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
797 797
 		// if $data_to_reset is not in an array, then put it in one
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if (!defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );/**
3 5
  *
4 6
  * Event Espresso
@@ -349,7 +351,7 @@  discard block
 block discarded – undo
349 351
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
350 352
 		 if ( ! empty( $key ))  {
351 353
 			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
352
-		}  else  {
354
+		} else  {
353 355
 			return $this->_session_data;
354 356
 		}
355 357
 	}
Please login to merge, or discard this patch.
Spacing   +150 added lines, -150 removed lines patch added patch discarded remove patch
@@ -1,4 +1,4 @@  discard block
 block discarded – undo
1
-<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3 3
  *
4 4
  * Event Espresso
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 	  * array for defining default session vars
105 105
 	  * @var array
106 106
 	  */
107
-	 private $_default_session_vars = array (
107
+	 private $_default_session_vars = array(
108 108
 		'id' => NULL,
109 109
 		'user_id' => NULL,
110 110
 		'ip_address' => NULL,
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 	 * @param \EE_Encryption $encryption
128 128
 	 *	@return EE_Session
129 129
 	 */
130
-	public static function instance( EE_Encryption $encryption = null ) {
130
+	public static function instance(EE_Encryption $encryption = null) {
131 131
 		// check if class object is instantiated
132 132
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via:
133 133
 		// add_filter( 'FHEE_load_EE_Session', '__return_false' );
134
-		if ( ! self::$_instance instanceof EE_Session && apply_filters( 'FHEE_load_EE_Session', true ) ) {
135
-			self::$_instance = new self( $encryption );
134
+		if ( ! self::$_instance instanceof EE_Session && apply_filters('FHEE_load_EE_Session', true)) {
135
+			self::$_instance = new self($encryption);
136 136
 		}
137 137
 		return self::$_instance;
138 138
 	}
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
 	  * @access protected
146 146
 	  * @param \EE_Encryption $encryption
147 147
 	  */
148
-	 protected function __construct( EE_Encryption $encryption = null ) {
148
+	 protected function __construct(EE_Encryption $encryption = null) {
149 149
 
150 150
 		// session loading is turned ON by default, but prior to the init hook, can be turned back OFF via: add_filter( 'FHEE_load_EE_Session', '__return_false' );
151
-		if ( ! apply_filters( 'FHEE_load_EE_Session', TRUE ) ) {
151
+		if ( ! apply_filters('FHEE_load_EE_Session', TRUE)) {
152 152
 			return NULL;
153 153
 		}
154
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
155
-		if ( ! defined( 'ESPRESSO_SESSION' ) ) {
156
-			define( 'ESPRESSO_SESSION', true );
154
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
155
+		if ( ! defined('ESPRESSO_SESSION')) {
156
+			define('ESPRESSO_SESSION', true);
157 157
 		}
158 158
 		// default session lifespan in seconds
159 159
 		$this->_lifespan = apply_filters(
@@ -167,35 +167,35 @@  discard block
 block discarded – undo
167 167
 		 * 		}
168 168
 		 */
169 169
 		// retrieve session options from db
170
-		$session_settings = get_option( 'ee_session_settings' );
171
-		if ( $session_settings !== FALSE ) {
170
+		$session_settings = get_option('ee_session_settings');
171
+		if ($session_settings !== FALSE) {
172 172
 			// cycle though existing session options
173
-			foreach ( $session_settings as $var_name => $session_setting ) {
173
+			foreach ($session_settings as $var_name => $session_setting) {
174 174
 				// set values for class properties
175
-				$var_name = '_' . $var_name;
175
+				$var_name = '_'.$var_name;
176 176
 				$this->{$var_name} = $session_setting;
177 177
 			}
178 178
 		}
179 179
 		// are we using encryption?
180
-		if ( $this->_use_encryption && $encryption instanceof EE_Encryption ) {
180
+		if ($this->_use_encryption && $encryption instanceof EE_Encryption) {
181 181
 			// encrypt data via: $this->encryption->encrypt();
182 182
 			$this->encryption = $encryption;
183 183
 		}
184 184
 		// filter hook allows outside functions/classes/plugins to change default empty cart
185
-		$extra_default_session_vars = apply_filters( 'FHEE__EE_Session__construct__extra_default_session_vars', array() );
186
-		array_merge( $this->_default_session_vars, $extra_default_session_vars );
185
+		$extra_default_session_vars = apply_filters('FHEE__EE_Session__construct__extra_default_session_vars', array());
186
+		array_merge($this->_default_session_vars, $extra_default_session_vars);
187 187
 		// apply default session vars
188 188
 		$this->_set_defaults();
189 189
 		// check for existing session and retrieve it from db
190
-		if ( ! $this->_espresso_session() ) {
190
+		if ( ! $this->_espresso_session()) {
191 191
 			// or just start a new one
192 192
 			$this->_create_espresso_session();
193 193
 		}
194 194
 		// check request for 'clear_session' param
195
-		add_action( 'AHEE__EE_Request_Handler__construct__complete', array( $this, 'wp_loaded' ));
195
+		add_action('AHEE__EE_Request_Handler__construct__complete', array($this, 'wp_loaded'));
196 196
 		// once everything is all said and done,
197
-		add_action( 'shutdown', array( $this, 'update' ), 100 );
198
-		add_action( 'shutdown', array( $this, 'garbage_collection' ), 999 );
197
+		add_action('shutdown', array($this, 'update'), 100);
198
+		add_action('shutdown', array($this, 'garbage_collection'), 999);
199 199
 
200 200
 	}
201 201
 
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 	 */
228 228
 	private function _set_defaults() {
229 229
 		// set some defaults
230
-		foreach ( $this->_default_session_vars as $key => $default_var ) {
231
-			if ( is_array( $default_var )) {
232
-				$this->_session_data[ $key ] = array();
230
+		foreach ($this->_default_session_vars as $key => $default_var) {
231
+			if (is_array($default_var)) {
232
+				$this->_session_data[$key] = array();
233 233
 			} else {
234
-				$this->_session_data[ $key ] = '';
234
+				$this->_session_data[$key] = '';
235 235
 			}
236 236
 		}
237 237
 	}
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 	  * @param \EE_Cart $cart
254 254
 	  * @return bool
255 255
 	  */
256
-	 public function set_cart( EE_Cart $cart ) {
256
+	 public function set_cart(EE_Cart $cart) {
257 257
 		 $this->_session_data['cart'] = $cart;
258 258
 		 return TRUE;
259 259
 	 }
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 	  * @return \EE_Cart
274 274
 	  */
275 275
 	 public function cart() {
276
-		 return isset( $this->_session_data['cart'] ) ? $this->_session_data['cart'] : NULL;
276
+		 return isset($this->_session_data['cart']) ? $this->_session_data['cart'] : NULL;
277 277
 	 }
278 278
 
279 279
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	  * @param \EE_Checkout $checkout
283 283
 	  * @return bool
284 284
 	  */
285
-	 public function set_checkout( EE_Checkout $checkout ) {
285
+	 public function set_checkout(EE_Checkout $checkout) {
286 286
 		 $this->_session_data['checkout'] = $checkout;
287 287
 		 return TRUE;
288 288
 	 }
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	  * @return \EE_Checkout
303 303
 	  */
304 304
 	 public function checkout() {
305
-		 return isset( $this->_session_data['checkout'] ) ? $this->_session_data['checkout'] : NULL;
305
+		 return isset($this->_session_data['checkout']) ? $this->_session_data['checkout'] : NULL;
306 306
 	 }
307 307
 
308 308
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 	  * @param \EE_Transaction $transaction
312 312
 	  * @return bool
313 313
 	  */
314
-	 public function set_transaction( EE_Transaction $transaction ) {
314
+	 public function set_transaction(EE_Transaction $transaction) {
315 315
 		 // first remove the session from the transaction before we save the transaction in the session
316
-		 $transaction->set_txn_session_data( NULL );
316
+		 $transaction->set_txn_session_data(NULL);
317 317
 		 $this->_session_data['transaction'] = $transaction;
318 318
 		 return TRUE;
319 319
 	 }
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 	  * @return \EE_Transaction
334 334
 	  */
335 335
 	 public function transaction() {
336
-		 return isset( $this->_session_data['transaction'] ) ? $this->_session_data['transaction'] : NULL;
336
+		 return isset($this->_session_data['transaction']) ? $this->_session_data['transaction'] : NULL;
337 337
 	 }
338 338
 
339 339
 
@@ -345,15 +345,15 @@  discard block
 block discarded – undo
345 345
 	  * @param bool $reset_cache
346 346
 	  * @return    array
347 347
 	  */
348
-	public function get_session_data( $key = NULL, $reset_cache = FALSE ) {
349
-		if ( $reset_cache ) {
348
+	public function get_session_data($key = NULL, $reset_cache = FALSE) {
349
+		if ($reset_cache) {
350 350
 			$this->reset_cart();
351 351
 			$this->reset_checkout();
352 352
 			$this->reset_transaction();
353 353
 		}
354
-		 if ( ! empty( $key ))  {
355
-			return  isset( $this->_session_data[ $key ] ) ? $this->_session_data[ $key ] : NULL;
356
-		}  else  {
354
+		 if ( ! empty($key)) {
355
+			return  isset($this->_session_data[$key]) ? $this->_session_data[$key] : NULL;
356
+		} else {
357 357
 			return $this->_session_data;
358 358
 		}
359 359
 	}
@@ -366,20 +366,20 @@  discard block
 block discarded – undo
366 366
 	  * @param 	array $data
367 367
 	  * @return 	TRUE on success, FALSE on fail
368 368
 	  */
369
-	public function set_session_data( $data ) {
369
+	public function set_session_data($data) {
370 370
 
371 371
 		// nothing ??? bad data ??? go home!
372
-		if ( empty( $data ) || ! is_array( $data )) {
373
-			EE_Error::add_error( __( 'No session data or invalid session data was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
372
+		if (empty($data) || ! is_array($data)) {
373
+			EE_Error::add_error(__('No session data or invalid session data was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
374 374
 			return FALSE;
375 375
 		}
376 376
 
377
-		foreach ( $data as $key =>$value ) {
378
-			if ( isset( $this->_default_session_vars[ $key ] )) {
379
-				EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $key ), __FILE__, __FUNCTION__, __LINE__ );
377
+		foreach ($data as $key =>$value) {
378
+			if (isset($this->_default_session_vars[$key])) {
379
+				EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $key), __FILE__, __FUNCTION__, __LINE__);
380 380
 				return FALSE;
381 381
 			} else {
382
-				$this->_session_data[ $key ] = $value;
382
+				$this->_session_data[$key] = $value;
383 383
 			}
384 384
 		}
385 385
 
@@ -396,9 +396,9 @@  discard block
 block discarded – undo
396 396
 	  * @throws \EE_Error
397 397
 	  */
398 398
 	private function _espresso_session() {
399
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
399
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
400 400
 		// check that session has started
401
-		if ( session_id() === '' ) {
401
+		if (session_id() === '') {
402 402
 			//starts a new session if one doesn't already exist, or re-initiates an existing one
403 403
 			session_start();
404 404
 		}
@@ -407,57 +407,57 @@  discard block
 block discarded – undo
407 407
 		// and the visitors IP
408 408
 		$this->_ip_address = $this->_visitor_ip();
409 409
 		// set the "user agent"
410
-		$this->_user_agent = ( isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr( $_SERVER['HTTP_USER_AGENT'] ) : FALSE;
410
+		$this->_user_agent = (isset($_SERVER['HTTP_USER_AGENT'])) ? esc_attr($_SERVER['HTTP_USER_AGENT']) : FALSE;
411 411
 		// now let's retrieve what's in the db
412 412
 		// we're using WP's Transient API to store session data using the PHP session ID as the option name
413
-		$session_data = get_transient( EE_Session::session_id_prefix . $this->_sid );
414
-		if ( $session_data ) {
415
-			if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
416
-				$hash_check = get_transient( EE_Session::hash_check_prefix . $this->_sid );
417
-				if ( $hash_check && $hash_check !== md5( $session_data ) ) {
413
+		$session_data = get_transient(EE_Session::session_id_prefix.$this->_sid);
414
+		if ($session_data) {
415
+			if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
416
+				$hash_check = get_transient(EE_Session::hash_check_prefix.$this->_sid);
417
+				if ($hash_check && $hash_check !== md5($session_data)) {
418 418
 					EE_Error::add_error(
419 419
 						sprintf(
420
-							__( 'The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso' ),
421
-							EE_Session::session_id_prefix . $this->_sid
420
+							__('The stored data for session %1$s failed to pass a hash check and therefore appears to be invalid.', 'event_espresso'),
421
+							EE_Session::session_id_prefix.$this->_sid
422 422
 						),
423 423
 						__FILE__, __FUNCTION__, __LINE__
424 424
 					);
425 425
 				}
426 426
 			}
427 427
 			// un-encrypt the data
428
-			$session_data = $this->_use_encryption ? $this->encryption->decrypt( $session_data ) : $session_data;
428
+			$session_data = $this->_use_encryption ? $this->encryption->decrypt($session_data) : $session_data;
429 429
 			// unserialize
430
-			$session_data = maybe_unserialize( $session_data );
430
+			$session_data = maybe_unserialize($session_data);
431 431
 			// just a check to make sure the session array is indeed an array
432
-			if ( ! is_array( $session_data ) ) {
432
+			if ( ! is_array($session_data)) {
433 433
 				// no?!?! then something is wrong
434 434
 				return FALSE;
435 435
 			}
436 436
 			// get the current time in UTC
437
-			$this->_time = isset( $this->_time ) ? $this->_time : time();
437
+			$this->_time = isset($this->_time) ? $this->_time : time();
438 438
 			// and reset the session expiration
439
-			$this->_expiration = isset( $session_data['expiration'] ) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
439
+			$this->_expiration = isset($session_data['expiration']) ? $session_data['expiration'] : $this->_time + $this->_lifespan;
440 440
 
441 441
 		} else {
442 442
 			// set initial site access time and the session expiration
443 443
 			$this->_set_init_access_and_expiration();
444 444
 			// set referer
445
-			$this->_session_data[ 'pages_visited' ][ $this->_session_data['init_access'] ] = isset( $_SERVER['HTTP_REFERER'] ) ? esc_attr( $_SERVER['HTTP_REFERER'] ) : '';
445
+			$this->_session_data['pages_visited'][$this->_session_data['init_access']] = isset($_SERVER['HTTP_REFERER']) ? esc_attr($_SERVER['HTTP_REFERER']) : '';
446 446
 			// no previous session = go back and create one (on top of the data above)
447 447
 			return FALSE;
448 448
 		}
449 449
 		// now the user agent
450
-		if ( $session_data['user_agent'] != $this->_user_agent ) {
450
+		if ($session_data['user_agent'] != $this->_user_agent) {
451 451
 			return FALSE;
452 452
 		}
453 453
 		// wait a minute... how old are you?
454
-		if ( $this->_time > $this->_expiration ) {
454
+		if ($this->_time > $this->_expiration) {
455 455
 			// yer too old fer me!
456 456
 			// wipe out everything that isn't a default session datum
457
-			$this->clear_session( __CLASS__, __FUNCTION__ );
457
+			$this->clear_session(__CLASS__, __FUNCTION__);
458 458
 		}
459 459
 		// make event espresso session data available to plugin
460
-		$this->_session_data = array_merge( $this->_session_data, $session_data );
460
+		$this->_session_data = array_merge($this->_session_data, $session_data);
461 461
 		return TRUE;
462 462
 
463 463
 	}
@@ -475,12 +475,12 @@  discard block
 block discarded – undo
475 475
 	  */
476 476
 	protected function _generate_session_id() {
477 477
 		// check if the SID was passed explicitly, otherwise get from session, then add salt and hash it to reduce length
478
-		if ( isset( $_REQUEST[ 'EESID' ] ) ) {
479
-			$session_id = sanitize_text_field( $_REQUEST[ 'EESID' ] );
478
+		if (isset($_REQUEST['EESID'])) {
479
+			$session_id = sanitize_text_field($_REQUEST['EESID']);
480 480
 		} else {
481
-			$session_id = md5( session_id() . get_current_blog_id() . $this->_get_sid_salt() );
481
+			$session_id = md5(session_id().get_current_blog_id().$this->_get_sid_salt());
482 482
 		}
483
-		return apply_filters( 'FHEE__EE_Session___generate_session_id__session_id', $session_id );
483
+		return apply_filters('FHEE__EE_Session___generate_session_id__session_id', $session_id);
484 484
 	}
485 485
 
486 486
 
@@ -492,20 +492,20 @@  discard block
 block discarded – undo
492 492
 	  */
493 493
 	protected function _get_sid_salt() {
494 494
 		// was session id salt already saved to db ?
495
-		if ( empty( $this->_sid_salt ) ) {
495
+		if (empty($this->_sid_salt)) {
496 496
 			// no?  then maybe use WP defined constant
497
-			if ( defined( 'AUTH_SALT' ) ) {
497
+			if (defined('AUTH_SALT')) {
498 498
 				$this->_sid_salt = AUTH_SALT;
499 499
 			}
500 500
 			// if salt doesn't exist or is too short
501
-			if ( empty( $this->_sid_salt ) || strlen( $this->_sid_salt ) < 32 ) {
501
+			if (empty($this->_sid_salt) || strlen($this->_sid_salt) < 32) {
502 502
 				// create a new one
503
-				$this->_sid_salt = wp_generate_password( 64 );
503
+				$this->_sid_salt = wp_generate_password(64);
504 504
 			}
505 505
 			// and save it as a permanent session setting
506
-			$session_settings = get_option( 'ee_session_settings' );
507
-			$session_settings[ 'sid_salt' ] = $this->_sid_salt;
508
-			update_option( 'ee_session_settings', $session_settings );
506
+			$session_settings = get_option('ee_session_settings');
507
+			$session_settings['sid_salt'] = $this->_sid_salt;
508
+			update_option('ee_session_settings', $session_settings);
509 509
 		}
510 510
 		return $this->_sid_salt;
511 511
 	}
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
 	  * @param bool $new_session
534 534
 	  * @return TRUE on success, FALSE on fail
535 535
 	  */
536
-	public function update( $new_session = FALSE ) {
537
-		$this->_session_data = isset( $this->_session_data )
538
-			&& is_array( $this->_session_data )
539
-			&& isset( $this->_session_data['id'])
536
+	public function update($new_session = FALSE) {
537
+		$this->_session_data = isset($this->_session_data)
538
+			&& is_array($this->_session_data)
539
+			&& isset($this->_session_data['id'])
540 540
 			? $this->_session_data
541 541
 			: NULL;
542
-		if ( empty( $this->_session_data )) {
542
+		if (empty($this->_session_data)) {
543 543
 			$this->_set_defaults();
544 544
 		}
545 545
 		$session_data = array();
546
-		foreach ( $this->_session_data as $key => $value ) {
546
+		foreach ($this->_session_data as $key => $value) {
547 547
 
548
-			switch( $key ) {
548
+			switch ($key) {
549 549
 
550 550
 				case 'id' :
551 551
 					// session ID
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 				break;
564 564
 
565 565
 				case 'init_access' :
566
-					$session_data['init_access'] = absint( $value );
566
+					$session_data['init_access'] = absint($value);
567 567
 				break;
568 568
 
569 569
 				case 'last_access' :
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 
574 574
 				case 'expiration' :
575 575
 					// when the session expires
576
-					$session_data['expiration'] = ! empty( $this->_expiration )
576
+					$session_data['expiration'] = ! empty($this->_expiration)
577 577
 						? $this->_expiration
578 578
 						: $session_data['init_access'] + $this->_lifespan;
579 579
 				break;
@@ -585,11 +585,11 @@  discard block
 block discarded – undo
585 585
 
586 586
 				case 'pages_visited' :
587 587
 					$page_visit = $this->_get_page_visit();
588
-					if ( $page_visit ) {
588
+					if ($page_visit) {
589 589
 						// set pages visited where the first will be the http referrer
590
-						$this->_session_data[ 'pages_visited' ][ $this->_time ] = $page_visit;
590
+						$this->_session_data['pages_visited'][$this->_time] = $page_visit;
591 591
 						// we'll only save the last 10 page visits.
592
-						$session_data[ 'pages_visited' ] = array_slice( $this->_session_data['pages_visited'], -10 );
592
+						$session_data['pages_visited'] = array_slice($this->_session_data['pages_visited'], -10);
593 593
 					}
594 594
 				break;
595 595
 
@@ -603,9 +603,9 @@  discard block
 block discarded – undo
603 603
 
604 604
 		$this->_session_data = $session_data;
605 605
 		// creating a new session does not require saving to the db just yet
606
-		if ( ! $new_session ) {
606
+		if ( ! $new_session) {
607 607
 			// ready? let's save
608
-			if ( $this->_save_session_to_db() ) {
608
+			if ($this->_save_session_to_db()) {
609 609
 				return TRUE;
610 610
 			} else {
611 611
 				return FALSE;
@@ -626,9 +626,9 @@  discard block
 block discarded – undo
626 626
 	 * 	@return bool
627 627
 	 */
628 628
 	private function _create_espresso_session( ) {
629
-		do_action( 'AHEE_log', __CLASS__, __FUNCTION__, '' );
629
+		do_action('AHEE_log', __CLASS__, __FUNCTION__, '');
630 630
 		// use the update function for now with $new_session arg set to TRUE
631
-		return  $this->update( TRUE ) ? TRUE : FALSE;
631
+		return  $this->update(TRUE) ? TRUE : FALSE;
632 632
 	}
633 633
 
634 634
 
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
 			return FALSE;
653 653
 		}
654 654
 		// first serialize all of our session data
655
-		$session_data = serialize( $this->_session_data );
655
+		$session_data = serialize($this->_session_data);
656 656
 		// encrypt it if we are using encryption
657
-		$session_data = $this->_use_encryption ? $this->encryption->encrypt( $session_data ) : $session_data;
657
+		$session_data = $this->_use_encryption ? $this->encryption->encrypt($session_data) : $session_data;
658 658
 		// maybe save hash check
659
-		if ( apply_filters( 'FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG ) ) {
660
-			set_transient( EE_Session::hash_check_prefix . $this->_sid, md5( $session_data ), $this->_lifespan );
659
+		if (apply_filters('FHEE__EE_Session___perform_session_id_hash_check', WP_DEBUG)) {
660
+			set_transient(EE_Session::hash_check_prefix.$this->_sid, md5($session_data), $this->_lifespan);
661 661
 		}
662 662
 		// we're using the Transient API for storing session data, cuz it's so damn simple -> set_transient(  transient ID, data, expiry )
663
-		return set_transient( EE_Session::session_id_prefix . $this->_sid, $session_data, $this->_lifespan );
663
+		return set_transient(EE_Session::session_id_prefix.$this->_sid, $session_data, $this->_lifespan);
664 664
 	}
665 665
 
666 666
 
@@ -686,10 +686,10 @@  discard block
 block discarded – undo
686 686
 			'HTTP_FORWARDED',
687 687
 			'REMOTE_ADDR'
688 688
 		);
689
-		foreach ( $server_keys as $key ){
690
-			if ( isset( $_SERVER[ $key ] )) {
691
-				foreach ( array_map( 'trim', explode( ',', $_SERVER[ $key ] )) as $ip ) {
692
-					if ( $ip === '127.0.0.1' || filter_var( $ip, FILTER_VALIDATE_IP ) !== FALSE ) {
689
+		foreach ($server_keys as $key) {
690
+			if (isset($_SERVER[$key])) {
691
+				foreach (array_map('trim', explode(',', $_SERVER[$key])) as $ip) {
692
+					if ($ip === '127.0.0.1' || filter_var($ip, FILTER_VALIDATE_IP) !== FALSE) {
693 693
 						$visitor_ip = $ip;
694 694
 					}
695 695
 				}
@@ -710,45 +710,45 @@  discard block
 block discarded – undo
710 710
 	public function _get_page_visit() {
711 711
 
712 712
 //		echo '<h3>'. __CLASS__ .'->'.__FUNCTION__.'  ( line no: ' . __LINE__ . ' )</h3>';
713
-		$page_visit = home_url('/') . 'wp-admin/admin-ajax.php';
713
+		$page_visit = home_url('/').'wp-admin/admin-ajax.php';
714 714
 
715 715
 		// check for request url
716
-		if ( isset( $_SERVER['REQUEST_URI'] )) {
716
+		if (isset($_SERVER['REQUEST_URI'])) {
717 717
 
718
-			$request_uri = esc_url( $_SERVER['REQUEST_URI'] );
718
+			$request_uri = esc_url($_SERVER['REQUEST_URI']);
719 719
 
720
-			$ru_bits = explode( '?', $request_uri );
720
+			$ru_bits = explode('?', $request_uri);
721 721
 			$request_uri = $ru_bits[0];
722 722
 			//echo '<h1>$request_uri   ' . $request_uri . '</h1>';
723 723
 
724 724
 			// check for and grab host as well
725
-			if ( isset( $_SERVER['HTTP_HOST'] )) {
726
-				$http_host = esc_url( $_SERVER['HTTP_HOST'] );
725
+			if (isset($_SERVER['HTTP_HOST'])) {
726
+				$http_host = esc_url($_SERVER['HTTP_HOST']);
727 727
 			} else {
728 728
 				$http_host = '';
729 729
 			}
730 730
 			//echo '<h1>$http_host   ' . $http_host . '</h1>';
731 731
 
732 732
 			// check for page_id in SERVER REQUEST
733
-			if ( isset( $_REQUEST['page_id'] )) {
733
+			if (isset($_REQUEST['page_id'])) {
734 734
 				// rebuild $e_reg without any of the extra parameters
735
-				$page_id = '?page_id=' . esc_attr( $_REQUEST['page_id'] ) . '&amp;';
735
+				$page_id = '?page_id='.esc_attr($_REQUEST['page_id']).'&amp;';
736 736
 			} else {
737 737
 				$page_id = '?';
738 738
 			}
739 739
 			// check for $e_reg in SERVER REQUEST
740
-			if ( isset( $_REQUEST['ee'] )) {
740
+			if (isset($_REQUEST['ee'])) {
741 741
 				// rebuild $e_reg without any of the extra parameters
742
-				$e_reg = 'ee=' . esc_attr( $_REQUEST['ee'] );
742
+				$e_reg = 'ee='.esc_attr($_REQUEST['ee']);
743 743
 			} else {
744 744
 				$e_reg = '';
745 745
 			}
746 746
 
747
-			$page_visit = rtrim( $http_host . $request_uri . $page_id . $e_reg, '?' );
747
+			$page_visit = rtrim($http_host.$request_uri.$page_id.$e_reg, '?');
748 748
 
749 749
 		}
750 750
 
751
-		return $page_visit != home_url( '/wp-admin/admin-ajax.php' ) ? $page_visit : '';
751
+		return $page_visit != home_url('/wp-admin/admin-ajax.php') ? $page_visit : '';
752 752
 
753 753
 	}
754 754
 
@@ -777,14 +777,14 @@  discard block
 block discarded – undo
777 777
 	  * @param string $function
778 778
 	  * @return void
779 779
 	  */
780
-	public function clear_session( $class = '', $function = '' ) {
780
+	public function clear_session($class = '', $function = '') {
781 781
 		//echo '<h3 style="color:#999;line-height:.9em;"><span style="color:#2EA2CC">' . __CLASS__ . '</span>::<span style="color:#E76700">' . __FUNCTION__ . '( ' . $class . '::' . $function . '() )</span><br/><span style="font-size:9px;font-weight:normal;">' . __FILE__ . '</span>    <b style="font-size:10px;">  ' . __LINE__ . ' </b></h3>';
782
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : ' . $class . '::' .  $function . '()' );
782
+		do_action('AHEE_log', __FILE__, __FUNCTION__, 'session cleared by : '.$class.'::'.$function.'()');
783 783
 		$this->reset_cart();
784 784
 		$this->reset_checkout();
785 785
 		$this->reset_transaction();
786 786
 		// wipe out everything that isn't a default session datum
787
-		$this->reset_data( array_keys( $this->_session_data ));
787
+		$this->reset_data(array_keys($this->_session_data));
788 788
 		// reset initial site access time and the session expiration
789 789
 		$this->_set_init_access_and_expiration();
790 790
 		$this->_save_session_to_db();
@@ -799,42 +799,42 @@  discard block
 block discarded – undo
799 799
 	  * @param bool  $show_all_notices
800 800
 	  * @return TRUE on success, FALSE on fail
801 801
 	  */
802
-	public function reset_data( $data_to_reset = array(), $show_all_notices = FALSE ) {
802
+	public function reset_data($data_to_reset = array(), $show_all_notices = FALSE) {
803 803
 		// if $data_to_reset is not in an array, then put it in one
804
-		if ( ! is_array( $data_to_reset ) ) {
805
-			$data_to_reset = array ( $data_to_reset );
804
+		if ( ! is_array($data_to_reset)) {
805
+			$data_to_reset = array($data_to_reset);
806 806
 		}
807 807
 		// nothing ??? go home!
808
-		if ( empty( $data_to_reset )) {
809
-			EE_Error::add_error( __( 'No session data could be reset, because no session var name was provided.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
808
+		if (empty($data_to_reset)) {
809
+			EE_Error::add_error(__('No session data could be reset, because no session var name was provided.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
810 810
 			return FALSE;
811 811
 		}
812 812
 		$return_value = TRUE;
813 813
 		// since $data_to_reset is an array, cycle through the values
814
-		foreach ( $data_to_reset as $reset ) {
814
+		foreach ($data_to_reset as $reset) {
815 815
 
816 816
 			// first check to make sure it is a valid session var
817
-			if ( isset( $this->_session_data[ $reset ] )) {
817
+			if (isset($this->_session_data[$reset])) {
818 818
 				// then check to make sure it is not a default var
819
-				if ( ! array_key_exists( $reset, $this->_default_session_vars )) {
819
+				if ( ! array_key_exists($reset, $this->_default_session_vars)) {
820 820
 					// remove session var
821
-					unset( $this->_session_data[ $reset ] );
822
-					if ( $show_all_notices ) {
823
-						EE_Error::add_success( sprintf( __( 'The session variable %s was removed.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
821
+					unset($this->_session_data[$reset]);
822
+					if ($show_all_notices) {
823
+						EE_Error::add_success(sprintf(__('The session variable %s was removed.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
824 824
 					}
825
-					$return_value = !isset($return_value) ? TRUE : $return_value;
825
+					$return_value = ! isset($return_value) ? TRUE : $return_value;
826 826
 
827 827
 				} else {
828 828
 					// yeeeeeeeeerrrrrrrrrrr OUT !!!!
829
-					if ( $show_all_notices ) {
830
-						EE_Error::add_error( sprintf( __( 'Sorry! %s is a default session datum and can not be reset.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
829
+					if ($show_all_notices) {
830
+						EE_Error::add_error(sprintf(__('Sorry! %s is a default session datum and can not be reset.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
831 831
 					}
832 832
 					$return_value = FALSE;
833 833
 				}
834 834
 
835
-			} else if ( $show_all_notices ) {
835
+			} else if ($show_all_notices) {
836 836
 				// oops! that session var does not exist!
837
-				EE_Error::add_error( sprintf( __( 'The session item provided, %s, is invalid or does not exist.', 'event_espresso' ), $reset ), __FILE__, __FUNCTION__, __LINE__ );
837
+				EE_Error::add_error(sprintf(__('The session item provided, %s, is invalid or does not exist.', 'event_espresso'), $reset), __FILE__, __FUNCTION__, __LINE__);
838 838
 				$return_value = FALSE;
839 839
 			}
840 840
 
@@ -855,8 +855,8 @@  discard block
 block discarded – undo
855 855
 	 *   @return	 string
856 856
 	 */
857 857
 	public function wp_loaded() {
858
-		if ( isset(  EE_Registry::instance()->REQ ) && EE_Registry::instance()->REQ->is_set( 'clear_session' )) {
859
-			$this->clear_session( __CLASS__, __FUNCTION__ );
858
+		if (isset(EE_Registry::instance()->REQ) && EE_Registry::instance()->REQ->is_set('clear_session')) {
859
+			$this->clear_session(__CLASS__, __FUNCTION__);
860 860
 		}
861 861
 	}
862 862
 
@@ -881,24 +881,24 @@  discard block
 block discarded – undo
881 881
 	  */
882 882
 	 public function garbage_collection() {
883 883
 		 // only perform during regular requests
884
-		 if ( ! defined( 'DOING_AJAX') || ! DOING_AJAX ) {
884
+		 if ( ! defined('DOING_AJAX') || ! DOING_AJAX) {
885 885
 			 /** @type WPDB $wpdb */
886 886
 			 global $wpdb;
887 887
 			 // since transient expiration timestamps are set in the future, we can compare against NOW
888 888
 			 $expiration = time();
889
-			 $too_far_in_the_the_future = $expiration + ( $this->_lifespan * 2 );
889
+			 $too_far_in_the_the_future = $expiration + ($this->_lifespan * 2);
890 890
 			 // filter the query limit. Set to 0 to turn off garbage collection
891
-			 $expired_session_transient_delete_query_limit = absint( apply_filters( 'FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50 ));
891
+			 $expired_session_transient_delete_query_limit = absint(apply_filters('FHEE__EE_Session__garbage_collection___expired_session_transient_delete_query_limit', 50));
892 892
 			 // non-zero LIMIT means take out the trash
893
-			 if ( $expired_session_transient_delete_query_limit ) {
893
+			 if ($expired_session_transient_delete_query_limit) {
894 894
 				 //array of transient keys that require garbage collection
895 895
 				 $session_keys = array(
896 896
 					 EE_Session::session_id_prefix,
897 897
 					 EE_Session::hash_check_prefix,
898 898
 				 );
899
-				 foreach ( $session_keys as $session_key ) {
900
-					 $session_key = str_replace( '_', '\_', $session_key );
901
-					 $session_key = '\_transient\_timeout\_' . $session_key . '%';
899
+				 foreach ($session_keys as $session_key) {
900
+					 $session_key = str_replace('_', '\_', $session_key);
901
+					 $session_key = '\_transient\_timeout\_'.$session_key.'%';
902 902
 					 $SQL = "
903 903
 					SELECT option_name
904 904
 					FROM {$wpdb->options}
@@ -908,28 +908,28 @@  discard block
 block discarded – undo
908 908
 					OR option_value > {$too_far_in_the_the_future} )
909 909
 					LIMIT {$expired_session_transient_delete_query_limit}
910 910
 				";
911
-					 $expired_sessions = $wpdb->get_col( $SQL );
911
+					 $expired_sessions = $wpdb->get_col($SQL);
912 912
 					 // valid results?
913
-					 if ( ! $expired_sessions instanceof WP_Error && ! empty( $expired_sessions ) ) {
913
+					 if ( ! $expired_sessions instanceof WP_Error && ! empty($expired_sessions)) {
914 914
 						 // format array of results into something usable within the actual DELETE query's IN clause
915 915
 						 $expired = array();
916
-						 foreach ( $expired_sessions as $expired_session ) {
917
-							 $expired[ ] = "'" . $expired_session . "'";
918
-							 $expired[ ] = "'" . str_replace( 'timeout_', '', $expired_session ) . "'";
916
+						 foreach ($expired_sessions as $expired_session) {
917
+							 $expired[] = "'".$expired_session."'";
918
+							 $expired[] = "'".str_replace('timeout_', '', $expired_session)."'";
919 919
 						 }
920
-						 $expired = implode( ', ', $expired );
920
+						 $expired = implode(', ', $expired);
921 921
 						 $SQL = "
922 922
 						DELETE FROM {$wpdb->options}
923 923
 						WHERE option_name
924 924
 						IN ( $expired );
925 925
 					 ";
926
-						 $results = $wpdb->query( $SQL );
926
+						 $results = $wpdb->query($SQL);
927 927
 						 // if something went wrong, then notify the admin
928
-						 if ( $results instanceof WP_Error && is_admin() ) {
929
-							 EE_Error::add_error( $results->get_error_message(), __FILE__, __FUNCTION__, __LINE__ );
928
+						 if ($results instanceof WP_Error && is_admin()) {
929
+							 EE_Error::add_error($results->get_error_message(), __FILE__, __FUNCTION__, __LINE__);
930 930
 						 }
931 931
 					 }
932
-					 do_action( 'FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit );
932
+					 do_action('FHEE__EE_Session__garbage_collection___end', $expired_session_transient_delete_query_limit);
933 933
 				 }
934 934
 			 }
935 935
 		 }
Please login to merge, or discard this patch.
core/EE_System.core.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -613,7 +613,7 @@
 block discarded – undo
613 613
 	 * so that it will be done when migrations are finished
614 614
 	 * @param boolean $initialize_addons_too if true, we double-check addons' database tables etc too;
615 615
 	 *		however,
616
-	 * @param boolean $verify_db_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
616
+	 * @param boolean $verify_schema if true will re-check the database tables have the correct schema. This is a resource-intensive job
617 617
 	 * so we prefer to only do it when necessary
618 618
 	 * @return void
619 619
 	 */
Please login to merge, or discard this patch.
Braces   +11 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -578,7 +580,7 @@  discard block
 block discarded – undo
578 580
 				$espresso_db_update =  array( $espresso_db_update=>array() );
579 581
 				update_option( 'espresso_db_update', $espresso_db_update );
580 582
 			}
581
-		}else{
583
+		} else{
582 584
 			$corrected_db_update = array();
583 585
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
584 586
 			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
@@ -588,7 +590,7 @@  discard block
 block discarded – undo
588 590
 					//fix it!
589 591
 					$version_string = $should_be_array;
590 592
 					$corrected_db_update[$version_string] = array('unknown-date');
591
-				}else{
593
+				} else{
592 594
 					//ok it checks out
593 595
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
594 596
 				}
@@ -633,7 +635,7 @@  discard block
 block discarded – undo
633 635
 					$addon->initialize_db_if_no_migrations_required();
634 636
 				}
635 637
 			}
636
-		}else{
638
+		} else{
637 639
 			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
638 640
 		}
639 641
 		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
@@ -703,7 +705,7 @@  discard block
 block discarded – undo
703 705
 				//it a version we haven't seen before
704 706
 				if( $version_is_higher === 1 ){
705 707
 					$req_type = EE_System::req_type_upgrade;
706
-				}else{
708
+				} else{
707 709
 					$req_type = EE_System::req_type_downgrade;
708 710
 				}
709 711
 				delete_option( $activation_indicator_option_name );
@@ -712,10 +714,10 @@  discard block
 block discarded – undo
712 714
 				if( get_option( $activation_indicator_option_name, FALSE ) ){
713 715
 					if ( $version_is_higher === -1 ){
714 716
 						$req_type = EE_System::req_type_downgrade;
715
-					}elseif( $version_is_higher === 0 ){
717
+					} elseif( $version_is_higher === 0 ){
716 718
 						//we've seen this version before, but it's an activation. must be a reactivation
717 719
 						$req_type = EE_System::req_type_reactivation;
718
-					}else{//$version_is_higher === 1
720
+					} else{//$version_is_higher === 1
719 721
 						$req_type = EE_System::req_type_upgrade;
720 722
 					}
721 723
 					delete_option( $activation_indicator_option_name );
@@ -723,10 +725,10 @@  discard block
 block discarded – undo
723 725
 					//we've seen this version before and the activation indicate doesn't show it was just activated
724 726
 					if ( $version_is_higher === -1 ){
725 727
 						$req_type = EE_System::req_type_downgrade;
726
-					}elseif( $version_is_higher === 0 ){
728
+					} elseif( $version_is_higher === 0 ){
727 729
 						//we've seen this version before and it's not an activation. its normal request
728 730
 						$req_type = EE_System::req_type_normal;
729
-					}else{//$version_is_higher === 1
731
+					} else{//$version_is_higher === 1
730 732
 						$req_type = EE_System::req_type_upgrade;
731 733
 					}
732 734
 				}
Please login to merge, or discard this patch.
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -203,14 +203,14 @@  discard block
 block discarded – undo
203 203
 
204 204
 
205 205
 	/**
206
-	* detect_if_activation_or_upgrade
207
-	*
208
-	* Takes care of detecting whether this is a brand new install or code upgrade,
209
-	* and either setting up the DB or setting up maintenance mode etc.
210
-	*
211
-	* @access public
212
-	* @return void
213
-	*/
206
+	 * detect_if_activation_or_upgrade
207
+	 *
208
+	 * Takes care of detecting whether this is a brand new install or code upgrade,
209
+	 * and either setting up the DB or setting up maintenance mode etc.
210
+	 *
211
+	 * @access public
212
+	 * @return void
213
+	 */
214 214
 	public function detect_if_activation_or_upgrade() {
215 215
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
216 216
 
@@ -514,11 +514,11 @@  discard block
 block discarded – undo
514 514
 			$query_params =  array( 'page' => 'espresso_about' );
515 515
 
516 516
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
517
-			    $query_params['new_activation'] = TRUE;
517
+				$query_params['new_activation'] = TRUE;
518 518
 			}
519 519
 
520 520
 			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
521
-			    $query_params['reactivation'] = TRUE;
521
+				$query_params['reactivation'] = TRUE;
522 522
 			}
523 523
 			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
524 524
 			wp_safe_redirect( $url );
@@ -621,11 +621,11 @@  discard block
 block discarded – undo
621 621
 
622 622
 
623 623
 	/**
624
-	* _incompatible_addon_error
625
-	*
626
-	* @access public
627
-	* @return void
628
-	*/
624
+	 * _incompatible_addon_error
625
+	 *
626
+	 * @access public
627
+	 * @return void
628
+	 */
629 629
 	private function _incompatible_addon_error() {
630 630
 		// get array of classes hooking into here
631 631
 		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
@@ -747,14 +747,14 @@  discard block
 block discarded – undo
747 747
 
748 748
 
749 749
 	/**
750
-	* load_controllers
751
-	*
752
-	* this is the best place to load any additional controllers that needs access to EE core.
753
-	* it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
754
-	*
755
-	* @access public
756
-	* @return void
757
-	*/
750
+	 * load_controllers
751
+	 *
752
+	 * this is the best place to load any additional controllers that needs access to EE core.
753
+	 * it is expected that all basic core EE systems, that are not dependant on the current request are loaded at this time
754
+	 *
755
+	 * @access public
756
+	 * @return void
757
+	 */
758 758
 	public function load_controllers() {
759 759
 		do_action( 'AHEE__EE_System__load_controllers__start' );
760 760
 		// let's get it started
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
 
772 772
 
773 773
 	/**
774
-	* core_loaded_and_ready
775
-	*
776
-	* all of the basic EE core should be loaded at this point and available regardless of M-Mode
777
-	*
778
-	* @access public
779
-	* @return void
780
-	*/
774
+	 * core_loaded_and_ready
775
+	 *
776
+	 * all of the basic EE core should be loaded at this point and available regardless of M-Mode
777
+	 *
778
+	 * @access public
779
+	 * @return void
780
+	 */
781 781
 	public function core_loaded_and_ready() {
782 782
 		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
783 783
 		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
@@ -788,13 +788,13 @@  discard block
 block discarded – undo
788 788
 
789 789
 
790 790
 	/**
791
-	* initialize
792
-	*
793
-	* this is the best place to begin initializing client code
794
-	*
795
-	* @access public
796
-	* @return void
797
-	*/
791
+	 * initialize
792
+	 *
793
+	 * this is the best place to begin initializing client code
794
+	 *
795
+	 * @access public
796
+	 * @return void
797
+	 */
798 798
 	public function initialize() {
799 799
 		do_action( 'AHEE__EE_System__initialize' );
800 800
 	}
@@ -802,13 +802,13 @@  discard block
 block discarded – undo
802 802
 
803 803
 
804 804
 	/**
805
-	* initialize_last
806
-	*
807
-	* this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
808
-	*
809
-	* @access public
810
-	* @return void
811
-	*/
805
+	 * initialize_last
806
+	 *
807
+	 * this is run really late during the WP init hookpoint, and ensures that mostly everything else that needs to initialize has done so
808
+	 *
809
+	 * @access public
810
+	 * @return void
811
+	 */
812 812
 	public function initialize_last() {
813 813
 		do_action( 'AHEE__EE_System__initialize_last' );
814 814
 	}
@@ -817,14 +817,14 @@  discard block
 block discarded – undo
817 817
 
818 818
 
819 819
 	/**
820
-	* set_hooks_for_shortcodes_modules_and_addons
821
-	*
822
-	* this is the best place for other systems to set callbacks for hooking into other parts of EE
823
-	* this happens at the very beginning of the wp_loaded hookpoint
824
-	*
825
-	* @access public
826
-	* @return void
827
-	*/
820
+	 * set_hooks_for_shortcodes_modules_and_addons
821
+	 *
822
+	 * this is the best place for other systems to set callbacks for hooking into other parts of EE
823
+	 * this happens at the very beginning of the wp_loaded hookpoint
824
+	 *
825
+	 * @access public
826
+	 * @return void
827
+	 */
828 828
 	public function set_hooks_for_shortcodes_modules_and_addons() {
829 829
 //		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
830 830
 	}
@@ -833,13 +833,13 @@  discard block
 block discarded – undo
833 833
 
834 834
 
835 835
 	/**
836
-	* do_not_cache
837
-	*
838
-	* sets no cache headers and defines no cache constants for WP plugins
839
-	*
840
-	* @access public
841
-	* @return void
842
-	*/
836
+	 * do_not_cache
837
+	 *
838
+	 * sets no cache headers and defines no cache constants for WP plugins
839
+	 *
840
+	 * @access public
841
+	 * @return void
842
+	 */
843 843
 	public static function do_not_cache() {
844 844
 		// set no cache constants
845 845
 		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 			//Current post
958 958
 			global $post;		
959 959
     	
960
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
960
+			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
961 961
 				//Events Edit Current Event
962 962
 				$admin_bar->add_menu(array(
963 963
 						'id' => 'espresso-toolbar-events-edit',
Please login to merge, or discard this patch.
Spacing   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public static function instance() {
104 104
 		// check if class object is instantiated
105
-		if ( ! self::$_instance instanceof EE_System ) {
105
+		if ( ! self::$_instance instanceof EE_System) {
106 106
 			self::$_instance = new self();
107 107
 		}
108 108
 		return self::$_instance;
@@ -113,12 +113,12 @@  discard block
 block discarded – undo
113 113
 	 * resets the instance and returns it
114 114
 	 * @return EE_System
115 115
 	 */
116
-	public static function reset(){
116
+	public static function reset() {
117 117
 		self::$_instance->_req_type = NULL;
118 118
 		//we need to reset the migration manager in order for it to detect DMSs properly
119 119
 		EE_Data_Migration_Manager::reset();
120 120
 		//make sure none of the old hooks are left hanging around
121
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations');
121
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
122 122
 		self::instance()->detect_activations_or_upgrades();
123 123
 		self::instance()->perform_activations_upgrades_and_migrations();
124 124
 		return self::instance();
@@ -134,26 +134,26 @@  discard block
 block discarded – undo
134 134
 	 * @access    private
135 135
 	 */
136 136
 	private function __construct() {
137
-		do_action( 'AHEE__EE_System__construct__begin', $this );
137
+		do_action('AHEE__EE_System__construct__begin', $this);
138 138
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
139
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
139
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
140 140
 		// when an ee addon is activated, we want to call the core hook(s) again
141 141
 		// because the newly-activated addon didn't get a chance to run at all
142
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
142
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
143 143
 		// detect whether install or upgrade
144
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
144
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
145 145
 		// load EE_Config, EE_Textdomain, etc
146
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
146
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
147 147
 		// load EE_Config, EE_Textdomain, etc
148
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
148
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
149 149
 		// you wanna get going? I wanna get going... let's get going!
150
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
150
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
151 151
 		//other housekeeping
152 152
 		//exclude EE critical pages from wp_list_pages
153
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
153
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
154 154
 		// ALL EE Addons should use the following hook point to attach their initial setup too
155 155
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
156
-		do_action( 'AHEE__EE_System__construct__complete', $this );
156
+		do_action('AHEE__EE_System__construct__complete', $this);
157 157
 	}
158 158
 
159 159
 
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
 	public function load_espresso_addons() {
174 174
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
175 175
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
176
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
176
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
177 177
 		//load and setup EE_Capabilities
178
-		EE_Registry::instance()->load_core( 'Capabilities' );
178
+		EE_Registry::instance()->load_core('Capabilities');
179 179
 		//caps need to be initialized on every request so that capability maps are set.
180 180
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
181 181
 		EE_Registry::instance()->CAP->init_caps();
182
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
182
+		do_action('AHEE__EE_System__load_espresso_addons');
183 183
 	}
184 184
 
185 185
 
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @access public
195 195
 	 * @return void
196 196
 	 */
197
-	public function detect_activations_or_upgrades(){
197
+	public function detect_activations_or_upgrades() {
198 198
 		//first off: let's make sure to handle core
199 199
 		$this->detect_if_activation_or_upgrade();
200
-		foreach(EE_Registry::instance()->addons as $addon){
200
+		foreach (EE_Registry::instance()->addons as $addon) {
201 201
 			//detect teh request type for that addon
202 202
 			$addon->detect_activation_or_upgrade();
203 203
 		}
@@ -218,44 +218,44 @@  discard block
 block discarded – undo
218 218
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
219 219
 
220 220
 		// load M-Mode class
221
-		EE_Registry::instance()->load_core( 'Maintenance_Mode' );
221
+		EE_Registry::instance()->load_core('Maintenance_Mode');
222 222
 		// check if db has been updated, or if its a brand-new installation
223 223
 
224 224
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
225
-		$request_type =  $this->detect_req_type($espresso_db_update);
225
+		$request_type = $this->detect_req_type($espresso_db_update);
226 226
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
227
-		if( $request_type != EE_System::req_type_normal){
227
+		if ($request_type != EE_System::req_type_normal) {
228 228
 			EE_Registry::instance()->load_helper('Activation');
229 229
 		}
230 230
 
231
-		switch($request_type){
231
+		switch ($request_type) {
232 232
 			case EE_System::req_type_new_activation:
233
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
234
-				$this->_handle_core_version_change( $espresso_db_update );
233
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
234
+				$this->_handle_core_version_change($espresso_db_update);
235 235
 				break;
236 236
 			case EE_System::req_type_reactivation:
237
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
238
-				$this->_handle_core_version_change( $espresso_db_update );
237
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
238
+				$this->_handle_core_version_change($espresso_db_update);
239 239
 				break;
240 240
 			case EE_System::req_type_upgrade:
241
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
241
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
242 242
 				//migrations may be required now that we've upgraded
243 243
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
244
-				$this->_handle_core_version_change( $espresso_db_update );
244
+				$this->_handle_core_version_change($espresso_db_update);
245 245
 //				echo "done upgrade";die;
246 246
 				break;
247 247
 			case EE_System::req_type_downgrade:
248
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
248
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
249 249
 				//its possible migrations are no longer required
250 250
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
251
-				$this->_handle_core_version_change( $espresso_db_update );
251
+				$this->_handle_core_version_change($espresso_db_update);
252 252
 				break;
253 253
 			case EE_System::req_type_normal:
254 254
 			default:
255 255
 //				$this->_maybe_redirect_to_ee_about();
256 256
 				break;
257 257
 		}
258
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
258
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
259 259
 	}
260 260
 
261 261
 	/**
@@ -263,10 +263,10 @@  discard block
 block discarded – undo
263 263
 	 * initializing the database later during the request
264 264
 	 * @param array $espresso_db_update
265 265
 	 */
266
-	protected function _handle_core_version_change( $espresso_db_update ){
267
-		$this->update_list_of_installed_versions( $espresso_db_update );
266
+	protected function _handle_core_version_change($espresso_db_update) {
267
+		$this->update_list_of_installed_versions($espresso_db_update);
268 268
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
269
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
269
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
270 270
 	}
271 271
 
272 272
 
@@ -281,44 +281,44 @@  discard block
 block discarded – undo
281 281
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
282 282
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
283 283
 	 */
284
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
285
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
286
-		if( ! $espresso_db_update){
287
-			$espresso_db_update = get_option( 'espresso_db_update' );
284
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
285
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
286
+		if ( ! $espresso_db_update) {
287
+			$espresso_db_update = get_option('espresso_db_update');
288 288
 		}
289 289
 		// check that option is an array
290
-		if( ! is_array( $espresso_db_update )) {
290
+		if ( ! is_array($espresso_db_update)) {
291 291
 			// if option is FALSE, then it never existed
292
-			if ( $espresso_db_update === FALSE ) {
292
+			if ($espresso_db_update === FALSE) {
293 293
 				// make $espresso_db_update an array and save option with autoload OFF
294
-				$espresso_db_update =  array();
295
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
294
+				$espresso_db_update = array();
295
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
296 296
 			} else {
297 297
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
298
-				$espresso_db_update =  array( $espresso_db_update=>array() );
299
-				update_option( 'espresso_db_update', $espresso_db_update );
298
+				$espresso_db_update = array($espresso_db_update=>array());
299
+				update_option('espresso_db_update', $espresso_db_update);
300 300
 			}
301
-		}else{
301
+		} else {
302 302
 			$corrected_db_update = array();
303 303
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
304
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
305
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
304
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
305
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
306 306
 					//the key is an int, and the value IS NOT an array
307 307
 					//so it must be numerically-indexed, where values are versions installed...
308 308
 					//fix it!
309 309
 					$version_string = $should_be_array;
310 310
 					$corrected_db_update[$version_string] = array('unknown-date');
311
-				}else{
311
+				} else {
312 312
 					//ok it checks out
313 313
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
314 314
 				}
315 315
 			}
316 316
 			$espresso_db_update = $corrected_db_update;
317
-			update_option( 'espresso_db_update', $espresso_db_update );
317
+			update_option('espresso_db_update', $espresso_db_update);
318 318
 
319 319
 		}
320 320
 
321
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
321
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
322 322
 		return $espresso_db_update;
323 323
 	}
324 324
 
@@ -337,33 +337,33 @@  discard block
 block discarded – undo
337 337
 	 * so we prefer to only do it when necessary
338 338
 	 * @return void
339 339
 	 */
340
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
340
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
341 341
 		$request_type = $this->detect_req_type();
342 342
 		//only initialize system if we're not in maintenance mode.
343
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
344
-			update_option( 'ee_flush_rewrite_rules', TRUE );
343
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
344
+			update_option('ee_flush_rewrite_rules', TRUE);
345 345
 			EEH_Activation::system_initialization();
346
-			if( $verify_schema ) {
346
+			if ($verify_schema) {
347 347
 				EEH_Activation::initialize_db_and_folders();
348 348
 			}
349 349
 			EEH_Activation::initialize_db_content();
350
-			if( $initialize_addons_too ) {
350
+			if ($initialize_addons_too) {
351 351
 				$this->initialize_addons();
352 352
 			}
353
-		}else{
354
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
353
+		} else {
354
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
355 355
 		}
356
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
357
-			add_action( 'AHEE__EE_System__load_CPTs_and_session__start', array( $this, 'redirect_to_about_ee' ), 9 );
356
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
357
+			add_action('AHEE__EE_System__load_CPTs_and_session__start', array($this, 'redirect_to_about_ee'), 9);
358 358
 		}
359 359
 	}
360 360
 
361 361
 	/**
362 362
 	 * Initializes the db for all registered addons
363 363
 	 */
364
-	public function initialize_addons(){
364
+	public function initialize_addons() {
365 365
 		//foreach registered addon, make sure its db is up-to-date too
366
-		foreach(EE_Registry::instance()->addons as $addon){
366
+		foreach (EE_Registry::instance()->addons as $addon) {
367 367
 			$addon->initialize_db_if_no_migrations_required();
368 368
 		}
369 369
 	}
@@ -375,16 +375,16 @@  discard block
 block discarded – undo
375 375
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
376 376
 	 * @return 	boolean success as to whether or not this option was changed
377 377
 	 */
378
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
379
-		if( ! $version_history ) {
378
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
379
+		if ( ! $version_history) {
380 380
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
381 381
 		}
382
-		if( $current_version_to_add == NULL){
382
+		if ($current_version_to_add == NULL) {
383 383
 			$current_version_to_add = espresso_version();
384 384
 		}
385
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
385
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
386 386
 		// re-save
387
-		return update_option( 'espresso_db_update', $version_history );
387
+		return update_option('espresso_db_update', $version_history);
388 388
 	}
389 389
 
390 390
 
@@ -401,10 +401,10 @@  discard block
 block discarded – undo
401 401
 	 *                            but still know if this is a new install or not
402 402
 	 * @return int one of the constants on EE_System::req_type_
403 403
 	 */
404
-	public function detect_req_type( $espresso_db_update = NULL ){
405
-		if ( $this->_req_type === NULL ){
406
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
407
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
404
+	public function detect_req_type($espresso_db_update = NULL) {
405
+		if ($this->_req_type === NULL) {
406
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
407
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
408 408
 		}
409 409
 		return $this->_req_type;
410 410
 	}
@@ -420,39 +420,39 @@  discard block
 block discarded – undo
420 420
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
421 421
 	 * @return int one of the constants on EE_System::req_type_*
422 422
 	 */
423
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
424
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
425
-		if( $activation_history_for_addon ){
423
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
424
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
425
+		if ($activation_history_for_addon) {
426 426
 			//it exists, so this isn't a completely new install
427 427
 			//check if this version already in that list of previously installed versions
428
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
428
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
429 429
 				//it a version we haven't seen before
430
-				if( $version_is_higher === 1 ){
430
+				if ($version_is_higher === 1) {
431 431
 					$req_type = EE_System::req_type_upgrade;
432
-				}else{
432
+				} else {
433 433
 					$req_type = EE_System::req_type_downgrade;
434 434
 				}
435
-				delete_option( $activation_indicator_option_name );
435
+				delete_option($activation_indicator_option_name);
436 436
 			} else {
437 437
 				// its not an update. maybe a reactivation?
438
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
439
-					if ( $version_is_higher === -1 ){
438
+				if (get_option($activation_indicator_option_name, FALSE)) {
439
+					if ($version_is_higher === -1) {
440 440
 						$req_type = EE_System::req_type_downgrade;
441
-					}elseif( $version_is_higher === 0 ){
441
+					}elseif ($version_is_higher === 0) {
442 442
 						//we've seen this version before, but it's an activation. must be a reactivation
443 443
 						$req_type = EE_System::req_type_reactivation;
444
-					}else{//$version_is_higher === 1
444
+					} else {//$version_is_higher === 1
445 445
 						$req_type = EE_System::req_type_upgrade;
446 446
 					}
447
-					delete_option( $activation_indicator_option_name );
447
+					delete_option($activation_indicator_option_name);
448 448
 				} else {
449 449
 					//we've seen this version before and the activation indicate doesn't show it was just activated
450
-					if ( $version_is_higher === -1 ){
450
+					if ($version_is_higher === -1) {
451 451
 						$req_type = EE_System::req_type_downgrade;
452
-					}elseif( $version_is_higher === 0 ){
452
+					}elseif ($version_is_higher === 0) {
453 453
 						//we've seen this version before and it's not an activation. its normal request
454 454
 						$req_type = EE_System::req_type_normal;
455
-					}else{//$version_is_higher === 1
455
+					} else {//$version_is_higher === 1
456 456
 						$req_type = EE_System::req_type_upgrade;
457 457
 					}
458 458
 				}
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 		} else {
461 461
 			//brand new install
462 462
 			$req_type = EE_System::req_type_new_activation;
463
-			delete_option( $activation_indicator_option_name );
463
+			delete_option($activation_indicator_option_name);
464 464
 		}
465 465
 		return $req_type;
466 466
 	}
@@ -478,30 +478,30 @@  discard block
 block discarded – undo
478 478
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
479 479
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
480 480
 	 */
481
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
481
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
482 482
 		//find the most recently-activated version
483 483
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
484 484
 		$most_recently_active_version = '0.0.0.dev.000';
485
-		if( is_array( $activation_history_for_addon ) ){
486
-			foreach( $activation_history_for_addon as $version => $times_activated ){
485
+		if (is_array($activation_history_for_addon)) {
486
+			foreach ($activation_history_for_addon as $version => $times_activated) {
487 487
 				//check there is a record of when this version was activated. Otherwise,
488 488
 				//mark it as unknown
489
-				if( ! $times_activated ){
490
-					$times_activated = array( 'unknown-date');
489
+				if ( ! $times_activated) {
490
+					$times_activated = array('unknown-date');
491 491
 				}
492
-				if( is_string( $times_activated ) ){
493
-					$times_activated = array( $times_activated );
492
+				if (is_string($times_activated)) {
493
+					$times_activated = array($times_activated);
494 494
 				}
495
-				foreach( $times_activated as $an_activation ){
496
-					if( $an_activation != 'unknown-date' &&
497
-							$an_activation > $most_recently_active_version_activation  ){
495
+				foreach ($times_activated as $an_activation) {
496
+					if ($an_activation != 'unknown-date' &&
497
+							$an_activation > $most_recently_active_version_activation) {
498 498
 						$most_recently_active_version = $version;
499 499
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
500 500
 					}
501 501
 				}
502 502
 			}
503 503
 		}
504
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
504
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
505 505
 	}
506 506
 
507 507
 
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 	 * @return void
512 512
 	 */
513 513
 	public function redirect_to_about_ee() {
514
-		$notices = EE_Error::get_notices( FALSE );
514
+		$notices = EE_Error::get_notices(FALSE);
515 515
 		//if current user is an admin and it's not an ajax request
516
-		if(EE_Registry::instance()->CAP->current_user_can( 'manage_options', 'espresso_about_default' ) && ! ( defined('DOING_AJAX') && DOING_AJAX  ) && ! isset( $notices[ 'errors' ] ) ){
517
-			$query_params =  array( 'page' => 'espresso_about' );
516
+		if (EE_Registry::instance()->CAP->current_user_can('manage_options', 'espresso_about_default') && ! (defined('DOING_AJAX') && DOING_AJAX) && ! isset($notices['errors'])) {
517
+			$query_params = array('page' => 'espresso_about');
518 518
 
519
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
519
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
520 520
 			    $query_params['new_activation'] = TRUE;
521 521
 			}
522 522
 
523
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
523
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
524 524
 			    $query_params['reactivation'] = TRUE;
525 525
 			}
526
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
527
-			wp_safe_redirect( $url );
526
+			$url = add_query_arg($query_params, admin_url('admin.php'));
527
+			wp_safe_redirect($url);
528 528
 			exit();
529 529
 		}
530 530
 	}
@@ -538,31 +538,31 @@  discard block
 block discarded – undo
538 538
 	 *
539 539
 	 * @return void
540 540
 	 */
541
-	public function load_core_configuration(){
542
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
543
-		EE_Registry::instance()->load_core( 'EE_Load_Textdomain' );
541
+	public function load_core_configuration() {
542
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
543
+		EE_Registry::instance()->load_core('EE_Load_Textdomain');
544 544
 		//load textdomain
545 545
 		EE_Load_Textdomain::load_textdomain();
546 546
 		// load and setup EE_Config and EE_Network_Config
547
-		EE_Registry::instance()->load_core( 'Config' );
548
-		EE_Registry::instance()->load_core( 'Network_Config' );
547
+		EE_Registry::instance()->load_core('Config');
548
+		EE_Registry::instance()->load_core('Network_Config');
549 549
 		// setup autoloaders
550 550
 		// enable logging?
551
-		if ( EE_Registry::instance()->CFG->admin->use_full_logging ) {
552
-			EE_Registry::instance()->load_core( 'Log' );
551
+		if (EE_Registry::instance()->CFG->admin->use_full_logging) {
552
+			EE_Registry::instance()->load_core('Log');
553 553
 		}
554 554
 		// check for activation errors
555
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
556
-		if ( $activation_errors ) {
557
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
558
-			update_option( 'ee_plugin_activation_errors', FALSE );
555
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
556
+		if ($activation_errors) {
557
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
558
+			update_option('ee_plugin_activation_errors', FALSE);
559 559
 		}
560 560
 		// get model names
561 561
 		$this->_parse_model_names();
562 562
 
563 563
 		//load caf stuff a chance to play during the activation process too.
564 564
 		$this->_maybe_brew_regular();
565
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
565
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
566 566
 	}
567 567
 
568 568
 
@@ -571,23 +571,23 @@  discard block
 block discarded – undo
571 571
 	 *
572 572
 	 * @return void
573 573
 	 */
574
-	private function _parse_model_names(){
574
+	private function _parse_model_names() {
575 575
 		//get all the files in the EE_MODELS folder that end in .model.php
576
-		$models = glob( EE_MODELS.'*.model.php');
576
+		$models = glob(EE_MODELS.'*.model.php');
577 577
 		$model_names = array();
578 578
 		$non_abstract_db_models = array();
579
-		foreach( $models as $model ){
579
+		foreach ($models as $model) {
580 580
 			// get model classname
581
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
582
-			$shortname = str_replace( 'EEM_', '', $classname );
581
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
582
+			$shortname = str_replace('EEM_', '', $classname);
583 583
 			$reflectionClass = new ReflectionClass($classname);
584
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
584
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
585 585
 				$non_abstract_db_models[$shortname] = $classname;
586 586
 			}
587
-			$model_names[ $shortname ] = $classname;
587
+			$model_names[$shortname] = $classname;
588 588
 		}
589
-		EE_Registry::instance()->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
590
-		EE_Registry::instance()->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
589
+		EE_Registry::instance()->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
590
+		EE_Registry::instance()->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
591 591
 	}
592 592
 
593 593
 
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 	 * @return void
598 598
 	 */
599 599
 	private function _maybe_brew_regular() {
600
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
601
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
600
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
601
+			require_once EE_CAFF_PATH.'brewing_regular.php';
602 602
 		}
603 603
 	}
604 604
 
@@ -615,9 +615,9 @@  discard block
 block discarded – undo
615 615
 	 * @return void
616 616
 	 */
617 617
 	public function register_shortcodes_modules_and_widgets() {
618
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
618
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
619 619
 		// check for addons using old hookpoint
620
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
620
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
621 621
 			$this->_incompatible_addon_error();
622 622
 		}
623 623
 	}
@@ -631,19 +631,19 @@  discard block
 block discarded – undo
631 631
 	*/
632 632
 	private function _incompatible_addon_error() {
633 633
 		// get array of classes hooking into here
634
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
635
-		if ( ! empty( $class_names )) {
636
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
634
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
635
+		if ( ! empty($class_names)) {
636
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
637 637
 			$msg .= '<ul>';
638
-			foreach ( $class_names as $class_name ) {
639
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
638
+			foreach ($class_names as $class_name) {
639
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
640 640
 			}
641 641
 			$msg .= '</ul>';
642
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
642
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
643 643
 			// save list of incompatible addons to wp-options for later use
644
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
645
-			if ( is_admin() ) {
646
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
644
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
645
+			if (is_admin()) {
646
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
647 647
 			}
648 648
 		}
649 649
 	}
@@ -660,25 +660,25 @@  discard block
 block discarded – undo
660 660
 	 *
661 661
 	 * @return void
662 662
 	 */
663
-	public function brew_espresso(){
664
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
663
+	public function brew_espresso() {
664
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
665 665
 		// load some final core systems
666
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
667
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
668
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
669
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
670
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
671
-		add_action( 'init', array( $this, 'initialize' ), 10 );
672
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
673
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
674
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
675
-
676
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
666
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
667
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
668
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
669
+		add_action('init', array($this, 'load_controllers'), 7);
670
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
671
+		add_action('init', array($this, 'initialize'), 10);
672
+		add_action('init', array($this, 'initialize_last'), 100);
673
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
674
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
675
+
676
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
677 677
 			// pew pew pew
678
-			EE_Registry::instance()->load_core( 'PUE' );
679
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
678
+			EE_Registry::instance()->load_core('PUE');
679
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
680 680
 		}
681
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
681
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
682 682
 	}
683 683
 
684 684
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 	 */
693 693
 	public function set_hooks_for_core() {
694 694
 		$this->_deactivate_incompatible_addons();
695
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
695
+		do_action('AHEE__EE_System__set_hooks_for_core');
696 696
 	}
697 697
 
698 698
 
@@ -701,15 +701,15 @@  discard block
 block discarded – undo
701 701
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
702 702
 	 * deactivates any addons considered incompatible with the current version of EE
703 703
 	 */
704
-	private function _deactivate_incompatible_addons(){
705
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
706
-		if ( ! empty( $incompatible_addons )) {
707
-			$active_plugins = get_option( 'active_plugins', array() );
708
-			foreach ( $active_plugins as $active_plugin ) {
709
-				foreach ( $incompatible_addons as $incompatible_addon ) {
710
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
711
-						unset( $_GET['activate'] );
712
-						espresso_deactivate_plugin( $active_plugin );
704
+	private function _deactivate_incompatible_addons() {
705
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
706
+		if ( ! empty($incompatible_addons)) {
707
+			$active_plugins = get_option('active_plugins', array());
708
+			foreach ($active_plugins as $active_plugin) {
709
+				foreach ($incompatible_addons as $incompatible_addon) {
710
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
711
+						unset($_GET['activate']);
712
+						espresso_deactivate_plugin($active_plugin);
713 713
 					}
714 714
 				}
715 715
 			}
@@ -726,10 +726,10 @@  discard block
 block discarded – undo
726 726
 	 */
727 727
 	public function perform_activations_upgrades_and_migrations() {
728 728
 		//first check if we had previously attempted to setup EE's directories but failed
729
-		if( EEH_Activation::upload_directories_incomplete() ) {
729
+		if (EEH_Activation::upload_directories_incomplete()) {
730 730
 			EEH_Activation::create_upload_directories();
731 731
 		}
732
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
732
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
733 733
 	}
734 734
 
735 735
 
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
 	 *  	@return 	void
742 742
 	 */
743 743
 	public function load_CPTs_and_session() {
744
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
744
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
745 745
 		// register Custom Post Types
746
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
747
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
746
+		EE_Registry::instance()->load_core('Register_CPTs');
747
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
748 748
 	}
749 749
 
750 750
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	* @return void
760 760
 	*/
761 761
 	public function load_controllers() {
762
-		do_action( 'AHEE__EE_System__load_controllers__start' );
762
+		do_action('AHEE__EE_System__load_controllers__start');
763 763
 		// let's get it started
764
-		if ( ! is_admin() && !  EE_Maintenance_Mode::instance()->level() ) {
765
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
766
-			EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true );
767
-		} else if ( ! EE_FRONT_AJAX ) {
768
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
769
-			EE_Registry::instance()->load_core( 'Admin' );
764
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
765
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
766
+			EE_Registry::instance()->load_core('Front_Controller', array(), false, true);
767
+		} else if ( ! EE_FRONT_AJAX) {
768
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
769
+			EE_Registry::instance()->load_core('Admin');
770 770
 		}
771
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
771
+		do_action('AHEE__EE_System__load_controllers__complete');
772 772
 	}
773 773
 
774 774
 
@@ -782,9 +782,9 @@  discard block
 block discarded – undo
782 782
 	* @return void
783 783
 	*/
784 784
 	public function core_loaded_and_ready() {
785
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
786
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
787
-		EE_Registry::instance()->load_core( 'Session' );
785
+		do_action('AHEE__EE_System__core_loaded_and_ready');
786
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
787
+		EE_Registry::instance()->load_core('Session');
788 788
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
789 789
 	}
790 790
 
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
 	* @return void
800 800
 	*/
801 801
 	public function initialize() {
802
-		do_action( 'AHEE__EE_System__initialize' );
802
+		do_action('AHEE__EE_System__initialize');
803 803
 	}
804 804
 
805 805
 
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 	* @return void
814 814
 	*/
815 815
 	public function initialize_last() {
816
-		do_action( 'AHEE__EE_System__initialize_last' );
816
+		do_action('AHEE__EE_System__initialize_last');
817 817
 	}
818 818
 
819 819
 
@@ -845,21 +845,21 @@  discard block
 block discarded – undo
845 845
 	*/
846 846
 	public static function do_not_cache() {
847 847
 		// set no cache constants
848
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
849
-			define( 'DONOTCACHEPAGE', true );
848
+		if ( ! defined('DONOTCACHEPAGE')) {
849
+			define('DONOTCACHEPAGE', true);
850 850
 		}
851
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
852
-			define( 'DONOTCACHCEOBJECT', true );
851
+		if ( ! defined('DONOTCACHCEOBJECT')) {
852
+			define('DONOTCACHCEOBJECT', true);
853 853
 		}
854
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
855
-			define( 'DONOTCACHEDB', true );
854
+		if ( ! defined('DONOTCACHEDB')) {
855
+			define('DONOTCACHEDB', true);
856 856
 		}
857 857
 		// add no cache headers
858
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
858
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
859 859
 		// plus a little extra for nginx
860
-		add_filter( 'nocache_headers', array( 'EE_System', 'nocache_headers_nginx' ), 10, 1 );
860
+		add_filter('nocache_headers', array('EE_System', 'nocache_headers_nginx'), 10, 1);
861 861
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
862
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
862
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
863 863
 	}
864 864
 
865 865
 
@@ -871,7 +871,7 @@  discard block
 block discarded – undo
871 871
 	 * @param $headers
872 872
 	 * @return    array
873 873
 	 */
874
-	public static function nocache_headers_nginx ( $headers ) {
874
+	public static function nocache_headers_nginx($headers) {
875 875
 		$headers['X-Accel-Expires'] = 0;
876 876
 		return $headers;
877 877
 	}
@@ -897,15 +897,15 @@  discard block
 block discarded – undo
897 897
 	 * @param $admin_bar
898 898
 	 * @return    void
899 899
 	 */
900
-	public function espresso_toolbar_items( $admin_bar ) {
900
+	public function espresso_toolbar_items($admin_bar) {
901 901
 
902 902
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
903
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
903
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
904 904
 			return;
905 905
 		}
906 906
 
907
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
908
-		EE_Registry::instance()->load_helper( 'URL' );
907
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
908
+		EE_Registry::instance()->load_helper('URL');
909 909
 		$menu_class = 'espresso_menu_item_class';
910 910
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
911 911
 		//because they're only defined in each of their respective constructors
@@ -917,20 +917,20 @@  discard block
 block discarded – undo
917 917
 		//Top Level
918 918
 		$admin_bar->add_menu(array(
919 919
 				'id' => 'espresso-toolbar',
920
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
920
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
921 921
 				'href' => $events_admin_url,
922 922
 				'meta' => array(
923 923
 						'title' => __('Event Espresso', 'event_espresso'),
924
-						'class' => $menu_class . 'first'
924
+						'class' => $menu_class.'first'
925 925
 				),
926 926
 		));
927 927
 
928 928
 		//Events
929
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
929
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
930 930
 			$admin_bar->add_menu(array(
931 931
 					'id' => 'espresso-toolbar-events',
932 932
 					'parent' => 'espresso-toolbar',
933
-					'title' => __( 'Events', 'event_espresso' ),
933
+					'title' => __('Events', 'event_espresso'),
934 934
 					'href' => $events_admin_url,
935 935
 					'meta' => array(
936 936
 							'title' => __('Events', 'event_espresso'),
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
 		}
942 942
 
943 943
 
944
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
944
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
945 945
 			//Events Add New
946 946
 			$admin_bar->add_menu(array(
947 947
 					'id' => 'espresso-toolbar-events-new',
948 948
 					'parent' => 'espresso-toolbar-events',
949 949
 					'title' => __('Add New', 'event_espresso'),
950
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
950
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
951 951
 					'meta' => array(
952 952
 							'title' => __('Add New', 'event_espresso'),
953 953
 							'target' => '',
@@ -956,18 +956,18 @@  discard block
 block discarded – undo
956 956
 			));
957 957
 		}
958 958
 
959
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
959
+		if (is_single() && (get_post_type() == 'espresso_events')) {
960 960
 
961 961
 			//Current post
962 962
 			global $post;		
963 963
     	
964
-	    	if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
964
+	    	if (EE_Registry::instance()->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
965 965
 				//Events Edit Current Event
966 966
 				$admin_bar->add_menu(array(
967 967
 						'id' => 'espresso-toolbar-events-edit',
968 968
 						'parent' => 'espresso-toolbar-events',
969 969
 						'title' => __('Edit Event', 'event_espresso'),
970
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
970
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
971 971
 						'meta' => array(
972 972
 								'title' => __('Edit Event', 'event_espresso'),
973 973
 								'target' => '',
@@ -979,11 +979,11 @@  discard block
 block discarded – undo
979 979
 		}
980 980
 
981 981
 		//Events View
982
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
982
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
983 983
 			$admin_bar->add_menu(array(
984 984
 					'id' => 'espresso-toolbar-events-view',
985 985
 					'parent' => 'espresso-toolbar-events',
986
-					'title' => __( 'View', 'event_espresso' ),
986
+					'title' => __('View', 'event_espresso'),
987 987
 					'href' => $events_admin_url,
988 988
 					'meta' => array(
989 989
 							'title' => __('View', 'event_espresso'),
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
 			));
994 994
 		}
995 995
 
996
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
996
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
997 997
 			//Events View All
998 998
 			$admin_bar->add_menu(array(
999 999
 					'id' => 'espresso-toolbar-events-all',
1000 1000
 					'parent' => 'espresso-toolbar-events-view',
1001
-					'title' => __( 'All', 'event_espresso' ),
1001
+					'title' => __('All', 'event_espresso'),
1002 1002
 					'href' => $events_admin_url,
1003 1003
 					'meta' => array(
1004 1004
 							'title' => __('All', 'event_espresso'),
@@ -1009,13 +1009,13 @@  discard block
 block discarded – undo
1009 1009
 		}
1010 1010
 
1011 1011
 
1012
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1012
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1013 1013
 			//Events View Today
1014 1014
 			$admin_bar->add_menu(array(
1015 1015
 					'id' => 'espresso-toolbar-events-today',
1016 1016
 					'parent' => 'espresso-toolbar-events-view',
1017 1017
 					'title' => __('Today', 'event_espresso'),
1018
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1018
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1019 1019
 					'meta' => array(
1020 1020
 							'title' => __('Today', 'event_espresso'),
1021 1021
 							'target' => '',
@@ -1025,13 +1025,13 @@  discard block
 block discarded – undo
1025 1025
 		}
1026 1026
 
1027 1027
 
1028
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1028
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1029 1029
 			//Events View This Month
1030 1030
 			$admin_bar->add_menu(array(
1031 1031
 					'id' => 'espresso-toolbar-events-month',
1032 1032
 					'parent' => 'espresso-toolbar-events-view',
1033
-					'title' => __( 'This Month', 'event_espresso'),
1034
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1033
+					'title' => __('This Month', 'event_espresso'),
1034
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1035 1035
 					'meta' => array(
1036 1036
 							'title' => __('This Month', 'event_espresso'),
1037 1037
 							'target' => '',
@@ -1041,11 +1041,11 @@  discard block
 block discarded – undo
1041 1041
 		}
1042 1042
 
1043 1043
 		//Registration Overview
1044
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1044
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1045 1045
 			$admin_bar->add_menu(array(
1046 1046
 					'id' => 'espresso-toolbar-registrations',
1047 1047
 					'parent' => 'espresso-toolbar',
1048
-					'title' => __( 'Registrations', 'event_espresso' ),
1048
+					'title' => __('Registrations', 'event_espresso'),
1049 1049
 					'href' => $reg_admin_url,
1050 1050
 					'meta' => array(
1051 1051
 							'title' => __('Registrations', 'event_espresso'),
@@ -1056,12 +1056,12 @@  discard block
 block discarded – undo
1056 1056
 		}
1057 1057
 
1058 1058
 		//Registration Overview Today
1059
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1059
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1060 1060
 			$admin_bar->add_menu(array(
1061 1061
 					'id' => 'espresso-toolbar-registrations-today',
1062 1062
 					'parent' => 'espresso-toolbar-registrations',
1063
-					'title' => __( 'Today', 'event_espresso'),
1064
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1063
+					'title' => __('Today', 'event_espresso'),
1064
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1065 1065
 					'meta' => array(
1066 1066
 							'title' => __('Today', 'event_espresso'),
1067 1067
 							'target' => '',
@@ -1071,14 +1071,14 @@  discard block
 block discarded – undo
1071 1071
 		}
1072 1072
 
1073 1073
 		//Registration Overview Today Completed
1074
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1074
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1075 1075
 			$admin_bar->add_menu(array(
1076 1076
 					'id' => 'espresso-toolbar-registrations-today-approved',
1077 1077
 					'parent' => 'espresso-toolbar-registrations-today',
1078
-					'title' => __( 'Approved', 'event_espresso' ),
1079
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1078
+					'title' => __('Approved', 'event_espresso'),
1079
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1080 1080
 					'meta' => array(
1081
-							'title' => __('Approved', 'event_espresso' ),
1081
+							'title' => __('Approved', 'event_espresso'),
1082 1082
 							'target' => '',
1083 1083
 							'class' => $menu_class
1084 1084
 					),
@@ -1086,14 +1086,14 @@  discard block
 block discarded – undo
1086 1086
 		}
1087 1087
 
1088 1088
 		//Registration Overview Today Pending\
1089
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1089
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1090 1090
 			$admin_bar->add_menu(array(
1091 1091
 					'id' => 'espresso-toolbar-registrations-today-pending',
1092 1092
 					'parent' => 'espresso-toolbar-registrations-today',
1093
-					'title' => __( 'Pending', 'event_espresso' ),
1094
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1093
+					'title' => __('Pending', 'event_espresso'),
1094
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1095 1095
 					'meta' => array(
1096
-							'title' => __('Pending Payment', 'event_espresso' ),
1096
+							'title' => __('Pending Payment', 'event_espresso'),
1097 1097
 							'target' => '',
1098 1098
 							'class' => $menu_class
1099 1099
 					),
@@ -1101,14 +1101,14 @@  discard block
 block discarded – undo
1101 1101
 		}
1102 1102
 
1103 1103
 		//Registration Overview Today Incomplete
1104
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1104
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1105 1105
 			$admin_bar->add_menu(array(
1106 1106
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1107 1107
 					'parent' => 'espresso-toolbar-registrations-today',
1108
-					'title' => __( 'Not Approved', 'event_espresso' ),
1109
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1108
+					'title' => __('Not Approved', 'event_espresso'),
1109
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1110 1110
 					'meta' => array(
1111
-							'title' => __('Not Approved', 'event_espresso' ),
1111
+							'title' => __('Not Approved', 'event_espresso'),
1112 1112
 							'target' => '',
1113 1113
 							'class' => $menu_class
1114 1114
 					),
@@ -1116,12 +1116,12 @@  discard block
 block discarded – undo
1116 1116
 		}
1117 1117
 
1118 1118
 		//Registration Overview Today Incomplete
1119
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1119
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1120 1120
 			$admin_bar->add_menu(array(
1121 1121
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1122 1122
 					'parent' => 'espresso-toolbar-registrations-today',
1123
-					'title' => __( 'Cancelled', 'event_espresso'),
1124
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1123
+					'title' => __('Cancelled', 'event_espresso'),
1124
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1125 1125
 					'meta' => array(
1126 1126
 							'title' => __('Cancelled', 'event_espresso'),
1127 1127
 							'target' => '',
@@ -1131,12 +1131,12 @@  discard block
 block discarded – undo
1131 1131
 		}
1132 1132
 
1133 1133
 		//Registration Overview This Month
1134
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1134
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1135 1135
 			$admin_bar->add_menu(array(
1136 1136
 					'id' => 'espresso-toolbar-registrations-month',
1137 1137
 					'parent' => 'espresso-toolbar-registrations',
1138
-					'title' => __( 'This Month', 'event_espresso' ),
1139
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1138
+					'title' => __('This Month', 'event_espresso'),
1139
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1140 1140
 					'meta' => array(
1141 1141
 							'title' => __('This Month', 'event_espresso'),
1142 1142
 							'target' => '',
@@ -1146,12 +1146,12 @@  discard block
 block discarded – undo
1146 1146
 		}
1147 1147
 
1148 1148
 		//Registration Overview This Month Approved
1149
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1149
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1150 1150
 			$admin_bar->add_menu(array(
1151 1151
 					'id' => 'espresso-toolbar-registrations-month-approved',
1152 1152
 					'parent' => 'espresso-toolbar-registrations-month',
1153
-					'title' => __( 'Approved', 'event_espresso' ),
1154
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1153
+					'title' => __('Approved', 'event_espresso'),
1154
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1155 1155
 					'meta' => array(
1156 1156
 							'title' => __('Approved', 'event_espresso'),
1157 1157
 							'target' => '',
@@ -1161,12 +1161,12 @@  discard block
 block discarded – undo
1161 1161
 		}
1162 1162
 
1163 1163
 		//Registration Overview This Month Pending
1164
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1164
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1165 1165
 			$admin_bar->add_menu(array(
1166 1166
 					'id' => 'espresso-toolbar-registrations-month-pending',
1167 1167
 					'parent' => 'espresso-toolbar-registrations-month',
1168
-					'title' => __( 'Pending', 'event_espresso'),
1169
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1168
+					'title' => __('Pending', 'event_espresso'),
1169
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1170 1170
 					'meta' => array(
1171 1171
 							'title' => __('Pending', 'event_espresso'),
1172 1172
 							'target' => '',
@@ -1176,14 +1176,14 @@  discard block
 block discarded – undo
1176 1176
 		}
1177 1177
 
1178 1178
 		//Registration Overview This Month Not Approved
1179
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1179
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1180 1180
 			$admin_bar->add_menu(array(
1181 1181
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1182 1182
 					'parent' => 'espresso-toolbar-registrations-month',
1183
-					'title' => __( 'Not Approved', 'event_espresso'),
1184
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1183
+					'title' => __('Not Approved', 'event_espresso'),
1184
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1185 1185
 					'meta' => array(
1186
-							'title' => __('Not Approved', 'event_espresso' ),
1186
+							'title' => __('Not Approved', 'event_espresso'),
1187 1187
 							'target' => '',
1188 1188
 							'class' => $menu_class
1189 1189
 					),
@@ -1192,12 +1192,12 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 
1194 1194
 		//Registration Overview This Month Cancelled
1195
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1195
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1196 1196
 			$admin_bar->add_menu(array(
1197 1197
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1198 1198
 					'parent' => 'espresso-toolbar-registrations-month',
1199 1199
 					'title' => __('Cancelled', 'event_espresso'),
1200
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1200
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1201 1201
 					'meta' => array(
1202 1202
 							'title' => __('Cancelled', 'event_espresso'),
1203 1203
 							'target' => '',
@@ -1207,11 +1207,11 @@  discard block
 block discarded – undo
1207 1207
 		}
1208 1208
 
1209 1209
 		//Extensions & Services
1210
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1210
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1211 1211
 			$admin_bar->add_menu(array(
1212 1212
 					'id' => 'espresso-toolbar-extensions-and-services',
1213 1213
 					'parent' => 'espresso-toolbar',
1214
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1214
+					'title' => __('Extensions & Services', 'event_espresso'),
1215 1215
 					'href' => $extensions_admin_url,
1216 1216
 					'meta' => array(
1217 1217
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1233,8 +1233,8 @@  discard block
 block discarded – undo
1233 1233
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1234 1234
 	 * @return array
1235 1235
 	 */
1236
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1237
-		return  array_merge( $exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array() );
1236
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1237
+		return  array_merge($exclude_array, EE_Registry::instance()->CFG->core->get_critical_pages_array());
1238 1238
 	}
1239 1239
 
1240 1240
 
@@ -1254,11 +1254,11 @@  discard block
 block discarded – undo
1254 1254
 	 */
1255 1255
 	public function wp_enqueue_scripts() {
1256 1256
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1257
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1257
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1258 1258
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1259
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1259
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1260 1260
 				// register jQuery Validate
1261
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE );
1261
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.11.1', TRUE);
1262 1262
 			}
1263 1263
 		}
1264 1264
 	}
Please login to merge, or discard this patch.
core/helpers/EEH_Form_Fields.helper.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 	 *
775 775
 	 * @param mixed $opt_group
776 776
 	 * @param mixed $QSOs
777
-	 * @param mixed $answer
777
+	 * @param string $answer
778 778
 	 * @return string
779 779
 	 */
780 780
 	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
 	/**
1123 1123
 	 * 	prep_required
1124 1124
 	 * @param string|array 	$required
1125
-	 * @return array
1125
+	 * @return string
1126 1126
 	 */
1127 1127
 	static function prep_required( $required = array() ){
1128 1128
 		// make sure required is an array
@@ -1173,8 +1173,8 @@  discard block
 block discarded – undo
1173 1173
 
1174 1174
 	/**
1175 1175
 	 * 	_load_system_dropdowns
1176
-	 * @param array 	$QFI
1177
-	 * @return array
1176
+	 * @param EE_Question_Form_Input 	$QFI
1177
+	 * @return EE_Question_Form_Input
1178 1178
 	 */
1179 1179
 	private static function _load_system_dropdowns( $QFI ){
1180 1180
 		$QST_system = $QFI->get('QST_system');
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 	 * @param    string   $nonce_action     - if using nonces
1464 1464
 	 * @param    bool|string $input_only       - whether to print form header and footer. TRUE returns the input without the form
1465 1465
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1466
-	 * @return    void
1466
+	 * @return    string
1467 1467
 	 */
1468 1468
 	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1469 1469
 		$btn = '';
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 
394 394
 	/**
395 395
 	 * generate_question_groups_html
396
- 	 *
396
+	 *
397 397
 	 * @param string $question_groups
398 398
 	 * @return string HTML
399 399
 	 */
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
 
538 538
 	/**
539 539
 	 * generate_form_input
540
- 	 *
540
+	 *
541 541
 	 * @param EE_Question_Form_Input $QFI
542 542
 	 * @return string HTML
543 543
 	 */
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 
613 613
 	/**
614 614
 	 * generates HTML for a form text input
615
- 	 *
615
+	 *
616 616
 	 * @param string $question 	label content
617 617
 	 * @param string $answer 		form input value attribute
618 618
 	 * @param string $name 			form input name attribute
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 
658 658
 	/**
659 659
 	 * generates HTML for a form textarea
660
- 	 *
660
+	 *
661 661
 	 * @param string $question 		label content
662 662
 	 * @param string $answer 		form input value attribute
663 663
 	 * @param string $name 			form input name attribute
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 
709 709
 	/**
710 710
 	 * generates HTML for a form select input
711
- 	 *
711
+	 *
712 712
 	 * @param string $question 		label content
713 713
 	 * @param string $answer 		form input value attribute
714 714
 	 * @param array $options			array of answer options where array key = option value and array value = option display text
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
 	/**
887 887
 	 * generates HTML for form checkbox inputs
888
- 	 *
888
+	 *
889 889
 	 * @param string $question 		label content
890 890
 	 * @param string $answer 		form input value attribute
891 891
 	 * @param array $options 			array of options where array key = option value and array value = option display text
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 
967 967
 	/**
968 968
 	 * generates HTML for a form datepicker input
969
- 	 *
969
+	 *
970 970
 	 * @param string $question 	label content
971 971
 	 * @param string $answer 		form input value attribute
972 972
 	 * @param string $name 			form input name attribute
Please login to merge, or discard this patch.
Spacing   +378 added lines, -378 removed lines patch added patch discarded remove patch
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * 	@return string
59 59
 	 * 	@todo: at some point we can break this down into other static methods to abstract it a bit better.
60 60
 	 */
61
-	static public function get_form_fields( $input_vars = array(), $id = FALSE ) {
61
+	static public function get_form_fields($input_vars = array(), $id = FALSE) {
62 62
 
63
-		if ( empty($input_vars) ) {
64
-			EE_Error::add_error( __('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
63
+		if (empty($input_vars)) {
64
+			EE_Error::add_error(__('missing required variables for the form field generator', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
65 65
 			return FALSE;
66 66
 		}
67 67
 
@@ -87,25 +87,25 @@  discard block
 block discarded – undo
87 87
 				'append_content' => ''
88 88
 				);
89 89
 
90
-			$input_value = wp_parse_args( $input_value, $defaults );
90
+			$input_value = wp_parse_args($input_value, $defaults);
91 91
 
92 92
 			// required fields get a *
93 93
 			$required = isset($input_value['required']) && $input_value['required'] ? ' <span>*</span>: ' : ': ';
94 94
 			// and the css class "required"
95
-			$css_class = isset( $input_value['css_class'] ) ? $input_value['css_class'] : '';
96
-			$styles = $input_value['required'] ? 'required ' . $css_class : $css_class;
95
+			$css_class = isset($input_value['css_class']) ? $input_value['css_class'] : '';
96
+			$styles = $input_value['required'] ? 'required '.$css_class : $css_class;
97 97
 
98
-			$field_id = ($id) ? $id . '-' . $input_key : $input_key;
99
-			$tabindex = !empty($input_value['tabindex']) ? ' tabindex="' . $input_value['tabindex'] . '"' : '';
98
+			$field_id = ($id) ? $id.'-'.$input_key : $input_key;
99
+			$tabindex = ! empty($input_value['tabindex']) ? ' tabindex="'.$input_value['tabindex'].'"' : '';
100 100
 
101 101
 			//rows or cols?
102
-			$rows = isset($input_value['rows'] ) ? $input_value['rows'] : '10';
103
-			$cols = isset($input_value['cols'] ) ? $input_value['cols'] : '80';
102
+			$rows = isset($input_value['rows']) ? $input_value['rows'] : '10';
103
+			$cols = isset($input_value['cols']) ? $input_value['cols'] : '80';
104 104
 
105 105
 			//any content?
106 106
 			$append_content = $input_value['append_content'];
107 107
 
108
-			$output .= (!$close) ? '<ul>' : '';
108
+			$output .= ( ! $close) ? '<ul>' : '';
109 109
 			$output .= '<li>';
110 110
 
111 111
 			// what type of input are we dealing with ?
@@ -113,15 +113,15 @@  discard block
 block discarded – undo
113 113
 
114 114
 				// text inputs
115 115
 				case 'text' :
116
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
117
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" class="' . $styles . '" type="text" value="' . $input_value['value'] . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
116
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
117
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" class="'.$styles.'" type="text" value="'.$input_value['value'].'" name="'.$input_value['name'].'"'.$tabindex.'>';
118 118
 					break;
119 119
 
120 120
 				// dropdowns
121 121
 				case 'select' :
122 122
 
123
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
124
-					$output .= "\n\t\t\t" . '<select id="' . $field_id . '" class="' . $styles . '" name="' . $input_value['name'] . '"' . $tabindex . '>';
123
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
124
+					$output .= "\n\t\t\t".'<select id="'.$field_id.'" class="'.$styles.'" name="'.$input_value['name'].'"'.$tabindex.'>';
125 125
 
126 126
 					if (is_array($input_value['options'])) {
127 127
 						$options = $input_value['options'];
@@ -130,30 +130,30 @@  discard block
 block discarded – undo
130 130
 					}
131 131
 
132 132
 					foreach ($options as $key => $value) {
133
-						$selected = isset( $input_value['value'] ) && $input_value['value'] == $key ? 'selected=selected' : '';
133
+						$selected = isset($input_value['value']) && $input_value['value'] == $key ? 'selected=selected' : '';
134 134
 						//$key = str_replace( ' ', '_', sanitize_key( $value ));
135
-						$output .= "\n\t\t\t\t" . '<option '. $selected . ' value="' . $key . '">' . $value . '</option>';
135
+						$output .= "\n\t\t\t\t".'<option '.$selected.' value="'.$key.'">'.$value.'</option>';
136 136
 					}
137
-					$output .= "\n\t\t\t" . '</select>';
137
+					$output .= "\n\t\t\t".'</select>';
138 138
 
139 139
 					break;
140 140
 
141 141
 				case 'textarea' :
142 142
 
143
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
144
-					$output .= "\n\t\t\t" . '<textarea id="' . $field_id . '" class="' . $styles . '" rows="'.$rows.'" cols="'.$cols.'" name="' . $input_value['name'] . '"' . $tabindex . '>' . $input_value['value'] . '</textarea>';
143
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
144
+					$output .= "\n\t\t\t".'<textarea id="'.$field_id.'" class="'.$styles.'" rows="'.$rows.'" cols="'.$cols.'" name="'.$input_value['name'].'"'.$tabindex.'>'.$input_value['value'].'</textarea>';
145 145
 					break;
146 146
 
147 147
 				case 'hidden' :
148 148
 					$close = false;
149 149
 					$output .= "</li></ul>";
150
-					$output .= "\n\t\t\t" . '<input id="' . $field_id . '" type="hidden" name="' . $input_value['name'] . '" value="' . $input_value['value'] . '">';
150
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="hidden" name="'.$input_value['name'].'" value="'.$input_value['value'].'">';
151 151
 					break;
152 152
 
153 153
 				case 'checkbox' :
154
-					$checked = ( $input_value['value'] == 1 ) ? 'checked="checked"' : '';
155
-					$output .= "\n\t\t\t" . '<label for="' . $field_id . '">' . $input_value['label'] . $required . '</label>';
156
-					$output .= "\n\t\t\t" . '<input id="' . $field_id. '" type="checkbox" name="' . $input_value['name'] . '" value="1"' . $checked . $tabindex . ' />';
154
+					$checked = ($input_value['value'] == 1) ? 'checked="checked"' : '';
155
+					$output .= "\n\t\t\t".'<label for="'.$field_id.'">'.$input_value['label'].$required.'</label>';
156
+					$output .= "\n\t\t\t".'<input id="'.$field_id.'" type="checkbox" name="'.$input_value['name'].'" value="1"'.$checked.$tabindex.' />';
157 157
 					break;
158 158
 
159 159
 				case 'wp_editor' :
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
 					);
167 167
 					$output .= '</li>';
168 168
 					$output .= '</ul>';
169
-					$output .= '<h4>' . $input_value['label'] . '</h4>';
170
-					if ( $append_content ) {
169
+					$output .= '<h4>'.$input_value['label'].'</h4>';
170
+					if ($append_content) {
171 171
 						$output .= $append_content;
172 172
 					}
173 173
 					ob_start();
174
-					wp_editor( $input_value['value'], $field_id, $editor_settings);
174
+					wp_editor($input_value['value'], $field_id, $editor_settings);
175 175
 					$editor = ob_get_contents();
176 176
 					ob_end_clean();
177 177
 					$output .= $editor;
178 178
 					break;
179 179
 
180 180
 				}
181
-				if ( $append_content && $input_value['input'] !== 'wp_editor' ) {
181
+				if ($append_content && $input_value['input'] !== 'wp_editor') {
182 182
 					$output .= $append_content;
183 183
 				}
184 184
 				$output .= ($close) ? '</li>' : '';
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 		$form_fields = array();
220 220
 		$fields = (array) $fields;
221 221
 
222
-		foreach ( $fields as $field_name => $field_atts ) {
222
+		foreach ($fields as $field_name => $field_atts) {
223 223
 			//defaults:
224 224
 			$defaults = array(
225 225
 				'label' => '',
@@ -237,67 +237,67 @@  discard block
 block discarded – undo
237 237
 				'wpeditor_args' => array()
238 238
 				);
239 239
 			// merge defaults with passed arguments
240
-			$_fields = wp_parse_args( $field_atts, $defaults);
241
-			extract( $_fields );
240
+			$_fields = wp_parse_args($field_atts, $defaults);
241
+			extract($_fields);
242 242
 			// generate label
243
-			$label = empty($label) ? '' : '<label for="' . $id . '">' . $label . '</label>';
243
+			$label = empty($label) ? '' : '<label for="'.$id.'">'.$label.'</label>';
244 244
 			// generate field name
245
-			$f_name = !empty($unique_id) ? $field_name . '[' . $unique_id . ']' : $field_name;
245
+			$f_name = ! empty($unique_id) ? $field_name.'['.$unique_id.']' : $field_name;
246 246
 
247 247
 			//tabindex
248
-			$tabindex_str = !empty( $tabindex ) ? ' tabindex="' . $tabindex . '"' : '';
248
+			$tabindex_str = ! empty($tabindex) ? ' tabindex="'.$tabindex.'"' : '';
249 249
 
250 250
 			//we determine what we're building based on the type
251
-			switch ( $type ) {
251
+			switch ($type) {
252 252
 
253 253
 				case 'textarea' :
254
-						$fld = '<textarea id="' . $id . '" class="' . $class . '" rows="' . $dimensions[1] . '" cols="' . $dimensions[0] . '" name="' . $f_name . '"' . $tabindex_str . '>' . $value . '</textarea>';
254
+						$fld = '<textarea id="'.$id.'" class="'.$class.'" rows="'.$dimensions[1].'" cols="'.$dimensions[0].'" name="'.$f_name.'"'.$tabindex_str.'>'.$value.'</textarea>';
255 255
 						$fld .= $extra_desc;
256 256
 					break;
257 257
 
258 258
 				case 'checkbox' :
259 259
 						$c_input = '';
260
-						if ( is_array($value) ) {
261
-							foreach ( $value as $key => $val ) {
262
-								$c_id = $field_name . '_' . $value;
263
-								$c_class = isset($classes[$key]) ? ' class="' . $classes[$key] . '" ' : '';
264
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
265
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
266
-								$c_input .= '<input name="' . $f_name . '[]" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
260
+						if (is_array($value)) {
261
+							foreach ($value as $key => $val) {
262
+								$c_id = $field_name.'_'.$value;
263
+								$c_class = isset($classes[$key]) ? ' class="'.$classes[$key].'" ' : '';
264
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
265
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
266
+								$c_input .= '<input name="'.$f_name.'[]" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
267 267
 							}
268 268
 							$fld = $c_input;
269 269
 						} else {
270
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
271
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
270
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
271
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
272 272
 						}
273 273
 					break;
274 274
 
275 275
 				case 'radio' :
276 276
 						$c_input = '';
277
-						if ( is_array($value) ) {
278
-							foreach ( $value as $key => $val ) {
279
-								$c_id = $field_name . '_' . $value;
280
-								$c_class = isset($classes[$key]) ? 'class="' . $classes[$key] . '" ' : '';
281
-								$c_label = isset($labels[$key]) ? '<label for="' . $c_id . '">' . $labels[$key] . '</label>' : '';
282
-								$checked = !empty($default) && $default == $val ? ' checked="checked" ' : '';
283
-								$c_input .= '<input name="' . $f_name . '" type="checkbox" id="' . $c_id . '"' . $c_class . 'value="' . $val . '"' . $checked . $tabindex_str . ' />' . "\n" . $c_label;
277
+						if (is_array($value)) {
278
+							foreach ($value as $key => $val) {
279
+								$c_id = $field_name.'_'.$value;
280
+								$c_class = isset($classes[$key]) ? 'class="'.$classes[$key].'" ' : '';
281
+								$c_label = isset($labels[$key]) ? '<label for="'.$c_id.'">'.$labels[$key].'</label>' : '';
282
+								$checked = ! empty($default) && $default == $val ? ' checked="checked" ' : '';
283
+								$c_input .= '<input name="'.$f_name.'" type="checkbox" id="'.$c_id.'"'.$c_class.'value="'.$val.'"'.$checked.$tabindex_str.' />'."\n".$c_label;
284 284
 							}
285 285
 							$fld = $c_input;
286 286
 						} else {
287
-							$checked = !empty($default) && $default == $val ? 'checked="checked" ' : '';
288
-							$fld = '<input name="'. $f_name . '" type="checkbox" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $checked . $tabindex_str . ' />' . "\n";
287
+							$checked = ! empty($default) && $default == $val ? 'checked="checked" ' : '';
288
+							$fld = '<input name="'.$f_name.'" type="checkbox" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$checked.$tabindex_str.' />'."\n";
289 289
 						}
290 290
 					break;
291 291
 
292 292
 				case 'hidden' :
293
-						$fld = '<input name="' . $f_name . '" type="hidden" id="' . $id . '" class="' . $class . '" value="' . $value . '" />' . "\n";
293
+						$fld = '<input name="'.$f_name.'" type="hidden" id="'.$id.'" class="'.$class.'" value="'.$value.'" />'."\n";
294 294
 					break;
295 295
 
296 296
 				case 'select' :
297
-						$fld = '<select name="' . $f_name . '" class="' . $class . '" id="' . $id . '"' . $tabindex_str . '>' . "\n";
298
-						foreach ( $value as $key => $val ) {
299
-							$checked = !empty($default) && $default == $val ? ' selected="selected"' : '';
300
-							$fld .= "\t" . '<option value="' . $val . '"' . $checked . '>' . $labels[$key] . '</option>' . "\n";
297
+						$fld = '<select name="'.$f_name.'" class="'.$class.'" id="'.$id.'"'.$tabindex_str.'>'."\n";
298
+						foreach ($value as $key => $val) {
299
+							$checked = ! empty($default) && $default == $val ? ' selected="selected"' : '';
300
+							$fld .= "\t".'<option value="'.$val.'"'.$checked.'>'.$labels[$key].'</option>'."\n";
301 301
 						}
302 302
 						$fld .= '</select>';
303 303
 					break;
@@ -309,21 +309,21 @@  discard block
 block discarded – undo
309 309
 							'editor_class' => $class,
310 310
 							'tabindex' => $tabindex
311 311
 							);
312
-						$editor_settings = array_merge( $wpeditor_args, $editor_settings );
312
+						$editor_settings = array_merge($wpeditor_args, $editor_settings);
313 313
 						ob_start();
314
-						wp_editor( $value, $id, $editor_settings );
314
+						wp_editor($value, $id, $editor_settings);
315 315
 						$editor = ob_get_contents();
316 316
 						ob_end_clean();
317 317
 						$fld = $editor;
318 318
 					break;
319 319
 
320 320
 				default : //'text fields'
321
-						$fld = '<input name="' . $f_name . '" type="text" id="' . $id . '" class="' . $class . '" value="' . $value . '"' . $tabindex_str . ' />' . "\n";
321
+						$fld = '<input name="'.$f_name.'" type="text" id="'.$id.'" class="'.$class.'" value="'.$value.'"'.$tabindex_str.' />'."\n";
322 322
 						$fld .= $extra_desc;
323 323
 
324 324
 			}
325 325
 
326
-			$form_fields[ $field_name ] = array( 'label' => $label, 'field' => $fld );
326
+			$form_fields[$field_name] = array('label' => $label, 'field' => $fld);
327 327
 		}
328 328
 
329 329
 		return $form_fields;
@@ -352,22 +352,22 @@  discard block
 block discarded – undo
352 352
 	 */
353 353
 	static public function select_input($name, $values, $default = '', $parameters = '', $class = '', $autosize = true) {
354 354
 		//if $values was submitted in the wrong format, convert it over
355
-		if(!empty($values) && (!array_key_exists(0,$values) || !is_array($values[0]))){
356
-			$converted_values=array();
357
-			foreach($values as $id=>$text){
358
-				$converted_values[]=array('id'=>$id,'text'=>$text);
355
+		if ( ! empty($values) && ( ! array_key_exists(0, $values) || ! is_array($values[0]))) {
356
+			$converted_values = array();
357
+			foreach ($values as $id=>$text) {
358
+				$converted_values[] = array('id'=>$id, 'text'=>$text);
359 359
 			}
360
-			$values=$converted_values;
360
+			$values = $converted_values;
361 361
 		}
362 362
 		//load formatter helper
363
-		EE_Registry::instance()->load_helper( 'Formatter' );
363
+		EE_Registry::instance()->load_helper('Formatter');
364 364
 		//EE_Registry::instance()->load_helper( 'Formatter' );
365 365
 
366
-		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
366
+		$field = '<select id="'.EEH_Formatter::ee_tep_output_string($name).'" name="'.EEH_Formatter::ee_tep_output_string($name).'"';
367 367
 		//Debug
368 368
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
369
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
370
-			$field .= ' ' . $parameters;
369
+		if (EEH_Formatter::ee_tep_not_null($parameters))
370
+			$field .= ' '.$parameters;
371 371
 		if ($autosize) {
372 372
 			$size = 'med';
373 373
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
@@ -380,21 +380,21 @@  discard block
 block discarded – undo
380 380
 			$size = '';
381 381
 		}
382 382
 
383
-		$field .= ' class="' . $class . ' ' . $size . '">';
383
+		$field .= ' class="'.$class.' '.$size.'">';
384 384
 
385 385
 		if (empty($default) && isset($GLOBALS[$name]))
386 386
 			$default = stripslashes($GLOBALS[$name]);
387 387
 
388 388
 
389 389
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
390
-			$field .= '<option value="' . $values[$i]['id'] . '"';
390
+			$field .= '<option value="'.$values[$i]['id'].'"';
391 391
 			if ($default == $values[$i]['id']) {
392 392
 				$field .= ' selected = "selected"';
393 393
 			}
394
-			if ( isset( $values[$i]['class'] ) ) {
395
-				$field .= ' class="' . $values[$i]['class'] . '"';
394
+			if (isset($values[$i]['class'])) {
395
+				$field .= ' class="'.$values[$i]['class'].'"';
396 396
 			}
397
-			$field .= '>' . $values[$i]['text'] . '</option>';
397
+			$field .= '>'.$values[$i]['text'].'</option>';
398 398
 		}
399 399
 		$field .= '</select>';
400 400
 
@@ -412,38 +412,38 @@  discard block
 block discarded – undo
412 412
 	 * @param string $question_groups
413 413
 	 * @return string HTML
414 414
 	 */
415
-	static function generate_question_groups_html( $question_groups = array(), $group_wrapper = 'fieldset' ) {
415
+	static function generate_question_groups_html($question_groups = array(), $group_wrapper = 'fieldset') {
416 416
 
417 417
 		$html = '';
418
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
419
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
418
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
419
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
420 420
 
421
-		if ( ! empty( $question_groups )) {
421
+		if ( ! empty($question_groups)) {
422 422
 			//EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
423 423
 			// loop thru question groups
424
-			foreach ( $question_groups as $QSG ) {
424
+			foreach ($question_groups as $QSG) {
425 425
 				// check that questions exist
426
-				if ( ! empty( $QSG['QSG_questions'] )) {
426
+				if ( ! empty($QSG['QSG_questions'])) {
427 427
 					// use fieldsets
428
-					$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG['QSG_identifier'] . '">';
428
+					$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG['QSG_identifier'].'">';
429 429
 					// group_name
430
-					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . self::prep_answer( $QSG['QSG_name'] ) . '</h5>' : '';
430
+					$html .= $QSG['QSG_show_group_name'] ? "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.self::prep_answer($QSG['QSG_name']).'</h5>' : '';
431 431
 					// group_desc
432
-					$html .= $QSG['QSG_show_group_desc'] && ! empty( $QSG['QSG_desc'] ) ? '<div class="espresso-question-group-desc-pg">' . self::prep_answer( $QSG['QSG_desc'] ) . '</div>' : '';
432
+					$html .= $QSG['QSG_show_group_desc'] && ! empty($QSG['QSG_desc']) ? '<div class="espresso-question-group-desc-pg">'.self::prep_answer($QSG['QSG_desc']).'</div>' : '';
433 433
 
434 434
 					$html .= $before_question_group_questions;
435 435
 					// loop thru questions
436
-					foreach ( $QSG['QSG_questions'] as $question ) {
436
+					foreach ($QSG['QSG_questions'] as $question) {
437 437
 //						EEH_Debug_Tools::printr( $question, '$question  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
438 438
 						$QFI = new EE_Question_Form_Input(
439 439
 							$question['qst_obj'],
440 440
 							$question['ans_obj'],
441 441
 							$question
442 442
 						);
443
-						$html .= self::generate_form_input( $QFI );
443
+						$html .= self::generate_form_input($QFI);
444 444
 					}
445 445
 					$html .= $after_question_group_questions;
446
-					$html .= "\n\t" . '</' . $group_wrapper . '>';
446
+					$html .= "\n\t".'</'.$group_wrapper.'>';
447 447
 				}
448 448
 			}
449 449
 		}
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
 	 * @param string       $group_wrapper
464 464
 	 * @return string HTML
465 465
 	 */
466
-	static function generate_question_groups_html2( $question_groups = array(), $q_meta = array(), 	$from_admin = FALSE, $group_wrapper = 'fieldset' ) {
466
+	static function generate_question_groups_html2($question_groups = array(), $q_meta = array(), $from_admin = FALSE, $group_wrapper = 'fieldset') {
467 467
 
468 468
 		$html = '';
469
-		$before_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '' );
470
-		$after_question_group_questions = apply_filters( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '' );
469
+		$before_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', '');
470
+		$after_question_group_questions = apply_filters('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', '');
471 471
 
472 472
 		$default_q_meta = array(
473 473
 				'att_nmbr' => 1,
@@ -476,55 +476,55 @@  discard block
 block discarded – undo
476 476
 				'input_id' => '',
477 477
 				'input_class' => ''
478 478
 		);
479
-		$q_meta = array_merge( $default_q_meta, $q_meta );
479
+		$q_meta = array_merge($default_q_meta, $q_meta);
480 480
 		//EEH_Debug_Tools::printr( $q_meta, '$q_meta  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
481 481
 
482
-		if ( ! empty( $question_groups )) {
482
+		if ( ! empty($question_groups)) {
483 483
 //			EEH_Debug_Tools::printr( $question_groups, '$question_groups  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
484 484
 			// loop thru question groups
485
-			foreach ( $question_groups as $QSG ) {
486
-				if ( $QSG instanceof EE_Question_Group ) {
485
+			foreach ($question_groups as $QSG) {
486
+				if ($QSG instanceof EE_Question_Group) {
487 487
 					// check that questions exist
488 488
 
489
-					$where = array( 'QST_deleted' => 0 );
490
-					if ( ! $from_admin ) {
489
+					$where = array('QST_deleted' => 0);
490
+					if ( ! $from_admin) {
491 491
 						$where['QST_admin_only'] = 0;
492 492
 					}
493
-					$questions = $QSG->questions( array( $where, 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' )));
494
-					if ( ! empty( $questions )) {
493
+					$questions = $QSG->questions(array($where, 'order_by' => array('Question_Group_Question.QGQ_order' => 'ASC')));
494
+					if ( ! empty($questions)) {
495 495
 						// use fieldsets
496
-						$html .= "\n\t" . '<' . $group_wrapper . ' class="espresso-question-group-wrap" id="' . $QSG->get( 'QSG_identifier' ) . '">';
496
+						$html .= "\n\t".'<'.$group_wrapper.' class="espresso-question-group-wrap" id="'.$QSG->get('QSG_identifier').'">';
497 497
 						// group_name
498
-						if ( $QSG->show_group_name() ) {
499
-							$html .=  "\n\t\t" . '<h5 class="espresso-question-group-title-h5 section-title">' . $QSG->get_pretty( 'QSG_name' ) . '</h5>';
498
+						if ($QSG->show_group_name()) {
499
+							$html .= "\n\t\t".'<h5 class="espresso-question-group-title-h5 section-title">'.$QSG->get_pretty('QSG_name').'</h5>';
500 500
 						}
501 501
 						// group_desc
502
-						if ( $QSG->show_group_desc() ) {
503
-							$html .=  '<div class="espresso-question-group-desc-pg">' . $QSG->get_pretty( 'QSG_desc'  ) . '</div>';
502
+						if ($QSG->show_group_desc()) {
503
+							$html .= '<div class="espresso-question-group-desc-pg">'.$QSG->get_pretty('QSG_desc').'</div>';
504 504
 						}
505 505
 
506 506
 						$html .= $before_question_group_questions;
507 507
 						// loop thru questions
508
-						foreach ( $questions as $QST ) {
508
+						foreach ($questions as $QST) {
509 509
 							$qstn_id = $QST->is_system_question() ? $QST->system_ID() : $QST->ID();
510 510
 
511 511
 							$answer = NULL;
512 512
 
513
-							if (  isset( $_GET['qstn'] ) && isset( $q_meta['input_id'] ) && isset( $q_meta['att_nmbr'] )) {
513
+							if (isset($_GET['qstn']) && isset($q_meta['input_id']) && isset($q_meta['att_nmbr'])) {
514 514
 								// check for answer in $_GET in case we are reprocessing a form after an error
515
-								if ( isset( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] )) {
516
-									$answer = is_array( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] ) ? $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] : sanitize_text_field( $_GET['qstn'][ $q_meta['input_id'] ][ $qstn_id ] );
515
+								if (isset($_GET['qstn'][$q_meta['input_id']][$qstn_id])) {
516
+									$answer = is_array($_GET['qstn'][$q_meta['input_id']][$qstn_id]) ? $_GET['qstn'][$q_meta['input_id']][$qstn_id] : sanitize_text_field($_GET['qstn'][$q_meta['input_id']][$qstn_id]);
517 517
 								}
518
-							} else if ( isset( $q_meta['attendee'] ) && $q_meta['attendee'] ) {
518
+							} else if (isset($q_meta['attendee']) && $q_meta['attendee']) {
519 519
 								//attendee data from the session
520
-								$answer = isset( $q_meta['attendee'][ $qstn_id ] ) ? $q_meta['attendee'][ $qstn_id ] : NULL;
520
+								$answer = isset($q_meta['attendee'][$qstn_id]) ? $q_meta['attendee'][$qstn_id] : NULL;
521 521
 							}
522 522
 
523 523
 
524 524
 
525 525
 							$QFI = new EE_Question_Form_Input(
526 526
 									$QST,
527
-									EE_Answer::new_instance ( array(
527
+									EE_Answer::new_instance(array(
528 528
 											'ANS_ID'=> 0,
529 529
 											'QST_ID'=> 0,
530 530
 											'REG_ID'=> 0,
@@ -533,10 +533,10 @@  discard block
 block discarded – undo
533 533
 									$q_meta
534 534
 							);
535 535
 							//EEH_Debug_Tools::printr( $QFI, '$QFI  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
536
-							$html .= self::generate_form_input( $QFI );
536
+							$html .= self::generate_form_input($QFI);
537 537
 						}
538 538
 						$html .= $after_question_group_questions;
539
-						$html .= "\n\t" . '</' . $group_wrapper . '>';
539
+						$html .= "\n\t".'</'.$group_wrapper.'>';
540 540
 					}
541 541
 				}
542 542
 			}
@@ -556,63 +556,63 @@  discard block
 block discarded – undo
556 556
 	 * @param EE_Question_Form_Input $QFI
557 557
 	 * @return string HTML
558 558
 	 */
559
-	static function generate_form_input( EE_Question_Form_Input $QFI ) {
560
-		if ( isset( $QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin() ) {
559
+	static function generate_form_input(EE_Question_Form_Input $QFI) {
560
+		if (isset($QFI->QST_admin_only) && $QFI->QST_admin_only && ! is_admin()) {
561 561
 			return '';
562 562
 		}
563 563
 
564
-		$QFI = self::_load_system_dropdowns( $QFI );
565
-		$QFI = self::_load_specialized_dropdowns( $QFI );
564
+		$QFI = self::_load_system_dropdowns($QFI);
565
+		$QFI = self::_load_specialized_dropdowns($QFI);
566 566
 
567 567
 		//we also need to verify
568 568
 
569 569
 		$display_text = $QFI->get('QST_display_text');
570 570
 		$input_name = $QFI->get('QST_input_name');
571
-		$answer = EE_Registry::instance()->REQ->is_set( $input_name ) ? EE_Registry::instance()->REQ->get( $input_name ) : $QFI->get('ANS_value');
571
+		$answer = EE_Registry::instance()->REQ->is_set($input_name) ? EE_Registry::instance()->REQ->get($input_name) : $QFI->get('ANS_value');
572 572
 		$input_id = $QFI->get('QST_input_id');
573 573
 		$input_class = $QFI->get('QST_input_class');
574 574
 //		$disabled = $QFI->get('QST_disabled') ? ' disabled="disabled"' : '';
575 575
 		$disabled = $QFI->get('QST_disabled') ? TRUE : FALSE;
576
-		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>' );
576
+		$required_label = apply_filters(' FHEE__EEH_Form_Fields__generate_form_input__required_label', '<em>*</em>');
577 577
 		$QST_required = $QFI->get('QST_required');
578
-		$required = $QST_required ? array( 'label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required ) : array();
579
-		$use_html_entities = $QFI->get_meta( 'htmlentities' );
580
-		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __( 'This field is required', 'event_espresso' );
581
-		$required_text = $QST_required ? "\n\t\t\t" . '<div class="required-text hidden">' . self::prep_answer( $required_text, $use_html_entities ) . '</div>' : '';
578
+		$required = $QST_required ? array('label' => $required_label, 'class' => 'required needs-value', 'title' => $QST_required) : array();
579
+		$use_html_entities = $QFI->get_meta('htmlentities');
580
+		$required_text = $QFI->get('QST_required_text') != '' ? $QFI->get('QST_required_text') : __('This field is required', 'event_espresso');
581
+		$required_text = $QST_required ? "\n\t\t\t".'<div class="required-text hidden">'.self::prep_answer($required_text, $use_html_entities).'</div>' : '';
582 582
 		$label_class = 'espresso-form-input-lbl';
583
-		$QST_options = $QFI->options(true,$answer);
584
-		$options = is_array( $QST_options ) ? self::prep_answer_options( $QST_options ) : array();
583
+		$QST_options = $QFI->options(true, $answer);
584
+		$options = is_array($QST_options) ? self::prep_answer_options($QST_options) : array();
585 585
 		$system_ID = $QFI->get('QST_system');
586
-		$label_b4 = $QFI->get_meta( 'label_b4' );
587
-		$use_desc_4_label = $QFI->get_meta( 'use_desc_4_label' );
586
+		$label_b4 = $QFI->get_meta('label_b4');
587
+		$use_desc_4_label = $QFI->get_meta('use_desc_4_label');
588 588
 
589 589
 
590
-		switch ( $QFI->get('QST_type') ){
590
+		switch ($QFI->get('QST_type')) {
591 591
 
592 592
 			case 'TEXTAREA' :
593
-					return EEH_Form_Fields::textarea( $display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
593
+					return EEH_Form_Fields::textarea($display_text, $answer, $input_name, $input_id, $input_class, array(), $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
594 594
 				break;
595 595
 
596 596
 			case 'DROPDOWN' :
597
-					return EEH_Form_Fields::select( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE );
597
+					return EEH_Form_Fields::select($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, TRUE);
598 598
 				break;
599 599
 
600 600
 
601 601
 			case 'RADIO_BTN' :
602
-					return EEH_Form_Fields::radio( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label );
602
+					return EEH_Form_Fields::radio($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities, $label_b4, $use_desc_4_label);
603 603
 				break;
604 604
 
605 605
 			case 'CHECKBOX' :
606
-					return EEH_Form_Fields::checkbox( $display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
606
+					return EEH_Form_Fields::checkbox($display_text, $answer, $options, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
607 607
 				break;
608 608
 
609 609
 			case 'DATE' :
610
-					return EEH_Form_Fields::datepicker( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
610
+					return EEH_Form_Fields::datepicker($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
611 611
 				break;
612 612
 
613 613
 			case 'TEXT' :
614 614
 			default:
615
-					return EEH_Form_Fields::text( $display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities );
615
+					return EEH_Form_Fields::text($display_text, $answer, $input_name, $input_id, $input_class, $required, $required_text, $label_class, $disabled, $system_ID, $use_html_entities);
616 616
 				break;
617 617
 
618 618
 		}
@@ -638,31 +638,31 @@  discard block
 block discarded – undo
638 638
 	 * @param string $disabled 		disabled="disabled" or null
639 639
 	 * @return string HTML
640 640
 	 */
641
-	static function text( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
641
+	static function text($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
642 642
 		// need these
643
-		if ( ! $question || ! $name ) {
643
+		if ( ! $question || ! $name) {
644 644
 			return NULL;
645 645
 		}
646 646
 		// prep the answer
647
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
647
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
648 648
 		// prep the required array
649
-		$required = self::prep_required( $required );
649
+		$required = self::prep_required($required);
650 650
 		// set disabled tag
651
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
651
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
652 652
 		// ya gots ta have style man!!!
653 653
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-text-inp';
654
-		$class = empty( $class ) ? $txt_class : $class;
655
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
656
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
654
+		$class = empty($class) ? $txt_class : $class;
655
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
656
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
657 657
 
658
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
658
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
659 659
 		// filter label but ensure required text comes before it
660
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
660
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
661 661
 
662
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled .' ' . $extra . '/>';
662
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
663 663
 
664
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
665
-		return  $label_html . $input_html;
664
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
665
+		return  $label_html.$input_html;
666 666
 
667 667
 	}
668 668
 
@@ -684,35 +684,35 @@  discard block
 block discarded – undo
684 684
 	 * @param string $disabled 		disabled="disabled" or null
685 685
 	 * @return string HTML
686 686
 	 */
687
-	static function textarea( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
687
+	static function textarea($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $dimensions = FALSE, $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
688 688
 		// need these
689
-		if ( ! $question || ! $name ) {
689
+		if ( ! $question || ! $name) {
690 690
 			return NULL;
691 691
 		}
692 692
 		// prep the answer
693
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
693
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
694 694
 		// prep the required array
695
-		$required = self::prep_required( $required );
695
+		$required = self::prep_required($required);
696 696
 		// make sure $dimensions is an array
697
-		$dimensions = is_array( $dimensions ) ? $dimensions : array();
697
+		$dimensions = is_array($dimensions) ? $dimensions : array();
698 698
 		// and set some defaults
699
-		$dimensions = array_merge( array( 'rows' => 3, 'cols' => 40 ), $dimensions );
699
+		$dimensions = array_merge(array('rows' => 3, 'cols' => 40), $dimensions);
700 700
 		// set disabled tag
701
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
701
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
702 702
 		// ya gots ta have style man!!!
703 703
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-textarea-inp';
704
-		$class = empty( $class ) ? $txt_class : $class;
705
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
706
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
704
+		$class = empty($class) ? $txt_class : $class;
705
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
706
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
707 707
 
708
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
708
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
709 709
 		// filter label but ensure required text comes before it
710
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
710
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
711 711
 
712
-		$input_html = "\n\t\t\t" . '<textarea name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" rows="' . $dimensions['rows'] . '" cols="' . $dimensions['cols'] . '"  title="' . $required['msg'] . '" ' . $disabled . ' ' . $extra . '>' . $answer . '</textarea>';
712
+		$input_html = "\n\t\t\t".'<textarea name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" rows="'.$dimensions['rows'].'" cols="'.$dimensions['cols'].'"  title="'.$required['msg'].'" '.$disabled.' '.$extra.'>'.$answer.'</textarea>';
713 713
 
714
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
715
-		return  $label_html . $input_html;
714
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
715
+		return  $label_html.$input_html;
716 716
 
717 717
 	}
718 718
 
@@ -735,47 +735,47 @@  discard block
 block discarded – undo
735 735
 	 * @param string $disabled 		disabled="disabled" or null
736 736
 	 * @return string HTML
737 737
 	 */
738
-	static function select( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE ) {
738
+	static function select($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $add_please_select_option = FALSE) {
739 739
 
740 740
 		// need these
741
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
741
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
742 742
 			return NULL;
743 743
 		}
744 744
 		// prep the answer
745
-		$answer = is_array( $answer ) ? self::prep_answer( array_shift( $answer )) : self::prep_answer( $answer, $use_html_entities );
745
+		$answer = is_array($answer) ? self::prep_answer(array_shift($answer)) : self::prep_answer($answer, $use_html_entities);
746 746
 		// prep the required array
747
-		$required = self::prep_required( $required );
747
+		$required = self::prep_required($required);
748 748
 		// set disabled tag
749
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
749
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
750 750
 		// ya gots ta have style man!!!
751 751
 		$txt_class = is_admin() ? 'wide' : 'espresso-select-inp';
752
-		$class = empty( $class ) ? $txt_class : $class;
753
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
754
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
752
+		$class = empty($class) ? $txt_class : $class;
753
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
754
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
755 755
 
756
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
756
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
757 757
 		// filter label but ensure required text comes before it
758
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
758
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
759 759
 
760
-		$input_html = "\n\t\t\t" . '<select name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . '" title="' . esc_attr( $required['msg'] ) . '"' . $disabled . ' ' . $extra . '>';
760
+		$input_html = "\n\t\t\t".'<select name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].'" title="'.esc_attr($required['msg']).'"'.$disabled.' '.$extra.'>';
761 761
 		// recursively count array elements, to determine total number of options
762
-		$only_option = count( $options, 1 ) == 1 ? TRUE : FALSE;
763
-		if ( ! $only_option ) {
762
+		$only_option = count($options, 1) == 1 ? TRUE : FALSE;
763
+		if ( ! $only_option) {
764 764
 			// if there is NO answer set and there are multiple options to choose from, then set the "please select" message as selected
765 765
 			$selected = $answer === NULL ? ' selected="selected"' : '';
766
-			$input_html .= $add_please_select_option ? "\n\t\t\t\t" . '<option value=""' . $selected . '>' . __(' - please select - ', 'event_espresso') . '</option>' : '';
766
+			$input_html .= $add_please_select_option ? "\n\t\t\t\t".'<option value=""'.$selected.'>'.__(' - please select - ', 'event_espresso').'</option>' : '';
767 767
 		}
768
-		foreach ( $options as $key => $value ) {
768
+		foreach ($options as $key => $value) {
769 769
 			// if value is an array, then create option groups, else create regular ol' options
770
-			$input_html .= is_array( $value ) ? self::_generate_select_option_group( $key, $value, $answer ) : self::_generate_select_option( $value->value(), $value->desc(), $answer, $only_option );
770
+			$input_html .= is_array($value) ? self::_generate_select_option_group($key, $value, $answer) : self::_generate_select_option($value->value(), $value->desc(), $answer, $only_option);
771 771
 		}
772 772
 
773
-		$input_html .= "\n\t\t\t" . '</select>';
773
+		$input_html .= "\n\t\t\t".'</select>';
774 774
 
775
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID );
775
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__select__before_end_wrapper', $input_html, $question, $answer, $name, $id, $class, $system_ID);
776 776
 
777
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
778
-		return  $label_html . $input_html;
777
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
778
+		return  $label_html.$input_html;
779 779
 
780 780
 	}
781 781
 
@@ -792,12 +792,12 @@  discard block
 block discarded – undo
792 792
 	 * @param mixed $answer
793 793
 	 * @return string
794 794
 	 */
795
-	private static function _generate_select_option_group( $opt_group, $QSOs, $answer ){
796
-		$html = "\n\t\t\t\t" . '<optgroup label="' . self::prep_option_value( $opt_group ) . '">';
797
-		foreach ( $QSOs as $QSO ) {
798
-			$html .= self::_generate_select_option( $QSO->value(), $QSO->desc(), $answer );
795
+	private static function _generate_select_option_group($opt_group, $QSOs, $answer) {
796
+		$html = "\n\t\t\t\t".'<optgroup label="'.self::prep_option_value($opt_group).'">';
797
+		foreach ($QSOs as $QSO) {
798
+			$html .= self::_generate_select_option($QSO->value(), $QSO->desc(), $answer);
799 799
 		}
800
-		$html .= "\n\t\t\t\t" . '</optgroup>';
800
+		$html .= "\n\t\t\t\t".'</optgroup>';
801 801
 		return $html;
802 802
 	}
803 803
 
@@ -811,12 +811,12 @@  discard block
 block discarded – undo
811 811
 	 * @param int $only_option
812 812
 	 * @return string
813 813
 	 */
814
-	private static function _generate_select_option( $key, $value, $answer, $only_option = FALSE ){
815
-		$key = self::prep_answer( $key );
816
-		$value = self::prep_answer( $value );
817
-		$value = ! empty( $value ) ? $value : $key;
818
-		$selected = ( $answer == $key || $only_option ) ? ' selected="selected"' : '';
819
-		return "\n\t\t\t\t" . '<option value="' . self::prep_option_value( $key ) . '"' . $selected . '> ' . $value . '&nbsp;&nbsp;&nbsp;</option>';
814
+	private static function _generate_select_option($key, $value, $answer, $only_option = FALSE) {
815
+		$key = self::prep_answer($key);
816
+		$value = self::prep_answer($value);
817
+		$value = ! empty($value) ? $value : $key;
818
+		$selected = ($answer == $key || $only_option) ? ' selected="selected"' : '';
819
+		return "\n\t\t\t\t".'<option value="'.self::prep_option_value($key).'"'.$selected.'> '.$value.'&nbsp;&nbsp;&nbsp;</option>';
820 820
 	}
821 821
 
822 822
 
@@ -840,56 +840,56 @@  discard block
 block discarded – undo
840 840
 	 * @param bool        $use_desc_4_label
841 841
 	 * @return string HTML
842 842
 	 */
843
-	static function radio( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE ) {
843
+	static function radio($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE, $label_b4 = FALSE, $use_desc_4_label = FALSE) {
844 844
 		// need these
845
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
845
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
846 846
 			return NULL;
847 847
 		}
848 848
 		// prep the answer
849
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
849
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
850 850
 		// prep the required array
851
-		$required = self::prep_required( $required );
851
+		$required = self::prep_required($required);
852 852
 		// set disabled tag
853
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
853
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
854 854
 		// ya gots ta have style man!!!
855 855
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
856
-		$class = ! empty( $class ) ? $class : 'espresso-radio-btn-inp';
857
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
856
+		$class = ! empty($class) ? $class : 'espresso-radio-btn-inp';
857
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
858 858
 
859
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
859
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
860 860
 		// filter label but ensure required text comes before it
861
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
861
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
862 862
 
863
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-radio-btn-options-ul ' . $label_class . ' ' . $class . '-ul">';
863
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-radio-btn-options-ul '.$label_class.' '.$class.'-ul">';
864 864
 
865
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
866
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
865
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
866
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
867 867
 
868
-		foreach ( $options as $OPT ) {
869
-			if ( $OPT instanceof EE_Question_Option ) {
870
-				$value = self::prep_option_value( $OPT->value() );
868
+		foreach ($options as $OPT) {
869
+			if ($OPT instanceof EE_Question_Option) {
870
+				$value = self::prep_option_value($OPT->value());
871 871
 				$label = $use_desc_4_label ? $OPT->desc() : $OPT->value();
872
-				$size = $use_desc_4_label ? self::get_label_size_class( $OPT->value() . ' ' . $OPT->desc() ) : self::get_label_size_class( $OPT->value() );
873
-				$desc = $OPT->desc();//no self::prep_answer
874
-				$answer = is_numeric( $value ) && empty( $answer ) ? 0 : $answer;
875
-				$checked = (string)$value == (string)$answer ? ' checked="checked"' : '';
876
-				$opt = '-' . sanitize_key( $value );
877
-
878
-				$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
879
-				$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-radio-btn-lbl">';
880
-				$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $label . '</span>' : '';
881
-				$input_html .= "\n\t\t\t\t\t\t" . '<input type="radio" name="' . $name . '" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
882
-				$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span class="espresso-radio-btn-desc">' . $label . '</span>' : '';
883
-				$input_html .= "\n\t\t\t\t\t" . '</label>';
884
-				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">' . $desc . '</span>';
885
-				$input_html .= "\n\t\t\t\t" . '</li>';
872
+				$size = $use_desc_4_label ? self::get_label_size_class($OPT->value().' '.$OPT->desc()) : self::get_label_size_class($OPT->value());
873
+				$desc = $OPT->desc(); //no self::prep_answer
874
+				$answer = is_numeric($value) && empty($answer) ? 0 : $answer;
875
+				$checked = (string) $value == (string) $answer ? ' checked="checked"' : '';
876
+				$opt = '-'.sanitize_key($value);
877
+
878
+				$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
879
+				$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-radio-btn-lbl">';
880
+				$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$label.'</span>' : '';
881
+				$input_html .= "\n\t\t\t\t\t\t".'<input type="radio" name="'.$name.'" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
882
+				$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span class="espresso-radio-btn-desc">'.$label.'</span>' : '';
883
+				$input_html .= "\n\t\t\t\t\t".'</label>';
884
+				$input_html .= $use_desc_4_label ? '' : '<span class="espresso-radio-btn-option-desc small-text grey-text">'.$desc.'</span>';
885
+				$input_html .= "\n\t\t\t\t".'</li>';
886 886
 			}
887 887
 		}
888 888
 
889
-		$input_html .= "\n\t\t\t" . '</ul>';
889
+		$input_html .= "\n\t\t\t".'</ul>';
890 890
 
891
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
892
-		return  $label_html . $input_html;
891
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
892
+		return  $label_html.$input_html;
893 893
 
894 894
 	}
895 895
 
@@ -912,65 +912,65 @@  discard block
 block discarded – undo
912 912
 	 * @param string $disabled 		disabled="disabled" or null
913 913
 	 * @return string HTML
914 914
 	 */
915
-	static function checkbox( $question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
915
+	static function checkbox($question = FALSE, $answer = NULL, $options = FALSE, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $label_b4 = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
916 916
 		// need these
917
-		if ( ! $question || ! $name || ! $options || empty( $options ) || ! is_array( $options )) {
917
+		if ( ! $question || ! $name || ! $options || empty($options) || ! is_array($options)) {
918 918
 			return NULL;
919 919
 		}
920
-		$answer = maybe_unserialize( $answer );
920
+		$answer = maybe_unserialize($answer);
921 921
 
922 922
 		// prep the answer(s)
923
-		$answer = is_array( $answer ) ? $answer : array( sanitize_key( $answer ) => $answer );
923
+		$answer = is_array($answer) ? $answer : array(sanitize_key($answer) => $answer);
924 924
 
925
-		foreach ( $answer as $key => $value ) {
926
-			$key = self::prep_option_value( $key );
927
-			$answer[$key] = self::prep_answer( $value );
925
+		foreach ($answer as $key => $value) {
926
+			$key = self::prep_option_value($key);
927
+			$answer[$key] = self::prep_answer($value);
928 928
 		}
929 929
 
930 930
 		// prep the required array
931
-		$required = self::prep_required( $required );
931
+		$required = self::prep_required($required);
932 932
 		// set disabled tag
933
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
933
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
934 934
 		// ya gots ta have style man!!!
935 935
 		$radio_class = is_admin() ? 'ee-admin-radio-lbl' : $label_class;
936
-		$class = empty( $class ) ? 'espresso-radio-btn-inp' : $class;
937
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
936
+		$class = empty($class) ? 'espresso-radio-btn-inp' : $class;
937
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
938 938
 
939
-		$label_html = $required_text . "\n\t\t\t" . '<label class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label> ';
939
+		$label_html = $required_text."\n\t\t\t".'<label class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label> ';
940 940
 		// filter label but ensure required text comes before it
941
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
942
-
943
-		$input_html = "\n\t\t\t" . '<ul id="' . $id . '-ul" class="espresso-checkbox-options-ul ' . $label_class . ' ' . $class . '-ul">';
944
-
945
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
946
-		$class .= ! empty( $required['class'] ) ? ' ' . $required['class'] : '';
947
-
948
-		foreach ( $options as $OPT ) {
949
-			$value = $OPT->value();//self::prep_option_value( $OPT->value() );
950
-			$size = self::get_label_size_class(  $OPT->value() . ' ' . $OPT->desc() );
951
-			$text = self::prep_answer( $OPT->value() );
952
-			$desc = $OPT->desc() ;
953
-			$opt = '-' . sanitize_key( $value );
954
-
955
-			$checked = is_array( $answer ) && in_array( $text, $answer ) ? ' checked="checked"' : '';
956
-
957
-			$input_html .= "\n\t\t\t\t" . '<li' . $size . '>';
958
-			$input_html .= "\n\t\t\t\t\t" . '<label class="' . $radio_class . ' espresso-checkbox-lbl">';
959
-			$input_html .= $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
960
-			$input_html .= "\n\t\t\t\t\t\t" . '<input type="checkbox" name="' . $name . '[' . $OPT->ID() . ']" id="' . $id . $opt . '" class="' . $class . '" value="' . $value . '" title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . $checked . ' ' . $extra . '/>';
961
-			$input_html .= ! $label_b4  ? "\n\t\t\t\t\t\t" . '<span>' . $text . '</span>' : '';
962
- 			$input_html .= "\n\t\t\t\t\t" . '</label>';
963
-			if ( ! empty( $desc ) && $desc != $text ) {
964
-	 			$input_html .= "\n\t\t\t\t\t" . ' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">' . $desc . '</div>';
941
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
942
+
943
+		$input_html = "\n\t\t\t".'<ul id="'.$id.'-ul" class="espresso-checkbox-options-ul '.$label_class.' '.$class.'-ul">';
944
+
945
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
946
+		$class .= ! empty($required['class']) ? ' '.$required['class'] : '';
947
+
948
+		foreach ($options as $OPT) {
949
+			$value = $OPT->value(); //self::prep_option_value( $OPT->value() );
950
+			$size = self::get_label_size_class($OPT->value().' '.$OPT->desc());
951
+			$text = self::prep_answer($OPT->value());
952
+			$desc = $OPT->desc();
953
+			$opt = '-'.sanitize_key($value);
954
+
955
+			$checked = is_array($answer) && in_array($text, $answer) ? ' checked="checked"' : '';
956
+
957
+			$input_html .= "\n\t\t\t\t".'<li'.$size.'>';
958
+			$input_html .= "\n\t\t\t\t\t".'<label class="'.$radio_class.' espresso-checkbox-lbl">';
959
+			$input_html .= $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
960
+			$input_html .= "\n\t\t\t\t\t\t".'<input type="checkbox" name="'.$name.'['.$OPT->ID().']" id="'.$id.$opt.'" class="'.$class.'" value="'.$value.'" title="'.esc_attr($required['msg']).'" '.$disabled.$checked.' '.$extra.'/>';
961
+			$input_html .= ! $label_b4 ? "\n\t\t\t\t\t\t".'<span>'.$text.'</span>' : '';
962
+ 			$input_html .= "\n\t\t\t\t\t".'</label>';
963
+			if ( ! empty($desc) && $desc != $text) {
964
+	 			$input_html .= "\n\t\t\t\t\t".' &nbsp; <br/><div class="espresso-checkbox-option-desc small-text grey-text">'.$desc.'</div>';
965 965
 			}
966
-			$input_html .= "\n\t\t\t\t" . '</li>';
966
+			$input_html .= "\n\t\t\t\t".'</li>';
967 967
 
968 968
 		}
969 969
 
970
-		$input_html .= "\n\t\t\t" . '</ul>';
970
+		$input_html .= "\n\t\t\t".'</ul>';
971 971
 
972
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
973
-		return  $label_html . $input_html;
972
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
973
+		return  $label_html.$input_html;
974 974
 
975 975
 	}
976 976
 
@@ -992,36 +992,36 @@  discard block
 block discarded – undo
992 992
 	 * @param string $disabled 		disabled="disabled" or null
993 993
 	 * @return string HTML
994 994
 	 */
995
-	static function datepicker( $question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE ) {
995
+	static function datepicker($question = FALSE, $answer = NULL, $name = FALSE, $id = '', $class = '', $required = FALSE, $required_text = '', $label_class = '', $disabled = FALSE, $system_ID = FALSE, $use_html_entities = TRUE) {
996 996
 		// need these
997
-		if ( ! $question || ! $name ) {
997
+		if ( ! $question || ! $name) {
998 998
 			return NULL;
999 999
 		}
1000 1000
 		// prep the answer
1001
-		$answer = is_array( $answer ) ? '' : self::prep_answer( $answer, $use_html_entities );
1001
+		$answer = is_array($answer) ? '' : self::prep_answer($answer, $use_html_entities);
1002 1002
 		// prep the required array
1003
-		$required = self::prep_required( $required );
1003
+		$required = self::prep_required($required);
1004 1004
 		// set disabled tag
1005
-		$disabled = $answer === NULL || ! $disabled  ? '' : ' disabled="disabled"';
1005
+		$disabled = $answer === NULL || ! $disabled ? '' : ' disabled="disabled"';
1006 1006
 		// ya gots ta have style man!!!
1007 1007
 		$txt_class = is_admin() ? 'regular-text' : 'espresso-datepicker-inp';
1008
-		$class = empty( $class ) ? $txt_class : $class;
1009
-		$class .= ! empty( $system_ID ) ? ' ' . $system_ID : '';
1010
-		$extra = apply_filters( 'FHEE__EEH_Form_Fields__additional_form_field_attributes', '' );
1008
+		$class = empty($class) ? $txt_class : $class;
1009
+		$class .= ! empty($system_ID) ? ' '.$system_ID : '';
1010
+		$extra = apply_filters('FHEE__EEH_Form_Fields__additional_form_field_attributes', '');
1011 1011
 
1012
-		$label_html = $required_text . "\n\t\t\t" . '<label for="' . $name . '" class="' . $label_class . '">' . self::prep_question( $question ) . $required['label'] . '</label><br/>';
1012
+		$label_html = $required_text."\n\t\t\t".'<label for="'.$name.'" class="'.$label_class.'">'.self::prep_question($question).$required['label'].'</label><br/>';
1013 1013
 		// filter label but ensure required text comes before it
1014
-		$label_html = apply_filters( 'FHEE__EEH_Form_Fields__label_html', $label_html, $required_text );
1014
+		$label_html = apply_filters('FHEE__EEH_Form_Fields__label_html', $label_html, $required_text);
1015 1015
 
1016
-		$input_html = "\n\t\t\t" . '<input type="text" name="' . $name . '" id="' . $id . '" class="' . $class . ' ' . $required['class'] . ' datepicker" value="' . $answer . '"  title="' . esc_attr( $required['msg'] ) . '" ' . $disabled . ' ' . $extra . '/>';
1016
+		$input_html = "\n\t\t\t".'<input type="text" name="'.$name.'" id="'.$id.'" class="'.$class.' '.$required['class'].' datepicker" value="'.$answer.'"  title="'.esc_attr($required['msg']).'" '.$disabled.' '.$extra.'/>';
1017 1017
 
1018 1018
 		// enqueue scripts
1019
-		wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION );
1020
-		wp_enqueue_style( 'espresso-ui-theme');
1021
-		wp_enqueue_script( 'jquery-ui-datepicker' );
1019
+		wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION);
1020
+		wp_enqueue_style('espresso-ui-theme');
1021
+		wp_enqueue_script('jquery-ui-datepicker');
1022 1022
 
1023
-		$input_html =  apply_filters( 'FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id );
1024
-		return  $label_html . $input_html;
1023
+		$input_html = apply_filters('FHEE__EEH_Form_Fields__input_html', $input_html, $label_html, $id);
1024
+		return  $label_html.$input_html;
1025 1025
 
1026 1026
 	}
1027 1027
 
@@ -1033,7 +1033,7 @@  discard block
 block discarded – undo
1033 1033
 	 * 	@access public
1034 1034
 	 * 	@return 	string
1035 1035
 	 */
1036
-	public static function remove_label_keep_required_msg( $label_html, $required_text ) {
1036
+	public static function remove_label_keep_required_msg($label_html, $required_text) {
1037 1037
 		return $required_text;
1038 1038
 	}
1039 1039
 
@@ -1047,9 +1047,9 @@  discard block
 block discarded – undo
1047 1047
 	 * @param string $value
1048 1048
 	 * @return string HTML
1049 1049
 	 */
1050
-	static function hidden_input( $name, $value, $id = '' ){
1051
-		$id = ! empty( $id ) ? $id : $name;
1052
-		return '<input id="' . $id . '" type="hidden" name="'.$name.'" value="' .  $value . '"/>';
1050
+	static function hidden_input($name, $value, $id = '') {
1051
+		$id = ! empty($id) ? $id : $name;
1052
+		return '<input id="'.$id.'" type="hidden" name="'.$name.'" value="'.$value.'"/>';
1053 1053
 	}
1054 1054
 
1055 1055
 
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 	 * @param string $question
1062 1062
 	 * @return string
1063 1063
 	 */
1064
-	static function prep_question( $question ){
1064
+	static function prep_question($question) {
1065 1065
 		return $question;
1066 1066
 //		$link = '';
1067 1067
 //		// does this label have a help link attached ?
@@ -1084,13 +1084,13 @@  discard block
 block discarded – undo
1084 1084
 	 * @param mixed $answer
1085 1085
 	 * @return string
1086 1086
 	 */
1087
-	static function prep_answer( $answer, $use_html_entities = TRUE ){
1087
+	static function prep_answer($answer, $use_html_entities = TRUE) {
1088 1088
 		//make sure we convert bools first.  Otherwise (bool) false becomes an empty string which is NOT desired, we want "0".
1089
-		if ( is_bool( $answer ) ) {
1089
+		if (is_bool($answer)) {
1090 1090
 			$answer = $answer ? 1 : 0;
1091 1091
 		}
1092
-		$answer = trim( stripslashes( str_replace( '&#039;', "'", $answer )));
1093
-		return $use_html_entities ? htmlentities( $answer, ENT_QUOTES, 'UTF-8' ) : $answer;
1092
+		$answer = trim(stripslashes(str_replace('&#039;', "'", $answer)));
1093
+		return $use_html_entities ? htmlentities($answer, ENT_QUOTES, 'UTF-8') : $answer;
1094 1094
 	}
1095 1095
 
1096 1096
 
@@ -1100,18 +1100,18 @@  discard block
 block discarded – undo
1100 1100
 	 * 	@param array $QSOs  array of EE_Question_Option objects
1101 1101
 	 * 	@return array
1102 1102
 	 */
1103
-	public static function prep_answer_options( $QSOs = array() ){
1103
+	public static function prep_answer_options($QSOs = array()) {
1104 1104
 		$prepped_answer_options = array();
1105
-		if ( is_array( $QSOs ) && ! empty( $QSOs )) {
1106
-			foreach( $QSOs as $key => $QSO ) {
1107
-				if ( ! $QSO instanceof EE_Question_Option ) {
1108
-					$QSO = EE_Question_Option::new_instance( array(
1109
-						'QSO_value' => is_array( $QSO ) && isset( $QSO['id'] ) ? (string)$QSO['id'] : (string)$key,
1110
-						'QSO_desc' => is_array( $QSO ) && isset( $QSO['text'] ) ? (string)$QSO['text'] : (string)$QSO
1105
+		if (is_array($QSOs) && ! empty($QSOs)) {
1106
+			foreach ($QSOs as $key => $QSO) {
1107
+				if ( ! $QSO instanceof EE_Question_Option) {
1108
+					$QSO = EE_Question_Option::new_instance(array(
1109
+						'QSO_value' => is_array($QSO) && isset($QSO['id']) ? (string) $QSO['id'] : (string) $key,
1110
+						'QSO_desc' => is_array($QSO) && isset($QSO['text']) ? (string) $QSO['text'] : (string) $QSO
1111 1111
 					));
1112 1112
 				}
1113
-				if ( $QSO->opt_group() ) {
1114
-					$prepped_answer_options[ $QSO->opt_group() ][] = $QSO;
1113
+				if ($QSO->opt_group()) {
1114
+					$prepped_answer_options[$QSO->opt_group()][] = $QSO;
1115 1115
 				} else {
1116 1116
 					$prepped_answer_options[] = $QSO;
1117 1117
 				}
@@ -1127,8 +1127,8 @@  discard block
 block discarded – undo
1127 1127
 	 * @param string $option_value
1128 1128
 	 * @return string
1129 1129
 	 */
1130
-	static function prep_option_value( $option_value ){
1131
-		return trim( stripslashes( $option_value ));
1130
+	static function prep_option_value($option_value) {
1131
+		return trim(stripslashes($option_value));
1132 1132
 	}
1133 1133
 
1134 1134
 
@@ -1139,11 +1139,11 @@  discard block
 block discarded – undo
1139 1139
 	 * @param string|array 	$required
1140 1140
 	 * @return array
1141 1141
 	 */
1142
-	static function prep_required( $required = array() ){
1142
+	static function prep_required($required = array()) {
1143 1143
 		// make sure required is an array
1144
-		$required = is_array( $required ) ? $required : array();
1144
+		$required = is_array($required) ? $required : array();
1145 1145
 		// and set some defaults
1146
-		$required = array_merge( array( 'label' => '', 'class' => '', 'msg' => '' ), $required );
1146
+		$required = array_merge(array('label' => '', 'class' => '', 'msg' => ''), $required);
1147 1147
 		return $required;
1148 1148
 	}
1149 1149
 
@@ -1154,30 +1154,30 @@  discard block
 block discarded – undo
1154 1154
 	 * @param string 	$value
1155 1155
 	 * @return string
1156 1156
 	 */
1157
-	static function get_label_size_class( $value = FALSE ){
1158
-			if ( $value === FALSE || $value == '' ) {
1157
+	static function get_label_size_class($value = FALSE) {
1158
+			if ($value === FALSE || $value == '') {
1159 1159
 				return ' class="medium-lbl"';
1160 1160
 			}
1161 1161
 			// determine length of option value
1162
-			$val_size = strlen( $value );
1163
-			switch( $val_size ){
1162
+			$val_size = strlen($value);
1163
+			switch ($val_size) {
1164 1164
 				case $val_size < 3 :
1165
-					$size =  ' class="nano-lbl"';
1165
+					$size = ' class="nano-lbl"';
1166 1166
 					break;
1167 1167
 				case $val_size < 6 :
1168
-					$size =  ' class="micro-lbl"';
1168
+					$size = ' class="micro-lbl"';
1169 1169
 					break;
1170 1170
 				case $val_size < 12 :
1171
-					$size =  ' class="tiny-lbl"';
1171
+					$size = ' class="tiny-lbl"';
1172 1172
 					break;
1173 1173
 				case $val_size < 25 :
1174
-					$size =  ' class="small-lbl"';
1174
+					$size = ' class="small-lbl"';
1175 1175
 					break;
1176 1176
 				case $val_size > 100 :
1177
-					$size =  ' class="big-lbl"';
1177
+					$size = ' class="big-lbl"';
1178 1178
 					break;
1179 1179
 				default:
1180
-					$size =  ' class="medium-lbl"';
1180
+					$size = ' class="medium-lbl"';
1181 1181
 					break;
1182 1182
 			}
1183 1183
 		return $size;
@@ -1191,20 +1191,20 @@  discard block
 block discarded – undo
1191 1191
 	 * @param array 	$QFI
1192 1192
 	 * @return array
1193 1193
 	 */
1194
-	private static function _load_system_dropdowns( $QFI ){
1194
+	private static function _load_system_dropdowns($QFI) {
1195 1195
 		$QST_system = $QFI->get('QST_system');
1196
-		switch ( $QST_system ) {
1196
+		switch ($QST_system) {
1197 1197
 			case 'state' :
1198
-				$QFI = self::generate_state_dropdown( $QFI );
1198
+				$QFI = self::generate_state_dropdown($QFI);
1199 1199
 				break;
1200 1200
 			case 'country' :
1201
-				$QFI = self::generate_country_dropdown( $QFI );
1201
+				$QFI = self::generate_country_dropdown($QFI);
1202 1202
 				break;
1203 1203
 			case 'admin-state' :
1204
-				$QFI = self::generate_state_dropdown( $QFI, TRUE );
1204
+				$QFI = self::generate_state_dropdown($QFI, TRUE);
1205 1205
 				break;
1206 1206
 			case 'admin-country' :
1207
-				$QFI = self::generate_country_dropdown( $QFI, TRUE );
1207
+				$QFI = self::generate_country_dropdown($QFI, TRUE);
1208 1208
 				break;
1209 1209
 		}
1210 1210
 		return $QFI;
@@ -1221,13 +1221,13 @@  discard block
 block discarded – undo
1221 1221
 	 *
1222 1222
 	 * @return EE_Question_Form_Input
1223 1223
 	 */
1224
-	protected static function _load_specialized_dropdowns( $QFI ) {
1225
-		switch( $QFI->get( 'QST_type' ) ) {
1224
+	protected static function _load_specialized_dropdowns($QFI) {
1225
+		switch ($QFI->get('QST_type')) {
1226 1226
 			case 'STATE' :
1227
-				$QFI = self::generate_state_dropdown( $QFI );
1227
+				$QFI = self::generate_state_dropdown($QFI);
1228 1228
 				break;
1229 1229
 			case 'COUNTRY' :
1230
-				$QFI = self::generate_country_dropdown( $QFI );
1230
+				$QFI = self::generate_country_dropdown($QFI);
1231 1231
 				break;
1232 1232
 		}
1233 1233
 		return $QFI;
@@ -1241,23 +1241,23 @@  discard block
 block discarded – undo
1241 1241
 	 * @param bool  $get_all
1242 1242
 	 * @return array
1243 1243
 	 */
1244
-	public static function generate_state_dropdown( $QST, $get_all = FALSE ){
1244
+	public static function generate_state_dropdown($QST, $get_all = FALSE) {
1245 1245
 		$states = $get_all ? EEM_State::instance()->get_all_states() : EEM_State::instance()->get_all_states_of_active_countries();
1246
-		if ( $states && count( $states ) != count( $QST->options() )) {
1247
-			$QST->set( 'QST_type', 'DROPDOWN' );
1246
+		if ($states && count($states) != count($QST->options())) {
1247
+			$QST->set('QST_type', 'DROPDOWN');
1248 1248
 			// if multiple countries, we'll create option groups within the dropdown
1249
-			foreach ( $states as $state ) {
1250
-				if ( $state instanceof EE_State ) {
1251
-					$QSO = EE_Question_Option::new_instance ( array (
1249
+			foreach ($states as $state) {
1250
+				if ($state instanceof EE_State) {
1251
+					$QSO = EE_Question_Option::new_instance(array(
1252 1252
 						'QSO_value' => $state->ID(),
1253 1253
 						'QSO_desc' => $state->name(),
1254
-						'QST_ID' => $QST->get( 'QST_ID' ),
1254
+						'QST_ID' => $QST->get('QST_ID'),
1255 1255
 						'QSO_deleted' => FALSE
1256 1256
 					));
1257 1257
 					// set option group
1258
-					$QSO->set_opt_group( $state->country()->name() );
1258
+					$QSO->set_opt_group($state->country()->name());
1259 1259
 					// add option to question
1260
-					$QST->add_temp_option( $QSO );
1260
+					$QST->add_temp_option($QSO);
1261 1261
 				}
1262 1262
 			}
1263 1263
 		}
@@ -1273,20 +1273,20 @@  discard block
 block discarded – undo
1273 1273
 	 * @internal param array $question
1274 1274
 	 * @return array
1275 1275
 	 */
1276
-	public static function generate_country_dropdown( $QST, $get_all = FALSE ){
1276
+	public static function generate_country_dropdown($QST, $get_all = FALSE) {
1277 1277
 		$countries = $get_all ? EEM_Country::instance()->get_all_countries() : EEM_Country::instance()->get_all_active_countries();
1278
-		if ( $countries && count( $countries ) != count( $QST->options() ) ) {
1279
-			$QST->set( 'QST_type', 'DROPDOWN' );
1278
+		if ($countries && count($countries) != count($QST->options())) {
1279
+			$QST->set('QST_type', 'DROPDOWN');
1280 1280
 			// now add countries
1281
-			foreach ( $countries as $country ) {
1282
-				if ( $country instanceof EE_Country ) {
1283
-					$QSO = EE_Question_Option::new_instance ( array (
1281
+			foreach ($countries as $country) {
1282
+				if ($country instanceof EE_Country) {
1283
+					$QSO = EE_Question_Option::new_instance(array(
1284 1284
 						'QSO_value' => $country->ID(),
1285 1285
 						'QSO_desc' => $country->name(),
1286
-						'QST_ID' => $QST->get( 'QST_ID' ),
1286
+						'QST_ID' => $QST->get('QST_ID'),
1287 1287
 						'QSO_deleted' => FALSE
1288 1288
 					));
1289
-					$QST->add_temp_option( $QSO );
1289
+					$QST->add_temp_option($QSO);
1290 1290
 				}
1291 1291
 			}
1292 1292
 		}
@@ -1303,11 +1303,11 @@  discard block
 block discarded – undo
1303 1303
 	 */
1304 1304
 	public static function two_digit_months_dropdown_options() {
1305 1305
 		$options = array();
1306
-		for ( $x = 1; $x <= 12; $x++ ) {
1307
-			$mm = str_pad( $x, 2, '0', STR_PAD_LEFT );
1308
-			$options[ (string)$mm ] = (string)$mm;
1306
+		for ($x = 1; $x <= 12; $x++) {
1307
+			$mm = str_pad($x, 2, '0', STR_PAD_LEFT);
1308
+			$options[(string) $mm] = (string) $mm;
1309 1309
 		}
1310
-		return EEH_Form_Fields::prep_answer_options( $options );
1310
+		return EEH_Form_Fields::prep_answer_options($options);
1311 1311
 	}
1312 1312
 
1313 1313
 
@@ -1322,11 +1322,11 @@  discard block
 block discarded – undo
1322 1322
 		$options = array();
1323 1323
 		$current_year = date('y');
1324 1324
 		$next_decade = $current_year + 10;
1325
-		for ( $x = $current_year; $x <= $next_decade; $x++ ) {
1326
-			$yy = str_pad( $x, 2, '0', STR_PAD_LEFT );
1327
-			$options[ (string)$yy ] = (string)$yy;
1325
+		for ($x = $current_year; $x <= $next_decade; $x++) {
1326
+			$yy = str_pad($x, 2, '0', STR_PAD_LEFT);
1327
+			$options[(string) $yy] = (string) $yy;
1328 1328
 		}
1329
-		return EEH_Form_Fields::prep_answer_options( $options );
1329
+		return EEH_Form_Fields::prep_answer_options($options);
1330 1330
 	}
1331 1331
 
1332 1332
 
@@ -1340,17 +1340,17 @@  discard block
 block discarded – undo
1340 1340
 	 * @param  integer $evt_category Event Category ID if the Event Category filter is selected
1341 1341
 	 * @return string                html
1342 1342
 	 */
1343
-	public static function generate_registration_months_dropdown( $cur_date = '', $status = '', $evt_category = 0 ) {
1343
+	public static function generate_registration_months_dropdown($cur_date = '', $status = '', $evt_category = 0) {
1344 1344
 		$_where = array();
1345
-		if ( !empty( $status ) ) {
1345
+		if ( ! empty($status)) {
1346 1346
 			$_where['STS_ID'] = $status;
1347 1347
 		}
1348 1348
 
1349
-		if ( $evt_category > 0 ) {
1349
+		if ($evt_category > 0) {
1350 1350
 			$_where['Event.Term_Taxonomy.term_id'] = $evt_category;
1351 1351
 		}
1352 1352
 
1353
-		$regdtts = EEM_Registration::instance()->get_reg_months_and_years( $_where );
1353
+		$regdtts = EEM_Registration::instance()->get_reg_months_and_years($_where);
1354 1354
 
1355 1355
 		//setup vals for select input helper
1356 1356
 		$options = array(
@@ -1360,15 +1360,15 @@  discard block
 block discarded – undo
1360 1360
 				)
1361 1361
 			);
1362 1362
 
1363
-		foreach ( $regdtts as $regdtt ) {
1364
-			$date = $regdtt->reg_month. ' ' . $regdtt->reg_year;
1363
+		foreach ($regdtts as $regdtt) {
1364
+			$date = $regdtt->reg_month.' '.$regdtt->reg_year;
1365 1365
 			$options[] = array(
1366 1366
 				'text' => $date,
1367 1367
 				'id' => $date
1368 1368
 				);
1369 1369
 		}
1370 1370
 
1371
-		return self::select_input('month_range', $options, $cur_date, '', 'wide' );
1371
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1372 1372
 	}
1373 1373
 
1374 1374
 
@@ -1382,18 +1382,18 @@  discard block
 block discarded – undo
1382 1382
 	 * @param  string $evt_active_status "upcoming", "expired", "active", or "inactive"
1383 1383
 	 * @return string                    html
1384 1384
 	 */
1385
-	public static function generate_event_months_dropdown( $cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL ) {
1385
+	public static function generate_event_months_dropdown($cur_date = '', $status = NULL, $evt_category = NULL, $evt_active_status = NULL) {
1386 1386
 		//determine what post_status our condition will have for the query.
1387
-		switch ( $status ) {
1387
+		switch ($status) {
1388 1388
 			case 'month' :
1389 1389
 			case 'today' :
1390 1390
 			case NULL :
1391 1391
 			case 'all' :
1392
-				$where['Event.status'] = array( 'NOT IN', array('trash') );
1392
+				$where['Event.status'] = array('NOT IN', array('trash'));
1393 1393
 				break;
1394 1394
 
1395 1395
 			case 'draft' :
1396
-				$where['Event.status'] = array( 'IN', array('draft', 'auto-draft') );
1396
+				$where['Event.status'] = array('IN', array('draft', 'auto-draft'));
1397 1397
 
1398 1398
 			default :
1399 1399
 				$where['Event.status'] = $status;
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 		//categories?
1403 1403
 
1404 1404
 
1405
-		if ( !empty ( $evt_category ) ) {
1405
+		if ( ! empty ($evt_category)) {
1406 1406
 			$where['Event.Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1407 1407
 			$where['Event.Term_Taxonomy.term_id'] = $evt_category;
1408 1408
 		}
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 
1411 1411
 //		$where['DTT_is_primary'] = 1;
1412 1412
 
1413
-		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status );
1413
+		$DTTS = EE_Registry::instance()->load_model('Datetime')->get_dtt_months_and_years($where, $evt_active_status);
1414 1414
 
1415 1415
 		//let's setup vals for select input helper
1416 1416
 		$options = array(
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
 		//translate month and date
1424 1424
 		global $wp_locale;
1425 1425
 
1426
-		foreach ( $DTTS as $DTT ) {
1427
-			$localized_date = $wp_locale->get_month( date('m', strtotime($DTT->dtt_month)) ) . ' ' . $DTT->dtt_year;
1428
-			$id = $DTT->dtt_month . ' ' . $DTT->dtt_year;
1426
+		foreach ($DTTS as $DTT) {
1427
+			$localized_date = $wp_locale->get_month(date('m', strtotime($DTT->dtt_month))).' '.$DTT->dtt_year;
1428
+			$id = $DTT->dtt_month.' '.$DTT->dtt_year;
1429 1429
 			$options[] = array(
1430 1430
 				'text' => $localized_date,
1431 1431
 				'id' => $id
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 		}
1434 1434
 
1435 1435
 
1436
-		return self::select_input( 'month_range', $options, $cur_date, '', 'wide' );
1436
+		return self::select_input('month_range', $options, $cur_date, '', 'wide');
1437 1437
 	}
1438 1438
 
1439 1439
 
@@ -1444,7 +1444,7 @@  discard block
 block discarded – undo
1444 1444
 	 * @param  integer $current_cat currently selected category
1445 1445
 	 * @return string               html for dropdown
1446 1446
 	 */
1447
-	public static function generate_event_category_dropdown( $current_cat = -1 ) {
1447
+	public static function generate_event_category_dropdown($current_cat = -1) {
1448 1448
 		$categories = EEM_Term::instance()->get_all_ee_categories(TRUE);
1449 1449
 		$options = array(
1450 1450
 			'0' => array(
@@ -1454,14 +1454,14 @@  discard block
 block discarded – undo
1454 1454
 			);
1455 1455
 
1456 1456
 		//setup categories for dropdown
1457
-		foreach ( $categories as $category ) {
1457
+		foreach ($categories as $category) {
1458 1458
 			$options[] = array(
1459 1459
 				'text' => $category->get('name'),
1460 1460
 				'id' => $category->ID()
1461 1461
 				);
1462 1462
 		}
1463 1463
 
1464
-		return self::select_input( 'EVT_CAT', $options, $current_cat );
1464
+		return self::select_input('EVT_CAT', $options, $current_cat);
1465 1465
 	}
1466 1466
 
1467 1467
 
@@ -1480,20 +1480,20 @@  discard block
 block discarded – undo
1480 1480
 	 * @param    string   $extra_attributes - any extra attributes that need to be attached to the form input
1481 1481
 	 * @return    void
1482 1482
 	 */
1483
-	public static function submit_button( $url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '' ) {
1483
+	public static function submit_button($url = '', $ID = '', $class = '', $text = '', $nonce_action = '', $input_only = FALSE, $extra_attributes = '') {
1484 1484
 		$btn = '';
1485
-		if ( empty( $url ) || empty( $ID )) {
1485
+		if (empty($url) || empty($ID)) {
1486 1486
 			return $btn;
1487 1487
 		}
1488
-		$text = ! empty( $text ) ? $text : __('Submit', 'event_espresso' );
1489
-		$btn .= '<input id="' . $ID . '-btn" class="' . $class . '" type="submit" value="' . $text . '" ' . $extra_attributes . '/>';
1490
-		if ( ! $input_only ) {
1491
-			$btn_frm = '<form id="' . $ID . '-frm" method="POST" action="' . $url . '">';
1492
-			$btn_frm .= ! empty( $nonce_action ) ? wp_nonce_field( $nonce_action, $nonce_action . '_nonce', TRUE, FALSE ) : '';
1488
+		$text = ! empty($text) ? $text : __('Submit', 'event_espresso');
1489
+		$btn .= '<input id="'.$ID.'-btn" class="'.$class.'" type="submit" value="'.$text.'" '.$extra_attributes.'/>';
1490
+		if ( ! $input_only) {
1491
+			$btn_frm = '<form id="'.$ID.'-frm" method="POST" action="'.$url.'">';
1492
+			$btn_frm .= ! empty($nonce_action) ? wp_nonce_field($nonce_action, $nonce_action.'_nonce', TRUE, FALSE) : '';
1493 1493
 			$btn_frm .= $btn;
1494 1494
 			$btn_frm .= '</form>';
1495 1495
 			$btn = $btn_frm;
1496
-			unset ( $btn_frm );
1496
+			unset ($btn_frm);
1497 1497
 		}
1498 1498
 		return $btn;
1499 1499
 	}
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -366,14 +366,16 @@  discard block
 block discarded – undo
366 366
 		$field = '<select id="' . EEH_Formatter::ee_tep_output_string($name) . '" name="' . EEH_Formatter::ee_tep_output_string($name) . '"';
367 367
 		//Debug
368 368
 		//EEH_Debug_Tools::printr( $values, '$values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
369
-		if ( EEH_Formatter::ee_tep_not_null($parameters))
370
-			$field .= ' ' . $parameters;
369
+		if ( EEH_Formatter::ee_tep_not_null($parameters)) {
370
+					$field .= ' ' . $parameters;
371
+		}
371 372
 		if ($autosize) {
372 373
 			$size = 'med';
373 374
 			for ($ii = 0, $ni = sizeof($values); $ii < $ni; $ii++) {
374 375
 				if ($values[$ii]['text']) {
375
-					if (strlen($values[$ii]['text']) > 5)
376
-						$size = 'wide';
376
+					if (strlen($values[$ii]['text']) > 5) {
377
+											$size = 'wide';
378
+					}
377 379
 				}
378 380
 			}
379 381
 		} else {
@@ -382,8 +384,9 @@  discard block
 block discarded – undo
382 384
 
383 385
 		$field .= ' class="' . $class . ' ' . $size . '">';
384 386
 
385
-		if (empty($default) && isset($GLOBALS[$name]))
386
-			$default = stripslashes($GLOBALS[$name]);
387
+		if (empty($default) && isset($GLOBALS[$name])) {
388
+					$default = stripslashes($GLOBALS[$name]);
389
+		}
387 390
 
388 391
 
389 392
 		for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
Please login to merge, or discard this patch.
core/helpers/EEH_Maps.helper.php 2 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,6 @@  discard block
 block discarded – undo
31 31
 
32 32
 	/**
33 33
 	 * google_map - creates a Google Map Link
34
-	 * @param  array $atts aray of attributes required for the map link generation
35 34
 	 * @return string (link to map!)
36 35
 	 */
37 36
 	public static function google_map( $ee_gmaps_opts ){
@@ -116,7 +115,6 @@  discard block
 block discarded – undo
116 115
 
117 116
 	/**
118 117
 	 * creates a Google Map Link
119
-	 * @param  array $atts aray of attributes required for the map link generation
120 118
 	 * @return string (link to map!)
121 119
 	 */
122 120
 	public static function espresso_google_map_js() {
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -34,20 +34,20 @@  discard block
 block discarded – undo
34 34
 	 * @param  array $atts aray of attributes required for the map link generation
35 35
 	 * @return string (link to map!)
36 36
 	 */
37
-	public static function google_map( $ee_gmaps_opts ){
37
+	public static function google_map($ee_gmaps_opts) {
38 38
 
39 39
 		//d( $ee_gmaps_opts );
40 40
 
41
-		$ee_map_width = isset( $ee_gmaps_opts['ee_map_width'] ) && ! empty( $ee_gmaps_opts['ee_map_width'] ) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
-		$ee_map_height = isset( $ee_gmaps_opts['ee_map_height'] ) && ! empty( $ee_gmaps_opts['ee_map_height'] ) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
-		$ee_map_zoom = isset( $ee_gmaps_opts['ee_map_zoom'] ) && ! empty( $ee_gmaps_opts['ee_map_zoom'] ) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
-		$ee_map_nav_display = isset( $ee_gmaps_opts['ee_map_nav_display'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_display'] ) ? 'true' : 'false';
45
-		$ee_map_nav_size =  isset( $ee_gmaps_opts['ee_map_nav_size'] ) && ! empty( $ee_gmaps_opts['ee_map_nav_size'] )? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
-		$ee_map_type_control =  isset( $ee_gmaps_opts['ee_map_type_control'] ) && ! empty( $ee_gmaps_opts['ee_map_type_control'] )? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
-		$static_url =  isset( $ee_gmaps_opts['ee_static_url'] ) && ! empty( $ee_gmaps_opts['ee_static_url'] )? $ee_gmaps_opts['ee_static_url'] : FALSE;
41
+		$ee_map_width = isset($ee_gmaps_opts['ee_map_width']) && ! empty($ee_gmaps_opts['ee_map_width']) ? $ee_gmaps_opts['ee_map_width'] : '300';
42
+		$ee_map_height = isset($ee_gmaps_opts['ee_map_height']) && ! empty($ee_gmaps_opts['ee_map_height']) ? $ee_gmaps_opts['ee_map_height'] : '185';
43
+		$ee_map_zoom = isset($ee_gmaps_opts['ee_map_zoom']) && ! empty($ee_gmaps_opts['ee_map_zoom']) ? $ee_gmaps_opts['ee_map_zoom'] : '12';
44
+		$ee_map_nav_display = isset($ee_gmaps_opts['ee_map_nav_display']) && ! empty($ee_gmaps_opts['ee_map_nav_display']) ? 'true' : 'false';
45
+		$ee_map_nav_size = isset($ee_gmaps_opts['ee_map_nav_size']) && ! empty($ee_gmaps_opts['ee_map_nav_size']) ? $ee_gmaps_opts['ee_map_nav_size'] : 'default';
46
+		$ee_map_type_control = isset($ee_gmaps_opts['ee_map_type_control']) && ! empty($ee_gmaps_opts['ee_map_type_control']) ? $ee_gmaps_opts['ee_map_type_control'] : 'default';
47
+		$static_url = isset($ee_gmaps_opts['ee_static_url']) && ! empty($ee_gmaps_opts['ee_static_url']) ? $ee_gmaps_opts['ee_static_url'] : FALSE;
48 48
 
49
-		if( isset( $ee_gmaps_opts['ee_map_align'] ) && ! empty( $ee_gmaps_opts['ee_map_align'] )){
50
-			switch( $ee_gmaps_opts['ee_map_align'] ){
49
+		if (isset($ee_gmaps_opts['ee_map_align']) && ! empty($ee_gmaps_opts['ee_map_align'])) {
50
+			switch ($ee_gmaps_opts['ee_map_align']) {
51 51
 				case "left":
52 52
 					$map_align = 'ee-gmap-align-left left';
53 53
 					break;
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 
69 69
 		// Determine whether user has set a hardoded url to use and
70 70
 		// if so display a Google static iframe map else run V3 api
71
-		if( $static_url ) {
71
+		if ($static_url) {
72 72
 
73
-			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper ' . $map_align . '">';
74
-			$html .= '<iframe src="' . $static_url . '&output=embed" style="width: ' . $ee_map_width  .'px; height: ' . $ee_map_height . 'px;" frameborder="0" scrolling="no">';
73
+			$html = '<div class="ee-gmap-iframewrap ee-gmap-wrapper '.$map_align.'">';
74
+			$html .= '<iframe src="'.$static_url.'&output=embed" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;" frameborder="0" scrolling="no">';
75 75
 			$html .= '</iframe>';
76
-			$html .= '<a href="' . $static_url . '">View Large map</a>';
76
+			$html .= '<a href="'.$static_url.'">View Large map</a>';
77 77
 			$html .= '</div>';
78 78
 			return $html;
79 79
 
80 80
 		 } else {
81 81
 
82
-			EEH_Maps::$gmap_vars[ $ee_gmaps_opts['map_ID'] ] = array(
82
+			EEH_Maps::$gmap_vars[$ee_gmaps_opts['map_ID']] = array(
83 83
 				'map_ID' => $ee_gmaps_opts['map_ID'],
84 84
 				'ee_map_zoom' => $ee_map_zoom,
85 85
 				'ee_map_nav_display' => $ee_map_nav_display,
@@ -89,12 +89,12 @@  discard block
 block discarded – undo
89 89
 			);
90 90
 
91 91
 			$html = '<div class="ee-gmap-wrapper '.$map_align.';">';
92
-			$html .= '<div class="ee-gmap" id="map_canvas_' . $ee_gmaps_opts['map_ID'] .'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>';  //
92
+			$html .= '<div class="ee-gmap" id="map_canvas_'.$ee_gmaps_opts['map_ID'].'" style="width: '.$ee_map_width.'px; height: '.$ee_map_height.'px;"></div>'; //
93 93
 			$html .= '</div>';
94 94
 
95
-			wp_enqueue_script( 'gmap_api' );
96
-			wp_enqueue_script( 'ee_gmap' );
97
-			add_action( 'wp_footer', array( 'EEH_Maps', 'footer_enqueue_script' ));
95
+			wp_enqueue_script('gmap_api');
96
+			wp_enqueue_script('ee_gmap');
97
+			add_action('wp_footer', array('EEH_Maps', 'footer_enqueue_script'));
98 98
 
99 99
 			return $html;
100 100
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @return void
110 110
 	 */
111 111
 	public static function footer_enqueue_script() {
112
-		wp_localize_script( 'ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars );
112
+		wp_localize_script('ee_gmap', 'ee_gmap_vars', EEH_Maps::$gmap_vars);
113 113
 	}
114 114
 
115 115
 
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	public static function espresso_google_map_js() {
123 123
 		$scheme = is_ssl() ? 'https://' : 'http://';
124
-		wp_register_script( 'gmap_api', $scheme . 'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE );
125
-		wp_register_script( 'ee_gmap', plugin_dir_url(__FILE__) . 'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE );
124
+		wp_register_script('gmap_api', $scheme.'maps.google.com/maps/api/js?sensor=false', array('jquery'), NULL, TRUE);
125
+		wp_register_script('ee_gmap', plugin_dir_url(__FILE__).'assets/ee_gmap.js', array('gmap_api'), '1.0', TRUE);
126 126
 	}
127 127
 
128 128
 	/**
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 	 * @return string (link to map!)
132 132
 	 */
133 133
 	public static function google_map_link($atts) {
134
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
134
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
135 135
 		extract($atts);
136 136
 
137 137
 		$address = "{$address}";
@@ -146,9 +146,9 @@  discard block
 block discarded – undo
146 146
 		$id = isset($id) ? $id : 'not_set';
147 147
 		$map_image_class = isset($map_image_class) ? $map_image_class : 'ee_google_map_view';
148 148
 
149
-		$address_string = ($address != '' ? $address : '') . ($city != '' ? ',' . $city : '') . ($state != '' ? ',' . $state : '') . ($zip != '' ? ',' . $zip : '') . ($country != '' ? ',' . $country : '');
149
+		$address_string = ($address != '' ? $address : '').($city != '' ? ','.$city : '').($state != '' ? ','.$state : '').($zip != '' ? ','.$zip : '').($country != '' ? ','.$country : '');
150 150
 
151
-		$google_map = htmlentities2('http://maps.google.com/maps?q=' . urlencode( $address_string ));
151
+		$google_map = htmlentities2('http://maps.google.com/maps?q='.urlencode($address_string));
152 152
 
153 153
 		switch ($type) {
154 154
 			case 'text':
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 
163 163
 			case 'map':
164 164
 				$scheme = is_ssl() ? 'https://' : 'http://';
165
-				return '<a class="a_map_image_link" href="' . $google_map . '" target="_blank">' . '<img class="map_image_link" id="venue_map_' . $id . '" ' . $map_image_class . ' src="' . htmlentities2( $scheme . 'maps.googleapis.com/maps/api/staticmap?center=' . urlencode( $address_string ) . '&amp;zoom=14&amp;size=' . $map_w . 'x' . $map_h . '&amp;markers=color:green|label:|' . urlencode( $address_string ) . '&amp;sensor=false' ) . '" /></a>';
165
+				return '<a class="a_map_image_link" href="'.$google_map.'" target="_blank">'.'<img class="map_image_link" id="venue_map_'.$id.'" '.$map_image_class.' src="'.htmlentities2($scheme.'maps.googleapis.com/maps/api/staticmap?center='.urlencode($address_string).'&amp;zoom=14&amp;size='.$map_w.'x'.$map_h.'&amp;markers=color:green|label:|'.urlencode($address_string).'&amp;sensor=false').'" /></a>';
166 166
 		}
167 167
 
168
-		return '<a href="' . $google_map . '" target="_blank">' . $text . '</a>';
168
+		return '<a href="'.$google_map.'" target="_blank">'.$text.'</a>';
169 169
 	}
170 170
 
171 171
 
Please login to merge, or discard this patch.
core/helpers/EEH_Qtip_Loader.helper.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
 	 * - registers and enqueues the qtip scripts and styles.
110 110
 	 *
111 111
 	 * @access public
112
-	 * @param  array  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
112
+	 * @param  string[]  $paths      Array of paths to check for the EE_Qtip class. If present we check these path(s) first.  If not present (empty array), then it's assumed it's either in core/libraries/qtips OR the file is already loaded.
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 */
33 33
 	public static function instance() {
34 34
 		// check if class object is instantiated
35
-		if ( self::$_instance === NULL  or ! is_object( self::$_instance ) or ! ( self::$_instance instanceof EEH_Qtip_Loader )) {
35
+		if (self::$_instance === NULL or ! is_object(self::$_instance) or ! (self::$_instance instanceof EEH_Qtip_Loader)) {
36 36
 			self::$_instance = new self();
37 37
 		}
38 38
 		return self::$_instance;
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	private function __construct() {
50 50
 		//let's just make sure this is instantiated in the right place.
51
-		if ( did_action( 'wp_print_styles' ) || did_action( 'admin_head' )) {
52
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso' ), '4.1' );
51
+		if (did_action('wp_print_styles') || did_action('admin_head')) {
52
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader', __('This helper must be instantiated before or within a callback for the WordPress wp_enqueue_scripts hook action hook.', 'event_espresso'), '4.1');
53 53
 		}
54 54
 	}
55 55
 
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
 	 * @return void
62 62
 	 */
63 63
 	public function register_and_enqueue() {
64
-		$qtips_js = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.js';
65
-		$qtip_images_loaded = EE_THIRD_PARTY_URL . 'qtip/imagesloaded.pkg.min.js';
66
-		$qtip_map = EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.map';
67
-		$qtipcss = !defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL . 'qtip/jquery.qtip.css';
64
+		$qtips_js = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.js' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.js';
65
+		$qtip_images_loaded = EE_THIRD_PARTY_URL.'qtip/imagesloaded.pkg.min.js';
66
+		$qtip_map = EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.map';
67
+		$qtipcss = ! defined('SCRIPT_DEBUG') ? EE_THIRD_PARTY_URL.'qtip/jquery.qtip.min.css' : EE_THIRD_PARTY_URL.'qtip/jquery.qtip.css';
68 68
 
69
-		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE );
70
-		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE );
71
-		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE );
72
-		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS . 'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE );
69
+		wp_register_script('qtip-map', $qtip_map, array(), '3', TRUE);
70
+		wp_register_script('qtip-images-loaded', $qtip_images_loaded, array(), '2.2.0', TRUE);
71
+		wp_register_script('qtip', $qtips_js, array('jquery'), '2.2.0', TRUE);
72
+		wp_register_script('ee-qtip-helper', EE_HELPERS_ASSETS.'ee-qtip-helper.js', array('qtip', 'jquery-cookie'), EVENT_ESPRESSO_VERSION, TRUE);
73 73
 
74
-		wp_register_style('qtip-css', $qtipcss, array(), '2.2' );
74
+		wp_register_style('qtip-css', $qtipcss, array(), '2.2');
75 75
 
76 76
 		//k now let's see if there are any registered qtips.  If there are, then we need to setup the localized script for ee-qtip-helper.js (and enqueue ee-qtip-helper.js of course!)
77
-		if ( !empty( $this->_qtips ) ) {
77
+		if ( ! empty($this->_qtips)) {
78 78
 			wp_enqueue_script('ee-qtip-helper');
79 79
 			wp_enqueue_style('qtip-css');
80 80
 			$qtips = array();
81
-			foreach ( $this->_qtips as $qtip ) {
81
+			foreach ($this->_qtips as $qtip) {
82 82
 				$qts = $qtip->get_tips();
83
-				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
83
+				foreach ($qts as $qt) {
84
+					if ( ! $qt instanceof EE_Qtip)
85 85
 						continue;
86 86
 					$qtips[] = array(
87 87
 						'content_id' => $qt->content_id,
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
 						);
91 91
 				}
92 92
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
93
+			if ( ! empty($qtips))
94
+				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array('qtips' => $qtips));
95 95
 
96 96
 		} else {
97 97
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -113,24 +113,24 @@  discard block
 block discarded – undo
113 113
 	 * @param  string|array $configname name of the Qtip class (full class name is expected and will be used for looking for file, Qtip config classes must extend EE_Qtip_Config) [if this is an array, then we loop through the array to instantiate and setup the qtips]
114 114
 	 * @return void
115 115
 	 */
116
-	public function register( $configname, $paths = array() ) {
116
+	public function register($configname, $paths = array()) {
117 117
 
118 118
 		//let's just make sure this is instantiated in the right place.
119
-		if ( did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts') ) {
120
-			EE_Error::doing_it_wrong( 'EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso' ), '4.1' );
119
+		if (did_action('wp_enqueue_scripts') || did_action('admin_enqueue_scripts')) {
120
+			EE_Error::doing_it_wrong('EEH_Qtip_Loader->register()', __('EE_Qtip_Config objects must be registered before wp_enqueue_scripts is called.', 'event_espresso'), '4.1');
121 121
 		}
122 122
 
123 123
 		$configname = (array) $configname; //typecast to array
124
-		foreach ( $configname as $config ) {
125
-			$this->_register( $config, $paths );
124
+		foreach ($configname as $config) {
125
+			$this->_register($config, $paths);
126 126
 		}
127 127
 
128 128
 		//hook into appropriate footer
129 129
 		$footer_action = is_admin() ? 'admin_footer' : 'wp_footer';
130
-		add_action($footer_action, array($this, 'setup_qtip'), 10 );
130
+		add_action($footer_action, array($this, 'setup_qtip'), 10);
131 131
 
132 132
 		//make sure we "turn on" qtip js.
133
-		add_filter('FHEE_load_qtip', '__return_true' );
133
+		add_filter('FHEE_load_qtip', '__return_true');
134 134
 	}
135 135
 
136 136
 
@@ -144,15 +144,15 @@  discard block
 block discarded – undo
144 144
 	 * @throws EE_Error
145 145
 	 * @return void
146 146
 	 */
147
-	private function _register( $config, $paths ) {
147
+	private function _register($config, $paths) {
148 148
 		//before doing anything we have to make sure that EE_Qtip_Config parent is required.
149
-		EE_Registry::instance()->load_lib( 'Qtip_Config', array(), TRUE );
149
+		EE_Registry::instance()->load_lib('Qtip_Config', array(), TRUE);
150 150
 
151
-		if ( !empty( $paths ) ) {
151
+		if ( ! empty($paths)) {
152 152
 			$paths = (array) $paths;
153
-			foreach ( $paths as $path ) {
154
-				$path = $path . $config . '.lib.php';
155
-				if ( !is_readable($path ) ) {
153
+			foreach ($paths as $path) {
154
+				$path = $path.$config.'.lib.php';
155
+				if ( ! is_readable($path)) {
156 156
 					continue;
157 157
 				} else {
158 158
 					require_once $path;
@@ -161,26 +161,26 @@  discard block
 block discarded – undo
161 161
 		}
162 162
 
163 163
 		//does class exist at this point?  If it does then let's instantiate.  If it doesn't then let's continue with other paths.
164
-		if ( !class_exists($config) ) {
165
-			$path = EE_LIBRARIES . 'qtips/' . $config . '.lib.php';
166
-			if ( !is_readable($path ) ) {
167
-				throw new EE_Error( sprintf( __('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config ) );
164
+		if ( ! class_exists($config)) {
165
+			$path = EE_LIBRARIES.'qtips/'.$config.'.lib.php';
166
+			if ( ! is_readable($path)) {
167
+				throw new EE_Error(sprintf(__('Unable to load the Qtip Config registered for this page (%s) because none of the file paths attempted are readable.  Please check the spelling of the paths you\'ve used in the registration', 'event_espresso'), $config));
168 168
 			} else {
169 169
 				require_once $path;
170 170
 			}
171 171
 		}
172 172
 
173 173
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
174
+		if ( ! class_exists($config))
175
+			throw new EE_Error(sprintf(__('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config));
176 176
 
177 177
 		//made it HERE?  FINALLY, let's get things setup.
178 178
 		$a = new ReflectionClass($config);
179 179
 		$qtip = $a->newInstance();
180 180
 
181 181
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
182
+		if ( ! $qtip instanceof EE_Qtip_Config)
183
+			throw new EE_Error(sprintf(__('The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config));
184 184
 
185 185
 		$this->_qtips[] = $a->newInstance();
186 186
 
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 	 * @return void
197 197
 	 */
198 198
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
199
+		if (empty($this->_qtips))
200 200
 			return; //no qtips!
201 201
 
202 202
 		$content = array();
203 203
 
204
-		foreach ( $this->_qtips as $qtip ) {
204
+		foreach ($this->_qtips as $qtip) {
205 205
 			$content[] = $this->_generate_content_container($qtip);
206 206
 		}
207 207
 
@@ -218,10 +218,10 @@  discard block
 block discarded – undo
218 218
 	private function _generate_content_container($qtip) {
219 219
 		$qts = $qtip->get_tips();
220 220
 		$content = array();
221
-		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
221
+		foreach ($qts as $qt) {
222
+			if ( ! $qt instanceof EE_Qtip)
223 223
 				continue;
224
-			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
224
+			$content[] = '<div class="ee-qtip-helper-content hidden" id="'.$qt->content_id.'">'.$qt->content.'</div>';
225 225
 		}
226 226
 
227 227
 		return implode('<br />', $content);
Please login to merge, or discard this patch.
Braces   +19 added lines, -12 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 			foreach ( $this->_qtips as $qtip ) {
82 82
 				$qts = $qtip->get_tips();
83 83
 				foreach ( $qts as $qt ) {
84
-					if ( ! $qt instanceof EE_Qtip )
85
-						continue;
84
+					if ( ! $qt instanceof EE_Qtip ) {
85
+											continue;
86
+					}
86 87
 					$qtips[] = array(
87 88
 						'content_id' => $qt->content_id,
88 89
 						'options' => $qt->options,
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 						);
91 92
 				}
92 93
 			}
93
-			if ( !empty($qtips) )
94
-				wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
94
+			if ( !empty($qtips) ) {
95
+							wp_localize_script('ee-qtip-helper', 'EE_QTIP_HELPER', array( 'qtips' => $qtips ) );
96
+			}
95 97
 
96 98
 		} else {
97 99
 			//qtips has been requested without any registration (so assuming its just directly used in the admin).
@@ -171,16 +173,18 @@  discard block
 block discarded – undo
171 173
 		}
172 174
 
173 175
 		//now we attempt a class_exists one more time.
174
-		if ( !class_exists( $config ) )
175
-			throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
176
+		if ( !class_exists( $config ) ) {
177
+					throw new EE_Error( sprintf( __('The Qtip_Config class being registered (%s) does not exist, please check the spelling.', 'event_espresso'), $config ) );
178
+		}
176 179
 
177 180
 		//made it HERE?  FINALLY, let's get things setup.
178 181
 		$a = new ReflectionClass($config);
179 182
 		$qtip = $a->newInstance();
180 183
 
181 184
 		//verify that $qtip is a valid object
182
-		if ( ! $qtip instanceof EE_Qtip_Config )
183
-			throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
185
+		if ( ! $qtip instanceof EE_Qtip_Config ) {
186
+					throw new EE_Error( sprintf( __( 'The class given for the Qtip loader (%s) is not a child of the <strong>EE_Qtip_Config</strong> class. Please make sure you are extending EE_Qtip_Config.', 'event_espresso'), $config ) );
187
+		}
184 188
 
185 189
 		$this->_qtips[] = $a->newInstance();
186 190
 
@@ -196,8 +200,10 @@  discard block
 block discarded – undo
196 200
 	 * @return void
197 201
 	 */
198 202
 	public function setup_qtip() {
199
-		if ( empty( $this->_qtips ) )
200
-			return; //no qtips!
203
+		if ( empty( $this->_qtips ) ) {
204
+					return;
205
+		}
206
+		//no qtips!
201 207
 
202 208
 		$content = array();
203 209
 
@@ -219,8 +225,9 @@  discard block
 block discarded – undo
219 225
 		$qts = $qtip->get_tips();
220 226
 		$content = array();
221 227
 		foreach ( $qts as $qt ) {
222
-			if ( ! $qt instanceof EE_Qtip )
223
-				continue;
228
+			if ( ! $qt instanceof EE_Qtip ) {
229
+							continue;
230
+			}
224 231
 			$content[] = '<div class="ee-qtip-helper-content hidden" id="' . $qt->content_id . '">' . $qt->content . '</div>';
225 232
 		}
226 233
 
Please login to merge, or discard this patch.