Completed
Branch BUG-8372-txn-meta-box-errors (d9e527)
by
unknown
33:55 queued 16:24
created
core/libraries/rest_api/controllers/model/Meta.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 
4 4
 use EventEspresso\core\libraries\rest_api\Model_Data_Translator;
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
 /**
@@ -25,20 +25,20 @@  discard block
 block discarded – undo
25 25
 	 * @param \WP_REST_Request $request
26 26
 	 * @return array|\WP_REST_Response
27 27
 	 */
28
-	public static function handle_request_models_meta( \WP_REST_Request $request ) {
28
+	public static function handle_request_models_meta(\WP_REST_Request $request) {
29 29
 		$controller = new Meta();
30
-		try{
30
+		try {
31 31
 			$matches = $controller->parse_route(
32 32
 				$request->get_route(),
33
-				'~' . \EED_Core_Rest_Api::ee_api_namespace_for_regex . 'resources~',
34
-				array( 'version' ) );
35
-			if( $matches instanceof \WP_REST_Response ) {
33
+				'~'.\EED_Core_Rest_Api::ee_api_namespace_for_regex.'resources~',
34
+				array('version') );
35
+			if ($matches instanceof \WP_REST_Response) {
36 36
 				return $matches;
37 37
 			}
38
-			$controller->set_requested_version( $matches[ 'version' ] );
39
-			return $controller->send_response( $controller->_get_models_metadata_entity() );
40
-		} catch( \Exception $e ) {
41
-			return $controller->send_response( $e );
38
+			$controller->set_requested_version($matches['version']);
39
+			return $controller->send_response($controller->_get_models_metadata_entity());
40
+		} catch (\Exception $e) {
41
+			return $controller->send_response($e);
42 42
 		}
43 43
 	}
44 44
 
@@ -46,22 +46,22 @@  discard block
 block discarded – undo
46 46
 	 * Gets the model metadata resource entity
47 47
 	 * @return array for JSON response, describing all the models available in teh requested version
48 48
 	 */
49
-	protected function _get_models_metadata_entity(){
49
+	protected function _get_models_metadata_entity() {
50 50
 		$response = array();
51
-		foreach( $this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname ){
52
-			$model = $this->get_model_version_info()->load_model( $model_name );
51
+		foreach ($this->get_model_version_info()->models_for_requested_version() as $model_name => $model_classname) {
52
+			$model = $this->get_model_version_info()->load_model($model_name);
53 53
 			$fields_json = array();
54
-			foreach( $this->get_model_version_info()->fields_on_model_in_this_version( $model ) as $field_name => $field_obj ) {
55
-				if( $this->get_model_version_info()->field_is_ignored( $field_obj ) ) {
54
+			foreach ($this->get_model_version_info()->fields_on_model_in_this_version($model) as $field_name => $field_obj) {
55
+				if ($this->get_model_version_info()->field_is_ignored($field_obj)) {
56 56
 					continue;
57 57
 				}
58
-				if( $field_obj instanceof \EE_Boolean_Field ) {
58
+				if ($field_obj instanceof \EE_Boolean_Field) {
59 59
 					$datatype = 'Boolean';
60
-				}elseif( $field_obj->get_wpdb_data_type() == '%d' ) {
60
+				}elseif ($field_obj->get_wpdb_data_type() == '%d') {
61 61
 					$datatype = 'Number';
62
-				}elseif( $field_name instanceof \EE_Serialized_Text_Field ) {
62
+				}elseif ($field_name instanceof \EE_Serialized_Text_Field) {
63 63
 					$datatype = 'Object';
64
-				}else{
64
+				} else {
65 65
 					$datatype = 'String';
66 66
 				}
67 67
 				$default_value = Model_Data_Translator::prepare_field_value_for_json(
@@ -72,30 +72,30 @@  discard block
 block discarded – undo
72 72
 				$field_json = array(
73 73
 					'name' => $field_name,
74 74
 					'nicename' => $field_obj->get_nicename(),
75
-					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format( $field_obj ),
76
-					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format( $field_obj ),
77
-					'type' => str_replace('EE_', '', get_class( $field_obj ) ),
75
+					'has_rendered_format' => $this->get_model_version_info()->field_has_rendered_format($field_obj),
76
+					'has_pretty_format' => $this->get_model_version_info()->field_has_pretty_format($field_obj),
77
+					'type' => str_replace('EE_', '', get_class($field_obj)),
78 78
 					'datatype' => $datatype,
79 79
 					'nullable' => $field_obj->is_nullable(),
80 80
 					'default' => $default_value,
81 81
 					'table_alias' => $field_obj->get_table_alias(),
82 82
 					'table_column' => $field_obj->get_table_column(),
83 83
 				);
84
-				$fields_json[ $field_json[ 'name' ] ] = $field_json;
84
+				$fields_json[$field_json['name']] = $field_json;
85 85
 
86 86
 			}
87
-			$fields_json = array_merge( $fields_json, $this->get_model_version_info()->extra_resource_properties_for_model( $model ) );
88
-			$response[ $model_name ]['fields'] = apply_filters( 'FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model );
87
+			$fields_json = array_merge($fields_json, $this->get_model_version_info()->extra_resource_properties_for_model($model));
88
+			$response[$model_name]['fields'] = apply_filters('FHEE__Meta__handle_request_models_meta__fields', $fields_json, $model);
89 89
 			$relations_json = array();
90
-			foreach( $model->relation_settings()  as $relation_name => $relation_obj ) {
90
+			foreach ($model->relation_settings()  as $relation_name => $relation_obj) {
91 91
 				$relation_json = array(
92 92
 					'name' => $relation_name,
93
-					'type' => str_replace( 'EE_', '', get_class( $relation_obj ) ),
93
+					'type' => str_replace('EE_', '', get_class($relation_obj)),
94 94
 					'single' => $relation_obj instanceof \EE_Belongs_To_Relation ? true : false,
95 95
 				);
96
-				$relations_json[ $relation_name ] = $relation_json;
96
+				$relations_json[$relation_name] = $relation_json;
97 97
 			}
98
-			$response[ $model_name ][ 'relations' ] = apply_filters( 'FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model );
98
+			$response[$model_name]['relations'] = apply_filters('FHEE__Meta__handle_request_models_meta__relations', $relations_json, $model);
99 99
 		}
100 100
 		return $response;
101 101
 	}
@@ -105,24 +105,24 @@  discard block
 block discarded – undo
105 105
 	 * @param \WP_REST_Response $rest_response_obj
106 106
 	 * @return \WP_REST_Response
107 107
 	 */
108
-	public static function filter_ee_metadata_into_index( \WP_REST_Response $rest_response_obj ) {
108
+	public static function filter_ee_metadata_into_index(\WP_REST_Response $rest_response_obj) {
109 109
 		$response_data = $rest_response_obj->get_data();
110 110
 		$addons = array();
111
-		foreach( \EE_Registry::instance()->addons as $addon){
111
+		foreach (\EE_Registry::instance()->addons as $addon) {
112 112
 			$addon_json = array(
113 113
 				'name' => $addon->name(),
114 114
 				'version' => $addon->version()
115 115
 			);
116
-			$addons[ $addon_json[ 'name' ] ] = $addon_json;
116
+			$addons[$addon_json['name']] = $addon_json;
117 117
 		}
118
-		$response_data[ 'ee' ] = array(
118
+		$response_data['ee'] = array(
119 119
 			'version' => \EEM_System_Status::instance()->get_ee_version(),
120 120
 			'documentation_url' => 'https://github.com/eventespresso/event-espresso-core/tree/master/docs/C--REST-API',
121 121
 			'addons' => $addons,
122 122
 			'maintenance_mode' => \EE_Maintenance_Mode::instance()->real_level(),
123
-			'served_core_versions' => array_keys( \EED_Core_Rest_Api::versions_served() ),
123
+			'served_core_versions' => array_keys(\EED_Core_Rest_Api::versions_served()),
124 124
 		);
125
-		$rest_response_obj->set_data( $response_data );
125
+		$rest_response_obj->set_data($response_data);
126 126
 		return $rest_response_obj;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
core/libraries/rest_api/controllers/config/Read.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\libraries\rest_api\controllers\config;
3
-if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
4
-	exit( 'No direct script access allowed' );
3
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
+	exit('No direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 * @param \WP_REST_Request $request
22 22
 	 * @return \EE_Config|\WP_Error
23 23
 	 */
24
-	public static function handle_request( \WP_REST_Request $request) {
24
+	public static function handle_request(\WP_REST_Request $request) {
25 25
 		$cap = \EE_Restriction_Generator_Base::get_default_restrictions_cap();
26
-		if( \EE_Capabilities::instance()->current_user_can( $cap, 'read_over_api' ) ){
26
+		if (\EE_Capabilities::instance()->current_user_can($cap, 'read_over_api')) {
27 27
 			return \EE_Config::instance();
28
-		}else{
28
+		} else {
29 29
 			return new \WP_Error(
30 30
 				'cannot_read_config',
31 31
 				sprintf(
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 					),
36 36
 					$cap
37 37
 				),
38
-				array( 'status' => 403 )
38
+				array('status' => 403)
39 39
 			);
40 40
 		}
41 41
 	}
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	 * @param \WP_REST_Request $request
46 46
 	 * @return \EE_Config|\WP_Error
47 47
 	 */
48
-	public static function handle_request_site_info( \WP_REST_Request $request) {
48
+	public static function handle_request_site_info(\WP_REST_Request $request) {
49 49
 		return array(
50 50
 			'default_timezone' => array(
51 51
 				'pretty' => \EEH_DTT_Helper::get_timezone_string_for_display(),
52
-				'string' => get_option( 'timezone_string' ),
52
+				'string' => get_option('timezone_string'),
53 53
 				'offset' => \EEH_DTT_Helper::get_site_timezone_gmt_offset(),
54 54
 			),
55 55
 			'default_currency' => \EE_Config::instance()->currency
Please login to merge, or discard this patch.
core/helpers/EEH_DTT_Helper.helper.php 1 patch
Spacing   +142 added lines, -143 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 * @throws \EE_Error
55 55
 	 */
56
-	public static function get_valid_timezone_string( $timezone_string = '' ) {
56
+	public static function get_valid_timezone_string($timezone_string = '') {
57 57
 		// if passed a value, then use that, else get WP option
58
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
58
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
59 59
 		// value from above exists, use that, else get timezone string from gmt_offset
60
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
-		EEH_DTT_Helper::validate_timezone( $timezone_string );
60
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_gmt_offset();
61
+		EEH_DTT_Helper::validate_timezone($timezone_string);
62 62
 		return $timezone_string;
63 63
 	}
64 64
 
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @return bool
75 75
 	 * @throws \EE_Error
76 76
 	 */
77
-	public static function validate_timezone( $timezone_string, $throw_error = true ) {
77
+	public static function validate_timezone($timezone_string, $throw_error = true) {
78 78
 		// easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it
79 79
 		try {
80
-			new DateTimeZone( $timezone_string );
81
-		} catch ( Exception $e ) {
80
+			new DateTimeZone($timezone_string);
81
+		} catch (Exception $e) {
82 82
 			// sometimes we take exception to exceptions
83
-			if ( ! $throw_error ) {
83
+			if ( ! $throw_error) {
84 84
 				return false;
85 85
 			}
86 86
 			throw new EE_Error(
87 87
 				sprintf(
88
-					__( 'The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
88
+					__('The timezone given (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
89 89
 					$timezone_string,
90 90
 					'<a href="http://www.php.net/manual/en/timezones.php">',
91 91
 					'</a>'
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 * @param string $gmt_offset
105 105
 	 * @return string
106 106
 	 */
107
-	public static function get_timezone_string_from_gmt_offset( $gmt_offset = '' ) {
107
+	public static function get_timezone_string_from_gmt_offset($gmt_offset = '') {
108 108
 		$timezone_string = 'UTC';
109
-		$gmt_offset = ! empty( $gmt_offset ) ? $gmt_offset : get_option( 'gmt_offset' );
110
-		if ( $gmt_offset !== '' ) {
109
+		$gmt_offset = ! empty($gmt_offset) ? $gmt_offset : get_option('gmt_offset');
110
+		if ($gmt_offset !== '') {
111 111
 			// convert GMT offset to seconds
112 112
 			$gmt_offset = $gmt_offset * HOUR_IN_SECONDS;
113 113
 			// account for WP offsets that aren't valid UTC
114
-			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets( $gmt_offset );
114
+			$gmt_offset = EEH_DTT_Helper::adjust_invalid_gmt_offsets($gmt_offset);
115 115
 			// although we don't know the TZ abbreviation, we know the UTC offset
116
-			$timezone_string = timezone_name_from_abbr( null, $gmt_offset );
116
+			$timezone_string = timezone_name_from_abbr(null, $gmt_offset);
117 117
 		}
118 118
 		// better have a valid timezone string by now, but if not, sigh... loop thru  the timezone_abbreviations_list()...
119
-		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list( $gmt_offset );
119
+		$timezone_string = $timezone_string !== false ? $timezone_string : EEH_DTT_Helper::get_timezone_string_from_abbreviations_list($gmt_offset);
120 120
 		return $timezone_string;
121 121
 	}
122 122
 	
@@ -127,15 +127,15 @@  discard block
 block discarded – undo
127 127
 	 * @return int seconds offset
128 128
 	 */
129 129
 	public static function get_site_timezone_gmt_offset() {
130
-		$timezone_string = get_option( 'timezone_string' );
131
-		if ( $timezone_string ) {
130
+		$timezone_string = get_option('timezone_string');
131
+		if ($timezone_string) {
132 132
 			try {
133
-				$timezone = new DateTimeZone( $timezone_string );
134
-				return $timezone->getOffset( new DateTime() ); //in WordPress DateTime defaults to UTC
135
-			} catch( Exception $e ){}
133
+				$timezone = new DateTimeZone($timezone_string);
134
+				return $timezone->getOffset(new DateTime()); //in WordPress DateTime defaults to UTC
135
+			} catch (Exception $e) {}
136 136
 		}
137
-		$offset = get_option( 'gmt_offset' );
138
-		return (int) ( $offset * HOUR_IN_SECONDS );
137
+		$offset = get_option('gmt_offset');
138
+		return (int) ($offset * HOUR_IN_SECONDS);
139 139
 	}
140 140
 
141 141
 
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
 	 * @param int $gmt_offset
148 148
 	 * @return int
149 149
 	 */
150
-	public static function adjust_invalid_gmt_offsets( $gmt_offset = 0 ) {
150
+	public static function adjust_invalid_gmt_offsets($gmt_offset = 0) {
151 151
 		//make sure $gmt_offset is int
152 152
 		$gmt_offset = (int) $gmt_offset;
153
-		switch ( $gmt_offset ) {
153
+		switch ($gmt_offset) {
154 154
 
155 155
 			//			case -30600 :
156 156
 			//				$gmt_offset = -28800;
@@ -202,13 +202,13 @@  discard block
 block discarded – undo
202 202
 	 * @return string
203 203
 	 * @throws \EE_Error
204 204
 	 */
205
-	public static function get_timezone_string_from_abbreviations_list( $gmt_offset = 0 ) {
205
+	public static function get_timezone_string_from_abbreviations_list($gmt_offset = 0) {
206 206
 		$abbreviations = timezone_abbreviations_list();
207
-		foreach ( $abbreviations as $abbreviation ) {
208
-			foreach ( $abbreviation as $city ) {
209
-				if ( $city['offset'] === $gmt_offset && $city['dst'] === FALSE ) {
207
+		foreach ($abbreviations as $abbreviation) {
208
+			foreach ($abbreviation as $city) {
209
+				if ($city['offset'] === $gmt_offset && $city['dst'] === FALSE) {
210 210
 					// check if the timezone is valid but don't throw any errors if it isn't
211
-					if ( EEH_DTT_Helper::validate_timezone( $city['timezone_id'], false ) ) {
211
+					if (EEH_DTT_Helper::validate_timezone($city['timezone_id'], false)) {
212 212
 						return $city['timezone_id'];
213 213
 					}
214 214
 				}
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		}
217 217
 		throw new EE_Error(
218 218
 			sprintf(
219
-				__( 'The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso' ),
219
+				__('The provided GMT offset (%1$s), is invalid, please check with %2$sthis list%3$s for what valid timezones can be used', 'event_espresso'),
220 220
 				$gmt_offset,
221 221
 				'<a href="http://www.php.net/manual/en/timezones.php">',
222 222
 				'</a>'
@@ -230,23 +230,23 @@  discard block
 block discarded – undo
230 230
 	 * @access public
231 231
 	 * @param string $timezone_string
232 232
 	 */
233
-	public static function timezone_select_input( $timezone_string = '' ) {
233
+	public static function timezone_select_input($timezone_string = '') {
234 234
 		// get WP date time format
235
-		$datetime_format = get_option('date_format') . ' '  . get_option('time_format');
235
+		$datetime_format = get_option('date_format').' '.get_option('time_format');
236 236
 		// if passed a value, then use that, else get WP option
237
-		$timezone_string = ! empty( $timezone_string ) ? $timezone_string : get_option( 'timezone_string' );
237
+		$timezone_string = ! empty($timezone_string) ? $timezone_string : get_option('timezone_string');
238 238
 		// check if the timezone is valid but don't throw any errors if it isn't
239
-		$timezone_string = EEH_DTT_Helper::validate_timezone( $timezone_string, false );
239
+		$timezone_string = EEH_DTT_Helper::validate_timezone($timezone_string, false);
240 240
 		$gmt_offset = get_option('gmt_offset');
241 241
 
242 242
 		$check_zone_info = true;
243
-		if ( empty( $timezone_string )) {
243
+		if (empty($timezone_string)) {
244 244
 			// Create a UTC+- zone if no timezone string exists
245 245
 			$check_zone_info = false;
246
-			if ( $gmt_offset > 0 ) {
247
-				$timezone_string = 'UTC+' . $gmt_offset;
248
-			} elseif ( $gmt_offset < 0 ) {
249
-				$timezone_string = 'UTC' . $gmt_offset;
246
+			if ($gmt_offset > 0) {
247
+				$timezone_string = 'UTC+'.$gmt_offset;
248
+			} elseif ($gmt_offset < 0) {
249
+				$timezone_string = 'UTC'.$gmt_offset;
250 250
 			} else {
251 251
 				$timezone_string = 'UTC';
252 252
 			}
@@ -268,11 +268,11 @@  discard block
 block discarded – undo
268 268
 					__('%1$sUTC%2$s time is %3$s'),
269 269
 					'<abbr title="Coordinated Universal Time">',
270 270
 					'</abbr>',
271
-					'<code>' . date_i18n( $datetime_format , false, 'gmt') . '</code>'
271
+					'<code>'.date_i18n($datetime_format, false, 'gmt').'</code>'
272 272
 				);
273 273
 				?></span>
274
-			<?php if ( ! empty( $timezone_string ) || ! empty( $gmt_offset )) : ?>
275
-				<br /><span><?php printf(__('Local time is %1$s'), '<code>' . date_i18n( $datetime_format ) . '</code>' ); ?></span>
274
+			<?php if ( ! empty($timezone_string) || ! empty($gmt_offset)) : ?>
275
+				<br /><span><?php printf(__('Local time is %1$s'), '<code>'.date_i18n($datetime_format).'</code>'); ?></span>
276 276
 		<?php endif; ?>
277 277
 
278 278
 				<?php if ($check_zone_info && $timezone_string) : ?>
@@ -304,10 +304,9 @@  discard block
 block discarded – undo
304 304
 
305 305
 						if ($found) {
306 306
 							$message = $tr['isdst'] ?
307
-											__(' Daylight saving time begins on: %s.' ) :
308
-											__(' Standard time begins  on: %s.');
307
+											__(' Daylight saving time begins on: %s.') : __(' Standard time begins  on: %s.');
309 308
 							// Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n().
310
-							printf( $message, '<code >' . date_i18n( $datetime_format, $tr['ts'] + ( $tz_offset - $tr['offset'] ) ). '</code >' );
309
+							printf($message, '<code >'.date_i18n($datetime_format, $tr['ts'] + ($tz_offset - $tr['offset'])).'</code >');
311 310
 						} else {
312 311
 							_e('This timezone does not observe daylight saving time.');
313 312
 						}
@@ -337,14 +336,14 @@  discard block
 block discarded – undo
337 336
 	 *
338 337
 	 * @return int      $unix_timestamp with the offset applied for the given timezone.
339 338
 	 */
340
-	public static function get_timestamp_with_offset( $unix_timestamp = 0, $timezone_string = '' ) {
339
+	public static function get_timestamp_with_offset($unix_timestamp = 0, $timezone_string = '') {
341 340
 		$unix_timestamp = $unix_timestamp === 0 ? time() : (int) $unix_timestamp;
342
-		$timezone_string = self::get_valid_timezone_string( $timezone_string );
343
-		$TimeZone = new DateTimeZone( $timezone_string );
341
+		$timezone_string = self::get_valid_timezone_string($timezone_string);
342
+		$TimeZone = new DateTimeZone($timezone_string);
344 343
 
345
-		$DateTime = new DateTime( '@' . $unix_timestamp, $TimeZone );
346
-		$offset = timezone_offset_get( $TimeZone, $DateTime );
347
-		return (int)$DateTime->format( 'U' ) + (int)$offset;
344
+		$DateTime = new DateTime('@'.$unix_timestamp, $TimeZone);
345
+		$offset = timezone_offset_get($TimeZone, $DateTime);
346
+		return (int) $DateTime->format('U') + (int) $offset;
348 347
 	}
349 348
 
350 349
 
@@ -359,17 +358,17 @@  discard block
 block discarded – undo
359 358
 	 * @param  string					$datetime_field_name 	the datetime fieldname to be manipulated
360 359
 	 * @return 	EE_Base_Class
361 360
 	 */
362
-	protected static function _set_date_time_field( EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name ) {
361
+	protected static function _set_date_time_field(EE_Base_Class $obj, DateTime $DateTime, $datetime_field_name) {
363 362
 		// grab current datetime format
364 363
 		$current_format = $obj->get_format();
365 364
 		// set new full timestamp format
366
-		$obj->set_date_format( EE_Datetime_Field::mysql_date_format );
367
-		$obj->set_time_format( EE_Datetime_Field::mysql_time_format );
365
+		$obj->set_date_format(EE_Datetime_Field::mysql_date_format);
366
+		$obj->set_time_format(EE_Datetime_Field::mysql_time_format);
368 367
 		// set the new date value using a full timestamp format so that no data is lost
369
-		$obj->set( $datetime_field_name, $DateTime->format( EE_Datetime_Field::mysql_timestamp_format ) );
368
+		$obj->set($datetime_field_name, $DateTime->format(EE_Datetime_Field::mysql_timestamp_format));
370 369
 		// reset datetime formats
371
-		$obj->set_date_format( $current_format[0] );
372
-		$obj->set_time_format( $current_format[1] );
370
+		$obj->set_date_format($current_format[0]);
371
+		$obj->set_time_format($current_format[1]);
373 372
 		return $obj;
374 373
 	}
375 374
 
@@ -386,11 +385,11 @@  discard block
 block discarded – undo
386 385
 	 * @param  integer 	$value    what you want to increment the time by
387 386
 	 * @return EE_Base_Class		   return the EE_Base_Class object so right away you can do something with it (chaining)
388 387
 	 */
389
-	public static function date_time_add( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
388
+	public static function date_time_add(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
390 389
 		//get the raw UTC date.
391
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
392
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value );
393
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
390
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
391
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value);
392
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
394 393
 	}
395 394
 
396 395
 
@@ -405,11 +404,11 @@  discard block
 block discarded – undo
405 404
 	 * @param int            $value
406 405
 	 * @return \EE_Base_Class
407 406
 	 */
408
-	public static function date_time_subtract( EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1 ) {
407
+	public static function date_time_subtract(EE_Base_Class $obj, $datetime_field_name, $period = 'years', $value = 1) {
409 408
 		//get the raw UTC date
410
-		$DateTime = $obj->get_DateTime_object( $datetime_field_name );
411
-		$DateTime = EEH_DTT_Helper::calc_date( $DateTime, $period, $value, '-' );
412
-		return EEH_DTT_Helper::_set_date_time_field( $obj, $DateTime, $datetime_field_name );
409
+		$DateTime = $obj->get_DateTime_object($datetime_field_name);
410
+		$DateTime = EEH_DTT_Helper::calc_date($DateTime, $period, $value, '-');
411
+		return EEH_DTT_Helper::_set_date_time_field($obj, $DateTime, $datetime_field_name);
413 412
 	}
414 413
 
415 414
 
@@ -422,44 +421,44 @@  discard block
 block discarded – undo
422 421
 	 * @return \DateTime return whatever type came in.
423 422
 	 * @throws \EE_Error
424 423
 	 */
425
-	protected static function _modify_datetime_object( DateTime $DateTime, $period = 'years', $value = 1, $operand = '+' ) {
426
-		if ( ! $DateTime instanceof DateTime ) {
424
+	protected static function _modify_datetime_object(DateTime $DateTime, $period = 'years', $value = 1, $operand = '+') {
425
+		if ( ! $DateTime instanceof DateTime) {
427 426
 			throw new EE_Error(
428 427
 				sprintf(
429
-					__( 'Expected a PHP DateTime object, but instead received %1$s', 'event_espresso' ),
430
-					print_r( $DateTime, true )
428
+					__('Expected a PHP DateTime object, but instead received %1$s', 'event_espresso'),
429
+					print_r($DateTime, true)
431 430
 				)
432 431
 			);
433 432
 		}
434
-		switch ( $period ) {
433
+		switch ($period) {
435 434
 			case 'years' :
436
-				$value = 'P' . $value . 'Y';
435
+				$value = 'P'.$value.'Y';
437 436
 				break;
438 437
 			case 'months' :
439
-				$value = 'P' . $value . 'M';
438
+				$value = 'P'.$value.'M';
440 439
 				break;
441 440
 			case 'weeks' :
442
-				$value = 'P' . $value . 'W';
441
+				$value = 'P'.$value.'W';
443 442
 				break;
444 443
 			case 'days' :
445
-				$value = 'P' . $value . 'D';
444
+				$value = 'P'.$value.'D';
446 445
 				break;
447 446
 			case 'hours' :
448
-				$value = 'PT' . $value . 'H';
447
+				$value = 'PT'.$value.'H';
449 448
 				break;
450 449
 			case 'minutes' :
451
-				$value = 'PT' . $value . 'M';
450
+				$value = 'PT'.$value.'M';
452 451
 				break;
453 452
 			case 'seconds' :
454
-				$value = 'PT' . $value . 'S';
453
+				$value = 'PT'.$value.'S';
455 454
 				break;
456 455
 		}
457
-		switch ( $operand ) {
456
+		switch ($operand) {
458 457
 			case '+':
459
-				$DateTime->add( new DateInterval( $value ) );
458
+				$DateTime->add(new DateInterval($value));
460 459
 				break;
461 460
 			case '-':
462
-				$DateTime->sub( new DateInterval( $value ) );
461
+				$DateTime->sub(new DateInterval($value));
463 462
 				break;
464 463
 		}
465 464
 		return $DateTime;
@@ -475,16 +474,16 @@  discard block
 block discarded – undo
475 474
 	 * @return \DateTime return whatever type came in.
476 475
 	 * @throws \EE_Error
477 476
 	 */
478
-	protected static function _modify_timestamp( $timestamp, $period = 'years', $value = 1, $operand = '+' ) {
479
-		if ( ! preg_match( EE_Datetime_Field::unix_timestamp_regex, $timestamp ) ) {
477
+	protected static function _modify_timestamp($timestamp, $period = 'years', $value = 1, $operand = '+') {
478
+		if ( ! preg_match(EE_Datetime_Field::unix_timestamp_regex, $timestamp)) {
480 479
 			throw new EE_Error(
481 480
 				sprintf(
482
-					__( 'Expected a Unix timestamp, but instead received %1$s', 'event_espresso' ),
483
-					print_r( $timestamp, true )
481
+					__('Expected a Unix timestamp, but instead received %1$s', 'event_espresso'),
482
+					print_r($timestamp, true)
484 483
 				)
485 484
 			);
486 485
 		}
487
-		switch ( $period ) {
486
+		switch ($period) {
488 487
 			case 'years' :
489 488
 				$value = YEAR_IN_SECONDS * $value;
490 489
 				break;
@@ -504,9 +503,9 @@  discard block
 block discarded – undo
504 503
 				$value = MINUTE_IN_SECONDS * $value;
505 504
 				break;
506 505
 		}
507
-		switch ( $operand ) {
506
+		switch ($operand) {
508 507
 			case '+':
509
-				$timestamp  += $value;
508
+				$timestamp += $value;
510 509
 				break;
511 510
 			case '-':
512 511
 				$timestamp -= $value;
@@ -526,11 +525,11 @@  discard block
 block discarded – undo
526 525
 	 * @param  string  $operand What operand you wish to use for the calculation
527 526
 	 * @return mixed string|DateTime          return whatever type came in.
528 527
 	 */
529
-	public static function calc_date( $DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+' ) {
530
-		if ( $DateTime_or_timestamp instanceof DateTime ) {
531
-			return EEH_DTT_Helper::_modify_datetime_object( $DateTime_or_timestamp, $period, $value, $operand );
532
-		} else if ( preg_match( EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp )) {
533
-			return EEH_DTT_Helper::_modify_timestamp( $DateTime_or_timestamp, $period, $value, $operand );
528
+	public static function calc_date($DateTime_or_timestamp, $period = 'years', $value = 1, $operand = '+') {
529
+		if ($DateTime_or_timestamp instanceof DateTime) {
530
+			return EEH_DTT_Helper::_modify_datetime_object($DateTime_or_timestamp, $period, $value, $operand);
531
+		} else if (preg_match(EE_Datetime_Field::unix_timestamp_regex, $DateTime_or_timestamp)) {
532
+			return EEH_DTT_Helper::_modify_timestamp($DateTime_or_timestamp, $period, $value, $operand);
534 533
 		} else {
535 534
 			//error
536 535
 			return $DateTime_or_timestamp;
@@ -560,24 +559,24 @@  discard block
 block discarded – undo
560 559
 	 * 			'moment' => //date and time format.
561 560
 	 * 		)
562 561
 	 */
563
-	public static function convert_php_to_js_and_moment_date_formats( $date_format_string = null, $time_format_string = null ) {
564
-		if ( $date_format_string === null ) {
565
-			$date_format_string = get_option( 'date_format' );
562
+	public static function convert_php_to_js_and_moment_date_formats($date_format_string = null, $time_format_string = null) {
563
+		if ($date_format_string === null) {
564
+			$date_format_string = get_option('date_format');
566 565
 		}
567 566
 
568
-		if ( $time_format_string === null ) {
569
-			$time_format_string = get_option( 'time_format' );
567
+		if ($time_format_string === null) {
568
+			$time_format_string = get_option('time_format');
570 569
 		}
571 570
 
572
-		$date_format = self::_php_to_js_moment_converter( $date_format_string );
573
-		$time_format = self::_php_to_js_moment_converter( $time_format_string );
571
+		$date_format = self::_php_to_js_moment_converter($date_format_string);
572
+		$time_format = self::_php_to_js_moment_converter($time_format_string);
574 573
 
575 574
 		return array(
576 575
 			'js' => array(
577 576
 				'date' => $date_format['js'],
578 577
 				'time' => $time_format['js']
579 578
 				),
580
-			'moment' => $date_format['moment'] . ' ' . $time_format['moment' ]
579
+			'moment' => $date_format['moment'].' '.$time_format['moment']
581 580
 			);
582 581
 	}
583 582
 
@@ -591,7 +590,7 @@  discard block
 block discarded – undo
591 590
 	 *
592 591
 	 * @return array js and moment formats.
593 592
 	 */
594
-	protected static function _php_to_js_moment_converter( $format_string ) {
593
+	protected static function _php_to_js_moment_converter($format_string) {
595 594
 		/**
596 595
 		 * This is a map of symbols for formats.
597 596
 		 * The index is the php symbol, the equivalent values are in the array.
@@ -748,15 +747,15 @@  discard block
 block discarded – undo
748 747
 		$jquery_ui_format = "";
749 748
 		$moment_format = "";
750 749
 		$escaping = false;
751
-		for ( $i = 0; $i < strlen($format_string); $i++ ) {
750
+		for ($i = 0; $i < strlen($format_string); $i++) {
752 751
 			$char = $format_string[$i];
753
-			if ( $char === '\\' )  { // PHP date format escaping character
752
+			if ($char === '\\') { // PHP date format escaping character
754 753
 				$i++;
755
-				if ( $escaping ) {
754
+				if ($escaping) {
756 755
 					$jquery_ui_format .= $format_string[$i];
757 756
 					$moment_format .= $format_string[$i];
758 757
 				} else {
759
-					$jquery_ui_format .= '\'' . $format_string[$i];
758
+					$jquery_ui_format .= '\''.$format_string[$i];
760 759
 					$moment_format .= $format_string[$i];
761 760
 				}
762 761
 				$escaping = true;
@@ -775,7 +774,7 @@  discard block
 block discarded – undo
775 774
 				}
776 775
 			}
777 776
 		}
778
-		return array( 'js' => $jquery_ui_format, 'moment' => $moment_format );
777
+		return array('js' => $jquery_ui_format, 'moment' => $moment_format);
779 778
 	}
780 779
 
781 780
 
@@ -790,25 +789,25 @@  discard block
 block discarded – undo
790 789
 	 *                           		errors is returned.  So for client code calling, check for is_array() to
791 790
 	 *                           		indicate failed validations.
792 791
 	 */
793
-	public static function validate_format_string( $format_string ) {
792
+	public static function validate_format_string($format_string) {
794 793
 		$error_msg = array();
795 794
 		//time format checks
796
-		switch ( true ) {
797
-			case   strpos( $format_string, 'h' )  !== false  :
798
-			case   strpos( $format_string, 'g' ) !== false :
795
+		switch (true) {
796
+			case   strpos($format_string, 'h') !== false  :
797
+			case   strpos($format_string, 'g') !== false :
799 798
 				/**
800 799
 				 * if the time string has a lowercase 'h' which == 12 hour time format and there
801 800
 				 * is not any ante meridiem format ('a' or 'A').  Then throw an error because its
802 801
 				 * too ambiguous and PHP won't be able to figure out whether 1 = 1pm or 1am.
803 802
 				 */
804
-				if ( strpos( strtoupper( $format_string ), 'A' )  === false ) {
805
-					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso' );
803
+				if (strpos(strtoupper($format_string), 'A') === false) {
804
+					$error_msg[] = __('There is a  time format for 12 hour time but no  "a" or "A" to indicate am/pm.  Without this distinction, PHP is unable to determine if a "1" for the hour value equals "1pm" or "1am".', 'event_espresso');
806 805
 				}
807 806
 				break;
808 807
 
809 808
 		}
810 809
 
811
-		return empty( $error_msg ) ? true : $error_msg;
810
+		return empty($error_msg) ? true : $error_msg;
812 811
 	}
813 812
 
814 813
 
@@ -830,11 +829,11 @@  discard block
 block discarded – undo
830 829
 	 * @param mixed $date_2
831 830
 	 * @return bool
832 831
 	 */
833
-	public static function dates_represent_one_24_hour_date( $date_1, $date_2 ) {
832
+	public static function dates_represent_one_24_hour_date($date_1, $date_2) {
834 833
 
835 834
 		if (
836
-			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime ) ||
837
-			( $date_1->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' || $date_2->format( EE_Datetime_Field::mysql_time_format ) != '00:00:00' )
835
+			( ! $date_1 instanceof DateTime || ! $date_2 instanceof DateTime) ||
836
+			($date_1->format(EE_Datetime_Field::mysql_time_format) != '00:00:00' || $date_2->format(EE_Datetime_Field::mysql_time_format) != '00:00:00')
838 837
 		) {
839 838
 			return false;
840 839
 		}
@@ -851,11 +850,11 @@  discard block
 block discarded – undo
851 850
 	 * @param string $field_for_interval  The Database field that is the interval is applied to in the query.
852 851
 	 * @return string
853 852
 	 */
854
-	public static function get_sql_query_interval_for_offset( $timezone_string, $field_for_interval ) {
853
+	public static function get_sql_query_interval_for_offset($timezone_string, $field_for_interval) {
855 854
 		try {
856 855
 			/** need to account for timezone offset on the selects */
857
-			$DateTimeZone = new DateTimeZone( $timezone_string );
858
-		} catch ( Exception $e ) {
856
+			$DateTimeZone = new DateTimeZone($timezone_string);
857
+		} catch (Exception $e) {
859 858
 			$DateTimeZone = null;
860 859
 		}
861 860
 
@@ -863,10 +862,10 @@  discard block
 block discarded – undo
863 862
 		 * Note get_option( 'gmt_offset') returns a value in hours, whereas DateTimeZone::getOffset returns values in seconds.
864 863
 		 * Hence we do the calc for DateTimeZone::getOffset.
865 864
 		 */
866
-		$offset = $DateTimeZone instanceof DateTimeZone ? ( $DateTimeZone->getOffset( new DateTime('now') ) ) / HOUR_IN_SECONDS : get_option( 'gmt_offset' );
865
+		$offset = $DateTimeZone instanceof DateTimeZone ? ($DateTimeZone->getOffset(new DateTime('now'))) / HOUR_IN_SECONDS : get_option('gmt_offset');
867 866
 		$query_interval = $offset < 0
868
-			? 'DATE_SUB(' . $field_for_interval . ', INTERVAL ' . $offset*-1 . ' HOUR)'
869
-			: 'DATE_ADD(' . $field_for_interval .', INTERVAL ' . $offset . ' HOUR)';
867
+			? 'DATE_SUB('.$field_for_interval.', INTERVAL '.$offset * -1.' HOUR)'
868
+			: 'DATE_ADD('.$field_for_interval.', INTERVAL '.$offset.' HOUR)';
870 869
 		return $query_interval;
871 870
 	}
872 871
 	
@@ -878,47 +877,47 @@  discard block
 block discarded – undo
878 877
 	 * @return string
879 878
 	 */
880 879
 	public static function get_timezone_string_for_display() {
881
-		$pretty_timezone = apply_filters( 'FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '' );
882
-		if( ! empty( $pretty_timezone ) ) {
883
-			return esc_html( $pretty_timezone );
880
+		$pretty_timezone = apply_filters('FHEE__EEH_DTT_Helper__get_timezone_string_for_display', '');
881
+		if ( ! empty($pretty_timezone)) {
882
+			return esc_html($pretty_timezone);
884 883
 		}
885
-		$timezone_string = get_option( 'timezone_string' );
886
-		if( $timezone_string ) {
884
+		$timezone_string = get_option('timezone_string');
885
+		if ($timezone_string) {
887 886
 			static $mo_loaded = false;
888 887
 			// Load translations for continents and cities just like wp_timezone_choice does
889
-			if ( ! $mo_loaded ) {
888
+			if ( ! $mo_loaded) {
890 889
 				$locale = get_locale();
891
-				$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
892
-				load_textdomain( 'continents-cities', $mofile );
890
+				$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
891
+				load_textdomain('continents-cities', $mofile);
893 892
 				$mo_loaded = true;
894 893
 			}
895 894
 			//well that was easy. 
896
-			$parts = explode('/', $timezone_string );
895
+			$parts = explode('/', $timezone_string);
897 896
 			//remove the continent
898
-			unset( $parts[0] );
897
+			unset($parts[0]);
899 898
 			$t_parts = array();
900
-			foreach( $parts as $part ) {
901
-				$t_parts[] = translate( str_replace( '_', ' ', $part ), 'continents-cities' );
899
+			foreach ($parts as $part) {
900
+				$t_parts[] = translate(str_replace('_', ' ', $part), 'continents-cities');
902 901
 			}
903
-			return implode( ' - ', $t_parts );
902
+			return implode(' - ', $t_parts);
904 903
 		}
905 904
 		//they haven't set the timezone string, so let's return a string like "UTC+1"
906
-		$gmt_offset = get_option( 'gmt_offset' );
907
-		if( intval( $gmt_offset ) >= 0 ) {
905
+		$gmt_offset = get_option('gmt_offset');
906
+		if (intval($gmt_offset) >= 0) {
908 907
 			$prefix = '+';
909 908
 		} else {
910 909
 			$prefix = '';
911 910
 		}
912
-		$parts = explode( '.', (string) $gmt_offset );
913
-		if( count( $parts ) === 1 ) {
911
+		$parts = explode('.', (string) $gmt_offset);
912
+		if (count($parts) === 1) {
914 913
 			$parts[1] = '00';
915 914
 		} else {
916 915
 			//convert the part after the decimal, eg "5" (from x.5) or "25" (from x.25)
917 916
 			//to minutes, eg 30 or 15, respectively
918
-			$hour_fraction = (float)( '0.' . $parts[1] );
919
-			$parts[1] = (string)$hour_fraction * 60;
917
+			$hour_fraction = (float) ('0.'.$parts[1]);
918
+			$parts[1] = (string) $hour_fraction * 60;
920 919
 		}
921
-		return sprintf( __( 'UTC%1$s', 'event_espresso' ), $prefix . implode( ':', $parts ) );
920
+		return sprintf(__('UTC%1$s', 'event_espresso'), $prefix.implode(':', $parts));
922 921
 	}
923 922
 
924 923
 
Please login to merge, or discard this patch.
core/EE_System.core.php 1 patch
Spacing   +270 added lines, -270 removed lines patch added patch discarded remove patch
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
 	 * @param  \EE_Registry        $Registry
89 89
 	 * @return \EE_System
90 90
 	 */
91
-	public static function instance( EE_Registry $Registry = null ) {
91
+	public static function instance(EE_Registry $Registry = null) {
92 92
 		// check if class object is instantiated
93
-		if ( ! self::$_instance instanceof EE_System ) {
94
-			self::$_instance = new self( $Registry );
93
+		if ( ! self::$_instance instanceof EE_System) {
94
+			self::$_instance = new self($Registry);
95 95
 		}
96 96
 		return self::$_instance;
97 97
 	}
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
 	 * resets the instance and returns it
102 102
 	 * @return EE_System
103 103
 	 */
104
-	public static function reset(){
104
+	public static function reset() {
105 105
 		self::$_instance->_req_type = NULL;
106 106
 
107 107
 		//make sure none of the old hooks are left hanging around
108
-		remove_all_actions( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
108
+		remove_all_actions('AHEE__EE_System__perform_activations_upgrades_and_migrations');
109 109
 
110 110
 		//we need to reset the migration manager in order for it to detect DMSs properly
111 111
 		EE_Data_Migration_Manager::reset();
@@ -125,28 +125,28 @@  discard block
 block discarded – undo
125 125
 	 * @access private
126 126
 	 * @param  \EE_Registry        $Registry
127 127
 	 */
128
-	private function __construct( EE_Registry $Registry ) {
128
+	private function __construct(EE_Registry $Registry) {
129 129
 		$this->registry = $Registry;
130
-		do_action( 'AHEE__EE_System__construct__begin', $this );
130
+		do_action('AHEE__EE_System__construct__begin', $this);
131 131
 		// allow addons to load first so that they can register autoloaders, set hooks for running DMS's, etc
132
-		add_action( 'AHEE__EE_Bootstrap__load_espresso_addons', array( $this, 'load_espresso_addons' ) );
132
+		add_action('AHEE__EE_Bootstrap__load_espresso_addons', array($this, 'load_espresso_addons'));
133 133
 		// when an ee addon is activated, we want to call the core hook(s) again
134 134
 		// because the newly-activated addon didn't get a chance to run at all
135
-		add_action( 'activate_plugin', array( $this, 'load_espresso_addons' ), 1 );
135
+		add_action('activate_plugin', array($this, 'load_espresso_addons'), 1);
136 136
 		// detect whether install or upgrade
137
-		add_action( 'AHEE__EE_Bootstrap__detect_activations_or_upgrades', array( $this, 'detect_activations_or_upgrades' ), 3 );
137
+		add_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades', array($this, 'detect_activations_or_upgrades'), 3);
138 138
 		// load EE_Config, EE_Textdomain, etc
139
-		add_action( 'AHEE__EE_Bootstrap__load_core_configuration', array( $this, 'load_core_configuration' ), 5 );
139
+		add_action('AHEE__EE_Bootstrap__load_core_configuration', array($this, 'load_core_configuration'), 5);
140 140
 		// load EE_Config, EE_Textdomain, etc
141
-		add_action( 'AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array( $this, 'register_shortcodes_modules_and_widgets' ), 7 );
141
+		add_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets', array($this, 'register_shortcodes_modules_and_widgets'), 7);
142 142
 		// you wanna get going? I wanna get going... let's get going!
143
-		add_action( 'AHEE__EE_Bootstrap__brew_espresso', array( $this, 'brew_espresso' ), 9 );
143
+		add_action('AHEE__EE_Bootstrap__brew_espresso', array($this, 'brew_espresso'), 9);
144 144
 		//other housekeeping
145 145
 		//exclude EE critical pages from wp_list_pages
146
-		add_filter( 'wp_list_pages_excludes', array( $this, 'remove_pages_from_wp_list_pages' ), 10 );
146
+		add_filter('wp_list_pages_excludes', array($this, 'remove_pages_from_wp_list_pages'), 10);
147 147
 		// ALL EE Addons should use the following hook point to attach their initial setup too
148 148
 		// it's extremely important for EE Addons to register any class autoloaders so that they can be available when the EE_Config loads
149
-		do_action( 'AHEE__EE_System__construct__complete', $this );
149
+		do_action('AHEE__EE_System__construct__complete', $this);
150 150
 	}
151 151
 
152 152
 
@@ -166,30 +166,30 @@  discard block
 block discarded – undo
166 166
 	public function load_espresso_addons() {
167 167
 		// set autoloaders for all of the classes implementing EEI_Plugin_API
168 168
 		// which provide helpers for EE plugin authors to more easily register certain components with EE.
169
-		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'plugin_api' );
169
+		EEH_Autoloader::instance()->register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'plugin_api');
170 170
 		//load and setup EE_Capabilities
171
-		$this->registry->load_core( 'Capabilities' );
171
+		$this->registry->load_core('Capabilities');
172 172
 		//caps need to be initialized on every request so that capability maps are set.
173 173
 		//@see https://events.codebasehq.com/projects/event-espresso/tickets/8674
174 174
 		$this->registry->CAP->init_caps();
175
-		do_action( 'AHEE__EE_System__load_espresso_addons' );
175
+		do_action('AHEE__EE_System__load_espresso_addons');
176 176
 		//if the WP API basic auth plugin isn't already loaded, load it now.
177 177
 		//We want it for mobile apps. Just include the entire plugin
178 178
 		//also, don't load the basic auth when a plugin is getting activated, because
179 179
 		//it could be the basic auth plugin, and it doesn't check if its methods are already defined
180 180
 		//and causes a fatal error
181
-		if( !function_exists( 'json_basic_auth_handler' )
182
-			&& ! function_exists( 'json_basic_auth_error' )
181
+		if ( ! function_exists('json_basic_auth_handler')
182
+			&& ! function_exists('json_basic_auth_error')
183 183
 			&& ! (
184
-				isset( $_GET[ 'action'] )
185
-				&& in_array( $_GET[ 'action' ], array( 'activate', 'activate-selected' ) )
184
+				isset($_GET['action'])
185
+				&& in_array($_GET['action'], array('activate', 'activate-selected'))
186 186
 			)
187 187
 			&& ! (
188
-				isset( $_GET['activate' ] )
189
-				&& $_GET['activate' ] === 'true'
188
+				isset($_GET['activate'])
189
+				&& $_GET['activate'] === 'true'
190 190
 			)
191 191
 		) {
192
-			include_once EE_THIRD_PARTY . 'wp-api-basic-auth' . DS . 'basic-auth.php';
192
+			include_once EE_THIRD_PARTY.'wp-api-basic-auth'.DS.'basic-auth.php';
193 193
 		}
194 194
 	}
195 195
 
@@ -205,10 +205,10 @@  discard block
 block discarded – undo
205 205
 	 * @access public
206 206
 	 * @return void
207 207
 	 */
208
-	public function detect_activations_or_upgrades(){
208
+	public function detect_activations_or_upgrades() {
209 209
 		//first off: let's make sure to handle core
210 210
 		$this->detect_if_activation_or_upgrade();
211
-		foreach($this->registry->addons as $addon){
211
+		foreach ($this->registry->addons as $addon) {
212 212
 			//detect teh request type for that addon
213 213
 			$addon->detect_activation_or_upgrade();
214 214
 		}
@@ -229,41 +229,41 @@  discard block
 block discarded – undo
229 229
 		do_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin');
230 230
 
231 231
 		// load M-Mode class
232
-		$this->registry->load_core( 'Maintenance_Mode' );
232
+		$this->registry->load_core('Maintenance_Mode');
233 233
 		// check if db has been updated, or if its a brand-new installation
234 234
 
235 235
 		$espresso_db_update = $this->fix_espresso_db_upgrade_option();
236
-		$request_type =  $this->detect_req_type($espresso_db_update);
236
+		$request_type = $this->detect_req_type($espresso_db_update);
237 237
 		//EEH_Debug_Tools::printr( $request_type, '$request_type', __FILE__, __LINE__ );
238 238
 
239
-		switch($request_type){
239
+		switch ($request_type) {
240 240
 			case EE_System::req_type_new_activation:
241
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__new_activation' );
242
-				$this->_handle_core_version_change( $espresso_db_update );
241
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__new_activation');
242
+				$this->_handle_core_version_change($espresso_db_update);
243 243
 				break;
244 244
 			case EE_System::req_type_reactivation:
245
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__reactivation' );
246
-				$this->_handle_core_version_change( $espresso_db_update );
245
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__reactivation');
246
+				$this->_handle_core_version_change($espresso_db_update);
247 247
 				break;
248 248
 			case EE_System::req_type_upgrade:
249
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__upgrade' );
249
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__upgrade');
250 250
 				//migrations may be required now that we've upgraded
251 251
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
252
-				$this->_handle_core_version_change( $espresso_db_update );
252
+				$this->_handle_core_version_change($espresso_db_update);
253 253
 //				echo "done upgrade";die;
254 254
 				break;
255 255
 			case EE_System::req_type_downgrade:
256
-				do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__downgrade' );
256
+				do_action('AHEE__EE_System__detect_if_activation_or_upgrade__downgrade');
257 257
 				//its possible migrations are no longer required
258 258
 				EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
259
-				$this->_handle_core_version_change( $espresso_db_update );
259
+				$this->_handle_core_version_change($espresso_db_update);
260 260
 				break;
261 261
 			case EE_System::req_type_normal:
262 262
 			default:
263 263
 //				$this->_maybe_redirect_to_ee_about();
264 264
 				break;
265 265
 		}
266
-		do_action( 'AHEE__EE_System__detect_if_activation_or_upgrade__complete' );
266
+		do_action('AHEE__EE_System__detect_if_activation_or_upgrade__complete');
267 267
 	}
268 268
 
269 269
 	/**
@@ -271,10 +271,10 @@  discard block
 block discarded – undo
271 271
 	 * initializing the database later during the request
272 272
 	 * @param array $espresso_db_update
273 273
 	 */
274
-	protected function _handle_core_version_change( $espresso_db_update ){
275
-		$this->update_list_of_installed_versions( $espresso_db_update );
274
+	protected function _handle_core_version_change($espresso_db_update) {
275
+		$this->update_list_of_installed_versions($espresso_db_update);
276 276
 		//get ready to verify the DB is ok (provided we aren't in maintenance mode, of course)
277
-		add_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( $this, 'initialize_db_if_no_migrations_required' ));
277
+		add_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array($this, 'initialize_db_if_no_migrations_required'));
278 278
 	}
279 279
 
280 280
 
@@ -289,44 +289,44 @@  discard block
 block discarded – undo
289 289
 	 * @internal param array $espresso_db_update_value the value of the WordPress option. If not supplied, fetches it from the options table
290 290
 	 * @return array the correct value of 'espresso_db_upgrade', after saving it, if it needed correction
291 291
 	 */
292
-	private function fix_espresso_db_upgrade_option($espresso_db_update = null){
293
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update );
294
-		if( ! $espresso_db_update){
295
-			$espresso_db_update = get_option( 'espresso_db_update' );
292
+	private function fix_espresso_db_upgrade_option($espresso_db_update = null) {
293
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__begin', $espresso_db_update);
294
+		if ( ! $espresso_db_update) {
295
+			$espresso_db_update = get_option('espresso_db_update');
296 296
 		}
297 297
 		// check that option is an array
298
-		if( ! is_array( $espresso_db_update )) {
298
+		if ( ! is_array($espresso_db_update)) {
299 299
 			// if option is FALSE, then it never existed
300
-			if ( $espresso_db_update === FALSE ) {
300
+			if ($espresso_db_update === FALSE) {
301 301
 				// make $espresso_db_update an array and save option with autoload OFF
302
-				$espresso_db_update =  array();
303
-				add_option( 'espresso_db_update', $espresso_db_update, '', 'no' );
302
+				$espresso_db_update = array();
303
+				add_option('espresso_db_update', $espresso_db_update, '', 'no');
304 304
 			} else {
305 305
 				// option is NOT FALSE but also is NOT an array, so make it an array and save it
306
-				$espresso_db_update =  array( $espresso_db_update=>array() );
307
-				update_option( 'espresso_db_update', $espresso_db_update );
306
+				$espresso_db_update = array($espresso_db_update=>array());
307
+				update_option('espresso_db_update', $espresso_db_update);
308 308
 			}
309
-		}else{
309
+		} else {
310 310
 			$corrected_db_update = array();
311 311
 			//if IS an array, but is it an array where KEYS are version numbers, and values are arrays?
312
-			foreach($espresso_db_update as $should_be_version_string => $should_be_array){
313
-				if(is_int($should_be_version_string) && ! is_array($should_be_array)){
312
+			foreach ($espresso_db_update as $should_be_version_string => $should_be_array) {
313
+				if (is_int($should_be_version_string) && ! is_array($should_be_array)) {
314 314
 					//the key is an int, and the value IS NOT an array
315 315
 					//so it must be numerically-indexed, where values are versions installed...
316 316
 					//fix it!
317 317
 					$version_string = $should_be_array;
318 318
 					$corrected_db_update[$version_string] = array('unknown-date');
319
-				}else{
319
+				} else {
320 320
 					//ok it checks out
321 321
 					$corrected_db_update[$should_be_version_string] = $should_be_array;
322 322
 				}
323 323
 			}
324 324
 			$espresso_db_update = $corrected_db_update;
325
-			update_option( 'espresso_db_update', $espresso_db_update );
325
+			update_option('espresso_db_update', $espresso_db_update);
326 326
 
327 327
 		}
328 328
 
329
-		do_action( 'FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update );
329
+		do_action('FHEE__EE_System__manage_fix_espresso_db_upgrade_option__complete', $espresso_db_update);
330 330
 		return $espresso_db_update;
331 331
 	}
332 332
 
@@ -346,34 +346,34 @@  discard block
 block discarded – undo
346 346
 	 * so we prefer to only do it when necessary
347 347
 	 * @return void
348 348
 	 */
349
-	public function initialize_db_if_no_migrations_required( $initialize_addons_too = FALSE, $verify_schema = true ){
349
+	public function initialize_db_if_no_migrations_required($initialize_addons_too = FALSE, $verify_schema = true) {
350 350
 		$request_type = $this->detect_req_type();
351 351
 		//only initialize system if we're not in maintenance mode.
352
-		if( EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance ){
353
-			update_option( 'ee_flush_rewrite_rules', TRUE );
352
+		if (EE_Maintenance_Mode::instance()->level() != EE_Maintenance_Mode::level_2_complete_maintenance) {
353
+			update_option('ee_flush_rewrite_rules', TRUE);
354 354
 
355
-			if( $verify_schema ) {
355
+			if ($verify_schema) {
356 356
 				EEH_Activation::initialize_db_and_folders();
357 357
 			}
358 358
 			EEH_Activation::initialize_db_content();
359 359
 			EEH_Activation::system_initialization();
360
-			if( $initialize_addons_too ) {
360
+			if ($initialize_addons_too) {
361 361
 				$this->initialize_addons();
362 362
 			}
363
-		}else{
364
-			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for( 'Core' );
363
+		} else {
364
+			EE_Data_Migration_Manager::instance()->enqueue_db_initialization_for('Core');
365 365
 		}
366
-		if ( $request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade ) {
367
-			add_action( 'AHEE__EE_System__initialize_last', array( $this, 'redirect_to_about_ee' ), 9 );
366
+		if ($request_type == EE_System::req_type_new_activation || $request_type == EE_System::req_type_reactivation || $request_type == EE_System::req_type_upgrade) {
367
+			add_action('AHEE__EE_System__initialize_last', array($this, 'redirect_to_about_ee'), 9);
368 368
 		}
369 369
 	}
370 370
 
371 371
 	/**
372 372
 	 * Initializes the db for all registered addons
373 373
 	 */
374
-	public function initialize_addons(){
374
+	public function initialize_addons() {
375 375
 		//foreach registered addon, make sure its db is up-to-date too
376
-		foreach($this->registry->addons as $addon){
376
+		foreach ($this->registry->addons as $addon) {
377 377
 			$addon->initialize_db_if_no_migrations_required();
378 378
 		}
379 379
 	}
@@ -385,16 +385,16 @@  discard block
 block discarded – undo
385 385
 	 * @param 	string 	$current_version_to_add 	version to be added to the version history
386 386
 	 * @return 	boolean success as to whether or not this option was changed
387 387
 	 */
388
-	public function update_list_of_installed_versions($version_history = NULL,$current_version_to_add = NULL) {
389
-		if( ! $version_history ) {
388
+	public function update_list_of_installed_versions($version_history = NULL, $current_version_to_add = NULL) {
389
+		if ( ! $version_history) {
390 390
 			$version_history = $this->fix_espresso_db_upgrade_option($version_history);
391 391
 		}
392
-		if( $current_version_to_add == NULL){
392
+		if ($current_version_to_add == NULL) {
393 393
 			$current_version_to_add = espresso_version();
394 394
 		}
395
-		$version_history[ $current_version_to_add ][] = date( 'Y-m-d H:i:s',time() );
395
+		$version_history[$current_version_to_add][] = date('Y-m-d H:i:s', time());
396 396
 		// re-save
397
-		return update_option( 'espresso_db_update', $version_history );
397
+		return update_option('espresso_db_update', $version_history);
398 398
 	}
399 399
 
400 400
 
@@ -411,10 +411,10 @@  discard block
 block discarded – undo
411 411
 	 *                            but still know if this is a new install or not
412 412
 	 * @return int one of the constants on EE_System::req_type_
413 413
 	 */
414
-	public function detect_req_type( $espresso_db_update = NULL ){
415
-		if ( $this->_req_type === NULL ){
416
-			$espresso_db_update = ! empty( $espresso_db_update ) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
417
-			$this->_req_type = $this->detect_req_type_given_activation_history( $espresso_db_update, 'ee_espresso_activation', espresso_version() );
414
+	public function detect_req_type($espresso_db_update = NULL) {
415
+		if ($this->_req_type === NULL) {
416
+			$espresso_db_update = ! empty($espresso_db_update) ? $espresso_db_update : $this->fix_espresso_db_upgrade_option();
417
+			$this->_req_type = $this->detect_req_type_given_activation_history($espresso_db_update, 'ee_espresso_activation', espresso_version());
418 418
 		}
419 419
 		return $this->_req_type;
420 420
 	}
@@ -430,39 +430,39 @@  discard block
 block discarded – undo
430 430
 	 * @param string $version_to_upgrade_to the version that was just upgraded to (for core that will be espresso_version())
431 431
 	 * @return int one of the constants on EE_System::req_type_*
432 432
 	 */
433
-	public static function detect_req_type_given_activation_history( $activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to ){
434
-		$version_is_higher = self::_new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to );
435
-		if( $activation_history_for_addon ){
433
+	public static function detect_req_type_given_activation_history($activation_history_for_addon, $activation_indicator_option_name, $version_to_upgrade_to) {
434
+		$version_is_higher = self::_new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to);
435
+		if ($activation_history_for_addon) {
436 436
 			//it exists, so this isn't a completely new install
437 437
 			//check if this version already in that list of previously installed versions
438
-			if ( ! isset( $activation_history_for_addon[ $version_to_upgrade_to ] )) {
438
+			if ( ! isset($activation_history_for_addon[$version_to_upgrade_to])) {
439 439
 				//it a version we haven't seen before
440
-				if( $version_is_higher === 1 ){
440
+				if ($version_is_higher === 1) {
441 441
 					$req_type = EE_System::req_type_upgrade;
442
-				}else{
442
+				} else {
443 443
 					$req_type = EE_System::req_type_downgrade;
444 444
 				}
445
-				delete_option( $activation_indicator_option_name );
445
+				delete_option($activation_indicator_option_name);
446 446
 			} else {
447 447
 				// its not an update. maybe a reactivation?
448
-				if( get_option( $activation_indicator_option_name, FALSE ) ){
449
-					if ( $version_is_higher === -1 ){
448
+				if (get_option($activation_indicator_option_name, FALSE)) {
449
+					if ($version_is_higher === -1) {
450 450
 						$req_type = EE_System::req_type_downgrade;
451
-					}elseif( $version_is_higher === 0 ){
451
+					}elseif ($version_is_higher === 0) {
452 452
 						//we've seen this version before, but it's an activation. must be a reactivation
453 453
 						$req_type = EE_System::req_type_reactivation;
454
-					}else{//$version_is_higher === 1
454
+					} else {//$version_is_higher === 1
455 455
 						$req_type = EE_System::req_type_upgrade;
456 456
 					}
457
-					delete_option( $activation_indicator_option_name );
457
+					delete_option($activation_indicator_option_name);
458 458
 				} else {
459 459
 					//we've seen this version before and the activation indicate doesn't show it was just activated
460
-					if ( $version_is_higher === -1 ){
460
+					if ($version_is_higher === -1) {
461 461
 						$req_type = EE_System::req_type_downgrade;
462
-					}elseif( $version_is_higher === 0 ){
462
+					}elseif ($version_is_higher === 0) {
463 463
 						//we've seen this version before and it's not an activation. its normal request
464 464
 						$req_type = EE_System::req_type_normal;
465
-					}else{//$version_is_higher === 1
465
+					} else {//$version_is_higher === 1
466 466
 						$req_type = EE_System::req_type_upgrade;
467 467
 					}
468 468
 				}
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 		} else {
471 471
 			//brand new install
472 472
 			$req_type = EE_System::req_type_new_activation;
473
-			delete_option( $activation_indicator_option_name );
473
+			delete_option($activation_indicator_option_name);
474 474
 		}
475 475
 		return $req_type;
476 476
 	}
@@ -488,30 +488,30 @@  discard block
 block discarded – undo
488 488
 	 *		0 if $version_to_upgrade_to MATCHES (reactivation or normal request);
489 489
 	 *		1 if $version_to_upgrade_to is HIGHER (upgrade) ;
490 490
 	 */
491
-	protected static function _new_version_is_higher( $activation_history_for_addon, $version_to_upgrade_to ){
491
+	protected static function _new_version_is_higher($activation_history_for_addon, $version_to_upgrade_to) {
492 492
 		//find the most recently-activated version
493 493
 		$most_recently_active_version_activation = '1970-01-01 00:00:00';
494 494
 		$most_recently_active_version = '0.0.0.dev.000';
495
-		if( is_array( $activation_history_for_addon ) ){
496
-			foreach( $activation_history_for_addon as $version => $times_activated ){
495
+		if (is_array($activation_history_for_addon)) {
496
+			foreach ($activation_history_for_addon as $version => $times_activated) {
497 497
 				//check there is a record of when this version was activated. Otherwise,
498 498
 				//mark it as unknown
499
-				if( ! $times_activated ){
500
-					$times_activated = array( 'unknown-date');
499
+				if ( ! $times_activated) {
500
+					$times_activated = array('unknown-date');
501 501
 				}
502
-				if( is_string( $times_activated ) ){
503
-					$times_activated = array( $times_activated );
502
+				if (is_string($times_activated)) {
503
+					$times_activated = array($times_activated);
504 504
 				}
505
-				foreach( $times_activated as $an_activation ){
506
-					if( $an_activation != 'unknown-date' &&
507
-							$an_activation > $most_recently_active_version_activation  ){
505
+				foreach ($times_activated as $an_activation) {
506
+					if ($an_activation != 'unknown-date' &&
507
+							$an_activation > $most_recently_active_version_activation) {
508 508
 						$most_recently_active_version = $version;
509 509
 						$most_recently_active_version_activation = $an_activation == 'unknown-date' ? '1970-01-01 00:00:00' : $an_activation;
510 510
 					}
511 511
 				}
512 512
 			}
513 513
 		}
514
-		return version_compare( $version_to_upgrade_to, $most_recently_active_version );
514
+		return version_compare($version_to_upgrade_to, $most_recently_active_version);
515 515
 	}
516 516
 
517 517
 
@@ -521,24 +521,24 @@  discard block
 block discarded – undo
521 521
 	 * @return void
522 522
 	 */
523 523
 	public function redirect_to_about_ee() {
524
-		$notices = EE_Error::get_notices( FALSE );
524
+		$notices = EE_Error::get_notices(FALSE);
525 525
 		//if current user is an admin and it's not an ajax request
526 526
 		if (
527
-			$this->registry->CAP->current_user_can( 'manage_options', 'espresso_about_default' )
528
-			&& ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )
529
-			&& ! isset( $notices[ 'errors' ] )
527
+			$this->registry->CAP->current_user_can('manage_options', 'espresso_about_default')
528
+			&& ! (defined('DOING_AJAX') && DOING_AJAX)
529
+			&& ! isset($notices['errors'])
530 530
 		) {
531
-			$query_params =  array( 'page' => 'espresso_about' );
531
+			$query_params = array('page' => 'espresso_about');
532 532
 
533
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation ) {
533
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_new_activation) {
534 534
 			    $query_params['new_activation'] = TRUE;
535 535
 			}
536 536
 
537
-			if ( EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation ) {
537
+			if (EE_System::instance()->detect_req_type() == EE_System::req_type_reactivation) {
538 538
 			    $query_params['reactivation'] = TRUE;
539 539
 			}
540
-			$url = add_query_arg( $query_params, admin_url( 'admin.php' ) );
541
-			wp_safe_redirect( $url );
540
+			$url = add_query_arg($query_params, admin_url('admin.php'));
541
+			wp_safe_redirect($url);
542 542
 			exit();
543 543
 		}
544 544
 	}
@@ -552,31 +552,31 @@  discard block
 block discarded – undo
552 552
 	 *
553 553
 	 * @return void
554 554
 	 */
555
-	public function load_core_configuration(){
556
-		do_action( 'AHEE__EE_System__load_core_configuration__begin', $this );
557
-		$this->registry->load_core( 'EE_Load_Textdomain' );
555
+	public function load_core_configuration() {
556
+		do_action('AHEE__EE_System__load_core_configuration__begin', $this);
557
+		$this->registry->load_core('EE_Load_Textdomain');
558 558
 		//load textdomain
559 559
 		EE_Load_Textdomain::load_textdomain();
560 560
 		// load and setup EE_Config and EE_Network_Config
561
-		$this->registry->load_core( 'Config' );
562
-		$this->registry->load_core( 'Network_Config' );
561
+		$this->registry->load_core('Config');
562
+		$this->registry->load_core('Network_Config');
563 563
 		// setup autoloaders
564 564
 		// enable logging?
565
-		if ( $this->registry->CFG->admin->use_full_logging ) {
566
-			$this->registry->load_core( 'Log' );
565
+		if ($this->registry->CFG->admin->use_full_logging) {
566
+			$this->registry->load_core('Log');
567 567
 		}
568 568
 		// check for activation errors
569
-		$activation_errors = get_option( 'ee_plugin_activation_errors', FALSE );
570
-		if ( $activation_errors ) {
571
-			EE_Error::add_error( $activation_errors, __FILE__, __FUNCTION__, __LINE__ );
572
-			update_option( 'ee_plugin_activation_errors', FALSE );
569
+		$activation_errors = get_option('ee_plugin_activation_errors', FALSE);
570
+		if ($activation_errors) {
571
+			EE_Error::add_error($activation_errors, __FILE__, __FUNCTION__, __LINE__);
572
+			update_option('ee_plugin_activation_errors', FALSE);
573 573
 		}
574 574
 		// get model names
575 575
 		$this->_parse_model_names();
576 576
 
577 577
 		//load caf stuff a chance to play during the activation process too.
578 578
 		$this->_maybe_brew_regular();
579
-		do_action( 'AHEE__EE_System__load_core_configuration__complete', $this );
579
+		do_action('AHEE__EE_System__load_core_configuration__complete', $this);
580 580
 	}
581 581
 
582 582
 
@@ -585,23 +585,23 @@  discard block
 block discarded – undo
585 585
 	 *
586 586
 	 * @return void
587 587
 	 */
588
-	private function _parse_model_names(){
588
+	private function _parse_model_names() {
589 589
 		//get all the files in the EE_MODELS folder that end in .model.php
590
-		$models = glob( EE_MODELS.'*.model.php');
590
+		$models = glob(EE_MODELS.'*.model.php');
591 591
 		$model_names = array();
592 592
 		$non_abstract_db_models = array();
593
-		foreach( $models as $model ){
593
+		foreach ($models as $model) {
594 594
 			// get model classname
595
-			$classname = EEH_File::get_classname_from_filepath_with_standard_filename( $model );
596
-			$short_name = str_replace( 'EEM_', '', $classname );
595
+			$classname = EEH_File::get_classname_from_filepath_with_standard_filename($model);
596
+			$short_name = str_replace('EEM_', '', $classname);
597 597
 			$reflectionClass = new ReflectionClass($classname);
598
-			if( $reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()){
599
-				$non_abstract_db_models[ $short_name ] = $classname;
598
+			if ($reflectionClass->isSubclassOf('EEM_Base') && ! $reflectionClass->isAbstract()) {
599
+				$non_abstract_db_models[$short_name] = $classname;
600 600
 			}
601
-			$model_names[ $short_name ] = $classname;
601
+			$model_names[$short_name] = $classname;
602 602
 		}
603
-		$this->registry->models = apply_filters( 'FHEE__EE_System__parse_model_names', $model_names );
604
-		$this->registry->non_abstract_db_models = apply_filters( 'FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models );
603
+		$this->registry->models = apply_filters('FHEE__EE_System__parse_model_names', $model_names);
604
+		$this->registry->non_abstract_db_models = apply_filters('FHEE__EE_System__parse_implemented_model_names', $non_abstract_db_models);
605 605
 	}
606 606
 
607 607
 
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @return void
612 612
 	 */
613 613
 	private function _maybe_brew_regular() {
614
-		if (( ! defined( 'EE_DECAF' ) ||  EE_DECAF !== TRUE ) && is_readable( EE_CAFF_PATH . 'brewing_regular.php' )) {
615
-			require_once EE_CAFF_PATH . 'brewing_regular.php';
614
+		if (( ! defined('EE_DECAF') || EE_DECAF !== TRUE) && is_readable(EE_CAFF_PATH.'brewing_regular.php')) {
615
+			require_once EE_CAFF_PATH.'brewing_regular.php';
616 616
 		}
617 617
 	}
618 618
 
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
 	 * @return void
630 630
 	 */
631 631
 	public function register_shortcodes_modules_and_widgets() {
632
-		do_action( 'AHEE__EE_System__register_shortcodes_modules_and_widgets' );
632
+		do_action('AHEE__EE_System__register_shortcodes_modules_and_widgets');
633 633
 		// check for addons using old hookpoint
634
-		if ( has_action( 'AHEE__EE_System__register_shortcodes_modules_and_addons' )) {
634
+		if (has_action('AHEE__EE_System__register_shortcodes_modules_and_addons')) {
635 635
 			$this->_incompatible_addon_error();
636 636
 		}
637 637
 	}
@@ -645,19 +645,19 @@  discard block
 block discarded – undo
645 645
 	*/
646 646
 	private function _incompatible_addon_error() {
647 647
 		// get array of classes hooking into here
648
-		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook( 'AHEE__EE_System__register_shortcodes_modules_and_addons' );
649
-		if ( ! empty( $class_names )) {
650
-			$msg = __( 'The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso' );
648
+		$class_names = EEH_Class_Tools::get_class_names_for_all_callbacks_on_hook('AHEE__EE_System__register_shortcodes_modules_and_addons');
649
+		if ( ! empty($class_names)) {
650
+			$msg = __('The following plugins, addons, or modules appear to be incompatible with this version of Event Espresso and were automatically deactivated to avoid fatal errors:', 'event_espresso');
651 651
 			$msg .= '<ul>';
652
-			foreach ( $class_names as $class_name ) {
653
-				$msg .= '<li><b>Event Espresso - ' . str_replace( array( 'EE_', 'EEM_', 'EED_', 'EES_', 'EEW_' ), '', $class_name ) . '</b></li>';
652
+			foreach ($class_names as $class_name) {
653
+				$msg .= '<li><b>Event Espresso - '.str_replace(array('EE_', 'EEM_', 'EED_', 'EES_', 'EEW_'), '', $class_name).'</b></li>';
654 654
 			}
655 655
 			$msg .= '</ul>';
656
-			$msg .= __( 'Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso' );
656
+			$msg .= __('Compatibility issues can be avoided and/or resolved by keeping addons and plugins updated to the latest version.', 'event_espresso');
657 657
 			// save list of incompatible addons to wp-options for later use
658
-			add_option( 'ee_incompatible_addons', $class_names, '', 'no' );
659
-			if ( is_admin() ) {
660
-				EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
658
+			add_option('ee_incompatible_addons', $class_names, '', 'no');
659
+			if (is_admin()) {
660
+				EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
661 661
 			}
662 662
 		}
663 663
 	}
@@ -674,26 +674,26 @@  discard block
 block discarded – undo
674 674
 	 *
675 675
 	 * @return void
676 676
 	 */
677
-	public function brew_espresso(){
678
-		do_action( 'AHEE__EE_System__brew_espresso__begin', $this );
677
+	public function brew_espresso() {
678
+		do_action('AHEE__EE_System__brew_espresso__begin', $this);
679 679
 		// load some final core systems
680
-		add_action( 'init', array( $this, 'set_hooks_for_core' ), 1 );
681
-		add_action( 'init', array( $this, 'perform_activations_upgrades_and_migrations' ), 3 );
682
-		add_action( 'init', array( $this, 'load_CPTs_and_session' ), 5 );
683
-		add_action( 'init', array( $this, 'load_controllers' ), 7 );
684
-		add_action( 'init', array( $this, 'core_loaded_and_ready' ), 9 );
685
-		add_action( 'init', array( $this, 'initialize' ), 10 );
686
-		add_action( 'init', array( $this, 'initialize_last' ), 100 );
687
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
688
-		add_action('admin_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 25 );
689
-		add_action( 'admin_bar_menu', array( $this, 'espresso_toolbar_items' ), 100 );
690
-
691
-		if ( is_admin() && apply_filters( 'FHEE__EE_System__brew_espresso__load_pue', TRUE )  ) {
680
+		add_action('init', array($this, 'set_hooks_for_core'), 1);
681
+		add_action('init', array($this, 'perform_activations_upgrades_and_migrations'), 3);
682
+		add_action('init', array($this, 'load_CPTs_and_session'), 5);
683
+		add_action('init', array($this, 'load_controllers'), 7);
684
+		add_action('init', array($this, 'core_loaded_and_ready'), 9);
685
+		add_action('init', array($this, 'initialize'), 10);
686
+		add_action('init', array($this, 'initialize_last'), 100);
687
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
688
+		add_action('admin_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 25);
689
+		add_action('admin_bar_menu', array($this, 'espresso_toolbar_items'), 100);
690
+
691
+		if (is_admin() && apply_filters('FHEE__EE_System__brew_espresso__load_pue', TRUE)) {
692 692
 			// pew pew pew
693
-			$this->registry->load_core( 'PUE' );
694
-			do_action( 'AHEE__EE_System__brew_espresso__after_pue_init' );
693
+			$this->registry->load_core('PUE');
694
+			do_action('AHEE__EE_System__brew_espresso__after_pue_init');
695 695
 		}
696
-		do_action( 'AHEE__EE_System__brew_espresso__complete', $this );
696
+		do_action('AHEE__EE_System__brew_espresso__complete', $this);
697 697
 	}
698 698
 
699 699
 
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
 	 */
708 708
 	public function set_hooks_for_core() {
709 709
 		$this->_deactivate_incompatible_addons();
710
-		do_action( 'AHEE__EE_System__set_hooks_for_core' );
710
+		do_action('AHEE__EE_System__set_hooks_for_core');
711 711
 	}
712 712
 
713 713
 
@@ -716,15 +716,15 @@  discard block
 block discarded – undo
716 716
 	 * Using the information gathered in EE_System::_incompatible_addon_error,
717 717
 	 * deactivates any addons considered incompatible with the current version of EE
718 718
 	 */
719
-	private function _deactivate_incompatible_addons(){
720
-		$incompatible_addons = get_option( 'ee_incompatible_addons', array() );
721
-		if ( ! empty( $incompatible_addons )) {
722
-			$active_plugins = get_option( 'active_plugins', array() );
723
-			foreach ( $active_plugins as $active_plugin ) {
724
-				foreach ( $incompatible_addons as $incompatible_addon ) {
725
-					if ( strpos( $active_plugin,  $incompatible_addon ) !== FALSE ) {
726
-						unset( $_GET['activate'] );
727
-						espresso_deactivate_plugin( $active_plugin );
719
+	private function _deactivate_incompatible_addons() {
720
+		$incompatible_addons = get_option('ee_incompatible_addons', array());
721
+		if ( ! empty($incompatible_addons)) {
722
+			$active_plugins = get_option('active_plugins', array());
723
+			foreach ($active_plugins as $active_plugin) {
724
+				foreach ($incompatible_addons as $incompatible_addon) {
725
+					if (strpos($active_plugin, $incompatible_addon) !== FALSE) {
726
+						unset($_GET['activate']);
727
+						espresso_deactivate_plugin($active_plugin);
728 728
 					}
729 729
 				}
730 730
 			}
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
 	 */
742 742
 	public function perform_activations_upgrades_and_migrations() {
743 743
 		//first check if we had previously attempted to setup EE's directories but failed
744
-		if( EEH_Activation::upload_directories_incomplete() ) {
744
+		if (EEH_Activation::upload_directories_incomplete()) {
745 745
 			EEH_Activation::create_upload_directories();
746 746
 		}
747
-		do_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations' );
747
+		do_action('AHEE__EE_System__perform_activations_upgrades_and_migrations');
748 748
 	}
749 749
 
750 750
 
@@ -756,10 +756,10 @@  discard block
 block discarded – undo
756 756
 	 *  	@return 	void
757 757
 	 */
758 758
 	public function load_CPTs_and_session() {
759
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__start' );
759
+		do_action('AHEE__EE_System__load_CPTs_and_session__start');
760 760
 		// register Custom Post Types
761
-		$this->registry->load_core( 'Register_CPTs' );
762
-		do_action( 'AHEE__EE_System__load_CPTs_and_session__complete' );
761
+		$this->registry->load_core('Register_CPTs');
762
+		do_action('AHEE__EE_System__load_CPTs_and_session__complete');
763 763
 	}
764 764
 
765 765
 
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
 	* @return void
775 775
 	*/
776 776
 	public function load_controllers() {
777
-		do_action( 'AHEE__EE_System__load_controllers__start' );
777
+		do_action('AHEE__EE_System__load_controllers__start');
778 778
 		// let's get it started
779
-		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level() ) {
780
-			do_action( 'AHEE__EE_System__load_controllers__load_front_controllers' );
781
-			$this->registry->load_core( 'Front_Controller', array(), false, true );
782
-		} else if ( ! EE_FRONT_AJAX ) {
783
-			do_action( 'AHEE__EE_System__load_controllers__load_admin_controllers' );
784
-			EE_Registry::instance()->load_core( 'Admin' );
779
+		if ( ! is_admin() && ! EE_Maintenance_Mode::instance()->level()) {
780
+			do_action('AHEE__EE_System__load_controllers__load_front_controllers');
781
+			$this->registry->load_core('Front_Controller', array(), false, true);
782
+		} else if ( ! EE_FRONT_AJAX) {
783
+			do_action('AHEE__EE_System__load_controllers__load_admin_controllers');
784
+			EE_Registry::instance()->load_core('Admin');
785 785
 		}
786
-		do_action( 'AHEE__EE_System__load_controllers__complete' );
786
+		do_action('AHEE__EE_System__load_controllers__complete');
787 787
 	}
788 788
 
789 789
 
@@ -797,9 +797,9 @@  discard block
 block discarded – undo
797 797
 	* @return void
798 798
 	*/
799 799
 	public function core_loaded_and_ready() {
800
-		do_action( 'AHEE__EE_System__core_loaded_and_ready' );
801
-		do_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons' );
802
-		$this->registry->load_core( 'Session' );
800
+		do_action('AHEE__EE_System__core_loaded_and_ready');
801
+		do_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons');
802
+		$this->registry->load_core('Session');
803 803
 		//		add_action( 'wp_loaded', array( $this, 'set_hooks_for_shortcodes_modules_and_addons' ), 1 );
804 804
 	}
805 805
 
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 	* @return void
815 815
 	*/
816 816
 	public function initialize() {
817
-		do_action( 'AHEE__EE_System__initialize' );
817
+		do_action('AHEE__EE_System__initialize');
818 818
 	}
819 819
 
820 820
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 	* @return void
829 829
 	*/
830 830
 	public function initialize_last() {
831
-		do_action( 'AHEE__EE_System__initialize_last' );
831
+		do_action('AHEE__EE_System__initialize_last');
832 832
 	}
833 833
 
834 834
 
@@ -860,21 +860,21 @@  discard block
 block discarded – undo
860 860
 	*/
861 861
 	public static function do_not_cache() {
862 862
 		// set no cache constants
863
-		if ( ! defined( 'DONOTCACHEPAGE' ) ) {
864
-			define( 'DONOTCACHEPAGE', true );
863
+		if ( ! defined('DONOTCACHEPAGE')) {
864
+			define('DONOTCACHEPAGE', true);
865 865
 		}
866
-		if ( ! defined( 'DONOTCACHCEOBJECT' ) ) {
867
-			define( 'DONOTCACHCEOBJECT', true );
866
+		if ( ! defined('DONOTCACHCEOBJECT')) {
867
+			define('DONOTCACHCEOBJECT', true);
868 868
 		}
869
-		if ( ! defined( 'DONOTCACHEDB' ) ) {
870
-			define( 'DONOTCACHEDB', true );
869
+		if ( ! defined('DONOTCACHEDB')) {
870
+			define('DONOTCACHEDB', true);
871 871
 		}
872 872
 		// add no cache headers
873
-		add_action( 'send_headers' , array( 'EE_System', 'nocache_headers' ), 10 );
873
+		add_action('send_headers', array('EE_System', 'nocache_headers'), 10);
874 874
 		// plus a little extra for nginx and Google Chrome
875
-		add_filter( 'nocache_headers', array( 'EE_System', 'extra_nocache_headers' ), 10, 1 );
875
+		add_filter('nocache_headers', array('EE_System', 'extra_nocache_headers'), 10, 1);
876 876
 		// prevent browsers from prefetching of the rel='next' link, because it may contain content that interferes with the registration process
877
-		remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );
877
+		remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
878 878
 	}
879 879
 
880 880
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 	 * @param $headers
887 887
 	 * @return    array
888 888
 	 */
889
-	public static function extra_nocache_headers ( $headers ) {
889
+	public static function extra_nocache_headers($headers) {
890 890
 		// for NGINX
891 891
 		$headers['X-Accel-Expires'] = 0;
892 892
 		// plus extra for Google Chrome since it doesn't seem to respect "no-cache", but WILL respect "no-store"
@@ -915,14 +915,14 @@  discard block
 block discarded – undo
915 915
 	 * @param  WP_Admin_Bar $admin_bar
916 916
 	 * @return void
917 917
 	 */
918
-	public function espresso_toolbar_items( WP_Admin_Bar $admin_bar ) {
918
+	public function espresso_toolbar_items(WP_Admin_Bar $admin_bar) {
919 919
 
920 920
 		// if in full M-Mode, or its an AJAX request, or user is NOT an admin
921
-		if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined( 'DOING_AJAX' ) || ! $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_top_level' )) {
921
+		if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance || defined('DOING_AJAX') || ! $this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_top_level')) {
922 922
 			return;
923 923
 		}
924 924
 
925
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
925
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
926 926
 		$menu_class = 'espresso_menu_item_class';
927 927
 		//we don't use the constants EVENTS_ADMIN_URL or REG_ADMIN_URL
928 928
 		//because they're only defined in each of their respective constructors
@@ -934,20 +934,20 @@  discard block
 block discarded – undo
934 934
 		//Top Level
935 935
 		$admin_bar->add_menu(array(
936 936
 				'id' => 'espresso-toolbar',
937
-				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">' . _x('Event Espresso', 'admin bar menu group label', 'event_espresso') . '</span>',
937
+				'title' => '<span class="ee-icon ee-icon-ee-cup-thick ee-icon-size-20"></span><span class="ab-label">'._x('Event Espresso', 'admin bar menu group label', 'event_espresso').'</span>',
938 938
 				'href' => $events_admin_url,
939 939
 				'meta' => array(
940 940
 						'title' => __('Event Espresso', 'event_espresso'),
941
-						'class' => $menu_class . 'first'
941
+						'class' => $menu_class.'first'
942 942
 				),
943 943
 		));
944 944
 
945 945
 		//Events
946
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events' ) ) {
946
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events')) {
947 947
 			$admin_bar->add_menu(array(
948 948
 					'id' => 'espresso-toolbar-events',
949 949
 					'parent' => 'espresso-toolbar',
950
-					'title' => __( 'Events', 'event_espresso' ),
950
+					'title' => __('Events', 'event_espresso'),
951 951
 					'href' => $events_admin_url,
952 952
 					'meta' => array(
953 953
 							'title' => __('Events', 'event_espresso'),
@@ -958,13 +958,13 @@  discard block
 block discarded – undo
958 958
 		}
959 959
 
960 960
 
961
-		if ( $this->registry->CAP->current_user_can( 'ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new' ) ) {
961
+		if ($this->registry->CAP->current_user_can('ee_edit_events', 'ee_admin_bar_menu_espresso-toolbar-events-new')) {
962 962
 			//Events Add New
963 963
 			$admin_bar->add_menu(array(
964 964
 					'id' => 'espresso-toolbar-events-new',
965 965
 					'parent' => 'espresso-toolbar-events',
966 966
 					'title' => __('Add New', 'event_espresso'),
967
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'create_new' ), $events_admin_url ),
967
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'create_new'), $events_admin_url),
968 968
 					'meta' => array(
969 969
 							'title' => __('Add New', 'event_espresso'),
970 970
 							'target' => '',
@@ -973,18 +973,18 @@  discard block
 block discarded – undo
973 973
 			));
974 974
 		}
975 975
 
976
-		if ( is_single() && ( get_post_type() == 'espresso_events' ) ) {
976
+		if (is_single() && (get_post_type() == 'espresso_events')) {
977 977
 
978 978
 			//Current post
979 979
 			global $post;
980 980
 
981
-	    	if ( $this->registry->CAP->current_user_can( 'ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID ) ) {
981
+	    	if ($this->registry->CAP->current_user_can('ee_edit_event', 'ee_admin_bar_menu_espresso-toolbar-events-edit', $post->ID)) {
982 982
 				//Events Edit Current Event
983 983
 				$admin_bar->add_menu(array(
984 984
 						'id' => 'espresso-toolbar-events-edit',
985 985
 						'parent' => 'espresso-toolbar-events',
986 986
 						'title' => __('Edit Event', 'event_espresso'),
987
-						'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'edit', 'post'=>$post->ID ), $events_admin_url ),
987
+						'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'edit', 'post'=>$post->ID), $events_admin_url),
988 988
 						'meta' => array(
989 989
 								'title' => __('Edit Event', 'event_espresso'),
990 990
 								'target' => '',
@@ -996,11 +996,11 @@  discard block
 block discarded – undo
996 996
 		}
997 997
 
998 998
 		//Events View
999
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view' ) ) {
999
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-view')) {
1000 1000
 			$admin_bar->add_menu(array(
1001 1001
 					'id' => 'espresso-toolbar-events-view',
1002 1002
 					'parent' => 'espresso-toolbar-events',
1003
-					'title' => __( 'View', 'event_espresso' ),
1003
+					'title' => __('View', 'event_espresso'),
1004 1004
 					'href' => $events_admin_url,
1005 1005
 					'meta' => array(
1006 1006
 							'title' => __('View', 'event_espresso'),
@@ -1010,12 +1010,12 @@  discard block
 block discarded – undo
1010 1010
 			));
1011 1011
 		}
1012 1012
 
1013
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all' ) ) {
1013
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-all')) {
1014 1014
 			//Events View All
1015 1015
 			$admin_bar->add_menu(array(
1016 1016
 					'id' => 'espresso-toolbar-events-all',
1017 1017
 					'parent' => 'espresso-toolbar-events-view',
1018
-					'title' => __( 'All', 'event_espresso' ),
1018
+					'title' => __('All', 'event_espresso'),
1019 1019
 					'href' => $events_admin_url,
1020 1020
 					'meta' => array(
1021 1021
 							'title' => __('All', 'event_espresso'),
@@ -1026,13 +1026,13 @@  discard block
 block discarded – undo
1026 1026
 		}
1027 1027
 
1028 1028
 
1029
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today' ) ) {
1029
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-today')) {
1030 1030
 			//Events View Today
1031 1031
 			$admin_bar->add_menu(array(
1032 1032
 					'id' => 'espresso-toolbar-events-today',
1033 1033
 					'parent' => 'espresso-toolbar-events-view',
1034 1034
 					'title' => __('Today', 'event_espresso'),
1035
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $events_admin_url ),
1035
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $events_admin_url),
1036 1036
 					'meta' => array(
1037 1037
 							'title' => __('Today', 'event_espresso'),
1038 1038
 							'target' => '',
@@ -1042,13 +1042,13 @@  discard block
 block discarded – undo
1042 1042
 		}
1043 1043
 
1044 1044
 
1045
-		if ( $this->registry->CAP->current_user_can( 'ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month' ) ) {
1045
+		if ($this->registry->CAP->current_user_can('ee_read_events', 'ee_admin_bar_menu_espresso-toolbar-events-month')) {
1046 1046
 			//Events View This Month
1047 1047
 			$admin_bar->add_menu(array(
1048 1048
 					'id' => 'espresso-toolbar-events-month',
1049 1049
 					'parent' => 'espresso-toolbar-events-view',
1050
-					'title' => __( 'This Month', 'event_espresso'),
1051
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $events_admin_url ),
1050
+					'title' => __('This Month', 'event_espresso'),
1051
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $events_admin_url),
1052 1052
 					'meta' => array(
1053 1053
 							'title' => __('This Month', 'event_espresso'),
1054 1054
 							'target' => '',
@@ -1058,11 +1058,11 @@  discard block
 block discarded – undo
1058 1058
 		}
1059 1059
 
1060 1060
 		//Registration Overview
1061
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations' ) ) {
1061
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations')) {
1062 1062
 			$admin_bar->add_menu(array(
1063 1063
 					'id' => 'espresso-toolbar-registrations',
1064 1064
 					'parent' => 'espresso-toolbar',
1065
-					'title' => __( 'Registrations', 'event_espresso' ),
1065
+					'title' => __('Registrations', 'event_espresso'),
1066 1066
 					'href' => $reg_admin_url,
1067 1067
 					'meta' => array(
1068 1068
 							'title' => __('Registrations', 'event_espresso'),
@@ -1073,12 +1073,12 @@  discard block
 block discarded – undo
1073 1073
 		}
1074 1074
 
1075 1075
 		//Registration Overview Today
1076
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today' ) ) {
1076
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today')) {
1077 1077
 			$admin_bar->add_menu(array(
1078 1078
 					'id' => 'espresso-toolbar-registrations-today',
1079 1079
 					'parent' => 'espresso-toolbar-registrations',
1080
-					'title' => __( 'Today', 'event_espresso'),
1081
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today' ), $reg_admin_url ),
1080
+					'title' => __('Today', 'event_espresso'),
1081
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today'), $reg_admin_url),
1082 1082
 					'meta' => array(
1083 1083
 							'title' => __('Today', 'event_espresso'),
1084 1084
 							'target' => '',
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 		}
1089 1089
 
1090 1090
 		//Registration Overview Today Completed
1091
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved' ) ) {
1091
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-approved')) {
1092 1092
 			$admin_bar->add_menu(array(
1093 1093
 					'id' => 'espresso-toolbar-registrations-today-approved',
1094 1094
 					'parent' => 'espresso-toolbar-registrations-today',
1095
-					'title' => __( 'Approved', 'event_espresso' ),
1096
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1095
+					'title' => __('Approved', 'event_espresso'),
1096
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1097 1097
 					'meta' => array(
1098
-							'title' => __('Approved', 'event_espresso' ),
1098
+							'title' => __('Approved', 'event_espresso'),
1099 1099
 							'target' => '',
1100 1100
 							'class' => $menu_class
1101 1101
 					),
@@ -1103,14 +1103,14 @@  discard block
 block discarded – undo
1103 1103
 		}
1104 1104
 
1105 1105
 		//Registration Overview Today Pending\
1106
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending' ) ) {
1106
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-pending')) {
1107 1107
 			$admin_bar->add_menu(array(
1108 1108
 					'id' => 'espresso-toolbar-registrations-today-pending',
1109 1109
 					'parent' => 'espresso-toolbar-registrations-today',
1110
-					'title' => __( 'Pending', 'event_espresso' ),
1111
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1110
+					'title' => __('Pending', 'event_espresso'),
1111
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', 'reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1112 1112
 					'meta' => array(
1113
-							'title' => __('Pending Payment', 'event_espresso' ),
1113
+							'title' => __('Pending Payment', 'event_espresso'),
1114 1114
 							'target' => '',
1115 1115
 							'class' => $menu_class
1116 1116
 					),
@@ -1118,14 +1118,14 @@  discard block
 block discarded – undo
1118 1118
 		}
1119 1119
 
1120 1120
 		//Registration Overview Today Incomplete
1121
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved' ) ) {
1121
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-not-approved')) {
1122 1122
 			$admin_bar->add_menu(array(
1123 1123
 					'id' => 'espresso-toolbar-registrations-today-not-approved',
1124 1124
 					'parent' => 'espresso-toolbar-registrations-today',
1125
-					'title' => __( 'Not Approved', 'event_espresso' ),
1126
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1125
+					'title' => __('Not Approved', 'event_espresso'),
1126
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1127 1127
 					'meta' => array(
1128
-							'title' => __('Not Approved', 'event_espresso' ),
1128
+							'title' => __('Not Approved', 'event_espresso'),
1129 1129
 							'target' => '',
1130 1130
 							'class' => $menu_class
1131 1131
 					),
@@ -1133,12 +1133,12 @@  discard block
 block discarded – undo
1133 1133
 		}
1134 1134
 
1135 1135
 		//Registration Overview Today Incomplete
1136
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled' ) ) {
1136
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-today-cancelled')) {
1137 1137
 			$admin_bar->add_menu(array(
1138 1138
 					'id' => 'espresso-toolbar-registrations-today-cancelled',
1139 1139
 					'parent' => 'espresso-toolbar-registrations-today',
1140
-					'title' => __( 'Cancelled', 'event_espresso'),
1141
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1140
+					'title' => __('Cancelled', 'event_espresso'),
1141
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'today', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1142 1142
 					'meta' => array(
1143 1143
 							'title' => __('Cancelled', 'event_espresso'),
1144 1144
 							'target' => '',
@@ -1148,12 +1148,12 @@  discard block
 block discarded – undo
1148 1148
 		}
1149 1149
 
1150 1150
 		//Registration Overview This Month
1151
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month' ) ) {
1151
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month')) {
1152 1152
 			$admin_bar->add_menu(array(
1153 1153
 					'id' => 'espresso-toolbar-registrations-month',
1154 1154
 					'parent' => 'espresso-toolbar-registrations',
1155
-					'title' => __( 'This Month', 'event_espresso' ),
1156
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month' ), $reg_admin_url ),
1155
+					'title' => __('This Month', 'event_espresso'),
1156
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month'), $reg_admin_url),
1157 1157
 					'meta' => array(
1158 1158
 							'title' => __('This Month', 'event_espresso'),
1159 1159
 							'target' => '',
@@ -1163,12 +1163,12 @@  discard block
 block discarded – undo
1163 1163
 		}
1164 1164
 
1165 1165
 		//Registration Overview This Month Approved
1166
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved' ) ) {
1166
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-approved')) {
1167 1167
 			$admin_bar->add_menu(array(
1168 1168
 					'id' => 'espresso-toolbar-registrations-month-approved',
1169 1169
 					'parent' => 'espresso-toolbar-registrations-month',
1170
-					'title' => __( 'Approved', 'event_espresso' ),
1171
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved ), $reg_admin_url ),
1170
+					'title' => __('Approved', 'event_espresso'),
1171
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_approved), $reg_admin_url),
1172 1172
 					'meta' => array(
1173 1173
 							'title' => __('Approved', 'event_espresso'),
1174 1174
 							'target' => '',
@@ -1178,12 +1178,12 @@  discard block
 block discarded – undo
1178 1178
 		}
1179 1179
 
1180 1180
 		//Registration Overview This Month Pending
1181
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending' ) ) {
1181
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-pending')) {
1182 1182
 			$admin_bar->add_menu(array(
1183 1183
 					'id' => 'espresso-toolbar-registrations-month-pending',
1184 1184
 					'parent' => 'espresso-toolbar-registrations-month',
1185
-					'title' => __( 'Pending', 'event_espresso'),
1186
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment ), $reg_admin_url ),
1185
+					'title' => __('Pending', 'event_espresso'),
1186
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_pending_payment), $reg_admin_url),
1187 1187
 					'meta' => array(
1188 1188
 							'title' => __('Pending', 'event_espresso'),
1189 1189
 							'target' => '',
@@ -1193,14 +1193,14 @@  discard block
 block discarded – undo
1193 1193
 		}
1194 1194
 
1195 1195
 		//Registration Overview This Month Not Approved
1196
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved' ) ) {
1196
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-not-approved')) {
1197 1197
 			$admin_bar->add_menu(array(
1198 1198
 					'id' => 'espresso-toolbar-registrations-month-not-approved',
1199 1199
 					'parent' => 'espresso-toolbar-registrations-month',
1200
-					'title' => __( 'Not Approved', 'event_espresso'),
1201
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved ), $reg_admin_url ),
1200
+					'title' => __('Not Approved', 'event_espresso'),
1201
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_not_approved), $reg_admin_url),
1202 1202
 					'meta' => array(
1203
-							'title' => __('Not Approved', 'event_espresso' ),
1203
+							'title' => __('Not Approved', 'event_espresso'),
1204 1204
 							'target' => '',
1205 1205
 							'class' => $menu_class
1206 1206
 					),
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
 
1210 1210
 
1211 1211
 		//Registration Overview This Month Cancelled
1212
-		if ( $this->registry->CAP->current_user_can( 'ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled' ) ) {
1212
+		if ($this->registry->CAP->current_user_can('ee_read_registrations', 'ee_admin_bar_menu_espresso-toolbar-registrations-month-cancelled')) {
1213 1213
 			$admin_bar->add_menu(array(
1214 1214
 					'id' => 'espresso-toolbar-registrations-month-cancelled',
1215 1215
 					'parent' => 'espresso-toolbar-registrations-month',
1216 1216
 					'title' => __('Cancelled', 'event_espresso'),
1217
-					'href' => EEH_URL::add_query_args_and_nonce( array( 'action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled ), $reg_admin_url ),
1217
+					'href' => EEH_URL::add_query_args_and_nonce(array('action'=>'default', 'status'=>'month', '_reg_status'=>EEM_Registration::status_id_cancelled), $reg_admin_url),
1218 1218
 					'meta' => array(
1219 1219
 							'title' => __('Cancelled', 'event_espresso'),
1220 1220
 							'target' => '',
@@ -1224,11 +1224,11 @@  discard block
 block discarded – undo
1224 1224
 		}
1225 1225
 
1226 1226
 		//Extensions & Services
1227
-		if ( $this->registry->CAP->current_user_can( 'ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services' ) ) {
1227
+		if ($this->registry->CAP->current_user_can('ee_read_ee', 'ee_admin_bar_menu_espresso-toolbar-extensions-and-services')) {
1228 1228
 			$admin_bar->add_menu(array(
1229 1229
 					'id' => 'espresso-toolbar-extensions-and-services',
1230 1230
 					'parent' => 'espresso-toolbar',
1231
-					'title' => __( 'Extensions & Services', 'event_espresso' ),
1231
+					'title' => __('Extensions & Services', 'event_espresso'),
1232 1232
 					'href' => $extensions_admin_url,
1233 1233
 					'meta' => array(
1234 1234
 							'title' => __('Extensions & Services', 'event_espresso'),
@@ -1250,8 +1250,8 @@  discard block
 block discarded – undo
1250 1250
 	 * @param  array  $exclude_array any existing pages being excluded are in this array.
1251 1251
 	 * @return array
1252 1252
 	 */
1253
-	public function remove_pages_from_wp_list_pages( $exclude_array ) {
1254
-		return  array_merge( $exclude_array, $this->registry->CFG->core->get_critical_pages_array() );
1253
+	public function remove_pages_from_wp_list_pages($exclude_array) {
1254
+		return  array_merge($exclude_array, $this->registry->CFG->core->get_critical_pages_array());
1255 1255
 	}
1256 1256
 
1257 1257
 
@@ -1271,15 +1271,15 @@  discard block
 block discarded – undo
1271 1271
 	 */
1272 1272
 	public function wp_enqueue_scripts() {
1273 1273
 		// unlike other systems, EE_System_scripts loading is turned ON by default, but prior to the init hook, can be turned off via: add_filter( 'FHEE_load_EE_System_scripts', '__return_false' );
1274
-		if ( apply_filters( 'FHEE_load_EE_System_scripts', TRUE ) ) {
1274
+		if (apply_filters('FHEE_load_EE_System_scripts', TRUE)) {
1275 1275
 			// jquery_validate loading is turned OFF by default, but prior to the wp_enqueue_scripts hook, can be turned back on again via:  add_filter( 'FHEE_load_jquery_validate', '__return_true' );
1276
-			if ( apply_filters( 'FHEE_load_jquery_validate', FALSE ) ) {
1276
+			if (apply_filters('FHEE_load_jquery_validate', FALSE)) {
1277 1277
 				// register jQuery Validate and additional methods
1278
-				wp_register_script( 'jquery-validate', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.min.js', array('jquery' ), '1.15.0', TRUE );
1279
-				wp_register_script( 'jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL . 'scripts/jquery.validate.additional-methods.min.js', array( 'jquery', 'jquery-validate' ), '1.15.0', TRUE );
1278
+				wp_register_script('jquery-validate', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.min.js', array('jquery'), '1.15.0', TRUE);
1279
+				wp_register_script('jquery-validate-extra-methods', EE_GLOBAL_ASSETS_URL.'scripts/jquery.validate.additional-methods.min.js', array('jquery', 'jquery-validate'), '1.15.0', TRUE);
1280 1280
 			}
1281
-			wp_register_script( 'select2', EE_GLOBAL_ASSETS_URL . 'scripts/select2.min.js', array(), '4.0.2', true );
1282
-			wp_register_style( 'select2', EE_GLOBAL_ASSETS_URL . 'css/select2.min.css', array(), '4.0.2', 'all' );
1281
+			wp_register_script('select2', EE_GLOBAL_ASSETS_URL.'scripts/select2.min.js', array(), '4.0.2', true);
1282
+			wp_register_style('select2', EE_GLOBAL_ASSETS_URL.'css/select2.min.css', array(), '4.0.2', 'all');
1283 1283
 		}
1284 1284
 	}
1285 1285
 
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/SequentialStepFormManager.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 use Exception;
17 17
 use InvalidArgumentException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
 		$progress_step_style = 'number_bubbles',
116 116
 		EE_Request $request
117 117
 	) {
118
-		$this->setBaseUrl( $base_url );
119
-		$this->setDefaultFormStep( $default_form_step );
120
-		$this->setFormAction( $form_action );
121
-		$this->setFormConfig( $form_config );
122
-		$this->setProgressStepStyle( $progress_step_style );
118
+		$this->setBaseUrl($base_url);
119
+		$this->setDefaultFormStep($default_form_step);
120
+		$this->setFormAction($form_action);
121
+		$this->setFormConfig($form_config);
122
+		$this->setProgressStepStyle($progress_step_style);
123 123
 		$this->request = $request;
124 124
 	}
125 125
 
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
131 131
 	 */
132 132
 	public function baseUrl() {
133
-		if ( strpos( $this->base_url, $this->getCurrentStep()->slug() ) === false ) {
133
+		if (strpos($this->base_url, $this->getCurrentStep()->slug()) === false) {
134 134
 			add_query_arg(
135
-				array( $this->form_step_url_key => $this->getCurrentStep()->slug() ),
135
+				array($this->form_step_url_key => $this->getCurrentStep()->slug()),
136 136
 				$this->base_url
137 137
 			);
138 138
 		}
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 	 * @throws InvalidDataTypeException
147 147
 	 * @throws InvalidArgumentException
148 148
 	 */
149
-	protected function setBaseUrl( $base_url ) {
150
-		if ( ! is_string( $base_url ) ) {
151
-			throw new InvalidDataTypeException( '$base_url', $base_url, 'string' );
149
+	protected function setBaseUrl($base_url) {
150
+		if ( ! is_string($base_url)) {
151
+			throw new InvalidDataTypeException('$base_url', $base_url, 'string');
152 152
 		}
153
-		if ( empty( $base_url ) ) {
153
+		if (empty($base_url)) {
154 154
 			throw new InvalidArgumentException(
155
-				__( 'The base URL can not be an empty string.', 'event_espresso' )
155
+				__('The base URL can not be an empty string.', 'event_espresso')
156 156
 			);
157 157
 		}
158 158
 		$this->base_url = $base_url;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @throws InvalidDataTypeException
166 166
 	 */
167 167
 	public function formStepUrlKey() {
168
-		if ( empty( $this->form_step_url_key ) ) {
168
+		if (empty($this->form_step_url_key)) {
169 169
 			$this->setFormStepUrlKey();
170 170
 		}
171 171
 		return $this->form_step_url_key;
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
 	 * @param string $form_step_url_key
178 178
 	 * @throws InvalidDataTypeException
179 179
 	 */
180
-	public function setFormStepUrlKey( $form_step_url_key = 'ee-form-step' ) {
181
-		if ( ! is_string( $form_step_url_key ) ) {
182
-			throw new InvalidDataTypeException( '$form_step_key', $form_step_url_key, 'string' );
180
+	public function setFormStepUrlKey($form_step_url_key = 'ee-form-step') {
181
+		if ( ! is_string($form_step_url_key)) {
182
+			throw new InvalidDataTypeException('$form_step_key', $form_step_url_key, 'string');
183 183
 		}
184
-		$this->form_step_url_key = ! empty( $form_step_url_key ) ? $form_step_url_key : 'ee-form-step';
184
+		$this->form_step_url_key = ! empty($form_step_url_key) ? $form_step_url_key : 'ee-form-step';
185 185
 	}
186 186
 
187 187
 
@@ -199,9 +199,9 @@  discard block
 block discarded – undo
199 199
 	 * @param $default_form_step
200 200
 	 * @throws InvalidDataTypeException
201 201
 	 */
202
-	protected function setDefaultFormStep( $default_form_step ) {
203
-		if ( ! is_string( $default_form_step ) ) {
204
-			throw new InvalidDataTypeException( '$default_form_step', $default_form_step, 'string' );
202
+	protected function setDefaultFormStep($default_form_step) {
203
+		if ( ! is_string($default_form_step)) {
204
+			throw new InvalidDataTypeException('$default_form_step', $default_form_step, 'string');
205 205
 		}
206 206
 		$this->default_form_step = $default_form_step;
207 207
 	}
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
 	 * @throws InvalidDataTypeException
215 215
 	 */
216 216
 	protected function setCurrentStepFromRequest() {
217
-		$current_step_slug = $this->request()->get( $this->formStepUrlKey(), $this->defaultFormStep() );
218
-		if ( ! $this->form_steps->setCurrent( $current_step_slug ) ) {
217
+		$current_step_slug = $this->request()->get($this->formStepUrlKey(), $this->defaultFormStep());
218
+		if ( ! $this->form_steps->setCurrent($current_step_slug)) {
219 219
 			throw new InvalidIdentifierException(
220 220
 				$current_step_slug,
221 221
 				$this->defaultFormStep(),
@@ -237,8 +237,8 @@  discard block
 block discarded – undo
237 237
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
238 238
 	 */
239 239
 	public function getCurrentStep() {
240
-		if ( ! $this->form_steps->current() instanceof SequentialStepForm ) {
241
-			throw new InvalidFormHandlerException( $this->form_steps->current() );
240
+		if ( ! $this->form_steps->current() instanceof SequentialStepForm) {
241
+			throw new InvalidFormHandlerException($this->form_steps->current());
242 242
 		}
243 243
 		return $this->form_steps->current();
244 244
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
251 251
 	 */
252 252
 	public function formAction() {
253
-		if ( ! is_string( $this->form_action ) || empty( $this->form_action ) ) {
253
+		if ( ! is_string($this->form_action) || empty($this->form_action)) {
254 254
 			$this->form_action = $this->baseUrl();
255 255
 		}
256 256
 		return $this->form_action;
@@ -262,9 +262,9 @@  discard block
 block discarded – undo
262 262
 	 * @param string $form_action
263 263
 	 * @throws InvalidDataTypeException
264 264
 	 */
265
-	public function setFormAction( $form_action ) {
266
-		if ( ! is_string( $form_action ) ) {
267
-			throw new InvalidDataTypeException( '$form_action', $form_action, 'string' );
265
+	public function setFormAction($form_action) {
266
+		if ( ! is_string($form_action)) {
267
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
268 268
 		}
269 269
 		$this->form_action = $form_action;
270 270
 	}
@@ -275,15 +275,15 @@  discard block
 block discarded – undo
275 275
 	 * @param array $form_action_args
276 276
 	 * @throws InvalidDataTypeException
277 277
 	 */
278
-	public function addFormActionArgs( $form_action_args = array() ) {
279
-		if ( ! is_array( $form_action_args ) ) {
280
-			throw new InvalidDataTypeException( '$form_action_args', $form_action_args, 'array' );
278
+	public function addFormActionArgs($form_action_args = array()) {
279
+		if ( ! is_array($form_action_args)) {
280
+			throw new InvalidDataTypeException('$form_action_args', $form_action_args, 'array');
281 281
 		}
282
-		$form_action_args = ! empty( $form_action_args )
282
+		$form_action_args = ! empty($form_action_args)
283 283
 			? $form_action_args
284
-			: array( $this->formStepUrlKey() => $this->form_steps->current()->slug() );
284
+			: array($this->formStepUrlKey() => $this->form_steps->current()->slug());
285 285
 		$this->getCurrentStep()->setFormAction(
286
-			add_query_arg( $form_action_args, $this->formAction() )
286
+			add_query_arg($form_action_args, $this->formAction())
287 287
 		);
288 288
 		$this->form_action = $this->getCurrentStep()->formAction();
289 289
 	}
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	/**
303 303
 	 * @param string $form_config
304 304
 	 */
305
-	public function setFormConfig( $form_config ) {
305
+	public function setFormConfig($form_config) {
306 306
 		$this->form_config = $form_config;
307 307
 	}
308 308
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 	/**
321 321
 	 * @param string $progress_step_style
322 322
 	 */
323
-	public function setProgressStepStyle( $progress_step_style ) {
323
+	public function setProgressStepStyle($progress_step_style) {
324 324
 		$this->progress_step_style = $progress_step_style;
325 325
 	}
326 326
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	protected function getProgressStepsCollection() {
342 342
 		static $collection = null;
343
-		if ( ! $collection instanceof ProgressStepCollection ) {
343
+		if ( ! $collection instanceof ProgressStepCollection) {
344 344
 			$collection = new ProgressStepCollection();
345 345
 		}
346 346
 		return $collection;
@@ -356,12 +356,12 @@  discard block
 block discarded – undo
356 356
 	 * @throws InvalidClassException
357 357
 	 * @throws InvalidInterfaceException
358 358
 	 */
359
-	protected function generateProgressSteps( Collection $progress_steps_collection ) {
359
+	protected function generateProgressSteps(Collection $progress_steps_collection) {
360 360
 		$current_step = $this->getCurrentStep();
361 361
 		/** @var SequentialStepForm $form_step */
362
-		foreach ( $this->form_steps as $form_step ) {
362
+		foreach ($this->form_steps as $form_step) {
363 363
 			// is this step active ?
364
-			if ( ! $form_step->initialize() ) {
364
+			if ( ! $form_step->initialize()) {
365 365
 				continue;
366 366
 			}
367 367
 			$progress_steps_collection->add(
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			);
376 376
 		}
377 377
 		// set collection pointer back to current step
378
-		$this->form_steps->setCurrentUsingObject( $current_step );
378
+		$this->form_steps->setCurrentUsingObject($current_step);
379 379
 		return new ProgressStepManager(
380 380
 			$this->progressStepStyle(),
381 381
 			$this->defaultFormStep(),
@@ -409,9 +409,9 @@  discard block
 block discarded – undo
409 409
 	 * @throws InvalidInterfaceException
410 410
 	 * @throws InvalidArgumentException
411 411
 	 */
412
-	public function processForm( $form_data = array() ) {
412
+	public function processForm($form_data = array()) {
413 413
 		$this->buildCurrentStepFormForProcessing();
414
-		$this->processCurrentStepForm( $form_data );
414
+		$this->processCurrentStepForm($form_data);
415 415
 	}
416 416
 
417 417
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	public function buildCurrentStepFormForDisplay() {
428 428
 		$form_step = $this->buildCurrentStepForm();
429 429
 		// no displayable content ? then skip straight to processing
430
-		if ( ! $form_step->displayable() ) {
430
+		if ( ! $form_step->displayable()) {
431 431
 			$this->addFormActionArgs();
432
-			$form_step->setFormAction( $this->formAction() );
433
-			wp_safe_redirect( $form_step->formAction() );
432
+			$form_step->setFormAction($this->formAction());
433
+			wp_safe_redirect($form_step->formAction());
434 434
 		}
435 435
 	}
436 436
 
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 	 * @throws InvalidArgumentException
446 446
 	 */
447 447
 	public function buildCurrentStepFormForProcessing() {
448
-		$this->buildCurrentStepForm( false );
448
+		$this->buildCurrentStepForm(false);
449 449
 	}
450 450
 
451 451
 
@@ -460,14 +460,14 @@  discard block
 block discarded – undo
460 460
 	 * @throws InvalidInterfaceException
461 461
 	 * @throws InvalidArgumentException
462 462
 	 */
463
-	private function buildCurrentStepForm( $for_display = true ) {
463
+	private function buildCurrentStepForm($for_display = true) {
464 464
 		$this->form_steps = $this->getFormStepsCollection();
465 465
 		$this->setCurrentStepFromRequest();
466 466
 		$form_step = $this->getCurrentStep();
467
-		if ( $form_step->submitBtnText() === __( 'Submit', 'event_espresso' ) ) {
468
-			$form_step->setSubmitBtnText( __( 'Next Step', 'event_espresso' ) );
467
+		if ($form_step->submitBtnText() === __('Submit', 'event_espresso')) {
468
+			$form_step->setSubmitBtnText(__('Next Step', 'event_espresso'));
469 469
 		}
470
-		if ( $for_display && $form_step->displayable() ) {
470
+		if ($for_display && $form_step->displayable()) {
471 471
 			$this->progress_step_manager = $this->generateProgressSteps(
472 472
 				$this->getProgressStepsCollection()
473 473
 			);
@@ -478,16 +478,16 @@  discard block
 block discarded – undo
478 478
 			$this->progress_step_manager->setPreviousStepsCompleted();
479 479
 			$this->progress_step_manager->enqueueStylesAndScripts();
480 480
 			$this->addFormActionArgs();
481
-			$form_step->setFormAction( $this->formAction() );
481
+			$form_step->setFormAction($this->formAction());
482 482
 
483 483
 		} else {
484
-			$form_step->setRedirectUrl( $this->baseUrl() );
484
+			$form_step->setRedirectUrl($this->baseUrl());
485 485
 			$form_step->addRedirectArgs(
486
-				array( $this->formStepUrlKey() => $this->form_steps->current()->slug() )
486
+				array($this->formStepUrlKey() => $this->form_steps->current()->slug())
487 487
 			);
488 488
 		}
489 489
 		$form_step->generate();
490
-		if ( $for_display ) {
490
+		if ($for_display) {
491 491
 			$form_step->enqueueStylesAndScripts();
492 492
 		}
493 493
 		return $form_step;
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	 * @param bool $return_as_string
500 500
 	 * @return string
501 501
 	 */
502
-	public function displayProgressSteps( $return_as_string = true ) {
502
+	public function displayProgressSteps($return_as_string = true) {
503 503
 		$progress_steps = apply_filters(
504 504
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__before_steps',
505 505
 			''
@@ -509,7 +509,7 @@  discard block
 block discarded – undo
509 509
 			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_SequentialStepFormManager__displayProgressSteps__after_steps',
510 510
 			''
511 511
 		);
512
-		if ( $return_as_string ) {
512
+		if ($return_as_string) {
513 513
 			return $progress_steps;
514 514
 		}
515 515
 		echo $progress_steps;
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @return string
524 524
 	 * @throws \EventEspresso\core\exceptions\InvalidDataTypeException
525 525
 	 */
526
-	public function displayCurrentStepForm( $return_as_string = true ) {
527
-		if ( $return_as_string ) {
526
+	public function displayCurrentStepForm($return_as_string = true) {
527
+		if ($return_as_string) {
528 528
 			return $this->getCurrentStep()->display();
529 529
 		}
530 530
 		echo $this->getCurrentStep()->display();
@@ -539,32 +539,32 @@  discard block
 block discarded – undo
539 539
 	 * @throws InvalidArgumentException
540 540
 	 * @throws InvalidDataTypeException
541 541
 	 */
542
-	public function processCurrentStepForm( $form_data = array() ) {
542
+	public function processCurrentStepForm($form_data = array()) {
543 543
 		// grab instance of current step because after calling next() below,
544 544
 		// any calls to getCurrentStep() will return the "next" step because we advanced
545 545
 		$current_step = $this->getCurrentStep();
546 546
 		try {
547 547
 			// form processing should either throw exceptions or return true
548
-			$current_step->process( $form_data );
549
-		} catch ( Exception $e ) {
548
+			$current_step->process($form_data);
549
+		} catch (Exception $e) {
550 550
 			// something went wrong, so...
551 551
 			// if WP_DEBUG === true, display the Exception and stack trace right now
552
-			new ExceptionStackTraceDisplay( $e );
552
+			new ExceptionStackTraceDisplay($e);
553 553
 			// else convert the Exception to an EE_Error
554
-			EE_Error::add_error( $e->getMessage(), __FILE__, __FUNCTION__, __LINE__ );
554
+			EE_Error::add_error($e->getMessage(), __FILE__, __FUNCTION__, __LINE__);
555 555
 			// prevent redirect to next step or other if exception was thrown
556 556
 			if (
557 557
 				$current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_NEXT_STEP
558 558
 				|| $current_step->redirectTo() === SequentialStepForm::REDIRECT_TO_OTHER
559 559
 			) {
560
-				$current_step->setRedirectTo( SequentialStepForm::REDIRECT_TO_CURRENT_STEP );
560
+				$current_step->setRedirectTo(SequentialStepForm::REDIRECT_TO_CURRENT_STEP);
561 561
 			}
562 562
 		}
563 563
 		// save notices to a transient so that when we redirect back
564 564
 		// to the display portion for this step
565 565
 		// those notices can be displayed
566
-		EE_Error::get_notices( false, true );
567
-		$this->redirectForm( $current_step );
566
+		EE_Error::get_notices(false, true);
567
+		$this->redirectForm($current_step);
568 568
 	}
569 569
 
570 570
 
@@ -574,13 +574,13 @@  discard block
 block discarded – undo
574 574
 	 *
575 575
 	 * @param \EventEspresso\core\libraries\form_sections\form_handlers\SequentialStepFormInterface $current_step
576 576
 	 */
577
-	public function redirectForm( SequentialStepFormInterface $current_step ) {
577
+	public function redirectForm(SequentialStepFormInterface $current_step) {
578 578
 		$redirect_step = $current_step;
579
-		switch( $current_step->redirectTo() ) {
579
+		switch ($current_step->redirectTo()) {
580 580
 
581 581
 			case SequentialStepForm::REDIRECT_TO_OTHER :
582 582
 				// going somewhere else, so just check out now
583
-				wp_safe_redirect( $redirect_step->redirectUrl() );
583
+				wp_safe_redirect($redirect_step->redirectUrl());
584 584
 				exit();
585 585
 				break;
586 586
 
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
 			case SequentialStepForm::REDIRECT_TO_NEXT_STEP :
592 592
 				$this->form_steps->next();
593
-				if ( $this->form_steps->valid() ) {
593
+				if ($this->form_steps->valid()) {
594 594
 					$redirect_step = $this->form_steps->current();
595 595
 				}
596 596
 				break;
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 				// $redirect_step is already set
601 601
 
602 602
 		}
603
-		$current_step->setRedirectUrl( $this->baseUrl() );
603
+		$current_step->setRedirectUrl($this->baseUrl());
604 604
 		$current_step->addRedirectArgs(
605 605
 			// use the slug for whatever step we are redirecting too
606
-			array( $this->formStepUrlKey() => $redirect_step->slug() )
606
+			array($this->formStepUrlKey() => $redirect_step->slug())
607 607
 		);
608
-		wp_safe_redirect( $current_step->redirectUrl() );
608
+		wp_safe_redirect($current_step->redirectUrl());
609 609
 		exit();
610 610
 	}
611 611
 
Please login to merge, or discard this patch.
strategies/validation/EE_Full_HTML_Validation_Strategy.strategy.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -10,20 +10,20 @@  discard block
 block discarded – undo
10 10
  * @since 				4.6
11 11
  *
12 12
  */
13
-class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base{
13
+class EE_Full_HTML_Validation_Strategy extends EE_Validation_Strategy_Base {
14 14
 
15 15
 	/**
16 16
 	 * @param null $validation_error_message
17 17
 	 */
18
-	public function __construct( $validation_error_message = NULL ) {
19
-		if ( ! $validation_error_message ) {
18
+	public function __construct($validation_error_message = NULL) {
19
+		if ( ! $validation_error_message) {
20 20
 			$validation_error_message = sprintf(
21
-				__( 'Only the following HTML tags are allowed:%1$s%2$s', "event_espresso" ),
21
+				__('Only the following HTML tags are allowed:%1$s%2$s', "event_espresso"),
22 22
 				'<br />',
23 23
 				$this->get_list_of_allowed_tags()
24 24
 			);
25 25
 		}
26
-		parent::__construct( $validation_error_message );
26
+		parent::__construct($validation_error_message);
27 27
 	}
28 28
 
29 29
 
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function get_list_of_allowed_tags() {
39 39
 		global $allowedposttags;
40
-		ksort( $allowedposttags );
41
-		return implode( ', ', array_keys( $allowedposttags ) );
40
+		ksort($allowedposttags);
41
+		return implode(', ', array_keys($allowedposttags));
42 42
 	}
43 43
 
44 44
 
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function validate($normalized_value) {
51 51
 		global $allowedposttags;
52
-		parent::validate( $normalized_value );
53
-		$normalized_value_sans_tags =  wp_kses( "$normalized_value", $allowedposttags );
54
-		if ( strlen( $normalized_value ) > strlen( $normalized_value_sans_tags ) ) {
55
-			throw new EE_Validation_Error( $this->get_validation_error_message(), 'complex_html_tags' );
52
+		parent::validate($normalized_value);
53
+		$normalized_value_sans_tags = wp_kses("$normalized_value", $allowedposttags);
54
+		if (strlen($normalized_value) > strlen($normalized_value_sans_tags)) {
55
+			throw new EE_Validation_Error($this->get_validation_error_message(), 'complex_html_tags');
56 56
 		}
57 57
 	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
strategies/display/EE_Admin_File_Uploader_Display_Strategy.strategy.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
  * @since                4.6
9 9
  *
10 10
  */
11
-class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base{
11
+class EE_Admin_File_Uploader_Display_Strategy extends EE_Display_Strategy_Base {
12 12
 
13 13
 	/**
14 14
 	 * Its important this media only get enqueued AFTER init, but before the footer... where the
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 	 * this input displayed.
21 21
 	 * @deprecated. enqueue_js should be called automatically now
22 22
 	 */
23
-	static function enqueue_scripts(){
24
-		EE_Error::doing_it_wrong( __FUNCTION__, __( 'EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015' );
23
+	static function enqueue_scripts() {
24
+		EE_Error::doing_it_wrong(__FUNCTION__, __('EE_Admin_File_Uploader_Display_Strategy::enqueue_scripts() no longer needs to be called in order to display the admin uploader input correctly. This is handled now by EE_Admin_File_Uploader_Display_Strategy::enqueue_js() which is called automatically when enqueueing JS and CSS for the form'), '4.9.8.rc.015');
25 25
 		wp_enqueue_media();
26 26
 		wp_enqueue_script('media-upload');
27
-		wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
27
+		wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
28 28
 	}
29 29
 	
30 30
 	/**
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	public function enqueue_js() {
34 34
 		wp_enqueue_media();
35 35
 		wp_enqueue_script('media-upload');
36
-		wp_enqueue_script('ee-payments',EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
36
+		wp_enqueue_script('ee-payments', EE_GLOBAL_ASSETS_URL.'scripts/ee-media-uploader.js');
37 37
 		parent::enqueue_js();
38 38
 	}
39 39
 
@@ -44,19 +44,19 @@  discard block
 block discarded – undo
44 44
 	 * @return string of html to display the field
45 45
 	 */
46 46
 
47
-	function display(){
47
+	function display() {
48 48
 		// the actual input
49 49
 		$input = '<input type="text" size="34" ';
50
-		$input .= 'name="' . $this->_input->html_name() . '" ';
51
-		$input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url ' . $this->_input->html_class() . '" ' : 'class="large-text ee_media_url" ';
52
-		$input .= 'value="' . $this->_input->raw_value_in_form() . '" ';
53
-		$input .= $this->_input->other_html_attributes() . '>';
50
+		$input .= 'name="'.$this->_input->html_name().'" ';
51
+		$input .= $this->_input->html_class() != '' ? 'class="large-text ee_media_url '.$this->_input->html_class().'" ' : 'class="large-text ee_media_url" ';
52
+		$input .= 'value="'.$this->_input->raw_value_in_form().'" ';
53
+		$input .= $this->_input->other_html_attributes().'>';
54 54
 		// image uploader
55
-		$uploader = EEH_HTML::link( '#', '<img src="' . admin_url( 'images/media-button-image.gif' ) . '" >', __( 'click to add an image', 'event_espresso' ), '', 'ee_media_upload' );
55
+		$uploader = EEH_HTML::link('#', '<img src="'.admin_url('images/media-button-image.gif').'" >', __('click to add an image', 'event_espresso'), '', 'ee_media_upload');
56 56
 		//only attempt to show the image if it at least exists
57
-		$image = $this->src_exists( $this->_input->raw_value() ) ? EEH_HTML::br(2) . EEH_HTML::img( $this->_input->raw_value(), __( 'logo', 'event_espresso' ), '', 'ee_media_image' ) : '';
57
+		$image = $this->src_exists($this->_input->raw_value()) ? EEH_HTML::br(2).EEH_HTML::img($this->_input->raw_value(), __('logo', 'event_espresso'), '', 'ee_media_image') : '';
58 58
 		// html string
59
-		return EEH_HTML::div( $input . EEH_HTML::nbsp() . $uploader . $image, '', 'ee_media_uploader_area' );
59
+		return EEH_HTML::div($input.EEH_HTML::nbsp().$uploader.$image, '', 'ee_media_uploader_area');
60 60
 	}
61 61
 
62 62
 
@@ -67,11 +67,11 @@  discard block
 block discarded – undo
67 67
 	 * @param string $src
68 68
 	 * @return boolean
69 69
 	 */
70
-	protected function src_exists( $src ){
71
-		$results = wp_remote_head( $src );
72
-		if( is_array( $results) && ! $results instanceof WP_Error){
73
-			return strpos($results['headers']['content-type'], "image" ) !== FALSE;
74
-		}else{
70
+	protected function src_exists($src) {
71
+		$results = wp_remote_head($src);
72
+		if (is_array($results) && ! $results instanceof WP_Error) {
73
+			return strpos($results['headers']['content-type'], "image") !== FALSE;
74
+		} else {
75 75
 			return FALSE;
76 76
 		}
77 77
 	}
Please login to merge, or discard this patch.
core/EE_Deprecated.core.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -881,7 +881,7 @@
 block discarded – undo
881 881
 
882 882
 	/**
883 883
 	 * @deprecated 4.9.0
884
-	 * @return array
884
+	 * @return EE_messenger[]
885 885
 	 */
886 886
 	public function get_installed_messengers() {
887 887
 		// EE_messages has been deprecated
Please login to merge, or discard this patch.
Spacing   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  * ************************************************************************
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
  * @param \EE_Checkout $checkout
32 32
  * @return string
33 33
  */
34
-function ee_deprecated__registration_checkout__button_text( $submit_button_text, EE_Checkout $checkout ) {
34
+function ee_deprecated__registration_checkout__button_text($submit_button_text, EE_Checkout $checkout) {
35 35
 	// list of old filters
36 36
 	$deprecated_filters = array(
37 37
 		'update_registration_details' => true,
@@ -41,16 +41,16 @@  discard block
 block discarded – undo
41 41
 		'proceed_to' => true,
42 42
 	);
43 43
 	// loop thru and call doing_it_wrong() or remove any that aren't being used
44
-	foreach ( $deprecated_filters as $deprecated_filter => $on ) {
44
+	foreach ($deprecated_filters as $deprecated_filter => $on) {
45 45
 		// was this filter called ?
46
-		if ( has_action( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter )) {
46
+		if (has_action('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter)) {
47 47
 			// only display doing_it_wrong() notice to Event Admins during non-AJAX requests
48
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter' ) && ! defined( 'DOING_AJAX' ) ) {
48
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_ee', 'hide_doing_it_wrong_for_deprecated_SPCO_filter') && ! defined('DOING_AJAX')) {
49 49
 				EE_Error::doing_it_wrong(
50
-					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
50
+					'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
51 51
 					sprintf(
52
-						__( 'The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso' ),
53
-						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__' . $deprecated_filter,
52
+						__('The %1$s filter is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new filter: %2$s"%3$s" found in "%4$s"', 'event_espresso'),
53
+						'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__'.$deprecated_filter,
54 54
 						'<br />',
55 55
 						'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text',
56 56
 						'/modules/single_page_checkout/inc/EE_SPCO_Reg_Step.class.php'
@@ -59,24 +59,24 @@  discard block
 block discarded – undo
59 59
 				);
60 60
 			}
61 61
 		} else {
62
-			unset( $deprecated_filters[ $deprecated_filter ] );
62
+			unset($deprecated_filters[$deprecated_filter]);
63 63
 		}
64 64
 	}
65
-	if ( ! empty( $deprecated_filters )) {
65
+	if ( ! empty($deprecated_filters)) {
66 66
 
67
-		if ( $checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset( $deprecated_filters[ 'update_registration_details' ] )) {
68
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text );
69
-		} else if ( $checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset( $deprecated_filters[ 'process_payment' ] ) ) {
70
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text );
71
-		} else if ( $checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset( $deprecated_filters[ 'finalize_registration' ] ) ) {
72
-			$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text );
67
+		if ($checkout->current_step->slug() == 'attendee_information' && $checkout->revisit && isset($deprecated_filters['update_registration_details'])) {
68
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $submit_button_text);
69
+		} else if ($checkout->current_step->slug() == 'payment_options' && $checkout->revisit && isset($deprecated_filters['process_payment'])) {
70
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $submit_button_text);
71
+		} else if ($checkout->next_step instanceof EE_SPCO_Reg_Step && $checkout->next_step->slug() == 'finalize_registration' && isset($deprecated_filters['finalize_registration'])) {
72
+			$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $submit_button_text);
73 73
 		}
74
-		if ( $checkout->next_step instanceof EE_SPCO_Reg_Step ) {
75
-			if ( $checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset( $deprecated_filters[ 'and_proceed_to_payment' ] ) ) {
76
-				$submit_button_text .= apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text );
74
+		if ($checkout->next_step instanceof EE_SPCO_Reg_Step) {
75
+			if ($checkout->payment_required() && $checkout->next_step->slug() == 'payment_options' && isset($deprecated_filters['and_proceed_to_payment'])) {
76
+				$submit_button_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $submit_button_text);
77 77
 			}
78
-			if ( $checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset( $deprecated_filters[ 'proceed_to' ] ) ) {
79
-				$submit_button_text = apply_filters( 'FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text ) . $checkout->next_step->name();
78
+			if ($checkout->next_step->slug() != 'finalize_registration' && ! $checkout->revisit && isset($deprecated_filters['proceed_to'])) {
79
+				$submit_button_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $submit_button_text).$checkout->next_step->name();
80 80
 			}
81 81
 		}
82 82
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	return $submit_button_text;
85 85
 
86 86
 }
87
-add_filter( 'FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2 );
87
+add_filter('FHEE__EE_SPCO_Reg_Step__set_submit_button_text___submit_button_text', 'ee_deprecated__registration_checkout__button_text', 10, 2);
88 88
 
89 89
 
90 90
 
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
  * @param \EE_Checkout $checkout
96 96
  * @param boolean $status_updates
97 97
  */
98
-function ee_deprecated_finalize_transaction( EE_Checkout $checkout, $status_updates ) {
98
+function ee_deprecated_finalize_transaction(EE_Checkout $checkout, $status_updates) {
99 99
 	$action_ref = NULL;
100
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__new_transaction' ) ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
101
-	$action_ref = has_action( 'AHEE__EE_Transaction__finalize__all_transaction' ) ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
102
-	if ( $action_ref ) {
100
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__new_transaction') ? 'AHEE__EE_Transaction__finalize__new_transaction' : $action_ref;
101
+	$action_ref = has_action('AHEE__EE_Transaction__finalize__all_transaction') ? 'AHEE__EE_Transaction__finalize__all_transaction' : $action_ref;
102
+	if ($action_ref) {
103 103
 
104 104
 		EE_Error::doing_it_wrong(
105 105
 			$action_ref,
106 106
 			sprintf(
107
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso' ),
107
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use one of the following new actions: %1$s"%3$s" found in "%2$s" %1$s"%4$s" found in "%2$s" %1$s"%5$s" found in "%2$s" %1$s"%6$s" found in "%2$s"', 'event_espresso'),
108 108
 				'<br />',
109 109
 				'/core/business/EE_Transaction_Processor.class.php',
110 110
 				'AHEE__EE_Transaction_Processor__finalize',
@@ -114,39 +114,39 @@  discard block
 block discarded – undo
114 114
 			),
115 115
 			'4.6.0'
116 116
 		);
117
-		switch ( $action_ref ) {
117
+		switch ($action_ref) {
118 118
 			case 'AHEE__EE_Transaction__finalize__new_transaction' :
119
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request );
119
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, $checkout->admin_request);
120 120
 				break;
121 121
 			case 'AHEE__EE_Transaction__finalize__all_transaction' :
122
-				do_action( 'AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array( 'new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates ), $checkout->admin_request );
122
+				do_action('AHEE__EE_Transaction__finalize__new_transaction', $checkout->transaction, array('new_reg' => ! $checkout->revisit, 'to_approved' => $status_updates), $checkout->admin_request);
123 123
 				break;
124 124
 		}
125 125
 	}
126 126
 }
127
-add_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2 );
127
+add_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', 'ee_deprecated_finalize_transaction', 10, 2);
128 128
 /**
129 129
  * ee_deprecated_finalize_registration
130 130
  *
131 131
  * @param EE_Registration $registration
132 132
  */
133
-function ee_deprecated_finalize_registration( EE_Registration $registration ) {
134
-	$action_ref = has_action( 'AHEE__EE_Registration__finalize__update_and_new_reg' ) ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
135
-	if ( $action_ref ) {
133
+function ee_deprecated_finalize_registration(EE_Registration $registration) {
134
+	$action_ref = has_action('AHEE__EE_Registration__finalize__update_and_new_reg') ? 'AHEE__EE_Registration__finalize__update_and_new_reg' : NULL;
135
+	if ($action_ref) {
136 136
 		EE_Error::doing_it_wrong(
137 137
 			$action_ref,
138 138
 			sprintf(
139
-				__( 'This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso' ),
139
+				__('This action is deprecated.  It *may* work as an attempt to build in backwards compatibility.  However, it is recommended to use the following new action: %1$s"%3$s" found in "%2$s"', 'event_espresso'),
140 140
 				'<br />',
141 141
 				'/core/business/EE_Registration_Processor.class.php',
142 142
 				'AHEE__EE_Registration_Processor__trigger_registration_status_changed_hook'
143 143
 			),
144 144
 			'4.6.0'
145 145
 		);
146
-		do_action( 'AHEE__EE_Registration__finalize__update_and_new_reg', $registration, ( is_admin() && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX )));
146
+		do_action('AHEE__EE_Registration__finalize__update_and_new_reg', $registration, (is_admin() && ! (defined('DOING_AJAX') && DOING_AJAX)));
147 147
 	}
148 148
 }
149
-add_action( 'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1 );
149
+add_action('AHEE__EE_Registration_Processor__trigger_registration_update_notifications', 'ee_deprecated_finalize_registration', 10, 1);
150 150
 
151 151
 
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
  * Called after EED_Module::set_hooks() and EED_Module::set_admin_hooks() was called.
155 155
  * Checks if any deprecated hooks were hooked-into and provide doing_it_wrong messages appropriately.
156 156
  */
157
-function ee_deprecated_hooks(){
157
+function ee_deprecated_hooks() {
158 158
 	/**
159 159
 	 * @var $hooks array where keys are hook names, and their values are array{
160 160
 	 *			@type string $version  when deprecated
@@ -165,25 +165,25 @@  discard block
 block discarded – undo
165 165
 	$hooks = array(
166 166
 		'AHEE__EE_System___do_setup_validations' => array(
167 167
 			'version' => '4.6.0',
168
-			'alternative' => __( 'Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso' ),
168
+			'alternative' => __('Instead use "AHEE__EEH_Activation__validate_messages_system" which is called after validating messages (done on every new install, upgrade, reactivation, and downgrade)', 'event_espresso'),
169 169
 			'still_works' => FALSE
170 170
 		)
171 171
 	);
172
-	foreach( $hooks as $name => $deprecation_info ){
173
-		if( has_action( $name ) ){
172
+	foreach ($hooks as $name => $deprecation_info) {
173
+		if (has_action($name)) {
174 174
 			EE_Error::doing_it_wrong(
175 175
 				$name,
176 176
 				sprintf(
177
-					__('This filter is deprecated. %1$s%2$s','event_espresso'),
178
-					$deprecation_info[ 'still_works' ] ?  __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __( 'It has been completely removed.', 'event_espresso' ),
179
-					isset( $deprecation_info[ 'alternative' ] ) ? $deprecation_info[ 'alternative' ] : __( 'Please read the current EE4 documentation further or contact Support.', 'event_espresso' )
177
+					__('This filter is deprecated. %1$s%2$s', 'event_espresso'),
178
+					$deprecation_info['still_works'] ? __('It *may* work as an attempt to build in backwards compatibility.', 'event_espresso') : __('It has been completely removed.', 'event_espresso'),
179
+					isset($deprecation_info['alternative']) ? $deprecation_info['alternative'] : __('Please read the current EE4 documentation further or contact Support.', 'event_espresso')
180 180
 				),
181
-				isset( $deprecation_info[ 'version' ] ) ? $deprecation_info[ 'version' ] : __( 'recently', 'event_espresso' )
181
+				isset($deprecation_info['version']) ? $deprecation_info['version'] : __('recently', 'event_espresso')
182 182
 			);
183 183
 		}
184 184
 	}
185 185
 }
186
-add_action( 'AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks' );
186
+add_action('AHEE__EE_System__set_hooks_for_shortcodes_modules_and_addons', 'ee_deprecated_hooks');
187 187
 
188 188
 
189 189
 
@@ -194,9 +194,9 @@  discard block
 block discarded – undo
194 194
  * @return boolean
195 195
  */
196 196
 function ee_deprecated_using_old_registration_admin_custom_questions_form_hooks() {
197
-	$in_use =  has_filter( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns' )
198
-			|| has_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save' );
199
-	if( $in_use ) {
197
+	$in_use = has_filter('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns')
198
+			|| has_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save');
199
+	if ($in_use) {
200 200
 		$msg = __(
201 201
 			'We detected you are using the filter FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns or AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save.'
202 202
 			. 'Both of these have been deprecated and should not be used anymore. You should instead use FHEE__EE_Form_Section_Proper___construct__options_array to customize the contents of the form,'
@@ -205,18 +205,18 @@  discard block
 block discarded – undo
205 205
 			'event_espresso' )
206 206
 		;
207 207
 		EE_Error::doing_it_wrong(
208
-			__CLASS__ . '::' . __FUNCTION__,
208
+			__CLASS__.'::'.__FUNCTION__,
209 209
 			$msg,
210 210
 			'4.8.32.rc.000'
211 211
 		);
212 212
 		//it seems the doing_it_wrong messages get output during some hidden html tags, so add an error to make sure this gets noticed
213
-		if ( is_admin() && ! defined( 'DOING_AJAX' ) ) {
214
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
213
+		if (is_admin() && ! defined('DOING_AJAX')) {
214
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
215 215
 		}
216 216
 	}
217 217
 	return $in_use;
218 218
 }
219
-add_action( 'AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks' );
219
+add_action('AHEE__Registrations_Admin_Page___registration_details_metabox__start', 'ee_deprecated_using_old_registration_admin_custom_questions_form_hooks');
220 220
 
221 221
 /**
222 222
  * @deprecated since 4.8.32.rc.000 because it has issues on https://events.codebasehq.com/projects/event-espresso/tickets/9165
@@ -225,34 +225,34 @@  discard block
 block discarded – undo
225 225
  * @param EE_Admin_Page $admin_page
226 226
  * @return void
227 227
  */
228
-function ee_deprecated_update_attendee_registration_form_old( $admin_page ) {
228
+function ee_deprecated_update_attendee_registration_form_old($admin_page) {
229 229
 	//check if the old hooks are in use. If not, do the default
230
-	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
231
-		|| ! $admin_page instanceof EE_Admin_Page ) {
230
+	if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
231
+		|| ! $admin_page instanceof EE_Admin_Page) {
232 232
 		return;
233 233
 	}
234 234
 	$req_data = $admin_page->get_request_data();
235
-	$qstns = isset( $req_data['qstn'] ) ? $req_data['qstn'] : FALSE;
236
-	$REG_ID = isset( $req_data['_REG_ID'] ) ? absint( $req_data['_REG_ID'] ) : FALSE;
237
-	$qstns = apply_filters( 'FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns );
238
-	if ( ! $REG_ID || ! $qstns ) {
239
-		EE_Error::add_error( __('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
235
+	$qstns = isset($req_data['qstn']) ? $req_data['qstn'] : FALSE;
236
+	$REG_ID = isset($req_data['_REG_ID']) ? absint($req_data['_REG_ID']) : FALSE;
237
+	$qstns = apply_filters('FHEE__Registrations_Admin_Page___update_attendee_registration_form__qstns', $qstns);
238
+	if ( ! $REG_ID || ! $qstns) {
239
+		EE_Error::add_error(__('An error occurred. No registration ID and/or registration questions were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
240 240
 	}
241 241
 	$success = TRUE;
242 242
 
243 243
 	// allow others to get in on this awesome fun   :D
244
-	do_action( 'AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns );
244
+	do_action('AHEE__Registrations_Admin_Page___save_attendee_registration_form__after_reg_and_attendee_save', $REG_ID, $qstns);
245 245
 	// loop thru questions... FINALLY!!!
246 246
 
247
-	foreach ( $qstns as $QST_ID => $qstn ) {
247
+	foreach ($qstns as $QST_ID => $qstn) {
248 248
 		//if $qstn isn't an array then it doesn't already have an answer, so let's create the answer
249
-		if ( !is_array($qstn) ) {
250
-			$success = $this->_save_new_answer( $REG_ID, $QST_ID, $qstn);
249
+		if ( ! is_array($qstn)) {
250
+			$success = $this->_save_new_answer($REG_ID, $QST_ID, $qstn);
251 251
 			continue;
252 252
 		}
253 253
 
254 254
 
255
-		foreach ( $qstn as $ANS_ID => $ANS_value ) {
255
+		foreach ($qstn as $ANS_ID => $ANS_value) {
256 256
 			//get answer
257 257
 			$query_params = array(
258 258
 				0 => array(
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 				);
264 264
 			$answer = EEM_Answer::instance()->get_one($query_params);
265 265
 			//this MAY be an array but NOT have an answer because its multi select.  If so then we need to create the answer
266
-			if ( ! $answer instanceof EE_Answer ) {
266
+			if ( ! $answer instanceof EE_Answer) {
267 267
 				$set_values = array(
268 268
 					'QST_ID' => $QST_ID,
269 269
 					'REG_ID' => $REG_ID,
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 		}
279 279
 	}
280 280
 	$what = __('Registration Form', 'event_espresso');
281
-	$route = $REG_ID ? array( 'action' => 'view_registration', '_REG_ID' => $REG_ID ) : array( 'action' => 'default' );
282
-	$admin_page->redirect_after_action( $success, $what, __('updated', 'event_espresso'), $route );
281
+	$route = $REG_ID ? array('action' => 'view_registration', '_REG_ID' => $REG_ID) : array('action' => 'default');
282
+	$admin_page->redirect_after_action($success, $what, __('updated', 'event_espresso'), $route);
283 283
 	exit;
284 284
 }
285
-add_action( 'AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1 );
285
+add_action('AHEE__Registrations_Admin_Page___update_attendee_registration_form__start', 'ee_deprecated_update_attendee_registration_form_old', 10, 1);
286 286
 /**
287 287
  * Render the registration admin page's custom questions area in the old fashion
288 288
  * and firing the old hooks. When this method is removed, we can probably also
@@ -295,31 +295,31 @@  discard block
 block discarded – undo
295 295
  * @return bool
296 296
  * @throws \EE_Error
297 297
  */
298
-function ee_deprecated_reg_questions_meta_box_old( $do_default_action, $admin_page, $registration ) {
298
+function ee_deprecated_reg_questions_meta_box_old($do_default_action, $admin_page, $registration) {
299 299
 	//check if the old hooks are in use. If not, do the default
300
-	if( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
301
-		|| ! $admin_page instanceof EE_Admin_Page ) {
300
+	if ( ! ee_deprecated_using_old_registration_admin_custom_questions_form_hooks()
301
+		|| ! $admin_page instanceof EE_Admin_Page) {
302 302
 		return $do_default_action;
303 303
 	}
304
-	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array( $admin_page, 'form_before_question_group' ), 10, 1 );
305
-	add_filter( 'FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array( $admin_page, 'form_after_question_group' ), 10, 1 );
306
-	add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $admin_page, 'form_form_field_label_wrap' ), 10, 1 );
307
-	add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $admin_page, 'form_form_field_input__wrap' ), 10, 1 );
304
+	add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__before_question_group_questions', array($admin_page, 'form_before_question_group'), 10, 1);
305
+	add_filter('FHEE__EEH_Form_Fields__generate_question_groups_html__after_question_group_questions', array($admin_page, 'form_after_question_group'), 10, 1);
306
+	add_filter('FHEE__EEH_Form_Fields__label_html', array($admin_page, 'form_form_field_label_wrap'), 10, 1);
307
+	add_filter('FHEE__EEH_Form_Fields__input_html', array($admin_page, 'form_form_field_input__wrap'), 10, 1);
308 308
 
309
-	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options( $registration, $registration->get('EVT_ID') );
309
+	$question_groups = EEM_Event::instance()->assemble_array_of_groups_questions_and_options($registration, $registration->get('EVT_ID'));
310 310
 
311
-	EE_Registry::instance()->load_helper( 'Form_Fields' );
311
+	EE_Registry::instance()->load_helper('Form_Fields');
312 312
 	$template_args = array(
313
-		'att_questions' => EEH_Form_Fields::generate_question_groups_html( $question_groups ),
313
+		'att_questions' => EEH_Form_Fields::generate_question_groups_html($question_groups),
314 314
 		'reg_questions_form_action' => 'edit_registration',
315 315
 		'REG_ID' => $registration->ID()
316 316
 	);
317
-	$template_path = REG_TEMPLATE_PATH . 'reg_admin_details_main_meta_box_reg_questions.template.php';
318
-	echo EEH_Template::display_template( $template_path, $template_args, TRUE );
317
+	$template_path = REG_TEMPLATE_PATH.'reg_admin_details_main_meta_box_reg_questions.template.php';
318
+	echo EEH_Template::display_template($template_path, $template_args, TRUE);
319 319
 	//indicate that we should not do the default admin page code
320 320
 	return false;
321 321
 }
322
-add_action( 'FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3 );
322
+add_action('FHEE__Registrations_Admin_Page___reg_questions_meta_box__do_default', 'ee_deprecated_reg_questions_meta_box_old', 10, 3);
323 323
 
324 324
 
325 325
 
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 			'4.9.0'
361 361
 		);
362 362
 		/** @var EE_Message_Resource_Manager $message_resource_manager */
363
-		$message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
364
-		$messenger = $message_resource_manager->get_messenger( $messenger_name );
365
-		$message_type = $message_resource_manager->get_message_type( $message_type_name );
363
+		$message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
364
+		$messenger = $message_resource_manager->get_messenger($messenger_name);
365
+		$message_type = $message_resource_manager->get_message_type($message_type_name);
366 366
 		return EE_Registry::instance()->load_lib(
367 367
 			'Messages_Template_Defaults',
368 368
 			array(
@@ -427,15 +427,15 @@  discard block
 block discarded – undo
427 427
 	/**
428 428
 	 * @param string $method
429 429
 	 */
430
-	public function _class_is_deprecated( $method ) {
430
+	public function _class_is_deprecated($method) {
431 431
 		EE_Error::doing_it_wrong(
432
-			'EE_messages::' . $method,
433
-			__( 'EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.' ),
432
+			'EE_messages::'.$method,
433
+			__('EE_messages has been deprecated.  Please use EE_Message_Resource_Manager instead.'),
434 434
 			'4.9.0',
435 435
 			'4.10.0.p'
436 436
 		);
437 437
 		// Please use EE_Message_Resource_Manager instead
438
-		$this->_message_resource_manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' );
438
+		$this->_message_resource_manager = EE_Registry::instance()->load_lib('Message_Resource_Manager');
439 439
 	}
440 440
 
441 441
 
@@ -445,10 +445,10 @@  discard block
 block discarded – undo
445 445
 	 * @param string $messenger_name
446 446
 	 * @return boolean TRUE if it was PREVIOUSLY active, and FALSE if it was previously inactive
447 447
 	 */
448
-	public function ensure_messenger_is_active( $messenger_name ) {
448
+	public function ensure_messenger_is_active($messenger_name) {
449 449
 		// EE_messages has been deprecated
450
-		$this->_class_is_deprecated( __FUNCTION__ );
451
-		return $this->_message_resource_manager->ensure_messenger_is_active( $messenger_name );
450
+		$this->_class_is_deprecated(__FUNCTION__);
451
+		return $this->_message_resource_manager->ensure_messenger_is_active($messenger_name);
452 452
 	}
453 453
 
454 454
 
@@ -460,10 +460,10 @@  discard block
 block discarded – undo
460 460
 	 * @return bool true if it got activated (or was active) and false if not.
461 461
 	 * @throws \EE_Error
462 462
 	 */
463
-	public function ensure_message_type_is_active( $message_type, $messenger ) {
463
+	public function ensure_message_type_is_active($message_type, $messenger) {
464 464
 		// EE_messages has been deprecated
465
-		$this->_class_is_deprecated( __FUNCTION__ );
466
-		return $this->_message_resource_manager->ensure_message_type_is_active( $message_type, $messenger );
465
+		$this->_class_is_deprecated(__FUNCTION__);
466
+		return $this->_message_resource_manager->ensure_message_type_is_active($message_type, $messenger);
467 467
 	}
468 468
 
469 469
 
@@ -476,10 +476,10 @@  discard block
 block discarded – undo
476 476
 	 *                                            they are already setup.)
477 477
 	 * @return boolean an array of generated templates or false if nothing generated/activated.
478 478
 	 */
479
-	public function activate_messenger( $messenger_name, $mts_to_activate = array() ) {
479
+	public function activate_messenger($messenger_name, $mts_to_activate = array()) {
480 480
 		// EE_messages has been deprecated
481
-		$this->_class_is_deprecated( __FUNCTION__ );
482
-		return $this->_message_resource_manager->activate_messenger( $messenger_name, $mts_to_activate );
481
+		$this->_class_is_deprecated(__FUNCTION__);
482
+		return $this->_message_resource_manager->activate_messenger($messenger_name, $mts_to_activate);
483 483
 	}
484 484
 
485 485
 
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
 	 *
492 492
 	 * @return bool true is a generating messenger and can be sent OR FALSE meaning cannot send.
493 493
 	 */
494
-	public function is_generating_messenger_and_active( EE_messenger $messenger, EE_message_type $message_type ) {
494
+	public function is_generating_messenger_and_active(EE_messenger $messenger, EE_message_type $message_type) {
495 495
 		// EE_messages has been deprecated
496
-		$this->_class_is_deprecated( __FUNCTION__ );
497
-		return $this->_message_resource_manager->is_generating_messenger_and_active( $messenger, $message_type );
496
+		$this->_class_is_deprecated(__FUNCTION__);
497
+		return $this->_message_resource_manager->is_generating_messenger_and_active($messenger, $message_type);
498 498
 	}
499 499
 
500 500
 
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 	 * @param string $messenger
505 505
 	 * @return EE_messenger | null
506 506
 	 */
507
-	public function get_messenger_if_active( $messenger ) {
507
+	public function get_messenger_if_active($messenger) {
508 508
 		// EE_messages has been deprecated
509
-		$this->_class_is_deprecated( __FUNCTION__ );
510
-		return $this->_message_resource_manager->get_active_messenger( $messenger );
509
+		$this->_class_is_deprecated(__FUNCTION__);
510
+		return $this->_message_resource_manager->get_active_messenger($messenger);
511 511
 	}
512 512
 
513 513
 
@@ -528,9 +528,9 @@  discard block
 block discarded – undo
528 528
 	 *                  'message_type' => null
529 529
 	 *                  )
530 530
 	 */
531
-	public function validate_for_use( EE_Message $message ) {
531
+	public function validate_for_use(EE_Message $message) {
532 532
 		// EE_messages has been deprecated
533
-		$this->_class_is_deprecated( __FUNCTION__ );
533
+		$this->_class_is_deprecated(__FUNCTION__);
534 534
 		return array(
535 535
 			'messenger'    => $message->messenger_object(),
536 536
 			'message_type' => $message->message_type_object(),
@@ -558,41 +558,41 @@  discard block
 block discarded – undo
558 558
 		$send = true
559 559
 	) {
560 560
 		// EE_messages has been deprecated
561
-		$this->_class_is_deprecated( __FUNCTION__ );
561
+		$this->_class_is_deprecated(__FUNCTION__);
562 562
 		/** @type EE_Messages_Processor $processor */
563
-		$processor = EE_Registry::instance()->load_lib( 'Messages_Processor' );
563
+		$processor = EE_Registry::instance()->load_lib('Messages_Processor');
564 564
 		$error = false;
565 565
 		//try to intelligently determine what method we'll call based on the incoming data.
566 566
 		//if generating and sending are different then generate and send immediately.
567
-		if ( ! empty( $sending_messenger ) && $sending_messenger != $generating_messenger && $send ) {
567
+		if ( ! empty($sending_messenger) && $sending_messenger != $generating_messenger && $send) {
568 568
 			//in the legacy system, when generating and sending were different, that means all the
569 569
 			//vars are already in the request object.  So let's just use that.
570 570
 			try {
571 571
 				/** @type EE_Message_To_Generate_From_Request $mtg */
572
-				$mtg = EE_Registry::instance()->load_lib( 'Message_To_Generate_From_Request' );
573
-				$processor->generate_and_send_now( $mtg );
574
-			} catch ( EE_Error $e ) {
572
+				$mtg = EE_Registry::instance()->load_lib('Message_To_Generate_From_Request');
573
+				$processor->generate_and_send_now($mtg);
574
+			} catch (EE_Error $e) {
575 575
 				$error_msg = __(
576 576
 					'Please note that a system message failed to send due to a technical issue.',
577 577
 					'event_espresso'
578 578
 				);
579 579
 				// add specific message for developers if WP_DEBUG in on
580
-				$error_msg .= '||' . $e->getMessage();
581
-				EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
580
+				$error_msg .= '||'.$e->getMessage();
581
+				EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
582 582
 				$error = true;
583 583
 			}
584 584
 		} else {
585
-			$processor->generate_for_all_active_messengers( $type, $vars, $send );
585
+			$processor->generate_for_all_active_messengers($type, $vars, $send);
586 586
 			//let's find out if there were any errors and how many successfully were queued.
587 587
 			$count_errors = $processor->get_queue()->count_STS_in_queue(
588
-				array( EEM_Message::status_failed, EEM_Message::status_debug_only )
588
+				array(EEM_Message::status_failed, EEM_Message::status_debug_only)
589 589
 			);
590
-			$count_queued = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_incomplete );
591
-			$count_retry = $processor->get_queue()->count_STS_in_queue( EEM_Message::status_retry );
590
+			$count_queued = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_incomplete);
591
+			$count_retry = $processor->get_queue()->count_STS_in_queue(EEM_Message::status_retry);
592 592
 			$count_errors = $count_errors + $count_retry;
593
-			if ( $count_errors > 0 ) {
593
+			if ($count_errors > 0) {
594 594
 				$error = true;
595
-				if ( $count_errors > 1 && $count_retry > 1 && $count_queued > 1 ) {
595
+				if ($count_errors > 1 && $count_retry > 1 && $count_queued > 1) {
596 596
 					$message = sprintf(
597 597
 						__(
598 598
 							'There were %d errors and %d messages successfully queued for generation and sending',
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 						$count_errors,
602 602
 						$count_queued
603 603
 					);
604
-				} elseif ( $count_errors > 1 && $count_queued === 1 ) {
604
+				} elseif ($count_errors > 1 && $count_queued === 1) {
605 605
 					$message = sprintf(
606 606
 						__(
607 607
 							'There were %d errors and %d message successfully queued for generation.',
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 						$count_errors,
611 611
 						$count_queued
612 612
 					);
613
-				} elseif ( $count_errors === 1 && $count_queued > 1 ) {
613
+				} elseif ($count_errors === 1 && $count_queued > 1) {
614 614
 					$message = sprintf(
615 615
 						__(
616 616
 							'There was %d error and %d messages successfully queued for generation.',
@@ -628,9 +628,9 @@  discard block
 block discarded – undo
628 628
 						$count_errors
629 629
 					);
630 630
 				}
631
-				EE_Error::add_error( $message, __FILE__, __FUNCTION__, __LINE__ );
631
+				EE_Error::add_error($message, __FILE__, __FUNCTION__, __LINE__);
632 632
 			} else {
633
-				if ( $count_queued === 1 ) {
633
+				if ($count_queued === 1) {
634 634
 					$message = sprintf(
635 635
 						__(
636 636
 							'%d message successfully queued for generation.',
@@ -647,18 +647,18 @@  discard block
 block discarded – undo
647 647
 						$count_queued
648 648
 					);
649 649
 				}
650
-				EE_Error::add_success( $message );
650
+				EE_Error::add_success($message);
651 651
 			}
652 652
 		}
653 653
 		//if no error then return the generated message(s).
654
-		if ( ! $error && ! $send ) {
655
-			$generated_queue = $processor->generate_queue( false );
654
+		if ( ! $error && ! $send) {
655
+			$generated_queue = $processor->generate_queue(false);
656 656
 			//get message and return.
657 657
 			$generated_queue->get_message_repository()->rewind();
658 658
 			$messages = array();
659
-			while ( $generated_queue->get_message_repository()->valid() ) {
659
+			while ($generated_queue->get_message_repository()->valid()) {
660 660
 				$message = $generated_queue->get_message_repository()->current();
661
-				if ( $message instanceof EE_Message ) {
661
+				if ($message instanceof EE_Message) {
662 662
 					//set properties that might be expected by add-ons (backward compat)
663 663
 					$message->content = $message->content();
664 664
 					$message->template_pack = $message->get_template_pack();
@@ -683,10 +683,10 @@  discard block
 block discarded – undo
683 683
 	 * @param bool    $send      true we will do a test send using the messenger delivery, false we just do a regular preview
684 684
 	 * @return string          The body of the message.
685 685
 	 */
686
-	public function preview_message( $type, $context, $messenger, $send = false ) {
686
+	public function preview_message($type, $context, $messenger, $send = false) {
687 687
 		// EE_messages has been deprecated
688
-		$this->_class_is_deprecated( __FUNCTION__ );
689
-		return EED_Messages::preview_message( $type, $context, $messenger, $send );
688
+		$this->_class_is_deprecated(__FUNCTION__);
689
+		return EED_Messages::preview_message($type, $context, $messenger, $send);
690 690
 	}
691 691
 
692 692
 
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @return bool          success or fail.
702 702
 	 */
703
-	public function send_message_with_messenger_only( $messenger, $message_type, $message ) {
703
+	public function send_message_with_messenger_only($messenger, $message_type, $message) {
704 704
 		// EE_messages has been deprecated
705
-		$this->_class_is_deprecated( __FUNCTION__ );
705
+		$this->_class_is_deprecated(__FUNCTION__);
706 706
 		//setup for sending to new method.
707 707
 		/** @type EE_Messages_Queue $queue */
708
-		$queue = EE_Registry::instance()->load_lib( 'Messages_Queue' );
708
+		$queue = EE_Registry::instance()->load_lib('Messages_Queue');
709 709
 		//make sure we have a proper message object
710
-		if ( ! $message instanceof EE_Message && is_object( $message ) && isset( $message->content ) ) {
710
+		if ( ! $message instanceof EE_Message && is_object($message) && isset($message->content)) {
711 711
 			$msg = EE_Message_Factory::create(
712 712
 				array(
713 713
 					'MSG_messenger'    => $messenger,
@@ -719,15 +719,15 @@  discard block
 block discarded – undo
719 719
 		} else {
720 720
 			$msg = $message;
721 721
 		}
722
-		if ( ! $msg instanceof EE_Message ) {
722
+		if ( ! $msg instanceof EE_Message) {
723 723
 			return false;
724 724
 		}
725 725
 		//make sure any content in a content property (if not empty) is set on the MSG_content.
726
-		if ( ! empty( $msg->content ) ) {
727
-			$msg->set( 'MSG_content', $msg->content );
726
+		if ( ! empty($msg->content)) {
727
+			$msg->set('MSG_content', $msg->content);
728 728
 		}
729
-		$queue->add( $msg );
730
-		return EED_Messages::send_message_with_messenger_only( $messenger, $message_type, $queue );
729
+		$queue->add($msg);
730
+		return EED_Messages::send_message_with_messenger_only($messenger, $message_type, $queue);
731 731
 	}
732 732
 
733 733
 
@@ -741,11 +741,11 @@  discard block
 block discarded – undo
741 741
 	 * @return array|object if creation is successful then we return an array of info, otherwise an error_object is returned.
742 742
 	 * @throws \EE_Error
743 743
 	 */
744
-	public function create_new_templates( $messenger, $message_type, $GRP_ID = 0, $is_global = false ) {
744
+	public function create_new_templates($messenger, $message_type, $GRP_ID = 0, $is_global = false) {
745 745
 		// EE_messages has been deprecated
746
-		$this->_class_is_deprecated( __FUNCTION__ );
747
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
748
-		return EEH_MSG_Template::create_new_templates( $messenger, $message_type, $GRP_ID, $is_global );
746
+		$this->_class_is_deprecated(__FUNCTION__);
747
+		EE_Registry::instance()->load_helper('MSG_Template');
748
+		return EEH_MSG_Template::create_new_templates($messenger, $message_type, $GRP_ID, $is_global);
749 749
 	}
750 750
 
751 751
 
@@ -756,11 +756,11 @@  discard block
 block discarded – undo
756 756
 	 * @param  string $message_type_name name of EE_message_type
757 757
 	 * @return array
758 758
 	 */
759
-	public function get_fields( $messenger_name, $message_type_name ) {
759
+	public function get_fields($messenger_name, $message_type_name) {
760 760
 		// EE_messages has been deprecated
761
-		$this->_class_is_deprecated( __FUNCTION__ );
762
-		EE_Registry::instance()->load_helper( 'MSG_Template' );
763
-		return EEH_MSG_Template::get_fields( $messenger_name, $message_type_name );
761
+		$this->_class_is_deprecated(__FUNCTION__);
762
+		EE_Registry::instance()->load_helper('MSG_Template');
763
+		return EEH_MSG_Template::get_fields($messenger_name, $message_type_name);
764 764
 	}
765 765
 
766 766
 
@@ -774,13 +774,13 @@  discard block
 block discarded – undo
774 774
 	 * @return array                    multidimensional array of messenger and message_type objects
775 775
 	 *                                    (messengers index, and message_type index);
776 776
 	 */
777
-	public function get_installed( $type = 'all', $skip_cache = false ) {
777
+	public function get_installed($type = 'all', $skip_cache = false) {
778 778
 		// EE_messages has been deprecated
779
-		$this->_class_is_deprecated( __FUNCTION__ );
780
-		if ( $skip_cache ) {
779
+		$this->_class_is_deprecated(__FUNCTION__);
780
+		if ($skip_cache) {
781 781
 			$this->_message_resource_manager->reset_active_messengers_and_message_types();
782 782
 		}
783
-		switch ( $type ) {
783
+		switch ($type) {
784 784
 			case 'messengers' :
785 785
 				return array(
786 786
 					'messenger' => $this->_message_resource_manager->installed_messengers(),
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
 	 */
810 810
 	public function get_active_messengers() {
811 811
 		// EE_messages has been deprecated
812
-		$this->_class_is_deprecated( __FUNCTION__ );
812
+		$this->_class_is_deprecated(__FUNCTION__);
813 813
 		return $this->_message_resource_manager->active_messengers();
814 814
 	}
815 815
 
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	 */
822 822
 	public function get_active_message_types() {
823 823
 		// EE_messages has been deprecated
824
-		$this->_class_is_deprecated( __FUNCTION__ );
824
+		$this->_class_is_deprecated(__FUNCTION__);
825 825
 		return $this->_message_resource_manager->list_of_active_message_types();
826 826
 	}
827 827
 
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 	 */
834 834
 	public function get_active_message_type_objects() {
835 835
 		// EE_messages has been deprecated
836
-		$this->_class_is_deprecated( __FUNCTION__ );
836
+		$this->_class_is_deprecated(__FUNCTION__);
837 837
 		return $this->_message_resource_manager->get_active_message_type_objects();
838 838
 	}
839 839
 
@@ -845,10 +845,10 @@  discard block
 block discarded – undo
845 845
 	 * @param string $messenger The messenger being checked
846 846
 	 * @return EE_message_type[]    (or empty array if none present)
847 847
 	 */
848
-	public function get_active_message_types_per_messenger( $messenger ) {
848
+	public function get_active_message_types_per_messenger($messenger) {
849 849
 		// EE_messages has been deprecated
850
-		$this->_class_is_deprecated( __FUNCTION__ );
851
-		return $this->_message_resource_manager->get_active_message_types_for_messenger( $messenger );
850
+		$this->_class_is_deprecated(__FUNCTION__);
851
+		return $this->_message_resource_manager->get_active_message_types_for_messenger($messenger);
852 852
 	}
853 853
 
854 854
 
@@ -859,10 +859,10 @@  discard block
 block discarded – undo
859 859
 	 * @param string $message_type The string should correspond to a message type.
860 860
 	 * @return EE_message_type|null
861 861
 	 */
862
-	public function get_active_message_type( $messenger, $message_type ) {
862
+	public function get_active_message_type($messenger, $message_type) {
863 863
 		// EE_messages has been deprecated
864
-		$this->_class_is_deprecated( __FUNCTION__ );
865
-		return $this->_message_resource_manager->get_active_message_type_for_messenger( $messenger, $message_type );
864
+		$this->_class_is_deprecated(__FUNCTION__);
865
+		return $this->_message_resource_manager->get_active_message_type_for_messenger($messenger, $message_type);
866 866
 	}
867 867
 
868 868
 
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
 	 */
874 874
 	public function get_installed_message_types() {
875 875
 		// EE_messages has been deprecated
876
-		$this->_class_is_deprecated( __FUNCTION__ );
876
+		$this->_class_is_deprecated(__FUNCTION__);
877 877
 		return $this->_message_resource_manager->installed_message_types();
878 878
 	}
879 879
 
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	 */
886 886
 	public function get_installed_messengers() {
887 887
 		// EE_messages has been deprecated
888
-		$this->_class_is_deprecated( __FUNCTION__ );
888
+		$this->_class_is_deprecated(__FUNCTION__);
889 889
 		return $this->_message_resource_manager->installed_messengers();
890 890
 	}
891 891
 
@@ -896,10 +896,10 @@  discard block
 block discarded – undo
896 896
 	 * @param   bool $slugs_only Whether to return an array of just slugs and labels (true) or all contexts indexed by message type.
897 897
 	 * @return array
898 898
 	 */
899
-	public function get_all_contexts( $slugs_only = true ) {
899
+	public function get_all_contexts($slugs_only = true) {
900 900
 		// EE_messages has been deprecated
901
-		$this->_class_is_deprecated( __FUNCTION__ );
902
-		return $this->_message_resource_manager->get_all_contexts( $slugs_only );
901
+		$this->_class_is_deprecated(__FUNCTION__);
902
+		return $this->_message_resource_manager->get_all_contexts($slugs_only);
903 903
 	}
904 904
 
905 905
 
Please login to merge, or discard this patch.
core/CPTs/CptQueryModifier.php 1 patch
Spacing   +81 added lines, -81 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\CPTs;
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
 
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 		\WP_Query $WP_Query,
81 81
 		\EE_Request_Handler $request
82 82
 	) {
83
-		$this->setRequest( $request );
84
-		$this->setWpQuery( $WP_Query );
85
-		$this->setPostType( $post_type );
86
-		$this->setCptDetails( $cpt_details );
83
+		$this->setRequest($request);
84
+		$this->setWpQuery($WP_Query);
85
+		$this->setPostType($post_type);
86
+		$this->setCptDetails($cpt_details);
87 87
 		$this->init();
88 88
 	}
89 89
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	/**
102 102
 	 * @param string $post_type
103 103
 	 */
104
-	protected function setPostType( $post_type ) {
104
+	protected function setPostType($post_type) {
105 105
 		$this->post_type = $post_type;
106 106
 	}
107 107
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	/**
120 120
 	 * @param array $cpt_details
121 121
 	 */
122
-	protected function setCptDetails( $cpt_details ) {
122
+	protected function setCptDetails($cpt_details) {
123 123
 		$this->cpt_details = $cpt_details;
124 124
 	}
125 125
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 	/**
138 138
 	 * @param \EE_Table_Base[] $model_tables
139 139
 	 */
140
-	protected function setModelTables( $model_tables ) {
140
+	protected function setModelTables($model_tables) {
141 141
 		$this->model_tables = $model_tables;
142 142
 	}
143 143
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 * @return array
148 148
 	 */
149 149
 	public function taxonomies() {
150
-		if ( empty( $this->taxonomies ) ) {
150
+		if (empty($this->taxonomies)) {
151 151
 			$this->initializeTaxonomies();
152 152
 		}
153 153
 		return $this->taxonomies;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	/**
159 159
 	 * @param array $taxonomies
160 160
 	 */
161
-	protected function setTaxonomies( array $taxonomies ) {
161
+	protected function setTaxonomies(array $taxonomies) {
162 162
 		$this->taxonomies = $taxonomies;
163 163
 	}
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 	/**
177 177
 	 * @param \EE_Secondary_Table $meta_table
178 178
 	 */
179
-	public function setMetaTable( \EE_Secondary_Table $meta_table ) {
179
+	public function setMetaTable(\EE_Secondary_Table $meta_table) {
180 180
 		$this->meta_table = $meta_table;
181 181
 	}
182 182
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 	/**
195 195
 	 * @param \EEM_Base $CPT_model
196 196
 	 */
197
-	protected function setModel( \EEM_Base $CPT_model ) {
197
+	protected function setModel(\EEM_Base $CPT_model) {
198 198
 		$this->model = $CPT_model;
199 199
 	}
200 200
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	/**
213 213
 	 * @param \EE_Request_Handler $request
214 214
 	 */
215
-	protected function setRequest( \EE_Request_Handler $request ) {
215
+	protected function setRequest(\EE_Request_Handler $request) {
216 216
 		$this->request = $request;
217 217
 	}
218 218
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	/**
231 231
 	 * @param \WP_Query $wp_query
232 232
 	 */
233
-	public function setWpQuery( \WP_Query $wp_query ) {
233
+	public function setWpQuery(\WP_Query $wp_query) {
234 234
 		$this->wp_query = $wp_query;
235 235
 	}
236 236
 
@@ -245,22 +245,22 @@  discard block
 block discarded – undo
245 245
 	protected function initializeTaxonomies() {
246 246
 		// check if taxonomies have already been set and that this CPT has taxonomies registered for it
247 247
 		if (
248
-			empty( $this->taxonomies )
249
-			&& isset( $this->cpt_details['args'], $this->cpt_details['args']['taxonomies'] )
248
+			empty($this->taxonomies)
249
+			&& isset($this->cpt_details['args'], $this->cpt_details['args']['taxonomies'])
250 250
 		) {
251 251
 			// if so then grab them, but we want the taxonomy name as the key
252
-			$taxonomies = array_flip( $this->cpt_details['args']['taxonomies'] );
252
+			$taxonomies = array_flip($this->cpt_details['args']['taxonomies']);
253 253
 			// then grab the list of ALL taxonomies
254 254
 			$all_taxonomies = \EE_Register_CPTs::get_taxonomies();
255
-			foreach ( $taxonomies as $taxonomy => &$details ) {
255
+			foreach ($taxonomies as $taxonomy => &$details) {
256 256
 				// add details to our taxonomies if they exist
257
-				$details = isset( $all_taxonomies[ $taxonomy ] )
258
-					? $all_taxonomies[ $taxonomy ]
257
+				$details = isset($all_taxonomies[$taxonomy])
258
+					? $all_taxonomies[$taxonomy]
259 259
 					: array();
260 260
 			}
261 261
 			// ALWAYS unset() variables that were passed by reference
262
-			unset( $details );
263
-			$this->setTaxonomies( $taxonomies );
262
+			unset($details);
263
+			$this->setTaxonomies($taxonomies);
264 264
 		}
265 265
 	}
266 266
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 		$this->setAdditionalCptDetails();
271 271
 		$this->setRequestVarsIfCpt();
272 272
 		// convert post_type to model name
273
-		$model_name = str_replace( 'EE_', '', $this->cpt_details['class_name'] );
273
+		$model_name = str_replace('EE_', '', $this->cpt_details['class_name']);
274 274
 		// load all tables related to CPT
275
-		$this->setupModelsAndTables( $model_name );
275
+		$this->setupModelsAndTables($model_name);
276 276
 		// load and instantiate CPT_*_Strategy
277
-		$CPT_Strategy = $this->cptStrategyClass( $model_name );
277
+		$CPT_Strategy = $this->cptStrategyClass($model_name);
278 278
 		// !!!!!!!!!!  IMPORTANT !!!!!!!!!!!!
279 279
 		// here's the list of available filters in the WP_Query object
280 280
 		// 'posts_where_paged'
@@ -285,17 +285,17 @@  discard block
 block discarded – undo
285 285
 		// 'post_limits'
286 286
 		// 'posts_fields'
287 287
 		// 'posts_join'
288
-		add_filter( 'posts_fields', array( $this, 'postsFields' ) );
289
-		add_filter( 'posts_join', array( $this, 'postsJoin' ) );
288
+		add_filter('posts_fields', array($this, 'postsFields'));
289
+		add_filter('posts_join', array($this, 'postsJoin'));
290 290
 		add_filter(
291
-			'get_' . $this->post_type . '_metadata',
292
-			array( $CPT_Strategy, 'get_EE_post_type_metadata' ),
291
+			'get_'.$this->post_type.'_metadata',
292
+			array($CPT_Strategy, 'get_EE_post_type_metadata'),
293 293
 			1,
294 294
 			4
295 295
 		);
296
-		add_filter( 'the_posts', array( $this, 'thePosts' ), 1, 1 );
297
-		if ( $this->wp_query->is_main_query() ) {
298
-			add_filter( 'get_edit_post_link', array( $this, 'getEditPostLink' ), 10, 2 );
296
+		add_filter('the_posts', array($this, 'thePosts'), 1, 1);
297
+		if ($this->wp_query->is_main_query()) {
298
+			add_filter('get_edit_post_link', array($this, 'getEditPostLink'), 10, 2);
299 299
 			$this->addTemplateFilters();
300 300
 		}
301 301
 	}
@@ -312,18 +312,18 @@  discard block
 block discarded – undo
312 312
 		// the post or category or term that is triggering EE
313 313
 		$this->cpt_details['espresso_page'] = $this->request->is_espresso_page();
314 314
 		// requested post name
315
-		$this->cpt_details['post_name'] = $this->request->get( 'post_name' );
315
+		$this->cpt_details['post_name'] = $this->request->get('post_name');
316 316
 		// add support for viewing 'private', 'draft', or 'pending' posts
317 317
 		if (
318
-			isset( $this->wp_query->query_vars['p'] )
318
+			isset($this->wp_query->query_vars['p'])
319 319
 			&& $this->wp_query->query_vars['p'] !== 0
320 320
 			&& is_user_logged_in()
321
-			&& current_user_can( 'edit_post', $this->wp_query->query_vars['p'] )
321
+			&& current_user_can('edit_post', $this->wp_query->query_vars['p'])
322 322
 		) {
323 323
 			// we can just inject directly into the WP_Query object
324
-			$this->wp_query->query['post_status'] = array( 'publish', 'private', 'draft', 'pending' );
324
+			$this->wp_query->query['post_status'] = array('publish', 'private', 'draft', 'pending');
325 325
 			// now set the main 'ee' request var so that the appropriate module can load the appropriate template(s)
326
-			$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
326
+			$this->request->set('ee', $this->cpt_details['singular_slug']);
327 327
 		}
328 328
 	}
329 329
 
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	 */
341 341
 	public function setRequestVarsIfCpt() {
342 342
 		// check if ee action var has been set
343
-		if ( ! $this->request->is_set( 'ee' ) ) {
343
+		if ( ! $this->request->is_set('ee')) {
344 344
 			// check that route exists for CPT archive slug
345
-			if ( is_archive() && \EE_Config::get_route( $this->cpt_details['plural_slug'] ) ) {
345
+			if (is_archive() && \EE_Config::get_route($this->cpt_details['plural_slug'])) {
346 346
 				// ie: set "ee" to "events"
347
-				$this->request->set( 'ee', $this->cpt_details['plural_slug'] );
347
+				$this->request->set('ee', $this->cpt_details['plural_slug']);
348 348
 				// or does it match a single page CPT like /event/
349
-			} else if ( is_single() && \EE_Config::get_route( $this->cpt_details['singular_slug'] ) ) {
349
+			} else if (is_single() && \EE_Config::get_route($this->cpt_details['singular_slug'])) {
350 350
 				// ie: set "ee" to "event"
351
-				$this->request->set( 'ee', $this->cpt_details['singular_slug'] );
351
+				$this->request->set('ee', $this->cpt_details['singular_slug']);
352 352
 			}
353 353
 		}
354 354
 	}
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	 * @param string $model_name
363 363
 	 * @throws \EE_Error
364 364
 	 */
365
-	protected function setupModelsAndTables( $model_name ) {
365
+	protected function setupModelsAndTables($model_name) {
366 366
 		// get CPT table data via CPT Model
367
-		$model = \EE_Registry::instance()->load_model( $model_name );
368
-		if ( ! $model instanceof \EEM_Base ) {
369
-			throw new \EE_Error (
367
+		$model = \EE_Registry::instance()->load_model($model_name);
368
+		if ( ! $model instanceof \EEM_Base) {
369
+			throw new \EE_Error(
370 370
 				sprintf(
371 371
 					__(
372 372
 						'The "%1$s" model could not be loaded.',
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
 				)
377 377
 			);
378 378
 		}
379
-		$this->setModel( $model );
380
-		$this->setModelTables( $this->model->get_tables() );
379
+		$this->setModel($model);
380
+		$this->setModelTables($this->model->get_tables());
381 381
 		// is there a Meta Table for this CPT?
382 382
 		if (
383
-			isset( $this->cpt_details['tables'][ $model_name . '_Meta' ] )
384
-			&& $this->cpt_details['tables'][ $model_name . '_Meta' ] instanceof \EE_Secondary_Table
383
+			isset($this->cpt_details['tables'][$model_name.'_Meta'])
384
+			&& $this->cpt_details['tables'][$model_name.'_Meta'] instanceof \EE_Secondary_Table
385 385
 		) {
386
-			$this->setMetaTable( $this->cpt_details['tables'][ $model_name . '_Meta' ] );
386
+			$this->setMetaTable($this->cpt_details['tables'][$model_name.'_Meta']);
387 387
 		}
388 388
 	}
389 389
 
@@ -396,18 +396,18 @@  discard block
 block discarded – undo
396 396
 	 * @param  string $model_name
397 397
 	 * @return string
398 398
 	 */
399
-	protected function cptStrategyClass( $model_name ) {
399
+	protected function cptStrategyClass($model_name) {
400 400
 		// creates classname like:  CPT_Event_Strategy
401
-		$CPT_Strategy_class_name = 'CPT_' . $model_name . '_Strategy';
401
+		$CPT_Strategy_class_name = 'CPT_'.$model_name.'_Strategy';
402 402
 		// load and instantiate
403 403
 		$CPT_Strategy = \EE_Registry::instance()->load_core(
404 404
 			$CPT_Strategy_class_name,
405
-			array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
405
+			array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
406 406
 		);
407
-		if ( $CPT_Strategy === null ) {
407
+		if ($CPT_Strategy === null) {
408 408
 			$CPT_Strategy = \EE_Registry::instance()->load_core(
409 409
 				'CPT_Default_Strategy',
410
-				array( 'WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details )
410
+				array('WP_Query' => $this->wp_query, 'CPT' => $this->cpt_details)
411 411
 			);
412 412
 		}
413 413
 		return $CPT_Strategy;
@@ -422,13 +422,13 @@  discard block
 block discarded – undo
422 422
 	 * @param  $SQL
423 423
 	 * @return string
424 424
 	 */
425
-	public function postsFields( $SQL ) {
425
+	public function postsFields($SQL) {
426 426
 		// does this CPT have a meta table ?
427
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
427
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
428 428
 			// adds something like ", wp_esp_event_meta.* " to WP Query SELECT statement
429
-			$SQL .= ', ' . $this->meta_table->get_table_name() . '.* ';
429
+			$SQL .= ', '.$this->meta_table->get_table_name().'.* ';
430 430
 		}
431
-		remove_filter( 'posts_fields', array( $this, 'postsFields' ) );
431
+		remove_filter('posts_fields', array($this, 'postsFields'));
432 432
 		return $SQL;
433 433
 	}
434 434
 
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	 * @param  $SQL
442 442
 	 * @return string
443 443
 	 */
444
-	public function postsJoin( $SQL ) {
444
+	public function postsJoin($SQL) {
445 445
 		// does this CPT have a meta table ?
446
-		if ( $this->meta_table instanceof \EE_Secondary_Table ) {
446
+		if ($this->meta_table instanceof \EE_Secondary_Table) {
447 447
 			global $wpdb;
448 448
 			// adds something like " LEFT JOIN wp_esp_event_meta ON ( wp_esp_event_meta.EVT_ID = wp_posts.ID ) " to WP Query JOIN statement
449 449
 			$SQL .= ' LEFT JOIN '
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 			        . $wpdb->posts
457 457
 			        . '.ID ) ';
458 458
 		}
459
-		remove_filter( 'posts_join', array( $this, 'postsJoin' ) );
459
+		remove_filter('posts_join', array($this, 'postsJoin'));
460 460
 		return $SQL;
461 461
 	}
462 462
 
@@ -469,17 +469,17 @@  discard block
 block discarded – undo
469 469
 	 * @param  \WP_Post[] $posts
470 470
 	 * @return \WP_Post[]
471 471
 	 */
472
-	public function thePosts( $posts ) {
472
+	public function thePosts($posts) {
473 473
 		$CPT_class = $this->cpt_details['class_name'];
474 474
 		// loop thru posts
475
-		if ( is_array( $posts ) && $this->model instanceof \EEM_CPT_Base ) {
476
-			foreach ( $posts as $key => $post ) {
477
-				if ( $post->post_type === $this->post_type ) {
478
-					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object( $post );
475
+		if (is_array($posts) && $this->model instanceof \EEM_CPT_Base) {
476
+			foreach ($posts as $key => $post) {
477
+				if ($post->post_type === $this->post_type) {
478
+					$post->{$CPT_class} = $this->model->instantiate_class_from_post_object($post);
479 479
 				}
480 480
 			}
481 481
 		}
482
-		remove_filter( 'the_posts', array( $this, 'thePosts' ), 1 );
482
+		remove_filter('the_posts', array($this, 'thePosts'), 1);
483 483
 		return $posts;
484 484
 	}
485 485
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	 * @param $ID
491 491
 	 * @return string
492 492
 	 */
493
-	public function getEditPostLink( $url, $ID ) {
493
+	public function getEditPostLink($url, $ID) {
494 494
 		// need to make sure we only edit links if our cpt
495 495
 		global $post;
496 496
 		//notice if the cpt is registered with `show_ee_ui` set to false, we take that to mean that the WordPress core ui
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 			! $post instanceof \WP_Post
500 500
 			|| $post->post_type !== $this->post_type
501 501
 			|| (
502
-				isset( $this->cpt_details['args']['show_ee_ui'] )
502
+				isset($this->cpt_details['args']['show_ee_ui'])
503 503
 				&& ! $this->cpt_details['args']['show_ee_ui']
504 504
 			)
505 505
 		) {
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 		//k made it here so all is good.
509 509
 		return wp_nonce_url(
510 510
 			add_query_arg(
511
-				array( 'page' => $this->post_type, 'post' => $ID, 'action' => 'edit' ),
512
-				admin_url( 'admin.php' )
511
+				array('page' => $this->post_type, 'post' => $ID, 'action' => 'edit'),
512
+				admin_url('admin.php')
513 513
 			),
514 514
 			'edit',
515 515
 			'edit_nonce'
@@ -526,9 +526,9 @@  discard block
 block discarded – undo
526 526
 	 */
527 527
 	public function addTemplateFilters() {
528 528
 		// if requested cpt supports page_templates and it's the main query
529
-		if ( ! empty( $this->cpt_details['args']['page_templates'] ) && $this->wp_query->is_main_query() ) {
529
+		if ( ! empty($this->cpt_details['args']['page_templates']) && $this->wp_query->is_main_query()) {
530 530
 			// then let's hook into the appropriate query_template hook
531
-			add_filter( 'single_template', array( $this, 'singleCptTemplate' ) );
531
+			add_filter('single_template', array($this, 'singleCptTemplate'));
532 532
 		}
533 533
 	}
534 534
 
@@ -542,20 +542,20 @@  discard block
 block discarded – undo
542 542
 	 * @param string $current_template Existing default template path derived for this page call.
543 543
 	 * @return string the path to the full template file.
544 544
 	 */
545
-	public function singleCptTemplate( $current_template ) {
545
+	public function singleCptTemplate($current_template) {
546 546
 		$object = get_queried_object();
547 547
 		//does this called object HAVE a page template set that is something other than the default.
548
-		$template = get_post_meta( $object->ID, '_wp_page_template', true );
548
+		$template = get_post_meta($object->ID, '_wp_page_template', true);
549 549
 		//exit early if default or not set or invalid path (accounts for theme changes)
550 550
 		if (
551 551
 			$template === 'default'
552
-			|| empty( $template )
553
-			|| ! is_readable( get_stylesheet_directory() . '/' . $template )
552
+			|| empty($template)
553
+			|| ! is_readable(get_stylesheet_directory().'/'.$template)
554 554
 		) {
555 555
 			return $current_template;
556 556
 		}
557 557
 		//made it here so we SHOULD be able to just locate the template and then return it.
558
-		return locate_template( array( $template ) );
558
+		return locate_template(array($template));
559 559
 	}
560 560
 
561 561
 
Please login to merge, or discard this patch.