PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.7.0.12
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.7.0.12
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.7.0.12, at includes/admin/views/settings/select-form.php

69 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Display select field.
4 *
5 * @author David Bisset
6 * @package Charitable/Admin View/Settings
7 * @copyright Copyright (c) 2022, WP Charitable LLC
8 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 * @since 1.0.0
10 * @version 1.6.25
11 */
12
13 $value = charitable_get_option( $view_args['key'] );
14
15 if ( false === $value ) {
16 $value = isset( $view_args['default'] ) ? $view_args['default'] : '';
17 }
18
19 $form_action_url = isset( $view_args['form_action_url'] ) ? $view_args['form_action_url'] : '';
20 $form_action_method = isset( $view_args['form_action_method'] ) ? $view_args['form_action_method'] : 'POST';
21 $button_label = isset( $view_args['button_label'] ) ? $view_args['button_label'] : 'Submit';
22 $nonce_action_name = isset( $view_args['nonce_action_name'] ) ? $view_args['nonce_action_name'] : 'wpcharitable-action';
23 $nonce_field_name = isset( $view_args['nonce_field_name'] ) ? $view_args['nonce_field_name'] : false;
24 $error_message = false;
25
26 // determine if the fields should be shown, based on what we are trying to do with them.
27 if ( isset( $view_args['nonce_action_name'] ) && 'export_campaign' === $view_args['nonce_action_name'] && is_array( $view_args['options'] ) && 0 === count( $view_args['options'] ) ) {
28 $error_message = '<strong>' . __('You have no campaigns to export.', 'charitable' ) . '</strong>';
29 } else if ( 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'] ) ) {
30 $error_message = '<strong>' . __('You have no donations to export.', 'charitable' ) . '</strong>';
31 }
32 ?>
33 <form action="<?php echo $form_action_url; ?>" method="<?php echo $form_action_method; ?>">
34
35 <?php wp_nonce_field( $nonce_action_name, $nonce_field_name ); ?>
36
37 <?php if ( ! $error_message ) { ?>
38 <select id="<?php printf( 'charitable_settings_%s', implode( '_', $view_args['key'] ) ); ?>"
39 name="<?php printf( 'charitable_settings[%s]', $view_args['name'] ); ?>"
40 class="<?php echo esc_attr( $view_args['classes'] ); ?>"
41 <?php echo charitable_get_arbitrary_attributes( $view_args ); ?>
42 >
43 <?php
44 foreach ( $view_args['options'] as $key => $option ) :
45 if ( is_array( $option ) ) :
46 $label = isset( $option['label'] ) ? $option['label'] : '';
47 ?>
48 <optgroup label="<?php echo $label; ?>">
49 <?php foreach ( $option['options'] as $k => $opt ) : ?>
50 <option value="<?php echo $k; ?>" <?php selected( $k, $value ); ?>><?php echo $opt; ?></option>
51 <?php endforeach ?>
52 </optgroup>
53 <?php else : ?>
54 <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $value ); ?>><?php echo $option; ?></option>
55 <?php
56 endif;
57 endforeach
58 ?>
59 </select>
60 <input class="button button-primary" type="submit" value="<?php echo $button_label; ?>">
61 <?php } else { ?>
62 <p><?php echo $error_message; ?></p>
63 <?php } ?>
64 </form>
65 <?php if ( isset( $view_args['help'] ) ) : ?>
66 <div class="charitable-help"><?php echo $view_args['help']; ?></div>
67 <?php
68 endif;
69