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 / settings / select.php

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

77 lines 2.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 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 // Determine if this is a tools field or settings field.
20 $charitable_is_tools_field = charitable_is_tools_view();
21
22 if ( $charitable_is_tools_field ) {
23 $charitable_tools_options = get_option( 'charitable_tools', array() );
24 $charitable_value = '';
25 if ( isset( $view_args['key'] ) && is_array( $view_args['key'] ) ) {
26 $charitable_value_path = $charitable_tools_options;
27 foreach ( $view_args['key'] as $charitable_key_part ) {
28 if ( isset( $charitable_value_path[ $charitable_key_part ] ) ) {
29 $charitable_value_path = $charitable_value_path[ $charitable_key_part ];
30 } else {
31 $charitable_value_path = false;
32 break;
33 }
34 }
35 $charitable_value = $charitable_value_path;
36 }
37 if ( false === $charitable_value ) {
38 $charitable_value = isset( $view_args['default'] ) ? $view_args['default'] : '';
39 }
40 $charitable_field_id = sprintf( 'charitable_tools_%s', implode( '_', $view_args['key'] ) );
41 $charitable_field_name = sprintf( 'charitable_tools[%s]', $view_args['name'] );
42 } else {
43 $charitable_value = charitable_get_option( $view_args['key'] );
44 if ( false === $charitable_value ) {
45 $charitable_value = isset( $view_args['default'] ) ? $view_args['default'] : '';
46 }
47 $charitable_field_id = sprintf( 'charitable_settings_%s', implode( '_', $view_args['key'] ) );
48 $charitable_field_name = sprintf( 'charitable_settings[%s]', $view_args['name'] );
49 }
50 ?>
51 <select id="<?php echo esc_attr( $charitable_field_id ); ?>"
52 name="<?php echo esc_attr( $charitable_field_name ); ?>"
53 class="<?php echo esc_attr( $view_args['classes'] ); ?>"
54 <?php echo charitable_get_arbitrary_attributes( $view_args ); // phpcs:ignore ?>
55 >
56 <?php
57 foreach ( $view_args['options'] as $charitable_key => $charitable_option ) :
58 if ( is_array( $charitable_option ) ) :
59 $charitable_label = isset( $charitable_option['label'] ) ? $charitable_option['label'] : '';
60 ?>
61 <optgroup label="<?php echo wp_kses_post( $charitable_label ); ?>">
62 <?php foreach ( $charitable_option['options'] as $charitable_k => $charitable_opt ) : ?>
63 <option value="<?php echo esc_attr( $charitable_k ); ?>" <?php selected( $charitable_k, $charitable_value ); ?>><?php echo esc_html( $charitable_opt ); ?></option>
64 <?php endforeach ?>
65 </optgroup>
66 <?php else : ?>
67 <option value="<?php echo esc_attr( $charitable_key ); ?>" <?php selected( $charitable_key, $charitable_value ); ?>><?php echo $charitable_option; // phpcs:ignore ?></option>
68 <?php
69 endif;
70 endforeach
71 ?>
72 </select>
73 <?php if ( isset( $view_args['help'] ) ) : ?>
74 <div class="charitable-help"><?php echo $view_args['help']; // phpcs:ignore ?></div>
75 <?php
76 endif;
77