Completed
Branch FET-9413-questions-refactor (bd7ded)
by
unknown
85:35 queued 75:04
created
core/db_models/EEM_Question.model.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -219,7 +219,7 @@
 block discarded – undo
219 219
 	 * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know
220 220
 	 * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
221 221
 	 * @param $QST_system
222
-	 * @return int of QST_ID for the question that corresponds to that QST_system
222
+	 * @return string of QST_ID for the question that corresponds to that QST_system
223 223
 	 */
224 224
 	public function get_Question_ID_from_system_string( $QST_system ){
225 225
 		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 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
 
@@ -107,54 +107,54 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 * @param null $timezone
109 109
 	 */
110
-	protected function __construct( $timezone = NULL ) {
111
-		$this->singular_item = __('Question','event_espresso');
112
-		$this->plural_item = __('Questions','event_espresso');
113
-		$this->_allowed_question_types=apply_filters(
110
+	protected function __construct($timezone = NULL) {
111
+		$this->singular_item = __('Question', 'event_espresso');
112
+		$this->plural_item = __('Questions', 'event_espresso');
113
+		$this->_allowed_question_types = apply_filters(
114 114
 			'FHEE__EEM_Question__construct__allowed_question_types',
115 115
 			array(
116
-				EEM_Question::QST_type_text =>__('Text','event_espresso'),
117
-				EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'),
118
-				EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'),
119
-				EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'),
120
-				EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'),
121
-				EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'),
122
-				EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'),
123
-				EEM_Question::QST_type_date =>__('Date Picker','event_espresso'),
124
-				EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ),
125
-				EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ),
126
-				EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ),
127
-				EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ),
128
-				EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ),
129
-				EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ),
130
-				EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ),
131
-				EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ),
132
-				EEM_Question::QST_type_ajax_select => __( 'AJAX Select', 'event_espresso' ),
116
+				EEM_Question::QST_type_text =>__('Text', 'event_espresso'),
117
+				EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'),
118
+				EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'),
119
+				EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'),
120
+				EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'),
121
+				EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'),
122
+				EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'),
123
+				EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'),
124
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
125
+				EEM_Question::QST_type_email => __('Email', 'event_espresso'),
126
+				EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'),
127
+				EEM_Question::QST_type_decimal => __('Number', 'event_espresso'),
128
+				EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'),
129
+				EEM_Question::QST_type_url => __('URL', 'event_espresso'),
130
+				EEM_Question::QST_type_year => __('Year', 'event_espresso'),
131
+				EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso'),
132
+				EEM_Question::QST_type_ajax_select => __('AJAX Select', 'event_espresso'),
133 133
 			)
134 134
 		);
135 135
 		$this->_question_descriptions = apply_filters(
136 136
 			'FHEE__EEM_Question__construct__allowed_question_types',
137 137
 			array(
138
-				EEM_Question::QST_type_text          => __( 'A single line text input field', 'event_espresso' ),
139
-				EEM_Question::QST_type_textarea      => __( 'A multi line text input field', 'event_espresso' ),
140
-				EEM_Question::QST_type_checkbox      => __( 'Allows multiple preset options to be selected', 'event_espresso' ),
141
-				EEM_Question::QST_type_radio         => __( 'Allows a single preset option to be selected', 'event_espresso' ),
142
-				EEM_Question::QST_type_dropdown      => __( 'A dropdown that allows a single selection', 'event_espresso' ),
143
-				EEM_Question::QST_type_state         => __( 'A dropdown that lists states/provinces', 'event_espresso' ),
144
-				EEM_Question::QST_type_country       => __( 'A dropdown that lists countries', 'event_espresso' ),
145
-				EEM_Question::QST_type_date          => __( 'A popup calendar that allows date selections', 'event_espresso' ),
146
-				EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ),
147
-				EEM_Question::QST_type_email         => __( 'A text field that must contain a valid Email address', 'event_espresso' ),
148
-				EEM_Question::QST_type_us_phone      => __( 'A text field that must contain a valid US phone number', 'event_espresso' ),
149
-				EEM_Question::QST_type_decimal       => __( 'A text field that allows number values with decimals', 'event_espresso' ),
150
-				EEM_Question::QST_type_int           => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ),
151
-				EEM_Question::QST_type_url           => __( 'A text field that must contain a valid URL', 'event_espresso' ),
152
-				EEM_Question::QST_type_year          => __( 'A dropdown that lists the last 100 years', 'event_espresso' ),
153
-				EEM_Question::QST_type_multi_select  => __( 'A dropdown that allows multiple selections', 'event_espresso' ),
154
-				EEM_Question::QST_type_ajax_select   => __( 'A dropdown that populates it\'s options dynamically via AJAX', 'event_espresso' ),
138
+				EEM_Question::QST_type_text          => __('A single line text input field', 'event_espresso'),
139
+				EEM_Question::QST_type_textarea      => __('A multi line text input field', 'event_espresso'),
140
+				EEM_Question::QST_type_checkbox      => __('Allows multiple preset options to be selected', 'event_espresso'),
141
+				EEM_Question::QST_type_radio         => __('Allows a single preset option to be selected', 'event_espresso'),
142
+				EEM_Question::QST_type_dropdown      => __('A dropdown that allows a single selection', 'event_espresso'),
143
+				EEM_Question::QST_type_state         => __('A dropdown that lists states/provinces', 'event_espresso'),
144
+				EEM_Question::QST_type_country       => __('A dropdown that lists countries', 'event_espresso'),
145
+				EEM_Question::QST_type_date          => __('A popup calendar that allows date selections', 'event_espresso'),
146
+				EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'),
147
+				EEM_Question::QST_type_email         => __('A text field that must contain a valid Email address', 'event_espresso'),
148
+				EEM_Question::QST_type_us_phone      => __('A text field that must contain a valid US phone number', 'event_espresso'),
149
+				EEM_Question::QST_type_decimal       => __('A text field that allows number values with decimals', 'event_espresso'),
150
+				EEM_Question::QST_type_int           => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'),
151
+				EEM_Question::QST_type_url           => __('A text field that must contain a valid URL', 'event_espresso'),
152
+				EEM_Question::QST_type_year          => __('A dropdown that lists the last 100 years', 'event_espresso'),
153
+				EEM_Question::QST_type_multi_select  => __('A dropdown that allows multiple selections', 'event_espresso'),
154
+				EEM_Question::QST_type_ajax_select   => __('A dropdown that populates it\'s options dynamically via AJAX', 'event_espresso'),
155 155
 			)
156 156
 		);
157
-		$this->_question_type_categories = (array)apply_filters(
157
+		$this->_question_type_categories = (array) apply_filters(
158 158
 			'FHEE__EEM_Question__construct__question_type_categories',
159 159
 			array(
160 160
 				'text' => array(
@@ -180,33 +180,33 @@  discard block
 block discarded – undo
180 180
 		);
181 181
 
182 182
 		$this->_tables = array(
183
-			'Question'=>new EE_Primary_Table('esp_question','QST_ID')
183
+			'Question'=>new EE_Primary_Table('esp_question', 'QST_ID')
184 184
 		);
185 185
 		$this->_fields = array(
186 186
 			'Question'=>array(
187
-				'QST_ID'=> new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')),
188
-				'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID',__( 'Question Group ID', 'event_espresso' ),false,0,'Question_Group'),
189
-				'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label',__( 'Question Label (admin-only)', 'event_espresso' ),true,''),
190
-				'QST_display_text'=> new EE_Post_Content_Field('QST_display_text', __('Question Text','event_espresso'), true, ''),
191
-				'QST_identifier'=> new EE_Plain_Text_Field('QST_identifier', __('Internal string ID for question','event_espresso'), TRUE, NULL ),
192
-				'QST_system'=> new EE_Plain_Text_Field('QST_system', __('System Question type ID','event_espresso'), TRUE, NULL ),
193
-				'QST_type'=> new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types),
194
-				'QST_required'=> new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false),
195
-				'QST_required_text'=> new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''),
196
-				'QST_desc'=> new EE_Full_HTML_Field('QST_desc', __( 'Description of Question', 'event_espresso' ), true, ''),
197
-				'QST_html_name' => new EE_Plain_Text_Field('QST_html_name',__( 'HTML name property', 'event_espresso' ),true,null),
198
-				'QST_html_id' => new EE_Plain_Text_Field('QST_html_id',__( 'HTML CSS "id" property', 'event_espresso' ),true,null),
199
-				'QST_html_class' => new EE_Plain_Text_Field('QST_html_class',__( 'HTML CSS "class" property', 'event_espresso' ),true,null),
200
-				'QST_html_label_id' => new EE_Plain_Text_Field( 'QST_html_label_id', __( "HTML CSS \"id\" property for the Question's label", 'event_espresso' ), true, null),
201
-				'QST_html_label_class' => new EE_Plain_Text_Field( 'QST_html_label_class', __( "HTML CSS \"class\" property for the Question's label", 'event_espresso' ), true, null),
202
-				'QST_default_value' => new EE_Plain_Text_Field( 'QST_default_value', __( 'Default value for input', 'event_espresso' ), true, null),
203
-				'QST_validation_strategies'=> new EE_Plain_Text_Field('QST_validation_strategies', __('List of validations to be applied to Question.','event_espresso'), false, false),
204
-				'QST_validation_message'=> new EE_Simple_HTML_Field('QST_validation_message', __('Validation message to be displayed if this question fails to pass a validation check','event_espresso'), true, ''),
205
-				'QST_order'=> new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0),
206
-				'QST_admin_only'=> new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false),
207
-				'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso'	), false, EE_INF ),
208
-				'QST_wp_user'=> new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ),
209
-				'QST_deleted'=> new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false)
187
+				'QST_ID'=> new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
188
+				'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso'), false, 0, 'Question_Group'),
189
+				'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
190
+				'QST_display_text'=> new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
191
+				'QST_identifier'=> new EE_Plain_Text_Field('QST_identifier', __('Internal string ID for question', 'event_espresso'), TRUE, NULL),
192
+				'QST_system'=> new EE_Plain_Text_Field('QST_system', __('System Question type ID', 'event_espresso'), TRUE, NULL),
193
+				'QST_type'=> new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
194
+				'QST_required'=> new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
195
+				'QST_required_text'=> new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
196
+				'QST_desc'=> new EE_Full_HTML_Field('QST_desc', __('Description of Question', 'event_espresso'), true, ''),
197
+				'QST_html_name' => new EE_Plain_Text_Field('QST_html_name', __('HTML name property', 'event_espresso'), true, null),
198
+				'QST_html_id' => new EE_Plain_Text_Field('QST_html_id', __('HTML CSS "id" property', 'event_espresso'), true, null),
199
+				'QST_html_class' => new EE_Plain_Text_Field('QST_html_class', __('HTML CSS "class" property', 'event_espresso'), true, null),
200
+				'QST_html_label_id' => new EE_Plain_Text_Field('QST_html_label_id', __("HTML CSS \"id\" property for the Question's label", 'event_espresso'), true, null),
201
+				'QST_html_label_class' => new EE_Plain_Text_Field('QST_html_label_class', __("HTML CSS \"class\" property for the Question's label", 'event_espresso'), true, null),
202
+				'QST_default_value' => new EE_Plain_Text_Field('QST_default_value', __('Default value for input', 'event_espresso'), true, null),
203
+				'QST_validation_strategies'=> new EE_Plain_Text_Field('QST_validation_strategies', __('List of validations to be applied to Question.', 'event_espresso'), false, false),
204
+				'QST_validation_message'=> new EE_Simple_HTML_Field('QST_validation_message', __('Validation message to be displayed if this question fails to pass a validation check', 'event_espresso'), true, ''),
205
+				'QST_order'=> new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
206
+				'QST_admin_only'=> new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
207
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
208
+				'QST_wp_user'=> new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
209
+				'QST_deleted'=> new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
210 210
 			)
211 211
 		);
212 212
 
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 			'Question_Group_Question' => new EE_Has_Many_Relation(),
219 219
 		);
220 220
 		//this model is generally available for reading
221
-		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
222
-		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
223
-		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
224
-		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
225
-		parent::__construct( $timezone );
221
+		$this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
222
+		$this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
223
+		$this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
224
+		$this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
225
+		parent::__construct($timezone);
226 226
 	}
227 227
 
228 228
 	/**
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * but they can be extended
231 231
 	 * @return string[]
232 232
 	 */
233
-	public function allowed_question_types(){
233
+	public function allowed_question_types() {
234 234
 		return $this->_allowed_question_types;
235 235
 	}
236 236
 	/**
@@ -238,16 +238,16 @@  discard block
 block discarded – undo
238 238
 	 * @param string $question_type one of EEM_Question::allowed_question_types(
239 239
 	 * @return string[] like EEM_Question::allowed_question_types()
240 240
 	 */
241
-	public function question_types_in_same_category( $question_type ) {
242
-		$question_types = array( $question_type );
243
-		foreach( $this->_question_type_categories as $category => $question_types_in_category ) {
244
-			if( in_array( $question_type, $question_types_in_category ) ) {
241
+	public function question_types_in_same_category($question_type) {
242
+		$question_types = array($question_type);
243
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
244
+			if (in_array($question_type, $question_types_in_category)) {
245 245
 				$question_types = $question_types_in_category;
246 246
 				break;
247 247
 			}
248 248
 		}
249 249
 
250
-		return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) );
250
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
251 251
 	}
252 252
 
253 253
 	/**
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
257 257
 	 * @return boolean
258 258
 	 */
259
-	public function question_type_is_in_category( $question_type, $category ) {
260
-		if( ! isset( $this->_question_type_categories[ $category ] ) ) {
259
+	public function question_type_is_in_category($question_type, $category) {
260
+		if ( ! isset($this->_question_type_categories[$category])) {
261 261
 			return false;
262 262
 		}
263
-		return in_array( $question_type, $this->_question_type_categories[ $category ] );
263
+		return in_array($question_type, $this->_question_type_categories[$category]);
264 264
 	}
265 265
 
266 266
 	/**
@@ -277,9 +277,9 @@  discard block
 block discarded – undo
277 277
 	 * @param string $system_question_group_id QSG_system
278 278
 	 * @return array of system question names (QST_system)
279 279
 	 */
280
-	public function allowed_system_questions_in_system_question_group( $system_question_group_id ) {
280
+	public function allowed_system_questions_in_system_question_group($system_question_group_id) {
281 281
 		$question_system_ids = array();
282
-		switch( $system_question_group_id ) {
282
+		switch ($system_question_group_id) {
283 283
 			case EEM_Question_Group::system_personal:
284 284
 				$question_system_ids = array(
285 285
 					EEM_Attendee::system_question_fname,
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 				);
301 301
 				break;
302 302
 		}
303
-		return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id );
303
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
304 304
 	}
305 305
 
306 306
 	/**
@@ -309,11 +309,11 @@  discard block
 block discarded – undo
309 309
 	 * @param string $system_question_group_id QSG_system
310 310
 	 * @return array of system question names (QST_system)
311 311
 	 */
312
-	public function required_system_questions_in_system_question_group( $system_question_group_id ) {
312
+	public function required_system_questions_in_system_question_group($system_question_group_id) {
313 313
 		$question_system_ids = null;
314
-		switch( $system_question_group_id ) {
314
+		switch ($system_question_group_id) {
315 315
 			case EEM_Question_Group::system_personal:
316
-				$question_system_ids =  array(
316
+				$question_system_ids = array(
317 317
 					EEM_Attendee::system_question_fname,
318 318
 					EEM_Attendee::system_question_email,
319 319
 				);
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			default:
322 322
 				$question_system_ids = array();
323 323
 		}
324
-		return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id );
324
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
325 325
 	}
326 326
 
327 327
 
@@ -334,8 +334,8 @@  discard block
 block discarded – undo
334 334
 	 * @return int of QST_ID for the question that corresponds to that QST_system
335 335
 	 * @throws \EE_Error
336 336
 	 */
337
-	public function get_Question_ID_from_system_string( $QST_system ){
338
-		 return $this->get_var( array( array( 'QST_system' => $QST_system ) ) );
337
+	public function get_Question_ID_from_system_string($QST_system) {
338
+		 return $this->get_var(array(array('QST_system' => $QST_system)));
339 339
 	}
340 340
 
341 341
 
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
 	 */
350 350
 	public function get_latest_question_order() {
351 351
 		$columns_to_select = array(
352
-			'max_order' => array("MAX(QST_order)","%d")
352
+			'max_order' => array("MAX(QST_order)", "%d")
353 353
 		);
354
-		$max = (array) $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select );
355
-		return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0;
354
+		$max = (array) $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
355
+		return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
356 356
 	}
357 357
 
358 358
 	/**
@@ -381,10 +381,10 @@  discard block
 block discarded – undo
381 381
 	 * @param string $system_question_value
382 382
 	 * @return int|float
383 383
 	 */
384
-	public function absolute_max_for_system_question( $system_question_value ) {
384
+	public function absolute_max_for_system_question($system_question_value) {
385 385
 		$maxes = $this->system_question_maxes();
386
-		if( isset( $maxes[ $system_question_value ] ) ) {
387
-			return $maxes[ $system_question_value ];
386
+		if (isset($maxes[$system_question_value])) {
387
+			return $maxes[$system_question_value];
388 388
 		} else {
389 389
 			return EE_INF;
390 390
 		}
Please login to merge, or discard this patch.
extend/registration_form_X/Extend_Registration_Form_Admin_Page.core.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@
 block discarded – undo
126 126
 	 * being address info, and 0 being neither)
127 127
 	 * @global type $wpdb
128 128
 	 * @param type $new_question_group_id
129
-	 * @return boolean
129
+	 * @return integer
130 130
 	 */
131 131
 	private function _is_system_question_group($new_question_group_id){
132 132
 		global $wpdb;
Please login to merge, or discard this patch.
Indentation   +87 added lines, -87 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' => esc_html__('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
 
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
 	 * @return EE_Form_Section_Proper
934 934
 	 */
935 935
 	protected function _email_validation_settings_form() {
936
-        return new EE_Form_Section_Proper(
936
+		return new EE_Form_Section_Proper(
937 937
 			array(
938 938
 				'name'            => 'email_validation_settings',
939 939
 				'html_id'         => 'email_validation_settings',
@@ -951,7 +951,7 @@  discard block
 block discarded – undo
951 951
 						),
952 952
 						array(
953 953
 							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
954
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
954
+												 . EEH_Template::get_help_tab_link( 'email_validation_info' ),
955 955
 							'html_help_text'  => esc_html__( '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'),
956 956
 							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
957 957
 								? EE_Registry::instance()->CFG->registration->email_validation_level
@@ -973,8 +973,8 @@  discard block
 block discarded – undo
973 973
 	 * @return \EE_Registration_Config
974 974
 	 */
975 975
 	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
976
-        $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
977
-        try {
976
+		$prev_email_validation_level = $EE_Registration_Config->email_validation_level;
977
+		try {
978 978
 			$email_validation_settings_form = $this->_email_validation_settings_form();
979 979
 			// if not displaying a form, then check for form submission
980 980
 			if ( $email_validation_settings_form->was_submitted() ) {
@@ -985,38 +985,38 @@  discard block
 block discarded – undo
985 985
 					// grab validated data from form
986 986
 					$valid_data = $email_validation_settings_form->valid_data();
987 987
 					if ( isset( $valid_data['email_validation_level'] ) ) {
988
-					    $email_validation_level = $valid_data['email_validation_level'];
989
-                        // now if they want to use international email addresses
990
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
991
-                            // in case we need to reset their email validation level,
992
-                            // make sure that the previous value wasn't already set to one of the i18n options.
993
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
994
-                                // if so, then reset it back to "basic" since that is the only other option that,
995
-                                // despite offering poor validation, supports i18n email addresses
996
-                                $prev_email_validation_level = 'basic';
997
-                            }
998
-                            // confirm our i18n email validation will work on the server
999
-                            if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1000
-                                // or reset email validation level to previous value
1001
-                                $email_validation_level = $prev_email_validation_level;
1002
-                            }
1003
-                        }
1004
-                        $EE_Registration_Config->email_validation_level = $email_validation_level;
1005
-                    } else {
988
+						$email_validation_level = $valid_data['email_validation_level'];
989
+						// now if they want to use international email addresses
990
+						if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
991
+							// in case we need to reset their email validation level,
992
+							// make sure that the previous value wasn't already set to one of the i18n options.
993
+							if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
994
+								// if so, then reset it back to "basic" since that is the only other option that,
995
+								// despite offering poor validation, supports i18n email addresses
996
+								$prev_email_validation_level = 'basic';
997
+							}
998
+							// confirm our i18n email validation will work on the server
999
+							if ( ! $this->_verify_pcre_support($EE_Registration_Config, $email_validation_level)) {
1000
+								// or reset email validation level to previous value
1001
+								$email_validation_level = $prev_email_validation_level;
1002
+							}
1003
+						}
1004
+						$EE_Registration_Config->email_validation_level = $email_validation_level;
1005
+					} else {
1006 1006
 						EE_Error::add_error(
1007 1007
 							esc_html__(
1008 1008
 								'Invalid or missing Email Validation settings. Please refresh the form and try again.',
1009 1009
 								'event_espresso'
1010 1010
 							),
1011
-                            __FILE__, __FUNCTION__, __LINE__
1012
-                        );
1011
+							__FILE__, __FUNCTION__, __LINE__
1012
+						);
1013 1013
 					}
1014 1014
 				} else {
1015 1015
 					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1016 1016
 						EE_Error::add_error(
1017 1017
 							$email_validation_settings_form->submission_error_message(),
1018
-                            __FILE__, __FUNCTION__, __LINE__
1019
-                        );
1018
+							__FILE__, __FUNCTION__, __LINE__
1019
+						);
1020 1020
 					}
1021 1021
 				}
1022 1022
 			}
@@ -1028,61 +1028,61 @@  discard block
 block discarded – undo
1028 1028
 
1029 1029
 
1030 1030
 
1031
-    /**
1032
-     * confirms that the server's PHP version has the PCRE module enabled,
1033
-     * and that the PCRE version works with our i18n email validation
1034
-     *
1035
-     * @param \EE_Registration_Config $EE_Registration_Config
1036
-     * @param string                  $email_validation_level
1037
-     * @return bool
1038
-     */
1039
-    private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1040
-    {
1041
-        // first check that PCRE is enabled
1042
-        if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1043
-            EE_Error::add_error(
1044
-                sprintf(
1045
-                    esc_html__(
1046
-                        'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1047
-                        'event_espresso'
1048
-                    ),
1049
-                    '<br />'
1050
-                ),
1051
-                __FILE__,
1052
-                __FUNCTION__,
1053
-                __LINE__
1054
-            );
1055
-            return false;
1056
-        } else {
1057
-            // PCRE support is enabled, but let's still
1058
-            // perform a test to see if the server will support it.
1059
-            // but first, save the updated validation level to the config,
1060
-            // so that the validation strategy picks it up.
1061
-            // this will get bumped back down if it doesn't work
1062
-            $EE_Registration_Config->email_validation_level = $email_validation_level;
1063
-            try {
1064
-                $email_validator = new EE_Email_Validation_Strategy();
1065
-                $i18n_email_address = apply_filters(
1066
-                    'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1067
-                    'jägerjü[email protected]'
1068
-                );
1069
-                $email_validator->validate($i18n_email_address);
1070
-            } catch (Exception $e) {
1071
-                EE_Error::add_error(
1072
-                    sprintf(
1073
-                        esc_html__(
1074
-                            'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1075
-                            'event_espresso'
1076
-                        ),
1077
-                        '<br />',
1078
-                        '<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1079
-                    ),
1080
-                    __FILE__, __FUNCTION__, __LINE__
1081
-                );
1082
-                return false;
1083
-            }
1084
-        }
1085
-        return true;
1086
-    }
1031
+	/**
1032
+	 * confirms that the server's PHP version has the PCRE module enabled,
1033
+	 * and that the PCRE version works with our i18n email validation
1034
+	 *
1035
+	 * @param \EE_Registration_Config $EE_Registration_Config
1036
+	 * @param string                  $email_validation_level
1037
+	 * @return bool
1038
+	 */
1039
+	private function _verify_pcre_support(EE_Registration_Config $EE_Registration_Config, $email_validation_level)
1040
+	{
1041
+		// first check that PCRE is enabled
1042
+		if ( ! defined('PREG_BAD_UTF8_ERROR')) {
1043
+			EE_Error::add_error(
1044
+				sprintf(
1045
+					esc_html__(
1046
+						'We\'re sorry, but it appears that your server\'s version of PHP was not compiled with PCRE unicode support.%1$sPlease contact your hosting company and ask them whether the PCRE compiled with your version of PHP on your server can be been built with the "--enable-unicode-properties" and "--enable-utf8" configuration switches to enable more complex regex expressions.%1$sIf they are unable, or unwilling to do so, then your server will not support international email addresses using UTF-8 unicode characters. This means you will either have to lower your email validation level to "Basic" or "WordPress Default", or switch to a hosting company that has/can enable PCRE unicode support on the server.',
1047
+						'event_espresso'
1048
+					),
1049
+					'<br />'
1050
+				),
1051
+				__FILE__,
1052
+				__FUNCTION__,
1053
+				__LINE__
1054
+			);
1055
+			return false;
1056
+		} else {
1057
+			// PCRE support is enabled, but let's still
1058
+			// perform a test to see if the server will support it.
1059
+			// but first, save the updated validation level to the config,
1060
+			// so that the validation strategy picks it up.
1061
+			// this will get bumped back down if it doesn't work
1062
+			$EE_Registration_Config->email_validation_level = $email_validation_level;
1063
+			try {
1064
+				$email_validator = new EE_Email_Validation_Strategy();
1065
+				$i18n_email_address = apply_filters(
1066
+					'FHEE__Extend_Registration_Form_Admin_Page__update_email_validation_settings_form__i18n_email_address',
1067
+					'jägerjü[email protected]'
1068
+				);
1069
+				$email_validator->validate($i18n_email_address);
1070
+			} catch (Exception $e) {
1071
+				EE_Error::add_error(
1072
+					sprintf(
1073
+						esc_html__(
1074
+							'We\'re sorry, but it appears that your server\'s configuration will not support the "International" or "International + DNS Check" email validation levels.%1$sTo correct this issue, please consult with your hosting company regarding your server\'s PCRE settings.%1$sIt is recommended that your PHP version be configured to use PCRE 8.10 or newer.%1$sMore information regarding PCRE versions and installation can be found here: %2$s',
1075
+							'event_espresso'
1076
+						),
1077
+						'<br />',
1078
+						'<a href="http://php.net/manual/en/pcre.installation.php" target="_blank">http://php.net/manual/en/pcre.installation.php</a>'
1079
+					),
1080
+					__FILE__, __FUNCTION__, __LINE__
1081
+				);
1082
+				return false;
1083
+			}
1084
+		}
1085
+		return true;
1086
+	}
1087 1087
 
1088 1088
 }
Please login to merge, or discard this patch.
Spacing   +211 added lines, -211 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
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 					'noheader' => TRUE
192 192
 				),
193 193
 			);
194
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
194
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
195 195
 
196 196
 		$new_page_config = array(
197 197
 
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
216 216
 						),
217 217
 					),
218
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
218
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
219 219
 				'metaboxes' => $this->_default_espresso_metaboxes,
220 220
 				'require_nonce' => FALSE,
221 221
 				'qtips' => array(
@@ -229,14 +229,14 @@  discard block
 block discarded – undo
229 229
 					'order' => 5,
230 230
 					'persistent' => FALSE
231 231
 					),
232
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
232
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
233 233
                 'help_tabs' => array(
234 234
 					'registration_form_add_question_help_tab' => array(
235 235
 						'title' => esc_html__('Add Question', 'event_espresso'),
236 236
 						'filename' => 'registration_form_add_question'
237 237
 						),
238 238
 					),
239
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
239
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
240 240
 				'require_nonce' => FALSE
241 241
 				),
