Completed
Branch BETA-4.9-message-activity (c2a8e0)
by
unknown
18:28 queued 10s
created
admin_pages/maintenance/Maintenance_Admin_Page.core.php 1 patch
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 class Maintenance_Admin_Page extends EE_Admin_Page {
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		parent::__construct($routing);
35 35
 	}
36 36
 
37 37
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 
48 48
 	protected function _ajax_hooks() {
49
-		add_action('wp_ajax_migration_step',array($this,'migration_step'));
50
-		add_action('wp_ajax_add_error_to_migrations_ran',array($this,'add_error_to_migrations_ran'));
49
+		add_action('wp_ajax_migration_step', array($this, 'migration_step'));
50
+		add_action('wp_ajax_add_error_to_migrations_ran', array($this, 'add_error_to_migrations_ran'));
51 51
 	}
52 52
 
53 53
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->_admin_page_title = EE_MAINTENANCE_LABEL;
57 57
 		$this->_labels = array(
58 58
 			'buttons' => array(
59
-				'reset_capabilities' => __( 'Reset Event Espresso Capabilities', 'event_espresso' )
59
+				'reset_capabilities' => __('Reset Event Espresso Capabilities', 'event_espresso')
60 60
 				)
61 61
 			);
62 62
 	}
@@ -155,23 +155,23 @@  discard block
 block discarded – undo
155 155
 	 * default maintenance page. If we're in maintenance mode level 2, then we need to show
156 156
 	 * the migration scripts and all that UI.
157 157
 	 */
