Completed
Branch BUG-8698-ticket-sellouts (4c4ee4)
by
unknown
125:44 queued 110:35
created
help_tabs/registration_form_reg_form_settings.help_tab.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,15 +3,15 @@
 block discarded – undo
3 3
 <?php _e('This page shows options for Email Validation, the EE "Bot Trap" and reCAPTCHA which can help prevent SPAM registrations on your site.', 'event_espresso'); ?>
4 4
 </p>
5 5
 <div id="email_validation_info">
6
-<p><strong><?php _e('Email Validation', 'event_espresso');?></strong></p>
6
+<p><strong><?php _e('Email Validation', 'event_espresso'); ?></strong></p>
7 7
 <p><?php _e("Validating an email address is extremely difficult to do correctly. Your server's configuration, as well as your own tolerances and needs, can affect the type of validation needed. We offer different types of validation so that you can control how strict your registration form responds to entered email addresses. If you are receiving too many bogus email addresses, then you can try the WordPress Default validation setting. If you find that the form validation is blocking a valid email address you can try the Basic setting, or if available, the International validation settings.", 'event_espresso'); ?>
8 8
 </p>
9
-<p><strong><?php _e('Validation Options:', 'event_espresso' );?></strong></p>
9
+<p><strong><?php _e('Validation Options:', 'event_espresso'); ?></strong></p>
10 10
 <ul>
11 11
 <li>
12 12
 	<?php _e('"Basic" - only checks that an email address follows the most basic structure guidelines ( ie: [email protected] ). Will work with the widest range of email addresses but will also allow the most garbage through.', 'event_espresso'); ?></li>
13 13
 <li>
14
-	<?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).','event_espresso'); ?></li>
14
+	<?php _e('"WordPress Default" - uses built in WordPress email validation, but does not support unicode characters (ie: international characters from non-latin based languages).', 'event_espresso'); ?></li>
15 15
 <li>
16 16
 	<?php _e('"International" - supports unicode characters but may not be supported by all server configurations. Try this first if you need to international language support, but drop back down to "Basic" if your server configuration conflicts.', 'event_espresso'); ?>
17 17
 </li>
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 3 patches
Braces   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -487,12 +487,12 @@  discard block
 block discarded – undo
487 487
 				}
488 488
 			}
489 489
 
490
-		}elseif( !empty($this->_req_data['QSG_ID'])){
490
+		} elseif( !empty($this->_req_data['QSG_ID'])){
491 491
 			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
492 492
 
493
-		}elseif( !empty($this->_req_data['QST_ID'])){
493
+		} elseif( !empty($this->_req_data['QST_ID'])){
494 494
 			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
495
-		}else{
495
+		} else{
496 496
 			EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
497 497
 		}
498 498
 		return $success;
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
 			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
532 532
 			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
533 533
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
534
-		}else{
534
+		} else{
535 535
 			/** @var EE_Question_Group $questionGroup */
536 536
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
537 537
 			$questionGroup->set_order_to_latest();
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 		if($trash){
735 735
 			$action_desc = 'trashed';
736 736
 			$status = 'trash';
737
-		}else{
737
+		} else{
738 738
 			$action_desc = 'restored';
739 739
 			$status = 'all';
740 740
 		}
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
757 757
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
758 758
 			$results=$this->_question_model->count_deleted($where);
759
-		}else{
759
+		} else{
760 760
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
761 761
 			$results=$this->_question_model->get_all_deleted($query_params);
762 762
 		}
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 		if ($count){
778 778
 			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
779 779
 			$results = $questionGroupModel->count($where);
780
-		}else{
780
+		} else{
781 781
 			$results = $questionGroupModel->get_all($query_params);
782 782
 		}
783 783
 		return $results;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
799 799
 			$query_params['limit'] = NULL;
800 800
 			$results = $questionGroupModel->count_deleted($where);
801
-		}else{
801
+		} else{
802 802
 			$results = $questionGroupModel->get_all_deleted($query_params);
803 803
 		}
804 804
 		return $results;
Please login to merge, or discard this patch.
Spacing   +182 added lines, -182 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
 /**
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
37 37
 	 * 		@access public
38 38
 	 */
39
-	public function __construct( $routing = TRUE ) {
40
-		define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS );
41
-		define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS );
42
-		define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' );
43
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS );
44
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' );
45
-		parent::__construct( $routing );
39
+	public function __construct($routing = TRUE) {
40
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS);
41
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS);
42
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
43
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS);
44
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
45
+		parent::__construct($routing);
46 46
 	}
47 47
 
