PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
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
← All changes | includes/admin/views/settings/select-form.php +37 -31 1.7.0.11 → 1.8.13 View file →
@@ -1,68 +1,74 @@
1 1 <?php
2 +
3 +// Exit if accessed directly.
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
2 8 /**
3 9 * Display select field.
4 10 *
5 11 * @author David Bisset
6 12 * @package Charitable/Admin View/Settings
7 - * @copyright Copyright (c) 2022, WP Charitable LLC
13 + * @copyright Copyright (c) 2023, WP Charitable LLC
8 14 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
9 15 * @since 1.0.0
10 - * @version 1.6.25
16 + * @version 1.8.8.6
11 17 */
12 18
13 -$value = charitable_get_option( $view_args['key'] );
19 +$charitable_value = charitable_get_option( $view_args['key'] );
14 20
15 -if ( false === $value ) {
16 - $value = isset( $view_args['default'] ) ? $view_args['default'] : '';
21 +if ( false === $charitable_value ) {
22 + $charitable_value = isset( $view_args['default'] ) ? $view_args['default'] : '';
17 23 }
18 24
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 +$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;
25 31
26 32 // determine if the fields should be shown, based on what we are trying to do with them.
27 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'] ) ) {
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>';
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>';
31 37 }
32 38 ?>
33 -<form action="<?php echo $form_action_url; ?>" method="<?php echo $form_action_method; ?>">
39 +<form action="<?php echo esc_url( $charitable_form_action_url ); ?>" method="<?php echo esc_attr( $charitable_form_action_method ); ?>">
34 40
35 - <?php wp_nonce_field( $nonce_action_name, $nonce_field_name ); ?>
41 + <?php wp_nonce_field( $charitable_nonce_action_name, $charitable_nonce_field_name ); ?>
36 42
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'] ); ?>"
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 ?>"
40 46 class="<?php echo esc_attr( $view_args['classes'] ); ?>"
41 - <?php echo charitable_get_arbitrary_attributes( $view_args ); ?>
47 + <?php echo charitable_get_arbitrary_attributes( $view_args ); // phpcs:ignore ?>
42 48 >
43 49 <?php
44 - foreach ( $view_args['options'] as $key => $option ) :
45 - if ( is_array( $option ) ) :
46 - $label = isset( $option['label'] ) ? $option['label'] : '';
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'] : '';
47 53 ?>
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>
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>
51 57 <?php endforeach ?>
52 58 </optgroup>
53 59 <?php else : ?>
54 - <option value="<?php echo esc_attr( $key ); ?>" <?php selected( $key, $value ); ?>><?php echo $option; ?></option>
60 + <option value="<?php echo esc_attr( $charitable_key ); ?>" <?php selected( $charitable_key, $charitable_value ); ?>><?php echo $charitable_option; // phpcs:ignore ?></option>
55 61 <?php
56 62 endif;
57 63 endforeach
58 64 ?>
59 65 </select>
60 - <input class="button button-primary" type="submit" value="<?php echo $button_label; ?>">
66 + <input class="button button-primary" type="submit" value="<?php echo esc_html( $charitable_button_label ); ?>">
61 67 <?php } else { ?>
62 - <p><?php echo $error_message; ?></p>
63 - <?php } ?>
68 + <p><?php echo $charitable_error_message; // phpcs:ignore ?></p>
69 + <?php } ?>
64 70 </form>
65 71 <?php if ( isset( $view_args['help'] ) ) : ?>
66 - <div class="charitable-help"><?php echo $view_args['help']; ?></div>
72 + <div class="charitable-help"><?php echo $view_args['help']; // phpcs:ignore ?></div>
67 73 <?php
68 74 endif;