158
-	public function _maintenance(){
158
+	public function _maintenance() {
159 159
 		//it all depends if we're in maintenance model level 1 (frontend-only) or
160 160
 		//level 2 (everything except maintenance page)
161
-		try{
161
+		try {
162 162
 			//get the current maintenance level and check if
163 163
 			//we are removed
164 164
 			$mm = EE_Maintenance_Mode::instance()->level();
165 165
 			$placed_in_mm = EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
166
-			if( $mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm){
166
+			if ($mm == EE_Maintenance_Mode::level_2_complete_maintenance && ! $placed_in_mm) {
167 167
 				//we just took the site out of maintenance mode, so notify the user.
168 168
 				//unfortunately this message appears to be echoed on the NEXT page load...
169 169
 				//oh well, we should really be checking for this on addon deactivation anyways
170
-				EE_Error::add_attention( __( 'Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso' ) );
171
-				$this->_process_notices( array( 'page' => 'espresso_maintenance_settings'), false );
170
+				EE_Error::add_attention(__('Site taken out of maintenance mode because no data migration scripts are required', 'event_espresso'));
171
+				$this->_process_notices(array('page' => 'espresso_maintenance_settings'), false);
172 172
 			}
173 173
 			//in case an exception is thrown while trying to handle migrations
174
-			switch(EE_Maintenance_Mode::instance()->level()){
174
+			switch (EE_Maintenance_Mode::instance()->level()) {
175 175
 				case EE_Maintenance_Mode::level_0_not_in_maintenance:
176 176
 				case EE_Maintenance_Mode::level_1_frontend_only_maintenance:
177 177
 					$show_maintenance_switch = true;
@@ -183,18 +183,18 @@  discard block
 block discarded – undo
183 183
 				case EE_Maintenance_Mode::level_2_complete_maintenance:
184 184
 					$show_maintenance_switch = false;
185 185
 					$show_migration_progress = true;
186
-					if(isset($this->_req_data['continue_migration'])){
186
+					if (isset($this->_req_data['continue_migration'])) {
187 187
 						$show_backup_db_text = false;
188
-					}else{
188
+					} else {
189 189
 						$show_backup_db_text = true;
190 190
 					}
191 191
 					$scripts_needing_to_run = EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts();
192 192
 					$addons_should_be_upgraded_first = EE_Data_Migration_Manager::instance()->addons_need_updating();
193 193
 					$script_names = array();
194 194
 					$current_script = NULL;
195
-					foreach($scripts_needing_to_run as $script){
196
-						if($script instanceof EE_Data_Migration_Script_Base){
197
-							if( ! $current_script){
195
+					foreach ($scripts_needing_to_run as $script) {
196
+						if ($script instanceof EE_Data_Migration_Script_Base) {
197
+							if ( ! $current_script) {
198 198
 								$current_script = $script;
199 199
 								$current_script->migration_page_hooks();
200 200
 							}
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 			}
206 206
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
207 207
 			$exception_thrown = false;
208
-		}catch(EE_Error $e){
208
+		} catch (EE_Error $e) {
209 209
 
210 210
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
211 211
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -215,53 +215,53 @@  discard block
 block discarded – undo
215 215
 			$exception_thrown = true;
216 216
 		}
217 217
 		$current_db_state = EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set();
218
-		if($exception_thrown ||
219
-				(	$most_recent_migration &&
218
+		if ($exception_thrown ||
219
+				($most_recent_migration &&
220 220
 					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
221 221
 					$most_recent_migration->is_broken()
222
-				)){
223
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_was_borked_page.template.php';
224
-			$this->_template_args[ 'support_url' ] = 'http://eventespresso.com/support/forums/';
225
-			$this->_template_args[ 'next_url' ] = EEH_URL::add_query_args_and_nonce(array( 'action' => 'confirm_migration_crash_report_sent', 'success' => '0' ), EE_MAINTENANCE_ADMIN_URL );
226
-		}elseif($addons_should_be_upgraded_first){
227
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_upgrade_addons_before_migrating.template.php';
228
-		}else{
229
-			if($most_recent_migration &&
230
-					$most_recent_migration instanceof EE_Data_Migration_Script_Base  &&
231
-					$most_recent_migration->can_continue()){
222
+				)) {
223
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_was_borked_page.template.php';
224
+			$this->_template_args['support_url'] = 'http://eventespresso.com/support/forums/';
225
+			$this->_template_args['next_url'] = EEH_URL::add_query_args_and_nonce(array('action' => 'confirm_migration_crash_report_sent', 'success' => '0'), EE_MAINTENANCE_ADMIN_URL);
226
+		}elseif ($addons_should_be_upgraded_first) {
227
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_upgrade_addons_before_migrating.template.php';
228
+		} else {
229
+			if ($most_recent_migration &&
230
+					$most_recent_migration instanceof EE_Data_Migration_Script_Base &&
231
+					$most_recent_migration->can_continue()) {
232 232
 				$show_backup_db_text = false;
233 233
 				$show_continue_current_migration_script = true;
234 234
 				$show_most_recent_migration = true;
235
-			}elseif(isset($this->_req_data['continue_migration'])){
235
+			}elseif (isset($this->_req_data['continue_migration'])) {
236 236
 				$show_most_recent_migration = true;
237 237
 				$show_continue_current_migration_script = false;
238
-			}else{
238
+			} else {
239 239
 				$show_most_recent_migration = false;
240 240
 				$show_continue_current_migration_script = false;
241 241
 			}
242 242
 
243
-			if(isset($current_script)){
243
+			if (isset($current_script)) {
244 244
 				$migrates_to = $current_script->migrates_to_version();
245
-				$plugin_slug = $migrates_to[ 'slug' ];
246
-				$new_version = $migrates_to[ 'version' ];
247
-				$this->_template_args = array_merge($this->_template_args,array(
248
-					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3,$plugin_slug),
249
-					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'),$new_version,$plugin_slug) : NULL));
245
+				$plugin_slug = $migrates_to['slug'];
246
+				$new_version = $migrates_to['version'];
247
+				$this->_template_args = array_merge($this->_template_args, array(
248
+					'current_db_state'=>  sprintf(__("EE%s (%s)", "event_espresso"), isset($current_db_state[$plugin_slug]) ? $current_db_state[$plugin_slug] : 3, $plugin_slug),
249
+					'next_db_state'=>isset($current_script) ? sprintf(__("EE%s (%s)", 'event_espresso'), $new_version, $plugin_slug) : NULL));
250 250
 			}
251 251
 
252
-			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_migration_page.template.php';
252
+			$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_migration_page.template.php';
253 253
 			$this->_template_args = array_merge(
254 254
 				$this->_template_args,
255 255
 				array(
256
-					'show_most_recent_migration' => $show_most_recent_migration,//flag for showing the most recent migration's status and/or errors
257
-					'show_migration_progress' => $show_migration_progress,//flag for showing the option to run migrations and see their progress
258
-					'show_backup_db_text' => $show_backup_db_text,//flag for showing text telling the user to backup their DB
259
-					'show_maintenance_switch'=> $show_maintenance_switch,//flag for showing the option to change maintenance mode between levels 0 and 1
260
-					'script_names'=>$script_names,//array of names of scripts that have run
261
-					'show_continue_current_migration_script'=>$show_continue_current_migration_script,//flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
256
+					'show_most_recent_migration' => $show_most_recent_migration, //flag for showing the most recent migration's status and/or errors
257
+					'show_migration_progress' => $show_migration_progress, //flag for showing the option to run migrations and see their progress
258
+					'show_backup_db_text' => $show_backup_db_text, //flag for showing text telling the user to backup their DB
259
+					'show_maintenance_switch'=> $show_maintenance_switch, //flag for showing the option to change maintenance mode between levels 0 and 1
260
+					'script_names'=>$script_names, //array of names of scripts that have run
261
+					'show_continue_current_migration_script'=>$show_continue_current_migration_script, //flag to change wording to indicating that we're only CONTINUING a migration script (somehow it got interrupted0
262 262
 					'reset_db_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL),
263
-					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'),EE_MAINTENANCE_ADMIN_URL),
264
-					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'),espresso_version()),
263
+					'update_migration_script_page_link' => EE_Admin_Page::add_query_args_and_nonce(array('action'=>'change_maintenance_level'), EE_MAINTENANCE_ADMIN_URL),
264
+					'ultimate_db_state'=>  sprintf(__("EE%s", 'event_espresso'), espresso_version()),
265 265
 				)
266 266
 			);
267 267
 		//make sure we have the form fields helper available. It usually is, but sometimes it isn't
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
 			'status_fatal_error'=>  EE_Data_Migration_Manager::status_fatal_error,
276 276
 			'status_completed'=>  EE_Data_Migration_Manager::status_completed));
277 277
 		}
278
-		$this->_template_args['most_recent_migration'] = $most_recent_migration;//the actual most recently ran migration
278
+		$this->_template_args['most_recent_migration'] = $most_recent_migration; //the actual most recently ran migration
279 279
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
280 280
 		$this->display_admin_page_with_sidebar();
281 281
 	}
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
 	/**
286 286
 	 * returns JSON and executes another step of the currently-executing data migration (called via ajax)
287 287
 	 */
288
-	public function migration_step(){
288
+	public function migration_step() {
289 289
 		$this->_template_args['data'] = EE_Data_Migration_Manager::instance()->response_to_migration_ajax_request();
290 290
 		$this->_return_json();
291 291
 	}
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	 * Can be used by js when it notices a response with HTML in it in order
297 297
 	 * to log the malformed response
298 298
 	 */
299
-	public function add_error_to_migrations_ran(){
299
+	public function add_error_to_migrations_ran() {
300 300
 		EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($this->_req_data['message']);
301 301
 		$this->_template_args['data'] = array('ok'=>true);
302 302
 		$this->_return_json();
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 	/**
308 308
 	 * changes the maintenance level, provided there are still no migration scripts that shoudl run
309 309
 	 */
310
-	public function _change_maintenance_level(){
310
+	public function _change_maintenance_level() {
311 311
 		$new_level = intval($this->_req_data['maintenance_mode_level']);
312
-		if( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()){
312
+		if ( ! EE_Data_Migration_Manager::instance()->check_for_applicable_data_migration_scripts()) {
313 313
 			EE_Maintenance_Mode::instance()->set_maintenance_level($new_level);
314 314
 			$success = true;
315
-		}else{
315
+		} else {
316 316
 			EE_Maintenance_Mode::instance()->set_maintenance_mode_if_db_old();
317
-			$success= false;
317
+			$success = false;
318 318
 		}
319 319
 		$this->_redirect_after_action($success, 'Maintenance Mode', __("Updated", "event_espresso"));
320 320
 	}
@@ -324,9 +324,9 @@  discard block
 block discarded – undo
324 324
 	/**
325 325
 	 * a tab with options for reseting and/or deleting EE data
326 326
 	 */
327
-	public function _data_reset_and_delete(){
328
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_data_reset_and_delete.template.php';
329
-		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button( 'reset_capabilities', 'reset_capabilities', array(),  'button button-primary' );
327
+	public function _data_reset_and_delete() {
328
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_data_reset_and_delete.template.php';
329
+		$this->_template_args['reset_capabilities_button'] = $this->get_action_link_or_button('reset_capabilities', 'reset_capabilities', array(), 'button button-primary');
330 330
 		$this->_template_args['delete_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_db'), EE_MAINTENANCE_ADMIN_URL);
331 331
 		$this->_template_args['reset_db_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL);
332 332
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
@@ -336,9 +336,9 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
 	protected function _reset_capabilities() {
339
-		EE_Registry::instance()->CAP->init_caps( true );
340
-		EE_Error::add_success( __('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso' ) );
341
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'data_reset' ), TRUE );
339
+		EE_Registry::instance()->CAP->init_caps(true);
340
+		EE_Error::add_success(__('Default Event Espresso capabilities have been restored for all current roles.', 'event_espresso'));
341
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'data_reset'), TRUE);
342 342
 	}
343 343
 
344 344
 	/**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	protected function _reattempt_migration() {
350 350
 		EE_Data_Migration_Manager::instance()->reattempt();
351
-		$this->_redirect_after_action( FALSE, '', '', array( 'action' => 'default' ), TRUE );
351
+		$this->_redirect_after_action(FALSE, '', '', array('action' => 'default'), TRUE);
352 352
 	}
353 353
 
354 354
 
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 	/**
358 358
 	 * shows the big ol' System Information page
359 359
 	 */
360
-	public function _system_status(){
361
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_system_stati_page.template.php';
360
+	public function _system_status() {
361
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_system_stati_page.template.php';
362 362
 		$this->_template_args['system_stati'] = EEM_System_Status::instance()->get_system_stati();
363 363
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
364 364
 		$this->display_admin_page_with_sidebar();
@@ -366,30 +366,30 @@  discard block
 block discarded – undo
366 366
 
367 367
 
368 368
 
369
-	public function _send_migration_crash_report(){
369
+	public function _send_migration_crash_report() {
370 370
 		$from = $this->_req_data['from'];
371 371
 		$from_name = $this->_req_data['from_name'];
372 372
 		$body = $this->_req_data['body'];
373
-		try{
373
+		try {
374 374
 		$success = wp_mail(EE_SUPPORT_EMAIL,
375 375
 				'Migration Crash Report',
376
-				$body."/r/n<br>".  print_r(EEM_System_Status::instance()->get_system_stati(),true),
376
+				$body."/r/n<br>".print_r(EEM_System_Status::instance()->get_system_stati(), true),
377 377
 				array(
378 378
 					"from:$from_name<$from>",
379 379
 //					'content-type:text/html charset=UTF-8'
380 380
 					));
381
-		}catch( Exception $e ){
381
+		} catch (Exception $e) {
382 382
 			$success = FALSE;
383 383
 		}
384
-		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"),array('success'=>$success,'action'=>'confirm_migration_crash_report_sent'));
384
+		$this->_redirect_after_action($success, __("Migration Crash Report", "event_espresso"), __("sent", "event_espresso"), array('success'=>$success, 'action'=>'confirm_migration_crash_report_sent'));
385 385
 	}
386 386
 
387 387
 
388 388
 
389
-	public function _confirm_migration_crash_report_sent(){
390
-		try{
389
+	public function _confirm_migration_crash_report_sent() {
390
+		try {
391 391
 			$most_recent_migration = EE_Data_Migration_Manager::instance()->get_last_ran_script(true);
392
-		}catch(EE_Error $e){
392
+		} catch (EE_Error $e) {
393 393
 
394 394
 			EE_Data_Migration_Manager::instance()->add_error_to_migrations_ran($e->getMessage());
395 395
 			//now, just so we can display the page correctly, make a error migration script stage object
@@ -397,14 +397,14 @@  discard block
 block discarded – undo
397 397
 			$most_recent_migration = new EE_DMS_Unknown_1_0_0();
398 398
 			$most_recent_migration->add_error($e->getMessage());
399 399
 		}
400
-		$success = $this->_req_data['success']=='1' ? true : false;
400
+		$success = $this->_req_data['success'] == '1' ? true : false;
401 401
 		$this->_template_args['success'] = $success;
402
-		$this->_template_args[ 'most_recent_migration' ] = $most_recent_migration;
402
+		$this->_template_args['most_recent_migration'] = $most_recent_migration;
403 403
 		$this->_template_args['reset_db_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'reset_db'), EE_MAINTENANCE_ADMIN_URL);
404
-		$this->_template_args[ 'reset_db_page_url' ] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
405
-		$this->_template_args[ 'reattempt_action_url' ] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL );
406
-		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH . 'ee_confirm_migration_crash_report_sent.template.php';
407
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path,$this->_template_args,TRUE);
404
+		$this->_template_args['reset_db_page_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'data_reset'), EE_MAINTENANCE_ADMIN_URL);
405
+		$this->_template_args['reattempt_action_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'reattempt_migration'), EE_MAINTENANCE_ADMIN_URL);
406
+		$this->_template_path = EE_MAINTENANCE_TEMPLATE_PATH.'ee_confirm_migration_crash_report_sent.template.php';
407
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template($this->_template_path, $this->_template_args, TRUE);
408 408
 		$this->display_admin_page_with_sidebar();
409 409
 	}
410 410
 
@@ -417,18 +417,18 @@  discard block
 block discarded – undo
417 417
 	 * @param boolean $nuke_old_ee4_data controls whether or not we
418 418
 	 * destroy the old ee4 data, or just try initializing ee4 default data
419 419
 	 */
420
-	public function _reset_db( $nuke_old_ee4_data = TRUE ){
420
+	public function _reset_db($nuke_old_ee4_data = TRUE) {
421 421
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
422 422
 
423
-		if( $nuke_old_ee4_data ){
423
+		if ($nuke_old_ee4_data) {
424 424
 			EEH_Activation::delete_all_espresso_cpt_data();
425
-			EEH_Activation::delete_all_espresso_tables_and_data( FALSE );
425
+			EEH_Activation::delete_all_espresso_tables_and_data(FALSE);
426 426
 			EEH_Activation::remove_cron_tasks();
427 427
 		}
428 428
 		//make sure when we reset the registry's config that it
429 429
 		//switches to using the new singleton
430
-		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset( TRUE );
431
-		EE_System::instance()->initialize_db_if_no_migrations_required( TRUE );
430
+		EE_Registry::instance()->CFG = EE_Registry::instance()->CFG->reset(TRUE);
431
+		EE_System::instance()->initialize_db_if_no_migrations_required(TRUE);
432 432
 		EE_System::instance()->redirect_to_about_ee();
433 433
 	}
434 434
 
@@ -437,20 +437,20 @@  discard block
 block discarded – undo
437 437
 	/**
438 438
 	 * Deletes ALL EE tables, Records, and Options from the database.
439 439
 	 */
440
-	public function _delete_db(){
440
+	public function _delete_db() {
441 441
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
442 442
 		EEH_Activation::delete_all_espresso_cpt_data();
443 443
 		EEH_Activation::delete_all_espresso_tables_and_data();
444 444
 		EEH_Activation::remove_cron_tasks();
445 445
 		EEH_Activation::deactivate_event_espresso();
446
-		wp_safe_redirect( admin_url( 'plugins.php' ));
446
+		wp_safe_redirect(admin_url('plugins.php'));
447 447
 		exit;
448 448
 	}
449 449
 
450 450
 	/**
451 451
 	 * sets up EE4 to rerun the migrations from ee3 to ee4
452 452
 	 */
453
-	public function _rerun_migration_from_ee3(){
453
+	public function _rerun_migration_from_ee3() {
454 454
 		EE_Maintenance_Mode::instance()->set_maintenance_level(EE_Maintenance_Mode::level_0_not_in_maintenance);
455 455
 		EEH_Activation::delete_all_espresso_cpt_data();
456 456
 		EEH_Activation::delete_all_espresso_tables_and_data(false);
@@ -477,9 +477,9 @@  discard block
 block discarded – undo
477 477
 		wp_enqueue_script('ee_admin_js');
478 478
 //		wp_enqueue_media();
479 479
 //		wp_enqueue_script('media-upload');
480
-		wp_enqueue_script('ee-maintenance',EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js',array('jquery'),EVENT_ESPRESSO_VERSION,true);
480
+		wp_enqueue_script('ee-maintenance', EE_MAINTENANCE_ASSETS_URL.'/ee-maintenance.js', array('jquery'), EVENT_ESPRESSO_VERSION, true);
481 481
 
482
-		wp_register_style( 'espresso_maintenance', EE_MAINTENANCE_ASSETS_URL . 'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION );
482
+		wp_register_style('espresso_maintenance', EE_MAINTENANCE_ASSETS_URL.'ee-maintenance.css', array(), EVENT_ESPRESSO_VERSION);
483 483
 		wp_enqueue_style('espresso_maintenance');
484 484
 	}
485 485
 
Please login to merge, or discard this patch.
admin_pages/payments/Payments_Admin_Page.core.php 1 patch
Spacing   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -44,8 +44,8 @@  discard block
 block discarded – undo
44 44
 	 * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
45 45
 	 * @return \Payments_Admin_Page
46 46
 	 */
47
-	public function __construct( $routing = TRUE ) {
48
-		parent::__construct( $routing );
47
+	public function __construct($routing = TRUE) {
48
+		parent::__construct($routing);
49 49
 	}
50 50
 
51 51
 
@@ -130,19 +130,19 @@  discard block
 block discarded – undo
130 130
 	protected function _set_page_config() {
131 131
 		$payment_method_list_config = array(
132 132
 			'nav'           => array(
133
-				'label' => __( 'Payment Methods', 'event_espresso' ),
133
+				'label' => __('Payment Methods', 'event_espresso'),
134 134
 				'order' => 10
135 135
 			),
136 136
 			'metaboxes'     => $this->_default_espresso_metaboxes,
137 137
 			'help_tabs'     => array_merge(
138 138
 				array(
139 139
 					'payment_methods_overview_help_tab' => array(
140
-						'title'    => __( 'Payment Methods Overview', 'event_espresso' ),
140
+						'title'    => __('Payment Methods Overview', 'event_espresso'),
141 141
 						'filename' => 'payment_methods_overview'
142 142
 					)
143 143
 				),
144 144
 				$this->_add_payment_method_help_tabs() ),
145
-			'help_tour'     => array( 'Payment_Methods_Selection_Help_Tour' ),
145
+			'help_tour'     => array('Payment_Methods_Selection_Help_Tour'),
146 146
 			'require_nonce' => false
147 147
 		);
148 148
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 					)
161 161
 				),
162 162
 				//'help_tour' => array( 'Payment_Methods_Settings_Help_Tour' ),
163
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
163
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
164 164
 				'require_nonce' => FALSE
165 165
 			),
166 166
 			'payment_log'=>array(
@@ -179,17 +179,17 @@  discard block
 block discarded – undo
179 179
 	/**
180 180
 	 * @return array
181 181
 	 */
182
-	protected function _add_payment_method_help_tabs(){
182
+	protected function _add_payment_method_help_tabs() {
183 183
 		EE_Registry::instance()->load_lib('Payment_Method_Manager');
184 184
 		$payment_method_types = EE_Payment_Method_Manager::instance()->payment_method_types();
185 185
 		$all_pmt_help_tabs_config = array();
186
-		foreach( $payment_method_types as $payment_method_type ){
187
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $payment_method_type->cap_name(), 'specific_payment_method_type_access' ) ) {
186
+		foreach ($payment_method_types as $payment_method_type) {
187
+			if ( ! EE_Registry::instance()->CAP->current_user_can($payment_method_type->cap_name(), 'specific_payment_method_type_access')) {
188 188
 				continue;
189 189
 			}
190
-			foreach( $payment_method_type->help_tabs_config() as $help_tab_name => $config ){
191
-				$template_args = isset( $config[ 'template_args' ] ) ? $config[ 'template_args' ] : array();
192
-				$template_args[ 'admin_page_obj' ] = $this;
190
+			foreach ($payment_method_type->help_tabs_config() as $help_tab_name => $config) {
191
+				$template_args = isset($config['template_args']) ? $config['template_args'] : array();
192
+				$template_args['admin_page_obj'] = $this;
193 193
 				$all_pmt_help_tabs_config[$help_tab_name] = array(
194 194
 					'title'=>$config['title'],
195 195
 					'content'=>EEH_Template::display_template( 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 	public function load_scripts_styles() {
219
-		wp_enqueue_script( 'ee_admin_js' );
220
-		wp_enqueue_script( 'ee-text-links' );
221
-		wp_enqueue_script( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'espresso_payments_admin.js', array( 'espresso-ui-theme', 'ee-datepicker' ), EVENT_ESPRESSO_VERSION, TRUE );
219
+		wp_enqueue_script('ee_admin_js');
220
+		wp_enqueue_script('ee-text-links');
221
+		wp_enqueue_script('espresso_payments', EE_PAYMENTS_ASSETS_URL.'espresso_payments_admin.js', array('espresso-ui-theme', 'ee-datepicker'), EVENT_ESPRESSO_VERSION, TRUE);
222 222
 	}
223 223
 
224 224
 
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 	public function load_scripts_styles_default() {
229 229
 		//styles
230
-		wp_register_style( 'espresso_payments', EE_PAYMENTS_ASSETS_URL . 'ee-payments.css', array(), EVENT_ESPRESSO_VERSION );
231
-		wp_enqueue_style( 'espresso_payments' );
232
-		wp_enqueue_style( 'ee-text-links' );
230
+		wp_register_style('espresso_payments', EE_PAYMENTS_ASSETS_URL.'ee-payments.css', array(), EVENT_ESPRESSO_VERSION);
231
+		wp_enqueue_style('espresso_payments');
232
+		wp_enqueue_style('ee-text-links');
233 233
 		//scripts
234 234
 	}
235 235
 
@@ -243,44 +243,44 @@  discard block
 block discarded – undo
243 243
 		 * to the loading process.  However, people MUST setup the details for the payment method so its safe to do a
244 244
 		 * recheck here.
245 245
 		 */
246
-		EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
246
+		EE_Registry::instance()->load_lib('Payment_Method_Manager');
247 247
 		EEM_Payment_Method::instance()->verify_button_urls();
248 248
 		//setup tabs, one for each payment method type
249 249
 		$tabs = array();
250 250
 		$payment_methods = array();
251
-		foreach( EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj ) {
251
+		foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
252 252
 			// we don't want to show admin-only PMTs for now
253
-			if ( $pmt_obj instanceof EE_PMT_Admin_Only ) {
253
+			if ($pmt_obj instanceof EE_PMT_Admin_Only) {
254 254
 				continue;
255 255
 			}
256 256
 			//check access
257
-			if ( ! EE_Registry::instance()->CAP->current_user_can( $pmt_obj->cap_name(), 'specific_payment_method_type_access' ) ) {
257
+			if ( ! EE_Registry::instance()->CAP->current_user_can($pmt_obj->cap_name(), 'specific_payment_method_type_access')) {
258 258
 				continue;
259 259
 			}
260 260
 			//check for any active pms of that type
261
-			$payment_method = EEM_Payment_Method::instance()->get_one_of_type( $pmt_obj->system_name() );
262
-			if ( ! $payment_method instanceof EE_Payment_Method ) {
261
+			$payment_method = EEM_Payment_Method::instance()->get_one_of_type($pmt_obj->system_name());
262
+			if ( ! $payment_method instanceof EE_Payment_Method) {
263 263
 				$payment_method = EE_Payment_Method::new_instance(
264 264
 					array(
265
-						'PMD_slug'					=>sanitize_key( $pmt_obj->system_name() ),
265
+						'PMD_slug'					=>sanitize_key($pmt_obj->system_name()),
266 266
 						'PMD_type'					=>$pmt_obj->system_name(),
267 267
 						'PMD_name'				=>$pmt_obj->pretty_name(),
268 268
 						'PMD_admin_name'	=>$pmt_obj->pretty_name()
269 269
 					)
270 270
 				);
271 271
 			}
272
-			$payment_methods[ $payment_method->slug() ] = $payment_method;
272
+			$payment_methods[$payment_method->slug()] = $payment_method;
273 273
 		}
274
-		$payment_methods = apply_filters( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods );
275
-		foreach( $payment_methods as $payment_method ) {
276
-			if ( $payment_method instanceof EE_Payment_Method ) {
274
+		$payment_methods = apply_filters('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', $payment_methods);
275
+		foreach ($payment_methods as $payment_method) {
276
+			if ($payment_method instanceof EE_Payment_Method) {
277 277
 				add_meta_box(
278 278
 					//html id
279
-					'espresso_' . $payment_method->slug() . '_payment_settings',
279
+					'espresso_'.$payment_method->slug().'_payment_settings',
280 280
 					//title
281
-					sprintf( __( '%s Settings', 'event_espresso' ), $payment_method->admin_name() ),
281
+					sprintf(__('%s Settings', 'event_espresso'), $payment_method->admin_name()),
282 282
 					//callback
283
-					array( $this, 'payment_method_settings_meta_box' ),
283
+					array($this, 'payment_method_settings_meta_box'),
284 284
 					//post type
285 285
 					null,
286 286
 					//context
@@ -288,19 +288,19 @@  discard block
 block discarded – undo
288 288
 					//priority
289 289
 					'default',
290 290
 					//callback args
291
-					array( 'payment_method' => $payment_method )
291
+					array('payment_method' => $payment_method)
292 292
 				);
293 293
 				//setup for tabbed content
294
-				$tabs[ $payment_method->slug() ] = array(
294
+				$tabs[$payment_method->slug()] = array(
295 295
 					'label' => $payment_method->admin_name(),
296 296
 					'class' => $payment_method->active() ? 'gateway-active' : '',
297
-					'href'  => 'espresso_' . $payment_method->slug() . '_payment_settings',
298
-					'title' => __( 'Modify this Payment Method', 'event_espresso' ),
297
+					'href'  => 'espresso_'.$payment_method->slug().'_payment_settings',
298
+					'title' => __('Modify this Payment Method', 'event_espresso'),
299 299
 					'slug'  => $payment_method->slug()
300 300
 				);
301 301
 			}
302 302
 		}
303
-		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links( $tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug() );
303
+		$this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($tabs, 'payment_method_links', '|', $this->_get_active_payment_method_slug());
304 304
 		$this->display_admin_page_with_sidebar();
305 305
 
306 306
 	}
@@ -311,20 +311,20 @@  discard block
 block discarded – undo
311 311
 	 *   _get_active_payment_method_slug
312 312
 	 * 	@return string
313 313
 	 */
314
-	protected function _get_active_payment_method_slug(){
314
+	protected function _get_active_payment_method_slug() {
315 315
 		$payment_method_slug = FALSE;
316 316
 		//decide which payment method tab to open first, as dictated by the request's 'payment_method'
317
-		if ( isset( $this->_req_data['payment_method'] )) {
317
+		if (isset($this->_req_data['payment_method'])) {
318 318
 			// if they provided the current payment method, use it
319
-			$payment_method_slug = sanitize_key( $this->_req_data['payment_method'] );
319
+			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
320 320
 		}
321
-		$payment_method = EEM_Payment_Method::instance()->get_one( array( array( 'PMD_slug' => $payment_method_slug )));
321
+		$payment_method = EEM_Payment_Method::instance()->get_one(array(array('PMD_slug' => $payment_method_slug)));
322 322
 		// if that didn't work or wasn't provided, find another way to select the current pm
323
-		if ( ! $this->_verify_payment_method( $payment_method )) {
323
+		if ( ! $this->_verify_payment_method($payment_method)) {
324 324
 			// like, looking for an active one
325
-			$payment_method = EEM_Payment_Method::instance()->get_one_active( 'CART' );
325
+			$payment_method = EEM_Payment_Method::instance()->get_one_active('CART');
326 326
 			// test that one as well
327
-			if ( $this->_verify_payment_method( $payment_method )) {
327
+			if ($this->_verify_payment_method($payment_method)) {
328 328
 				$payment_method_slug = $payment_method->slug();
329 329
 			} else {
330 330
 				$payment_method_slug = 'paypal_standard';
@@ -342,11 +342,11 @@  discard block
 block discarded – undo
342 342
 	 * @param \EE_Payment_Method $payment_method
343 343
 	 * @return boolean
344 344
 	 */
345
-	protected function _verify_payment_method( $payment_method ){
345
+	protected function _verify_payment_method($payment_method) {
346 346
 		if (
347 347
 			$payment_method instanceof EE_Payment_Method &&
348 348
 			$payment_method->type_obj() instanceof EE_PMT_Base &&
349
-			EE_Registry::instance()->CAP->current_user_can( $payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access' )
349
+			EE_Registry::instance()->CAP->current_user_can($payment_method->type_obj()->cap_name(), 'specific_payment_method_type_access')
350 350
 		) {
351 351
 			return TRUE;
352 352
 		}
@@ -363,21 +363,21 @@  discard block
 block discarded – undo
363 363
 	 * @return string
364 364
 	 * @throws EE_Error
365 365
 	 */
366
-	public function payment_method_settings_meta_box( $post_obj_which_is_null, $metabox ){
367
-		$payment_method = isset( $metabox['args'], $metabox['args']['payment_method'] ) ? $metabox['args']['payment_method'] : NULL;
368
-		if ( ! $payment_method instanceof EE_Payment_Method ){
369
-			throw new EE_Error( sprintf( __( 'Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso' )));
366
+	public function payment_method_settings_meta_box($post_obj_which_is_null, $metabox) {
367
+		$payment_method = isset($metabox['args'], $metabox['args']['payment_method']) ? $metabox['args']['payment_method'] : NULL;
368
+		if ( ! $payment_method instanceof EE_Payment_Method) {
369
+			throw new EE_Error(sprintf(__('Payment method metabox setup incorrectly. No Payment method object was supplied', 'event_espresso')));
370 370
 		}
371 371
 		$payment_method_scopes = $payment_method->active();
372 372
 		// if the payment method really exists show its form, otherwise the activation template
373
-		if ( $payment_method->ID() && ! empty( $payment_method_scopes )) {
374
-				$form = $this->_generate_payment_method_settings_form( $payment_method );
375
-				if ( $form->form_data_present_in( $this->_req_data )) {
376
-					$form->receive_form_submission( $this->_req_data );
373
+		if ($payment_method->ID() && ! empty($payment_method_scopes)) {
374
+				$form = $this->_generate_payment_method_settings_form($payment_method);
375
+				if ($form->form_data_present_in($this->_req_data)) {
376
+					$form->receive_form_submission($this->_req_data);
377 377
 				}
378
-				echo $form->form_open() . $form->get_html_and_js() . $form->form_close();
378
+				echo $form->form_open().$form->get_html_and_js().$form->form_close();
379 379
 		} else {
380
-			echo $this->_activate_payment_method_button( $payment_method )->get_html_and_js();
380
+			echo $this->_activate_payment_method_button($payment_method)->get_html_and_js();
381 381
 		}
382 382
 	}
383 383
 
@@ -390,14 +390,14 @@  discard block
 block discarded – undo
390 390
 	 * @param \EE_Payment_Method $payment_method
391 391
 	 * @return \EE_Form_Section_Proper
392 392
 	 */
393
-	protected function _generate_payment_method_settings_form( EE_Payment_Method $payment_method ) {
394
-		if ( ! $payment_method instanceof EE_Payment_Method ){
393
+	protected function _generate_payment_method_settings_form(EE_Payment_Method $payment_method) {
394
+		if ( ! $payment_method instanceof EE_Payment_Method) {
395 395
 			return new EE_Form_Section_Proper();
396 396
 		}
397 397
 		return new EE_Form_Section_Proper(
398 398
 			array(
399
-				'name' 	=> $payment_method->slug() . '_settings_form',
400
-				'html_id' 	=> $payment_method->slug() . '_settings_form',
399
+				'name' 	=> $payment_method->slug().'_settings_form',
400
+				'html_id' 	=> $payment_method->slug().'_settings_form',
401 401
 				'action' 	=> EE_Admin_Page::add_query_args_and_nonce(
402 402
 					array(
403 403
 						'action' 						=> 'update_payment_method',
@@ -409,12 +409,12 @@  discard block
 block discarded – undo
409 409
 				'subsections' 			=> apply_filters(
410 410
 					'FHEE__Payments_Admin_Page___generate_payment_method_settings_form__form_subsections',
411 411
 					array(
412
-						'pci_dss_compliance_' . $payment_method->slug() 				=> $this->_pci_dss_compliance( $payment_method ),
413
-						'currency_support_' . $payment_method->slug()					=> $this->_currency_support( $payment_method ),
414
-						'payment_method_settings_' . $payment_method->slug() 	=> $this->_payment_method_settings( $payment_method ),
415
-						'update_' . $payment_method->slug()										=> $this->_update_payment_method_button( $payment_method ),
416
-						'deactivate_' . $payment_method->slug()								=> $this->_deactivate_payment_method_button( $payment_method ),
417
-						'fine_print_' . $payment_method->slug()									=> $this->_fine_print()
412
+						'pci_dss_compliance_'.$payment_method->slug() 				=> $this->_pci_dss_compliance($payment_method),
413
+						'currency_support_'.$payment_method->slug()					=> $this->_currency_support($payment_method),
414
+						'payment_method_settings_'.$payment_method->slug() 	=> $this->_payment_method_settings($payment_method),
415
+						'update_'.$payment_method->slug()										=> $this->_update_payment_method_button($payment_method),
416
+						'deactivate_'.$payment_method->slug()								=> $this->_deactivate_payment_method_button($payment_method),
417
+						'fine_print_'.$payment_method->slug()									=> $this->_fine_print()
418 418
 					),
419 419
 					$payment_method
420 420
 				)
@@ -431,19 +431,19 @@  discard block
 block discarded – undo
431 431
 	 * @param \EE_Payment_Method $payment_method
432 432
 	 * @return \EE_Form_Section_Proper
433 433
 	 */
434
-	protected function _pci_dss_compliance( EE_Payment_Method $payment_method ) {
435
-		if ( $payment_method->type_obj()->requires_https() ) {
434
+	protected function _pci_dss_compliance(EE_Payment_Method $payment_method) {
435
+		if ($payment_method->type_obj()->requires_https()) {
436 436
 			return new EE_Form_Section_HTML(
437 437
 				EEH_HTML::tr(
438 438
 					EEH_HTML::th(
439 439
 						EEH_HTML::label(
440
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
440
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
441 441
 						)
442
-					) .
442
+					).
443 443
 					EEH_HTML::td(
444
-						EEH_HTML::strong( __( 'You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso' )) .
445
-						EEH_HTML::br() .
446
-						__( 'Learn more about ', 'event_espresso' ) . EEH_HTML::link( 'https://www.pcisecuritystandards.org/merchants/index.php', __( 'PCI DSS compliance', 'event_espresso' ))
444
+						EEH_HTML::strong(__('You are responsible for your own website security and Payment Card Industry Data Security Standards (PCI DSS) compliance.', 'event_espresso')).
445
+						EEH_HTML::br().
446
+						__('Learn more about ', 'event_espresso').EEH_HTML::link('https://www.pcisecuritystandards.org/merchants/index.php', __('PCI DSS compliance', 'event_espresso'))
447 447
 					)
448 448
 				)
449 449
 			);
@@ -461,19 +461,19 @@  discard block
 block discarded – undo
461 461
 	 * @param \EE_Payment_Method $payment_method
462 462
 	 * @return \EE_Form_Section_Proper
463 463
 	 */
464
-	protected function _currency_support( EE_Payment_Method $payment_method ) {
465
-		if ( ! $payment_method->usable_for_currency( EE_Config::instance()->currency->code )) {
464
+	protected function _currency_support(EE_Payment_Method $payment_method) {
465
+		if ( ! $payment_method->usable_for_currency(EE_Config::instance()->currency->code)) {
466 466
 			return new EE_Form_Section_HTML(
467 467
 				EEH_HTML::tr(
468 468
 					EEH_HTML::th(
469 469
 						EEH_HTML::label(
470
-							EEH_HTML::strong( __( 'IMPORTANT', 'event_espresso' ), '', 'important-notice' )
470
+							EEH_HTML::strong(__('IMPORTANT', 'event_espresso'), '', 'important-notice')
471 471
 						)
472
-					) .
472
+					).
473 473
 					EEH_HTML::td(
474 474
 						EEH_HTML::strong(
475 475
 							sprintf(
476
-								__( 'This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
476
+								__('This payment method does not support the currency set on your site (%1$s) and so will not appear as a payment option to registrants. Please activate a different payment method or change your site\'s country and associated currency.', 'event_espresso'),
477 477
 								EE_Config::instance()->currency->code
478 478
 							)
479 479
 						)
@@ -493,9 +493,9 @@  discard block
 block discarded – undo
493 493
 	 * @param \EE_Payment_Method $payment_method
494 494
 	 * @return \EE_Form_Section_HTML
495 495
 	 */
496
-	protected function _payment_method_settings( EE_Payment_Method $payment_method ) {
496
+	protected function _payment_method_settings(EE_Payment_Method $payment_method) {
497 497
 		//modify the form so we only have/show fields that will be implemented for this version
498
-		return $this->_simplify_form( $payment_method->type_obj()->settings_form(), $payment_method->name() );
498
+		return $this->_simplify_form($payment_method->type_obj()->settings_form(), $payment_method->name());
499 499
 	}
500 500
 
501 501
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
 	 * @return \EE_Payment_Method_Form
509 509
 	 * @throws \EE_Error
510 510
 	 */
511
-	protected function _simplify_form( $form_section, $payment_method_name = '' ){
512
-		if ( $form_section instanceof EE_Payment_Method_Form ) {
511
+	protected function _simplify_form($form_section, $payment_method_name = '') {
512
+		if ($form_section instanceof EE_Payment_Method_Form) {
513 513
 			$form_section->exclude(
514 514
 				array(
515 515
 					'PMD_type', //dont want them changing the type
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 			);
521 521
 			return $form_section;
522 522
 		} else {
523
-			throw new EE_Error( sprintf( __( 'The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso' ), $payment_method_name ));
523
+			throw new EE_Error(sprintf(__('The EE_Payment_Method_Form for the "%1$s" payment method is missing or invalid.', 'event_espresso'), $payment_method_name));
524 524
 		}
525 525
 	}
526 526
 
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 	 * @param \EE_Payment_Method $payment_method
534 534
 	 * @return \EE_Form_Section_HTML
535 535
 	 */
536
-	protected function _update_payment_method_button( EE_Payment_Method $payment_method ) {
536
+	protected function _update_payment_method_button(EE_Payment_Method $payment_method) {
537 537
 		$update_button = new EE_Submit_Input(
538 538
 			array(
539
-				'html_id' 		=> 'save_' . $payment_method->slug() . '_settings',
540
-				'default' 		=> sprintf( __( 'Update %s Payment Settings', 'event_espresso' ), $payment_method->admin_name() ),
539
+				'html_id' 		=> 'save_'.$payment_method->slug().'_settings',
540
+				'default' 		=> sprintf(__('Update %s Payment Settings', 'event_espresso'), $payment_method->admin_name()),
541 541
 				'html_label' => EEH_HTML::nbsp()
542 542
 			)
543 543
 		);
544 544
 		return new EE_Form_Section_HTML(
545
-			EEH_HTML::no_row( EEH_HTML::br(2) ) .
545
+			EEH_HTML::no_row(EEH_HTML::br(2)).
546 546
 			EEH_HTML::tr(
547
-				EEH_HTML::th( __( 'Update Settings', 'event_espresso') ) .
547
+				EEH_HTML::th(__('Update Settings', 'event_espresso')).
548 548
 				EEH_HTML::td(
549 549
 					$update_button->get_html_for_input()
550 550
 				)
@@ -561,11 +561,11 @@  discard block
 block discarded – undo
561 561
 	 * @param \EE_Payment_Method $payment_method
562 562
 	 * @return \EE_Form_Section_Proper
563 563
 	 */
564
-	protected function _deactivate_payment_method_button( EE_Payment_Method $payment_method ) {
565
-		$link_text_and_title = sprintf( __( 'Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name() );
564
+	protected function _deactivate_payment_method_button(EE_Payment_Method $payment_method) {
565
+		$link_text_and_title = sprintf(__('Deactivate %1$s Payments?', 'event_espresso'), $payment_method->admin_name());
566 566
 		return new EE_Form_Section_HTML(
567 567
 			EEH_HTML::tr(
568
-				EEH_HTML::th( __( 'Deactivate Payment Method', 'event_espresso') ) .
568
+				EEH_HTML::th(__('Deactivate Payment Method', 'event_espresso')).
569 569
 				EEH_HTML::td(
570 570
 					EEH_HTML::link(
571 571
 						EE_Admin_Page::add_query_args_and_nonce(
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 						),
578 578
 						$link_text_and_title,
579 579
 						$link_text_and_title,
580
-						'deactivate_' . $payment_method->slug(),
580
+						'deactivate_'.$payment_method->slug(),
581 581
 						'espresso-button button-secondary'
582 582
 					)
583 583
 				)
@@ -593,12 +593,12 @@  discard block
 block discarded – undo
593 593
 	 * @param \EE_Payment_Method $payment_method
594 594
 	 * @return \EE_Form_Section_Proper
595 595
 	 */
596
-	protected function _activate_payment_method_button( EE_Payment_Method $payment_method ) {
597
-		$link_text_and_title = sprintf( __( 'Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name() );
596
+	protected function _activate_payment_method_button(EE_Payment_Method $payment_method) {
597
+		$link_text_and_title = sprintf(__('Activate %1$s Payment Method?', 'event_espresso'), $payment_method->admin_name());
598 598
 		return new EE_Form_Section_Proper(
599 599
 			array(
600
-				'name' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
601
-				'html_id' 	=> 'activate_' . $payment_method->slug() . '_settings_form',
600
+				'name' 	=> 'activate_'.$payment_method->slug().'_settings_form',
601
+				'html_id' 	=> 'activate_'.$payment_method->slug().'_settings_form',
602 602
 				'action' 	=> '#',
603 603
 				'layout_strategy'		=> new EE_Admin_Two_Column_Layout(),
604 604
 				'subsections' 			=> apply_filters(
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 						new EE_Form_Section_HTML(
608 608
 							EEH_HTML::tr(
609 609
 								EEH_HTML::th(
610
-									EEH_HTML::label( __( 'Click to Activate ', 'event_espresso' ))
611
-								) .
610
+									EEH_HTML::label(__('Click to Activate ', 'event_espresso'))
611
+								).
612 612
 								EEH_HTML::td(
613 613
 									EEH_HTML::link(
614 614
 										EE_Admin_Page::add_query_args_and_nonce(
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 										),
621 621
 										$link_text_and_title,
622 622
 										$link_text_and_title,
623
-										'activate_' . $payment_method->slug(),
623
+										'activate_'.$payment_method->slug(),
624 624
 										'espresso-button-green button-primary'
625 625
 									)
626 626
 								)
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 	protected function _fine_print() {
643 643
 		return new EE_Form_Section_HTML(
644 644
 			EEH_HTML::tr(
645
-				EEH_HTML::th() .
645
+				EEH_HTML::th().
646 646
 				EEH_HTML::td(
647
-					EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )
647
+					EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')
648 648
 				)
649 649
 			)
650 650
 		);
@@ -656,15 +656,15 @@  discard block
 block discarded – undo
656 656
 	 * Activates a payment method of that type. Mostly assuming there is only 1 of that type (or none so far)
657 657
 	 * @global WP_User $current_user
658 658
 	 */
659
-	protected function _activate_payment_method(){
660
-		if(isset($this->_req_data['payment_method_type'])){
659
+	protected function _activate_payment_method() {
660
+		if (isset($this->_req_data['payment_method_type'])) {
661 661
 			$payment_method_type = sanitize_text_field($this->_req_data['payment_method_type']);
662 662
 			//see if one exists
663
-			EE_Registry::instance()->load_lib( 'Payment_Method_Manager' );
664
-			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( $payment_method_type );
663
+			EE_Registry::instance()->load_lib('Payment_Method_Manager');
664
+			$payment_method = EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type($payment_method_type);
665 665
 
666
-			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default','payment_method'=>$payment_method->slug()));
667
-		}else{
666
+			$this->_redirect_after_action(1, 'Payment Method', 'activated', array('action' => 'default', 'payment_method'=>$payment_method->slug()));
667
+		} else {
668 668
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
669 669
 		}
670 670
 	}
@@ -672,14 +672,14 @@  discard block
 block discarded – undo
672 672
 	/**
673 673
 	 * Deactivates the payment method with the specified slug, and redirects.
674 674
 	 */
675
-	protected function _deactivate_payment_method(){
676
-		if(isset($this->_req_data['payment_method'])){
675
+	protected function _deactivate_payment_method() {
676
+		if (isset($this->_req_data['payment_method'])) {
677 677
 			$payment_method_slug = sanitize_key($this->_req_data['payment_method']);
678 678
 			//deactivate it
679 679
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
680
-			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method( $payment_method_slug );
681
-			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default','payment_method'=>$payment_method_slug));
682
-		}else{
680
+			$count_updated = EE_Payment_Method_Manager::instance()->deactivate_payment_method($payment_method_slug);
681
+			$this->_redirect_after_action($count_updated, 'Payment Method', 'deactivated', array('action' => 'default', 'payment_method'=>$payment_method_slug));
682
+		} else {
683 683
 			$this->_redirect_after_action(FALSE, 'Payment Method', 'deactivated', array('action' => 'default'));
684 684
 		}
685 685
 	}
@@ -693,39 +693,39 @@  discard block
 block discarded – undo
693 693
 	 * subsequently called 'headers_sent_func' which is _payment_methods_list)
694 694
 	 * @return void
695 695
 	 */
696
-	protected function _update_payment_method(){
697
-		if( $_SERVER['REQUEST_METHOD'] == 'POST'){
696
+	protected function _update_payment_method() {
697
+		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
698 698
 			//ok let's find which gateway form to use based on the form input
699 699
 			EE_Registry::instance()->load_lib('Payment_Method_Manager');
700 700
 			/** @var $correct_pmt_form_to_use EE_Payment_Method_Form */
701 701
 			$correct_pmt_form_to_use = NULL;
702 702
 			$pmt_obj = NULL;
703
-			foreach(EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj){
703
+			foreach (EE_Payment_Method_Manager::instance()->payment_method_types() as $pmt_obj) {
704 704
 				/** @var $pmt_obj EE_PMT_Base */
705 705
 				//get the form and simplify it, like what we do when we display it
706 706
 				$pmt_form = $pmt_obj->settings_form();
707 707
 				$this->_simplify_form($pmt_form);
708
-				if($pmt_form->form_data_present_in($this->_req_data)){
708
+				if ($pmt_form->form_data_present_in($this->_req_data)) {
709 709
 					$correct_pmt_form_to_use = $pmt_form;
710 710
 					break;
711 711
 				}
712 712
 			}
713 713
 			//if we couldn't find the correct payment method type...
714
-			if( ! $correct_pmt_form_to_use ){
714
+			if ( ! $correct_pmt_form_to_use) {
715 715
 				EE_Error::add_error(__("We could not find which payment method type your form submission related to. Please contact support", 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
716 716
 				$this->_redirect_after_action(FALSE, 'Payment Method', 'activated', array('action' => 'default'));
717 717
 			}
718 718
 			$correct_pmt_form_to_use->receive_form_submission($this->_req_data);
719
-			if($correct_pmt_form_to_use->is_valid()){
719
+			if ($correct_pmt_form_to_use->is_valid()) {
720 720
 				$correct_pmt_form_to_use->save();
721 721
 				$pm = $correct_pmt_form_to_use->get_model_object();
722 722
 				/** @var $pm EE_Payment_Method */
723
-				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default','payment_method'=>$pm->slug()));
724
-			}else{
723
+				$this->_redirect_after_action(TRUE, 'Payment Method', 'updated', array('action' => 'default', 'payment_method'=>$pm->slug()));
724
+			} else {
725 725
 				EE_Error::add_error(
726 726
 					sprintf(
727 727
 						__('Payment method of type %s was not saved because there were validation errors. They have been marked in the form', 'event_espresso'),
728
-						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __( '"(unknown)"', 'event_espresso' )
728
+						$pmt_obj instanceof EE_PMT_Base ? $pmt_obj->pretty_name() : __('"(unknown)"', 'event_espresso')
729 729
 					),
730 730
 					__FILE__,
731 731
 					__FUNCTION__,
@@ -742,11 +742,11 @@  discard block
 block discarded – undo
742 742
 	protected function _payment_settings() {
743 743
 
744 744
 		$this->_template_args['values'] = $this->_yes_no_values;
745
-		$this->_template_args['show_pending_payment_options'] = isset( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) ? absint( EE_Registry::instance()->CFG->registration->show_pending_payment_options ) : FALSE;
745
+		$this->_template_args['show_pending_payment_options'] = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) ? absint(EE_Registry::instance()->CFG->registration->show_pending_payment_options) : FALSE;
746 746
 
747
-		$this->_set_add_edit_form_tags( 'update_payment_settings' );
748
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
749
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_PAYMENTS_TEMPLATE_PATH . 'payment_settings.template.php', $this->_template_args, TRUE );
747
+		$this->_set_add_edit_form_tags('update_payment_settings');
748
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
749
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_PAYMENTS_TEMPLATE_PATH.'payment_settings.template.php', $this->_template_args, TRUE);
750 750
 		$this->display_admin_page_with_sidebar();
751 751
 
752 752
 	}
@@ -760,13 +760,13 @@  discard block
 block discarded – undo
760 760
 	*		@return array
761 761
 	*/
762 762
 	protected function _update_payment_settings() {
763
-		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset( $this->_req_data['show_pending_payment_options'] ) ? $this->_req_data['show_pending_payment_options'] : FALSE;
764
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG );
763
+		EE_Registry::instance()->CFG->registration->show_pending_payment_options = isset($this->_req_data['show_pending_payment_options']) ? $this->_req_data['show_pending_payment_options'] : FALSE;
764
+		EE_Registry::instance()->CFG = apply_filters('FHEE__Payments_Admin_Page___update_payment_settings__CFG', EE_Registry::instance()->CFG);
765 765
 
766 766
 
767
-		$what = __('Payment Settings','event_espresso');
768
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
769
-		$this->_redirect_after_action( $success, $what, __('updated','event_espresso'), array( 'action' => 'payment_settings' ) );
767
+		$what = __('Payment Settings', 'event_espresso');
768
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
769
+		$this->_redirect_after_action($success, $what, __('updated', 'event_espresso'), array('action' => 'payment_settings'));
770 770
 
771 771
 	}
772 772
 	protected function _payment_log_overview_list_table() {
@@ -792,18 +792,18 @@  discard block
 block discarded – undo
792 792
 	 * @param bool $count
793 793
 	 * @return array
794 794
 	 */
795
-	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false){
796
-		EE_Registry::instance()->load_model( 'Change_Log' );
795
+	public function get_payment_logs($per_page = 50, $current_page = 0, $count = false) {
796
+		EE_Registry::instance()->load_model('Change_Log');
797 797
 		//we may need to do multiple queries (joining differently), so we actually wan tan array of query params
798
-		$query_params =  array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
798
+		$query_params = array(array('LOG_type'=>  EEM_Change_Log::type_gateway));
799 799
 		//check if they've selected a specific payment method
800
-		if( isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all'){
800
+		if (isset($this->_req_data['_payment_method']) && $this->_req_data['_payment_method'] !== 'all') {
801 801
 			$query_params[0]['OR*pm_or_pay_pm'] = array('Payment.Payment_Method.PMD_ID'=>$this->_req_data['_payment_method'],
802 802
 				'Payment_Method.PMD_ID'=>$this->_req_data['_payment_method']);
803 803
 		}
804 804
 		//take into account search
805
-		if(isset($this->_req_data['s']) && $this->_req_data['s']){
806
-			$similarity_string = array('LIKE','%'.str_replace("","%",$this->_req_data['s']) .'%');
805
+		if (isset($this->_req_data['s']) && $this->_req_data['s']) {
806
+			$similarity_string = array('LIKE', '%'.str_replace("", "%", $this->_req_data['s']).'%');
807 807
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_fname'] = $similarity_string;
808 808
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_lname'] = $similarity_string;
809 809
 			$query_params[0]['OR*s']['Payment.Transaction.Registration.Attendee.ATT_email'] = $similarity_string;
@@ -818,48 +818,48 @@  discard block
 block discarded – undo
818 818
 			$query_params[0]['OR*s']['LOG_message'] = $similarity_string;
819 819
 
820 820
 		}
821
-		if(isset( $this->_req_data['payment-filter-start-date'] ) && isset( $this->_req_data['payment-filter-end-date'] )){
821
+		if (isset($this->_req_data['payment-filter-start-date']) && isset($this->_req_data['payment-filter-end-date'])) {
822 822
 			//add date
823
-			$start_date =wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] );
824
-			$end_date = wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] );
823
+			$start_date = wp_strip_all_tags($this->_req_data['payment-filter-start-date']);
824
+			$end_date = wp_strip_all_tags($this->_req_data['payment-filter-end-date']);
825 825
 			//make sure our timestamps start and end right at the boundaries for each day
826
-			$start_date = date( 'Y-m-d', strtotime( $start_date ) ) . ' 00:00:00';
827
-			$end_date = date( 'Y-m-d', strtotime( $end_date ) ) . ' 23:59:59';
826
+			$start_date = date('Y-m-d', strtotime($start_date)).' 00:00:00';
827
+			$end_date = date('Y-m-d', strtotime($end_date)).' 23:59:59';
828 828
 
829 829
 			//convert to timestamps
830
-			$start_date = strtotime( $start_date );
831
-			$end_date = strtotime( $end_date );
830
+			$start_date = strtotime($start_date);
831
+			$end_date = strtotime($end_date);
832 832
 
833 833
 			//makes sure start date is the lowest value and vice versa
834
-			$start_date = min( $start_date, $end_date );
835
-			$end_date = max( $start_date, $end_date );
834
+			$start_date = min($start_date, $end_date);
835
+			$end_date = max($start_date, $end_date);
836 836
 
837 837
 			//convert for query
838
-			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $start_date ), 'Y-m-d H:i:s' );
839
-			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query( 'LOG_time', date( 'Y-m-d H:i:s', $end_date ), 'Y-m-d H:i:s' );
838
+			$start_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $start_date), 'Y-m-d H:i:s');
839
+			$end_date = EEM_Change_Log::instance()->convert_datetime_for_query('LOG_time', date('Y-m-d H:i:s', $end_date), 'Y-m-d H:i:s');
840 840
 
841
-			$query_params[0]['LOG_time'] = array('BETWEEN',array($start_date,$end_date));
841
+			$query_params[0]['LOG_time'] = array('BETWEEN', array($start_date, $end_date));
842 842
 
843 843
 		}
844
-		if($count){
844
+		if ($count) {
845 845
 			return EEM_Change_Log::instance()->count($query_params);
846 846
 		}
847
-		if(isset($this->_req_data['order'])){
848
-			$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'DESC';
847
+		if (isset($this->_req_data['order'])) {
848
+			$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'DESC';
849 849
 			$query_params['order_by'] = array('LOG_time' => $sort);
850
-		}else{
850
+		} else {
851 851
 				$query_params['order_by'] = array('LOG_time' => 'DESC');
852 852
 		}
853
-		$offset = ($current_page-1)*$per_page;
853
+		$offset = ($current_page - 1) * $per_page;
854 854
 
855
-		if( ! isset($this->_req_data['download_results'])){
856
-			$query_params['limit'] = array( $offset, $per_page );
855
+		if ( ! isset($this->_req_data['download_results'])) {
856
+			$query_params['limit'] = array($offset, $per_page);
857 857
 		}
858 858
 
859 859
 
860 860
 
861 861
 		//now they've requested to instead just download the file instead of viewing it.
862
-		if(isset($this->_req_data['download_results'])){
862
+		if (isset($this->_req_data['download_results'])) {
863 863
 			$wpdb_results = EEM_Change_Log::instance()->get_all_efficiently($query_params);
864 864
 			header('Content-Disposition: attachment');
865 865
 			header("Content-Disposition: attachment; filename=ee_payment_logs_for_".sanitize_key(site_url()));
@@ -881,36 +881,36 @@  discard block
 block discarded – undo
881 881
 	 * @param EE_Change_Log $logB
882 882
 	 * @return int
883 883
 	 */
884
-	protected function _sort_logs_again($logA,$logB){
884
+	protected function _sort_logs_again($logA, $logB) {
885 885
 		$timeA = $logA->get_raw('LOG_time');
886 886
 		$timeB = $logB->get_raw('LOG_time');
887
-		if($timeA == $timeB){
887
+		if ($timeA == $timeB) {
888 888
 			return 0;
889 889
 		}
890 890
 		$comparison = $timeA < $timeB ? -1 : 1;
891
-		if(strtoupper($this->_sort_logs_again_direction) == 'DESC'){
891
+		if (strtoupper($this->_sort_logs_again_direction) == 'DESC') {
892 892
 			return $comparison * -1;
893
-		}else{
893
+		} else {
894 894
 			return $comparison;
895 895
 		}
896 896
 	}
897 897
 
898 898
 	protected function _payment_log_details() {
899
-		EE_Registry::instance()->load_model( 'Change_Log' );
899
+		EE_Registry::instance()->load_model('Change_Log');
900 900
 		/** @var $payment_log EE_Change_Log */
901 901
 		$payment_log = EEM_Change_Log::instance()->get_one_by_ID($this->_req_data['ID']);
902 902
 		$payment_method = NULL;
903 903
 		$transaction = NULL;
904
-		if( $payment_log instanceof EE_Change_Log ){
905
-			if( $payment_log->object() instanceof EE_Payment ){
904
+		if ($payment_log instanceof EE_Change_Log) {
905
+			if ($payment_log->object() instanceof EE_Payment) {
906 906
 				$payment_method = $payment_log->object()->payment_method();
907 907
 				$transaction = $payment_log->object()->transaction();
908
-			}elseif($payment_log->object() instanceof EE_Payment_Method){
908
+			}elseif ($payment_log->object() instanceof EE_Payment_Method) {
909 909
 				$payment_method = $payment_log->object();
910 910
 			}
911 911
 		}
912 912
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
913
-			EE_PAYMENTS_TEMPLATE_PATH . 'payment_log_details.template.php',
913
+			EE_PAYMENTS_TEMPLATE_PATH.'payment_log_details.template.php',
914 914
 			array(
915 915
 				'payment_log'=>$payment_log,
916 916
 				'payment_method'=>$payment_method,
Please login to merge, or discard this patch.
admin_pages/payments/Payment_Log_Admin_List_Table.class.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 	 * @param \EE_Admin_Page $admin_page
36 36
 	 * @return Payment_Log_Admin_List_Table
37 37
 	 */
38
-	public function __construct( $admin_page ) {
38
+	public function __construct($admin_page) {
39 39
 		parent::__construct($admin_page);
40 40
 	}
41 41
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 //		}else{
53 53
 //			$this->_data = $this->_admin_page->get_questions( $this->_per_page,$this->_current_page, FALSE );
54 54
 //		}
55
-		$this->_all_data_count = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
56
-		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons',array($this,'add_download_logs_checkbox'));
55
+		$this->_all_data_count = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
56
+		add_action('AHEE__EE_Admin_List_Table__extra_tablenav__after_bottom_buttons', array($this, 'add_download_logs_checkbox'));
57 57
 	}
58 58
 
59 59
 
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 	 * adds a checkbox to the bottom of the list table, instead of at the top with the rest of the filters
64 64
 	 * @return void
65 65
 	 */
66
-	public function add_download_logs_checkbox(){
67
-		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".  __( 'Download Results', 'event_espresso' )."'>";
66
+	public function add_download_logs_checkbox() {
67
+		echo "<input type='submit' class='button-primary' id='download_results' name='download_results' value='".__('Download Results', 'event_espresso')."'>";
68 68
 	}
69 69
 
70 70
 
@@ -75,8 +75,8 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	protected function _set_properties() {
77 77
 		$this->_wp_list_args = array(
78
-			'singular' => __('payment log', 'event_espresso' ),
79
-			'plural' => __('payment logs', 'event_espresso' ),
78
+			'singular' => __('payment log', 'event_espresso'),
79
+			'plural' => __('payment logs', 'event_espresso'),
80 80
 			'ajax' => TRUE, //for now,
81 81
 			'screen' => $this->_admin_page->get_current_screen()->id
82 82
 			);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 			);
91 91
 
92 92
 		$this->_sortable_columns = array(
93
-			'LOG_time' => array( 'LOG_time' => TRUE ),
93
+			'LOG_time' => array('LOG_time' => TRUE),
94 94
 			);
95 95
 
96 96
 		$this->_hidden_columns = array(
@@ -108,18 +108,18 @@  discard block
 block discarded – undo
108 108
 		$filters = array();
109 109
 		//todo we're currently using old functions here. We need to move things into the Events_Admin_Page() class as methods.
110 110
 		$payment_methods = EEM_Payment_Method::instance()->get_all();
111
-		$payment_method_names = array(array('id'=>'all','text'=>  __("All", 'event_espresso')),array('id'=>'0','text'=>  __("Unknown Payment Method", 'event_espresso')));
112
-		foreach($payment_methods as $payment_method){
113
-			$payment_method_names[] = array('id'=>$payment_method->ID(),'text'=>$payment_method->admin_name());
111
+		$payment_method_names = array(array('id'=>'all', 'text'=>  __("All", 'event_espresso')), array('id'=>'0', 'text'=>  __("Unknown Payment Method", 'event_espresso')));
112
+		foreach ($payment_methods as $payment_method) {
113
+			$payment_method_names[] = array('id'=>$payment_method->ID(), 'text'=>$payment_method->admin_name());
114 114
 		}
115 115
 		$filters[] = EEH_Form_Fields::select_input('_payment_method', $payment_method_names, isset($this->_req_data['_payment_method']) ? $this->_req_data['_payment_method'] : 'all');
116
-		$start_date = isset( $this->_req_data['payment-filter-start-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-start-date'] ) : date( 'm/d/Y', strtotime( '-6 months' ));
117
-		$end_date = isset( $this->_req_data['payment-filter-end-date'] ) ? wp_strip_all_tags( $this->_req_data['payment-filter-end-date'] ) : date( 'm/d/Y' );
116
+		$start_date = isset($this->_req_data['payment-filter-start-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-start-date']) : date('m/d/Y', strtotime('-6 months'));
117
+		$end_date = isset($this->_req_data['payment-filter-end-date']) ? wp_strip_all_tags($this->_req_data['payment-filter-end-date']) : date('m/d/Y');
118 118
 		ob_start();
119 119
 		?>
120
-		<label for="txn-filter-start-date"><?php _e( 'Display Transactions from ', 'event_espresso' ); ?></label>
120
+		<label for="txn-filter-start-date"><?php _e('Display Transactions from ', 'event_espresso'); ?></label>
121 121
 		<input id="payment-filter-start-date" class="datepicker" type="text" value="<?php echo $start_date; ?>" name="payment-filter-start-date" size="15"/>
122
-		<label for="txn-filter-end-date"><?php _e( ' until ', 'event_espresso' ); ?></label>
122
+		<label for="txn-filter-end-date"><?php _e(' until ', 'event_espresso'); ?></label>
123 123
 		<input id="payment-filter-end-date" class="datepicker" type="text" value="<?php echo $end_date; ?>" name="payment-filter-end-date" size="15"/>
124 124
 		<?php
125 125
 		$filters[] = ob_get_clean();
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return void
134 134
 	 */
135 135
 	protected function _add_view_counts() {
136
-		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs( $this->_per_page,$this->_current_page, TRUE );
136
+		$this->_views['all']['count'] = $this->_admin_page->get_payment_logs($this->_per_page, $this->_current_page, TRUE);
137 137
 	}
138 138
 
139 139
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	 * @return string
145 145
 	 */
146 146
 	public function column_cb($item) {
147
-		return sprintf( '<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID() );
147
+		return sprintf('<input type="checkbox" class="option_id" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
148 148
 	}
149 149
 
150 150
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	 * @param \EE_Change_Log $item
171 171
 	 * @return string
172 172
 	 */
173
-	public function column_LOG_time(EE_Change_Log $item){
173
+	public function column_LOG_time(EE_Change_Log $item) {
174 174
 		return $item->get_datetime('LOG_time');
175 175
 	}
176 176
 
@@ -181,12 +181,12 @@  discard block
 block discarded – undo
181 181
 	 * @param \EE_Change_Log $item
182 182
 	 * @return string
183 183
 	 */
184
-	public function column_PMD_ID(EE_Change_Log $item){
185
-		if($item->object() instanceof EE_Payment_Method){
184
+	public function column_PMD_ID(EE_Change_Log $item) {
185
+		if ($item->object() instanceof EE_Payment_Method) {
186 186
 			return $item->object()->admin_name();
187
-		}elseif($item->object() instanceof EE_Payment && $item->object()->payment_method()){
187
+		}elseif ($item->object() instanceof EE_Payment && $item->object()->payment_method()) {
188 188
 			return $item->object()->payment_method()->admin_name();
189
-		}else{
189
+		} else {
190 190
 			return __("No longer exists", 'event_espresso');
191 191
 		}
192 192
 	}
@@ -198,11 +198,11 @@  discard block
 block discarded – undo
198 198
 	 * @param \EE_Change_Log $item
199 199
 	 * @return string
200 200
 	 */
201
-	public function column_TXN_ID(EE_Change_Log $item){
202
-		if($item->object() instanceof EE_Payment){
203
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID() )) {
204
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID() ), TXN_ADMIN_URL );
205
-				return '<a href="'.$view_txn_lnk_url.'"  title="' . sprintf( esc_attr__( 'click to view transaction #%s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '">' . sprintf( __( 'view txn %s', 'event_espresso' ),  $item->object()->TXN_ID() ) . '</a>';
201
+	public function column_TXN_ID(EE_Change_Log $item) {
202
+		if ($item->object() instanceof EE_Payment) {
203
+			if (EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction', $item->object()->TXN_ID())) {
204
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->object()->TXN_ID()), TXN_ADMIN_URL);
205
+				return '<a href="'.$view_txn_lnk_url.'"  title="'.sprintf(esc_attr__('click to view transaction #%s', 'event_espresso'), $item->object()->TXN_ID()).'">'.sprintf(__('view txn %s', 'event_espresso'), $item->object()->TXN_ID()).'</a>';
206 206
 			}
207 207
 		} else {
208 208
 			return __("Unable to find transaction", 'event_espresso');
Please login to merge, or discard this patch.
admin_pages/events/Events_Admin_Page.core.php 1 patch
Spacing   +398 added lines, -398 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION'))
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			'espresso_events' => 'edit'
68 68
 			);
69 69
 
70
-		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array( $this, 'verify_event_edit' ) );
70
+		add_action('AHEE__EE_Admin_Page_CPT__set_model_object__after_set_object', array($this, 'verify_event_edit'));
71 71
 	}
72 72
 
73 73
 	protected function _ajax_hooks() {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 				'edit' => __('Update Event', 'event_espresso'),
94 94
 				'add_category' => __('Save New Category', 'event_espresso'),
95 95
 				'edit_category' => __('Update Category', 'event_espresso'),
96
-				'template_settings' => __( 'Update Settings', 'event_espresso' )
96
+				'template_settings' => __('Update Settings', 'event_espresso')
97 97
 				)
98 98
 		);
99 99
 	}
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		//load field generator helper
104 104
 
105 105
 		//is there a evt_id in the request?
106
-		$evt_id = ! empty( $this->_req_data['EVT_ID'] ) && ! is_array( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : 0;
107
-		$evt_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $evt_id;
106
+		$evt_id = ! empty($this->_req_data['EVT_ID']) && ! is_array($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : 0;
107
+		$evt_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $evt_id;
108 108
 
109 109
 
110 110
 		$this->_page_routes = array(
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 				'help_tour' => array(
319 319
 					'Event_Editor_Help_Tour'
320 320
 					),
321
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
321
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
322 322
 				'require_nonce' => FALSE
323 323
 			),
324 324
 			'edit' => array(
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 				/*'help_tour' => array(
375 375
 					'Event_Edit_Help_Tour'
376 376
 				),*/
377
-				'qtips' => array( 'EE_Event_Editor_Decaf_Tips' ),
377
+				'qtips' => array('EE_Event_Editor_Decaf_Tips'),
378 378
 				'require_nonce' => FALSE
379 379
 			),
380 380
 			'default_event_settings' => array(
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 						'filename' => 'events_default_settings_status'
397 397
 					)
398 398
 				),
399
-				'help_tour' => array( 'Event_Default_Settings_Help_Tour'),
399
+				'help_tour' => array('Event_Default_Settings_Help_Tour'),
400 400
 				'require_nonce' => FALSE
401 401
 			),
402 402
 			//template settings
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 						'filename' => 'general_settings_templates'
413 413
 					)
414 414
 				),
415
-				'help_tour' => array( 'Templates_Help_Tour' ),
415
+				'help_tour' => array('Templates_Help_Tour'),
416 416
 				'require_nonce' => FALSE
417 417
 			),
418 418
 			//event category stuff
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 					'label' => __('Edit Category', 'event_espresso'),
437 437
 					'order' => 15,
438 438
 					'persistent' => FALSE,
439
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
439
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
440 440
 					),
441 441
 				'help_tabs' => array(
442 442
 					'edit_category_help_tab' => array(
@@ -506,14 +506,14 @@  discard block
 block discarded – undo
506 506
 
507 507
 	public function load_scripts_styles() {
508 508
 
509
-		wp_register_style('events-admin-css', EVENTS_ASSETS_URL . 'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
510
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
509
+		wp_register_style('events-admin-css', EVENTS_ASSETS_URL.'events-admin-page.css', array(), EVENT_ESPRESSO_VERSION);
510
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
511 511
 		wp_enqueue_style('events-admin-css');
512 512
 		wp_enqueue_style('ee-cat-admin');
513 513
 		//todo note: we also need to load_scripts_styles per view (i.e. default/view_report/event_details
514 514
 		//registers for all views
515 515
 		//scripts
516
-		wp_register_script('event_editor_js', EVENTS_ASSETS_URL . 'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
516
+		wp_register_script('event_editor_js', EVENTS_ASSETS_URL.'event_editor.js', array('ee_admin_js', 'jquery-ui-slider', 'jquery-ui-timepicker-addon'), EVENT_ESPRESSO_VERSION, TRUE);
517 517
 	}
518 518
 
519 519
 	/**
@@ -531,11 +531,11 @@  discard block
 block discarded – undo
531 531
 	public function load_scripts_styles_edit() {
532 532
 		//styles
533 533
 		wp_enqueue_style('espresso-ui-theme');
534
-		wp_register_style('event-editor-css', EVENTS_ASSETS_URL . 'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION );
534
+		wp_register_style('event-editor-css', EVENTS_ASSETS_URL.'event-editor.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
535 535
 		wp_enqueue_style('event-editor-css');
536 536
 
537 537
 		//scripts
538
-		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL . 'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION );
538
+		wp_register_script('event-datetime-metabox', EVENTS_ASSETS_URL.'event-datetime-metabox.js', array('event_editor_js', 'ee-datepicker'), EVENT_ESPRESSO_VERSION);
539 539
 		wp_enqueue_script('event-datetime-metabox');
540 540
 
541 541
 	}
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
 
571 571
 
572 572
 	public function admin_init() {
573
-		EE_Registry::$i18n_js_strings[ 'image_confirm' ] = __( 'Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso' );
573
+		EE_Registry::$i18n_js_strings['image_confirm'] = __('Do you really want to delete this image? Please remember to update your event to complete the removal.', 'event_espresso');
574 574
 	}
575 575
 
576 576
 
@@ -591,45 +591,45 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function verify_event_edit($event = NULL) {
593 593
 		// no event?
594
-		if ( empty( $event )) {
594
+		if (empty($event)) {
595 595
 			// set event
596 596
 			$event = $this->_cpt_model_obj;
597 597
 		}
598 598
 		// STILL no event?
599
-		if ( empty ( $event )) {
599
+		if (empty ($event)) {
600 600
 			return;
601 601
 		}
602 602
 		// first check if event is active.
603
-		if ( $event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed ) {
603
+		if ($event->is_expired() || $event->is_inactive() || $event->status() == EEM_Event::cancelled || $event->status() == EEM_Event::postponed) {
604 604
 			return;
605 605
 		}
606 606
 		$orig_status = $event->status();
607 607
 		//made it here so it IS active... next check that any of the tickets are sold.
608
-		if ( $event->is_sold_out( true ) ) {
609
-			if ( $event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out  ) {
608
+		if ($event->is_sold_out(true)) {
609
+			if ($event->status() !== $orig_status && $orig_status !== EEM_Event::sold_out) {
610 610
 				EE_Error::add_attention(
611 611
 					sprintf(
612
-						__( 'Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso' ),
613
-						EEH_Template::pretty_status( EEM_Event::sold_out, FALSE, 'sentence' )
612
+						__('Please note that the Event Status has automatically been changed to %s because there are no more spaces available for this event.  However, this change is not permanent until you update the event.  You can change the status back to something else before updating if you wish.', 'event_espresso'),
613
+						EEH_Template::pretty_status(EEM_Event::sold_out, FALSE, 'sentence')
614 614
 					)
615 615
 				);
616 616
 			}
617 617
 			return;
618
-		} else if ( $orig_status === EEM_Event::sold_out ) {
618
+		} else if ($orig_status === EEM_Event::sold_out) {
619 619
 			EE_Error::add_attention(
620 620
 				sprintf(
621
-					__( 'Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
622
-						'event_espresso' ),
623
-					EEH_Template::pretty_status( $event->status(), false, 'sentence' )
621
+					__('Please note that the Event Status has automatically been changed to %s because more spaces have become available for this event, most likely due to abandoned transactions freeing up reserved tickets.  However, this change is not permanent until you update the event. If you wish, you can change the status back to something else before updating.',
622
+						'event_espresso'),
623
+					EEH_Template::pretty_status($event->status(), false, 'sentence')
624 624
 				)
625 625
 			);
626 626
 		}
627 627
 		//now we need to determine if the event has any tickets on sale.  If not then we dont' show the error
628
-		if ( ! $event->tickets_on_sale() ) {
628
+		if ( ! $event->tickets_on_sale()) {
629 629
 			return;
630 630
 		}
631 631
 		//made it here so show warning
632
-		EE_Error::add_attention( $this->_edit_event_warning() );
632
+		EE_Error::add_attention($this->_edit_event_warning());
633 633
 	}
634 634
 
635 635
 
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 			),
670 670
 		);
671 671
 
672
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_events', 'espresso_events_trash_events' ) ) {
672
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_events', 'espresso_events_trash_events')) {
673 673
 			$this->_views['trash'] = array(
674 674
 				'slug' => 'trash',
675 675
 				'label' => __('Trash', 'event_espresso'),
@@ -699,39 +699,39 @@  discard block
 block discarded – undo
699 699
 				'desc' => __('View Registrations for Event', 'event_espresso')
700 700
 			)
701 701
 		);
702
-		$items  = apply_filters( 'FHEE__Events_Admin_Page___event_legend_items__items', $items );
702
+		$items = apply_filters('FHEE__Events_Admin_Page___event_legend_items__items', $items);
703 703
 		$statuses = array(
704 704
 			'sold_out_status' => array(
705
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::sold_out,
706
-				'desc' => EEH_Template::pretty_status( EE_Datetime::sold_out, FALSE, 'sentence' )
705
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::sold_out,
706
+				'desc' => EEH_Template::pretty_status(EE_Datetime::sold_out, FALSE, 'sentence')
707 707
 			),
708 708
 			'active_status' => array(
709
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::active,
710
-				'desc' => EEH_Template::pretty_status( EE_Datetime::active, FALSE, 'sentence' )
709
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::active,
710
+				'desc' => EEH_Template::pretty_status(EE_Datetime::active, FALSE, 'sentence')
711 711
 			),
712 712
 			'upcoming_status' => array(
713
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::upcoming,
714
-				'desc' => EEH_Template::pretty_status( EE_Datetime::upcoming, FALSE, 'sentence' )
713
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::upcoming,
714
+				'desc' => EEH_Template::pretty_status(EE_Datetime::upcoming, FALSE, 'sentence')
715 715
 			),
716 716
 			'postponed_status' => array(
717
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::postponed,
718
-				'desc' => EEH_Template::pretty_status( EE_Datetime::postponed, FALSE, 'sentence' )
717
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::postponed,
718
+				'desc' => EEH_Template::pretty_status(EE_Datetime::postponed, FALSE, 'sentence')
719 719
 			),
720 720
 			'cancelled_status' => array(
721
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::cancelled,
722
-				'desc' => EEH_Template::pretty_status( EE_Datetime::cancelled, FALSE, 'sentence' )
721
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::cancelled,
722
+				'desc' => EEH_Template::pretty_status(EE_Datetime::cancelled, FALSE, 'sentence')
723 723
 			),
724 724
 			'expired_status' => array(
725
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::expired,
726
-				'desc' => EEH_Template::pretty_status( EE_Datetime::expired, FALSE, 'sentence' )
725
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::expired,
726
+				'desc' => EEH_Template::pretty_status(EE_Datetime::expired, FALSE, 'sentence')
727 727
 			),
728 728
 			'inactive_status' => array(
729
-				'class' => 'ee-status-legend ee-status-legend-' . EE_Datetime::inactive,
730
-				'desc' => EEH_Template::pretty_status( EE_Datetime::inactive, FALSE, 'sentence' )
729
+				'class' => 'ee-status-legend ee-status-legend-'.EE_Datetime::inactive,
730
+				'desc' => EEH_Template::pretty_status(EE_Datetime::inactive, FALSE, 'sentence')
731 731
 			)
732 732
 		);
733
-		$statuses = apply_filters( 'FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses );
734
-		return array_merge( $items, $statuses );
733
+		$statuses = apply_filters('FHEE__Events_Admin_Page__event_legend_items__statuses', $statuses);
734
+		return array_merge($items, $statuses);
735 735
 	}
736 736
 
737 737
 
@@ -743,8 +743,8 @@  discard block
 block discarded – undo
743 743
 	 * @return EEM_Event
744 744
 	 */
745 745
 	private function _event_model() {
746
-		if ( ! $this->_event_model instanceof EEM_Event ) {
747
-			$this->_event_model = EE_Registry::instance()->load_model( 'Event' );
746
+		if ( ! $this->_event_model instanceof EEM_Event) {
747
+			$this->_event_model = EE_Registry::instance()->load_model('Event');
748 748
 		}
749 749
 		return $this->_event_model;
750 750
 	}
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
 	 * @param  string $new_slug  what the slug is
764 764
 	 * @return string            The new html string for the permalink area
765 765
 	 */
766
-	public function extra_permalink_field_buttons( $return, $id, $new_title, $new_slug ) {
766
+	public function extra_permalink_field_buttons($return, $id, $new_title, $new_slug) {
767 767
 		//make sure this is only when editing
768
-		if ( !empty( $id ) ) {
769
-			$post = get_post( $id );
770
-			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">' . __('Shortcode', 'event_espresso') . '</a> ';
771
-			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id=' . $post->ID . ']">';
768
+		if ( ! empty($id)) {
769
+			$post = get_post($id);
770
+			$return .= '<a class="button button-small" onclick="prompt(\'Shortcode:\', jQuery(\'#shortcode\').val()); return false;" href="#"  tabindex="-1">'.__('Shortcode', 'event_espresso').'</a> ';
771
+			$return .= '<input id="shortcode" type="hidden" value="[ESPRESSO_TICKET_SELECTOR event_id='.$post->ID.']">';
772 772
 		}
773 773
 		return $return;
774 774
 	}
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	 * @return string html for generated table
785 785
 	 */
786 786
 	protected function _events_overview_list_table() {
787
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
788
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button' ) .
787
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_events'), __("View Event Archive Page", "event_espresso"), 'button').
789 789
 		$this->_display_legend($this->_event_legend_items());
790 790
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
791 791
 		$this->display_admin_list_table_page_with_no_sidebar();
@@ -803,51 +803,51 @@  discard block
 block discarded – undo
803 803
 
804 804
 
805 805
 
806
-	protected function _insert_update_cpt_item( $post_id, $post ) {
806
+	protected function _insert_update_cpt_item($post_id, $post) {
807 807
 
808
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_events' ) {
808
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_events') {
809 809
 			//getout we're not processing an event save.
810 810
 			return;
811 811
 		}
812 812
 
813 813
 		$event_values = array(
814
-			'EVT_display_desc' => !empty( $this->_req_data['display_desc'] ) ? 1 : 0,
815
-			'EVT_display_ticket_selector' => !empty( $this->_req_data['display_ticket_selector'] ) ? 1 : 0,
814
+			'EVT_display_desc' => ! empty($this->_req_data['display_desc']) ? 1 : 0,
815
+			'EVT_display_ticket_selector' => ! empty($this->_req_data['display_ticket_selector']) ? 1 : 0,
816 816
 			'EVT_additional_limit' => min(
817
-					apply_filters( 'FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255 ),
818
-					!empty( $this->_req_data['additional_limit'] ) ? $this->_req_data['additional_limit'] : NULL ),
819
-			'EVT_default_registration_status' => !empty( $this->_req_data['EVT_default_registration_status'] ) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
820
-			'EVT_member_only' => !empty( $this->_req_data['member_only'] ) ? 1 : 0,
821
-			'EVT_allow_overflow' => !empty( $this->_req_data['EVT_allow_overflow'] ) ? 1 : 0,
822
-			'EVT_timezone_string' => !empty( $this->_req_data['timezone_string'] ) ? $this->_req_data['timezone_string'] : NULL,
823
-			'EVT_external_URL' => !empty( $this->_req_data['externalURL'] ) ? $this->_req_data['externalURL'] : NULL,
824
-			'EVT_phone' => !empty( $this->_req_data['event_phone'] ) ? $this->_req_data['event_phone'] : NULL
817
+					apply_filters('FHEE__EE_Events_Admin__insert_update_cpt_item__EVT_additional_limit_max', 255),
818
+					! empty($this->_req_data['additional_limit']) ? $this->_req_data['additional_limit'] : NULL ),
819
+			'EVT_default_registration_status' => ! empty($this->_req_data['EVT_default_registration_status']) ? $this->_req_data['EVT_default_registration_status'] : EE_Registry::instance()->CFG->registration->default_STS_ID,
820
+			'EVT_member_only' => ! empty($this->_req_data['member_only']) ? 1 : 0,
821
+			'EVT_allow_overflow' => ! empty($this->_req_data['EVT_allow_overflow']) ? 1 : 0,
822
+			'EVT_timezone_string' => ! empty($this->_req_data['timezone_string']) ? $this->_req_data['timezone_string'] : NULL,
823
+			'EVT_external_URL' => ! empty($this->_req_data['externalURL']) ? $this->_req_data['externalURL'] : NULL,
824
+			'EVT_phone' => ! empty($this->_req_data['event_phone']) ? $this->_req_data['event_phone'] : NULL
825 825
 			);
826 826
 
827 827
 		//update event
828
-		$success = $this->_event_model()->update_by_ID( $event_values, $post_id );
828
+		$success = $this->_event_model()->update_by_ID($event_values, $post_id);
829 829
 
830 830
 
831 831
 		//get event_object for other metaboxes... though it would seem to make sense to just use $this->_event_model()->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
832
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status );
833
-		$event = $this->_event_model()->get_one( array($get_one_where) );
832
+		$get_one_where = array($this->_event_model()->primary_key_name() => $post_id, 'status' => $post->post_status);
833
+		$event = $this->_event_model()->get_one(array($get_one_where));
834 834
 
835 835
 
836 836
 		//the following are default callbacks for event attachment updates that can be overridden by caffeinated functionality and/or addons.
837
-		$event_update_callbacks = apply_filters( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( array($this, '_default_venue_update' ), array( $this, '_default_tickets_update') ) );
837
+		$event_update_callbacks = apply_filters('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array(array($this, '_default_venue_update'), array($this, '_default_tickets_update')));
838 838
 
839 839
 		$att_success = TRUE;
840 840
 
841
-		foreach ( $event_update_callbacks as $e_callback ) {
842
-			$_succ = call_user_func_array( $e_callback, array( $event,  $this->_req_data ) );
843
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
841
+		foreach ($event_update_callbacks as $e_callback) {
842
+			$_succ = call_user_func_array($e_callback, array($event, $this->_req_data));
843
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
844 844
 		}
845 845
 
846 846
 		//any errors?
847
-		if ( $success && FALSE === $att_success ) {
848
-			EE_Error::add_error( __('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
849
-		} else if ( $success === FALSE ) {
850
-			EE_Error::add_error( __('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
847
+		if ($success && FALSE === $att_success) {
848
+			EE_Error::add_error(__('Event Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
849
+		} else if ($success === FALSE) {
850
+			EE_Error::add_error(__('Event Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
851 851
 		}
852 852
 	}
853 853
 
@@ -857,14 +857,14 @@  discard block
 block discarded – undo
857 857
 	/**
858 858
 	 * @see parent::restore_item()
859 859
 	 */
860
-	protected function _restore_cpt_item( $post_id, $revision_id ) {
860
+	protected function _restore_cpt_item($post_id, $revision_id) {
861 861
 		//copy existing event meta to new post
862 862
 		$post_evt = $this->_event_model()->get_one_by_ID($post_id);
863
-		if ( $post_evt instanceof EE_Event ) {
863
+		if ($post_evt instanceof EE_Event) {
864 864
 			//meta revision restore
865
-			$post_evt->restore_revision( $revision_id );
865
+			$post_evt->restore_revision($revision_id);
866 866
 			//related objs restore
867
-			$post_evt->restore_revision( $revision_id, array( 'Venue', 'Datetime', 'Price' ) );
867
+			$post_evt->restore_revision($revision_id, array('Venue', 'Datetime', 'Price'));
868 868
 		}
869 869
 	}
870 870
 
@@ -877,52 +877,52 @@  discard block
 block discarded – undo
877 877
 	 * @param  array  $data   The request data from the form
878 878
 	 * @return bool           Success or fail.
879 879
 	 */
880
-	protected function _default_venue_update( $evtobj, $data ) {
881
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
880
+	protected function _default_venue_update($evtobj, $data) {
881
+		require_once(EE_MODELS.'EEM_Venue.model.php');
882 882
 		$venue_model = EE_Registry::instance()->load_model('Venue');
883 883
 		$rows_affected = NULL;
884
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
884
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
885 885
 
886 886
 		// very important.  If we don't have a venue name...
887 887
 		// then we'll get out because not necessary to create empty venue
888
-		if ( empty( $data['venue_title'] ) ) {
888
+		if (empty($data['venue_title'])) {
889 889
 			return false;
890 890
 		}
891 891
 
892 892
 		$venue_array = array(
893 893
 				'VNU_wp_user' => $evtobj->get('EVT_wp_user'),
894
-				'VNU_name' => !empty( $data['venue_title'] ) ? $data['venue_title'] : NULL,
895
-				'VNU_desc' => !empty( $data['venue_description'] ) ? $data['venue_description'] : NULL,
896
-				'VNU_identifier' => !empty( $data['venue_identifier'] ) ? $data['venue_identifier'] : NULL,
897
-				'VNU_short_desc' => !empty( $data['venue_short_description'] ) ? $data['venue_short_description'] : NULL,
898
-				'VNU_address' => !empty( $data['address'] ) ? $data['address'] : NULL,
899
-				'VNU_address2' => !empty( $data['address2'] ) ? $data['address2'] : NULL,
900
-				'VNU_city' => !empty( $data['city'] ) ? $data['city'] : NULL,
901
-				'STA_ID' => !empty( $data['state'] ) ? $data['state'] : NULL,
902
-				'CNT_ISO' => !empty( $data['countries'] ) ? $data['countries'] : NULL,
903
-				'VNU_zip' => !empty( $data['zip'] ) ? $data['zip'] : NULL,
904
-				'VNU_phone' => !empty( $data['venue_phone'] ) ? $data['venue_phone'] : NULL,
905
-				'VNU_capacity' => !empty( $data['venue_capacity'] ) ? $data['venue_capacity'] : NULL,
906
-				'VNU_url' => !empty($data['venue_url'] ) ? $data['venue_url'] : NULL,
907
-				'VNU_virtual_phone' => !empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
908
-				'VNU_virtual_url' => !empty( $data['virtual_url'] ) ? $data['virtual_url'] : NULL,
909
-				'VNU_enable_for_gmap' => isset( $data['enable_for_gmap'] ) ? 1 : 0,
894
+				'VNU_name' => ! empty($data['venue_title']) ? $data['venue_title'] : NULL,
895
+				'VNU_desc' => ! empty($data['venue_description']) ? $data['venue_description'] : NULL,
896
+				'VNU_identifier' => ! empty($data['venue_identifier']) ? $data['venue_identifier'] : NULL,
897
+				'VNU_short_desc' => ! empty($data['venue_short_description']) ? $data['venue_short_description'] : NULL,
898
+				'VNU_address' => ! empty($data['address']) ? $data['address'] : NULL,
899
+				'VNU_address2' => ! empty($data['address2']) ? $data['address2'] : NULL,
900
+				'VNU_city' => ! empty($data['city']) ? $data['city'] : NULL,
901
+				'STA_ID' => ! empty($data['state']) ? $data['state'] : NULL,
902
+				'CNT_ISO' => ! empty($data['countries']) ? $data['countries'] : NULL,
903
+				'VNU_zip' => ! empty($data['zip']) ? $data['zip'] : NULL,
904
+				'VNU_phone' => ! empty($data['venue_phone']) ? $data['venue_phone'] : NULL,
905
+				'VNU_capacity' => ! empty($data['venue_capacity']) ? $data['venue_capacity'] : NULL,
906
+				'VNU_url' => ! empty($data['venue_url']) ? $data['venue_url'] : NULL,
907
+				'VNU_virtual_phone' => ! empty($data['virtual_phone']) ? $data['virtual_phone'] : NULL,
908
+				'VNU_virtual_url' => ! empty($data['virtual_url']) ? $data['virtual_url'] : NULL,
909
+				'VNU_enable_for_gmap' => isset($data['enable_for_gmap']) ? 1 : 0,
910 910
 				'status' => 'publish'
911 911
 			);
912 912
 
913 913
 
914 914
 		//if we've got the venue_id then we're just updating the existing venue so let's do that and then get out.
915
-		if ( !empty( $venue_id ) ) {
916
-			$update_where = array( $venue_model->primary_key_name() => $venue_id );
917
-			$rows_affected = $venue_model->update( $venue_array, array( $update_where ) );
915
+		if ( ! empty($venue_id)) {
916
+			$update_where = array($venue_model->primary_key_name() => $venue_id);
917
+			$rows_affected = $venue_model->update($venue_array, array($update_where));
918 918
 			//we've gotta make sure that the venue is always attached to a revision.. add_relation_to should take care of making sure that the relation is already present.
919
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
919
+			$evtobj->_add_relation_to($venue_id, 'Venue');
920 920
 			return $rows_affected > 0 ? TRUE : FALSE;
921 921
 		} else {
922 922
 			//we insert the venue
923
-			$venue_id = $venue_model->insert( $venue_array );
924
-			$evtobj->_add_relation_to( $venue_id, 'Venue' );
925
-			return !empty( $venue_id ) ? TRUE : FALSE;
923
+			$venue_id = $venue_model->insert($venue_array);
924
+			$evtobj->_add_relation_to($venue_id, 'Venue');
925
+			return ! empty($venue_id) ? TRUE : FALSE;
926 926
 		}
927 927
 		//when we have the ancestor come in it's already been handled by the revision save.
928 928
 	}
@@ -936,54 +936,54 @@  discard block
 block discarded – undo
936 936
 	 * @param  array    $data   The request data from the form
937 937
 	 * @return bool             success or fail
938 938
 	 */
939
-	protected function _default_tickets_update( EE_Event $evtobj, $data ) {
939
+	protected function _default_tickets_update(EE_Event $evtobj, $data) {
940 940
 		$success = true;
941 941
 		$saved_dtt = null;
942 942
 		$saved_tickets = array();
943
-		$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
943
+		$incoming_date_formats = array('Y-m-d', 'h:i a');
944 944
 
945
-		foreach ( $data['edit_event_datetimes'] as $row => $dtt ) {
945
+		foreach ($data['edit_event_datetimes'] as $row => $dtt) {
946 946
 			//trim all values to ensure any excess whitespace is removed.
947
-			$dtt =  array_map( 'trim', $dtt );
948
-			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty( $dtt['DTT_EVT_end'] ) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
947
+			$dtt = array_map('trim', $dtt);
948
+			$dtt['DTT_EVT_end'] = isset($dtt['DTT_EVT_end']) && ! empty($dtt['DTT_EVT_end']) ? $dtt['DTT_EVT_end'] : $dtt['DTT_EVT_start'];
949 949
 			$datetime_values = array(
950
-				'DTT_ID' 		=> ! empty( $dtt['DTT_ID'] ) ? $dtt['DTT_ID'] : NULL,
950
+				'DTT_ID' 		=> ! empty($dtt['DTT_ID']) ? $dtt['DTT_ID'] : NULL,
951 951
 				'DTT_EVT_start' => $dtt['DTT_EVT_start'],
952 952
 				'DTT_EVT_end' 	=> $dtt['DTT_EVT_end'],
953
-				'DTT_reg_limit' => empty( $dtt['DTT_reg_limit'] ) ? EE_INF : $dtt['DTT_reg_limit'],
953
+				'DTT_reg_limit' => empty($dtt['DTT_reg_limit']) ? EE_INF : $dtt['DTT_reg_limit'],
954 954
 				'DTT_order' 	=> $row,
955 955
 			);
956 956
 
957 957
 			//if we have an id then let's get existing object first and then set the new values.  Otherwise we instantiate a new object for save.
958 958
 
959
-			if ( !empty( $dtt['DTT_ID'] ) ) {
960
-				$DTM = EE_Registry::instance()->load_model('Datetime', array( $evtobj->get_timezone() ) )->get_one_by_ID($dtt['DTT_ID'] );
961
-				$DTM->set_date_format( $incoming_date_formats[0] );
962
-				$DTM->set_time_format( $incoming_date_formats[1] );
963
-				foreach ( $datetime_values as $field => $value ) {
964
-					$DTM->set( $field, $value );
959
+			if ( ! empty($dtt['DTT_ID'])) {
960
+				$DTM = EE_Registry::instance()->load_model('Datetime', array($evtobj->get_timezone()))->get_one_by_ID($dtt['DTT_ID']);
961
+				$DTM->set_date_format($incoming_date_formats[0]);
962
+				$DTM->set_time_format($incoming_date_formats[1]);
963
+				foreach ($datetime_values as $field => $value) {
964
+					$DTM->set($field, $value);
965 965
 				}
966 966
 
967 967
 				//make sure the $dtt_id here is saved just in case after the add_relation_to() the autosave replaces it.  We need to do this so we dont' TRASH the parent DTT.
968 968
 				$saved_dtts[$DTM->ID()] = $DTM;
969 969
 			} else {
970
-				$DTM = EE_Registry::instance()->load_class('Datetime', array( $datetime_values ), FALSE, FALSE );
971
-				$DTM->set_date_format( $incoming_date_formats[0] );
972
-				$DTM->set_time_format( $incoming_date_formats[1] );
973
-				$DTM->set_timezone( $evtobj->get_timezone() );
974
-				foreach ( $datetime_values as $field => $value ) {
975
-					$DTM->set( $field, $value );
970
+				$DTM = EE_Registry::instance()->load_class('Datetime', array($datetime_values), FALSE, FALSE);
971
+				$DTM->set_date_format($incoming_date_formats[0]);
972
+				$DTM->set_time_format($incoming_date_formats[1]);
973
+				$DTM->set_timezone($evtobj->get_timezone());
974
+				foreach ($datetime_values as $field => $value) {
975
+					$DTM->set($field, $value);
976 976
 				}
977 977
 			}
978 978
 			$DTM->save();
979 979
 
980
-			$DTT = $evtobj->_add_relation_to( $DTM, 'Datetime' );
980
+			$DTT = $evtobj->_add_relation_to($DTM, 'Datetime');
981 981
 
982 982
 			//load DTT helper
983 983
 
984 984
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
985
-			if( $DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end') ) {
986
-				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start') );
985
+			if ($DTT->get_raw('DTT_EVT_start') > $DTT->get_raw('DTT_EVT_end')) {
986
+				$DTT->set('DTT_EVT_end', $DTT->get('DTT_EVT_start'));
987 987
 				$DTT = EEH_DTT_Helper::date_time_add($DTT, 'DTT_EVT_end', 'days');
988 988
 				$DTT->save();
989 989
 			}
@@ -991,45 +991,45 @@  discard block
 block discarded – undo
991 991
 			//now we got to make sure we add the new DTT_ID to the $saved_dtts array  because it is possible there was a new one created for the autosave.
992 992
 			$saved_dtt = $DTT;
993 993
 
994
-			$success = !$success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
994
+			$success = ! $success ? $success : $DTT; //if ANY of these updates fail then we want the appropriate global error message. //todod this is actually sucky we need a better error message but this is what it is for now.
995 995
 		}
996 996
 
997 997
 		//no dtts get deleted so we don't do any of that logic here.
998 998
 		//update tickets next
999
-		$old_tickets = isset( $data['ticket_IDs'] ) ? explode(',', $data['ticket_IDs'] ) : array();
1000
-		foreach ( $data['edit_tickets'] as $row => $tkt ) {
1001
-			$incoming_date_formats = array( 'Y-m-d', 'h:i a' );
999
+		$old_tickets = isset($data['ticket_IDs']) ? explode(',', $data['ticket_IDs']) : array();
1000
+		foreach ($data['edit_tickets'] as $row => $tkt) {
1001
+			$incoming_date_formats = array('Y-m-d', 'h:i a');
1002 1002
 			$update_prices = false;
1003
-			$ticket_price = isset( $data['edit_prices'][$row][1]['PRC_amount'] ) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1003
+			$ticket_price = isset($data['edit_prices'][$row][1]['PRC_amount']) ? $data['edit_prices'][$row][1]['PRC_amount'] : 0;
1004 1004
 
1005 1005
 			// trim inputs to ensure any excess whitespace is removed.
1006
-			$tkt = array_map( 'trim', $tkt );
1006
+			$tkt = array_map('trim', $tkt);
1007 1007
 
1008
-			if ( empty( $tkt['TKT_start_date'] ) ) {
1008
+			if (empty($tkt['TKT_start_date'])) {
1009 1009
 				//let's use now in the set timezone.
1010
-				$now = new DateTime( 'now', new DateTimeZone( $evtobj->get_timezone() ) );
1011
-				$tkt['TKT_start_date'] = $now->format( $incoming_date_formats[0] . ' ' . $incoming_date_formats[1] );
1010
+				$now = new DateTime('now', new DateTimeZone($evtobj->get_timezone()));
1011
+				$tkt['TKT_start_date'] = $now->format($incoming_date_formats[0].' '.$incoming_date_formats[1]);
1012 1012
 			}
1013 1013
 
1014
-			if ( empty( $tkt['TKT_end_date'] ) ) {
1014
+			if (empty($tkt['TKT_end_date'])) {
1015 1015
 				//use the start date of the first datetime
1016 1016
 				$dtt = $evtobj->first_datetime();
1017
-				$tkt['TKT_end_date'] = $dtt->start_date_and_time( $incoming_date_formats[0], $incoming_date_formats[1] );
1017
+				$tkt['TKT_end_date'] = $dtt->start_date_and_time($incoming_date_formats[0], $incoming_date_formats[1]);
1018 1018
 			}
1019 1019
 
1020 1020
 			$TKT_values = array(
1021
-				'TKT_ID' 			=> !empty( $tkt['TKT_ID'] ) ? $tkt['TKT_ID'] : NULL,
1022
-				'TTM_ID' 			=> !empty( $tkt['TTM_ID'] ) ? $tkt['TTM_ID'] : 0,
1023
-				'TKT_name' 			=> !empty( $tkt['TKT_name'] ) ? $tkt['TKT_name'] : '',
1024
-				'TKT_description' 	=> !empty( $tkt['TKT_description'] ) ? $tkt['TKT_description'] : '',
1021
+				'TKT_ID' 			=> ! empty($tkt['TKT_ID']) ? $tkt['TKT_ID'] : NULL,
1022
+				'TTM_ID' 			=> ! empty($tkt['TTM_ID']) ? $tkt['TTM_ID'] : 0,
1023
+				'TKT_name' 			=> ! empty($tkt['TKT_name']) ? $tkt['TKT_name'] : '',
1024
+				'TKT_description' 	=> ! empty($tkt['TKT_description']) ? $tkt['TKT_description'] : '',
1025 1025
 				'TKT_start_date' 	=> $tkt['TKT_start_date'],
1026 1026
 				'TKT_end_date' 		=> $tkt['TKT_end_date'],
1027
-				'TKT_qty' 			=> ! isset( $tkt[ 'TKT_qty' ] ) || $tkt[ 'TKT_qty' ] === '' ? EE_INF : $tkt['TKT_qty'],
1028
-				'TKT_uses' 			=> ! isset( $tkt[ 'TKT_uses' ] ) || $tkt[ 'TKT_uses' ] === '' ? EE_INF : $tkt[ 'TKT_uses' ],
1029
-				'TKT_min' 			=> empty( $tkt['TKT_min'] ) ? 0 : $tkt['TKT_min'],
1030
-				'TKT_max' 			=> empty( $tkt['TKT_max'] ) ? EE_INF : $tkt['TKT_max'],
1027
+				'TKT_qty' 			=> ! isset($tkt['TKT_qty']) || $tkt['TKT_qty'] === '' ? EE_INF : $tkt['TKT_qty'],
1028
+				'TKT_uses' 			=> ! isset($tkt['TKT_uses']) || $tkt['TKT_uses'] === '' ? EE_INF : $tkt['TKT_uses'],
1029
+				'TKT_min' 			=> empty($tkt['TKT_min']) ? 0 : $tkt['TKT_min'],
1030
+				'TKT_max' 			=> empty($tkt['TKT_max']) ? EE_INF : $tkt['TKT_max'],
1031 1031
 				'TKT_row' 			=> $row,
1032
-				'TKT_order' 		=> isset( $tkt['TKT_order'] ) ? $tkt['TKT_order'] : $row,
1032
+				'TKT_order' 		=> isset($tkt['TKT_order']) ? $tkt['TKT_order'] : $row,
1033 1033
 				'TKT_price' 		=> $ticket_price
1034 1034
 			);
1035 1035
 
@@ -1037,7 +1037,7 @@  discard block
 block discarded – undo
1037 1037
 
1038 1038
 
1039 1039
 			//if this is a default TKT, then we need to set the TKT_ID to 0 and update accordingly, which means in turn that the prices will become new prices as well.
1040
-			if ( isset( $tkt['TKT_is_default'] ) && $tkt['TKT_is_default'] ) {
1040
+			if (isset($tkt['TKT_is_default']) && $tkt['TKT_is_default']) {
1041 1041
 				$TKT_values['TKT_ID'] = 0;
1042 1042
 				$TKT_values['TKT_is_default'] = 0;
1043 1043
 				$TKT_values['TKT_price'] = $ticket_price;
@@ -1048,58 +1048,58 @@  discard block
 block discarded – undo
1048 1048
 			//we actually do our saves a head of doing any add_relations to because its entirely possible that this ticket didn't removed or added to any datetime in the session but DID have it's items modified.
1049 1049
 			//keep in mind that if the TKT has been sold (and we have changed pricing information), then we won't be updating the tkt but instead a new tkt will be created and the old one archived.
1050 1050
 
1051
-			if ( !empty( $tkt['TKT_ID'] ) ) {
1052
-				$TKT = EE_Registry::instance()->load_model( 'Ticket', array( $evtobj->get_timezone() ) )->get_one_by_ID( $tkt['TKT_ID'] );
1053
-				if ( $TKT instanceof EE_Ticket ) {
1054
-					$ticket_sold = $TKT->count_related( 'Registration', array( array( 'STS_ID' => array( 'NOT IN', array( EEM_Registration::status_id_incomplete ) ) ) ) ) > 0 ? true : false;
1051
+			if ( ! empty($tkt['TKT_ID'])) {
1052
+				$TKT = EE_Registry::instance()->load_model('Ticket', array($evtobj->get_timezone()))->get_one_by_ID($tkt['TKT_ID']);
1053
+				if ($TKT instanceof EE_Ticket) {
1054
+					$ticket_sold = $TKT->count_related('Registration', array(array('STS_ID' => array('NOT IN', array(EEM_Registration::status_id_incomplete))))) > 0 ? true : false;
1055 1055
 					//let's just check the total price for the existing ticket and determine if it matches the new total price.  if they are different then we create a new ticket (if tkts sold) if they aren't different then we go ahead and modify existing ticket.
1056
-					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get( 'TKT_price' ) && ! $TKT->get( 'TKT_deleted' ) ? true : false;
1057
-					$TKT->set_date_format( $incoming_date_formats[ 0 ] );
1058
-					$TKT->set_time_format( $incoming_date_formats[ 1 ] );
1056
+					$create_new_TKT = $ticket_sold && $ticket_price != $TKT->get('TKT_price') && ! $TKT->get('TKT_deleted') ? true : false;
1057
+					$TKT->set_date_format($incoming_date_formats[0]);
1058
+					$TKT->set_time_format($incoming_date_formats[1]);
1059 1059
 					//set new values
1060
-					foreach ( $TKT_values as $field => $value ) {
1061
-						if ( $field == 'TKT_qty' ) {
1062
-							$TKT->set_qty( $value );
1060
+					foreach ($TKT_values as $field => $value) {
1061
+						if ($field == 'TKT_qty') {
1062
+							$TKT->set_qty($value);
1063 1063
 						} else {
1064
-							$TKT->set( $field, $value );
1064
+							$TKT->set($field, $value);
1065 1065
 						}
1066 1066
 					}
1067 1067
 					//if $create_new_TKT is false then we can safely update the existing ticket.  Otherwise we have to create a new ticket.
1068
-					if ( $create_new_TKT ) {
1068
+					if ($create_new_TKT) {
1069 1069
 						//archive the old ticket first
1070
-						$TKT->set( 'TKT_deleted', 1 );
1070
+						$TKT->set('TKT_deleted', 1);
1071 1071
 						$TKT->save();
1072 1072
 						//make sure this ticket is still recorded in our saved_tkts so we don't run it through the regular trash routine.
1073
-						$saved_tickets[ $TKT->ID() ] = $TKT;
1073
+						$saved_tickets[$TKT->ID()] = $TKT;
1074 1074
 						//create new ticket that's a copy of the existing except a new id of course (and not archived) AND has the new TKT_price associated with it.
1075 1075
 						$TKT = clone $TKT;
1076
-						$TKT->set( 'TKT_ID', 0 );
1077
-						$TKT->set( 'TKT_deleted', 0 );
1078
-						$TKT->set( 'TKT_price', $ticket_price );
1079
-						$TKT->set( 'TKT_sold', 0 );
1076
+						$TKT->set('TKT_ID', 0);
1077
+						$TKT->set('TKT_deleted', 0);
1078
+						$TKT->set('TKT_price', $ticket_price);
1079
+						$TKT->set('TKT_sold', 0);
1080 1080
 						//now we need to make sure that $new prices are created as well and attached to new ticket.
1081 1081
 						$update_prices = true;
1082 1082
 					}
1083 1083
 					//make sure price is set if it hasn't been already
1084
-					$TKT->set( 'TKT_price', $ticket_price );
1084
+					$TKT->set('TKT_price', $ticket_price);
1085 1085
 				}
1086 1086
 
1087 1087
 			} else {
1088 1088
 				//no TKT_id so a new TKT
1089 1089
 				$TKT_values['TKT_price'] = $ticket_price;
1090
-				$TKT = EE_Registry::instance()->load_class('Ticket', array( $TKT_values ), FALSE, FALSE );
1091
-				if ( $TKT instanceof EE_Ticket ) {
1090
+				$TKT = EE_Registry::instance()->load_class('Ticket', array($TKT_values), FALSE, FALSE);
1091
+				if ($TKT instanceof EE_Ticket) {
1092 1092
 					//need to reset values to properly account for the date formats
1093
-					$TKT->set_date_format( $incoming_date_formats[0] );
1094
-					$TKT->set_time_format( $incoming_date_formats[1] );
1095
-					$TKT->set_timezone( $evtobj->get_timezone() );
1093
+					$TKT->set_date_format($incoming_date_formats[0]);
1094
+					$TKT->set_time_format($incoming_date_formats[1]);
1095
+					$TKT->set_timezone($evtobj->get_timezone());
1096 1096
 
1097 1097
 					//set new values
1098
-					foreach ( $TKT_values as $field => $value ) {
1099
-						if ( $field == 'TKT_qty' ) {
1100
-							$TKT->set_qty( $value );
1098
+					foreach ($TKT_values as $field => $value) {
1099
+						if ($field == 'TKT_qty') {
1100
+							$TKT->set_qty($value);
1101 1101
 						} else {
1102
-							$TKT->set( $field, $value );
1102
+							$TKT->set($field, $value);
1103 1103
 						}
1104 1104
 					}
1105 1105
 
@@ -1107,31 +1107,31 @@  discard block
 block discarded – undo
1107 1107
 				}
1108 1108
 			}
1109 1109
 			// cap ticket qty by datetime reg limits
1110
-			$TKT->set_qty( min( $TKT->qty(), $TKT->qty( 'reg_limit' ) ) );
1110
+			$TKT->set_qty(min($TKT->qty(), $TKT->qty('reg_limit')));
1111 1111
 			//update ticket.
1112 1112
 			$TKT->save();
1113 1113
 
1114 1114
 			//before going any further make sure our dates are setup correctly so that the end date is always equal or greater than the start date.
1115
-			if( $TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date') ) {
1116
-				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date') );
1115
+			if ($TKT->get_raw('TKT_start_date') > $TKT->get_raw('TKT_end_date')) {
1116
+				$TKT->set('TKT_end_date', $TKT->get('TKT_start_date'));
1117 1117
 				$TKT = EEH_DTT_Helper::date_time_add($TKT, 'TKT_end_date', 'days');
1118 1118
 				$TKT->save();
1119 1119
 			}
1120 1120
 
1121 1121
 			//initially let's add the ticket to the dtt
1122
-			$saved_dtt->_add_relation_to( $TKT, 'Ticket' );
1122
+			$saved_dtt->_add_relation_to($TKT, 'Ticket');
1123 1123
 
1124 1124
 			$saved_tickets[$TKT->ID()] = $TKT;
1125 1125
 
1126 1126
 			//add prices to ticket
1127
-			$this->_add_prices_to_ticket( $data['edit_prices'][$row], $TKT, $update_prices );
1127
+			$this->_add_prices_to_ticket($data['edit_prices'][$row], $TKT, $update_prices);
1128 1128
 		}
1129 1129
 		//however now we need to handle permanently deleting tickets via the ui.  Keep in mind that the ui does not allow deleting/archiving tickets that have ticket sold.  However, it does allow for deleting tickets that have no tickets sold, in which case we want to get rid of permanently because there is no need to save in db.
1130
-		$old_tickets = isset( $old_tickets[0] ) && $old_tickets[0] == '' ? array() : $old_tickets;
1131
-		$tickets_removed = array_diff( $old_tickets, array_keys( $saved_tickets ) );
1130
+		$old_tickets = isset($old_tickets[0]) && $old_tickets[0] == '' ? array() : $old_tickets;
1131
+		$tickets_removed = array_diff($old_tickets, array_keys($saved_tickets));
1132 1132
 
1133
-		foreach ( $tickets_removed as $id ) {
1134
-			$id = absint( $id );
1133
+		foreach ($tickets_removed as $id) {
1134
+			$id = absint($id);
1135 1135
 
1136 1136
 			//get the ticket for this id
1137 1137
 			$tkt_to_remove = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($id);
@@ -1139,7 +1139,7 @@  discard block
 block discarded – undo
1139 1139
 			//need to get all the related datetimes on this ticket and remove from every single one of them (remember this process can ONLY kick off if there are NO tkts_sold)
1140 1140
 			$dtts = $tkt_to_remove->get_many_related('Datetime');
1141 1141
 
1142
-			foreach( $dtts as $dtt ) {
1142
+			foreach ($dtts as $dtt) {
1143 1143
 				$tkt_to_remove->_remove_relation_to($dtt, 'Datetime');
1144 1144
 			}
1145 1145
 
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 			//finally let's delete this ticket (which should not be blocked at this point b/c we've removed all our relationships)
1151 1151
 			$tkt_to_remove->delete_permanently();
1152 1152
 		}
1153
-		return array( $saved_dtt, $saved_tickets );
1153
+		return array($saved_dtt, $saved_tickets);
1154 1154
 	}
1155 1155
 
1156 1156
 
@@ -1165,31 +1165,31 @@  discard block
 block discarded – undo
1165 1165
 	 * @param bool 		$new_prices Whether attach existing incoming prices or create new ones.
1166 1166
 	 * @return  void
1167 1167
 	 */
1168
-	private function  _add_prices_to_ticket( $prices, EE_Ticket $ticket, $new_prices = FALSE ) {
1169
-		foreach ( $prices as $row => $prc ) {
1168
+	private function  _add_prices_to_ticket($prices, EE_Ticket $ticket, $new_prices = FALSE) {
1169
+		foreach ($prices as $row => $prc) {
1170 1170
 			$PRC_values = array(
1171
-				'PRC_ID' => !empty( $prc['PRC_ID'] ) ? $prc['PRC_ID'] : NULL,
1172
-				'PRT_ID' => !empty( $prc['PRT_ID'] ) ? $prc['PRT_ID'] : NULL,
1173
-				'PRC_amount' => !empty( $prc['PRC_amount'] ) ? $prc['PRC_amount'] : 0,
1174
-				'PRC_name' => !empty( $prc['PRC_name'] ) ? $prc['PRC_name'] : '',
1175
-				'PRC_desc' => !empty( $prc['PRC_desc'] ) ? $prc['PRC_desc'] : '',
1171
+				'PRC_ID' => ! empty($prc['PRC_ID']) ? $prc['PRC_ID'] : NULL,
1172
+				'PRT_ID' => ! empty($prc['PRT_ID']) ? $prc['PRT_ID'] : NULL,
1173
+				'PRC_amount' => ! empty($prc['PRC_amount']) ? $prc['PRC_amount'] : 0,
1174
+				'PRC_name' => ! empty($prc['PRC_name']) ? $prc['PRC_name'] : '',
1175
+				'PRC_desc' => ! empty($prc['PRC_desc']) ? $prc['PRC_desc'] : '',
1176 1176
 				'PRC_is_default' => 0, //make sure prices are NOT set as default from this context
1177 1177
 				'PRC_order' => $row
1178 1178
 			);
1179 1179
 
1180
-			if ( $new_prices || empty( $PRC_values['PRC_ID'] ) ) {
1180
+			if ($new_prices || empty($PRC_values['PRC_ID'])) {
1181 1181
 				$PRC_values['PRC_ID'] = 0;
1182
-				$PRC = EE_Registry::instance()->load_class('Price', array( $PRC_values ), FALSE, FALSE);
1182
+				$PRC = EE_Registry::instance()->load_class('Price', array($PRC_values), FALSE, FALSE);
1183 1183
 			} else {
1184
-				$PRC = EE_Registry::instance()->load_model( 'Price' )->get_one_by_ID( $prc['PRC_ID'] );
1184
+				$PRC = EE_Registry::instance()->load_model('Price')->get_one_by_ID($prc['PRC_ID']);
1185 1185
 				//update this price with new values
1186
-				foreach ( $PRC_values as $field => $newprc ) {
1187
-					$PRC->set( $field, $newprc );
1186
+				foreach ($PRC_values as $field => $newprc) {
1187
+					$PRC->set($field, $newprc);
1188 1188
 				}
1189 1189
 				$PRC->save();
1190 1190
 			}
1191 1191
 
1192
-			$ticket->_add_relation_to( $PRC, 'Price' );
1192
+			$ticket->_add_relation_to($PRC, 'Price');
1193 1193
 		}
1194 1194
 	}
1195 1195
 
@@ -1212,33 +1212,33 @@  discard block
 block discarded – undo
1212 1212
 
1213 1213
 		return; //TEMPORARILY EXITING CAUSE THIS IS A TODO
1214 1214
 
1215
-		$postid = isset( $this->_req_data['post_ID'] ) ? $this->_req_data['post_ID'] : NULL;
1215
+		$postid = isset($this->_req_data['post_ID']) ? $this->_req_data['post_ID'] : NULL;
1216 1216
 
1217 1217
 
1218 1218
 		//if no postid then get out cause we need it for stuff in here
1219
-		if ( empty( $postid ) ) return;
1219
+		if (empty($postid)) return;
1220 1220
 
1221 1221
 
1222 1222
 		//handle datetime saves
1223 1223
 		$items = array();
1224 1224
 
1225
-		$get_one_where = array( $this->_event_model()->primary_key_name() => $postid );
1226
-		$event = $this->_event_model()->get_one( array($get_one_where) );
1225
+		$get_one_where = array($this->_event_model()->primary_key_name() => $postid);
1226
+		$event = $this->_event_model()->get_one(array($get_one_where));
1227 1227
 
1228 1228
 		//now let's get the attached datetimes from the most recent autosave
1229 1229
 		$dtts = $event->get_many_related('Datetime');
1230 1230
 
1231 1231
 		$dtt_ids = array();
1232
-		foreach( $dtts as $dtt ) {
1232
+		foreach ($dtts as $dtt) {
1233 1233
 			$dtt_ids[] = $dtt->ID();
1234 1234
 			$order = $dtt->order();
1235 1235
 			$this->_template_args['data']['items']['ID-'.$order] = $dtt->ID();
1236 1236
 		}
1237
-		$this->_template_args['data']['items']['datetime_IDS'] = serialize( $dtt_ids );
1237
+		$this->_template_args['data']['items']['datetime_IDS'] = serialize($dtt_ids);
1238 1238
 
1239 1239
 		//handle DECAF venues
1240 1240
 		//we need to make sure that the venue_id gets updated in the form so that future autosaves will properly conntect that venue to the event.
1241
-		if ( $do_venue_autosaves = apply_filters( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE ) ) {
1241
+		if ($do_venue_autosaves = apply_filters('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', TRUE)) {
1242 1242
 			$venue = $event->get_first_related('Venue');
1243 1243
 			$this->_template_args['data']['items']['venue-id'] = $venue->ID();
1244 1244
 		}
@@ -1249,23 +1249,23 @@  discard block
 block discarded – undo
1249 1249
 
1250 1250
 		$ticket_ids = array();
1251 1251
 		$price_ids = array();
1252
-		foreach ( $tickets as $ticket ) {
1252
+		foreach ($tickets as $ticket) {
1253 1253
 			$ticket_ids[] = $price->ID();
1254 1254
 			$ticket_order = $price->get('TKT_order');
1255
-			$this->_template_args['data']['items']['edit-ticket-id-' . $ticket_order] = $ticket->ID();
1256
-			$this->_template_args['data']['items']['edit-ticket-event-id-' . $order] = $event->ID();
1255
+			$this->_template_args['data']['items']['edit-ticket-id-'.$ticket_order] = $ticket->ID();
1256
+			$this->_template_args['data']['items']['edit-ticket-event-id-'.$order] = $event->ID();
1257 1257
 
1258 1258
 			//now we have to make sure the prices are updated appropriately
1259 1259
 			$prices = $ticket->get_many_related('Prices');
1260 1260
 
1261
-			foreach ( $prices as $price ) {
1261
+			foreach ($prices as $price) {
1262 1262
 				$price_ids[] = $price->ID();
1263 1263
 				$price_order = $price->get('PRC_order');
1264
-				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-' . $ticket_order . '-' . $price_order] = $price->ID();
1265
-				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-' . $ticket_row . '-' . $price_row] = $price->ID();
1266
-				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-' . $ticket_row . '-' . $price_row] = $price->get('PRC_is_default');
1264
+				$this->_template_args['data']['items']['quick-edit-ticket-price-id-ticketrow-'.$ticket_order.'-'.$price_order] = $price->ID();
1265
+				$this->_template_args['data']['items']['edit-ticket-price-id-ticketrow-'.$ticket_row.'-'.$price_row] = $price->ID();
1266
+				$this->_template_args['data']['items']['edit-ticket-price-is-default-ticketrow-'.$ticket_row.'-'.$price_row] = $price->get('PRC_is_default');
1267 1267
 			}
1268
-			$this->_template_args['data']['items']['price-IDs-ticketrow-' . $ticket_row] = implode(',', $price_ids);
1268
+			$this->_template_args['data']['items']['price-IDs-ticketrow-'.$ticket_row] = implode(',', $price_ids);
1269 1269
 		}
1270 1270
 		$this->_template_args['data']['items']['ticket-IDs'] = implode(',', $ticket_ids);
1271 1271
 	}
@@ -1285,9 +1285,9 @@  discard block
 block discarded – undo
1285 1285
 		//load formatter helper
1286 1286
 
1287 1287
   		//args for getting related registrations
1288
-  		$approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved ) );
1289
-  		$not_approved_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved ) );
1290
-  		$pending_payment_query_args = array( array( 'REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment ) );
1288
+  		$approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_approved));
1289
+  		$not_approved_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_not_approved));
1290
+  		$pending_payment_query_args = array(array('REG_deleted' => 0, 'STS_ID' => EEM_Registration::status_id_pending_payment));
1291 1291
 
1292 1292
 
1293 1293
 		// publish box
@@ -1316,9 +1316,9 @@  discard block
 block discarded – undo
1316 1316
 				),
1317 1317
 				REG_ADMIN_URL
1318 1318
 			),
1319
-			'approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $approved_query_args ),
1320
-			'not_approved_regs' => $this->_cpt_model_obj->count_related( 'Registration', $not_approved_query_args ),
1321
-			'pending_payment_regs' => $this->_cpt_model_obj->count_related( 'Registration', $pending_payment_query_args ),
1319
+			'approved_regs' => $this->_cpt_model_obj->count_related('Registration', $approved_query_args),
1320
+			'not_approved_regs' => $this->_cpt_model_obj->count_related('Registration', $not_approved_query_args),
1321
+			'pending_payment_regs' => $this->_cpt_model_obj->count_related('Registration', $pending_payment_query_args),
1322 1322
 			'misc_pub_section_class' => apply_filters(
1323 1323
 				'FHEE_Events_Admin_Page___generate_publish_box_extra_content__misc_pub_section_class',
1324 1324
 				'misc-pub-section'
@@ -1337,9 +1337,9 @@  discard block
 block discarded – undo
1337 1337
 			'AHEE__Events_Admin_Page___generate_publish_box_extra_content__event_editor_overview_add',
1338 1338
 			$this->_cpt_model_obj
1339 1339
 		);
1340
-		$publish_box_extra_args[ 'event_editor_overview_add' ] = ob_get_clean();
1340
+		$publish_box_extra_args['event_editor_overview_add'] = ob_get_clean();
1341 1341
 		// load template
1342
-		EEH_Template::display_template( EVENTS_TEMPLATE_PATH . 'event_publish_box_extras.template.php', $publish_box_extra_args );
1342
+		EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_publish_box_extras.template.php', $publish_box_extra_args);
1343 1343
 	}
1344 1344
 
1345 1345
 
@@ -1371,16 +1371,16 @@  discard block
 block discarded – undo
1371 1371
 		$this->verify_cpt_object();
1372 1372
 		add_meta_box(
1373 1373
 			'espresso_event_editor_tickets',
1374
-			__( 'Event Datetime & Ticket', 'event_espresso' ),
1375
-			array( $this, 'ticket_metabox' ),
1374
+			__('Event Datetime & Ticket', 'event_espresso'),
1375
+			array($this, 'ticket_metabox'),
1376 1376
 			$this->page_slug,
1377 1377
 			'normal',
1378 1378
 			'high'
1379 1379
 		);
1380 1380
 		add_meta_box(
1381 1381
 			'espresso_event_editor_event_options',
1382
-			__( 'Event Registration Options', 'event_espresso' ),
1383
-			array( $this, 'registration_options_meta_box' ),
1382
+			__('Event Registration Options', 'event_espresso'),
1383
+			array($this, 'registration_options_meta_box'),
1384 1384
 			$this->page_slug,
1385 1385
 			'side',
1386 1386
 			'default'
@@ -1410,36 +1410,36 @@  discard block
 block discarded – undo
1410 1410
 			'disabled' => ''
1411 1411
 			);
1412 1412
 
1413
-		$event_id = is_object( $this->_cpt_model_obj ) ? $this->_cpt_model_obj->ID() : NULL;
1413
+		$event_id = is_object($this->_cpt_model_obj) ? $this->_cpt_model_obj->ID() : NULL;
1414 1414
 
1415
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1415
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1416 1416
 
1417 1417
 		/**
1418 1418
 		 * 1. Start with retrieving Datetimes
1419 1419
 		 * 2. Fore each datetime get related tickets
1420 1420
 		 * 3. For each ticket get related prices
1421 1421
 		 */
1422
-		$times = EE_Registry::instance()->load_model('Datetime' )->get_all_event_dates( $event_id );
1422
+		$times = EE_Registry::instance()->load_model('Datetime')->get_all_event_dates($event_id);
1423 1423
 		/** @type EE_Datetime $first_datetime */
1424
-		$first_datetime = reset( $times );
1424
+		$first_datetime = reset($times);
1425 1425
 		//do we get related tickets?
1426
-		if ( $first_datetime instanceof EE_Datetime 
1427
-			&& $first_datetime->ID() !== 0 ) {
1426
+		if ($first_datetime instanceof EE_Datetime 
1427
+			&& $first_datetime->ID() !== 0) {
1428 1428
 			$existing_datetime_ids[] = $first_datetime->get('DTT_ID');
1429 1429
 			$template_args['time'] = $first_datetime;
1430 1430
 			$related_tickets = $first_datetime->tickets(
1431 1431
 				array(
1432
-					array( 'OR' => array( 'TKT_deleted' => 1, 'TKT_deleted*' => 0 ) ),
1432
+					array('OR' => array('TKT_deleted' => 1, 'TKT_deleted*' => 0)),
1433 1433
 					'default_where_conditions' => 'none'
1434 1434
 				)
1435 1435
 			);
1436 1436
 
1437
-			if ( !empty($related_tickets) ) {
1437
+			if ( ! empty($related_tickets)) {
1438 1438
 				$template_args['total_ticket_rows'] = count($related_tickets);
1439 1439
 				$row = 0;
1440
-				foreach ( $related_tickets as $ticket ) {
1440
+				foreach ($related_tickets as $ticket) {
1441 1441
 					$existing_ticket_ids[] = $ticket->get('TKT_ID');
1442
-					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row );
1442
+					$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket, FALSE, $row);
1443 1443
 
1444 1444
 					$row++;
1445 1445
 				}
@@ -1447,13 +1447,13 @@  discard block
 block discarded – undo
1447 1447
 				$template_args['total_ticket_rows'] = 1;
1448 1448
 				/** @type EE_Ticket $ticket */
1449 1449
 				$ticket = EE_Registry::instance()->load_model('Ticket')->create_default_object();
1450
-				$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket );
1450
+				$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket);
1451 1451
 			}
1452 1452
 		} else {
1453 1453
 			$template_args['time'] = $times[0];
1454 1454
 			/** @type EE_Ticket $ticket */
1455 1455
 			$ticket = EE_Registry::instance()->load_model('Ticket')->get_all_default_tickets();
1456
-			$template_args['ticket_rows'] .= $this->_get_ticket_row( $ticket[1] );
1456
+			$template_args['ticket_rows'] .= $this->_get_ticket_row($ticket[1]);
1457 1457
 			// NOTE: we're just sending the first default row
1458 1458
 			// (decaf can't manage default tickets so this should be sufficient);
1459 1459
 		}
@@ -1462,8 +1462,8 @@  discard block
 block discarded – undo
1462 1462
 		$template_args['ticket_options_help_link'] = $this->_get_help_tab_link('ticket_options_info');
1463 1463
 		$template_args['existing_datetime_ids'] = implode(',', $existing_datetime_ids);
1464 1464
 		$template_args['existing_ticket_ids'] = implode(',', $existing_ticket_ids);
1465
-		$template_args['ticket_js_structure'] = $this->_get_ticket_row( EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE );
1466
-		$template = apply_filters( 'FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_main.template.php' );
1465
+		$template_args['ticket_js_structure'] = $this->_get_ticket_row(EE_Registry::instance()->load_model('Ticket')->create_default_object(), TRUE);
1466
+		$template = apply_filters('FHEE__Events_Admin_Page__ticket_metabox__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_main.template.php');
1467 1467
 		EEH_Template::display_template($template, $template_args);
1468 1468
 	}
1469 1469
 
@@ -1478,21 +1478,21 @@  discard block
 block discarded – undo
1478 1478
 	 * @param int        $row
1479 1479
 	 * @return string generated html for the ticket row.
1480 1480
 	 */
1481
-	private function _get_ticket_row( $ticket, $skeleton = FALSE, $row = 0 ) {
1481
+	private function _get_ticket_row($ticket, $skeleton = FALSE, $row = 0) {
1482 1482
 		$template_args = array(
1483
-			'tkt_status_class' => ' tkt-status-' . $ticket->ticket_status(),
1484
-			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && !$skeleton ? ' tkt-archived' : '',
1483
+			'tkt_status_class' => ' tkt-status-'.$ticket->ticket_status(),
1484
+			'tkt_archive_class' => $ticket->ticket_status() === EE_Ticket::archived && ! $skeleton ? ' tkt-archived' : '',
1485 1485
 			'ticketrow' => $skeleton ? 'TICKETNUM' : $row,
1486 1486
 			'TKT_ID' => $ticket->get('TKT_ID'),
1487 1487
 			'TKT_name' => $ticket->get('TKT_name'),
1488 1488
 			'TKT_start_date' => $skeleton ? '' : $ticket->get_date('TKT_start_date', 'Y-m-d h:i a'),
1489 1489
 			'TKT_end_date' => $skeleton ? '' : $ticket->get_date('TKT_end_date', 'Y-m-d h:i a'),
1490 1490
 			'TKT_is_default' => $ticket->get('TKT_is_default'),
1491
-			'TKT_qty' => $ticket->get_pretty('TKT_qty','input'),
1491
+			'TKT_qty' => $ticket->get_pretty('TKT_qty', 'input'),
1492 1492
 			'edit_ticketrow_name' => $skeleton ? 'TICKETNAMEATTR' : 'edit_tickets',
1493 1493
 			'TKT_sold' => $skeleton ? 0 : $ticket->get('TKT_sold'),
1494
-			'trash_icon' => ( $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted') ) ) && ( !empty( $ticket ) && $ticket->get('TKT_sold') === 0 ) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1495
-			'disabled' => $skeleton || ( !empty( $ticket ) && ! $ticket->get('TKT_deleted' ) ) ? '' : ' disabled=disabled'
1494
+			'trash_icon' => ($skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted'))) && ( ! empty($ticket) && $ticket->get('TKT_sold') === 0) ? 'trash-icon dashicons dashicons-post-trash clickable' : 'ee-lock-icon',
1495
+			'disabled' => $skeleton || ( ! empty($ticket) && ! $ticket->get('TKT_deleted')) ? '' : ' disabled=disabled'
1496 1496
 			);
1497 1497
 
1498 1498
 		$price = $ticket->ID() !== 0 ? $ticket->get_first_related('Price', array('default_where_conditions' => 'none')) : EE_Registry::instance()->load_model('Price')->create_default_object();
@@ -1508,23 +1508,23 @@  discard block
 block discarded – undo
1508 1508
 
1509 1509
 		//make sure we have default start and end dates if skeleton
1510 1510
 		//handle rows that should NOT be empty
1511
-		if ( empty( $template_args['TKT_start_date'] ) ) {
1511
+		if (empty($template_args['TKT_start_date'])) {
1512 1512
 			//if empty then the start date will be now.
1513 1513
 			$template_args['TKT_start_date'] = date('Y-m-d h:i a', current_time('timestamp'));
1514 1514
 		}
1515 1515
 
1516
-		if ( empty( $template_args['TKT_end_date'] ) ) {
1516
+		if (empty($template_args['TKT_end_date'])) {
1517 1517
 			//get the earliest datetime (if present);
1518
-			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC' ) ) ) : NULL;
1518
+			$earliest_dtt = $this->_cpt_model_obj->ID() > 0 ? $this->_cpt_model_obj->get_first_related('Datetime', array('order_by'=> array('DTT_EVT_start' => 'ASC'))) : NULL;
1519 1519
 
1520
-			if ( !empty( $earliest_dtt ) )
1520
+			if ( ! empty($earliest_dtt))
1521 1521
 				$template_args['TKT_end_date'] = $earliest_dtt->get_datetime('DTT_EVT_start', 'Y-m-d', 'h:i a');
1522 1522
 			else
1523
-				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d")+7, date("Y") ) );
1523
+				$template_args['TKT_end_date'] = date('Y-m-d h:i a', mktime(0, 0, 0, date("m"), date("d") + 7, date("Y")));
1524 1524
 		}
1525 1525
 
1526
-		$template_args = array_merge( $template_args, $price_args );
1527
-		$template = apply_filters( 'FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH . 'event_tickets_metabox_ticket_row.template.php', $ticket);
1526
+		$template_args = array_merge($template_args, $price_args);
1527
+		$template = apply_filters('FHEE__Events_Admin_Page__get_ticket_row__template', EVENTS_TEMPLATE_PATH.'event_tickets_metabox_ticket_row.template.php', $ticket);
1528 1528
 		return EEH_Template::display_template($template, $template_args, TRUE);
1529 1529
 	}
1530 1530
 
@@ -1553,8 +1553,8 @@  discard block
 block discarded – undo
1553 1553
 		$template_args['default_registration_status'] = EEH_Form_Fields::select_input('default_reg_status', $default_reg_status_values, $this->_cpt_model_obj->default_registration_status());
1554 1554
 		$template_args['display_description'] = EEH_Form_Fields::select_input('display_desc', $yes_no_values, $this->_cpt_model_obj->display_description());
1555 1555
 		$template_args['display_ticket_selector'] = EEH_Form_Fields::select_input('display_ticket_selector', $yes_no_values, $this->_cpt_model_obj->display_ticket_selector(), '', '', false);
1556
-		$template_args['additional_registration_options'] = apply_filters( 'FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values );
1557
-		$templatepath = EVENTS_TEMPLATE_PATH . 'event_registration_options.template.php';
1556
+		$template_args['additional_registration_options'] = apply_filters('FHEE__Events_Admin_Page__registration_options_meta_box__additional_registration_options', '', $template_args, $yes_no_values, $default_reg_status_values);
1557
+		$templatepath = EVENTS_TEMPLATE_PATH.'event_registration_options.template.php';
1558 1558
 		EEH_Template::display_template($templatepath, $template_args);
1559 1559
 	}
1560 1560
 
@@ -1582,21 +1582,21 @@  discard block
 block discarded – undo
1582 1582
 		$EEME = $this->_event_model();
1583 1583
 
1584 1584
 		$offset = ($current_page - 1) * $per_page;
1585
-		$limit = $count ? NULL : $offset . ',' . $per_page;
1585
+		$limit = $count ? NULL : $offset.','.$per_page;
1586 1586
 		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'EVT_ID';
1587 1587
 		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : "DESC";
1588 1588
 
1589 1589
 		if (isset($this->_req_data['month_range'])) {
1590 1590
 			$pieces = explode(' ', $this->_req_data['month_range'], 3);
1591
-			$month_r = !empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1592
-			$year_r = !empty($pieces[1]) ? $pieces[1] : '';
1591
+			$month_r = ! empty($pieces[0]) ? date('m', strtotime($pieces[0])) : '';
1592
+			$year_r = ! empty($pieces[1]) ? $pieces[1] : '';
1593 1593
 		}
1594 1594
 
1595 1595
 		$where = array();
1596 1596
 
1597
-		$status = isset( $this->_req_data['status'] ) ? $this->_req_data['status'] : NULL;
1597
+		$status = isset($this->_req_data['status']) ? $this->_req_data['status'] : NULL;
1598 1598
 		//determine what post_status our condition will have for the query.
1599
-		switch ( $status ) {
1599
+		switch ($status) {
1600 1600
 			case 'month' :
1601 1601
 			case 'today' :
1602 1602
 			case NULL :
@@ -1604,7 +1604,7 @@  discard block
 block discarded – undo
1604 1604
 				break;
1605 1605
 
1606 1606
 			case 'draft' :
1607
-				$where['status'] = array( 'IN', array('draft', 'auto-draft') );
1607
+				$where['status'] = array('IN', array('draft', 'auto-draft'));
1608 1608
 				break;
1609 1609
 
1610 1610
 			default :
@@ -1612,43 +1612,43 @@  discard block
 block discarded – undo
1612 1612
 		}
1613 1613
 
1614 1614
 		//categories?
1615
-		$category = isset( $this->_req_data['EVT_CAT'] ) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1615
+		$category = isset($this->_req_data['EVT_CAT']) && $this->_req_data['EVT_CAT'] > 0 ? $this->_req_data['EVT_CAT'] : NULL;
1616 1616
 
1617
-		if ( !empty ( $category ) ) {
1617
+		if ( ! empty ($category)) {
1618 1618
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
1619 1619
 			$where['Term_Taxonomy.term_id'] = $category;
1620 1620
 		}
1621 1621
 
1622 1622
 		//date where conditions
1623
-		$start_formats = EEM_Datetime::instance()->get_formats_for( 'DTT_EVT_start' );
1623
+		$start_formats = EEM_Datetime::instance()->get_formats_for('DTT_EVT_start');
1624 1624
 		if (isset($this->_req_data['month_range']) && $this->_req_data['month_range'] != '') {
1625
-			$DateTime = new DateTime( $year_r . '-' . $month_r . '-01 00:00:00', new DateTimeZone( EEM_Datetime::instance()->get_timezone() ) );
1626
-			$start = $DateTime->format( implode( ' ', $start_formats  ) );
1627
-			$end = $DateTime->setDate( $year_r, $month_r, $DateTime->format('t') )->setTime(23,59,59)->format( implode( ' ', $start_formats ) );
1628
-			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array( $start, $end ) );
1625
+			$DateTime = new DateTime($year_r.'-'.$month_r.'-01 00:00:00', new DateTimeZone(EEM_Datetime::instance()->get_timezone()));
1626
+			$start = $DateTime->format(implode(' ', $start_formats));
1627
+			$end = $DateTime->setDate($year_r, $month_r, $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1628
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1629 1629
 		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'today') {
1630
-			$DateTime = new DateTime( 'now', new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1631
-			$start = $DateTime->setTime( 0,0,0 )->format( implode( ' ', $start_formats ) );
1632
-			$end = $DateTime->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1633
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1634
-		} else if ( isset($this->_req_data['status']) && $this->_req_data['status'] == 'month' ) {
1635
-			$now = date( 'Y-m-01' );
1636
-			$DateTime = new DateTime( $now, new DateTimeZone( EEM_Event::instance()->get_timezone() ) );
1637
-			$start = $DateTime->setTime( 0, 0, 0 )->format( implode( ' ', $start_formats ) );
1638
-			$end = $DateTime->setDate( date('Y'), date('m'), $DateTime->format('t' ) )->setTime( 23, 59, 59 )->format( implode( ' ', $start_formats ) );
1639
-			$where['Datetime.DTT_EVT_start'] = array( 'BETWEEN', array( $start, $end ) );
1630
+			$DateTime = new DateTime('now', new DateTimeZone(EEM_Event::instance()->get_timezone()));
1631
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1632
+			$end = $DateTime->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1633
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1634
+		} else if (isset($this->_req_data['status']) && $this->_req_data['status'] == 'month') {
1635
+			$now = date('Y-m-01');
1636
+			$DateTime = new DateTime($now, new DateTimeZone(EEM_Event::instance()->get_timezone()));
1637
+			$start = $DateTime->setTime(0, 0, 0)->format(implode(' ', $start_formats));
1638
+			$end = $DateTime->setDate(date('Y'), date('m'), $DateTime->format('t'))->setTime(23, 59, 59)->format(implode(' ', $start_formats));
1639
+			$where['Datetime.DTT_EVT_start'] = array('BETWEEN', array($start, $end));
1640 1640
 		}
1641 1641
 
1642 1642
 
1643
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1644
-			$where['EVT_wp_user'] =  get_current_user_id();
1643
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1644
+			$where['EVT_wp_user'] = get_current_user_id();
1645 1645
 		} else {
1646
-			if ( ! isset( $where['status'] ) ) {
1647
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events' ) ) {
1646
+			if ( ! isset($where['status'])) {
1647
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
1648 1648
 					$where['OR'] = array(
1649
-						'status*restrict_private' => array( '!=', 'private' ),
1649
+						'status*restrict_private' => array('!=', 'private'),
1650 1650
 						'AND' => array(
1651
-							'status*inclusive' => array( '=', 'private' ),
1651
+							'status*inclusive' => array('=', 'private'),
1652 1652
 							'EVT_wp_user' => get_current_user_id()
1653 1653
 						)
1654 1654
 					);
@@ -1656,16 +1656,16 @@  discard block
 block discarded – undo
1656 1656
 			}
1657 1657
 		}
1658 1658
 
1659
-		if ( isset( $this->_req_data['EVT_wp_user'] ) ) {
1660
-			if ( $this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
1659
+		if (isset($this->_req_data['EVT_wp_user'])) {
1660
+			if ($this->_req_data['EVT_wp_user'] != get_current_user_id() && EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
1661 1661
 				$where['EVT_wp_user'] = $this->_req_data['EVT_wp_user'];
1662 1662
 			}
1663 1663
 		}
1664 1664
 
1665 1665
 
1666 1666
 		//search query handling
1667
-		if ( isset( $this->_req_data['s'] ) ) {
1668
-			$search_string = '%' . $this->_req_data['s'] . '%';
1667
+		if (isset($this->_req_data['s'])) {
1668
+			$search_string = '%'.$this->_req_data['s'].'%';
1669 1669
 			$where['OR'] = array(
1670 1670
 				'EVT_name' => array('LIKE', $search_string),
1671 1671
 				'EVT_desc' => array('LIKE', $search_string),
@@ -1674,32 +1674,32 @@  discard block
 block discarded – undo
1674 1674
 		}
1675 1675
 
1676 1676
 
1677
-		$where = apply_filters( 'FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data );
1678
-		$query_params = apply_filters( 'FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID' ), $this->_req_data );
1677
+		$where = apply_filters('FHEE__Events_Admin_Page__get_events__where', $where, $this->_req_data);
1678
+		$query_params = apply_filters('FHEE__Events_Admin_Page__get_events__query_params', array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $order, 'group_by' => 'EVT_ID'), $this->_req_data);
1679 1679
 
1680 1680
 
1681 1681
 		//let's first check if we have special requests coming in.
1682
-		if ( isset( $this->_req_data['active_status'] ) ) {
1683
-			switch ( $this->_req_data['active_status'] ) {
1682
+		if (isset($this->_req_data['active_status'])) {
1683
+			switch ($this->_req_data['active_status']) {
1684 1684
 				case 'upcoming' :
1685
-					return $EEME->get_upcoming_events( $query_params, $count );
1685
+					return $EEME->get_upcoming_events($query_params, $count);
1686 1686
 					break;
1687 1687
 
1688 1688
 				case 'expired' :
1689
-					return $EEME->get_expired_events( $query_params, $count );
1689
+					return $EEME->get_expired_events($query_params, $count);
1690 1690
 					break;
1691 1691
 
1692 1692
 				case 'active' :
1693
-					return $EEME->get_active_events( $query_params, $count );
1693
+					return $EEME->get_active_events($query_params, $count);
1694 1694
 					break;
1695 1695
 
1696 1696
 				case 'inactive' :
1697
-					return $EEME->get_inactive_events( $query_params, $count );
1697
+					return $EEME->get_inactive_events($query_params, $count);
1698 1698
 					break;
1699 1699
 			}
1700 1700
 		}
1701 1701
 
1702
-		$events = $count ? $EEME->count( array( $where ), 'EVT_ID', true ) : $EEME->get_all( $query_params );
1702
+		$events = $count ? $EEME->count(array($where), 'EVT_ID', true) : $EEME->get_all($query_params);
1703 1703
 
1704 1704
 		return $events;
1705 1705
 	}
@@ -1708,23 +1708,23 @@  discard block
 block discarded – undo
1708 1708
 
1709 1709
 
1710 1710
 	//handling for WordPress CPT actions (trash, restore, delete)
1711
-	public function trash_cpt_item( $post_id ) {
1711
+	public function trash_cpt_item($post_id) {
1712 1712
 		$this->_req_data['EVT_ID'] = $post_id;
1713
-		$this->_trash_or_restore_event( 'trash', FALSE );
1713
+		$this->_trash_or_restore_event('trash', FALSE);
1714 1714
 	}
1715 1715
 
1716 1716
 
1717 1717
 
1718 1718
 
1719
-	public function restore_cpt_item( $post_id ) {
1719
+	public function restore_cpt_item($post_id) {
1720 1720
 		$this->_req_data['EVT_ID'] = $post_id;
1721
-		$this->_trash_or_restore_event( 'draft', FALSE );
1721
+		$this->_trash_or_restore_event('draft', FALSE);
1722 1722
 	}
1723 1723
 
1724 1724
 
1725
-	public function delete_cpt_item( $post_id ) {
1725
+	public function delete_cpt_item($post_id) {
1726 1726
 		$this->_req_data['EVT_ID'] = $post_id;
1727
-		$this->_delete_event( FALSE );
1727
+		$this->_delete_event(FALSE);
1728 1728
 	}
1729 1729
 
1730 1730
 
@@ -1736,7 +1736,7 @@  discard block
 block discarded – undo
1736 1736
 	 * @param  string $event_status
1737 1737
 	 * @return void
1738 1738
 	 */
1739
-	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE ) {
1739
+	protected function _trash_or_restore_event($event_status = 'trash', $redirect_after = TRUE) {
1740 1740
 		//determine the event id and set to array.
1741 1741
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : FALSE;
1742 1742
 		// loop thru events
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 			// clean status
1745 1745
 			$event_status = sanitize_key($event_status);
1746 1746
 			// grab status
1747
-			if (!empty($event_status)) {
1747
+			if ( ! empty($event_status)) {
1748 1748
 				$success = $this->_change_event_status($EVT_ID, $event_status);
1749 1749
 			} else {
1750 1750
 				$success = FALSE;
@@ -1758,7 +1758,7 @@  discard block
 block discarded – undo
1758 1758
 		}
1759 1759
 		$action = $event_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
1760 1760
 
1761
-		if ( $redirect_after )
1761
+		if ($redirect_after)
1762 1762
 			$this->_redirect_after_action($success, 'Event', $action, array('action' => 'default'));
1763 1763
 	}
1764 1764
 
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 		// clean status
1774 1774
 		$event_status = sanitize_key($event_status);
1775 1775
 		// grab status
1776
-		if (!empty($event_status)) {
1776
+		if ( ! empty($event_status)) {
1777 1777
 			$success = TRUE;
1778 1778
 			//determine the event id and set to array.
1779 1779
 			$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
@@ -1808,15 +1808,15 @@  discard block
 block discarded – undo
1808 1808
 	 * @param  string $event_status
1809 1809
 	 * @return bool
1810 1810
 	 */
1811
-	private function _change_event_status( $EVT_ID = 0, $event_status = '') {
1811
+	private function _change_event_status($EVT_ID = 0, $event_status = '') {
1812 1812
 		// grab event id
1813
-		if (!$EVT_ID) {
1813
+		if ( ! $EVT_ID) {
1814 1814
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1815 1815
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1816 1816
 			return FALSE;
1817 1817
 		}
1818 1818
 
1819
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1819
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1820 1820
 
1821 1821
 		// clean status
1822 1822
 		$event_status = sanitize_key($event_status);
@@ -1842,7 +1842,7 @@  discard block
 block discarded – undo
1842 1842
 				$hook = FALSE;
1843 1843
 		}
1844 1844
 		//use class to change status
1845
-		$this->_cpt_model_obj->set_status( $event_status );
1845
+		$this->_cpt_model_obj->set_status($event_status);
1846 1846
 		$success = $this->_cpt_model_obj->save();
1847 1847
 
1848 1848
 		if ($success === FALSE) {
@@ -1864,15 +1864,15 @@  discard block
 block discarded – undo
1864 1864
 	 * @access protected
1865 1865
 	 * @param bool $redirect_after
1866 1866
 	 */
1867
-	protected function _delete_event( $redirect_after = TRUE ) {
1867
+	protected function _delete_event($redirect_after = TRUE) {
1868 1868
 		//determine the event id and set to array.
1869 1869
 		$EVT_ID = isset($this->_req_data['EVT_ID']) ? absint($this->_req_data['EVT_ID']) : NULL;
1870
-		$EVT_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $EVT_ID;
1870
+		$EVT_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $EVT_ID;
1871 1871
 
1872 1872
 
1873 1873
 		// loop thru events
1874 1874
 		if ($EVT_ID) {
1875
-			$success = $this->_permanently_delete_event( $EVT_ID );
1875
+			$success = $this->_permanently_delete_event($EVT_ID);
1876 1876
 			// get list of events with no prices
1877 1877
 			$espresso_no_ticket_prices = get_option('ee_no_ticket_prices', array());
1878 1878
 			// remove this event from the list of events with no prices
@@ -1886,7 +1886,7 @@  discard block
 block discarded – undo
1886 1886
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1887 1887
 		}
1888 1888
 
1889
-		if ( $redirect_after )
1889
+		if ($redirect_after)
1890 1890
 			$this->_redirect_after_action($success, 'Event', 'deleted', array('action' => 'default', 'status' => 'trash'));
1891 1891
 	}
1892 1892
 
@@ -1904,12 +1904,12 @@  discard block
 block discarded – undo
1904 1904
 		$EVT_IDs = isset($this->_req_data['EVT_IDs']) ? (array) $this->_req_data['EVT_IDs'] : array();
1905 1905
 		// loop thru events
1906 1906
 		foreach ($EVT_IDs as $EVT_ID) {
1907
-			$EVT_ID = absint( $EVT_ID );
1908
-			if ( $EVT_ID ) {
1909
-				$results = $this->_permanently_delete_event( $EVT_ID );
1907
+			$EVT_ID = absint($EVT_ID);
1908
+			if ($EVT_ID) {
1909
+				$results = $this->_permanently_delete_event($EVT_ID);
1910 1910
 				$success = $results !== FALSE ? $success : FALSE;
1911 1911
 				// remove this event from the list of events with no prices
1912
-				unset( $espresso_no_ticket_prices[ $EVT_ID ] );
1912
+				unset($espresso_no_ticket_prices[$EVT_ID]);
1913 1913
 			} else {
1914 1914
 				$success = FALSE;
1915 1915
 				$msg = __('An error occurred. An event could not be deleted because a valid event ID was not not supplied.', 'event_espresso');
@@ -1929,21 +1929,21 @@  discard block
 block discarded – undo
1929 1929
 	 * @param  int $EVT_ID
1930 1930
 	 * @return bool
1931 1931
 	 */
1932
-	private function _permanently_delete_event( $EVT_ID = 0 ) {
1932
+	private function _permanently_delete_event($EVT_ID = 0) {
1933 1933
 		// grab event id
1934
-		if ( ! $EVT_ID ) {
1934
+		if ( ! $EVT_ID) {
1935 1935
 			$msg = __('An error occurred. No Event ID or an invalid Event ID was received.', 'event_espresso');
1936 1936
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1937 1937
 			return FALSE;
1938 1938
 		}
1939
-		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID( $EVT_ID );
1939
+		$this->_cpt_model_obj = EEM_Event::instance()->get_one_by_ID($EVT_ID);
1940 1940
 
1941 1941
 		//need to delete related tickets and prices first.
1942 1942
 		$datetimes = $this->_cpt_model_obj->get_many_related('Datetime');
1943
-		foreach ( $datetimes as $datetime ) {
1943
+		foreach ($datetimes as $datetime) {
1944 1944
 			$this->_cpt_model_obj->_remove_relation_to($datetime, 'Datetime');
1945 1945
 			$tickets = $datetime->get_many_related('Ticket');
1946
-			foreach ( $tickets as $ticket ) {
1946
+			foreach ($tickets as $ticket) {
1947 1947
 				$ticket->_remove_relation_to($datetime, 'Datetime');
1948 1948
 				$ticket->delete_related_permanently('Price');
1949 1949
 				$ticket->delete_permanently();
@@ -1953,14 +1953,14 @@  discard block
 block discarded – undo
1953 1953
 
1954 1954
 		//what about related venues or terms?
1955 1955
 		$venues = $this->_cpt_model_obj->get_many_related('Venue');
1956
-		foreach ( $venues as $venue ) {
1956
+		foreach ($venues as $venue) {
1957 1957
 			$this->_cpt_model_obj->_remove_relation_to($venue, 'Venue');
1958 1958
 		}
1959 1959
 
1960 1960
 		//any attached question groups?
1961 1961
 		$question_groups = $this->_cpt_model_obj->get_many_related('Question_Group');
1962
-		if ( !empty( $question_groups ) ) {
1963
-			foreach ( $question_groups as $question_group ) {
1962
+		if ( ! empty($question_groups)) {
1963
+			foreach ($question_groups as $question_group) {
1964 1964
 				$this->_cpt_model_obj->_remove_relation_to($question_group, 'Question_Group');
1965 1965
 			}
1966 1966
 		}
@@ -1969,12 +1969,12 @@  discard block
 block discarded – undo
1969 1969
 
1970 1970
 
1971 1971
 		//Message Template Groups
1972
-		$this->_cpt_model_obj->_remove_relations( 'Message_Template_Group' );
1972
+		$this->_cpt_model_obj->_remove_relations('Message_Template_Group');
1973 1973
 
1974 1974
 		/** @type EE_Term_Taxonomy[] $term_taxonomies */
1975 1975
 		$term_taxonomies = $this->_cpt_model_obj->term_taxonomies();
1976 1976
 
1977
-		foreach ( $term_taxonomies as $term_taxonomy ) {
1977
+		foreach ($term_taxonomies as $term_taxonomy) {
1978 1978
 			$this->_cpt_model_obj->remove_relation_to_term_taxonomy($term_taxonomy);
1979 1979
 		}
1980 1980
 
@@ -1988,7 +1988,7 @@  discard block
 block discarded – undo
1988 1988
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1989 1989
 			return FALSE;
1990 1990
 		}
1991
-		do_action( 'AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID );
1991
+		do_action('AHEE__Events_Admin_Page___permanently_delete_event__after_event_deleted', $EVT_ID);
1992 1992
 		return TRUE;
1993 1993
 	}
1994 1994
 
@@ -2005,7 +2005,7 @@  discard block
 block discarded – undo
2005 2005
 	 */
2006 2006
 	public function total_events() {
2007 2007
 
2008
-		$count = EEM_Event::instance()->count( array( 'caps' => 'read_admin' ), 'EVT_ID', true );
2008
+		$count = EEM_Event::instance()->count(array('caps' => 'read_admin'), 'EVT_ID', true);
2009 2009
 		return $count;
2010 2010
 	}
2011 2011
 
@@ -2020,10 +2020,10 @@  discard block
 block discarded – undo
2020 2020
 	 */
2021 2021
 	public function total_events_draft() {
2022 2022
 		$where = array(
2023
-			'status' => array( 'IN', array('draft', 'auto-draft' ) )
2023
+			'status' => array('IN', array('draft', 'auto-draft'))
2024 2024
 			);
2025 2025
 
2026
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2026
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2027 2027
 		return $count;
2028 2028
 	}
2029 2029
 
@@ -2042,7 +2042,7 @@  discard block
 block discarded – undo
2042 2042
 			'status' => 'trash'
2043 2043
 			);
2044 2044
 
2045
-		$count = EEM_Event::instance()->count( array( $where, 'caps' => 'read_admin' ), 'EVT_ID', true );
2045
+		$count = EEM_Event::instance()->count(array($where, 'caps' => 'read_admin'), 'EVT_ID', true);
2046 2046
 		return $count;
2047 2047
 	}
2048 2048
 
@@ -2070,11 +2070,11 @@  discard block
 block discarded – undo
2070 2070
 			// translated
2071 2071
 			TRUE
2072 2072
 		);
2073
-		$this->_template_args['default_reg_status'] = isset( EE_Registry::instance()->CFG->registration->default_STS_ID ) ? sanitize_text_field( EE_Registry::instance()->CFG->registration->default_STS_ID ) : EEM_Registration::status_id_pending_payment;
2073
+		$this->_template_args['default_reg_status'] = isset(EE_Registry::instance()->CFG->registration->default_STS_ID) ? sanitize_text_field(EE_Registry::instance()->CFG->registration->default_STS_ID) : EEM_Registration::status_id_pending_payment;
2074 2074
 
2075 2075
 		$this->_set_add_edit_form_tags('update_default_event_settings');
2076 2076
 		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
2077
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH . 'event_settings.template.php', $this->_template_args, TRUE);
2077
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EVENTS_TEMPLATE_PATH.'event_settings.template.php', $this->_template_args, TRUE);
2078 2078
 		$this->display_admin_page_with_sidebar();
2079 2079
 	}
2080 2080
 
@@ -2100,9 +2100,9 @@  discard block
 block discarded – undo
2100 2100
 
2101 2101
 	protected function _template_settings() {
2102 2102
 		$this->_admin_page_title = __('Template Settings (Preview)', 'event_espresso');
2103
-		$this->_template_args['preview_img'] = '<img src="' . EVENTS_ASSETS_URL . DS . 'images' . DS . 'caffeinated_template_features.jpg" alt="' . esc_attr__( 'Template Settings Preview screenshot', 'event_espresso' ) . '" />';
2104
-		$this->_template_args['preview_text'] = '<strong>'.__( 'Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso' ).'</strong>';
2105
-		$this->display_admin_caf_preview_page( 'template_settings_tab' );
2103
+		$this->_template_args['preview_img'] = '<img src="'.EVENTS_ASSETS_URL.DS.'images'.DS.'caffeinated_template_features.jpg" alt="'.esc_attr__('Template Settings Preview screenshot', 'event_espresso').'" />';
2104
+		$this->_template_args['preview_text'] = '<strong>'.__('Template Settings is a feature that is only available in the Caffeinated version of Event Espresso. Template Settings allow you to configure some of the appearance options for both the Event List and Event Details pages.', 'event_espresso').'</strong>';
2105
+		$this->display_admin_caf_preview_page('template_settings_tab');
2106 2106
 	}
2107 2107
 
2108 2108
 
@@ -2115,22 +2115,22 @@  discard block
 block discarded – undo
2115 2115
 	 * @return void
2116 2116
 	 */
2117 2117
 	private function _set_category_object() {
2118
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
2118
+		if (isset($this->_category->id) && ! empty($this->_category->id))
2119 2119
 			return; //already have the category object so get out.
2120 2120
 
2121 2121
 		//set default category object
2122 2122
 		$this->_set_empty_category_object();
2123 2123
 
2124 2124
 		//only set if we've got an id
2125
-		if ( !isset($this->_req_data['EVT_CAT_ID'] ) ) {
2125
+		if ( ! isset($this->_req_data['EVT_CAT_ID'])) {
2126 2126
 			return;
2127 2127
 		}
2128 2128
 
2129 2129
 		$category_id = absint($this->_req_data['EVT_CAT_ID']);
2130 2130
 
2131
-		$term = get_term( $category_id, 'espresso_event_categories' );
2131
+		$term = get_term($category_id, 'espresso_event_categories');
2132 2132
 
2133
-		if ( !empty( $term ) ) {
2133
+		if ( ! empty($term)) {
2134 2134
 			$this->_category->category_name = $term->name;
2135 2135
 			$this->_category->category_identifier = $term->slug;
2136 2136
 			$this->_category->category_desc = $term->description;
@@ -2144,13 +2144,13 @@  discard block
 block discarded – undo
2144 2144
 
2145 2145
 	private function _set_empty_category_object() {
2146 2146
 		$this->_category = new stdClass();
2147
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
2147
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
2148 2148
 		$this->_category->id = $this->_category->parent = 0;
2149 2149
 	}
2150 2150
 
2151 2151
 
2152 2152
 	protected function _category_list_table() {
2153
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
2153
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
2154 2154
 		$this->_search_btn_label = __('Categories', 'event_espresso');
2155 2155
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
2156 2156
 		$this->display_admin_list_table_page_with_sidebar();
@@ -2166,14 +2166,14 @@  discard block
 block discarded – undo
2166 2166
 		$this->_set_add_edit_form_tags($route);
2167 2167
 
2168 2168
 		$this->_set_category_object();
2169
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
2169
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
2170 2170
 
2171 2171
 		$delete_action = 'delete_category';
2172 2172
 
2173 2173
 		//custom redirect
2174
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'category_list'), $this->_admin_base_url );
2174
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
2175 2175
 
2176
-		$this->_set_publish_post_box_vars( 'EVT_CAT_ID', $id, $delete_action, $redirect );
2176
+		$this->_set_publish_post_box_vars('EVT_CAT_ID', $id, $delete_action, $redirect);
2177 2177
 
2178 2178
 		//take care of contents
2179 2179
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -2187,25 +2187,25 @@  discard block
 block discarded – undo
2187 2187
 			'type' => 'wp_editor',
2188 2188
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
2189 2189
 			'class' => 'my_editor_custom',
2190
-			'wpeditor_args' => array('media_buttons' => FALSE )
2190
+			'wpeditor_args' => array('media_buttons' => FALSE)
2191 2191
 		);
2192
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
2192
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
2193 2193
 
2194
-		$all_terms = get_terms( array('espresso_event_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
2194
+		$all_terms = get_terms(array('espresso_event_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
2195 2195
 
2196 2196
 		//setup category select for term parents.
2197 2197
 		$category_select_values[] = array(
2198 2198
 			'text' => __('No Parent', 'event_espresso'),
2199 2199
 			'id' => 0
2200 2200
 			);
2201
-		foreach ( $all_terms as $term ) {
2201
+		foreach ($all_terms as $term) {
2202 2202
 			$category_select_values[] = array(
2203 2203
 				'text' => $term->name,
2204 2204
 				'id' => $term->term_id
2205 2205
 				);
2206 2206
 		}
2207 2207
 
2208
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
2208
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
2209 2209
 
2210 2210
 		$template_args = array(
2211 2211
 			'category' => $this->_category,
@@ -2215,15 +2215,15 @@  discard block
 block discarded – undo
2215 2215
 			'disable' => '',
2216 2216
 			'disabled_message' => FALSE
2217 2217
 			);
2218
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
2219
-		return EEH_Template::display_template($template, $template_args, TRUE );
2218
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
2219
+		return EEH_Template::display_template($template, $template_args, TRUE);
2220 2220
 	}
2221 2221
 
2222 2222
 
2223 2223
 	protected function _delete_categories() {
2224
-		$cat_ids = isset( $this->_req_data['EVT_CAT_ID'] ) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2224
+		$cat_ids = isset($this->_req_data['EVT_CAT_ID']) ? (array) $this->_req_data['EVT_CAT_ID'] : (array) $this->_req_data['category_id'];
2225 2225
 
2226
-		foreach ( $cat_ids as $cat_id ) {
2226
+		foreach ($cat_ids as $cat_id) {
2227 2227
 			$this->_delete_category($cat_id);
2228 2228
 		}
2229 2229
 
@@ -2231,7 +2231,7 @@  discard block
 block discarded – undo
2231 2231
 		$query_args = array(
2232 2232
 			'action' => 'category_list'
2233 2233
 			);
2234
-		$this->_redirect_after_action(0,'','',$query_args);
2234
+		$this->_redirect_after_action(0, '', '', $query_args);
2235 2235
 
2236 2236
 	}
2237 2237
 
@@ -2241,61 +2241,61 @@  discard block
 block discarded – undo
2241 2241
 
2242 2242
 	protected function _delete_category($cat_id) {
2243 2243
 		global $wpdb;
2244
-		$cat_id = absint( $cat_id );
2245
-		wp_delete_term( $cat_id, 'espresso_event_categories' );
2244
+		$cat_id = absint($cat_id);
2245
+		wp_delete_term($cat_id, 'espresso_event_categories');
2246 2246
 	}
2247 2247
 
2248 2248
 
2249 2249
 
2250 2250
 	protected function _insert_or_update_category($new_category) {
2251 2251
 
2252
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
2252
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
2253 2253
 		$success = 0; //we already have a success message so lets not send another.
2254 2254
 
2255
-		if ( $cat_id ) {
2255
+		if ($cat_id) {
2256 2256
 			$query_args = array(
2257 2257
 				'action'     => 'edit_category',
2258 2258
 				'EVT_CAT_ID' => $cat_id
2259 2259
 			);
2260 2260
 		} else {
2261
-			$query_args = array( 'action' => 'add_category' );
2261
+			$query_args = array('action' => 'add_category');
2262 2262
 		}
2263
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
2263
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
2264 2264
 
2265 2265
 	}
2266 2266
 
2267 2267
 
2268 2268
 
2269
-	private function _insert_category( $update = FALSE ) {
2269
+	private function _insert_category($update = FALSE) {
2270 2270
 		$cat_id = $update ? $this->_req_data['EVT_CAT_ID'] : '';
2271
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
2272
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
2273
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
2271
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
2272
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
2273
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
2274 2274
 
2275
-		if ( empty( $category_name ) ) {
2276
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
2277
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2275
+		if (empty($category_name)) {
2276
+			$msg = __('You must add a name for the category.', 'event_espresso');
2277
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2278 2278
 			return false;
2279 2279
 		}
2280 2280
 
2281
-		$term_args=array(
2281
+		$term_args = array(
2282 2282
 			'name'=>$category_name,
2283 2283
 			'description'=>$category_desc,
2284 2284
 			'parent'=>$category_parent
2285 2285
 		);
2286 2286
 		//was the category_identifier input disabled?
2287
-		if(isset($this->_req_data['category_identifier'])){
2287
+		if (isset($this->_req_data['category_identifier'])) {
2288 2288
 			$term_args['slug'] = $this->_req_data['category_identifier'];
2289 2289
 		}
2290
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_event_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_event_categories', $term_args );
2290
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_event_categories', $term_args) : wp_insert_term($category_name, 'espresso_event_categories', $term_args);
2291 2291
 
2292
-		if ( !is_array( $insert_ids ) ) {
2293
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
2294
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
2292
+		if ( ! is_array($insert_ids)) {
2293
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
2294
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
2295 2295
 		} else {
2296 2296
 			$cat_id = $insert_ids['term_id'];
2297
-			$msg = sprintf ( __('The category %s was successfuly saved', 'event_espresso'), $category_name );
2298
-			EE_Error::add_success( $msg );
2297
+			$msg = sprintf(__('The category %s was successfuly saved', 'event_espresso'), $category_name);
2298
+			EE_Error::add_success($msg);
2299 2299
 		}
2300 2300
 
2301 2301
 		return $cat_id;
@@ -2304,32 +2304,32 @@  discard block
 block discarded – undo
2304 2304
 
2305 2305
 
2306 2306
 
2307
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
2307
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
2308 2308
 		global $wpdb;
2309 2309
 
2310 2310
 		//testing term stuff
2311
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
2312
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
2313
-		$limit = ($current_page-1)*$per_page;
2311
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
2312
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
2313
+		$limit = ($current_page - 1) * $per_page;
2314 2314
 
2315
-		$where = array( 'taxonomy' => 'espresso_event_categories' );
2315
+		$where = array('taxonomy' => 'espresso_event_categories');
2316 2316
 
2317
-		if ( isset( $this->_req_data['s'] ) ) {
2318
-			$sstr = '%' . $this->_req_data['s'] . '%';
2317
+		if (isset($this->_req_data['s'])) {
2318
+			$sstr = '%'.$this->_req_data['s'].'%';
2319 2319
 			$where['OR'] = array(
2320
-				'Term.name' => array( 'LIKE', $sstr),
2321
-				'description' => array( 'LIKE', $sstr )
2320
+				'Term.name' => array('LIKE', $sstr),
2321
+				'description' => array('LIKE', $sstr)
2322 2322
 				);
2323 2323
 		}
2324 2324
 
2325 2325
 		$query_params = array(
2326
-			$where ,
2327
-			'order_by' => array( $orderby => $order ),
2328
-			'limit' => $limit . ',' . $per_page,
2326
+			$where,
2327
+			'order_by' => array($orderby => $order),
2328
+			'limit' => $limit.','.$per_page,
2329 2329
 			'force_join' => array('Term')
2330 2330
 			);
2331 2331
 
2332
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
2332
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
2333 2333
 
2334 2334
 		return $categories;
2335 2335
 	}
Please login to merge, or discard this patch.
admin_pages/general_settings/General_Settings_Admin_Page.core.php 1 patch
Spacing   +280 added lines, -281 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 
41 41
 
42 42
 
43
-	public function __construct( $routing = TRUE ) {
44
-		parent::__construct( $routing );
43
+	public function __construct($routing = TRUE) {
44
+		parent::__construct($routing);
45 45
 	}
46 46
 
47 47
 
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 
58 58
 
59 59
 	protected function _ajax_hooks() {
60
-		add_action('wp_ajax_espresso_display_country_settings', array( $this, 'display_country_settings'));
61
-		add_action('wp_ajax_espresso_display_country_states', array( $this, 'display_country_states'));
62
-		add_action('wp_ajax_espresso_delete_state', array( $this, 'delete_state'), 10, 3 );
63
-		add_action('wp_ajax_espresso_add_new_state', array( $this, 'add_new_state'));
60
+		add_action('wp_ajax_espresso_display_country_settings', array($this, 'display_country_settings'));
61
+		add_action('wp_ajax_espresso_display_country_states', array($this, 'display_country_states'));
62
+		add_action('wp_ajax_espresso_delete_state', array($this, 'delete_state'), 10, 3);
63
+		add_action('wp_ajax_espresso_add_new_state', array($this, 'add_new_state'));
64 64
 	}
65 65
 
66 66
 
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 					'label' => __('Critical Pages', 'event_espresso'),
154 154
 					'order' => 50
155 155
 					),
156
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
156
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
157 157
                			'help_tabs' => array(
158 158
 					'general_settings_critical_pages_help_tab' => array(
159 159
 						'title' => __('Critical Pages', 'event_espresso'),
160 160
 						'filename' => 'general_settings_critical_pages'
161 161
 						)
162 162
 					),
163
-				'help_tour' => array( 'Critical_Pages_Help_Tour' ),
163
+				'help_tour' => array('Critical_Pages_Help_Tour'),
164 164
 				'require_nonce' => FALSE
165 165
 				),
166 166
 			'default' => array(
@@ -174,8 +174,8 @@  discard block
 block discarded – undo
174 174
 						'filename' => 'general_settings_your_organization'
175 175
 						)
176 176
 					),
177
-				'help_tour' => array( 'Your_Organization_Help_Tour' ),
178
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
177
+				'help_tour' => array('Your_Organization_Help_Tour'),
178
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
179 179
 				'require_nonce' => FALSE
180 180
 				),
181 181
 			'admin_option_settings' => array(
@@ -183,14 +183,14 @@  discard block
 block discarded – undo
183 183
 					'label' => __('Admin Options', 'event_espresso'),
184 184
 					'order' => 60
185 185
 					),
186
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
186
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
187 187
                 			'help_tabs' => array(
188 188
 					'general_settings_admin_options_help_tab' => array(
189 189
 						'title' => __('Admin Options', 'event_espresso'),
190 190
 						'filename' => 'general_settings_admin_options'
191 191
 						)
192 192
 					),
193
-				'help_tour' => array( 'Admin_Options_Help_Tour' ),
193
+				'help_tour' => array('Admin_Options_Help_Tour'),
194 194
 				'require_nonce' => FALSE
195 195
 				),
196 196
 			'country_settings' => array(
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 						'filename' => 'general_settings_countries'
205 205
 						)
206 206
 					),
207
-				'help_tour' => array( 'Countries_Help_Tour' ),
207
+				'help_tour' => array('Countries_Help_Tour'),
208 208
 				'require_nonce' => FALSE
209 209
 				)
210 210
 			);
@@ -222,11 +222,11 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	public function admin_init() {
225
-		EE_Registry::$i18n_js_strings[ 'invalid_server_response' ] = __( 'An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso' );
226
-		EE_Registry::$i18n_js_strings[ 'error_occurred' ] = __( 'An error occurred! Please refresh the page and try again.', 'event_espresso' );
227
-		EE_Registry::$i18n_js_strings[ 'confirm_delete_state' ] = __( 'Are you sure you want to delete this State / Province?', 'event_espresso' );
228
-		$protocol = isset( $_SERVER[ 'HTTPS' ] ) ? 'https://' : 'http://';
229
-		EE_Registry::$i18n_js_strings[ 'ajax_url' ] = admin_url( 'admin-ajax.php?page=espresso_general_settings', $protocol );
225
+		EE_Registry::$i18n_js_strings['invalid_server_response'] = __('An error occurred! Your request may have been processed, but a valid response from the server was not received. Please refresh the page and try again.', 'event_espresso');
226
+		EE_Registry::$i18n_js_strings['error_occurred'] = __('An error occurred! Please refresh the page and try again.', 'event_espresso');
227
+		EE_Registry::$i18n_js_strings['confirm_delete_state'] = __('Are you sure you want to delete this State / Province?', 'event_espresso');
228
+		$protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://';
229
+		EE_Registry::$i18n_js_strings['ajax_url'] = admin_url('admin-ajax.php?page=espresso_general_settings', $protocol);
230 230
 	}
231 231
 
232 232
 	public function admin_notices() {}
@@ -239,21 +239,21 @@  discard block
 block discarded – undo
239 239
 		//scripts
240 240
 		wp_enqueue_script('media-upload');
241 241
 		wp_enqueue_script('thickbox');
242
-		wp_register_script( 'organization_settings', GEN_SET_ASSETS_URL . 'your_organization_settings.js', array( 'jquery','media-upload','thickbox' ), EVENT_ESPRESSO_VERSION, TRUE );
243
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
244
-		wp_enqueue_script( 'organization_settings' );
245
-		wp_enqueue_style( 'organization-css' );
246
-		$confirm_image_delete = array( 'text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
-		wp_localize_script( 'organization_settings', 'confirm_image_delete', $confirm_image_delete );
242
+		wp_register_script('organization_settings', GEN_SET_ASSETS_URL.'your_organization_settings.js', array('jquery', 'media-upload', 'thickbox'), EVENT_ESPRESSO_VERSION, TRUE);
243
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
244
+		wp_enqueue_script('organization_settings');
245
+		wp_enqueue_style('organization-css');
246
+		$confirm_image_delete = array('text' => __('Do you really want to delete this image? Please remember to save your settings to complete the removal.', 'event_espresso'));
247
+		wp_localize_script('organization_settings', 'confirm_image_delete', $confirm_image_delete);
248 248
 
249 249
 	}
250 250
 
251 251
 	public function load_scripts_styles_country_settings() {
252 252
 		//scripts
253
-		wp_register_script( 'gen_settings_countries', GEN_SET_ASSETS_URL . 'gen_settings_countries.js', array( 'ee_admin_js' ), EVENT_ESPRESSO_VERSION, TRUE );
254
-		wp_register_style( 'organization-css', GEN_SET_ASSETS_URL . 'organization.css', array(), EVENT_ESPRESSO_VERSION );
255
-		wp_enqueue_script( 'gen_settings_countries' );
256
-		wp_enqueue_style( 'organization-css' );
253
+		wp_register_script('gen_settings_countries', GEN_SET_ASSETS_URL.'gen_settings_countries.js', array('ee_admin_js'), EVENT_ESPRESSO_VERSION, TRUE);
254
+		wp_register_style('organization-css', GEN_SET_ASSETS_URL.'organization.css', array(), EVENT_ESPRESSO_VERSION);
255
+		wp_enqueue_script('gen_settings_countries');
256
+		wp_enqueue_style('organization-css');
257 257
 
258 258
 	}
259 259
 
@@ -270,31 +270,31 @@  discard block
 block discarded – undo
270 270
 		$this->_transient_garbage_collection();
271 271
 		$this->_template_args['values'] = $this->_yes_no_values;
272 272
 
273
-		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ?EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
-		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id ) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id ) : FALSE;
273
+		$this->_template_args['reg_page_id'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? EE_Registry::instance()->CFG->core->reg_page_id : NULL;
274
+		$this->_template_args['reg_page_obj'] = isset(EE_Registry::instance()->CFG->core->reg_page_id) ? get_page(EE_Registry::instance()->CFG->core->reg_page_id) : FALSE;
275 275
 
276
-		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ?EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
-		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id ) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id ) : FALSE;
276
+		$this->_template_args['txn_page_id'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? EE_Registry::instance()->CFG->core->txn_page_id : NULL;
277
+		$this->_template_args['txn_page_obj'] = isset(EE_Registry::instance()->CFG->core->txn_page_id) ? get_page(EE_Registry::instance()->CFG->core->txn_page_id) : FALSE;
278 278
 
279
-		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ?EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
-		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id ) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id ) : FALSE;
279
+		$this->_template_args['thank_you_page_id'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? EE_Registry::instance()->CFG->core->thank_you_page_id : NULL;
280
+		$this->_template_args['thank_you_page_obj'] = isset(EE_Registry::instance()->CFG->core->thank_you_page_id) ? get_page(EE_Registry::instance()->CFG->core->thank_you_page_id) : FALSE;
281 281
 
282
-		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ?EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
-		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id ) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id ) : FALSE;
282
+		$this->_template_args['cancel_page_id'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? EE_Registry::instance()->CFG->core->cancel_page_id : NULL;
283
+		$this->_template_args['cancel_page_obj'] = isset(EE_Registry::instance()->CFG->core->cancel_page_id) ? get_page(EE_Registry::instance()->CFG->core->cancel_page_id) : FALSE;
284 284
 
285
-		$this->_set_add_edit_form_tags( 'update_espresso_page_settings' );
286
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
287
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'espresso_page_settings.template.php', $this->_template_args, TRUE );
285
+		$this->_set_add_edit_form_tags('update_espresso_page_settings');
286
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
287
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'espresso_page_settings.template.php', $this->_template_args, TRUE);
288 288
 		$this->display_admin_page_with_sidebar();
289 289
 
290 290
 	}
291 291
 
292 292
 	protected function _update_espresso_page_settings() {
293 293
 		// capture incoming request data
294
-		$reg_page_id = isset( $this->_req_data['reg_page_id'] ) ? absint( $this->_req_data['reg_page_id'] ) : EE_Registry::instance()->CFG->core->reg_page_id;
295
-		$txn_page_id = isset( $this->_req_data['txn_page_id'] ) ? absint( $this->_req_data['txn_page_id'] ) : EE_Registry::instance()->CFG->core->txn_page_id;
296
-		$thank_you_page_id = isset( $this->_req_data['thank_you_page_id'] ) ? absint( $this->_req_data['thank_you_page_id'] ) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
-		$cancel_page_id = isset( $this->_req_data['cancel_page_id'] ) ? absint( $this->_req_data['cancel_page_id'] ) : EE_Registry::instance()->CFG->core->cancel_page_id;
294
+		$reg_page_id = isset($this->_req_data['reg_page_id']) ? absint($this->_req_data['reg_page_id']) : EE_Registry::instance()->CFG->core->reg_page_id;
295
+		$txn_page_id = isset($this->_req_data['txn_page_id']) ? absint($this->_req_data['txn_page_id']) : EE_Registry::instance()->CFG->core->txn_page_id;
296
+		$thank_you_page_id = isset($this->_req_data['thank_you_page_id']) ? absint($this->_req_data['thank_you_page_id']) : EE_Registry::instance()->CFG->core->thank_you_page_id;
297
+		$cancel_page_id = isset($this->_req_data['cancel_page_id']) ? absint($this->_req_data['cancel_page_id']) : EE_Registry::instance()->CFG->core->cancel_page_id;
298 298
 		// pack critical_pages into an array
299 299
 		$critical_pages = array(
300 300
 			'reg_page_id' 				=> $reg_page_id,
@@ -302,17 +302,17 @@  discard block
 block discarded – undo
302 302
 			'thank_you_page_id' 	=> $thank_you_page_id,
303 303
 			'cancel_page_id' 		=> $cancel_page_id
304 304
 		);
305
-		foreach ( $critical_pages as $critical_page_name => $critical_page_id ) {
305
+		foreach ($critical_pages as $critical_page_name => $critical_page_id) {
306 306
 			// has the page changed ?
307
-			if ( EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id ) {
307
+			if (EE_Registry::instance()->CFG->core->{$critical_page_name} != $critical_page_id) {
308 308
 				// grab post object for old page
309
-				$post = get_post( EE_Registry::instance()->CFG->core->{$critical_page_name} );
309
+				$post = get_post(EE_Registry::instance()->CFG->core->{$critical_page_name} );
310 310
 				// update post shortcodes for old page
311
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
311
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
312 312
 				// grab post object for new page
313
-				$post = get_post( $critical_page_id );
313
+				$post = get_post($critical_page_id);
314 314
 				// update post shortcodes for new page
315
-				EE_Admin::parse_post_content_on_save( $critical_page_id, $post );
315
+				EE_Admin::parse_post_content_on_save($critical_page_id, $post);
316 316
 			}
317 317
 		}
318 318
 		// set page IDs
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 		EE_Registry::instance()->CFG->core->thank_you_page_id = $thank_you_page_id;
322 322
 		EE_Registry::instance()->CFG->core->cancel_page_id = $cancel_page_id;
323 323
 
324
-		EE_Registry::instance()->CFG->core = apply_filters( 'FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data );
324
+		EE_Registry::instance()->CFG->core = apply_filters('FHEE__General_Settings_Admin_Page___update_espresso_page_settings__CFG_core', EE_Registry::instance()->CFG->core, $this->_req_data);
325 325
 
326 326
 		$what = __('Critical Pages & Shortcodes', 'event_espresso');
327
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__ );
327
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->core, __FILE__, __FUNCTION__, __LINE__);
328 328
 		$query_args = array(
329 329
 			'action' => 'critical_pages'
330 330
 			);
331
-		$this->_redirect_after_action( FALSE, '', '', $query_args, TRUE );
331
+		$this->_redirect_after_action(FALSE, '', '', $query_args, TRUE);
332 332
 
333 333
 	}
334 334
 
@@ -343,34 +343,34 @@  discard block
 block discarded – undo
343 343
 
344 344
 	protected function _your_organization_settings() {
345 345
 
346
-		$this->_template_args['site_license_key'] = isset( EE_Registry::instance()->NET_CFG->core->site_license_key ) ? EE_Registry::instance()->NET_CFG->core->get_pretty( 'site_license_key' ) : '';
347
-		$this->_template_args['organization_name'] = isset( EE_Registry::instance()->CFG->organization->name ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'name' ) : '';
348
-		$this->_template_args['organization_address_1'] = isset( EE_Registry::instance()->CFG->organization->address_1 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_1' ) : '';
349
-		$this->_template_args['organization_address_2'] = isset( EE_Registry::instance()->CFG->organization->address_2 ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'address_2' ) : '';
350
-		$this->_template_args['organization_city'] = isset( EE_Registry::instance()->CFG->organization->city ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'city' ) : '';
351
-		$this->_template_args['organization_zip'] = isset( EE_Registry::instance()->CFG->organization->zip ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'zip' ) : '';
352
-		$this->_template_args['organization_email'] = isset( EE_Registry::instance()->CFG->organization->email ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) : '';
353
-		$this->_template_args['organization_phone'] = isset( EE_Registry::instance()->CFG->organization->phone ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'phone' ) : '';
354
-		$this->_template_args['organization_vat'] = isset( EE_Registry::instance()->CFG->organization->vat ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'vat' ) : '';
355
-		$this->_template_args['currency_sign'] = isset( EE_Registry::instance()->CFG->currency->sign ) ? EE_Registry::instance()->CFG->currency->get_pretty( 'sign' ) : '$';
356
-		$this->_template_args['organization_logo_url'] = isset( EE_Registry::instance()->CFG->organization->logo_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'logo_url' ) : FALSE;
357
-		$this->_template_args['organization_facebook'] = isset( EE_Registry::instance()->CFG->organization->facebook ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : '';
358
-		$this->_template_args['organization_twitter'] = isset( EE_Registry::instance()->CFG->organization->twitter ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : '';
359
-		$this->_template_args['organization_linkedin'] = isset( EE_Registry::instance()->CFG->organization->linkedin ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'linkedin' ) : '';
360
-		$this->_template_args['organization_pinterest'] = isset( EE_Registry::instance()->CFG->organization->pinterest ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'pinterest' ) : '';
361
-		$this->_template_args['organization_google'] = isset( EE_Registry::instance()->CFG->organization->google ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'google' ) : '';
362
-		$this->_template_args['organization_instagram'] = isset( EE_Registry::instance()->CFG->organization->instagram ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'instagram' ) : '';
346
+		$this->_template_args['site_license_key'] = isset(EE_Registry::instance()->NET_CFG->core->site_license_key) ? EE_Registry::instance()->NET_CFG->core->get_pretty('site_license_key') : '';
347
+		$this->_template_args['organization_name'] = isset(EE_Registry::instance()->CFG->organization->name) ? EE_Registry::instance()->CFG->organization->get_pretty('name') : '';
348
+		$this->_template_args['organization_address_1'] = isset(EE_Registry::instance()->CFG->organization->address_1) ? EE_Registry::instance()->CFG->organization->get_pretty('address_1') : '';
349
+		$this->_template_args['organization_address_2'] = isset(EE_Registry::instance()->CFG->organization->address_2) ? EE_Registry::instance()->CFG->organization->get_pretty('address_2') : '';
350
+		$this->_template_args['organization_city'] = isset(EE_Registry::instance()->CFG->organization->city) ? EE_Registry::instance()->CFG->organization->get_pretty('city') : '';
351
+		$this->_template_args['organization_zip'] = isset(EE_Registry::instance()->CFG->organization->zip) ? EE_Registry::instance()->CFG->organization->get_pretty('zip') : '';
352
+		$this->_template_args['organization_email'] = isset(EE_Registry::instance()->CFG->organization->email) ? EE_Registry::instance()->CFG->organization->get_pretty('email') : '';
353
+		$this->_template_args['organization_phone'] = isset(EE_Registry::instance()->CFG->organization->phone) ? EE_Registry::instance()->CFG->organization->get_pretty('phone') : '';
354
+		$this->_template_args['organization_vat'] = isset(EE_Registry::instance()->CFG->organization->vat) ? EE_Registry::instance()->CFG->organization->get_pretty('vat') : '';
355
+		$this->_template_args['currency_sign'] = isset(EE_Registry::instance()->CFG->currency->sign) ? EE_Registry::instance()->CFG->currency->get_pretty('sign') : '$';
356
+		$this->_template_args['organization_logo_url'] = isset(EE_Registry::instance()->CFG->organization->logo_url) ? EE_Registry::instance()->CFG->organization->get_pretty('logo_url') : FALSE;
357
+		$this->_template_args['organization_facebook'] = isset(EE_Registry::instance()->CFG->organization->facebook) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : '';
358
+		$this->_template_args['organization_twitter'] = isset(EE_Registry::instance()->CFG->organization->twitter) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : '';
359
+		$this->_template_args['organization_linkedin'] = isset(EE_Registry::instance()->CFG->organization->linkedin) ? EE_Registry::instance()->CFG->organization->get_pretty('linkedin') : '';
360
+		$this->_template_args['organization_pinterest'] = isset(EE_Registry::instance()->CFG->organization->pinterest) ? EE_Registry::instance()->CFG->organization->get_pretty('pinterest') : '';
361
+		$this->_template_args['organization_google'] = isset(EE_Registry::instance()->CFG->organization->google) ? EE_Registry::instance()->CFG->organization->get_pretty('google') : '';
362
+		$this->_template_args['organization_instagram'] = isset(EE_Registry::instance()->CFG->organization->instagram) ? EE_Registry::instance()->CFG->organization->get_pretty('instagram') : '';
363 363
 		//UXIP settings
364
-		$this->_template_args['ee_ueip_optin'] = isset( EE_Registry::instance()->CFG->core->ee_ueip_optin ) ? EE_Registry::instance()->CFG->core->get_pretty( 'ee_ueip_optin' ) : TRUE;
364
+		$this->_template_args['ee_ueip_optin'] = isset(EE_Registry::instance()->CFG->core->ee_ueip_optin) ? EE_Registry::instance()->CFG->core->get_pretty('ee_ueip_optin') : TRUE;
365 365
 
366
-		$STA_ID = isset( EE_Registry::instance()->CFG->organization->STA_ID ) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
366
+		$STA_ID = isset(EE_Registry::instance()->CFG->organization->STA_ID) ? EE_Registry::instance()->CFG->organization->STA_ID : 4;
367 367
 		$this->_template_args['states'] = new EE_Question_Form_Input(
368
-				EE_Question::new_instance ( array(
368
+				EE_Question::new_instance(array(
369 369
 					'QST_ID'=> 0,
370 370
 					'QST_display_text'=> __('State/Province', 'event_espresso'),
371 371
 					'QST_system'=>'admin-state'
372 372
 				)),
373
-				EE_Answer::new_instance ( array(
373
+				EE_Answer::new_instance(array(
374 374
 					'ANS_ID' => 0,
375 375
 					'ANS_value' => $STA_ID
376 376
 				)),
@@ -382,14 +382,14 @@  discard block
 block discarded – undo
382 382
 				)
383 383
 			);
384 384
 
385
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
385
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
386 386
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
387
-				EE_Question::new_instance ( array(
387
+				EE_Question::new_instance(array(
388 388
 					'QST_ID'=> 0,
389 389
 					'QST_display_text'=> __('Country', 'event_espresso'),
390 390
 					'QST_system'=>'admin-country'
391 391
 				)),
392
-				EE_Answer::new_instance ( array(
392
+				EE_Answer::new_instance(array(
393 393
 					'ANS_ID' => 0,
394 394
 					'ANS_value' => $CNT_ISO
395 395
 				)),
@@ -401,51 +401,51 @@  discard block
 block discarded – undo
401 401
 				)
402 402
 			);
403 403
 
404
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
405
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
404
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
405
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
406 406
 
407 407
 		//PUE verification stuff
408
-		$ver_option_key = 'puvererr_' . basename( EE_PLUGIN_BASENAME );
409
-		$verify_fail = get_option( $ver_option_key );
410
-		$this->_template_args['site_license_key_verified'] = $verify_fail || !empty( $verify_fail ) || ( empty( $this->_template_args['site_license_key'] ) && empty( $verify_fail ) )? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
408
+		$ver_option_key = 'puvererr_'.basename(EE_PLUGIN_BASENAME);
409
+		$verify_fail = get_option($ver_option_key);
410
+		$this->_template_args['site_license_key_verified'] = $verify_fail || ! empty($verify_fail) || (empty($this->_template_args['site_license_key']) && empty($verify_fail)) ? '<span class="dashicons dashicons-admin-network ee-icon-color-ee-red ee-icon-size-20"></span>' : '<span class="dashicons dashicons-admin-network ee-icon-color-ee-green ee-icon-size-20"></span>';
411 411
 
412
-		$this->_set_add_edit_form_tags( 'update_your_organization_settings' );
413
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
414
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'your_organization_settings.template.php', $this->_template_args, TRUE );
412
+		$this->_set_add_edit_form_tags('update_your_organization_settings');
413
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
414
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'your_organization_settings.template.php', $this->_template_args, TRUE);
415 415
 
416 416
 		$this->display_admin_page_with_sidebar();
417 417
 	}
418 418
 
419 419
 	protected function _update_your_organization_settings() {
420
-		if ( is_main_site() )
421
-			EE_Registry::instance()->NET_CFG->core->site_license_key = isset( $this->_req_data['site_license_key'] ) ? sanitize_text_field( $this->_req_data['site_license_key'] ) : EE_Registry::instance()->NET_CFG->core->site_license_key;
422
-		EE_Registry::instance()->CFG->organization->name = isset( $this->_req_data['organization_name'] ) ? sanitize_text_field( $this->_req_data['organization_name'] ) : EE_Registry::instance()->CFG->organization->name;
423
-		EE_Registry::instance()->CFG->organization->address_1 = isset( $this->_req_data['organization_address_1'] ) ? sanitize_text_field( $this->_req_data['organization_address_1'] ) : EE_Registry::instance()->CFG->organization->address_1;
424
-		EE_Registry::instance()->CFG->organization->address_2 = isset( $this->_req_data['organization_address_2'] ) ? sanitize_text_field( $this->_req_data['organization_address_2'] ) : EE_Registry::instance()->CFG->organization->address_2;
425
-		EE_Registry::instance()->CFG->organization->city = isset( $this->_req_data['organization_city'] ) ? sanitize_text_field( $this->_req_data['organization_city'] ) : EE_Registry::instance()->CFG->organization->city;
426
-		EE_Registry::instance()->CFG->organization->STA_ID = isset( $this->_req_data['organization_state'] ) ? absint( $this->_req_data['organization_state'] ) : EE_Registry::instance()->CFG->organization->STA_ID;
427
-		EE_Registry::instance()->CFG->organization->CNT_ISO = isset( $this->_req_data['organization_country'] ) ? sanitize_text_field( $this->_req_data['organization_country'] ) : EE_Registry::instance()->CFG->organization->CNT_ISO;
428
-		EE_Registry::instance()->CFG->organization->zip = isset( $this->_req_data['organization_zip'] ) ? sanitize_text_field( $this->_req_data['organization_zip'] ) : EE_Registry::instance()->CFG->organization->zip;
429
-		EE_Registry::instance()->CFG->organization->email = isset( $this->_req_data['organization_email'] ) ? sanitize_email( $this->_req_data['organization_email'] ) : EE_Registry::instance()->CFG->organization->email;
430
-		EE_Registry::instance()->CFG->organization->vat = isset( $this->_req_data['organization_vat'] ) ? sanitize_text_field( $this->_req_data['organization_vat'] ) : EE_Registry::instance()->CFG->organization->vat;
431
-		EE_Registry::instance()->CFG->organization->phone = isset( $this->_req_data['organization_phone'] ) ? sanitize_text_field( $this->_req_data['organization_phone'] ) : EE_Registry::instance()->CFG->organization->phone;
432
-		EE_Registry::instance()->CFG->organization->logo_url = isset( $this->_req_data['organization_logo_url'] ) ? esc_url_raw( $this->_req_data['organization_logo_url'] ) : EE_Registry::instance()->CFG->organization->logo_url;
433
-		EE_Registry::instance()->CFG->organization->facebook = isset( $this->_req_data['organization_facebook'] ) ? esc_url_raw( $this->_req_data['organization_facebook'] ) : EE_Registry::instance()->CFG->organization->facebook;
434
-		EE_Registry::instance()->CFG->organization->twitter = isset( $this->_req_data['organization_twitter'] ) ? esc_url_raw( $this->_req_data['organization_twitter'] ) : EE_Registry::instance()->CFG->organization->twitter;
435
-		EE_Registry::instance()->CFG->organization->linkedin = isset( $this->_req_data['organization_linkedin'] ) ? esc_url_raw( $this->_req_data['organization_linkedin'] ) : EE_Registry::instance()->CFG->organization->linkedin;
436
-		EE_Registry::instance()->CFG->organization->pinterest = isset( $this->_req_data['organization_pinterest'] ) ? esc_url_raw( $this->_req_data['organization_pinterest'] ) : EE_Registry::instance()->CFG->organization->pinterest;
437
-		EE_Registry::instance()->CFG->organization->google = isset( $this->_req_data['organization_google'] ) ? esc_url_raw( $this->_req_data['organization_google'] ) : EE_Registry::instance()->CFG->organization->google;
438
-		EE_Registry::instance()->CFG->organization->instagram = isset( $this->_req_data['organization_instagram'] ) ? esc_url_raw( $this->_req_data['organization_instagram'] ) : EE_Registry::instance()->CFG->organization->instagram;
439
-		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset( $this->_req_data['ueip_optin'] ) && !empty( $this->_req_data['ueip_optin'] ) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
440
-
441
-		EE_Registry::instance()->CFG->currency = new EE_Currency_Config( EE_Registry::instance()->CFG->organization->CNT_ISO );
442
-
443
-		EE_Registry::instance()->CFG = apply_filters( 'FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG );
420
+		if (is_main_site())
421
+			EE_Registry::instance()->NET_CFG->core->site_license_key = isset($this->_req_data['site_license_key']) ? sanitize_text_field($this->_req_data['site_license_key']) : EE_Registry::instance()->NET_CFG->core->site_license_key;
422
+		EE_Registry::instance()->CFG->organization->name = isset($this->_req_data['organization_name']) ? sanitize_text_field($this->_req_data['organization_name']) : EE_Registry::instance()->CFG->organization->name;
423
+		EE_Registry::instance()->CFG->organization->address_1 = isset($this->_req_data['organization_address_1']) ? sanitize_text_field($this->_req_data['organization_address_1']) : EE_Registry::instance()->CFG->organization->address_1;
424
+		EE_Registry::instance()->CFG->organization->address_2 = isset($this->_req_data['organization_address_2']) ? sanitize_text_field($this->_req_data['organization_address_2']) : EE_Registry::instance()->CFG->organization->address_2;
425
+		EE_Registry::instance()->CFG->organization->city = isset($this->_req_data['organization_city']) ? sanitize_text_field($this->_req_data['organization_city']) : EE_Registry::instance()->CFG->organization->city;
426
+		EE_Registry::instance()->CFG->organization->STA_ID = isset($this->_req_data['organization_state']) ? absint($this->_req_data['organization_state']) : EE_Registry::instance()->CFG->organization->STA_ID;
427
+		EE_Registry::instance()->CFG->organization->CNT_ISO = isset($this->_req_data['organization_country']) ? sanitize_text_field($this->_req_data['organization_country']) : EE_Registry::instance()->CFG->organization->CNT_ISO;
428
+		EE_Registry::instance()->CFG->organization->zip = isset($this->_req_data['organization_zip']) ? sanitize_text_field($this->_req_data['organization_zip']) : EE_Registry::instance()->CFG->organization->zip;
429
+		EE_Registry::instance()->CFG->organization->email = isset($this->_req_data['organization_email']) ? sanitize_email($this->_req_data['organization_email']) : EE_Registry::instance()->CFG->organization->email;
430
+		EE_Registry::instance()->CFG->organization->vat = isset($this->_req_data['organization_vat']) ? sanitize_text_field($this->_req_data['organization_vat']) : EE_Registry::instance()->CFG->organization->vat;
431
+		EE_Registry::instance()->CFG->organization->phone = isset($this->_req_data['organization_phone']) ? sanitize_text_field($this->_req_data['organization_phone']) : EE_Registry::instance()->CFG->organization->phone;
432
+		EE_Registry::instance()->CFG->organization->logo_url = isset($this->_req_data['organization_logo_url']) ? esc_url_raw($this->_req_data['organization_logo_url']) : EE_Registry::instance()->CFG->organization->logo_url;
433
+		EE_Registry::instance()->CFG->organization->facebook = isset($this->_req_data['organization_facebook']) ? esc_url_raw($this->_req_data['organization_facebook']) : EE_Registry::instance()->CFG->organization->facebook;
434
+		EE_Registry::instance()->CFG->organization->twitter = isset($this->_req_data['organization_twitter']) ? esc_url_raw($this->_req_data['organization_twitter']) : EE_Registry::instance()->CFG->organization->twitter;
435
+		EE_Registry::instance()->CFG->organization->linkedin = isset($this->_req_data['organization_linkedin']) ? esc_url_raw($this->_req_data['organization_linkedin']) : EE_Registry::instance()->CFG->organization->linkedin;
436
+		EE_Registry::instance()->CFG->organization->pinterest = isset($this->_req_data['organization_pinterest']) ? esc_url_raw($this->_req_data['organization_pinterest']) : EE_Registry::instance()->CFG->organization->pinterest;
437
+		EE_Registry::instance()->CFG->organization->google = isset($this->_req_data['organization_google']) ? esc_url_raw($this->_req_data['organization_google']) : EE_Registry::instance()->CFG->organization->google;
438
+		EE_Registry::instance()->CFG->organization->instagram = isset($this->_req_data['organization_instagram']) ? esc_url_raw($this->_req_data['organization_instagram']) : EE_Registry::instance()->CFG->organization->instagram;
439
+		EE_Registry::instance()->CFG->core->ee_ueip_optin = isset($this->_req_data['ueip_optin']) && ! empty($this->_req_data['ueip_optin']) ? $this->_req_data['ueip_optin'] : EE_Registry::instance()->CFG->core->ee_ueip_optin;
440
+
441
+		EE_Registry::instance()->CFG->currency = new EE_Currency_Config(EE_Registry::instance()->CFG->organization->CNT_ISO);
442
+
443
+		EE_Registry::instance()->CFG = apply_filters('FHEE__General_Settings_Admin_Page___update_your_organization_settings__CFG', EE_Registry::instance()->CFG);
444 444
 
445 445
 		$what = 'Your Organization Settings';
446
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
446
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
447 447
 
448
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'default' ) );
448
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'default'));
449 449
 
450 450
 	}
451 451
 
@@ -456,36 +456,36 @@  discard block
 block discarded – undo
456 456
 	protected function _admin_option_settings() {
457 457
 
458 458
 		$this->_template_args['values'] = $this->_yes_no_values;
459
-		$this->_template_args['use_personnel_manager'] = isset( EE_Registry::instance()->CFG->admin->use_personnel_manager ) ? absint( EE_Registry::instance()->CFG->admin->use_personnel_manager ) : FALSE;
460
-		$this->_template_args['use_dashboard_widget'] = isset( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) ? absint( EE_Registry::instance()->CFG->admin->use_dashboard_widget ) : TRUE;
461
-		$this->_template_args['events_in_dashboard'] = isset( EE_Registry::instance()->CFG->admin->events_in_dashboard ) ? absint( EE_Registry::instance()->CFG->admin->events_in_dashboard ) : 30;
462
-		$this->_template_args['use_event_timezones'] = isset( EE_Registry::instance()->CFG->admin->use_event_timezones ) ? absint( EE_Registry::instance()->CFG->admin->use_event_timezones ) : FALSE;
463
-		$this->_template_args['show_reg_footer'] = isset( EE_Registry::instance()->CFG->admin->show_reg_footer ) ? absint( EE_Registry::instance()->CFG->admin->show_reg_footer ) : TRUE;
464
-		$this->_template_args['affiliate_id'] = isset( EE_Registry::instance()->CFG->admin->affiliate_id ) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
-		$this->_template_args['help_tour_activation'] = isset( EE_Registry::instance()->CFG->admin->help_tour_activation ) ? absint( EE_Registry::instance()->CFG->admin->help_tour_activation ): 1;
466
-
467
-		$this->_set_add_edit_form_tags( 'update_admin_option_settings' );
468
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
459
+		$this->_template_args['use_personnel_manager'] = isset(EE_Registry::instance()->CFG->admin->use_personnel_manager) ? absint(EE_Registry::instance()->CFG->admin->use_personnel_manager) : FALSE;
460
+		$this->_template_args['use_dashboard_widget'] = isset(EE_Registry::instance()->CFG->admin->use_dashboard_widget) ? absint(EE_Registry::instance()->CFG->admin->use_dashboard_widget) : TRUE;
461
+		$this->_template_args['events_in_dashboard'] = isset(EE_Registry::instance()->CFG->admin->events_in_dashboard) ? absint(EE_Registry::instance()->CFG->admin->events_in_dashboard) : 30;
462
+		$this->_template_args['use_event_timezones'] = isset(EE_Registry::instance()->CFG->admin->use_event_timezones) ? absint(EE_Registry::instance()->CFG->admin->use_event_timezones) : FALSE;
463
+		$this->_template_args['show_reg_footer'] = isset(EE_Registry::instance()->CFG->admin->show_reg_footer) ? absint(EE_Registry::instance()->CFG->admin->show_reg_footer) : TRUE;
464
+		$this->_template_args['affiliate_id'] = isset(EE_Registry::instance()->CFG->admin->affiliate_id) ? EE_Registry::instance()->CFG->admin->get_pretty('affiliate_id') : '';
465
+		$this->_template_args['help_tour_activation'] = isset(EE_Registry::instance()->CFG->admin->help_tour_activation) ? absint(EE_Registry::instance()->CFG->admin->help_tour_activation) : 1;
466
+
467
+		$this->_set_add_edit_form_tags('update_admin_option_settings');
468
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
469 469
 		$this->_template_args['template_args'] = $this->_template_args;
470
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'admin_option_settings.template.php', $this->_template_args, TRUE );
470
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'admin_option_settings.template.php', $this->_template_args, TRUE);
471 471
 		$this->display_admin_page_with_sidebar();
472 472
 	}
473 473
 
474 474
 	protected function _update_admin_option_settings() {
475
-		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset( $this->_req_data['use_personnel_manager'] ) ? absint( $this->_req_data['use_personnel_manager'] ) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
476
-		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset( $this->_req_data['use_dashboard_widget'] ) ? absint( $this->_req_data['use_dashboard_widget'] ) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
477
-		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset( $this->_req_data['events_in_dashboard'] ) ? absint( $this->_req_data['events_in_dashboard'] ) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
478
-		EE_Registry::instance()->CFG->admin->use_event_timezones = isset( $this->_req_data['use_event_timezones'] ) ? absint( $this->_req_data['use_event_timezones'] ) : EE_Registry::instance()->CFG->admin->use_event_timezones;
479
-		EE_Registry::instance()->CFG->admin->show_reg_footer = isset( $this->_req_data['show_reg_footer'] ) ? absint( $this->_req_data['show_reg_footer'] ) : EE_Registry::instance()->CFG->admin->show_reg_footer;
480
-		EE_Registry::instance()->CFG->admin->affiliate_id = isset( $this->_req_data['affiliate_id'] ) ? sanitize_text_field( $this->_req_data['affiliate_id'] ) : EE_Registry::instance()->CFG->admin->affiliate_id;
481
-		EE_Registry::instance()->CFG->admin->help_tour_activation = isset( $this->_req_data['help_tour_activation'] ) ? absint( $this->_req_data['help_tour_activation'] ) : EE_Registry::instance()->CFG->admin->help_tour_activation;
475
+		EE_Registry::instance()->CFG->admin->use_personnel_manager = isset($this->_req_data['use_personnel_manager']) ? absint($this->_req_data['use_personnel_manager']) : EE_Registry::instance()->CFG->admin->use_personnel_manager;
476
+		EE_Registry::instance()->CFG->admin->use_dashboard_widget = isset($this->_req_data['use_dashboard_widget']) ? absint($this->_req_data['use_dashboard_widget']) : EE_Registry::instance()->CFG->admin->use_dashboard_widget;
477
+		EE_Registry::instance()->CFG->admin->events_in_dashboard = isset($this->_req_data['events_in_dashboard']) ? absint($this->_req_data['events_in_dashboard']) : EE_Registry::instance()->CFG->admin->events_in_dashboard;
478
+		EE_Registry::instance()->CFG->admin->use_event_timezones = isset($this->_req_data['use_event_timezones']) ? absint($this->_req_data['use_event_timezones']) : EE_Registry::instance()->CFG->admin->use_event_timezones;
479
+		EE_Registry::instance()->CFG->admin->show_reg_footer = isset($this->_req_data['show_reg_footer']) ? absint($this->_req_data['show_reg_footer']) : EE_Registry::instance()->CFG->admin->show_reg_footer;
480
+		EE_Registry::instance()->CFG->admin->affiliate_id = isset($this->_req_data['affiliate_id']) ? sanitize_text_field($this->_req_data['affiliate_id']) : EE_Registry::instance()->CFG->admin->affiliate_id;
481
+		EE_Registry::instance()->CFG->admin->help_tour_activation = isset($this->_req_data['help_tour_activation']) ? absint($this->_req_data['help_tour_activation']) : EE_Registry::instance()->CFG->admin->help_tour_activation;
482 482
 
483
-		EE_Registry::instance()->CFG->admin = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin );
483
+		EE_Registry::instance()->CFG->admin = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin', EE_Registry::instance()->CFG->admin);
484 484
 
485 485
 		$what = 'Admin Options';
486
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__ );
487
-		$success = apply_filters( 'FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success );
488
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'admin_option_settings' ) );
486
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->admin, __FILE__, __FUNCTION__, __LINE__);
487
+		$success = apply_filters('FHEE__General_Settings_Admin_Page___update_admin_option_settings__success', $success);
488
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'admin_option_settings'));
489 489
 
490 490
 	}
491 491
 
@@ -498,20 +498,20 @@  discard block
 block discarded – undo
498 498
 
499 499
 	protected function _country_settings() {
500 500
 
501
-		$CNT_ISO = isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
501
+		$CNT_ISO = isset(EE_Registry::instance()->CFG->organization->CNT_ISO) ? EE_Registry::instance()->CFG->organization->CNT_ISO : 'US';
502
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
503 503
 
504 504
 		//load field generator helper
505 505
 
506 506
 		$this->_template_args['values'] = $this->_yes_no_values;
507 507
 
508 508
 		$this->_template_args['countries'] = new EE_Question_Form_Input(
509
-				EE_Question::new_instance ( array(
509
+				EE_Question::new_instance(array(
510 510
 					'QST_ID'=> 0,
511 511
 					'QST_display_text'=> __('Select Country', 'event_espresso'),
512 512
 					'QST_system'=>'admin-country'
513 513
 				)),
514
-				EE_Answer::new_instance ( array(
514
+				EE_Answer::new_instance(array(
515 515
 					'ANS_ID' => 0,
516 516
 					'ANS_value' => $CNT_ISO
517 517
 				)),
@@ -524,14 +524,14 @@  discard block
 block discarded – undo
524 524
 			);
525 525
 //		EEH_Debug_Tools::printr( $this->_template_args['countries'], 'countries  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
526 526
 
527
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
528
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
527
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
528
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
529 529
 		$this->_template_args['country_details_settings'] = $this->display_country_settings();
530 530
 		$this->_template_args['country_states_settings'] = $this->display_country_states();
531 531
 
532
-		$this->_set_add_edit_form_tags( 'update_country_settings' );
533
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
534
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'countries_settings.template.php', $this->_template_args, TRUE );
532
+		$this->_set_add_edit_form_tags('update_country_settings');
533
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
534
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'countries_settings.template.php', $this->_template_args, TRUE);
535 535
 		$this->display_admin_page_with_no_sidebar();
536 536
 	}
537 537
 
@@ -544,43 +544,43 @@  discard block
 block discarded – undo
544 544
 	 * 		@param 	string 		$CNT_ISO
545 545
 	 * 		@return 		mixed		string | array
546 546
 	 */
547
-	public function display_country_settings( $CNT_ISO = '' ) {
547
+	public function display_country_settings($CNT_ISO = '') {
548 548
 
549
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : $CNT_ISO;
550
-		if ( ! $CNT_ISO ) {
549
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : $CNT_ISO;
550
+		if ( ! $CNT_ISO) {
551 551
 			return '';
552 552
 		}
553 553
 
554 554
 		// for ajax
555
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
556
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
557
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'country_form_field_label_wrap' ), 10, 2 );
558
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'country_form_field_input__wrap' ), 10, 2 );
559
-		$country = EEM_Country::instance()->get_one_by_ID( $CNT_ISO );
555
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
556
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
557
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'country_form_field_label_wrap'), 10, 2);
558
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'country_form_field_input__wrap'), 10, 2);
559
+		$country = EEM_Country::instance()->get_one_by_ID($CNT_ISO);
560 560
 		//EEH_Debug_Tools::printr( $country, '$country  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
561 561
 		$country_input_types = array(
562
-			'CNT_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  ),
563
-			'CNT_ISO' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
564
-			'CNT_ISO3' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
565
-			'RGN_ID' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
566
-			'CNT_name' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'regular-text' ),
567
-			'CNT_cur_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
568
-			'CNT_cur_single' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
569
-			'CNT_cur_plural' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'medium-text' ),
570
-			'CNT_cur_sign' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text', 'htmlentities' => FALSE ),
571
-			'CNT_cur_sign_b4' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE ),
572
-			'CNT_cur_dec_plc' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => 0, 'text' => '' ), array( 'id' => 1, 'text' => '' ), array( 'id' => 2, 'text' => '' ), array( 'id' => 3, 'text' => '' ))),
573
-			'CNT_cur_dec_mrk' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
574
-			'CNT_cur_thsnds' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => array( array( 'id' => ',', 'text' => __(', (comma)', 'event_espresso')), array( 'id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE ),
575
-			'CNT_tel_code' => array( 'type' => 'TEXT', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => 'small-text' ),
576
-			'CNT_is_EU' => array( 'type' => 'RADIO_BTN', 'input_name' => 'cntry[' . $CNT_ISO . ']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE  )
562
+			'CNT_active' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
563
+			'CNT_ISO' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
564
+			'CNT_ISO3' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
565
+			'RGN_ID' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
566
+			'CNT_name' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'regular-text'),
567
+			'CNT_cur_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
568
+			'CNT_cur_single' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
569
+			'CNT_cur_plural' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'medium-text'),
570
+			'CNT_cur_sign' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text', 'htmlentities' => FALSE),
571
+			'CNT_cur_sign_b4' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE),
572
+			'CNT_cur_dec_plc' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => 0, 'text' => ''), array('id' => 1, 'text' => ''), array('id' => 2, 'text' => ''), array('id' => 3, 'text' => ''))),
573
+			'CNT_cur_dec_mrk' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
574
+			'CNT_cur_thsnds' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => array(array('id' => ',', 'text' => __(', (comma)', 'event_espresso')), array('id' => '.', 'text' => __('. (decimal)', 'event_espresso'))), 'use_desc_4_label' => TRUE),
575
+			'CNT_tel_code' => array('type' => 'TEXT', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => 'small-text'),
576
+			'CNT_is_EU' => array('type' => 'RADIO_BTN', 'input_name' => 'cntry['.$CNT_ISO.']', 'class' => '', 'options' => $this->_yes_no_values, 'use_desc_4_label' => TRUE)
577 577
 		);
578
-		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $country, $country_input_types );
579
-		$country_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'country_details_settings.template.php', $this->_template_args, TRUE );
578
+		$this->_template_args['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($country, $country_input_types);
579
+		$country_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'country_details_settings.template.php', $this->_template_args, TRUE);
580 580
 
581
-		if ( defined( 'DOING_AJAX' )) {
582
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
583
-			echo json_encode( array( 'return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
581
+		if (defined('DOING_AJAX')) {
582
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
583
+			echo json_encode(array('return_data' => $country_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
584 584
 			die();
585 585
 		} else {
586 586
 			return $country_details_settings;
@@ -598,49 +598,49 @@  discard block
 block discarded – undo
598 598
 	 * 		@param 	string 		$CNT_ISO
599 599
 	 * 		@return 		string
600 600
 	 */
601
-	public function display_country_states( $CNT_ISO = '' ) {
601
+	public function display_country_states($CNT_ISO = '') {
602 602
 
603
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? sanitize_text_field( $this->_req_data['country'] ) : $CNT_ISO;
603
+		$CNT_ISO = isset($this->_req_data['country']) ? sanitize_text_field($this->_req_data['country']) : $CNT_ISO;
604 604
 
605
-		if ( ! $CNT_ISO ) {
605
+		if ( ! $CNT_ISO) {
606 606
 			return '';
607 607
 		}
608 608
 		// for ajax
609
-		remove_all_filters( 'FHEE__EEH_Form_Fields__label_html' );
610
-		remove_all_filters( 'FHEE__EEH_Form_Fields__input_html' );
611
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', array( $this, 'state_form_field_label_wrap' ), 10, 2 );
612
-		add_filter( 'FHEE__EEH_Form_Fields__input_html', array( $this, 'state_form_field_input__wrap' ), 10, 2 );
613
-		$states = EEM_State::instance()->get_all_states_for_these_countries( array( $CNT_ISO => $CNT_ISO ));
609
+		remove_all_filters('FHEE__EEH_Form_Fields__label_html');
610
+		remove_all_filters('FHEE__EEH_Form_Fields__input_html');
611
+		add_filter('FHEE__EEH_Form_Fields__label_html', array($this, 'state_form_field_label_wrap'), 10, 2);
612
+		add_filter('FHEE__EEH_Form_Fields__input_html', array($this, 'state_form_field_input__wrap'), 10, 2);
613
+		$states = EEM_State::instance()->get_all_states_for_these_countries(array($CNT_ISO => $CNT_ISO));
614 614
 
615 615
 //			echo '<h4>$CNT_ISO : ' . $CNT_ISO . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
616 616
 //			global $wpdb;
617 617
 //			echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
618 618
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
619
-		if ( $states ) {
620
-			foreach ( $states as $STA_ID => $state ) {
621
-				if ( $state instanceof EE_State ) {
619
+		if ($states) {
620
+			foreach ($states as $STA_ID => $state) {
621
+				if ($state instanceof EE_State) {
622 622
 					//STA_abbrev 	STA_name 	STA_active
623 623
 					$state_input_types = array(
624
-						'STA_abbrev' => array( 'type' => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'mid-text' ),
625
-						'STA_name'   => array( 'type'       => 'TEXT', 'input_name' => 'states[' . $STA_ID . ']', 'class' => 'regular-text' ),
626
-						'STA_active' => array( 'type' => 'RADIO_BTN', 'input_name' => 'states[' . $STA_ID . ']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true )
624
+						'STA_abbrev' => array('type' => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'mid-text'),
625
+						'STA_name'   => array('type'       => 'TEXT', 'input_name' => 'states['.$STA_ID.']', 'class' => 'regular-text'),
626
+						'STA_active' => array('type' => 'RADIO_BTN', 'input_name' => 'states['.$STA_ID.']', 'options' => $this->_yes_no_values, 'use_desc_4_label' => true)
627 627
 					);
628
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'inputs' ] = EE_Question_Form_Input::generate_question_form_inputs_for_object( $state, $state_input_types );
629
-					$query_args = array( 'action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev() );
630
-					$this->_template_args[ 'states' ][ $STA_ID ][ 'delete_state_url' ] = EE_Admin_Page::add_query_args_and_nonce( $query_args, GEN_SET_ADMIN_URL );
628
+					$this->_template_args['states'][$STA_ID]['inputs'] = EE_Question_Form_Input::generate_question_form_inputs_for_object($state, $state_input_types);
629
+					$query_args = array('action'     => 'delete_state', 'STA_ID' => $STA_ID, 'CNT_ISO' => $CNT_ISO, 'STA_abbrev' => $state->abbrev());
630
+					$this->_template_args['states'][$STA_ID]['delete_state_url'] = EE_Admin_Page::add_query_args_and_nonce($query_args, GEN_SET_ADMIN_URL);
631 631
 				}
632 632
 			}
633 633
 		} else {
634 634
 			$this->_template_args['states'] = FALSE;
635 635
 		}
636 636
 //		EEH_Debug_Tools::printr( $this->_template_args['states'], 'states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
637
-		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'add_new_state' ),  GEN_SET_ADMIN_URL );
637
+		$this->_template_args['add_new_state_url'] = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'add_new_state'), GEN_SET_ADMIN_URL);
638 638
 
639
-		$state_details_settings = EEH_Template::display_template( GEN_SET_TEMPLATE_PATH . 'state_details_settings.template.php', $this->_template_args, TRUE );
639
+		$state_details_settings = EEH_Template::display_template(GEN_SET_TEMPLATE_PATH.'state_details_settings.template.php', $this->_template_args, TRUE);
640 640
 
641
-		if ( defined( 'DOING_AJAX' )) {
642
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
643
-			echo json_encode( array( 'return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors'] ));
641
+		if (defined('DOING_AJAX')) {
642
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
643
+			echo json_encode(array('return_data' => $state_details_settings, 'success' => $notices['success'], 'errors' => $notices['errors']));
644 644
 			die();
645 645
 		} else {
646 646
 			return $state_details_settings;
@@ -661,40 +661,39 @@  discard block
 block discarded – undo
661 661
 
662 662
 		$success = TRUE;
663 663
 
664
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
665
-		if ( ! $CNT_ISO ) {
666
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
664
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
665
+		if ( ! $CNT_ISO) {
666
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
667 667
 			$success = FALSE;
668 668
 		}
669
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
670
-		if ( ! $STA_abbrev ) {
671
-			EE_Error::add_error( __( 'No State ISO code or an invalid State ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
669
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
670
+		if ( ! $STA_abbrev) {
671
+			EE_Error::add_error(__('No State ISO code or an invalid State ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
672 672
 			$success = FALSE;
673 673
 		}
674
-		$STA_name = isset( $this->_req_data['STA_name'] ) ?  sanitize_text_field( $this->_req_data['STA_name'] ) :
675
-			FALSE;
676
-		if ( ! $STA_name ) {
677
-			EE_Error::add_error( __( 'No State name or an invalid State name was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
674
+		$STA_name = isset($this->_req_data['STA_name']) ? sanitize_text_field($this->_req_data['STA_name']) : FALSE;
675
+		if ( ! $STA_name) {
676
+			EE_Error::add_error(__('No State name or an invalid State name was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
678 677
 			$success = FALSE;
679 678
 		}
680 679
 
681
-		if ( $success ) {
680
+		if ($success) {
682 681
 			$cols_n_values = array(
683 682
 				'CNT_ISO' => $CNT_ISO,
684 683
 				'STA_abbrev' => $STA_abbrev,
685 684
 				'STA_name' => $STA_name,
686 685
 				'STA_active' => TRUE
687 686
 			);
688
-			$success = EEM_State::instance()->insert ( $cols_n_values );
689
-			EE_Error::add_success( __( 'The State was added successfully.', 'event_espresso' ) );
687
+			$success = EEM_State::instance()->insert($cols_n_values);
688
+			EE_Error::add_success(__('The State was added successfully.', 'event_espresso'));
690 689
 		}
691 690
 
692
-		if ( defined( 'DOING_AJAX' )) {
693
-			$notices = EE_Error::get_notices( FALSE, FALSE, FALSE );
694
-			echo json_encode( array_merge( $notices, array( 'return_data' => $CNT_ISO ) ) );
691
+		if (defined('DOING_AJAX')) {
692
+			$notices = EE_Error::get_notices(FALSE, FALSE, FALSE);
693
+			echo json_encode(array_merge($notices, array('return_data' => $CNT_ISO)));
695 694
 			die();
696 695
 		} else {
697
-			$this->_redirect_after_action( $success, 'State', 'added', array( 'action' => 'country_settings' ) );
696
+			$this->_redirect_after_action($success, 'State', 'added', array('action' => 'country_settings'));
698 697
 		}
699 698
 	}
700 699
 
@@ -707,25 +706,25 @@  discard block
 block discarded – undo
707 706
 	 * 		@return 		boolean | void
708 707
 	 */
709 708
 	public function delete_state() {
710
-		$CNT_ISO = isset( $this->_req_data['CNT_ISO'] ) ? strtoupper( sanitize_text_field( $this->_req_data['CNT_ISO'] )) : FALSE;
711
-		$STA_ID = isset( $this->_req_data['STA_ID'] ) ? sanitize_text_field( $this->_req_data['STA_ID'] ) : FALSE;
712
-		$STA_abbrev = isset( $this->_req_data['STA_abbrev'] ) ? sanitize_text_field( $this->_req_data['STA_abbrev'] ) : FALSE;
713
-		if ( ! $STA_ID ) {
714
-			EE_Error::add_error( __( 'No State ID or an invalid State ID was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
709
+		$CNT_ISO = isset($this->_req_data['CNT_ISO']) ? strtoupper(sanitize_text_field($this->_req_data['CNT_ISO'])) : FALSE;
710
+		$STA_ID = isset($this->_req_data['STA_ID']) ? sanitize_text_field($this->_req_data['STA_ID']) : FALSE;
711
+		$STA_abbrev = isset($this->_req_data['STA_abbrev']) ? sanitize_text_field($this->_req_data['STA_abbrev']) : FALSE;
712
+		if ( ! $STA_ID) {
713
+			EE_Error::add_error(__('No State ID or an invalid State ID was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
715 714
 			return FALSE;
716 715
 		}
717
-		$success = EEM_State::instance()->delete_by_ID( $STA_ID );
718
-		if ( $success !== FALSE ) {
719
-			do_action( 'AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array( 'STA_abbrev' => $STA_abbrev ));
720
-			EE_Error::add_success( __( 'The State was deleted successfully.', 'event_espresso' ));
716
+		$success = EEM_State::instance()->delete_by_ID($STA_ID);
717
+		if ($success !== FALSE) {
718
+			do_action('AHEE__General_Settings_Admin_Page__delete_state__state_deleted', $CNT_ISO, $STA_ID, array('STA_abbrev' => $STA_abbrev));
719
+			EE_Error::add_success(__('The State was deleted successfully.', 'event_espresso'));
721 720
 		}
722
-		if ( defined( 'DOING_AJAX' )) {
723
-			$notices = EE_Error::get_notices( FALSE, FALSE );
721
+		if (defined('DOING_AJAX')) {
722
+			$notices = EE_Error::get_notices(FALSE, FALSE);
724 723
 			$notices['return_data'] = TRUE;
725
-			echo json_encode( $notices );
724
+			echo json_encode($notices);
726 725
 			die();
727 726
 		} else {
728
-			$this->_redirect_after_action( $success, 'State', 'deleted', array( 'action' => 'country_settings' ) );
727
+			$this->_redirect_after_action($success, 'State', 'deleted', array('action' => 'country_settings'));
729 728
 		}
730 729
 	}
731 730
 
@@ -741,63 +740,63 @@  discard block
 block discarded – undo
741 740
 	protected function _update_country_settings() {
742 741
 //		EEH_Debug_Tools::printr( $this->_req_data, '$this->_req_data  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
743 742
 		// grab the country ISO code
744
-		$CNT_ISO = isset( $this->_req_data['country'] ) ? strtoupper( sanitize_text_field( $this->_req_data['country'] )) : FALSE;
745
-		if ( ! $CNT_ISO ) {
746
-			EE_Error::add_error( __( 'No Country ISO code or an invalid Country ISO code was received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ );
743
+		$CNT_ISO = isset($this->_req_data['country']) ? strtoupper(sanitize_text_field($this->_req_data['country'])) : FALSE;
744
+		if ( ! $CNT_ISO) {
745
+			EE_Error::add_error(__('No Country ISO code or an invalid Country ISO code was received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
747 746
 			return;
748 747
 		}
749 748
 		$cols_n_values = array();
750
-		$cols_n_values['CNT_ISO3'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'] )) : FALSE;
751
-		$cols_n_values['RGN_ID'] = isset( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['RGN_ID'] ) : NULL;
752
-		$cols_n_values['CNT_name'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_name'] ) : NULL;
753
-		$cols_n_values['CNT_cur_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] ) ? strtoupper( sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'] )) : 'USD';
754
-		$cols_n_values['CNT_cur_single'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single'] ) : 'dollar';
755
-		$cols_n_values['CNT_cur_plural'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural'] ) : 'dollars';
756
-		$cols_n_values['CNT_cur_sign'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign'] ) : '$';
757
-		$cols_n_values['CNT_cur_sign_b4'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4'] ) : TRUE;
758
-		$cols_n_values['CNT_cur_dec_plc'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc'] ) : 2;
759
-		$cols_n_values['CNT_cur_dec_mrk'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk'] ) : '.';
760
-		$cols_n_values['CNT_cur_thsnds'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds'] ) : ',';
761
-		$cols_n_values['CNT_tel_code'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) ? sanitize_text_field( $this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code'] ) : NULL;
762
-		$cols_n_values['CNT_is_EU'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU'] ) : FALSE;
763
-		$cols_n_values['CNT_active'] = isset( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) ? absint( $this->_req_data['cntry'][$CNT_ISO]['CNT_active'] ) : FALSE;
749
+		$cols_n_values['CNT_ISO3'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_ISO3'])) : FALSE;
750
+		$cols_n_values['RGN_ID'] = isset($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) ? absint($this->_req_data['cntry'][$CNT_ISO]['RGN_ID']) : NULL;
751
+		$cols_n_values['CNT_name'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_name']) : NULL;
752
+		$cols_n_values['CNT_cur_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code']) ? strtoupper(sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_code'])) : 'USD';
753
+		$cols_n_values['CNT_cur_single'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_single']) : 'dollar';
754
+		$cols_n_values['CNT_cur_plural'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_plural']) : 'dollars';
755
+		$cols_n_values['CNT_cur_sign'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign']) : '$';
756
+		$cols_n_values['CNT_cur_sign_b4'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_sign_b4']) : TRUE;
757
+		$cols_n_values['CNT_cur_dec_plc'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_plc']) : 2;
758
+		$cols_n_values['CNT_cur_dec_mrk'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_dec_mrk']) : '.';
759
+		$cols_n_values['CNT_cur_thsnds'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_cur_thsnds']) : ',';
760
+		$cols_n_values['CNT_tel_code'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) ? sanitize_text_field($this->_req_data['cntry'][$CNT_ISO]['CNT_tel_code']) : NULL;
761
+		$cols_n_values['CNT_is_EU'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_is_EU']) : FALSE;
762
+		$cols_n_values['CNT_active'] = isset($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) ? absint($this->_req_data['cntry'][$CNT_ISO]['CNT_active']) : FALSE;
764 763
 		// allow filtering of country data
765
-		$cols_n_values = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values );
764
+		$cols_n_values = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__cols_n_values', $cols_n_values);
766 765
 		//EEH_Debug_Tools::printr( $cols_n_values, '$cols_n_values  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
767 766
 		// where values
768
-		$where_cols_n_values = array( array( 'CNT_ISO' => $CNT_ISO ));
767
+		$where_cols_n_values = array(array('CNT_ISO' => $CNT_ISO));
769 768
 		// run the update
770
-		$success = EEM_Country::instance()->update( $cols_n_values, $where_cols_n_values );
769
+		$success = EEM_Country::instance()->update($cols_n_values, $where_cols_n_values);
771 770
 //		global $wpdb;
772 771
 //		echo '<h4>' . $wpdb->last_query . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
773 772
 //		echo '<h4>$success : ' . $success . '  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
774
-		if ( isset( $this->_req_data['states'] ) && is_array( $this->_req_data['states'] ) && $success !== FALSE ) {
773
+		if (isset($this->_req_data['states']) && is_array($this->_req_data['states']) && $success !== FALSE) {
775 774
 			// allow filtering of states data
776
-			$states = apply_filters( 'FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states'] );
775
+			$states = apply_filters('FHEE__General_Settings_Admin_Page___update_country_settings__states', $this->_req_data['states']);
777 776
 //			EEH_Debug_Tools::printr( $states, '$states  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
778 777
 			// loop thru state data ( looks like : states[75][STA_name] )
779
-			foreach( $states as $STA_ID => $state ) {
778
+			foreach ($states as $STA_ID => $state) {
780 779
 				$cols_n_values = array(
781 780
 					'CNT_ISO' 		=> $CNT_ISO,
782
-					'STA_abbrev' => sanitize_text_field( $state['STA_abbrev'] ),
783
-					'STA_name' 	=> sanitize_text_field( $state['STA_name'] ),
784
-					'STA_active' 	=> (bool)absint( $state['STA_active'] )
781
+					'STA_abbrev' => sanitize_text_field($state['STA_abbrev']),
782
+					'STA_name' 	=> sanitize_text_field($state['STA_name']),
783
+					'STA_active' 	=> (bool) absint($state['STA_active'])
785 784
 				);
786 785
 				// where values
787
-				$where_cols_n_values = array( array( 'STA_ID' => $STA_ID ));
786
+				$where_cols_n_values = array(array('STA_ID' => $STA_ID));
788 787
 				// run the update
789
-				$success = EEM_State::instance()->update( $cols_n_values, $where_cols_n_values );
790
-				if ( $success !== FALSE ) {
791
-					do_action( 'AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values );
788
+				$success = EEM_State::instance()->update($cols_n_values, $where_cols_n_values);
789
+				if ($success !== FALSE) {
790
+					do_action('AHEE__General_Settings_Admin_Page__update_country_settings__state_saved', $CNT_ISO, $STA_ID, $cols_n_values);
792 791
 				}
793 792
 			}
794 793
 		}
795 794
 		// check if country being edited matches org option country, and if so, then  update EE_Config with new settings
796
-		if ( isset( EE_Registry::instance()->CFG->organization->CNT_ISO ) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO ) {
797
-			EE_Registry::instance()->CFG->currency = new EE_Currency_Config( $CNT_ISO );
795
+		if (isset(EE_Registry::instance()->CFG->organization->CNT_ISO) && $CNT_ISO == EE_Registry::instance()->CFG->organization->CNT_ISO) {
796
+			EE_Registry::instance()->CFG->currency = new EE_Currency_Config($CNT_ISO);
798 797
 			EE_Registry::instance()->CFG->update_espresso_config();
799 798
 		}
800
-		$this->_redirect_after_action( $success, 'Countries', 'updated', array( 'action' => 'country_settings', 'country' => $CNT_ISO ));
799
+		$this->_redirect_after_action($success, 'Countries', 'updated', array('action' => 'country_settings', 'country' => $CNT_ISO));
801 800
 	}
802 801
 
803 802
 
@@ -811,11 +810,11 @@  discard block
 block discarded – undo
811 810
 	 * 		@param 		string 		$label
812 811
 	 * 		@return 		string
813 812
 	 */
814
-	public function country_form_field_label_wrap( $label, $required_text ) {
813
+	public function country_form_field_label_wrap($label, $required_text) {
815 814
 		return '
816 815
 			<tr>
817 816
 				<th>
818
-					' . $label  . '
817
+					' . $label.'
819 818
 				</th>';
820 819
 	}
821 820
 
@@ -829,10 +828,10 @@  discard block
 block discarded – undo
829 828
 	 * 		@param 		string 		$label
830 829
 	 * 		@return 		string
831 830
 	 */
832
-	public function country_form_field_input__wrap( $input, $label ) {
831
+	public function country_form_field_input__wrap($input, $label) {
833 832
 		return '
834 833
 				<td class="general-settings-country-input-td">
835
-					' . $input . '
834
+					' . $input.'
836 835
 				</td>
837 836
 			</tr>';
838 837
 	}
@@ -848,7 +847,7 @@  discard block
 block discarded – undo
848 847
 	 * 		@param 		string 		$required_text
849 848
 	 * 		@return 		string
850 849
 	 */
851
-	public function state_form_field_label_wrap( $label, $required_text  ) {
850
+	public function state_form_field_label_wrap($label, $required_text) {
852 851
 		return $required_text;
853 852
 	}
854 853
 
@@ -862,10 +861,10 @@  discard block
 block discarded – undo
862 861
 	 * 		@param 		string 		$label
863 862
 	 * 		@return 		string
864 863
 	 */
865
-	public function state_form_field_input__wrap( $input, $label ) {
864
+	public function state_form_field_input__wrap($input, $label) {
866 865
 		return '
867 866
 				<td class="general-settings-country-state-input-td">
868
-					' . $input . '
867
+					' . $input.'
869 868
 				</td>';
870 869
 
871 870
 	}
@@ -888,10 +887,10 @@  discard block
 block discarded – undo
888 887
 	 * @param int $ee_page_id
889 888
 	 * @return string
890 889
 	 */
891
-	public static function edit_view_links( $ee_page_id ) {
892
-		$links = '<a href="' . add_query_arg( array( 'post' => $ee_page_id, 'action' => 'edit' ),  admin_url( 'post.php' )) . '" >' . __('Edit', 'event_espresso') . '</a>';
890
+	public static function edit_view_links($ee_page_id) {
891
+		$links = '<a href="'.add_query_arg(array('post' => $ee_page_id, 'action' => 'edit'), admin_url('post.php')).'" >'.__('Edit', 'event_espresso').'</a>';
893 892
 		$links .= ' &nbsp;|&nbsp; ';
894
-		$links .= '<a href="' . get_permalink( $ee_page_id ) . '" >' . __('View', 'event_espresso') . '</a>';
893
+		$links .= '<a href="'.get_permalink($ee_page_id).'" >'.__('View', 'event_espresso').'</a>';
895 894
 		return $links;
896 895
 	}
897 896
 
@@ -904,27 +903,27 @@  discard block
 block discarded – undo
904 903
 	 * @param WP page object $ee_page
905 904
 	 * @return string
906 905
 	 */
907
-	public static function page_and_shortcode_status( $ee_page, $shortcode ) {
906
+	public static function page_and_shortcode_status($ee_page, $shortcode) {
908 907
 
909 908
 		// page status
910
-		if ( isset( $ee_page->post_status ) && $ee_page->post_status == 'publish') {
909
+		if (isset($ee_page->post_status) && $ee_page->post_status == 'publish') {
911 910
 			$pg_colour = 'green';
912
-			$pg_status = sprintf( __('Page%sStatus%sOK', 'event_espresso'), '&nbsp;' , '&nbsp;' );
911
+			$pg_status = sprintf(__('Page%sStatus%sOK', 'event_espresso'), '&nbsp;', '&nbsp;');
913 912
 		 } else {
914 913
 			$pg_colour = 'red';
915
-			$pg_status = sprintf( __('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;'  );
914
+			$pg_status = sprintf(__('Page%sVisibility%sProblem', 'event_espresso'), '&nbsp;', '&nbsp;');
916 915
 		}
917 916
 
918 917
 		// shortcode status
919
-		if ( isset( $ee_page->post_content ) && strpos( $ee_page->post_content, $shortcode ) !== FALSE ) {
918
+		if (isset($ee_page->post_content) && strpos($ee_page->post_content, $shortcode) !== FALSE) {
920 919
 			$sc_colour = 'green';
921
-			$sc_status = sprintf( __('Shortcode%sOK', 'event_espresso'), '&nbsp;' );
920
+			$sc_status = sprintf(__('Shortcode%sOK', 'event_espresso'), '&nbsp;');
922 921
 		 } else {
923 922
 			$sc_colour = 'red';
924
-			$sc_status = sprintf( __('Shortcode%sProblem', 'event_espresso'), '&nbsp;' );
923
+			$sc_status = sprintf(__('Shortcode%sProblem', 'event_espresso'), '&nbsp;');
925 924
 		}
926 925
 
927
-		return '<span style="color:' . $pg_colour . '; margin-right:2em;"><strong>' . $pg_status . '</strong></span><span style="color:' . $sc_colour . '"><strong>' . $sc_status . '</strong></span>';
926
+		return '<span style="color:'.$pg_colour.'; margin-right:2em;"><strong>'.$pg_status.'</strong></span><span style="color:'.$sc_colour.'"><strong>'.$sc_status.'</strong></span>';
928 927
 
929 928
 	}
930 929
 
@@ -939,20 +938,20 @@  discard block
 block discarded – undo
939 938
 	 * @param unknown_type $level
940 939
 	 * @return unknown
941 940
 	 */
942
-	public static function page_settings_dropdown( $default = 0, $parent = 0, $level = 0 ) {
941
+	public static function page_settings_dropdown($default = 0, $parent = 0, $level = 0) {
943 942
 		global $wpdb;
944
-		$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent) );
943
+		$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' AND post_status != 'trash' ORDER BY menu_order", $parent));
945 944
 
946
-		if ( $items ) {
947
-			foreach ( $items as $item ) {
948
-				$pad = str_repeat( '&nbsp;', $level * 3 );
949
-				if ( $item->ID == $default)
945
+		if ($items) {
946
+			foreach ($items as $item) {
947
+				$pad = str_repeat('&nbsp;', $level * 3);
948
+				if ($item->ID == $default)
950 949
 					$current = ' selected="selected"';
951 950
 				else
952 951
 					$current = '';
953 952
 
954
-				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . esc_html($item->post_title) . "</option>";
955
-				parent_dropdown( $default, $item->ID, $level +1 );
953
+				echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad ".esc_html($item->post_title)."</option>";
954
+				parent_dropdown($default, $item->ID, $level + 1);
956 955
 			}
957 956
 		} else {
958 957
 			return false;
Please login to merge, or discard this patch.
admin_pages/venues/Venues_Admin_Page.core.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 
63 63
 
64 64
 	protected function _init_page_props() {
65
-		require_once( EE_MODELS . 'EEM_Venue.model.php' );
65
+		require_once(EE_MODELS.'EEM_Venue.model.php');
66 66
 		$this->page_slug = EE_VENUES_PG_SLUG;
67 67
 		$this->_admin_base_url = EE_VENUES_ADMIN_URL;
68
-		$this->_admin_base_path = EE_ADMIN_PAGES . 'venues';
68
+		$this->_admin_base_path = EE_ADMIN_PAGES.'venues';
69 69
 		$this->page_label = __('Event Venues', 'event_espresso');
70 70
 		$this->_cpt_model_names = array(
71 71
 			'create_new' => 'EEM_Venue',
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 				'edit' => __('Update Venue', 'event_espresso'),
109 109
 				'add_category' => __('Save New Category', 'event_espresso'),
110 110
 				'edit_category' => __('Update Category', 'event_espresso'),
111
-				'google_map_settings' => __( 'Update Settings', 'event_espresso' )
111
+				'google_map_settings' => __('Update Settings', 'event_espresso')
112 112
 				)
113 113
 		);
114 114
 	}
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
 		//load field generator helper
124 124
 
125 125
 		//is there a vnu_id in the request?
126
-		$vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0;
127
-		$vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id;
126
+		$vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0;
127
+		$vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id;
128 128
 
129 129
 		$this->_page_routes = array(
130 130
 			'default' => array(
@@ -142,27 +142,27 @@  discard block
 block discarded – undo
142 142
 				),
143 143
 			'trash_venue' => array(
144 144
 				'func' => '_trash_or_restore_venue',
145
-				'args' => array( 'venue_status' => 'trash' ),
145
+				'args' => array('venue_status' => 'trash'),
146 146
 				'noheader' => TRUE,
147 147
 				'capability' => 'ee_delete_venue',
148 148
 				'obj_id' => $vnu_id
149 149
 				),
150 150
 			'trash_venues' => array(
151 151
 				'func' => '_trash_or_restore_venues',
152
-				'args' => array( 'venue_status' => 'trash' ),
152
+				'args' => array('venue_status' => 'trash'),
153 153
 				'noheader' => TRUE,
154 154
 				'capability' => 'ee_delete_venues'
155 155
 				),
156 156
 			'restore_venue' => array(
157 157
 				'func' => '_trash_or_restore_venue',
158
-				'args' => array( 'venue_status' => 'draft' ),
158
+				'args' => array('venue_status' => 'draft'),
159 159
 				'noheader' => TRUE,
160 160
 				'capability' => 'ee_delete_venue',
161 161
 				'obj_id' => $vnu_id
162 162
 				),
163 163
 			'restore_venues' => array(
164 164
 				'func' => '_trash_or_restore_venues',
165
-				'args' => array( 'venue_status' => 'draft' ),
165
+				'args' => array('venue_status' => 'draft'),
166 166
 				'noheader' => TRUE,
167 167
 				'capability' => 'ee_delete_venues'
168 168
 				),
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 						'filename' => 'venues_overview_views_bulk_actions_search'
265 265
 					)
266 266
 				),
267
-				'help_tour' => array( 'Venues_Overview_Help_Tour' ),
267
+				'help_tour' => array('Venues_Overview_Help_Tour'),
268 268
 				'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'),
269 269
 				'require_nonce' => FALSE
270 270
 			),
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 						'filename' => 'venues_editor_other'
301 301
 					)
302 302
 				),
303
-				'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ),
303
+				'help_tour' => array('Venues_Add_Venue_Help_Tour'),
304 304
 				'metaboxes' => array('_venue_editor_metaboxes'),
305 305
 				'require_nonce' => FALSE
306 306
 				),
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 					'label' => __('Edit Venue', 'event_espresso'),
310 310
 					'order' => 5,
311 311
 					'persistent' => FALSE,
312
-					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url )  : $this->_admin_base_url
312
+					'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url
313 313
 				),
314 314
 				'help_tabs' => array(
315 315
 					'venues_editor_help_tab' => array(
@@ -346,14 +346,14 @@  discard block
 block discarded – undo
346 346
 					'label' => __('Google Maps'),
347 347
 					'order' => 40
348 348
 				),
349
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
349
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
350 350
 				'help_tabs' => array(
351 351
 					'general_settings_google_maps_help_tab' => array(
352 352
 						'title' => __('Google Maps', 'event_espresso'),
353 353
 						'filename' => 'general_settings_google_maps'
354 354
 					)
355 355
 				),
356
-				'help_tour' => array( 'Google_Maps_Help_Tour' ),
356
+				'help_tour' => array('Google_Maps_Help_Tour'),
357 357
 				'require_nonce' => FALSE
358 358
 			),
359 359
 			//venue category stuff
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 						'filename' => 'venues_add_category'
370 370
 					)
371 371
 				),
372
-				'help_tour' => array( 'Venues_Add_Category_Help_Tour' ),
372
+				'help_tour' => array('Venues_Add_Category_Help_Tour'),
373 373
 				'require_nonce' => FALSE
374 374
 				),
375 375
 			'edit_category' => array(
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 					'label' => __('Edit Category', 'event_espresso'),
378 378
 					'order' => 15,
379 379
 					'persistent' => FALSE,
380
-					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url )  : $this->_admin_base_url
380
+					'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url
381 381
 					),
382 382
 				'metaboxes' => array('_publish_post_box'),
383 383
 				'help_tabs' => array(
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 						'filename' => 'venues_categories_other'
414 414
 					)
415 415
 				),
416
-				'help_tour' => array( 'Venues_Categories_Help_Tour' ),
416
+				'help_tour' => array('Venues_Categories_Help_Tour'),
417 417
 				'metaboxes' => $this->_default_espresso_metaboxes,
418 418
 				'require_nonce' => FALSE
419 419
 				)
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
 
471 471
 
472 472
 	public function load_scripts_styles() {
473
-		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION );
473
+		wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION);
474 474
 		wp_enqueue_style('ee-cat-admin');
475 475
 	}
476 476
 
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 	public function load_scripts_styles_edit() {
494 494
 		//styles
495 495
 		wp_enqueue_style('espresso-ui-theme');
496
-		wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION );
496
+		wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION);
497 497
 		wp_enqueue_style('espresso_venues');
498 498
 	}
499 499
 
@@ -512,13 +512,13 @@  discard block
 block discarded – undo
512 512
 				)
513 513
 		);
514 514
 
515
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) {
515
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) {
516 516
 			$this->_views['all']['bulk_action'] = array(
517 517
 				'trash_venues' => __('Move to Trash', 'event_espresso')
518 518
 			);
519 519
 			$this->_views['trash'] = array(
520 520
 				'slug' => 'trash',
521
-				'label' => __( 'Trash', 'event_espresso' ),
521
+				'label' => __('Trash', 'event_espresso'),
522 522
 				'count' => 0,
523 523
 				'bulk_action' => array(
524 524
 					'restore_venues' => __('Restore from Trash', 'event_espresso'),
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 
552 552
 
553 553
 	protected function _overview_list_table() {
554
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
555
-		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' );
554
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
555
+		$this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button');
556 556
 		$this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2');
557 557
 		$this->_search_btn_label = __('Venues', 'event_espresso');
558 558
 		$this->display_admin_list_table_page_with_sidebar();
@@ -566,8 +566,8 @@  discard block
 block discarded – undo
566 566
 			'vnu_url' => $this->_cpt_model_obj->venue_url(),
567 567
 			'vnu_phone' => $this->_cpt_model_obj->phone()
568 568
 			);
569
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php';
570
-		EEH_Template::display_template( $template, $extra_rows );
569
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php';
570
+		EEH_Template::display_template($template, $extra_rows);
571 571
 	}
572 572
 
573 573
 
@@ -582,115 +582,115 @@  discard block
 block discarded – undo
582 582
 		$default_map_settings = new stdClass();
583 583
 		$default_map_settings->use_google_maps = TRUE;
584 584
 		// for event details pages (reg page)
585
-		$default_map_settings->event_details_map_width = 585; 			// ee_map_width_single
586
-		$default_map_settings->event_details_map_height = 362; 			// ee_map_height_single
587
-		$default_map_settings->event_details_map_zoom = 14; 			// ee_map_zoom_single
588
-		$default_map_settings->event_details_display_nav = TRUE; 			// ee_map_nav_display_single
589
-		$default_map_settings->event_details_nav_size = FALSE; 			// ee_map_nav_size_single
590
-		$default_map_settings->event_details_control_type = 'default'; 		// ee_map_type_control_single
591
-		$default_map_settings->event_details_map_align = 'center'; 			// ee_map_align_single
585
+		$default_map_settings->event_details_map_width = 585; // ee_map_width_single
586
+		$default_map_settings->event_details_map_height = 362; // ee_map_height_single
587
+		$default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single
588
+		$default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single
589
+		$default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single
590
+		$default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single
591
+		$default_map_settings->event_details_map_align = 'center'; // ee_map_align_single
592 592
 		// for event list pages
593
-		$default_map_settings->event_list_map_width = 300; 			// ee_map_width
594
-		$default_map_settings->event_list_map_height = 185; 		// ee_map_height
595
-		$default_map_settings->event_list_map_zoom = 12; 			// ee_map_zoom
596
-		$default_map_settings->event_list_display_nav = FALSE; 		// ee_map_nav_display
597
-		$default_map_settings->event_list_nav_size = TRUE; 			// ee_map_nav_size
598
-		$default_map_settings->event_list_control_type = 'dropdown'; 		// ee_map_type_control
599
-		$default_map_settings->event_list_map_align = 'center'; 			// ee_map_align
593
+		$default_map_settings->event_list_map_width = 300; // ee_map_width
594
+		$default_map_settings->event_list_map_height = 185; // ee_map_height
595
+		$default_map_settings->event_list_map_zoom = 12; // ee_map_zoom
596
+		$default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display
597
+		$default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size
598
+		$default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control
599
+		$default_map_settings->event_list_map_align = 'center'; // ee_map_align
600 600
 
601 601
 		$this->_template_args['map_settings'] =
602
-			isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings )
603
-				? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings )
602
+			isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings)
603
+				? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings)
604 604
 				: $default_map_settings;
605 605
 
606
-		$this->_set_add_edit_form_tags( 'update_google_map_settings' );
607
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
608
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', $this->_template_args, TRUE );
606
+		$this->_set_add_edit_form_tags('update_google_map_settings');
607
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
608
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_VENUES_TEMPLATE_PATH.'google_map.template.php', $this->_template_args, TRUE);
609 609
 		$this->display_admin_page_with_sidebar();
610 610
 	}
611 611
 
612 612
 	protected function _update_google_map_settings() {
613 613
 
614 614
 		EE_Registry::instance()->CFG->map_settings->use_google_maps =
615
-			isset( $this->_req_data['use_google_maps'] )
616
-				? absint( $this->_req_data['use_google_maps'] )
615
+			isset($this->_req_data['use_google_maps'])
616
+				? absint($this->_req_data['use_google_maps'])
617 617
 				: EE_Registry::instance()->CFG->map_settings->use_google_maps;
618 618
 
619 619
 		EE_Registry::instance()->CFG->map_settings->event_details_map_width =
620
-			isset( $this->_req_data['event_details_map_width'] )
621
-				? absint( $this->_req_data['event_details_map_width'] )
620
+			isset($this->_req_data['event_details_map_width'])
621
+				? absint($this->_req_data['event_details_map_width'])
622 622
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_width;
623 623
 
624 624
 		EE_Registry::instance()->CFG->map_settings->event_details_map_height =
625
-			isset( $this->_req_data['event_details_map_height'] )
626
-				? absint( $this->_req_data['event_details_map_height'] )
625
+			isset($this->_req_data['event_details_map_height'])
626
+				? absint($this->_req_data['event_details_map_height'])
627 627
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_height;
628 628
 
629 629
 		EE_Registry::instance()->CFG->map_settings->event_details_map_zoom =
630
-			isset( $this->_req_data['event_details_map_zoom'] )
631
-				? absint( $this->_req_data['event_details_map_zoom'] )
630
+			isset($this->_req_data['event_details_map_zoom'])
631
+				? absint($this->_req_data['event_details_map_zoom'])
632 632
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_zoom;
633 633
 
634 634
 		EE_Registry::instance()->CFG->map_settings->event_details_display_nav =
635
-			isset( $this->_req_data['event_details_display_nav'] )
636
-				? absint( $this->_req_data['event_details_display_nav'] )
635
+			isset($this->_req_data['event_details_display_nav'])
636
+				? absint($this->_req_data['event_details_display_nav'])
637 637
 				: EE_Registry::instance()->CFG->map_settings->event_details_display_nav;
638 638
 
639 639
 		EE_Registry::instance()->CFG->map_settings->event_details_nav_size =
640
-			isset( $this->_req_data['event_details_nav_size'] )
641
-				? absint( $this->_req_data['event_details_nav_size'] )
640
+			isset($this->_req_data['event_details_nav_size'])
641
+				? absint($this->_req_data['event_details_nav_size'])
642 642
 				: EE_Registry::instance()->CFG->map_settings->event_details_nav_size;
643 643
 
644 644
 		EE_Registry::instance()->CFG->map_settings->event_details_control_type =
645
-			isset( $this->_req_data['event_details_control_type'] )
646
-				? sanitize_text_field( $this->_req_data['event_details_control_type'] )
645
+			isset($this->_req_data['event_details_control_type'])
646
+				? sanitize_text_field($this->_req_data['event_details_control_type'])
647 647
 				: EE_Registry::instance()->CFG->map_settings->event_details_control_type;
648 648
 
649 649
 		EE_Registry::instance()->CFG->map_settings->event_details_map_align =
650
-			isset( $this->_req_data['event_details_map_align'] )
651
-				? sanitize_text_field( $this->_req_data['event_details_map_align'] )
650
+			isset($this->_req_data['event_details_map_align'])
651
+				? sanitize_text_field($this->_req_data['event_details_map_align'])
652 652
 				: EE_Registry::instance()->CFG->map_settings->event_details_map_align;
653 653
 
654 654
 		EE_Registry::instance()->CFG->map_settings->event_list_map_width =
655
-			isset( $this->_req_data['event_list_map_width'] )
656
-				? absint( $this->_req_data['event_list_map_width'] )
655
+			isset($this->_req_data['event_list_map_width'])
656
+				? absint($this->_req_data['event_list_map_width'])
657 657
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_width;
658 658
 
659 659
 		EE_Registry::instance()->CFG->map_settings->event_list_map_height =
660
-			isset( $this->_req_data['event_list_map_height'] )
661
-				? absint( $this->_req_data['event_list_map_height'] )
660
+			isset($this->_req_data['event_list_map_height'])
661
+				? absint($this->_req_data['event_list_map_height'])
662 662
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_height;
663 663
 
664 664
 		EE_Registry::instance()->CFG->map_settings->event_list_map_zoom =
665
-			isset( $this->_req_data['event_list_map_zoom'] )
666
-				? absint( $this->_req_data['event_list_map_zoom'] )
665
+			isset($this->_req_data['event_list_map_zoom'])
666
+				? absint($this->_req_data['event_list_map_zoom'])
667 667
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_zoom;
668 668
 
669 669
 		EE_Registry::instance()->CFG->map_settings->event_list_display_nav =
670
-			isset( $this->_req_data['event_list_display_nav'] )
671
-				? absint( $this->_req_data['event_list_display_nav'] )
670
+			isset($this->_req_data['event_list_display_nav'])
671
+				? absint($this->_req_data['event_list_display_nav'])
672 672
 				: EE_Registry::instance()->CFG->map_settings->event_list_display_nav;
673 673
 
674 674
 		EE_Registry::instance()->CFG->map_settings->event_list_nav_size =
675
-			isset( $this->_req_data['event_list_nav_size'] )
676
-				? absint( $this->_req_data['event_list_nav_size'] )
675
+			isset($this->_req_data['event_list_nav_size'])
676
+				? absint($this->_req_data['event_list_nav_size'])
677 677
 				: EE_Registry::instance()->CFG->map_settings->event_list_nav_size;
678 678
 
679 679
 		EE_Registry::instance()->CFG->map_settings->event_list_control_type =
680
-			isset( $this->_req_data['event_list_control_type'] )
681
-				? sanitize_text_field( $this->_req_data['event_list_control_type'] )
680
+			isset($this->_req_data['event_list_control_type'])
681
+				? sanitize_text_field($this->_req_data['event_list_control_type'])
682 682
 				: EE_Registry::instance()->CFG->map_settings->event_list_control_type;
683 683
 
684 684
 		EE_Registry::instance()->CFG->map_settings->event_list_map_align =
685
-			isset( $this->_req_data['event_list_map_align'] )
686
-				? sanitize_text_field( $this->_req_data['event_list_map_align'] )
685
+			isset($this->_req_data['event_list_map_align'])
686
+				? sanitize_text_field($this->_req_data['event_list_map_align'])
687 687
 				: EE_Registry::instance()->CFG->map_settings->event_list_map_align;
688 688
 
689
-		EE_Registry::instance()->CFG->map_settings = apply_filters( 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings );
689
+		EE_Registry::instance()->CFG->map_settings = apply_filters('FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', EE_Registry::instance()->CFG->map_settings);
690 690
 
691 691
 		$what = 'Google Map Settings';
692
-		$success = $this->_update_espresso_configuration( $what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__ );
693
-		$this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) );
692
+		$success = $this->_update_espresso_configuration($what, EE_Registry::instance()->CFG->map_settings, __FILE__, __FUNCTION__, __LINE__);
693
+		$this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings'));
694 694
 
695 695
 	}
696 696
 
@@ -699,9 +699,9 @@  discard block
 block discarded – undo
699 699
 	protected function _venue_editor_metaboxes() {
700 700
 		$this->verify_cpt_object();
701 701
 
702
-		add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' );
703
-		add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' );
704
-		add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' );
702
+		add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default');
703
+		add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default');
704
+		add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default');
705 705
 
706 706
 	}
707 707
 
@@ -709,23 +709,23 @@  discard block
 block discarded – undo
709 709
 
710 710
 	public function venue_gmap_metabox() {
711 711
 		$template_args = array(
712
-			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ),
712
+			'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()),
713 713
 			'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(),
714 714
 			);
715
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php';
716
-		EEH_Template::display_template( $template, $template_args );
715
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php';
716
+		EEH_Template::display_template($template, $template_args);
717 717
 	}
718 718
 
719 719
 
720 720
 
721 721
 	public function venue_address_metabox() {
722 722
 
723
-		$template_args['_venue'] =$this->_cpt_model_obj;
723
+		$template_args['_venue'] = $this->_cpt_model_obj;
724 724
 
725 725
 		$template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input(
726 726
 			$QFI = new EE_Question_Form_Input(
727
-				EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )),
728
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->state_ID() )),
727
+				EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')),
728
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())),
729 729
 				array(
730 730
 					'input_name' =>  'sta_id',
731 731
 					'input_id' => 'sta_id',
@@ -737,8 +737,8 @@  discard block
 block discarded – undo
737 737
 		);
738 738
 		$template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input(
739 739
 			$QFI = new EE_Question_Form_Input(
740
-				EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )),
741
-				EE_Answer::new_instance( array(  'ANS_value'=> $this->_cpt_model_obj->country_ID() )),
740
+				EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')),
741
+				EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())),
742 742
 				array(
743 743
 					'input_name' =>  'cnt_iso',
744 744
 					'input_id' => 'cnt_iso',
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 			)
750 750
 		);
751 751
 
752
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php';
753
-		EEH_Template::display_template( $template, $template_args );
752
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php';
753
+		EEH_Template::display_template($template, $template_args);
754 754
 	}
755 755
 
756 756
 
@@ -762,8 +762,8 @@  discard block
 block discarded – undo
762 762
 		$template_args = array(
763 763
 			'_venue' => $this->_cpt_model_obj
764 764
 			);
765
-		$template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php';
766
-		EEH_Template::display_template( $template, $template_args );
765
+		$template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php';
766
+		EEH_Template::display_template($template, $template_args);
767 767
 	}
768 768
 
769 769
 
@@ -786,52 +786,52 @@  discard block
 block discarded – undo
786 786
 	 * @param  object $post    Post object (with "blessed" WP properties)
787 787
 	 * @return void
788 788
 	 */
789
-	protected function _insert_update_cpt_item( $post_id, $post ) {
789
+	protected function _insert_update_cpt_item($post_id, $post) {
790 790
 
791
-		if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) {
792
-			return;// get out we're not processing the saving of venues.
791
+		if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') {
792
+			return; // get out we're not processing the saving of venues.
793 793
 		}
794 794
 
795
-		$wheres = array( $this->_venue_model->primary_key_name() => $post_id );
795
+		$wheres = array($this->_venue_model->primary_key_name() => $post_id);
796 796
 
797 797
 		$venue_values = array(
798
-			'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL,
799
-			'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL,
800
-			'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL,
801
-			'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL,
802
-			'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL,
803
-			'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL,
804
-			'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL,
805
-			'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF,
806
-			'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL,
807
-			'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
-			'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
-			'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE,
810
-			'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL
798
+			'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL,
799
+			'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL,
800
+			'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL,
801
+			'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL,
802
+			'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL,
803
+			'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL,
804
+			'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL,
805
+			'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF,
806
+			'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL,
807
+			'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL,
808
+			'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL,
809
+			'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE,
810
+			'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL
811 811
 			);
812 812
 
813 813
 		//update venue
814
-		$success = $this->_venue_model->update( $venue_values, array( $wheres ) );
814
+		$success = $this->_venue_model->update($venue_values, array($wheres));
815 815
 
816 816
 		//get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id!
817
-		$get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status  );
818
-		$venue = $this->_venue_model->get_one( array( $get_one_where ) );
817
+		$get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status);
818
+		$venue = $this->_venue_model->get_one(array($get_one_where));
819 819
 
820 820
 		//notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use.  So this is just here for addons to more easily hook into venue saves.
821
-		$venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() );
821
+		$venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array());
822 822
 
823 823
 		$att_success = TRUE;
824 824
 
825
-		foreach ( $venue_update_callbacks as $v_callback ) {
826
-			$_succ = call_user_func_array( $v_callback, array( $venue,  $this->_req_data ) );
827
-			$att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
825
+		foreach ($venue_update_callbacks as $v_callback) {
826
+			$_succ = call_user_func_array($v_callback, array($venue, $this->_req_data));
827
+			$att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message
828 828
 		}
829 829
 
830 830
 		//any errors?
831
-		if ( $success && !$att_success ) {
832
-			EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
833
-		} else if ( $success === FALSE ) {
834
-			EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ );
831
+		if ($success && ! $att_success) {
832
+			EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
833
+		} else if ($success === FALSE) {
834
+			EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
835 835
 		}
836 836
 	}
837 837
 
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
 
840 840
 
841 841
 
842
-	public function trash_cpt_item( $post_id ) {
842
+	public function trash_cpt_item($post_id) {
843 843
 		$this->_req_data['VNU_ID'] = $post_id;
844
-		$this->_trash_or_restore_venue( 'trash', FALSE );
844
+		$this->_trash_or_restore_venue('trash', FALSE);
845 845
 	}
846 846
 
847 847
 
@@ -849,18 +849,18 @@  discard block
 block discarded – undo
849 849
 
850 850
 
851 851
 
852
-	public function restore_cpt_item( $post_id ) {
852
+	public function restore_cpt_item($post_id) {
853 853
 		$this->_req_data['VNU_ID'] = $post_id;
854
-		$this->_trash_or_restore_venue( 'draft', FALSE );
854
+		$this->_trash_or_restore_venue('draft', FALSE);
855 855
 	}
856 856
 
857 857
 
858 858
 
859 859
 
860 860
 
861
-	public function delete_cpt_item( $post_id ) {
861
+	public function delete_cpt_item($post_id) {
862 862
 		$this->_req_data['VNU_ID'] = $post_id;
863
-		$this->_delete_venue( FALSE );
863
+		$this->_delete_venue(FALSE);
864 864
 	}
865 865
 
866 866
 
@@ -875,15 +875,15 @@  discard block
 block discarded – undo
875 875
 
876 876
 
877 877
 
878
-	protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) {
879
-		$VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE;
878
+	protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) {
879
+		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE;
880 880
 
881 881
 		//loop thru venues
882
-		if ( $VNU_ID ) {
882
+		if ($VNU_ID) {
883 883
 			//clean status
884
-			$venue_status = sanitize_key( $venue_status );
884
+			$venue_status = sanitize_key($venue_status);
885 885
 			// grab status
886
-			if (!empty($venue_status)) {
886
+			if ( ! empty($venue_status)) {
887 887
 				$success = $this->_change_venue_status($VNU_ID, $venue_status);
888 888
 			} else {
889 889
 				$success = FALSE;
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
 		}
898 898
 		$action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash';
899 899
 
900
-		if ( $redirect_after )
900
+		if ($redirect_after)
901 901
 			$this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default'));
902 902
 
903 903
 	}
@@ -906,11 +906,11 @@  discard block
 block discarded – undo
906 906
 
907 907
 
908 908
 
909
-	protected function _trash_or_restore_venues( $venue_status = 'trash' ) {
909
+	protected function _trash_or_restore_venues($venue_status = 'trash') {
910 910
 		// clean status
911 911
 		$venue_status = sanitize_key($venue_status);
912 912
 		// grab status
913
-		if (!empty($venue_status)) {
913
+		if ( ! empty($venue_status)) {
914 914
 			$success = TRUE;
915 915
 			//determine the event id and set to array.
916 916
 			$VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array();
@@ -950,20 +950,20 @@  discard block
 block discarded – undo
950 950
 	 * @param  string $venue_status
951 951
 	 * @return void
952 952
 	 */
953
-	private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) {
953
+	private function _change_venue_status($VNU_ID = 0, $venue_status = '') {
954 954
 		// grab venue id
955
-		if (! $VNU_ID) {
955
+		if ( ! $VNU_ID) {
956 956
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
957 957
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
958 958
 			return FALSE;
959 959
 		}
960 960
 
961
-		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID );
961
+		$this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID);
962 962
 
963 963
 		// clean status
964 964
 		$venue_status = sanitize_key($venue_status);
965 965
 		// grab status
966
-		if ( ! $venue_status ) {
966
+		if ( ! $venue_status) {
967 967
 			$msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso');
968 968
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
969 969
 			return FALSE;
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 				$hook = FALSE;
985 985
 		}
986 986
 		//use class to change status
987
-		$this->_cpt_model_obj->set_status( $venue_status );
987
+		$this->_cpt_model_obj->set_status($venue_status);
988 988
 		$success = $this->_cpt_model_obj->save();
989 989
 
990 990
 		if ($success === FALSE) {
@@ -1003,21 +1003,21 @@  discard block
 block discarded – undo
1003 1003
 	 * @param  bool $redirect_after
1004 1004
 	 * @return void
1005 1005
 	 */
1006
-	protected function _delete_venue( $redirect_after = true ) {
1006
+	protected function _delete_venue($redirect_after = true) {
1007 1007
 		//determine the venue id and set to array.
1008 1008
 		$VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL;
1009
-		$VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID;
1009
+		$VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID;
1010 1010
 
1011 1011
 
1012 1012
 		// loop thru venues
1013 1013
 		if ($VNU_ID) {
1014
-			$success = $this->_delete_or_trash_venue( $VNU_ID );
1014
+			$success = $this->_delete_or_trash_venue($VNU_ID);
1015 1015
 		} else {
1016 1016
 			$success = FALSE;
1017 1017
 			$msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso');
1018 1018
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1019 1019
 		}
1020
-		if ( $redirect_after )
1020
+		if ($redirect_after)
1021 1021
 			$this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default'));
1022 1022
 	}
1023 1023
 
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
 	//todo: put in parent
1050 1050
 	private function _delete_or_trash_venue($VNU_ID = FALSE) {
1051 1051
 		// grab event id
1052
-		if (!$VNU_ID = absint($VNU_ID)) {
1052
+		if ( ! $VNU_ID = absint($VNU_ID)) {
1053 1053
 			$msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso');
1054 1054
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1055 1055
 			return FALSE;
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1070 1070
 			return FALSE;
1071 1071
 		}
1072
-		do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' );
1072
+		do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted');
1073 1073
 		return TRUE;
1074 1074
 	}
1075 1075
 
@@ -1080,11 +1080,11 @@  discard block
 block discarded – undo
1080 1080
 	/* QUERIES */
1081 1081
 
1082 1082
 
1083
-	public function get_venues( $per_page = 10, $count = FALSE ) {
1083
+	public function get_venues($per_page = 10, $count = FALSE) {
1084 1084
 
1085
-		$_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : '';
1085
+		$_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : '';
1086 1086
 
1087
-		switch ( $_orderby ) {
1087
+		switch ($_orderby) {
1088 1088
 			case 'id':
1089 1089
 				$orderby = 'VNU_ID';
1090 1090
 				break;
@@ -1102,43 +1102,43 @@  discard block
 block discarded – undo
1102 1102
 		}
1103 1103
 
1104 1104
 
1105
-		$sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC';
1105
+		$sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC';
1106 1106
 
1107
-		$current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1;
1108
-		$per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10;
1109
-		$per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page;
1107
+		$current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1;
1108
+		$per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10;
1109
+		$per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page;
1110 1110
 
1111 1111
 
1112
-		$offset = ($current_page-1)*$per_page;
1112
+		$offset = ($current_page - 1) * $per_page;
1113 1113
 		$limit = array($offset, $per_page);
1114 1114
 
1115
-		$category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1115
+		$category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL;
1116 1116
 		$where = array();
1117 1117
 
1118 1118
 		//only set initial status if it is in the incoming request.  Otherwise the "all" view display's all statuses.
1119
-		if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) {
1119
+		if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') {
1120 1120
 			$where['status'] = $this->_req_data['status'];
1121 1121
 		}
1122 1122
 
1123
-		if ( isset( $this->_req_data['venue_status'] ) ) {
1123
+		if (isset($this->_req_data['venue_status'])) {
1124 1124
 			$where['status'] = $this->_req_data['venue_status'];
1125 1125
 		}
1126 1126
 
1127 1127
 
1128
-		if ( $category ) {
1128
+		if ($category) {
1129 1129
 			$where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories';
1130 1130
 			$where['Term_Taxonomy.term_id'] = $category;
1131 1131
 		}
1132 1132
 
1133 1133
 
1134
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
1135
-			$where['VNU_wp_user'] =  get_current_user_id();
1134
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
1135
+			$where['VNU_wp_user'] = get_current_user_id();
1136 1136
 		} else {
1137
-				if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
1137
+				if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
1138 1138
 					$where['OR'] = array(
1139
-						'status*restrict_private' => array( '!=', 'private' ),
1139
+						'status*restrict_private' => array('!=', 'private'),
1140 1140
 						'AND'                     => array(
1141
-							'status*inclusive' => array( '=', 'private' ),
1141
+							'status*inclusive' => array('=', 'private'),
1142 1142
 							'VNU_wp_user'      => get_current_user_id()
1143 1143
 						)
1144 1144
 					);
@@ -1148,30 +1148,30 @@  discard block
 block discarded – undo
1148 1148
 
1149 1149
 
1150 1150
 
1151
-		if ( isset( $this->_req_data['s'] ) ) {
1152
-			$sstr = '%' . $this->_req_data['s'] . '%';
1151
+		if (isset($this->_req_data['s'])) {
1152
+			$sstr = '%'.$this->_req_data['s'].'%';
1153 1153
 			$where['OR'] = array(
1154
-				'VNU_name' => array('LIKE',$sstr ),
1155
-				'VNU_desc' => array('LIKE',$sstr ),
1156
-				'VNU_short_desc' => array( 'LIKE',$sstr ),
1157
-				'VNU_address' => array( 'LIKE', $sstr ),
1158
-				'VNU_address2' => array( 'LIKE', $sstr ),
1159
-				'VNU_city' => array( 'LIKE', $sstr ),
1160
-				'VNU_zip' => array( 'LIKE', $sstr ),
1161
-				'VNU_phone' => array( 'LIKE', $sstr ),
1162
-				'VNU_url' => array( 'LIKE', $sstr ),
1163
-				'VNU_virtual_phone' => array( 'LIKE', $sstr ),
1164
-				'VNU_virtual_url' => array( 'LIKE', $sstr ),
1165
-				'VNU_google_map_link' => array( 'LIKE', $sstr ),
1166
-				'Event.EVT_name' => array('LIKE', $sstr ),
1167
-				'Event.EVT_desc' => array('LIKE', $sstr ),
1168
-				'Event.EVT_phone' => array('LIKE', $sstr ),
1169
-				'Event.EVT_external_URL' => array('LIKE', $sstr ),
1154
+				'VNU_name' => array('LIKE', $sstr),
1155
+				'VNU_desc' => array('LIKE', $sstr),
1156
+				'VNU_short_desc' => array('LIKE', $sstr),
1157
+				'VNU_address' => array('LIKE', $sstr),
1158
+				'VNU_address2' => array('LIKE', $sstr),
1159
+				'VNU_city' => array('LIKE', $sstr),
1160
+				'VNU_zip' => array('LIKE', $sstr),
1161
+				'VNU_phone' => array('LIKE', $sstr),
1162
+				'VNU_url' => array('LIKE', $sstr),
1163
+				'VNU_virtual_phone' => array('LIKE', $sstr),
1164
+				'VNU_virtual_url' => array('LIKE', $sstr),
1165
+				'VNU_google_map_link' => array('LIKE', $sstr),
1166
+				'Event.EVT_name' => array('LIKE', $sstr),
1167
+				'Event.EVT_desc' => array('LIKE', $sstr),
1168
+				'Event.EVT_phone' => array('LIKE', $sstr),
1169
+				'Event.EVT_external_URL' => array('LIKE', $sstr),
1170 1170
 				);
1171 1171
 		}
1172 1172
 
1173 1173
 
1174
-		$venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) );
1174
+		$venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort));
1175 1175
 
1176 1176
 		return $venues;
1177 1177
 
@@ -1189,22 +1189,22 @@  discard block
 block discarded – undo
1189 1189
 	 * @return void
1190 1190
 	 */
1191 1191
 	private function _set_category_object() {
1192
-		if ( isset( $this->_category->id ) && !empty( $this->_category->id ) )
1192
+		if (isset($this->_category->id) && ! empty($this->_category->id))
1193 1193
 			return; //already have the category object so get out.
1194 1194
 
1195 1195
 		//set default category object
1196 1196
 		$this->_set_empty_category_object();
1197 1197
 
1198 1198
 		//only set if we've got an id
1199
-		if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) {
1199
+		if ( ! isset($this->_req_data['VEN_CAT_ID'])) {
1200 1200
 			return;
1201 1201
 		}
1202 1202
 
1203 1203
 		$category_id = absint($this->_req_data['VEN_CAT_ID']);
1204
-		$term = get_term( $category_id, 'espresso_venue_categories' );
1204
+		$term = get_term($category_id, 'espresso_venue_categories');
1205 1205
 
1206 1206
 
1207
-		if ( !empty( $term ) ) {
1207
+		if ( ! empty($term)) {
1208 1208
 			$this->_category->category_name = $term->name;
1209 1209
 			$this->_category->category_identifier = $term->slug;
1210 1210
 			$this->_category->category_desc = $term->description;
@@ -1218,14 +1218,14 @@  discard block
 block discarded – undo
1218 1218
 
1219 1219
 	private function _set_empty_category_object() {
1220 1220
 		$this->_category = new stdClass();
1221
-		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc  = '';
1221
+		$this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = '';
1222 1222
 		$this->_category->id = $this->_category->parent = 0;
1223 1223
 	}
1224 1224
 
1225 1225
 
1226 1226
 
1227 1227
 	protected function _category_list_table() {
1228
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
1228
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
1229 1229
 		$this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2');
1230 1230
 		$this->_search_btn_label = __('Venue Categories', 'event_espresso');
1231 1231
 		$this->display_admin_list_table_page_with_sidebar();
@@ -1241,13 +1241,13 @@  discard block
 block discarded – undo
1241 1241
 		$this->_set_add_edit_form_tags($route);
1242 1242
 
1243 1243
 		$this->_set_category_object();
1244
-		$id = !empty($this->_category->id) ? $this->_category->id : '';
1244
+		$id = ! empty($this->_category->id) ? $this->_category->id : '';
1245 1245
 
1246 1246
 		$delete_action = 'delete_category';
1247 1247
 
1248
-		$redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url );
1248
+		$redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url);
1249 1249
 
1250
-		$this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect );
1250
+		$this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect);
1251 1251
 
1252 1252
 		//take care of contents
1253 1253
 		$this->_template_args['admin_page_content'] = $this->_category_details_content();
@@ -1261,25 +1261,25 @@  discard block
 block discarded – undo
1261 1261
 			'type' => 'wp_editor',
1262 1262
 			'value' => EEH_Formatter::admin_format_content($this->_category->category_desc),
1263 1263
 			'class' => 'my_editor_custom',
1264
-			'wpeditor_args' => array( 'media_buttons' => FALSE )
1264
+			'wpeditor_args' => array('media_buttons' => FALSE)
1265 1265
 		);
1266
-		$_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' );
1266
+		$_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array');
1267 1267
 
1268
-		$all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) );
1268
+		$all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id)));
1269 1269
 
1270 1270
 		//setup category select for term parents.
1271 1271
 		$category_select_values[] = array(
1272 1272
 			'text' => __('No Parent', 'event_espresso'),
1273 1273
 			'id' => 0
1274 1274
 			);
1275
-		foreach ( $all_terms as $term ) {
1275
+		foreach ($all_terms as $term) {
1276 1276
 			$category_select_values[] = array(
1277 1277
 				'text' => $term->name,
1278 1278
 				'id' => $term->term_id
1279 1279
 				);
1280 1280
 		}
1281 1281
 
1282
-		$category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent );
1282
+		$category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent);
1283 1283
 		$template_args = array(
1284 1284
 			'category' => $this->_category,
1285 1285
 			'category_select' => $category_select,
@@ -1288,15 +1288,15 @@  discard block
 block discarded – undo
1288 1288
 			'disable' => '',
1289 1289
 			'disabled_message' =>FALSE
1290 1290
 			);
1291
-		$template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php';
1292
-		return EEH_Template::display_template($template, $template_args, TRUE );
1291
+		$template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php';
1292
+		return EEH_Template::display_template($template, $template_args, TRUE);
1293 1293
 	}
1294 1294
 
1295 1295
 
1296 1296
 	protected function _delete_categories() {
1297
-		$cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1297
+		$cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id'];
1298 1298
 
1299
-		foreach ( $cat_ids as $cat_id ) {
1299
+		foreach ($cat_ids as $cat_id) {
1300 1300
 			$this->_delete_category($cat_id);
1301 1301
 		}
1302 1302
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
 		$query_args = array(
1305 1305
 			'action' => 'category_list'
1306 1306
 			);
1307
-		$this->_redirect_after_action(0,'','',$query_args);
1307
+		$this->_redirect_after_action(0, '', '', $query_args);
1308 1308
 
1309 1309
 	}
1310 1310
 
@@ -1313,58 +1313,58 @@  discard block
 block discarded – undo
1313 1313
 
1314 1314
 
1315 1315
 	protected function _delete_category($cat_id) {
1316
-		$cat_id = absint( $cat_id );
1317
-		wp_delete_term( $cat_id, 'espresso_venue_categories' );
1316
+		$cat_id = absint($cat_id);
1317
+		wp_delete_term($cat_id, 'espresso_venue_categories');
1318 1318
 	}
1319 1319
 
1320 1320
 
1321 1321
 
1322 1322
 	protected function _insert_or_update_category($new_category) {
1323 1323
 
1324
-		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE );
1324
+		$cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE);
1325 1325
 		$success = 0; //we already have a success message so lets not send another.
1326
-		if ( $cat_id ) {
1326
+		if ($cat_id) {
1327 1327
 			$query_args = array(
1328 1328
 				'action'     => 'edit_category',
1329 1329
 				'VEN_CAT_ID' => $cat_id
1330 1330
 			);
1331 1331
 		} else {
1332
-			$query_args = array( 'action' => 'add_category' );
1332
+			$query_args = array('action' => 'add_category');
1333 1333
 		}
1334
-		$this->_redirect_after_action( $success, '','', $query_args, TRUE );
1334
+		$this->_redirect_after_action($success, '', '', $query_args, TRUE);
1335 1335
 
1336 1336
 	}
1337 1337
 
1338 1338
 
1339 1339
 
1340
-	private function _insert_category( $update = FALSE ) {
1340
+	private function _insert_category($update = FALSE) {
1341 1341
 		$cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : '';
1342
-		$category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : '';
1343
-		$category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : '';
1344
-		$category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0;
1342
+		$category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : '';
1343
+		$category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : '';
1344
+		$category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0;
1345 1345
 
1346
-		if ( empty( $category_name ) ) {
1347
-			$msg = __( 'You must add a name for the category.', 'event_espresso' );
1348
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1346
+		if (empty($category_name)) {
1347
+			$msg = __('You must add a name for the category.', 'event_espresso');
1348
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1349 1349
 			return false;
1350 1350
 		}
1351 1351
 
1352 1352
 
1353
-		$term_args=array(
1353
+		$term_args = array(
1354 1354
 			'name'=>$category_name,
1355 1355
 			'description'=>$category_desc,
1356 1356
 			'parent'=>$category_parent
1357 1357
 		);
1358 1358
 
1359
-		$insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args );
1359
+		$insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args);
1360 1360
 
1361
-		if ( !is_array( $insert_ids ) ) {
1362
-			$msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' );
1363
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
1361
+		if ( ! is_array($insert_ids)) {
1362
+			$msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso');
1363
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
1364 1364
 		} else {
1365 1365
 			$cat_id = $insert_ids['term_id'];
1366
-			$msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name );
1367
-			EE_Error::add_success( $msg );
1366
+			$msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name);
1367
+			EE_Error::add_success($msg);
1368 1368
 		}
1369 1369
 
1370 1370
 		return $cat_id;
@@ -1384,11 +1384,11 @@  discard block
 block discarded – undo
1384 1384
 			'category_ids' => $this->_req_data['VEN_CAT_ID']
1385 1385
 			);
1386 1386
 
1387
-		$this->_req_data = array_merge( $this->_req_data, $new_request_args );
1387
+		$this->_req_data = array_merge($this->_req_data, $new_request_args);
1388 1388
 
1389
-		if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) {
1390
-			require_once( EE_CLASSES . 'EE_Export.class.php');
1391
-			$EE_Export = EE_Export::instance( $this->_req_data );
1389
+		if (is_readable(EE_CLASSES.'EE_Export.class.php')) {
1390
+			require_once(EE_CLASSES.'EE_Export.class.php');
1391
+			$EE_Export = EE_Export::instance($this->_req_data);
1392 1392
 			$EE_Export->export();
1393 1393
 		}
1394 1394
 
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 
1401 1401
 	protected function _import_categories() {
1402 1402
 
1403
-		require_once(EE_CLASSES . 'EE_Import.class.php');
1403
+		require_once(EE_CLASSES.'EE_Import.class.php');
1404 1404
 		EE_Import::instance()->import();
1405 1405
 
1406 1406
 	}
@@ -1408,29 +1408,29 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 
1410 1410
 
1411
-	public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) {
1411
+	public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) {
1412 1412
 
1413 1413
 		//testing term stuff
1414
-		$orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
-		$order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC';
1416
-		$limit = ($current_page-1)*$per_page;
1417
-		$where = array( 'taxonomy' => 'espresso_venue_categories' );
1418
-		if ( isset( $this->_req_data['s'] ) ) {
1419
-			$sstr = '%' . $this->_req_data['s'] . '%';
1414
+		$orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id';
1415
+		$order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC';
1416
+		$limit = ($current_page - 1) * $per_page;
1417
+		$where = array('taxonomy' => 'espresso_venue_categories');
1418
+		if (isset($this->_req_data['s'])) {
1419
+			$sstr = '%'.$this->_req_data['s'].'%';
1420 1420
 			$where['OR'] = array(
1421
-				'Term.name' => array( 'LIKE', $sstr),
1422
-				'description' => array( 'LIKE', $sstr )
1421
+				'Term.name' => array('LIKE', $sstr),
1422
+				'description' => array('LIKE', $sstr)
1423 1423
 				);
1424 1424
 		}
1425 1425
 
1426 1426
 		$query_params = array(
1427 1427
 			$where,
1428
-			'order_by' => array( $orderby => $order ),
1429
-			'limit' => $limit . ',' . $per_page,
1428
+			'order_by' => array($orderby => $order),
1429
+			'limit' => $limit.','.$per_page,
1430 1430
 			'force_join' => array('Term')
1431 1431
 			);
1432 1432
 
1433
-		$categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params );
1433
+		$categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params);
1434 1434
 
1435 1435
 		return $categories;
1436 1436
 	}
Please login to merge, or discard this patch.
widgets/upcoming_events/EEW_Upcoming_Events.widget.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	function __construct() {
31 31
 		parent::__construct(
32 32
 			'ee-upcoming-events-widget',
33
-			__( 'Event Espresso Upcoming Events', 'event_espresso' ),
34
-			 array( 'description' => __( 'A widget to display your upcoming events.', 'event_espresso' )),
33
+			__('Event Espresso Upcoming Events', 'event_espresso'),
34
+			 array('description' => __('A widget to display your upcoming events.', 'event_espresso')),
35 35
 			array(
36 36
 				'width' => 300,
37 37
 				'height' => 350,
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	 * @param array $instance Previously saved values from database.
50 50
 	 * @return string|void
51 51
 	 */
52
-	public function form( $instance ) {
52
+	public function form($instance) {
53 53
 
54
-		EE_Registry::instance()->load_class( 'Question_Option', array(), FALSE, FALSE, TRUE );
54
+		EE_Registry::instance()->load_class('Question_Option', array(), FALSE, FALSE, TRUE);
55 55
 		// Set up some default widget settings.
56 56
 		$defaults = array(
57 57
 			'title' => __('Upcoming Events', 'event_espresso'),
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 			'image_size' => 'medium'
67 67
 		);
68 68
 
69
-		$instance = wp_parse_args( (array) $instance, $defaults );
69
+		$instance = wp_parse_args((array) $instance, $defaults);
70 70
 		// don't add HTML labels for EE_Form_Fields generated inputs
71
-		add_filter( 'FHEE__EEH_Form_Fields__label_html', '__return_empty_string' );
71
+		add_filter('FHEE__EEH_Form_Fields__label_html', '__return_empty_string');
72 72
 		$yes_no_values = array(
73
-			EE_Question_Option::new_instance( array( 'QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
-			EE_Question_Option::new_instance( array( 'QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
73
+			EE_Question_Option::new_instance(array('QSO_value' => FALSE, 'QSO_desc' => __('No', 'event_espresso'))),
74
+			EE_Question_Option::new_instance(array('QSO_value' => TRUE, 'QSO_desc' => __('Yes', 'event_espresso')))
75 75
 		);
76 76
 
77 77
 	?>
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			<label for="<?php echo $this->get_field_id('title'); ?>">
83 83
 				<?php _e('Title:', 'event_espresso'); ?>
84 84
 			</label>
85
-			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" type="text" />
85
+			<input id="<?php echo $this->get_field_id('title'); ?>" class="widefat" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo esc_attr($instance['title']); ?>" type="text" />
86 86
 		</p>
87 87
 		<p>
88 88
 			<label for="<?php echo $this->get_field_id('category_name'); ?>">
@@ -91,16 +91,16 @@  discard block
 block discarded – undo
91 91
 			<?php
92 92
 			$event_categories = array();
93 93
 			/** @type EEM_Term $EEM_Term */
94
-			$EEM_Term = EE_Registry::instance()->load_model( 'Term' );
95
-			$categories = $EEM_Term->get_all_ee_categories( TRUE );
96
-			if ( $categories ) {
97
-				foreach ( $categories as $category ) {
98
-					if ( $category instanceof EE_Term ) {
99
-						$event_categories[] = EE_Question_Option::new_instance( array( 'QSO_value' => $category->get( 'slug' ), 'QSO_desc' => $category->get( 'name' )));
94
+			$EEM_Term = EE_Registry::instance()->load_model('Term');
95
+			$categories = $EEM_Term->get_all_ee_categories(TRUE);
96
+			if ($categories) {
97
+				foreach ($categories as $category) {
98
+					if ($category instanceof EE_Term) {
99
+						$event_categories[] = EE_Question_Option::new_instance(array('QSO_value' => $category->get('slug'), 'QSO_desc' => $category->get('name')));
100 100
 					}
101 101
 				}
102 102
 			}
103
-			array_unshift( $event_categories, EE_Question_Option::new_instance( array( 'QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
103
+			array_unshift($event_categories, EE_Question_Option::new_instance(array('QSO_value' => '', 'QSO_desc' => __(' - display all - ', 'event_espresso'))));
104 104
 			echo EEH_Form_Fields::select(
105 105
 				 __('Event Category:', 'event_espresso'),
106 106
 				$instance['category_name'],
@@ -137,16 +137,16 @@  discard block
 block discarded – undo
137 137
 			<?php
138 138
 			$image_sizes = array();
139 139
 			$sizes = get_intermediate_image_sizes();
140
-			if ( $sizes ) {
140
+			if ($sizes) {
141 141
 				// loop thru images and create option objects out of them
142
-				foreach ( $sizes as $image_size ) {
143
-					$image_size = trim( $image_size );
142
+				foreach ($sizes as $image_size) {
143
+					$image_size = trim($image_size);
144 144
 					// no big images plz
145
-					if ( ! in_array( $image_size, array( 'large', 'post-thumbnail' ))) {
146
-						$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => $image_size, 'QSO_desc' => $image_size ));
145
+					if ( ! in_array($image_size, array('large', 'post-thumbnail'))) {
146
+						$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => $image_size, 'QSO_desc' => $image_size));
147 147
 					}
148 148
 				}
149
-				$image_sizes[] = EE_Question_Option::new_instance( array( 'QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso') ));
149
+				$image_sizes[] = EE_Question_Option::new_instance(array('QSO_value' => 'none', 'QSO_desc' =>  __('don\'t show images', 'event_espresso')));
150 150
 			}
151 151
 			echo EEH_Form_Fields::select(
152 152
 				 __('Image Size:', 'event_espresso'),
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 			<label for="<?php echo $this->get_field_id('date_limit'); ?>">
205 205
 				<?php _e('Number of Dates to Display:', 'event_espresso'); ?>
206 206
 			</label>
207
-			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr( $instance['date_limit'] ); ?>" size="3" type="text" />
207
+			<input id="<?php echo $this->get_field_id('date_limit'); ?>" name="<?php echo $this->get_field_name('date_limit'); ?>" value="<?php echo esc_attr($instance['date_limit']); ?>" size="3" type="text" />
208 208
 		</p>
209 209
 		<p>
210 210
 			<label for="<?php echo $this->get_field_id('date_range'); ?>">
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 	 *
237 237
 	 * @return array Updated safe values to be saved.
238 238
 	 */
239
-	public function update( $new_instance, $old_instance ) {
239
+	public function update($new_instance, $old_instance) {
240 240
 		$instance = $old_instance;
241
-		$instance['title'] = ! empty( $new_instance['title'] ) ? strip_tags( $new_instance['title'] ) : '';
241
+		$instance['title'] = ! empty($new_instance['title']) ? strip_tags($new_instance['title']) : '';
242 242
 		$instance['category_name'] = $new_instance['category_name'];
243 243
 		$instance['show_expired'] = $new_instance['show_expired'];
244 244
 		$instance['limit'] = $new_instance['limit'];
@@ -261,18 +261,18 @@  discard block
 block discarded – undo
261 261
 	 * @param array $args     Widget arguments.
262 262
 	 * @param array $instance Saved values from database.
263 263
 	 */
264
-	public function widget( $args, $instance ) {
264
+	public function widget($args, $instance) {
265 265
 
266 266
 		global $post;
267 267
 		// make sure there is some kinda post object
268
-		if ( $post instanceof WP_Post ) {
268
+		if ($post instanceof WP_Post) {
269 269
 			$before_widget = '';
270 270
 			$before_title = '';
271 271
 			$after_title = '';
272 272
 			$after_widget = '';
273 273
 			// but NOT an events archives page, cuz that would be like two event lists on the same page
274
-			$show_everywhere = isset( $instance['show_everywhere'] ) ? (bool) absint( $instance['show_everywhere'] ) : TRUE;
275
-			if ( $show_everywhere || ! ( $post->post_type == 'espresso_events' && is_archive() )) {
274
+			$show_everywhere = isset($instance['show_everywhere']) ? (bool) absint($instance['show_everywhere']) : TRUE;
275
+			if ($show_everywhere || ! ($post->post_type == 'espresso_events' && is_archive())) {
276 276
 				// let's use some of the event helper functions'
277 277
 				// make separate vars out of attributes
278 278
 
@@ -291,76 +291,76 @@  discard block
 block discarded – undo
291 291
 				// Before widget (defined by themes).
292 292
 				echo $before_widget;
293 293
 				// Display the widget title if one was input (before and after defined by themes).
294
-				if ( ! empty( $title )) {
295
-					echo $before_title . $title . $after_title;
294
+				if ( ! empty($title)) {
295
+					echo $before_title.$title.$after_title;
296 296
 				}
297 297
 				// grab widget settings
298
-				$category = isset( $instance['category_name'] ) && ! empty( $instance['category_name'] ) ? $instance['category_name'] : FALSE;
299
-				$show_expired = isset( $instance['show_expired'] ) ? (bool) absint( $instance['show_expired'] ) : FALSE;
300
-				$image_size = isset( $instance['image_size'] ) && ! empty( $instance['image_size'] ) ? $instance['image_size'] : 'medium';
301
-				$show_desc = isset( $instance['show_desc'] ) ? (bool) absint( $instance['show_desc'] ) : TRUE;
302
-				$show_dates = isset( $instance['show_dates'] ) ? (bool) absint( $instance['show_dates'] ) : TRUE;
303
-				$date_limit = isset( $instance['date_limit'] ) && ! empty( $instance['date_limit'] ) ? $instance['date_limit'] : NULL;
304
-				$date_range = isset( $instance['date_range'] ) && ! empty( $instance['date_range'] ) ? $instance['date_range'] : FALSE;
298
+				$category = isset($instance['category_name']) && ! empty($instance['category_name']) ? $instance['category_name'] : FALSE;
299
+				$show_expired = isset($instance['show_expired']) ? (bool) absint($instance['show_expired']) : FALSE;
300
+				$image_size = isset($instance['image_size']) && ! empty($instance['image_size']) ? $instance['image_size'] : 'medium';
301
+				$show_desc = isset($instance['show_desc']) ? (bool) absint($instance['show_desc']) : TRUE;
302
+				$show_dates = isset($instance['show_dates']) ? (bool) absint($instance['show_dates']) : TRUE;
303
+				$date_limit = isset($instance['date_limit']) && ! empty($instance['date_limit']) ? $instance['date_limit'] : NULL;
304
+				$date_range = isset($instance['date_range']) && ! empty($instance['date_range']) ? $instance['date_range'] : FALSE;
305 305
 				// start to build our where clause
306 306
 				$where = array(
307 307
 //					'Datetime.DTT_is_primary' => 1,
308 308
 					'status' => 'publish'
309 309
 				);
310 310
 				// add category
311
-				if ( $category ) {
311
+				if ($category) {
312 312
 					$where['Term_Taxonomy.taxonomy'] = 'espresso_event_categories';
313 313
 					$where['Term_Taxonomy.Term.slug'] = $category;
314 314
 				}
315 315
 				// if NOT expired then we want events that start today or in the future
316
-				if ( ! $show_expired ) {
317
-					$where['Datetime.DTT_EVT_end'] = array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) );
316
+				if ( ! $show_expired) {
317
+					$where['Datetime.DTT_EVT_end'] = array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'));
318 318
 				}
319 319
 				// run the query
320
-				$events = EE_Registry::instance()->load_model( 'Event' )->get_all( array(
320
+				$events = EE_Registry::instance()->load_model('Event')->get_all(array(
321 321
 					$where,
322
-					'limit' => $instance['limit'] > 0 ? '0,' . $instance['limit'] : '0,10',
322
+					'limit' => $instance['limit'] > 0 ? '0,'.$instance['limit'] : '0,10',
323 323
 					'order_by' => 'Datetime.DTT_EVT_start',
324 324
 					'order' => 'ASC',
325 325
 					'group_by' => 'EVT_ID'
326 326
 				));
327 327
 
328
-				if ( ! empty( $events )) {
328
+				if ( ! empty($events)) {
329 329
 					echo '<ul class="ee-upcoming-events-widget-ul">';
330
-					foreach ( $events as $event ) {
331
-						if ( $event instanceof EE_Event && ( !is_single() || $post->ID != $event->ID() ) ) {
330
+					foreach ($events as $event) {
331
+						if ($event instanceof EE_Event && ( ! is_single() || $post->ID != $event->ID())) {
332 332
 							//printr( $event, '$event  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
333
-							echo '<li id="ee-upcoming-events-widget-li-' . $event->ID() . '" class="ee-upcoming-events-widget-li">';
333
+							echo '<li id="ee-upcoming-events-widget-li-'.$event->ID().'" class="ee-upcoming-events-widget-li">';
334 334
 							// how big is the event name ?
335
-							$name_length = strlen( $event->name() );
336
-							switch( $name_length ) {
335
+							$name_length = strlen($event->name());
336
+							switch ($name_length) {
337 337
 								case $name_length > 70 :
338
-									$len_class =  ' three-line';
338
+									$len_class = ' three-line';
339 339
 									break;
340 340
 								case $name_length > 35 :
341
-									$len_class =  ' two-line';
341
+									$len_class = ' two-line';
342 342
 									break;
343 343
 								default :
344
-									$len_class =  ' one-line';
344
+									$len_class = ' one-line';
345 345
 							}
346
-							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a' . $len_class . '" href="' . get_permalink( $event->ID() ) . '">' . $event->name() . '</a></h5>';
347
-							if ( has_post_thumbnail( $event->ID() ) && $image_size != 'none' ) {
348
-								echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="' . get_permalink( $event->ID() ) . '">' . get_the_post_thumbnail( $event->ID(), $image_size ) . '</a></div>';
346
+							echo '<h5 class="ee-upcoming-events-widget-title-h5"><a class="ee-widget-event-name-a'.$len_class.'" href="'.get_permalink($event->ID()).'">'.$event->name().'</a></h5>';
347
+							if (has_post_thumbnail($event->ID()) && $image_size != 'none') {
348
+								echo '<div class="ee-upcoming-events-widget-img-dv"><a class="ee-upcoming-events-widget-img" href="'.get_permalink($event->ID()).'">'.get_the_post_thumbnail($event->ID(), $image_size).'</a></div>';
349 349
 							}
350
-							$desc = $event->short_description( 25 );
351
-							if ( $show_dates ) {
352
-								$date_format = apply_filters( 'FHEE__espresso_event_date_range__date_format', get_option( 'date_format' ));
353
-								$time_format = apply_filters( 'FHEE__espresso_event_date_range__time_format', get_option( 'time_format' ));
354
-								$single_date_format = apply_filters( 'FHEE__espresso_event_date_range__single_date_format', get_option( 'date_format' ));
355
-								$single_time_format = apply_filters( 'FHEE__espresso_event_date_range__single_time_format', get_option( 'time_format' ));
356
-								if ( $date_range == TRUE ) {
357
-									echo espresso_event_date_range( $date_format, $time_format, $single_date_format, $single_time_format, $event->ID() );
358
-								}else{
359
-									echo espresso_list_of_event_dates( $event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit );
350
+							$desc = $event->short_description(25);
351
+							if ($show_dates) {
352
+								$date_format = apply_filters('FHEE__espresso_event_date_range__date_format', get_option('date_format'));
353
+								$time_format = apply_filters('FHEE__espresso_event_date_range__time_format', get_option('time_format'));
354
+								$single_date_format = apply_filters('FHEE__espresso_event_date_range__single_date_format', get_option('date_format'));
355
+								$single_time_format = apply_filters('FHEE__espresso_event_date_range__single_time_format', get_option('time_format'));
356
+								if ($date_range == TRUE) {
357
+									echo espresso_event_date_range($date_format, $time_format, $single_date_format, $single_time_format, $event->ID());
358
+								} else {
359
+									echo espresso_list_of_event_dates($event->ID(), $date_format, $time_format, FALSE, NULL, TRUE, TRUE, $date_limit);
360 360
 								}
361 361
 							}
362
-							if ( $show_desc && $desc ) {
363
-								echo '<p style="margin-top: .5em">' . $desc . '</p>';
362
+							if ($show_desc && $desc) {
363
+								echo '<p style="margin-top: .5em">'.$desc.'</p>';
364 364
 							}
365 365
 							echo '</li>';
366 366
 						}
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	 * @return string
384 384
 	 */
385 385
 	public function make_the_title_a_link($title) {
386
-	    return '<a href="' . EEH_Event_View::event_archive_url() . '">' . $title . '</a>';
386
+	    return '<a href="'.EEH_Event_View::event_archive_url().'">'.$title.'</a>';
387 387
 	}
388 388
 
389 389
 }
Please login to merge, or discard this patch.
core/services/address/formatters/MultiLineAddressFormatter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\core\services\address\formatters;
3 3
 
4
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
5
-	exit( 'No direct script access allowed' );
4
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
5
+	exit('No direct script access allowed');
6 6
 }
7 7
 
8 8
 
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 * @param string $CNT_ISO
29 29
 	 * @return string
30 30
 	 */
31
-	public function format( $address, $address2, $city, $state, $zip, $country, $CNT_ISO ) {
31
+	public function format($address, $address2, $city, $state, $zip, $country, $CNT_ISO) {
32 32
 		$address_formats = apply_filters(
33 33
 			'FHEE__EE_Inline_Address_Formatter__address_formats',
34 34
 			array(
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 			)
40 40
 		);
41 41
 		// if the incoming country has a set format, use that, else use the default
42
-		$formatted_address = isset( $address_formats[ $CNT_ISO ] ) ? $address_formats[ $CNT_ISO ]
42
+		$formatted_address = isset($address_formats[$CNT_ISO]) ? $address_formats[$CNT_ISO]
43 43
 			: $address_formats['ZZZ'];
44 44
 		return $this->parse_formatted_address(
45 45
 			$address,
Please login to merge, or discard this patch.
core/EE_Deprecated.core.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 	}
338 338
 
339 339
 	/**
340
-	 * @param $method_name
340
+	 * @param string $method_name
341 341
 	 */
342 342
 	public static function doing_it_wrong_call( $method_name ) {
343 343
 		EE_Error::doing_it_wrong( __CLASS__, sprintf( __('The %s in this class is deprecated as of EE4.5.0.  All functionality formerly in this class is now in the EED_Messages module.', 'event_espresso'), $method_name ), '4.5.0', E_USER_DEPRECATED );
@@ -1150,7 +1150,7 @@  discard block
 block discarded – undo
1150 1150
 
1151 1151
 	/**
1152 1152
 	 * @deprecated 4.9.0
1153
-	 * @return array
1153
+	 * @return EE_messenger[]
1154 1154
 	 */
1155 1155
 	public function get_installed_messengers() {
1156 1156
 		// EE_messages has been deprecated
Please login to merge, or discard this patch.