|
@@ 549-587 (lines=39) @@
|
| 546 |
|
$output = ''; |
| 547 |
|
|
| 548 |
|
switch ( $display_style ) { |
| 549 |
|
case 'buttons': |
| 550 |
|
$output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 551 |
|
|
| 552 |
|
foreach ( $prices as $price ) { |
| 553 |
|
$level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
| 554 |
|
$level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $price['_give_id']['level_id'] . ' ' . ( give_is_default_level_id( $price ) ? 'give-default-level' : '' ), $form_id, $price ); |
| 555 |
|
|
| 556 |
|
$formatted_amount = give_format_amount( |
| 557 |
|
$price['_give_amount'], array( |
| 558 |
|
'sanitize' => false, |
| 559 |
|
'currency' => give_get_currency( $form_id ), |
| 560 |
|
) |
| 561 |
|
); |
| 562 |
|
|
| 563 |
|
$output .= sprintf( |
| 564 |
|
'<li><button type="button" data-price-id="%1$s" class="%2$s" value="%3$s" data-default="%4$s">%5$s</button></li>', |
| 565 |
|
$price['_give_id']['level_id'], |
| 566 |
|
$level_classes, |
| 567 |
|
$formatted_amount, |
| 568 |
|
array_key_exists( '_give_default', $price ) ? 1 : 0, |
| 569 |
|
$level_text |
| 570 |
|
); |
| 571 |
|
} |
| 572 |
|
|
| 573 |
|
// Custom Amount. |
| 574 |
|
if ( |
| 575 |
|
give_is_setting_enabled( $custom_amount ) |
| 576 |
|
&& ! empty( $custom_amount_text ) |
| 577 |
|
) { |
| 578 |
|
|
| 579 |
|
$output .= sprintf( |
| 580 |
|
'<li><button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">%1$s</button></li>', |
| 581 |
|
$custom_amount_text |
| 582 |
|
); |
| 583 |
|
} |
| 584 |
|
|
| 585 |
|
$output .= '</ul>'; |
| 586 |
|
|
| 587 |
|
break; |
| 588 |
|
|
| 589 |
|
case 'radios': |
| 590 |
|
$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
|
@@ 589-627 (lines=39) @@
|
| 586 |
|
|
| 587 |
|
break; |
| 588 |
|
|
| 589 |
|
case 'radios': |
| 590 |
|
$output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 591 |
|
|
| 592 |
|
foreach ( $prices as $price ) { |
| 593 |
|
$level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'], array( 'sanitize' => false ) ), array( 'currency_code' => give_get_currency( $form_id ) ) ), $form_id, $price ); |
| 594 |
|
$level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $price['_give_id']['level_id'] . ( give_is_default_level_id( $price ) ? ' give-default-level' : '' ), $form_id, $price ); |
| 595 |
|
|
| 596 |
|
$formatted_amount = give_format_amount( |
| 597 |
|
$price['_give_amount'], array( |
| 598 |
|
'sanitize' => false, |
| 599 |
|
'currency' => give_get_currency( $form_id ), |
| 600 |
|
) |
| 601 |
|
); |
| 602 |
|
|
| 603 |
|
$output .= sprintf( |
| 604 |
|
'<li><input type="radio" data-price-id="%1$s" class="%2$s" value="%3$s" name="give-radio-donation-level" id="give-radio-level-%1$s" %4$s data-default="%5$s"><label for="give-radio-level-%1$s">%6$s</label></li>', |
| 605 |
|
$price['_give_id']['level_id'], |
| 606 |
|
$level_classes, |
| 607 |
|
$formatted_amount, |
| 608 |
|
( give_is_default_level_id( $price ) ? 'checked="checked"' : '' ), |
| 609 |
|
array_key_exists( '_give_default', $price ) ? 1 : 0, |
| 610 |
|
$level_text |
| 611 |
|
); |
| 612 |
|
} |
| 613 |
|
|
| 614 |
|
// Custom Amount. |
| 615 |
|
if ( |
| 616 |
|
give_is_setting_enabled( $custom_amount ) |
| 617 |
|
&& ! empty( $custom_amount_text ) |
| 618 |
|
) { |
| 619 |
|
$output .= sprintf( |
| 620 |
|
'<li><input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom"><label for="give-radio-level-custom">%1$s</label></li>', |
| 621 |
|
$custom_amount_text |
| 622 |
|
); |
| 623 |
|
} |
| 624 |
|
|
| 625 |
|
$output .= '</ul>'; |
| 626 |
|
|
| 627 |
|
break; |
| 628 |
|
|
| 629 |
|
case 'dropdown': |
| 630 |
|
$output .= '<label for="give-donation-level-select-' . $form_id . '" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |