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/widgets/class-charitable-campaign-terms-widget.php +98 -96 1.6.7 → 1.8.13 View file →
@@ -3,115 +3,117 @@
3 3 * Campaign categories/tags widget class.
4 4 *
5 5 * @package Charitable/Widgets/Charitable_Campaign_Terms_Widget
6 6 * @category Class
7 - * @author Eric Daams
7 + * @author David Bisset
8 8 * @since 1.0.0
9 9 * @version 1.5.4
10 10 */
11 11
12 12 // Exit if accessed directly.
13 -if ( ! defined( 'ABSPATH' ) ) { exit; }
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit;
15 +}
14 16
15 17 if ( ! class_exists( 'Charitable_Campaign_Terms_Widget' ) ) :
16 18
17 - /**
18 - * Charitable_Campaign_Terms_Widget class.
19 - *
20 - * @since 1.0.0
21 - */
22 - class Charitable_Campaign_Terms_Widget extends WP_Widget {
19 + /**
20 + * Charitable_Campaign_Terms_Widget class.
21 + *
22 + * @since 1.0.0
23 + */
24 + class Charitable_Campaign_Terms_Widget extends WP_Widget {
23 25
24 - /**
25 - * Instantiate the widget and set up basic configuration.
26 - *
27 - * @since 1.0.0
28 - */
29 - public function __construct() {
30 - parent::__construct(
31 - 'charitable_campaign_terms_widget',
32 - __( 'Campaign Categories / Tags', 'charitable' ),
33 - array(
34 - 'description' => __( 'Displays your Charitable campaign categories or tags.', 'charitable' ),
35 - // 'customize_selective_refresh' => true
36 - )
37 - );
38 - }
26 + /**
27 + * Instantiate the widget and set up basic configuration.
28 + *
29 + * @since 1.0.0
30 + */
31 + public function __construct() {
32 + parent::__construct(
33 + 'charitable_campaign_terms_widget',
34 + __( 'Campaign Categories / Tags', 'charitable' ),
35 + array(
36 + 'description' => __( 'Displays your Charitable campaign categories or tags.', 'charitable' ),
37 + // 'customize_selective_refresh' => true
38 + )
39 + );
40 + }
39 41
40 - /**
41 - * Display the widget contents on the front-end.
42 - *
43 - * @since 1.0.0
44 - *
45 - * @param array $args
46 - * @param array $instance
47 - * @return void
48 - */
49 - public function widget( $args, $instance ) {
50 - $view_args = array_merge( $args, $instance );
51 - $template = array_key_exists( 'dropdown', $view_args ) && $view_args['dropdown'] ? 'widgets/campaign-terms-dropdown.php' : 'widgets/campaign-terms.php';
42 + /**
43 + * Display the widget contents on the front-end.
44 + *
45 + * @since 1.0.0
46 + *
47 + * @param array $args Display arguments including 'before_title', 'after_title', 'before_widget' and 'after_widget'.
48 + * @param array $instance The settings for the particular instance of the widget.
49 + * @return void
50 + */
51 + public function widget( $args, $instance ) {
52 + $view_args = array_merge( $args, $instance );
53 + $template = array_key_exists( 'dropdown', $view_args ) && $view_args['dropdown'] ? 'widgets/campaign-terms-dropdown.php' : 'widgets/campaign-terms.php';
52 54
53 - charitable_template( $template, $view_args );
54 - }
55 + charitable_template( $template, $view_args );
56 + }
55 57
56 - /**
57 - * Display the widget form in the admin.
58 - *
59 - * @since 1.0.0
60 - *
61 - * @param array $instance The current settings for the widget options.
62 - * @return void
63 - */
64 - public function form( $instance ) {
65 - $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
66 - $taxonomy = isset( $instance['taxonomy'] ) ? $instance['taxonomy'] : 'campaign_category';
67 - $show_count = isset( $instance['show_count'] ) && $instance['show_count'];
68 - $hide_empty = isset( $instance['hide_empty'] ) && $instance['hide_empty'];
69 - $dropdown = isset( $instance['dropdown'] ) && $instance['dropdown'];
70 - ?>
71 - <p>
72 - <label for="<?php echo $this->get_field_id( 'title' ) ?>"><?php _e( 'Title:', 'charitable' ) ?></label>
73 - <input type="text" name="<?php echo $this->get_field_name('title' ) ?>" id="<?php echo $this->get_field_id( 'title' ) ?>" value="<?php echo $title ?>"/>
74 - </p>
75 - <p>
76 - <label for="<?php echo $this->get_field_id( 'taxonomy' ) ?>"><?php _e( 'Taxonomy', 'charitable' ) ?></label>
77 - <select name="<?php echo $this->get_field_name('taxonomy' ) ?>" id="<?php echo $this->get_field_id( 'taxonomy' ) ?>">
78 - <option value="campaign_category" <?php selected( 'campaign_category', $taxonomy ) ?>><?php _e( 'Categories', 'charitable' ) ?></option>
79 - <option value="campaign_tag" <?php selected( 'campaign_tag', $taxonomy ) ?>><?php _e( 'Tags', 'charitable' ) ?></option>
80 - </select>
81 - </p>
82 - <p>
83 - <label for="<?php echo $this->get_field_id( 'show_count' ) ?>"><?php _e( 'Show count:', 'charitable' ) ?></label>
84 - <input type="checkbox" name="<?php echo $this->get_field_name('show_count' ) ?>" id="<?php echo $this->get_field_id( 'show_count' ) ?>" <?php checked( $show_count ) ?> />
85 - </p>
86 - <p>
87 - <label for="<?php echo $this->get_field_id( 'hide_empty' ) ?>"><?php _e( 'Hide empty:', 'charitable' ) ?></label>
88 - <input type="checkbox" name="<?php echo $this->get_field_name('hide_empty' ) ?>" id="<?php echo $this->get_field_id( 'hide_empty' ) ?>" <?php checked( $hide_empty ) ?> />
89 - </p>
90 - <p>
91 - <label for="<?php echo $this->get_field_id( 'dropdown' ) ?>"><?php _e( 'Display as dropdown:', 'charitable' ) ?></label>
92 - <input type="checkbox" name="<?php echo $this->get_field_name( 'dropdown' ) ?>" id="<?php echo $this->get_field_id( 'dropdown' ) ?>" <?php checked( $dropdown ) ?> />
93 - </p>
94 - <?php
95 - }
58 + /**
59 + * Display the widget form in the admin.
60 + *
61 + * @since 1.0.0
62 + *
63 + * @param array $instance The current settings for the widget options.
64 + * @return void
65 + */
66 + public function form( $instance ) {
67 + $title = isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : '';
68 + $taxonomy = isset( $instance['taxonomy'] ) ? $instance['taxonomy'] : 'campaign_category';
69 + $show_count = isset( $instance['show_count'] ) && $instance['show_count'];
70 + $hide_empty = isset( $instance['hide_empty'] ) && $instance['hide_empty'];
71 + $dropdown = isset( $instance['dropdown'] ) && $instance['dropdown'];
72 + ?>
73 + <p>
74 + <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_attr_e( 'Title:', 'charitable' ); ?></label>
75 + <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" value="<?php echo esc_attr( $title ); ?>"/>
76 + </p>
77 + <p>
78 + <label for="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>"><?php esc_html_e( 'Taxonomy', 'charitable' ); ?></label>
79 + <select name="<?php echo esc_attr( $this->get_field_name( 'taxonomy' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'taxonomy' ) ); ?>">
80 + <option value="campaign_category" <?php selected( 'campaign_category', $taxonomy ); ?>><?php esc_html_e( 'Categories', 'charitable' ); ?></option>
81 + <option value="campaign_tag" <?php selected( 'campaign_tag', $taxonomy ); ?>><?php esc_html_e( 'Tags', 'charitable' ); ?></option>
82 + </select>
83 + </p>
84 + <p>
85 + <label for="<?php echo esc_attr( $this->get_field_id( 'show_count' ) ); ?>"><?php esc_html_e( 'Show count:', 'charitable' ); ?></label>
86 + <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_count' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'show_count' ) ); ?>" <?php checked( $show_count ); ?> />
87 + </p>
88 + <p>
89 + <label for="<?php echo esc_attr( $this->get_field_id( 'hide_empty' ) ); ?>"><?php esc_html_e( 'Hide empty:', 'charitable' ); ?></label>
90 + <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'hide_empty' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'hide_empty' ) ); ?>" <?php checked( $hide_empty ); ?> />
91 + </p>
92 + <p>
93 + <label for="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>"><?php esc_html_e( 'Display as dropdown:', 'charitable' ); ?></label>
94 + <input type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'dropdown' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'dropdown' ) ); ?>" <?php checked( $dropdown ); ?> />
95 + </p>
96 + <?php
97 + }
96 98
97 - /**
98 - * Update the widget settings in the admin.
99 - *
100 - * @since 1.0.0
101 - *
102 - * @param array $new_instance The updated settings.
103 - * @param array $new_instance The old settings.
104 - * @return void
105 - */
106 - public function update( $new_instance, $old_instance ) {
107 - $instance = array();
108 - $instance['title'] = isset( $new_instance['title'] ) ? $new_instance['title'] : $old_instance['title'];
109 - $instance['taxonomy'] = isset( $new_instance['taxonomy'] ) ? $new_instance['taxonomy'] : $old_instance['taxonomy'];
110 - $instance['show_count'] = isset( $new_instance['show_count'] ) && $new_instance['show_count'] == 'on';
111 - $instance['hide_empty'] = isset( $new_instance['hide_empty'] ) && $new_instance['hide_empty'] == 'on';
112 - $instance['dropdown'] = isset( $new_instance['dropdown'] ) && $new_instance['dropdown'] == 'on';
113 - return $instance;
114 - }
115 - }
99 + /**
100 + * Update the widget settings in the admin.
101 + *
102 + * @since 1.0.0
103 + *
104 + * @param array $new_instance The updated settings.
105 + * @param array $old_instance The old settings.
106 + * @return array
107 + */
108 + public function update( $new_instance, $old_instance ) {
109 + $instance = array();
110 + $instance['title'] = isset( $new_instance['title'] ) ? $new_instance['title'] : $old_instance['title'];
111 + $instance['taxonomy'] = isset( $new_instance['taxonomy'] ) ? $new_instance['taxonomy'] : $old_instance['taxonomy'];
112 + $instance['show_count'] = isset( $new_instance['show_count'] ) && $new_instance['show_count'] === 'on';
113 + $instance['hide_empty'] = isset( $new_instance['hide_empty'] ) && $new_instance['hide_empty'] === 'on';
114 + $instance['dropdown'] = isset( $new_instance['dropdown'] ) && $new_instance['dropdown'] === 'on';
115 + return $instance;
116 + }
117 + }
116 118
117 119 endif;