Completed
Branch FET-9413-questions-refactor (bd7ded)
by
unknown
196:24 queued 185:12
created
admin_pages/other_services/Other_Services_Admin_Page.core.php 2 patches
Spacing   +4 added lines, -4 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
 /**
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 
88 88
 
89 89
 	public function load_scripts_styles() {
90
-		wp_register_style( 'ee-other-services-css', EE_OTHER_SERVICES_ASSETS_URL . 'other-services.css' , array('ee-admin-css') , EVENT_ESPRESSO_VERSION );
91
-		wp_enqueue_style( 'ee-other-services-css' );
90
+		wp_register_style('ee-other-services-css', EE_OTHER_SERVICES_ASSETS_URL.'other-services.css', array('ee-admin-css'), EVENT_ESPRESSO_VERSION);
91
+		wp_enqueue_style('ee-other-services-css');
92 92
 	}
93 93
 
94 94
 
95 95
 	protected function _other_services() {
96
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH . 'other_services_content.template.php', array(), true );
96
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH.'other_services_content.template.php', array(), true);
97 97
 		$this->display_admin_page_with_no_sidebar();
98 98
 	}
99 99
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
admin_pages/other_services/Other_Services_Admin_Page_Init.core.php 2 patches
Spacing   +7 added lines, -7 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
 /**
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function __construct() {
34 34
 		//define some help/support page related constants
35
-		define( 'EE_OTHER_SERVICES_PG_SLUG', 'espresso_packages' );
36
-		define( 'EE_OTHER_SERVICES_ADMIN_URL', admin_url('admin.php?page=' . EE_OTHER_SERVICES_PG_SLUG ));
37
-		define( 'EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES . 'other_services/templates/');
38
-		define( 'EE_OTHER_SERVICES_ADMIN', EE_ADMIN_PAGES . 'other_services/' );
39
-		define( 'EE_OTHER_SERVICES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'other_services/assets/');
35
+		define('EE_OTHER_SERVICES_PG_SLUG', 'espresso_packages');
36
+		define('EE_OTHER_SERVICES_ADMIN_URL', admin_url('admin.php?page='.EE_OTHER_SERVICES_PG_SLUG));
37
+		define('EE_OTHER_SERVICES_ADMIN_TEMPLATE_PATH', EE_ADMIN_PAGES.'other_services/templates/');
38
+		define('EE_OTHER_SERVICES_ADMIN', EE_ADMIN_PAGES.'other_services/');
39
+		define('EE_OTHER_SERVICES_ASSETS_URL', EE_ADMIN_PAGES_URL.'other_services/assets/');
40 40
 
41 41
 		parent::__construct();
42 42
 	}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 
48 48
 	protected function _set_menu_map() {
49
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
49
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
50 50
 			'menu_group' => 'extras',
51 51
 			'menu_order' => 30,
52 52
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_AND_NETWORK_ADMIN,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
payments/help_tours/Payment_Methods_Selection_Help_Tour.class.php 2 patches
Spacing   +6 added lines, -6 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
 /**
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 
69 69
 
70 70
 	protected function _start() {
71
-		$content = '<h3>' . __('Payment Methods', 'event_espresso') . '</h3>';
72
-		$content .= '<p>' . __('This tour of the Payment Methods page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
71
+		$content = '<h3>'.__('Payment Methods', 'event_espresso').'</h3>';
72
+		$content .= '<p>'.__('This tour of the Payment Methods page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
73 73
 		return $content;
74 74
 	}
75 75
 
76 76
 	protected function _gateway_links_stop() {
77
-		return '<p>' . __('Available payment methods are shown here. Clicking on a payment method will provide you with an option to activate that payment gateway.', 'event_espresso') . '</p>';
77
+		return '<p>'.__('Available payment methods are shown here. Clicking on a payment method will provide you with an option to activate that payment gateway.', 'event_espresso').'</p>';
78 78
 	}
79 79
 
80 80
 	protected function _gateway_settings_metabox_stop() {
81
-		return '<p>' . __('A payment gateway must first be enabled. You will then be able to configure the payment gateway. Be sure to save settings after configuring your payment gateway.', 'event_espresso') . '</p>';
81
+		return '<p>'.__('A payment gateway must first be enabled. You will then be able to configure the payment gateway. Be sure to save settings after configuring your payment gateway.', 'event_espresso').'</p>';
82 82
 	}
83 83
 
84 84
 	protected function _end_tour_stop() {
85
-		return '<p>' . __('After configuring your payment gateway, go to the Event Editor to create your first event with Event Espresso.', 'event_espresso') . '</p>';
85
+		return '<p>'.__('After configuring your payment gateway, go to the Event Editor to create your first event with Event Espresso.', 'event_espresso').'</p>';
86 86
 	}
87 87
 
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
payments/help_tours/Payment_Methods_Settings_Help_Tour.class.php 2 patches
Spacing   +4 added lines, -4 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
 /**
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
 
54 54
 
55 55
 	protected function _start() {
56
-		$content = '<h3>' . __('Payment Settings', 'event_espresso') . '</h3>';
57
-		$content .= '<p>' . __('This tour of the Payment Settings page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso') . '</p>';
56
+		$content = '<h3>'.__('Payment Settings', 'event_espresso').'</h3>';
57
+		$content .= '<p>'.__('This tour of the Payment Settings page will go over different areas of the screen to help you understand what they are used for.', 'event_espresso').'</p>';
58 58
 		return $content;
59 59
 	}
60 60
 
61 61
 	protected function _show_pending_options_stop() {
62
-		return '<p>' . __('Specify whether to provide your registrants with the option to retry payments.', 'event_espresso') . '</p>';
62
+		return '<p>'.__('Specify whether to provide your registrants with the option to retry payments.', 'event_espresso').'</p>';
63 63
 	}
64 64
 }
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
admin_pages/payments/templates/payment_log_details.template.php 3 patches
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -3,27 +3,27 @@
 block discarded – undo
3 3
 if (!defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 /**
6
- * Event Espresso
7
- *
8
- * Event Registration and Management Plugin for WordPress
9
- *
10
- * @ package			Event Espresso
11
- * @ author			Seth Shoultes
12
- * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
13
- * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
14
- * @ link					http://www.eventespresso.com
15
- * @ version		 	4.3
16
- *
17
- * ------------------------------------------------------------------------
18
- *
19
- * payment_log_details
20
- *
21
- * @package			Event Espresso
22
- * @subpackage
23
- * @author				Mike Nelson
24
- *
25
- * ------------------------------------------------------------------------
26
- */
6
+	 * Event Espresso
7
+	 *
8
+	 * Event Registration and Management Plugin for WordPress
9
+	 *
10
+	 * @ package			Event Espresso
11
+	 * @ author			Seth Shoultes
12
+	 * @ copyright		(c) 2008-2011 Event Espresso  All Rights Reserved.
13
+	 * @ license			http://eventespresso.com/support/terms-conditions/   * see Plugin Licensing *
14
+	 * @ link					http://www.eventespresso.com
15
+	 * @ version		 	4.3
16
+	 *
17
+	 * ------------------------------------------------------------------------
18
+	 *
19
+	 * payment_log_details
20
+	 *
21
+	 * @package			Event Espresso
22
+	 * @subpackage
23
+	 * @author				Mike Nelson
24
+	 *
25
+	 * ------------------------------------------------------------------------
26
+	 */
27 27
 /*@var EE_Change_Log $payment_Log */
