Completed
Branch FET-10007-no-scary-messages (194aa6)
by
unknown
106:21 queued 95:57
created
espresso.php 1 patch
Spacing   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined( 'ABSPATH' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('ABSPATH')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  *
43 43
  */
44 44
 
45
-if ( function_exists( 'espresso_version' ) ) {
45
+if (function_exists('espresso_version')) {
46 46
 
47 47
 	/**
48 48
 	 *    espresso_duplicate_plugin_error
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
 	function espresso_duplicate_plugin_error() {
52 52
 		?>
53 53
 		<div class="error">
54
-			<p><?php _e( 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso' ); ?></p>
54
+			<p><?php _e('Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', 'event_espresso'); ?></p>
55 55
 		</div>
56 56
 		<?php
57
-		espresso_deactivate_plugin( plugin_basename( __FILE__ ) );
57
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
58 58
 	}
59
-	add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 );
59
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
60 60
 
61 61
 } else {
62 62
 
@@ -67,103 +67,103 @@  discard block
 block discarded – undo
67 67
 	 * @return string
68 68
 	 */
69 69
 	function espresso_version() {
70
-		return apply_filters( 'FHEE__espresso__espresso_version', '4.9.9.rc.017' );
70
+		return apply_filters('FHEE__espresso__espresso_version', '4.9.9.rc.017');
71 71
 	}
72 72
 
73 73
 	// define versions
74
-	define( 'EVENT_ESPRESSO_VERSION', espresso_version() );
75
-	define( 'EE_MIN_WP_VER_REQUIRED', '4.1' );
76
-	define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' );
77
-	define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' );
78
-	define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' );
79
-	define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION );
80
-	define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ );
74
+	define('EVENT_ESPRESSO_VERSION', espresso_version());
75
+	define('EE_MIN_WP_VER_REQUIRED', '4.1');
76
+	define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
77
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.0');
78
+	define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
79
+	define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION);
80
+	define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
81 81
 	//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
82
-	if ( ! defined( 'DS' ) ) {
83
-		define( 'DS', '/' );
82
+	if ( ! defined('DS')) {
83
+		define('DS', '/');
84 84
 	}
85
-	if ( ! defined( 'PS' ) ) {
86
-		define( 'PS', PATH_SEPARATOR );
85
+	if ( ! defined('PS')) {
86
+		define('PS', PATH_SEPARATOR);
87 87
 	}
88
-	if ( ! defined( 'SP' ) ) {
89
-		define( 'SP', ' ' );
88
+	if ( ! defined('SP')) {
89
+		define('SP', ' ');
90 90
 	}
91
-	if ( ! defined( 'EENL' ) ) {
92
-		define( 'EENL', "\n" );
91
+	if ( ! defined('EENL')) {
92
+		define('EENL', "\n");
93 93
 	}
94
-	define( 'EE_SUPPORT_EMAIL', '[email protected]' );
94
+	define('EE_SUPPORT_EMAIL', '[email protected]');
95 95
 	// define the plugin directory and URL
96
-	define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) );
97
-	define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) );
98
-	define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) );
96
+	define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
97
+	define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
98
+	define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
99 99
 	// main root folder paths
100
-	define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS );
101
-	define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS );
102
-	define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS );
103
-	define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS );
104
-	define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS );
105
-	define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS );
106
-	define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS );
107
-	define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS );
100
+	define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS);
101
+	define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS);
102
+	define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS);
103
+	define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS);
104
+	define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS);
105
+	define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS);
106
+	define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS);
107
+	define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS);
108 108
 	// core system paths
109
-	define( 'EE_ADMIN', EE_CORE . 'admin' . DS );
110
-	define( 'EE_CPTS', EE_CORE . 'CPTs' . DS );
111
-	define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS );
112
-	define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS );
113
-	define( 'EE_BUSINESS', EE_CORE . 'business' . DS );
114
-	define( 'EE_MODELS', EE_CORE . 'db_models' . DS );
115
-	define( 'EE_HELPERS', EE_CORE . 'helpers' . DS );
116
-	define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS );
117
-	define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS );
118
-	define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS );
119
-	define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS );
120
-	define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS );
109
+	define('EE_ADMIN', EE_CORE.'admin'.DS);
110
+	define('EE_CPTS', EE_CORE.'CPTs'.DS);
111
+	define('EE_CLASSES', EE_CORE.'db_classes'.DS);
112
+	define('EE_INTERFACES', EE_CORE.'interfaces'.DS);
113
+	define('EE_BUSINESS', EE_CORE.'business'.DS);
114
+	define('EE_MODELS', EE_CORE.'db_models'.DS);
115
+	define('EE_HELPERS', EE_CORE.'helpers'.DS);
116
+	define('EE_LIBRARIES', EE_CORE.'libraries'.DS);
117
+	define('EE_TEMPLATES', EE_CORE.'templates'.DS);
118
+	define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS);
119
+	define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS);
120
+	define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS);
121 121
 	// gateways
122
-	define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS );
123
-	define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS );
122
+	define('EE_GATEWAYS', EE_MODULES.'gateways'.DS);
123
+	define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS);
124 124
 	// asset URL paths
125
-	define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS );
126
-	define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS );
127
-	define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS );
128
-	define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS );
129
-	define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' );
130
-	define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' );
125
+	define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS);
126
+	define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS);
127
+	define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS);
128
+	define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS);
129
+	define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/');
130
+	define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/');
131 131
 	// define upload paths
132 132
 	$uploads = wp_upload_dir();
133 133
 	// define the uploads directory and URL
