| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
|
| 6 |
?> |
| 7 |
<p> |
| 8 |
<?php esc_html_e( 'Configure and manage your payment gateways in one place to control transactions, settings, and more.', 'formidable' ); ?> |
| 9 |
</p> |
| 10 |
<?php |
| 11 |
|
| 12 |
echo '<div class="frm-long-icon-buttons" role="tablist">'; |
| 13 |
|
| 14 |
foreach ( $payment_sections as $key => $section ) { |
| 15 |
$is_active = $tab === $key; |
| 16 |
$name = $section['name'] ?? ucfirst( $key ); |
| 17 |
$input_params = array( |
| 18 |
'id' => "frm_toggle_{$key}_settings", |
| 19 |
'type' => 'radio', |
| 20 |
'name' => 'frm_payment_section', |
| 21 |
'value' => $key, |
| 22 |
'data-frmshow' => "#frm_{$key}_settings_section", |
| 23 |
); |
| 24 |
|
| 25 |
if ( $is_active ) { |
| 26 |
$input_params['checked'] = 'checked'; |
| 27 |
} |
| 28 |
|
| 29 |
$other_section_selectors = array_map( |
| 30 |
function ( $section ) { |
| 31 |
return "#frm_{$section}_settings_section"; |
| 32 |
}, |
| 33 |
array_diff( array_keys( $payment_sections ), array( $key ) ) |
| 34 |
); |
| 35 |
$input_params['data-frmhide'] = implode( ',', $other_section_selectors ); |
| 36 |
|
| 37 |
$label_params = array( |
| 38 |
'for' => "frm_toggle_{$key}_settings", |
| 39 |
'class' => 'frm_payment_settings_tab', |
| 40 |
'tabindex' => '0', |
| 41 |
'role' => 'tab', |
| 42 |
'aria-selected' => $is_active ? 'true' : 'false', |
| 43 |
); |
| 44 |
?> |
| 45 |
<input <?php FrmAppHelper::array_to_html_params( $input_params, true ); ?> /> |
| 46 |
<label <?php FrmAppHelper::array_to_html_params( $label_params, true ); ?>> |
| 47 |
<?php FrmAppHelper::icon_by_class( 'frmfont frm_' . $key . '_full_icon' ); ?> |
| 48 |
<span class="screen-reader-text"><?php echo esc_html( $name ); ?></span> |
| 49 |
</label> |
| 50 |
<?php |
| 51 |
}//end foreach |
| 52 |
echo '</div>'; |
| 53 |
|
| 54 |
foreach ( $payment_sections as $key => $section ) { |
| 55 |
$is_active = $tab === $key; |
| 56 |
$name = $section['name'] ?? ucfirst( $key ); |
| 57 |
$section_classes = 'frm_payments_section'; |
| 58 |
|
| 59 |
// Exclude Authorize.Net as the h3 tag is added explicitly. |
| 60 |
$include_h3 = 'authorize_net' !== $key; |
| 61 |
|
| 62 |
if ( ! $is_active ) { |
| 63 |
$section_classes .= ' frm_hidden'; |
| 64 |
} |
| 65 |
?> |
| 66 |
<div id="frm_<?php echo esc_attr( $key ); ?>_settings_section" class="<?php echo esc_attr( $section_classes ); ?>" role="tabpanel"> |
| 67 |
<?php if ( $include_h3 ) { ?> |
| 68 |
<h3 style="margin-bottom: 0;"> |
| 69 |
<?php |
| 70 |
// translators: %s is the payment gateway name |
| 71 |
printf( '%s Settings', esc_html( $name ) ); |
| 72 |
?> |
| 73 |
</h3> |
| 74 |
<?php } ?> |
| 75 |
<?php |
| 76 |
if ( isset( $section['class'] ) ) { |
| 77 |
call_user_func( array( $section['class'], $section['function'] ) ); |
| 78 |
} else { |
| 79 |
call_user_func( $section['function'] ?? $section ); |
| 80 |
} |
| 81 |
?> |
| 82 |
</div> |
| 83 |
<?php |
| 84 |
}//end foreach |
| 85 |
|