Completed
Branch BUG-10008-migration-stalling (f3f3da)
by
unknown
15:47
created
core/libraries/plugin_api/EE_Register_Addon.lib.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -138,10 +138,10 @@
 block discarded – undo
138 138
 	 *       		 An array of message types with the key as the message type name and the values as below:
139 139
 	 *        		@type string $mtfilename The filename of the message type being registered.  This will be the main
140 140
 	 *                                       EE_{Messagetype_Name}_message_type class. (eg. EE_Declined_Registration_message_type.class.php). Required.
141
-	*               @type array $autoloadpaths An array of paths to add to the messages autoloader for the new message type. Required.
142
-	*               @type array $messengers_to_activate_with An array of messengers that this message
143
-	*                           type should activate with. Each value in the array should match the name property of a EE_messenger. Optional.
144
-	*               @type array $messengers_to_validate_with An array of messengers that this message
141
+	 *               @type array $autoloadpaths An array of paths to add to the messages autoloader for the new message type. Required.
142
+	 *               @type array $messengers_to_activate_with An array of messengers that this message
143
+	 *                           type should activate with. Each value in the array should match the name property of a EE_messenger. Optional.
144
+	 *               @type array $messengers_to_validate_with An array of messengers that this message
145 145
 	 *                          type should validate with. Each value in the array should match the name property of an EE_messenger. Optional.
146 146
 	 *       	}
147 147
 	 *			@type array $custom_post_types
Please login to merge, or discard this patch.
Spacing   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param string $min_core_version
67 67
 	 * @return string always like '4.3.0.rc.000'
68 68
 	 */
69
-	protected static function _effective_version( $min_core_version ) {
69
+	protected static function _effective_version($min_core_version) {
70 70
 		// versions: 4 . 3 . 1 . p . 123
71 71
 		// offsets:    0 . 1 . 2 . 3 . 4
72
-		$version_parts = explode( '.', $min_core_version );
72
+		$version_parts = explode('.', $min_core_version);
73 73
 		//check they specified the micro version (after 2nd period)
74
-		if( ! isset( $version_parts[ 2 ] ) ) {
75
-			$version_parts[ 2] = '0';
74
+		if ( ! isset($version_parts[2])) {
75
+			$version_parts[2] = '0';
76 76
 		}
77 77
 		//if they didn't specify the 'p', or 'rc' part. Just assume the lowest possible
78 78
 		//soon we can assume that's 'rc', but this current version is 'alpha'
79
-		if( ! isset( $version_parts[ 3 ] ) ) {
80
-			$version_parts[ 3 ] = 'dev';
79
+		if ( ! isset($version_parts[3])) {
80
+			$version_parts[3] = 'dev';
81 81
 		}
82
-		if( ! isset( $version_parts[ 4 ] ) ) {
83
-			$version_parts[ 4 ] = '000';
82
+		if ( ! isset($version_parts[4])) {
83
+			$version_parts[4] = '000';
84 84
 		}
85
-		return implode( '.', $version_parts );
85
+		return implode('.', $version_parts);
86 86
 
87 87
 	}
88 88
 
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $actual_core_version the actual core version, optional
93 93
 	 * @return boolean
94 94
 	 */
95
-	public static  function _meets_min_core_version_requirement( $min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION ) {
96
-		return version_compare( self::_effective_version( $actual_core_version ), self::_effective_version( $min_core_version ), '>=' );
95
+	public static  function _meets_min_core_version_requirement($min_core_version, $actual_core_version = EVENT_ESPRESSO_VERSION) {
96
+		return version_compare(self::_effective_version($actual_core_version), self::_effective_version($min_core_version), '>=');
97 97
 	}
98 98
 
99 99
 
@@ -155,112 +155,112 @@  discard block
 block discarded – undo
155 155
 	 * @throws EE_Error
156 156
 	 * @return void
157 157
 	 */
158
-	public static function register( $addon_name = '', $setup_args = array()  ) {
158
+	public static function register($addon_name = '', $setup_args = array()) {
159 159
 		// required fields MUST be present, so let's make sure they are.
160
-		if ( empty( $addon_name ) || ! is_array( $setup_args )) {
161
-			throw new EE_Error( __( 'In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso' ));
160
+		if (empty($addon_name) || ! is_array($setup_args)) {
161
+			throw new EE_Error(__('In order to register an EE_Addon with EE_Register_Addon::register(), you must include the "addon_name" (the name of the addon), and an array of arguments.', 'event_espresso'));
162 162
 		}
163
-		if ( ! isset($setup_args[ 'main_file_path' ]) || empty( $setup_args[ 'main_file_path' ] ) ){
164
-			throw new EE_Error( sprintf( __( 'When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso' ), implode(",", array_keys( $setup_args ) ) ) );
163
+		if ( ! isset($setup_args['main_file_path']) || empty($setup_args['main_file_path'])) {
164
+			throw new EE_Error(sprintf(__('When registering an addon, you didn\'t provide the "main_file_path", which is the full path to the main file loaded directly by Wordpress. You only provided %s', 'event_espresso'), implode(",", array_keys($setup_args))));
165 165
 		}
166 166
 		// check that addon has not already been registered with that name
167
-		if ( isset( self::$_settings[ $addon_name ] ) && ! did_action( 'activate_plugin' ) ) {
168
-			throw new EE_Error( sprintf( __( 'An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso' ), $addon_name ));
167
+		if (isset(self::$_settings[$addon_name]) && ! did_action('activate_plugin')) {
168
+			throw new EE_Error(sprintf(__('An EE_Addon with the name "%s" has already been registered and each EE_Addon requires a unique name.', 'event_espresso'), $addon_name));
169 169
 		}
170 170
 
171 171
 
172 172
 		// no class name for addon?
173
-		if ( empty( $setup_args['class_name'] )) {
173
+		if (empty($setup_args['class_name'])) {
174 174
 			// generate one by first separating name with spaces
175
-			$class_name = str_replace( array( '-', '_' ), ' ', trim( $addon_name ));
175
+			$class_name = str_replace(array('-', '_'), ' ', trim($addon_name));
176 176
 			//capitalize, then replace spaces with underscores
177
-			$class_name = str_replace( ' ', '_', ucwords( $class_name ));
177
+			$class_name = str_replace(' ', '_', ucwords($class_name));
178 178
 		} else {
179 179
 			$class_name = $setup_args['class_name'];
180 180
 		}
181
-		$class_name = strpos( $class_name, 'EE_' ) === 0 ? $class_name : 'EE_' . $class_name;
181
+		$class_name = strpos($class_name, 'EE_') === 0 ? $class_name : 'EE_'.$class_name;
182 182
 		//setup $_settings array from incoming values.
183 183
 		$addon_settings = array(
184 184
 			// generated from the addon name, changes something like "calendar" to "EE_Calendar"
185 185
 			'class_name' 						=> $class_name,
186 186
 			// the addon slug for use in URLs, etc
187
-			'plugin_slug' 						=> isset( $setup_args['plugin_slug'] ) ? (string)$setup_args['plugin_slug'] : '',
187
+			'plugin_slug' 						=> isset($setup_args['plugin_slug']) ? (string) $setup_args['plugin_slug'] : '',
188 188
 			// page slug to be used when generating the "Settings" link on the WP plugin page
189
-			'plugin_action_slug' 			=> isset( $setup_args[ 'plugin_action_slug' ] ) ? (string)$setup_args[ 'plugin_action_slug' ] : '',
189
+			'plugin_action_slug' 			=> isset($setup_args['plugin_action_slug']) ? (string) $setup_args['plugin_action_slug'] : '',
190 190
 			// the "software" version for the addon
191
-			'version' 								=> isset( $setup_args['version'] ) ? (string)$setup_args['version'] : '',
191
+			'version' 								=> isset($setup_args['version']) ? (string) $setup_args['version'] : '',
192 192
 			// the minimum version of EE Core that the addon will work with
193
-			'min_core_version' 			=> isset( $setup_args['min_core_version'] ) ? (string)$setup_args['min_core_version'] : '',
193
+			'min_core_version' 			=> isset($setup_args['min_core_version']) ? (string) $setup_args['min_core_version'] : '',
194 194
 			// the minimum version of WordPress that the addon will work with
195
-			'min_wp_version' 			=> isset( $setup_args['min_wp_version'] ) ? (string)$setup_args['min_wp_version'] : EE_MIN_WP_VER_REQUIRED,
195
+			'min_wp_version' 			=> isset($setup_args['min_wp_version']) ? (string) $setup_args['min_wp_version'] : EE_MIN_WP_VER_REQUIRED,
196 196
 			// full server path to main file (file loaded directly by WP)
197
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
197
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
198 198
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
199
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
199
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
200 200
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
201
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
201
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
202 202
 			// the section name for this addon's configuration settings section (defaults to "addons")
203
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
203
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
204 204
 			// the class name for this addon's configuration settings object
205
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
205
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
206 206
 			//the name given to the config for this addons' configuration settings object (optional)
207
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
207
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
208 208
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
209
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
209
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
210 210
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
211
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
211
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
212 212
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
213
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
213
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
214 214
 			// array of full server paths to any EED_Modules used by the addon
215
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
215
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
216 216
 			// array of full server paths to any EES_Shortcodes used by the addon
217
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
217
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
218 218
 			// array of full server paths to any WP_Widgets used by the addon
219
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
219
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
220 220
 			// array of PUE options used by the addon
221
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
222
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
223
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
224
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
225
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
226
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
227
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
228
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
229
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
230
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
231
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
232
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
221
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
222
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
223
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
224
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
225
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
226
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
227
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
228
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
229
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
230
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
231
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
232
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
233 233
 			// if not empty, inserts a new table row after this plugin's row on the WP Plugins page that can be used for adding upgrading/marketing info
234
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
234
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
235 235
 		);
236 236
 
237 237
 		// if plugin_action_slug is NOT set, but an admin page path IS set, then let's just use the plugin_slug since that will be used for linking to the admin page
238
-		$addon_settings[ 'plugin_action_slug' ] = empty( $addon_settings[ 'plugin_action_slug' ] ) && ! empty( $addon_settings[ 'admin_path' ] ) ? $addon_settings[ 'plugin_slug' ] : $addon_settings[ 'plugin_action_slug' ];
238
+		$addon_settings['plugin_action_slug'] = empty($addon_settings['plugin_action_slug']) && ! empty($addon_settings['admin_path']) ? $addon_settings['plugin_slug'] : $addon_settings['plugin_action_slug'];
239 239
 		// full server path to main file (file loaded directly by WP)
240
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
240
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
241 241
 
242 242
 		global $wp_version;
243 243
 		//check whether this addon version is compatible with EE core
244
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
245
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
244
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
245
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
246 246
 			$incompatibility_message = sprintf(
247
-				__( 'The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso' ),
247
+				__('The Event Espresso "%1$s" addon was deactivated because it is incompatible with this version of core.%2$s Only version %3$s or higher of "%1$s" can run with this version of core. This can happen when attempting to run beta versions or release candidates with older versions of core, or running old versions of addons with a newer version of core.%2$sPlease upgrade Event Espresso Core and the "%1$s" addon, then re-attempt activating it.', 'event_espresso'),
248 248
 				$addon_name,
249 249
 				'<br />',
250
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
250
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
251 251
 			);
252
-		} else if ( ! self::_meets_min_core_version_requirement( $addon_settings[ 'min_core_version' ], espresso_version() ) ) {
252
+		} else if ( ! self::_meets_min_core_version_requirement($addon_settings['min_core_version'], espresso_version())) {
253 253
 			$incompatibility_message = sprintf(
254 254
 				__(
255 255
 					'The Event Espresso "%1$s" addon could not be activated because it requires Event Espresso Core version "%2$s" or higher in order to run.%4$sYour version of Event Espresso Core is currently at "%3$s". Please upgrade Event Espresso Core first and then re-attempt activating "%1$s".',
256 256
 					'event_espresso'
257 257
 				),
258 258
 				$addon_name,
259
-				self::_effective_version( $addon_settings[ 'min_core_version' ] ),
260
-				self::_effective_version( espresso_version() ),
259
+				self::_effective_version($addon_settings['min_core_version']),
260
+				self::_effective_version(espresso_version()),
261 261
 				'<br />'
262 262
 			);
263
-		} else if (version_compare( $wp_version, $addon_settings['min_wp_version'], '<' )) {
263
+		} else if (version_compare($wp_version, $addon_settings['min_wp_version'], '<')) {
264 264
 			$incompatibility_message = sprintf(
265 265
 				__(
266 266
 					'The Event Espresso "%1$s" addon could not be activated because it requires WordPress version "%2$s" or greater.%3$sPlease update your version of WordPress to use the "%1$s" addon and to keep your site secure.',
@@ -269,137 +269,137 @@  discard block
 block discarded – undo
269 269
 				$addon_name,
270 270
 				$addon_settings['min_wp_version'],
271 271
 				'<br />'
272
-			);;
272
+			); ;
273 273
 		} else {
274 274
 			$incompatibility_message = '';
275 275
 		}
276
-		if ( ! empty( $incompatibility_message ) ) {
276
+		if ( ! empty($incompatibility_message)) {
277 277
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
278 278
 			//plugin activated fine when it didn't
279
-			if( isset( $_GET[ 'activate' ]) ) {
280
-				unset( $_GET[ 'activate' ] );
279
+			if (isset($_GET['activate'])) {
280
+				unset($_GET['activate']);
281 281
 			}
282
-			if( isset( $_REQUEST[ 'activate' ] ) ){
283
-				unset( $_REQUEST[ 'activate' ] );
282
+			if (isset($_REQUEST['activate'])) {
283
+				unset($_REQUEST['activate']);
284 284
 			}
285 285
 			//and show an error message indicating the plugin didn't activate properly
286
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
287
-			if ( current_user_can( 'activate_plugins' )) {
288
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
289
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
286
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
287
+			if (current_user_can('activate_plugins')) {
288
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
289
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
290 290
 			}
291 291
 			return;
292 292
 		}
293 293
 		//this is an activation request
294
-		if( did_action( 'activate_plugin' ) ){
294
+		if (did_action('activate_plugin')) {
295 295
 			//to find if THIS is the addon that was activated,
296 296
 			//just check if we have already registered it or not
297 297
 			//(as the newly-activated addon wasn't around the first time addons were registered)
298
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
299
-				self::$_settings[ $addon_name ] = $addon_settings;
298
+			if ( ! isset(self::$_settings[$addon_name])) {
299
+				self::$_settings[$addon_name] = $addon_settings;
300 300
 				$addon = self::_load_and_init_addon_class($addon_name);
301 301
 				$addon->set_activation_indicator_option();
302 302
 				//dont bother setting up the rest of the addon.
303 303
 				//we know it was just activated and the request will end soon
304 304
 			}
305 305
 			return;
306
-		}else{
306
+		} else {
307 307
 			// make sure this was called in the right place!
308
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
308
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
309 309
 				EE_Error::doing_it_wrong(
310 310
 					__METHOD__,
311 311
 					sprintf(
312
-						__( 'An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.','event_espresso'),
312
+						__('An attempt to register an EE_Addon named "%s" has failed because it was not registered at the correct time.  Please use the "AHEE__EE_System__load_espresso_addons" hook to register addons.', 'event_espresso'),
313 313
 						$addon_name
314 314
 					),
315 315
 					'4.3.0'
316 316
 				);
317 317
 			}
318
-			self::$_settings[ $addon_name ] = $addon_settings;
318
+			self::$_settings[$addon_name] = $addon_settings;
319 319
 		}
320 320
 		// we need cars
321
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
321
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
322 322
 			// setup autoloader for single file
323
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
323
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
324 324
 		}
325 325
 		// setup autoloaders for folders
326
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
327
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
328
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
326
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
327
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
328
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
329 329
 			}
330 330
 		}
331 331
 		// register new models
332
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
333
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
332
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
333
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
334 334
 		}
335 335
 		// register model extensions
336
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
337
-			EE_Register_Model_Extensions::register( $addon_name, array( 'model_extension_paths' => self::$_settings[ $addon_name ]['model_extension_paths'] , 'class_extension_paths' => self::$_settings[ $addon_name ]['class_extension_paths']));
336
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
337
+			EE_Register_Model_Extensions::register($addon_name, array('model_extension_paths' => self::$_settings[$addon_name]['model_extension_paths'], 'class_extension_paths' => self::$_settings[$addon_name]['class_extension_paths']));
338 338
 		}
339 339
 		// setup DMS
340
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
341
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
340
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
341
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
342 342
 		}
343 343
 		// if config_class is present let's register config.
344
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
344
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
345 345
 			EE_Register_Config::register(
346
-				self::$_settings[ $addon_name ]['config_class'],
346
+				self::$_settings[$addon_name]['config_class'],
347 347
 				array(
348
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
349
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
348
+					'config_section' => self::$_settings[$addon_name]['config_section'],
349
+					'config_name' => self::$_settings[$addon_name]['config_name']
350 350
 				)
351 351
 			);
352 352
 		}
353 353
 		// register admin page
354
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
355
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
354
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
355
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
356 356
 
357 357
 		}
358 358
 		// add to list of modules to be registered
359
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
360
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
359
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
360
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
361 361
 		}
362 362
 		// add to list of shortcodes to be registered
363
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
364
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
363
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
364
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
365 365
 		}
366 366
 		// add to list of widgets to be registered
367
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
368
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
367
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
368
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
369 369
 		}
370 370
 
371 371
 		//register capability related stuff.
372
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
373
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
372
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
373
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
374 374
 		}
375 375
 		//any message type to register?
376
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
377
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
377
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
378 378
 		}
379 379
 
380 380
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
381
-		if ( ! empty( $setup_args['pue_options'] )) {
382
-			self::$_settings[ $addon_name ]['pue_options'] = array(
383
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
384
-				'plugin_basename' => isset( $setup_args['pue_options']['plugin_basename'] ) ? (string)$setup_args['pue_options']['plugin_basename'] : plugin_basename( self::$_settings[ $addon_name ]['main_file_path'] ),
385
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
386
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
381
+		if ( ! empty($setup_args['pue_options'])) {
382
+			self::$_settings[$addon_name]['pue_options'] = array(
383
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
384
+				'plugin_basename' => isset($setup_args['pue_options']['plugin_basename']) ? (string) $setup_args['pue_options']['plugin_basename'] : plugin_basename(self::$_settings[$addon_name]['main_file_path']),
385
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
386
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
387 387
 			);
388
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
388
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
389 389
 		}
390 390
 
391 391
 		//any custom post type/ custom capabilities or default terms to register
392
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
393
-			EE_Register_CPT::register( $addon_name, array( 'cpts' => self::$_settings[$addon_name]['custom_post_types'] , 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms'] ) );
392
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
393
+			EE_Register_CPT::register($addon_name, array('cpts' => self::$_settings[$addon_name]['custom_post_types'], 'cts' => self::$_settings[$addon_name]['custom_taxonomies'], 'default_terms' => self::$_settings[$addon_name]['default_terms']));
394 394
 		}
395
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
396
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
395
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
396
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
397 397
 		}
398 398
 		// load and instantiate main addon class
399 399
 		$addon = self::_load_and_init_addon_class($addon_name);
400 400
 		// call any additional admin_callback functions during load_admin_controller hook
401
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
402
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
401
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
402
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
403 403
 		}
404 404
 	}
405 405
 
@@ -410,22 +410,22 @@  discard block
 block discarded – undo
410 410
 	 * @param string $addon_name
411 411
 	 * @return EE_Addon
412 412
 	 */
413
-	private static function _load_and_init_addon_class($addon_name){
414
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
415
-		$addon->set_name( $addon_name );
416
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
417
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
418
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
419
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
420
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
421
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
422
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
423
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
424
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
425
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
413
+	private static function _load_and_init_addon_class($addon_name) {
414
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
415
+		$addon->set_name($addon_name);
416
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
417
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
418
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
419
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
420
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
421
+		$addon->set_version(self::$_settings[$addon_name]['version']);
422
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
423
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
424
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
425
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
426 426
 		//unfortunately this can't be hooked in upon construction, because we don't have
427 427
 		//the plugin mainfile's path upon construction.
428
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
428
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
429 429
 		return $addon;
430 430
 	}
431 431
 
@@ -438,18 +438,18 @@  discard block
 block discarded – undo
438 438
 	 */
439 439
 	public static function load_pue_update() {
440 440
 		// load PUE client
441
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
441
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
442 442
 		// cycle thru settings
443
-		foreach ( self::$_settings as $settings ) {
444
-			if ( ! empty( $settings['pue_options'] )) {
443
+		foreach (self::$_settings as $settings) {
444
+			if ( ! empty($settings['pue_options'])) {
445 445
 				// initiate the class and start the plugin update engine!
446 446
 				new PluginUpdateEngineChecker(
447 447
 				// host file URL
448 448
 					'https://eventespresso.com',
449 449
 					// plugin slug(s)
450 450
 					array(
451
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
452
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
451
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
452
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
453 453
 					),
454 454
 					// options
455 455
 					array(
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 	 * @return void
478 478
 	 */
479 479
 	public static function register_message_types() {
480
-		foreach ( self::$_settings as $settings ) {
481
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
482
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
480
+		foreach (self::$_settings as $settings) {
481
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
482
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
483 483
 			}
484 484
 		}
485 485
 	}
@@ -495,60 +495,60 @@  discard block
 block discarded – undo
495 495
 	 * @throws EE_Error
496 496
 	 * @return void
497 497
 	 */
498
-	public static function deregister( $addon_name = NULL ) {
499
-		if ( isset( self::$_settings[ $addon_name ] )) {
500
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
501
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
498
+	public static function deregister($addon_name = NULL) {
499
+		if (isset(self::$_settings[$addon_name])) {
500
+			$class_name = self::$_settings[$addon_name]['class_name'];
501
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
502 502
 				// setup DMS
503
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
503
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
506 506
 				// register admin page
507
-				EE_Register_Admin_Page::deregister( $addon_name );
507
+				EE_Register_Admin_Page::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
510 510
 				// add to list of modules to be registered
511
-				EE_Register_Module::deregister( $addon_name );
511
+				EE_Register_Module::deregister($addon_name);
512 512
 			}
513
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
513
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
514 514
 				// add to list of shortcodes to be registered
515
-				EE_Register_Shortcode::deregister( $addon_name );
515
+				EE_Register_Shortcode::deregister($addon_name);
516 516
 			}
517
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
517
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
518 518
 				// if config_class present let's register config.
519
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
519
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
520 520
 			}
521
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
521
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
522 522
 				// add to list of widgets to be registered
523
-				EE_Register_Widget::deregister( $addon_name );
523
+				EE_Register_Widget::deregister($addon_name);
524 524
 			}
525
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
526
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
525
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
526
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
527 527
 				// add to list of shortcodes to be registered
528
-				EE_Register_Model::deregister( $addon_name );
528
+				EE_Register_Model::deregister($addon_name);
529 529
 			}
530
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
531
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
530
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
531
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
532 532
 				// add to list of shortcodes to be registered
533
-				EE_Register_Model_Extensions::deregister( $addon_name );
533
+				EE_Register_Model_Extensions::deregister($addon_name);
534 534
 				}
535
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
536
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
537
-					EE_Register_Message_Type::deregister( $message_type );
535
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
536
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
537
+					EE_Register_Message_Type::deregister($message_type);
538 538
 				}
539 539
 			}
540 540
 			//deregister capabilities for addon
541
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
542
-				EE_Register_Capabilities::deregister( $addon_name );
541
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
542
+				EE_Register_Capabilities::deregister($addon_name);
543 543
 			}
544 544
 			//deregister custom_post_types for addon
545
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
546
-				EE_Register_CPT::deregister( $addon_name );
545
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
546
+				EE_Register_CPT::deregister($addon_name);
547 547
 			}
548
-			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->{$class_name}, 'deactivation' ) );
549
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required' ) );
548
+			remove_action('deactivate_'.EE_Registry::instance()->addons->{$class_name}->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->{$class_name}, 'deactivation'));
549
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->{$class_name}, 'initialize_db_if_no_migrations_required'));
550 550
 			unset(EE_Registry::instance()->addons->{$class_name});