134
-	define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS );
135
-	define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS );
134
+	define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS);
135
+	define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS);
136 136
 	// define the templates directory and URL
137
-	define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS );
138
-	define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS );
137
+	define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS);
138
+	define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS);
139 139
 	// define the gateway directory and URL
140
-	define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS );
141
-	define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS );
140
+	define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS);
141
+	define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS);
142 142
 	// languages folder/path
143
-	define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS );
144
-	define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS );
143
+	define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS);
144
+	define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS);
145 145
 	//check for dompdf fonts in uploads
146
-	if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) {
147
-		define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS );
146
+	if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) {
147
+		define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS);
148 148
 	}
149 149
 	//ajax constants
150
-	define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false );
151
-	define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false );
150
+	define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false);
151
+	define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false);
152 152
 	//just a handy constant occasionally needed for finding values representing infinity in the DB
153 153
 	//you're better to use this than its straight value (currently -1) in case you ever
154 154
 	//want to change its default value! or find when -1 means infinity
155
-	define( 'EE_INF_IN_DB', -1 );
156
-	define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX );
157
-	define( 'EE_DEBUG', false );
155
+	define('EE_INF_IN_DB', -1);
156
+	define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX);
157
+	define('EE_DEBUG', false);
158 158
 
159 159
 	/**
160 160
 	 *    espresso_plugin_activation
161 161
 	 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
162 162
 	 */
163 163
 	function espresso_plugin_activation() {
164
-		update_option( 'ee_espresso_activation', true );
164
+		update_option('ee_espresso_activation', true);
165 165
 	}
166
-	register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' );
166
+	register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
167 167
 
168 168
 
169 169
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 		//	}
178 178
 		//
179 179
 	}
180
-	register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' );
180
+	register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation');
181 181
 
182 182
 
183 183
 
@@ -187,15 +187,15 @@  discard block
 block discarded – undo
187 187
 	 */
188 188
 	function espresso_load_error_handling() {
189 189
 		// load debugging tools
190
-		if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) {
191
-			require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' );
190
+		if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) {
191
+			require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php');
192 192
 			EEH_Debug_Tools::instance();
193 193
 		}
194 194
 		// load error handling
195
-		if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) {
196
-			require_once( EE_CORE . 'EE_Error.core.php' );
195
+		if (is_readable(EE_CORE.'EE_Error.core.php')) {
196
+			require_once(EE_CORE.'EE_Error.core.php');
197 197
 		} else {
198
-			wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) );
198
+			wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso'));
199 199
 		}
200 200
 	}
201 201
 
@@ -209,25 +209,25 @@  discard block
 block discarded – undo
209 209
 	 * @param    string $full_path_to_file
210 210
 	 * @throws    EE_Error
211 211
 	 */
212
-	function espresso_load_required( $classname, $full_path_to_file ) {
212
+	function espresso_load_required($classname, $full_path_to_file) {
213 213
 		static $error_handling_loaded = false;
214
-		if ( ! $error_handling_loaded ) {
214
+		if ( ! $error_handling_loaded) {
215 215
 			espresso_load_error_handling();
216 216
 			$error_handling_loaded = true;
217 217
 		}
218
-		if ( is_readable( $full_path_to_file ) ) {
219
-			require_once( $full_path_to_file );
218
+		if (is_readable($full_path_to_file)) {
219
+			require_once($full_path_to_file);
220 220
 		} else {
221
-			throw new EE_Error ( sprintf(
222
-				__( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ),
221
+			throw new EE_Error(sprintf(
222
+				__('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'),
223 223
 				$classname
224
-			) );
224
+			));
225 225
 		}
226 226
 	}
227 227
 
228
-	espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' );
229
-	espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' );
230
-	espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' );
228
+	espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php');
229
+	espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php');
230
+	espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php');
231 231
 	new EE_Bootstrap();
232 232
 
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
 
238 238
 
239
-if ( ! function_exists( 'espresso_deactivate_plugin' ) ) {
239
+if ( ! function_exists('espresso_deactivate_plugin')) {
240 240
 	/**
241 241
 	*    deactivate_plugin
242 242
 	* usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
@@ -245,11 +245,11 @@  discard block
 block discarded – undo
245 245
 	* @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
246 246
 	* @return    void
247 247
 	*/
248
-	function espresso_deactivate_plugin( $plugin_basename = '' ) {
249
-		if ( ! function_exists( 'deactivate_plugins' ) ) {
250
-			require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
248
+	function espresso_deactivate_plugin($plugin_basename = '') {
249
+		if ( ! function_exists('deactivate_plugins')) {
250
+			require_once(ABSPATH.'wp-admin/includes/plugin.php');
251 251
 		}
252
-		unset( $_GET[ 'activate' ], $_REQUEST[ 'activate' ] );
253
-		deactivate_plugins( $plugin_basename );
252
+		unset($_GET['activate'], $_REQUEST['activate']);
253
+		deactivate_plugins($plugin_basename);
254 254
 	}
255 255
 }
Please login to merge, or discard this patch.
modules/ticket_selector/EED_Ticket_Selector.module.php 3 patches
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 * @return EED_Ticket_Selector
58 58
 	 */
59 59
 	public static function instance() {
60
-		return parent::get_instance( __CLASS__ );
60
+		return parent::get_instance(__CLASS__);
61 61
 	}
62 62
 
63 63
 
64 64
 
65
-	protected function set_config(){
66
-		$this->set_config_section( 'template_settings' );
67
-		$this->set_config_class( 'EE_Ticket_Selector_Config' );
68
-		$this->set_config_name( 'EED_Ticket_Selector' );
65
+	protected function set_config() {
66
+		$this->set_config_section('template_settings');
67
+		$this->set_config_class('EE_Ticket_Selector_Config');
68
+		$this->set_config_name('EED_Ticket_Selector');
69 69
 	}
70 70
 
71 71
 
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	 */
81 81
 	public static function set_hooks() {
82 82
 		// routing
83
-		EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' );
84
-		EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' );
85
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
83
+		EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector');
84
+		EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections');
85
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
86 86
 		//add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 );
87
-		add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 );
87
+		add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1);
88 88
 		//add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 );
89 89
 		//add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 );
90
-		add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 );
90
+		add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10);
91 91
 	}
92 92
 
93 93
 
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 	 *  @return 	void
100 100
 	 */
101 101
 	public static function set_hooks_admin() {
102
-		add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 );
102
+		add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2);
103 103
 		//add button for iframe code to event editor.
104
-		add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 );
105
-		add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 );
104
+		add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4);
105
+		add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10);
106 106
 	}
