Completed
Branch FET-7011-toggle-country-state-... (279eb2)
by
unknown
125:35 queued 109:59
created
registration_form/templates/questions_main_meta_box.template.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 //does question have any answers? cause if it does then we have to disable type
16 16
 $has_answers = $question->has_answers();
17 17
 
18
-if ( $QST_system === 'country' ) {
18
+if ($QST_system === 'country') {
19 19
 	echo EEH_HTML::div(
20
-		EEH_HTML::h4( '<span class="dashicons dashicons-info"></span>' . esc_html__( 'Did you know...', 'event_espresso' ) ) .
20
+		EEH_HTML::h4('<span class="dashicons dashicons-info"></span>'.esc_html__('Did you know...', 'event_espresso')).
21 21
 		EEH_HTML::p(
22 22
 			esc_html__(
23 23
 				'If you add a State/Province Select input immediately after this Country Select input when building your registration form, then the State/Province Select input options will change to correspond with the choice made in this input. So for example, choosing "United States" in this Country Select input will populate the State/Province Select input with just the state options for the United States.',
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		<tbody>
35 35
 			<tr>
36 36
 				<th>
37
-					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info');?>
37
+					<label for="QST_display_text"><?php echo $fields['QST_display_text']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_text_info'); ?>
38 38
 				</th>
39 39
 				<td>
40 40
 					<input type="text" class="regular-text" id="QST_display_text" name="QST_display_text" value="<?php $question->f('QST_display_text')?>"/>
@@ -44,23 +44,23 @@  discard block
 block discarded – undo
44 44
 
45 45
 			<tr>
46 46
 				<th>
47
-					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info');?>
47
+					<label for="QST_admin_label"><?php echo $fields['QST_admin_label']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_label_info'); ?>
48 48
 				</th>
49 49
 				<td>
50 50
 					<?php
51
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
52
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
51
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
52
+						$id = ! empty($QST_system) ? '_disabled' : '';
53 53
 					?>
54 54
 					<input type="text" class="regular-text" id="QST_admin_label<?php echo $id?>" name="QST_admin_label<?php echo $id?>" value="<?php $question->f('QST_admin_label')?>"<?php echo $disabled?>/>
55 55
 					<input class="QST_order" type="hidden" id="QST_order<?php echo $id; ?>" name = "QST_order<?php echo $id; ?>" value="<?php echo $question->get('QST_order'); ?>" />
56
-					<?php if ( ! empty( $QST_system )) { ?>
56
+					<?php if ( ! empty($QST_system)) { ?>
57 57
 						<input type="hidden"  id="QST_admin_label" name="QST_admin_label" value="<?php echo $question->admin_label()?>"/>
58 58
 					<?php } ?>
59 59
 					<br/>
60 60
 					<p class="description">
61
-					<?php if ( ! empty( $QST_system )) { ?>
61
+					<?php if ( ! empty($QST_system)) { ?>
62 62
 					<span class="description" style="color:#D54E21;">
63
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
63
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
64 64
 					</span>
65 65
 					<?php } ?>
66 66
 
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 
71 71
 			<tr>
72 72
 				<th>
73
-					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info');?>
73
+					<label for="QST_admin_only"><?php echo $fields['QST_admin_only']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_admin_only_info'); ?>
74 74
 				</th>
75 75
 				<td>
76 76
 					<?php
77
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
78
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
77
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
78
+						$id = ! empty($QST_system) ? '_disabled' : '';
79 79
 						$admin_only = $question->get('QST_admin_only');
80
-						$checked = !empty( $admin_only ) ? ' checked="checked"' : '';
80
+						$checked = ! empty($admin_only) ? ' checked="checked"' : '';
81 81
 					?>
82 82
 					<input class="QST_admin_only" type="checkbox" id="QST_admin_only<?php echo $id; ?>" name = "QST_admin_only<?php echo $id; ?>" value="1"<?php echo $disabled; echo $checked; ?>/>
83 83
 					<br/>
84 84
 					<p class="description">
85
-					<?php if ( ! empty( $QST_system )) { ?>
85
+					<?php if ( ! empty($QST_system)) { ?>
86 86
 					<span class="description" style="color:#D54E21;">
87
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
87
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
88 88
 					</span>
89 89
 					<?php } ?>
90 90
 
@@ -94,21 +94,21 @@  discard block
 block discarded – undo
94 94
 
95 95
 			<tr>
96 96
 				<th>
97
-					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info');?>
97
+					<label for="QST_type"><?php echo $fields['QST_type']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('question_type_info'); ?>
98 98
 				</th>
99 99
 				<td>
100 100
 					<?php
101
-						$disabled = ! empty( $QST_system ) ? ' disabled="disabled"' : '';
102
-						$id =  ! empty( $QST_system ) ? '_disabled' : '';
103
-						echo EEH_Form_Fields::select_input( 'QST_type' . $id, $question_types, $question->type(), 'id="QST_type' . $id . '"' . $disabled );
104
-						if( ! empty( $QST_system ) ) { ?>
101
+						$disabled = ! empty($QST_system) ? ' disabled="disabled"' : '';
102
+						$id = ! empty($QST_system) ? '_disabled' : '';
103
+						echo EEH_Form_Fields::select_input('QST_type'.$id, $question_types, $question->type(), 'id="QST_type'.$id.'"'.$disabled);
104
+						if ( ! empty($QST_system)) { ?>
105 105
 							<input type="hidden"  id="QST_type" name="QST_type" value="<?php echo $question->type()?>"/>
106 106
 						<?php
107
-							$explanatory_text = esc_html__('System question! This field cannot be changed.','event_espresso');
108
-						}else{
109
-							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.','event_espresso');
107
+							$explanatory_text = esc_html__('System question! This field cannot be changed.', 'event_espresso');
108
+						} else {
109
+							$explanatory_text = esc_html__('Because there are currently answers for this question in the database, your options to change the question type have been limited to similar question-types.', 'event_espresso');
110 110
 						}
111
-						if ( ! empty( $QST_system ) || $has_answers ) { ?>
111
+						if ( ! empty($QST_system) || $has_answers) { ?>
112 112
 							<p><span class="description" style="color:#D54E21;">
113 113
 								<?php echo $explanatory_text; ?>
114 114
 							</span></p>
@@ -121,22 +121,22 @@  discard block
 block discarded – undo
121 121
 			<tr id="text_input_question_options">
122 122
 				<th>
123 123
 					<label>
124
-						<?php esc_html_e( 'Maximum Allowed Response Size', 'event_espresso' );?>
124
+						<?php esc_html_e('Maximum Allowed Response Size', 'event_espresso'); ?>
125 125
 					</label>
126 126
 				</th>
127 127
 				<td>
128
-					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'";?> value="<?php $question->f( 'QST_max' );?>" min="1">
128
+					<input id="QST_max" name="QST_max" type="number" <?php echo $max_max === EE_INF ? '' : "max='$max_max'"; ?> value="<?php $question->f('QST_max'); ?>" min="1">
129 129
 					<p>
130 130
 						<span class="description">
131
-							<?php esc_html_e( 'Maximum number of characters allowed when answering this question', 'event_espresso' );?>
131
+							<?php esc_html_e('Maximum number of characters allowed when answering this question', 'event_espresso'); ?>
132 132
 						</span>
133 133
 					</p>
134
-					<?php if ( $QST_system ) { ?>
134
+					<?php if ($QST_system) { ?>
135 135
 					<p>
136 136
 						<span class="description" style="color:#D54E21;">
137 137
 							<?php printf(
138
-									esc_html__( 'System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso' ),
139
-									$max_max );?>
138
+									esc_html__('System question! The maximum number of characters that can be used for this question is %1$s', 'event_espresso'),
139
+									$max_max ); ?>
140 140
 						</span>
141 141
 					</p>
142 142
 					<?php } ?>
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			<tr id="question_options">
146 146
 				<th>
147 147
 					<label>
148
-						<?php esc_html_e('Answer Options','event_espresso')?>
148
+						<?php esc_html_e('Answer Options', 'event_espresso')?>
149 149
 					</label>
150 150
 				</th>
151 151
 				<td>
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 						<thead>
155 155
 							<tr>
156 156
 								<th class="option-value-header">
157
-									<?php esc_html_e('Value','event_espresso')?>
157
+									<?php esc_html_e('Value', 'event_espresso')?>
158 158
 								</th>
159 159
 								<th class="option-desc-header">
160
-									<?php esc_html_e('Description (optional, only shown on registration form)','event_espresso')?>
160
+									<?php esc_html_e('Description (optional, only shown on registration form)', 'event_espresso')?>
161 161
 								</th>
162 162
 								<th>
163 163
 								</th>
@@ -180,17 +180,17 @@  discard block
 block discarded – undo
180 180
 							</tr>
181 181
 
182 182
 							<?php
183
-							$count=0;
183
+							$count = 0;
184 184
 							$question_options = $question->options();
185
-							if ( ! empty( $question_options )) {
186
-								foreach( $question_options as $option_id => $option ) {
187
-									$disabled =  $has_answers || $option->get('QSO_system') ? ' disabled="disabled"'  : '';
185
+							if ( ! empty($question_options)) {
186
+								foreach ($question_options as $option_id => $option) {
187
+									$disabled = $has_answers || $option->get('QSO_system') ? ' disabled="disabled"' : '';
188 188
 							?>
189 189
 								<tr class="question-option ee-options-sortable">
190 190
 									<td class="option-value-cell">
191 191
 										<input type="hidden" class="QSO_order" name="question_options[<?php echo $count; ?>][QSO_order]" value="<?php echo $count; ?>">
192 192
 										<input type="text" class="option-value regular-text" name="question_options[<?php echo $count?>][QSO_value]" value="<?php  $option->f('QSO_value')?>"<?php echo $disabled; ?>>
193
-										<?php if ( $has_answers ) : ?>
193
+										<?php if ($has_answers) : ?>
194 194
 											<input type="hidden" name="question_options[<?php echo $count; ?>][QSO_value]" value="<?php echo $option->f('QSO_value'); ?>" >
195 195
 										<?php endif; ?>
196 196
 									</td>
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 										<input type="text" class="option-desc regular-text" name="question_options[<?php echo $count?>][QSO_desc]" value="<?php $option->f('QSO_desc')?>">
199 199
 									</td>
200 200
 									<td>
201
-										<?php if ( ! $option->system() ) { ?>
201
+										<?php if ( ! $option->system()) { ?>
202 202
 											<span class="dashicons clickable dashicons-post-trash ee-icon-size-18 remove-option remove-item"></span>
203 203
 										<?php } ?>
204 204
 										<span class="dashicons dashicons-image-flip-vertical sortable-drag-handle ee-icon-size-18"></span>
@@ -237,13 +237,13 @@  discard block
 block discarded – undo
237 237
 					</table>
238 238
 
239 239
 					<a id="new-question-option" class="button" style="margin:0 0 1em 3px;">
240
-						<?php esc_html_e('Add Another Answer Option','event_espresso')?>
240
+						<?php esc_html_e('Add Another Answer Option', 'event_espresso')?>
241 241
 					</a><br/>
242 242
 
243 243
 					<p class="description">
244
-						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.','event_espresso')?>
244
+						<?php esc_html_e('Answer Options are the choices that you give people to select from for RADIO_BTN, CHECKBOX or DROPDOWN questions. The Value is a simple key that will be saved to the database and the description is optional. Note that values CANNOT contain any HTML, but descriptions can.', 'event_espresso')?>
245 245
 					</p>
246
-					<?php if ( $has_answers ) : ?>
246
+					<?php if ($has_answers) : ?>
247 247
 					<p class="description" style="color:#D54E21;">
248 248
 							<?php esc_html_e('Answer values that are uneditable are this way because there are registrations in the database that have answers for this question.  If you need to correct a mistake, or edit an existing option value, then trash the existing one and create a new option with the changes.  This will ensure that the existing registrations that chose the original answer will preserve that answer.', 'event_espresso'); ?>
249 249
 					</p>
@@ -254,32 +254,32 @@  discard block
 block discarded – undo
254 254
 
255 255
 			<tr>
256 256
 				<th>
257
-					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename();?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info');?>
257
+					<label for="QST_required"><?php echo $fields['QST_required']->get_nicename(); ?></label> <?php echo EEH_Template::get_help_tab_link('required_question_info'); ?>
258 258
 				</th>
259 259
 				<td>
260 260
 					<?php
261
-					$system_required = array( 'fname', 'email' );
262
-					$disabled = in_array( $QST_system, $system_required ) ? ' disabled="disabled"' : '';
261
+					$system_required = array('fname', 'email');
262
+					$disabled = in_array($QST_system, $system_required) ? ' disabled="disabled"' : '';
263 263
 					$required_on = $question->get('QST_admin_only');
264 264
 					$show_required_msg = $required_on ? '' : ' display:none;';
265
-					$disabled = $required_on || ! empty( $disabled ) ? ' disabled="disabled"' : '';
266
-					$id =  ! empty( $disabled ) && in_array( $QST_system, $system_required) ? '_disabled' : '';
267
-					$requiredOptions=array(
268
-						array( 'text'=> esc_html__( 'Optional', 'event_espresso' ), 'id'=>0 ),
269
-						array( 'text'=> esc_html__( 'Required', 'event_espresso' ), 'id'=>1 )
265
+					$disabled = $required_on || ! empty($disabled) ? ' disabled="disabled"' : '';
266
+					$id = ! empty($disabled) && in_array($QST_system, $system_required) ? '_disabled' : '';
267
+					$requiredOptions = array(
268
+						array('text'=> esc_html__('Optional', 'event_espresso'), 'id'=>0),
269
+						array('text'=> esc_html__('Required', 'event_espresso'), 'id'=>1)
270 270
 					);
271
-					echo EEH_Form_Fields::select_input('QST_required' . $id, $requiredOptions, $question->required(), 'id="QST_required' . $id . '"' . $disabled );
271
+					echo EEH_Form_Fields::select_input('QST_required'.$id, $requiredOptions, $question->required(), 'id="QST_required'.$id.'"'.$disabled);
272 272
 					?>
273 273
 						<p><span id="required_toggled_on" class="description" style="color:#D54E21;<?php echo $show_required_msg; ?>">
274
-						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.','event_espresso')?>
274
+						<?php esc_html_e('Required is set to optional, and this field is disabled, because the question is Admin-Only.', 'event_espresso')?>
275 275
 						</span></p>
276 276
 						<p><span id="required_toggled_off" class="description" style="color:#D54E21; display: none;">
277
-							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only','event_espresso')?>
277
+							<?php esc_html_e('Required option field is no longer disabled because the question is not Admin-Only', 'event_espresso')?>
278 278
 						</span></p>
279
-					<?php if ( ! empty( $disabled ) && in_array( $QST_system, $system_required ) ) { ?>
279
+					<?php if ( ! empty($disabled) && in_array($QST_system, $system_required)) { ?>
280 280
 						<input type="hidden"  id="QST_required" name="QST_required" value="1"/>
281 281
 						<p><span class="description" style="color:#D54E21;">
282
-						<?php esc_html_e('System question! This field cannot be changed.','event_espresso')?>
282
+						<?php esc_html_e('System question! This field cannot be changed.', 'event_espresso')?>
283 283
 					</span></p>
284 284
 					<?php } ?>
285 285
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 			<tr>
290 290
 				<th>
291
-					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info');?>
291
+					<label for="QST_required_text"><?php esc_html_e('Required Text', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('required_text_info'); ?>
292 292
 				</th>
293 293
 				<td>
294 294
 					<input type="text" maxlength="100" class="regular-text" id="QST_required_text" name="QST_required_text" value="<?php  $question->f('QST_required_text')?>"/>
Please login to merge, or discard this patch.