| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display the main settings page wrapper. |
| 4 |
* |
| 5 |
* @author Eric Daams |
| 6 |
* @package Charitable/Admin View/Settings |
| 7 |
* @copyright Copyright (c) 2019, Studio 164a |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0.0 |
| 10 |
* @version 1.6.19 |
| 11 |
*/ |
| 12 |
|
| 13 |
$active_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'general'; |
| 14 |
$group = isset( $_GET['group'] ) ? $_GET['group'] : $active_tab; |
| 15 |
$sections = charitable_get_admin_settings()->get_sections(); |
| 16 |
$show_return = $group != $active_tab; |
| 17 |
|
| 18 |
if ( $show_return ) { |
| 19 |
/** |
| 20 |
* Filter the return link text. |
| 21 |
* |
| 22 |
* @since 1.6.19 |
| 23 |
* |
| 24 |
* @param string $default The default return link text. |
| 25 |
* @param string $active_tab The active tab. |
| 26 |
* @param string $group The current group. |
| 27 |
*/ |
| 28 |
$return_tab_text = apply_filters( |
| 29 |
'charitable_settings_return_tab_text', |
| 30 |
sprintf( |
| 31 |
/* translators: %s: tab name */ |
| 32 |
__( '← Return to %s', 'charitable' ), |
| 33 |
$active_tab |
| 34 |
), |
| 35 |
$active_tab, |
| 36 |
$group |
| 37 |
); |
| 38 |
|
| 39 |
/** |
| 40 |
* Filter the return link URL. |
| 41 |
* |
| 42 |
* @since 1.6.19 |
| 43 |
* |
| 44 |
* @param string $default The default return link URL |
| 45 |
* @param string $active_tab The active tab. |
| 46 |
* @param string $group The current group. |
| 47 |
*/ |
| 48 |
$return_tab_url = apply_filters( |
| 49 |
'charitable_settings_return_tab_url', |
| 50 |
add_query_arg( |
| 51 |
array( 'tab' => $active_tab ), |
| 52 |
admin_url( 'admin.php?page=charitable-settings' ) |
| 53 |
), |
| 54 |
$active_tab, |
| 55 |
$group |
| 56 |
); |
| 57 |
} |
| 58 |
|
| 59 |
ob_start(); |
| 60 |
?> |
| 61 |
<div id="charitable-settings" class="wrap"> |
| 62 |
<h1 class="screen-reader-text"><?php echo get_admin_page_title(); ?></ha> |
| 63 |
<h2 class="nav-tab-wrapper"> |
| 64 |
<?php foreach ( $sections as $tab => $name ) : ?> |
| 65 |
<a href="<?php echo esc_url( add_query_arg( array( 'tab' => $tab ), admin_url( 'admin.php?page=charitable-settings' ) ) ); ?>" class="nav-tab <?php echo $active_tab == $tab ? 'nav-tab-active' : ''; ?>"><?php echo $name; ?></a> |
| 66 |
<?php endforeach ?> |
| 67 |
</h2> |
| 68 |
<?php if ( $show_return ) : ?> |
| 69 |
<?php /* translators: %s: active settings tab label */ ?> |
| 70 |
<p><a href="<?php echo esc_url( $return_tab_url ); ?>"><?php echo $return_tab_text; ?></a></p> |
| 71 |
<?php endif ?> |
| 72 |
<?php |
| 73 |
/** |
| 74 |
* Do or render something right before the settings form. |
| 75 |
* |
| 76 |
* @since 1.0.0 |
| 77 |
* |
| 78 |
* @param string $group The settings group we are viewing. |
| 79 |
*/ |
| 80 |
do_action( 'charitable_before_admin_settings', $group ); |
| 81 |
?> |
| 82 |
<form method="post" action="options.php"> |
| 83 |
<table class="form-table"> |
| 84 |
<?php |
| 85 |
settings_fields( 'charitable_settings' ); |
| 86 |
|
| 87 |
charitable_do_settings_fields( 'charitable_settings_' . $group, 'charitable_settings_' . $group ); |
| 88 |
?> |
| 89 |
</table> |
| 90 |
<?php |
| 91 |
/** |
| 92 |
* Filter the submit button at the bottom of the settings table. |
| 93 |
* |
| 94 |
* @since 1.6.0 |
| 95 |
* |
| 96 |
* @param string $button The button output. |
| 97 |
*/ |
| 98 |
echo apply_filters( 'charitable_settings_button_' . $group, get_submit_button( null, 'primary', 'submit', true, null ) ); |
| 99 |
?> |
| 100 |
</form> |
| 101 |
<?php |
| 102 |
/** |
| 103 |
* Do or render something right after the settings form. |
| 104 |
* |
| 105 |
* @since 1.0.0 |
| 106 |
* |
| 107 |
* @param string $group The settings group we are viewing. |
| 108 |
*/ |
| 109 |
do_action( 'charitable_after_admin_settings', $group ); |
| 110 |
?> |
| 111 |
</div> |
| 112 |
<?php |
| 113 |
echo ob_get_clean(); |
| 114 |
|