107 107
 
108 108
 
@@ -114,15 +114,15 @@  discard block
 block discarded – undo
114 114
 	 *  @return 	void
115 115
 	 */
116 116
 	public static function set_definitions() {
117
-		define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS );
118
-		define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS );
117
+		define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS);
118
+		define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS);
119 119
 
120 120
 		//if config is not set, initialize
121 121
 		//If config is not set, set it.
122
-		if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) {
122
+		if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) {
123 123
 			EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config();
124 124
 		}
125
-		EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' );
125
+		EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso');
126 126
 	}
127 127
 
128 128
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * 	@param	object 			$WP
134 134
 	 * 	@return 	void
135 135
 	 */
136
-	public function run( $WP ) {}
136
+	public function run($WP) {}
137 137
 
138 138
 
139 139
 	/**
@@ -145,23 +145,23 @@  discard block
 block discarded – undo
145 145
 	public function ticket_selector_iframe() {
146 146
 		self::$_in_iframe = true;
147 147
 		/** @type EEM_Event $EEM_Event */
148
-		$EEM_Event = EE_Registry::instance()->load_model( 'Event' );
148
+		$EEM_Event = EE_Registry::instance()->load_model('Event');
149 149
 		$event = $EEM_Event->get_one_by_ID(
150
-			EE_Registry::instance()->REQ->get( 'event', 0 )
150
+			EE_Registry::instance()->REQ->get('event', 0)
151 151
 		);
152
-		EE_Registry::instance()->REQ->set_espresso_page( true );
153
-		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event );
152
+		EE_Registry::instance()->REQ->set_espresso_page(true);
153
+		$template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event);
154 154
 		$template_args['css'] = apply_filters(
155 155
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css',
156 156
 			array(
157
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION,
158
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION,
159
-				includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ),
160
-				EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION
157
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION,
158
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION,
159
+				includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']),
160
+				EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION
161 161
 			)
162 162
 		);
163
-		EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true;
164
-		EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' );
163
+		EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true;
164
+		EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso');
165 165
 		$template_args['eei18n'] = apply_filters(
166 166
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings',
167 167
 			EE_Registry::localize_i18n_js_strings()
@@ -169,18 +169,18 @@  discard block
 block discarded – undo
169 169
 		$template_args['js'] = apply_filters(
170 170
 			'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js',
171 171
 			array(
172
-				includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ),
173
-				EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION,
174
-				TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION
172
+				includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']),
173
+				EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION,
174
+				TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION
175 175
 			)
176 176
 		);
177
-		$template_args[ 'notices' ] = EEH_Template::display_template(
178
-			EE_TEMPLATES . 'espresso-ajax-notices.template.php',
177
+		$template_args['notices'] = EEH_Template::display_template(
178
+			EE_TEMPLATES.'espresso-ajax-notices.template.php',
179 179
 			array(),
180 180
 			true
181 181
 		);
182 182
 		EEH_Template::display_template(
183
-			TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php',
183
+			TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php',
184 184
 			$template_args
185 185
 		);
186 186
 		exit;
@@ -199,25 +199,25 @@  discard block
 block discarded – undo
199 199
 	 *
200 200
 	 * @return string The new html string for the permalink area.
201 201
 	 */
202
-	public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) {
202
+	public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) {
203 203
 		//make sure this is ONLY when editing and the event id has been set.
204
-		if ( ! empty( $id ) ) {
205
-			$post = get_post( $id );
204
+		if ( ! empty($id)) {
205
+			$post = get_post($id);
206 206
 			//if NOT event then let's get out.
207
-			if ( $post->post_type !== 'espresso_events' ) {
207
+			if ($post->post_type !== 'espresso_events') {
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
211
+			                     . __('Embed', 'event_espresso')
212 212
 			                     . '</a> ';
213
-			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
213
+			$ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url());
214 214
 			$iframe_string = esc_html(
215
-				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
215
+				'<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>'
216 216
 			);
217 217
 			$permalink_string .= '
218 218
 <div id="js-ts-iframe" style="display:none">
219 219
 	<div style="width:100%; height: 500px;">
220
-		' . $iframe_string . '
220
+		' . $iframe_string.'
221 221
 	</div>
222 222
 </div>';
223 223
 		}
@@ -236,22 +236,22 @@  discard block
 block discarded – undo
236 236
 	 * @param 	mixed $event
237 237
 	 * @return 	bool
238 238
 	 */
239
-	protected static function set_event( $event = null ) {
240
-		if( $event === null ) {
239
+	protected static function set_event($event = null) {
240
+		if ($event === null) {
241 241
 			global $post;
242 242
 			$event = $post;
243 243
 		}
244
-		if ( $event instanceof EE_Event ) {
244
+		if ($event instanceof EE_Event) {
245 245
 			self::$_event = $event;
246
-		} else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) {
246
+		} else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) {
247 247
 			self::$_event = $event->EE_Event;
248
-		} else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) {
249
-			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event );
248
+		} else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') {
249
+			$event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event);
250 250
 			self::$_event = $event->EE_Event;
251 251
 		} else {
252
-			$user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' );
253
-			$dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' );
254
-			EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ );
252
+			$user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso');
253
+			$dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso');
254
+			EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__);
255 255
 			return false;
