PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.12
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.12
1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 1.8.0 All 210 releases
charitable / includes / admin / views / tools / tools.php

tools.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.12, at includes/admin/views/tools/tools.php

121 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly.
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 /**
9 * Display the main tools page wrapper.
10 *
11 * @author David Bisset
12 * @package Charitable/Admin View/Tools
13 * @copyright Copyright (c) 2023, WP Charitable LLC
14 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
15 * @since 1.8.1.6
16 * @version 1.8.1.6
17 * @version 1.8.8.6
18 */
19
20 $charitable_active_tab = isset( $_GET['tab'] ) ? esc_html( $_GET['tab'] ) : 'export'; // phpcs:ignore
21 $charitable_active_sub_tab = isset( $_GET['sub_tab'] ) ? esc_html( $_GET['sub_tab'] ) : ''; // phpcs:ignore
22 $charitable_group = isset( $_GET['group'] ) ? esc_html( $_GET['group'] ) : $charitable_active_tab; // phpcs:ignore
23 $charitable_tab_no_form_tag = array( 'import', 'export', 'system-info', 'snippets', 'customize', 'logs' );
24 $charitable_tab_no_fields = array( 'system-info', 'snippets', 'customize', 'logs' );
25 $charitable_tab_no_table = array( 'logs' );
26 $charitable_sections = charitable_get_admin_tools()->get_sections();
27 $charitable_show_return = $charitable_group !== $charitable_active_tab;
28
29 /* Determine sub-sections and active sub-tab slug for the import tab. */
30 $charitable_sub_sections = array();
31 $charitable_active_sub_tab_slug = '';
32 if ( 'import' === $charitable_active_tab && ! empty( $charitable_active_sub_tab ) ) {
33 $charitable_sub_sections = charitable_get_admin_tools()->get_sub_sections_import();
34 $charitable_active_sub_tab_slug = 'import__' . $charitable_active_sub_tab;
35 $charitable_group = $charitable_active_sub_tab_slug;
36 }
37
38 ob_start();
39 ?>
40
41 <div id="charitable-tools" class="wrap">
42 <h1 class="screen-reader-text"><?php echo get_admin_page_title(); // phpcs:ignore ?></h1>
43 <h1><?php echo get_admin_page_title(); // phpcs:ignore ?></h1>
44 <?php do_action( 'charitable_maybe_show_notification' ); ?>
45 <h2 class="nav-tab-wrapper">
46 <?php foreach ( $charitable_sections as $charitable_tab => $charitable_name ) : // phpcs:ignore ?>
47 <a href="<?php echo esc_url( add_query_arg( array( 'tab' => $charitable_tab ), admin_url( 'admin.php?page=charitable-tools' ) ) ); ?>" class="nav-tab <?php echo $charitable_active_tab == $charitable_tab ? 'nav-tab-active' : ''; ?>"><?php echo $charitable_name; // phpcs:ignore ?></a>
48 <?php endforeach ?>
49 </h2>
50 <?php if ( ! empty( $charitable_sub_sections ) ) : ?>
51 <h3 class="nav-sub-tab-wrapper">
52 <?php foreach ( $charitable_sub_sections as $charitable_sub_tab_key => $charitable_sub_tab_name ) : // phpcs:ignore
53 $charitable_sub_tab_slug = str_replace( 'import__', '', $charitable_sub_tab_key );
54 ?>
55 <a href="<?php echo esc_url( add_query_arg( array( 'tab' => $charitable_active_tab, 'sub_tab' => $charitable_sub_tab_slug ), admin_url( 'admin.php?page=charitable-tools' ) ) ); ?>" class="nav-tab <?php echo $charitable_active_sub_tab_slug === $charitable_sub_tab_key ? 'nav-tab-active' : ''; ?>"><?php echo esc_html( $charitable_sub_tab_name ); ?></a>
56 <?php endforeach ?>
57 </h3>
58 <?php endif; ?>
59 <?php
60 /**
61 * Do or render something right before the tools form.
62 *
63 * @since 1.8.1.6
64 *
65 * @param string $group The tools group we are viewing.
66 */
67 do_action( 'charitable_before_admin_tools', $charitable_group );
68 ?>
69 <?php if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_form_tag, true ) ) : ?>
70 <form method="post" action="options.php">
71 <?php endif; ?>
72 <?php if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_table, true ) ) : ?>
73 <table class="form-table">
74 <?php endif; ?>
75 <?php
76 if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_form_tag, true ) ) :
77 settings_fields( 'charitable_tools' );
78 endif;
79
80 if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_fields, true ) ) :
81
82 charitable_do_tools_fields( 'charitable_tools_' . $charitable_group, 'charitable_tools_' . $charitable_group );
83
84 else :
85
86 charitable_admin_view( 'tools/' . $charitable_active_tab );
87
88 endif;
89 ?>
90 <?php if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_table, true ) ) : ?>
91 </table>
92 <?php endif; ?>
93 <?php if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_form_tag, true ) ) : ?>
94 <?php
95 /**
96 * Filter the submit button at the bottom of the tools table.
97 *
98 * @since 1.6.0
99 *
100 * @param string $button The button output.
101 */
102 echo apply_filters( 'charitable_tools_button_' . esc_attr( $charitable_group ), get_submit_button( null, 'primary', 'submit', true, null ) ); // phpcs:ignore
103 ?>
104 <?php endif; ?>
105 <?php if ( ! in_array( strtolower( $charitable_active_tab ), $charitable_tab_no_form_tag, true ) ) : ?>
106 </form>
107 <?php endif; ?>
108 <?php
109 /**
110 * Do or render something right after the tools form.
111 *
112 * @since 1.8.1.6
113 *
114 * @param string $group The tools group we are viewing.
115 */
116 do_action( 'charitable_after_admin_tools', $charitable_group );
117 ?>
118 </div>
119 <?php
120 echo ob_get_clean(); // phpcs:ignore
121