551
-			unset( self::$_settings[ $addon_name ] );
551
+			unset(self::$_settings[$addon_name]);
552 552
 		}
553 553
 	}
554 554
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Attendee_Shortcodes.lib.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@
 block discarded – undo
41 41
 
42 42
 	/**
43 43
 	 * EE_Attendee_Shortcodes constructor.
44
-	*/
44
+	 */
45 45
 	public function __construct() {
46 46
 		parent::__construct();
47 47
 	}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _init_props() {
52
-		$this->label = esc_html__( 'Attendee Shortcodes', 'event_espresso' );
53
-		$this->description = esc_html__( 'All shortcodes specific to attendee related data', 'event_espresso' );
52
+		$this->label = esc_html__('Attendee Shortcodes', 'event_espresso');
53
+		$this->description = esc_html__('All shortcodes specific to attendee related data', 'event_espresso');
54 54
 		$this->_shortcodes = array(
55
-			'[FNAME]' => esc_html__( 'First Name of an attendee.', 'event_espresso' ),
56
-			'[LNAME]' => esc_html__( 'Last Name of an attendee.', 'event_espresso' ),
57
-			'[ATTENDEE_EMAIL]' => esc_html__( 'Email address for the attendee.', 'event_espresso' ),
58
-			'[EDIT_ATTENDEE_LINK]' => esc_html__( 'Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso' ),
59
-			'[REGISTRATION_CODE]' => esc_html__( 'Unique Registration Code for the registration', 'event_espresso' ),
60
-			'[REGISTRATION_STATUS_ID]' => esc_html__( 'Parses to the registration status for the attendee', 'event_espresso' ),
61
-			'[REGISTRATION_STATUS_LABEL]' => esc_html__( 'Parses to the status label for the registrant', 'event_espresso' ),
62
-			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__( 'Parses to the total amount paid for this registration.', 'event_espresso' ),
63
-			'[FRONTEND_EDIT_REG_LINK]' => esc_html__( 'Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso' ),
64
-			'[PHONE_NUMBER]' => esc_html__( 'The Phone Number for the Registration.', 'event_espresso' ),
65
-			'[ADDRESS]' => esc_html__( 'The Address for the Registration', 'event_espresso' ),
66
-			'[ADDRESS2]' => esc_html__( 'Whatever was in the address 2 field for the registration.', 'event_espresso' ),
67
-			'[CITY]' => esc_html__( 'The city for the registration.', 'event_espresso' ),
68
-			'[ZIP_PC]' => esc_html__( 'The ZIP (or Postal) Code for the Registration.', 'event_espresso' ),
69
-			'[ADDRESS_STATE]' => esc_html__( 'The state/province for the registration.', 'event_espresso' ),
70
-			'[COUNTRY]' => esc_html__( 'The country for the registration.', 'event_espresso' )
55
+			'[FNAME]' => esc_html__('First Name of an attendee.', 'event_espresso'),
56
+			'[LNAME]' => esc_html__('Last Name of an attendee.', 'event_espresso'),
57
+			'[ATTENDEE_EMAIL]' => esc_html__('Email address for the attendee.', 'event_espresso'),
58
+			'[EDIT_ATTENDEE_LINK]' => esc_html__('Edit Registration Link (typically you\'d only use this for messages going to event administrators)', 'event_espresso'),
59
+			'[REGISTRATION_CODE]' => esc_html__('Unique Registration Code for the registration', 'event_espresso'),
60
+			'[REGISTRATION_STATUS_ID]' => esc_html__('Parses to the registration status for the attendee', 'event_espresso'),
61
+			'[REGISTRATION_STATUS_LABEL]' => esc_html__('Parses to the status label for the registrant', 'event_espresso'),
62
+			'[REGISTRATION_TOTAL_AMOUNT_PAID]' => esc_html__('Parses to the total amount paid for this registration.', 'event_espresso'),
63
+			'[FRONTEND_EDIT_REG_LINK]' => esc_html__('Generates a link for the given registration to edit this registration details on the frontend.', 'event_espresso'),
64
+			'[PHONE_NUMBER]' => esc_html__('The Phone Number for the Registration.', 'event_espresso'),
65
+			'[ADDRESS]' => esc_html__('The Address for the Registration', 'event_espresso'),
66
+			'[ADDRESS2]' => esc_html__('Whatever was in the address 2 field for the registration.', 'event_espresso'),
67
+			'[CITY]' => esc_html__('The city for the registration.', 'event_espresso'),
68
+			'[ZIP_PC]' => esc_html__('The ZIP (or Postal) Code for the Registration.', 'event_espresso'),
69
+			'[ADDRESS_STATE]' => esc_html__('The state/province for the registration.', 'event_espresso'),
70
+			'[COUNTRY]' => esc_html__('The country for the registration.', 'event_espresso')
71 71
 			);
72 72
 	}
73 73
 
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 	 * @return string
82 82
 	 * @throws \EE_Error
83 83
 	 */
84
-	protected function _parser( $shortcode ) {
84
+	protected function _parser($shortcode) {
85 85
 
86 86
 
87
-		$this->_xtra = ! empty( $this->_extra_data ) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
87
+		$this->_xtra = ! empty($this->_extra_data) && $this->_extra_data['data'] instanceof EE_Messages_Addressee
88 88
 			? $this->_extra_data['data']
89 89
 			: null;
90 90
 
@@ -93,34 +93,34 @@  discard block
 block discarded – undo
93 93
 			? null
94 94
 			: $this->_data;
95 95
 
96
-		if ( ! $registration instanceof EE_Registration ) {
96
+		if ( ! $registration instanceof EE_Registration) {
97 97
 			//let's attempt to get the txn_id for the error message.
98
-			$txn_id = isset( $this->_xtra->txn ) && $this->_xtra->txn instanceof EE_Transaction
98
+			$txn_id = isset($this->_xtra->txn) && $this->_xtra->txn instanceof EE_Transaction
99 99
 				? $this->_xtra->txn->ID()
100
-				: esc_html__( 'Unknown', 'event_espresso' );
101
-			$msg = esc_html__( 'There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso' );
100
+				: esc_html__('Unknown', 'event_espresso');
101
+			$msg = esc_html__('There is no EE_Registration object in the data sent to the EE_Attendee Shortcode Parser for the messages system.', 'event_espresso');
102 102
 			$dev_msg = sprintf(
103
-				esc_html__( 'The transaction ID for this request is: %s', 'event_espresso' ),
103
+				esc_html__('The transaction ID for this request is: %s', 'event_espresso'),
104 104
 				$txn_id
105 105
 			);
106
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
106
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
107 107
 		}
108 108
 
109 109
 		//attendee obj for this registration
110
-		$attendee = isset( $this->_xtra->registrations[ $registration->ID() ]['att_obj'] )
111
-			?  $this->_xtra->registrations[ $registration->ID() ]['att_obj']
112
-			: null ;
110
+		$attendee = isset($this->_xtra->registrations[$registration->ID()]['att_obj'])
111
+			? $this->_xtra->registrations[$registration->ID()]['att_obj']
112
+			: null;
113 113
 
114
-		if ( ! $attendee instanceof EE_Attendee ) {
115
-			$msg = esc_html__( 'There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso' );
114
+		if ( ! $attendee instanceof EE_Attendee) {
115
+			$msg = esc_html__('There is no EE_Attendee object in the data sent to the EE_Attendee_Shortcode parser for the messages system.', 'event_espresso');
116 116
 			$dev_msg = sprintf(
117
-				esc_html__( 'The registration ID for this request is: %s', 'event_espresso' ),
117
+				esc_html__('The registration ID for this request is: %s', 'event_espresso'),
118 118
 				$registration->ID()
119 119
 			);
120
-			throw new EE_Error( "{$msg}||{$msg} {$dev_msg}" );
120
+			throw new EE_Error("{$msg}||{$msg} {$dev_msg}");
121 121
 		}
122 122
 
123
-		switch ( $shortcode ) {
123
+		switch ($shortcode) {
124 124
 
125 125
 			case '[FNAME]' :
126 126
 				return $attendee->fname();
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Datetime_Shortcodes.lib.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -61,13 +61,13 @@  discard block
 block discarded – undo
61 61
 	 * @param string $shortcode
62 62
 	 * @return string
63 63
 	 */
64
-	protected function _parser( $shortcode ) {
64
+	protected function _parser($shortcode) {
65 65
 
66
-		if ( ! $this->_data instanceof EE_Datetime ) {
66
+		if ( ! $this->_data instanceof EE_Datetime) {
67 67
 			return ''; //get out cause we can only parse with the datetime object.
68 68
 		}
69 69
 
70
-		switch ( $shortcode ) {
70
+		switch ($shortcode) {
71 71
 
72 72
 			case '[DATETIME_START]' :
73 73
 				return $this->_data->get_i18n_datetime('DTT_EVT_start');
@@ -81,27 +81,27 @@  discard block
 block discarded – undo
81 81
 				return $this->_data->get_timezone();
82 82
 				break;
83 83
 			case '[DATE_START]' :
84
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'date_format' ) );
84
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('date_format'));
85 85
 				break;
86 86
 			case '[DATE_END]' :
87
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'date_format' ) );
87
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('date_format'));
88 88
 				break;
89 89
 			case '[TIME_START]' :
90
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_start', get_option( 'time_format' ) );
90
+				return $this->_data->get_i18n_datetime('DTT_EVT_start', get_option('time_format'));
91 91
 				break;
92 92
 			case '[TIME_END]' :
93
-				return $this->_data->get_i18n_datetime( 'DTT_EVT_end', get_option( 'time_format' ) );
93
+				return $this->_data->get_i18n_datetime('DTT_EVT_end', get_option('time_format'));
94 94
 				break;
95 95
 		}
96 96
 
97
-		if ( strpos( $shortcode, '[ICAL_LINK_*') !== FALSE  ) {
98
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
97
+		if (strpos($shortcode, '[ICAL_LINK_*') !== FALSE) {
98
+			$attrs = $this->_get_shortcode_attrs($shortcode);
99 99
 			
100
-			$link_text = empty( $attrs['link_text'] ) ?  __( 'Add to iCal Calendar', 'event_espresso' ) : $attrs['link_text'];
100
+			$link_text = empty($attrs['link_text']) ? __('Add to iCal Calendar', 'event_espresso') : $attrs['link_text'];
101 101
 			
102
-			$URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $this->_data->ID() ), site_url() );
102
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $this->_data->ID()), site_url());
103 103
 		
104
-			return '<a class="ee-ical" href="' . $URL . '">' . $link_text . '</a>';
104
+			return '<a class="ee-ical" href="'.$URL.'">'.$link_text.'</a>';
105 105
 			
106 106
 		}
107 107
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Organization_Shortcodes.lib.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@
 block discarded – undo
6 6
  * @package Event Espresso
7 7
  * @subpackage messages
8 8
  */
9
-if (!defined('EVENT_ESPRESSO_VERSION') )
9
+if (!defined('EVENT_ESPRESSO_VERSION') ) {
10 10
 	exit('NO direct script access allowed');
11
+}
11 12
 
12 13
 /**
13 14
  *
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION') )
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('NO direct script access allowed');
5 5
 
6 6
 /**
@@ -58,96 +58,96 @@  discard block
 block discarded – undo
58 58
 			'[CO_GOOGLE_URL]' => esc_html__('Link to organization Google page', 'event_espresso'),
59 59
 			'[CO_LINKEDIN_URL]' => esc_html__('Link to organization LinkedIn page', 'event_espresso'),
60 60
 			'[CO_INSTAGRAM_URL]' => esc_html__('Link to organization Instagram page', 'event_espresso'),
61
-			'[CO_TAX_NUMBER_*]' => sprintf( esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso' ),'<strong>','</strong>')
61
+			'[CO_TAX_NUMBER_*]' => sprintf(esc_html__('This is the shortcode used for displaying any tax number for the company.  %1$sNote: This is a special dynamic shortcode.%2$s You can use the "prefix" parameter to indicate what the prefix for this tax number is.  It defaults to "VAT/Tax Number:".  To change this prefix you do the following format for this shortcode:  [CO_TAX_NUMBER_* prefix="GST: "] and that will output: GST: 12345t56.  Also take note that if you have NO number in your settings, the prefix is not output either.', 'event_espresso'), '<strong>', '</strong>')
62 62
 			);
63 63
 	}
64 64
 
65 65
 
66
-	protected function _parser( $shortcode ) {
66
+	protected function _parser($shortcode) {
67 67
 
68
-		switch ( $shortcode ) {
68
+		switch ($shortcode) {
69 69
 
70 70
 			case '[COMPANY]' :
71
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'name' );
71
+				return EE_Registry::instance()->CFG->organization->get_pretty('name');
72 72
 				break;
73 73
 
74 74
 			case '[CO_ADD1]' :
75
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' );
75
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_1');
76 76
 				break;
77 77
 
78 78
 			case '[CO_ADD2]' :
79
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' );
79
+				return EE_Registry::instance()->CFG->organization->get_pretty('address_2');
80 80
 				break;
81 81
 
82 82
 			case '[CO_CITY]' :
83
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'city' );
83
+				return EE_Registry::instance()->CFG->organization->get_pretty('city');
84 84
 				break;
85 85
 
86 86
 			case '[CO_STATE]' :
87
-				$state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( EE_Registry::instance()->CFG->organization->STA_ID );
87
+				$state = EE_Registry::instance()->load_model('State')->get_one_by_ID(EE_Registry::instance()->CFG->organization->STA_ID);
88 88
 				return $state->name();
89 89
 				break;
90 90
 
91 91
 			case '[CO_ZIP]' :
92
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'zip' );
92
+				return EE_Registry::instance()->CFG->organization->get_pretty('zip');
93 93
 				break;
94 94
 
95 95
 			case '[CO_EMAIL]' :
96
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'email' );
96
+				return EE_Registry::instance()->CFG->organization->get_pretty('email');
97 97
 				break;
98 98
 
99 99
 			case '[CO_PHONE]' :
100
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'phone' );
100
+				return EE_Registry::instance()->CFG->organization->get_pretty('phone');
101 101
 				break;
102 102
 
103 103
 			case '[CO_LOGO]' :
104
-				return '<img src="' . EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) . '" id="headerImage" />';
104
+				return '<img src="'.EE_Registry::instance()->CFG->organization->get_pretty('logo_url').'" id="headerImage" />';
105 105
 				break;
106 106
 
107 107
 			case '[CO_LOGO_URL]' :
108
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' );
108
+				return EE_Registry::instance()->CFG->organization->get_pretty('logo_url');
109 109
 				break;
110 110
 
111 111
 			case '[CO_FACEBOOK_URL]' :
112
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' );
112
+				return EE_Registry::instance()->CFG->organization->get_pretty('facebook');
113 113
 				break;
114 114
 
115 115
 			case '[CO_TWITTER_URL]' :
116
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' );
116
+				return EE_Registry::instance()->CFG->organization->get_pretty('twitter');
117 117
 				break;
118 118
 
119 119
 			case '[CO_PINTEREST_URL]' :
120
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' );
120
+				return EE_Registry::instance()->CFG->organization->get_pretty('pinterest');
121 121
 				break;
122 122
 
123 123
 			case '[CO_LINKEDIN_URL]' :
124
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' );
124
+				return EE_Registry::instance()->CFG->organization->get_pretty('linkedin');
125 125
 				break;
126 126
 
127 127
 			case '[CO_GOOGLE_URL]' :
128
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'google' );
128
+				return EE_Registry::instance()->CFG->organization->get_pretty('google');
129 129
 				break;
130 130
 
131 131
 			case '[CO_INSTAGRAM_URL]' :
132
-				return EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' );
132
+				return EE_Registry::instance()->CFG->organization->get_pretty('instagram');
133 133
 				break;
134 134
 
135 135
 		}
136 136
 
137 137
 		//also allow for parameter shortcode
138
-		if ( strpos( $shortcode, '[CO_TAX_NUMBER_*' ) !== FALSE ) {
138
+		if (strpos($shortcode, '[CO_TAX_NUMBER_*') !== FALSE) {
139 139
 			//first see if there is any company tax number set and bail early if not
140 140
 			$tax_number = EE_Registry::instance()->CFG->organization->vat;
141
-			if ( empty( $tax_number ) ) {
141
+			if (empty($tax_number)) {
142 142
 				return '';
143 143
 			}
144 144
 
145 145
 			//see if there are any attributes.
146
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
146
+			$attrs = $this->_get_shortcode_attrs($shortcode);
147 147
 
148 148
 			//set custom attrs if present (or default)
149
-			$prefix = isset( $attrs['prefix'] ) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
-			return $prefix . $tax_number;
149
+			$prefix = isset($attrs['prefix']) ? $attrs['prefix'] : esc_html__('VAT/Tax Number: ', 'event_espresso');
150
+			return $prefix.$tax_number;
151 151
 		}
152 152
 
153 153
 		return '';
Please login to merge, or discard this patch.
modules/event_single/EED_Event_Single.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 	 * @return EED_Event_Single
41 41
 	 */
42 42
 	public static function instance() {
43
-		return parent::get_instance( __CLASS__ );
43
+		return parent::get_instance(__CLASS__);
44 44
 	}
45 45
 
46 46
 
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 	 *  @return 	void
53 53
 	 */
54 54
 	public static function set_hooks() {
55
-		add_filter( 'FHEE_run_EE_wp', '__return_true' );
56
-		add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 );
57
-		EE_Config::register_route( __( 'event', 'event_espresso' ), 'Event_Single', 'run' );
55
+		add_filter('FHEE_run_EE_wp', '__return_true');
56
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
57
+		EE_Config::register_route(__('event', 'event_espresso'), 'Event_Single', 'run');
58 58
 	}
