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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / widgets / class-wc-widget-brand-thumbnails.php
woocommerce / includes / widgets Last commit date
class-wc-widget-brand-description.php 1 year ago class-wc-widget-brand-nav.php 7 months ago class-wc-widget-brand-thumbnails.php 1 year ago class-wc-widget-cart.php 3 years ago class-wc-widget-layered-nav-filters.php 2 years ago class-wc-widget-layered-nav.php 3 months ago class-wc-widget-price-filter.php 8 months ago class-wc-widget-product-categories.php 7 months ago class-wc-widget-product-search.php 5 years ago class-wc-widget-product-tag-cloud.php 5 years ago class-wc-widget-products.php 1 year ago class-wc-widget-rating-filter.php 5 years ago class-wc-widget-recent-reviews.php 2 months ago class-wc-widget-recently-viewed.php 1 year ago class-wc-widget-top-rated-products.php 5 years ago
class-wc-widget-brand-thumbnails.php
236 lines
1 <?php
2
3 declare( strict_types = 1);
4
5 /**
6 * Brand Thumbnails Widget
7 *
8 * Show brand images as thumbnails
9 *
10 * Important: For internal use only by the Automattic\WooCommerce\Internal\Brands package.
11 *
12 * @package WooCommerce\Widgets
13 * @version 9.4.0
14 */
15 class WC_Widget_Brand_Thumbnails extends WP_Widget {
16
17 /**
18 * Widget CSS class.
19 *
20 * @var string
21 */
22 public $woo_widget_cssclass;
23
24 /**
25 * Widget description.
26 *
27 * @var string
28 */
29 public $woo_widget_description;
30
31 /**
32 * Widget id base.
33 *
34 * @var string
35 */
36 public $woo_widget_idbase;
37
38 /**
39 * Widget name.
40 *
41 * @var string
42 */
43 public $woo_widget_name;
44
45 /** Constructor */
46 public function __construct() {
47
48 /* Widget variable settings. */
49 $this->woo_widget_name = __( 'WooCommerce Brand Thumbnails', 'woocommerce' );
50 $this->woo_widget_description = __( 'Show a grid of brand thumbnails.', 'woocommerce' );
51 $this->woo_widget_idbase = 'wc_brands_brand_thumbnails';
52 $this->woo_widget_cssclass = 'widget_brand_thumbnails';
53
54 /* Widget settings. */
55 $widget_ops = array(
56 'classname' => $this->woo_widget_cssclass,
57 'description' => $this->woo_widget_description,
58 );
59
60 /* Create the widget. */
61 parent::__construct( $this->woo_widget_idbase, $this->woo_widget_name, $widget_ops );
62 }
63
64 /**
65 * Echoes the widget content.
66 *
67 * @see WP_Widget
68 *
69 * @param array $args Display arguments including 'before_title', 'after_title',
70 * 'before_widget', and 'after_widget'.
71 * @param array $instance The settings for the particular instance of the widget.
72 */
73 public function widget( $args, $instance ) {
74 $instance = wp_parse_args(
75 $instance,
76 array(
77 'title' => '',
78 'columns' => 1,
79 'exclude' => '',
80 'orderby' => 'name',
81 'hide_empty' => 0,
82 'number' => '',
83 )
84 );
85
86 $exclude = array_map( 'intval', explode( ',', $instance['exclude'] ) );
87 $order = 'name' === $instance['orderby'] ? 'asc' : 'desc';
88
89 $brands = get_terms(
90 array(
91 'taxonomy' => 'product_brand',
92 'hide_empty' => $instance['hide_empty'],
93 'orderby' => $instance['orderby'],
94 'exclude' => $exclude,
95 'number' => $instance['number'],
96 'order' => $order,
97 )
98 );
99
100 if ( ! $brands ) {
101 return;
102 }
103
104 /**
105 * Filter the widget's title.
106 *
107 * @since 9.4.0
108 *
109 * @param string $title Widget title
110 * @param array $instance The settings for the particular instance of the widget.
111 * @param string $woo_widget_idbase The widget's id base.
112 */
113 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->woo_widget_idbase );
114
115 echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput
116 if ( '' !== $title ) {
117 echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput
118 }
119
120 wc_get_template(
121 'widgets/brand-thumbnails.php',
122 array(
123 'brands' => $brands,
124 'columns' => (int) $instance['columns'],
125 'fluid_columns' => ! empty( $instance['fluid_columns'] ) ? true : false,
126 ),
127 'woocommerce',
128 WC()->plugin_path() . '/templates/brands/'
129 );
130
131 echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput
132 }
133
134 /**
135 * Update widget instance.
136 *
137 * @param array $new_instance The new settings for the particular instance of the widget.
138 * @param array $old_instance The old settings for the particular instance of the widget.
139 *
140 * @see WP_Widget->update
141 */
142 public function update( $new_instance, $old_instance ) {
143 $instance['title'] = wp_strip_all_tags( stripslashes( $new_instance['title'] ) );
144 $instance['columns'] = wp_strip_all_tags( stripslashes( $new_instance['columns'] ) );
145 $instance['fluid_columns'] = ! empty( $new_instance['fluid_columns'] ) ? true : false;
146 $instance['orderby'] = wp_strip_all_tags( stripslashes( $new_instance['orderby'] ) );
147 $instance['exclude'] = wp_strip_all_tags( stripslashes( $new_instance['exclude'] ) );
148 $instance['hide_empty'] = wp_strip_all_tags( stripslashes( (string) $new_instance['hide_empty'] ) );
149 $instance['number'] = wp_strip_all_tags( stripslashes( $new_instance['number'] ) );
150
151 if ( ! $instance['columns'] ) {
152 $instance['columns'] = 1;
153 }
154
155 if ( ! $instance['orderby'] ) {
156 $instance['orderby'] = 'name';
157 }
158
159 if ( ! $instance['exclude'] ) {
160 $instance['exclude'] = '';
161 }
162
163 if ( ! $instance['hide_empty'] ) {
164 $instance['hide_empty'] = 0;
165 }
166
167 if ( ! $instance['number'] ) {
168 $instance['number'] = '';
169 }
170
171 return $instance;
172 }
173
174 /**
175 * Outputs the settings update form.
176 *
177 * @param array $instance Current settings.
178 */
179 public function form( $instance ) {
180 if ( ! isset( $instance['hide_empty'] ) ) {
181 $instance['hide_empty'] = 0;
182 }
183
184 if ( ! isset( $instance['orderby'] ) ) {
185 $instance['orderby'] = 'name';
186 }
187
188 if ( empty( $instance['fluid_columns'] ) ) {
189 $instance['fluid_columns'] = false;
190 }
191
192 ?>
193 <p>
194 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'woocommerce' ); ?></label>
195 <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" value="<?php echo isset( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?>" />
196 </p>
197
198 <p>
199 <label for="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>"><?php esc_html_e( 'Columns:', 'woocommerce' ); ?></label>
200 <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'columns' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'columns' ) ); ?>" value="<?php echo isset( $instance['columns'] ) ? esc_attr( $instance['columns'] ) : '1'; ?>" />
201 </p>
202
203 <p>
204 <label for="<?php echo esc_attr( $this->get_field_id( 'fluid_columns' ) ); ?>"><?php esc_html_e( 'Fluid columns:', 'woocommerce' ); ?></label>
205 <input type="checkbox" <?php checked( $instance['fluid_columns'] ); ?> id="<?php echo esc_attr( $this->get_field_id( 'fluid_columns' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'fluid_columns' ) ); ?>" />
206 </p>
207
208 <p>
209 <label for="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>"><?php esc_html_e( 'Number:', 'woocommerce' ); ?></label>
210 <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'number' ) ); ?>" value="<?php if ( isset ( $instance['number'] ) ) { echo esc_attr( $instance['number'] ); } // phpcs:ignore ?>" placeholder="<?php esc_attr_e( 'All', 'woocommerce' ); ?>" />
211 </p>
212
213 <p>
214 <label for="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>"><?php esc_html_e( 'Exclude:', 'woocommerce' ); ?></label>
215 <input type="text" class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'exclude' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'exclude' ) ); ?>" value="<?php if ( isset ( $instance['exclude'] ) ) { echo esc_attr( $instance['exclude'] ); } // phpcs:ignore ?>" placeholder="<?php esc_attr_e( 'None', 'woocommerce' ); ?>" />
216 </p>
217
218 <p>
219 <label for="<?php echo esc_attr( $this->get_field_id( 'hide_empty' ) ); ?>"><?php esc_html_e( 'Hide empty brands:', 'woocommerce' ); ?></label>
220 <select id="<?php echo esc_attr( $this->get_field_id( 'hide_empty' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'hide_empty' ) ); ?>">
221 <option value="1" <?php selected( $instance['hide_empty'], 1 ); ?>><?php esc_html_e( 'Yes', 'woocommerce' ); ?></option>
222 <option value="0" <?php selected( $instance['hide_empty'], 0 ); ?>><?php esc_html_e( 'No', 'woocommerce' ); ?></option>
223 </select>
224 </p>
225
226 <p>
227 <label for="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>"><?php esc_html_e( 'Order by:', 'woocommerce' ); ?></label>
228 <select id="<?php echo esc_attr( $this->get_field_id( 'orderby' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'orderby' ) ); ?>">
229 <option value="name" <?php selected( $instance['orderby'], 'name' ); ?>><?php esc_html_e( 'Name', 'woocommerce' ); ?></option>
230 <option value="count" <?php selected( $instance['orderby'], 'count' ); ?>><?php esc_html_e( 'Count', 'woocommerce' ); ?></option>
231 </select>
232 </p>
233 <?php
234 }
235 }
236