PluginProbe
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress / 4.1.1
QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress v4.1.1
4.1.1 4.1.0 4.0.1 4.0.0 3.3.1 3.3.0 trunk 1.0.0 2.0.0 2.1.0 3.0.0 3.1.0 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8
quickwebp / admin / components / button-group.php

button-group.php in QuickWebP – WebP & AVIF Image Optimizer, Compression & SEO for WordPress 4.1.1, at admin/components/button-group.php

56 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
4 /**
5 * Button group component for the settings page
6 */
7 $quickwebp_key_option = sanitize_key( $data['name'] );
8
9 //phpcs:ignore WordPress.Security.NonceVerification.Missing
10 if ( isset( $quickwebp_key_option, $_POST[ $quickwebp_key_option ] ) ) {
11 //phpcs:ignore WordPress.Security.NonceVerification.Missing
12 $quickwebp_value_to_save = sanitize_text_field( wp_unslash( $_POST[ $quickwebp_key_option ] ) );
13 update_option( $quickwebp_key_option, $quickwebp_value_to_save );
14 }
15
16 $quickwebp_conversion = get_option( $quickwebp_key_option, quickwebp_settings_default( $quickwebp_key_option ) );
17
18 if ( isset( $data['options'] ) && is_array( $data['options'] ) ) {
19 ?><span class="quickwebp-button-group"><?php
20
21 foreach( $data['options'] as $quickwebp_option ) {
22 ?>
23 <label class="quickwebp-button-group__item <?php echo esc_attr( $quickwebp_option['parent_classes'] ?? '' ); ?>">
24 <input class="<?php echo esc_attr( $quickwebp_option['classes'] ?? ''); ?>" type="radio" name="<?php echo esc_attr( $quickwebp_key_option ?? '' ); ?>" value="<?php echo esc_attr( $quickwebp_option['value'] ?? '' ); ?>" <?php checked( $quickwebp_conversion, $quickwebp_option['value'] ?? '' ); disabled( isset( $quickwebp_option['disabled'] ) && $quickwebp_option['disabled'] ); ?>>
25 <span class="quickwebp-button-group__item__content">
26 <span class="quickwebp-button-group__item__content__text" style="color: <?php echo esc_attr( $quickwebp_option['color'] ?? '' ); ?>;">
27 <?php echo esc_html( $quickwebp_option['label'] ?? '' ); ?>
28 </span>
29 <span class="quickwebp-button-group__item__content__desc">
30 <?php echo esc_html( $quickwebp_option['desc'] ?? '' ); ?>
31 </span>
32 </span>
33 <span class="quickwebp-button-group__item__check">
34 <?php echo wp_kses( file_get_contents( QUICKWEBP_PLUGIN_PATH . 'public/assets/svg/check.svg' ), quickwebp_allowed_tags_for_svg_files() ); ?>
35 </span>
36 <?php
37 if ( isset( $quickwebp_option['taglines'] ) && is_array( $quickwebp_option['taglines']) ) {
38 foreach( $quickwebp_option['taglines'] as $quickwebp_tagline ) {
39 if ( isset( $quickwebp_tagline['show'] ) && ! $quickwebp_tagline['show'] ) {
40 continue;
41 }
42 ?>
43 <span class="quickwebp-button-group__item__tagline <?php echo esc_attr( strtolower( $quickwebp_tagline['value'] ?? '' ) ); ?>">
44 <?php echo esc_html( $quickwebp_tagline['label'] ?? '' ); ?>
45 </span>
46 <?php
47 }
48 }
49 ?>
50 </label>
51 <?php
52 }
53
54 ?></span><?php
55 }
56