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 | templates/form-fields/select.php +36 -28 1.7.0.11 → 1.8.13 View file →
@@ -1,12 +1,19 @@
1 1 <?php
2 +
3 +// Exit if accessed directly.
4 +if ( ! defined( 'ABSPATH' ) ) {
5 + exit;
6 +}
7 +
2 8 /**
3 9 * The template used to display select form fields.
4 10 *
5 - * @author WP Charitable LLC
11 + * @author WP Charitable LLC
6 12 * @package Charitable/Templates/Form Fields
7 13 * @since 1.0.0
8 14 * @version 1.0.0
15 + * @version 1.8.8.6
9 16 */
10 17
11 18 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
12 19 return;
@@ -11,44 +18,45 @@
11 18 if ( ! isset( $view_args['form'] ) || ! isset( $view_args['field'] ) ) {
12 19 return;
13 20 }
14 21
15 -$form = $view_args['form'];
16 -$field = $view_args['field'];
17 -$classes = $view_args['classes'];
18 -$is_required = isset( $field['required'] ) ? $field['required'] : false;
19 -$options = isset( $field['options'] ) ? $field['options'] : array();
20 -$value = isset( $field['value'] ) ? $field['value'] : '';
22 +$charitable_form = $view_args['form'];
23 +$charitable_field = $view_args['field'];
24 +$charitable_classes = $view_args['classes'];
25 +$charitable_is_required = isset( $charitable_field['required'] ) ? $charitable_field['required'] : false;
26 +$charitable_options = isset( $charitable_field['options'] ) ? $charitable_field['options'] : array();
27 +$charitable_value = isset( $charitable_field['value'] ) ? $charitable_field['value'] : '';
21 28
22 -if ( is_array( $value ) ) {
23 - $value = current( $value );
29 +if ( is_array( $charitable_value ) ) {
30 + $charitable_value = current( $charitable_value );
24 31 }
25 32
26 -if ( count( $options ) ) :
33 +if ( count( $charitable_options ) ) :
27 34
28 -?>
29 -<div id="charitable_field_<?php echo $field['key'] ?>" class="<?php echo esc_attr( $classes ) ?>">
30 - <?php if ( isset( $field['label'] ) ) : ?>
31 - <label for="charitable_field_<?php echo esc_attr( $field['key'] ) ?>_element">
32 - <?php echo $field['label'] ?>
33 - <?php if ( $is_required ) : ?>
34 - <abbr class="required" title="required">*</abbr>
35 + ?>
36 +<div id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>" class="<?php echo esc_attr( $charitable_classes ); ?>">
37 + <?php if ( isset( $charitable_field['label'] ) ) : ?>
38 + <label for="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element">
39 + <?php echo wp_kses_post( $charitable_field['label'] ); ?>
40 + <?php if ( $charitable_is_required ) : ?>
41 + <abbr class="required" title="<?php esc_html_e( 'Required', 'charitable' ); ?>">*</abbr>
35 42 <?php endif ?>
36 43 </label>
37 44 <?php endif ?>
38 - <select name="<?php echo $field['key'] ?>" id="charitable_field_<?php echo esc_attr( $field['key'] ) ?>_element">
45 + <select name="<?php echo esc_attr( $charitable_field['key'] ); ?>" id="charitable_field_<?php echo esc_attr( $charitable_field['key'] ); ?>_element">
39 46 <?php
40 - foreach ( $options as $val => $label ) :
47 + foreach ( $charitable_options as $charitable_val => $charitable_label ) :
41 48
42 - if ( is_array( $label ) ) : ?>
43 - <optgroup label="<?php echo esc_attr( $val ) ?>">
44 - <?php foreach ( $label as $val => $label ) : ?>
45 - <option value="<?php echo esc_attr( $val ) ?>" <?php selected( $val, $value ) ?>><?php echo $label ?></option>
49 + if ( is_array( $charitable_label ) ) :
50 + ?>
51 + <optgroup label="<?php echo esc_attr( $charitable_val ); ?>">
52 + <?php foreach ( $charitable_label as $charitable_val => $charitable_label ) : ?>
53 + <option value="<?php echo esc_attr( $charitable_val ); ?>" <?php selected( $charitable_val, $charitable_value ); ?>><?php echo esc_html( $charitable_label ); ?></option>
46 54 <?php endforeach; ?>
47 55 </optgroup>
48 56 <?php else : ?>
49 - <option value="<?php echo esc_attr( $val ) ?>" <?php selected( $val, $value ) ?>><?php echo $label ?></option>
50 - <?php
57 + <option value="<?php echo esc_attr( $charitable_val ); ?>" <?php selected( $charitable_val, $charitable_value ); ?>><?php echo esc_html( $charitable_label ); ?></option>
58 + <?php
51 59
52 60 endif;
53 61 endforeach;
54 62
@@ -53,11 +61,11 @@
53 61 endforeach;
54 62
55 63 ?>
56 64 </select>
57 - <?php if ( isset( $field['help'] ) ) : ?>
58 - <p class="charitable-field-help"><?php echo $field['help']; ?></p>
65 + <?php if ( isset( $charitable_field['help'] ) ) : ?>
66 + <p class="charitable-field-help"><?php echo $charitable_field['help']; // phpcs:ignore ?></p>
59 67 <?php endif ?>
60 68 </div>
61 -<?php
69 + <?php
62 70
63 71 endif;