Completed
Branch FET-9795-new-interfaces (ea072c)
by
unknown
296:38 queued 279:44
created
admin_pages/registrations/templates/reg_status_change_buttons.template.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <div id="reg-admin-approve-decline-reg-status-dv">
2 2
 
3 3
 	<h2 id="reg-admin-reg-details-reg-status-hdr">
4
-		<?php echo __( 'Current Registration Status : ', 'event_espresso' ); ?>
4
+		<?php echo __('Current Registration Status : ', 'event_espresso'); ?>
5 5
 		<span class="<?php echo $reg_status_class; ?> bigger-text"><?php echo $reg_status_value; ?></span>
6 6
 	</h2>
7
-	<?php do_action( 'AHEE__reg_status_change_buttons__after_header', $REG_ID ); ?>
7
+	<?php do_action('AHEE__reg_status_change_buttons__after_header', $REG_ID); ?>
8 8
 
9 9
 	<h3 id="reg-admin-reg-details-reg-status-hdr">
10
-		<?php echo __( 'Change Registration Status to :', 'event_espresso' ); ?>
10
+		<?php echo __('Change Registration Status to :', 'event_espresso'); ?>
11 11
 	</h3>
12 12
 
13 13
 	<form id="reg_status_change_form" method="POST" action="<?php echo $form_url; ?>">
@@ -16,15 +16,15 @@  discard block
 block discarded – undo
16 16
 		<input type="hidden" name="return" value="view_registration">
17 17
 		<?php echo $nonce; ?>
18 18
 		<?php echo $status_buttons; ?>
19
-		<?php if ( $attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'registration_message_type' ) ) : ?>
19
+		<?php if ($attendee instanceof EE_Attendee && EE_Registry::instance()->CAP->current_user_can('ee_send_message', 'registration_message_type')) : ?>
20 20
 			<span id="send-related-messages-dv">
21
-			<label for="txn-reg-status-send-notifications-inp" class="important-notice"><?php _e( '...and send related messages ?', 'event_espresso' ); ?>
21
+			<label for="txn-reg-status-send-notifications-inp" class="important-notice"><?php _e('...and send related messages ?', 'event_espresso'); ?>
22 22
 				<input type="checkbox" value="1" id="txn-reg-status-send-notifications-inp" name="txn_reg_status_change[send_notifications]">
23 23
 			</label>
24 24
 			<br/>
25 25
 		</span>
26 26
 			<br/>
27
-			<p class="description"><?php _e( 'If the "send related messages"checkbox is checked when changing status, then the related messages will be sent to the registrant.', 'event_espresso' ); ?></p>
27
+			<p class="description"><?php _e('If the "send related messages"checkbox is checked when changing status, then the related messages will be sent to the registrant.', 'event_espresso'); ?></p>
28 28
 		<?php endif; ?>
29 29
 	</form>
30 30
 </div>
Please login to merge, or discard this patch.
core/helpers/EEH_Array.helper.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); }
3 3
 
4
-require_once( EE_HELPERS . 'EEH_Base.helper.php' );
4
+require_once(EE_HELPERS.'EEH_Base.helper.php');
5 5
 
6 6
 /**
7 7
  * EE_Array
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param  array $array2 an array of objects
27 27
 	 * @return array         an array of objects found in array 1 that aren't found in array 2.
28 28
 	 */