256 256
 		}
257 257
 		return true;
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 * @param 	bool 	$view_details
271 271
 	 * @return 	string
272 272
 	 */
273
-	public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) {
273
+	public static function display_ticket_selector($event = NULL, $view_details = FALSE) {
274 274
 		// reset filter for displaying submit button
275
-		remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
275
+		remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
276 276
 		// poke and prod incoming event till it tells us what it is
277
-		if ( ! EED_Ticket_Selector::set_event( $event )) {
277
+		if ( ! EED_Ticket_Selector::set_event($event)) {
278 278
 			return false;
279 279
 		}
280 280
 		$event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 			&& (
286 286
 				! self::$_event->display_ticket_selector()
287 287
 				|| $view_details
288
-				|| post_password_required( $event_post )
288
+				|| post_password_required($event_post)
289 289
 				|| (
290 290
 					$_event_active_status != EE_Datetime::active
291 291
 					&& $_event_active_status != EE_Datetime::upcoming
@@ -303,68 +303,68 @@  discard block
 block discarded – undo
303 303
 		$template_args = array();
304 304
 		$template_args['event_status'] = $_event_active_status;
305 305
 
306
-		$template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) );
307
-		$template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) );
306
+		$template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format'));
307
+		$template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format'));
308 308
 
309 309
 		$template_args['EVT_ID'] = self::$_event->ID();
310 310
 		$template_args['event'] = self::$_event;
311 311
 
312 312
 		// is the event expired ?
313 313
 		$template_args['event_is_expired'] = self::$_event->is_expired();
314
-		if ( $template_args['event_is_expired'] ) {
315
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>';
314
+		if ($template_args['event_is_expired']) {
315
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>';
316 316
 		}
317 317
 
318 318
 		$ticket_query_args = array(
319
-			array( 'Datetime.EVT_ID' => self::$_event->ID() ),
320
-			'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' )
319
+			array('Datetime.EVT_ID' => self::$_event->ID()),
320
+			'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC')
321 321
 		);
322 322
 
323
-		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) {
323
+		if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) {
324 324
 			//use the correct applicable time query depending on what version of core is being run.
325
-			$current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp');
326
-			$ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time );
325
+			$current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp');
326
+			$ticket_query_args[0]['TKT_end_date'] = array('>', $current_time);
327 327
 		}
328 328
 
329 329
 		// get all tickets for this event ordered by the datetime
330
-		$template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args );
330
+		$template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args);
331 331
 
332
-		if ( count( $template_args['tickets'] ) < 1 ) {
333
-			return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>';
332
+		if (count($template_args['tickets']) < 1) {
333
+			return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>';
334 334
 		}
335 335
 
336 336
 		// filter the maximum qty that can appear in the Ticket Selector qty dropdowns
337
-		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() );
338
-		if ( $template_args['max_atndz'] < 1 ) {
339
-			$sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' );
340
-			if ( current_user_can( 'edit_post', self::$_event->ID() )) {
341
-				$sales_closed_msg .=  sprintf(
342
-					__( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ),
337
+		$template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit());
338
+		if ($template_args['max_atndz'] < 1) {
339
+			$sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso');
340
+			if (current_user_can('edit_post', self::$_event->ID())) {
341
+				$sales_closed_msg .= sprintf(
342
+					__('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'),
343 343
 					'<div class="ee-attention" style="text-align: left;"><b>',
344 344
 					'</b><br />',
345
-					$link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">',
345
+					$link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">',
346 346
 					'</a></span></div>'
347 347
 				);
348 348
 			}
349
-			return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>';
349
+			return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>';
350 350
 		}
351 351
 
352
-		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php';
353
-		$templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event );
352
+		$templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php';
353
+		$templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event);
354 354
 
355 355
 		// redirecting to another site for registration ??
356 356
 		$external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE;
357 357
 		// set up the form (but not for the admin)
358
-		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : '';
358
+		$ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : '';
359 359
 		// if not redirecting to another site for registration
360
-		if ( ! $external_url ) {
360
+		if ( ! $external_url) {
361 361
 			// then display the ticket selector
362
-			$ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args );
362
+			$ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args);
363 363
 		} else {
364 364
 			// if not we still need to trigger the display of the submit button
365
-			add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' );
365
+			add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true');
366 366
 			//display notice to admin that registration is external
367
-			$ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' );
367
+			$ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso');
368 368
 		}
369 369
 		// submit button and form close tag
370 370
 		$ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : '';
@@ -384,25 +384,25 @@  discard block
 block discarded – undo
384 384
 	 * @param 		string $external_url
385 385
 	 * @return 		string
386 386
 	 */