59 59
 
60 60
 	/**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *  @return 	void
65 65
 	 */
66 66
 	public static function set_hooks_admin() {
67
-		add_action( 'wp_loaded', array( 'EED_Event_Single', 'set_definitions' ), 2 );
67
+		add_action('wp_loaded', array('EED_Event_Single', 'set_definitions'), 2);
68 68
 	}
69 69
 
70 70
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	 * @return void
79 79
 	 */
80 80
 	public static function set_definitions() {
81
-		define( 'EVENT_SINGLE_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
82
-		define( 'EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
81
+		define('EVENT_SINGLE_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
82
+		define('EVENT_SINGLE_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
83 83
 	}
84 84
 
85 85
 
@@ -89,10 +89,10 @@  discard block
 block discarded – undo
89 89
 	 *
90 90
 	 * @void
91 91
 	 */
92
-	protected function set_config(){
93
-		$this->set_config_section( 'template_settings' );
94
-		$this->set_config_class( 'EE_Event_Single_Config' );
95
-		$this->set_config_name( 'EED_Event_Single' );
92
+	protected function set_config() {
93
+		$this->set_config_section('template_settings');
94
+		$this->set_config_class('EE_Event_Single_Config');
95
+		$this->set_config_name('EED_Event_Single');
96 96
 	}
97 97
 
98 98
 
@@ -105,35 +105,35 @@  discard block
 block discarded – undo
105 105
 	 * @param \EE_Event_Single_Config $config
106 106
 	 * @return \EE_Template_Part_Manager
107 107
 	 */
108
-	public function initialize_template_parts( EE_Event_Single_Config $config = null ) {
108
+	public function initialize_template_parts(EE_Event_Single_Config $config = null) {
109 109
 		$config = $config instanceof EE_Event_Single_Config ? $config : $this->config();
110 110
 		EEH_Autoloader::instance()->register_template_part_autoloaders();
111 111
 		$template_parts = new EE_Template_Part_Manager();
112 112
 		$template_parts->add_template_part(
113 113
 			'tickets',
114
-			__( 'Ticket Selector', 'event_espresso' ),
114
+			__('Ticket Selector', 'event_espresso'),
115 115
 			'content-espresso_events-tickets.php',
116 116
 			$config->display_order_tickets
117 117
 		);
118 118
 		$template_parts->add_template_part(
119 119
 			'datetimes',
120
-			__( 'Dates and Times', 'event_espresso' ),
120
+			__('Dates and Times', 'event_espresso'),
121 121
 			'content-espresso_events-datetimes.php',
122 122
 			$config->display_order_datetimes
123 123
 		);
124 124
 		$template_parts->add_template_part(
125 125
 			'event',
126
-			__( 'Event Description', 'event_espresso' ),
126
+			__('Event Description', 'event_espresso'),
127 127
 			'content-espresso_events-details.php',
128 128
 			$config->display_order_event
129 129
 		);
130 130
 		$template_parts->add_template_part(
131 131
 			'venue',
132
-			__( 'Venue Information', 'event_espresso' ),
132
+			__('Venue Information', 'event_espresso'),
133 133
 			'content-espresso_events-venues.php',
134 134
 			$config->display_order_venue
135 135
 		);
136
-		do_action( 'AHEE__EED_Event_Single__initialize_template_parts', $template_parts );
136
+		do_action('AHEE__EED_Event_Single__initialize_template_parts', $template_parts);
137 137
 		return $template_parts;
138 138
 	}
139 139
 
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
 	 * @param WP $WP
148 148
 	 * @return    void
149 149
 	 */
150
-	public function run( $WP ) {
150
+	public function run($WP) {
151 151
 		// ensure valid EE_Events_Single_Config() object exists
152 152
 		$this->set_config();
153 153
 		// check what template is loaded
154
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
155
-		add_filter( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true' );
154
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
155
+		add_filter('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', '__return_true');
156 156
 		// load css
157
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
157
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
158 158
 	}
159 159
 
160 160
 
@@ -166,27 +166,27 @@  discard block
 block discarded – undo
166 166
 	 * @param 	string $template
167 167
 	 * @return 	string
168 168
 	 */
169
-	public function template_include( $template ) {
169
+	public function template_include($template) {
170 170
 		global $post;
171 171
 		/** @type EE_Event_Single_Config $config */
172 172
 		$config = $this->config();
173
-		if ( $config->display_status_banner_single ) {
174
-			add_filter( 'the_title', array( 'EED_Event_Single', 'the_title' ), 100, 2 );
173
+		if ($config->display_status_banner_single) {
174
+			add_filter('the_title', array('EED_Event_Single', 'the_title'), 100, 2);
175 175
 		}
176 176
 		// not a custom template?
177 177
 		if (
178
-			EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_events.php'
179
-			|| apply_filters( 'FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE )
180
-			&& ! post_password_required( $post )
178
+			EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_events.php'
179
+			|| apply_filters('FHEE__EED_Event_Single__template_include__allow_custom_selected_template', FALSE)
180
+			&& ! post_password_required($post)
181 181
 		) {
182 182
 			EEH_Template::load_espresso_theme_functions();
183 183
 			// then add extra event data via hooks
184
-			add_action( 'loop_start', array( 'EED_Event_Single', 'loop_start' ));
185
-			add_filter( 'get_the_excerpt', array( 'EED_Event_Single', 'get_the_excerpt' ), 1, 1 );
186
-			add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
187
-			add_action( 'loop_end', array( 'EED_Event_Single', 'loop_end' ));
184
+			add_action('loop_start', array('EED_Event_Single', 'loop_start'));
185
+			add_filter('get_the_excerpt', array('EED_Event_Single', 'get_the_excerpt'), 1, 1);
186
+			add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
187
+			add_action('loop_end', array('EED_Event_Single', 'loop_end'));
188 188
 			// don't display entry meta because the existing theme will take car of that
189
-			add_filter( 'FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false' );
189
+			add_filter('FHEE__content_espresso_events_details_template__display_entry_meta', '__return_false');
190 190
 		}
191 191
 		return $template;
192 192
 	}
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param 	array $wp_query_array an array containing the WP_Query object
201 201
 	 * @return 	void
202 202
 	 */
203
-	public static function loop_start( $wp_query_array ) {
203
+	public static function loop_start($wp_query_array) {
204 204
 		global $post;
205
-		do_action( 'AHEE_event_details_before_post', $post, $wp_query_array );
205
+		do_action('AHEE_event_details_before_post', $post, $wp_query_array);
206 206
 	}
207 207
 
208 208
 
@@ -215,9 +215,9 @@  discard block
 block discarded – undo
215 215
 	 * @param 	int 	$id
216 216
 	 * @return 	string
217 217
 	 */
218
-	public static function the_title( $title = '', $id = 0 ) {
218
+	public static function the_title($title = '', $id = 0) {
219 219
 		global $post;
220
-		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner( $post->ID ) . $title :  $title;
220
+		return in_the_loop() && $post->ID == $id ? espresso_event_status_banner($post->ID).$title : $title;
221 221
 	}
222 222
 
223 223
 
@@ -229,9 +229,9 @@  discard block
 block discarded – undo
229 229
 	 * @param        string $excerpt
230 230
 	 * @return        string
231 231
 	 */
232
-	public static function get_the_excerpt( $excerpt = '' ) {
232
+	public static function get_the_excerpt($excerpt = '') {
233 233
 		EED_Event_Single::$using_get_the_excerpt = true;
234
-		add_filter( 'wp_trim_excerpt', array( 'EED_Event_Single', 'end_get_the_excerpt' ), 999, 1 );
234
+		add_filter('wp_trim_excerpt', array('EED_Event_Single', 'end_get_the_excerpt'), 999, 1);
235 235
 		return $excerpt;
236 236
 	}
237 237
 
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 	 * @param  string $text
245 245
 	 * @return string
246 246
 	 */
247
-	public static function end_get_the_excerpt( $text = '' ) {
247
+	public static function end_get_the_excerpt($text = '') {
248 248
 		EED_Event_Single::$using_get_the_excerpt = false;
249 249
 		return $text;
250 250
 	}
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	 * @param 	string 	$content
259 259
 	 * @return 	string
260 260
 	 */
261
-	public static function event_details( $content ) {
261
+	public static function event_details($content) {
262 262
 		global $post;
263 263
 		static $current_post_ID = 0;
264 264
 		if (
@@ -273,15 +273,15 @@  discard block
 block discarded – undo
273 273
 			// We want to allow those plugins to still do their thing and have access to our content, but depending on
274 274
 			// how your event content is being displayed (shortcode, CPT route, etc), this filter can get applied twice,
275 275
 			// so the following allows this filter to be applied multiple times, but only once for real
276
-			$current_post_ID = did_action( 'loop_start' ) ? $post->ID : 0;
277
-			if ( EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order ) {
276
+			$current_post_ID = did_action('loop_start') ? $post->ID : 0;
277
+			if (EE_Registry::instance()->CFG->template_settings->EED_Event_Single->use_sortable_display_order) {
278 278
 				// we need to first remove this callback from being applied to the_content()
279 279
 				// (otherwise it will recurse and blow up the interweb)
280
-				remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
280
+				remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
281 281
 				EED_Event_Single::instance()->template_parts = EED_Event_Single::instance()->initialize_template_parts();
282
-				$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
283
-				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters( $content );
284
-				add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
282
+				$content = EEH_Template::locate_template('content-espresso_events-details.php');
283
+				$content = EED_Event_Single::instance()->template_parts->apply_template_part_filters($content);
284
+				add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
285 285
 			} else {
286 286
 				$content = EED_Event_Single::use_filterable_display_order();
287 287
 			}
@@ -302,19 +302,19 @@  discard block
 block discarded – undo
302 302
 		// it uses the_content() for displaying the $post->post_content
303 303
 		// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
304 304
 		// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
305
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
305
+		remove_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
306 306
 		//now add additional content
307
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110, 1 );
308
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120, 1 );
309
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130, 1 );
310
-		do_action( 'AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters' );
307
+		add_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110, 1);
308
+		add_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120, 1);
309
+		add_filter('the_content', array('EED_Event_Single', 'event_venues'), 130, 1);
310
+		do_action('AHEE__EED_Event_Single__use_filterable_display_order__after_add_filters');
311 311
 		// now load our template
312
-		$content = EEH_Template::locate_template( 'content-espresso_events-details.php' );
312
+		$content = EEH_Template::locate_template('content-espresso_events-details.php');
313 313
 		//now add our filter back in, plus some others
314
-		add_filter( 'the_content', array( 'EED_Event_Single', 'event_details' ), 100 );
315
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 );
316
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 );
317
-		remove_filter( 'the_content', array( 'EED_Event_Single', 'event_venues' ), 130 );
314
+		add_filter('the_content', array('EED_Event_Single', 'event_details'), 100);
315
+		remove_filter('the_content', array('EED_Event_Single', 'event_datetimes'), 110);
316
+		remove_filter('the_content', array('EED_Event_Single', 'event_tickets'), 120);
317
+		remove_filter('the_content', array('EED_Event_Single', 'event_venues'), 130);
318 318
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
319 319
 		return $content;
320 320
 	}
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 	 * @param        string $content
329 329
 	 * @return        string
330 330
 	 */
331
-	public static function event_datetimes( $content ) {
332
-		return EEH_Template::locate_template( 'content-espresso_events-datetimes.php' ) . $content;
331
+	public static function event_datetimes($content) {
332
+		return EEH_Template::locate_template('content-espresso_events-datetimes.php').$content;
333 333
 	}
334 334
 
335 335
 
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 	 * @param        string $content
342 342
 	 * @return        string
343 343
 	 */
344
-	public static function event_tickets( $content ) {
345
-		return EEH_Template::locate_template( 'content-espresso_events-tickets.php' ) . $content;
344
+	public static function event_tickets($content) {
345
+		return EEH_Template::locate_template('content-espresso_events-tickets.php').$content;
346 346
 	}
347 347
 
348 348
 
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 	 * @param 	string $content
355 355
 	 * @return 	string
356 356
 	 */
357
-	public static function event_venue( $content ) {
358
-		return EED_Event_Single::event_venues( $content );
357
+	public static function event_venue($content) {
358
+		return EED_Event_Single::event_venues($content);
359 359
 	}
360 360
 
361 361
 
@@ -367,8 +367,8 @@  discard block
 block discarded – undo
367 367
 	 * @param        string $content
368 368
 	 * @return        string
369 369
 	 */
370
-	public static function event_venues( $content ) {
371
-		return $content . EEH_Template::locate_template( 'content-espresso_events-venues.php' );
370
+	public static function event_venues($content) {
371
+		return $content.EEH_Template::locate_template('content-espresso_events-venues.php');
372 372
 	}
373 373
 
374 374
 
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
 	 * 	@param		array 	$wp_query_array an array containing the WP_Query object
381 381
 	 *  	@return 		void
382 382
 	 */
383
-	public static function loop_end( $wp_query_array ) {
383
+	public static function loop_end($wp_query_array) {
384 384
 		global $post;
385
-		do_action( 'AHEE_event_details_after_post', $post, $wp_query_array );
385
+		do_action('AHEE_event_details_after_post', $post, $wp_query_array);
386 386
 	}
387 387
 
388 388
 
@@ -395,16 +395,16 @@  discard block
 block discarded – undo
395 395
 	 */
396 396
 	public function wp_enqueue_scripts() {
397 397
 		// get some style
398
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && apply_filters( 'FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE )) {
398
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && apply_filters('FHEE__EED_Event_Single__wp_enqueue_scripts__enable_css', TRUE)) {
399 399
 			// first check uploads folder
400
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
401
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
400
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
401
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
402 402
 			} else {
403
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ));
403
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
404 404
 			}
405
-			wp_enqueue_script( $this->theme );
406
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
407
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
405
+			wp_enqueue_script($this->theme);
406
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
407
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
408 408
 			}
409 409
 		}
410 410
 	}
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 	public static function display_venue() {
426 426
 		/** @type EE_Event_Single_Config $config */
427 427
 		$config = EED_Event_Single::instance()->config();
428
-		$display_venue= isset( $config->display_venue ) ? $config->display_venue : TRUE;
428
+		$display_venue = isset($config->display_venue) ? $config->display_venue : TRUE;
429 429
 		$venue_name = EEH_Venue_View::venue_name();
430
-		return $display_venue && ! empty( $venue_name ) ? TRUE : FALSE;
430
+		return $display_venue && ! empty($venue_name) ? TRUE : FALSE;
431 431
 	}
432 432
 
433 433
 
Please login to merge, or discard this patch.
modules/ical/EED_Ical.module.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -220,8 +220,8 @@
 block discarded – undo
220 220
 			//Escape spcial chars within the decription
221 221
 			$description = EED_Ical::_escape_ICal_data( $description );
222 222
 
223
-		    //Remove line breaks and output in iCal format
224
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
223
+			//Remove line breaks and output in iCal format
224
+			$description = str_replace( array( "\r\n", "\n"), '\n', $description );
225 225
 
226 226
 		return $description;
227 227
 	}
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	 * @return EED_Ical
33 33
 	 */
34 34
 	public static function instance() {
35
-		return parent::get_instance( __CLASS__ );
35
+		return parent::get_instance(__CLASS__);
36 36
 	}
37 37
 
38 38
 
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	public static function set_hooks() {
47 47
 		// create download buttons
48
-		add_filter( 'FHEE__espresso_list_of_event_dates__datetime_html', array( 'EED_Ical', 'generate_add_to_iCal_button' ), 10, 2 );
48
+		add_filter('FHEE__espresso_list_of_event_dates__datetime_html', array('EED_Ical', 'generate_add_to_iCal_button'), 10, 2);
49 49
 		 // process ics download request
50
-		EE_Config::register_route( 'download_ics_file', 'EED_Ical', 'download_ics_file' );
50
+		EE_Config::register_route('download_ics_file', 'EED_Ical', 'download_ics_file');
51 51
 	}
52 52
 
53 53
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 * @param    WP $WP
71 71
 	 * @return    void
72 72
 	 */
73
-	public function run( $WP ) {}
73
+	public function run($WP) {}
74 74
 
75 75
 
76 76
 
@@ -82,30 +82,30 @@  discard block
 block discarded – undo
82 82
 	 * @param $datetime
83 83
 	 * @return    string
84 84
 	 */
85
-	public static function generate_add_to_iCal_button( $html, $datetime ) {
85
+	public static function generate_add_to_iCal_button($html, $datetime) {
86 86
 		// first verify a proper datetime object has been received
87
-		if ( $datetime instanceof EE_Datetime ) {
87
+		if ($datetime instanceof EE_Datetime) {
88 88
 			// set whether a link or submit button is shown
89
-			$iCal_type = apply_filters( 'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit' );
89
+			$iCal_type = apply_filters('FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type', 'submit');
90 90
 			// generate a link to the route we registered in set_hooks()
91
-			$URL = add_query_arg( array( 'ee' => 'download_ics_file', 'ics_id' => $datetime->ID() ), site_url() );
91
+			$URL = add_query_arg(array('ee' => 'download_ics_file', 'ics_id' => $datetime->ID()), site_url());
92 92
 			// what type ?
93
-			switch ( $iCal_type ) {
93
+			switch ($iCal_type) {
94 94
 				// submit buttons appear as buttons and are very compatible with a theme's style
95 95
 				case 'submit' :
96
-					$html .= '<form id="download-iCal-frm-' . $datetime->ID() . '" class="download-iCal-frm" action="' . $URL . '" method="post" >';
97
-					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '"/>';
96
+					$html .= '<form id="download-iCal-frm-'.$datetime->ID().'" class="download-iCal-frm" action="'.$URL.'" method="post" >';
97
+					$html .= '<input type="submit" class="ee-ical-sbmt" value="&#xf145;" title="'.__('Add to iCal Calendar', 'event_espresso').'"/>';
98 98
 					$html .= '</form>';
99 99
 					break;
100 100
 				// buttons are just links that have been styled to appear as buttons, but may not be blend with a theme as well as submit buttons
101 101
 				case 'button' :
102
-					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
102
+					$html .= '<a class="ee-ical-btn small ee-button ee-roundish" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
103 103
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
104 104
 					$html .= '</a>';
105 105
 					break;
106 106
 				// links are just links that use the calendar dashicon
107 107
 				case 'icon' :
108
-					$html .= '<a class="ee-ical-lnk" href="' . $URL . '" title="' . __( 'Add to iCal Calendar', 'event_espresso' ) . '">';
108
+					$html .= '<a class="ee-ical-lnk" href="'.$URL.'" title="'.__('Add to iCal Calendar', 'event_espresso').'">';
109 109
 					$html .= ' <span class="dashicons dashicons-calendar"></span>';
110 110
 					$html .= '</a>';
111 111
 					break;
@@ -123,72 +123,72 @@  discard block
 block discarded – undo
123 123
 	 *  @return 	void
124 124
 	 */
125 125
 	public static function download_ics_file() {
126
-		if ( EE_Registry::instance()->REQ->is_set( 'ics_id' )) {
127
-			$DTT_ID = absint( EE_Registry::instance()->REQ->get( 'ics_id' ));
128
-			$datetime = EE_Registry::instance()->load_model( 'Datetime' )->get_one_by_ID( $DTT_ID );
129
-			if ( $datetime instanceof EE_Datetime ) {
126
+		if (EE_Registry::instance()->REQ->is_set('ics_id')) {
127
+			$DTT_ID = absint(EE_Registry::instance()->REQ->get('ics_id'));
128
+			$datetime = EE_Registry::instance()->load_model('Datetime')->get_one_by_ID($DTT_ID);
129
+			if ($datetime instanceof EE_Datetime) {
130 130
 				// get related event, venues, and event categories
131 131
 				$event = $datetime->event();
132 132
 				// get related category Term object and it's name
133 133
 				$category = $event->first_event_category();
134
-				if ( $category instanceof EE_Term ) {
134
+				if ($category instanceof EE_Term) {
135 135
 					$category = $category->name();
136 136
 				}
137 137
 				$location = '';
138 138
 				// get first related venue and convert to CSV string
139
-				$venue = $event->venues(array( 'limit'=>1 ));
140
-				if ( is_array( $venue ) && ! empty( $venue )) {
141
-					$venue = array_shift( $venue );
142
-					if ( $venue instanceof EE_Venue ) {
143
-						$location = espresso_venue_raw_address( 'inline', $venue->ID(), FALSE );
139
+				$venue = $event->venues(array('limit'=>1));
140
+				if (is_array($venue) && ! empty($venue)) {
141
+					$venue = array_shift($venue);
142
+					if ($venue instanceof EE_Venue) {
143
+						$location = espresso_venue_raw_address('inline', $venue->ID(), FALSE);
144 144
 					}
145 145
 				}
146 146
 				// set variables, escape strings, convert timestamps to ics format, etc
147
-				$filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics';
148
-				$organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name );
149
-				$UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() ));
150
-				$org_email = EED_Ical::_escape_ICal_data( $datetime->ID() );
151
-				$timestamp = date( EED_Ical::iCal_datetime_format );
152
-				$location = EED_Ical::_escape_ICal_data( $location );
153
-				$summary = EED_Ical::_escape_ICal_data( $event->name() );
154
-				$description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() ));
147
+				$filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics';
148
+				$organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name);
149
+				$UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID()));
150
+				$org_email = EED_Ical::_escape_ICal_data($datetime->ID());
151
+				$timestamp = date(EED_Ical::iCal_datetime_format);
152
+				$location = EED_Ical::_escape_ICal_data($location);
153
+				$summary = EED_Ical::_escape_ICal_data($event->name());
154
+				$description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description()));
155 155
 				$status = $datetime->get_active_status();
156 156
 				$status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed';
157
-				$status = EED_Ical::_escape_ICal_data( $status );
158
-				$categories = EED_Ical::_escape_ICal_data( $category );
159
-				$url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() ));
160
-				$dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() ));
161
-				$dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() ));
157
+				$status = EED_Ical::_escape_ICal_data($status);
158
+				$categories = EED_Ical::_escape_ICal_data($category);
159
+				$url = EED_Ical::_escape_ICal_data(get_permalink($event->ID()));
160
+				$dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start()));
161
+				$dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end()));
162 162
 				// set headers
163
-				header( 'Content-type: text/calendar; charset=utf-8' );
164
-				header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
165
-				header( 'Cache-Control: private, max-age=0, must-revalidate' );
166
-				header( 'Pragma: public' );
167
-				header( 'Content-Type: application/octet-stream' );
168
-				header( 'Content-Type: application/force-download' );
169
-				header( 'Cache-Control: no-cache, must-revalidate' );
170
-				header( 'Content-Transfer-Encoding: binary' );
171
-				header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date
172
-				ini_set( 'zlib.output_compression', '0' );
163
+				header('Content-type: text/calendar; charset=utf-8');
164
+				header('Content-Disposition: attachment; filename="'.$filename.'"');
165
+				header('Cache-Control: private, max-age=0, must-revalidate');
166
+				header('Pragma: public');
167
+				header('Content-Type: application/octet-stream');
168
+				header('Content-Type: application/force-download');
169
+				header('Cache-Control: no-cache, must-revalidate');
170
+				header('Content-Transfer-Encoding: binary');
171
+				header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
172
+				ini_set('zlib.output_compression', '0');
173 173
 				// echo the output
174
-				echo "BEGIN:VCALENDAR" . PHP_EOL;
175
-				echo "VERSION:2.0" . PHP_EOL;
176
-				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL;
177
-				echo "CALSCALE:GREGORIAN" . PHP_EOL;
178
-				echo "BEGIN:VEVENT" . PHP_EOL;
179
-				echo "UID:{$UID}" . PHP_EOL;
180
-				echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL;
181
-				echo "DTSTAMP:{$timestamp}" . PHP_EOL;
182
-				echo "LOCATION:{$location}" . PHP_EOL;
183
-				echo "SUMMARY:{$summary}" . PHP_EOL;
184
-				echo "DESCRIPTION:{$description}" . PHP_EOL;
185
-				echo "STATUS:{$status}" . PHP_EOL;
186
-				echo "CATEGORIES:{$categories}" . PHP_EOL;
187
-				echo "URL;VALUE=URI:{$url}" . PHP_EOL;
188
-				echo "DTSTART:{$dtt_start}" . PHP_EOL;
189
-				echo "DTEND:{$dtt_end}" . PHP_EOL;
190
-				echo "END:VEVENT" . PHP_EOL;
191
-				echo "END:VCALENDAR" . PHP_EOL;
174
+				echo "BEGIN:VCALENDAR".PHP_EOL;
175
+				echo "VERSION:2.0".PHP_EOL;
176
+				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL;
177
+				echo "CALSCALE:GREGORIAN".PHP_EOL;
178
+				echo "BEGIN:VEVENT".PHP_EOL;
179
+				echo "UID:{$UID}".PHP_EOL;
180
+				echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL;
181
+				echo "DTSTAMP:{$timestamp}".PHP_EOL;
182
+				echo "LOCATION:{$location}".PHP_EOL;
183
+				echo "SUMMARY:{$summary}".PHP_EOL;
184
+				echo "DESCRIPTION:{$description}".PHP_EOL;
185
+				echo "STATUS:{$status}".PHP_EOL;
186
+				echo "CATEGORIES:{$categories}".PHP_EOL;
187
+				echo "URL;VALUE=URI:{$url}".PHP_EOL;
188
+				echo "DTSTART:{$dtt_start}".PHP_EOL;
189
+				echo "DTEND:{$dtt_end}".PHP_EOL;
190
+				echo "END:VEVENT".PHP_EOL;
191
+				echo "END:VCALENDAR".PHP_EOL;
192 192
 			}
193 193
 		}
194 194
 		die();
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
 	 *  	@param	string $string
204 204
 	 *  	@return	string
205 205
 	 */
206
-	private static function _escape_ICal_data( $string = '' ) {
207
-		return preg_replace( '/([\,;])/', '\\\$1', $string );
206
+	private static function _escape_ICal_data($string = '') {
207
+		return preg_replace('/([\,;])/', '\\\$1', $string);
208 208
 	}
209 209
 
210 210
 	/**
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
 	 *  	@param	string $description
215 215
 	 *  	@return	string
216 216
 	 */
217
-	private static function _escape_ICal_description( $description = '' ) {
217
+	private static function _escape_ICal_description($description = '') {
218 218
 			
219 219
 			//Escape spcial chars within the decription
220
-			$description = EED_Ical::_escape_ICal_data( $description );
220
+			$description = EED_Ical::_escape_ICal_data($description);
221 221
 
222 222
 		    //Remove line breaks and output in iCal format
223
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
223
+		    $description = str_replace(array("\r\n", "\n"), '\n', $description);
224 224
 
225 225
 		return $description;
226 226
 	}
Please login to merge, or discard this patch.
attendee_information/EE_SPCO_Reg_Step_Attendee_Information.class.php 4 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -808,7 +808,7 @@
 block discarded – undo
808 808
 
809 809
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
810 810
 
811
-			}  else {
811
+			} else {
812 812
 				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
813 813
 				// remove malformed data
814 814
 				unset( $valid_data[ $reg_url_link ] );
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 * _auto_copy_attendee_info
349 349
 	 *
350 350
 	 * @access public
351
-	 * @return 	EE_Form_Section_Proper
351
+	 * @return 	EE_Form_Section_HTML
352 352
 	 */
353 353
 	private function _auto_copy_attendee_info() {
354 354
 		return new EE_Form_Section_HTML(
@@ -462,6 +462,7 @@  discard block
 block discarded – undo
462 462
 	 * @param EE_Registration $registration
463 463
 	 * @param EE_Question     $question
464 464
 	 * @param mixed EE_Answer|NULL      $answer
465
+	 * @param EE_Answer $answer
465 466
 	 * @return EE_Form_Input_Base
466 467
 	 */
467 468
 	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); }
2 2
  /**
3
- *
4
- * Class EE_SPCO_Reg_Step_Attendee_Information
5
- *
6
- * Description
7
- *
8
- * @package 			Event Espresso
9
- * @subpackage 	core
10
- * @author 				Brent Christensen
11
- * @since 				4.5.0
12
- *
13
- */
3
+  *
4
+  * Class EE_SPCO_Reg_Step_Attendee_Information
5
+  *
6
+  * Description
7
+  *
8
+  * @package 			Event Espresso
9
+  * @subpackage 	core
10
+  * @author 				Brent Christensen
11
+  * @since 				4.5.0
12
+  *
13
+  */
14 14
 class EE_SPCO_Reg_Step_Attendee_Information extends EE_SPCO_Reg_Step {
15 15
 
16 16
 	/**
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 				// generate hidden input
172 172
 				if (
173 173
 					isset( $subsections[ $primary_registrant ] )
174
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
174
+					 && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
175 175
 				) {
176 176
 					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
177 177
 				}
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 					if ( isset( $valid_data[ $reg_url_link ] ) ) {
903 903
 						// do we need to copy basic info from primary attendee ?
904 904
 						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
905
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
905
+										&& absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
906 906
 							? true
907 907
 							: false;
908 908
 						// filter form input data for this registration
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
1079 1079
 			? $form_input
1080 1080
 			: $form_input . '-' . $registration->reg_url_link();
1081 1081
 		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1082
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1082
+						 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1083 1083
 			? true
1084 1084
 			: false;
1085 1085
 		//rename form_inputs if they are EE_Attendee properties
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 		}
1320 1320
 		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1321 1321
 			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1322
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1322
+				 || empty( $attendee_data[ $critical_attendee_detail ] )
1323 1323
 			) {
1324 1324
 				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1325 1325
 					$critical_attendee_detail
Please login to merge, or discard this patch.
Spacing   +233 added lines, -234 removed lines patch added patch discarded remove patch
@@ -42,21 +42,21 @@  discard block
 block discarded – undo
42 42
 	 * @param    EE_Checkout $checkout
43 43
 	 * @return    \EE_SPCO_Reg_Step_Attendee_Information
44 44
 	 */
45
-	public function __construct( EE_Checkout $checkout ) {
45
+	public function __construct(EE_Checkout $checkout) {
46 46
 		$this->_slug = 'attendee_information';
47 47
 		$this->_name = __('Attendee Information', 'event_espresso');
48
-		$this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_main.template.php';
48
+		$this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_main.template.php';
49 49
 		$this->checkout = $checkout;
50 50
 		$this->_reset_success_message();
51 51
 		$this->set_instructions(
52
-			__( 'Please answer the following registration questions before proceeding.', 'event_espresso' )
52
+			__('Please answer the following registration questions before proceeding.', 'event_espresso')
53 53
 		);
54 54
 	}
55 55
 
56 56
 
57 57
 
58 58
 	public function translate_js_strings() {
59
-		EE_Registry::$i18n_js_strings['required_field'] = __( ' is a required question.', 'event_espresso' );
59
+		EE_Registry::$i18n_js_strings['required_field'] = __(' is a required question.', 'event_espresso');
60 60
 		EE_Registry::$i18n_js_strings['required_multi_field'] = __(
61 61
 			' is a required question. Please enter a value for at least one of the options.',
62 62
 			'event_espresso'
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		// calculate taxes
117 117
 		$Line_Item_Display->display_line_item(
118 118
 			$this->checkout->cart->get_grand_total(),
119
-			array( 'set_tax_rate' => true )
119
+			array('set_tax_rate' => true)
120 120
 		);
121 121
 		/** @var $subsections EE_Form_Section_Proper[] */
122 122
 		$subsections = array(
@@ -128,51 +128,51 @@  discard block
 block discarded – undo
128 128
 			'ticket_count' 	=> array()
129 129
 		);
130 130
 		// grab the saved registrations from the transaction
131
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
132
-		if ( $registrations ) {
133
-			foreach ( $registrations as $registration ) {
131
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
132
+		if ($registrations) {
133
+			foreach ($registrations as $registration) {
134 134
 				// can this registration be processed during this visit ?
135 135
 				if (
136 136
 					$registration instanceof EE_Registration
137
-					&& $this->checkout->visit_allows_processing_of_this_registration( $registration )
137
+					&& $this->checkout->visit_allows_processing_of_this_registration($registration)
138 138
 				) {
139
-					$subsections[ $registration->reg_url_link() ] = $this->_registrations_reg_form( $registration );
140
-					if ( ! $this->checkout->admin_request ) {
141
-						$template_args['registrations'][ $registration->reg_url_link() ] = $registration;
142
-						$template_args['ticket_count'][ $registration->ticket()->ID() ] = isset(
143
-							$template_args['ticket_count'][ $registration->ticket()->ID() ]
139
+					$subsections[$registration->reg_url_link()] = $this->_registrations_reg_form($registration);
140
+					if ( ! $this->checkout->admin_request) {
141
+						$template_args['registrations'][$registration->reg_url_link()] = $registration;
142
+						$template_args['ticket_count'][$registration->ticket()->ID()] = isset(
143
+							$template_args['ticket_count'][$registration->ticket()->ID()]
144 144
 						)
145
-							? $template_args['ticket_count'][ $registration->ticket()->ID() ] + 1
145
+							? $template_args['ticket_count'][$registration->ticket()->ID()] + 1
146 146
 							: 1;
147 147
 						$ticket_line_item = EEH_Line_Item::get_line_items_by_object_type_and_IDs(
148 148
 							$this->checkout->cart->get_grand_total(),
149 149
 							'Ticket',
150
-							array( $registration->ticket()->ID() )
150
+							array($registration->ticket()->ID())
151 151
 						);
152
-						$ticket_line_item = is_array( $ticket_line_item )
153
-							? reset( $ticket_line_item )
152
+						$ticket_line_item = is_array($ticket_line_item)
153
+							? reset($ticket_line_item)
154 154
 							: $ticket_line_item;
155
-						$template_args['ticket_line_item'][ $registration->ticket()->ID() ] = $Line_Item_Display->display_line_item(
155
+						$template_args['ticket_line_item'][$registration->ticket()->ID()] = $Line_Item_Display->display_line_item(
156 156
 							$ticket_line_item
157 157
 						);
158 158
 					}
159
-					if ( $registration->is_primary_registrant() ) {
159
+					if ($registration->is_primary_registrant()) {
160 160
 						$primary_registrant = $registration->reg_url_link();
161 161
 					}
162 162
 				}
163 163
 			}
164 164
 			// print_copy_info ?
165
-			if ( $primary_registrant && ! $this->checkout->admin_request && count( $registrations ) > 1 ) {
165
+			if ($primary_registrant && ! $this->checkout->admin_request && count($registrations) > 1) {
166 166
 				// TODO: add admin option for toggling copy attendee info, then use that value to change $this->_print_copy_info
167 167
 				$copy_options['spco_copy_attendee_chk'] = $this->_print_copy_info
168 168
 					? $this->_copy_attendee_info_form()
169 169
 					: $this->_auto_copy_attendee_info();
170 170
 				// generate hidden input
171 171
 				if (
172
-					isset( $subsections[ $primary_registrant ] )
173
-				     && $subsections[ $primary_registrant ] instanceof EE_Form_Section_Proper
172
+					isset($subsections[$primary_registrant])
173
+				     && $subsections[$primary_registrant] instanceof EE_Form_Section_Proper
174 174
 				) {
175
-					$subsections[ $primary_registrant ]->add_subsections( $copy_options, 'primary_registrant', false );
175
+					$subsections[$primary_registrant]->add_subsections($copy_options, 'primary_registrant', false);
176 176
 				}
177 177
 			}
178 178
 
@@ -184,8 +184,7 @@  discard block
 block discarded – undo
184 184
 				'html_id' 					=> $this->reg_form_name(),
185 185
 				'subsections' 			=> $subsections,
186 186
 				'layout_strategy'		=> $this->checkout->admin_request ?
187
-					new EE_Div_Per_Section_Layout() :
188
-					new EE_Template_Layout(
187
+					new EE_Div_Per_Section_Layout() : new EE_Template_Layout(
189 188
 						array(
190 189
 							'layout_template_file' 	=> $this->_template, // layout_template
191 190
 							'template_args' 				=> $template_args
@@ -203,11 +202,11 @@  discard block
 block discarded – undo
203 202
 	 * @return EE_Form_Section_Proper
204 203
 	 * @throws \EE_Error
205 204
 	 */
206
-	private function _registrations_reg_form( EE_Registration $registration ) {
205
+	private function _registrations_reg_form(EE_Registration $registration) {
207 206
 		static $attendee_nmbr = 1;
208 207
 		// array of params to pass to parent constructor
209 208
 		$form_args = array(
210
-			'html_id'         => 'ee-registration-' . $registration->reg_url_link(),
209
+			'html_id'         => 'ee-registration-'.$registration->reg_url_link(),
211 210
 			'html_class'      => 'ee-reg-form-attendee-dv',
212 211
 			'html_style'      => $this->checkout->admin_request
213 212
 				? 'padding:0em 2em 1em; margin:3em 0 0; border:1px solid #ddd;'
@@ -216,24 +215,24 @@  discard block
 block discarded – undo
216 215
 			'layout_strategy' => new EE_Fieldset_Section_Layout(
217 216
 				array(
218 217
 					'legend_class' => 'spco-attendee-lgnd smaller-text lt-grey-text',
219
-					'legend_text'  => sprintf( __( 'Attendee %d', 'event_espresso' ), $attendee_nmbr )
218
+					'legend_text'  => sprintf(__('Attendee %d', 'event_espresso'), $attendee_nmbr)
220 219
 				)
221 220
 			)
222 221
 		);
223 222
 		// verify that registration has valid event
224
-		if ( $registration->event() instanceof EE_Event ) {
223
+		if ($registration->event() instanceof EE_Event) {
225 224
 			$query_params = array(
226 225
 				array(
227 226
 					'Event.EVT_ID' => $registration->event()->ID(),
228 227
 					'Event_Question_Group.EQG_primary' => $registration->count() === 1 ? true : false
229 228
 				),
230
-				'order_by'=>array( 'QSG_order'=>'ASC' )
229
+				'order_by'=>array('QSG_order'=>'ASC')
231 230
 			);
232
-			$question_groups = $registration->event()->question_groups( $query_params );
233
-			if ( $question_groups ) {
234
-				foreach ( $question_groups as $question_group ) {
235
-					if ( $question_group instanceof EE_Question_Group ) {
236
-						$form_args['subsections'][ $question_group->identifier() ] = $this->_question_group_reg_form(
231
+			$question_groups = $registration->event()->question_groups($query_params);
232
+			if ($question_groups) {
233
+				foreach ($question_groups as $question_group) {
234
+					if ($question_group instanceof EE_Question_Group) {
235
+						$form_args['subsections'][$question_group->identifier()] = $this->_question_group_reg_form(
237 236
 							$registration,
238 237
 							$question_group
239 238
 						);
@@ -246,10 +245,10 @@  discard block
 block discarded – undo
246 245
 				// if we have question groups for additional attendees, then display the copy options
247 246
 				$this->_print_copy_info = $attendee_nmbr > 1 ? true : $this->_print_copy_info;
248 247
 			} else {
249
-				$form_args['subsections'][ 'attendee_info_not_required_' . $registration->reg_url_link(
250
-				) ] = new EE_Form_Section_HTML(
248
+				$form_args['subsections']['attendee_info_not_required_'.$registration->reg_url_link(
249
+				)] = new EE_Form_Section_HTML(
251 250
 					EEH_Template::locate_template(
252
-						SPCO_REG_STEPS_PATH . $this->_slug . DS . 'attendee_info_not_required.template.php',
251
+						SPCO_REG_STEPS_PATH.$this->_slug.DS.'attendee_info_not_required.template.php',
253 252
 						apply_filters(
254 253
 							'FHEE__EE_SPCO_Reg_Step_Attendee_Information___registrations_reg_form__attendee_info_not_required_template_args',
255 254
 							array()
@@ -265,12 +264,12 @@  discard block
 block discarded – undo
265 264
 				);
266 265
 			}
267 266
 		}
268
-		if ( $registration->is_primary_registrant() ) {
267
+		if ($registration->is_primary_registrant()) {
269 268
 			// generate hidden input
270
-			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs( $registration );
269
+			$form_args['subsections']['primary_registrant'] = $this->_additional_primary_registrant_inputs($registration);
271 270
 		}
272 271
 		$attendee_nmbr++;
273
-		return new EE_Form_Section_Proper( $form_args );
272
+		return new EE_Form_Section_Proper($form_args);
274 273
 	}
275 274
 
276 275
 
@@ -291,7 +290,7 @@  discard block
 block discarded – undo
291 290
 		// generate hidden input
292 291
 		return new EE_Hidden_Input(
293 292
 			array(
294
-				'html_id' => 'additional-attendee-reg-info-' . $registration->reg_url_link(),
293
+				'html_id' => 'additional-attendee-reg-info-'.$registration->reg_url_link(),
295 294
 				'default' => $additional_attendee_reg_info
296 295
 			)
297 296
 		);
@@ -305,26 +304,26 @@  discard block
 block discarded – undo
305 304
 	 * @return EE_Form_Section_Proper
306 305
 	 * @throws \EE_Error
307 306
 	 */
308
-	private function _question_group_reg_form( EE_Registration $registration, EE_Question_Group $question_group ){
307
+	private function _question_group_reg_form(EE_Registration $registration, EE_Question_Group $question_group) {
309 308
 		// array of params to pass to parent constructor
310 309
 		$form_args = array(
311
-			'html_id'         => 'ee-reg-form-qstn-grp-' . $question_group->identifier(),
310
+			'html_id'         => 'ee-reg-form-qstn-grp-'.$question_group->identifier(),
312 311
 			'html_class'      => $this->checkout->admin_request
313 312
 				? 'form-table ee-reg-form-qstn-grp-dv'
314 313
 				: 'ee-reg-form-qstn-grp-dv',
315
-			'html_label_id'   => 'ee-reg-form-qstn-grp-' . $question_group->identifier() . '-lbl',
314
+			'html_label_id'   => 'ee-reg-form-qstn-grp-'.$question_group->identifier().'-lbl',
316 315
 			'subsections'     => array(
317
-				'reg_form_qstn_grp_hdr' => $this->_question_group_header( $question_group )
316
+				'reg_form_qstn_grp_hdr' => $this->_question_group_header($question_group)
318 317
 			),
319 318
 			'layout_strategy' => $this->checkout->admin_request
320 319
 				? new EE_Admin_Two_Column_Layout()
321 320
 				: new EE_Div_Per_Section_Layout()
322 321
 		);
323 322
 		// where params
324
-		$query_params = array( 'QST_deleted' => 0 );
323
+		$query_params = array('QST_deleted' => 0);
325 324
 		// don't load admin only questions on the frontend
326
-		if ( ! $this->checkout->admin_request ) {
327
-			$query_params['QST_admin_only'] = array( '!=', true );
325
+		if ( ! $this->checkout->admin_request) {
326
+			$query_params['QST_admin_only'] = array('!=', true);
328 327
 		}
329 328
 		$questions = $question_group->get_many_related(
330 329
 			'Question',
@@ -346,10 +345,10 @@  discard block
 block discarded – undo
346 345
 			)
347 346
 		);
348 347
 		// loop thru questions
349
-		foreach ( $questions as $question ) {
350
-			if( $question instanceof EE_Question ){
348
+		foreach ($questions as $question) {
349
+			if ($question instanceof EE_Question) {
351 350
 				$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
352
-				$form_args['subsections'][ $identifier ] = $this->reg_form_question( $registration, $question );
351
+				$form_args['subsections'][$identifier] = $this->reg_form_question($registration, $question);
353 352
 			}
354 353
 		}
355 354
 		$form_args['subsections'] = apply_filters(
@@ -370,7 +369,7 @@  discard block
 block discarded – undo
370 369
 			)
371 370
 		);
372 371
 //		d( $form_args );
373
-		$question_group_reg_form = new EE_Form_Section_Proper( $form_args );
372
+		$question_group_reg_form = new EE_Form_Section_Proper($form_args);
374 373
 		return apply_filters(
375 374
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___question_group_reg_form__question_group_reg_form',
376 375
 			$question_group_reg_form,
@@ -387,11 +386,11 @@  discard block
 block discarded – undo
387 386
 	 * @param EE_Question_Group $question_group
388 387
 	 * @return 	EE_Form_Section_HTML
389 388
 	 */
390
-	private function _question_group_header( EE_Question_Group $question_group ){
389
+	private function _question_group_header(EE_Question_Group $question_group) {
391 390
 		$html = '';
392 391
 		// group_name
393
-		if ( $question_group->show_group_name() && $question_group->name() !== '' ) {
394
-			if ( $this->checkout->admin_request ) {
392
+		if ($question_group->show_group_name() && $question_group->name() !== '') {
393
+			if ($this->checkout->admin_request) {
395 394
 				$html .= EEH_HTML::br();
396 395
 				$html .= EEH_HTML::h3(
397 396
 					$question_group->name(),
@@ -405,7 +404,7 @@  discard block
 block discarded – undo
405 404
 			}
406 405
 		}
407 406
 		// group_desc
408
-		if ( $question_group->show_group_desc() && $question_group->desc() !== '' ) {
407
+		if ($question_group->show_group_desc() && $question_group->desc() !== '') {
409 408
 			$html .= EEH_HTML::p(
410 409
 				$question_group->desc(),
411 410
 				'',
@@ -415,7 +414,7 @@  discard block
 block discarded – undo
415 414
 			);
416 415
 
417 416
 		}
418
-		return new EE_Form_Section_HTML( $html );
417
+		return new EE_Form_Section_HTML($html);
419 418
 	}
420 419
 
421 420
 
@@ -425,7 +424,7 @@  discard block
 block discarded – undo
425 424
 	 * @return    EE_Form_Section_Proper
426 425
 	 * @throws \EE_Error
427 426
 	 */
428
-	private function _copy_attendee_info_form(){
427
+	private function _copy_attendee_info_form() {
429 428
 		// array of params to pass to parent constructor
430 429
 		return new EE_Form_Section_Proper(
431 430
 			array(
@@ -454,7 +453,7 @@  discard block
 block discarded – undo
454 453
 	private function _auto_copy_attendee_info() {
455 454
 		return new EE_Form_Section_HTML(
456 455
 			EEH_Template::locate_template(
457
-				SPCO_REG_STEPS_PATH . $this->_slug . DS . '_auto_copy_attendee_info.template.php',
456
+				SPCO_REG_STEPS_PATH.$this->_slug.DS.'_auto_copy_attendee_info.template.php',
458 457
 				apply_filters(
459 458
 					'FHEE__EE_SPCO_Reg_Step_Attendee_Information__auto_copy_attendee_info__template_args',
460 459
 					array()
@@ -478,32 +477,32 @@  discard block
 block discarded – undo
478 477
 		$copy_attendee_info_inputs = array();
479 478
 		$prev_ticket = NULL;
480 479
 		// grab the saved registrations from the transaction
481
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
482
-		foreach ( $registrations as $registration ) {
480
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
481
+		foreach ($registrations as $registration) {
483 482
 			// for all  attendees other than the primary attendee
484
-			if ( $registration instanceof EE_Registration && ! $registration->is_primary_registrant() ) {
483
+			if ($registration instanceof EE_Registration && ! $registration->is_primary_registrant()) {
485 484
 				// if this is a new ticket OR if this is the very first additional attendee after the primary attendee
486
-				if ( $registration->ticket()->ID() !== $prev_ticket ) {
485
+				if ($registration->ticket()->ID() !== $prev_ticket) {
487 486
 					$item_name = $registration->ticket()->name();
488 487
 					$item_name .= $registration->ticket()->description() !== ''
489
-						? ' - ' . $registration->ticket()->description()
488
+						? ' - '.$registration->ticket()->description()
490 489
 						: '';
491
-					$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[ticket-' . $registration->ticket()->ID() . ']' ] = new EE_Form_Section_HTML(
492
-						'<h6 class="spco-copy-attendee-event-hdr">' . $item_name . '</h6>'
490
+					$copy_attendee_info_inputs['spco_copy_attendee_chk[ticket-'.$registration->ticket()->ID().']'] = new EE_Form_Section_HTML(
491
+						'<h6 class="spco-copy-attendee-event-hdr">'.$item_name.'</h6>'
493 492
 					);
494 493
 					$prev_ticket = $registration->ticket()->ID();
495 494
 				}
496 495
 
497
-				$copy_attendee_info_inputs[ 'spco_copy_attendee_chk[' . $registration->ID() . ']' ] = new
496
+				$copy_attendee_info_inputs['spco_copy_attendee_chk['.$registration->ID().']'] = new
498 497
 				EE_Checkbox_Multi_Input(
499 498
 					array(
500 499
 						$registration->ID() => sprintf(
501
-							__( 'Attendee #%s', 'event_espresso' ),
500
+							__('Attendee #%s', 'event_espresso'),
502 501
 							$registration->count()
503 502
 						)
504 503
 					),
505 504
 					array(
506
-						'html_id'                 => 'spco-copy-attendee-chk-' . $registration->reg_url_link(),
505
+						'html_id'                 => 'spco-copy-attendee-chk-'.$registration->reg_url_link(),
507 506
 						'html_class'              => 'spco-copy-attendee-chk ee-do-not-validate',
508 507
 						'display_html_label_text' => false
509 508
 					)
@@ -523,7 +522,7 @@  discard block
 block discarded – undo
523 522
 	 * @return    EE_Form_Input_Base
524 523
 	 * @throws \EE_Error
525 524
 	 */
526
-	private function _additional_primary_registrant_inputs( EE_Registration $registration ){
525
+	private function _additional_primary_registrant_inputs(EE_Registration $registration) {
527 526
 		// generate hidden input
528 527
 		return new EE_Hidden_Input(
529 528
 			array(
@@ -542,7 +541,7 @@  discard block
 block discarded – undo
542 541
 	 * @return    EE_Form_Input_Base
543 542
 	 * @throws \EE_Error
544 543
 	 */
545
-	public function reg_form_question( EE_Registration $registration, EE_Question $question ){
544
+	public function reg_form_question(EE_Registration $registration, EE_Question $question) {
546 545
 
547 546
 		// if this question was for an attendee detail, then check for that answer
548 547
 		$answer_value = EEM_Answer::instance()->get_attendee_property_answer_value(
@@ -551,32 +550,32 @@  discard block
 block discarded – undo
551 550
 		);
552 551
 		$answer = $answer_value === null
553 552
 			? EEM_Answer::instance()->get_one(
554
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
553
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
555 554
 			)
556 555
 			: null;
557 556
 		// if NOT returning to edit an existing registration
558 557
 		// OR if this question is for an attendee property
559 558
 		// OR we still don't have an EE_Answer object
560
-		if( $answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link() ) {
559
+		if ($answer_value || ! $answer instanceof EE_Answer || ! $registration->reg_url_link()) {
561 560
 			// create an EE_Answer object for storing everything in
562
-			$answer = EE_Answer::new_instance ( array(
561
+			$answer = EE_Answer::new_instance(array(
563 562
 				'QST_ID'=> $question->ID(),
564 563
 				'REG_ID'=> $registration->ID()
565 564
 			));
566 565
 		}
567 566
 		// verify instance
568
-		if( $answer instanceof EE_Answer ){
569
-			if ( ! empty( $answer_value )) {
570
-				$answer->set( 'ANS_value', $answer_value );
567
+		if ($answer instanceof EE_Answer) {
568
+			if ( ! empty($answer_value)) {
569
+				$answer->set('ANS_value', $answer_value);
571 570
 			}
572
-			$answer->cache( 'Question', $question );
571
+			$answer->cache('Question', $question);
573 572
 			//remember system ID had a bug where sometimes it could be null
574
-			$answer_cache_id =$question->is_system_question()
575
-				? $question->system_ID() . '-' . $registration->reg_url_link()
576
-				: $question->ID() . '-' . $registration->reg_url_link();			
577
-			$registration->cache( 'Answer', $answer, $answer_cache_id );
573
+			$answer_cache_id = $question->is_system_question()
574
+				? $question->system_ID().'-'.$registration->reg_url_link()
575
+				: $question->ID().'-'.$registration->reg_url_link();			
576
+			$registration->cache('Answer', $answer, $answer_cache_id);
578 577
 		}
579
-		return $this->_generate_question_input( $registration, $question, $answer );
578
+		return $this->_generate_question_input($registration, $question, $answer);
580 579
 
581 580
 	}
582 581
 
@@ -589,46 +588,46 @@  discard block
 block discarded – undo
589 588
 	 * @return EE_Form_Input_Base
590 589
 	 * @throws \EE_Error
591 590
 	 */
592
-	private function _generate_question_input( EE_Registration $registration, EE_Question $question, $answer ){
591
+	private function _generate_question_input(EE_Registration $registration, EE_Question $question, $answer) {
593 592
 		$identifier = $question->is_system_question() ? $question->system_ID() : $question->ID();
594
-		$this->_required_questions[ $identifier ] = $question->required() ? true : false;
593
+		$this->_required_questions[$identifier] = $question->required() ? true : false;
595 594
 		add_filter(
596 595
 			'FHEE__EE_Question__generate_form_input__country_options',
597
-			array( $this, 'use_cached_countries_for_form_input' ),
596
+			array($this, 'use_cached_countries_for_form_input'),
598 597
 			10,
599 598
 			4
600 599
 		);
601 600
 		add_filter(
602 601
 			'FHEE__EE_Question__generate_form_input__state_options',
603
-			array( $this, 'use_cached_states_for_form_input' ),
602
+			array($this, 'use_cached_states_for_form_input'),
604 603
 			10,
605 604
 			4
606 605
 		);
607 606
 		$input_constructor_args = array(
608
-			'html_name'     => 'ee_reg_qstn[' . $registration->ID() . '][' . $identifier . ']',
609
-			'html_id'       => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
610
-			'html_class'    => 'ee-reg-qstn ee-reg-qstn-' . $identifier,
611
-			'html_label_id' => 'ee_reg_qstn-' . $registration->ID() . '-' . $identifier,
607
+			'html_name'     => 'ee_reg_qstn['.$registration->ID().']['.$identifier.']',
608
+			'html_id'       => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
609
+			'html_class'    => 'ee-reg-qstn ee-reg-qstn-'.$identifier,
610
+			'html_label_id' => 'ee_reg_qstn-'.$registration->ID().'-'.$identifier,
612 611
 			'html_label_class'	=> 'ee-reg-qstn',
613 612
 		);
614
-		$input_constructor_args['html_label_id'] 	.= '-lbl';
615
-		if ( $answer instanceof EE_Answer && $answer->ID() ) {
616
-			$input_constructor_args[ 'html_name' ] .= '[' . $answer->ID() . ']';
617
-			$input_constructor_args[ 'html_id' ] .= '-' . $answer->ID();
618
-			$input_constructor_args[ 'html_label_id' ] .= '-' . $answer->ID();
613
+		$input_constructor_args['html_label_id'] .= '-lbl';
614
+		if ($answer instanceof EE_Answer && $answer->ID()) {
615
+			$input_constructor_args['html_name'] .= '['.$answer->ID().']';
616
+			$input_constructor_args['html_id'] .= '-'.$answer->ID();
617
+			$input_constructor_args['html_label_id'] .= '-'.$answer->ID();
619 618
 		}
620
-		$form_input =  $question->generate_form_input(
619
+		$form_input = $question->generate_form_input(
621 620
 			$registration,
622 621
 			$answer,
623 622
 			$input_constructor_args
624 623
 		);
625 624
 		remove_filter(
626 625
 			'FHEE__EE_Question__generate_form_input__country_options',
627
-			array( $this, 'use_cached_countries_for_form_input' )
626
+			array($this, 'use_cached_countries_for_form_input')
628 627
 		);
629 628
 		remove_filter(
630 629
 			'FHEE__EE_Question__generate_form_input__state_options',
631
-			array( $this, 'use_cached_states_for_form_input' )
630
+			array($this, 'use_cached_states_for_form_input')
632 631
 		);
633 632
 		return $form_input;
634 633
 	}
@@ -642,23 +641,23 @@  discard block
 block discarded – undo
642 641
 	 * @return array 2d keys are country IDs, values are their names
643 642
 	 * @throws \EE_Error
644 643
 	 */
645
-	public function use_cached_countries_for_form_input( $countries_list, $question, $registration, $answer ) {
646
-		$country_options = array( '' => '' );
644
+	public function use_cached_countries_for_form_input($countries_list, $question, $registration, $answer) {
645
+		$country_options = array('' => '');
647 646
 		// get possibly cached list of countries
648 647
 		$countries = $this->checkout->action === 'process_reg_step'
649 648
 			? EEM_Country::instance()->get_all_countries()
650 649
 			: EEM_Country::instance()->get_all_active_countries();
651
-		if ( ! empty( $countries )) {
652
-			foreach( $countries as $country ){
653
-				if ( $country instanceof EE_Country ) {
654
-					$country_options[ $country->ID() ] = $country->name();
650
+		if ( ! empty($countries)) {
651
+			foreach ($countries as $country) {
652
+				if ($country instanceof EE_Country) {
653
+					$country_options[$country->ID()] = $country->name();
655 654
 				}
656 655
 			}
657 656
 		}
658
-		if( $question instanceof EE_Question
659
-			&& $registration instanceof EE_Registration ) {
657
+		if ($question instanceof EE_Question
658
+			&& $registration instanceof EE_Registration) {
660 659
 			$answer = EEM_Answer::instance()->get_one(
661
-				array( array( 'QST_ID' => $question->ID(), 'REG_ID' => $registration->ID() ) )
660
+				array(array('QST_ID' => $question->ID(), 'REG_ID' => $registration->ID()))
662 661
 			);
663 662
 		} else {
664 663
 			$answer = EE_Answer::new_instance();
@@ -685,15 +684,15 @@  discard block
 block discarded – undo
685 684
 	 * @return array 2d keys are state IDs, values are their names
686 685
 	 * @throws \EE_Error
687 686
 	 */
688
-	public function use_cached_states_for_form_input( $states_list, $question, $registration, $answer ) {
689
-		$state_options = array( '' => array( '' => ''));
687
+	public function use_cached_states_for_form_input($states_list, $question, $registration, $answer) {
688
+		$state_options = array('' => array('' => ''));
690 689
 		$states = $this->checkout->action === 'process_reg_step'
691 690
 			? EEM_State::instance()->get_all_states()
692 691
 			: EEM_State::instance()->get_all_active_states();
693
-		if ( ! empty( $states )) {
694
-			foreach( $states as $state ){
695
-				if ( $state instanceof EE_State ) {
696
-					$state_options[ $state->country()->name() ][ $state->ID() ] = $state->name();
692
+		if ( ! empty($states)) {
693
+			foreach ($states as $state) {
694
+				if ($state instanceof EE_State) {
695
+					$state_options[$state->country()->name()][$state->ID()] = $state->name();
697 696
 				}
698 697
 			}
699 698
 		}
@@ -721,24 +720,24 @@  discard block
 block discarded – undo
721 720
 	 * @throws \EE_Error
722 721
 	 */
723 722
 	public function process_reg_step() {
724
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
723
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
725 724
 		// grab validated data from form
726 725
 		$valid_data = $this->checkout->current_step->valid_data();
727 726
 		// EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
728 727
 		// EEH_Debug_Tools::printr( $valid_data, '$valid_data', __FILE__, __LINE__ );
729 728
 		// if we don't have any $valid_data then something went TERRIBLY WRONG !!!
730
-		if ( empty( $valid_data ))  {
729
+		if (empty($valid_data)) {
731 730
 			EE_Error::add_error(
732
-				__( 'No valid question responses were received.', 'event_espresso' ),
731
+				__('No valid question responses were received.', 'event_espresso'),
733 732
 				__FILE__,
734 733
 				__FUNCTION__,
735 734
 				__LINE__
736 735
 			);
737 736
 			return false;
738 737
 		}
739
-		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg ) {
738
+		if ( ! $this->checkout->transaction instanceof EE_Transaction || ! $this->checkout->continue_reg) {
740 739
 			EE_Error::add_error(
741
-				__( 'A valid transaction could not be initiated for processing your registrations.', 'event_espresso' ),
740
+				__('A valid transaction could not be initiated for processing your registrations.', 'event_espresso'),
742 741
 				__FILE__,
743 742
 				__FUNCTION__,
744 743
 				__LINE__
@@ -746,11 +745,11 @@  discard block
 block discarded – undo
746 745
 			return false;
747 746
 		}
748 747
 		// get cached registrations
749
-		$registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params );
748
+		$registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params);
750 749
 		// verify we got the goods
751
-		if ( empty( $registrations )) {
750
+		if (empty($registrations)) {
752 751
 			EE_Error::add_error(
753
-				__( 'Your form data could not be applied to any valid registrations.', 'event_espresso' ),
752
+				__('Your form data could not be applied to any valid registrations.', 'event_espresso'),
754 753
 				__FILE__,
755 754
 				__FUNCTION__,
756 755
 				__LINE__
@@ -758,15 +757,15 @@  discard block
 block discarded – undo
758 757
 			return false;
759 758
 		}
760 759
 		// extract attendee info from form data and save to model objects
761
-		$registrations_processed = $this->_process_registrations( $registrations, $valid_data );
760
+		$registrations_processed = $this->_process_registrations($registrations, $valid_data);
762 761
 		// if first pass thru SPCO,
763 762
 		// then let's check processed registrations against the total number of tickets in the cart
764
-		if ( $registrations_processed === false ) {
763
+		if ($registrations_processed === false) {
765 764
 			// but return immediately if the previous step exited early due to errors
766 765
 			return false;
767
-		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count ) {
766
+		} else if ( ! $this->checkout->revisit && $registrations_processed !== $this->checkout->total_ticket_count) {
768 767
 			// generate a correctly translated string for all possible singular/plural combinations
769
-			if ( $this->checkout->total_ticket_count === 1 && $registrations_processed !== 1 ) {
768
+			if ($this->checkout->total_ticket_count === 1 && $registrations_processed !== 1) {
770 769
 				$error_msg = sprintf(
771 770
 					__(
772 771
 						'There was %1$d ticket in the Event Queue, but %2$ds registrations were processed',
@@ -775,7 +774,7 @@  discard block
 block discarded – undo
775 774
 					$this->checkout->total_ticket_count,
776 775
 					$registrations_processed
777 776
 				);
778
-			} else if ( $this->checkout->total_ticket_count !== 1 && $registrations_processed === 1 ) {
777
+			} else if ($this->checkout->total_ticket_count !== 1 && $registrations_processed === 1) {
779 778
 				$error_msg = sprintf(
780 779
 					__(
781 780
 						'There was a total of %1$d tickets in the Event Queue, but only %2$ds registration was processed',
@@ -794,17 +793,17 @@  discard block
 block discarded – undo
794 793
 					$registrations_processed
795 794
 				);
796 795
 			}
797
-			EE_Error::add_error( $error_msg, __FILE__, __FUNCTION__, __LINE__ );
796
+			EE_Error::add_error($error_msg, __FILE__, __FUNCTION__, __LINE__);
798 797
 			return false;
799 798
 		}
800 799
 		// mark this reg step as completed
801 800
 		$this->set_completed();
802 801
 		$this->_set_success_message(
803
-			__( 'The Attendee Information Step has been successfully completed.', 'event_espresso' )
802
+			__('The Attendee Information Step has been successfully completed.', 'event_espresso')
804 803
 		);
805 804
 		//do action in case a plugin wants to do something with the data submitted in step 1.
806 805
 		//passes EE_Single_Page_Checkout, and it's posted data
807
-		do_action( 'AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data );
806
+		do_action('AHEE__EE_Single_Page_Checkout__process_attendee_information__end', $this, $valid_data);
808 807
 		return true;
809 808
 	}
810 809
 
@@ -818,9 +817,9 @@  discard block
 block discarded – undo
818 817
 	 * @return boolean | int
819 818
 	 * @throws \EE_Error
820 819
 	 */
821
-	private function _process_registrations( $registrations = array(), $valid_data = array() ) {
820
+	private function _process_registrations($registrations = array(), $valid_data = array()) {
822 821
 		// load resources and set some defaults
823
-		EE_Registry::instance()->load_model( 'Attendee' );
822
+		EE_Registry::instance()->load_model('Attendee');
824 823
 		// holder for primary registrant attendee object
825 824
 		$this->checkout->primary_attendee_obj = NULL;
826 825
 		// array for tracking reg form data for the primary registrant
@@ -837,9 +836,9 @@  discard block
 block discarded – undo
837 836
 		// attendee counter
838 837
 		$att_nmbr = 0;
839 838
 		// grab the saved registrations from the transaction
840
-		foreach ( $registrations  as $registration ) {
839
+		foreach ($registrations  as $registration) {
841 840
 			// verify EE_Registration object
842
-			if ( ! $registration instanceof EE_Registration ) {
841
+			if ( ! $registration instanceof EE_Registration) {
843 842
 				EE_Error::add_error(
844 843
 					__(
845 844
 						'An invalid Registration object was discovered when attempting to process your registration information.',
@@ -854,12 +853,12 @@  discard block
 block discarded – undo
854 853
 			/** @var string $reg_url_link */
855 854
 			$reg_url_link = $registration->reg_url_link();
856 855
 			// reg_url_link exists ?
857
-			if ( ! empty( $reg_url_link ) ) {
856
+			if ( ! empty($reg_url_link)) {
858 857
 				// should this registration be processed during this visit ?
859
-				if ( $this->checkout->visit_allows_processing_of_this_registration( $registration ) ) {
858
+				if ($this->checkout->visit_allows_processing_of_this_registration($registration)) {
860 859
 					// if NOT revisiting, then let's save the registration now,
861 860
 					// so that we have a REG_ID to use when generating other objects
862
-					if ( ! $this->checkout->revisit ) {
861
+					if ( ! $this->checkout->revisit) {
863 862
 						$registration->save();
864 863
 					}
865 864
 					/**
@@ -869,7 +868,7 @@  discard block
 block discarded – undo
869 868
 					 * @var bool   if true is returned by the plugin then the
870 869
 					 *      		registration processing is halted.
871 870
 					 */
872
-					if ( apply_filters(
871
+					if (apply_filters(
873 872
 						'FHEE__EE_SPCO_Reg_Step_Attendee_Information___process_registrations__pre_registration_process',
874 873
 						false,
875 874
 						$att_nmbr,
@@ -877,38 +876,38 @@  discard block
 block discarded – undo
877 876
 						$registrations,
878 877
 						$valid_data,
879 878
 						$this
880
-					) ) {
879
+					)) {
881 880
 						return false;
882 881
 					}
883 882
 
884 883
 					// Houston, we have a registration!
885 884
 					$att_nmbr++;
886
-					$this->_attendee_data[ $reg_url_link ] = array();
885
+					$this->_attendee_data[$reg_url_link] = array();
887 886
 					// grab any existing related answer objects
888 887
 					$this->_registration_answers = $registration->answers();
889 888
 					// unset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] );
890
-					if ( isset( $valid_data[ $reg_url_link ] ) ) {
889
+					if (isset($valid_data[$reg_url_link])) {
891 890
 						// do we need to copy basic info from primary attendee ?
892
-						$copy_primary = isset( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] )
893
-						                && absint( $valid_data[ $reg_url_link ]['additional_attendee_reg_info'] ) === 0
891
+						$copy_primary = isset($valid_data[$reg_url_link]['additional_attendee_reg_info'])
892
+						                && absint($valid_data[$reg_url_link]['additional_attendee_reg_info']) === 0
894 893
 							? true
895 894
 							: false;
896 895
 						// filter form input data for this registration
897
-						$valid_data[ $reg_url_link ] = (array)apply_filters(
896
+						$valid_data[$reg_url_link] = (array) apply_filters(
898 897
 							'FHEE__EE_Single_Page_Checkout__process_attendee_information__valid_data_line_item',
899
-							$valid_data[ $reg_url_link ]
898
+							$valid_data[$reg_url_link]
900 899
 						);
901 900
 						// EEH_Debug_Tools::printr( $valid_data[ $reg_url_link ], '$valid_data[ $reg_url_link ]', __FILE__, __LINE__ );
902
-						if ( isset( $valid_data['primary_attendee'] )) {
903
-							$primary_registrant['line_item_id'] =  ! empty( $valid_data['primary_attendee'] )
901
+						if (isset($valid_data['primary_attendee'])) {
902
+							$primary_registrant['line_item_id'] = ! empty($valid_data['primary_attendee'])
904 903
 								? $valid_data['primary_attendee']
905 904
 								: false;
906
-							unset( $valid_data['primary_attendee'] );
905
+							unset($valid_data['primary_attendee']);
907 906
 						}
908 907
 						// now loop through our array of valid post data && process attendee reg forms
909
-						foreach ( $valid_data[ $reg_url_link ] as $form_section => $form_inputs ) {
910
-							if ( ! in_array( $form_section, $non_input_form_sections )) {
911
-								foreach ( $form_inputs as $form_input => $input_value ) {
908
+						foreach ($valid_data[$reg_url_link] as $form_section => $form_inputs) {
909
+							if ( ! in_array($form_section, $non_input_form_sections)) {
910
+								foreach ($form_inputs as $form_input => $input_value) {
912 911
 									// \EEH_Debug_Tools::printr( $input_value, $form_input, __FILE__, __LINE__ );
913 912
 									// check for critical inputs
914 913
 									if (
@@ -922,16 +921,16 @@  discard block
 block discarded – undo
922 921
 									// store a bit of data about the primary attendee
923 922
 									if (
924 923
 										$att_nmbr === 1
925
-										&& ! empty( $input_value )
924
+										&& ! empty($input_value)
926 925
 										&& $reg_url_link === $primary_registrant['line_item_id']
927 926
 									) {
928
-										$primary_registrant[ $form_input ] = $input_value;
927
+										$primary_registrant[$form_input] = $input_value;
929 928
 									} else if (
930 929
 										$copy_primary
931 930
 										&& $input_value === null
932
-										&& isset( $primary_registrant[ $form_input ] )
931
+										&& isset($primary_registrant[$form_input])
933 932
 									) {
934
-										$input_value = $primary_registrant[ $form_input ];
933
+										$input_value = $primary_registrant[$form_input];
935 934
 									}
936 935
 									// now attempt to save the input data
937 936
 									if (
@@ -973,57 +972,57 @@  discard block
 block discarded – undo
973 972
 						// have we met before?
974 973
 						$attendee = $this->_find_existing_attendee(
975 974
 							$registration,
976
-							$this->_attendee_data[ $reg_url_link ]
975
+							$this->_attendee_data[$reg_url_link]
977 976
 						);
978 977
 						// did we find an already existing record for this attendee ?
979
-						if ( $attendee instanceof EE_Attendee ) {
978
+						if ($attendee instanceof EE_Attendee) {
980 979
 							$attendee = $this->_update_existing_attendee_data(
981 980
 								$attendee,
982
-								$this->_attendee_data[ $reg_url_link ]
981
+								$this->_attendee_data[$reg_url_link]
983 982
 							);
984 983
 						} else {
985 984
 							// ensure critical details are set for additional attendees
986
-							$this->_attendee_data[ $reg_url_link ] = $att_nmbr > 1
985
+							$this->_attendee_data[$reg_url_link] = $att_nmbr > 1
987 986
 								? $this->_copy_critical_attendee_details_from_primary_registrant(
988
-									$this->_attendee_data[ $reg_url_link ]
987
+									$this->_attendee_data[$reg_url_link]
989 988
 								)
990
-								: $this->_attendee_data[ $reg_url_link ];
989
+								: $this->_attendee_data[$reg_url_link];
991 990
 							$attendee = $this->_create_new_attendee(
992 991
 								$registration,
993
-								$this->_attendee_data[ $reg_url_link ]
992
+								$this->_attendee_data[$reg_url_link]
994 993
 							);
995 994
 						}
996 995
 						// who's #1 ?
997
-						if ( $att_nmbr === 1 ) {
996
+						if ($att_nmbr === 1) {
998 997
 							$this->checkout->primary_attendee_obj = $attendee;
999 998
 						}
1000 999
 					}
1001 1000
 					// EEH_Debug_Tools::printr( $attendee, '$attendee', __FILE__, __LINE__ );
1002 1001
 					// add relation to registration, set attendee ID, and cache attendee
1003
-					$this->_associate_attendee_with_registration( $registration, $attendee );
1002
+					$this->_associate_attendee_with_registration($registration, $attendee);
1004 1003
 					// \EEH_Debug_Tools::printr( $registration, '$registration', __FILE__, __LINE__ );
1005
-					if ( ! $registration->attendee() instanceof EE_Attendee ) {
1006
-						EE_Error::add_error( sprintf( __( 'Registration %s has an invalid or missing Attendee object.', 'event_espresso' ), $reg_url_link ), __FILE__, __FUNCTION__, __LINE__ );
1004
+					if ( ! $registration->attendee() instanceof EE_Attendee) {
1005
+						EE_Error::add_error(sprintf(__('Registration %s has an invalid or missing Attendee object.', 'event_espresso'), $reg_url_link), __FILE__, __FUNCTION__, __LINE__);
1007 1006
 						return false;
1008 1007
 					}
1009 1008
 					/** @type EE_Registration_Processor $registration_processor */
1010
-					$registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' );
1009
+					$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
1011 1010
 					// at this point, we should have enough details about the registrant to consider the registration NOT incomplete
1012
-					$registration_processor->toggle_incomplete_registration_status_to_default( $registration, false );
1011
+					$registration_processor->toggle_incomplete_registration_status_to_default($registration, false);
1013 1012
 					/** @type EE_Transaction_Processor $transaction_processor */
1014
-					$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
1013
+					$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
1015 1014
 					// we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned
1016
-					$transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction );
1015
+					$transaction_processor->toggle_failed_transaction_status($this->checkout->transaction);
1017 1016
 					// if we've gotten this far, then let's save what we have
1018 1017
 					$registration->save();
1019 1018
 					// add relation between TXN and registration
1020
-					$this->_associate_registration_with_transaction( $registration );
1019
+					$this->_associate_registration_with_transaction($registration);
1021 1020
 				} // end of if ( ! $this->checkout->revisit || $this->checkout->primary_revisit || ( $this->checkout->revisit && $this->checkout->reg_url_link == $reg_url_link )) {
1022 1021
 
1023
-			}  else {
1024
-				EE_Error::add_error( __( 'An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
1022
+			} else {
1023
+				EE_Error::add_error(__('An invalid or missing line item ID was encountered while attempting to process the registration form.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
1025 1024
 				// remove malformed data
1026
-				unset( $valid_data[ $reg_url_link ] );
1025
+				unset($valid_data[$reg_url_link]);
1027 1026
 				return false;
1028 1027
 			}
1029 1028
 
@@ -1052,26 +1051,26 @@  discard block
 block discarded – undo
1052 1051
 		// \EEH_Debug_Tools::printr( $input_value, '$input_value', __FILE__, __LINE__ );
1053 1052
 		// allow for plugins to hook in and do their own processing of the form input.
1054 1053
 		// For plugins to bypass normal processing here, they just need to return a boolean value.
1055
-		if ( apply_filters(
1054
+		if (apply_filters(
1056 1055
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information___save_registration_form_input',
1057 1056
 			false,
1058 1057
 			$registration,
1059 1058
 			$form_input,
1060 1059
 			$input_value,
1061 1060
 			$this
1062
-		) ) {
1061
+		)) {
1063 1062
 			return true;
1064 1063
 		}
1065 1064
 		// $answer_cache_id is the key used to find the EE_Answer we want
1066 1065
 		$answer_cache_id = $this->checkout->reg_url_link
1067 1066
 			? $form_input
1068
-			: $form_input . '-' . $registration->reg_url_link();
1069
-		$answer_is_obj = isset( $this->_registration_answers[ $answer_cache_id ] )
1070
-		                 && $this->_registration_answers[ $answer_cache_id ] instanceof EE_Answer
1067
+			: $form_input.'-'.$registration->reg_url_link();
1068
+		$answer_is_obj = isset($this->_registration_answers[$answer_cache_id])
1069
+		                 && $this->_registration_answers[$answer_cache_id] instanceof EE_Answer
1071 1070
 			? true
1072 1071
 			: false;
1073 1072
 		//rename form_inputs if they are EE_Attendee properties
1074
-		switch( (string)$form_input ) {
1073
+		switch ((string) $form_input) {
1075 1074
 
1076 1075
 			case 'state' :
1077 1076
 			case 'STA_ID' :
@@ -1086,32 +1085,32 @@  discard block
 block discarded – undo
1086 1085
 				break;
1087 1086
 
1088 1087
 			default :
1089
-				$ATT_input = 'ATT_' . $form_input;
1088
+				$ATT_input = 'ATT_'.$form_input;
1090 1089
 				//EEH_Debug_Tools::printr( $ATT_input, '$ATT_input', __FILE__, __LINE__ );
1091
-				$attendee_property = EEM_Attendee::instance()->has_field( $ATT_input ) ? true : false;
1092
-				$form_input = $attendee_property ? 'ATT_' . $form_input : $form_input;
1090
+				$attendee_property = EEM_Attendee::instance()->has_field($ATT_input) ? true : false;
1091
+				$form_input = $attendee_property ? 'ATT_'.$form_input : $form_input;
1093 1092
 		}
1094 1093
 		// EEH_Debug_Tools::printr( $answer_cache_id, '$answer_cache_id', __FILE__, __LINE__ );
1095 1094
 		// EEH_Debug_Tools::printr( $attendee_property, '$attendee_property', __FILE__, __LINE__ );
1096 1095
 		// EEH_Debug_Tools::printr( $answer_is_obj, '$answer_is_obj', __FILE__, __LINE__ );
1097 1096
 		// if this form input has a corresponding attendee property
1098
-		if ( $attendee_property ) {
1099
-			$this->_attendee_data[ $registration->reg_url_link() ][ $form_input ] = $input_value;
1100
-			if ( $answer_is_obj ) {
1097
+		if ($attendee_property) {
1098
+			$this->_attendee_data[$registration->reg_url_link()][$form_input] = $input_value;
1099
+			if ($answer_is_obj) {
1101 1100
 				// and delete the corresponding answer since we won't be storing this data in that object
1102
-				$registration->_remove_relation_to( $this->_registration_answers[ $answer_cache_id ], 'Answer' );
1103
-				$this->_registration_answers[ $answer_cache_id ]->delete_permanently();
1101
+				$registration->_remove_relation_to($this->_registration_answers[$answer_cache_id], 'Answer');
1102
+				$this->_registration_answers[$answer_cache_id]->delete_permanently();
1104 1103
 			}
1105 1104
 			return true;
1106
-		} elseif ( $answer_is_obj ) {
1105
+		} elseif ($answer_is_obj) {
1107 1106
 			// save this data to the answer object
1108
-			$this->_registration_answers[ $answer_cache_id ]->set_value( $input_value );
1109
-			$result = $this->_registration_answers[ $answer_cache_id ]->save();
1107
+			$this->_registration_answers[$answer_cache_id]->set_value($input_value);
1108
+			$result = $this->_registration_answers[$answer_cache_id]->save();
1110 1109
 			return $result !== false ? true : false;
1111 1110
 		} else {
1112
-			foreach ( $this->_registration_answers as $answer ) {
1113
-				if ( $answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id ) {
1114
-					$answer->set_value( $input_value );
1111
+			foreach ($this->_registration_answers as $answer) {
1112
+				if ($answer instanceof EE_Answer && $answer->question_ID() === $answer_cache_id) {
1113
+					$answer->set_value($input_value);
1115 1114
 					$result = $answer->save();
1116 1115
 					return $result !== false ? true : false;
1117 1116
 				}
@@ -1133,15 +1132,15 @@  discard block
 block discarded – undo
1133 1132
 		$form_input = '',
1134 1133
 		$input_value = ''
1135 1134
 	) {
1136
-		if ( empty( $input_value ) ) {
1135
+		if (empty($input_value)) {
1137 1136
 			// if the form input isn't marked as being required, then just return
1138
-			if ( ! isset( $this->_required_questions[ $form_input ] ) || ! $this->_required_questions[ $form_input ] ) {
1137
+			if ( ! isset($this->_required_questions[$form_input]) || ! $this->_required_questions[$form_input]) {
1139 1138
 				return true;
1140 1139
 			}
1141
-			switch ( $form_input ) {
1140
+			switch ($form_input) {
1142 1141
 				case 'fname' :
1143 1142
 					EE_Error::add_error(
1144
-						__( 'First Name is a required value.', 'event_espresso' ),
1143
+						__('First Name is a required value.', 'event_espresso'),
1145 1144
 						__FILE__,
1146 1145
 						__FUNCTION__,
1147 1146
 						__LINE__
@@ -1150,7 +1149,7 @@  discard block
 block discarded – undo
1150 1149
 					break;
1151 1150
 				case 'lname' :
1152 1151
 					EE_Error::add_error(
1153
-						__( 'Last Name is a required value.', 'event_espresso' ),
1152
+						__('Last Name is a required value.', 'event_espresso'),
1154 1153
 						__FILE__,
1155 1154
 						__FUNCTION__,
1156 1155
 						__LINE__
@@ -1159,7 +1158,7 @@  discard block
 block discarded – undo
1159 1158
 					break;
1160 1159
 				case 'email' :
1161 1160
 					EE_Error::add_error(
1162
-						__( 'Please enter a valid email address.', 'event_espresso' ),
1161
+						__('Please enter a valid email address.', 'event_espresso'),
1163 1162
 						__FILE__,
1164 1163
 						__FUNCTION__,
1165 1164
 						__LINE__
@@ -1192,21 +1191,21 @@  discard block
 block discarded – undo
1192 1191
 	 * @param array           $attendee_data
1193 1192
 	 * @return boolean
1194 1193
 	 */
1195
-	private function _find_existing_attendee( EE_Registration $registration, $attendee_data = array() ) {
1194
+	private function _find_existing_attendee(EE_Registration $registration, $attendee_data = array()) {
1196 1195
 		$existing_attendee = null;
1197 1196
 		// does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address
1198
-		$ATT_fname = isset( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_fname'] )
1197
+		$ATT_fname = isset($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_fname'])
1199 1198
 			? $attendee_data['ATT_fname']
1200 1199
 			: '';
1201
-		$ATT_lname = isset( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_lname'] )
1200
+		$ATT_lname = isset($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_lname'])
1202 1201
 			? $attendee_data['ATT_lname']
1203 1202
 			: '';
1204
-		$ATT_email = isset( $attendee_data['ATT_email'] ) && ! empty( $attendee_data['ATT_email'] )
1203
+		$ATT_email = isset($attendee_data['ATT_email']) && ! empty($attendee_data['ATT_email'])
1205 1204
 			? $attendee_data['ATT_email']
1206 1205
 			: '';
1207 1206
 		// but only if those have values
1208
-		if ( $ATT_fname && $ATT_lname && $ATT_email ) {
1209
-			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array(
1207
+		if ($ATT_fname && $ATT_lname && $ATT_email) {
1208
+			$existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array(
1210 1209
 				'ATT_fname' => $ATT_fname,
1211 1210
 				'ATT_lname' => $ATT_lname,
1212 1211
 				'ATT_email' => $ATT_email
@@ -1230,13 +1229,13 @@  discard block
 block discarded – undo
1230 1229
 	 * @return \EE_Attendee
1231 1230
 	 * @throws \EE_Error
1232 1231
 	 */
1233
-	private function _update_existing_attendee_data( EE_Attendee $existing_attendee, $attendee_data = array() ) {
1232
+	private function _update_existing_attendee_data(EE_Attendee $existing_attendee, $attendee_data = array()) {
1234 1233
 		// first remove fname, lname, and email from attendee data
1235
-		$dont_set = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1234
+		$dont_set = array('ATT_fname', 'ATT_lname', 'ATT_email');
1236 1235
 		// now loop thru what's left and add to attendee CPT
1237
-		foreach ( $attendee_data as $property_name => $property_value ) {
1238
-			if ( ! in_array( $property_name, $dont_set ) && EEM_Attendee::instance()->has_field( $property_name )) {
1239
-				$existing_attendee->set( $property_name, $property_value );
1236
+		foreach ($attendee_data as $property_name => $property_value) {
1237
+			if ( ! in_array($property_name, $dont_set) && EEM_Attendee::instance()->has_field($property_name)) {
1238
+				$existing_attendee->set($property_name, $property_value);
1240 1239
 			}
1241 1240
 		}
1242 1241
 		// better save that now
@@ -1254,11 +1253,11 @@  discard block
 block discarded – undo
1254 1253
 	 * @return void
1255 1254
 	 * @throws \EE_Error
1256 1255
 	 */
1257
-	private function _associate_attendee_with_registration( EE_Registration $registration, EE_Attendee $attendee ) {
1256
+	private function _associate_attendee_with_registration(EE_Registration $registration, EE_Attendee $attendee) {
1258 1257
 		// add relation to attendee
1259
-		$registration->_add_relation_to( $attendee, 'Attendee' );
1260
-		$registration->set_attendee_id( $attendee->ID() );
1261
-		$registration->update_cache_after_object_save( 'Attendee', $attendee );
1258
+		$registration->_add_relation_to($attendee, 'Attendee');
1259
+		$registration->set_attendee_id($attendee->ID());
1260
+		$registration->update_cache_after_object_save('Attendee', $attendee);
1262 1261
 	}
1263 1262
 
1264 1263
 
@@ -1270,10 +1269,10 @@  discard block
 block discarded – undo
1270 1269
 	 * @return void
1271 1270
 	 * @throws \EE_Error
1272 1271
 	 */
1273
-	private function _associate_registration_with_transaction( EE_Registration $registration ) {
1272
+	private function _associate_registration_with_transaction(EE_Registration $registration) {
1274 1273
 		// add relation to attendee
1275
-		$this->checkout->transaction->_add_relation_to( $registration, 'Registration' );
1276
-		$this->checkout->transaction->update_cache_after_object_save( 'Registration', $registration );
1274
+		$this->checkout->transaction->_add_relation_to($registration, 'Registration');
1275
+		$this->checkout->transaction->update_cache_after_object_save('Registration', $registration);
1277 1276
 	}
1278 1277
 
1279 1278
 
@@ -1286,14 +1285,14 @@  discard block
 block discarded – undo
1286 1285
 	 * @return array
1287 1286
 	 * @throws \EE_Error
1288 1287
 	 */
1289
-	private function _copy_critical_attendee_details_from_primary_registrant( $attendee_data = array() ) {
1288
+	private function _copy_critical_attendee_details_from_primary_registrant($attendee_data = array()) {
1290 1289
 		// bare minimum critical details include first name, last name, email address
1291
-		$critical_attendee_details = array( 'ATT_fname', 'ATT_lname', 'ATT_email' );
1290
+		$critical_attendee_details = array('ATT_fname', 'ATT_lname', 'ATT_email');
1292 1291
 		// add address info to critical details?
1293
-		if ( apply_filters(
1292
+		if (apply_filters(
1294 1293
 			'FHEE__EE_SPCO_Reg_Step_Attendee_Information__merge_address_details_with_critical_attendee_details',
1295 1294
 			false
1296
-		) ) {
1295
+		)) {
1297 1296
 			$address_details = array(
1298 1297
 				'ATT_address',
1299 1298
 				'ATT_address2',
@@ -1303,13 +1302,13 @@  discard block
 block discarded – undo
1303 1302
 				'ATT_zip',
1304 1303
 				'ATT_phone'
1305 1304
 			);
1306
-			$critical_attendee_details = array_merge( $critical_attendee_details, $address_details );
1305
+			$critical_attendee_details = array_merge($critical_attendee_details, $address_details);
1307 1306
 		}
1308
-		foreach ( $critical_attendee_details as $critical_attendee_detail ) {
1309
-			if ( ! isset( $attendee_data[ $critical_attendee_detail ] )
1310
-			     || empty( $attendee_data[ $critical_attendee_detail ] )
1307
+		foreach ($critical_attendee_details as $critical_attendee_detail) {
1308
+			if ( ! isset($attendee_data[$critical_attendee_detail])
1309
+			     || empty($attendee_data[$critical_attendee_detail])
1311 1310
 			) {
1312
-				$attendee_data[ $critical_attendee_detail ] = $this->checkout->primary_attendee_obj->get(
1311
+				$attendee_data[$critical_attendee_detail] = $this->checkout->primary_attendee_obj->get(
1313 1312
 					$critical_attendee_detail
1314 1313
 				);
1315 1314
 			}
@@ -1327,11 +1326,11 @@  discard block
 block discarded – undo
1327 1326
 	 * @return \EE_Attendee
1328 1327
 	 * @throws \EE_Error
1329 1328
 	 */
1330
-	private function _create_new_attendee( EE_Registration $registration, $attendee_data = array() ) {
1329
+	private function _create_new_attendee(EE_Registration $registration, $attendee_data = array()) {
1331 1330
 		// create new attendee object
1332
-		$new_attendee = EE_Attendee::new_instance( $attendee_data );
1331
+		$new_attendee = EE_Attendee::new_instance($attendee_data);
1333 1332
 		// set author to event creator
1334
-		$new_attendee->set( 'ATT_author', $registration->event()->wp_user() );
1333
+		$new_attendee->set('ATT_author', $registration->event()->wp_user());
1335 1334
 		$new_attendee->save();
1336 1335
 		return $new_attendee;
1337 1336
 	}
@@ -1348,7 +1347,7 @@  discard block
 block discarded – undo
1348 1347
 	 */
1349 1348
 	public function update_reg_step() {
1350 1349
 		// save everything
1351
-		if ( $this->process_reg_step() ) {
1350
+		if ($this->process_reg_step()) {
1352 1351
 			$this->checkout->redirect = true;
1353 1352
 			$this->checkout->redirect_url = add_query_arg(
1354 1353
 				array(
@@ -1357,7 +1356,7 @@  discard block
 block discarded – undo
1357 1356
 				),
1358 1357
 				$this->checkout->thank_you_page_url
1359 1358
 			);
1360
-			$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
1359
+			$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
1361 1360
 			return true;
1362 1361
 		}
1363 1362
 		return false;
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 4 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
 	 * 	process_ticket_selections
487 487
 	 *
488 488
 	 *	@access public
489
-	 * 	@return array|boolean
489
+	 * 	@return boolean|null
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492 492
         do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 *    validate_post_data
632 632
 	 *
633 633
 	 * @access        private
634
-	 * @return        array  or FALSE
634
+	 * @return        string  or FALSE
635 635
 	 */
636 636
 	private static function _validate_post_data() {
637 637
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	 * @access   private
749 749
 	 * @param EE_Ticket $ticket
750 750
 	 * @param int       $qty
751
-	 * @return TRUE on success, FALSE on fail
751
+	 * @return boolean on success, FALSE on fail
752 752
 	 */
753 753
 	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
754 754
 		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
212
-			                     . '</a> ';
211
+								 . __( 'Embed', 'event_espresso' )
212
+								 . '</a> ';
213 213
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
214 214
 			$iframe_string = esc_html(
215 215
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
493 493
 		// check nonce
494 494
 		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
495 495
 			EE_Error::add_error(
@@ -883,11 +883,11 @@  discard block
 block discarded – undo
883 883
 
884 884
 
885 885
 	/**
886
-	* 	load js
887
-	*
888
-	* 	@access 		public
889
-	* 	@return 		void
890
-	*/
886
+	 * 	load js
887
+	 *
888
+	 * 	@access 		public
889
+	 * 	@return 		void
890
+	 */
891 891
 	public static function load_tckt_slctr_assets() {
892 892
 		// add some style
893 893
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
86 86
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
87
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
87
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
88 88
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
89 89
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
90
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
90
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
91 91
 	}
92 92
 
93 93
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
102
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
103 103
 		//add button for iframe code to event editor.
104
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
105
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
104
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
105
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *  @return 	void
115 115
 	 */
116 116
 	public static function set_definitions() {
117
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
118
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
117
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
118
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
119 119
 
120 120
 		//if config is not set, initialize
121 121
 		//If config is not set, set it.
122
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
122
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
123 123
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
124 124
 		}
125
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
125
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * 	@param	object 			$WP
134 134
 	 * 	@return 	void
135 135
 	 */
136
-	public function run( $WP ) {}
136
+	public function run($WP) {}
137 137
 
138 138
 
139 139
 	/**
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	public function ticket_selector_iframe() {
146 146
 		self::$_in_iframe = true;
147 147
 		/** @type EEM_Event $EEM_Event */
148
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
148
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
149 149
 		$event = $EEM_Event->get_one_by_ID(
150
-			EE_Registry::instance()->REQ->get( 'event', 0 )
150
+			EE_Registry::instance()->REQ->get('event', 0)
151 151
 		);
152
-		EE_Registry::instance()->REQ->set_espresso_page( true );
153
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
152
+		EE_Registry::instance()->REQ->set_espresso_page(true);
153
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
154 154
 		$template_args['css'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
156 156
 			array(
157
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
160
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
157
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
160
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
161 161
 			)
162 162
 		);
163
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
164
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
163
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
164
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
165 165
 		$template_args['eei18n'] = apply_filters(
166 166
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
167 167
 			EE_Registry::localize_i18n_js_strings()
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		$template_args['js'] = apply_filters(
170 170
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
171 171
 			array(
172
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
173
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
174
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
172
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
173
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
174
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
175 175
 			)
176 176
 		);
177
-		$template_args[ 'notices' ] = EEH_Template::display_template(
178
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
177
+		$template_args['notices'] = EEH_Template::display_template(
178
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
179 179
 			array(),
180 180
 			true
181 181
 		);
182 182
 		EEH_Template::display_template(
183
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
183
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
184 184
 			$template_args
185 185
 		);
186 186
 		exit;
@@ -199,25 +199,25 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string The new html string for the permalink area.
201 201
 	 */
202
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
202
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
203 203
 		//make sure this is ONLY when editing and the event id has been set.
204
-		if ( ! empty( $id ) ) {
205
-			$post = get_post( $id );
204
+		if ( ! empty($id)) {
205
+			$post = get_post($id);
206 206
 			//if NOT event then let's get out.
207
-			if ( $post->post_type !== 'espresso_events' ) {
207
+			if ($post->post_type !== 'espresso_events') {
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
211
+			                     . __('Embed', 'event_espresso')
212 212
 			                     . '</a> ';
213
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
213
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
214 214
 			$iframe_string = esc_html(
215
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
215
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
216 216
 			);
217 217
 			$permalink_string .= '
218 218
 <div id="js-ts-iframe" style="display:none">
219 219
 	<div style="width:100%; height: 500px;">
220
-		' . $iframe_string . '
220
+		' . $iframe_string.'
221 221
 	</div>
222 222
 </div>';
223 223
 		}
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @param 	mixed $event
237 237
 	 * @return 	bool
238 238
 	 */
239
-	protected static function set_event( $event = null ) {
240
-		if( $event === null ) {
239
+	protected static function set_event($event = null) {
240
+		if ($event === null) {
241 241
 			global $post;
242 242
 			$event = $post;
243 243
 		}
244
-		if ( $event instanceof EE_Event ) {
244
+		if ($event instanceof EE_Event) {
245 245
 			self::$_event = $event;
246
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
246
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
247 247
 			self::$_event = $event->EE_Event;
248
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
249
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
248
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
249
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
250 250
 			self::$_event = $event->EE_Event;
251 251
 		} else {
252
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
253
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
254
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
252
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
253
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
254
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
255 255
 			return false;
256 256
 		}
257 257
 		return true;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 * @param 	bool 	$view_details
271 271
 	 * @return 	string
272 272
 	 */
273
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
273
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
274 274
 		// reset filter for displaying submit button
275
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
275
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
276 276
 		// poke and prod incoming event till it tells us what it is
277
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
277
+		if ( ! EED_Ticket_Selector::set_event($event)) {
278 278
 			return false;
279 279
 		}
280 280
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			&& (
286 286
 				! self::$_event->display_ticket_selector()
287 287
 				|| $view_details
288
-				|| post_password_required( $event_post )
288
+				|| post_password_required($event_post)
289 289
 				|| (
290 290
 					$_event_active_status != EE_Datetime::active
291 291
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -303,68 +303,68 @@  discard block
 block discarded – undo
303 303
 		$template_args = array();
304 304
 		$template_args['event_status'] = $_event_active_status;
305 305
 
306
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
307
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
306
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
307
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
308 308
 
309 309
 		$template_args['EVT_ID'] = self::$_event->ID();
310 310
 		$template_args['event'] = self::$_event;
311 311
 
312 312
 		// is the event expired ?
313 313
 		$template_args['event_is_expired'] = self::$_event->is_expired();
314
-		if ( $template_args['event_is_expired'] ) {
315
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
314
+		if ($template_args['event_is_expired']) {
315
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
316 316
 		}
317 317
 
318 318
 		$ticket_query_args = array(
319
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
320
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
319
+			array('Datetime.EVT_ID' => self::$_event->ID()),
320
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
321 321
 		);
322 322
 
323
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
323
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
324 324
 			//use the correct applicable time query depending on what version of core is being run.
325
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
326
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
325
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
326
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
327 327
 		}
328 328
 
329 329
 		// get all tickets for this event ordered by the datetime
330
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
330
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
331 331
 
332
-		if ( count( $template_args['tickets'] ) < 1 ) {
333
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
332
+		if (count($template_args['tickets']) < 1) {
333
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
334 334
 		}
335 335
 
336 336
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
337
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
338
-		if ( $template_args['max_atndz'] < 1 ) {
339
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
340
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
341
-				$sales_closed_msg .=  sprintf(
342
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
337
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
338
+		if ($template_args['max_atndz'] < 1) {
339
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
340
+			if (current_user_can('edit_post', self::$_event->ID())) {
341
+				$sales_closed_msg .= sprintf(
342
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
343 343
 					'<div class="ee-attention" style="text-align: left;"><b>',
344 344
 					'</b><br />',
345
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
345
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
346 346
 					'</a></span></div>'
347 347
 				);
348 348
 			}
349
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
349
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
350 350
 		}
351 351
 
352
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
353
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
352
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
353
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
354 354
 
355 355
 		// redirecting to another site for registration ??
356 356
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
357 357
 		// set up the form (but not for the admin)
358
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
358
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
359 359
 		// if not redirecting to another site for registration
360
-		if ( ! $external_url ) {
360
+		if ( ! $external_url) {
361 361
 			// then display the ticket selector
362
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
362
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
363 363
 		} else {
364 364
 			// if not we still need to trigger the display of the submit button
365
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
365
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
366 366
 			//display notice to admin that registration is external
367
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
367
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
368 368
 		}
369 369
 		// submit button and form close tag
370 370
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -384,25 +384,25 @@  discard block
 block discarded – undo
384 384
 	 * @param 		string $external_url
385 385
 	 * @return 		string
386 386
 	 */
387
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
387
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
388 388
 		// if redirecting, we don't need any anything else
389
-		if ( $external_url ) {
390
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
391
-			$query_args = EEH_URL::get_query_string( $external_url );
392
-			foreach ( $query_args as $query_arg => $value ) {
393
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
389
+		if ($external_url) {
390
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
391
+			$query_args = EEH_URL::get_query_string($external_url);
392
+			foreach ($query_args as $query_arg => $value) {
393
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
394 394
 			}
395 395
 			return $html;
396 396
 		}
397
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
398
-		if ( ! $checkout_url ) {
399
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
397
+		$checkout_url = EEH_Event_View::event_link_url($ID);
398
+		if ( ! $checkout_url) {
399
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
400 400
 		}
401 401
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
402
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
403
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
402
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
403
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
404 404
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
405
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
405
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
406 406
 		return $html;
407 407
 	}
408 408
 
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 	 * 	@return		string
418 418
 	 */
419 419
 	public static function display_ticket_selector_submit() {
420
-		if ( ! is_admin() ) {
421
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
420
+		if ( ! is_admin()) {
421
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
422 422
 				$btn_text = apply_filters(
423 423
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
424
-					__('Register Now', 'event_espresso' ),
424
+					__('Register Now', 'event_espresso'),
425 425
 					self::$_event
426 426
 				);
427 427
 				$external_url = self::$_event->external_url();
428
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
428
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
429 429
 				$html .= ' class="ticket-selector-submit-btn ';
430
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
431
-				$html .= ' type="submit" value="' . $btn_text . '" />';
432
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
430
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
431
+				$html .= ' type="submit" value="'.$btn_text.'" />';
432
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
433 433
 				$html .= '<div class="clear"><br/></div></form>';
434 434
 				return $html;
435
-			} else if ( is_archive() ) {
436
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
435
+			} else if (is_archive()) {
436
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
437 437
 			}
438 438
 		}
439 439
 		return '';
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 	 * 	@return		string
466 466
 	 */
467 467
 	public static function display_view_details_btn() {
468
-		if ( ! self::$_event->get_permalink() ) {
469
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
468
+		if ( ! self::$_event->get_permalink()) {
469
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
470 470
 		}
471
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
472
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
473
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
474
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
471
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
472
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
473
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
474
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
475 475
 		$view_details_btn .= '<div class="clear"><br/></div>';
476 476
 		$view_details_btn .= '</form>';
477 477
 		return $view_details_btn;
@@ -489,11 +489,11 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
493 493
 		// check nonce
494
-		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) {
494
+		if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) {
495 495
 			EE_Error::add_error(
496
-				sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
496
+				sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
497 497
 				__FILE__, __FUNCTION__, __LINE__
498 498
 			);
499 499
 			return FALSE;
@@ -507,16 +507,16 @@  discard block
 block discarded – undo
507 507
 
508 508
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
509 509
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
510
-		EE_Registry::instance()->load_core( 'Session' );
510
+		EE_Registry::instance()->load_core('Session');
511 511
 		// unless otherwise requested, clear the session
512
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
513
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
512
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
513
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
514 514
 		}
515 515
 		//d( EE_Registry::instance()->SSN );
516 516
 
517
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
517
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
518 518
 		// do we have an event id?
519
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
519
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
520 520
 			// validate/sanitize data
521 521
 			$valid = self::_validate_post_data();
522 522
 
@@ -526,41 +526,41 @@  discard block
 block discarded – undo
526 526
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
527 527
 
528 528
 			//check total tickets ordered vs max number of attendees that can register
529
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
529
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
530 530
 
531 531
 				// ordering too many tickets !!!
532 532
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
533
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
533
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
534 534
 				// dev only message
535 535
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
536
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
537
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
536
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
537
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
538 538
 			} else {
539 539
 
540 540
 				// all data appears to be valid
541 541
 				$tckts_slctd = FALSE;
542 542
 				$success = TRUE;
543 543
 				// load cart
544
-				EE_Registry::instance()->load_core( 'Cart' );
544
+				EE_Registry::instance()->load_core('Cart');
545 545
 
546 546
 				// cycle thru the number of data rows sent from the event listing
547
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
547
+				for ($x = 0; $x < $valid['rows']; $x++) {
548 548
 					// does this row actually contain a ticket quantity?
549
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
549
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
550 550
 						// YES we have a ticket quantity
551 551
 						$tckts_slctd = TRUE;
552 552
 						//						d( $valid['ticket_obj'][$x] );
553
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
553
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
554 554
 							// then add ticket to cart
555
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
555
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
556 556
 							$success = ! $ticket_added ? FALSE : $success;
557
-							if ( EE_Error::has_error() ) {
557
+							if (EE_Error::has_error()) {
558 558
 								break;
559 559
 							}
560 560
 						} else {
561 561
 							// nothing added to cart retrieved
562 562
 							EE_Error::add_error(
563
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
563
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
564 564
 								__FILE__, __FUNCTION__, __LINE__
565 565
 							);
566 566
 						}
@@ -569,45 +569,45 @@  discard block
 block discarded – undo
569 569
 				//d( EE_Registry::instance()->CART );
570 570
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
571 571
 
572
-				if ( $tckts_slctd ) {
573
-					if ( $success ) {
574
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
572
+				if ($tckts_slctd) {
573
+					if ($success) {
574
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
575 575
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
576
-						EE_Registry::instance()->CART->save_cart( FALSE );
576
+						EE_Registry::instance()->CART->save_cart(FALSE);
577 577
 						EE_Registry::instance()->SSN->update();
578 578
 						//d( EE_Registry::instance()->CART );
579 579
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
580 580
 						// just return TRUE for registrations being made from admin
581
-						if ( is_admin() ) {
581
+						if (is_admin()) {
582 582
 							return TRUE;
583 583
 						}
584
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
584
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
585 585
 						exit();
586 586
 
587 587
 					} else {
588
-						if ( ! EE_Error::has_error() ) {
588
+						if ( ! EE_Error::has_error()) {
589 589
 							// nothing added to cart
590
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
590
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
591 591
 						}
592 592
 					}
593 593
 
594 594
 				} else {
595 595
 					// no ticket quantities were selected
596
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
596
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
597 597
 				}
598 598
 			}
599 599
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
600 600
 			// at this point, just return if registration is being made from admin
601
-			if ( is_admin() ) {
601
+			if (is_admin()) {
602 602
 				return FALSE;
603 603
 			}
604
-			if ( $valid['return_url'] ) {
605
-				EE_Error::get_notices( FALSE, TRUE );
606
-				wp_safe_redirect( $valid['return_url'] );
604
+			if ($valid['return_url']) {
605
+				EE_Error::get_notices(FALSE, TRUE);
606
+				wp_safe_redirect($valid['return_url']);
607 607
 				exit();
608
-			} elseif ( isset( $event_to_add['id'] )) {
609
-				EE_Error::get_notices( FALSE, TRUE );
610
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
608
+			} elseif (isset($event_to_add['id'])) {
609
+				EE_Error::get_notices(FALSE, TRUE);
610
+				wp_safe_redirect(get_permalink($event_to_add['id']));
611 611
 				exit();
612 612
 			} else {
613 613
 				echo EE_Error::get_notices();
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 		} else {
617 617
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
618 618
 			EE_Error::add_error(
619
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
619
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
620 620
 				__FILE__, __FUNCTION__, __LINE__
621 621
 			);
622 622
 		}
@@ -634,18 +634,18 @@  discard block
 block discarded – undo
634 634
 	 * @return        array  or FALSE
635 635
 	 */
636 636
 	private static function _validate_post_data() {
637
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
637
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
638 638
 
639 639
 		// start with an empty array()
640 640
 		$valid_data = array();
641 641
 		//		d( $_POST );
642 642
 		//if event id is valid
643
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
644
-		if ( $id ) {
643
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
644
+		if ($id) {
645 645
 			// grab valid id
646 646
 			$valid_data['id'] = $id;
647 647
 			// grab and sanitize return-url
648
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
648
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
649 649
 			// array of other form names
650 650
 			$inputs_to_clean = array(
651 651
 				'event_id' => 'tkt-slctr-event-id',
@@ -658,22 +658,22 @@  discard block
 block discarded – undo
658 658
 			// let's track the total number of tickets ordered.'
659 659
 			$valid_data['total_tickets'] = 0;
660 660
 			// cycle through $inputs_to_clean array
661
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
661
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
662 662
 				// check for POST data
663
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
663
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
664 664
 					// grab value
665
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
665
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
666 666
 					switch ($what) {
667 667
 
668 668
 						// integers
669 669
 						case 'event_id':
670
-							$valid_data[$what] = absint( $input_value );
670
+							$valid_data[$what] = absint($input_value);
671 671
 							// get event via the event id we put in the form
672
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
672
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
673 673
 							break;
674 674
 						case 'rows':
675 675
 						case 'max_atndz':
676
-							$valid_data[$what] = absint( $input_value );
676
+							$valid_data[$what] = absint($input_value);
677 677
 							break;
678 678
 
679 679
 						// arrays of integers
@@ -681,27 +681,27 @@  discard block
 block discarded – undo
681 681
 							//							d( $input_value );
682 682
 							$row_qty = $input_value;
683 683
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
684
-							if( ! is_array( $row_qty )) {
684
+							if ( ! is_array($row_qty)) {
685 685
 								// get number of rows
686
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
686
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
687 687
 								//								d( $rows );
688 688
 								// explode ints by the dash
689
-								$row_qty = explode( '-', $row_qty );
690
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
691
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
692
-								$row_qty = array( $row => $qty );
689
+								$row_qty = explode('-', $row_qty);
690
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
691
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
692
+								$row_qty = array($row => $qty);
693 693
 								//								 d( $row_qty );
694
-								for( $x = 1; $x <= $rows; $x++ ) {
695
-									if ( ! isset( $row_qty[$x] )) {
694
+								for ($x = 1; $x <= $rows; $x++) {
695
+									if ( ! isset($row_qty[$x])) {
696 696
 										$row_qty[$x] = 0;
697 697
 									}
698 698
 								}
699 699
 							}
700
-							ksort( $row_qty );
700
+							ksort($row_qty);
701 701
 							//							 d( $row_qty );
702 702
 							// cycle thru values
703
-							foreach ( $row_qty as $qty ) {
704
-								$qty = absint( $qty );
703
+							foreach ($row_qty as $qty) {
704
+								$qty = absint($qty);
705 705
 								// sanitize as integers
706 706
 								$valid_data[$what][] = $qty;
707 707
 								$valid_data['total_tickets'] += $qty;
@@ -712,19 +712,19 @@  discard block
 block discarded – undo
712 712
 						case 'ticket_id':
713 713
 							$value_array = array();
714 714
 							// cycle thru values
715
-							foreach ( $input_value as $key=>$value ) {
715
+							foreach ($input_value as $key=>$value) {
716 716
 								// allow only numbers, letters,  spaces, commas and dashes
717
-								$value_array[ $key ] = wp_strip_all_tags( $value );
717
+								$value_array[$key] = wp_strip_all_tags($value);
718 718
 								// get ticket via the ticket id we put in the form
719
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
720
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
719
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
720
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
721 721
 							}
722
-							$valid_data[ $what ] = $value_array;
722
+							$valid_data[$what] = $value_array;
723 723
 							break;
724 724
 
725 725
 						case 'return_url' :
726 726
 							// grab and sanitize return-url
727
-							$valid_data[$what] = esc_url_raw( $input_value );
727
+							$valid_data[$what] = esc_url_raw($input_value);
728 728
 							break;
729 729
 
730 730
 					} 	// end switch $what
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 			} 	// end foreach $inputs_to_clean
733 733
 
734 734
 		} else {
735
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
735
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
736 736
 			return FALSE;
737 737
 		}
738 738
 
@@ -750,28 +750,28 @@  discard block
 block discarded – undo
750 750
 	 * @param int       $qty
751 751
 	 * @return TRUE on success, FALSE on fail
752 752
 	 */
753
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
754
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
753
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
754
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
755 755
 		// get the number of spaces left for this datetime ticket
756
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
756
+		$available_spaces = self::_ticket_datetime_availability($ticket);
757 757
 		// compare available spaces against the number of tickets being purchased
758
-		if ( $available_spaces >= $qty ) {
758
+		if ($available_spaces >= $qty) {
759 759
 			// allow addons to prevent a ticket from being added to cart
760
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
760
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
761 761
 				return false;
762 762
 			}
763 763
 			// add event to cart
764
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
765
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
764
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
765
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
766 766
 				return true;
767 767
 			} else {
768 768
 				return false;
769 769
 			}
770 770
 		} else {
771 771
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
772
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
772
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
773 773
 			// greedy greedy greedy eh?
774
-			if ( $available_spaces > 0 ) {
774
+			if ($available_spaces > 0) {
775 775
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
776 776
 				EE_Error::add_error(
777 777
 					sprintf(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 					__FILE__, __FUNCTION__, __LINE__
788 788
 				);
789 789
 			} else {
790
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
790
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
791 791
 			}
792 792
 			return false;
793 793
 		}
@@ -805,22 +805,22 @@  discard block
 block discarded – undo
805 805
 	 * @param 	bool         $get_original_ticket_spaces
806 806
 	 * @return 	int
807 807
 	 */
808
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
808
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
809 809
 		// if the $_available_spaces array has not been set up yet...
810
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
811
-				self::_set_initial_ticket_datetime_availability( $ticket );
810
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
811
+				self::_set_initial_ticket_datetime_availability($ticket);
812 812
 		}
813 813
 		$available_spaces = $ticket->qty() - $ticket->sold();
814
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
814
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
815 815
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
816
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
816
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
817 817
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
818
-				if ( $get_original_ticket_spaces ) {
818
+				if ($get_original_ticket_spaces) {
819 819
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
820
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
820
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
821 821
 				} else {
822 822
 					// we want the updated ticket availability as stored in the "datetimes" array
823
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
823
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
824 824
 				}
825 825
 			}
826 826
 		}
@@ -836,23 +836,23 @@  discard block
 block discarded – undo
836 836
 	 * @param 	EE_Ticket $ticket
837 837
 	 * @return 	int
838 838
 	 */
839
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
839
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
840 840
 		// first, get all of the datetimes that are available to this ticket
841 841
 		$datetimes = $ticket->get_many_related(
842 842
 			'Datetime',
843
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
843
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
844 844
 		);
845
-		if ( ! empty( $datetimes )) {
845
+		if ( ! empty($datetimes)) {
846 846
 			// now loop thru all of the datetimes
847
-			foreach ( $datetimes as $datetime  ) {
848
-				if ( $datetime instanceof EE_Datetime ) {
847
+			foreach ($datetimes as $datetime) {
848
+				if ($datetime instanceof EE_Datetime) {
849 849
 					// the number of spaces available for the datetime without considering individual ticket quantities
850 850
 					$spaces_remaining = $datetime->spaces_remaining();
851 851
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
852
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
852
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
853 853
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
854 854
 					// else just take the datetime spaces remaining, and assign to the datetimes array
855
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
855
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
856 856
 				}
857 857
 			}
858 858
 		}
@@ -868,12 +868,12 @@  discard block
 block discarded – undo
868 868
 	 * @param 	int   $qty
869 869
 	 * @return 	int
870 870
 	 */
871
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
872
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
871
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
872
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
873 873
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
874
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
874
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
875 875
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
876
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
876
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
877 877
 			}
878 878
 		}
879 879
 	}
@@ -890,8 +890,8 @@  discard block
 block discarded – undo
890 890
 	*/
891 891
 	public static function load_tckt_slctr_assets() {
892 892
 		// add some style
893
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
894
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
893
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
894
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
895 895
 			wp_enqueue_style('ticket_selector');
896 896
 			// make it dance
897 897
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -905,9 +905,9 @@  discard block
 block discarded – undo
905 905
 
906 906
 	public static function load_tckt_slctr_assets_admin() {
907 907
 		//iframe button js on admin event editor page
908
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
909
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
910
-			wp_enqueue_script( 'ticket_selector_embed' );
908
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
909
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
910
+			wp_enqueue_script('ticket_selector_embed');
911 911
 		}
912 912
 	}
913 913
 
Please login to merge, or discard this patch.
modules/venue_single/EED_Venue_Single.module.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @return EED_Venue_Single
28 28
 	 */
29 29
 	public static function instance() {
30
-		return parent::get_instance( __CLASS__ );
30
+		return parent::get_instance(__CLASS__);
31 31
 	}
32 32
 
33 33
 	/**
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 *  @return 	void
38 38
 	 */
39 39
 	public static function set_hooks() {
40
-		EE_Config::register_route( 'venue', 'Venue_Single', 'run' );
40
+		EE_Config::register_route('venue', 'Venue_Single', 'run');
41 41
 //		EE_Config::register_view( 'venue', 0, EE_TEMPLATES . EE_Config::get_current_theme() . DS . 'single-espresso_venues.php' );
42 42
 	}
43 43
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	 * @access    public
59 59
 	 * @param \WP $WP
60 60
 	 */
61
-	public function run( $WP ) {
61
+	public function run($WP) {
62 62
 		// check what template is loaded
63
-		add_filter( 'template_include',  array( $this, 'template_include' ), 999, 1 );
64
-		add_action('wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ), 10 );
63
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
64
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
65 65
 	}
66 66
 
67 67
 
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 	 * @param  string $template
74 74
 	 * @return string
75 75
 	 */
76
-	public function template_include( $template ) {
76
+	public function template_include($template) {
77 77
 		// not a custom template?
78
-		if ( EE_Registry::instance()->load_core( 'Front_Controller', array(), false, true )->get_selected_template() != 'single-espresso_venues.php' ) {
78
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)->get_selected_template() != 'single-espresso_venues.php') {
79 79
 			EEH_Template::load_espresso_theme_functions();
80 80
 			// then add extra event data via hooks
81
-			add_filter( 'the_title', array( $this, 'the_title' ), 100, 1 );
82
-			add_filter( 'the_content', array( $this, 'venue_details' ), 100 );
81
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
82
+			add_filter('the_content', array($this, 'venue_details'), 100);
83 83
 			// don't display entry meta because the existing theme will take car of that
84
-			add_filter( 'FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false' );
84
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
85 85
 		}
86 86
 		return $template;
87 87
 	}
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 * @param  string $title
96 96
 	 * @return string
97 97
 	 */
98
-	public function the_title( $title = '' ) {
98
+	public function the_title($title = '') {
99 99
 		return $title;
100 100
 	}
101 101
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 	 * @param  string $content
108 108
 	 * @return string
109 109
 	 */
110
-	public function venue_details( $content ) {
110
+	public function venue_details($content) {
111 111
 		global $post;
112 112
 		if (
113 113
 			$post->post_type == 'espresso_venues'
@@ -117,16 +117,16 @@  discard block
 block discarded – undo
117 117
 			// it uses the_content() for displaying the $post->post_content
118 118
 			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
119 119
 			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
120
-			remove_filter( 'the_content', array( $this, 'venue_details' ), 100 );
120
+			remove_filter('the_content', array($this, 'venue_details'), 100);
121 121
 			// add filters we want
122
-			add_filter( 'the_content', array( $this, 'venue_location' ), 110 );
122
+			add_filter('the_content', array($this, 'venue_location'), 110);
123 123
 			// now load our template
124
-			$template = EEH_Template::locate_template( 'content-espresso_venues-details.php' );
124
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
125 125
 			// remove other filters we added so they won't get applied to the next post
126
-			remove_filter( 'the_content', array( $this, 'venue_location' ), 110 );
126
+			remove_filter('the_content', array($this, 'venue_location'), 110);
127 127
 		}
128 128
 		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
129
-		return ! empty( $template ) ? $template : $content;
129
+		return ! empty($template) ? $template : $content;
130 130
 	}
131 131
 
132 132
 
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 * @param  string $content
139 139
 	 * @return string
140 140
 	 */
141
-	public function venue_location( $content ) {
142
-		return $content . EEH_Template::locate_template( 'content-espresso_venues-location.php' );
141
+	public function venue_location($content) {
142
+		return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
143 143
 	}
144 144
 
145 145
 
@@ -152,16 +152,16 @@  discard block
 block discarded – undo
152 152
 	 */
153 153
 	public function wp_enqueue_scripts() {
154 154
 		// get some style
155
-		if ( apply_filters( 'FHEE_enable_default_espresso_css', TRUE ) && is_single() ) {
155
+		if (apply_filters('FHEE_enable_default_espresso_css', TRUE) && is_single()) {
156 156
 			// first check theme folder
157
-			if ( is_readable( get_stylesheet_directory() . $this->theme . DS . 'style.css' )) {
158
-				wp_register_style( $this->theme, get_stylesheet_directory_uri() . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
159
-			} else if ( is_readable( EE_TEMPLATES . $this->theme . DS . 'style.css' )) {
160
-				wp_register_style( $this->theme, EE_TEMPLATES_URL . $this->theme . DS . 'style.css', array( 'dashicons', 'espresso_default' ) );
157
+			if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
158
+				wp_register_style($this->theme, get_stylesheet_directory_uri().$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
159
+			} else if (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
160
+				wp_register_style($this->theme, EE_TEMPLATES_URL.$this->theme.DS.'style.css', array('dashicons', 'espresso_default'));
161 161
 			}
162
-			wp_enqueue_style( $this->theme );
163
-			if ( EE_Registry::instance()->CFG->map_settings->use_google_maps ) {
164
-				add_action('wp_enqueue_scripts', array( 'EEH_Maps', 'espresso_google_map_js' ), 11 );
162
+			wp_enqueue_style($this->theme);
163
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
164
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
165 165
 			}
166 166
 		}
167 167
 	}
Please login to merge, or discard this patch.