28 28
 /*@var EE_Payment_Method $payment_Method*/
29 29
 /*@var EE_Transaction $transaction*/
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 /**
6 6
  * Event Espresso
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 					</label>
62 62
 				</th>
63 63
 				<td>
64
-					<?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso');?>
64
+					<?php echo $transaction ? $transaction->ID() : __("Could not be determined", 'event_espresso'); ?>
65 65
 
66 66
 				</td>
67 67
 			</tr>
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 					</label>
73 73
 				</th>
74 74
 				<td>
75
-					<?php echo $payment_log->e('LOG_message','as_table');//EEH_Template::layout_array_as_table($payment_log->content())?>
75
+					<?php echo $payment_log->e('LOG_message', 'as_table'); //EEH_Template::layout_array_as_table($payment_log->content())?>
76 76
 				</td>
77 77
 			</tr>
78 78
 		</tbody>
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if (!defined('EVENT_ESPRESSO_VERSION')) {
4 4
 	exit('No direct script access allowed');
5
+}
5 6
 /**
6 7
  * Event Espresso
7 8
  *
Please login to merge, or discard this patch.
admin_pages/payments/templates/payment_method_activate.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 				<td>
15 15
 					
16 16
 					<a id="activate_<?php echo $payment_method->slug()?>" class="espresso-button-green button-primary" href="<?php echo $activate_url?>">
17
-						<?php printf(__("Activate %s Payment Method?", "event_espresso"),$payment_method->admin_name()); ?>
17
+						<?php printf(__("Activate %s Payment Method?", "event_espresso"), $payment_method->admin_name()); ?>
18 18
 					</a>
19 19
 				</td>
20 20
 			</tr>
Please login to merge, or discard this patch.
admin_pages/payments/templates/payment_settings.template.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 					</label>
10 10
 				</th>
11 11
 				<td>
12
-					<?php echo EEH_Form_Fields::select_input('show_pending_payment_options', $values, $show_pending_payment_options ); ?>
12
+					<?php echo EEH_Form_Fields::select_input('show_pending_payment_options', $values, $show_pending_payment_options); ?>
13 13
 
14 14
 				</td>
15 15
 			</tr>
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page_Init.core.php 2 patches
Spacing   +12 added lines, -12 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
 /**
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
 
34 34
 	public function __construct() {
35 35
 		//define some constants
36
-		define( 'REGISTRATION_FORM_PG_SLUG', 'espresso_registration_form' );
37
-		define( 'REGISTRATION_FORM_LABEL', __('Registration Form', 'event_espresso'));
38
-		define( 'REGISTRATION_FORM_PG_NAME', REGISTRATION_FORM_LABEL );
39
-		define( 'REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES . 'registration_form' . DS );
40
-		define( 'REGISTRATION_FORM_ADMIN_URL', admin_url( 'admin.php?page=' . REGISTRATION_FORM_PG_SLUG ));
41
-		define( 'EE_FORMS_ADMIN_URL', admin_url('admin.php?page=' . REGISTRATION_FORM_PG_SLUG ));
42
-		define( 'REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN . 'assets' . DS );
43
-		define( 'REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL . 'registration_form/assets/' );
44
-		define( 'REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN . 'templates' . DS );
45
-		define( 'REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'registration_form/templates/' );
36
+		define('REGISTRATION_FORM_PG_SLUG', 'espresso_registration_form');
37
+		define('REGISTRATION_FORM_LABEL', __('Registration Form', 'event_espresso'));
38
+		define('REGISTRATION_FORM_PG_NAME', REGISTRATION_FORM_LABEL);
39
+		define('REGISTRATION_FORM_ADMIN', EE_ADMIN_PAGES.'registration_form'.DS);
40
+		define('REGISTRATION_FORM_ADMIN_URL', admin_url('admin.php?page='.REGISTRATION_FORM_PG_SLUG));
41
+		define('EE_FORMS_ADMIN_URL', admin_url('admin.php?page='.REGISTRATION_FORM_PG_SLUG));
42
+		define('REGISTRATION_FORM_ASSETS_PATH', REGISTRATION_FORM_ADMIN.'assets'.DS);
43
+		define('REGISTRATION_FORM_ASSETS_URL', EE_ADMIN_PAGES_URL.'registration_form/assets/');
44
+		define('REGISTRATION_FORM_TEMPLATE_PATH', REGISTRATION_FORM_ADMIN.'templates'.DS);
45
+		define('REGISTRATION_FORM_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'registration_form/templates/');
46 46
 		parent::__construct();
47 47
 	}
48 48
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 
54 54
 
55 55
 	protected function _set_menu_map() {
56
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
56
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
57 57
 			'menu_group' => 'management',
58 58
 			'menu_order' => 30,
59 59
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@
 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 6
 /**
6 7
  * Event Espresso
Please login to merge, or discard this patch.
registration_form/espresso_events_Registration_Form_Hooks.class.php 2 patches
Spacing   +36 added lines, -36 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
 
36 36
 
37 37
 
38
-	public function __construct( EE_Admin_Page $admin_page ) {
38
+	public function __construct(EE_Admin_Page $admin_page) {
39 39
 		parent::__construct($admin_page);
40 40
 	}
41 41
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$this->_name = 'registration_form';
47 47
 		$this->_metaboxes = array(
48 48
 			0 => array(
49
-				'page_route' => array( 'edit', 'create_new' ),
49
+				'page_route' => array('edit', 'create_new'),
50 50
 				'func' => 'primary_questions',
51 51
 				'label' => __('Questions for Primary Registrant', 'event_espresso'),
52 52
 				'priority' => 'default',
@@ -55,28 +55,28 @@  discard block
 block discarded – undo
55 55
 		);
56 56
 
57 57
 		//hook into the handler for saving question groups
58
-		add_filter( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'modify_callbacks'), 10 );
58
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'modify_callbacks'), 10);
59 59
 
60 60
 		//hook into revision restores (we're hooking into the global action because EE_Admin_Hooks classes are already restricted by page)
61
-		add_action( 'AHEE_EE_Admin_Page_CPT__restore_revision', array($this, 'restore_revision' ), 10, 2 );
61
+		add_action('AHEE_EE_Admin_Page_CPT__restore_revision', array($this, 'restore_revision'), 10, 2);
62 62
 	}
63 63
 
64 64
 
65 65
 
66 66
 
67 67
 
68
-	public function modify_callbacks( $callbacks ) {
68
+	public function modify_callbacks($callbacks) {
69 69
 		//now let's add the question group callback
70
-		$callbacks[] = array( $this, 'primary_question_group_update' );
70
+		$callbacks[] = array($this, 'primary_question_group_update');
71 71
 		return $callbacks;
72 72
 	}
73 73
 
74 74
 
75
-	public function restore_revision( $post_id, $revision_id ) {
75
+	public function restore_revision($post_id, $revision_id) {
76 76
 		$EVT_MDL = EE_Registry::instance()->load_model('Event');
77
-		$post_evt = $EVT_MDL->get_one_by_ID( $post_id );
77
+		$post_evt = $EVT_MDL->get_one_by_ID($post_id);
78 78
 		//restore revision for primary questions
79
-		$post_evt->restore_revision($revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 1 ) ) );
79
+		$post_evt->restore_revision($revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 1)));
80 80
 		return $post_evt; //for any caffeinated functionality extending.
81 81
 	}
82 82
 
@@ -100,35 +100,35 @@  discard block
 block discarded – undo
100 100
 			<?php
101 101
 
102 102
 			$qsg_where['QSG_deleted'] = FALSE;
103
-			$query_params = array( $qsg_where, 'order_by' => array( 'QSG_order' => 'ASC' ) );
104
-			$QSGs = EEM_Question_Group::instance()->get_all( $query_params );
105
-			$EQGs = !empty( $event_id ) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1 )) ) : array();
103
+			$query_params = array($qsg_where, 'order_by' => array('QSG_order' => 'ASC'));
104
+			$QSGs = EEM_Question_Group::instance()->get_all($query_params);
105
+			$EQGs = ! empty($event_id) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1))) : array();
106 106
 			$EQGids = array_keys($EQGs);
107 107
 
108 108
 			//EEH_Debug_Tools::printr( $QSGs, '$QSGs  <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
109 109
 
110
-			if ( ! empty( $QSGs )) {
111
- 				$html = count( $QSGs ) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
112
-				foreach ( $QSGs as $QSG ) {
110
+			if ( ! empty($QSGs)) {
111
+ 				$html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
112
+				foreach ($QSGs as $QSG) {
113 113
 
114
-					$checked = ( in_array( $QSG->ID(), $EQGids ) || $QSG->get('QSG_system') == 1 ) ? ' checked="checked"' : '';
114
+					$checked = (in_array($QSG->ID(), $EQGids) || $QSG->get('QSG_system') == 1) ? ' checked="checked"' : '';
115 115
 					$visibility = $QSG->get('QSG_system') == 1 ? ' style="visibility:hidden"' : '';
116
-					$edit_query_args = $this->_adminpage_obj->is_caf() ? array( 'action' => 'edit_question_group', 'QSG_ID' => $QSG->ID() ) : array( 'action' => 'question_groups' );
117
-					$edit_link = $this->_adminpage_obj->add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL );
116
+					$edit_query_args = $this->_adminpage_obj->is_caf() ? array('action' => 'edit_question_group', 'QSG_ID' => $QSG->ID()) : array('action' => 'question_groups');
117
+					$edit_link = $this->_adminpage_obj->add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
118 118
 
119 119
 					$html .= '
120
-					<p id="event-question-group-' . $QSG->ID() . '">
121
-						<input value="' . $QSG->ID() . '" type="checkbox"' . $visibility . ' name="question_groups[' . $QSG->ID() . ']"' . $checked . ' />
122
-						<a href="' . $edit_link . '" title="' . sprintf( esc_attr__('Edit %s Group', 'event_espresso'),  $QSG->get('QSG_name') ) . '" target="_blank">' . $QSG->get('QSG_name') . '</a>
120
+					<p id="event-question-group-' . $QSG->ID().'">
121
+						<input value="' . $QSG->ID().'" type="checkbox"'.$visibility.' name="question_groups['.$QSG->ID().']"'.$checked.' />
122
+						<a href="' . $edit_link.'" title="'.sprintf(esc_attr__('Edit %s Group', 'event_espresso'), $QSG->get('QSG_name')).'" target="_blank">'.$QSG->get('QSG_name').'</a>
123 123
 					</p>';
124 124
 				}
125
-				$html .= count( $QSGs ) > 10 ? '</div>' : '';
125
+				$html .= count($QSGs) > 10 ? '</div>' : '';
126 126
 
127 127
 				echo $html;
128 128
 			} else {
129 129
 				echo __('There seems to be a problem with your questions. Please contact [email protected]', 'event_espresso');
130 130
 			}
131
-			do_action( 'AHEE_event_editor_questions_notice' );
131
+			do_action('AHEE_event_editor_questions_notice');
132 132
 			?>
133 133
 		</div>
134 134
 		<?php
@@ -138,31 +138,31 @@  discard block
 block discarded – undo
138 138
 
139 139
 
140 140
 
141
-	public function primary_question_group_update( $evtobj, $data ) {
142
-		$question_groups = !empty( $data['question_groups'] ) ? (array) $data['question_groups'] : array();
141
+	public function primary_question_group_update($evtobj, $data) {
142
+		$question_groups = ! empty($data['question_groups']) ? (array) $data['question_groups'] : array();
143 143
 		$added_qgs = array_keys($question_groups);
144 144
 		$success = array();
145 145
 
146 146
 		//let's get all current question groups associated with this event.
147
-		$current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1) ));
147
+		$current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 1)));
148 148
 		$current_qgs = array_keys($current_qgs); //we just want the ids
149 149
 
150 150
 		//now let's get the groups selected in the editor and update (IF we have data)
151
-		if ( !empty( $question_groups ) ) {
152
-			foreach ( $question_groups as $id => $val ) {
151
+		if ( ! empty($question_groups)) {
152
+			foreach ($question_groups as $id => $val) {
153 153
 				//add to event
154
-				if ( $val )
155
-					$qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 1) );
156
-				$success[] = !empty($qg) ? 1 : 0;
154
+				if ($val)
155
+					$qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 1));
156
+				$success[] = ! empty($qg) ? 1 : 0;
157 157
 			}
158 158
 		}
159 159
 
160 160
 		//wait a minute... are there question groups missing in the saved groups that ARE with the current event?
161
-		$removed_qgs = array_diff( $current_qgs, $added_qgs );
161
+		$removed_qgs = array_diff($current_qgs, $added_qgs);
162 162
 
163
-		foreach ( $removed_qgs as $qgid ) {
164
-			$qg = $evtobj->_remove_relation_to( $qgid, 'Question_Group', array('EQG_primary' => 1 ) );
165
-			$success[] = !empty($qg) ? 1 : 0;
163
+		foreach ($removed_qgs as $qgid) {
164
+			$qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 1));
165
+			$success[] = ! empty($qg) ? 1 : 0;
166 166
 		}
167 167
 
168 168
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,7 @@  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 6
 /**
6 7
  * Event Espresso
@@ -151,8 +152,9 @@  discard block
 block discarded – undo
151 152
 		if ( !empty( $question_groups ) ) {
152 153
 			foreach ( $question_groups as $id => $val ) {
153 154
 				//add to event
154
-				if ( $val )
155
-					$qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 1) );
155
+				if ( $val ) {
156
+									$qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 1) );
157
+				}
156 158
 				$success[] = !empty($qg) ? 1 : 0;
157 159
 			}
158 160
 		}
Please login to merge, or discard this patch.