Completed
Branch BETA-4.9-messages-queue-fixed (941081)
by
unknown
30:24 queued 05:56
created
core/libraries/plugin_api/EE_Register_Addon.lib.php 1 patch
Spacing   +170 added lines, -170 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,235 +155,235 @@  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
 			// full server path to main file (file loaded directly by WP)
195
-			'main_file_path' 					=> isset( $setup_args['main_file_path'] ) ? (string)$setup_args['main_file_path'] : '',
195
+			'main_file_path' 					=> isset($setup_args['main_file_path']) ? (string) $setup_args['main_file_path'] : '',
196 196
 			// path to folder containing files for integrating with the EE core admin and/or setting up EE admin pages
197
-			'admin_path' 						=> isset( $setup_args['admin_path'] ) ? (string)$setup_args['admin_path'] : '',
197
+			'admin_path' 						=> isset($setup_args['admin_path']) ? (string) $setup_args['admin_path'] : '',
198 198
 			// a method to be called when the EE Admin is first invoked, can be used for hooking into any admin page
199
-			'admin_callback' 				=> isset( $setup_args['admin_callback'] ) ? (string)$setup_args['admin_callback'] : '',
199
+			'admin_callback' 				=> isset($setup_args['admin_callback']) ? (string) $setup_args['admin_callback'] : '',
200 200
 			// the section name for this addon's configuration settings section (defaults to "addons")
201
-			'config_section' 					=> isset( $setup_args['config_section'] ) ? (string)$setup_args['config_section'] : 'addons',
201
+			'config_section' 					=> isset($setup_args['config_section']) ? (string) $setup_args['config_section'] : 'addons',
202 202
 			// the class name for this addon's configuration settings object
203
-			'config_class' 						=> isset( $setup_args['config_class'] ) ? (string)$setup_args['config_class'] : '',
203
+			'config_class' 						=> isset($setup_args['config_class']) ? (string) $setup_args['config_class'] : '',
204 204
 			//the name given to the config for this addons' configuration settings object (optional)
205
-			'config_name' 					=> isset( $setup_args['config_name'] ) ? (string) $setup_args['config_name']: '',
205
+			'config_name' 					=> isset($setup_args['config_name']) ? (string) $setup_args['config_name'] : '',
206 206
 			// an array of "class names" => "full server paths" for any classes that might be invoked by the addon
207
-			'autoloader_paths' 			=> isset( $setup_args['autoloader_paths'] ) ? (array)$setup_args['autoloader_paths'] : array(),
207
+			'autoloader_paths' 			=> isset($setup_args['autoloader_paths']) ? (array) $setup_args['autoloader_paths'] : array(),
208 208
 			// an array of  "full server paths" for any folders containing classes that might be invoked by the addon
209
-			'autoloader_folders' 			=> isset( $setup_args['autoloader_folders'] ) ? (array)$setup_args['autoloader_folders'] : array(),
209
+			'autoloader_folders' 			=> isset($setup_args['autoloader_folders']) ? (array) $setup_args['autoloader_folders'] : array(),
210 210
 			// array of full server paths to any EE_DMS data migration scripts used by the addon
211
-			'dms_paths' 						=> isset( $setup_args['dms_paths'] ) ? (array)$setup_args['dms_paths'] : array(),
211
+			'dms_paths' 						=> isset($setup_args['dms_paths']) ? (array) $setup_args['dms_paths'] : array(),
212 212
 			// array of full server paths to any EED_Modules used by the addon
213
-			'module_paths' 					=> isset( $setup_args['module_paths'] ) ? (array)$setup_args['module_paths'] : array(),
213
+			'module_paths' 					=> isset($setup_args['module_paths']) ? (array) $setup_args['module_paths'] : array(),
214 214
 			// array of full server paths to any EES_Shortcodes used by the addon
215
-			'shortcode_paths'			 	=> isset( $setup_args['shortcode_paths'] ) ? (array)$setup_args['shortcode_paths'] : array(),
215
+			'shortcode_paths'			 	=> isset($setup_args['shortcode_paths']) ? (array) $setup_args['shortcode_paths'] : array(),
216 216
 			// array of full server paths to any WP_Widgets used by the addon
217
-			'widget_paths' 					=> isset( $setup_args['widget_paths'] ) ? (array)$setup_args['widget_paths'] : array(),
217
+			'widget_paths' 					=> isset($setup_args['widget_paths']) ? (array) $setup_args['widget_paths'] : array(),
218 218
 			// array of PUE options used by the addon
219
-			'pue_options' 						=> isset( $setup_args['pue_options'] ) ? (array)$setup_args['pue_options'] : array(),
220
-			'message_types' 				=> isset( $setup_args['message_types'] ) ? (array) $setup_args['message_types'] : array(),
221
-			'capabilities' 						=> isset( $setup_args['capabilities'] ) ? (array) $setup_args['capabilities'] : array(),
222
-			'capability_maps' 				=> isset( $setup_args['capability_maps'] ) ? (array) $setup_args['capability_maps'] : array(),
223
-			'model_paths' 					=> isset( $setup_args['model_paths'] ) ? (array) $setup_args['model_paths'] : array(),
224
-			'class_paths' 						=> isset( $setup_args['class_paths'] ) ? (array) $setup_args['class_paths'] : array(),
225
-			'model_extension_paths' 	=> isset( $setup_args['model_extension_paths'] ) ? (array) $setup_args['model_extension_paths'] : array(),
226
-			'class_extension_paths' 		=> isset( $setup_args['class_extension_paths'] ) ? (array) $setup_args['class_extension_paths'] : array(),
227
-			'custom_post_types' 			=> isset( $setup_args['custom_post_types'] ) ? (array) $setup_args['custom_post_types'] : array(),
228
-			'custom_taxonomies' 		=> isset( $setup_args['custom_taxonomies'] ) ? (array) $setup_args['custom_taxonomies'] : array(),
229
-			'payment_method_paths'	=> isset( $setup_args[ 'payment_method_paths' ] ) ? (array) $setup_args[ 'payment_method_paths' ] : array(),
230
-			'default_terms' 					=> isset( $setup_args['default_terms'] ) ? (array) $setup_args['default_terms'] : array(),
219
+			'pue_options' 						=> isset($setup_args['pue_options']) ? (array) $setup_args['pue_options'] : array(),
220
+			'message_types' 				=> isset($setup_args['message_types']) ? (array) $setup_args['message_types'] : array(),
221
+			'capabilities' 						=> isset($setup_args['capabilities']) ? (array) $setup_args['capabilities'] : array(),
222
+			'capability_maps' 				=> isset($setup_args['capability_maps']) ? (array) $setup_args['capability_maps'] : array(),
223
+			'model_paths' 					=> isset($setup_args['model_paths']) ? (array) $setup_args['model_paths'] : array(),
224
+			'class_paths' 						=> isset($setup_args['class_paths']) ? (array) $setup_args['class_paths'] : array(),
225
+			'model_extension_paths' 	=> isset($setup_args['model_extension_paths']) ? (array) $setup_args['model_extension_paths'] : array(),
226
+			'class_extension_paths' 		=> isset($setup_args['class_extension_paths']) ? (array) $setup_args['class_extension_paths'] : array(),
227
+			'custom_post_types' 			=> isset($setup_args['custom_post_types']) ? (array) $setup_args['custom_post_types'] : array(),
228
+			'custom_taxonomies' 		=> isset($setup_args['custom_taxonomies']) ? (array) $setup_args['custom_taxonomies'] : array(),
229
+			'payment_method_paths'	=> isset($setup_args['payment_method_paths']) ? (array) $setup_args['payment_method_paths'] : array(),
230
+			'default_terms' 					=> isset($setup_args['default_terms']) ? (array) $setup_args['default_terms'] : array(),
231 231
 			// 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
232
-			'plugins_page_row' 			=> isset( $setup_args['plugins_page_row'] ) ? $setup_args['plugins_page_row'] : '',
232
+			'plugins_page_row' 			=> isset($setup_args['plugins_page_row']) ? $setup_args['plugins_page_row'] : '',
233 233
 		);
234 234
 
235 235
 		// 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
236
-		$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' ];
236
+		$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'];
237 237
 		// full server path to main file (file loaded directly by WP)
238
-		$addon_settings['plugin_basename'] = plugin_basename( $addon_settings[ 'main_file_path' ] );
238
+		$addon_settings['plugin_basename'] = plugin_basename($addon_settings['main_file_path']);
239 239
 
240 240
 		//check whether this addon version is compatible with EE core
241
-		if ( isset( EE_Register_Addon::$_incompatible_addons[ $addon_name ] ) &&
242
-				! self::_meets_min_core_version_requirement( EE_Register_Addon::$_incompatible_addons[ $addon_name ], $addon_settings[ 'version' ] ) ) {
241
+		if (isset(EE_Register_Addon::$_incompatible_addons[$addon_name]) &&
242
+				! self::_meets_min_core_version_requirement(EE_Register_Addon::$_incompatible_addons[$addon_name], $addon_settings['version'])) {
243 243
 			$incompatibility_message = sprintf(
244
-				__( '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' ),
244
+				__('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'),
245 245
 				$addon_name,
246 246
 				'<br />',
247
-				EE_Register_Addon::$_incompatible_addons[ $addon_name ]
247
+				EE_Register_Addon::$_incompatible_addons[$addon_name]
248 248
 			);
249
-		} else if ( ! self::_meets_min_core_version_requirement( $setup_args[ 'min_core_version' ], espresso_version() ) ) {
249
+		} else if ( ! self::_meets_min_core_version_requirement($setup_args['min_core_version'], espresso_version())) {
250 250
 			$incompatibility_message = sprintf(
251
-				__( '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".', 'event_espresso' ),
251
+				__('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".', 'event_espresso'),
252 252
 				$addon_name,
253
-				self::_effective_version( $setup_args[ 'min_core_version' ] ),
254
-				self::_effective_version( espresso_version() ),
253
+				self::_effective_version($setup_args['min_core_version']),
254
+				self::_effective_version(espresso_version()),
255 255
 				'<br />'
256 256
 			);
257 257
 		} else {
258 258
 			$incompatibility_message = '';
259 259
 		}
260
-		if ( ! empty( $incompatibility_message ) ) {
260
+		if ( ! empty($incompatibility_message)) {
261 261
 			//remove 'activate' from the REQUEST so WP doesn't erroneously tell the user the
262 262
 			//plugin activated fine when it didn't
263
-			if( isset( $_GET[ 'activate' ]) ) {
264
-				unset( $_GET[ 'activate' ] );
263
+			if (isset($_GET['activate'])) {
264
+				unset($_GET['activate']);
265 265
 			}
266
-			if( isset( $_REQUEST[ 'activate' ] ) ){
267
-				unset( $_REQUEST[ 'activate' ] );
266
+			if (isset($_REQUEST['activate'])) {
267
+				unset($_REQUEST['activate']);
268 268
 			}
269 269
 			//and show an error message indicating the plugin didn't activate properly
270
-			EE_Error::add_error( $incompatibility_message, __FILE__, __FUNCTION__, __LINE__ );
271
-			if ( current_user_can( 'activate_plugins' )) {
272
-				require_once( ABSPATH.'wp-admin/includes/plugin.php' );
273
-				deactivate_plugins( plugin_basename( $addon_settings[ 'main_file_path' ] ), TRUE );
270
+			EE_Error::add_error($incompatibility_message, __FILE__, __FUNCTION__, __LINE__);
271
+			if (current_user_can('activate_plugins')) {
272
+				require_once(ABSPATH.'wp-admin/includes/plugin.php');
273
+				deactivate_plugins(plugin_basename($addon_settings['main_file_path']), TRUE);
274 274
 			}
275 275
 			return;
276 276
 		}
277 277
 		//this is an activation request
278
-		if( did_action( 'activate_plugin' ) ){
278
+		if (did_action('activate_plugin')) {
279 279
 			//to find if THIS is the addon that was activated,
280 280
 			//just check if we have already registered it or not
281 281
 			//(as the newly-activated addon wasn't around the first time addons were registered)
282
-			if( ! isset( self::$_settings[ $addon_name ] ) ){
283
-				self::$_settings[ $addon_name ] = $addon_settings;
282
+			if ( ! isset(self::$_settings[$addon_name])) {
283
+				self::$_settings[$addon_name] = $addon_settings;
284 284
 				$addon = self::_load_and_init_addon_class($addon_name);
285 285
 				$addon->set_activation_indicator_option();
286 286
 				//dont bother setting up the rest of the addon.
287 287
 				//we know it was just activated and the request will end soon
288 288
 			}
289 289
 			return;
290
-		}else{
290
+		} else {
291 291
 			// make sure this was called in the right place!
292
-			if ( ! did_action( 'AHEE__EE_System__load_espresso_addons' ) || did_action( 'AHEE__EE_System___detect_if_activation_or_upgrade__begin' )) {
292
+			if ( ! did_action('AHEE__EE_System__load_espresso_addons') || did_action('AHEE__EE_System___detect_if_activation_or_upgrade__begin')) {
293 293
 				EE_Error::doing_it_wrong(
294 294
 					__METHOD__,
295 295
 					sprintf(
296
-						__( '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'),
296
+						__('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'),
297 297
 						$addon_name
298 298
 					),
299 299
 					'4.3.0'
300 300
 				);
301 301
 			}
302
-			self::$_settings[ $addon_name ] = $addon_settings;
302
+			self::$_settings[$addon_name] = $addon_settings;
303 303
 		}
304 304
 		// we need cars
305
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_paths'] )) {
305
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_paths'])) {
306 306
 			// setup autoloader for single file
307
-			EEH_Autoloader::instance()->register_autoloader( self::$_settings[ $addon_name ]['autoloader_paths'] );
307
+			EEH_Autoloader::instance()->register_autoloader(self::$_settings[$addon_name]['autoloader_paths']);
308 308
 		}
309 309
 		// setup autoloaders for folders
310
-		if ( ! empty( self::$_settings[ $addon_name ]['autoloader_folders'] )) {
311
-			foreach ( self::$_settings[ $addon_name ]['autoloader_folders'] as $autoloader_folder ) {
312
-				EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $autoloader_folder );
310
+		if ( ! empty(self::$_settings[$addon_name]['autoloader_folders'])) {
311
+			foreach (self::$_settings[$addon_name]['autoloader_folders'] as $autoloader_folder) {
312
+				EEH_Autoloader::register_autoloaders_for_each_file_in_folder($autoloader_folder);
313 313
 			}
314 314
 		}
315 315
 		// register new models
316
-		if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
317
-			EE_Register_Model::register( $addon_name, array( 'model_paths' => self::$_settings[ $addon_name ]['model_paths'] , 'class_paths' => self::$_settings[ $addon_name ]['class_paths']));
316
+		if ( ! empty(self::$_settings[$addon_name]['model_paths']) || ! empty(self::$_settings[$addon_name]['class_paths'])) {
317
+			EE_Register_Model::register($addon_name, array('model_paths' => self::$_settings[$addon_name]['model_paths'], 'class_paths' => self::$_settings[$addon_name]['class_paths']));
318 318
 		}
319 319
 		// register model extensions
320
-		if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) || ! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
321
-			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']));
320
+		if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) || ! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
321
+			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']));
322 322
 		}
323 323
 		// setup DMS
324
-		if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
325
-			EE_Register_Data_Migration_Scripts::register( $addon_name, array( 'dms_paths' => self::$_settings[ $addon_name ]['dms_paths'] ));
324
+		if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
325
+			EE_Register_Data_Migration_Scripts::register($addon_name, array('dms_paths' => self::$_settings[$addon_name]['dms_paths']));
326 326
 		}
327 327
 		// if config_class is present let's register config.
328
-		if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
328
+		if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
329 329
 			EE_Register_Config::register(
330
-				self::$_settings[ $addon_name ]['config_class'],
330
+				self::$_settings[$addon_name]['config_class'],
331 331
 				array(
332
-					'config_section' => self::$_settings[ $addon_name ]['config_section'],
333
-					'config_name' => self::$_settings[ $addon_name ]['config_name']
332
+					'config_section' => self::$_settings[$addon_name]['config_section'],
333
+					'config_name' => self::$_settings[$addon_name]['config_name']
334 334
 				)
335 335
 			);
336 336
 		}
337 337
 		// register admin page
338
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
339
-			EE_Register_Admin_Page::register( $addon_name, array( 'page_path' => self::$_settings[ $addon_name ]['admin_path'] ));
338
+		if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
339
+			EE_Register_Admin_Page::register($addon_name, array('page_path' => self::$_settings[$addon_name]['admin_path']));
340 340
 
341 341
 		}
342 342
 		// add to list of modules to be registered
343
-		if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
344
-			EE_Register_Module::register( $addon_name, array( 'module_paths' => self::$_settings[ $addon_name ]['module_paths'] ));
343
+		if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
344
+			EE_Register_Module::register($addon_name, array('module_paths' => self::$_settings[$addon_name]['module_paths']));
345 345
 		}
346 346
 		// add to list of shortcodes to be registered
347
-		if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
348
-			EE_Register_Shortcode::register( $addon_name, array( 'shortcode_paths' => self::$_settings[ $addon_name ]['shortcode_paths'] ));
347
+		if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
348
+			EE_Register_Shortcode::register($addon_name, array('shortcode_paths' => self::$_settings[$addon_name]['shortcode_paths']));
349 349
 		}