242 242
 
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
 					'order' => 5,
247 247
 					'persistent' => FALSE
248 248
 					),
249
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
249
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
250 250
 				'help_tabs' => array(
251 251
 					'registration_form_add_question_group_help_tab' => array(
252 252
 						'title' => esc_html__('Add Question Group', 'event_espresso'),
253 253
 						'filename' => 'registration_form_add_question_group'
254 254
 						),
255 255
 					),
256
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
256
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
257 257
 				'require_nonce' => FALSE
258 258
 				),
259 259
 
@@ -262,16 +262,16 @@  discard block
 block discarded – undo
262 262
 					'label' => esc_html__('Edit Question Group', 'event_espresso'),
263 263
 					'order' => 5,
264 264
 					'persistent' => FALSE,
265
-					'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
265
+					'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
266 266
 					),
267
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
267
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
268 268
 				'help_tabs' => array(
269 269
 					'registration_form_edit_question_group_help_tab' => array(
270 270
 						'title' => esc_html__('Edit Question Group', 'event_espresso'),
271 271
 						'filename' => 'registration_form_edit_question_group'
272 272
 						),
273 273
 					),
274
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
274
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
275 275
 				'require_nonce' => FALSE
276 276
 				),
277 277
 
@@ -283,19 +283,19 @@  discard block
 block discarded – undo
283 283
 				'labels' => array(
284 284
 					'publishbox' => esc_html__('Update Settings', 'event_espresso')
285 285
 					),
286
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
286
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
287 287
 				'help_tabs' => array(
288 288
 					'registration_form_reg_form_settings_help_tab' => array(
289 289
 						'title' => esc_html__('Registration Form Settings', 'event_espresso'),
290 290
 						'filename' => 'registration_form_reg_form_settings'
291 291
 						),
292 292
 					),
293
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
293
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
294 294
 				'require_nonce' => FALSE
295 295
 				)
296 296
 
297 297
 			);
298
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
298
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
299 299
 
300 300
 		//change the list table we're going to use so it's the NEW list table!
301 301
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 			'edit_question_group' => esc_html__('Edit Question Group', 'event_espresso'),
310 310
 			'delete_question_group' => esc_html__('Delete Question Group', 'event_espresso'),
311 311
 			);
312
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
312
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
313 313
 
314 314
 	}
315 315
 
@@ -318,14 +318,14 @@  discard block
 block discarded – undo
318 318
 
319 319
 
320 320
 	protected function _ajax_hooks() {
321
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
321
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
322 322
 	}
323 323
 
324 324
 
325 325
 
326 326
 
327 327
 	public function load_scripts_styles_question_groups() {
328
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
328
+		wp_enqueue_script('espresso_ajax_table_sorting');
329 329
 	}
330 330
 
331 331
 
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 	 * @return void
347 347
 	 */
348 348
 	public function load_sortable_question_script() {
349
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
349
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
350 350
 		wp_enqueue_script('ee-question-sortable');
351 351
 	}
352 352
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 				)
366 366
 		);
367 367
 
368
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
368
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
369 369
 			$this->_views['trash'] = array(
370 370
 				'slug' => 'trash',
371 371
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -395,7 +395,7 @@  discard block
 block discarded – undo
395 395
 				)
396 396
 		);
397 397
 