48 48
 
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 	protected function _extend_page_config() {
54 54
 		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
55
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
56
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0;
55
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
56
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0;
57 57
 
58 58
 		$new_page_routes = array(
59 59
 			'question_groups' => array(
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 				'func' => '_trash_or_restore_questions',
87 87
 				'capability' => 'ee_delete_question',
88 88
 				'obj_id' => $qst_id,
89
-				'args' => array( 'trash' => FALSE ),
89
+				'args' => array('trash' => FALSE),
90 90
 				'noheader' => TRUE
91 91
 				),
92 92
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
 			'trash_question_group' => array(
147 147
 				'func' => '_trash_or_restore_question_groups',
148
-				'args' => array( 'trash' => TRUE ),
148
+				'args' => array('trash' => TRUE),
149 149
 				'capability' => 'ee_delete_question_group',
150 150
 				'obj_id' => $qsg_id,
151 151
 				'noheader' => TRUE
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 
154 154
 			'restore_question_group' => array(
155 155
 				'func' => '_trash_or_restore_question_groups',
156
-				'args' => array( 'trash' => FALSE ),
156
+				'args' => array('trash' => FALSE),
157 157
 				'capability' => 'ee_delete_question_group',
158 158
 				'obj_id' => $qsg_id,
159 159
 				'noheader' => TRUE
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 			'update_question_group' => array(
170 170
 				'func' => '_insert_or_update_question_group',
171
-				'args' => array('new_question_group' => FALSE ),
171
+				'args' => array('new_question_group' => FALSE),
172 172
 				'capability' => 'ee_edit_question_group',
173 173
 				'obj_id' => $qsg_id,
174 174
 				'noheader' => TRUE,
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 					'noheader' => TRUE
207 207
 				),
208 208
 			);
209
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
209
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
210 210
 
211 211
 		$new_page_config = array(
212 212
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
231 231
 						),
232 232
 					),
233
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
233
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
234 234
 				'metaboxes' => $this->_default_espresso_metaboxes,
235 235
 				'require_nonce' => FALSE,
236 236
 				'qtips' => array(
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 					'order' => 5,
245 245
 					'persistent' => FALSE
246 246
 					),
247
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
247
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
248 248
                 'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => __('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -261,14 +261,14 @@  discard block
 block discarded – undo
261 261
 					'order' => 5,
262 262
 					'persistent' => FALSE
263 263
 					),
264
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
264
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
265 265
 				'help_tabs' => array(
266 266
 					'registration_form_add_question_group_help_tab' => array(
267 267
 						'title' => __('Add Question Group', 'event_espresso'),
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -277,16 +277,16 @@  discard block
 block discarded – undo
277 277
 					'label' => __('Edit Question Group', 'event_espresso'),
278 278
 					'order' => 5,
279 279
 					'persistent' => FALSE,
280
-					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
280
+					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url
281 281
 					),
282
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
282
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
283 283
 				'help_tabs' => array(
284 284
 					'registration_form_edit_question_group_help_tab' => array(
285 285
 						'title' => __('Edit Question Group', 'event_espresso'),
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -298,19 +298,19 @@  discard block
 block discarded – undo
298 298
 				'labels' => array(
299 299
 					'publishbox' => __('Update Settings', 'event_espresso')
300 300
 					),
301
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
301
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
302 302
 				'help_tabs' => array(
303 303
 					'registration_form_reg_form_settings_help_tab' => array(
304 304
 						'title' => __('Registration Form Settings', 'event_espresso'),
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
312 312
 			);
313
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
313
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
314 314
 
315 315
 		//change the list table we're going to use so it's the NEW list table!
316 316
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 			'edit_question_group' => __('Edit Question Group', 'event_espresso'),
325 325
 			'delete_question_group' => __('Delete Question Group', 'event_espresso'),
326 326
 			);
327
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
327
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
328 328
 
329 329
 	}
330 330
 
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 
334 334
 
335 335
 	protected function _ajax_hooks() {
336
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
336
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
337 337
 	}
338 338
 
339 339
 
340 340
 
341 341
 
342 342
 	public function load_scripts_styles_question_groups() {
343
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
343
+		wp_enqueue_script('espresso_ajax_table_sorting');
344 344
 	}
345 345
 
346 346
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 	 * @return void
362 362
 	 */
363 363
 	public function load_sortable_question_script() {
364
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
364
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
365 365
 		wp_enqueue_script('ee-question-sortable');
366 366
 	}
367 367
 
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 				)
381 381
 		);
382 382
 
383
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
383
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
384 384
 			$this->_views['trash'] = array(
385 385
 				'slug' => 'trash',
386 386
 				'label' => __('Trash', 'event_espresso'),
@@ -410,7 +410,7 @@  discard block
 block discarded – undo
410 410
 				)
411 411
 		);
412 412
 
