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.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 All 211 releases
← All changes | includes/widgets/class-charitable-campaigns-widget.php +36 -35 1.6.7 → 1.8.13 View file →
@@ -1,17 +1,19 @@
1 1 <?php
2 2 /**
3 3 * Campaigns widget class.
4 4 *
5 - * @class Charitable_Campaigns_Widget
6 - * @version 1.0.0
7 - * @package Charitable/Widgets/Campaigns Widget
8 - * @category Class
9 - * @author Eric Daams
5 + * @class Charitable_Campaigns_Widget
6 + * @version 1.0.0
7 + * @package Charitable/Widgets/Campaigns Widget
8 + * @category Class
9 + * @author David Bisset
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_Campaigns_Widget' ) ) :
16 18
17 19 /**
@@ -30,9 +32,9 @@
30 32 parent::__construct(
31 33 'charitable_campaigns_widget',
32 34 __( 'Campaigns', 'charitable' ),
33 35 array(
34 - 'description' => __( 'Displays your Charitable campaigns.', 'charitable' ),
36 + 'description' => __( 'Displays your Charitable campaigns.', 'charitable' ),
35 37 'customize_selective_refresh' => true,
36 38 )
37 39 );
38 40 }
@@ -41,17 +43,16 @@
41 43 * Display the widget contents on the front-end.
42 44 *
43 45 * @since 1.0.0
44 46 *
45 - * @param array $args
46 - * @param array $instance
47 + * @param array $args The widget arguments.
48 + * @param array $instance The widget instance.
47 49 */
48 50 public function widget( $args, $instance ) {
49 -
50 51 $view_args = array_merge( $args, $instance );
51 - $view_args['campaigns'] = $this->get_widget_campaigns( $instance );
52 + $view_args['campaigns'] = $this->get_widget_campaigns( $instance );
52 53
53 - charitable_template( 'widgets/campaigns.php', $view_args );
54 + charitable_template( 'widgets/campaigns.php', $view_args );
54 55 }
55 56
56 57 /**
57 58 * Display the widget form in the admin.
@@ -57,38 +58,38 @@
57 58 * Display the widget form in the admin.
58 59 *
59 60 * @since 1.0.0
60 61 *
61 - * @param array $instance The current settings for the widget options.
62 - * @return void
62 + * @param array $instance The current settings for the widget options.
63 + * @return void
63 64 */
64 65 public function form( $instance ) {
65 66 $defaults = array(
66 - 'title' => '',
67 - 'number' => 10,
68 - 'order' => 'recent',
69 - 'show_thumbnail' => false,
70 - );
67 + 'title' => '',
68 + 'number' => 10,
69 + 'order' => 'recent',
70 + 'show_thumbnail' => false,
71 + );
71 72
72 - $args = wp_parse_args( $instance, $defaults );
73 + $args = wp_parse_args( $instance, $defaults );
73 74 ?>
74 75 <p>
75 - <label for="<?php echo $this->get_field_id( 'title' ) ?>"><?php _e( 'Title:', 'charitable' ) ?></label>
76 - <input type="text" name="<?php echo $this->get_field_name( 'title' ) ?>" id="<?php echo $this->get_field_id( 'title' ) ?>" value="<?php echo $args['title'] ?>"/>
76 + <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'charitable' ); ?></label>
77 + <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( $args['title'] ); ?>"/>
77 78 </p>
78 79 <p>
79 - <label for="<?php echo $this->get_field_id( 'number' ) ?>"><?php _e( 'Number of campaigns to display:', 'charitable' ) ?></label>
80 - <input type="text" name="<?php echo $this->get_field_name( 'number' ) ?>" id="<?php echo $this->get_field_id( 'number' ) ?>" value="<?php echo $args['number'] ?>" />
80 + <label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number of campaigns to display:', 'charitable' ); ?></label>
81 + <input type="text" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" value="<?php echo esc_attr( $args['number'] ); ?>" />
81 82 </p>
82 - <p>
83 - <input id="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ) ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_thumbnail' ) ); ?>" <?php checked( $args['show_thumbnail'] ) ?>>
84 - <label for="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ) ?>"><?php _e( 'Show thumbnail', 'charitable' ) ?></label>
83 + <p>
84 + <input id="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>" type="checkbox" name="<?php echo esc_attr( $this->get_field_name( 'show_thumbnail' ) ); ?>" <?php checked( $args['show_thumbnail'] ); ?>>
85 + <label for="<?php echo esc_attr( $this->get_field_id( 'show_thumbnail' ) ); ?>"><?php esc_html_e( 'Show thumbnail', 'charitable' ); ?></label>
85 86 </p>
86 87 <p>
87 - <label for="<?php echo $this->get_field_id( 'order' ) ?>"><?php _e( 'Order:', 'charitable' ) ?></label>
88 - <select name="<?php echo $this->get_field_name( 'order' ) ?>" id="<?php echo $this->get_field_id( 'order' ) ?>">
89 - <option value="recent" <?php selected( 'recent', $args['order'] ) ?>><?php _e( 'Date published', 'charitable' ) ?></option>
90 - <option value="ending" <?php selected( 'ending', $args['order'] ) ?>><?php _e( 'Ending soonest', 'charitable' ) ?></option>
88 + <label for="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>"><?php esc_html_e( 'Order:', 'charitable' ); ?></label>
89 + <select name="<?php echo esc_attr( $this->get_field_name( 'order' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'order' ) ); ?>">
90 + <option value="recent" <?php selected( 'recent', $args['order'] ); ?>><?php esc_html_e( 'Date published', 'charitable' ); ?></option>
91 + <option value="ending" <?php selected( 'ending', $args['order'] ); ?>><?php esc_html_e( 'Ending soonest', 'charitable' ); ?></option>
91 92 </select>
92 93 </p>
93 94 <?php
94 95 }
@@ -97,11 +98,11 @@
97 98 * Update the widget settings in the admin.
98 99 *
99 100 * @since 1.0.0
100 101 *
101 - * @param array $new_instance The updated settings.
102 - * @param array $new_instance The old settings.
103 - * @return void
102 + * @param array $new_instance The updated settings.
103 + * @param array $old_instance The old settings.
104 + * @return array
104 105 */
105 106 public function update( $new_instance, $old_instance ) {
106 107
107 108 $instance = array();
@@ -116,9 +117,9 @@
116 117 * Return campaigns to display in the widget.
117 118 *
118 119 * @since 1.0.0
119 120 *
120 - * @param array $instance
121 + * @param array $instance The widget instance.
121 122 * @return WP_Query
122 123 */
123 124 protected function get_widget_campaigns( $instance ) {
124 125