387
-	public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) {
387
+	public static function ticket_selector_form_open($ID = 0, $external_url = '') {
388 388
 		// if redirecting, we don't need any anything else
389
-		if ( $external_url ) {
390
-			$html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">';
391
-			$query_args = EEH_URL::get_query_string( $external_url );
392
-			foreach ( $query_args as $query_arg => $value ) {
393
-				$html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">';
389
+		if ($external_url) {
390
+			$html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">';
391
+			$query_args = EEH_URL::get_query_string($external_url);
392
+			foreach ($query_args as $query_arg => $value) {
393
+				$html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">';
394 394
 			}
395 395
 			return $html;
396 396
 		}
397
-		$checkout_url = EEH_Event_View::event_link_url( $ID );
398
-		if ( ! $checkout_url ) {
399
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
397
+		$checkout_url = EEH_Event_View::event_link_url($ID);
398
+		if ( ! $checkout_url) {
399
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
400 400
 		}
401 401
 		$extra_params = self::$_in_iframe ? ' target="_blank"' : '';
402
-		$html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>';
403
-		$html .= wp_nonce_field( 	'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE );
402
+		$html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>';
403
+		$html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE);
404 404
 		$html .= '<input type="hidden" name="ee" value="process_ticket_selections">';
405
-		$html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event );
405
+		$html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event);
406 406
 		return $html;
407 407
 	}
408 408
 
@@ -417,23 +417,23 @@  discard block
 block discarded – undo
417 417
 	 * 	@return		string
418 418
 	 */
419 419
 	public static function display_ticket_selector_submit() {
420
-		if ( ! is_admin() ) {
421
-			if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) {
420
+		if ( ! is_admin()) {
421
+			if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) {
422 422
 				$btn_text = apply_filters(
423 423
 					'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text',
424
-					__('Register Now', 'event_espresso' ),
424
+					__('Register Now', 'event_espresso'),
425 425
 					self::$_event
426 426
 				);
427 427
 				$external_url = self::$_event->external_url();
428
-				$html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"';
428
+				$html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"';
429 429
 				$html .= ' class="ticket-selector-submit-btn ';
430
-				$html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"';
431
-				$html .= ' type="submit" value="' . $btn_text . '" />';
432
-				$html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event );
430
+				$html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"';
431
+				$html .= ' type="submit" value="'.$btn_text.'" />';
432
+				$html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event);
433 433
 				$html .= '<div class="clear"><br/></div></form>';
434 434
 				return $html;
435
-			} else if ( is_archive() ) {
436
-				return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn();
435
+			} else if (is_archive()) {
436
+				return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn();
437 437
 			}
438 438
 		}
439 439
 		return '';
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 	 * 	@return		string
466 466
 	 */
467 467
 	public static function display_view_details_btn() {
468
-		if ( ! self::$_event->get_permalink() ) {
469
-			EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
468
+		if ( ! self::$_event->get_permalink()) {
469
+			EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
470 470
 		}
471
-		$view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">';
472
-		$btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event );
473
-		$view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />';
474
-		$view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event );
471
+		$view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">';
472
+		$btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event);
473
+		$view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />';
474
+		$view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event);
475 475
 		$view_details_btn .= '<div class="clear"><br/></div>';
476 476
 		$view_details_btn .= '</form>';
477 477
 		return $view_details_btn;
@@ -489,14 +489,14 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+        do_action('EED_Ticket_Selector__process_ticket_selections__before');
493 493
 		// check nonce
494 494
 		if (
495 495
 			! is_admin()
496 496
 			&& (
497
-				! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' )
497
+				! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce')
498 498
 				|| ! wp_verify_nonce(
499
-					EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ),
499
+					EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'),
500 500
 					'process_ticket_selections'
501 501
 				)
502 502
 			)
@@ -525,16 +525,16 @@  discard block
 block discarded – undo
525 525
 
526 526
 		//we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart.
527 527
 		// When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc.
528
-		EE_Registry::instance()->load_core( 'Session' );
528
+		EE_Registry::instance()->load_core('Session');
529 529
 		// unless otherwise requested, clear the session
530
-		if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) {
531
-			EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ );
530
+		if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) {
531
+			EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__);
532 532
 		}
533 533
 		//d( EE_Registry::instance()->SSN );
534 534
 
535
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
535
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
536 536
 		// do we have an event id?
537
-		if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) {
537
+		if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) {
538 538
 			// validate/sanitize data
539 539
 			$valid = self::_validate_post_data();
540 540
 
@@ -544,41 +544,41 @@  discard block
 block discarded – undo
544 544
 			//EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ );
545 545
 
546 546
 			//check total tickets ordered vs max number of attendees that can register
547
-			if ( $valid['total_tickets'] > $valid['max_atndz'] ) {
547
+			if ($valid['total_tickets'] > $valid['max_atndz']) {
548 548
 
549 549
 				// ordering too many tickets !!!
550 550
 				$total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso');
551
-				$limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] );
551
+				$limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']);
552 552
 				// dev only message
553 553
 				$max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso');
554
-				$limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] );
555
-				EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ );
554
+				$limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']);
555
+				EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__);
556 556
 			} else {
557 557
 
558 558
 				// all data appears to be valid
559 559
 				$tckts_slctd = FALSE;
560 560
 				$success = TRUE;
561 561
 				// load cart
562
-				EE_Registry::instance()->load_core( 'Cart' );
562
+				EE_Registry::instance()->load_core('Cart');
563 563
 
564 564
 				// cycle thru the number of data rows sent from the event listing
565
-				for ( $x = 0; $x < $valid['rows']; $x++ ) {
565
+				for ($x = 0; $x < $valid['rows']; $x++) {
566 566
 					// does this row actually contain a ticket quantity?
567
-					if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) {
567
+					if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) {
568 568
 						// YES we have a ticket quantity
569 569
 						$tckts_slctd = TRUE;
570 570
 						//						d( $valid['ticket_obj'][$x] );
571
-						if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) {
571
+						if ($valid['ticket_obj'][$x] instanceof EE_Ticket) {
572 572
 							// then add ticket to cart
573
-							$ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] );
573
+							$ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]);
574 574
 							$success = ! $ticket_added ? FALSE : $success;