350 350
 		// add to list of widgets to be registered
351
-		if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
352
-			EE_Register_Widget::register( $addon_name, array( 'widget_paths' => self::$_settings[ $addon_name ]['widget_paths'] ));
351
+		if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
352
+			EE_Register_Widget::register($addon_name, array('widget_paths' => self::$_settings[$addon_name]['widget_paths']));
353 353
 		}
354 354
 
355 355
 		//register capability related stuff.
356
-		if ( ! empty( self::$_settings[ $addon_name ]['capabilities'] ) ) {
357
-			EE_Register_Capabilities::register( $addon_name , array( 'capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps'] ) );
356
+		if ( ! empty(self::$_settings[$addon_name]['capabilities'])) {
357
+			EE_Register_Capabilities::register($addon_name, array('capabilities' => self::$_settings[$addon_name]['capabilities'], 'capability_maps' => self::$_settings[$addon_name]['capability_maps']));
358 358
 		}
359 359
 		//any message type to register?
360
-		if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
361
-				add_action( 'EE_Brewing_Regular___messages_caf', array( 'EE_Register_Addon', 'register_message_types' ) );
360
+		if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
361
+				add_action('EE_Brewing_Regular___messages_caf', array('EE_Register_Addon', 'register_message_types'));
362 362
 		}
363 363
 
364 364
 		// if plugin update engine is being used for auto-updates (not needed if PUE is not being used)
365
-		if ( ! empty( $setup_args['pue_options'] )) {
366
-			self::$_settings[ $addon_name ]['pue_options'] = array(
367
-				'pue_plugin_slug' 	=> isset( $setup_args['pue_options']['pue_plugin_slug'] ) ? (string)$setup_args['pue_options']['pue_plugin_slug'] : 'espresso_' . strtolower( $class_name ),
368
-				'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'] ),
369
-				'checkPeriod' 			=> isset( $setup_args['pue_options']['checkPeriod'] ) ? (string)$setup_args['pue_options']['checkPeriod'] : '24',
370
-				'use_wp_update'		=> isset( $setup_args['pue_options']['use_wp_update'] ) ? (string)$setup_args['pue_options']['use_wp_update'] : FALSE
365
+		if ( ! empty($setup_args['pue_options'])) {
366
+			self::$_settings[$addon_name]['pue_options'] = array(
367
+				'pue_plugin_slug' 	=> isset($setup_args['pue_options']['pue_plugin_slug']) ? (string) $setup_args['pue_options']['pue_plugin_slug'] : 'espresso_'.strtolower($class_name),
368
+				'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']),
369
+				'checkPeriod' 			=> isset($setup_args['pue_options']['checkPeriod']) ? (string) $setup_args['pue_options']['checkPeriod'] : '24',
370
+				'use_wp_update'		=> isset($setup_args['pue_options']['use_wp_update']) ? (string) $setup_args['pue_options']['use_wp_update'] : FALSE
371 371
 			);
372
-			add_action( 'AHEE__EE_System__brew_espresso__after_pue_init', array( 'EE_Register_Addon', 'load_pue_update' ));
372
+			add_action('AHEE__EE_System__brew_espresso__after_pue_init', array('EE_Register_Addon', 'load_pue_update'));
373 373
 		}
374 374
 
375 375
 		//any custom post type/ custom capabilities or default terms to register
