PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.1
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.1
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / views / input / selector.php

selector.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.1, at views/input/selector.php

48 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
3
4 if ( empty( $data['values'] ) || empty( $data['name'] ) ) {
5 return;
6 }
7
8 if ( ! isset( $data['value'] ) ) {
9 $data['value'] = key( $data['values'] );
10 }
11
12 if ( empty( $data['current_label'] ) ) {
13 $data['current_label'] = __( 'Current value:', 'imagify' );
14 }
15
16 if ( ! isset( $data['values'][ $data['value'] ] ) ) {
17 return;
18 }
19
20 $list_id = str_replace( [ '[', ']' ], [ '-', '' ], $data['name'] );
21 $list_id = 'imagify-' . $list_id . '-selector-list';
22 ?>
23
24 <div class="imagify-selector">
25 <span class="hide-if-js">
26 <?php echo esc_html( $data['current_label'] ); ?>
27 <span class="imagify-selector-current-value-info"><?php echo $data['values'][ $data['value'] ]; ?></span>
28 </span>
29
30 <button aria-controls="<?php echo esc_attr( $list_id ); ?>" type="button" class="button imagify-button-clean hide-if-no-js imagify-selector-button">
31 <span class="imagify-selector-current-value-info"><?php echo $data['values'][ $data['value'] ]; ?></span>
32 </button>
33
34 <ul id="<?php echo esc_attr( $list_id ); ?>" role="listbox" aria-orientation="vertical" aria-hidden="true" class="imagify-selector-list hide-if-no-js">
35 <?php
36 foreach ( $data['values'] as $val => $label ) {
37 $input_id = $list_id . '-' . sanitize_html_class( $val );
38 ?>
39 <li class="imagify-selector-choice<?php echo $val === $data['value'] ? ' imagify-selector-current-value" aria-current="true' : ''; ?>" role="option">
40 <input type="radio" name="<?php echo esc_attr( $data['name'] ); ?>" value="<?php echo esc_attr( $val ); ?>" id="<?php echo esc_attr( $input_id ); ?>" <?php checked( $val, $data['value'] ); ?> class="screen-reader-text">
41 <label for="<?php echo esc_attr( $input_id ); ?>"><?php echo $label; ?></label>
42 </li>
43 <?php
44 }
45 ?>
46 </ul>
47 </div>
48