575
-							if ( EE_Error::has_error() ) {
575
+							if (EE_Error::has_error()) {
576 576
 								break;
577 577
 							}
578 578
 						} else {
579 579
 							// nothing added to cart retrieved
580 580
 							EE_Error::add_error(
581
-								sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
581
+								sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
582 582
 								__FILE__, __FUNCTION__, __LINE__
583 583
 							);
584 584
 						}
@@ -587,45 +587,45 @@  discard block
 block discarded – undo
587 587
 				//d( EE_Registry::instance()->CART );
588 588
 				//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE
589 589
 
590
-				if ( $tckts_slctd ) {
591
-					if ( $success ) {
592
-						do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this );
590
+				if ($tckts_slctd) {
591
+					if ($success) {
592
+						do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this);
593 593
 						EE_Registry::instance()->CART->recalculate_all_cart_totals();
594
-						EE_Registry::instance()->CART->save_cart( FALSE );
594
+						EE_Registry::instance()->CART->save_cart(FALSE);
595 595
 						EE_Registry::instance()->SSN->update();
596 596
 						//d( EE_Registry::instance()->CART );
597 597
 						//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE
598 598
 						// just return TRUE for registrations being made from admin
599
-						if ( is_admin() ) {
599
+						if (is_admin()) {
600 600
 							return TRUE;
601 601
 						}
602
-						wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() ));
602
+						wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url()));
603 603
 						exit();
604 604
 
605 605
 					} else {
606
-						if ( ! EE_Error::has_error() ) {
606
+						if ( ! EE_Error::has_error()) {
607 607
 							// nothing added to cart
608
-							EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
608
+							EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
609 609
 						}
610 610
 					}
611 611
 
612 612
 				} else {
613 613
 					// no ticket quantities were selected
614
-					EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
614
+					EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
615 615
 				}
616 616
 			}
617 617
 			//die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT
618 618
 			// at this point, just return if registration is being made from admin
619
-			if ( is_admin() ) {
619
+			if (is_admin()) {
620 620
 				return FALSE;
621 621
 			}
622
-			if ( $valid['return_url'] ) {
623
-				EE_Error::get_notices( FALSE, TRUE );
624
-				wp_safe_redirect( $valid['return_url'] );
622
+			if ($valid['return_url']) {
623
+				EE_Error::get_notices(FALSE, TRUE);
624
+				wp_safe_redirect($valid['return_url']);
625 625
 				exit();
626
-			} elseif ( isset( $event_to_add['id'] )) {
627
-				EE_Error::get_notices( FALSE, TRUE );
628
-				wp_safe_redirect( get_permalink( $event_to_add['id'] ));
626
+			} elseif (isset($event_to_add['id'])) {
627
+				EE_Error::get_notices(FALSE, TRUE);
628
+				wp_safe_redirect(get_permalink($event_to_add['id']));
629 629
 				exit();
630 630
 			} else {
631 631
 				echo EE_Error::get_notices();
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 		} else {
635 635
 			// $_POST['tkt-slctr-event-id'] was not set ?!?!?!?
636 636
 			EE_Error::add_error(
637
-				sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ),
637
+				sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'),
638 638
 				__FILE__, __FUNCTION__, __LINE__
639 639
 			);
640 640
 		}
@@ -652,18 +652,18 @@  discard block
 block discarded – undo
652 652
 	 * @return        array  or FALSE
653 653
 	 */
654 654
 	private static function _validate_post_data() {
655
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
655
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
656 656
 
657 657
 		// start with an empty array()
658 658
 		$valid_data = array();
659 659
 		//		d( $_POST );
660 660
 		//if event id is valid
661
-		$id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' ));
662
-		if ( $id ) {
661
+		$id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id'));
662
+		if ($id) {
663 663
 			// grab valid id
664 664
 			$valid_data['id'] = $id;
665 665
 			// grab and sanitize return-url
666
-			$valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id ));
666
+			$valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id));
667 667
 			// array of other form names
668 668
 			$inputs_to_clean = array(
669 669
 				'event_id' => 'tkt-slctr-event-id',
@@ -676,22 +676,22 @@  discard block
 block discarded – undo
676 676
 			// let's track the total number of tickets ordered.'
677 677
 			$valid_data['total_tickets'] = 0;
678 678
 			// cycle through $inputs_to_clean array
679
-			foreach ( $inputs_to_clean as $what => $input_to_clean ) {
679
+			foreach ($inputs_to_clean as $what => $input_to_clean) {
680 680
 				// check for POST data
681
-				if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) {
681
+				if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) {
682 682
 					// grab value
683
-					$input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id );
683
+					$input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id);
684 684
 					switch ($what) {
685 685
 
686 686
 						// integers
687 687
 						case 'event_id':
688
-							$valid_data[$what] = absint( $input_value );
688
+							$valid_data[$what] = absint($input_value);
689 689
 							// get event via the event id we put in the form
690
-							$valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] );
690
+							$valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']);
691 691
 							break;