376
-		if ( !empty( self::$_settings[$addon_name]['custom_post_types'] ) || !empty( self::$_settings[$addon_name]['custom_taxonomies'] ) ) {
377
-			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'] ) );
376
+		if ( ! empty(self::$_settings[$addon_name]['custom_post_types']) || ! empty(self::$_settings[$addon_name]['custom_taxonomies'])) {
377
+			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']));
378 378
 		}
379
-		if( ! empty( self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) ){
380
-			EE_Register_Payment_Method::register($addon_name, array( 'payment_method_paths' => self::$_settings[ $addon_name ][ 'payment_method_paths' ] ) );
379
+		if ( ! empty(self::$_settings[$addon_name]['payment_method_paths'])) {
380
+			EE_Register_Payment_Method::register($addon_name, array('payment_method_paths' => self::$_settings[$addon_name]['payment_method_paths']));
381 381
 		}
382 382
 		// load and instantiate main addon class
383 383
 		$addon = self::_load_and_init_addon_class($addon_name);
384 384
 		// call any additional admin_callback functions during load_admin_controller hook
385
-		if ( ! empty( self::$_settings[ $addon_name ]['admin_callback'] )) {
386
-			add_action( 'AHEE__EE_System__load_controllers__load_admin_controllers', array( $addon, self::$_settings[ $addon_name ]['admin_callback'] ));
385
+		if ( ! empty(self::$_settings[$addon_name]['admin_callback'])) {
386
+			add_action('AHEE__EE_System__load_controllers__load_admin_controllers', array($addon, self::$_settings[$addon_name]['admin_callback']));
387 387
 		}
388 388
 	}
389 389
 
@@ -394,22 +394,22 @@  discard block
 block discarded – undo
394 394
 	 * @param string $addon_name
395 395
 	 * @return EE_Addon
396 396
 	 */
397
-	private static function _load_and_init_addon_class($addon_name){
398
-		$addon = EE_Registry::instance()->load_addon( dirname( self::$_settings[ $addon_name ]['main_file_path'] ), self::$_settings[ $addon_name ]['class_name'] );
399
-		$addon->set_name( $addon_name );
400
-		$addon->set_plugin_slug( self::$_settings[ $addon_name ][ 'plugin_slug' ] );
401
-		$addon->set_plugin_basename( self::$_settings[ $addon_name ][ 'plugin_basename' ] );
402
-		$addon->set_main_plugin_file( self::$_settings[ $addon_name ]['main_file_path'] );
403
-		$addon->set_plugin_action_slug( self::$_settings[ $addon_name ][ 'plugin_action_slug' ] );
404
-		$addon->set_plugins_page_row( self::$_settings[ $addon_name ][ 'plugins_page_row' ] );
405
-		$addon->set_version( self::$_settings[ $addon_name ]['version'] );
406
-		$addon->set_min_core_version( self::_effective_version( self::$_settings[ $addon_name ]['min_core_version'] ) );
407
-		$addon->set_config_section( self::$_settings[ $addon_name ]['config_section'] );
408
-		$addon->set_config_class( self::$_settings[ $addon_name ]['config_class'] );
409
-		$addon->set_config_name( self::$_settings[ $addon_name ]['config_name'] );
397
+	private static function _load_and_init_addon_class($addon_name) {
398
+		$addon = EE_Registry::instance()->load_addon(dirname(self::$_settings[$addon_name]['main_file_path']), self::$_settings[$addon_name]['class_name']);
399
+		$addon->set_name($addon_name);
400
+		$addon->set_plugin_slug(self::$_settings[$addon_name]['plugin_slug']);
401
+		$addon->set_plugin_basename(self::$_settings[$addon_name]['plugin_basename']);
402
+		$addon->set_main_plugin_file(self::$_settings[$addon_name]['main_file_path']);
403
+		$addon->set_plugin_action_slug(self::$_settings[$addon_name]['plugin_action_slug']);
404
+		$addon->set_plugins_page_row(self::$_settings[$addon_name]['plugins_page_row']);
405
+		$addon->set_version(self::$_settings[$addon_name]['version']);
406
+		$addon->set_min_core_version(self::_effective_version(self::$_settings[$addon_name]['min_core_version']));
407
+		$addon->set_config_section(self::$_settings[$addon_name]['config_section']);
408
+		$addon->set_config_class(self::$_settings[$addon_name]['config_class']);
409
+		$addon->set_config_name(self::$_settings[$addon_name]['config_name']);
410 410
 		//unfortunately this can't be hooked in upon construction, because we don't have
411 411
 		//the plugin mainfile's path upon construction.
412
-		register_deactivation_hook($addon->get_main_plugin_file(), array($addon,'deactivation'));
412
+		register_deactivation_hook($addon->get_main_plugin_file(), array($addon, 'deactivation'));
413 413
 		return $addon;
414 414
 	}
415 415
 
@@ -422,18 +422,18 @@  discard block
 block discarded – undo
422 422
 	 */
423 423
 	public static function load_pue_update() {
424 424
 		// load PUE client
425
-		require_once  EE_THIRD_PARTY . 'pue' . DS . 'pue-client.php';
425
+		require_once  EE_THIRD_PARTY.'pue'.DS.'pue-client.php';
426 426
 		// cycle thru settings
427
-		foreach ( self::$_settings as $settings ) {
428
-			if ( ! empty( $settings['pue_options'] )) {
427
+		foreach (self::$_settings as $settings) {
428
+			if ( ! empty($settings['pue_options'])) {
429 429
 				// initiate the class and start the plugin update engine!
430 430
 				new PluginUpdateEngineChecker(
431 431
 				// host file URL
432 432
 					'http://eventespresso.com',
433 433
 					// plugin slug(s)
434 434
 					array(
435
-						'premium' => array( 'p' => $settings['pue_options']['pue_plugin_slug'] ),
436
-						'prerelease' => array( 'beta' => $settings['pue_options']['pue_plugin_slug'] . '-pr' )
435
+						'premium' => array('p' => $settings['pue_options']['pue_plugin_slug']),
436
+						'prerelease' => array('beta' => $settings['pue_options']['pue_plugin_slug'].'-pr')
437 437
 					),
438 438
 					// options
439 439
 					array(
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 	 * @return void
462 462
 	 */
463 463
 	public static function register_message_types() {
464
-		foreach ( self::$_settings as $settings ) {
465
-			foreach( $settings['message_types'] as $message_type => $message_type_settings ) {
466
-				EE_Register_Message_Type::register( $message_type, $message_type_settings );
464
+		foreach (self::$_settings as $settings) {
465
+			foreach ($settings['message_types'] as $message_type => $message_type_settings) {
466
+				EE_Register_Message_Type::register($message_type, $message_type_settings);
467 467
 			}
468 468
 		}
469 469
 	}
@@ -479,60 +479,60 @@  discard block
 block discarded – undo
479 479
 	 * @throws EE_Error
480 480
 	 * @return void
481 481
 	 */
482
-	public static function deregister( $addon_name = NULL ) {
483
-		if ( isset( self::$_settings[ $addon_name ] )) {
484
-			$class_name = self::$_settings[ $addon_name ]['class_name'];
485
-			if ( ! empty( self::$_settings[ $addon_name ]['dms_paths'] )) {
482
+	public static function deregister($addon_name = NULL) {
483
+		if (isset(self::$_settings[$addon_name])) {
484
+			$class_name = self::$_settings[$addon_name]['class_name'];
485
+			if ( ! empty(self::$_settings[$addon_name]['dms_paths'])) {
486 486
 				// setup DMS
487
-				EE_Register_Data_Migration_Scripts::deregister( $addon_name );
487
+				EE_Register_Data_Migration_Scripts::deregister($addon_name);
488 488
 			}
489
-			if ( ! empty( self::$_settings[ $addon_name ]['admin_path'] )) {
489
+			if ( ! empty(self::$_settings[$addon_name]['admin_path'])) {
490 490
 				// register admin page
491
-				EE_Register_Admin_Page::deregister( $addon_name );
491
+				EE_Register_Admin_Page::deregister($addon_name);
492 492
 			}
493
-			if ( ! empty( self::$_settings[ $addon_name ]['module_paths'] )) {
493
+			if ( ! empty(self::$_settings[$addon_name]['module_paths'])) {
494 494
 				// add to list of modules to be registered
495
-				EE_Register_Module::deregister( $addon_name );
495
+				EE_Register_Module::deregister($addon_name);
496 496
 			}
497
-			if ( ! empty( self::$_settings[ $addon_name ]['shortcode_paths'] )) {
497
+			if ( ! empty(self::$_settings[$addon_name]['shortcode_paths'])) {
498 498
 				// add to list of shortcodes to be registered
499
-				EE_Register_Shortcode::deregister( $addon_name );
499
+				EE_Register_Shortcode::deregister($addon_name);
500 500
 			}
501
-			if ( ! empty( self::$_settings[ $addon_name ]['config_class'] )) {
501
+			if ( ! empty(self::$_settings[$addon_name]['config_class'])) {
502 502
 				// if config_class present let's register config.
503
-				EE_Register_Config::deregister( self::$_settings[ $addon_name ]['config_class']);
503
+				EE_Register_Config::deregister(self::$_settings[$addon_name]['config_class']);
504 504
 			}
505
-			if ( ! empty( self::$_settings[ $addon_name ]['widget_paths'] )) {
505
+			if ( ! empty(self::$_settings[$addon_name]['widget_paths'])) {
506 506
 				// add to list of widgets to be registered
507
-				EE_Register_Widget::deregister( $addon_name );
507
+				EE_Register_Widget::deregister($addon_name);
508 508
 			}
509
-			if ( ! empty( self::$_settings[ $addon_name ]['model_paths'] ) ||
510
-					! empty( self::$_settings[ $addon_name ]['class_paths'] )) {
509
+			if ( ! empty(self::$_settings[$addon_name]['model_paths']) ||
510
+					! empty(self::$_settings[$addon_name]['class_paths'])) {
511 511
 				// add to list of shortcodes to be registered
512
-				EE_Register_Model::deregister( $addon_name );
512
+				EE_Register_Model::deregister($addon_name);
513 513
 			}
514
-			if ( ! empty( self::$_settings[ $addon_name ]['model_extension_paths'] ) ||
515
-					! empty( self::$_settings[ $addon_name ]['class_extension_paths'] )) {
514
+			if ( ! empty(self::$_settings[$addon_name]['model_extension_paths']) ||
515
+					! empty(self::$_settings[$addon_name]['class_extension_paths'])) {
516 516
 				// add to list of shortcodes to be registered
517
-				EE_Register_Model_Extensions::deregister( $addon_name );
517
+				EE_Register_Model_Extensions::deregister($addon_name);
518 518
 				}
519
-			if (  !empty( self::$_settings[$addon_name]['message_types'] ) ) {
520
-				foreach( self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings ) {
521
-					EE_Register_Message_Type::deregister( $message_type );
519
+			if ( ! empty(self::$_settings[$addon_name]['message_types'])) {
520
+				foreach (self::$_settings[$addon_name]['message_types'] as $message_type => $message_type_settings) {
521
+					EE_Register_Message_Type::deregister($message_type);
522 522
 				}
523 523
 			}
524 524
 			//deregister capabilities for addon
525
-			if ( ! empty( self::$_settings[$addon_name]['capabilities'] ) || ! empty( self::$_settings[$addon_name]['capability_maps']) ) {
526
-				EE_Register_Capabilities::deregister( $addon_name );
525
+			if ( ! empty(self::$_settings[$addon_name]['capabilities']) || ! empty(self::$_settings[$addon_name]['capability_maps'])) {
526
+				EE_Register_Capabilities::deregister($addon_name);
527 527
 			}
528 528
 			//deregister custom_post_types for addon
529
-			if ( ! empty( self::$_settings[$addon_name]['custom_post_types'] ) ) {
530
-				EE_Register_CPT::deregister( $addon_name );
529
+			if ( ! empty(self::$_settings[$addon_name]['custom_post_types'])) {
530
+				EE_Register_CPT::deregister($addon_name);
531 531
 			}
532
-			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(),  array( EE_Registry::instance()->addons->$class_name, 'deactivation' ) );
533
-			remove_action( 'AHEE__EE_System__perform_activations_upgrades_and_migrations', array( EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required' ) );
532
+			remove_action('deactivate_'.EE_Registry::instance()->addons->$class_name->get_main_plugin_file_basename(), array(EE_Registry::instance()->addons->$class_name, 'deactivation'));
533
+			remove_action('AHEE__EE_System__perform_activations_upgrades_and_migrations', array(EE_Registry::instance()->addons->$class_name, 'initialize_db_if_no_migrations_required'));
534 534
 			unset(EE_Registry::instance()->addons->$class_name);
535
-			unset( self::$_settings[ $addon_name ] );
535
+			unset(self::$_settings[$addon_name]);
536 536
 		}
537 537
 	}
538 538
 
Please login to merge, or discard this patch.
core/libraries/shortcodes/EE_Event_Shortcodes.lib.php 1 patch
Spacing   +32 added lines, -32 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
 /**
@@ -56,34 +56,34 @@  discard block
 block discarded – undo
56 56
 			'[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'),
57 57
 			'[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'),
58 58
 			'[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'),
59
-			'[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ),
59
+			'[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'),
60 60
 			'[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'),
61 61
 			'[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'),
62 62
 			'[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'),
63 63
 			'[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'),
64 64
 			'[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'),
65 65
 			'[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf(
66
-				__( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ),
66
+				__('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event.  There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode).  %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'),
67 67
 				'<code>',
68 68
 				'</code>'
69 69
 				),
70
-			'[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ),
70
+			'[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'),
71 71
 			'[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'),
72 72
 			'[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'),
73 73
 			'[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'),
74
-			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ),
74
+			'[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'),
75 75
 			);
76 76
 	}
77 77
 
78 78
 
79
-	protected function _parser( $shortcode ) {
79
+	protected function _parser($shortcode) {
80 80
 
81
-		EE_Registry::instance()->load_helper( 'Formatter' );
81
+		EE_Registry::instance()->load_helper('Formatter');
82 82
 
83 83
 		$this->_event = $this->_data instanceof EE_Event ? $this->_data : null;
84 84
 
85 85
 		//if no event, then let's see if there is a reg_obj.  If there IS, then we'll try and grab the event from the reg_obj instead.
86
-		if ( empty( $this->_event ) ) {
86
+		if (empty($this->_event)) {
87 87
 			$aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL;
88 88
 			$aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee;
89 89
 
@@ -92,17 +92,17 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 		//If there is no event objecdt by now then get out.
95
-		if ( ! $this->_event instanceof EE_Event )
95
+		if ( ! $this->_event instanceof EE_Event)
96 96
 			return '';
97 97
 
98
-		switch ( $shortcode ) {
98
+		switch ($shortcode) {
99 99
 
100 100
 			case '[EVENT_ID]' :
101 101
 				return $this->_event->ID();
102 102
 				break;
103 103
 
104 104
 			case '[EVENT_IDENTIFIER]' :
105
-				return isset($this->_data['line_ref']) ? $this->_data['line_ref']: '';
105
+				return isset($this->_data['line_ref']) ? $this->_data['line_ref'] : '';
106 106
 				break;
107 107
 
108 108
 			case '[EVENT]' :
@@ -132,71 +132,71 @@  discard block
 block discarded – undo
132 132
 
133 133
 			case '[VIRTUAL_URL]' :
134 134
 				$venue = $this->_event->get_first_related('Venue');
135
-				if ( empty( $venue ) )
135
+				if (empty($venue))
136 136
 					return '';
137 137
 				return $venue->get('VNU_virtual_url');
138 138
 
139 139
 			case '[VIRTUAL_PHONE]' :
140 140
 				$venue = $this->_event->get_first_related('Venue');
141
-				if ( empty( $venue ) )
141
+				if (empty($venue))
142 142
 					return '';
143 143
 				return $venue->get('VNU_virtual_phone');
144 144
 				break;
145 145
 
146 146
 			case '[EVENT_IMAGE]' :
147
-				$image = $this->_event->feature_image_url(array(600,300) );
147
+				$image = $this->_event->feature_image_url(array(600, 300));
148 148
 				// @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned.
149
-				return !empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : '';
149
+				return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : '';
150 150
 				break;
151 151
 
152 152
 			case '[EVENT_FACEBOOK_URL]' :
153
-				$facebook_url = $this->_event->get_post_meta('event_facebook', true );
154
-				return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url;
153
+				$facebook_url = $this->_event->get_post_meta('event_facebook', true);
154
+				return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url;
155 155
 				break;
156 156
 
157 157
 			case '[EVENT_TWITTER_URL]' :
158 158
 				$twitter_url = $this->_event->get_post_meta('event_twitter', true);
159
-				return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url;
159
+				return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url;
160 160
 				break;
161 161
 
162 162
 			case '[EVENT_AUTHOR_EMAIL]' :
163 163
 				$author_id = $this->_event->get('EVT_wp_user');
164
-				$user_data = get_userdata( (int) $author_id );
164
+				$user_data = get_userdata((int) $author_id);
165 165
 				return $user_data->user_email;
166 166
 				break;
167 167
 
168 168
 			case '[EVENT_TOTAL_SPOTS_TAKEN]' :
169
-				return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true );
169
+				return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true);
170 170
 				break;
171 171
 
172 172
 			case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' :
173
-				EE_Registry::instance()->load_helper( 'URL' );
173
+				EE_Registry::instance()->load_helper('URL');
174 174
 				return EEH_URL::add_query_args_and_nonce(
175 175
 					array(
176 176
 						'event_id' => $this->_event->ID(),
177 177
 						'page' => 'espresso_registrations',
178 178
 						'action' => 'default'
179 179
 					),
180
-					admin_url( 'admin.php' ),
180
+					admin_url('admin.php'),
181 181
 					true
182 182
 				);
183 183
 				break;
184 184
 		}
185 185
 
186
-		if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) {
187
-			$shortcode = str_replace( '[EVENT_META_*', '', $shortcode );
188
-			$shortcode = trim( str_replace( ']', '', $shortcode ) );
186
+		if (strpos($shortcode, '[EVENT_META_*') !== false) {
187
+			$shortcode = str_replace('[EVENT_META_*', '', $shortcode);
188
+			$shortcode = trim(str_replace(']', '', $shortcode));
189 189
 
190 190
 			//pull the meta value from the event post
191
-			$event_meta = $this->_event->get_post_meta( $shortcode, true );
191
+			$event_meta = $this->_event->get_post_meta($shortcode, true);
192 192
 
193
-			return !empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : '';
193
+			return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : '';
194 194
 
195 195
 		}
196 196
 
197
-		if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) {
198
-			$attrs = $this->_get_shortcode_attrs( $shortcode );
199
-			$method = empty( $attrs['method'] ) ? 'current' : $attrs['method'];
197
+		if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) {
198
+			$attrs = $this->_get_shortcode_attrs($shortcode);
199
+			$method = empty($attrs['method']) ? 'current' : $attrs['method'];
200 200
 			$method = $method === 'current';
201 201
 			$available = $this->_event->total_available_spaces($method);
202 202
 			return $available === INF ? '&infin;' : $available;
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @param  boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event.  Otherwise we just return the url of the event.
213 213
 	 * @return string
214 214
 	 */
215
-	private function _get_event_link( $event, $full_link = TRUE ) {
215
+	private function _get_event_link($event, $full_link = TRUE) {
216 216
 		$url = get_permalink($event->ID());
217 217
 
218
-		return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url;
218
+		return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url;
219 219
 	}
220 220
 
221 221
 
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @return EED_Bot_Trap
19 19
 	 */
20 20
 	public static function instance() {
21
-		return parent::get_instance( __CLASS__ );
21
+		return parent::get_instance(__CLASS__);
22 22
 	}
23 23
 
24 24
 
@@ -31,22 +31,22 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public static function set_hooks() {
33 33
 		if (
34
-			apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) &&
34
+			apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35 35
 			EE_Registry::instance()->CFG->registration->use_bot_trap
36 36
 		) {
37
-			define( 'EE_BOT_TRAP_BASE_URL', plugin_dir_url( __FILE__ ) . DS );
37
+			define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
38 38
 			add_action(
39 39
 				'AHEE__ticket_selector_chart__template__after_ticket_selector',
40
-				array( 'EED_Bot_Trap', 'generate_bot_trap' ),
40
+				array('EED_Bot_Trap', 'generate_bot_trap'),
41 41
 				10, 2
42 42
 			);
43 43
 			add_action(
44 44
 				'EED_Ticket_Selector__process_ticket_selections__before',
45
-				array( 'EED_Bot_Trap', 'process_bot_trap' ),
45
+				array('EED_Bot_Trap', 'process_bot_trap'),
46 46
 				1, 2
47 47
 			);
48 48
 			// redirect bots to bogus success page
49
-			EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' );
49
+			EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
50 50
 		}
51 51
 	}
52 52
 
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	public static function set_hooks_admin() {
62 62
 		add_action(
63 63
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
64
-			array( 'EED_Bot_Trap', 'bot_trap_settings_form' ),
64
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
65 65
 			10
66 66
 		);
67 67
 		add_filter(
68 68
 			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
69
-			array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ),
69
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
70 70
 			10, 1
71 71
 		);
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param    WP $WP
81 81
 	 * @return    void
82 82
 	 */
83
-	public function run( $WP ) {}
83
+	public function run($WP) {}
84 84
 
85 85
 
86 86
 
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	 * @return    void
92 92
 	 */
93 93
 	public static function generate_bot_trap() {
94
-		$do_not_enter = __( 'please do not enter anything in this input', 'event_espresso' );
94
+		$do_not_enter = __('please do not enter anything in this input', 'event_espresso');
95 95
 		$html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">';
96
-		$html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter  . '</label>';
96
+		$html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>';
97 97
 		$html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>';
98 98
 		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
99
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
100
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
101
-			$html .= EE_Encryption::instance()->encrypt( time() );
99
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
100
+			EE_Registry::instance()->load_core('EE_Encryption');
101
+			$html .= EE_Encryption::instance()->encrypt(time());
102 102
 		} else {
103 103
 			$html .= time();
104 104
 		}
@@ -117,35 +117,35 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public static function process_bot_trap() {
119 119
 		// what's your email address Mr. Bot ?
120
-		$empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) && $_REQUEST[ 'tkt-slctr-request-processor-email' ] == '' ? true : false;
120
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) && $_REQUEST['tkt-slctr-request-processor-email'] == '' ? true : false;
121 121
 		// get encrypted timestamp for when the form was originally displayed
122
-		$bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) : '';
122
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) : '';
123 123
 		// decrypt and convert to absolute  integer
124
-		if ( EE_Registry::instance()->CFG->registration->use_encryption ) {
125
-			EE_Registry::instance()->load_core( 'EE_Encryption' );
126
-			$bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) );
124
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
125
+			EE_Registry::instance()->load_core('EE_Encryption');
126
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
127 127
 		} else {
128
-			$bot_trap_timestamp = absint( $bot_trap_timestamp );
128
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
129 129
 		}
130 130
 		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
131
-		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) ? true : false;
131
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) ? true : false;
132 132
 		// are we human ?
133
-		if ( $empty_trap && ! $suspicious_timing ) {
133
+		if ($empty_trap && ! $suspicious_timing) {
134 134
 			return;
135 135
 		}
136 136
 		// UH OH...
137 137
 		$redirect_url = add_query_arg(
138
-			array( 'ee' => 'ticket_selection_received' ),
138
+			array('ee' => 'ticket_selection_received'),
139 139
 			EE_Registry::instance()->CFG->core->reg_page_url()
140 140
 		);
141
-		if ( $suspicious_timing ) {
141
+		if ($suspicious_timing) {
142 142
 			$redirect_url = add_query_arg(
143
-				array( 'ee-notice' => urlencode( __( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ),
143
+				array('ee-notice' => urlencode(__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))),
144 144
 				$redirect_url
145 145
 			);
146 146
 		}
147 147
 		wp_safe_redirect(
148
-			apply_filters( 'FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url )
148
+			apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url)
149 149
 		);
150 150
 		exit();
151 151
 	}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 * @return    void
161 161
 	 */
162 162
 	public static function display_bot_trap_success() {
163
-		EE_Registry::instance()->load_helper( 'HTML' );
164
-		add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' );
165
-		$bot_notice = __( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' );
166
-		$bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice;
167
-		EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) );
163
+		EE_Registry::instance()->load_helper('HTML');
164
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
165
+		$bot_notice = __('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso');
166
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice;
167
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
168 168
 	}
169 169
 
170 170
 
@@ -198,20 +198,20 @@  discard block
 block discarded – undo
198 198
 				'html_id'         			=> 'bot_trap_settings',
199 199
 				'layout_strategy' 	=> new EE_Admin_Two_Column_Layout(),
200 200
 				'subsections'     		=> array(
201
-					'bot_trap_hdr' 		=> new EE_Form_Section_HTML( EEH_HTML::h2( __( 'Bot Trap Settings', 'event_espresso' ) ) ),
201
+					'bot_trap_hdr' 		=> new EE_Form_Section_HTML(EEH_HTML::h2(__('Bot Trap Settings', 'event_espresso'))),
202 202
 					'use_bot_trap' 		=> new EE_Yes_No_Input(
203 203
 						array(
204
-							'html_label_text' 	=> __( 'Enable Bot Trap', 'event_espresso' ),
205
-							'html_help_text' 		=>  __( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ),
206
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
204
+							'html_label_text' 	=> __('Enable Bot Trap', 'event_espresso'),
205
+							'html_help_text' 		=>  __('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'),
206
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true,
207 207
 							'required'        		=> false
208 208
 						)
209 209
 					),
210 210
 					'use_encryption' 		=> new EE_Yes_No_Input(
211 211
 						array(
212
-							'html_label_text' 	=> __( 'Encrypt Bot Trap Data', 'event_espresso' ),
213
-							'html_help_text' 		=>  __( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ),
214
-							'default'        			=> isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
212
+							'html_label_text' 	=> __('Encrypt Bot Trap Data', 'event_espresso'),
213
+							'html_help_text' 		=>  __('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'),
214
+							'default'        			=> isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true,
215 215
 							'required'        		=> false
216 216
 						)
217 217
 					),
@@ -229,30 +229,30 @@  discard block
 block discarded – undo
229 229
 	 * @param \EE_Registration_Config $EE_Registration_Config
230 230
 	 * @return \EE_Registration_Config
231 231
 	 */
232
-	public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) {
232
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) {
233 233
 		try {
234 234
 			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
235 235
 			// if not displaying a form, then check for form submission
236
-			if ( $bot_trap_settings_form->was_submitted() ) {
236
+			if ($bot_trap_settings_form->was_submitted()) {
237 237
 				// capture form data
238 238
 				$bot_trap_settings_form->receive_form_submission();
239 239
 				// validate form data
240
-				if ( $bot_trap_settings_form->is_valid() ) {
240
+				if ($bot_trap_settings_form->is_valid()) {
241 241
 					// grab validated data from form
242 242
 					$valid_data = $bot_trap_settings_form->valid_data();
243
-					if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) {
244
-						$EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ];
245
-						$EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ];
243
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
244
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
245
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
246 246
 					} else {
247
-						EE_Error::add_error( __( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
247
+						EE_Error::add_error(__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
248 248
 					}
249 249
 				} else {
250
-					if ( $bot_trap_settings_form->submission_error_message() != '' ) {
251
-						EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ );
250
+					if ($bot_trap_settings_form->submission_error_message() != '') {
251
+						EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__);
252 252
 					}
253 253
 				}
254 254
 			}
255
-		} catch ( EE_Error $e ) {
255
+		} catch (EE_Error $e) {
256 256
 			$e->get_error();
257 257
 		}
258 258
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/Invoice.class.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -21,23 +21,23 @@  discard block
 block discarded – undo
21 21
 	private $EE;
22 22
 	public function __construct($url_link = 0) {
23 23
 
24
-		if ( $this->registration = EE_Registry::instance()->load_model( 'Registration' )->get_registration_for_reg_url_link( $url_link)) {
24
+		if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) {
25 25
 			$this->transaction = $this->registration->transaction();
26 26
 
27
-			$payment_settings = EE_Config::instance()->gateway->payment_settings;//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
28
-			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' );
27
+			$payment_settings = EE_Config::instance()->gateway->payment_settings; //get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE);
28
+			$this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice');
29 29
 		} else {
30
-			EE_Error::add_error( __( 'Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
30
+			EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
31 31
 		}
32 32
 
33 33
 	}
34 34
 
35
-	public function send_invoice( $download = FALSE ) {
35
+	public function send_invoice($download = FALSE) {
36 36
 		$template_args = array();
37 37
 		$EE = EE_Registry::instance();
38 38
 
39 39
 		//allow the request to override the default theme defined in the invoice settings
40
-		$theme_requested = ( isset( $_REQUEST['theme'] ) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ) ? absint( $_REQUEST['theme'] ) : null;
40
+		$theme_requested = (isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8) ? absint($_REQUEST['theme']) : null;
41 41
 		$themes = array(
42 42
 										1 => "simple.css",
43 43
 										2 => "bauhaus.css",
@@ -48,26 +48,26 @@  discard block
 block discarded – undo
48 48
 										7 => "union.css"
49 49
 									);
50 50
 		//Get the CSS file
51
-		if( isset( $themes[ $theme_requested ] ) ) {
52
-			$template_args['invoice_css'] = $themes[ $theme_requested ];
53
-		}else{
54
-			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' );
51
+		if (isset($themes[$theme_requested])) {
52
+			$template_args['invoice_css'] = $themes[$theme_requested];
53
+		} else {
54
+			$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css');
55 55
 		}
56 56
 
57
-		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) {
58
-			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/';
57
+		if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) {
58
+			$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/';
59 59
 		} else {
60
-			$template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/';
60
+			$template_args['base_url'] = EE_GATEWAYS.'/Invoice/lib/templates/';
61 61
 		}
62 62
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
63 63
 
64
-		$template_args['organization'] = $EE->CFG->organization->get_pretty( 'name' );
65
-		$template_args['street'] = empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' );
66
-		$template_args['city'] = $EE->CFG->organization->get_pretty( 'city' );
67
-		$template_args['state'] = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
68
-		$template_args['country'] = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $EE->CFG->organization->CNT_ISO );
69
-		$template_args['zip'] = $EE->CFG->organization->get_pretty( 'zip' );
70
-		$template_args['email'] = $EE->CFG->organization->get_pretty( 'email' );
64
+		$template_args['organization'] = $EE->CFG->organization->get_pretty('name');
65
+		$template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2');
66
+		$template_args['city'] = $EE->CFG->organization->get_pretty('city');
67
+		$template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
68
+		$template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO);
69
+		$template_args['zip'] = $EE->CFG->organization->get_pretty('zip');
70
+		$template_args['email'] = $EE->CFG->organization->get_pretty('email');
71 71
 
72 72
 		$template_args['registration_code'] = $this->registration->reg_code();
73 73
 		$template_args['registration_date'] = $this->registration->date();
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
 		$template_args['attendee_address2'] = $primary_attendee->address2();
77 77
 		$template_args['attendee_city'] = $primary_attendee->city();
78 78
 		$attendee_state = $primary_attendee->state_obj();
79
-		if($attendee_state){
79
+		if ($attendee_state) {
80 80
 			$attendee_state_name = $attendee_state->name();
81
-		}else{
81
+		} else {
82 82
 			$attendee_state_name = '';
83 83
 		}
84 84
 		$template_args['attendee_state'] = $attendee_state_name;
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 		if ($template_args['amount_pd'] != $template_args['total_cost']) {
103 103
 			//$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']);
104 104
 			$tax_items = $this->transaction->tax_items();
105
-			if(!empty($tax_items) ){
105
+			if ( ! empty($tax_items)) {
106 106
 				foreach ($tax_items as $tax) {
107
-					$template_args['net_total'] .= $this->espressoInvoiceTotals( $tax->name(), $tax->total());
107
+					$template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total());
108 108
 				}
109 109
 			}
110 110
 
@@ -114,30 +114,30 @@  discard block
 block discarded – undo
114 114
 			} else {
115 115
 				$text = __('Extra', 'event_espresso');
116 116
 			}
117
-			$template_args['discount'] = $this->espressoInvoiceTotals( $text, $difference );
117
+			$template_args['discount'] = $this->espressoInvoiceTotals($text, $difference);
118 118
 		}
119 119
 
120 120
 		$template_args['currency_symbol'] = $EE->CFG->currency->sign;
121
-		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), ENT_QUOTES)));
122
-		$template_args['shameless_plug'] = apply_filters( 'FHEE_Invoice__send_invoice__shameless_plug',true );
123
-		if(isset($_GET['receipt'])){
121
+		$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES)));
122
+		$template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true);
123
+		if (isset($_GET['receipt'])) {
124 124
 			//receipt-specific stuff
125 125
 			$events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID'=>$this->transaction->ID())));
126 126
 			$ticket_line_items_per_event = array();
127 127
 			$registrations_per_line_item = array();
128 128
 			$venues_for_events = array();
129
-			foreach($events_for_txn as $event_id => $event){
130
-				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id,'TXN_ID'=>$this->transaction->ID())));
129
+			foreach ($events_for_txn as $event_id => $event) {
130
+				$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id, 'TXN_ID'=>$this->transaction->ID())));
131 131
 				$ticket_line_items_per_event[$event_id] = $line_items_for_this_event;
132
-				foreach($line_items_for_this_event as $line_item_id => $line_item){
132
+				foreach ($line_items_for_this_event as $line_item_id => $line_item) {
133 133
 					$ticket = $line_item->ticket();
134
-					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(),'TXN_ID'=>$this->transaction->ID())));
134
+					$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(), 'TXN_ID'=>$this->transaction->ID())));
135 135
 					$registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket;
136 136
 				}
137 137
 				$venues_for_events = array_merge($venues_for_events, $event->venues());
138 138
 			}
139
-			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(),'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
140
-			$questions_to_skip = array(EEM_Attendee::system_question_fname,EEM_Attendee::system_question_lname,  EEM_Attendee::system_question_email);
139
+			$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(), 'LIN_type'=>  EEM_Line_Item::type_tax_sub_total)));
140
+			$questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email);
141 141
 
142 142
 
143 143
 			$template_args['events_for_txn'] = $events_for_txn;
@@ -146,10 +146,10 @@  discard block
 block discarded – undo
146 146
 			$template_args['venues_for_events'] = $venues_for_events;
147 147
 			$template_args['tax_total_line_item'] = $tax_total_line_item;
148 148
 			$template_args['questions_to_skip'] = $questions_to_skip;
149
-			$EE->load_helper( 'Venue_View' );
149
+			$EE->load_helper('Venue_View');
150 150
 //			d($template_args);
151 151
 			$template_args['download_link'] = $this->registration->receipt_url('download');
152
-		}else{
152
+		} else {
153 153
 			//it's just an invoice we're accessing
154 154
 			$template_args['download_link'] = $this->registration->invoice_url('download');
155 155
 		}
@@ -157,51 +157,51 @@  discard block
 block discarded – undo
157 157
 
158 158
 
159 159
 		//require helpers
160
-		$EE->load_helper( 'Formatter' );
160
+		$EE->load_helper('Formatter');
161 161
 
162 162
 		//Get the HTML as an object
163 163
 		EE_Registry::instance()->load_helper('Template');
164 164
 		$templates_relative_path = 'modules/gateways/Invoice/lib/templates/';
165
-		$template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE );
166
-		if(isset($_GET['receipt'])){
167
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE );
168
-		}else{
169
-			$template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE );
165
+		$template_header = EEH_Template::locate_template($templates_relative_path.'invoice_header.template.php', $template_args, TRUE, TRUE);
166
+		if (isset($_GET['receipt'])) {
167
+			$template_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', $template_args, TRUE, TRUE);
168
+		} else {
169
+			$template_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', $template_args, TRUE, TRUE);
170 170
 		}
171 171
 
172 172
 
173
-		$template_footer = EEH_Template::locate_template( $templates_relative_path . 'invoice_footer.template.php', $template_args, TRUE, TRUE );
173
+		$template_footer = EEH_Template::locate_template($templates_relative_path.'invoice_footer.template.php', $template_args, TRUE, TRUE);
174 174
 
175
-		$copies =  ! empty( $_REQUEST['copies'] ) ? $_REQUEST['copies'] : 1;
175
+		$copies = ! empty($_REQUEST['copies']) ? $_REQUEST['copies'] : 1;
176 176
 
177 177
 		$content = $this->espresso_replace_invoice_shortcodes($template_header);
178
-		for( $x = 1; $x <= $copies; $x++ ) {
178
+		for ($x = 1; $x <= $copies; $x++) {
179 179
 			$content .= $this->espresso_replace_invoice_shortcodes($template_body);
180 180
 		}
181 181
 		$content .= $this->espresso_replace_invoice_shortcodes($template_footer);
182 182
 
183 183
 		//Check if debugging or mobile is set
184
-		if (!empty($_REQUEST['html'])) {
184
+		if ( ! empty($_REQUEST['html'])) {
185 185
 			echo $content;
186 186
 			exit(0);
187 187
 		}
188
-		$invoice_name = $template_args['organization'] . ' ' . __('Invoice #', 'event_espresso') . $template_args['registration_code'] . __(' for ', 'event_espresso') . $template_args['name'];
189
-		$invoice_name = str_replace( ' ', '_', $invoice_name );
188
+		$invoice_name = $template_args['organization'].' '.__('Invoice #', 'event_espresso').$template_args['registration_code'].__(' for ', 'event_espresso').$template_args['name'];
189
+		$invoice_name = str_replace(' ', '_', $invoice_name);
190 190
 		//Create the PDF
191
-		if(array_key_exists('html',$_GET)){
191
+		if (array_key_exists('html', $_GET)) {
192 192
 			echo $content;
193
-		}else{
193
+		} else {
194 194
 			//only load dompdf if nobody else has yet...
195
-			if( ! defined('DOMPDF_DIR')){
195
+			if ( ! defined('DOMPDF_DIR')) {
196 196
 				define('DOMPDF_ENABLE_REMOTE', TRUE);
197 197
 				define('DOMPDF_ENABLE_JAVASCRIPT', FALSE);
198 198
 				define('DOMPDF_ENABLE_CSS_FLOAT', TRUE);
199
-				require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php');
199
+				require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php');
200 200
 			}
201 201
 			$dompdf = new DOMPDF();
202 202
 			$dompdf->load_html($content);
203 203
 			$dompdf->render();
204
-			$dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => $download ));
204
+			$dompdf->stream($invoice_name.".pdf", array('Attachment' => $download));
205 205
 		}
206 206
 		exit(0);
207 207
 	}
@@ -211,12 +211,12 @@  discard block
 block discarded – undo
211 211
 	 * @param EE_Line_Item $line_item
212 212
 	 * @return boolean
213 213
 	 */
214
-	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){
215
-		if($line_item->desc()){
214
+	function check_if_any_line_items_have_a_description(EE_Line_Item $line_item) {
215
+		if ($line_item->desc()) {
216 216
 			return true;
217
-		}else{
218
-			foreach($line_item->children() as $child_line_item){
219
-				if($this->check_if_any_line_items_have_a_description($child_line_item)){
217
+		} else {
218
+			foreach ($line_item->children() as $child_line_item) {
219
+				if ($this->check_if_any_line_items_have_a_description($child_line_item)) {
220 220
 					return true;
221 221
 				}
222 222
 			}
@@ -226,14 +226,14 @@  discard block
 block discarded – undo
226 226
 	}
227 227
 
228 228
 //Perform the shortcode replacement
229
-	function espresso_replace_invoice_shortcodes( $content ) {
229
+	function espresso_replace_invoice_shortcodes($content) {
230 230
 
231 231
 		$EE = EE_Registry::instance();
232 232
 		//Create the logo
233
-		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE,  $EE->CFG->organization->logo_url );
234
-		if (!empty($invoice_logo_url)) {
233
+		$invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url);
234
+		if ( ! empty($invoice_logo_url)) {
235 235
 			$image_size = getimagesize($invoice_logo_url);
236
-			$invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> ';
236
+			$invoice_logo_image = '<img class="logo screen" src="'.$invoice_logo_url.'" '.$image_size[3].' alt="logo" /> ';
237 237
 		} else {
238 238
 			$invoice_logo_image = '';
239 239
 		}
@@ -255,28 +255,28 @@  discard block
 block discarded – undo
255 255
 				"[instructions]",
256 256
 		);
257 257
 		$primary_attendee = $this->transaction->primary_registration()->attendee();
258
-		$org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID );
259
-		if($org_state){
258
+		$org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
259
+		if ($org_state) {
260 260
 			$org_state_name = $org_state->name();
261
-		}else{
261
+		} else {
262 262
 			$org_state_name = '';
263 263
 		}
264 264
 		$ReplaceValues = array(
265
-				$EE->CFG->organization->get_pretty( 'name' ),
265
+				$EE->CFG->organization->get_pretty('name'),
266 266
 				$this->registration->reg_code(),
267 267
 				$this->transaction->ID(),
268 268
 				$primary_attendee->full_name(),
269
-				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/',
270
-				$this->registration->invoice_url(),//home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
269
+				(is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/' : EE_GATEWAYS_URL.'Invoice/lib/templates/',
270
+				$this->registration->invoice_url(), //home_url() . '/?download_invoice=true&amp;id=' . $this->registration->reg_url_link(),
271 271
 				$invoice_logo_image,
272
-				empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ),
273
-				$EE->CFG->organization->get_pretty( 'city' ),
272
+				empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'),
273
+				$EE->CFG->organization->get_pretty('city'),
274 274
 				$org_state_name,
275
-				$EE->CFG->organization->get_pretty( 'zip' ),
276
-				$EE->CFG->organization->get_pretty( 'email' ),
275
+				$EE->CFG->organization->get_pretty('zip'),
276
+				$EE->CFG->organization->get_pretty('email'),
277 277
 				$EE->CFG->organization->vat,
278
-				$this->registration->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ),
279
-				$this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ),
278
+				$this->registration->get_i18n_datetime('REG_date', get_option('date_format')),
279
+				$this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE),
280 280
 		);
281 281
 
282 282
 		return str_replace($SearchValues, $ReplaceValues, $content);
@@ -299,12 +299,12 @@  discard block
 block discarded – undo
299 299
 		if ($total_cost < 0) {
300 300
 			$total_cost = (-1) * $total_cost;
301 301
 		}
302
-		$find = array( ' ' );
303
-		$replace = array( '-' );
304
-		$row_id = strtolower( str_replace( $find, $replace, $text ));
302
+		$find = array(' ');
303
+		$replace = array('-');
304
+		$row_id = strtolower(str_replace($find, $replace, $text));
305 305
 		$html .= '<tr id="'.$row_id.'-tr"><td colspan="4">&nbsp;</td>';
306
-		$html .= '<td class="item_r">' . $text . '</td>';
307
-		$html .= '<td class="item_r">' . $total_cost . '</td>';
306
+		$html .= '<td class="item_r">'.$text.'</td>';
307
+		$html .= '<td class="item_r">'.$total_cost.'</td>';
308 308
 		$html .= '</tr>';
309 309
 		return $html;
310 310
 	}
Please login to merge, or discard this patch.
modules/gateways/Invoice/lib/templates/receipt_body.template.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -36,53 +36,53 @@  discard block
 block discarded – undo
36 36
 						<h2 id="invoice-hdr"><?php _e('Order Confirmation', 'event_espresso')?></h2>
37 37
 						<h3 id="invoice-date"><?php _e('Date:', 'event_espresso')?> <span class="plain-text">[registration_date]</span></h3>
38 38
 						<h3 id="invoice-txn-id"><?php _e('Transaction ID:', 'event_espresso')?> <span class="plain-text">[transaction_id]</span></h3>
39
-						<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status();?></span></h3>
39
+						<h3 id="invoice-txn-status"><?php _e('Status:', 'event_espresso')?> <span class="<?php echo $transaction->status_ID()?> plain-text"><?php echo $transaction->pretty_status(); ?></span></h3>
40 40
 					</div>
41 41
 				</td>
42 42
 			</tr>
43 43
 		</table>
44 44
 		<div class="events">
45
-		<?php foreach($events_for_txn as $event_id => $event){
46
-			?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png';?>"><?php _e("Event Name:","event_espresso")?> <span class="plain-text"><?php echo $event->name();?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3>
47
-			<?php if (strlen($event->description()>1)){?><p class="event-description"><?php $event->description()?></p><?php }?>
45
+		<?php foreach ($events_for_txn as $event_id => $event) {
46
+			?><h3 class="section-title event-name"><img class="icon" src="<?php echo EE_IMAGES_URL.'calendar_year-24x24.png'; ?>"><?php _e("Event Name:", "event_espresso")?> <span class="plain-text"><?php echo $event->name(); ?></span> <span class="small-text link">[ <a href='<?php echo $event->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></h3>
47
+			<?php if (strlen($event->description() > 1)) {?><p class="event-description"><?php $event->description()?></p><?php }?>
48 48
 			<ul class="tickets-per-event">
49
-			<?php foreach($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item){
49
+			<?php foreach ($ticket_line_items_per_event[$event_id] as $line_item_id => $line_item) {
50 50
 				$ticket = $line_item->ticket();
51
-				$taxable_html = $ticket->taxable() ? '*': '';
51
+				$taxable_html = $ticket->taxable() ? '*' : '';
52 52
 				$subitems = $line_item->children();
53
-				$ticket_uses = $ticket->get_pretty('TKT_uses',  __("any", "event_espresso"));
53
+				$ticket_uses = $ticket->get_pretty('TKT_uses', __("any", "event_espresso"));
54 54
 			?>
55 55
 				<li class="event-ticket">
56 56
 					<div class="ticket-details">
57 57
 						<table class="invoice-amount">
58 58
 							<thead>
59 59
 								<tr class="header_row">
60
-									<th class="name-column"><?php _e("Ticket", "event_espresso");?></th>
61
-									<th colspan="2" class="desc-column"><?php _e("Description", "event_espresso");?></th>
62
-									<th class="number-column item_c"><?php _e("Quantity", "event_espresso");?></th>
63
-									<th class="number-column item_c"><?php _e("Price", "event_espresso");?></th>
64
-									<th class="number-column item_r"><?php _e("Total", "event_espresso");?></th>
60
+									<th class="name-column"><?php _e("Ticket", "event_espresso"); ?></th>
61
+									<th colspan="2" class="desc-column"><?php _e("Description", "event_espresso"); ?></th>
62
+									<th class="number-column item_c"><?php _e("Quantity", "event_espresso"); ?></th>
63
+									<th class="number-column item_c"><?php _e("Price", "event_espresso"); ?></th>
64
+									<th class="number-column item_r"><?php _e("Total", "event_espresso"); ?></th>
65 65
 								</tr>
66 66
 							</thead>
67 67
 							<tbody>
68
-								<?php if( count($subitems) < 2){?>
68
+								<?php if (count($subitems) < 2) {?>
69 69
 								<tr class="item">
70 70
 									<td><?php echo $line_item->name().$taxable_html?></td>
71
-									<td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
71
+									<td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
72 72
 									<td class="item_c"><?php echo $line_item->quantity()?></td>
73 73
 									<td class="item_c"><?php echo $line_item->unit_price_no_code()?></td>
74 74
 									<td class="item_r"><?php echo $line_item->total_no_code()?></td>
75 75
 								</tr>
76
-								<?php }else{?>
76
+								<?php } else {?>
77 77
 									<tr class="item">
78 78
 										<td class="aln-left"><?php echo $line_item->name().$taxable_html?></td>
79
-										<td colspan="2"><?php echo $line_item->desc();?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
79
+										<td colspan="2"><?php echo $line_item->desc(); ?><p class="ticket-note"><?php echo sprintf(__('This ticket can be used once at %s of the dates/times below.', 'event_espresso'), $ticket_uses); ?></p></td>
80 80
 										<td class="item_c"><?php echo $line_item->quantity()?></td>
81 81
 										<td class="item_c"><?php echo $line_item->unit_price_no_code()?></td>
82 82
 										<td class="item_r"><?php echo $line_item->total_no_code()?></td>
83 83
 									</tr>
84
-									<?php foreach($subitems as $sub_line_item){
85
-										$is_percent = $sub_line_item->is_percent();?>
84
+									<?php foreach ($subitems as $sub_line_item) {
85
+										$is_percent = $sub_line_item->is_percent(); ?>
86 86
 										<tr class="subitem-row">
87 87
 											<td class="subitem"><?php echo $sub_line_item->name()?></td>
88 88
 											<td colspan="2"><?php echo $sub_line_item->desc()?></td>
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 									<?php } ?>
94 94
 									<tr class="total_tr odd">
95 95
 										<td colspan="4"></td>
96
-										<td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso");?></td>
96
+										<td class="total" nowrap="nowrap"><?php _e("Ticket Total:", "event_espresso"); ?></td>
97 97
 										<td class="item_r"><?php echo $line_item->total_no_code()?></td>
98 98
 									</tr>
99 99
 								<?php }?>
@@ -104,22 +104,22 @@  discard block
 block discarded – undo
104 104
 					<div class="reg-details-for-ticket">
105 105
 						<div class="ticket-time-and-place-details">
106 106
 							<div class="ticket-time-details">
107
-								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png';?>"><?php echo _n("Date/Time:","Dates/Times:",count($ticket->datetimes()), "event_espresso");?></h4>
107
+								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'clock-16x16.png'; ?>"><?php echo _n("Date/Time:", "Dates/Times:", count($ticket->datetimes()), "event_espresso"); ?></h4>
108 108
 								<ul class="event-dates">
109
-									<?php foreach($ticket->datetimes_ordered() as $datetime){
109
+									<?php foreach ($ticket->datetimes_ordered() as $datetime) {
110 110
 										/* @var $datetime EE_Datetime */ ?>
111 111
 									<li><?php
112
-										echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '' ;
113
-										echo sprintf(__("%s - %s (%s)", "event_espresso"),$datetime->start_date_and_time(),$datetime->end_date_and_time(),$datetime->get_timezone());
112
+										echo $datetime->name() ? '<b>'.$datetime->name().' </b>' : '';
113
+										echo sprintf(__("%s - %s (%s)", "event_espresso"), $datetime->start_date_and_time(), $datetime->end_date_and_time(), $datetime->get_timezone());
114 114
 										echo $datetime->description() ? '<p class="ticket-note">'.$datetime->description().'</p>' : '' ?></li>
115 115
 									<?php }?>
116 116
 								</ul>
117 117
 							</div>
118
-							<?php if ($event->venues()){?>
118
+							<?php if ($event->venues()) {?>
119 119
 							<div class="ticket-place-details">
120
-								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png';?>"><?php echo _n("Venue:","Venues:",count($event->venues()), "event_espresso");?></h4>
120
+								<h4 class="sub-section-title no-bottom-margin"><img class="icon" src="<?php echo EE_IMAGES_URL.'location-pin-16x16.png'; ?>"><?php echo _n("Venue:", "Venues:", count($event->venues()), "event_espresso"); ?></h4>
121 121
 								<ul class="event-venues">
122
-									<?php foreach($event->venues() as $venue){?>
122
+									<?php foreach ($event->venues() as $venue) {?>
123 123
 									<li><?php echo $venue->name()?> <span class="small-text">[ <a href='<?php echo $venue->get_permalink()?>'><?php _e('view', 'event_espresso'); ?></a> ]</span></li>
124 124
 									<?php } ?>
125 125
 								</ul>
@@ -127,34 +127,34 @@  discard block
 block discarded – undo
127 127
 							<?php }?>
128 128
 						</div>
129 129
 						<div class="ticket-registrations-area">
130
-							<h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png';?>"><?php echo __("Registration Details", "event_espresso");?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4>
130
+							<h4 class="sub-section-title"><img class="icon" src="<?php echo EE_IMAGES_URL.'users-16x16.png'; ?>"><?php echo __("Registration Details", "event_espresso"); ?> <span class="small-text link">[ <a class="print_button noPrint" href="<?php echo $edit_reg_info_url; ?>"><?php _e('edit', 'event_espresso'); ?></a> ]</span></h4>
131 131
 							<ul class="ticket-registrations-list">
132
-								<?php foreach($registrations_per_line_item[$line_item_id] as $registration){
132
+								<?php foreach ($registrations_per_line_item[$line_item_id] as $registration) {
133 133
 									/* @var $registration EE_Registration */
134 134
 									$attendee = $registration->attendee();
135
-									$answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC')));?>
135
+									$answers = $registration->answers(array('order_by'=>array('Question.Question_Group_Question.QGQ_order'=>'ASC'))); ?>
136 136
 								<li class="ticket-registration">
137 137
 									<table class="registration-details">
138 138
 										<tr class="odd">
139
-											<th><?php echo 	_e("Registration Code:", "event_espresso");?></th>
140
-											<td><?php echo $registration->reg_code();?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td>
139
+											<th><?php echo 	_e("Registration Code:", "event_espresso"); ?></th>
140
+											<td><?php echo $registration->reg_code(); ?> - <span class="<?php echo $registration->status_ID()?>"><?php echo $registration->pretty_status()?></span></td>
141 141
 										</tr>
142 142
 										<?php
143
-										foreach($event->question_groups() as $question_group){
144
-											?><tr><th><?php $question_group->e('QSG_name');?></th><td></td></tr><?php
143
+										foreach ($event->question_groups() as $question_group) {
144
+											?><tr><th><?php $question_group->e('QSG_name'); ?></th><td></td></tr><?php
145 145
 											$has_personal_info = false;
146
-											foreach($question_group->questions() as $question){
147
-												if( in_array($question->system_ID(),$questions_to_skip)){
146
+											foreach ($question_group->questions() as $question) {
147
+												if (in_array($question->system_ID(), $questions_to_skip)) {
148 148
 													$has_personal_info = true;
149 149
 													continue;
150 150
 												}
151 151
 												?><tr>
152 152
 														<th><?php echo $question->display_text()?></th>
153
-														<td><?php echo $registration->answer_value_to_question($question);?></td>
153
+														<td><?php echo $registration->answer_value_to_question($question); ?></td>
154 154
 												</tr><?php
155 155
 											}
156
-											if($has_personal_info){
157
-												?><tr><th><?php	_e('Attendee', 'event_espresso');?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"),$attendee->full_name(),$attendee->email())?></td></tr><?php
156
+											if ($has_personal_info) {
157
+												?><tr><th><?php	_e('Attendee', 'event_espresso'); ?></th><td><?php echo sprintf(__('%s (%s)', "event_espresso"), $attendee->full_name(), $attendee->email())?></td></tr><?php
158 158
 											}
159 159
 										}
160 160
 										?>
@@ -171,21 +171,21 @@  discard block
 block discarded – undo
171 171
 		<?php }?>
172 172
 		</div>
173 173
 		<div class="taxes">
174
-			<?php if ($tax_total_line_item && $tax_total_line_item->children()){?>
175
-				<h3 class="section-title"><?php _e("Taxes",'event_espresso')?></h3>
174
+			<?php if ($tax_total_line_item && $tax_total_line_item->children()) {?>
175
+				<h3 class="section-title"><?php _e("Taxes", 'event_espresso')?></h3>
176 176
 				<table class="invoice-amount">
177 177
 
178 178
 					<thead>
179 179
 						<tr class="header_row">
180
-							<th class="left ticket_th"><?php _e("Tax Name", "event_espresso");?></th>
181
-							<th class="left"><?php _e('Description', 'event_espresso');?></th>
180
+							<th class="left ticket_th"><?php _e("Tax Name", "event_espresso"); ?></th>
181
+							<th class="left"><?php _e('Description', 'event_espresso'); ?></th>
182 182
 							<th class="event_th item_c"><?php _e('Rate', 'event_espresso'); ?></th>
183 183
 							<th class="subtotal_th"><?php _e('Tax Amount', 'event_espresso'); ?></th>
184 184
 						</tr>
185 185
 					</thead>
186 186
 					<tbody>
187 187
 						<?php
188
-						foreach($tax_total_line_item->children() as $child_tax){?>
188
+						foreach ($tax_total_line_item->children() as $child_tax) {?>
189 189
 						<tr>
190 190
 							<td><?php echo $child_tax->name()?></td>
191 191
 							<td><?php echo $child_tax->desc()?></td>
@@ -195,26 +195,26 @@  discard block
 block discarded – undo
195 195
 						<?php } ?>
196 196
 						<tr class="total_tr odd">
197 197
 							<td class="total_tr" colspan="2"></td>
198
-							<td class="total"><?php	_e("Tax Total:", "event_espresso");?></td>
198
+							<td class="total"><?php	_e("Tax Total:", "event_espresso"); ?></td>
199 199
 							<td class="item_r"><?php echo $tax_total_line_item->total_no_code()?></td>
200 200
 						</tr>
201 201
 					</tbody>
202 202
 
203 203
 				</table>
204 204
 			<?php }?>
205
-			<p><?php _e("* taxable items", "event_espresso");?></p>
205
+			<p><?php _e("* taxable items", "event_espresso"); ?></p>
206 206
 		</div>
207 207
 		<div class="grand-total-dv">
208
-		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"),EEH_Template::format_currency($total_cost));?></h2>
208
+		<h2 class="grand-total"><?php printf(__("Grand Total: %s", "event_espresso"), EEH_Template::format_currency($total_cost)); ?></h2>
209 209
 		</div>
210 210
 		<div class="payment-dv">
211
-			<h3 class="section-title"><?php _e("Payments",'event_espresso')?></h3>
211
+			<h3 class="section-title"><?php _e("Payments", 'event_espresso')?></h3>
212 212
 			<p>[instructions]</p>
213 213
 			<table class="invoice-amount">
214 214
 				<thead>
215 215
 					<tr class="header_row">
216 216
 						<th><span class=""><?php _e('Payment Method', 'event_espresso'); ?></span></th>
217
-						<th class='left datetime_th'><?php _e("Date",'event_espresso')?></th>
217
+						<th class='left datetime_th'><?php _e("Date", 'event_espresso')?></th>
218 218
 						<th><span class=""><?php _e('Transaction Id / Cheque #', 'event_espresso'); ?></span></th>
219 219
 						<th><span class=""><?php _e('P.O. / S.O.#', 'event_espresso'); ?></span></th>
220 220
 						<th><span class=""><?php _e('Status', 'event_espresso'); ?></span></th>
@@ -224,11 +224,11 @@  discard block
 block discarded – undo
224 224
 				<tbody>
225 225
 					<?php
226 226
 					$c = false;
227
-					if(!empty($payments)){
227
+					if ( ! empty($payments)) {
228 228
 
229
-						foreach($payments as $payment){
229
+						foreach ($payments as $payment) {
230 230
 							/* @var $payment EE_Payment */?>
231
-						<tr class='item <?php echo (($c = !$c) ? ' odd' : '')?>'>
231
+						<tr class='item <?php echo (($c = ! $c) ? ' odd' : '')?>'>
232 232
 							<td><?php $payment->e('PAY_gateway')?></td>
233 233
 							<td><?php echo $payment->timestamp()?></td>
234 234
 							<td><?php $payment->e('PAY_txn_id_chq_nmbr')?></td>
@@ -237,17 +237,17 @@  discard block
 block discarded – undo
237 237
 							<td class='item_r'><?php echo $payment->amount_no_code()?></td>
238 238
 						</tr>
239 239
 						<?php }
240
-					}else{?>
240
+					} else {?>
241 241
 						<tr class='item'>
242
-							<td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.",'event_espresso')?> </td>
242
+							<td class='aln-cntr' colspan="6"><?php _e("No approved payments have been received.", 'event_espresso')?> </td>
243 243
 						</tr>
244 244
 					<?php }
245
-					?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if($amount_owed){?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso");}?></a></td></tr>
245
+					?><tr class="item" ><td class='aln-cntr' colspan="6"><?php if ($amount_owed) {?><a class="noPrint" href='<?php echo $retry_payment_url?>'><?php _e("Please make a payment.", "event_espresso"); }?></a></td></tr>
246 246
 				</tbody>
247 247
 				<tfoot>
248 248
 					<tr class='total_tr'><td colspan="4">&nbsp;</td>
249
-						<td class="item_r"><?php _e('Total Paid','event_espresso')?></td>
250
-						<td class="item_r"><?php echo EEH_Template::format_currency($amount_pd,false,false)?> </td>
249
+						<td class="item_r"><?php _e('Total Paid', 'event_espresso')?></td>
250
+						<td class="item_r"><?php echo EEH_Template::format_currency($amount_pd, false, false)?> </td>
251 251
 					</tr>
252 252
 					<?php //echo $discount; ?>
253 253
 					<tr class="total_tr odd">
@@ -259,20 +259,20 @@  discard block
 block discarded – undo
259 259
 			</table>
260 260
 		</div>
261 261
 		<div class="additional-info-dv">
262
-			<h3 class="section-title"><?php _e("Additional Information:", "event_espresso");?></h3>
262
+			<h3 class="section-title"><?php _e("Additional Information:", "event_espresso"); ?></h3>
263 263
 			<div class="additional-info">
264
-				<?php if($venues_for_events){?>
265
-				<h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso",count($venues_for_events));?></h2>
264
+				<?php if ($venues_for_events) {?>
265
+				<h2><?php echo _n("Venue Details:", "Venues Details:", "event_espresso", count($venues_for_events)); ?></h2>
266 266
 				<table class="venue-list">
267
-					<?php foreach($venues_for_events as $venue){?>
267
+					<?php foreach ($venues_for_events as $venue) {?>
268 268
 						<tr class="venue-details">
269 269
 							<td class="venue-details-part venue-address-dv">
270 270
 								<h3><a href='<?php echo $venue->get_permalink()?>'><?php
271 271
 									echo $venue->name()
272 272
 								?></a></h3>
273 273
 								<p><?php echo $venue->description()?></p>
274
-								<?php echo  EEH_Address::format($venue);?></td>
275
-							<?php if($venue->enable_for_gmap()){?>
274
+								<?php echo  EEH_Address::format($venue); ?></td>
275
+							<?php if ($venue->enable_for_gmap()) {?>
276 276
 								<td class="venue-details-part venue-image-dv"><?php echo EEH_Venue_View::espresso_google_static_map($venue)?></td>
277 277
 							<?php } ?>
278 278
 						</tr>
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
 				</table>
281 281
 				<?php } ?>
282 282
 
283
-				<?php if($shameless_plug){?>
283
+				<?php if ($shameless_plug) {?>
284 284
 				<div class='aln-cntr'><?php
285
-					printf(__("Powered by %sEvent Espresso %s", "event_espresso"),"<a href='http://eventespresso.com'>","</a>");
285
+					printf(__("Powered by %sEvent Espresso %s", "event_espresso"), "<a href='http://eventespresso.com'>", "</a>");
286 286
 				?></div>
287 287
 				<?php } ?>
288 288
 			</div>
Please login to merge, or discard this patch.
modules/ical/EED_Ical.module.php 2 patches
Spacing   +70 added lines, -70 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,73 +123,73 @@  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
-						 EE_Registry::instance()->load_helper( 'Venue_View' );
144
-						$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
+						 EE_Registry::instance()->load_helper('Venue_View');
144
+						$location = espresso_venue_raw_address('inline', $venue->ID(), FALSE);
145 145
 					}
146 146
 				}
147 147
 				// set variables, escape strings, convert timestamps to ics format, etc
148
-				$filename = $event->slug() . '-' . $datetime->start_date( 'Y-m-d' ) . '.ics';
149
-				$organizer = EED_Ical::_escape_ICal_data( EE_Registry::instance()->CFG->organization->name );
150
-				$UID = EED_Ical::_escape_ICal_data( md5( $event->name() . $event->ID() . $datetime->ID() ));
151
-				$org_email = EED_Ical::_escape_ICal_data( $datetime->ID() );
152
-				$timestamp = date( EED_Ical::iCal_datetime_format );
153
-				$location = EED_Ical::_escape_ICal_data( $location );
154
-				$summary = EED_Ical::_escape_ICal_data( $event->name() );
155
-				$description = EED_Ical::_escape_ICal_description( wp_strip_all_tags( $event->description() ));
148
+				$filename = $event->slug().'-'.$datetime->start_date('Y-m-d').'.ics';
149
+				$organizer = EED_Ical::_escape_ICal_data(EE_Registry::instance()->CFG->organization->name);
150
+				$UID = EED_Ical::_escape_ICal_data(md5($event->name().$event->ID().$datetime->ID()));
151
+				$org_email = EED_Ical::_escape_ICal_data($datetime->ID());
152
+				$timestamp = date(EED_Ical::iCal_datetime_format);
153
+				$location = EED_Ical::_escape_ICal_data($location);
154
+				$summary = EED_Ical::_escape_ICal_data($event->name());
155
+				$description = EED_Ical::_escape_ICal_description(wp_strip_all_tags($event->description()));
156 156
 				$status = $datetime->get_active_status();
157 157
 				$status = $status == EE_Datetime::cancelled ? 'Cancelled' : 'Confirmed';
158
-				$status = EED_Ical::_escape_ICal_data( $status );
159
-				$categories = EED_Ical::_escape_ICal_data( $category );
160
-				$url = EED_Ical::_escape_ICal_data( get_permalink( $event->ID() ));
161
-				$dtt_start = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->start() ));
162
-				$dtt_end = EED_Ical::_escape_ICal_data( date( EED_Ical::iCal_datetime_format, $datetime->end() ));
158
+				$status = EED_Ical::_escape_ICal_data($status);
159
+				$categories = EED_Ical::_escape_ICal_data($category);
160
+				$url = EED_Ical::_escape_ICal_data(get_permalink($event->ID()));
161
+				$dtt_start = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->start()));
162
+				$dtt_end = EED_Ical::_escape_ICal_data(date(EED_Ical::iCal_datetime_format, $datetime->end()));
163 163
 				// set headers
164
-				header( 'Content-type: text/calendar; charset=utf-8' );
165
-				header( 'Content-Disposition: attachment; filename="' . $filename . '"' );
166
-				header( 'Cache-Control: private, max-age=0, must-revalidate' );
167
-				header( 'Pragma: public' );
168
-				header( 'Content-Type: application/octet-stream' );
169
-				header( 'Content-Type: application/force-download' );
170
-				header( 'Cache-Control: no-cache, must-revalidate' );
171
-				header( 'Content-Transfer-Encoding: binary' );
172
-				header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' ); // past date
173
-				ini_set( 'zlib.output_compression', '0' );
164
+				header('Content-type: text/calendar; charset=utf-8');
165
+				header('Content-Disposition: attachment; filename="'.$filename.'"');
166
+				header('Cache-Control: private, max-age=0, must-revalidate');
167
+				header('Pragma: public');
168
+				header('Content-Type: application/octet-stream');
169
+				header('Content-Type: application/force-download');
170
+				header('Cache-Control: no-cache, must-revalidate');
171
+				header('Content-Transfer-Encoding: binary');
172
+				header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // past date
173
+				ini_set('zlib.output_compression', '0');
174 174
 				// echo the output
175
-				echo "BEGIN:VCALENDAR" . PHP_EOL;
176
-				echo "VERSION:2.0" . PHP_EOL;
177
-				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN" . PHP_EOL;
178
-				echo "CALSCALE:GREGORIAN" . PHP_EOL;
179
-				echo "BEGIN:VEVENT" . PHP_EOL;
180
-				echo "UID:{$UID}" . PHP_EOL;
181
-				echo "ORGANIZER:MAILTO:{$org_email}" . PHP_EOL;
182
-				echo "DTSTAMP:{$timestamp}" . PHP_EOL;
183
-				echo "LOCATION:{$location}" . PHP_EOL;
184
-				echo "SUMMARY:{$summary}" . PHP_EOL;
185
-				echo "DESCRIPTION:{$description}" . PHP_EOL;
186
-				echo "STATUS:{$status}" . PHP_EOL;
187
-				echo "CATEGORIES:{$categories}" . PHP_EOL;
188
-				echo "URL;VALUE=URI:{$url}" . PHP_EOL;
189
-				echo "DTSTART:{$dtt_start}" . PHP_EOL;
190
-				echo "DTEND:{$dtt_end}" . PHP_EOL;
191
-				echo "END:VEVENT" . PHP_EOL;
192
-				echo "END:VCALENDAR" . PHP_EOL;
175
+				echo "BEGIN:VCALENDAR".PHP_EOL;
176
+				echo "VERSION:2.0".PHP_EOL;
177
+				echo "PRODID:-//{$organizer}//NONSGML PDA Calendar Version 1.0//EN".PHP_EOL;
178
+				echo "CALSCALE:GREGORIAN".PHP_EOL;
179
+				echo "BEGIN:VEVENT".PHP_EOL;
180
+				echo "UID:{$UID}".PHP_EOL;
181
+				echo "ORGANIZER:MAILTO:{$org_email}".PHP_EOL;
182
+				echo "DTSTAMP:{$timestamp}".PHP_EOL;
183
+				echo "LOCATION:{$location}".PHP_EOL;
184
+				echo "SUMMARY:{$summary}".PHP_EOL;
185
+				echo "DESCRIPTION:{$description}".PHP_EOL;
186
+				echo "STATUS:{$status}".PHP_EOL;
187
+				echo "CATEGORIES:{$categories}".PHP_EOL;
188
+				echo "URL;VALUE=URI:{$url}".PHP_EOL;
189
+				echo "DTSTART:{$dtt_start}".PHP_EOL;
190
+				echo "DTEND:{$dtt_end}".PHP_EOL;
191
+				echo "END:VEVENT".PHP_EOL;
192
+				echo "END:VCALENDAR".PHP_EOL;
193 193
 			}
194 194
 		}
195 195
 		die();
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 	 *  	@param	string $string
205 205
 	 *  	@return	string
206 206
 	 */
207
-	private static function _escape_ICal_data( $string = '' ) {
208
-		return preg_replace( '/([\,;])/', '\\\$1', $string );
207
+	private static function _escape_ICal_data($string = '') {
208
+		return preg_replace('/([\,;])/', '\\\$1', $string);
209 209
 	}
210 210
 
211 211
 	/**
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
 	 *  	@param	string $description
216 216
 	 *  	@return	string
217 217
 	 */
218
-	private static function _escape_ICal_description( $description = '' ) {
218
+	private static function _escape_ICal_description($description = '') {
219 219
 			
220 220
 			//Escape spcial chars within the decription
221
-			$description = EED_Ical::_escape_ICal_data( $description );
221
+			$description = EED_Ical::_escape_ICal_data($description);
222 222
 
223 223
 		    //Remove line breaks and output in iCal format
224
-		    $description = str_replace( array( "\r\n", "\n"), '\n', $description );
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.
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.
finalize_registration/EE_SPCO_Reg_Step_Finalize_Registration.class.php 2 patches
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @param    EE_Checkout $checkout
21 21
 	 * @return 	\EE_SPCO_Reg_Step_Finalize_Registration
22 22
 	 */
23
-	public function __construct( EE_Checkout $checkout ) {
23
+	public function __construct(EE_Checkout $checkout) {
24 24
 		$this->_slug = 'finalize_registration';
25 25
 		$this->_name = __('Finalize Registration', 'event_espresso');
26 26
 		$this->_submit_button_text = $this->_name;
@@ -47,9 +47,9 @@  discard block
 block discarded – undo
47 47
 	public function initialize_reg_step() {
48 48
 
49 49
 		// there's actually no reg form to process if this is the final step
50
-		if ( $this->is_current_step() ) {
50
+		if ($this->is_current_step()) {
51 51
 			$this->checkout->step = $_REQUEST['step'] = $this->slug();
52
-			$this->checkout->action = $_REQUEST[ 'action' ] = 'process_reg_step';
52
+			$this->checkout->action = $_REQUEST['action'] = 'process_reg_step';
53 53
 			$this->checkout->generate_reg_form = false;
54 54
 		}
55 55
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	public function process_reg_step() {
74 74
 		// ensure all data gets refreshed from the db
75
-		$this->checkout->refresh_all_entities( true );
75
+		$this->checkout->refresh_all_entities(true);
76 76
 		// ensures that all details and statuses for transaction, registration, and payments are updated
77 77
 		$txn_update_params = $this->_finalize_transaction();
78 78
 		// DEBUG LOG
@@ -86,16 +86,16 @@  discard block
 block discarded – undo
86 86
 		//	)
87 87
 		//);
88 88
 		// set a hook point
89
-		do_action( 'AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params );
89
+		do_action('AHEE__EE_SPCO_Reg_Step_Finalize_Registration__process_reg_step__completed', $this->checkout, $txn_update_params);
90 90
 		// check if transaction has a primary registrant and that it has a related Attendee object
91
-		if ( $this->checkout->transaction_has_primary_registrant() ) {
91
+		if ($this->checkout->transaction_has_primary_registrant()) {
92 92
 			// setup URL for redirect
93 93
 			$this->checkout->redirect_url = add_query_arg(
94
-				array( 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link() ),
94
+				array('e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link()),
95 95
 				$this->checkout->thank_you_page_url
96 96
 			);
97 97
 		} else {
98
-			EE_Error::add_error( __( 'A valid Primary Registration for this Transaction could not be found.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
98
+			EE_Error::add_error(__('A valid Primary Registration for this Transaction could not be found.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
99 99
 			$this->checkout->redirect = false;
100 100
 			$this->checkout->continue_reg = false;
101 101
 			return false;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		// you don't have to go home but you can't stay here !
104 104
 		$this->checkout->redirect = true;
105 105
 		$this->checkout->continue_reg = true;
106
-		$this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url );
107
-		if ( ! ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) ) {
106
+		$this->checkout->json_response->set_redirect_url($this->checkout->redirect_url);
107
+		if ( ! ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site())) {
108 108
 			// mark this reg step as completed
109 109
 			$this->checkout->current_step->set_completed();
110 110
 		}
@@ -121,43 +121,43 @@  discard block
 block discarded – undo
121 121
 	 */
122 122
 	protected function _finalize_transaction() {
123 123
 		/** @type EE_Transaction_Processor $transaction_processor */
124
-		$transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' );
124
+		$transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor');
125 125
 		//set revisit flag in txn processor
126
-		$transaction_processor->set_revisit( $this->checkout->revisit );
126
+		$transaction_processor->set_revisit($this->checkout->revisit);
127 127
 		// at this point we'll consider a TXN to not have been abandoned
128
-		$transaction_processor->toggle_abandoned_transaction_status( $this->checkout->transaction );
129
-		if ( $this->checkout->cart instanceof EE_Cart ) {
128
+		$transaction_processor->toggle_abandoned_transaction_status($this->checkout->transaction);
129
+		if ($this->checkout->cart instanceof EE_Cart) {
130 130
 			// save TXN data to the cart
131
-			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() );
131
+			$this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID());
132 132
 		}
133 133
 		/** @type EE_Transaction_Payments $transaction_payments */
134
-		$transaction_payments = EE_Registry::instance()->load_class( 'Transaction_Payments' );
134
+		$transaction_payments = EE_Registry::instance()->load_class('Transaction_Payments');
135 135
 		// maybe update status, but don't save transaction just yet
136
-		$transaction_payments->update_transaction_status_based_on_total_paid( $this->checkout->transaction, false );
136
+		$transaction_payments->update_transaction_status_based_on_total_paid($this->checkout->transaction, false);
137 137
 		// If the selected method of payment used an off-site gateway...
138
-		if ( $this->checkout->payment_method instanceof EE_Payment_Method ) {
139
-			$is_revisit = filter_var( $this->checkout->revisit, FILTER_VALIDATE_BOOLEAN );
140
-			if ( $this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site() ) {
141
-				$gateway= $this->checkout->payment_method->type_obj()->get_gateway();
142
-				if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) {
138
+		if ($this->checkout->payment_method instanceof EE_Payment_Method) {
139
+			$is_revisit = filter_var($this->checkout->revisit, FILTER_VALIDATE_BOOLEAN);
140
+			if ($this->checkout->payment_method instanceof EE_Payment_Method && $this->checkout->payment_method->is_off_site()) {
141
+				$gateway = $this->checkout->payment_method->type_obj()->get_gateway();
142
+				if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) {
143 143
 					// do NOT trigger notifications because it was already done during the IPN
144
-					remove_all_filters( 'FHEE__EED_Messages___maybe_registration__deliver_notifications' );
145
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15 );
146
-				} else if ( ! $is_revisit ) {
147
-					add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
144
+					remove_all_filters('FHEE__EED_Messages___maybe_registration__deliver_notifications');
145
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15);
146
+				} else if ( ! $is_revisit) {
147
+					add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
148 148
 				}
149 149
 			} else if (
150 150
 				// if SPCO revisit and TXN status has changed due to a payment
151
-				$is_revisit && ( $this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated() )
151
+				$is_revisit && ($this->checkout->txn_status_updated || $this->checkout->any_reg_status_updated())
152 152
 			) {
153 153
 				// send out notifications
154
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
155
-			} else if ( ! $is_revisit ) {
156
-				add_filter( 'FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10 );
154
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
155
+			} else if ( ! $is_revisit) {
156
+				add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_true', 10);
157 157
 			}
158 158
 		}
159 159
 		// this will result in the base session properties getting saved to the TXN_Session_data field
160
-		$this->checkout->transaction->set_txn_session_data( EE_Registry::instance()->SSN->get_session_data( null, true ));
160
+		$this->checkout->transaction->set_txn_session_data(EE_Registry::instance()->SSN->get_session_data(null, true));
161 161
 
162 162
 		// update the TXN if payment conditions have changed
163 163
 		return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment(
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @return boolean
175 175
 	 */
176 176
 	public function update_reg_step() {
177
-		EE_Error::doing_it_wrong( __CLASS__ . '::' . __FILE__, __( 'Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0' );
177
+		EE_Error::doing_it_wrong(__CLASS__.'::'.__FILE__, __('Can not call update_reg_step() on the Finalize Registration reg step.', 'event_espresso'), '4.6.0');
178 178
 	 }
179 179
 
180 180
 
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
 	/**
28 28
 	 * Applies all teh individual item validation strategies on each item in the array
29 29
 	 * @param array $normalized_value
30
-	 * @return boolean
30
+	 * @return boolean|null
31 31
 	 */
32 32
 	function validate($normalized_value) {
33 33
 		if( is_array($normalized_value)){
Please login to merge, or discard this patch.
caffeinated/modules/event_single_caff/EED_Event_Single_Caff.module.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -116,7 +116,7 @@
 block discarded – undo
116 116
 	 * @access    	public
117 117
 	 * @param 		EE_Template_Config $CFG
118 118
 	 * @param 		array $REQ
119
-	 * @return    	EE_Event_Single_Config
119
+	 * @return    	EE_Template_Config
120 120
 	 */
121 121
 	public static function update_template_settings( $CFG, $REQ ) {
122 122
 		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
Please login to merge, or discard this patch.
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	 * @return EED_Event_Single_Caff
30 30
 	 */
31 31
 	public static function instance() {
32
-		return parent::get_instance( __CLASS__ );
32
+		return parent::get_instance(__CLASS__);
33 33
 	}
34 34
 
35 35
 
@@ -50,34 +50,34 @@  discard block
 block discarded – undo
50 50
 	 *  @return 	void
51 51
 	 */
52 52
 	public static function set_hooks_admin() {
53
-		define( 'EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path( __FILE__ ) . 'templates' . DS );
54
-		define( 'EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
53
+		define('EVENT_SINGLE_CAFF_TEMPLATES_PATH', plugin_dir_path(__FILE__).'templates'.DS);
54
+		define('EVENT_SINGLE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
55 55
 		add_action(
56 56
 			'FHEE__EE_Admin_Page___load_page_dependencies__after_load__espresso_events__template_settings',
57
-			array( 'EED_Event_Single_Caff', 'load_scripts_styles' ),
57
+			array('EED_Event_Single_Caff', 'load_scripts_styles'),
58 58
 			10
59 59
 		);
60
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Event_Single_Caff', 'template_settings_form' ), 10 );
61
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Event_Single_Caff', 'update_template_settings' ), 10, 2 );
60
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Event_Single_Caff', 'template_settings_form'), 10);
61
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Event_Single_Caff', 'update_template_settings'), 10, 2);
62 62
 		// AJAX
63
-		add_action( 'wp_ajax_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
64
-		add_action( 'wp_ajax_nopriv_espresso_update_event_single_order', array( 'EED_Event_Single_Caff', 'update_event_single_order' ) );
63
+		add_action('wp_ajax_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
64
+		add_action('wp_ajax_nopriv_espresso_update_event_single_order', array('EED_Event_Single_Caff', 'update_event_single_order'));
65 65
 
66 66
 	}
67 67
 
68 68
 
69 69
 
70 70
 	public static function load_scripts_styles() {
71
-		add_action( 'admin_enqueue_scripts', array( 'EED_Event_Single_Caff', 'enqueue_scripts_styles' ), 10 );
71
+		add_action('admin_enqueue_scripts', array('EED_Event_Single_Caff', 'enqueue_scripts_styles'), 10);
72 72
 	}
73 73
 
74 74
 
75 75
 
76 76
 	public static function enqueue_scripts_styles() {
77
-		wp_register_style( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION );
78
-		wp_enqueue_style( 'eed-event-single-sortable' );
79
-		wp_register_script( 'eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL . 'eed_event_single_sortable.js', array( 'jquery-ui-sortable' ), EVENT_ESPRESSO_VERSION, true );
80
-		wp_enqueue_script( 'eed-event-single-sortable' );
77
+		wp_register_style('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.css', array(), EVENT_ESPRESSO_VERSION);
78
+		wp_enqueue_style('eed-event-single-sortable');
79
+		wp_register_script('eed-event-single-sortable', EVENT_SINGLE_CAFF_ASSETS_URL.'eed_event_single_sortable.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
80
+		wp_enqueue_script('eed-event-single-sortable');
81 81
 	}
82 82
 
83 83
 
@@ -91,21 +91,21 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public static function template_settings_form() {
93 93
 		$config = EE_Registry::instance()->CFG->template_settings;
94
-		$config = isset( $config->EED_Event_Single ) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order ) ? $config->use_sortable_display_order : false;
96
-		$config = apply_filters( 'FHEE__EED_Event_Single__template_settings_form__event_list_config', $config );
94
+		$config = isset($config->EED_Event_Single) && $config->EED_Event_Single instanceof EE_Event_Single_Config ? $config->EED_Event_Single : new EE_Event_Single_Config();
95
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
96
+		$config = apply_filters('FHEE__EED_Event_Single__template_settings_form__event_list_config', $config);
97 97
 
98 98
 		$event_single_order_array = array();
99
-		$event_single_order_array[ $config->display_order_tickets ] = 'tickets';
100
-		$event_single_order_array[ $config->display_order_datetimes ] = 'datetimes';
101
-		$event_single_order_array[ $config->display_order_event ] = 'event';
102
-		$event_single_order_array[ $config->display_order_venue ] = 'venue';
99
+		$event_single_order_array[$config->display_order_tickets] = 'tickets';
100
+		$event_single_order_array[$config->display_order_datetimes] = 'datetimes';
101
+		$event_single_order_array[$config->display_order_event] = 'event';
102
+		$event_single_order_array[$config->display_order_venue] = 'venue';
103 103
 		// get template parts
104
-		$template_parts = EED_Event_Single::instance()->initialize_template_parts( $config );
104
+		$template_parts = EED_Event_Single::instance()->initialize_template_parts($config);
105 105
 		// convert to array so that we can add more properties
106
-		$config = get_object_vars( $config );
107
-		$config[ 'event_single_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-single-sortable-js', '', 'single-sortable-li single-sortable-js' );
108
-		EEH_Template::display_template( EVENT_SINGLE_CAFF_TEMPLATES_PATH . 'admin-event-single-settings.template.php', $config );
106
+		$config = get_object_vars($config);
107
+		$config['event_single_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-single-sortable-js', '', 'single-sortable-li single-sortable-js');
108
+		EEH_Template::display_template(EVENT_SINGLE_CAFF_TEMPLATES_PATH.'admin-event-single-settings.template.php', $config);
109 109
 	}
110 110
 
111 111
 
@@ -118,20 +118,20 @@  discard block
 block discarded – undo
118 118
 	 * @param 		array $REQ
119 119
 	 * @return    	EE_Event_Single_Config
120 120
 	 */
121
-	public static function update_template_settings( $CFG, $REQ ) {
122
-		$display_order_tickets = isset( $CFG->EED_Event_Single->display_order_tickets ) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
-		$display_order_datetimes = isset( $CFG->EED_Event_Single->display_order_datetimes ) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
-		$display_order_event = isset( $CFG->EED_Event_Single->display_order_event ) ? $CFG->EED_Event_Single->display_order_event : 120;
125
-		$display_order_venue = isset( $CFG->EED_Event_Single->display_order_venue ) ? $CFG->EED_Event_Single->display_order_venue : 130;
121
+	public static function update_template_settings($CFG, $REQ) {
122
+		$display_order_tickets = isset($CFG->EED_Event_Single->display_order_tickets) ? $CFG->EED_Event_Single->display_order_tickets : 100;
123
+		$display_order_datetimes = isset($CFG->EED_Event_Single->display_order_datetimes) ? $CFG->EED_Event_Single->display_order_datetimes : 110;
124
+		$display_order_event = isset($CFG->EED_Event_Single->display_order_event) ? $CFG->EED_Event_Single->display_order_event : 120;
125
+		$display_order_venue = isset($CFG->EED_Event_Single->display_order_venue) ? $CFG->EED_Event_Single->display_order_venue : 130;
126 126
 		$CFG->EED_Event_Single = new EE_Event_Single_Config();
127
-		$CFG->EED_Event_Single->display_status_banner_single = !empty( $REQ['display_status_banner_single'] ) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
-		$CFG->EED_Event_Single->display_venue = ! empty( $REQ['display_venue'] ) && $REQ['display_venue'] ? TRUE : FALSE;
129
-		$CFG->EED_Event_Single->use_sortable_display_order = ! empty( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) ? absint( $REQ[ 'EED_Events_Single_use_sortable_display_order' ] ) : 0;
127
+		$CFG->EED_Event_Single->display_status_banner_single = ! empty($REQ['display_status_banner_single']) && $REQ['display_status_banner_single'] ? TRUE : FALSE;
128
+		$CFG->EED_Event_Single->display_venue = ! empty($REQ['display_venue']) && $REQ['display_venue'] ? TRUE : FALSE;
129
+		$CFG->EED_Event_Single->use_sortable_display_order = ! empty($REQ['EED_Events_Single_use_sortable_display_order']) ? absint($REQ['EED_Events_Single_use_sortable_display_order']) : 0;
130 130
 		$CFG->EED_Event_Single->display_order_tickets = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_tickets : 100;
131 131
 		$CFG->EED_Event_Single->display_order_datetimes = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_datetimes : 110;
132 132
 		$CFG->EED_Event_Single->display_order_event = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_event : 120;
133 133
 		$CFG->EED_Event_Single->display_order_venue = $CFG->EED_Event_Single->use_sortable_display_order ? $display_order_venue : 130;
134
-		do_action( 'AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ );
134
+		do_action('AHEE__EED_Event_Single__update_template_settings__after_update', $CFG, $REQ);
135 135
 		return $CFG;
136 136
 	}
137 137
 
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	 */
146 146
 	public static function update_event_single_order() {
147 147
 		$config_saved = false;
148
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
149
-		if ( ! empty( $template_parts ) ) {
150
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
151
-			foreach ( $template_parts as $key => $template_part ) {
148
+		$template_parts = sanitize_text_field($_POST['elements']);
149
+		if ( ! empty($template_parts)) {
150
+			$template_parts = explode(',', trim($template_parts, ','));
151
+			foreach ($template_parts as $key => $template_part) {
152 152
 				$template_part = "display_order_$template_part";
153
-				$priority = ( $key * 10 ) + 100;
153
+				$priority = ($key * 10) + 100;
154 154
 				EE_Registry::instance()->CFG->template_settings->EED_Event_Single->$template_part = $priority;
155
-				do_action( "AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority );
155
+				do_action("AHEE__EED_Event_Single__update_event_single_order__$template_part", $priority);
156 156
 			}
157
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
157
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
158 158
 		}
159
-		if ( $config_saved ) {
160
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
159
+		if ($config_saved) {
160
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
161 161
 		} else {
162
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
162
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
163 163
 		}
164
-		echo wp_json_encode( EE_Error::get_notices( false ));
164
+		echo wp_json_encode(EE_Error::get_notices(false));
165 165
 		exit();
166 166
 	}
167 167
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param WP $WP
175 175
 	 * @return    void
176 176
 	 */
177
-	public function run( $WP ) {
177
+	public function run($WP) {
178 178
 	}
179 179
 
180 180
 
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,26 +1,26 @@
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
2 2
 /**
3
- * Event Espresso
4
- *
5
- * Event Registration and Management Plugin for WordPress
6
- *
7
- * @ package			Event Espresso
8
- * @ author			Seth Shoultes
9
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
- * @ link				http://www.eventespresso.com
12
- * @ version		 	4.0
13
- *
14
- * ------------------------------------------------------------------------
15
- *
16
- * EED_Event_Single_Caff
17
- *
18
- * @package		Event Espresso
19
- * @subpackage	/modules/event_single_caff/
20
- * @author		Brent Christensen
21
- *
22
- * ------------------------------------------------------------------------
23
- */
3
+						 * Event Espresso
4
+						 *
5
+						 * Event Registration and Management Plugin for WordPress
6
+						 *
7
+						 * @ package			Event Espresso
8
+						 * @ author			Seth Shoultes
9
+						 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
10
+						 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
11
+						 * @ link				http://www.eventespresso.com
12
+						 * @ version		 	4.0
13
+						 *
14
+						 * ------------------------------------------------------------------------
15
+						 *
16
+						 * EED_Event_Single_Caff
17
+						 *
18
+						 * @package		Event Espresso
19
+						 * @subpackage	/modules/event_single_caff/
20
+						 * @author		Brent Christensen
21
+						 *
22
+						 * ------------------------------------------------------------------------
23
+						 */
24 24
 class EED_Event_Single_Caff  extends EED_Event_Single {
25 25
 
26 26
 
Please login to merge, or discard this patch.
caffeinated/modules/events_archive_caff/EED_Events_Archive_Caff.module.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@
 block discarded – undo
123 123
 	 *  @access 	public
124 124
 	 *  @param    EE_Template_Config $CFG
125 125
 	 *  @param 	array $REQ
126
-	 *  @return    EE_Events_Archive_Config
126
+	 *  @return    EE_Template_Config
127 127
 	 */
128 128
 	public static function update_template_settings( $CFG, $REQ ) {
129 129
 		$config = new EE_Events_Archive_Config();
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @return EED_Events_Archive_Caff
29 29
 	 */
30 30
 	public static function instance() {
31
-		return parent::get_instance( __CLASS__ );
31
+		return parent::get_instance(__CLASS__);
32 32
 	}
33 33
 
34 34
 
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 *  @return 	void
50 50
 	 */
51 51
 	public static function set_hooks_admin() {
52
-		define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
53
-		define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
54
-		add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 );
55
-		add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 );
52
+		define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
53
+		define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
54
+		add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10);
55
+		add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2);
56 56
 		// AJAX
57
-		add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
58
-		add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) );
57
+		add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
58
+		add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order'));
59 59
 	}
60 60
 
61 61
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 	 * @param    WP $WP
69 69
 	 * @return    void
70 70
 	 */
71
-	public function run( $WP ) {
71
+	public function run($WP) {
72 72
 	}
73 73
 
74 74
 
@@ -83,33 +83,33 @@  discard block
 block discarded – undo
83 83
 	 */
84 84
 	public static function template_settings_form() {
85 85
 		// grab general settings admin page and remove the existing hook callback
86
-		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' );
87
-		if ( $gen_set_admin instanceof General_Settings_Admin_Page ) {
88
-			remove_action( 'AHEE__template_settings__template__before_settings_form', array( $gen_set_admin, 'template_settings_caff_features' ), 100 );
86
+		$gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings');
87
+		if ($gen_set_admin instanceof General_Settings_Admin_Page) {
88
+			remove_action('AHEE__template_settings__template__before_settings_form', array($gen_set_admin, 'template_settings_caff_features'), 100);
89 89
 		}
90 90
 		// first just grab the template settings
91 91
 		$config = EE_Registry::instance()->CFG->template_settings;
92 92
 		// then if the Event Archive config is valid, use that, else create a new one
93
-		$config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
-		$config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config );
95
-		$config->display_status_banner = isset( $config->display_status_banner ) ? $config->display_status_banner : 0;
96
-		$config->display_description = isset( $config->display_description ) ? $config->display_description : 1;
97
-		$config->display_ticket_selector = isset( $config->display_ticket_selector ) ? $config->display_ticket_selector : 0;
98
-		$config->display_datetimes = isset( $config->display_datetimes ) ? $config->display_datetimes : 1;
99
-		$config->display_venue = isset( $config->display_venue ) ? $config->display_venue : 0;
100
-		$config->display_expired_events = isset( $config->display_expired_events ) ? $config->display_expired_events : 0;
93
+		$config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config ? $config->EED_Events_Archive : new EE_Events_Archive_Config();
94
+		$config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config);
95
+		$config->display_status_banner = isset($config->display_status_banner) ? $config->display_status_banner : 0;
96
+		$config->display_description = isset($config->display_description) ? $config->display_description : 1;
97
+		$config->display_ticket_selector = isset($config->display_ticket_selector) ? $config->display_ticket_selector : 0;
98
+		$config->display_datetimes = isset($config->display_datetimes) ? $config->display_datetimes : 1;
99
+		$config->display_venue = isset($config->display_venue) ? $config->display_venue : 0;
100
+		$config->display_expired_events = isset($config->display_expired_events) ? $config->display_expired_events : 0;
101 101
 		// display order options
102
-		$config->use_sortable_display_order = isset( $config->use_sortable_display_order  )? $config->use_sortable_display_order : false;
103
-		$config->display_order_tickets = isset( $config->display_order_tickets  )? $config->display_order_tickets : 100;
104
-		$config->display_order_datetimes = isset( $config->display_order_datetimes  )? $config->display_order_datetimes : 110;
105
-		$config->display_order_event = isset( $config->display_order_event  )? $config->display_order_event : 120;
106
-		$config->display_order_venue = isset( $config->display_order_venue  )? $config->display_order_venue : 130;
102
+		$config->use_sortable_display_order = isset($config->use_sortable_display_order) ? $config->use_sortable_display_order : false;
103
+		$config->display_order_tickets = isset($config->display_order_tickets) ? $config->display_order_tickets : 100;
104
+		$config->display_order_datetimes = isset($config->display_order_datetimes) ? $config->display_order_datetimes : 110;
105
+		$config->display_order_event = isset($config->display_order_event) ? $config->display_order_event : 120;
106
+		$config->display_order_venue = isset($config->display_order_venue) ? $config->display_order_venue : 130;
107 107
 		// get template parts
108
-		$template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config );
108
+		$template_parts = EED_Events_Archive::instance()->initialize_template_parts($config);
109 109
 		// convert to array so that we can add more properties
110
-		$config = get_object_vars( $config );
111
-		$config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' );
112
-		EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config );
110
+		$config = get_object_vars($config);
111
+		$config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js');
112
+		EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config);
113 113
 	}
114 114
 
115 115
 
@@ -125,24 +125,24 @@  discard block
 block discarded – undo
125 125
 	 *  @param 	array $REQ
126 126
 	 *  @return    EE_Events_Archive_Config
127 127
 	 */
128
-	public static function update_template_settings( $CFG, $REQ ) {
128
+	public static function update_template_settings($CFG, $REQ) {
129 129
 		$config = new EE_Events_Archive_Config();
130 130
 		// unless we are resetting the config...
131
-		if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) {
132
-			$config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0;
133
-			$config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1;
134
-			$config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0;
135
-			$config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1;
136
-			$config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0;
137
-			$config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0;
138
-			$config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0;
139
-			$config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
-			$config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
-			$config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
-			$config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
131
+		if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) {
132
+			$config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0;
133
+			$config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1;
134
+			$config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0;
135
+			$config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1;
136
+			$config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0;
137
+			$config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0;
138
+			$config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0;
139
+			$config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_tickets : 100;
140
+			$config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_datetimes : 110;
141
+			$config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_event : 120;
142
+			$config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order ? $CFG->EED_Events_Archive->display_order_venue : 130;
143 143
 		}
144 144
 		$CFG->EED_Events_Archive = $config;
145
-		do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ );
145
+		do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ);
146 146
 		return $CFG;
147 147
 	}
148 148
 
@@ -156,12 +156,12 @@  discard block
 block discarded – undo
156 156
 	 */
157 157
 	public static function update_event_archive_order() {
158 158
 		$config_saved = false;
159
-		$template_parts = sanitize_text_field( $_POST[ 'elements' ] );
160
-		if ( ! empty( $template_parts ) ) {
161
-			$template_parts = explode( ',', trim( $template_parts, ',' ) );
162
-			foreach ( $template_parts as $key => $template_part ) {
159
+		$template_parts = sanitize_text_field($_POST['elements']);
160
+		if ( ! empty($template_parts)) {
161
+			$template_parts = explode(',', trim($template_parts, ','));
162
+			foreach ($template_parts as $key => $template_part) {
163 163
 				$template_part = "display_order_$template_part";
164
-				$priority = ( $key * 10 ) + 100;
164
+				$priority = ($key * 10) + 100;
165 165
 				if (
166 166
 					property_exists(
167 167
 						EE_Registry::instance()->CFG->template_settings->EED_Events_Archive,
@@ -170,16 +170,16 @@  discard block
 block discarded – undo
170 170
 				) {
171 171
 					EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->$template_part = $priority;
172 172
 				}
173
-				do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority );
173
+				do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority);
174 174
 			}
175
-			$config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false );
175
+			$config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false);
176 176
 		}
177
-		if ( $config_saved ) {
178
-			EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) );
177
+		if ($config_saved) {
178
+			EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso'));
179 179
 		} else {
180
-			EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
180
+			EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
181 181
 		}
182
-		echo wp_json_encode( EE_Error::get_notices( false ) );
182
+		echo wp_json_encode(EE_Error::get_notices(false));
183 183
 		exit();
184 184
 	}
185 185
 
Please login to merge, or discard this patch.