413
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
413
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
414 414
 			$this->_views['trash'] = array(
415 415
 				'slug' => 'trash',
416 416
 				'label' => __('Trash', 'event_espresso'),
@@ -446,24 +446,24 @@  discard block
 block discarded – undo
446 446
 
447 447
 
448 448
 
449
-	protected function _delete_question(){
450
-		$success = $this->_delete_items( $this->_question_model );
449
+	protected function _delete_question() {
450
+		$success = $this->_delete_items($this->_question_model);
451 451
 		$this->_redirect_after_action(
452 452
 			$success,
453
-			$this->_question_model->item_name( $success ),
453
+			$this->_question_model->item_name($success),
454 454
 			'deleted',
455
-			array( 'action' => 'default', 'status' => 'all' )
455
+			array('action' => 'default', 'status' => 'all')
456 456
 		);
457 457
 	}
458 458
 
459 459
 
460 460
 	protected function _delete_questions() {
461
-		$success = $this->_delete_items( $this->_question_model );
461
+		$success = $this->_delete_items($this->_question_model);
462 462
 		$this->_redirect_after_action(
463 463
 			$success,
464
-			$this->_question_model->item_name( $success ),
464
+			$this->_question_model->item_name($success),
465 465
 			'deleted permanently',
466
-			array( 'action' => 'default', 'status' => 'trash' )
466
+			array('action' => 'default', 'status' => 'trash')
467 467
 		);
468 468
 	}
469 469
 
@@ -474,26 +474,26 @@  discard block
 block discarded – undo
474 474
  * @param EEM_Soft_Delete_Base $model
475 475
  * @return int number of items deleted permanently
476 476
  */
477
-	private function _delete_items(EEM_Soft_Delete_Base $model){
477
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
478 478
 		$success = 0;
479
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
480
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
479
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
480
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
481 481
 			// if array has more than one element than success message should be plural
482
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
482
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
483 483
 			// cycle thru bulk action checkboxes
484
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
485
-				if ( ! $this->_delete_item( $ID, $model ) ) {
484
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
485
+				if ( ! $this->_delete_item($ID, $model)) {
486 486
 					$success = 0;
487 487
 				}
488 488
 			}
489 489
 
490
-		}elseif( !empty($this->_req_data['QSG_ID'])){
491
-			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
490
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
491
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
492 492
 
493
-		}elseif( !empty($this->_req_data['QST_ID'])){
494
-			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
495
-		}else{
496
-			EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
493
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
494
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
495
+		} else {
496
+			EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
497 497
 		}
498 498
 		return $success;
499 499
 	}
@@ -504,11 +504,11 @@  discard block
 block discarded – undo
504 504
 	 * @param EEM_Soft_Delete_Base $model
505 505
 	 * @return boolean
506 506
 	 */
507
-	protected function _delete_item( $id, $model ) {
508
-		if( $model instanceof EEM_Question ) {
509
-			EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) );
507
+	protected function _delete_item($id, $model) {
508
+		if ($model instanceof EEM_Question) {
509
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
510 510
 		}
511
-		return $model->delete_permanently_by_ID( absint( $id ) );
511
+		return $model->delete_permanently_by_ID(absint($id));
512 512
 	}
513 513
 
514 514
 
@@ -520,31 +520,31 @@  discard block
 block discarded – undo
520 520
 
521 521
 
522 522
 
523
-	protected function _edit_question_group( $type = 'add' ) {
524
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
525
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
526
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
523
+	protected function _edit_question_group($type = 'add') {
524
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
525
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
526
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
527 527
 		// add ID to title if editing
528
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
529
-		if($ID){
528
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
529
+		if ($ID) {
530 530
 			/** @var EE_Question_Group $questionGroup */
531
-			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
532
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
531
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
532
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
533 533
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
534
-		}else{
534
+		} else {
535 535
 			/** @var EE_Question_Group $questionGroup */
536 536
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
537 537
 			$questionGroup->set_order_to_latest();
538 538
 			$this->_set_add_edit_form_tags('insert_question_group');
539 539
 		}
540 540
 		$this->_template_args['values'] = $this->_yes_no_values;
541
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
542
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
543
-		$this->_template_args['question_group']=$questionGroup;
541
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
542
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
543
+		$this->_template_args['question_group'] = $questionGroup;
544 544
 
545
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
546
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
547
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE );
545
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
546
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
547
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE);
548 548
 
549 549
 		// the details template wrapper
550 550
 		$this->display_admin_page_with_sidebar();
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 
556 556
 	protected function _delete_question_groups() {
557 557
 		$success = $this->_delete_items($this->_question_group_model);
558
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
558
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
559 559
 	}
560 560
 
561 561
 
@@ -563,71 +563,71 @@  discard block
 block discarded – undo
563 563
 	/**
564 564
 	 * @param bool $new_question_group
565 565
 	 */
566
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
567
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
568
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
569
-		if ( $new_question_group ){
566
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
567
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
568
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
569
+		if ($new_question_group) {
570 570
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
571 571
 			$success = $QSG_ID ? 1 : 0;
572 572
 		} else {
573 573
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
574
-			unset( $set_column_values[ 'QSG_ID' ] );
575
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
574
+			unset($set_column_values['QSG_ID']);
575
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
576 576
 		}
577
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
577
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
578 578
 		// update the existing related questions
579 579
 		// BUT FIRST...  delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group)
580
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
580
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
581 581
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
582
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
582
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
583 583
 		}
584 584
 		/** @type EE_Question_Group $question_group */
585
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
585
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
586 586
 		$questions = $question_group->questions();
587 587
 		// make sure system phone question is added to list of questions for this group
588
-		if ( ! isset( $questions[$phone_question_id ] )) {
589
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
588
+		if ( ! isset($questions[$phone_question_id])) {
589
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
590 590
 		}
591 591
 
592
-		foreach( $questions as $question_ID => $question ){
592
+		foreach ($questions as $question_ID => $question) {
593 593
 			// first we always check for order.
594
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
594
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
595 595
 				//update question order
596
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
596
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
597 597
 			}
598 598
 
599 599
 			// then we always check if adding or removing.
600
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
601
-				$question_group->add_question( $question_ID );
600
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
601
+				$question_group->add_question($question_ID);
602 602
 			} else {
603 603
 				// not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it)
604 604
 				if (
605 605
 					in_array(
606 606
 						$question->system_ID(),
607
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
607
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
608 608
 					)
609 609
 				) {
610 610
 					continue;
611 611
 				} else {
612
-					$question_group->remove_question( $question_ID );
612
+					$question_group->remove_question($question_ID);
613 613
 				}
614 614
 			}
615 615
 		}
616 616
 		// save new related questions
617
-		if ( isset( $this->_req_data['questions'] )) {
618
-			foreach( $this->_req_data['questions'] as $QST_ID ){
619
-				$question_group->add_question( $QST_ID );
620
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
621
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
617
+		if (isset($this->_req_data['questions'])) {
618
+			foreach ($this->_req_data['questions'] as $QST_ID) {
619
+				$question_group->add_question($QST_ID);
620
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
621
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
622 622
 				}
623 623
 			}
624 624
 		}
625 625
 
626
-		if ( $success !== FALSE ) {
627
-			$msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
628
-			EE_Error::add_success( $msg );
626
+		if ($success !== FALSE) {
627
+			$msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
628
+			EE_Error::add_success($msg);
629 629
 		}
630
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
630
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
631 631
 
632 632
 	}
633 633
 
@@ -635,20 +635,20 @@  discard block
 block discarded – undo
635 635
 	 * duplicates a question and all its question options and redirects to the new question.
636 636
 	 */
637 637
 	public function _duplicate_question() {
638
-		$question_ID = (int)$this->_req_data[ 'QST_ID' ];
639
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
640
-		if( $question instanceof EE_Question ) {
638
+		$question_ID = (int) $this->_req_data['QST_ID'];
639
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
640
+		if ($question instanceof EE_Question) {
641 641
 			$new_question = $question->duplicate();
642
-			if( $new_question instanceof EE_Question ) {
643
-				$this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
642
+			if ($new_question instanceof EE_Question) {
643
+				$this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
644 644
 			} else {
645 645
 				global $wpdb;
646
-				EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
647
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
646
+				EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
647
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
648 648
 			}
649 649
 		} else {
650
-			EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
651
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
650
+			EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
651
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
652 652
 		}
653 653
 	}
654 654
 
@@ -657,8 +657,8 @@  discard block
 block discarded – undo
657 657
 	/**
658 658
 	 * @param bool $trash
659 659
 	 */
660
-	protected function _trash_or_restore_question_groups( $trash = TRUE) {
661
-		$this->_trash_or_restore_items( $this->_question_group_model, $trash );
660
+	protected function _trash_or_restore_question_groups($trash = TRUE) {
661
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
662 662
 	}
663 663
 
664 664
 
@@ -666,9 +666,9 @@  discard block
 block discarded – undo
666 666
 	/**
667 667
 	 *_trash_question
668 668
 	 */
669
-	protected function _trash_question(){
670
-		$success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] );
671
-		$query_args=array('action'=>'default','status'=>'all');
669
+	protected function _trash_question() {
670
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
671
+		$query_args = array('action'=>'default', 'status'=>'all');
672 672
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
673 673
 	}
674 674
 
@@ -677,8 +677,8 @@  discard block
 block discarded – undo
677 677
 	/**
678 678
 	 * @param bool $trash
679 679
 	 */
680
-	protected function _trash_or_restore_questions( $trash=TRUE){
681
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
680
+	protected function _trash_or_restore_questions($trash = TRUE) {
681
+		$this->_trash_or_restore_items($this->_question_model, $trash);
682 682
 	}
683 683
 
684 684
 
@@ -690,21 +690,21 @@  discard block
 block discarded – undo
690 690
 *@param EEM_Soft_Delete_Base $model
691 691
 	 * @param boolean $trash whether to trash or restore
692 692
 	 */
693
-	private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) {
693
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) {
694 694
 
695
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
695
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
696 696
 
697 697
 		$success = 1;
698 698
 		//Checkboxes
699 699
 		//echo "trash $trash";
700 700
 		//var_dump($this->_req_data['checkbox']);die;
701
-		if ( isset( $this->_req_data['checkbox'] )) {
702
-			if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
701
+		if (isset($this->_req_data['checkbox'])) {
702
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
703 703
 				// if array has more than one element than success message should be plural
704
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
704
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
705 705
 				// cycle thru bulk action checkboxes
706
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
707
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
706
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
707
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
708 708
 						$success = 0;
709 709
 					}
710 710
 				}
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 			} else {
713 713
 				// grab single id and delete
714 714
 				$ID = absint($this->_req_data['checkbox']);
715
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
715
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
716 716
 					$success = 0;
717 717
 				}
718 718
 			}
@@ -720,25 +720,25 @@  discard block
 block discarded – undo
720 720
 		} else {
721 721
 			// delete via trash link
722 722
 			// grab single id and delete
723
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
724
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
723
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
724
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
725 725
 				$success = 0;
726 726
 			}
727 727
 
728 728
 		}
729 729
 
730 730
 
731
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
731
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
732 732
 		//echo "action :$action";
733 733
 		//$action = 'questions' ? 'default' : $action;
734
-		if($trash){
734
+		if ($trash) {
735 735
 			$action_desc = 'trashed';
736 736
 			$status = 'trash';
737
-		}else{
737
+		} else {
738 738
 			$action_desc = 'restored';
739 739
 			$status = 'all';
740 740
 		}
741
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
741
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
742 742
 	}
743 743
 
744 744
 
@@ -749,16 +749,16 @@  discard block
 block discarded – undo
749 749
 	 * @param bool|false $count
750 750
 	 * @return \EE_Soft_Delete_Base_Class[]|int
751 751
 	 */
752
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
752
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
753 753
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
754 754
 
755
-		if( $count ){
755
+		if ($count) {
756 756
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
757
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
758
-			$results=$this->_question_model->count_deleted($where);
759
-		}else{
757
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
758
+			$results = $this->_question_model->count_deleted($where);
759
+		} else {
760 760
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
761
-			$results=$this->_question_model->get_all_deleted($query_params);
761
+			$results = $this->_question_model->get_all_deleted($query_params);
762 762
 		}
763 763
 		return $results;
764 764
 	}
@@ -771,13 +771,13 @@  discard block
 block discarded – undo
771 771
 	 * @param bool|false $count
772 772
 	 * @return \EE_Soft_Delete_Base_Class[]
773 773
 	 */
774
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
775
-		$questionGroupModel=EEM_Question_Group::instance();
776
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
777
-		if ($count){
778
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
774
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
775
+		$questionGroupModel = EEM_Question_Group::instance();
776
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
777
+		if ($count) {
778
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
779 779
 			$results = $questionGroupModel->count($where);
780
-		}else{
780
+		} else {
781 781
 			$results = $questionGroupModel->get_all($query_params);
782 782
 		}
783 783
 		return $results;
@@ -791,14 +791,14 @@  discard block
 block discarded – undo
791 791
 	 * @param bool $count
792 792
 	 * @return \EE_Soft_Delete_Base_Class[]|int
793 793
 	 */
794
-	public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
795
-		$questionGroupModel=EEM_Question_Group::instance();
796
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
797
-		if($count){
798
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
794
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
795
+		$questionGroupModel = EEM_Question_Group::instance();
796
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
797
+		if ($count) {
798
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
799 799
 			$query_params['limit'] = NULL;
800 800
 			$results = $questionGroupModel->count_deleted($where);
801
-		}else{
801
+		} else {
802 802
 			$results = $questionGroupModel->get_all_deleted($query_params);
803 803
 		}
804 804
 		return $results;
@@ -811,32 +811,32 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public function update_question_group_order() {
813 813
 
814
-		$success = __( 'Question group order was updated successfully.', 'event_espresso' );
814
+		$success = __('Question group order was updated successfully.', 'event_espresso');
815 815
 
816 816
 		// grab our row IDs
817
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] )
818
-			? explode( ',', rtrim( $this->_req_data['row_ids'], ',' ))
817
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
818
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
819 819
 			: array();
820 820
 
821
-		$perpage = !empty( $this->_req_data['perpage'] )
821
+		$perpage = ! empty($this->_req_data['perpage'])
822 822
 			? (int) $this->_req_data['perpage']
823 823
 			: NULL;
824
-		$curpage = !empty( $this->_req_data['curpage'] )
824
+		$curpage = ! empty($this->_req_data['curpage'])
825 825
 			? (int) $this->_req_data['curpage']
826 826
 			: NULL;
827 827
 
828
-		if ( ! empty( $row_ids ) ) {
828
+		if ( ! empty($row_ids)) {
829 829
 			//figure out where we start the row_id count at for the current page.
830
-			$qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
830
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
831 831
 
832
-			$row_count = count( $row_ids );
833
-			for( $i = 0; $i < $row_count; $i++ ) {
832
+			$row_count = count($row_ids);
833
+			for ($i = 0; $i < $row_count; $i++) {
834 834
 				//Update the questions when re-ordering
835 835
 				$updated = EEM_Question_Group::instance()->update(
836
-					array( 'QSG_order' => $qsgcount ),
837
-					array( array( 'QSG_ID' => $row_ids[ $i ] ) )
836
+					array('QSG_order' => $qsgcount),
837
+					array(array('QSG_ID' => $row_ids[$i]))
838 838
 				);
839
-				if ( $updated === false ) {
839
+				if ($updated === false) {
840 840
 					$success = false;
841 841
 				}
842 842
 				$qsgcount++;
@@ -846,10 +846,10 @@  discard block
 block discarded – undo
846 846
 		}
847 847
 
848 848
 		$errors = ! $success
849
-			? __( 'An error occurred. The question group order was not updated.', 'event_espresso' )
849
+			? __('An error occurred. The question group order was not updated.', 'event_espresso')
850 850
 			: false;
851 851
 
852
-		echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors ));
852
+		echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
853 853
 		die();
854 854
 
855 855
 	}
@@ -868,17 +868,17 @@  discard block
 block discarded – undo
868 868
 		$this->_template_args['values'] = $this->_yes_no_values;
869 869
 		add_action(
870 870
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
871
-			array( $this, 'email_validation_settings_form' ),
871
+			array($this, 'email_validation_settings_form'),
872 872
 			2
873 873
 		);
874
-		$this->_template_args = (array)apply_filters(
874
+		$this->_template_args = (array) apply_filters(
875 875
 			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
876 876
 			$this->_template_args
877 877
 		);
878
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
879
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
878
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
879
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
880 880
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
881
-			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
881
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
882 882
 			$this->_template_args,
883 883
 			TRUE
884 884
 		);
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
 			EE_Registry::instance()->CFG,
900 900
 			__FILE__, __FUNCTION__, __LINE__
901 901
 		);
902
-		$this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
902
+		$this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
903 903
 	}
904 904
 
905 905
 
@@ -930,20 +930,20 @@  discard block
 block discarded – undo
930 930
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
931 931
 				'subsections'     => array(
932 932
 					'email_validation_hdr'           => new EE_Form_Section_HTML(
933
-						EEH_HTML::h2( __( 'Email Validation Settings', 'event_espresso' ) )
933
+						EEH_HTML::h2(__('Email Validation Settings', 'event_espresso'))
934 934
 					),
935 935
 					'email_validation_level' => new EE_Select_Input(
936 936
 						array(
937
-							'basic'      => __( 'Basic', 'event_espresso' ),
938
-							'wp_default' => __( 'WordPress Default', 'event_espresso' ),
939
-							'i18n'       => __( 'International', 'event_espresso' ),
940
-							'i18n_dns'   => __( 'International + DNS Check', 'event_espresso' ),
937
+							'basic'      => __('Basic', 'event_espresso'),
938
+							'wp_default' => __('WordPress Default', 'event_espresso'),
939
+							'i18n'       => __('International', 'event_espresso'),
940
+							'i18n_dns'   => __('International + DNS Check', 'event_espresso'),
941 941
 						),
942 942
 						array(
943
-							'html_label_text' => __( 'Email Validation Level', 'event_espresso' )
944
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
945
-							'html_help_text'  => __( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
946
-							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
943
+							'html_label_text' => __('Email Validation Level', 'event_espresso')
944
+							                     . EEH_Template::get_help_tab_link('email_validation_info'),
945
+							'html_help_text'  => __('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
946
+							'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level)
947 947
 								? EE_Registry::instance()->CFG->registration->email_validation_level
948 948
 								: 'wp_default',
949 949
 							'required'        => false
@@ -962,18 +962,18 @@  discard block
 block discarded – undo
962 962
 	 * @param \EE_Registration_Config $EE_Registration_Config
963 963
 	 * @return \EE_Registration_Config
964 964
 	 */
965
-	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
965
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) {
966 966
 		try {
967 967
 			$email_validation_settings_form = $this->_email_validation_settings_form();
968 968
 			// if not displaying a form, then check for form submission
969
-			if ( $email_validation_settings_form->was_submitted() ) {
969
+			if ($email_validation_settings_form->was_submitted()) {
970 970
 				// capture form data
971 971
 				$email_validation_settings_form->receive_form_submission();
972 972
 				// validate form data
973
-				if ( $email_validation_settings_form->is_valid() ) {
973
+				if ($email_validation_settings_form->is_valid()) {
974 974
 					// grab validated data from form
975 975
 					$valid_data = $email_validation_settings_form->valid_data();
976
-					if ( isset( $valid_data['email_validation_level'] ) ) {
976
+					if (isset($valid_data['email_validation_level'])) {
977 977
 						$EE_Registration_Config->email_validation_level = $valid_data['email_validation_level'];
978 978
 					} else {
979 979
 						EE_Error::add_error(
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 						);
988 988
 					}
989 989
 				} else {
990
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
990
+					if ($email_validation_settings_form->submission_error_message() !== '') {
991 991
 						EE_Error::add_error(
992 992
 							$email_validation_settings_form->submission_error_message(),
993 993
 							__FILE__,
@@ -997,7 +997,7 @@  discard block
 block discarded – undo
997 997
 					}
998 998
 				}
999 999
 			}
1000
-		} catch ( EE_Error $e ) {
1000
+		} catch (EE_Error $e) {
1001 1001
 			$e->get_error();
1002 1002
 		}
1003 1003
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -245,13 +245,13 @@  discard block
 block discarded – undo
245 245
 					'persistent' => FALSE
246 246
 					),
247 247
 				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
248
-                'help_tabs' => array(
248
+				'help_tabs' => array(
249 249
 					'registration_form_add_question_help_tab' => array(
250 250
 						'title' => __('Add Question', 'event_espresso'),
251 251
 						'filename' => 'registration_form_add_question'
252 252
 						),
253 253
 					),
254
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
254
+				'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
255 255
 				'require_nonce' => FALSE
256 256
 				),
257 257
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 						'filename' => 'registration_form_add_question_group'
269 269
 						),
270 270
 					),
271
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
271
+				'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
272 272
 				'require_nonce' => FALSE
273 273
 				),
274 274
 
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 						'filename' => 'registration_form_edit_question_group'
287 287
 						),
288 288
 					),
289
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
289
+				'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
290 290
 				'require_nonce' => FALSE
291 291
 				),
292 292
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 						'filename' => 'registration_form_reg_form_settings'
306 306
 						),
307 307
 					),
308
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
308
+				'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
309 309
 				'require_nonce' => FALSE
310 310
 				)
311 311
 
@@ -941,7 +941,7 @@  discard block
 block discarded – undo
941 941
 						),
