PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.11.3
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.11.3
1.8.13.1 1.8.13 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 All 212 releases
charitable / includes / admin / views / settings / select-form.php

select-form.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.11.3, at includes/admin/views/settings/select-form.php

75 lines 3.7 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 select field.
10 *
11 * @author David Bisset
12 * @package Charitable/Admin View/Settings
13 * @copyright Copyright (c) 2023, WP Charitable LLC
14 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
15 * @since 1.0.0
16 * @version 1.8.8.6
17 */
18
19 $charitable_value = charitable_get_option( $view_args['key'] );
20
21 if ( false === $charitable_value ) {
22 $charitable_value = isset( $view_args['default'] ) ? $view_args['default'] : '';
23 }
24
25 $charitable_form_action_url = isset( $view_args['form_action_url'] ) ? $view_args['form_action_url'] : '';
26 $charitable_form_action_method = isset( $view_args['form_action_method'] ) ? $view_args['form_action_method'] : 'POST';
27 $charitable_button_label = isset( $view_args['button_label'] ) ? $view_args['button_label'] : 'Submit';
28 $charitable_nonce_action_name = isset( $view_args['nonce_action_name'] ) ? $view_args['nonce_action_name'] : 'wpcharitable-action';
29 $charitable_nonce_field_name = isset( $view_args['nonce_field_name'] ) ? $view_args['nonce_field_name'] : false;
30 $charitable_error_message = false;
31
32 // determine if the fields should be shown, based on what we are trying to do with them.
33 if ( isset( $view_args['nonce_action_name'] ) && 'export_campaign' === $view_args['nonce_action_name'] && is_array( $view_args['options'] ) && 0 === count( $view_args['options'] ) ) {
34 $charitable_error_message = '<strong>' . __( 'You have no campaigns to export.', 'charitable' ) . '</strong>';
35 } elseif ( isset( $view_args['nonce_action_name'] ) && 'export_donations_from_campaign' === $view_args['nonce_action_name'] && is_array( $view_args['options'] ) && 0 === count( $view_args['options'] ) ) {
36 $charitable_error_message = '<strong>' . __( 'You have no donations to export.', 'charitable' ) . '</strong>';
37 }
38 ?>
39 <form action="<?php echo esc_url( $charitable_form_action_url ); ?>" method="<?php echo esc_attr( $charitable_form_action_method ); ?>">
40
41 <?php wp_nonce_field( $charitable_nonce_action_name, $charitable_nonce_field_name ); ?>
42
43 <?php if ( ! $charitable_error_message ) { ?>
44 <select id="<?php printf( 'charitable_settings_%s', implode( '_', $view_args['key'] ) ); // phpcs:ignore ?>"
45 name="<?php printf( 'charitable_settings[%s]', $view_args['name'] ); // phpcs:ignore ?>"
46 class="<?php echo esc_attr( $view_args['classes'] ); ?>"
47 <?php echo charitable_get_arbitrary_attributes( $view_args ); // phpcs:ignore ?>
48 >
49 <?php
50 foreach ( $view_args['options'] as $charitable_key => $charitable_option ) :
51 if ( is_array( $charitable_option ) ) :
52 $charitable_label = isset( $charitable_option['label'] ) ? $charitable_option['label'] : '';
53 ?>
54 <optgroup label="<?php echo esc_html( $charitable_label ); ?>">
55 <?php foreach ( $charitable_option['options'] as $charitable_k => $charitable_opt ) : ?>
56 <option value="<?php echo esc_attr( $charitable_k ); ?>" <?php selected( $charitable_k, $charitable_value ); ?>><?php echo esc_html( $charitable_opt ); ?></option>
57 <?php endforeach ?>
58 </optgroup>
59 <?php else : ?>
60 <option value="<?php echo esc_attr( $charitable_key ); ?>" <?php selected( $charitable_key, $charitable_value ); ?>><?php echo $charitable_option; // phpcs:ignore ?></option>
61 <?php
62 endif;
63 endforeach
64 ?>
65 </select>
66 <input class="button button-primary" type="submit" value="<?php echo esc_html( $charitable_button_label ); ?>">
67 <?php } else { ?>
68 <p><?php echo $charitable_error_message; // phpcs:ignore ?></p>
69 <?php } ?>
70 </form>
71 <?php if ( isset( $view_args['help'] ) ) : ?>
72 <div class="charitable-help"><?php echo $view_args['help']; // phpcs:ignore ?></div>
73 <?php
74 endif;
75