29
-	public static function object_array_diff( $array1, $array2 ) {
30
-		return array_udiff( $array1, $array2, array('self', '_compare_objects' ));
29
+	public static function object_array_diff($array1, $array2) {
30
+		return array_udiff($array1, $array2, array('self', '_compare_objects'));
31 31
 	}
32 32
 
33 33
 	/**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 	 * @param array $array
37 37
 	 * @return boolean
38 38
 	 */
39
-	public static function is_associative_array( array $array ) {
40
-		return array_keys( $array ) !== range( 0, count( $array ) - 1 );
39
+	public static function is_associative_array(array $array) {
40
+		return array_keys($array) !== range(0, count($array) - 1);
41 41
 	}
42 42
 
43 43
 	/**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * @param array $arr
47 47
 	 * @return mixed what ever is in the array
48 48
 	 */
49
-	public static function get_one_item_from_array($arr){
49
+	public static function get_one_item_from_array($arr) {
50 50
 		$item = end($arr);
51 51
 		reset($arr);
52 52
 		return $item;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
 	 * @param mixed $arr
58 58
 	 * @return boolean
59 59
 	 */
60
-	public static function is_multi_dimensional_array($arr){
61
-		if(is_array($arr)){
60
+	public static function is_multi_dimensional_array($arr) {
61
+		if (is_array($arr)) {
62 62
 			$first_item = reset($arr);
63
-			if(is_array($first_item)){
64
-				return true;//yep, there's at least 2 levels to this array
65
-			}else{
66
-				return false;//nope, only 1 level
63
+			if (is_array($first_item)) {
64
+				return true; //yep, there's at least 2 levels to this array
65
+			} else {
66
+				return false; //nope, only 1 level
67 67
 			}
68
-		}else{
69
-			return false;//its not an array at all!
68
+		} else {
69
+			return false; //its not an array at all!
70 70
 		}
71 71
 	}
72 72
 
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
 	 * @param mixed $default
78 78
 	 * @return mixed
79 79
 	 */
80
-	public static function is_set( $arr, $index, $default ) {
81
-		return isset( $arr[ $index ] ) ? $arr[ $index ] : $default;
80
+	public static function is_set($arr, $index, $default) {
81
+		return isset($arr[$index]) ? $arr[$index] : $default;
82 82
 	}
83 83
 
84 84
 	/**
@@ -86,12 +86,12 @@  discard block
 block discarded – undo
86 86
 	 * @param mixed $value usually a string, but could be an array or object
87 87
 	 * @return mixed the UN-serialized data
88 88
 	 */
89
-	public static function maybe_unserialize( $value ) {
89
+	public static function maybe_unserialize($value) {
90 90
 		$data = maybe_unserialize($value);
91 91
 		//it's possible that this still has serialized data if its the session.  WP has a bug, http://core.trac.wordpress.org/ticket/26118 that doesnt' unserialize this automatically.
92 92
 		$token = 'C';
93 93
 		$data = is_string($data) ? trim($data) : $data;
94
-		if ( is_string($data) && strlen($data) > 1 && $data[0] == $token  && preg_match( "/^{$token}:[0-9]+:/s", $data ) ) {
94
+		if (is_string($data) && strlen($data) > 1 && $data[0] == $token && preg_match("/^{$token}:[0-9]+:/s", $data)) {
95 95
 			return unserialize($data);
96 96
 		} else {
97 97
 			return $data;
@@ -110,30 +110,30 @@  discard block
 block discarded – undo
110 110
 	 * @param bool $preserve_keys 		whether or not to reset numerically indexed arrays
111 111
 	 * @return array
112 112
 	 */
113
-	public static function insert_into_array( $target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true ) {
113
+	public static function insert_into_array($target_array = array(), $array_to_insert = array(), $offset = null, $add_before = true, $preserve_keys = true) {
114 114
 		// ensure incoming arrays are actually arrays
115
-		$target_array 		= (array)$target_array;
116
-		$array_to_insert	= (array)$array_to_insert;
115
+		$target_array = (array) $target_array;
116
+		$array_to_insert = (array) $array_to_insert;
117 117
 		// if no offset key was supplied
118
-		if ( empty( $offset )) {
118
+		if (empty($offset)) {
119 119
 			// use start or end of $target_array based on whether we are adding before or not
120
-			$offset = $add_before ? 0 : count( $target_array );
120
+			$offset = $add_before ? 0 : count($target_array);
121 121
 		}
122 122
 		// if offset key is a string, then find the corresponding numeric location for that element
123
-		$offset = is_int( $offset ) ? $offset : array_search( $offset, array_keys( $target_array ) );
123
+		$offset = is_int($offset) ? $offset : array_search($offset, array_keys($target_array));
124 124
 		// add one to the offset if adding after
125 125
 		$offset = $add_before ? $offset : $offset + 1;
126 126
 		// but ensure offset does not exceed the length of the array
127
-		$offset = $offset > count( $target_array ) ? count( $target_array ) : $offset;
127
+		$offset = $offset > count($target_array) ? count($target_array) : $offset;
128 128
 		// reindex array ???
129
-		if ( $preserve_keys ) {
129
+		if ($preserve_keys) {
130 130
 			// take a slice of the target array from the beginning till the offset,
131 131
 			// then add the new data
132 132
 			// then add another slice that starts at the offset and goes till the end
133
-			return array_slice( $target_array, 0, $offset, true ) + $array_to_insert + array_slice( $target_array, $offset, null, true );
133
+			return array_slice($target_array, 0, $offset, true) + $array_to_insert + array_slice($target_array, $offset, null, true);
134 134
 		} else {
135 135
 			// since we don't want to preserve keys, we can use array_splice
136
-			array_splice( $target_array, $offset, 0, $array_to_insert );
136
+			array_splice($target_array, $offset, 0, $array_to_insert);
137 137
 			return $target_array;
138 138
 		}
139 139
 	}
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
 	 * @param array $array2
152 152
 	 * @return array
153 153
 	 */
154
-	public static function merge_arrays_and_overwrite_keys( array $array1, array $array2 ) {
155
-		foreach ( $array2 as $key => $value ) {
156
-			$array1[ $key ] = $value;
154
+	public static function merge_arrays_and_overwrite_keys(array $array1, array $array2) {
155
+		foreach ($array2 as $key => $value) {
156
+			$array1[$key] = $value;
157 157
 		}
158 158
 		return $array1;
159 159
 	}
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
 	 * @param mixed $final_value
172 172
 	 * @return array
173 173
 	 */
174
-	public static function convert_array_values_to_keys( array $flat_array, $final_value = null ) {
174
+	public static function convert_array_values_to_keys(array $flat_array, $final_value = null) {
175 175
 		$multidimensional = array();
176 176
 		$reference = &$multidimensional;
177
-		foreach ( $flat_array as $key ) {
178
-			$reference[ $key ] = array();
179
-			$reference = &$reference[ $key ];
177
+		foreach ($flat_array as $key) {
178
+			$reference[$key] = array();
179
+			$reference = &$reference[$key];
180 180
 		}
181
-		if ( $final_value !== null ) {
181
+		if ($final_value !== null) {
182 182
 			$reference = $final_value;
183 183
 		}
184 184
 		return $multidimensional;
Please login to merge, or discard this patch.
core/helpers/EEH_Activation.helper.php 2 patches
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
466 466
 		if($post_id){
467 467
 			return get_post($post_id);
468
-		}else{
468
+		} else{
469 469
 			return NULL;
470 470
 		}
471 471
 
@@ -838,13 +838,13 @@  discard block
 block discarded – undo
838 838
 					foreach( $current_data_migration_script->get_errors() as $error ){
839 839
 						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
840 840
 					}
841
-				}else{
841
+				} else{
842 842
 					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
843 843
 				}
844 844
 				return false;
845 845
 			}
846 846
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
847
-		}else{
847
+		} else{
848 848
 			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
849 849
 			return false;
850 850
 		}
@@ -1174,7 +1174,7 @@  discard block
 block discarded – undo
1174 1174
 		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1175 1175
 			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1176 1176
 			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1177
-		}else{
1177
+		} else{
1178 1178
 			EEM_Payment_Method::instance()->verify_button_urls();
1179 1179
 		}
1180 1180
 	}
@@ -1667,7 +1667,7 @@  discard block
 block discarded – undo
1667 1667
 				if( ! delete_option( $option_name ) ){
1668 1668
 					$undeleted_options[] = $option_name;
1669 1669
 				}
1670
-			}else{
1670
+			} else{
1671 1671
 				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1672 1672
 				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1673 1673
 					if( ! delete_option( $option_name_from_wildcard ) ){
Please login to merge, or discard this patch.
Spacing   +346 added lines, -346 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php use EventEspresso\core\interfaces\ResettableInterface;
2 2
 
3
-if ( ! defined( 'EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed');}
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {exit('No direct script access allowed'); }
4 4
 /**
5 5
  * EEH_Activation Helper
6 6
  *
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 	 * @param $table_name
51 51
 	 * @return string
52 52
 	 */
53
-	public static function ensure_table_name_has_prefix( $table_name ) {
53
+	public static function ensure_table_name_has_prefix($table_name) {
54 54
 		global $wpdb;
55
-		return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name;
55
+		return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name;
56 56
 	}
57 57
 
58 58
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return boolean success, whether the database and folders are setup properly
81 81
 	 * @throws \EE_Error
82 82
 	 */
83
-	public static function initialize_db_and_folders(){
83
+	public static function initialize_db_and_folders() {
84 84
 		$good_filesystem = EEH_Activation::create_upload_directories();
85 85
 		$good_db = EEH_Activation::create_database_tables();
86 86
 		return $good_filesystem && $good_db;
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 	 *
97 97
 	 * @throws \EE_Error
98 98
 	 */
99
-	public static function initialize_db_content(){
99
+	public static function initialize_db_content() {
100 100
 		//let's avoid doing all this logic repeatedly, especially when addons are requesting it
101
-		if( EEH_Activation::$_initialized_db_content_already_in_this_request ) {
101
+		if (EEH_Activation::$_initialized_db_content_already_in_this_request) {
102 102
 			return;
103 103
 		}
104 104
 		EEH_Activation::$_initialized_db_content_already_in_this_request = true;
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		EEH_Activation::remove_cron_tasks();
116 116
 		EEH_Activation::create_cron_tasks();
117 117
 		// remove all TXN locks since that is being done via extra meta now
118
-		delete_option( 'ee_locked_transactions' );
118
+		delete_option('ee_locked_transactions');
119 119
 		//also, check for CAF default db content
120
-		do_action( 'AHEE__EEH_Activation__initialize_db_content' );
120
+		do_action('AHEE__EEH_Activation__initialize_db_content');
121 121
 		//also: EEM_Gateways::load_all_gateways() outputs a lot of success messages
122 122
 		//which users really won't care about on initial activation
123 123
 		EE_Error::overwrite_success();
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	 * @return array
138 138
 	 * @throws \EE_Error
139 139
 	 */
140
-	public static function get_cron_tasks( $which_to_include ) {
140
+	public static function get_cron_tasks($which_to_include) {
141 141
 		$cron_tasks = apply_filters(
142 142
 			'FHEE__EEH_Activation__get_cron_tasks',
143 143
 			array(
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 				'AHEE__EE_Cron_Tasks__update_transaction_with_payment' => EEH_Activation::cron_task_no_longer_in_use, //there may have been a bug which prevented from these cron tasks from getting unscheduled, so we might want to remove these for a few updates
147 147
 			)
148 148
 		);
149
-		if ( $which_to_include === 'old' ) {
149
+		if ($which_to_include === 'old') {
150 150
 			$cron_tasks = array_filter(
151 151
 				$cron_tasks,
152
-				function ( $value ) {
152
+				function($value) {
153 153
 					return $value === EEH_Activation::cron_task_no_longer_in_use;
154 154
 				}
155 155
 			);
156
-		} elseif ( $which_to_include === 'current' ) {
157
-			$cron_tasks = array_filter( $cron_tasks );
158
-		} elseif ( WP_DEBUG && $which_to_include !== 'all' ) {
156
+		} elseif ($which_to_include === 'current') {
157
+			$cron_tasks = array_filter($cron_tasks);
158
+		} elseif (WP_DEBUG && $which_to_include !== 'all') {
159 159
 			throw new EE_Error(
160 160
 				sprintf(
161 161
 					__(
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 	 */
179 179
 	public static function create_cron_tasks() {
180 180
 
181
-		foreach( EEH_Activation::get_cron_tasks( 'current' ) as $hook_name => $frequency ) {
182
-			if( ! wp_next_scheduled( $hook_name ) ) {
183
-				wp_schedule_event( time(), $frequency, $hook_name );
181
+		foreach (EEH_Activation::get_cron_tasks('current') as $hook_name => $frequency) {
182
+			if ( ! wp_next_scheduled($hook_name)) {
183
+				wp_schedule_event(time(), $frequency, $hook_name);
184 184
 			}
185 185
 		}
186 186
 
@@ -194,10 +194,10 @@  discard block
 block discarded – undo
194 194
 	 * @param boolean $remove_all whether to only remove the old ones, or remove absolutely ALL the EE ones
195 195
 	 * @throws \EE_Error
196 196
 	 */
197
-	public static function remove_cron_tasks( $remove_all = true ) {
197
+	public static function remove_cron_tasks($remove_all = true) {
198 198
 		$cron_tasks_to_remove = $remove_all ? 'all' : 'old';
199 199
 		$crons = _get_cron_array();
200
-		$crons = is_array( $crons ) ? $crons : array();
200
+		$crons = is_array($crons) ? $crons : array();
201 201
 		/* reminder of what $crons look like:
202 202
 		 * Top-level keys are timestamps, and their values are arrays.
203 203
 		 * The 2nd level arrays have keys with each of the cron task hook names to run at that time
@@ -215,23 +215,23 @@  discard block
 block discarded – undo
215 215
 		 *					...
216 216
 		 *      ...
217 217
 		 */
218
-		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks( $cron_tasks_to_remove );
219
-		foreach ( $crons as $timestamp => $hooks_to_fire_at_time ) {
220
-			if ( is_array( $hooks_to_fire_at_time ) ) {
221
-				foreach ( $hooks_to_fire_at_time as $hook_name => $hook_actions ) {
222
-					if ( isset( $ee_cron_tasks_to_remove[ $hook_name ] )
223
-					     && is_array( $ee_cron_tasks_to_remove[ $hook_name ] )
218
+		$ee_cron_tasks_to_remove = EEH_Activation::get_cron_tasks($cron_tasks_to_remove);
219
+		foreach ($crons as $timestamp => $hooks_to_fire_at_time) {
220
+			if (is_array($hooks_to_fire_at_time)) {
221
+				foreach ($hooks_to_fire_at_time as $hook_name => $hook_actions) {
222
+					if (isset($ee_cron_tasks_to_remove[$hook_name])
223
+					     && is_array($ee_cron_tasks_to_remove[$hook_name])
224 224
 					) {
225
-						unset( $crons[ $timestamp ][ $hook_name ] );
225
+						unset($crons[$timestamp][$hook_name]);
226 226
 					}
227 227
 				}
228 228
 				//also take care of any empty cron timestamps.
229
-				if ( empty( $hooks_to_fire_at_time ) ) {
230
-					unset( $crons[ $timestamp ] );
229
+				if (empty($hooks_to_fire_at_time)) {
230
+					unset($crons[$timestamp]);
231 231
 				}
232 232
 			}
233 233
 		}
234
-		_set_cron_array( $crons );
234
+		_set_cron_array($crons);
235 235
 	}
236 236
 
237 237
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 	 */
247 247
 	public static function CPT_initialization() {
248 248
 		// register Custom Post Types
249
-		EE_Registry::instance()->load_core( 'Register_CPTs' );
249
+		EE_Registry::instance()->load_core('Register_CPTs');
250 250
 		flush_rewrite_rules();
251 251
 	}
252 252
 
@@ -264,8 +264,8 @@  discard block
 block discarded – undo
264 264
 	 * 	@return void
265 265
 	 */
266 266
 	public static function reset_and_update_config() {
267
-		do_action( 'AHEE__EE_Config___load_core_config__start', array( 'EEH_Activation', 'load_calendar_config' ) );
268
-		add_filter( 'FHEE__EE_Config___load_core_config__config_settings', array( 'EEH_Activation', 'migrate_old_config_data' ), 10, 3 );
267
+		do_action('AHEE__EE_Config___load_core_config__start', array('EEH_Activation', 'load_calendar_config'));
268
+		add_filter('FHEE__EE_Config___load_core_config__config_settings', array('EEH_Activation', 'migrate_old_config_data'), 10, 3);
269 269
 		//EE_Config::reset();
270 270
 	}
271 271
 
@@ -278,28 +278,28 @@  discard block
 block discarded – undo
278 278
 	 */
279 279
 	public static function load_calendar_config() {
280 280
 		// grab array of all plugin folders and loop thru it
281
-		$plugins = glob( WP_PLUGIN_DIR . DS . '*', GLOB_ONLYDIR );
282
-		if ( empty( $plugins ) ) {
281
+		$plugins = glob(WP_PLUGIN_DIR.DS.'*', GLOB_ONLYDIR);
282
+		if (empty($plugins)) {
283 283
 			return;
284 284
 		}
285
-		foreach ( $plugins as $plugin_path ) {
285
+		foreach ($plugins as $plugin_path) {
286 286
 			// grab plugin folder name from path
287
-			$plugin = basename( $plugin_path );
287
+			$plugin = basename($plugin_path);
288 288
 			// drill down to Espresso plugins
289 289
 			// then to calendar related plugins
290 290
 			if (
291
-				strpos( $plugin, 'espresso' ) !== FALSE
292
-				|| strpos( $plugin, 'Espresso' ) !== FALSE
293
-				|| strpos( $plugin, 'ee4' ) !== FALSE
294
-				|| strpos( $plugin, 'EE4' ) !== FALSE
295
-				|| strpos( $plugin, 'calendar' ) !== false
291
+				strpos($plugin, 'espresso') !== FALSE
292
+				|| strpos($plugin, 'Espresso') !== FALSE
293
+				|| strpos($plugin, 'ee4') !== FALSE
294
+				|| strpos($plugin, 'EE4') !== FALSE
295
+				|| strpos($plugin, 'calendar') !== false
296 296
 			) {
297 297
 				// this is what we are looking for
298
-				$calendar_config = $plugin_path . DS . 'EE_Calendar_Config.php';
298
+				$calendar_config = $plugin_path.DS.'EE_Calendar_Config.php';
299 299
 				// does it exist in this folder ?
300
-				if ( is_readable( $calendar_config )) {
300
+				if (is_readable($calendar_config)) {
301 301
 					// YEAH! let's load it
302
-					require_once( $calendar_config );
302
+					require_once($calendar_config);
303 303
 				}
304 304
 			}
305 305
 		}
@@ -315,21 +315,21 @@  discard block
 block discarded – undo
315 315
 	 * @param \EE_Config     $EE_Config
316 316
 	 * @return \stdClass
317 317
 	 */
318
-	public static function migrate_old_config_data( $settings = array(), $config = '', EE_Config $EE_Config ) {
319
-		$convert_from_array = array( 'addons' );
318
+	public static function migrate_old_config_data($settings = array(), $config = '', EE_Config $EE_Config) {
319
+		$convert_from_array = array('addons');
320 320
 		// in case old settings were saved as an array
321
-		if ( is_array( $settings ) && in_array( $config, $convert_from_array )) {
321
+		if (is_array($settings) && in_array($config, $convert_from_array)) {
322 322
 			// convert existing settings to an object
323 323
 			$config_array = $settings;
324 324
 			$settings = new stdClass();
325
-			foreach ( $config_array as $key => $value ){
326
-				if ( $key === 'calendar' && class_exists( 'EE_Calendar_Config' )) {
327
-					$EE_Config->set_config( 'addons', 'EE_Calendar', 'EE_Calendar_Config', $value );
325
+			foreach ($config_array as $key => $value) {
326
+				if ($key === 'calendar' && class_exists('EE_Calendar_Config')) {
327
+					$EE_Config->set_config('addons', 'EE_Calendar', 'EE_Calendar_Config', $value);
328 328
 				} else {
329 329
 					$settings->{$key} = $value;
330 330
 				}
331 331
 			}
332
-			add_filter( 'FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true' );
332
+			add_filter('FHEE__EE_Config___load_core_config__update_espresso_config', '__return_true');
333 333
 		}
334 334
 		return $settings;
335 335
 	}
@@ -345,8 +345,8 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public static function deactivate_event_espresso() {
347 347
 		// check permissions
348
-		if ( current_user_can( 'activate_plugins' )) {
349
-			deactivate_plugins( EE_PLUGIN_BASENAME, TRUE );
348
+		if (current_user_can('activate_plugins')) {
349
+			deactivate_plugins(EE_PLUGIN_BASENAME, TRUE);
350 350
 		}
351 351
 	}
352 352
 
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
 		$critical_pages = array(
369 369
 			array(
370 370
 				'id' =>'reg_page_id',
371
-				'name' => __( 'Registration Checkout', 'event_espresso' ),
371
+				'name' => __('Registration Checkout', 'event_espresso'),
372 372
 				'post' => NULL,
373 373
 				'code' => 'ESPRESSO_CHECKOUT'
374 374
 			),
375 375
 			array(
376 376
 				'id' => 'txn_page_id',
377
-				'name' => __( 'Transactions', 'event_espresso' ),
377
+				'name' => __('Transactions', 'event_espresso'),
378 378
 				'post' => NULL,
379 379
 				'code' => 'ESPRESSO_TXN_PAGE'
380 380
 			),
381 381
 			array(
382 382
 				'id' => 'thank_you_page_id',
383
-				'name' => __( 'Thank You', 'event_espresso' ),
383
+				'name' => __('Thank You', 'event_espresso'),
384 384
 				'post' => NULL,
385 385
 				'code' => 'ESPRESSO_THANK_YOU'
386 386
 			),
387 387
 			array(
388 388
 				'id' => 'cancel_page_id',
389
-				'name' => __( 'Registration Cancelled', 'event_espresso' ),
389
+				'name' => __('Registration Cancelled', 'event_espresso'),
390 390
 				'post' => NULL,
391 391
 				'code' => 'ESPRESSO_CANCELLED'
392 392
 			),
@@ -394,62 +394,62 @@  discard block
 block discarded – undo
394 394
 
395 395
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
396 396
 
397
-		foreach ( $critical_pages as $critical_page ) {
397
+		foreach ($critical_pages as $critical_page) {
398 398
 			// is critical page ID set in config ?
399
-			if ( $EE_Core_Config->{$critical_page[ 'id' ]} !== FALSE ) {
399
+			if ($EE_Core_Config->{$critical_page['id']} !== FALSE) {
400 400
 				// attempt to find post by ID
401
-				$critical_page['post'] = get_post( $EE_Core_Config->{$critical_page[ 'id' ]} );
401
+				$critical_page['post'] = get_post($EE_Core_Config->{$critical_page['id']} );
402 402
 			}
403 403
 			// no dice?
404
-			if ( $critical_page['post'] === null ) {
404
+			if ($critical_page['post'] === null) {
405 405
 				// attempt to find post by title
406
-				$critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] );
406
+				$critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']);
407 407
 				// still nothing?
408
-				if ( $critical_page['post'] === null ) {
409
-					$critical_page = EEH_Activation::create_critical_page( $critical_page );
408
+				if ($critical_page['post'] === null) {
409
+					$critical_page = EEH_Activation::create_critical_page($critical_page);
410 410
 					// REALLY? Still nothing ??!?!?
411
-					if ( $critical_page['post'] === null ) {
412
-						$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
413
-						EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
411
+					if ($critical_page['post'] === null) {
412
+						$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
413
+						EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
414 414
 						break;
415 415
 					}
416 416
 				}
417 417
 			}
418 418
 			// track post_shortcodes
419
-			if ( $critical_page['post'] ) {
420
-				EEH_Activation::_track_critical_page_post_shortcodes( $critical_page );
419
+			if ($critical_page['post']) {
420
+				EEH_Activation::_track_critical_page_post_shortcodes($critical_page);
421 421
 			}
422 422
 			// check that Post ID matches critical page ID in config
423 423
 			if (
424
-				isset( $critical_page['post']->ID )
425
-				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page[ 'id' ]}
424
+				isset($critical_page['post']->ID)
425
+				&& $critical_page['post']->ID !== $EE_Core_Config->{$critical_page['id']}
426 426
 			) {
427 427
 				//update Config with post ID
428
-				$EE_Core_Config->{$critical_page[ 'id' ]} = $critical_page['post']->ID;
429
-				if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) {
430
-					$msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' );
431
-					EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
428
+				$EE_Core_Config->{$critical_page['id']} = $critical_page['post']->ID;
429
+				if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
430
+					$msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso');
431
+					EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
432 432
 				}
433 433
 			}
434 434
 
435 435
 			$critical_page_problem =
436
-				! isset( $critical_page['post']->post_status )
436
+				! isset($critical_page['post']->post_status)
437 437
 				|| $critical_page['post']->post_status !== 'publish'
438
-				|| strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE
438
+				|| strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE
439 439
 					? TRUE
440 440
 					: $critical_page_problem;
441 441
 
442 442
 		}
443 443
 
444
-		if ( $critical_page_problem ) {
444
+		if ($critical_page_problem) {
445 445
 			$msg = sprintf(
446
-				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ),
447
-				'<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>'
446
+				__('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'),
447
+				'<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>'
448 448
 			);
449
-			EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg );
449
+			EE_Error::add_persistent_admin_notice('critical_page_problem', $msg);
450 450
 		}
451
-		if ( EE_Error::has_notices() ) {
452
-			EE_Error::get_notices( FALSE, TRUE, TRUE );
451
+		if (EE_Error::has_notices()) {
452
+			EE_Error::get_notices(FALSE, TRUE, TRUE);
453 453
 		}
454 454
 	}
455 455
 
@@ -461,13 +461,13 @@  discard block
 block discarded – undo
461 461
 	 * parameter to the shortcode
462 462
 	 * @return WP_Post or NULl
463 463
 	 */
464
-	public static function get_page_by_ee_shortcode($ee_shortcode){
464
+	public static function get_page_by_ee_shortcode($ee_shortcode) {
465 465
 		global $wpdb;
466 466
 		$shortcode_and_opening_bracket = '['.$ee_shortcode;
467 467
 		$post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1");
468
-		if($post_id){
468
+		if ($post_id) {
469 469
 			return get_post($post_id);
470
-		}else{
470
+		} else {
471 471
 			return NULL;
472 472
 		}
473 473
 
@@ -484,32 +484,32 @@  discard block
 block discarded – undo
484 484
 	 * @param array $critical_page
485 485
 	 * @return array
486 486
 	 */
487
-	public static function create_critical_page( $critical_page ) {
487
+	public static function create_critical_page($critical_page) {
488 488
 
489 489
 		$post_args = array(
490 490
 			'post_title' => $critical_page['name'],
491 491
 			'post_status' => 'publish',
492 492
 			'post_type' => 'page',
493 493
 			'comment_status' => 'closed',
494
-			'post_content' => '[' . $critical_page['code'] . ']'
494
+			'post_content' => '['.$critical_page['code'].']'
495 495
 		);
496 496
 
497
-		$post_id = wp_insert_post( $post_args );
498
-		if ( ! $post_id ) {
497
+		$post_id = wp_insert_post($post_args);
498
+		if ( ! $post_id) {
499 499
 			$msg = sprintf(
500
-				__( 'The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso' ),
500
+				__('The Event Espresso  critical page entitled "%s" could not be created.', 'event_espresso'),
501 501
 				$critical_page['name']
502 502
 			);
503
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
503
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
504 504
 			return $critical_page;
505 505
 		}
506 506
 		// get newly created post's details
507
-		if ( ! $critical_page['post'] = get_post( $post_id )) {
507
+		if ( ! $critical_page['post'] = get_post($post_id)) {
508 508
 			$msg = sprintf(
509
-				__( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ),
509
+				__('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'),
510 510
 				$critical_page['name']
511 511
 			);
512
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
512
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
513 513
 		}
514 514
 
515 515
 		return $critical_page;
@@ -528,35 +528,35 @@  discard block
 block discarded – undo
528 528
 	 * @param array $critical_page
529 529
 	 * @return void
530 530
 	 */
531
-	private static function _track_critical_page_post_shortcodes( $critical_page = array() ) {
531
+	private static function _track_critical_page_post_shortcodes($critical_page = array()) {
532 532
 		// check the goods
533
-		if ( ! $critical_page['post'] instanceof WP_Post ) {
533
+		if ( ! $critical_page['post'] instanceof WP_Post) {
534 534
 			$msg = sprintf(
535
-				__( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ),
535
+				__('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'),
536 536
 				$critical_page['name']
537 537
 			);
538
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
538
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
539 539
 			return;
540 540
 		}
541 541
 		$EE_Core_Config = EE_Registry::instance()->CFG->core;
542 542
 		// map shortcode to post
543
-		$EE_Core_Config->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID;
543
+		$EE_Core_Config->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID;
544 544
 		// and make sure it's NOT added to the WP "Posts Page"
545 545
 		// name of the WP Posts Page
546 546
 		$posts_page = EE_Config::get_page_for_posts();
547
-		if ( isset( $EE_Core_Config->post_shortcodes[ $posts_page ] )) {
548
-			unset( $EE_Core_Config->post_shortcodes[ $posts_page ][ $critical_page['code'] ] );
547
+		if (isset($EE_Core_Config->post_shortcodes[$posts_page])) {
548
+			unset($EE_Core_Config->post_shortcodes[$posts_page][$critical_page['code']]);
549 549
 		}
550
-		if ( $posts_page !== 'posts' && isset( $EE_Core_Config->post_shortcodes['posts'] )) {
551
-			unset( $EE_Core_Config->post_shortcodes['posts'][ $critical_page['code'] ] );
550
+		if ($posts_page !== 'posts' && isset($EE_Core_Config->post_shortcodes['posts'])) {
551
+			unset($EE_Core_Config->post_shortcodes['posts'][$critical_page['code']]);
552 552
 		}
553 553
 		// update post_shortcode CFG
554
-		if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) {
554
+		if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) {
555 555
 			$msg = sprintf(
556
-				__( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ),
556
+				__('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'),
557 557
 				$critical_page['name']
558 558
 			);
559
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
559
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
560 560
 		}
561 561
 	}
562 562
 
@@ -574,24 +574,24 @@  discard block
 block discarded – undo
574 574
 	public static function get_default_creator_id() {
575 575
 		global $wpdb;
576 576
 
577
-		if ( ! empty( self::$_default_creator_id ) ) {
577
+		if ( ! empty(self::$_default_creator_id)) {
578 578
 			return self::$_default_creator_id;
579 579
 		}/**/
580 580
 
581
-		$role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' );
581
+		$role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator');
582 582
 
583 583
 		//let's allow pre_filtering for early exits by alternative methods for getting id.  We check for truthy result and if so then exit early.
584
-		$pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check );
585
-		if ( $pre_filtered_id !== false ) {
584
+		$pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check);
585
+		if ($pre_filtered_id !== false) {
586 586
 			return (int) $pre_filtered_id;
587 587
 		}
588 588
 
589
-		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix( 'capabilities' );
590
-		$query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' );
591
-		$user_id = $wpdb->get_var( $query );
592
-		 $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id );
593
-		 if ( $user_id && (int)$user_id ) {
594
-		 	self::$_default_creator_id = (int)$user_id;
589
+		$capabilities_key = EEH_Activation::ensure_table_name_has_prefix('capabilities');
590
+		$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%');
591
+		$user_id = $wpdb->get_var($query);
592
+		 $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id);
593
+		 if ($user_id && (int) $user_id) {
594
+		 	self::$_default_creator_id = (int) $user_id;
595 595
 		 	return self::$_default_creator_id;
596 596
 		 } else {
597 597
 		 	return NULL;
@@ -618,29 +618,29 @@  discard block
 block discarded – undo
618 618
 	 * 	@return void
619 619
 	 * @throws EE_Error if there are database errors
620 620
 	 */
621
-	public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false ) {
622
-		if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){
621
+	public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_pre_existing_table = false) {
622
+		if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) {
623 623
 			return;
624 624
 		}
625
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
626
-		if ( ! function_exists( 'dbDelta' )) {
627
-			require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
625
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
626
+		if ( ! function_exists('dbDelta')) {
627
+			require_once(ABSPATH.'wp-admin/includes/upgrade.php');
628 628
 		}
629 629
 		/** @var WPDB $wpdb */
630 630
 		global $wpdb;
631
-		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
631
+		$wp_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
632 632
 		// do we need to first delete an existing version of this table ?
633
-		if ( $drop_pre_existing_table && EEH_Activation::table_exists( $wp_table_name ) ){
633
+		if ($drop_pre_existing_table && EEH_Activation::table_exists($wp_table_name)) {
634 634
 			// ok, delete the table... but ONLY if it's empty
635
-			$deleted_safely = EEH_Activation::delete_db_table_if_empty( $wp_table_name );
635
+			$deleted_safely = EEH_Activation::delete_db_table_if_empty($wp_table_name);
636 636
 			// table is NOT empty, are you SURE you want to delete this table ???
637
-			if ( ! $deleted_safely && defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){
638
-				EEH_Activation::delete_unused_db_table( $wp_table_name );
639
-			} else if ( ! $deleted_safely ) {
637
+			if ( ! $deleted_safely && defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) {
638
+				EEH_Activation::delete_unused_db_table($wp_table_name);
639
+			} else if ( ! $deleted_safely) {
640 640
 				// so we should be more cautious rather than just dropping tables so easily
641 641
 				EE_Error::add_persistent_admin_notice(
642
-						'bad_table_' . $wp_table_name . '_detected',
643
-						sprintf( __( 'Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ),
642
+						'bad_table_'.$wp_table_name.'_detected',
643
+						sprintf(__('Database table %1$s exists when it shouldn\'t, and may contain erroneous data. If you have previously restored your database from a backup that didn\'t remove the old tables, then we recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'),
644 644
 								$wp_table_name,
645 645
 								"<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>",
646 646
 								'<b>wp-config.php</b>',
@@ -649,25 +649,25 @@  discard block
 block discarded – undo
649 649
 			}
650 650
 		}
651 651
 		// does $sql contain valid column information? ( LPT: https://regex101.com/ is great for working out regex patterns )
652
-		if ( preg_match( '((((.*?))(,\s))+)', $sql, $valid_column_data ) ) {
652
+		if (preg_match('((((.*?))(,\s))+)', $sql, $valid_column_data)) {
653 653
 			$SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;";
654 654
 			//get $wpdb to echo errors, but buffer them. This way at least WE know an error
655 655
 			//happened. And then we can choose to tell the end user
656
-			$old_show_errors_policy = $wpdb->show_errors( TRUE );
657
-			$old_error_suppression_policy = $wpdb->suppress_errors( FALSE );
656
+			$old_show_errors_policy = $wpdb->show_errors(TRUE);
657
+			$old_error_suppression_policy = $wpdb->suppress_errors(FALSE);
658 658
 			ob_start();
659
-			dbDelta( $SQL );
659
+			dbDelta($SQL);
660 660
 			$output = ob_get_contents();
661 661
 			ob_end_clean();
662
-			$wpdb->show_errors( $old_show_errors_policy );
663
-			$wpdb->suppress_errors( $old_error_suppression_policy );
664
-			if( ! empty( $output ) ){
665
-				throw new EE_Error( $output	);
662
+			$wpdb->show_errors($old_show_errors_policy);
663
+			$wpdb->suppress_errors($old_error_suppression_policy);
664
+			if ( ! empty($output)) {
665
+				throw new EE_Error($output);
666 666
 			}
667 667
 		} else {
668 668
 			throw new EE_Error(
669 669
 				sprintf(
670
-					__( 'The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso' ),
670
+					__('The following table creation SQL does not contain valid information about the table columns: %1$s %2$s', 'event_espresso'),
671 671
 					'<br />',
672 672
 					$sql
673 673
 				)
@@ -690,15 +690,15 @@  discard block
 block discarded – undo
690 690
 	 *                            'VARCHAR(10)'
691 691
 	 * @return bool|int
692 692
 	 */
693
-	public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){
694
-		if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){
693
+	public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') {
694
+		if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) {
695 695
 			return FALSE;
696 696
 		}
697 697
 		global $wpdb;
698
-		$full_table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
698
+		$full_table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
699 699
 		$fields = self::get_fields_on_table($table_name);
700
-		if (!in_array($column_name, $fields)){
701
-			$alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info";
700
+		if ( ! in_array($column_name, $fields)) {
701
+			$alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info";
702 702
 			//echo "alter query:$alter_query";
703 703
 			return $wpdb->query($alter_query);
704 704
 		}
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
 	 * 	@param string $table_name, without prefixed $wpdb->prefix
718 718
 	 * 	@return array of database column names
719 719
 	 */
720
-	public static function get_fields_on_table( $table_name = NULL ) {
720
+	public static function get_fields_on_table($table_name = NULL) {
721 721
 		global $wpdb;
722
-		$table_name= EEH_Activation::ensure_table_name_has_prefix( $table_name );
723
-		if ( ! empty( $table_name )) {
722
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
723
+		if ( ! empty($table_name)) {
724 724
 			$columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name ");
725 725
 			if ($columns !== FALSE) {
726 726
 				$field_array = array();
727
-				foreach($columns as $column ){
727
+				foreach ($columns as $column) {
728 728
 					$field_array[] = $column->Field;
729 729
 				}
730 730
 				return $field_array;
@@ -743,12 +743,12 @@  discard block
 block discarded – undo
743 743
 	 * @param string $table_name
744 744
 	 * @return bool
745 745
 	 */
746
-	public static function db_table_is_empty( $table_name ) {
746
+	public static function db_table_is_empty($table_name) {
747 747
 		global $wpdb;
748
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
749
-		if ( EEH_Activation::table_exists( $table_name ) ) {
750
-			$count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" );
751
-			return absint( $count ) === 0 ? true : false;
748
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
749
+		if (EEH_Activation::table_exists($table_name)) {
750
+			$count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name");
751
+			return absint($count) === 0 ? true : false;
752 752
 		}
753 753
 		return false;
754 754
 	}
@@ -763,9 +763,9 @@  discard block
 block discarded – undo
763 763
 	 * @param string $table_name
764 764
 	 * @return bool | int
765 765
 	 */
766
-	public static function delete_db_table_if_empty( $table_name ) {
767
-		if ( EEH_Activation::db_table_is_empty( $table_name ) ) {
768
-			return EEH_Activation::delete_unused_db_table( $table_name );
766
+	public static function delete_db_table_if_empty($table_name) {
767
+		if (EEH_Activation::db_table_is_empty($table_name)) {
768
+			return EEH_Activation::delete_unused_db_table($table_name);
769 769
 		}
770 770
 		return false;
771 771
 	}
@@ -780,11 +780,11 @@  discard block
 block discarded – undo
780 780
 	 * @param string $table_name
781 781
 	 * @return bool | int
782 782
 	 */
783
-	public static function delete_unused_db_table( $table_name ) {
783
+	public static function delete_unused_db_table($table_name) {
784 784
 		global $wpdb;
785
-		if ( EEH_Activation::table_exists( $table_name ) ) {
786
-			$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
787
-			return $wpdb->query( "DROP TABLE IF EXISTS $table_name" );
785
+		if (EEH_Activation::table_exists($table_name)) {
786
+			$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
787
+			return $wpdb->query("DROP TABLE IF EXISTS $table_name");
788 788
 		}
789 789
 		return false;
790 790
 	}
@@ -800,18 +800,18 @@  discard block
 block discarded – undo
800 800
 	 * @param string $index_name
801 801
 	 * @return bool | int
802 802
 	 */
803
-	public static function drop_index( $table_name, $index_name ) {
804
-		if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){
803
+	public static function drop_index($table_name, $index_name) {
804
+		if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) {
805 805
 			return FALSE;
806 806
 		}
807 807
 		global $wpdb;
808
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
808
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
809 809
 		$index_exists_query = "SHOW INDEX FROM $table_name WHERE Key_name = '$index_name'";
810 810
 		if (
811
-			EEH_Activation::table_exists(  $table_name )
812
-			&& $wpdb->get_var( $index_exists_query ) === $table_name //using get_var with the $index_exists_query returns the table's name
811
+			EEH_Activation::table_exists($table_name)
812
+			&& $wpdb->get_var($index_exists_query) === $table_name //using get_var with the $index_exists_query returns the table's name
813 813
 		) {
814
-			return $wpdb->query( "ALTER TABLE $table_name DROP INDEX $index_name" );
814
+			return $wpdb->query("ALTER TABLE $table_name DROP INDEX $index_name");
815 815
 		}
816 816
 		return TRUE;
817 817
 	}
@@ -827,27 +827,27 @@  discard block
 block discarded – undo
827 827
 	 * @return boolean success (whether database is setup properly or not)
828 828
 	 */
829 829
 	public static function create_database_tables() {
830
-		EE_Registry::instance()->load_core( 'Data_Migration_Manager' );
830
+		EE_Registry::instance()->load_core('Data_Migration_Manager');
831 831
 		//find the migration script that sets the database to be compatible with the code
832 832
 		$dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms();
833
-		if( $dms_name ){
834
-			$current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name );
835
-			$current_data_migration_script->set_migrating( false );
833
+		if ($dms_name) {
834
+			$current_data_migration_script = EE_Registry::instance()->load_dms($dms_name);
835
+			$current_data_migration_script->set_migrating(false);
836 836
 			$current_data_migration_script->schema_changes_before_migration();
837 837
 			$current_data_migration_script->schema_changes_after_migration();
838
-			if( $current_data_migration_script->get_errors() ){
839
-				if( WP_DEBUG ){
840
-					foreach( $current_data_migration_script->get_errors() as $error ){
841
-						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ );
838
+			if ($current_data_migration_script->get_errors()) {
839
+				if (WP_DEBUG) {
840
+					foreach ($current_data_migration_script->get_errors() as $error) {
841
+						EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__);
842 842
 					}
843
-				}else{
844
-					EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) );
843
+				} else {
844
+					EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso'));
845 845
 				}
846 846
 				return false;
847 847
 			}
848 848
 			EE_Data_Migration_Manager::instance()->update_current_database_state_to();
849
-		}else{
850
-			EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__);
849
+		} else {
850
+			EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
851 851
 			return false;
852 852
 		}
853 853
 		return true;
@@ -867,27 +867,27 @@  discard block
 block discarded – undo
867 867
 	public static function initialize_system_questions() {
868 868
 		// QUESTION GROUPS
869 869
 		global $wpdb;
870
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group' );
870
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question_group');
871 871
 		$SQL = "SELECT QSG_system FROM $table_name WHERE QSG_system != 0";
872 872
 		// what we have
873
-		$question_groups = $wpdb->get_col( $SQL );
873
+		$question_groups = $wpdb->get_col($SQL);
874 874
 		// check the response
875
-		$question_groups = is_array( $question_groups ) ? $question_groups : array();
875
+		$question_groups = is_array($question_groups) ? $question_groups : array();
876 876
 		// what we should have
877
-		$QSG_systems = array( 1, 2 );
877
+		$QSG_systems = array(1, 2);
878 878
 		// loop thru what we should have and compare to what we have
879
-		foreach ( $QSG_systems as $QSG_system ) {
879
+		foreach ($QSG_systems as $QSG_system) {
880 880
 			// reset values array
881 881
 			$QSG_values = array();
882 882
 			// if we don't have what we should have (but use $QST_system as as string because that's what we got from the db)
883
-			if ( ! in_array( "$QSG_system", $question_groups )) {
883
+			if ( ! in_array("$QSG_system", $question_groups)) {
884 884
 				// add it
885
-				switch ( $QSG_system ) {
885
+				switch ($QSG_system) {
886 886
 
887 887
 					case 1:
888 888
 							$QSG_values = array(
889
-									'QSG_name' => __( 'Personal Information', 'event_espresso' ),
890
-									'QSG_identifier' => 'personal-information-' . time(),
889
+									'QSG_name' => __('Personal Information', 'event_espresso'),
890
+									'QSG_identifier' => 'personal-information-'.time(),
891 891
 									'QSG_desc' => '',
892 892
 									'QSG_order' => 1,
893 893
 									'QSG_show_group_name' => 1,
@@ -899,8 +899,8 @@  discard block
 block discarded – undo
899 899
 
900 900
 					case 2:
901 901
 							$QSG_values = array(
902
-									'QSG_name' => __( 'Address Information','event_espresso' ),
903
-									'QSG_identifier' => 'address-information-' . time(),
902
+									'QSG_name' => __('Address Information', 'event_espresso'),
903
+									'QSG_identifier' => 'address-information-'.time(),
904 904
 									'QSG_desc' => '',
905 905
 									'QSG_order' => 2,
906 906
 									'QSG_show_group_name' => 1,
@@ -912,14 +912,14 @@  discard block
 block discarded – undo
912 912
 
913 913
 				}
914 914
 				// make sure we have some values before inserting them
915
-				if ( ! empty( $QSG_values )) {
915
+				if ( ! empty($QSG_values)) {
916 916
 					// insert system question
917 917
 					$wpdb->insert(
918 918
 						$table_name,
919 919
 						$QSG_values,
920
-						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' )
920
+						array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d')
921 921
 					);
922
-					$QSG_IDs[ $QSG_system ] = $wpdb->insert_id;
922
+					$QSG_IDs[$QSG_system] = $wpdb->insert_id;
923 923
 				}
924 924
 			}
925 925
 		}
@@ -928,10 +928,10 @@  discard block
 block discarded – undo
928 928
 
929 929
 		// QUESTIONS
930 930
 		global $wpdb;
931
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( 'esp_question' );
931
+		$table_name = EEH_Activation::ensure_table_name_has_prefix('esp_question');
932 932
 		$SQL = "SELECT QST_system FROM $table_name WHERE QST_system != ''";
933 933
 		// what we have
934
-		$questions = $wpdb->get_col( $SQL );
934
+		$questions = $wpdb->get_col($SQL);
935 935
 		// what we should have
936 936
 		$QST_systems = array(
937 937
 			'fname',
@@ -948,25 +948,25 @@  discard block
 block discarded – undo
948 948
 		$order_for_group_1 = 1;
949 949
 		$order_for_group_2 = 1;
950 950
 		// loop thru what we should have and compare to what we have
951
-		foreach ( $QST_systems as $QST_system ) {
951
+		foreach ($QST_systems as $QST_system) {
952 952
 			// reset values array
953 953
 			$QST_values = array();
954 954
 			// if we don't have what we should have
955
-			if ( ! in_array( $QST_system, $questions )) {
955
+			if ( ! in_array($QST_system, $questions)) {
956 956
 				// add it
957
-				switch ( $QST_system ) {
957
+				switch ($QST_system) {
958 958
 
959 959
 					case 'fname':
960 960
 							$QST_values = array(
961
-									'QST_display_text' => __( 'First Name', 'event_espresso' ),
962
-									'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ),
961
+									'QST_display_text' => __('First Name', 'event_espresso'),
962
+									'QST_admin_label' => __('First Name - System Question', 'event_espresso'),
963 963
 									'QST_system' => 'fname',
964 964
 									'QST_type' => 'TEXT',
965 965
 									'QST_required' => 1,
966
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
966
+									'QST_required_text' => __('This field is required', 'event_espresso'),
967 967
 									'QST_order' => 1,
968 968
 									'QST_admin_only' => 0,
969
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
969
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
970 970
 									'QST_wp_user' => self::get_default_creator_id(),
971 971
 									'QST_deleted' => 0
972 972
 								);
@@ -974,15 +974,15 @@  discard block
 block discarded – undo
974 974
 
975 975
 					case 'lname':
976 976
 							$QST_values = array(
977
-									'QST_display_text' => __( 'Last Name', 'event_espresso' ),
978
-									'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ),
977
+									'QST_display_text' => __('Last Name', 'event_espresso'),
978
+									'QST_admin_label' => __('Last Name - System Question', 'event_espresso'),
979 979
 									'QST_system' => 'lname',
980 980
 									'QST_type' => 'TEXT',
981 981
 									'QST_required' => 1,
982
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
982
+									'QST_required_text' => __('This field is required', 'event_espresso'),
983 983
 									'QST_order' => 2,
984 984
 									'QST_admin_only' => 0,
985
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
985
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
986 986
 									'QST_wp_user' => self::get_default_creator_id(),
987 987
 									'QST_deleted' => 0
988 988
 								);
@@ -990,15 +990,15 @@  discard block
 block discarded – undo
990 990
 
991 991
 					case 'email':
992 992
 							$QST_values = array(
993
-									'QST_display_text' => __( 'Email Address', 'event_espresso' ),
994
-									'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ),
993
+									'QST_display_text' => __('Email Address', 'event_espresso'),
994
+									'QST_admin_label' => __('Email Address - System Question', 'event_espresso'),
995 995
 									'QST_system' => 'email',
996 996
 									'QST_type' => 'EMAIL',
997 997
 									'QST_required' => 1,
998
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
998
+									'QST_required_text' => __('This field is required', 'event_espresso'),
999 999
 									'QST_order' => 3,
1000 1000
 									'QST_admin_only' => 0,
1001
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1001
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1002 1002
 									'QST_wp_user' => self::get_default_creator_id(),
1003 1003
 									'QST_deleted' => 0
1004 1004
 								);
@@ -1006,15 +1006,15 @@  discard block
 block discarded – undo
1006 1006
 
1007 1007
 					case 'address':
1008 1008
 							$QST_values = array(
1009
-									'QST_display_text' => __( 'Address', 'event_espresso' ),
1010
-									'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ),
1009
+									'QST_display_text' => __('Address', 'event_espresso'),
1010
+									'QST_admin_label' => __('Address - System Question', 'event_espresso'),
1011 1011
 									'QST_system' => 'address',
1012 1012
 									'QST_type' => 'TEXT',
1013 1013
 									'QST_required' => 0,
1014
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1014
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1015 1015
 									'QST_order' => 4,
1016 1016
 									'QST_admin_only' => 0,
1017
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1017
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1018 1018
 									'QST_wp_user' => self::get_default_creator_id(),
1019 1019
 									'QST_deleted' => 0
1020 1020
 								);
@@ -1022,15 +1022,15 @@  discard block
 block discarded – undo
1022 1022
 
1023 1023
 					case 'address2':
1024 1024
 							$QST_values = array(
1025
-									'QST_display_text' => __( 'Address2', 'event_espresso' ),
1026
-									'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ),
1025
+									'QST_display_text' => __('Address2', 'event_espresso'),
1026
+									'QST_admin_label' => __('Address2 - System Question', 'event_espresso'),
1027 1027
 									'QST_system' => 'address2',
1028 1028
 									'QST_type' => 'TEXT',
1029 1029
 									'QST_required' => 0,
1030
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1030
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1031 1031
 									'QST_order' => 5,
1032 1032
 									'QST_admin_only' => 0,
1033
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1033
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1034 1034
 									'QST_wp_user' => self::get_default_creator_id(),
1035 1035
 									'QST_deleted' => 0
1036 1036
 								);
@@ -1038,15 +1038,15 @@  discard block
 block discarded – undo
1038 1038
 
1039 1039
 					case 'city':
1040 1040
 							$QST_values = array(
1041
-									'QST_display_text' => __( 'City', 'event_espresso' ),
1042
-									'QST_admin_label' => __( 'City - System Question', 'event_espresso' ),
1041
+									'QST_display_text' => __('City', 'event_espresso'),
1042
+									'QST_admin_label' => __('City - System Question', 'event_espresso'),
1043 1043
 									'QST_system' => 'city',
1044 1044
 									'QST_type' => 'TEXT',
1045 1045
 									'QST_required' => 0,
1046
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1046
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1047 1047
 									'QST_order' => 6,
1048 1048
 									'QST_admin_only' => 0,
1049
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1049
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1050 1050
 									'QST_wp_user' => self::get_default_creator_id(),
1051 1051
 									'QST_deleted' => 0
1052 1052
 								);
@@ -1054,12 +1054,12 @@  discard block
 block discarded – undo
1054 1054
 
1055 1055
 					case 'state':
1056 1056
 							$QST_values = array(
1057
-									'QST_display_text' => __( 'State/Province', 'event_espresso' ),
1058
-									'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ),
1057
+									'QST_display_text' => __('State/Province', 'event_espresso'),
1058
+									'QST_admin_label' => __('State/Province - System Question', 'event_espresso'),
1059 1059
 									'QST_system' => 'state',
1060 1060
 									'QST_type' => 'STATE',
1061 1061
 									'QST_required' => 0,
1062
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1062
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1063 1063
 									'QST_order' => 7,
1064 1064
 									'QST_admin_only' => 0,
1065 1065
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1069,12 +1069,12 @@  discard block
 block discarded – undo
1069 1069
 
1070 1070
 					case 'country' :
1071 1071
 							$QST_values = array(
1072
-									'QST_display_text' => __( 'Country', 'event_espresso' ),
1073
-									'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ),
1072
+									'QST_display_text' => __('Country', 'event_espresso'),
1073
+									'QST_admin_label' => __('Country - System Question', 'event_espresso'),
1074 1074
 									'QST_system' => 'country',
1075 1075
 									'QST_type' => 'COUNTRY',
1076 1076
 									'QST_required' => 0,
1077
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1077
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1078 1078
 									'QST_order' => 8,
1079 1079
 									'QST_admin_only' => 0,
1080 1080
 									'QST_wp_user' => self::get_default_creator_id(),
@@ -1084,15 +1084,15 @@  discard block
 block discarded – undo
1084 1084
 
1085 1085
 					case 'zip':
1086 1086
 							$QST_values = array(
1087
-									'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ),
1088
-									'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ),
1087
+									'QST_display_text' => __('Zip/Postal Code', 'event_espresso'),
1088
+									'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'),
1089 1089
 									'QST_system' => 'zip',
1090 1090
 									'QST_type' => 'TEXT',
1091 1091
 									'QST_required' => 0,
1092
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1092
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1093 1093
 									'QST_order' => 9,
1094 1094
 									'QST_admin_only' => 0,
1095
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1095
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1096 1096
 									'QST_wp_user' => self::get_default_creator_id(),
1097 1097
 									'QST_deleted' => 0
1098 1098
 								);
@@ -1100,49 +1100,49 @@  discard block
 block discarded – undo
1100 1100
 
1101 1101
 					case 'phone':
1102 1102
 							$QST_values = array(
1103
-									'QST_display_text' => __( 'Phone Number', 'event_espresso' ),
1104
-									'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ),
1103
+									'QST_display_text' => __('Phone Number', 'event_espresso'),
1104
+									'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'),
1105 1105
 									'QST_system' => 'phone',
1106 1106
 									'QST_type' => 'TEXT',
1107 1107
 									'QST_required' => 0,
1108
-									'QST_required_text' => __( 'This field is required', 'event_espresso' ),
1108
+									'QST_required_text' => __('This field is required', 'event_espresso'),
1109 1109
 									'QST_order' => 10,
1110 1110
 									'QST_admin_only' => 0,
1111
-									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question( $QST_system ),
1111
+									'QST_max' => EEM_Question::instance()->absolute_max_for_system_question($QST_system),
1112 1112
 									'QST_wp_user' => self::get_default_creator_id(),
1113 1113
 									'QST_deleted' => 0
1114 1114
 								);
1115 1115
 						break;
1116 1116
 
1117 1117
 				}
1118
-				if ( ! empty( $QST_values )) {
1118
+				if ( ! empty($QST_values)) {
1119 1119
 					// insert system question
1120 1120
 					$wpdb->insert(
1121 1121
 						$table_name,
1122 1122
 						$QST_values,
1123
-						array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' )
1123
+						array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d')
1124 1124
 					);
1125 1125
 					$QST_ID = $wpdb->insert_id;
1126 1126
 
1127 1127
 					// QUESTION GROUP QUESTIONS
1128
-					if(  in_array( $QST_system, array( 'fname', 'lname', 'email' ) ) ) {
1128
+					if (in_array($QST_system, array('fname', 'lname', 'email'))) {
1129 1129
 						$system_question_we_want = EEM_Question_Group::system_personal;
1130 1130
 					} else {
1131 1131
 						$system_question_we_want = EEM_Question_Group::system_address;
1132 1132
 					}
1133
-					if( isset( $QSG_IDs[ $system_question_we_want ] ) ) {
1134
-						$QSG_ID = $QSG_IDs[ $system_question_we_want ];
1133
+					if (isset($QSG_IDs[$system_question_we_want])) {
1134
+						$QSG_ID = $QSG_IDs[$system_question_we_want];
1135 1135
 					} else {
1136
-						$id_col = EEM_Question_Group::instance()->get_col( array( array( 'QSG_system' => $system_question_we_want ) ) );
1137
-						if( is_array( $id_col ) ) {
1138
-							$QSG_ID = reset( $id_col );
1136
+						$id_col = EEM_Question_Group::instance()->get_col(array(array('QSG_system' => $system_question_we_want)));
1137
+						if (is_array($id_col)) {
1138
+							$QSG_ID = reset($id_col);
1139 1139
 						} else {
1140 1140
 							//ok so we didn't find it in the db either?? that's weird because we should have inserted it at the start of this method
1141 1141
                                                         EE_Log::instance()->log(
1142 1142
                                                                 __FILE__,
1143 1143
                                                                 __FUNCTION__,
1144 1144
                                                                 sprintf(
1145
-                                                                        __( 'Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1145
+                                                                        __('Could not associate question %1$s to a question group because no system question group existed', 'event_espresso'),
1146 1146
                                                                         $QST_ID ),
1147 1147
                                                                 'error' );
1148 1148
                                                         continue;
@@ -1151,12 +1151,12 @@  discard block
 block discarded – undo
1151 1151
 
1152 1152
 					// add system questions to groups
1153 1153
 					$wpdb->insert(
1154
-						EEH_Activation::ensure_table_name_has_prefix( 'esp_question_group_question' ),
1155
-						array( 'QSG_ID'    => $QSG_ID,
1154
+						EEH_Activation::ensure_table_name_has_prefix('esp_question_group_question'),
1155
+						array('QSG_ID'    => $QSG_ID,
1156 1156
 						       'QST_ID'    => $QST_ID,
1157
-						       'QGQ_order' => ( $QSG_ID === 1 ) ? $order_for_group_1++ : $order_for_group_2++
1157
+						       'QGQ_order' => ($QSG_ID === 1) ? $order_for_group_1++ : $order_for_group_2++
1158 1158
 						),
1159
-						array( '%d', '%d', '%d' )
1159
+						array('%d', '%d', '%d')
1160 1160
 					);
1161 1161
 				}
1162 1162
 			}
@@ -1172,11 +1172,11 @@  discard block
 block discarded – undo
1172 1172
 	 *
1173 1173
 	 * @throws \EE_Error
1174 1174
 	 */
1175
-	public static function insert_default_payment_methods(){
1176
-		if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){
1177
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
1178
-			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' );
1179
-		}else{
1175
+	public static function insert_default_payment_methods() {
1176
+		if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) {
1177
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
1178
+			EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice');
1179
+		} else {
1180 1180
 			EEM_Payment_Method::instance()->verify_button_urls();
1181 1181
 		}
1182 1182
 	}
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
 		global $wpdb;
1194 1194
 
1195
-		if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) {
1195
+		if (EEH_Activation::table_exists(EEM_Status::instance()->table())) {
1196 1196
 
1197 1197
 			$table_name = EEM_Status::instance()->table();
1198 1198
 
@@ -1268,33 +1268,33 @@  discard block
 block discarded – undo
1268 1268
 		$folders = array(
1269 1269
 				EVENT_ESPRESSO_TEMPLATE_DIR,
1270 1270
 				EVENT_ESPRESSO_GATEWAY_DIR,
1271
-				EVENT_ESPRESSO_UPLOAD_DIR . 'logs/',
1272
-				EVENT_ESPRESSO_UPLOAD_DIR . 'css/',
1273
-				EVENT_ESPRESSO_UPLOAD_DIR . 'tickets/'
1271
+				EVENT_ESPRESSO_UPLOAD_DIR.'logs/',
1272
+				EVENT_ESPRESSO_UPLOAD_DIR.'css/',
1273
+				EVENT_ESPRESSO_UPLOAD_DIR.'tickets/'
1274 1274
 		);
1275
-		foreach ( $folders as $folder ) {
1275
+		foreach ($folders as $folder) {
1276 1276
 			try {
1277
-				EEH_File::ensure_folder_exists_and_is_writable( $folder );
1278
-				@ chmod( $folder, 0755 );
1279
-			} catch( EE_Error $e ){
1277
+				EEH_File::ensure_folder_exists_and_is_writable($folder);
1278
+				@ chmod($folder, 0755);
1279
+			} catch (EE_Error $e) {
1280 1280
 				EE_Error::add_error(
1281 1281
 					sprintf(
1282
-						__(  'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ),
1282
+						__('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'),
1283 1283
 						$folder,
1284
-						'<br />' . $e->getMessage()
1284
+						'<br />'.$e->getMessage()
1285 1285
 					),
1286 1286
 					__FILE__, __FUNCTION__, __LINE__
1287 1287
 				);
1288 1288
 				//indicate we'll need to fix this later
1289
-				update_option( EEH_Activation::upload_directories_incomplete_option_name, true );
1289
+				update_option(EEH_Activation::upload_directories_incomplete_option_name, true);
1290 1290
 				return FALSE;
1291 1291
 			}
1292 1292
 		}
1293 1293
 		//just add the .htaccess file to the logs directory to begin with. Even if logging
1294 1294
 		//is disabled, there might be activation errors recorded in there
1295
-		EEH_File::add_htaccess_deny_from_all( EVENT_ESPRESSO_UPLOAD_DIR . 'logs/' );
1295
+		EEH_File::add_htaccess_deny_from_all(EVENT_ESPRESSO_UPLOAD_DIR.'logs/');
1296 1296
 		//remember EE's folders are all good
1297
-		delete_option( EEH_Activation::upload_directories_incomplete_option_name );
1297
+		delete_option(EEH_Activation::upload_directories_incomplete_option_name);
1298 1298
 		return TRUE;
1299 1299
 	}
1300 1300
 
@@ -1307,7 +1307,7 @@  discard block
 block discarded – undo
1307 1307
 	 * @return boolean
1308 1308
 	 */
1309 1309
 	public static function upload_directories_incomplete() {
1310
-		return get_option( EEH_Activation::upload_directories_incomplete_option_name, false );
1310
+		return get_option(EEH_Activation::upload_directories_incomplete_option_name, false);
1311 1311
 	}
1312 1312
 
1313 1313
 
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
 	 */
1325 1325
 	public static function generate_default_message_templates() {
1326 1326
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1327
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1327
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1328 1328
 		/*
1329 1329
 		 * This first method is taking care of ensuring any default messengers
1330 1330
 		 * that should be made active and have templates generated are done.
@@ -1360,22 +1360,22 @@  discard block
 block discarded – undo
1360 1360
 		$active_messengers = $message_resource_manager->active_messengers();
1361 1361
 		$installed_message_types = $message_resource_manager->installed_message_types();
1362 1362
 		$templates_created = false;
1363
-		foreach ( $active_messengers as $active_messenger ) {
1363
+		foreach ($active_messengers as $active_messenger) {
1364 1364
 			$default_message_type_names_for_messenger = $active_messenger->get_default_message_types();
1365 1365
 			$default_message_type_names_to_activate = array();
1366 1366
 			// looping through each default message type reported by the messenger
1367 1367
 			// and setup the actual message types to activate.
1368
-			foreach ( $default_message_type_names_for_messenger as $default_message_type_name_for_messenger ) {
1368
+			foreach ($default_message_type_names_for_messenger as $default_message_type_name_for_messenger) {
1369 1369
 				// if already active or has already been activated before we skip
1370 1370
 				// (otherwise we might reactivate something user's intentionally deactivated.)
1371 1371
 				// we also skip if the message type is not installed.
1372 1372
 				if (
1373
-					$message_resource_manager->has_message_type_been_activated_for_messenger( $default_message_type_name_for_messenger, $active_messenger->name )
1373
+					$message_resource_manager->has_message_type_been_activated_for_messenger($default_message_type_name_for_messenger, $active_messenger->name)
1374 1374
 					|| $message_resource_manager->is_message_type_active_for_messenger(
1375 1375
 						$active_messenger->name,
1376 1376
 						$default_message_type_name_for_messenger
1377 1377
 					)
1378
-					|| ! isset( $installed_message_types[ $default_message_type_name_for_messenger ] )
1378
+					|| ! isset($installed_message_types[$default_message_type_name_for_messenger])
1379 1379
 				) {
1380 1380
 					continue;
1381 1381
 				}
@@ -1388,7 +1388,7 @@  discard block
 block discarded – undo
1388 1388
 				false
1389 1389
 			);
1390 1390
 			//activate the templates for these message types
1391
-			if ( ! empty( $default_message_type_names_to_activate ) ) {
1391
+			if ( ! empty($default_message_type_names_to_activate)) {
1392 1392
 				$templates_created = EEH_MSG_Template::generate_new_templates(
1393 1393
 					$active_messenger->name,
1394 1394
 					$default_message_type_names_for_messenger,
@@ -1415,18 +1415,18 @@  discard block
 block discarded – undo
1415 1415
 		EE_Message_Resource_Manager $message_resource_manager
1416 1416
 	) {
1417 1417
 		/** @type EE_messenger[] $messengers_to_generate */
1418
-		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation( $message_resource_manager );
1418
+		$messengers_to_generate = self::_get_default_messengers_to_generate_on_activation($message_resource_manager);
1419 1419
 		$installed_message_types = $message_resource_manager->installed_message_types();
1420 1420
 		$templates_generated = false;
1421
-		foreach ( $messengers_to_generate as $messenger_to_generate ) {
1421
+		foreach ($messengers_to_generate as $messenger_to_generate) {
1422 1422
 			$default_message_type_names_for_messenger = $messenger_to_generate->get_default_message_types();
1423 1423
 			//verify the default message types match an installed message type.
1424
-			foreach ( $default_message_type_names_for_messenger as $key => $name ) {
1424
+			foreach ($default_message_type_names_for_messenger as $key => $name) {
1425 1425
 				if (
1426
-					! isset( $installed_message_types[ $name ] )
1427
-					|| $message_resource_manager->has_message_type_been_activated_for_messenger( $name, $messenger_to_generate->name )
1426
+					! isset($installed_message_types[$name])
1427
+					|| $message_resource_manager->has_message_type_been_activated_for_messenger($name, $messenger_to_generate->name)
1428 1428
 				) {
1429
-					unset( $default_message_type_names_for_messenger[ $key ] );
1429
+					unset($default_message_type_names_for_messenger[$key]);
1430 1430
 				}
1431 1431
 			}
1432 1432
 			// in previous iterations, the active_messengers option in the db
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 				false
1441 1441
 			);
1442 1442
 			//create any templates needing created (or will reactivate templates already generated as necessary).
1443
-			if ( ! empty( $default_message_type_names_for_messenger ) ) {
1443
+			if ( ! empty($default_message_type_names_for_messenger)) {
1444 1444
 				$templates_generated = EEH_MSG_Template::generate_new_templates(
1445 1445
 					$messenger_to_generate->name,
1446 1446
 					$default_message_type_names_for_messenger,
@@ -1472,18 +1472,18 @@  discard block
 block discarded – undo
1472 1472
 		$has_activated = $message_resource_manager->get_has_activated_messengers_option();
1473 1473
 
1474 1474
 		$messengers_to_generate = array();
1475
-		foreach ( $installed_messengers as $installed_messenger ) {
1475
+		foreach ($installed_messengers as $installed_messenger) {
1476 1476
 			//if installed messenger is a messenger that should be activated on install
1477 1477
 			//and is not already active
1478 1478
 			//and has never been activated
1479 1479
 			if (
1480 1480
 				! $installed_messenger->activate_on_install
1481
-				|| isset( $active_messengers[ $installed_messenger->name ] )
1482
-				|| isset( $has_activated[ $installed_messenger->name ] )
1481
+				|| isset($active_messengers[$installed_messenger->name])
1482
+				|| isset($has_activated[$installed_messenger->name])
1483 1483
 			) {
1484 1484
 				continue;
1485 1485
 			}
1486
-			$messengers_to_generate[ $installed_messenger->name ] = $installed_messenger;
1486
+			$messengers_to_generate[$installed_messenger->name] = $installed_messenger;
1487 1487
 		}
1488 1488
 		return $messengers_to_generate;
1489 1489
 	}
@@ -1508,9 +1508,9 @@  discard block
 block discarded – undo
1508 1508
 	 */
1509 1509
 	public static function validate_messages_system() {
1510 1510
 		/** @type EE_Message_Resource_Manager $message_resource_manager */
1511
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
1511
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
1512 1512
 		$message_resource_manager->validate_active_message_types_are_installed();
1513
-		do_action( 'AHEE__EEH_Activation__validate_messages_system' );
1513
+		do_action('AHEE__EEH_Activation__validate_messages_system');
1514 1514
 	}
1515 1515
 
1516 1516
 
@@ -1523,12 +1523,12 @@  discard block
 block discarded – undo
1523 1523
 	 * 	@static
1524 1524
 	 * 	@return void
1525 1525
 	 */
1526
-	public static function create_no_ticket_prices_array(){
1526
+	public static function create_no_ticket_prices_array() {
1527 1527
 		// this creates an array for tracking events that have no active ticket prices created
1528 1528
 		// this allows us to warn admins of the situation so that it can be corrected
1529
-		$espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE );
1530
-		if ( ! $espresso_no_ticket_prices ) {
1531
-			add_option( 'ee_no_ticket_prices', array(), '', FALSE );
1529
+		$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE);
1530
+		if ( ! $espresso_no_ticket_prices) {
1531
+			add_option('ee_no_ticket_prices', array(), '', FALSE);
1532 1532
 		}
1533 1533
 	}
1534 1534
 
@@ -1553,24 +1553,24 @@  discard block
 block discarded – undo
1553 1553
 	 * @global wpdb $wpdb
1554 1554
 	 * @throws \EE_Error
1555 1555
 	 */
1556
-	public static function delete_all_espresso_cpt_data(){
1556
+	public static function delete_all_espresso_cpt_data() {
1557 1557
 		global $wpdb;
1558 1558
 		//get all the CPT post_types
1559 1559
 		$ee_post_types = array();
1560
-		foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){
1561
-			if ( method_exists( $model_name, 'instance' )) {
1562
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1563
-				if ( $model_obj instanceof EEM_CPT_Base ) {
1564
-					$ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type());
1560
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1561
+			if (method_exists($model_name, 'instance')) {
1562
+				$model_obj = call_user_func(array($model_name, 'instance'));
1563
+				if ($model_obj instanceof EEM_CPT_Base) {
1564
+					$ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type());
1565 1565
 				}
1566 1566
 			}
1567 1567
 		}
1568 1568
 		//get all our CPTs
1569
-		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")";
1569
+		$query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")";
1570 1570
 		$cpt_ids = $wpdb->get_col($query);
1571 1571
 		//delete each post meta and term relations too
1572
-		foreach($cpt_ids as $post_id){
1573
-			wp_delete_post($post_id,true);
1572
+		foreach ($cpt_ids as $post_id) {
1573
+			wp_delete_post($post_id, true);
1574 1574
 		}
1575 1575
 	}
1576 1576
 
@@ -1584,18 +1584,18 @@  discard block
 block discarded – undo
1584 1584
 	 * @param bool $remove_all
1585 1585
 	 * @return void
1586 1586
 	 */
1587
-	public static function delete_all_espresso_tables_and_data( $remove_all = true ) {
1587
+	public static function delete_all_espresso_tables_and_data($remove_all = true) {
1588 1588
 		global $wpdb;
1589 1589
 		$undeleted_tables = array();
1590 1590
 
1591 1591
 		// load registry
1592
-		foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){
1593
-			if ( method_exists( $model_name, 'instance' )) {
1594
-				$model_obj = call_user_func( array( $model_name, 'instance' ));
1595
-				if ( $model_obj instanceof EEM_Base ) {
1596
-					foreach ( $model_obj->get_tables() as $table ) {
1597
-						if ( strpos( $table->get_table_name(), 'esp_' )) {
1598
-							switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) {
1592
+		foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) {
1593
+			if (method_exists($model_name, 'instance')) {
1594
+				$model_obj = call_user_func(array($model_name, 'instance'));
1595
+				if ($model_obj instanceof EEM_Base) {
1596
+					foreach ($model_obj->get_tables() as $table) {
1597
+						if (strpos($table->get_table_name(), 'esp_')) {
1598
+							switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) {
1599 1599
 								case false :
1600 1600
 									$undeleted_tables[] = $table->get_table_name();
1601 1601
 								break;
@@ -1620,8 +1620,8 @@  discard block
 block discarded – undo
1620 1620
 			'esp_promotion_rule',
1621 1621
 			'esp_rule'
1622 1622
 		);
1623
-		foreach( $tables_without_models as $table ){
1624
-			EEH_Activation::delete_db_table_if_empty( $table );
1623
+		foreach ($tables_without_models as $table) {
1624
+			EEH_Activation::delete_db_table_if_empty($table);
1625 1625
 		}
1626 1626
 
1627 1627
 
@@ -1659,58 +1659,58 @@  discard block
 block discarded – undo
1659 1659
 			'ee_job_parameters_' => false,
1660 1660
 			'ee_upload_directories_incomplete' => true,
1661 1661
 		);
1662
-		if( is_main_site() ) {
1663
-			$wp_options_to_delete[ 'ee_network_config' ] = true;
1662
+		if (is_main_site()) {
1663
+			$wp_options_to_delete['ee_network_config'] = true;
1664 1664
 		}
1665 1665
 
1666 1666
 		$undeleted_options = array();
1667
-		foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) {
1667
+		foreach ($wp_options_to_delete as $option_name => $no_wildcard) {
1668 1668
 
1669
-			if( $no_wildcard ){
1670
-				if( ! delete_option( $option_name ) ){
1669
+			if ($no_wildcard) {
1670
+				if ( ! delete_option($option_name)) {
1671 1671
 					$undeleted_options[] = $option_name;
1672 1672
 				}
1673
-			}else{
1674
-				$option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" );
1675
-				foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){
1676
-					if( ! delete_option( $option_name_from_wildcard ) ){
1673
+			} else {
1674
+				$option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'");
1675
+				foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) {
1676
+					if ( ! delete_option($option_name_from_wildcard)) {
1677 1677
 						$undeleted_options[] = $option_name_from_wildcard;
1678 1678
 					}
1679 1679
 				}
1680 1680
 			}
1681 1681
 		}
1682 1682
                 //also, let's make sure the "ee_config_option_names" wp option stays out by removing the action that adds it
1683
-                remove_action( 'shutdown', array( EE_Config::instance(), 'shutdown' ), 10 );
1683
+                remove_action('shutdown', array(EE_Config::instance(), 'shutdown'), 10);
1684 1684
 
1685
-		if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) {
1685
+		if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) {
1686 1686
 			$db_update_sans_ee4 = array();
1687
-			foreach($espresso_db_update as $version => $times_activated){
1688
-				if( (string)$version[0] === '3'){//if its NON EE4
1687
+			foreach ($espresso_db_update as $version => $times_activated) {
1688
+				if ((string) $version[0] === '3') {//if its NON EE4
1689 1689
 					$db_update_sans_ee4[$version] = $times_activated;
1690 1690
 				}
1691 1691
 			}
1692
-			update_option( 'espresso_db_update', $db_update_sans_ee4 );
1692
+			update_option('espresso_db_update', $db_update_sans_ee4);
1693 1693
 		}
1694 1694
 
1695 1695
 		$errors = '';
1696
-		if ( ! empty( $undeleted_tables )) {
1696
+		if ( ! empty($undeleted_tables)) {
1697 1697
 			$errors .= sprintf(
1698
-				__( 'The following tables could not be deleted: %s%s', 'event_espresso' ),
1698
+				__('The following tables could not be deleted: %s%s', 'event_espresso'),
1699 1699
 				'<br/>',
1700
-				implode( ',<br/>', $undeleted_tables )
1700
+				implode(',<br/>', $undeleted_tables)
1701 1701
 			);
1702 1702
 		}
1703
-		if ( ! empty( $undeleted_options )) {
1704
-			$errors .= ! empty( $undeleted_tables ) ? '<br/>' : '';
1703
+		if ( ! empty($undeleted_options)) {
1704
+			$errors .= ! empty($undeleted_tables) ? '<br/>' : '';
1705 1705
 			$errors .= sprintf(
1706
-				__( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ),
1706
+				__('The following wp-options could not be deleted: %s%s', 'event_espresso'),
1707 1707
 				'<br/>',
1708
-				implode( ',<br/>', $undeleted_options )
1708
+				implode(',<br/>', $undeleted_options)
1709 1709
 			);
1710 1710
 
1711 1711
 		}
1712
-		if ( ! empty( $errors ) ) {
1713
-			EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ );
1712
+		if ( ! empty($errors)) {
1713
+			EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__);
1714 1714
 		}
1715 1715
 	}
1716 1716
 
@@ -1720,10 +1720,10 @@  discard block
 block discarded – undo
1720 1720
 	 */
1721 1721
 	public static function last_wpdb_error_code() {
1722 1722
 		global $wpdb;
1723
-		if( $wpdb->use_mysqli ) {
1724
-			return mysqli_errno( $wpdb->dbh );
1723
+		if ($wpdb->use_mysqli) {
1724
+			return mysqli_errno($wpdb->dbh);
1725 1725
 		} else {
1726
-			return mysql_errno( $wpdb->dbh );
1726
+			return mysql_errno($wpdb->dbh);
1727 1727
 		}
1728 1728
 	}
1729 1729
 
@@ -1733,23 +1733,23 @@  discard block
 block discarded – undo
1733 1733
 	 * @param string $table_name with or without $wpdb->prefix
1734 1734
 	 * @return boolean
1735 1735
 	 */
1736
-	public static function table_exists( $table_name ){
1736
+	public static function table_exists($table_name) {
1737 1737
 		global $wpdb, $EZSQL_ERROR;
1738
-		$table_name = EEH_Activation::ensure_table_name_has_prefix( $table_name );
1738
+		$table_name = EEH_Activation::ensure_table_name_has_prefix($table_name);
1739 1739
 		//ignore if this causes an sql error
1740 1740
 		$old_error = $wpdb->last_error;
1741 1741
 		$old_suppress_errors = $wpdb->suppress_errors();
1742
-		$old_show_errors_value = $wpdb->show_errors( FALSE );
1742
+		$old_show_errors_value = $wpdb->show_errors(FALSE);
1743 1743
 		$ezsql_error_cache = $EZSQL_ERROR;
1744
-		$wpdb->get_results( "SELECT * from $table_name LIMIT 1");
1745
-		$wpdb->show_errors( $old_show_errors_value );
1746
-		$wpdb->suppress_errors( $old_suppress_errors );
1744
+		$wpdb->get_results("SELECT * from $table_name LIMIT 1");
1745
+		$wpdb->show_errors($old_show_errors_value);
1746
+		$wpdb->suppress_errors($old_suppress_errors);
1747 1747
 		$new_error = $wpdb->last_error;
1748 1748
 		$wpdb->last_error = $old_error;
1749 1749
 		$EZSQL_ERROR = $ezsql_error_cache;
1750 1750
 		//if there was a table doesn't exist error
1751
-		if( ! empty( $new_error ) ) {
1752
-			if(
1751
+		if ( ! empty($new_error)) {
1752
+			if (
1753 1753
 				in_array(
1754 1754
 					EEH_Activation::last_wpdb_error_code(),
1755 1755
 					array(
@@ -1759,14 +1759,14 @@  discard block
 block discarded – undo
1759 1759
 					)
1760 1760
 				)
1761 1761
 				||
1762
-				preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string
1762
+				preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string
1763 1763
 			) {
1764 1764
 				return false;
1765 1765
 			} else {
1766 1766
 				//log this because that's weird. Just use the normal PHP error log
1767 1767
 				error_log(
1768 1768
 					sprintf(
1769
-						__( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ),
1769
+						__('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'),
1770 1770
 					$new_error
1771 1771
 					)
1772 1772
 				);
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
 	/**
1779 1779
 	 * Resets the cache on EEH_Activation
1780 1780
 	 */
1781
-	public static function reset(){
1781
+	public static function reset() {
1782 1782
 		self::$_default_creator_id = NULL;
1783 1783
 		self::$_initialized_db_content_already_in_this_request = false;
1784 1784
 	}
Please login to merge, or discard this patch.
core/exceptions/ExceptionStackTraceDisplay.php 2 patches
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 			// add generic non-identifying messages for non-privileged users
119 119
 			if ( ! WP_DEBUG ) {
120 120
 				$output .= '<span class="ee-error-user-msg-spn">'
121
-				           . trim( $msg )
122
-				           . '</span> &nbsp; <sup>'
123
-				           . $code
124
-				           . '</sup><br />';
121
+						   . trim( $msg )
122
+						   . '</span> &nbsp; <sup>'
123
+						   . $code
124
+						   . '</sup><br />';
125 125
 			} else {
126 126
 				// or helpful developer messages if debugging is on
127 127
 				$output .= '
@@ -130,39 +130,39 @@  discard block
 block discarded – undo
130 130
 				'
131 131
 				. sprintf(
132 132
 					__( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
133
-				    '<strong class="ee-error-dev-msg-str">',
133
+					'<strong class="ee-error-dev-msg-str">',
134 134
 					get_class( $exception ),
135 135
 					'</strong>  &nbsp; <span>',
136 136
 					$code . '</span>'
137 137
 				)
138 138
 				. '<br />
139 139
 				<span class="big-text">"'
140
-				           . trim( $msg )
141
-				           . '"</span><br/>
140
+						   . trim( $msg )
141
+						   . '"</span><br/>
142 142
 				<a id="display-ee-error-trace-1'
143
-				           . $time
144
-				           . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
145
-				           . $time
146
-				           . '">
143
+						   . $time
144
+						   . '" class="display-ee-error-trace-lnk small-text" rel="ee-error-trace-1'
145
+						   . $time
146
+						   . '">
147 147
 					'
148
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
149
-				           . '
148
+						   . __( 'click to view backtrace and class/method details', 'event_espresso' )
149
+						   . '
150 150
 				</a><br />
151 151
 				'
152
-				           . $exception->getFile()
153
-				           . sprintf(
154
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
155
-					           ' &nbsp; <span class="small-text lt-grey-text">',
156
-					           $exception->getLine(),
157
-					           '</span>'
158
-				           )
159
-				           . '
152
+						   . $exception->getFile()
153
+						   . sprintf(
154
+							   __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
155
+							   ' &nbsp; <span class="small-text lt-grey-text">',
156
+							   $exception->getLine(),
157
+							   '</span>'
158
+						   )
159
+						   . '
160 160
 			</p>
161 161
 			<div id="ee-error-trace-1'
162
-				           . $time
163
-				           . '-dv" class="ee-error-trace-dv" style="display: none;">
162
+						   . $time
163
+						   . '-dv" class="ee-error-trace-dv" style="display: none;">
164 164
 				'
165
-				           . $trace_details;
165
+						   . $trace_details;
166 166
 				if ( ! empty( $class ) ) {
167 167
 					$output .= '
168 168
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	/**
23 23
 	 * @param \Exception $exception
24 24
 	 */
25
-	public function __construct( \Exception $exception ) {
26
-		if ( WP_DEBUG ) {
27
-			$this->displayException( $exception );
25
+	public function __construct(\Exception $exception) {
26
+		if (WP_DEBUG) {
27
+			$this->displayException($exception);
28 28
 		}
29 29
 	}
30 30
 
@@ -34,27 +34,27 @@  discard block
 block discarded – undo
34 34
 	 * @access protected
35 35
 	 * @param \Exception $exception
36 36
 	 */
37
-	protected function displayException( \Exception $exception ) {
37
+	protected function displayException(\Exception $exception) {
38 38
 
39 39
 		$error_code = '';
40 40
 		$trace_details = '';
41 41
 		$time = time();
42 42
 		$trace = $exception->getTrace();
43 43
 		// get separate user and developer messages if they exist
44
-		$msg = explode( '||', $exception->getMessage() );
44
+		$msg = explode('||', $exception->getMessage());
45 45
 		$user_msg = $msg[0];
46
-		$dev_msg = isset( $msg[1] ) ? $msg[1] : $msg[0];
46
+		$dev_msg = isset($msg[1]) ? $msg[1] : $msg[0];
47 47
 		$msg = WP_DEBUG ? $dev_msg : $user_msg;
48 48
 		// start gathering output
49 49
 		$output = $this->exceptionStyles();
50 50
 		$output .= '
51 51
 <div id="ee-error-message" class="error">';
52
-		if ( ! WP_DEBUG ) {
52
+		if ( ! WP_DEBUG) {
53 53
 			$output .= '
54 54
 	<p>';
55 55
 		}
56 56
 			// process trace info
57
-			if ( empty( $trace ) ) {
57
+			if (empty($trace)) {
58 58
 				$trace_details .= __(
59 59
 					'Sorry, but no trace information was available for this exception.',
60 60
 					'event_espresso'
@@ -67,47 +67,47 @@  discard block
 block discarded – undo
67 67
 					<th scope="col" align="right" style="width:2.5%;">#</th>
68 68
 					<th scope="col" align="right" style="width:3.5%;">Line</th>
69 69
 					<th scope="col" align="left" style="width:40%;">File</th>
70
-					<th scope="col" align="left">' . __( 'Class', 'event_espresso' ) . '->' . __( 'Method( arguments )', 'event_espresso' ) . '</th>
70
+					<th scope="col" align="left">' . __('Class', 'event_espresso').'->'.__('Method( arguments )', 'event_espresso').'</th>
71 71
 				</tr>';
72
-				$last_on_stack = count( $trace ) - 1;
72
+				$last_on_stack = count($trace) - 1;
73 73
 				// reverse array so that stack is in proper chronological order
74
-				$sorted_trace = array_reverse( $trace );
75
-				foreach ( $sorted_trace as $nmbr => $trace ) {
76
-					$file = isset( $trace['file'] ) ? $trace['file'] : '';
77
-					$class = isset( $trace['class'] ) ? $trace['class'] : '';
78
-					$type = isset( $trace['type'] ) ? $trace['type'] : '';
79
-					$function = isset( $trace['function'] ) ? $trace['function'] : '';
80
-					$args = isset( $trace['args'] ) ? $this->_convert_args_to_string( $trace['args'] ) : '';
81
-					$args = isset( $trace['args'] ) && count( $trace['args'] ) > 4  ? ' <br />' . $args . '<br />' : $args;
82
-					$line = isset( $trace['line'] ) ? $trace['line'] : '';
74
+				$sorted_trace = array_reverse($trace);
75
+				foreach ($sorted_trace as $nmbr => $trace) {
76
+					$file = isset($trace['file']) ? $trace['file'] : '';
77
+					$class = isset($trace['class']) ? $trace['class'] : '';
78
+					$type = isset($trace['type']) ? $trace['type'] : '';
79
+					$function = isset($trace['function']) ? $trace['function'] : '';
80
+					$args = isset($trace['args']) ? $this->_convert_args_to_string($trace['args']) : '';
81
+					$args = isset($trace['args']) && count($trace['args']) > 4 ? ' <br />'.$args.'<br />' : $args;
82
+					$line = isset($trace['line']) ? $trace['line'] : '';
83 83
 					$zebra = $nmbr % 2 !== 0 ? ' odd' : '';
84
-					if ( empty( $file ) && ! empty( $class ) ) {
85
-						$a = new \ReflectionClass( $class );
84
+					if (empty($file) && ! empty($class)) {
85
+						$a = new \ReflectionClass($class);
86 86
 						$file = $a->getFileName();
87
-						if ( empty( $line ) && ! empty( $function ) ) {
88
-							$b = new \ReflectionMethod( $class, $function );
87
+						if (empty($line) && ! empty($function)) {
88
+							$b = new \ReflectionMethod($class, $function);
89 89
 							$line = $b->getStartLine();
90 90
 						}
91 91
 					}
92
-					if ( $nmbr === $last_on_stack ) {
92
+					if ($nmbr === $last_on_stack) {
93 93
 						$file = $exception->getFile() !== '' ? $exception->getFile() : $file;
94 94
 						$line = $exception->getLine() !== '' ? $exception->getLine() : $line;
95
-						$error_code = $this->generate_error_code( $file, $trace['function'], $line );
95
+						$error_code = $this->generate_error_code($file, $trace['function'], $line);
96 96
 					}
97
-					$file = \EEH_File::standardise_directory_separators( $file );
98
-					$nmbr = ! empty( $nmbr ) ? $nmbr : '&nbsp;';
99
-					$line = ! empty( $line ) ? $line : '&nbsp;';
100
-					$file = ! empty( $file ) ? $file : '&nbsp;';
101
-					$class_display = ! empty( $class ) ? $class : '';
102
-					$type = ! empty( $type ) ? $type : '';
103
-					$function = ! empty( $function ) ? $function : '';
104
-					$args = ! empty( $args ) ? '( ' . $args . ' )' : '()';
97
+					$file = \EEH_File::standardise_directory_separators($file);
98
+					$nmbr = ! empty($nmbr) ? $nmbr : '&nbsp;';
99
+					$line = ! empty($line) ? $line : '&nbsp;';
100
+					$file = ! empty($file) ? $file : '&nbsp;';
101
+					$class_display = ! empty($class) ? $class : '';
102
+					$type = ! empty($type) ? $type : '';
103
+					$function = ! empty($function) ? $function : '';
104
+					$args = ! empty($args) ? '( '.$args.' )' : '()';
105 105
 					$trace_details .= '
106 106
 					<tr>
107
-						<td align="right" valign="top" class="' . $zebra . '">' . $nmbr . '</td>
108
-						<td align="right" valign="top" class="' . $zebra . '">' . $line . '</td>
109
-						<td align="left" valign="top" class="' . $zebra . '">' . $file . '</td>
110
-						<td align="left" valign="top" class="' . $zebra . '">' . $class_display . $type . $function . $args . '</td>
107
+						<td align="right" valign="top" class="' . $zebra.'">'.$nmbr.'</td>
108
+						<td align="right" valign="top" class="' . $zebra.'">'.$line.'</td>
109
+						<td align="left" valign="top" class="' . $zebra.'">'.$file.'</td>
110
+						<td align="left" valign="top" class="' . $zebra.'">'.$class_display.$type.$function.$args.'</td>
111 111
 					</tr>';
112 112
 				}
113 113
 				$trace_details .= '
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
 			}
117 117
 			$code = $exception->getCode() ? $exception->getCode() : $error_code;
118 118
 			// add generic non-identifying messages for non-privileged users
119
-			if ( ! WP_DEBUG ) {
119
+			if ( ! WP_DEBUG) {
120 120
 				$output .= '<span class="ee-error-user-msg-spn">'
121
-				           . trim( $msg )
121
+				           . trim($msg)
122 122
 				           . '</span> &nbsp; <sup>'
123 123
 				           . $code
124 124
 				           . '</sup><br />';
@@ -129,15 +129,15 @@  discard block
 block discarded – undo
129 129
 			<p class="ee-error-dev-msg-pg">
130 130
 				'
131 131
 				. sprintf(
132
-					__( '%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso' ),
132
+					__('%1$sAn %2$s was thrown!%3$s code: %4$s', 'event_espresso'),
133 133
 				    '<strong class="ee-error-dev-msg-str">',
134
-					get_class( $exception ),
134
+					get_class($exception),
135 135
 					'</strong>  &nbsp; <span>',
136
-					$code . '</span>'
136
+					$code.'</span>'
137 137
 				)
138 138
 				. '<br />
139 139
 				<span class="big-text">"'
140
-				           . trim( $msg )
140
+				           . trim($msg)
141 141
 				           . '"</span><br/>
142 142
 				<a id="display-ee-error-trace-1'
143 143
 				           . $time
@@ -145,13 +145,13 @@  discard block
 block discarded – undo
145 145
 				           . $time
146 146
 				           . '">
147 147
 					'
148
-				           . __( 'click to view backtrace and class/method details', 'event_espresso' )
148
+				           . __('click to view backtrace and class/method details', 'event_espresso')
149 149
 				           . '
150 150
 				</a><br />
151 151
 				'
152 152
 				           . $exception->getFile()
153 153
 				           . sprintf(
154
-					           __( '%1$s( line no: %2$s )%3$s', 'event_espresso' ),
154
+					           __('%1$s( line no: %2$s )%3$s', 'event_espresso'),
155 155
 					           ' &nbsp; <span class="small-text lt-grey-text">',
156 156
 					           $exception->getLine(),
157 157
 					           '</span>'
@@ -163,14 +163,14 @@  discard block
 block discarded – undo
163 163
 				           . '-dv" class="ee-error-trace-dv" style="display: none;">
164 164
 				'
165 165
 				           . $trace_details;
166
-				if ( ! empty( $class ) ) {
166
+				if ( ! empty($class)) {
167 167
 					$output .= '
168 168
 				<div style="padding:3px; margin:0 0 1em; border:1px solid #999; background:#fff; border-radius:3px;">
169 169
 					<div style="padding:1em 2em; border:1px solid #999; background:#fcfcfc;">
170
-						<h3>' . __( 'Class Details', 'event_espresso' ) . '</h3>';
171
-					$a = new \ReflectionClass( $class );
170
+						<h3>' . __('Class Details', 'event_espresso').'</h3>';
171
+					$a = new \ReflectionClass($class);
172 172
 					$output .= '
173
-						<pre>' . $a . '</pre>
173
+						<pre>' . $a.'</pre>
174 174
 					</div>
175 175
 				</div>';
176 176
 				}
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
 		<br />';
181 181
 			}
182 182
 		// remove last linebreak
183
-		$output = substr( $output, 0, count( $output ) - 7 );
184
-		if ( ! WP_DEBUG ) {
183
+		$output = substr($output, 0, count($output) - 7);
184
+		if ( ! WP_DEBUG) {
185 185
 			$output .= '
186 186
 	</p>';
187 187
 		}
188 188
 		$output .= '
189 189
 </div>';
190
-		$output .= $this->printScripts( true );
191
-		if ( defined( 'DOING_AJAX' ) ) {
192
-			echo json_encode( array( 'error' => $output ) );
190
+		$output .= $this->printScripts(true);
191
+		if (defined('DOING_AJAX')) {
192
+			echo json_encode(array('error' => $output));
193 193
 			exit();
194 194
 		}
195 195
 		echo $output;
@@ -206,56 +206,56 @@  discard block
 block discarded – undo
206 206
 	 * @param bool  $array
207 207
 	 * @return string
208 208
 	 */
209
-	private function _convert_args_to_string( $arguments = array(), $indent = 0, $array = false ) {
209
+	private function _convert_args_to_string($arguments = array(), $indent = 0, $array = false) {
210 210
 		$args = array();
211
-		$args_count = count( $arguments );
212
-		if ( $args_count > 2 ) {
211
+		$args_count = count($arguments);
212
+		if ($args_count > 2) {
213 213
 			$indent++;
214 214
 			$args[] = '<br />';
215 215
 		}
216 216
 		$x = 0;
217
-		foreach ( $arguments as $arg ) {
217
+		foreach ($arguments as $arg) {
218 218
 			$x++;
219
-			for( $i = 0; $i < $indent; $i++ ) {
219
+			for ($i = 0; $i < $indent; $i++) {
220 220
 				$args[] = ' &nbsp;&nbsp; ';
221 221
 			}
222
-			if ( is_string( $arg ) ) {
223
-				if ( ! $array && strlen( $arg ) > 75 ) {
222
+			if (is_string($arg)) {
223
+				if ( ! $array && strlen($arg) > 75) {
224 224
 					$args[] = "<br />";
225
-					for ( $i = 0; $i <= $indent; $i++ ) {
225
+					for ($i = 0; $i <= $indent; $i++) {
226 226
 						$args[] = ' &nbsp;&nbsp; ';
227 227
 					}
228
-					$args[] = "'" . $arg . "'<br />";
228
+					$args[] = "'".$arg."'<br />";
229 229
 				} else {
230
-					$args[] = " '" . $arg . "'";
230
+					$args[] = " '".$arg."'";
231 231
 				}
232
-			} elseif ( is_array( $arg ) ) {
233
-				$arg_count = count( $arg );
234
-				if ( $arg_count > 2 ) {
232
+			} elseif (is_array($arg)) {
233
+				$arg_count = count($arg);
234
+				if ($arg_count > 2) {
235 235
 					$indent++;
236
-					$args[] = " array(" . $this->_convert_args_to_string( $arg, $indent, true ) . ")";
236
+					$args[] = " array(".$this->_convert_args_to_string($arg, $indent, true).")";
237 237
 					$indent--;
238
-				} else if ( $arg_count === 0 ) {
238
+				} else if ($arg_count === 0) {
239 239
 					$args[] = " array()";
240 240
 				} else {
241
-					$args[] = " array( " . $this->_convert_args_to_string( $arg ) . " )";
241
+					$args[] = " array( ".$this->_convert_args_to_string($arg)." )";
242 242
 				}
243
-			} elseif ( $arg === null ) {
243
+			} elseif ($arg === null) {
244 244
 				$args[] = ' null';
245
-			} elseif ( is_bool( $arg ) ) {
245
+			} elseif (is_bool($arg)) {
246 246
 				$args[] = $arg ? ' true' : ' false';
247
-			} elseif ( is_object( $arg ) ) {
248
-				$args[] = get_class( $arg );
249
-			} elseif ( is_resource( $arg ) ) {
250
-				$args[] = get_resource_type( $arg );
247
+			} elseif (is_object($arg)) {
248
+				$args[] = get_class($arg);
249
+			} elseif (is_resource($arg)) {
250
+				$args[] = get_resource_type($arg);
251 251
 			} else {
252 252
 				$args[] = $arg;
253 253
 			}
254
-			if ( $x === $args_count ) {
255
-				if ( $args_count > 2 ) {
254
+			if ($x === $args_count) {
255
+				if ($args_count > 2) {
256 256
 					$args[] = "<br />";
257 257
 					$indent--;
258
-					for ( $i = 1; $i < $indent; $i++ ) {
258
+					for ($i = 1; $i < $indent; $i++) {
259 259
 						$args[] = ' &nbsp;&nbsp; ';
260 260
 					}
261 261
 				}
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				$args[] = $args_count > 2 ? ",<br />" : ', ';
264 264
 			}
265 265
 		}
266
-		return implode( '', $args );
266
+		return implode('', $args);
267 267
 	}
268 268
 
269 269
 
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	 * @param string $line
279 279
 	 * @return string
280 280
 	 */
281
-	protected function generate_error_code( $file = '', $func = '', $line = '' ) {
282
-		$file_bits = explode( '.', basename( $file ) );
283
-		$error_code = ! empty( $file_bits[0] ) ? $file_bits[0] : '';
284
-		$error_code .= ! empty( $func ) ? ' - ' . $func : '';
285
-		$error_code .= ! empty( $line ) ? ' - ' . $line : '';
281
+	protected function generate_error_code($file = '', $func = '', $line = '') {
282
+		$file_bits = explode('.', basename($file));
283
+		$error_code = ! empty($file_bits[0]) ? $file_bits[0] : '';
284
+		$error_code .= ! empty($func) ? ' - '.$func : '';
285
+		$error_code .= ! empty($line) ? ' - '.$line : '';
286 286
 		return $error_code;
287 287
 	}
288 288
 
@@ -366,26 +366,26 @@  discard block
 block discarded – undo
366 366
 	 * @param bool $force_print
367 367
 	 * @return string|void
368 368
 	 */
369
-	private function printScripts( $force_print = false ) {
370
-		if ( ! $force_print  && ( did_action( 'admin_enqueue_scripts' ) || did_action( 'wp_enqueue_scripts' ) ) ) {
371
-			if ( wp_script_is( 'ee_error_js', 'enqueued' ) ) {
369
+	private function printScripts($force_print = false) {
370
+		if ( ! $force_print && (did_action('admin_enqueue_scripts') || did_action('wp_enqueue_scripts'))) {
371
+			if (wp_script_is('ee_error_js', 'enqueued')) {
372 372
 				return '';
373
-			} else if ( wp_script_is( 'ee_error_js', 'registered' ) ) {
374
-				add_filter( 'FHEE_load_css', '__return_true' );
375
-				add_filter( 'FHEE_load_js', '__return_true' );
376
-				wp_enqueue_script( 'ee_error_js' );
377
-				wp_localize_script( 'ee_error_js', 'ee_settings', array( 'wp_debug' => WP_DEBUG ) );
373
+			} else if (wp_script_is('ee_error_js', 'registered')) {
374
+				add_filter('FHEE_load_css', '__return_true');
375
+				add_filter('FHEE_load_js', '__return_true');
376
+				wp_enqueue_script('ee_error_js');
377
+				wp_localize_script('ee_error_js', 'ee_settings', array('wp_debug' => WP_DEBUG));
378 378
 			}
379 379
 		} else {
380 380
 			return '
381 381
 <script>
382 382
 /* <![CDATA[ */
383
-var ee_settings = {"wp_debug":"' . WP_DEBUG . '"};
383
+var ee_settings = {"wp_debug":"' . WP_DEBUG.'"};
384 384
 /* ]]> */
385 385
 </script>
386
-<script src="' . includes_url() . 'js/jquery/jquery.js" type="text/javascript"></script>
387
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
388
-<script src="' . EE_GLOBAL_ASSETS_URL . 'scripts/EE_Error.js' . '?ver=' . espresso_version() . '" type="text/javascript"></script>
386
+<script src="' . includes_url().'js/jquery/jquery.js" type="text/javascript"></script>
387
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
388
+<script src="' . EE_GLOBAL_ASSETS_URL.'scripts/EE_Error.js'.'?ver='.espresso_version().'" type="text/javascript"></script>
389 389
 ';
390 390
 		}
391 391
 		return '';
Please login to merge, or discard this patch.
core/exceptions/InsufficientPermissionsException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\exceptions;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
 	 * @param  int $code
25 25
 	 * @param  \Exception $previous
26 26
 	 */
27
-	public function __construct( $action, $message = '', $code = 0, \Exception $previous = null ) {
28
-		if ( empty( $message ) ) {
27
+	public function __construct($action, $message = '', $code = 0, \Exception $previous = null) {
28
+		if (empty($message)) {
29 29
 			$message = sprintf(
30 30
 				__(
31 31
 					'We\'re sorry, but you do not have the required permissions to perform the following action: ',
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 				$action
35 35
 			);
36 36
 		}
37
-		parent::__construct( $message, $code, $previous );
37
+		parent::__construct($message, $code, $previous);
38 38
 	}
39 39
 
40 40
 
Please login to merge, or discard this patch.
core/libraries/messages/EE_Messages_Generator.lib.php 1 patch
Spacing   +117 added lines, -117 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
  * This class is used for generating EE_Message objects with given info.
@@ -116,10 +116,10 @@  discard block
 block discarded – undo
116 116
 	 *
117 117
 	 * @return EE_Messages_Queue  The new queue for holding generated EE_Message objects.
118 118
 	 */
119
-	public function generate( $save = true ) {
119
+	public function generate($save = true) {
120 120
 		//iterate through the messages in the queue, generate, and add to new queue.
121 121
 		$this->_generation_queue->get_message_repository()->rewind();
122
-		while ( $this->_generation_queue->get_message_repository()->valid() ) {
122
+		while ($this->_generation_queue->get_message_repository()->valid()) {
123 123
 			//reset "current" properties
124 124
 			$this->_reset_current_properties();
125 125
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
 			$this->_generation_queue->get_message_repository()->next();
134 134
 			$next_msg = $this->_generation_queue->get_message_repository()->current();
135 135
 			//restore pointer to current item
136
-			$this->_generation_queue->get_message_repository()->set_current( $msg );
136
+			$this->_generation_queue->get_message_repository()->set_current($msg);
137 137
 
138 138
 			//skip and delete if the current $msg is NOT incomplete (queued for generation)
139
-			if ( $msg->STS_ID() !== EEM_Message::status_incomplete ) {
139
+			if ($msg->STS_ID() !== EEM_Message::status_incomplete) {
140 140
 				//we keep this item in the db just remove from the repo.
141
-				$this->_generation_queue->get_message_repository()->remove( $msg );
141
+				$this->_generation_queue->get_message_repository()->remove($msg);
142 142
 				//next item
143
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
143
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
144 144
 				continue;
145 145
 			}
146 146
 
147
-			if ( $this->_verify() ) {
147
+			if ($this->_verify()) {
148 148
 				//let's get generating!
149 149
 				$this->_generate();
150 150
 			}
@@ -155,28 +155,28 @@  discard block
 block discarded – undo
155 155
 				&& ! EEM_Message::debug()
156 156
 			) {
157 157
 				$this->_generation_queue->get_message_repository()->delete();
158
-				$this->_generation_queue->get_message_repository()->set_current( $next_msg );
158
+				$this->_generation_queue->get_message_repository()->set_current($next_msg);
159 159
 				continue;
160 160
 			}
161 161
 
162 162
 			//if there are error messages then let's set the status and the error message.
163
-			if ( $this->_error_msg ) {
163
+			if ($this->_error_msg) {
164 164
 				//if the status is already debug only, then let's leave it at that.
165
-				if ( $msg->STS_ID() !== EEM_Message::status_debug_only ) {
166
-					$msg->set_STS_ID( EEM_Message::status_failed );
165
+				if ($msg->STS_ID() !== EEM_Message::status_debug_only) {
166
+					$msg->set_STS_ID(EEM_Message::status_failed);
167 167
 				}
168 168
 				$msg->set_error_message(
169
-					__( 'Message failed to generate for the following reasons: ' )
169
+					__('Message failed to generate for the following reasons: ')
170 170
 					. "\n"
171
-					. implode( "\n", $this->_error_msg )
171
+					. implode("\n", $this->_error_msg)
172 172
 				);
173
-				$msg->set_modified( time() );
173
+				$msg->set_modified(time());
174 174
 			} else {
175 175
 				//remove from db
176 176
 				$this->_generation_queue->get_message_repository()->delete();
177 177
 			}
178 178
 			//next item
179
-			$this->_generation_queue->get_message_repository()->set_current( $next_msg );
179
+			$this->_generation_queue->get_message_repository()->set_current($next_msg);
180 180
 		}
181 181
 
182 182
 		//generation queue is ALWAYS saved to record any errors in the generation process.
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		 * so a EE_Extra_Meta entry could be created and attached to the EE_Message.  In those cases the save flag is
190 190
 		 * irrelevant.
191 191
 		 */
192
-		if ( $save ) {
192
+		if ($save) {
193 193
 			$this->_ready_queue->save();
194 194
 		}
195 195
 
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	protected function _reset_current_properties() {
208 208
 		$this->_verified = false;
209 209
 		//make sure any _data value in the current message type is reset
210
-		if ( $this->_current_message_type instanceof EE_message_type ) {
210
+		if ($this->_current_message_type instanceof EE_message_type) {
211 211
 			$this->_current_message_type->reset_data();
212 212
 		}
213 213
 		$this->_current_messenger = $this->_current_message_type = $this->_current_data_handler = null;
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	protected function _generate() {
228 228
 		//double check verification has run and that everything is ready to work with (saves us having to validate everything again).
229
-		if ( ! $this->_verified ) {
229
+		if ( ! $this->_verified) {
230 230
 			return false; //get out because we don't have a valid setup to work with.
231 231
 		}
232 232
 
@@ -236,34 +236,34 @@  discard block
 block discarded – undo
236 236
 				$this->_current_data_handler,
237 237
 				$this->_generation_queue->get_message_repository()->current()->context()
238 238
 			);
239
-		} catch ( EE_Error $e ) {
239
+		} catch (EE_Error $e) {
240 240
 			$this->_error_msg[] = $e->getMessage();
241 241
 			return false;
242 242
 		}
243 243
 
244 244
 
245 245
 		//if no addressees then get out because there is nothing to generation (possible bad data).
246
-		if ( ! $this->_valid_addressees( $addressees ) ) {
247
-			$this->_generation_queue->get_message_repository()->current()->set_STS_ID( EEM_Message::status_debug_only );
248
-			$this->_error_msg[] = __( 'This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
249
-			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso' );
246
+		if ( ! $this->_valid_addressees($addressees)) {
247
+			$this->_generation_queue->get_message_repository()->current()->set_STS_ID(EEM_Message::status_debug_only);
248
+			$this->_error_msg[] = __('This is not a critical error but an informational notice. Unable to generate messages EE_Messages_Addressee objects.  There were no attendees prepared by the data handler.
249
+			  Sometimes this is because messages only get generated for certain registration statuses. For example, the ticket notice message type only goes to approved registrations.', 'event_espresso');
250 250
 			return false;
251 251
 		}
252 252
 
253 253
 		$message_template_group = $this->_get_message_template_group();
254 254
 
255 255
 		//in the unlikely event there is no EE_Message_Template_Group available, get out!
256
-		if ( ! $message_template_group instanceof EE_Message_Template_Group ) {
257
-			$this->_error_msg[] = __( 'Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso' );
256
+		if ( ! $message_template_group instanceof EE_Message_Template_Group) {
257
+			$this->_error_msg[] = __('Unable to get the Message Templates for the Message being generated.  No message template group accessible.', 'event_espresso');
258 258
 			return false;
259 259
 		}
260 260
 
261 261
 		//get formatted templates for using to parse and setup EE_Message objects.
262
-		$templates = $this->_get_templates( $message_template_group );
262
+		$templates = $this->_get_templates($message_template_group);
263 263
 
264 264
 
265 265
 		//setup new EE_Message objects (and add to _ready_queue)
266
-		return $this->_assemble_messages( $addressees, $templates, $message_template_group );
266
+		return $this->_assemble_messages($addressees, $templates, $message_template_group);
267 267
 	}
268 268
 
269 269
 
@@ -281,17 +281,17 @@  discard block
 block discarded – undo
281 281
 		//so let's use that.
282 282
 		$GRP_ID = $this->_generation_queue->get_message_repository()->current()->GRP_ID();
283 283
 
284
-		if ( $GRP_ID ) {
284
+		if ($GRP_ID) {
285 285
 			//attempt to retrieve from repo first
286
-			$GRP = $this->_template_collection->get_by_ID( $GRP_ID );
287
-			if ( $GRP instanceof EE_Message_Template_Group ) {
288
-				return $GRP;  //got it!
286
+			$GRP = $this->_template_collection->get_by_ID($GRP_ID);
287
+			if ($GRP instanceof EE_Message_Template_Group) {
288
+				return $GRP; //got it!
289 289
 			}
290 290
 
291 291
 			//nope don't have it yet.  Get from DB then add to repo
292
-			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID( $GRP_ID );
293
-			if ( $GRP instanceof EE_Message_Template_Group ) {
294
-				$this->_template_collection->add( $GRP );
292
+			$GRP = EEM_Message_Template_Group::instance()->get_one_by_ID($GRP_ID);
293
+			if ($GRP instanceof EE_Message_Template_Group) {
294
+				$this->_template_collection->add($GRP);
295 295
 			}
296 296
 			return $GRP;
297 297
 		}
@@ -310,41 +310,41 @@  discard block
 block discarded – undo
310 310
 		//in vanilla EE we're assuming there's only one event.
311 311
 		//However, if there are multiple events then we'll just use the default templates instead of different
312 312
 		// templates per event (which could create problems).
313
-		if ( count( $this->_current_data_handler->events ) === 1 ) {
314
-			foreach ( $this->_current_data_handler->events as $event ) {
313
+		if (count($this->_current_data_handler->events) === 1) {
314
+			foreach ($this->_current_data_handler->events as $event) {
315 315
 				$EVT_ID = $event['ID'];
316 316
 			}
317 317
 		}
318 318
 
319 319
 		//before going any further, let's see if its in the queue
320
-		$GRP = $this->_template_collection->get_by_key( $this->_template_collection->get_key( $this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID ) );
320
+		$GRP = $this->_template_collection->get_by_key($this->_template_collection->get_key($this->_current_messenger->name, $this->_current_message_type->name, $EVT_ID));
321 321
 
322
-		if ( $GRP instanceof EE_Message_Template_Group ) {
322
+		if ($GRP instanceof EE_Message_Template_Group) {
323 323
 			return $GRP;
324 324
 		}
325 325
 
326 326
 		//nope still no GRP?
327 327
 		//first we get the global template in case it has an override set.
328
-		$global_template_qa = array_merge( array( 'MTP_is_global' => true ), $template_qa );
329
-		$global_GRP = EEM_Message_Template_Group::instance()->get_one( array( $global_template_qa ) );
328
+		$global_template_qa = array_merge(array('MTP_is_global' => true), $template_qa);
329
+		$global_GRP = EEM_Message_Template_Group::instance()->get_one(array($global_template_qa));
330 330
 
331 331
 		//if this is an override, then we just return it.
332
-		if ( $global_GRP instanceof EE_Message_Template_Group && $global_GRP->get( 'MTP_is_override' ) ) {
333
-			$this->_template_collection->add( $global_GRP, $EVT_ID );
332
+		if ($global_GRP instanceof EE_Message_Template_Group && $global_GRP->get('MTP_is_override')) {
333
+			$this->_template_collection->add($global_GRP, $EVT_ID);
334 334
 			return $global_GRP;
335 335
 		}
336 336
 
337 337
 		//STILL here? Okay that means we want to see if there is event specific group and if there is we return it,
338 338
 		//otherwise we return the global group we retrieved.
339
-		if ( $EVT_ID ) {
339
+		if ($EVT_ID) {
340 340
 			$template_qa['Event.EVT_ID'] = $EVT_ID;
341 341
 		}
342 342
 
343
-		$GRP = EEM_Message_Template_Group::instance()->get_one( array( $template_qa ) );
343
+		$GRP = EEM_Message_Template_Group::instance()->get_one(array($template_qa));
344 344
 		$GRP = $GRP instanceof EE_Message_Template_Group ? $GRP : $global_GRP;
345 345
 
346
-		if ( $GRP instanceof EE_Message_Template_Group ) {
347
-			$this->_template_collection->add( $GRP, $EVT_ID );
346
+		if ($GRP instanceof EE_Message_Template_Group) {
347
+			$this->_template_collection->add($GRP, $EVT_ID);
348 348
 			return $GRP;
349 349
 		}
350 350
 
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 	 *                      )
369 369
 	 *                  )
370 370
 	 */
371
-	protected function _get_templates( EE_Message_Template_Group $message_template_group ) {
371
+	protected function _get_templates(EE_Message_Template_Group $message_template_group) {
372 372
 		$templates = array();
373 373
 		$context_templates = $message_template_group->context_templates();
374
-		foreach ( $context_templates as $context => $template_fields ) {
375
-			foreach ( $template_fields as $template_field => $template_obj ) {
376
-				if ( ! $template_obj instanceof EE_Message_Template ) {
374
+		foreach ($context_templates as $context => $template_fields) {
375
+			foreach ($template_fields as $template_field => $template_obj) {
376
+				if ( ! $template_obj instanceof EE_Message_Template) {
377 377
 					continue;
378 378
 				}
379
-				$templates[ $template_field ][ $context ] = $template_obj->get( 'MTP_content' );
379
+				$templates[$template_field][$context] = $template_obj->get('MTP_content');
380 380
 			}
381 381
 		}
382 382
 		return $templates;
@@ -398,20 +398,20 @@  discard block
 block discarded – undo
398 398
 	 *                get added to the queue with EEM_Message::status_idle, unsuccessfully generated messages will get added
399 399
 	 *                to the queue as EEM_Message::status_failed.  Very rarely should "false" be returned from this method.
400 400
 	 */
401
-	protected function _assemble_messages( $addressees, $templates, EE_Message_Template_Group $message_template_group ) {
401
+	protected function _assemble_messages($addressees, $templates, EE_Message_Template_Group $message_template_group) {
402 402
 
403 403
 		//if templates are empty then get out because we can't generate anything.
404
-		if ( ! $templates ) {
404
+		if ( ! $templates) {
405 405
 			return false;
406 406
 		}
407 407
 
408 408
 		//We use this as the counter for generated messages because don't forget we may be executing this inside of a
409 409
 		//generation_queue.  So _ready_queue may have generated EE_Message objects already.
410 410
 		$generated_count = 0;
411
-		foreach ( $addressees as $context => $recipients ) {
412
-			foreach ( $recipients as $recipient ) {
413
-				$message = $this->_setup_message_object( $context, $recipient, $templates, $message_template_group );
414
-				if ( $message instanceof EE_Message ) {
411
+		foreach ($addressees as $context => $recipients) {
412
+			foreach ($recipients as $recipient) {
413
+				$message = $this->_setup_message_object($context, $recipient, $templates, $message_template_group);
414
+				if ($message instanceof EE_Message) {
415 415
 					$this->_ready_queue->add(
416 416
 						$message,
417 417
 						array(),
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 				}
423 423
 
424 424
 				//if the current MSG being generated is for a test send then we'll only use ONE message in the generation.
425
-				if ( $this->_generation_queue->get_message_repository()->is_test_send() ) {
425
+				if ($this->_generation_queue->get_message_repository()->is_test_send()) {
426 426
 					break 2;
427 427
 				}
428 428
 			}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	) {
452 452
 		//stuff we already know
453 453
 		$transaction_id = $recipient->txn instanceof EE_Transaction ? $recipient->txn->ID() : 0;
454
-		$transaction_id = empty( $transaction_id ) && $this->_current_data_handler->txn instanceof EE_Transaction
454
+		$transaction_id = empty($transaction_id) && $this->_current_data_handler->txn instanceof EE_Transaction
455 455
 			? $this->_current_data_handler->txn->ID()
456 456
 			: $transaction_id;
457 457
 		$message_fields = array(
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 
465 465
 		//recipient id and type should be on the EE_Messages_Addressee object but if this is empty, let's try to grab the
466 466
 		//info from the att_obj found in the EE_Messages_Addressee object.
467
-		if ( empty( $recipient->recipient_id ) || empty( $recipient->recipient_type ) ) {
467
+		if (empty($recipient->recipient_id) || empty($recipient->recipient_type)) {
468 468
 			$message_fields['MSG_recipient_ID'] = $recipient->att_obj instanceof EE_Attendee
469 469
 				? $recipient->att_obj->ID()
470 470
 				: 0;
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 			$message_fields['MSG_recipient_ID'] = $recipient->recipient_id;
474 474
 			$message_fields['MSG_recipient_type'] = $recipient->recipient_type;
475 475
 		}
476
-		$message = EE_Message_Factory::create( $message_fields );
476
+		$message = EE_Message_Factory::create($message_fields);
477 477
 
478 478
 		//grab valid shortcodes for shortcode parser
479 479
 		$mt_shortcodes = $this->_current_message_type->get_valid_shortcodes();
@@ -481,43 +481,43 @@  discard block
 block discarded – undo
481 481
 
482 482
 		//if the 'to' field is empty (messages will ALWAYS have a "to" field, then we get out because that means this
483 483
 		//context is turned off) EXCEPT if we're previewing
484
-		if ( empty( $templates['to'][ $context ] )
484
+		if (empty($templates['to'][$context])
485 485
 		     && ! $this->_generation_queue->get_message_repository()->is_preview()
486
-		     && ! $this->_current_messenger->allow_empty_to_field() ) {
486
+		     && ! $this->_current_messenger->allow_empty_to_field()) {
487 487
 			//we silently exit here and do NOT record a fail because the message is "turned off" by having no "to" field.
488 488
 			return false;
489 489
 		}
490 490
 		$error_msg = array();
491
-		foreach ( $templates as $field => $field_context ) {
491
+		foreach ($templates as $field => $field_context) {
492 492
 			$error_msg = array();
493 493
 			//let's setup the valid shortcodes for the incoming context.
494
-			$valid_shortcodes = $mt_shortcodes[ $context ];
494
+			$valid_shortcodes = $mt_shortcodes[$context];
495 495
 			//merge in valid shortcodes for the field.
496
-			$shortcodes = isset($m_shortcodes[ $field ]) ? $m_shortcodes[ $field ] : $valid_shortcodes;
497
-			if ( isset( $templates[ $field ][ $context ] ) ) {
496
+			$shortcodes = isset($m_shortcodes[$field]) ? $m_shortcodes[$field] : $valid_shortcodes;
497
+			if (isset($templates[$field][$context])) {
498 498
 				//prefix field.
499
-				$column_name = 'MSG_' . $field;
499
+				$column_name = 'MSG_'.$field;
500 500
 				try {
501 501
 					$content = $this->_shortcode_parser->parse_message_template(
502
-						$templates[ $field ][ $context ],
502
+						$templates[$field][$context],
503 503
 						$recipient,
504 504
 						$shortcodes,
505 505
 						$this->_current_message_type,
506 506
 						$this->_current_messenger,
507 507
 						$message );
508
-					$message->set_field_or_extra_meta( $column_name, $content );
509
-				} catch ( EE_Error $e ) {
510
-					$error_msg[] = sprintf( __( 'There was a problem generating the content for the field %s: %s', 'event_espresso' ), $field, $e->getMessage() );
511
-					$message->set_STS_ID( EEM_Message::status_failed );
508
+					$message->set_field_or_extra_meta($column_name, $content);
509
+				} catch (EE_Error $e) {
510
+					$error_msg[] = sprintf(__('There was a problem generating the content for the field %s: %s', 'event_espresso'), $field, $e->getMessage());
511
+					$message->set_STS_ID(EEM_Message::status_failed);
512 512
 				}
513 513
 			}
514 514
 		}
515 515
 
516
-		if ( $message->STS_ID() === EEM_Message::status_failed ) {
517
-			$error_msg = __( 'There were problems generating this message:', 'event_espresso' ) . "\n" . implode( "\n", $error_msg );
518
-			$message->set_error_message( $error_msg );
516
+		if ($message->STS_ID() === EEM_Message::status_failed) {
517
+			$error_msg = __('There were problems generating this message:', 'event_espresso')."\n".implode("\n", $error_msg);
518
+			$message->set_error_message($error_msg);
519 519
 		} else {
520
-			$message->set_STS_ID( EEM_Message::status_idle );
520
+			$message->set_STS_ID(EEM_Message::status_idle);
521 521
 		}
522 522
 		return $message;
523 523
 	}
@@ -551,14 +551,14 @@  discard block
 block discarded – undo
551 551
 	 * @param array $addressees  Keys correspond to contexts for the message type and values are EE_Messages_Addressee[]
552 552
 	 * @return bool
553 553
 	 */
554
-	protected function _valid_addressees( $addressees ) {
555
-		if ( ! $addressees || ! is_array( $addressees ) ) {
554
+	protected function _valid_addressees($addressees) {
555
+		if ( ! $addressees || ! is_array($addressees)) {
556 556
 			return false;
557 557
 		}
558 558
 
559
-		foreach( $addressees as $addressee_array ) {
560
-			foreach ( $addressee_array as $addressee ) {
561
-				if ( ! $addressee instanceof EE_Messages_Addressee ) {
559
+		foreach ($addressees as $addressee_array) {
560
+			foreach ($addressee_array as $addressee) {
561
+				if ( ! $addressee instanceof EE_Messages_Addressee) {
562 562
 					return false;
563 563
 				}
564 564
 			}
@@ -579,19 +579,19 @@  discard block
 block discarded – undo
579 579
 	protected function _validate_messenger_and_message_type() {
580 580
 
581 581
 		//first are there any existing error messages?  If so then return.
582
-		if ( $this->_error_msg ) {
582
+		if ($this->_error_msg) {
583 583
 			return false;
584 584
 		}
585 585
 		/** @type EE_Message $message */
586 586
 		$message = $this->_generation_queue->get_message_repository()->current();
587 587
 		try {
588
-			$this->_current_messenger = $message->valid_messenger( true ) ? $message->messenger_object() : null;
589
-		} catch ( Exception $e ) {
588
+			$this->_current_messenger = $message->valid_messenger(true) ? $message->messenger_object() : null;
589
+		} catch (Exception $e) {
590 590
 			$this->_error_msg[] = $e->getMessage();
591 591
 		}
592 592
 		try {
593
-			$this->_current_message_type = $message->valid_message_type( true ) ? $message->message_type_object() : null;
594
-		} catch ( Exception $e ) {
593
+			$this->_current_message_type = $message->valid_message_type(true) ? $message->message_type_object() : null;
594
+		} catch (Exception $e) {
595 595
 			$this->_error_msg[] = $e->getMessage();
596 596
 		}
597 597
 
@@ -603,10 +603,10 @@  discard block
 block discarded – undo
603 603
 			     ! $this->_generation_queue->get_message_repository()->is_preview()
604 604
 			     && $this->_generation_queue->get_message_repository()->get_data_handler() !== 'EE_Messages_Preview_incoming_data' )
605 605
 		) {
606
-			$this->_error_msg[] = __( 'There is no generation data for this message. Unable to generate.' );
606
+			$this->_error_msg[] = __('There is no generation data for this message. Unable to generate.');
607 607
 		}
608 608
 
609
-		return empty( $this->_error_msg );
609
+		return empty($this->_error_msg);
610 610
 	}
611 611
 
612 612
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 
624 624
 		//First, are there any existing error messages?  If so, return because if there were errors elsewhere this can't
625 625
 		//be used anyways.
626
-		if ( $this->_error_msg ) {
626
+		if ($this->_error_msg) {
627 627
 			return false;
628 628
 		}
629 629
 
@@ -632,29 +632,29 @@  discard block
 block discarded – undo
632 632
 		/** @type EE_Messages_incoming_data $data_handler_class_name - well not really... just the class name actually */
633 633
 		$data_handler_class_name = $this->_generation_queue->get_message_repository()->get_data_handler()
634 634
 			? $this->_generation_queue->get_message_repository()->get_data_handler()
635
-			: 'EE_Messages_' .  $this->_current_message_type->get_data_handler( $generation_data ) . '_incoming_data';
635
+			: 'EE_Messages_'.$this->_current_message_type->get_data_handler($generation_data).'_incoming_data';
636 636
 
637 637
 		//If this EE_Message is for a preview, then let's switch out to the preview data handler.
638
-		if ( $this->_generation_queue->get_message_repository()->is_preview() ) {
639
-			$data_handler_class_name  = 'EE_Messages_Preview_incoming_data';
638
+		if ($this->_generation_queue->get_message_repository()->is_preview()) {
639
+			$data_handler_class_name = 'EE_Messages_Preview_incoming_data';
640 640
 		}
641 641
 
642 642
 		//First get the class name for the data handler (and also verifies it exists.
643
-		if ( ! class_exists( $data_handler_class_name ) ) {
643
+		if ( ! class_exists($data_handler_class_name)) {
644 644
 			$this->_error_msg[] = sprintf(
645
-				__( 'The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso' ),
645
+				__('The included data handler class name does not match any valid, accessible, "EE_Messages_incoming_data" classes.  Looking for %s.', 'event_espresso'),
646 646
 				$data_handler_class_name
647 647
 			);
648 648
 			return false;
649 649
 		}
650 650
 
651 651
 		//convert generation_data for data_handler_instantiation.
652
-		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage( $generation_data );
652
+		$generation_data = $data_handler_class_name::convert_data_from_persistent_storage($generation_data);
653 653
 
654 654
 		//note, this may set error messages as well.
655
-		$this->_set_data_handler( $generation_data, $data_handler_class_name );
655
+		$this->_set_data_handler($generation_data, $data_handler_class_name);
656 656
 
657
-		return empty( $this->_error_msg );
657
+		return empty($this->_error_msg);
658 658
 	}
659 659
 
660 660
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 *
672 672
 	 * @return void.
673 673
 	 */
674
-	protected function _set_data_handler( $generating_data, $data_handler_class_name ) {
674
+	protected function _set_data_handler($generating_data, $data_handler_class_name) {
675 675
 		//valid classname for the data handler.  Now let's setup the key for the data handler repository to see if there
676 676
 		//is already a ready data handler in the repository.
677
-		$this->_current_data_handler = $this->_data_handler_collection->get_by_key( $this->_data_handler_collection->get_key( $data_handler_class_name, $generating_data ) );
678
-		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data ) {
677
+		$this->_current_data_handler = $this->_data_handler_collection->get_by_key($this->_data_handler_collection->get_key($data_handler_class_name, $generating_data));
678
+		if ( ! $this->_current_data_handler instanceof EE_messages_incoming_data) {
679 679
 			//no saved data_handler in the repo so let's set one up and add it to the repo.
680 680
 			try {
681
-				$this->_current_data_handler = new $data_handler_class_name( $generating_data );
682
-				$this->_data_handler_collection->add( $this->_current_data_handler, $generating_data );
683
-			} catch( EE_Error $e ) {
681
+				$this->_current_data_handler = new $data_handler_class_name($generating_data);
682
+				$this->_data_handler_collection->add($this->_current_data_handler, $generating_data);
683
+			} catch (EE_Error $e) {
684 684
 				$this->_error_msg[] = $e->get_error();
685 685
 			}
686 686
 		}
@@ -700,13 +700,13 @@  discard block
 block discarded – undo
700 700
 	 * @param bool                   $preview Indicate whether this is being used for a preview or not.
701 701
 	 * @return mixed Prepped data for persisting to the queue.  false is returned if unable to prep data.
702 702
 	 */
703
-	protected function _prepare_data_for_queue( EE_Message_To_Generate $message_to_generate, $preview ) {
703
+	protected function _prepare_data_for_queue(EE_Message_To_Generate $message_to_generate, $preview) {
704 704
 		/** @type EE_Messages_incoming_data $data_handler - well not really... just the class name actually */
705
-		$data_handler = $message_to_generate->get_data_handler_class_name( $preview );
706
-		if ( ! $message_to_generate->valid() ) {
705
+		$data_handler = $message_to_generate->get_data_handler_class_name($preview);
706
+		if ( ! $message_to_generate->valid()) {
707 707
 			return false; //unable to get the data because the info in the EE_Message_To_Generate class is invalid.
708 708
 		}
709
-		return $data_handler::convert_data_for_persistent_storage( $message_to_generate->data() );
709
+		return $data_handler::convert_data_for_persistent_storage($message_to_generate->data());
710 710
 	}
711 711
 
712 712
 
@@ -719,26 +719,26 @@  discard block
 block discarded – undo
719 719
 	 * @param EE_Message_To_Generate $message_to_generate
720 720
 	 * @param bool                   $test_send Whether this is just a test send or not.  Typically used for previews.
721 721
 	 */
722
-	public function create_and_add_message_to_queue( EE_Message_To_Generate $message_to_generate, $test_send = false ) {
722
+	public function create_and_add_message_to_queue(EE_Message_To_Generate $message_to_generate, $test_send = false) {
723 723
 		//prep data
724
-		$data = $this->_prepare_data_for_queue( $message_to_generate, $message_to_generate->preview() );
724
+		$data = $this->_prepare_data_for_queue($message_to_generate, $message_to_generate->preview());
725 725
 
726 726
 		$message = $message_to_generate->get_EE_Message();
727 727
 
728 728
 		//is there a GRP_ID in the request?
729
-		if ( $GRP_ID = EE_Registry::instance()->REQ->get( 'GRP_ID' ) ) {
730
-			$message->set_GRP_ID( $GRP_ID );
729
+		if ($GRP_ID = EE_Registry::instance()->REQ->get('GRP_ID')) {
730
+			$message->set_GRP_ID($GRP_ID);
731 731
 		}
732 732
 
733
-		if ( $data === false ) {
734
-			$message->set_STS_ID( EEM_Message::status_failed );
735
-			$message->set_error_message( __( 'Unable to prepare data for persistence to the database.', 'event_espresso' ) );
733
+		if ($data === false) {
734
+			$message->set_STS_ID(EEM_Message::status_failed);
735
+			$message->set_error_message(__('Unable to prepare data for persistence to the database.', 'event_espresso'));
736 736
 		} else {
737 737
 			//make sure that the data handler is cached on the message as well
738 738
 			$data['data_handler_class_name'] = $message_to_generate->get_data_handler_class_name();
739 739
 		}
740 740
 
741
-		$this->_generation_queue->add( $message, $data, $message_to_generate->preview(), $test_send );
741
+		$this->_generation_queue->add($message, $data, $message_to_generate->preview(), $test_send);
742 742
 	}
743 743
 
744 744
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/InvalidFormHandlerException.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\form_sections\form_handlers;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -26,8 +26,8 @@  discard block
 block discarded – undo
26 26
 	 * @param int        $code
27 27
 	 * @param \Exception $previous
28 28
 	 */
29
-	public function __construct( $actual, $message = '', $code = 0, \Exception $previous = null ) {
30
-		if ( empty( $message ) ) {
29
+	public function __construct($actual, $message = '', $code = 0, \Exception $previous = null) {
30
+		if (empty($message)) {
31 31
 			$message = sprintf(
32 32
 				__(
33 33
 					'A valid Form Handler was expected but instead "%1$s" was received.',
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 				$actual
37 37
 			);
38 38
 		}
39
-		parent::__construct( $message, $code, $previous );
39
+		parent::__construct($message, $code, $previous);
40 40
 	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/FormHandlerInterface.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EE_Form_Section_Proper;
5 5
 
6
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
7
-	exit( 'No direct script access allowed' );
6
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	/**
37 37
 	 * @param \EE_Form_Section_Proper $form
38 38
 	 */
39
-	public function setForm( \EE_Form_Section_Proper $form );
39
+	public function setForm(\EE_Form_Section_Proper $form);
40 40
 
41 41
 
42 42
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * @param boolean $displayable
55 55
 	 */
56
-	public function setDisplayable( $displayable = false );
56
+	public function setDisplayable($displayable = false);
57 57
 
58 58
 
59 59
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	/**
95 95
 	 * @param string $submit_btn_text
96 96
 	 */
97
-	public function setSubmitBtnText( $submit_btn_text );
97
+	public function setSubmitBtnText($submit_btn_text);
98 98
 
99 99
 
100 100
 
@@ -108,14 +108,14 @@  discard block
 block discarded – undo
108 108
 	/**
109 109
 	 * @param string $form_action
110 110
 	 */
111
-	public function setFormAction( $form_action );
111
+	public function setFormAction($form_action);
112 112
 
113 113
 
114 114
 
115 115
 	/**
116 116
 	 * @param array $form_args
117 117
 	 */
118
-	public function addFormActionArgs( $form_args = array() );
118
+	public function addFormActionArgs($form_args = array());
119 119
 
120 120
 
121 121
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 *
136 136
 	 * @param string $form_config
137 137
 	 */
138
-	public function setFormConfig( $form_config );
138
+	public function setFormConfig($form_config);
139 139
 
140 140
 
141 141
 
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 	 * @param array $submitted_form_data
188 188
 	 * @return bool
189 189
 	 */
190
-	public function process( $submitted_form_data = array() );
190
+	public function process($submitted_form_data = array());
191 191
 
192 192
 
193 193
 
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	 * @param string $text
198 198
 	 * @return \EE_Submit_Input
199 199
 	 */
200
-	public function generateSubmitButton( $text = '' );
200
+	public function generateSubmitButton($text = '');
201 201
 
202 202
 
203 203
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param string $text
217 217
 	 * @return \EE_Submit_Input
218 218
 	 */
219
-	public function generateCancelButton( $text = '' );
219
+	public function generateCancelButton($text = '');
220 220
 
221 221
 
222 222
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/SequentialStepFormInterface.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidDataTypeException;
5 5
 use InvalidArgumentException;
6 6
 
7
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
8
-	exit( 'No direct script access allowed' );
7
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
8
+	exit('No direct script access allowed');
9 9
 }
10 10
 
11 11
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @param int $order
33 33
 	 * @throws InvalidArgumentException
34 34
 	 */
35
-	public function setOrder( $order );
35
+	public function setOrder($order);
36 36
 
37 37
 
38 38
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 * @throws InvalidDataTypeException
49 49
 	 * @throws InvalidArgumentException
50 50
 	 */
51
-	public function setRedirectUrl( $redirect_url );
51
+	public function setRedirectUrl($redirect_url);
52 52
 
53 53
 
54 54
 
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @throws InvalidDataTypeException
58 58
 	 * @throws InvalidArgumentException
59 59
 	 */
60
-	public function addRedirectArgs( $redirect_args = array() );
60
+	public function addRedirectArgs($redirect_args = array());
61 61
 
62 62
 
63 63
 
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 	/**
72 72
 	 * @param string $redirect_to
73 73
 	 */
74
-	public function setRedirectTo( $redirect_to );
74
+	public function setRedirectTo($redirect_to);
75 75
 
76 76
 
77 77
 
Please login to merge, or discard this patch.