@@ -29,21 +29,21 @@ discard block |
||
| 29 | 29 | $has_answers = $question->has_answers(); |
| 30 | 30 | |
| 31 | 31 | if ($QST_system === 'country') { |
| 32 | - // already escaped |
|
| 33 | - echo EEH_HTML::div( |
|
| 34 | - EEH_HTML::h4( |
|
| 35 | - '<span class="dashicons dashicons-info"></span>' |
|
| 36 | - . esc_html__('Did you know...', 'event_espresso') |
|
| 37 | - ) . |
|
| 38 | - EEH_HTML::p( |
|
| 39 | - esc_html__( |
|
| 40 | - '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.', |
|
| 41 | - 'event_espresso' |
|
| 42 | - ) |
|
| 43 | - ), |
|
| 44 | - '', |
|
| 45 | - 'ee-info-box' |
|
| 46 | - ); |
|
| 32 | + // already escaped |
|
| 33 | + echo EEH_HTML::div( |
|
| 34 | + EEH_HTML::h4( |
|
| 35 | + '<span class="dashicons dashicons-info"></span>' |
|
| 36 | + . esc_html__('Did you know...', 'event_espresso') |
|
| 37 | + ) . |
|
| 38 | + EEH_HTML::p( |
|
| 39 | + esc_html__( |
|
| 40 | + '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.', |
|
| 41 | + 'event_espresso' |
|
| 42 | + ) |
|
| 43 | + ), |
|
| 44 | + '', |
|
| 45 | + 'ee-info-box' |
|
| 46 | + ); |
|
| 47 | 47 | } |
| 48 | 48 | ?> |
| 49 | 49 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | </th> |
| 80 | 80 | <td> |
| 81 | 81 | <?php |
| 82 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 83 | - $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
| 84 | - ?> |
|
| 82 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 83 | + $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
| 84 | + ?> |
|
| 85 | 85 | <input class='regular-text' |
| 86 | 86 | id="QST_admin_label<?php echo esc_attr($id); ?>" |
| 87 | 87 | name="QST_admin_label<?php echo esc_attr($id); ?>" |
@@ -123,30 +123,30 @@ discard block |
||
| 123 | 123 | </th> |
| 124 | 124 | <td> |
| 125 | 125 | <?php |
| 126 | - $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 127 | - $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
| 128 | - $admin_only = $question->get('QST_admin_only'); |
|
| 129 | - $checked = ! empty($admin_only) ? ' checked' : ''; |
|
| 130 | - ?> |
|
| 126 | + $id = ! empty($QST_system) ? '_disabled' : ''; |
|
| 127 | + $disabled_attr = ! empty($QST_system) ? 'disabled' : ''; |
|
| 128 | + $admin_only = $question->get('QST_admin_only'); |
|
| 129 | + $checked = ! empty($admin_only) ? ' checked' : ''; |
|
| 130 | + ?> |
|
| 131 | 131 | <input class="QST_admin_only" |
| 132 | 132 | id="QST_admin_only<?php echo esc_attr($id); ?>" |
| 133 | 133 | name="QST_admin_only<?php echo esc_attr($id); ?>" |
| 134 | 134 | type="checkbox" |
| 135 | 135 | value="1" |
| 136 | 136 | <?php |
| 137 | - echo esc_attr($disabled_attr); |
|
| 138 | - echo esc_attr($checked); |
|
| 139 | - ?> |
|
| 137 | + echo esc_attr($disabled_attr); |
|
| 138 | + echo esc_attr($checked); |
|
| 139 | + ?> |
|
| 140 | 140 | /> |
| 141 | 141 | <br /> |
| 142 | 142 | <p class="description"> |
| 143 | 143 | <?php |
| 144 | - if (! empty($QST_system)) { ?> |
|
| 144 | + if (! empty($QST_system)) { ?> |
|
| 145 | 145 | <span class="description" style="color:#D54E21;"> |
| 146 | 146 | <?php esc_html_e( |
| 147 | - 'System question! This field cannot be changed.', |
|
| 148 | - 'event_espresso' |
|
| 149 | - ); ?> |
|
| 147 | + 'System question! This field cannot be changed.', |
|
| 148 | + 'event_espresso' |
|
| 149 | + ); ?> |
|
| 150 | 150 | </span> |
| 151 | 151 | <?php } ?> |
| 152 | 152 | </p> |
@@ -162,44 +162,44 @@ discard block |
||
| 162 | 162 | </th> |
| 163 | 163 | <td> |
| 164 | 164 | <?php |
| 165 | - $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 166 | - if ($disabled) { |
|
| 167 | - $disabled_attr = 'disabled="disabled"'; |
|
| 168 | - $id = '_disabled'; |
|
| 169 | - } else { |
|
| 170 | - $disabled_attr = ''; |
|
| 171 | - $id = ''; |
|
| 172 | - } |
|
| 165 | + $disabled = ! empty($QST_system) && $QST_system !== EEM_Attendee::system_question_phone; |
|
| 166 | + if ($disabled) { |
|
| 167 | + $disabled_attr = 'disabled="disabled"'; |
|
| 168 | + $id = '_disabled'; |
|
| 169 | + } else { |
|
| 170 | + $disabled_attr = ''; |
|
| 171 | + $id = ''; |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | - // Only display Confirm email for |
|
| 175 | - if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) { |
|
| 176 | - unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
| 177 | - } |
|
| 174 | + // Only display Confirm email for |
|
| 175 | + if (empty($QST_system) || $QST_system !== EEM_Attendee::system_question_email_confirm) { |
|
| 176 | + unset($question_types[ EEM_Question::QST_type_email_confirm ]); |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - echo EEH_Form_Fields::select_input( |
|
| 180 | - 'QST_type' . $id, |
|
| 181 | - $question_types, |
|
| 182 | - $question->type(), |
|
| 183 | - 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 184 | - ); // already escaped |
|
| 185 | - if ($disabled) { ?> |
|
| 179 | + echo EEH_Form_Fields::select_input( |
|
| 180 | + 'QST_type' . $id, |
|
| 181 | + $question_types, |
|
| 182 | + $question->type(), |
|
| 183 | + 'id="QST_type' . $id . '"' . $disabled_attr |
|
| 184 | + ); // already escaped |
|
| 185 | + if ($disabled) { ?> |
|
| 186 | 186 | <input id='QST_type' |
| 187 | 187 | name="QST_type" |
| 188 | 188 | type="hidden" |
| 189 | 189 | value="<?php echo esc_attr($question->type()); ?>" |
| 190 | 190 | /> |
| 191 | 191 | <?php |
| 192 | - $explanatory_text = esc_html__( |
|
| 193 | - 'System question! This field cannot be changed.', |
|
| 194 | - 'event_espresso' |
|
| 195 | - ); |
|
| 196 | - } else { |
|
| 197 | - $explanatory_text = esc_html__( |
|
| 198 | - '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.', |
|
| 199 | - 'event_espresso' |
|
| 200 | - ); |
|
| 201 | - } |
|
| 202 | - if ($disabled || $has_answers) { ?> |
|
| 192 | + $explanatory_text = esc_html__( |
|
| 193 | + 'System question! This field cannot be changed.', |
|
| 194 | + 'event_espresso' |
|
| 195 | + ); |
|
| 196 | + } else { |
|
| 197 | + $explanatory_text = esc_html__( |
|
| 198 | + '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.', |
|
| 199 | + 'event_espresso' |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | + if ($disabled || $has_answers) { ?> |
|
| 203 | 203 | <p> |
| 204 | 204 | <span class="description" style="color:#D54E21;"> |
| 205 | 205 | <?php echo esc_html($explanatory_text); ?> |
@@ -228,21 +228,21 @@ discard block |
||
| 228 | 228 | <p> |
| 229 | 229 | <span class="description"> |
| 230 | 230 | <?php esc_html_e( |
| 231 | - 'Maximum number of characters allowed when answering this question', |
|
| 232 | - 'event_espresso' |
|
| 233 | - ); ?> |
|
| 231 | + 'Maximum number of characters allowed when answering this question', |
|
| 232 | + 'event_espresso' |
|
| 233 | + ); ?> |
|
| 234 | 234 | </span> |
| 235 | 235 | </p> |
| 236 | 236 | <?php if ($QST_system) { ?> |
| 237 | 237 | <p> |
| 238 | 238 | <span class="description" style="color:#D54E21;"> |
| 239 | 239 | <?php printf( |
| 240 | - esc_html__( |
|
| 241 | - 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 242 | - 'event_espresso' |
|
| 243 | - ), |
|
| 244 | - $max_max |
|
| 245 | - ); ?> |
|
| 240 | + esc_html__( |
|
| 241 | + 'System question! The maximum number of characters that can be used for this question is %1$s', |
|
| 242 | + 'event_espresso' |
|
| 243 | + ), |
|
| 244 | + $max_max |
|
| 245 | + ); ?> |
|
| 246 | 246 | </span> |
| 247 | 247 | </p> |
| 248 | 248 | <?php } ?> |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | </th> |
| 265 | 265 | <th class="option-desc-header"> |
| 266 | 266 | <?php esc_html_e( |
| 267 | - 'Description (optional, only shown on registration form)', |
|
| 268 | - 'event_espresso' |
|
| 269 | - ) ?> |
|
| 267 | + 'Description (optional, only shown on registration form)', |
|
| 268 | + 'event_espresso' |
|
| 269 | + ) ?> |
|
| 270 | 270 | </th> |
| 271 | 271 | <th> |
| 272 | 272 | </th> |
@@ -301,14 +301,14 @@ discard block |
||
| 301 | 301 | </tr> |
| 302 | 302 | |
| 303 | 303 | <?php |
| 304 | - $count = 0; |
|
| 305 | - $question_options = $question->options(); |
|
| 306 | - if (! empty($question_options)) { |
|
| 307 | - foreach ($question_options as $option_id => $option) { |
|
| 308 | - $disabled_attr = $has_answers || $option->get('QSO_system') |
|
| 309 | - ? 'disabled' |
|
| 310 | - : ''; |
|
| 311 | - ?> |
|
| 304 | + $count = 0; |
|
| 305 | + $question_options = $question->options(); |
|
| 306 | + if (! empty($question_options)) { |
|
| 307 | + foreach ($question_options as $option_id => $option) { |
|
| 308 | + $disabled_attr = $has_answers || $option->get('QSO_system') |
|
| 309 | + ? 'disabled' |
|
| 310 | + : ''; |
|
| 311 | + ?> |
|
| 312 | 312 | <tr class="question-option ee-options-sortable"> |
| 313 | 313 | <td class="option-value-cell"> |
| 314 | 314 | <input type="hidden" |
@@ -345,21 +345,21 @@ discard block |
||
| 345 | 345 | </span> |
| 346 | 346 | </td> |
| 347 | 347 | <?php |
| 348 | - echo EEH_Form_Fields::hidden_input( |
|
| 349 | - "question_options[{$count}][QST_ID])", |
|
| 350 | - $option->question_ID() |
|
| 351 | - ); // already escaped |
|
| 352 | - echo EEH_Form_Fields::hidden_input( |
|
| 353 | - "question_options[{$count}][QSO_ID])", |
|
| 354 | - $option->ID() |
|
| 355 | - ); // already escaped |
|
| 356 | - $count++; |
|
| 357 | - ?> |
|
| 348 | + echo EEH_Form_Fields::hidden_input( |
|
| 349 | + "question_options[{$count}][QST_ID])", |
|
| 350 | + $option->question_ID() |
|
| 351 | + ); // already escaped |
|
| 352 | + echo EEH_Form_Fields::hidden_input( |
|
| 353 | + "question_options[{$count}][QSO_ID])", |
|
| 354 | + $option->ID() |
|
| 355 | + ); // already escaped |
|
| 356 | + $count++; |
|
| 357 | + ?> |
|
| 358 | 358 | </tr> |
| 359 | 359 | <?php |
| 360 | - } |
|
| 361 | - } else { |
|
| 362 | - ?> |
|
| 360 | + } |
|
| 361 | + } else { |
|
| 362 | + ?> |
|
| 363 | 363 | <tr class="question-option ee-options-sortable"> |
| 364 | 364 | <td class="option-value-cell"> |
| 365 | 365 | <input type="hidden" |
@@ -383,8 +383,8 @@ discard block |
||
| 383 | 383 | </td> |
| 384 | 384 | </tr> |
| 385 | 385 | <?php |
| 386 | - } |
|
| 387 | - ?> |
|
| 386 | + } |
|
| 387 | + ?> |
|
| 388 | 388 | <tr style="display:none"> |
| 389 | 389 | <td colspan="3"> |
| 390 | 390 | <?php echo EEH_Form_Fields::hidden_input("question_options_count", $count); // already escaped ?> |
@@ -403,16 +403,16 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | <p class="description"> |
| 405 | 405 | <?php esc_html_e( |
| 406 | - '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.', |
|
| 407 | - 'event_espresso' |
|
| 408 | - ) ?> |
|
| 406 | + '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.', |
|
| 407 | + 'event_espresso' |
|
| 408 | + ) ?> |
|
| 409 | 409 | </p> |
| 410 | 410 | <?php if ($has_answers) : ?> |
| 411 | 411 | <p class="description" style="color:#D54E21;"> |
| 412 | 412 | <?php esc_html_e( |
| 413 | - '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.', |
|
| 414 | - 'event_espresso' |
|
| 415 | - ); ?> |
|
| 413 | + '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.', |
|
| 414 | + 'event_espresso' |
|
| 415 | + ); ?> |
|
| 416 | 416 | </p> |
| 417 | 417 | |
| 418 | 418 | <?php endif; ?> |
@@ -428,40 +428,40 @@ discard block |
||
| 428 | 428 | </th> |
| 429 | 429 | <td> |
| 430 | 430 | <?php |
| 431 | - $system_required = ['fname', 'email']; |
|
| 432 | - $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 433 | - $required_on = $question->get('QST_admin_only'); |
|
| 434 | - $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 435 | - $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 436 | - $id = |
|
| 437 | - ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 438 | - $requiredOptions = [ |
|
| 439 | - ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0], |
|
| 440 | - ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1], |
|
| 441 | - ]; |
|
| 442 | - echo EEH_Form_Fields::select_input( |
|
| 443 | - 'QST_required' . $id, |
|
| 444 | - $requiredOptions, |
|
| 445 | - $question->required(), |
|
| 446 | - 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 447 | - ); // already escaped |
|
| 448 | - ?> |
|
| 431 | + $system_required = ['fname', 'email']; |
|
| 432 | + $disabled_attr = in_array($QST_system, $system_required) ? ' disabled="disabled"' : ''; |
|
| 433 | + $required_on = $question->get('QST_admin_only'); |
|
| 434 | + $show_required_msg = $required_on ? '' : ' display:none;'; |
|
| 435 | + $disabled_attr = $required_on || ! empty($disabled_attr) ? ' disabled="disabled"' : ''; |
|
| 436 | + $id = |
|
| 437 | + ! empty($disabled_attr) && in_array($QST_system, $system_required) ? '_disabled' : ''; |
|
| 438 | + $requiredOptions = [ |
|
| 439 | + ['text' => esc_html__('Optional', 'event_espresso'), 'id' => 0], |
|
| 440 | + ['text' => esc_html__('Required', 'event_espresso'), 'id' => 1], |
|
| 441 | + ]; |
|
| 442 | + echo EEH_Form_Fields::select_input( |
|
| 443 | + 'QST_required' . $id, |
|
| 444 | + $requiredOptions, |
|
| 445 | + $question->required(), |
|
| 446 | + 'id="QST_required' . $id . '"' . $disabled_attr |
|
| 447 | + ); // already escaped |
|
| 448 | + ?> |
|
| 449 | 449 | <p> |
| 450 | 450 | <span id="required_toggled_on" class="description" |
| 451 | 451 | style="color:#D54E21;<?php echo esc_attr($show_required_msg); ?>" |
| 452 | 452 | > |
| 453 | 453 | <?php esc_html_e( |
| 454 | - 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 455 | - 'event_espresso' |
|
| 456 | - ) ?> |
|
| 454 | + 'Required is set to optional, and this field is disabled, because the question is Admin-Only.', |
|
| 455 | + 'event_espresso' |
|
| 456 | + ) ?> |
|
| 457 | 457 | </span |
| 458 | 458 | </p> |
| 459 | 459 | <p> |
| 460 | 460 | <span id="required_toggled_off" class="description" style="color:#D54E21; display: none;"> |
| 461 | 461 | <?php esc_html_e( |
| 462 | - 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 463 | - 'event_espresso' |
|
| 464 | - ) ?> |
|
| 462 | + 'Required option field is no longer disabled because the question is not Admin-Only', |
|
| 463 | + 'event_espresso' |
|
| 464 | + ) ?> |
|
| 465 | 465 | </span> |
| 466 | 466 | </p> |
| 467 | 467 | <?php if (! empty($disabled_attr) && in_array($QST_system, $system_required)) { ?> |
@@ -494,8 +494,8 @@ discard block |
||
| 494 | 494 | </td> |
| 495 | 495 | </tr> |
| 496 | 496 | <?php |
| 497 | - do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 498 | - ?> |
|
| 497 | + do_action('AHEE__questions_main_meta_box__template__after_table_form_table', $question); |
|
| 498 | + ?> |
|
| 499 | 499 | </tbody> |
| 500 | 500 | </table> |
| 501 | 501 | |