942 942
 						array(
943 943
 							'html_label_text' => __( 'Email Validation Level', 'event_espresso' )
944
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
944
+												 . EEH_Template::get_help_tab_link( 'email_validation_info' ),
945 945
 							'html_help_text'  => __( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'),
946 946
 							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
947 947
 								? EE_Registry::instance()->CFG->registration->email_validation_level
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 1 patch
Spacing   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2 2
 	exit('No direct script access allowed');
3 3
 }
4
-require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' );
5
-require_once( EE_CLASSES . 'EE_Question.class.php' );
4
+require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php');
5
+require_once(EE_CLASSES.'EE_Question.class.php');
6 6
 
7 7
 
8 8
 
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
 	/**
75 75
 	 * @param null $timezone
76 76
 	 */
77
-	protected function __construct( $timezone = NULL ) {
78
-		$this->singular_item = __('Question','event_espresso');
79
-		$this->plural_item = __('Questions','event_espresso');
80
-		$this->_allowed_question_types=apply_filters(
77
+	protected function __construct($timezone = NULL) {
78
+		$this->singular_item = __('Question', 'event_espresso');
79
+		$this->plural_item = __('Questions', 'event_espresso');
80
+		$this->_allowed_question_types = apply_filters(
81 81
 			'FHEE__EEM_Question__construct__allowed_question_types',
82 82
 			array(
83
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
84
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
85
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
86
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
87
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
88
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
89
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
90
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
91
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
83
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
84
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
85
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
86
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
87
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
88
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
89
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
90
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
91
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
92 92
 			)
93 93
 		);
94
-		$this->_question_type_categories = (array)apply_filters(
94
+		$this->_question_type_categories = (array) apply_filters(
95 95
 				'FHEE__EEM_Question__construct__question_type_categories',
96 96
 				array(
97 97
 				'text' => array(
@@ -107,22 +107,22 @@  discard block
 block discarded – undo
107 107
 		);
108 108
 
109 109
 		$this->_tables = array(
110
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
110
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
111 111
 		);
112 112
 		$this->_fields = array(
113 113
 			'Question'=>array(
114
-				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
115
-				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
116
-				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''),
117
-				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
118
-				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
119
-				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
120
-				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
121
-				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
122
-				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
123
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
124
-				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
125
-				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
114
+				'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
115
+				'QST_display_text'=>new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
116
+				'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
117
+				'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
118
+				'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
119
+				'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
120
+				'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
121
+				'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
122
+				'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
123
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
124
+				'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
125
+				'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
126 126
 			)
127 127
 		);
128 128
 		$this->_model_relations = array(
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 			'Question_Group_Question'=>new EE_Has_Many_Relation()
135 135
 		);
136 136
 		//this model is generally available for reading
137
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
138
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
141
-		parent::__construct( $timezone );
137
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
138
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
139
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
140
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
141
+		parent::__construct($timezone);
142 142
 	}
143 143
 
144 144
 	/**
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * but they can be extended
147 147
 	 * @return string[]
148 148
 	 */
149
-	public function allowed_question_types(){
149
+	public function allowed_question_types() {
150 150
 		return $this->_allowed_question_types;
151 151
 	}
152 152
 	/**
@@ -154,16 +154,16 @@  discard block
 block discarded – undo
154 154
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
155 155
 	 * @return string[] like EEM_Question::allowed_question_types()
156 156
 	 */
157
-	public function question_types_in_same_category( $question_type ) {
158
-		$question_types = array( $question_type );
159
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
160
-			if( in_array( $question_type, $question_types_in_category ) ) {
157
+	public function question_types_in_same_category($question_type) {
158
+		$question_types = array($question_type);
159
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
160
+			if (in_array($question_type, $question_types_in_category)) {
161 161
 				$question_types = $question_types_in_category;
162 162
 				break;
163 163
 			}
164 164
 		}
165 165
 
166
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
166
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
167 167
 	}
168 168
 
169 169
 	/**
@@ -172,11 +172,11 @@  discard block
 block discarded – undo
172 172
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
173 173
 	 * @return boolean
174 174
 	 */
175
-	public function question_type_is_in_category( $question_type, $category ) {
176
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
175
+	public function question_type_is_in_category($question_type, $category) {
176
+		if ( ! isset($this->_question_type_categories[$category])) {
177 177
 			return false;
178 178
 		}
179
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
179
+		return in_array($question_type, $this->_question_type_categories[$category]);
180 180
 	}
181 181
 
182 182
 	/**
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 	 * @param string $system_question_group_id QSG_system
194 194
 	 * @return array of system question names (QST_system)
195 195
 	 */
196
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
196
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
197 197
 		$question_system_ids = array();
198
-		switch( $system_question_group_id ) {
198
+		switch ($system_question_group_id) {
199 199
 			case EEM_Question_Group::system_personal:
200 200
 				$question_system_ids = array(
201 201
 					EEM_Attendee::system_question_fname,
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				);
217 217
 				break;
218 218
 		}
219
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
219
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
220 220
 	}
221 221
 
222 222
 	/**
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 * @param string $system_question_group_id QSG_system
226 226
 	 * @return array of system question names (QST_system)
227 227
 	 */
228
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
228
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
229 229
 		$question_system_ids = null;
230
-		switch( $system_question_group_id ) {
230
+		switch ($system_question_group_id) {
231 231
 			case EEM_Question_Group::system_personal:
232
-				$question_system_ids =  array(
232
+				$question_system_ids = array(
233 233
 					EEM_Attendee::system_question_fname,
234 234
 					EEM_Attendee::system_question_email,
235 235
 				);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 			default:
238 238
 				$question_system_ids = array();
239 239
 		}
240
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
240
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
241 241
 	}
242 242
 
243 243
 
@@ -248,8 +248,8 @@  discard block
 block discarded – undo
248 248
 	 * @param $QST_system
249 249
 	 * @return int of QST_ID for the question that corresponds to that QST_system
250 250
 	 */
251
-	public function get_Question_ID_from_system_string( $QST_system ){
252
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
251
+	public function get_Question_ID_from_system_string($QST_system) {
252
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
253 253
 	}
254 254
 
255 255
 
@@ -261,10 +261,10 @@  discard block
 block discarded – undo
261 261
 	 */
262 262
 	public function get_latest_question_order() {
263 263
 		$columns_to_select = array(
264
-			'max_order' => array("MAX(QST_order)","%d")
264
+			'max_order' => array("MAX(QST_order)", "%d")
265 265
 		);
266
-		$max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
267
-		return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0;
266
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
267
+		return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
268 268
 	}
269 269
 
270 270
 	/**
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * @param string $system_question_value
294 294
 	 * @return int|float
295 295
 	 */
296
-	public function absolute_max_for_system_question( $system_question_value ) {
296
+	public function absolute_max_for_system_question($system_question_value) {
297 297
 		$maxes = $this->system_question_maxes();
298
-		if( isset( $maxes[ $system_question_value ] ) ) {
299
-			return $maxes[ $system_question_value ];
298
+		if (isset($maxes[$system_question_value])) {
299
+			return $maxes[$system_question_value];
300 300
 		} else {
301 301
 			return EE_INF;
302 302
 		}
Please login to merge, or discard this patch.
core/EE_Load_Espresso_Core.core.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 /**
6 6
  *
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @param 	EE_Response $response
54 54
 	 * @return 	EE_Response
55 55
 	 */
56
-	public function handle_request( EE_Request $request, EE_Response $response ) {
56
+	public function handle_request(EE_Request $request, EE_Response $response) {
57 57
 		$this->request = $request;
58 58
 		$this->response = $response;
59 59
 		// central repository for classes
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 		// workarounds for PHP < 5.3
62 62
 		$this->_load_class_tools();
63 63
 		// PSR4 Autoloaders
64
-		EE_Registry::instance()->load_core( 'EE_Psr4AutoloaderInit' );
64
+		EE_Registry::instance()->load_core('EE_Psr4AutoloaderInit');
65 65
 		// deprecated functions
66
-		espresso_load_required( 'EE_Deprecated', EE_CORE . 'EE_Deprecated.core.php' );
66
+		espresso_load_required('EE_Deprecated', EE_CORE.'EE_Deprecated.core.php');
67 67
 		// load interfaces
68
-		espresso_load_required( 'EEI_Payment_Method_Interfaces', EE_LIBRARIES . 'payment_methods' . DS . 'EEI_Payment_Method_Interfaces.php' );
68
+		espresso_load_required('EEI_Payment_Method_Interfaces', EE_LIBRARIES.'payment_methods'.DS.'EEI_Payment_Method_Interfaces.php');
69 69
 		//// WP cron jobs
70
-		EE_Registry::instance()->load_core( 'Cron_Tasks' );
71
-		EE_Registry::instance()->load_core( 'Request_Handler' );
72
-		EE_Registry::instance()->load_core( 'EE_System' );
70
+		EE_Registry::instance()->load_core('Cron_Tasks');
71
+		EE_Registry::instance()->load_core('Request_Handler');
72
+		EE_Registry::instance()->load_core('EE_System');
73 73
 
74 74
 		return $this->response;
75 75
 	}
@@ -83,12 +83,12 @@  discard block
 block discarded – undo
83 83
 	 * 	@return void
84 84
 	 */
85 85
 	private function _load_registry() {
86
-		if ( is_readable( EE_CORE . 'EE_Registry.core.php' )) {
87
-			require_once( EE_CORE . 'EE_Registry.core.php' );
86
+		if (is_readable(EE_CORE.'EE_Registry.core.php')) {
87
+			require_once(EE_CORE.'EE_Registry.core.php');
88 88
 		} else {
89
-			$msg = __( 'The EE_Registry core class could not be loaded.', 'event_espresso' );
90
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
91
-			wp_die( EE_Error::get_notices() );
89
+			$msg = __('The EE_Registry core class could not be loaded.', 'event_espresso');
90
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
91
+			wp_die(EE_Error::get_notices());
92 92
 		}
93 93
 	}
94 94
 
@@ -100,11 +100,11 @@  discard block
 block discarded – undo
100 100
 	 * 	@return void
101 101
 	 */
102 102
 	private function _load_class_tools() {
103
-		if ( is_readable( EE_HELPERS . 'EEH_Class_Tools.helper.php' )) {
104
-			require_once( EE_HELPERS . 'EEH_Class_Tools.helper.php' );
103
+		if (is_readable(EE_HELPERS.'EEH_Class_Tools.helper.php')) {
104
+			require_once(EE_HELPERS.'EEH_Class_Tools.helper.php');
105 105
 		} else {
106
-			$msg = __( 'The EEH_Class_Tools helper could not be loaded.', 'event_espresso' );
107
-			EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ );
106
+			$msg = __('The EEH_Class_Tools helper could not be loaded.', 'event_espresso');
107
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
108 108
 		}
109 109
 	}
110 110
 
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 	 * @param \EE_Request $request
120 120
 	 * @param \EE_Response $response
121 121
 	 */
122
-	public function handle_response( EE_Request $request, EE_Response $response ) {
122
+	public function handle_response(EE_Request $request, EE_Response $response) {
123 123
 		//\EEH_Debug_Tools::printr( __FUNCTION__, __CLASS__, __FILE__, __LINE__, 2 );
124 124
 		//EEH_Debug_Tools::printr( $request, '$request', __FILE__, __LINE__ );
125 125
 		//EEH_Debug_Tools::printr( $response, '$response', __FILE__, __LINE__ );
126 126
 		//die();
127
-		if ( $response->plugin_deactivated() ) {
128
-			espresso_deactivate_plugin( EE_PLUGIN_BASENAME );
127
+		if ($response->plugin_deactivated()) {
128
+			espresso_deactivate_plugin(EE_PLUGIN_BASENAME);
129 129
 		}
130 130
 	}
131 131
 
Please login to merge, or discard this patch.
core/middleware/EE_Middleware.core.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @access 	public
44 44
 	 * @param 	\EEI_Request_Decorator $request_stack
45 45
 	 */
46
-	public function __construct( EEI_Request_Decorator $request_stack ) {
46
+	public function __construct(EEI_Request_Decorator $request_stack) {
47 47
 		$this->_request_stack = $request_stack;
48 48
 	}
49 49
 
@@ -57,11 +57,11 @@  discard block
 block discarded – undo
57 57
 	 * @param 	EE_Response $response
58 58
 	 * @return 	EE_Response
59 59
 	 */
60
-	protected function process_request_stack( EE_Request $request, EE_Response $response ) {
60
+	protected function process_request_stack(EE_Request $request, EE_Response $response) {
61 61
 		$this->_request = $request;
62 62
 		$this->_response = $response;
63
-		if ( ! $this->_response->request_terminated() ) {
64
-			$this->_response = $this->_request_stack->handle_request( $this->_request, $this->_response );
63
+		if ( ! $this->_response->request_terminated()) {
64
+			$this->_response = $this->_request_stack->handle_request($this->_request, $this->_response);
65 65
 		}
66 66
 		return $this->_response;
67 67
 	}
Please login to merge, or discard this patch.
core/middleware/EE_Alpha_Banner_Warning.core.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -21,11 +21,11 @@  discard block
 block discarded – undo
21 21
 	 * @param 	EE_Response $response
22 22
 	 * @return 	EE_Response
23 23
 	 */
24
-	public function handle_request( EE_Request $request, EE_Response $response ) {
24
+	public function handle_request(EE_Request $request, EE_Response $response) {
25 25
 		$this->_request = $request;
26 26
 		$this->_response = $response;
27 27
 		$this->display_alpha_banner_warning();
28
-		$this->_response = $this->process_request_stack( $this->_request, $this->_response );
28
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
29 29
 		return $this->_response;
30 30
 	}
31 31
 
@@ -41,22 +41,22 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	public function display_alpha_banner_warning() {
43 43
 		// skip AJAX requests
44
-		if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
44
+		if (defined('DOING_AJAX') && DOING_AJAX) {
45 45
 			return;
46 46
 		}
47 47
 		// skip stable releases
48
-		if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) {
48
+		if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) {
49 49
 			return;
50 50
 		}
51 51
 		// post release candidate warning
52
-		if ( is_admin() ) {
53
-			add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 );
52
+		if (is_admin()) {
53
+			add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999);
54 54
 		} else {
55 55
 			// site admin has authorized use of non-stable release candidate for production
56
-			if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) {
56
+			if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) {
57 57
 				return;
58 58
 			}
59
-			add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 );
59
+			add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10);
60 60
 		}
61 61
 	}
62 62
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 	public function alpha_banner_admin_notice() {
73 73
 		EE_Error::add_attention(
74 74
 			sprintf(
75
-				__( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ),
75
+				__('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'),
76 76
 				'<strong>',
77 77
 				'</strong>'
78 78
 			),
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 */
92 92
 	public function alpha_banner_warning_notice() {
93 93
 		printf(
94
-			__( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ),
94
+			__('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'),
95 95
 			'<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>',
96 96
 			'<strong>',
97 97
 			'</strong>',
Please login to merge, or discard this patch.
core/middleware/EE_Detect_Login.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
3
-	exit( 'No direct script access allowed' );
2
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
+	exit('No direct script access allowed');
4 4
 }
5 5
 
6 6
 
@@ -26,14 +26,14 @@  discard block
 block discarded – undo
26 26
 	 * @param    EE_Response $response
27 27
 	 * @return    EE_Response
28 28
 	 */
29
-	public function handle_request( EE_Request $request, EE_Response $response ) {
29
+	public function handle_request(EE_Request $request, EE_Response $response) {
30 30
 		$this->_request = $request;
31 31
 		$this->_response = $response;
32 32
 		global $pagenow;
33
-		if ( in_array( $pagenow, array( 'wp-login.php', 'wp-register.php' ) ) ) {
33
+		if (in_array($pagenow, array('wp-login.php', 'wp-register.php'))) {
34 34
 			$this->_response->terminate_request();
35 35
 		}
36
-		$this->_response = $this->process_request_stack( $this->_request, $this->_response );
36
+		$this->_response = $this->process_request_stack($this->_request, $this->_response);
37 37
 		return $this->_response;
38 38
 	}
39 39
 
Please login to merge, or discard this patch.
core/request_stack/EE_Request_Stack.core.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 	 * @param 	EEI_Request_Decorator $application
44 44
 	 * @param 	array $middlewares
45 45
 	 */
46
-	public function __construct( EEI_Request_Decorator $application, $middlewares = array() ) {
46
+	public function __construct(EEI_Request_Decorator $application, $middlewares = array()) {
47 47
 		$this->_application = $application;
48 48
 		$this->_middlewares = $middlewares;
49 49
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @param 	EE_Response $response
56 56
 	 * @return 	EE_Response
57 57
 	 */
58
-	public function handle_request( EE_Request $request, EE_Response $response ) {
58
+	public function handle_request(EE_Request $request, EE_Response $response) {
59 59
 		$this->_request = $request;
60 60
 		$this->_response = $response;
61
-		return $this->_application->handle_request( $request, $response );
61
+		return $this->_application->handle_request($request, $response);
62 62
 	}
63 63
 
64 64
 
@@ -69,9 +69,9 @@  discard block
 block discarded – undo
69 69
 	 * after the request stack has been fully processed
70 70
 	 */
71 71
 	public function handle_response() {
72
-		foreach ( $this->_middlewares as $middleware ) {
73
-			if ( $middleware instanceof EEI_Request_Stack_Core_App ) {
74
-				$middleware->handle_response( $this->_request, $this->_response );
72
+		foreach ($this->_middlewares as $middleware) {
73
+			if ($middleware instanceof EEI_Request_Stack_Core_App) {
74
+				$middleware->handle_response($this->_request, $this->_response);
75 75
 				// exit loop since we should be done
76 76
 				// (also in case someone has accidentally labeled multiple apps as the EEI_Request_Stack_Core_App )
77 77
 				break;
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlerBaseClasses/JobHandlerFile.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
 use EventEspressoBatchRequest\Helpers\BatchRequestException;
18 18
 
19
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
20
-	exit( 'No direct script access allowed' );
19
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 	 *
40 40
 	 * @param \EEHI_File|null $file_helper
41 41
 	 */
42
-	public function __construct( \EEHI_File $file_helper = null ) {
43
-		if( ! $file_helper ) {
42
+	public function __construct(\EEHI_File $file_helper = null) {
43
+		if ( ! $file_helper) {
44 44
 			$this->_file_helper = new \EEH_File();
45 45
 		}
46 46
 	}
@@ -56,39 +56,39 @@  discard block
 block discarded – undo
56 56
 	 * @return string
57 57
 	 * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException
58 58
 	 */
59
-	public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) {
59
+	public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') {
60 60
 		$filepath = '';
61
-		try{
61
+		try {
62 62
 			$base_folder = $this->get_base_folder();
63 63
 			$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
64
-				$base_folder . JobHandlerFile::temp_folder_name
64
+				$base_folder.JobHandlerFile::temp_folder_name
65 65
 			);
66
-			if ( $success ) {
66
+			if ($success) {
67 67
 				$success = $this->_file_helper->ensure_folder_exists_and_is_writable(
68
-					$base_folder . JobHandlerFile::temp_folder_name . DS . $job_id
68
+					$base_folder.JobHandlerFile::temp_folder_name.DS.$job_id
69 69
 				);
70 70
 			}
71
-			if( $success ) {
72
-				$filepath = $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename;
73
-				$success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath );
71
+			if ($success) {
72
+				$filepath = $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename;
73
+				$success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath);
74 74
 			}
75 75
 			//let's add the .htaccess file so safari will open the file properly
76
-			if( $success ) {
77
-				$extension = \EEH_File::get_file_extension( $filepath );
76
+			if ($success) {
77
+				$extension = \EEH_File::get_file_extension($filepath);
78 78
 				\EEH_File::write_to_file(
79
-					$base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess',
80
-					'AddType ' . $filetype . ' ' . $extension,
79
+					$base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess',
80
+					'AddType '.$filetype.' '.$extension,
81 81
 					'.htaccess'
82 82
 				);
83 83
 			}
84 84
 			//those methods normally fail with an exception, but if not, let's do it
85
-			if( ! $success ) {
86
-				throw new \EE_Error( __( 'Could not create temporary file, an unknown error occurred', 'event_espresso' ) );
85
+			if ( ! $success) {
86
+				throw new \EE_Error(__('Could not create temporary file, an unknown error occurred', 'event_espresso'));
87 87
 			}
88
-		} catch( \EE_Error $e ) {
88
+		} catch (\EE_Error $e) {
89 89
 			throw new BatchRequestException(
90 90
 				sprintf(
91
-					__( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ),
91
+					__('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'),
92 92
 					$job_id,
93 93
 					$e->getMessage()
94 94
 				),
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 	 * @param string $filepath
105 105
 	 * @return string url to file
106 106
 	 */
107
-	public function get_url_to_file( $filepath ) {
108
-		return str_replace( $this->get_base_folder(), $this->get_base_url(), $filepath );
107
+	public function get_url_to_file($filepath) {
108
+		return str_replace($this->get_base_folder(), $this->get_base_url(), $filepath);
109 109
 	}
110 110
 	
111 111
 	/**
Please login to merge, or discard this patch.