692 692
 						case 'rows':
693 693
 						case 'max_atndz':
694
-							$valid_data[$what] = absint( $input_value );
694
+							$valid_data[$what] = absint($input_value);
695 695
 							break;
696 696
 
697 697
 						// arrays of integers
@@ -699,27 +699,27 @@  discard block
 block discarded – undo
699 699
 							//							d( $input_value );
700 700
 							$row_qty = $input_value;
701 701
 							// if qty is coming from a radio button input, then we need to assemble an array of rows
702
-							if( ! is_array( $row_qty )) {
702
+							if ( ! is_array($row_qty)) {
703 703
 								// get number of rows
704
-								$rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1;
704
+								$rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1;
705 705
 								//								d( $rows );
706 706
 								// explode ints by the dash
707
-								$row_qty = explode( '-', $row_qty );
708
-								$row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1;
709
-								$qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0;
710
-								$row_qty = array( $row => $qty );
707
+								$row_qty = explode('-', $row_qty);
708
+								$row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1;
709
+								$qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0;
710
+								$row_qty = array($row => $qty);
711 711
 								//								 d( $row_qty );
712
-								for( $x = 1; $x <= $rows; $x++ ) {
713
-									if ( ! isset( $row_qty[$x] )) {
712
+								for ($x = 1; $x <= $rows; $x++) {
713
+									if ( ! isset($row_qty[$x])) {
714 714
 										$row_qty[$x] = 0;
715 715
 									}
716 716
 								}
717 717
 							}
718
-							ksort( $row_qty );
718
+							ksort($row_qty);
719 719
 							//							 d( $row_qty );
720 720
 							// cycle thru values
721
-							foreach ( $row_qty as $qty ) {
722
-								$qty = absint( $qty );
721
+							foreach ($row_qty as $qty) {
722
+								$qty = absint($qty);
723 723
 								// sanitize as integers
724 724
 								$valid_data[$what][] = $qty;
725 725
 								$valid_data['total_tickets'] += $qty;
@@ -730,19 +730,19 @@  discard block
 block discarded – undo
730 730
 						case 'ticket_id':
731 731
 							$value_array = array();
732 732
 							// cycle thru values
733
-							foreach ( $input_value as $key=>$value ) {
733
+							foreach ($input_value as $key=>$value) {
734 734
 								// allow only numbers, letters,  spaces, commas and dashes
735
-								$value_array[ $key ] = wp_strip_all_tags( $value );
735
+								$value_array[$key] = wp_strip_all_tags($value);
736 736
 								// get ticket via the ticket id we put in the form
737
-								$ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value );
738
-								$valid_data['ticket_obj'][ $key ] = $ticket_obj;
737
+								$ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value);
738
+								$valid_data['ticket_obj'][$key] = $ticket_obj;
739 739
 							}
740
-							$valid_data[ $what ] = $value_array;
740
+							$valid_data[$what] = $value_array;
741 741
 							break;
742 742
 
743 743
 						case 'return_url' :
744 744
 							// grab and sanitize return-url
745
-							$valid_data[$what] = esc_url_raw( $input_value );
745
+							$valid_data[$what] = esc_url_raw($input_value);
746 746
 							break;
747 747
 
748 748
 					} 	// end switch $what
@@ -750,7 +750,7 @@  discard block
 block discarded – undo
750 750
 			} 	// end foreach $inputs_to_clean
751 751
 
752 752
 		} else {
753
-			EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
753
+			EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
754 754
 			return FALSE;
755 755
 		}
756 756
 
@@ -768,28 +768,28 @@  discard block
 block discarded – undo
768 768
 	 * @param int       $qty
769 769
 	 * @return TRUE on success, FALSE on fail
770 770
 	 */
771
-	private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) {
772
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
771
+	private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) {
772
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
773 773
 		// get the number of spaces left for this datetime ticket
774
-		$available_spaces = self::_ticket_datetime_availability( $ticket );
774
+		$available_spaces = self::_ticket_datetime_availability($ticket);
775 775
 		// compare available spaces against the number of tickets being purchased
776
-		if ( $available_spaces >= $qty ) {
776
+		if ($available_spaces >= $qty) {
777 777
 			// allow addons to prevent a ticket from being added to cart
778
-			if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) {
778
+			if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) {
779 779
 				return false;
780 780
 			}
781 781
 			// add event to cart
782
-			if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) {
783
-				self::_recalculate_ticket_datetime_availability( $ticket, $qty );
782
+			if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) {
783
+				self::_recalculate_ticket_datetime_availability($ticket, $qty);
784 784
 				return true;
785 785
 			} else {
786 786
 				return false;
787 787
 			}
788 788
 		} else {
789 789
 			// tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets
790
-			$available_spaces = self::_ticket_datetime_availability( $ticket, true );
790
+			$available_spaces = self::_ticket_datetime_availability($ticket, true);
791 791
 			// greedy greedy greedy eh?
792
-			if ( $available_spaces > 0 ) {
792
+			if ($available_spaces > 0) {
793 793
 				// add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces
794 794
 				EE_Error::add_error(
795 795
 					sprintf(
@@ -805,7 +805,7 @@  discard block
 block discarded – undo
805 805
 					__FILE__, __FUNCTION__, __LINE__
806 806
 				);
807 807
 			} else {
808
-				EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
808
+				EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
809 809
 			}
810 810
 			return false;
811 811
 		}
@@ -823,22 +823,22 @@  discard block
 block discarded – undo
823 823
 	 * @param 	bool         $get_original_ticket_spaces
824 824
 	 * @return 	int
825 825
 	 */
826
-	private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) {
826
+	private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) {
827 827
 		// if the $_available_spaces array has not been set up yet...
828
-		if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
829
-				self::_set_initial_ticket_datetime_availability( $ticket );
828
+		if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
829
+				self::_set_initial_ticket_datetime_availability($ticket);
830 830
 		}
831 831
 		$available_spaces = $ticket->qty() - $ticket->sold();
832
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
832
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
833 833
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
834
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
834
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
835 835
 				// if we want the original datetime availability BEFORE we started subtracting tickets ?
836
-				if ( $get_original_ticket_spaces ) {
836
+				if ($get_original_ticket_spaces) {
837 837
 					// then grab the available spaces from the "tickets" array and compare with the above to get the lowest number
838
-					$available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] );
838
+					$available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]);
839 839
 				} else {
840 840
 					// we want the updated ticket availability as stored in the "datetimes" array
841
-					$available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] );
841
+					$available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]);
842 842
 				}
