main.php
62 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Network Admin Settings |
| 4 | * |
| 5 | * @package WPEL |
| 6 | * @category WordPress Plugin |
| 7 | * @version 2.3 |
| 8 | * @link https://www.webfactoryltd.com/ |
| 9 | * @license Dual licensed under the MIT and GPLv2+ licenses |
| 10 | * |
| 11 | * @var array $vars |
| 12 | * @option array "tabs" |
| 13 | * @option string "current_tab" |
| 14 | * @option string "page_url" |
| 15 | * @option string "menu_url" |
| 16 | * @option string "own_admin_menu" |
| 17 | */ |
| 18 | ?> |
| 19 | <div class="wrap wpel-network-page wpel-network-page-<?php echo esc_html($vars[ 'current_tab' ]); ?>"> |
| 20 | <h1><?php esc_html(get_admin_page_title()); ?></h1> |
| 21 | <?php |
| 22 | if ( $vars[ 'own_admin_menu' ] ): |
| 23 | settings_errors(); |
| 24 | endif; |
| 25 | |
| 26 | // nav tabs |
| 27 | $nav_tabs_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/nav-tabs.php' ); |
| 28 | WPEL_Plugin::show_template( $nav_tabs_template, $vars ); |
| 29 | |
| 30 | // get current option group |
| 31 | $tab = $vars[ 'tabs' ][ $vars[ 'current_tab' ] ]; |
| 32 | |
| 33 | if ( isset( $tab[ 'fields' ] ) ) { |
| 34 | $option_group = $tab[ 'fields' ]->get_setting( 'option_group' ); |
| 35 | $action_url = 'edit.php?action='. $option_group; |
| 36 | } else { |
| 37 | $action_url = ''; |
| 38 | } |
| 39 | ?> |
| 40 | |
| 41 | <form method="post" action="<?php echo esc_html($action_url); ?>" class="wpel-hidden"> |
| 42 | <?php |
| 43 | wp_referer_field(); |
| 44 | |
| 45 | $content_tab_template = __DIR__ .'/tab-contents/'. $vars[ 'current_tab' ] .'.php'; |
| 46 | $default_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/'. $vars[ 'current_tab' ] .'.php' ); |
| 47 | |
| 48 | if ( is_readable( $content_tab_template ) ): |
| 49 | WPEL_Plugin::show_template( $content_tab_template, $vars ); |
| 50 | elseif ( is_readable( $default_tab_template ) ): |
| 51 | WPEL_Plugin::show_template( $default_tab_template, $vars ); |
| 52 | else: |
| 53 | $content_tab_template = WPEL_Plugin::get_plugin_dir( '/templates/partials/tab-contents/fields-default.php' ); |
| 54 | |
| 55 | if ( is_readable( $content_tab_template ) ): |
| 56 | WPEL_Plugin::show_template( $content_tab_template, $vars ); |
| 57 | endif; |
| 58 | endif; |
| 59 | ?> |
| 60 | </form> |
| 61 | </div> |
| 62 |