398
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
398
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
399 399
 			$this->_views['trash'] = array(
400 400
 				'slug' => 'trash',
401 401
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 	 *_forms_overview_list_table
422 422
 	 */
423 423
 	protected function _forms_overview_list_table() {
424
-		$this->_search_btn_label = __( 'Forms', 'event_espresso' );
425
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
424
+		$this->_search_btn_label = __('Forms', 'event_espresso');
425
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
426 426
 			'add_question_group',
427 427
 			'add_question_group',
428 428
 			array(),
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param bool $trashed
441 441
 	 * @return \EEM_Question_Group[]|int
442 442
 	 */
443
-	public function get_form_sections( $per_page = 10, $current_page = 1, $count = false, $trashed = false ) {
443
+	public function get_form_sections($per_page = 10, $current_page = 1, $count = false, $trashed = false) {
444 444
 		return $this->get_form_sections_or_inputs(
445 445
 			EEM_Question_Group::instance(),
446 446
 			$per_page,
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 	 * @param bool $trashed
460 460
 	 * @return \EEM_Question_Group[]|int
461 461
 	 */
462
-	public function get_form_inputs( $per_page = 10, $current_page = 1, $count = false, $trashed = false ) {
462
+	public function get_form_inputs($per_page = 10, $current_page = 1, $count = false, $trashed = false) {
463 463
 		return $this->get_form_sections_or_inputs(
464 464
 			EEM_Question_Group::instance(),
465 465
 			$per_page,
@@ -487,65 +487,65 @@  discard block
 block discarded – undo
487 487
 		$trashed = false
488 488
 	) {
489 489
 		$query_params = array();
490
-		$offset = ( $current_page - 1 ) * $per_page;
491
-		$query_params[ 'limit' ] = array( $offset, $per_page );
492
-		$order = ( isset( $this->_req_data[ 'order' ] ) && ! empty( $this->_req_data[ 'order' ] ) )
493
-			? $this->_req_data[ 'order' ]
490
+		$offset = ($current_page - 1) * $per_page;
491
+		$query_params['limit'] = array($offset, $per_page);
492
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order']))
493
+			? $this->_req_data['order']
494 494
 			: 'ASC';
495 495
 		$orderby_field = $model instanceof EEM_Question_Group
496 496
 			? 'QSG_order'
497 497
 			: 'QST_order';
498
-		$field_to_order_by = empty( $this->_req_data[ 'orderby' ] )
498
+		$field_to_order_by = empty($this->_req_data['orderby'])
499 499
 			? $orderby_field
500
-			: $this->_req_data[ 'orderby' ];
501
-		$query_params[ 'order_by' ] = array( $field_to_order_by => $order );
502
-		$search_string = isset( $this->_req_data[ 's' ] )
503
-			? $this->_req_data[ 's' ]
500
+			: $this->_req_data['orderby'];
501
+		$query_params['order_by'] = array($field_to_order_by => $order);
502
+		$search_string = isset($this->_req_data['s'])
503
+			? $this->_req_data['s']
504 504
 			: null;
505
-		if ( ! empty( $search_string ) ) {
506
-			if ( $model instanceof EEM_Question_Group ) {
507
-				$query_params[ 0 ] = array(
505
+		if ( ! empty($search_string)) {
506
+			if ($model instanceof EEM_Question_Group) {
507
+				$query_params[0] = array(
508 508
 					'OR' => array(
509
-						'QSG_name' => array( 'LIKE', "%$search_string%" ),
510
-						'QSG_desc' => array( 'LIKE', "%$search_string%" )
509
+						'QSG_name' => array('LIKE', "%$search_string%"),
510
+						'QSG_desc' => array('LIKE', "%$search_string%")
511 511
 					)
512 512
 				);
513
-			} elseif ( $model instanceof EEM_Question ) {
514
-				$query_params[ 0 ] = array(
515
-					'QST_display_text' => array( 'LIKE', "%$search_string%" )
513
+			} elseif ($model instanceof EEM_Question) {
514
+				$query_params[0] = array(
515
+					'QST_display_text' => array('LIKE', "%$search_string%")
516 516
 				);
517 517
 			}
518 518
 		}
519
-		if ( $model instanceof EEM_Question_Group ) {
520
-			$query_params[ 0 ][ 'QSG_parent' ] = array( 'IS NULL' );
519
+		if ($model instanceof EEM_Question_Group) {
520
+			$query_params[0]['QSG_parent'] = array('IS NULL');
521 521
 		}
522
-		$where = isset( $query_params[ 0 ] ) ? array( $query_params[ 0 ] ) : array();
523
-		if ( $trashed ) {
524
-			return $count ? $model->count_deleted( $where ) : $model->get_all_deleted( $query_params );
522
+		$where = isset($query_params[0]) ? array($query_params[0]) : array();
523
+		if ($trashed) {
524
+			return $count ? $model->count_deleted($where) : $model->get_all_deleted($query_params);
525 525
 		}
526
-		return $count ? $model->count( $where ) : $model->get_all( $query_params );
526
+		return $count ? $model->count($where) : $model->get_all($query_params);
527 527
 	}
528 528
 
529 529
 
530 530
 
531
-	protected function _delete_question(){
532
-		$success = $this->_delete_items( $this->_question_model );
531
+	protected function _delete_question() {
532
+		$success = $this->_delete_items($this->_question_model);
533 533
 		$this->_redirect_after_action(
534 534
 			$success,
535
-			$this->_question_model->item_name( $success ),
535
+			$this->_question_model->item_name($success),
536 536
 			'deleted',
537
-			array( 'action' => 'default', 'status' => 'all' )
537
+			array('action' => 'default', 'status' => 'all')
538 538
 		);
539 539
 	}
540 540
 
541 541
 
542 542
 	protected function _delete_questions() {
543
-		$success = $this->_delete_items( $this->_question_model );
543
+		$success = $this->_delete_items($this->_question_model);
544 544
 		$this->_redirect_after_action(
545 545
 			$success,
546
-			$this->_question_model->item_name( $success ),
546
+			$this->_question_model->item_name($success),
547 547
 			'deleted permanently',
548
-			array( 'action' => 'default', 'status' => 'trash' )
548
+			array('action' => 'default', 'status' => 'trash')
549 549
 		);
550 550
 	}
551 551
 
@@ -556,26 +556,26 @@  discard block
 block discarded – undo
556 556
  * @param EEM_Soft_Delete_Base $model
557 557
  * @return int number of items deleted permanently
558 558
  */
559
-	private function _delete_items(EEM_Soft_Delete_Base $model){
559
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
560 560
 		$success = 0;
561
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
562
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
561
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
562
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
563 563
 			// if array has more than one element than success message should be plural
564
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
564
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
565 565
 			// cycle thru bulk action checkboxes
566
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
567
-				if ( ! $this->_delete_item( $ID, $model ) ) {
566
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
567
+				if ( ! $this->_delete_item($ID, $model)) {
568 568
 					$success = 0;
569 569
 				}
570 570
 			}
571 571
 
572
-		}elseif( !empty($this->_req_data['QSG_ID'])){
573
-			$success = $this->_delete_item( $this->_req_data['QSG_ID'], $model );
572
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
573
+			$success = $this->_delete_item($this->_req_data['QSG_ID'], $model);
574 574
 
575
-		}elseif( !empty($this->_req_data['QST_ID'])){
576
-			$success = $this->_delete_item( $this->_req_data['QST_ID'], $model );
577
-		}else{
578
-			EE_Error::add_error( sprintf(esc_html__("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__ );
575
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
576
+			$success = $this->_delete_item($this->_req_data['QST_ID'], $model);
577
+		} else {
578
+			EE_Error::add_error(sprintf(esc_html__("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__);
579 579
 		}
580 580
 		return $success;
581 581
 	}
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
 	 * @param EEM_Soft_Delete_Base $model
587 587
 	 * @return boolean
588 588
 	 */
589
-	protected function _delete_item( $id, $model ) {
590
-		if( $model instanceof EEM_Question ) {
591
-			EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) );
589
+	protected function _delete_item($id, $model) {
590
+		if ($model instanceof EEM_Question) {
591
+			EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id))));
592 592
 		}
593
-		return $model->delete_permanently_by_ID( absint( $id ) );
593
+		return $model->delete_permanently_by_ID(absint($id));
594 594
 	}
595 595
 
596 596
 
@@ -602,41 +602,41 @@  discard block
 block discarded – undo
602 602
 
603 603
 
604 604
 
605
-	protected function _edit_question_group( $type = 'add' ) {
606
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
607
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
605
+	protected function _edit_question_group($type = 'add') {
606
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
607
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
608 608
 
609
-		switch( $this->_req_action ) {
609
+		switch ($this->_req_action) {
610 610
 			case 'add_question_group' :
611
-				$this->_admin_page_title = esc_html__( 'Add Question Group', 'event_espresso' );
611
+				$this->_admin_page_title = esc_html__('Add Question Group', 'event_espresso');
612 612
 				break;
613 613
 			case 'edit_question_group' :
614
-				$this->_admin_page_title = esc_html__( 'Edit Question Group', 'event_espresso' );
614
+				$this->_admin_page_title = esc_html__('Edit Question Group', 'event_espresso');
615 615
 				break;
616 616
 			default :
617
-				$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
617
+				$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
618 618
 		}
619 619
 		// add ID to title if editing
620
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
621
-		if($ID){
620
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
621
+		if ($ID) {
622 622
 			/** @var EE_Question_Group $questionGroup */
623
-			$questionGroup=$this->_question_group_model->get_one_by_ID( $ID);
624
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
623
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
624
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
625 625
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
626
-		}else{
626
+		} else {
627 627
 			/** @var EE_Question_Group $questionGroup */
628 628
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
629 629
 			$questionGroup->set_order_to_latest();
630 630
 			$this->_set_add_edit_form_tags('insert_question_group');
631 631
 		}
632 632
 		$this->_template_args['values'] = $this->_yes_no_values;
633
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
634
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
635
-		$this->_template_args['question_group']=$questionGroup;
633
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
634
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
635
+		$this->_template_args['question_group'] = $questionGroup;
636 636
 
637
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
638
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
639
-		$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 );
637
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
638
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
639
+		$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);
640 640
 
641 641
 		// the details template wrapper
642 642
 		$this->display_admin_page_with_sidebar();
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 
648 648
 	protected function _delete_question_groups() {
649 649
 		$success = $this->_delete_items($this->_question_group_model);
650
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
650
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
651 651
 	}
652 652
 
653 653
 
@@ -655,71 +655,71 @@  discard block
 block discarded – undo
655 655
 	/**
656 656
 	 * @param bool $new_question_group
657 657
 	 */
658
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
659
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
660
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
661
-		if ( $new_question_group ){
658
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
659
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
660
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
661
+		if ($new_question_group) {
662 662
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
663 663
 			$success = $QSG_ID ? 1 : 0;
664 664
 		} else {
665 665
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
666
-			unset( $set_column_values[ 'QSG_ID' ] );
667
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
666
+			unset($set_column_values['QSG_ID']);
667
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
668 668
 		}
669
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
669
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
670 670
 		// update the existing related questions
671 671
 		// 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)
672
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
672
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
673 673
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
674
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
674
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
675 675
 		}
676 676
 		/** @type EE_Question_Group $question_group */
677
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
677
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
678 678
 		$questions = $question_group->questions();
679 679
 		// make sure system phone question is added to list of questions for this group
680
-		if ( ! isset( $questions[$phone_question_id ] )) {
681
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
680
+		if ( ! isset($questions[$phone_question_id])) {
681
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
682 682
 		}
683 683
 
684
-		foreach( $questions as $question_ID => $question ){
684
+		foreach ($questions as $question_ID => $question) {
685 685
 			// first we always check for order.
686
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
686
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
687 687
 				//update question order
688
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
688
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
689 689
 			}
690 690
 
691 691
 			// then we always check if adding or removing.
692
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
693
-				$question_group->add_question( $question_ID );
692
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
693
+				$question_group->add_question($question_ID);
694 694
 			} else {
695 695
 				// 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)
696 696
 				if (
697 697
 					in_array(
698 698
 						$question->system_ID(),
699
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
699
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
700 700
 					)
701 701
 				) {
702 702
 					continue;
703 703
 				} else {
704
-					$question_group->remove_question( $question_ID );
704
+					$question_group->remove_question($question_ID);
705 705
 				}
706 706
 			}
707 707
 		}
708 708
 		// save new related questions
709
-		if ( isset( $this->_req_data['questions'] )) {
710
-			foreach( $this->_req_data['questions'] as $QST_ID ){
711
-				$question_group->add_question( $QST_ID );
712
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
713
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
709
+		if (isset($this->_req_data['questions'])) {
710
+			foreach ($this->_req_data['questions'] as $QST_ID) {
711
+				$question_group->add_question($QST_ID);
712
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
713
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
714 714
 				}
715 715
 			}
716 716
 		}
717 717
 
718
-		if ( $success !== FALSE ) {
719
-			$msg = $new_question_group ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
720
-			EE_Error::add_success( $msg );
718
+		if ($success !== FALSE) {
719
+			$msg = $new_question_group ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
720
+			EE_Error::add_success($msg);
721 721
 		}
722
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
722
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
723 723
 
724 724
 	}
725 725
 
@@ -727,20 +727,20 @@  discard block
 block discarded – undo
727 727
 	 * duplicates a question and all its question options and redirects to the new question.
728 728
 	 */
729 729
 	public function _duplicate_question() {
730
-		$question_ID = (int)$this->_req_data[ 'QST_ID' ];
731
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
732
-		if( $question instanceof EE_Question ) {
730
+		$question_ID = (int) $this->_req_data['QST_ID'];
731
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
732
+		if ($question instanceof EE_Question) {
733 733
 			$new_question = $question->duplicate();
734
-			if( $new_question instanceof EE_Question ) {
735
-				$this->_redirect_after_action( true, esc_html__( 'Question', 'event_espresso' ), esc_html__( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
734
+			if ($new_question instanceof EE_Question) {
735
+				$this->_redirect_after_action(true, esc_html__('Question', 'event_espresso'), esc_html__('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
736 736
 			} else {
737 737
 				global $wpdb;
738
-				EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
739
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
738
+				EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
739
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
740 740
 			}
741 741
 		} else {
742
-			EE_Error::add_error( sprintf( esc_html__( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
743
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
742
+			EE_Error::add_error(sprintf(esc_html__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
743
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
744 744
 		}
745 745
 	}
746 746
 
@@ -749,8 +749,8 @@  discard block
 block discarded – undo
749 749
 	/**
750 750
 	 * @param bool $trash
751 751
 	 */
752
-	protected function _trash_or_restore_question_groups( $trash = TRUE) {
753
-		$this->_trash_or_restore_items( $this->_question_group_model, $trash );
752
+	protected function _trash_or_restore_question_groups($trash = TRUE) {
753
+		$this->_trash_or_restore_items($this->_question_group_model, $trash);
754 754
 	}
755 755
 
756 756
 
@@ -758,9 +758,9 @@  discard block
 block discarded – undo
758 758
 	/**
759 759
 	 *_trash_question
760 760
 	 */
761
-	protected function _trash_question(){
762
-		$success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] );
763
-		$query_args=array('action'=>'default','status'=>'all');
761
+	protected function _trash_question() {
762
+		$success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']);
763
+		$query_args = array('action'=>'default', 'status'=>'all');
764 764
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
765 765
 	}
766 766
 
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 	/**
770 770
 	 * @param bool $trash
771 771
 	 */
772
-	protected function _trash_or_restore_questions( $trash=TRUE){
773
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
772
+	protected function _trash_or_restore_questions($trash = TRUE) {
773
+		$this->_trash_or_restore_items($this->_question_model, $trash);
774 774
 	}
775 775
 
776 776
 
@@ -782,21 +782,21 @@  discard block
 block discarded – undo
782 782
 *@param EEM_Soft_Delete_Base $model
783 783
 	 * @param boolean $trash whether to trash or restore
784 784
 	 */
785
-	private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) {
785
+	private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) {
786 786
 
787
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
787
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
788 788
 
789 789
 		$success = 1;
790 790
 		//Checkboxes
791 791
 		//echo "trash $trash";
792 792
 		//var_dump($this->_req_data['checkbox']);die;
793
-		if ( isset( $this->_req_data['checkbox'] )) {
794
-			if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
793
+		if (isset($this->_req_data['checkbox'])) {
794
+			if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
795 795
 				// if array has more than one element than success message should be plural
796
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
796
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
797 797
 				// cycle thru bulk action checkboxes
798
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
799
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
798
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
799
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
800 800
 						$success = 0;
801 801
 					}
802 802
 				}
@@ -804,7 +804,7 @@  discard block
 block discarded – undo
804 804
 			} else {
805 805
 				// grab single id and delete
806 806
 				$ID = absint($this->_req_data['checkbox']);
807
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
807
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
808 808
 					$success = 0;
809 809
 				}
810 810
 			}
@@ -812,25 +812,25 @@  discard block
 block discarded – undo
812 812
 		} else {
813 813
 			// delete via trash link
814 814
 			// grab single id and delete
815
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
816
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
815
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
816
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
817 817
 				$success = 0;
818 818
 			}
819 819
 
820 820
 		}
821 821
 
822 822
 
823
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
823
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
824 824
 		//echo "action :$action";
825 825
 		//$action = 'questions' ? 'default' : $action;
826
-		if($trash){
826
+		if ($trash) {
827 827
 			$action_desc = 'trashed';
828 828
 			$status = 'trash';
829
-		}else{
829
+		} else {
830 830
 			$action_desc = 'restored';
831 831
 			$status = 'all';
832 832
 		}
833
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
833
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
834 834
 	}
835 835
 
836 836
 
@@ -841,16 +841,16 @@  discard block
 block discarded – undo
841 841
 	 * @param bool|false $count
842 842
 	 * @return \EE_Soft_Delete_Base_Class[]|int
843 843
 	 */
844
-	public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) {
844
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
845 845
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
846 846
 
847
-		if( $count ){
847
+		if ($count) {
848 848
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
849
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
850
-			$results=$this->_question_model->count_deleted($where);
851
-		}else{
849
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
850
+			$results = $this->_question_model->count_deleted($where);
851
+		} else {
852 852
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
853
-			$results=$this->_question_model->get_all_deleted($query_params);
853
+			$results = $this->_question_model->get_all_deleted($query_params);
854 854
 		}
855 855
 		return $results;
856 856
 	}
@@ -863,13 +863,13 @@  discard block
 block discarded – undo
863 863
 	 * @param bool|false $count
864 864
 	 * @return \EE_Soft_Delete_Base_Class[]
865 865
 	 */
866
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
867
-		$questionGroupModel=EEM_Question_Group::instance();
868
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
869
-		if ($count){
870
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
866
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
867
+		$questionGroupModel = EEM_Question_Group::instance();
868
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
869
+		if ($count) {
870
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
871 871
 			$results = $questionGroupModel->count($where);
872
-		}else{
872
+		} else {
873 873
 			$results = $questionGroupModel->get_all($query_params);
874 874
 		}
875 875
 		return $results;
@@ -883,14 +883,14 @@  discard block
 block discarded – undo
883 883
 	 * @param bool $count
884 884
 	 * @return \EE_Soft_Delete_Base_Class[]|int
885 885
 	 */
886
-	public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
887
-		$questionGroupModel=EEM_Question_Group::instance();
888
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
889
-		if($count){
890
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
886
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
887
+		$questionGroupModel = EEM_Question_Group::instance();
888
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
889
+		if ($count) {
890
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
891 891
 			$query_params['limit'] = NULL;
892 892
 			$results = $questionGroupModel->count_deleted($where);
893
-		}else{
893
+		} else {
894 894
 			$results = $questionGroupModel->get_all_deleted($query_params);
895 895
 		}
896 896
 		return $results;
@@ -906,28 +906,28 @@  discard block
 block discarded – undo
906 906
 	 */
907 907
 	public function update_question_group_order() {
908 908
 
909
-		$success = esc_html__( 'Question group order was updated successfully.', 'event_espresso' );
909
+		$success = esc_html__('Question group order was updated successfully.', 'event_espresso');
910 910
 
911 911
 		// grab our row IDs
912
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] )
913
-			? explode( ',', rtrim( $this->_req_data['row_ids'], ',' ))
912
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids'])
913
+			? explode(',', rtrim($this->_req_data['row_ids'], ','))
914 914
 			: array();
915 915
 
916
-		$perpage = !empty( $this->_req_data['perpage'] )
916
+		$perpage = ! empty($this->_req_data['perpage'])
917 917
 			? (int) $this->_req_data['perpage']
918 918
 			: NULL;
919
-		$curpage = !empty( $this->_req_data['curpage'] )
919
+		$curpage = ! empty($this->_req_data['curpage'])
920 920
 			? (int) $this->_req_data['curpage']
921 921
 			: NULL;
922 922
 
923
-		if ( ! empty( $row_ids ) ) {
923
+		if ( ! empty($row_ids)) {
924 924
 			//figure out where we start the row_id count at for the current page.
925
-			$qsg_count = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
926
-			foreach ( $row_ids as $row_id ) {
925
+			$qsg_count = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
926
+			foreach ($row_ids as $row_id) {
927 927
 				//Update the questions when re-ordering
928 928
 				$updated = EEM_Question_Group::instance()->update(
929
-					array( 'QSG_order' => $qsg_count ),
930
-					array( array( 'QSG_ID' => $row_id ) )
929
+					array('QSG_order' => $qsg_count),
930
+					array(array('QSG_ID' => $row_id))
931 931
 				);
932 932
 				$success = $updated === false ? false : $success;
933 933
 				$qsg_count++;
@@ -937,10 +937,10 @@  discard block
 block discarded – undo
937 937
 		}
938 938
 
939 939
 		$errors = ! $success
940
-			? esc_html__( 'An error occurred. The question group order was not updated.', 'event_espresso' )
940
+			? esc_html__('An error occurred. The question group order was not updated.', 'event_espresso')
941 941
 			: false;
942 942
 
943
-		echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors ));
943
+		echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors));
944 944
 		die();
945 945
 
946 946
 	}
@@ -959,17 +959,17 @@  discard block
 block discarded – undo
959 959
 		$this->_template_args['values'] = $this->_yes_no_values;
960 960
 		add_action(
961 961
 			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
962
-			array( $this, 'email_validation_settings_form' ),
962
+			array($this, 'email_validation_settings_form'),
963 963
 			2
964 964
 		);
965
-		$this->_template_args = (array)apply_filters(
965
+		$this->_template_args = (array) apply_filters(
966 966
 			'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args',
967 967
 			$this->_template_args
968 968
 		);
969
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
970
-		$this->_set_publish_post_box_vars( null, false, false, null, false );
969
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
970
+		$this->_set_publish_post_box_vars(null, false, false, null, false);
971 971
 		$this->_template_args['admin_page_content'] = EEH_Template::display_template(
972
-			REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php',
972
+			REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php',
973 973
 			$this->_template_args,
974 974
 			true
975 975
 		);
@@ -990,7 +990,7 @@  discard block
 block discarded – undo
990 990
 			EE_Registry::instance()->CFG,
991 991
 			__FILE__, __FUNCTION__, __LINE__
992 992
 		);
993
-		$this->_redirect_after_action( $success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
993
+		$this->_redirect_after_action($success, esc_html__('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
994 994
 	}
995 995
 
996 996
 
@@ -1023,20 +1023,20 @@  discard block
 block discarded – undo
1023 1023
 				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
1024 1024
 				'subsections'     => array(
1025 1025
 					'email_validation_hdr'           => new EE_Form_Section_HTML(
1026
-						EEH_HTML::h2( esc_html__( 'Email Validation Settings', 'event_espresso' ) )
1026
+						EEH_HTML::h2(esc_html__('Email Validation Settings', 'event_espresso'))
1027 1027
 					),
1028 1028
 					'email_validation_level' => new EE_Select_Input(
1029 1029
 						array(
1030
-							'basic'      => esc_html__( 'Basic', 'event_espresso' ),
1031
-							'wp_default' => esc_html__( 'WordPress Default', 'event_espresso' ),
1032
-							'i18n'       => esc_html__( 'International', 'event_espresso' ),
1033
-							'i18n_dns'   => esc_html__( 'International + DNS Check', 'event_espresso' ),
1030
+							'basic'      => esc_html__('Basic', 'event_espresso'),
1031
+							'wp_default' => esc_html__('WordPress Default', 'event_espresso'),
1032
+							'i18n'       => esc_html__('International', 'event_espresso'),
1033
+							'i18n_dns'   => esc_html__('International + DNS Check', 'event_espresso'),
1034 1034
 						),
1035 1035
 						array(
1036
-							'html_label_text' => esc_html__( 'Email Validation Level', 'event_espresso' )
1037
-							                     . EEH_Template::get_help_tab_link( 'email_validation_info' ),
1038
-							'html_help_text'  => esc_html__( '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'),
1039
-							'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level )
1036
+							'html_label_text' => esc_html__('Email Validation Level', 'event_espresso')
1037
+							                     . EEH_Template::get_help_tab_link('email_validation_info'),
1038
+							'html_help_text'  => esc_html__('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'),
1039
+							'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level)
1040 1040
 								? EE_Registry::instance()->CFG->registration->email_validation_level
1041 1041
 								: 'wp_default',
1042 1042
 							'required'        => false
@@ -1055,25 +1055,25 @@  discard block
 block discarded – undo
1055 1055
 	 * @param \EE_Registration_Config $EE_Registration_Config
1056 1056
 	 * @return \EE_Registration_Config
1057 1057
 	 */
1058
-	public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) {
1058
+	public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) {
1059 1059
         $prev_email_validation_level = $EE_Registration_Config->email_validation_level;
1060 1060
         try {
1061 1061
 			$email_validation_settings_form = $this->_email_validation_settings_form();
1062 1062
 			// if not displaying a form, then check for form submission
1063
-			if ( $email_validation_settings_form->was_submitted() ) {
1063
+			if ($email_validation_settings_form->was_submitted()) {
1064 1064
 				// capture form data
1065 1065
 				$email_validation_settings_form->receive_form_submission();
1066 1066
 				// validate form data
1067
-				if ( $email_validation_settings_form->is_valid() ) {
1067
+				if ($email_validation_settings_form->is_valid()) {
1068 1068
 					// grab validated data from form
1069 1069
 					$valid_data = $email_validation_settings_form->valid_data();
1070
-					if ( isset( $valid_data['email_validation_level'] ) ) {
1070
+					if (isset($valid_data['email_validation_level'])) {
1071 1071
 					    $email_validation_level = $valid_data['email_validation_level'];
1072 1072
                         // now if they want to use international email addresses
1073
-                        if ( $email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns' ) {
1073
+                        if ($email_validation_level === 'i18n' || $email_validation_level === 'i18n_dns') {
1074 1074
                             // in case we need to reset their email validation level,
1075 1075
                             // make sure that the previous value wasn't already set to one of the i18n options.
1076
-                            if ( $prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns' ) {
1076
+                            if ($prev_email_validation_level === 'i18n' || $prev_email_validation_level === 'i18n_dns') {
1077 1077
                                 // if so, then reset it back to "basic" since that is the only other option that,
1078 1078
                                 // despite offering poor validation, supports i18n email addresses
1079 1079
                                 $prev_email_validation_level = 'basic';
@@ -1095,7 +1095,7 @@  discard block
 block discarded – undo
1095 1095
                         );
1096 1096
 					}
1097 1097
 				} else {
1098
-					if ( $email_validation_settings_form->submission_error_message() !== '' ) {
1098
+					if ($email_validation_settings_form->submission_error_message() !== '') {
1099 1099
 						EE_Error::add_error(
1100 1100
 							$email_validation_settings_form->submission_error_message(),
1101 1101
                             __FILE__, __FUNCTION__, __LINE__
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 					}
1104 1104
 				}
1105 1105
 			}
1106
-		} catch ( EE_Error $e ) {
1106
+		} catch (EE_Error $e) {
1107 1107
 			$e->get_error();
1108 1108
 		}
1109 1109
 		return $EE_Registration_Config;
Please login to merge, or discard this patch.
admin_pages/registration_form/FormSectionListTable.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -503,7 +503,7 @@
 block discarded – undo
503 503
 	/**
504 504
 	 * @param $message_types
505 505
 	 * @param array $extra
506
-	 * @return mixed|string
506
+	 * @return string
507 507
 	 */
508 508
 	protected function _get_admin_content_events_edit( $message_types, $extra ) {
509 509
 		//defaults
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 		$lock_icon = $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers
123 123
 			? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock';
124 124
 		return $system_group > 0
125
-		       || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers )
126
-		       || ! \EE_Registry::instance()->CAP->current_user_can(
125
+			   || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers )
126
+			   || ! \EE_Registry::instance()->CAP->current_user_can(
127 127
 			'ee_delete_question_groups',
128 128
 			'espresso_registration_form_trash_form_sections',
129 129
 			$item->ID()
@@ -192,12 +192,12 @@  discard block
 block discarded – undo
192 192
 		) {
193 193
 			$actions = array(
194 194
 				'edit' => '<a href="'
195
-				          . $edit_link
196
-				          . '" title="'
197
-				          . esc_attr__( 'Edit Question Group', 'event_espresso' )
198
-				          . '">'
199
-				          . __( 'Edit', 'event_espresso' )
200
-				          . '</a>'
195
+						  . $edit_link
196
+						  . '" title="'
197
+						  . esc_attr__( 'Edit Question Group', 'event_espresso' )
198
+						  . '">'
199
+						  . __( 'Edit', 'event_espresso' )
200
+						  . '</a>'
201 201
 			);
202 202
 		}
203 203
 		if (
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 					) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
228 228
 			}
229 229
 			if ( ! $item->has_questions_with_answers()
230
-			     && \EE_Registry::instance()->CAP->current_user_can(
230
+				 && \EE_Registry::instance()->CAP->current_user_can(
231 231
 					'ee_delete_question_group',
232 232
 					'espresso_registration_form_delete_form_section',
233 233
 					$item->ID()
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace EventEspresso\admin_pages\registration_form;
3 3
 
4
-defined( 'ABSPATH' ) || exit;
4
+defined('ABSPATH') || exit;
5 5
 
6 6
 
7 7
 
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param \Registration_Form_Admin_Page $admin_page
31 31
 	 */
32
-	public function __construct( \Registration_Form_Admin_Page $admin_page ) {
32
+	public function __construct(\Registration_Form_Admin_Page $admin_page) {
33 33
 		$this->adminPage = $admin_page;
34
-		parent::__construct( $admin_page );
34
+		parent::__construct($admin_page);
35 35
 	}
36 36
 
37 37
 
@@ -41,32 +41,32 @@  discard block
 block discarded – undo
41 41
 			$this->_per_page,
42 42
 			$this->_current_page,
43 43
 			false
44
-		) : $this->adminPage->get_trashed_form_sections( $this->_per_page, $this->_current_page, false );
44
+		) : $this->adminPage->get_trashed_form_sections($this->_per_page, $this->_current_page, false);
45 45
 		$this->_all_data_count = $this->_view !== 'trash' ? $this->adminPage->get_form_sections(
46 46
 			$this->_per_page,
47 47
 			$this->_current_page,
48 48
 			true
49
-		) : $this->adminPage->get_trashed_form_sections( $this->_per_page, $this->_current_page, true );
49
+		) : $this->adminPage->get_trashed_form_sections($this->_per_page, $this->_current_page, true);
50 50
 	}
51 51
 
52 52
 
53 53
 
54 54
 	protected function _set_properties() {
55 55
 		$this->_wp_list_args = array(
56
-			'singular' => __( 'question group', 'event_espresso' ),
57
-			'plural'   => __( 'question groups', 'event_espresso' ),
56
+			'singular' => __('question group', 'event_espresso'),
57
+			'plural'   => __('question groups', 'event_espresso'),
58 58
 			'ajax'     => true, //for now,
59 59
 			'screen'   => $this->adminPage->get_current_screen()->id
60 60
 		);
61 61
 		$this->_columns = array(
62 62
 			'cb'              => '<input type="checkbox" />',
63
-			'id'              => __( 'ID', 'event_espresso' ),
64
-			'name'            => __( 'Form Section Name', 'event_espresso' ),
65
-			'description'     => __( 'Description', 'event_espresso' ),
63
+			'id'              => __('ID', 'event_espresso'),
64
+			'name'            => __('Form Section Name', 'event_espresso'),
65
+			'description'     => __('Description', 'event_espresso'),
66 66
 		);
67 67
 		$this->_sortable_columns = array(
68
-			'id'   => array( 'QSG_ID' => false ),
69
-			'name' => array( 'QSG_name' => false )
68
+			'id'   => array('QSG_ID' => false),
69
+			'name' => array('QSG_name' => false)
70 70
 		);
71 71
 		$this->_hidden_columns = array(
72 72
 			'id'
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			$this->_current_page,
97 97
 			true
98 98
 		);
99
-		if ( \EE_Registry::instance()->CAP->current_user_can(
99
+		if (\EE_Registry::instance()->CAP->current_user_can(
100 100
 			'ee_delete_question_groups',
101 101
 			'espresso_registration_form_trash_form_section'
102 102
 		)
@@ -116,19 +116,19 @@  discard block
 block discarded – undo
116 116
 	 * @return string|void
117 117
 	 * @throws \EE_Error
118 118
 	 */
119
-	public function column_cb( $item ) {
120
-		$system_group = $item->get( 'QSG_system' );
119
+	public function column_cb($item) {
120
+		$system_group = $item->get('QSG_system');
121 121
 		$has_questions_with_answers = $item->has_questions_with_answers();
122 122
 		$lock_icon = $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers
123 123
 			? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock';
124 124
 		return $system_group > 0
125
-		       || ( $system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers )
125
+		       || ($system_group === 0 && $this->_view === 'trash' && $has_questions_with_answers)
126 126
 		       || ! \EE_Registry::instance()->CAP->current_user_can(
127 127
 			'ee_delete_question_groups',
128 128
 			'espresso_registration_form_trash_form_sections',
129 129
 			$item->ID()
130 130
 		)
131
-			? '<span class="' . $lock_icon . '"></span>' . sprintf(
131
+			? '<span class="'.$lock_icon.'"></span>'.sprintf(
132 132
 				'<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />',
133 133
 				$item->ID()
134 134
 			)
@@ -145,9 +145,9 @@  discard block
 block discarded – undo
145 145
 	 * @return mixed|string
146 146
 	 * @throws \EE_Error
147 147
 	 */
148
-	public function column_id( \EE_Question_Group $item ) {
148
+	public function column_id(\EE_Question_Group $item) {
149 149
 		$content = $item->ID();
150
-		$content .= '  <span class="show-on-mobile-view-only">' . $item->name() . '</span>';
150
+		$content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
151 151
 		return $content;
152 152
 	}
153 153
 
@@ -158,11 +158,11 @@  discard block
 block discarded – undo
158 158
 	 * @return string
159 159
 	 * @throws \EE_Error
160 160
 	 */
161
-	public function column_name( \EE_Question_Group $item ) {
161
+	public function column_name(\EE_Question_Group $item) {
162 162
 		$actions = array();
163 163
 		//return $item->name();
164
-		if ( ! defined( 'REG_ADMIN_URL' ) ) {
165
-			define( 'REG_ADMIN_URL', EVENTS_ADMIN_URL );
164
+		if ( ! defined('REG_ADMIN_URL')) {
165
+			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
166 166
 		}
167 167
 		$edit_query_args = array(
168 168
 			'action' => 'add_edit_form_section',
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 			'action' => 'delete_form_section',
181 181
 			'QSG_ID' => $item->ID()
182 182
 		);
183
-		$edit_link = \EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL );
184
-		$trash_link = \EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL );
185
-		$restore_link = \EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL );
186
-		$delete_link = \EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL );
187
-		if ( \EE_Registry::instance()->CAP->current_user_can(
183
+		$edit_link = \EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
184
+		$trash_link = \EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
185
+		$restore_link = \EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
186
+		$delete_link = \EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
187
+		if (\EE_Registry::instance()->CAP->current_user_can(
188 188
 			'ee_edit_question_group',
189 189
 			'espresso_registration_form_edit_form_section',
190 190
 			$item->ID()
@@ -194,37 +194,37 @@  discard block
 block discarded – undo
194 194
 				'edit' => '<a href="'
195 195
 				          . $edit_link
196 196
 				          . '" title="'
197
-				          . esc_attr__( 'Edit Question Group', 'event_espresso' )
197
+				          . esc_attr__('Edit Question Group', 'event_espresso')
198 198
 				          . '">'
199
-				          . __( 'Edit', 'event_espresso' )
199
+				          . __('Edit', 'event_espresso')
200 200
 				          . '</a>'
201 201
 			);
202 202
 		}
203 203
 		if (
204 204
 			$this->_view !== 'trash'
205
-			&& $item->get( 'QSG_system' ) < 1
205
+			&& $item->get('QSG_system') < 1
206 206
 			&& \EE_Registry::instance()->CAP->current_user_can(
207 207
 				'ee_delete_question_group',
208 208
 				'espresso_registration_form_trash_form_section',
209 209
 				$item->ID()
210 210
 			)
211 211
 		) {
212
-			$actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__(
212
+			$actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__(
213 213
 					'Delete Question Group',
214 214
 					'event_espresso'
215
-				) . '">' . __( 'Trash', 'event_espresso' ) . '</a>';
215
+				).'">'.__('Trash', 'event_espresso').'</a>';
216 216
 		}
217
-		if ( $this->_view === 'trash' ) {
218
-			if ( \EE_Registry::instance()->CAP->current_user_can(
217
+		if ($this->_view === 'trash') {
218
+			if (\EE_Registry::instance()->CAP->current_user_can(
219 219
 				'ee_delete_question_group',
220 220
 				'espresso_registration_form_restore_form_section',
221 221
 				$item->ID()
222 222
 			)
223 223
 			) {
224
-				$actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__(
224
+				$actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__(
225 225
 						'Restore Question Group',
226 226
 						'event_espresso'
227
-					) . '">' . __( 'Restore', 'event_espresso' ) . '</a>';
227
+					).'">'.__('Restore', 'event_espresso').'</a>';
228 228
 			}
229 229
 			if ( ! $item->has_questions_with_answers()
230 230
 			     && \EE_Registry::instance()->CAP->current_user_can(
@@ -233,18 +233,18 @@  discard block
 block discarded – undo
233 233
 					$item->ID()
234 234
 				)
235 235
 			) {
236
-				$actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__(
236
+				$actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__(
237 237
 						'Delete Question Group Permanently',
238 238
 						'event_espresso'
239
-					) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>';
239
+					).'">'.__('Delete Permanently', 'event_espresso').'</a>';
240 240
 			}
241 241
 		}
242 242
 		$content = \EE_Registry::instance()->CAP->current_user_can(
243 243
 			'ee_edit_question_group',
244 244
 			'espresso_registration_form_edit_form_section',
245 245
 			$item->ID()
246
-		) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name();
247
-		$content .= $this->row_actions( $actions );
246
+		) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name();
247
+		$content .= $this->row_actions($actions);
248 248
 		return $content;
249 249
 	}
250 250
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	 * @param \EE_Question_Group $item
255 255
 	 * @return string
256 256
 	 */
257
-	public function column_identifier( \EE_Question_Group $item ) {
257
+	public function column_identifier(\EE_Question_Group $item) {
258 258
 		return $item->identifier();
259 259
 	}
260 260
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 * @param \EE_Question_Group $item
265 265
 	 * @return string
266 266
 	 */
267
-	public function column_description( \EE_Question_Group $item ) {
267
+	public function column_description(\EE_Question_Group $item) {
268 268
 		return $item->desc();
269 269
 	}
270 270
 
Please login to merge, or discard this patch.
admin_pages/registration_form/Registration_Form_Admin_Page.core.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 
439 439
 
440 440
 	/**
441
-	 * @param            $per_page
441
+	 * @param            integer $per_page
442 442
 	 * @param int        $current_page
443 443
 	 * @param bool|false $count
444 444
 	 * @return \EE_Soft_Delete_Base_Class[]
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
 
461 461
 	/**
462
-	 * @param      $per_page
462
+	 * @param      integer $per_page
463 463
 	 * @param int  $current_page
464 464
 	 * @param bool $count
465 465
 	 * @return \EE_Soft_Delete_Base_Class[]|int
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 
546 546
 
547 547
 	/**
548
-	 * @return array
548
+	 * @return EventEspresso\core\libraries\form_sections\inputs\EE_Form_Input_Base[]
549 549
 	 * @throws \EE_Error
550 550
 	 */
551 551
 	public function getAvailableFormInputs() {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	 *_question_model EEM_Question model instance (for queries)
49 49
 	 *
50 50
 	 * @var EEM_Question $_question_model;
51
- */
51
+	 */
52 52
 	protected $_question_model;
53 53
 
54 54
 	/**
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 				),
182 182
 				'list_table' => '\EventEspresso\admin_pages\registration_form\FormSectionListTable',
183 183
 				'metaboxes' => array(),
184
-                'help_tabs' => array(
184
+				'help_tabs' => array(
185 185
 					// 'registration_form_questions_overview_help_tab' => array(
186 186
 					// 	'title' => esc_html__('Questions Overview', 'event_espresso'),
187 187
 					// 	'filename' => 'registration_form_questions_overview'
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 				),
217 217
 				'metaboxes' => array_merge( array('_publish_post_box' ) ),
218 218
 				'help_tabs' => array(),
219
-                'help_tour' => array(),
219
+				'help_tour' => array(),
220 220
 				'require_nonce' => false
221 221
 			),
222 222
 		);
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 use EventEspresso\core\libraries\form_sections\inputs\FormInputsLoader;
8 8
 
9 9
 
10
-if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) {
11
-	exit( 'NO direct script access allowed' );
10
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
11
+	exit('NO direct script access allowed');
12 12
 }
13 13
 
14 14
 
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	 * 		@param bool $routing indicate whether we want to just load the object and handle routing or just load the object.
67 67
 	 * 		@access public
68 68
 	 */
69
-	public function __construct( $routing = TRUE ) {
70
-		require_once( EE_MODELS . 'EEM_Question.model.php' );
71
-		require_once( EE_MODELS . 'EEM_Question_Group.model.php' );
72
-		$this->_question_model=  EEM_Question::instance();
73
-		$this->_question_group_model=EEM_Question_Group::instance();
74
-		parent::__construct( $routing );
69
+	public function __construct($routing = TRUE) {
70
+		require_once(EE_MODELS.'EEM_Question.model.php');
71
+		require_once(EE_MODELS.'EEM_Question_Group.model.php');
72
+		$this->_question_model = EEM_Question::instance();
73
+		$this->_question_group_model = EEM_Question_Group::instance();
74
+		parent::__construct($routing);
75 75
 	}
76 76
 
77 77
 
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		$this->_admin_page_title = esc_html__('Registration Form', 'event_espresso');
117 117
 		$this->_labels = array(
118 118
 			'buttons' => array(
119
-				'add_edit_form_section' => esc_html__( 'Add New Form Section', 'event_espresso' ),
119
+				'add_edit_form_section' => esc_html__('Add New Form Section', 'event_espresso'),
120 120
 				'edit_question' => esc_html__('Edit Question', 'event_espresso'),
121 121
 			)
122 122
 		);
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 *_set_page_routes
129 129
 	 */
130 130
 	protected function _set_page_routes() {
131
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 1;
131
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 1;
132 132
 		$this->_page_routes = array(
133 133
 
134 134
 			'default' => array(
@@ -140,26 +140,26 @@  discard block
 block discarded – undo
140 140
 				'func' => 'add_edit_form_section',
141 141
 				'capability' => 'ee_edit_question_groups',
142 142
 				'obj_id' => $qsg_id,
143
-				'args' => array( 'edit' ),
143
+				'args' => array('edit'),
144 144
 			),
145 145
 
146 146
 			'form_section_preview' => array(
147 147
 				'func' => '_form_section_preview',
148 148
 				'capability' => 'ee_read_question_groups',
149 149
 				'obj_id' => $qsg_id,
150
-				'args' => array( 'edit' ),
150
+				'args' => array('edit'),
151 151
 			),
152 152
 
153 153
 			'insert_form_section' => array(
154 154
 				'func'       => '_insert_or_update_form_section',
155
-				'args'       => array( 'new_form_section' => true ),
155
+				'args'       => array('new_form_section' => true),
156 156
 				'capability' => 'ee_edit_question_groups',
157 157
 				'noheader'   => true,
158 158
 			),
159 159
 
160 160
 			'update_form_section' => array(
161 161
 				'func'       => '_insert_or_update_form_section',
162
-				'args'       => array( 'new_form_section' => false ),
162
+				'args'       => array('new_form_section' => false),
163 163
 				'capability' => 'ee_edit_question_group',
164 164
 				'obj_id'     => $qsg_id,
165 165
 				'noheader'   => true,
@@ -207,14 +207,14 @@  discard block
 block discarded – undo
207 207
 					'label' => esc_html__('Add/Edit Form Section', 'event_espresso'),
208 208
 					'order' => 15,
209 209
 					'persistent' => false,
210
-					'url' => isset( $this->_req_data['QSG_ID'] )
210
+					'url' => isset($this->_req_data['QSG_ID'])
211 211
 						? add_query_arg(
212
-							array('QSG_ID' => $this->_req_data['QSG_ID'] ),
212
+							array('QSG_ID' => $this->_req_data['QSG_ID']),
213 213
 							$this->_current_page_view_url
214 214
 						)
215 215
 						: $this->_admin_base_url
216 216
 				),
217
-				'metaboxes' => array_merge( array('_publish_post_box' ) ),
217
+				'metaboxes' => array_merge(array('_publish_post_box')),
218 218
 				'help_tabs' => array(),
219 219
                 'help_tour' => array(),
220 220
 				'require_nonce' => false
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 	public function load_scripts_styles() {
241 241
 		wp_register_style(
242 242
 			'espresso_registration',
243
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css',
244
-			array( 'dashicons' ),
243
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css',
244
+			array('dashicons'),
245 245
 			EVENT_ESPRESSO_VERSION
246 246
 		);
247 247
 		wp_enqueue_style('espresso_registration');
@@ -256,12 +256,12 @@  discard block
 block discarded – undo
256 256
 		$this->load_scripts_styles_forms();
257 257
 		wp_register_script(
258 258
 			'espresso_registration_form_single',
259
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
260
-			array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ),
261
-			EVENT_ESPRESSO_VERSION . time(),
259
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js',
260
+			array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'),
261
+			EVENT_ESPRESSO_VERSION.time(),
262 262
 			true
263 263
 		);
264
-		wp_enqueue_script( 'espresso_registration_form_single' );
264
+		wp_enqueue_script('espresso_registration_form_single');
265 265
 	}
266 266
 
267 267
 
@@ -271,19 +271,19 @@  discard block
 block discarded – undo
271 271
 		$this->load_scripts_styles_forms();
272 272
 		wp_register_script(
273 273
 			'espresso_registration_form_single',
274
-			REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js',
275
-			array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ),
276
-			EVENT_ESPRESSO_VERSION . time(),
274
+			REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js',
275
+			array('jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable'),
276
+			EVENT_ESPRESSO_VERSION.time(),
277 277
 			true
278 278
 		);
279
-		wp_enqueue_script( 'espresso_registration_form_single' );
279
+		wp_enqueue_script('espresso_registration_form_single');
280 280
 	}
281 281
 
282 282
 
283 283
 
284 284
 
285 285
 	public function recaptcha_info_help_tab() {
286
-		$template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php';
286
+		$template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php';
287 287
 		EEH_Template::display_template($template, array());
288 288
 	}
289 289
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 			)
314 314
 		);
315 315
 
316
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
316
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
317 317
 			$this->_views['trash'] = array(
318 318
 				'slug' => 'trash',
319 319
 				'label' => __('Trash', 'event_espresso'),
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
 				)
340 340
 		);
341 341
 
342
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
342
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
343 343
 			$this->_views['trash'] = array(
344 344
 				'slug' => 'trash',
345 345
 				'label' => esc_html__('Trash', 'event_espresso'),
@@ -354,8 +354,8 @@  discard block
 block discarded – undo
354 354
 
355 355
 
356 356
 	protected function _form_sections_overview_list_table() {
357
-		$this->_search_btn_label = __( 'Form Sections', 'event_espresso' );
358
-		$this->_admin_page_title .= ' ' . $this->get_action_link_or_button(
357
+		$this->_search_btn_label = __('Form Sections', 'event_espresso');
358
+		$this->_admin_page_title .= ' '.$this->get_action_link_or_button(
359 359
 				'add_edit_form_section',
360 360
 				'add_edit_form_section',
361 361
 				array(),
@@ -378,27 +378,27 @@  discard block
 block discarded – undo
378 378
 	 * @param int      $current_page
379 379
 	 * @return array lik EEM_Base::get_all's $query_params parameter
380 380
 	 */
381
-	protected function get_query_params( $model, $per_page = 10, $current_page = 10 ) {
381
+	protected function get_query_params($model, $per_page = 10, $current_page = 10) {
382 382
 		$query_params = array();
383
-		$offset = ( $current_page - 1 ) * $per_page;
384
-		$query_params['limit'] = array( $offset, $per_page );
385
-		$order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] ) )
383
+		$offset = ($current_page - 1) * $per_page;
384
+		$query_params['limit'] = array($offset, $per_page);
385
+		$order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order']))
386 386
 			? $this->_req_data['order'] : 'ASC';
387 387
 		$orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order';
388
-		$field_to_order_by = empty( $this->_req_data['orderby'] ) ? $orderby_field : $this->_req_data['orderby'];
389
-		$query_params['order_by'] = array( $field_to_order_by => $order );
390
-		$search_string = array_key_exists( 's', $this->_req_data ) ? $this->_req_data['s'] : null;
391
-		if ( ! empty( $search_string ) ) {
392
-			if ( $model instanceof EEM_Question_Group ) {
388
+		$field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby'];
389
+		$query_params['order_by'] = array($field_to_order_by => $order);
390
+		$search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null;
391
+		if ( ! empty($search_string)) {
392
+			if ($model instanceof EEM_Question_Group) {
393 393
 				$query_params[0] = array(
394 394
 					'OR' => array(
395
-						'QSG_name' => array( 'LIKE', "%$search_string%" ),
396
-						'QSG_desc' => array( 'LIKE', "%$search_string%" )
395
+						'QSG_name' => array('LIKE', "%$search_string%"),
396
+						'QSG_desc' => array('LIKE', "%$search_string%")
397 397
 					)
398 398
 				);
399 399
 			} else {
400 400
 				$query_params[0] = array(
401
-					'QST_display_text' => array( 'LIKE', "%$search_string%" )
401
+					'QST_display_text' => array('LIKE', "%$search_string%")
402 402
 				);
403 403
 			}
404 404
 		}
@@ -444,14 +444,14 @@  discard block
 block discarded – undo
444 444
 	 * @return \EE_Soft_Delete_Base_Class[]
445 445
 	 * @throws \EE_Error
446 446
 	 */
447
-	public function get_form_sections( $per_page, $current_page = 1, $count = false ) {
447
+	public function get_form_sections($per_page, $current_page = 1, $count = false) {
448 448
 		$questionGroupModel = EEM_Question_Group::instance();
449
-		$query_params = $this->get_query_params( $questionGroupModel, $per_page, $current_page );
450
-		if ( $count ) {
451
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
452
-			$results = $questionGroupModel->count( $where );
449
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
450
+		if ($count) {
451
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
452
+			$results = $questionGroupModel->count($where);
453 453
 		} else {
454
-			$results = $questionGroupModel->get_all( $query_params );
454
+			$results = $questionGroupModel->get_all($query_params);
455 455
 		}
456 456
 		return $results;
457 457
 	}
@@ -464,15 +464,15 @@  discard block
 block discarded – undo
464 464
 	 * @param bool $count
465 465
 	 * @return \EE_Soft_Delete_Base_Class[]|int
466 466
 	 */
467
-	public function get_trashed_form_sections( $per_page, $current_page = 1, $count = false ) {
467
+	public function get_trashed_form_sections($per_page, $current_page = 1, $count = false) {
468 468
 		$questionGroupModel = EEM_Question_Group::instance();
469
-		$query_params = $this->get_query_params( $questionGroupModel, $per_page, $current_page );
470
-		if ( $count ) {
471
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
469
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
470
+		if ($count) {
471
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
472 472
 			$query_params['limit'] = null;
473
-			$results = $questionGroupModel->count_deleted( $where );
473
+			$results = $questionGroupModel->count_deleted($where);
474 474
 		} else {
475
-			$results = $questionGroupModel->get_all_deleted( $query_params );
475
+			$results = $questionGroupModel->get_all_deleted($query_params);
476 476
 		}
477 477
 		return $results;
478 478
 	}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @throws \EventEspresso\core\exceptions\InvalidEntityException
490 490
 	 */
491 491
 	protected function add_edit_form_section() {
492
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
492
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
493 493
 		// are we editing an existing Question Group or creating a new one ?
494 494
 		$reg_form_editor = new RegistrationFormEditor(
495 495
 			$this,
@@ -507,9 +507,9 @@  discard block
 block discarded – undo
507 507
 			$reg_form_editor->getRoute(),
508 508
 			$reg_form_editor->getAdditionalHiddenFields()
509 509
 		);
510
-		$this->_set_publish_post_box_vars( 'id', $reg_form_editor->getQuestionGroupID() );
510
+		$this->_set_publish_post_box_vars('id', $reg_form_editor->getQuestionGroupID());
511 511
 		$reg_form_editor->addMetaBoxes();
512
-		$this->_template_args[ 'admin_page_content' ] = $reg_form_editor->getAdminPageContent();
512
+		$this->_template_args['admin_page_content'] = $reg_form_editor->getAdminPageContent();
513 513
 		// the details template wrapper
514 514
 		$this->display_admin_page_with_sidebar();
515 515
 	}
@@ -524,20 +524,20 @@  discard block
 block discarded – undo
524 524
 	public function getFormSection() {
525 525
 		// get copy of EE_Request
526 526
 		$request_data = $this->get_request_data();
527
-		$QSG_ID = isset( $request_data['QSG_ID'] ) && ! empty( $request_data['QSG_ID'] )
528
-			? absint( $request_data['QSG_ID'] )
527
+		$QSG_ID = isset($request_data['QSG_ID']) && ! empty($request_data['QSG_ID'])
528
+			? absint($request_data['QSG_ID'])
529 529
 			: 0;
530 530
 		// find question group if applicable
531
-		if ( $QSG_ID ) {
531
+		if ($QSG_ID) {
532 532
 			/** @var \EEM_Question_Group $question_group_model */
533 533
 			$question_group_model = $this->question_group_model();
534
-			$question_group = $question_group_model->get_one_by_ID( $QSG_ID );
534
+			$question_group = $question_group_model->get_one_by_ID($QSG_ID);
535 535
 		} else {
536 536
 			$question_group = \EE_Question_Group::new_instance();
537 537
 			$question_group->set_order_to_latest();
538 538
 		}
539
-		if ( ! $question_group instanceof \EE_Question_Group ) {
540
-			throw new InvalidEntityException( $question_group, 'EE_Question_Group' );
539
+		if ( ! $question_group instanceof \EE_Question_Group) {
540
+			throw new InvalidEntityException($question_group, 'EE_Question_Group');
541 541
 		}
542 542
 		return $question_group;
543 543
 	}
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
 			'select_multi_model',
560 560
 			//'submit',
561 561
 		);
562
-		return FormInputsLoader::get( $exclude );
562
+		return FormInputsLoader::get($exclude);
563 563
 	}
564 564
 
565 565
 
@@ -569,49 +569,49 @@  discard block
 block discarded – undo
569 569
 	 * @throws \EventEspresso\core\exceptions\InvalidFormSubmissionException
570 570
 	 * @throws \EE_Error
571 571
 	 */
572
-	protected function _insert_or_update_form_section( $new_question_group = true ) {
572
+	protected function _insert_or_update_form_section($new_question_group = true) {
573 573
 		$success = true;
574 574
 		// $reg_form_editor_form = new RegistrationFormEditorForm(
575 575
 		// 	$this->_question_model
576 576
 		// );
577 577
 		// $form = $reg_form_editor_form->rawForm( $this->getAvailableFormInputs() );
578
-		if ( ! ( isset( $_REQUEST['settings'] ) && is_array( $_REQUEST['settings'] ) ) ) {
578
+		if ( ! (isset($_REQUEST['settings']) && is_array($_REQUEST['settings']))) {
579 579
 			throw new InvalidFormSubmissionException(
580
-				__( 'Form Section settings are missing or invalid.', 'event_espresso' )
580
+				__('Form Section settings are missing or invalid.', 'event_espresso')
581 581
 			);
582 582
 		}
583 583
 		$field_settings = $this->_question_model->field_settings();
584 584
 		// \EEH_Debug_Tools::printr( $field_settings, '$field_settings', __FILE__, __LINE__ );
585
-		unset( $_REQUEST['reg_form']['clone'], $_REQUEST['settings']['clone'], $_REQUEST['input_options'] );
585
+		unset($_REQUEST['reg_form']['clone'], $_REQUEST['settings']['clone'], $_REQUEST['input_options']);
586 586
 		// \EEH_Debug_Tools::printr( $_REQUEST, '$_REQUEST', __FILE__, __LINE__ );
587 587
 		// $reg_form_input_list = explode( ',', sanitize_text_field( $_REQUEST['reg_form_input_list'] ) );
588 588
 		// \EEH_Debug_Tools::printr( $reg_form_input_list, '$reg_form_input_list', __FILE__, __LINE__ );
589
-		foreach ( (array) $_REQUEST['settings'] as $identifier => $form_input_fields ) {
589
+		foreach ((array) $_REQUEST['settings'] as $identifier => $form_input_fields) {
590 590
 			// \EEH_Debug_Tools::printr( $identifier, '$identifier', __FILE__, __LINE__ );
591 591
 			// \EEH_Debug_Tools::printr( $form_input_fields, '$form_input_fields', __FILE__, __LINE__ );
592
-			if ( ! isset( $form_input_fields['identifier'] ) ) {
592
+			if ( ! isset($form_input_fields['identifier'])) {
593 593
 				throw new InvalidFormSubmissionException(
594
-					__( 'Form Section input identifier is missing or invalid.', 'event_espresso' )
594
+					__('Form Section input identifier is missing or invalid.', 'event_espresso')
595 595
 				);
596 596
 			}
597 597
 			$properties_and_values = array();
598
-			foreach ( (array) $form_input_fields as $field_name => $value ) {
599
-				$field_name = strpos( $field_name, 'QST_' ) !== 0 ? "QST_{$field_name}" : $field_name;
598
+			foreach ((array) $form_input_fields as $field_name => $value) {
599
+				$field_name = strpos($field_name, 'QST_') !== 0 ? "QST_{$field_name}" : $field_name;
600 600
 				// \EEH_Debug_Tools::printr( $field_name, '$field_name', __FILE__, __LINE__ );
601
-				if ( isset( $field_settings[ $field_name ] ) ) {
602
-					$properties_and_values[ $field_name ] = $value;
601
+				if (isset($field_settings[$field_name])) {
602
+					$properties_and_values[$field_name] = $value;
603 603
 				}
604 604
 			}
605 605
 			// \EEH_Debug_Tools::printr( $properties_and_values, '$properties_and_values', __FILE__, __LINE__ );
606
-			if ( $form_input_fields['identifier'] === $identifier ) {
606
+			if ($form_input_fields['identifier'] === $identifier) {
607 607
 				// update existing question
608 608
 				$result = EEM_Question::instance()->update(
609 609
 					$properties_and_values,
610
-					array( array( 'QST_identifier' => $identifier ) )
610
+					array(array('QST_identifier' => $identifier))
611 611
 				);
612 612
 			} else {
613 613
 				// insert new question
614
-				$question = \EE_Question::new_instance( $properties_and_values );
614
+				$question = \EE_Question::new_instance($properties_and_values);
615 615
 				$result = $question->save();
616 616
 			}
617 617
 			$success = $result ? $success : false;
@@ -632,18 +632,18 @@  discard block
 block discarded – undo
632 632
 		// \EEH_Debug_Tools::printr( $_REQUEST['settings'], '$_REQUEST[settings]', __FILE__, __LINE__ );
633 633
 		//\EEH_Debug_Tools::printr( $form, '$form', __FILE__, __LINE__ );
634 634
 		// die();
635
-		if ( $success !== FALSE ) {
635
+		if ($success !== FALSE) {
636 636
 			EE_Error::add_success(
637 637
 				$new_question_group
638
-					? esc_html__( 'The Form Section has been created', 'event_espresso' )
639
-					: esc_html__( 'The Form Section has been updated', 'event_espresso' )
638
+					? esc_html__('The Form Section has been created', 'event_espresso')
639
+					: esc_html__('The Form Section has been updated', 'event_espresso')
640 640
 			);
641 641
 		}
642 642
 		$this->_redirect_after_action(
643 643
 			$success,
644
-			esc_html__( 'Form Section', 'event_espresso' ),
645
-			$new_question_group ? esc_html__( 'created', 'event_espresso' ) : esc_html__( 'updated', 'event_espresso' ),
646
-			array( 'action' => 'default', /*'QSG_ID' => $ID*/ )
644
+			esc_html__('Form Section', 'event_espresso'),
645
+			$new_question_group ? esc_html__('created', 'event_espresso') : esc_html__('updated', 'event_espresso'),
646
+			array('action' => 'default', /*'QSG_ID' => $ID*/)
647 647
 		);
648 648
 	}
649 649
 
@@ -797,36 +797,36 @@  discard block
 block discarded – undo
797 797
 
798 798
 		$this->_template_args['values'] = $this->_yes_no_values;
799 799
 
800
-		$this->_template_args['use_captcha'] = isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
801
-		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"': '';
800
+		$this->_template_args['use_captcha'] = isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE;
801
+		$this->_template_args['show_captcha_settings'] = $this->_template_args['use_captcha'] ? 'style="display:table-row;"' : '';
802 802
 
803
-		$this->_template_args['recaptcha_publickey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '';
804
-		$this->_template_args['recaptcha_privatekey'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '';
805
-		$this->_template_args['recaptcha_width'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_width ) ? absint( EE_Registry::instance()->CFG->registration->recaptcha_width ) : 500;
803
+		$this->_template_args['recaptcha_publickey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '';
804
+		$this->_template_args['recaptcha_privatekey'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '';
805
+		$this->_template_args['recaptcha_width'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_width) ? absint(EE_Registry::instance()->CFG->registration->recaptcha_width) : 500;
806 806
 
807 807
 		$this->_template_args['recaptcha_theme_options'] = array(
808
-				array('id'  => 'red','text'=> __('Red', 'event_espresso')),
809
-				array('id'  => 'white','text'=> __('White', 'event_espresso')),
810
-				array('id'  => 'blackglass','text'=> __('Blackglass', 'event_espresso')),
811
-				array('id'  => 'clean','text'=> __('Clean', 'event_espresso'))
808
+				array('id'  => 'red', 'text'=> __('Red', 'event_espresso')),
809
+				array('id'  => 'white', 'text'=> __('White', 'event_espresso')),
810
+				array('id'  => 'blackglass', 'text'=> __('Blackglass', 'event_espresso')),
811
+				array('id'  => 'clean', 'text'=> __('Clean', 'event_espresso'))
812 812
 			);
813
-		$this->_template_args['recaptcha_theme'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->get_pretty( 'recaptcha_theme' ) : 'clean';
813
+		$this->_template_args['recaptcha_theme'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->get_pretty('recaptcha_theme') : 'clean';
814 814
 
815 815
 		$this->_template_args['recaptcha_language_options'] = array(
816
-				array('id'  => 'en','text'=> __('English', 'event_espresso')),
817
-				array('id'  => 'es','text'=> __('Spanish', 'event_espresso')),
818
-				array('id'  => 'nl','text'=> __('Dutch', 'event_espresso')),
819
-				array('id'  => 'fr','text'=> __('French', 'event_espresso')),
820
-				array('id'  => 'de','text'=> __('German', 'event_espresso')),
821
-				array('id'  => 'pt','text'=> __('Portuguese', 'event_espresso')),
822
-				array('id'  => 'ru','text'=> __('Russian', 'event_espresso')),
823
-				array('id'  => 'tr','text'=> __('Turkish', 'event_espresso'))
816
+				array('id'  => 'en', 'text'=> __('English', 'event_espresso')),
817
+				array('id'  => 'es', 'text'=> __('Spanish', 'event_espresso')),
818
+				array('id'  => 'nl', 'text'=> __('Dutch', 'event_espresso')),
819
+				array('id'  => 'fr', 'text'=> __('French', 'event_espresso')),
820
+				array('id'  => 'de', 'text'=> __('German', 'event_espresso')),
821
+				array('id'  => 'pt', 'text'=> __('Portuguese', 'event_espresso')),
822
+				array('id'  => 'ru', 'text'=> __('Russian', 'event_espresso')),
823
+				array('id'  => 'tr', 'text'=> __('Turkish', 'event_espresso'))
824 824
 			);
825
-		$this->_template_args['recaptcha_language'] = isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
825
+		$this->_template_args['recaptcha_language'] = isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en';
826 826
 
827
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
828
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
829
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
827
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
828
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
829
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
830 830
 		$this->display_admin_page_with_sidebar();
831 831
 	}
832 832
 
Please login to merge, or discard this patch.
core/db_classes/EE_Question_Group.class.php 2 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 	/**
17 17
 	 * @param array $props_n_values
18
-	 * @return EE_Question_Group|mixed
18
+	 * @return string
19 19
 	 */
20 20
 	public static function new_instance( $props_n_values = array() ) {
21 21
 		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 	/**
238 238
 	 * Adds the question to this question group
239 239
 	 * @param EE_Question || int $question object or ID
240
-	 * @return boolean if successful
240
+	 * @return EE_Base_Class if successful
241 241
 	 */
242 242
 	public function add_question( $questionObjectOrID ) {
243 243
 		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 	/**
249 249
 	 * Removes the question from this question group
250 250
 	 * @param EE_Question || int $question object or ID
251
-	 * @return boolean of success
251
+	 * @return EE_Base_Class of success
252 252
 	 */
253 253
 	public function remove_question( $questionObjectOrID ) {
254 254
 		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1
-<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) {
2
-	exit( 'No direct script access allowed' );
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 
5 5
 /**
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
 	 * @param array $props_n_values
18 18
 	 * @return EE_Question_Group|mixed
19 19
 	 */
20
-	public static function new_instance( $props_n_values = array() ) {
21
-		$has_object = parent::_check_for_object( $props_n_values, __CLASS__ );
22
-		return $has_object ? $has_object : new self( $props_n_values );
20
+	public static function new_instance($props_n_values = array()) {
21
+		$has_object = parent::_check_for_object($props_n_values, __CLASS__);
22
+		return $has_object ? $has_object : new self($props_n_values);
23 23
 	}
24 24
 
25 25
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
 	 * @param array $props_n_values
29 29
 	 * @return EE_Question_Group
30 30
 	 */
31
-	public static function new_instance_from_db( $props_n_values = array() ) {
32
-		return new self( $props_n_values, TRUE );
31
+	public static function new_instance_from_db($props_n_values = array()) {
32
+		return new self($props_n_values, TRUE);
33 33
 	}
34 34
 
35 35
 
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 * @param bool $pretty
41 41
 	 * @return string
42 42
 	 */
43
-	public function name( $pretty = FALSE ) {
44
-		return $pretty ? $this->get_pretty( 'QSG_name' ) : $this->get( 'QSG_name' );
43
+	public function name($pretty = FALSE) {
44
+		return $pretty ? $this->get_pretty('QSG_name') : $this->get('QSG_name');
45 45
 	}
46 46
 
47 47
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 	 * @return string
54 54
 	 */
55 55
 	public function identifier() {
56
-		return $this->get( 'QSG_identifier' );
56
+		return $this->get('QSG_identifier');
57 57
 	}
58 58
 
59 59
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 * @param bool $pretty
65 65
 	 * @return string
66 66
 	 */
67
-	public function desc( $pretty = FALSE ) {
68
-		return $pretty ? $this->get_pretty( 'QSG_desc' ) : $this->get( 'QSG_desc' );
67
+	public function desc($pretty = FALSE) {
68
+		return $pretty ? $this->get_pretty('QSG_desc') : $this->get('QSG_desc');
69 69
 	}
70 70
 
71 71
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @return int
78 78
 	 */
79 79
 	public function order() {
80
-		return $this->get( 'QSG_order' );
80
+		return $this->get('QSG_order');
81 81
 	}
82 82
 
83 83
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return boolean
91 91
 	 */
92 92
 	public function system_group() {
93
-		return $this->get( 'QSG_system' );
93
+		return $this->get('QSG_system');
94 94
 	}
95 95
 
96 96
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 * @return boolean
116 116
 	 */
117 117
 	public function deleted() {
118
-		return $this->get( 'QST_deleted' );
118
+		return $this->get('QST_deleted');
119 119
 	}
120 120
 
121 121
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	 * @return int|null
129 129
 	 */
130 130
 	public function parent() {
131
-		return $this->get( 'QSG_parent' );
131
+		return $this->get('QSG_parent');
132 132
 	}
133 133
 
134 134
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return string
142 142
 	 */
143 143
 	public function html_name() {
144
-		return $this->get( 'QSG_html_name' );
144
+		return $this->get('QSG_html_name');
145 145
 	}
146 146
 
147 147
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 	 * @return string
154 154
 	 */
155 155
 	public function html_id() {
156
-		return $this->get( 'QSG_html_id' );
156
+		return $this->get('QSG_html_id');
157 157
 	}
158 158
 
159 159
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	 * @return string
166 166
 	 */
167 167
 	public function html_class() {
168
-		return $this->get( 'QSG_html_class' );
168
+		return $this->get('QSG_html_class');
169 169
 	}
170 170
 
171 171
 
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 	 * @return string
178 178
 	 */
179 179
 	public function html_content() {
180
-		return $this->get( 'QSG_html_content' );
180
+		return $this->get('QSG_html_content');
181 181
 	}
182 182
 
183 183
 
@@ -188,8 +188,8 @@  discard block
 block discarded – undo
188 188
 	 */
189 189
 	public function questions_in_and_not_in_group() {
190 190
 		$questions_in_group = $this->questions();
191
-		$exclude_question_ids = ! empty( $questions_in_group ) ? array_keys( $questions_in_group ) : array();
192
-		$questions_not_in_group = $this->questions_not_in_group( $exclude_question_ids );
191
+		$exclude_question_ids = ! empty($questions_in_group) ? array_keys($questions_in_group) : array();
192
+		$questions_not_in_group = $this->questions_not_in_group($exclude_question_ids);
193 193
 		return $questions_in_group + $questions_not_in_group;
194 194
 	}
195 195
 
@@ -200,9 +200,9 @@  discard block
 block discarded – undo
200 200
 	 * @param array $query_params
201 201
 	 * @return EE_Question[]
202 202
 	 */
203
-	public function questions( $query_params = array() ) {
203
+	public function questions($query_params = array()) {
204 204
 		// $query_params = ! empty( $query_params ) ? $query_params : array( 'order_by' => array( 'Question_Group_Question.QGQ_order' => 'ASC' ) );
205
-		return $this->ID() ? $this->get_many_related( 'Question', $query_params ) : array();
205
+		return $this->ID() ? $this->get_many_related('Question', $query_params) : array();
206 206
 	}
207 207
 
208 208
 
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 	 * @param  mixed $question_IDS_in_group if empty array then all questions returned.  if FALSE then we first get questions in this group and exclude them from questions get all. IF empty array then we just return all questions.
213 213
 	 * @return EE_Question[]
214 214
 	 */
215
-	public function questions_not_in_group( $question_IDS_in_group = FALSE ) {
216
-		if ( $question_IDS_in_group === FALSE ) {
215
+	public function questions_not_in_group($question_IDS_in_group = FALSE) {
216
+		if ($question_IDS_in_group === FALSE) {
217 217
 			$questions = $this->questions();
218
-			$question_IDS_in_group = ! empty( $questions ) ? array_keys( $questions ) : array();
218
+			$question_IDS_in_group = ! empty($questions) ? array_keys($questions) : array();
219 219
 		}
220
-		$_where = ! empty( $question_IDS_in_group ) ? array( 'QST_ID' => array( 'not_in', $question_IDS_in_group ) ) : array();
220
+		$_where = ! empty($question_IDS_in_group) ? array('QST_ID' => array('not_in', $question_IDS_in_group)) : array();
221 221
 
222
-		return EEM_Question::instance()->get_all( array( $_where, 'order_by' => array( 'QST_ID' => 'ASC' ) ) );
222
+		return EEM_Question::instance()->get_all(array($_where, 'order_by' => array('QST_ID' => 'ASC')));
223 223
 	}
224 224
 
225 225
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 	 * @return EE_Event[]
230 230
 	 */
231 231
 	public function events() {
232
-		return $this->get_many_related( 'Event' );
232
+		return $this->get_many_related('Event');
233 233
 	}
234 234
 
235 235
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 * @param EE_Question || int $question object or ID
240 240
 	 * @return boolean if successful
241 241
 	 */
242
-	public function add_question( $questionObjectOrID ) {
243
-		return $this->_add_relation_to( $questionObjectOrID, 'Question' );
242
+	public function add_question($questionObjectOrID) {
243
+		return $this->_add_relation_to($questionObjectOrID, 'Question');
244 244
 	}
245 245
 
246 246
 
@@ -250,8 +250,8 @@  discard block
 block discarded – undo
250 250
 	 * @param EE_Question || int $question object or ID
251 251
 	 * @return boolean of success
252 252
 	 */
253
-	public function remove_question( $questionObjectOrID ) {
254
-		return $this->_remove_relation_to( $questionObjectOrID, 'Question' );
253
+	public function remove_question($questionObjectOrID) {
254
+		return $this->_remove_relation_to($questionObjectOrID, 'Question');
255 255
 	}
256 256
 
257 257
 
@@ -261,9 +261,9 @@  discard block
 block discarded – undo
261 261
 	 * @param $qst_order
262 262
 	 * @return int
263 263
 	 */
264
-	public function update_question_order( $questionObjectOrID, $qst_order ) {
265
-		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int)$questionObjectOrID;
266
-		return EEM_Question_Group_Question::instance()->update( array( 'QGQ_order' => $qst_order ), array( array( 'QST_ID' => $qst_ID, 'QSG_ID' => $this->ID() ) ) );
264
+	public function update_question_order($questionObjectOrID, $qst_order) {
265
+		$qst_ID = $questionObjectOrID instanceof EE_Question ? $questionObjectOrID->ID() : (int) $questionObjectOrID;
266
+		return EEM_Question_Group_Question::instance()->update(array('QGQ_order' => $qst_order), array(array('QST_ID' => $qst_ID, 'QSG_ID' => $this->ID())));
267 267
 	}
268 268
 
269 269
 
@@ -274,9 +274,9 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function has_questions_with_answers() {
276 276
 		$has_answers = FALSE;
277
-		$questions = $this->get_many_related( 'Question' );
278
-		foreach ( $questions as $question ) {
279
-			if ( $question->count_related( 'Answer' ) > 0 )
277
+		$questions = $this->get_many_related('Question');
278
+		foreach ($questions as $question) {
279
+			if ($question->count_related('Answer') > 0)
280 280
 				$has_answers = TRUE;
281 281
 		}
282 282
 		return $has_answers;
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function set_order_to_latest() {
295 295
 		$latest_order = $this->get_model()->get_latest_question_group_order();
296
-		$latest_order ++;
297
-		$this->set( 'QSG_order', $latest_order );
296
+		$latest_order++;
297
+		$this->set('QSG_order', $latest_order);
298 298
 	}
299 299
 
300 300
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_10_0.dms.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @author      Mike Nelson, Brent Christensen
11 11
  * @since       4.10.0
12 12
  */
13
-class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base{
13
+class EE_DMS_Core_4_10_0 extends EE_Data_Migration_Script_Base {
14 14
 
15 15
 	/**
16 16
 	 * return EE_DMS_Core_4_10_0
@@ -40,9 +40,9 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	public function can_migrate_from_version($version_array) {
42 42
 		$version_string = $version_array['Core'];
43
-		if ( $version_string <= '4.10.0' && $version_string >= '4.9.0' ) {
43
+		if ($version_string <= '4.10.0' && $version_string >= '4.9.0') {
44 44
 			return true;
45
-		} elseif ( ! $version_string ) {
45
+		} elseif ( ! $version_string) {
46 46
 			//no version string provided... this must be pre 4.3
47 47
 			return false;
48 48
 		} else {
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
 	 * @return bool
67 67
 	 */
68 68
 	public function schema_changes_before_migration() {
69
-		$now_in_mysql = current_time( 'mysql', true );
69
+		$now_in_mysql = current_time('mysql', true);
70 70
 
71
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
71
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
72 72
 
73 73
 		// esp_answer
74 74
 		$this->_table_has_not_changed_since_previous(
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 		return $script_4_7_defaults->schema_changes_after_migration();
676 676
 	}
677 677
 
678
-	public function migration_page_hooks(){
678
+	public function migration_page_hooks() {
679 679
 
680 680
 	}
681 681
 
@@ -689,19 +689,19 @@  discard block
 block discarded – undo
689 689
 		//CNT_ISO, CNT_ISO3, RGN_ID, CNT_name, CNT_cur_code, CNT_cur_single, CNT_cur_plural, CNT_cur_sign, CNT_cur_sign_b4, CNT_cur_dec_plc, CNT_tel_code, CNT_is_EU, CNT_active
690 690
 		//('AD', 'AND', 0, 'Andorra', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+376', 0, 0),
691 691
 		$newer_countries = array(
692
-			array( 'AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0 ),
693
-			array( 'BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
694
-			array( 'CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0 ),
695
-			array( 'GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0 ),
696
-			array( 'IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2,  '+44', 0, 0  ),
697
-			array( 'JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0 ),
698
-			array( 'MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0 ),
699
-			array( 'MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1,  2, '+382', 0, 0 ),
700
-			array( 'RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0 ),
701
-			array( 'SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0 ),
702
-			array( 'SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0 ),
703
-			array( 'XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0 ),
704
-			array( 'YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0 ),
692
+			array('AX', 'ALA', 0, 'Alan Islands', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+358', 1, 0),
693
+			array('BL', 'BLM', 0, 'Saint Barthelemy', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
694
+			array('CW', 'CUW', 0, 'Curacao', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+599', 1, 0),
695
+			array('GG', 'GGY', 0, 'Guernsey', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+44', 0, 0),
696
+			array('IM', 'IMN', 0, 'Isle of Man', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
697
+			array('JE', 'JEY', 0, 'Jersey', 'GBP', 'Pound', 'Pounds', '£', 1, 2, '+44', 0, 0),
698
+			array('MF', 'MAF', 0, 'Saint Martin', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+590', 1, 0),
699
+			array('MN', 'MNE', 0, 'Montenegro', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+382', 0, 0),
700
+			array('RS', 'SRB', 0, 'Serbia', 'RSD', 'Dinar', 'Dinars', '', 0, 2, '+941', 1, 0),
701
+			array('SS', 'SSD', 0, 'South Sudan', 'SSP', 'Pound', 'Pounds', '£', 1, 2, '+211', 0, 0),
702
+			array('SX', 'SXM', 0, 'Sint Maarten', 'ANG', 'Guilder', 'Guilders', 'ƒ', 1, 2, '+1', 1, 0),
703
+			array('XK', 'XKX', 0, 'Kosovo', 'EUR', 'Euro', 'Euros', '€', 1, 2, '+381', 0, 0),
704
+			array('YT', 'MYT', 0, 'Mayotte', 'EUR', 'Euro', 'Euros', '€', 0, 2, '+262', 1, 0),
705 705
 		);
706 706
 		global $wpdb;
707 707
 		$country_table = $wpdb->prefix."esp_country";
@@ -720,14 +720,14 @@  discard block
 block discarded – undo
720 720
 							"CNT_is_EU" => '%d',
721 721
 							"CNT_active" => '%d',
722 722
 						);
723
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $country_table . "'") == $country_table ) {
724
-			foreach( $newer_countries as $country ) {
725
-				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1" ;
723
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$country_table."'") == $country_table) {
724
+			foreach ($newer_countries as $country) {
725
+				$SQL = "SELECT COUNT('CNT_ISO') FROM {$country_table} WHERE CNT_ISO='{$country[0]}' LIMIT 1";
726 726
 				$countries = $wpdb->get_var($SQL);
727
-				if ( ! $countries ) {
727
+				if ( ! $countries) {
728 728
 
729
-					$wpdb->insert( $country_table,
730
-							array_combine( array_keys( $country_format), $country ),
729
+					$wpdb->insert($country_table,
730
+							array_combine(array_keys($country_format), $country),
731 731
 							$country_format
732 732
 							);
733 733
 				}
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 		// CUR_code, CUR_single, CUR_plural, CUR_sign, CUR_dec_plc, CUR_active
746 746
 		//( 'EUR',  'Euro',  'Euros',  '€',  2,1),
747 747
 		$newer_currencies = array(
748
-			array( 'RSD', 'Dinar', 'Dinars', '', 3, 1 ),
748
+			array('RSD', 'Dinar', 'Dinars', '', 3, 1),
749 749
 		);
750 750
 		global $wpdb;
751 751
 		$currency_table = $wpdb->prefix."esp_currency";
@@ -757,14 +757,14 @@  discard block
 block discarded – undo
757 757
 							"CUR_dec_plc" => '%d',
758 758
 							"CUR_active" => '%d',
759 759
 						);
760
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '" . $currency_table . "'") == $currency_table ) {
761
-			foreach( $newer_currencies as $currency ) {
762
-				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1" ;
760
+		if ($wpdb->get_var("SHOW TABLES LIKE '".$currency_table."'") == $currency_table) {
761
+			foreach ($newer_currencies as $currency) {
762
+				$SQL = "SELECT COUNT('CUR_code') FROM {$currency_table} WHERE CUR_code='{$currency[0]}' LIMIT 1";
763 763
 				$countries = $wpdb->get_var($SQL);
764
-				if ( ! $countries ) {
764
+				if ( ! $countries) {
765 765
 
766
-					$wpdb->insert( $currency_table,
767
-							array_combine( array_keys( $currency_format), $currency ),
766
+					$wpdb->insert($currency_table,
767
+							array_combine(array_keys($currency_format), $currency),
768 768
 							$currency_format
769 769
 							);
770 770
 				}
@@ -776,9 +776,9 @@  discard block
 block discarded – undo
776 776
 	 * which should just be a temporary issue for folks who installed 4.8.0-4.8.5;
777 777
 	 * we should be able to stop doing this in 4.9
778 778
 	 */
779
-	public function fix_non_default_taxes(){
779
+	public function fix_non_default_taxes() {
780 780
 		global $wpdb;
781
-		$query = $wpdb->prepare( "UPDATE
781
+		$query = $wpdb->prepare("UPDATE
782 782
 				{$wpdb->prefix}esp_price p INNER JOIN
783 783
 				{$wpdb->prefix}esp_price_type pt ON p.PRT_ID = pt.PRT_ID
784 784
 			SET
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 			WHERE
787 787
 				p.PRC_is_default = 0 AND
788 788
 				pt.PBT_ID = %d
789
-					", EEM_Price_Type::base_type_tax );
790
-		$wpdb->query( $query );
789
+					", EEM_Price_Type::base_type_tax);
790
+		$wpdb->query($query);
791 791
 	}
792 792
 }
793 793
 
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_2_0.dms.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * -adds QGQ_order to the question-group_question table;
6 6
  * -adds DTT_name and DTT_description to the datetime table;
7 7
  */
8
-class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base{
8
+class EE_DMS_Core_4_2_0 extends EE_Data_Migration_Script_Base {
9 9
 
10 10
 
11 11
 
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 
30 30
 	public function can_migrate_from_version($version_array) {
31 31
 		$version_string = $version_array['Core'];
32
-		if ( version_compare( $version_string, '4.2.0', '<=' ) && version_compare( $version_string, '4.1.0', '>=' ) ) {
32
+		if (version_compare($version_string, '4.2.0', '<=') && version_compare($version_string, '4.1.0', '>=')) {
33 33
 //			echo "$version_string can be migrated fro";
34 34
 			return true;
35
-		}elseif( ! $version_string ){
35
+		}elseif ( ! $version_string) {
36 36
 //			echo "no version string provided: $version_string";
37 37
 			//no version string provided... this must be pre 4.1
38 38
 			//because since 4.1 we're
39
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
40
-		}else{
39
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
40
+		} else {
41 41
 //			echo "$version_string doesnt apply";
42 42
 			return false;
43 43
 		}
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 	public function schema_changes_before_migration() {
49 49
 		//relies on 4.1's EEH_Activation::create_table
50
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
51
-		$table_name='esp_answer';
52
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
50
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
51
+		$table_name = 'esp_answer';
52
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
53 53
 					REG_ID INT UNSIGNED NOT NULL,
54 54
 					QST_ID INT UNSIGNED NOT NULL,
55 55
 					ANS_value TEXT NOT NULL,
56 56
 					PRIMARY KEY  (ANS_ID)";
57
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
57
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
58 58
 
59 59
 		$table_name = 'esp_attendee_meta';
60 60
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
95 95
 					  CNT_active TINYINT(1) DEFAULT '0',
96 96
 					  PRIMARY KEY  (CNT_ISO)";
97
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
97
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
98 98
 
99 99
 
100 100
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 
119 119
 
120
-		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB' );
120
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
121 121
 		$table_name = 'esp_event_meta';
122 122
 		$sql = "
123 123
 			EVTM_ID INT NOT NULL AUTO_INCREMENT,
@@ -134,41 +134,41 @@  discard block
 block discarded – undo
134 134
 			EVT_external_URL VARCHAR(200) NULL,
135 135
 			EVT_donations TINYINT(1) NULL,
136 136
 			PRIMARY KEY  (EVTM_ID)";
137
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
137
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
138 138
 
139 139
 
140 140
 
141
-		$table_name='esp_event_question_group';
142
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
141
+		$table_name = 'esp_event_question_group';
142
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
143 143
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
144 144
 					QSG_ID INT UNSIGNED NOT NULL,
145 145
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
146 146
 					PRIMARY KEY  (EQG_ID)";
147
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
147
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
148 148
 
149 149
 
150 150
 
151
-		$table_name='esp_event_venue';
152
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
151
+		$table_name = 'esp_event_venue';
152
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
153 153
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
154 154
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
155 155
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
156 156
 				PRIMARY KEY  (EVV_ID)";
157
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
157
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
158 158
 
159 159
 
160 160
 
161
-		$table_name='esp_extra_meta';
162
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
161
+		$table_name = 'esp_extra_meta';
162
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
163 163
 				OBJ_ID INT(11) DEFAULT NULL,
164 164
 				EXM_type VARCHAR(45) DEFAULT NULL,
165 165
 				EXM_key VARCHAR(45) DEFAULT NULL,
166 166
 				EXM_value TEXT,
167 167
 				PRIMARY KEY  (EXM_ID)";
168
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
168
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
169 169
 
170
-		$table_name='esp_line_item';
171
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
170
+		$table_name = 'esp_line_item';
171
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
172 172
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
173 173
 				TXN_ID INT(11) DEFAULT NULL,
174 174
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -184,7 +184,7 @@  discard block
 block discarded – undo
184 184
 				OBJ_ID INT(11) DEFAULT NULL,
185 185
 				OBJ_type VARCHAR(45)DEFAULT NULL,
186 186
 				PRIMARY KEY  (LIN_ID)";
187
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB' );
187
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
188 188
 
189 189
 		$table_name = 'esp_message_template';
190 190
 		$sql = "MTP_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 					PRIMARY KEY  (GRP_ID),
212 212
 					KEY EVT_ID (EVT_ID),
213 213
 					KEY MTP_user_id (MTP_user_id)";
214
-		$this->_table_should_exist_previously( $table_name, $sql, 'ENGINE=InnoDB');
214
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
215 215
 
216 216
 
217 217
 
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
 
320 320
 
321 321
 
322
-		$table_name='esp_question';
323
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
322
+		$table_name = 'esp_question';
323
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
324 324
 					QST_display_text TEXT NOT NULL,
325 325
 					QST_admin_label VARCHAR(255) NOT NULL,
326 326
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -332,12 +332,12 @@  discard block
 block discarded – undo
332 332
 					QST_wp_user BIGINT UNSIGNED NULL,
333 333
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
334 334
 					PRIMARY KEY  (QST_ID)';
335
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
335
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
336 336
 
337
-		EEH_Activation::drop_index( 'esp_question_group', 'QSG_identifier_UNIQUE' );
337
+		EEH_Activation::drop_index('esp_question_group', 'QSG_identifier_UNIQUE');
338 338
 
339 339
 		$table_name = 'esp_question_group';
340
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
340
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
341 341
 					QSG_name VARCHAR(255) NOT NULL,
342 342
 					QSG_identifier VARCHAR(100) NOT NULL,
343 343
 					QSG_desc TEXT NULL,
@@ -348,28 +348,28 @@  discard block
 block discarded – undo
348 348
 					QSG_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
349 349
 					PRIMARY KEY  (QSG_ID),
350 350
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier ASC)';
351
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
351
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
352 352
 
353 353
 
354 354
 
355
-		$table_name='esp_question_group_question';
356
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
355
+		$table_name = 'esp_question_group_question';
356
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
357 357
 					QSG_ID INT UNSIGNED NOT NULL,
358 358
 					QST_ID INT UNSIGNED NOT NULL,
359 359
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
360 360
 					PRIMARY KEY  (QGQ_ID) ";
361
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
361
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
362 362
 
363 363
 
364 364
 
365
-		$table_name='esp_question_option';
366
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
365
+		$table_name = 'esp_question_option';
366
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
367 367
 					QSO_value VARCHAR(255) NOT NULL,
368 368
 					QSO_desc TEXT NOT NULL,
369 369
 					QST_ID INT UNSIGNED NOT NULL,
370 370
 					QSO_deleted TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
371 371
 					PRIMARY KEY  (QSO_ID)";
372
-		$this->_table_should_exist_previously($table_name,$sql, 'ENGINE=InnoDB');
372
+		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
373 373
 
374 374
 
375 375
 
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 
403 403
 
404 404
 
405
-		$table_name='esp_checkin';
406
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
405
+		$table_name = 'esp_checkin';
406
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
407 407
 					REG_ID INT(10) UNSIGNED NOT NULL,
408 408
 					DTT_ID INT(10) UNSIGNED NOT NULL,
409 409
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 		$this->_table_should_exist_previously($table_name, $sql, 'ENGINE=InnoDB');
478 478
 
479 479
 
480
-		$script_with_defaults = EE_Registry::instance()->load_dms( 'Core_4_1_0' );
480
+		$script_with_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
481 481
 		//setting up the DEFAULT stats and countries is also essential for the data migrations to run
482 482
 		//(because many need to convert old string states to foreign keys into the states table)
483 483
 		$script_with_defaults->insert_default_states();
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 		return true;
500 500
 	}
501 501
 
502
-	public function migration_page_hooks(){
502
+	public function migration_page_hooks() {
503 503
 
504 504
 	}
505 505
 }
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_Data_Migration_Script_Base.core.php 1 patch
Spacing   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -124,8 +124,8 @@  discard block
 block discarded – undo
124 124
 			'FHEE__'.get_class($this).'__construct__migration_stages',
125 125
 			$this->_migration_stages
126 126
 		);
127
-		foreach($this->_migration_stages as $migration_stage){
128
-			if ( $migration_stage instanceof EE_Data_Migration_Script_Stage ) {
127
+		foreach ($this->_migration_stages as $migration_stage) {
128
+			if ($migration_stage instanceof EE_Data_Migration_Script_Stage) {
129 129
 				$migration_stage->_construct_finalize($this);
130 130
 			}
131 131
 		}
@@ -142,16 +142,16 @@  discard block
 block discarded – undo
142 142
 	 */
143 143
 	protected function _load_script_stages() {
144 144
 		static $script_stages_loaded = array();
145
-		$stage = str_replace( 'EE_DMS_Core_', '', get_class( $this ) );
146
-		if ( isset( $script_stages_loaded[ $stage ] ) ) {
145
+		$stage = str_replace('EE_DMS_Core_', '', get_class($this));
146
+		if (isset($script_stages_loaded[$stage])) {
147 147
 			return;
148 148
 		}
149
-		$stages = glob( EE_CORE . "data_migration_scripts/{$stage}_stages/*.dmsstage.php" );
149
+		$stages = glob(EE_CORE."data_migration_scripts/{$stage}_stages/*.dmsstage.php");
150 150
 		$class_to_filepath = array();
151
-		foreach ( $stages as $filepath ) {
151
+		foreach ($stages as $filepath) {
152 152
 			$matches = array();
153
-			if ( preg_match( "~{$stage}_stages/(.*).dmsstage.php~", $filepath, $matches ) ) {
154
-				$class_to_filepath[ $matches[1] ] = $filepath;
153
+			if (preg_match("~{$stage}_stages/(.*).dmsstage.php~", $filepath, $matches)) {
154
+				$class_to_filepath[$matches[1]] = $filepath;
155 155
 			}
156 156
 		}
157 157
 		//give addons a chance to autoload their stages too
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
 			"FHEE__EE_DMS_{$stage}__autoloaded_stages",
160 160
 			$class_to_filepath
161 161
 		);
162
-		EEH_Autoloader::register_autoloader( $class_to_filepath );
163
-		$script_stages_loaded[ $stage ] = true;
162
+		EEH_Autoloader::register_autoloader($class_to_filepath);
163
+		$script_stages_loaded[$stage] = true;
164 164
 
165 165
 	}
166 166
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 	 * Place to add hooks and filters for tweaking the migrations page, in order
169 169
 	 * to customize it
170 170
 	 */
171
-	public function migration_page_hooks(){
171
+	public function migration_page_hooks() {
172 172
 		//by default none are added because we normally like the default look of the migration page
173 173
 	}
174 174
 
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 * @param int|string $new_pk eg posts.ID
184 184
 	 * @return void
185 185
 	 */
186
-	public function set_mapping($old_table,$old_pk,$new_table,$new_pk){
186
+	public function set_mapping($old_table, $old_pk, $new_table, $new_pk) {
187 187
 		//make sure it has the needed keys
188
-		if( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])){
188
+		if ( ! isset($this->_mappings[$old_table]) || ! isset($this->_mappings[$old_table][$new_table])) {
189 189
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
190 190
 		}
191 191
 		$this->_mappings[$old_table][$new_table][$old_pk] = $new_pk;
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 	 * @param string $new_table with wpdb prefix (wp_). Eg: wp_posts
202 202
 	 * @return mixed the primary key on the new table
203 203
 	 */
204
-	public function get_mapping_new_pk($old_table,$old_pk,$new_table){
205
-		if( ! isset($this->_mappings[$old_table]) ||
206
-			! isset($this->_mappings[$old_table][$new_table])){
204
+	public function get_mapping_new_pk($old_table, $old_pk, $new_table) {
205
+		if ( ! isset($this->_mappings[$old_table]) ||
206
+			! isset($this->_mappings[$old_table][$new_table])) {
207 207
 			//try fetching the option
208 208
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
209 209
 		}
@@ -220,15 +220,15 @@  discard block
 block discarded – undo
220 220
 	 * @param mixed $new_pk
221 221
 	 * @return mixed
222 222
 	 */
223
-	public function get_mapping_old_pk($old_table,$new_table,$new_pk){
224
-		if( ! isset($this->_mappings[$old_table]) ||
225
-			! isset($this->_mappings[$old_table][$new_table])){
223
+	public function get_mapping_old_pk($old_table, $new_table, $new_pk) {
224
+		if ( ! isset($this->_mappings[$old_table]) ||
225
+			! isset($this->_mappings[$old_table][$new_table])) {
226 226
 			//try fetching the option
227 227
 			$this->_mappings[$old_table][$new_table] = $this->_get_mapping_option($old_table, $new_table);
228 228
 		}
229
-		if(isset($this->_mappings[$old_table][$new_table])){
229
+		if (isset($this->_mappings[$old_table][$new_table])) {
230 230
 			$new_pk_to_old_pk = array_flip($this->_mappings[$old_table][$new_table]);
231
-			if(isset($new_pk_to_old_pk[$new_pk])){
231
+			if (isset($new_pk_to_old_pk[$new_pk])) {
232 232
 				return $new_pk_to_old_pk[$new_pk];
233 233
 			}
234 234
 		}
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 	 * @param string $new_table_name
244 244
 	 * @return array
245 245
 	 */
246
-	protected function _get_mapping_option($old_table_name,$new_table_name){
247
-		$option =  get_option($this->_get_mapping_option_name($old_table_name, $new_table_name),array());
246
+	protected function _get_mapping_option($old_table_name, $new_table_name) {
247
+		$option = get_option($this->_get_mapping_option_name($old_table_name, $new_table_name), array());
248 248
 		return $option;
249 249
 	}
250 250
 
@@ -257,9 +257,9 @@  discard block
 block discarded – undo
257 257
 	 * @param array $mapping_array
258 258
 	 * @return boolean success of updating option
259 259
 	 */
260
-	protected function _set_mapping_option($old_table_name,$new_table_name,$mapping_array){
260
+	protected function _set_mapping_option($old_table_name, $new_table_name, $mapping_array) {
261 261
 //		echo "set mapping for $old_table_name $new_table_name".count($mapping_array)."<br>";
262
-		$success =  update_option($this->_get_mapping_option_name($old_table_name, $new_table_name),$mapping_array);
262
+		$success = update_option($this->_get_mapping_option_name($old_table_name, $new_table_name), $mapping_array);
263 263
 		return $success;
264 264
 	}
265 265
 
@@ -271,12 +271,12 @@  discard block
 block discarded – undo
271 271
 	 * @param string $new_table_name
272 272
 	 * @return string
273 273
 	 */
274
-	protected function _get_mapping_option_name($old_table_name,$new_table_name){
274
+	protected function _get_mapping_option_name($old_table_name, $new_table_name) {
275 275
 		global $wpdb;
276
-		$old_table_name_sans_wp = str_replace($wpdb->prefix,"",$old_table_name);
277
-		$new_table_name_sans_wp = str_replace($wpdb->prefix,"",$new_table_name);
276
+		$old_table_name_sans_wp = str_replace($wpdb->prefix, "", $old_table_name);
277
+		$new_table_name_sans_wp = str_replace($wpdb->prefix, "", $new_table_name);
278 278
 		$migrates_to = EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
279
-		return substr( EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix . $migrates_to [ 'slug' ] . '_' . $migrates_to[ 'version' ] . '_' . $old_table_name_sans_wp . '_' . $new_table_name_sans_wp, 0, 64 );
279
+		return substr(EE_Data_Migration_Manager::data_migration_script_mapping_option_prefix.$migrates_to ['slug'].'_'.$migrates_to['version'].'_'.$old_table_name_sans_wp.'_'.$new_table_name_sans_wp, 0, 64);
280 280
 	}
281 281
 
282 282
 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 * 99% until the function "migration_step" returns EE_Data_Migration_Script_Base::status_complete.
294 294
 	 * @return int
295 295
 	 */
296
-	protected function _count_records_to_migrate(){
296
+	protected function _count_records_to_migrate() {
297 297
 		$count = 0;
298
-		foreach($this->stages() as $stage){
299
-			$count+= $stage->count_records_to_migrate();
298
+		foreach ($this->stages() as $stage) {
299
+			$count += $stage->count_records_to_migrate();
300 300
 		}
301 301
 		return $count;
302 302
 	}
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
 	 * by just setting a transient and updating it after each migration_step
309 309
 	 * @return int
310 310
 	 */
311
-	public function count_records_migrated(){
311
+	public function count_records_migrated() {
312 312
 		$count = 0;
313
-		foreach($this->stages() as $stage){
314
-			$count+= $stage->count_records_migrated();
313
+		foreach ($this->stages() as $stage) {
314
+			$count += $stage->count_records_migrated();
315 315
 		}
316 316
 		$this->_records_migrated = $count;
317 317
 		return $count;
@@ -325,24 +325,24 @@  discard block
 block discarded – undo
325 325
 	 * @throws EE_Error
326 326
 	 * @throws Exception
327 327
 	 */
328
-	public function migration_step($num_records_to_migrate_limit){
328
+	public function migration_step($num_records_to_migrate_limit) {
329 329
 		//reset the feedback message
330 330
 		$this->_feedback_message = '';
331 331
 		//if we haven't yet done the 1st schema changes, do them now. buffer any output
332 332
 		$this->_maybe_do_schema_changes(true);
333 333
 
334
-		$num_records_actually_migrated =0;
334
+		$num_records_actually_migrated = 0;
335 335
 		$records_migrated_per_stage = array();
336 336
 		//setup the 'stage' variable, which should hold the last run stage of the migration  (or none at all if nothing runs)
337 337
 		$stage = null;
338 338
 		//get the next stage that isn't complete
339
-		foreach($this->stages() as $stage){
340
-			if( $stage->get_status() == EE_Data_Migration_Manager::status_continue){
341
-				try{
339
+		foreach ($this->stages() as $stage) {
340
+			if ($stage->get_status() == EE_Data_Migration_Manager::status_continue) {
341
+				try {
342 342
 					$records_migrated_during_stage = $stage->migration_step($num_records_to_migrate_limit - $num_records_actually_migrated);
343 343
 					$num_records_actually_migrated += $records_migrated_during_stage;
344 344
 					$records_migrated_per_stage[$stage->pretty_name()] = $records_migrated_during_stage;
345
-				}catch(Exception $e){
345
+				} catch (Exception $e) {
346 346
 					//yes if we catch an exception here, we consider that migration stage borked.
347 347
 					$stage->set_status(EE_Data_Migration_Manager::status_fatal_error);
348 348
 					$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 					throw $e;
351 351
 				}
352 352
 				//check that the migration stage didn't mark itself as having a fatal error
353
-				if($stage->is_broken()){
353
+				if ($stage->is_broken()) {
354 354
 					$this->set_broken();
355 355
 					throw new EE_Error($stage->get_last_error());
356 356
 				}
@@ -358,24 +358,24 @@  discard block
 block discarded – undo
358 358
 			//once we've migrated all the number we intended to (possibly from different stages), stop migrating
359 359
 			//or if we had a fatal error
360 360
 			//or if the current script stopped early- its not done, but it's done all it thinks we should do on this step
361
-			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()){
361
+			if ($num_records_actually_migrated >= $num_records_to_migrate_limit || $stage->is_broken() || $stage->has_more_to_do()) {
362 362
 				break;
363 363
 			}
364 364
 		}
365 365
 		//check if we're all done this data migration...
366 366
 		//which is indicated by being done early AND the last stage claims to be done
367
-		if($stage == NULL){
367
+		if ($stage == NULL) {
368 368
 			//this migration script apparently has NO stages... which is super weird, but whatever
369 369
 			$this->set_completed();
370 370
 			$this->_maybe_do_schema_changes(false);
371
-		}else if( $num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()){
371
+		} else if ($num_records_actually_migrated < $num_records_to_migrate_limit && ! $stage->has_more_to_do()) {
372 372
 			//apparently we're done, because we couldn't migrate the number we intended to
373 373
 			$this->set_completed();
374 374
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
375 375
 			//do schema changes for after the migration now
376 376
 			//first double-check we haven't already done this
377 377
 			$this->_maybe_do_schema_changes(false);
378
-		}else{
378
+		} else {
379 379
 			//update feedback message, keeping in mind that we show them with the most recent at the top
380 380
 			$this->_update_feedback_message(array_reverse($records_migrated_per_stage));
381 381
 		}
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 	 * @param array $records_migrated_per_stage KEYS are pretty names for each stage; values are the count of records migrated from that stage
390 390
 	 * @return void
391 391
 	 */
392
-	private function _update_feedback_message($records_migrated_per_stage){
392
+	private function _update_feedback_message($records_migrated_per_stage) {
393 393
 		$feedback_message_array = array();
394
-		foreach($records_migrated_per_stage as $migration_stage_name => $num_records_migrated){
395
-			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"),$num_records_migrated,$migration_stage_name) ;
394
+		foreach ($records_migrated_per_stage as $migration_stage_name => $num_records_migrated) {
395
+			$feedback_message_array[] = sprintf(__("Migrated %d records successfully during %s", "event_espresso"), $num_records_migrated, $migration_stage_name);
396 396
 		}
397
-		$this->_feedback_message .= implode("<br>",$feedback_message_array);
397
+		$this->_feedback_message .= implode("<br>", $feedback_message_array);
398 398
 	}
399 399
 
400 400
 
@@ -406,27 +406,27 @@  discard block
 block discarded – undo
406 406
 	 * @throws Exception
407 407
 	 * @return void
408 408
 	 */
409
-	private function _maybe_do_schema_changes($before = true){
409
+	private function _maybe_do_schema_changes($before = true) {
410 410
 		//so this property will be either _schema_changes_after_migration_ran or _schema_changes_before_migration_ran
411
-		$property_name = '_schema_changes_'. ($before ? 'before' : 'after').'_migration_ran';
412
-		if ( ! $this->{$property_name} ){
413
-			try{
411
+		$property_name = '_schema_changes_'.($before ? 'before' : 'after').'_migration_ran';
412
+		if ( ! $this->{$property_name} ) {
413
+			try {
414 414
 				ob_start();
415
-				if($before){
415
+				if ($before) {
416 416
 					$this->schema_changes_before_migration();
417
-				}else{
417
+				} else {
418 418
 					$this->schema_changes_after_migration();
419 419
 				}
420 420
 				$output = ob_get_contents();
421 421
 				ob_end_clean();
422
-			}catch(Exception $e){
422
+			} catch (Exception $e) {
423 423
 				$this->set_status(EE_Data_Migration_Manager::status_fatal_error);
424 424
 				throw $e;
425 425
 			}
426 426
 			//record that we've done these schema changes
427 427
 			$this->{$property_name} = true;
428 428
 			//if there were any warnings etc, record them as non-fatal errors
429
-			if( $output ){
429
+			if ($output) {
430 430
 				//there were some warnings
431 431
 				$this->_errors[] = $output;
432 432
 			}
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
 	 * @param string $table_definition_sql
454 454
 	 * @param string $engine_string
455 455
 	 */
456
-	protected function _table_is_new_in_this_version($table_name,$table_definition_sql,$engine_string='ENGINE=InnoDB '){
456
+	protected function _table_is_new_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=InnoDB ') {
457 457
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_new_in_this_version_' . $table_name );
458
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  true ) );
458
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(true));
459 459
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_new_in_this_version_' . $table_name  );
460 460
 	}
461 461
 
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 * @param string $table_definition_sql
470 470
 	 * @param string $engine_string
471 471
 	 */
472
-	protected function _table_is_changed_in_this_version($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
472
+	protected function _table_is_changed_in_this_version($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
473 473
 //		EEH_Debug_Tools::instance()->start_timer( '_table_is_changed_in_this_version' . $table_name );
474
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
474
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
475 475
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_is_changed_in_this_version' . $table_name  );
476 476
 	}
477 477
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 	 * @param string $table_name
483 483
 	 * @return boolean
484 484
 	 */
485
-	protected function _old_table_exists( $table_name ) {
486
-		return EEH_Activation::table_exists( $table_name );
485
+	protected function _old_table_exists($table_name) {
486
+		return EEH_Activation::table_exists($table_name);
487 487
 	}
488 488
 
489 489
 
@@ -493,8 +493,8 @@  discard block
 block discarded – undo
493 493
 	 * @param string $table_name
494 494
 	 * @return boolean
495 495
 	 */
496
-	protected function _delete_table_if_empty( $table_name ) {
497
-		return EEH_Activation::delete_db_table_if_empty( $table_name );
496
+	protected function _delete_table_if_empty($table_name) {
497
+		return EEH_Activation::delete_db_table_if_empty($table_name);
498 498
 	}
499 499
 
500 500
 
@@ -513,9 +513,9 @@  discard block
 block discarded – undo
513 513
 	 * @param string $table_definition_sql
514 514
 	 * @param string $engine_string
515 515
 	 */
516
-	protected function _table_should_exist_previously($table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
516
+	protected function _table_should_exist_previously($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
517 517
 //		EEH_Debug_Tools::instance()->start_timer( '_table_should_exist_previously' . $table_name );
518
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
518
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
519 519
 //		EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
520 520
 	}
521 521
 
@@ -530,13 +530,13 @@  discard block
 block discarded – undo
530 530
 	 * @param string $table_definition_sql
531 531
 	 * @param string $engine_string
532 532
 	 */
533
-	protected function _table_has_not_changed_since_previous( $table_name,$table_definition_sql,$engine_string = 'ENGINE=MyISAM'){
534
-		if( $this->_currently_migrating() ) {
533
+	protected function _table_has_not_changed_since_previous($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM') {
534
+		if ($this->_currently_migrating()) {
535 535
 			//if we're doing a migration, and this table apparently already exists, then we don't need do anything right?
536 536
 //			EEH_Debug_Tools::instance()->stop_timer( '_table_should_exist_previously' . $table_name );
537 537
 			return;
538 538
 		}
539
-		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(  false ) );
539
+		$this->_create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string, $this->_pre_existing_table_should_be_dropped(false));
540 540
 	}
541 541
 
542 542
 	/**
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 	protected function _currently_migrating() {
547 547
 		//we want to know if we are currently performing a migration. We could just believe what was set on the _migrating property, but let's double-check (ie the script should apply and we should be in MM)
548 548
 		return $this->_migrating &&
549
-					$this->can_migrate_from_version( EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set() ) &&
549
+					$this->can_migrate_from_version(EE_Data_Migration_Manager::instance()->ensure_current_database_state_is_set()) &&
550 550
 					EE_Maintenance_Mode::instance()->real_level() == EE_Maintenance_Mode::level_2_complete_maintenance;
551 551
 	}
552 552
 
@@ -557,17 +557,17 @@  discard block
 block discarded – undo
557 557
 	 * @param boolean $table_is_new
558 558
 	 * @return boolean
559 559
 	 */
560
-	protected function _pre_existing_table_should_be_dropped( $table_is_new ) {
561
-		if( $table_is_new ) {
562
-			if( $this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation  || $this->_currently_migrating() ){
560
+	protected function _pre_existing_table_should_be_dropped($table_is_new) {
561
+		if ($table_is_new) {
562
+			if ($this->_get_req_type_for_plugin_corresponding_to_this_dms() == EE_System::req_type_new_activation || $this->_currently_migrating()) {
563 563
 				return true;
564
-			}else{
564
+			} else {
565 565
 				return false;
566 566
 			}
567
-		}else{
568
-			if(in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(),array(EE_System::req_type_new_activation))){
567
+		} else {
568
+			if (in_array($this->_get_req_type_for_plugin_corresponding_to_this_dms(), array(EE_System::req_type_new_activation))) {
569 569
 				return true;
570
-			}else{
570
+			} else {
571 571
 				return false;
572 572
 			}
573 573
 		}
@@ -580,12 +580,12 @@  discard block
 block discarded – undo
580 580
 	 * @param string $engine_string
581 581
 	 * @param boolean $drop_pre_existing_tables
582 582
 	 */
583
-	private function _create_table_and_catch_errors( $table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE ){
584
-		try{
585
-			EEH_Activation::create_table($table_name,$table_definition_sql, $engine_string, $drop_pre_existing_tables);
586
-		}catch( EE_Error $e ) {
587
-			$message = $e->getMessage() . '<br>Stack Trace:' . $e->getTraceAsString();
588
-			$this->add_error( $message  );
583
+	private function _create_table_and_catch_errors($table_name, $table_definition_sql, $engine_string = 'ENGINE=MyISAM', $drop_pre_existing_tables = FALSE) {
584
+		try {
585
+			EEH_Activation::create_table($table_name, $table_definition_sql, $engine_string, $drop_pre_existing_tables);
586
+		} catch (EE_Error $e) {
587
+			$message = $e->getMessage().'<br>Stack Trace:'.$e->getTraceAsString();
588
+			$this->add_error($message);
589 589
 			$this->_feedback_message .= $message;
590 590
 		}
591 591
 	}
@@ -597,15 +597,15 @@  discard block
 block discarded – undo
597 597
 	 * @return int one of EE_System::_req_type_* constants
598 598
 	 * @throws EE_Error
599 599
 	 */
600
-	private function _get_req_type_for_plugin_corresponding_to_this_dms(){
601
-		if($this->slug() == 'Core'){
600
+	private function _get_req_type_for_plugin_corresponding_to_this_dms() {
601
+		if ($this->slug() == 'Core') {
602 602
 			return EE_System::instance()->detect_req_type();
603
-		}else{//it must be for an addon
603
+		} else {//it must be for an addon
604 604
 			$addon_name = $this->slug();
605
-			if( EE_Registry::instance()->get_addon_by_name($addon_name)){
605
+			if (EE_Registry::instance()->get_addon_by_name($addon_name)) {
606 606
 				return EE_Registry::instance()->get_addon_by_name($addon_name)->detect_req_type();
607
-			}else{
608
-				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"),$this->slug(),$addon_name,implode(",",array_keys( EE_Registry::instance()->get_addons_by_name() ) ) ) ) ;
607
+			} else {
608
+				throw new EE_Error(sprintf(__("The DMS slug '%s' should correspond to the addon's name, which should also be '%s', but no such addon was registered. These are the registered addons' names: %s", "event_espresso"), $this->slug(), $addon_name, implode(",", array_keys(EE_Registry::instance()->get_addons_by_name()))));
609 609
 			}
610 610
 		}
611 611
 	}
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 	 * returns an array of strings describing errors by all the script's stages
617 617
 	 * @return array
618 618
 	 */
619
-	public function get_errors(){
619
+	public function get_errors() {
620 620
 		$all_errors = $this->_errors;
621
-		if( ! is_array($all_errors)){
621
+		if ( ! is_array($all_errors)) {
622 622
 			$all_errors = array();
623 623
 		}
624
-		foreach($this->stages() as $stage){
625
-			$all_errors = array_merge($stage->get_errors(),$all_errors);
624
+		foreach ($this->stages() as $stage) {
625
+			$all_errors = array_merge($stage->get_errors(), $all_errors);
626 626
 		}
627 627
 		return $all_errors;
628 628
 	}
@@ -633,8 +633,8 @@  discard block
 block discarded – undo
633 633
 	 * Indicates whether or not this migration script should continue
634 634
 	 * @return boolean
635 635
 	 */
636
-	public function can_continue(){
637
-		return in_array($this->get_status(),  EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
636
+	public function can_continue() {
637
+		return in_array($this->get_status(), EE_Data_Migration_Manager::instance()->stati_that_indicate_to_continue_single_migration_script);
638 638
 	}
639 639
 
640 640
 
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 	 * get ordered by the indexes
647 647
 	 * @return EE_Data_Migration_Script_Stage[]
648 648
 	 */
649
-	protected function stages(){
650
-		$stages = apply_filters( 'FHEE__'.get_class($this).'__stages',$this->_migration_stages );
649
+	protected function stages() {
650
+		$stages = apply_filters('FHEE__'.get_class($this).'__stages', $this->_migration_stages);
651 651
 		ksort($stages);
652 652
 		return $stages;
653 653
 	}
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * can be displayed to the user
660 660
 	 * @return string
661 661
 	 */
662
-	public function get_feedback_message(){
662
+	public function get_feedback_message() {
663 663
 		return $this->_feedback_message;
664 664
 	}
665 665
 
@@ -671,16 +671,16 @@  discard block
 block discarded – undo
671 671
 	 * possible that this class is defined when it goes to sleep, but NOT available when it
672 672
 	 * awakes (eg, this class is part of an addon that is deactivated at some point).
673 673
 	 */
674
-	public function properties_as_array(){
674
+	public function properties_as_array() {
675 675
 		$properties = parent::properties_as_array();
676 676
 		$properties['_migration_stages'] = array();
677
-		foreach($this->_migration_stages as $migration_stage_priority => $migration_stage_class){
677
+		foreach ($this->_migration_stages as $migration_stage_priority => $migration_stage_class) {
678 678
 			$properties['_migration_stages'][$migration_stage_priority] = $migration_stage_class->properties_as_array();
679 679
 		}
680 680
 		unset($properties['_mappings']);
681 681
 
682
-		foreach($this->_mappings as $old_table_name => $mapping_to_new_table){
683
-			foreach($mapping_to_new_table as $new_table_name => $mapping){
682
+		foreach ($this->_mappings as $old_table_name => $mapping_to_new_table) {
683
+			foreach ($mapping_to_new_table as $new_table_name => $mapping) {
684 684
 				$this->_set_mapping_option($old_table_name, $new_table_name, $mapping);
685 685
 			}
686 686
 		}
@@ -695,19 +695,19 @@  discard block
 block discarded – undo
695 695
 	 * @param array $array_of_properties like what's produced from properties_as_array() method
696 696
 	 * @return void
697 697
 	 */
698
-	public function instantiate_from_array_of_properties($array_of_properties){
698
+	public function instantiate_from_array_of_properties($array_of_properties) {
699 699
 		$stages_properties_arrays = $array_of_properties['_migration_stages'];
700 700
 		unset($array_of_properties['_migration_stages']);
701 701
 		unset($array_of_properties['class']);
702
-		foreach($array_of_properties as $property_name => $property_value){
702
+		foreach ($array_of_properties as $property_name => $property_value) {
703 703
 			$this->{$property_name} = $property_value;
704 704
 		}
705 705
 		//_migration_stages are already instantiated, but have only default data
706
-		foreach($this->_migration_stages as $stage){
707
-			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage),$stages_properties_arrays);
706
+		foreach ($this->_migration_stages as $stage) {
707
+			$stage_data = $this->_find_migration_stage_data_with_classname(get_class($stage), $stages_properties_arrays);
708 708
 			//SO, if we found the stage data that was saved, use it. Otherwise, I guess the stage is new? (maybe added by
709 709
 			//an addon? Unlikely... not sure why it wouldn't exist, but if it doesn't just treat it like it was never started yet)
710
-			if($stage_data){
710
+			if ($stage_data) {
711 711
 				$stage->instantiate_from_array_of_properties($stage_data);
712 712
 			}
713 713
 		}
@@ -723,9 +723,9 @@  discard block
 block discarded – undo
723 723
 	 * @param array $migration_stage_data_arrays
724 724
 	 * @return null
725 725
 	 */
726
-	private function _find_migration_stage_data_with_classname($classname,$migration_stage_data_arrays){
727
-		foreach($migration_stage_data_arrays as $migration_stage_data_array){
728
-			if(isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname){
726
+	private function _find_migration_stage_data_with_classname($classname, $migration_stage_data_arrays) {
727
+		foreach ($migration_stage_data_arrays as $migration_stage_data_array) {
728
+			if (isset($migration_stage_data_array['class']) && $migration_stage_data_array['class'] == $classname) {
729 729
 				return $migration_stage_data_array;
730 730
 			}
731 731
 		}
@@ -741,8 +741,8 @@  discard block
 block discarded – undo
741 741
 	 * @return array where the first key is the plugin's slug, the 2nd is the version of that plugin
742 742
 	 * that will be updated to. Eg array('Core','4.1.0')
743 743
 	 */
744
-	public final function migrates_to_version(){
745
-		return EE_Data_Migration_Manager::instance()->script_migrates_to_version( get_class( $this ) );
744
+	public final function migrates_to_version() {
745
+		return EE_Data_Migration_Manager::instance()->script_migrates_to_version(get_class($this));
746 746
 	}
747 747
 
748 748
 
@@ -754,10 +754,10 @@  discard block
 block discarded – undo
754 754
 	 * Or 'Core' for core (non-addon).
755 755
 	 * @return string
756 756
 	 */
757
-	public function slug(){
757
+	public function slug() {
758 758
 		$migrates_to_version_info = $this->migrates_to_version();
759 759
 		//the slug is the first part of the array
760
-		return $migrates_to_version_info[ 'slug' ];
760
+		return $migrates_to_version_info['slug'];
761 761
 	}
762 762
 
763 763
 
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	 * the database up so it can run), then you can set "A" to priority 3 or something.
772 772
 	 * @return int
773 773
 	 */
774
-	public function priority(){
774
+	public function priority() {
775 775
 		return $this->_priority;
776 776
 	}
777 777
 
@@ -784,18 +784,18 @@  discard block
 block discarded – undo
784 784
 	 * @param boolean $migrating
785 785
 	 * @return void
786 786
 	 */
787
-	public function set_migrating( $migrating = TRUE ){
787
+	public function set_migrating($migrating = TRUE) {
788 788
 		$this->_migrating = $migrating;
789 789
 	}
790 790
 
791 791
 	/**
792 792
 	 * Marks that we think this migration class can continue to migrate
793 793
 	 */
794
-	public function reattempt(){
794
+	public function reattempt() {
795 795
 		parent::reattempt();
796 796
 		//also, we want to reattempt any stages that were marked as borked
797
-		foreach( $this->stages() as $stage ) {
798
-			if( $stage->is_broken() ) {
797
+		foreach ($this->stages() as $stage) {
798
+			if ($stage->is_broken()) {
799 799
 				$stage->reattempt();
800 800
 			}
801 801
 		}
Please login to merge, or discard this patch.
core/data_migration_scripts/EE_DMS_Core_4_7_0.dms.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  * @author 		Mike Nelson, Brent Christensen
14 14
  * @since       4.7.0
15 15
  */
16
-class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base{
16
+class EE_DMS_Core_4_7_0 extends EE_Data_Migration_Script_Base {
17 17
 
18 18
 	/**
19 19
 	 * return EE_DMS_Core_4_7_0
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	public function can_migrate_from_version($version_array) {
41 41
 		$version_string = $version_array['Core'];
42 42
 		if (
43
-			( $version_string <= '4.7.0' && $version_string >= '4.6.0' )
43
+			($version_string <= '4.7.0' && $version_string >= '4.6.0')
44 44
 			||
45
-			( $version_string >= '4.7.0' &&
46
-					! EEH_Activation::table_exists( 'esp_registration_payment' ) &&
47
-					EEH_Activation::table_exists( 'esp_registration' ) ) ) {
45
+			($version_string >= '4.7.0' &&
46
+					! EEH_Activation::table_exists('esp_registration_payment') &&
47
+					EEH_Activation::table_exists('esp_registration')) ) {
48 48
 			return true;
49
-		} elseif ( ! $version_string ) {
49
+		} elseif ( ! $version_string) {
50 50
 			//no version string provided... this must be pre 4.3
51
-			return false;//changed mind. dont want people thinking they should migrate yet because they cant
51
+			return false; //changed mind. dont want people thinking they should migrate yet because they cant
52 52
 		} else {
53 53
 			return false;
54 54
 		}
@@ -70,16 +70,16 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function schema_changes_before_migration() {
72 72
 		//relies on 4.1's EEH_Activation::create_table
73
-		require_once( EE_HELPERS . 'EEH_Activation.helper.php' );
74
-		$table_name='esp_answer';
75
-		$sql=" ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
73
+		require_once(EE_HELPERS.'EEH_Activation.helper.php');
74
+		$table_name = 'esp_answer';
75
+		$sql = " ANS_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
76 76
 					REG_ID INT UNSIGNED NOT NULL,
77 77
 					QST_ID INT UNSIGNED NOT NULL,
78 78
 					ANS_value TEXT NOT NULL,
79 79
 					PRIMARY KEY  (ANS_ID),
80 80
 					KEY REG_ID (REG_ID),
81 81
 					KEY QST_ID (QST_ID)";
82
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
82
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
83 83
 
84 84
 		$table_name = 'esp_attendee_meta';
85 85
 		$sql = "ATTM_ID INT(10) UNSIGNED NOT	NULL AUTO_INCREMENT,
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 					  CNT_is_EU TINYINT(1) DEFAULT '0',
120 120
 					  CNT_active TINYINT(1) DEFAULT '0',
121 121
 					  PRIMARY KEY  (CNT_ISO)";
122
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
122
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
123 123
 
124 124
 		$table_name = 'esp_currency';
125 125
 		$sql = "CUR_code VARCHAR(6) COLLATE utf8_bin NOT NULL,
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 				CUR_dec_plc VARCHAR(1) COLLATE utf8_bin NOT NULL DEFAULT '2',
130 130
 				CUR_active TINYINT(1) DEFAULT '0',
131 131
 				PRIMARY KEY  (CUR_code)";
132
-		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB' );
132
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
133 133
 
134 134
 
135 135
 		$table_name = 'esp_currency_payment_method';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 						KEY EVT_ID (EVT_ID),
160 160
 						KEY DTT_is_primary (DTT_is_primary)";
161 161
 
162
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
162
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
163 163
 
164 164
 		$table_name = 'esp_event_meta';
165 165
 		$sql = "
@@ -178,44 +178,44 @@  discard block
 block discarded – undo
178 178
 			EVT_donations TINYINT(1) NULL,
179 179
 			PRIMARY KEY  (EVTM_ID),
180 180
 			KEY EVT_ID (EVT_ID)";
181
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
181
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
182 182
 
183 183
 
184 184
 
185
-		$table_name='esp_event_question_group';
186
-		$sql="EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
185
+		$table_name = 'esp_event_question_group';
186
+		$sql = "EQG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
187 187
 					EVT_ID BIGINT(20) UNSIGNED NOT NULL,
188 188
 					QSG_ID INT UNSIGNED NOT NULL,
189 189
 					EQG_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
190 190
 					PRIMARY KEY  (EQG_ID),
191 191
 					KEY EVT_ID (EVT_ID),
192 192
 					KEY QSG_ID (QSG_ID)";
193
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
193
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
194 194
 
195 195
 
196 196
 
197
-		$table_name='esp_event_venue';
198
-		$sql="EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
197
+		$table_name = 'esp_event_venue';
198
+		$sql = "EVV_ID INT(11) NOT NULL AUTO_INCREMENT,
199 199
 				EVT_ID BIGINT(20) UNSIGNED NOT NULL,
200 200
 				VNU_ID BIGINT(20) UNSIGNED NOT NULL,
201 201
 				EVV_primary TINYINT(1) UNSIGNED NOT NULL DEFAULT 0,
202 202
 				PRIMARY KEY  (EVV_ID)";
203
-		$this->_table_has_not_changed_since_previous($table_name,$sql, 'ENGINE=InnoDB');
203
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
204 204
 
205 205
 
206 206
 
207
-		$table_name='esp_extra_meta';
208
-		$sql="EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
207
+		$table_name = 'esp_extra_meta';
208
+		$sql = "EXM_ID INT(11) NOT NULL AUTO_INCREMENT,
209 209
 				OBJ_ID INT(11) DEFAULT NULL,
210 210
 				EXM_type VARCHAR(45) DEFAULT NULL,
211 211
 				EXM_key VARCHAR(45) DEFAULT NULL,
212 212
 				EXM_value TEXT,
213 213
 				PRIMARY KEY  (EXM_ID),
214 214
 				KEY EXM_type (EXM_type, OBJ_ID, EXM_key(45))";
215
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
215
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
216 216
 
217
-		$table_name='esp_line_item';
218
-		$sql="LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
217
+		$table_name = 'esp_line_item';
218
+		$sql = "LIN_ID INT(11) NOT NULL AUTO_INCREMENT,
219 219
 				LIN_code VARCHAR(245) NOT NULL DEFAULT '',
220 220
 				TXN_ID INT(11) DEFAULT NULL,
221 221
 				LIN_name VARCHAR(245) NOT NULL DEFAULT '',
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 				PRIMARY KEY  (LIN_ID),
234 234
 				KEY LIN_code (LIN_code(191)),
235 235
 				KEY TXN_ID (TXN_ID)";
236
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB' );
236
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
237 237
 
238 238
 		$table_name = 'esp_log';
239 239
 		$sql = "LOG_ID INT(11) NOT NULL AUTO_INCREMENT,
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 					MTP_is_active TINYINT(1) NOT NULL DEFAULT '1',
274 274
 					PRIMARY KEY  (GRP_ID),
275 275
 					KEY MTP_user_id (MTP_user_id)";
276
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
276
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
277 277
 
278 278
 		$table_name = 'esp_event_message_template';
279 279
 		$sql = "EMT_ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 					PRIMARY KEY  (EMT_ID),
283 283
 					KEY EVT_ID (EVT_ID),
284 284
 					KEY GRP_ID (GRP_ID)";
285
-		$this->_table_has_not_changed_since_previous( $table_name, $sql, 'ENGINE=InnoDB');
285
+		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
286 286
 
287 287
 
288 288
 		$table_name = 'esp_payment';
@@ -355,8 +355,8 @@  discard block
 block discarded – undo
355 355
 					  PRIMARY KEY  (TTM_ID)";
356 356
 		$this->_table_has_not_changed_since_previous($table_name, $sql, 'ENGINE=InnoDB');
357 357
 
358
-		$table_name='esp_question';
359
-		$sql='QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
358
+		$table_name = 'esp_question';
359
+		$sql = 'QST_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
360 360
 					QST_display_text TEXT NOT NULL,
361 361
 					QST_admin_label VARCHAR(255) NOT NULL,
362 362
 					QST_system VARCHAR(25) DEFAULT NULL,
@@ -369,22 +369,22 @@  discard block
 block discarded – undo
369 369
 					QST_deleted TINYINT UNSIGNED NOT NULL DEFAULT 0,
370 370
 					PRIMARY KEY  (QST_ID),
371 371
 					KEY QST_order (QST_order)';
372
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
372
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
373 373
 
374
-		$table_name='esp_question_group_question';
375
-		$sql="QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
374
+		$table_name = 'esp_question_group_question';
375
+		$sql = "QGQ_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
376 376
 					QSG_ID INT UNSIGNED NOT NULL,
377 377
 					QST_ID INT UNSIGNED NOT NULL,
378 378
 					QGQ_order INT UNSIGNED NOT NULL DEFAULT 0,
379 379
 					PRIMARY KEY  (QGQ_ID),
380 380
 					KEY QST_ID (QST_ID),
381 381
 					KEY QSG_ID_order (QSG_ID, QGQ_order)";
382
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
382
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
383 383
 
384 384
 
385 385
 
386
-		$table_name='esp_question_option';
387
-		$sql="QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
386
+		$table_name = 'esp_question_option';
387
+		$sql = "QSO_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
388 388
 					QSO_value VARCHAR(255) NOT NULL,
389 389
 					QSO_desc TEXT NOT NULL,
390 390
 					QST_ID INT UNSIGNED NOT NULL,
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 					PRIMARY KEY  (QSO_ID),
394 394
 					KEY QST_ID (QST_ID),
395 395
 					KEY QSO_order (QSO_order)";
396
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
396
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
397 397
 
398 398
 
399 399
 
@@ -439,8 +439,8 @@  discard block
 block discarded – undo
439 439
 
440 440
 
441 441
 
442
-		$table_name='esp_checkin';
443
-		$sql="CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
442
+		$table_name = 'esp_checkin';
443
+		$sql = "CHK_ID INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
444 444
 					REG_ID INT(10) UNSIGNED NOT NULL,
445 445
 					DTT_ID INT(10) UNSIGNED NOT NULL,
446 446
 					CHK_in TINYINT(1) UNSIGNED NOT NULL DEFAULT 1,
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 					  PRC_parent INT(10) UNSIGNED DEFAULT 0,
536 536
 					  PRIMARY KEY  (PRC_ID),
537 537
 					  KEY PRT_ID (PRT_ID)";
538
-		$this->_table_is_changed_in_this_version($table_name,$sql, 'ENGINE=InnoDB');
538
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
539 539
 
540 540
 		$table_name = "esp_price_type";
541 541
 		$sql = "PRT_ID TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
@@ -573,10 +573,10 @@  discard block
 block discarded – undo
573 573
 					  TKT_deleted TINYINT(1) NOT NULL DEFAULT '0',
574 574
 					  PRIMARY KEY  (TKT_ID),
575 575
 					  KEY TKT_start_date (TKT_start_date)";
576
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
576
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
577 577
 
578 578
 		$table_name = 'esp_question_group';
579
-		$sql='QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
579
+		$sql = 'QSG_ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
580 580
 					QSG_name VARCHAR(255) NOT NULL,
581 581
 					QSG_identifier VARCHAR(100) NOT NULL,
582 582
 					QSG_desc TEXT NULL,
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 					PRIMARY KEY  (QSG_ID),
590 590
 					UNIQUE KEY QSG_identifier_UNIQUE (QSG_identifier),
591 591
 					KEY QSG_order (QSG_order)';
592
-		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB' );
592
+		$this->_table_is_changed_in_this_version($table_name, $sql, 'ENGINE=InnoDB');
593 593
 
594 594
 		/** @var EE_DMS_Core_4_1_0 $script_4_1_defaults */
595 595
 		$script_4_1_defaults = EE_Registry::instance()->load_dms('Core_4_1_0');
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		return true;
622 622
 	}
623 623
 
624
-	public function migration_page_hooks(){
624
+	public function migration_page_hooks() {
625 625
 
626 626
 	}
627 627
 }
Please login to merge, or discard this patch.