843 843
 			}
844 844
 		}
@@ -854,23 +854,23 @@  discard block
 block discarded – undo
854 854
 	 * @param 	EE_Ticket $ticket
855 855
 	 * @return 	int
856 856
 	 */
857
-	private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) {
857
+	private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) {
858 858
 		// first, get all of the datetimes that are available to this ticket
859 859
 		$datetimes = $ticket->get_many_related(
860 860
 			'Datetime',
861
-			array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' ))
861
+			array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC'))
862 862
 		);
863
-		if ( ! empty( $datetimes )) {
863
+		if ( ! empty($datetimes)) {
864 864
 			// now loop thru all of the datetimes
865
-			foreach ( $datetimes as $datetime  ) {
866
-				if ( $datetime instanceof EE_Datetime ) {
865
+			foreach ($datetimes as $datetime) {
866
+				if ($datetime instanceof EE_Datetime) {
867 867
 					// the number of spaces available for the datetime without considering individual ticket quantities
868 868
 					$spaces_remaining = $datetime->spaces_remaining();
869 869
 					// save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key
870
-					self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining );
870
+					self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining);
871 871
 					// if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number,
872 872
 					// else just take the datetime spaces remaining, and assign to the datetimes array
873
-					self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining;
873
+					self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining;
874 874
 				}
875 875
 			}
876 876
 		}
@@ -886,12 +886,12 @@  discard block
 block discarded – undo
886 886
 	 * @param 	int   $qty
887 887
 	 * @return 	int
888 888
 	 */
889
-	private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) {
890
-		if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) {
889
+	private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) {
890
+		if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) {
891 891
 			// loop thru tickets, which will ALSO include individual ticket records AND a total
892
-			foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces  ) {
892
+			foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) {
893 893
 				// subtract the qty of selected tickets from each datetime's available spaces this ticket has access to,
894
-				self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty;
894
+				self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty;
895 895
 			}
896 896
 		}
897 897
 	}
@@ -908,8 +908,8 @@  discard block
 block discarded – undo
908 908
 	*/
909 909
 	public static function load_tckt_slctr_assets() {
910 910
 		// add some style
911
-		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
912
-			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css');
911
+		if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) {
912
+			wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css');
913 913
 			wp_enqueue_style('ticket_selector');
914 914
 			// make it dance
915 915
 			//			wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE);
@@ -923,9 +923,9 @@  discard block
 block discarded – undo
923 923
 
924 924
 	public static function load_tckt_slctr_assets_admin() {
925 925
 		//iframe button js on admin event editor page
926
-		if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) {
927
-			wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true );
928
-			wp_enqueue_script( 'ticket_selector_embed' );
926
+		if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') {
927
+			wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true);
928
+			wp_enqueue_script('ticket_selector_embed');
929 929
 		}
930 930
 	}
931 931
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	protected static $_event = NULL;
36 36
 
37 37
 	/**
38
-	* array of datetimes and the spaces available for them
39
-	*
40
-	* @access private
41
-	* @var array
42
-	*/
38
+	 * array of datetimes and the spaces available for them
39
+	 *
40
+	 * @access private
41
+	 * @var array
42
+	 */
43 43
 	private static $_available_spaces = array();
44 44
 
45 45
 
@@ -208,8 +208,8 @@  discard block
 block discarded – undo
208 208
 				return $permalink_string;
209 209
 			}
210 210
 			$permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#"  tabindex="-1">'
211
-			                     . __( 'Embed', 'event_espresso' )
212
-			                     . '</a> ';
211
+								 . __( 'Embed', 'event_espresso' )
212
+								 . '</a> ';
213 213
 			$ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() );
214 214
 			$iframe_string = esc_html(
215 215
 				'<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>'
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * 	@return array|boolean
490 490
 	 */
491 491
 	public function process_ticket_selections() {
492
-        do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
492
+		do_action( 'EED_Ticket_Selector__process_ticket_selections__before' );
493 493
 		// check nonce
494 494
 		if (
495 495
 			! is_admin()
@@ -901,11 +901,11 @@  discard block
 block discarded – undo
901 901
 
902 902
 
903 903
 	/**
904
-	* 	load js
905
-	*
906
-	* 	@access 		public
907
-	* 	@return 		void
908
-	*/
904
+	 * 	load js
905
+	 *
906
+	 * 	@access 		public
907
+	 * 	@return 		void
908
+	 */
909 909
 	public static function load_tckt_slctr_assets() {
910 910
 		// add some style
911 911
 		if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) {
Please login to merge, or discard this patch.