lossy-level.php
5.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<?php
/**
* Compression Level.
*
* @var $name string Compression field name.
* @var $value mixed Current compression value.
*/
use Smush\Core\Settings;
$settings = Settings::get_instance();
$lossy_level_setting = $settings->get_lossy_level_setting();
$level_basic = Settings::LEVEL_LOSSLESS;
$level_super = Settings::LEVEL_SUPER_LOSSY;
$level_ultra = Settings::LEVEL_ULTRA_LOSSY;
$level_labels = array(
Settings::LEVEL_LOSSLESS => __( 'Basic', 'wp-smushit' ),
Settings::LEVEL_SUPER_LOSSY => __( 'Super', 'wp-smushit' ),
Settings::LEVEL_ULTRA_LOSSY => __( 'Ultra', 'wp-smushit' ),
);
$level_notices = array(
Settings::LEVEL_LOSSLESS => sprintf(
/* translators: 1: opening <strong>, 2: closing </strong> */
__( '%1$sBasic:%2$s Achieve flawless, lossless compression for pixel-perfect images. Minimal file size reduction, negligible impact on speed.', 'wp-smushit' ),
'<strong>',
'</strong>'
),
Settings::LEVEL_SUPER_LOSSY => sprintf(
/* translators: 1: opening <strong>, 2: closing </strong> */
__( '%1$sSuper:%2$s Harness the power of lossy compression for substantial file size reduction with excellent image clarity. Accelerate page loads for better performance.', 'wp-smushit' ),
'<strong>',
'</strong>'
),
Settings::LEVEL_ULTRA_LOSSY => sprintf(
/* translators: 1: opening <strong>, 2: closing </strong> */
__( '%1$sUltra:%2$s Unlock unprecedented compression levels up to 5x greater than Super, while preserving remarkable image quality. The ultimate choice for unparalleled performance.', 'wp-smushit' ),
'<strong>',
'</strong>'
),
);
?>
<div class="sui-tabs sui-side-tabs wp-smush-lossy-level-tabs">
<div role="tablist" class="sui-tabs-menu">
<!-- Basic -->
<button
type="button"
role="tab"
id="lossy-level__basic"
class="sui-tab-item<?php echo $level_basic === $lossy_level_setting ? ' active' : ''; ?>"
aria-controls="lossy-level__basic-notice">
<?php echo esc_html( $settings->get_lossy_level_label( $level_basic ) ); ?>
</button>
<input
type="radio"
class="sui-screen-reader-text"
aria-hidden="true"
name="<?php echo esc_attr( $name ); ?>"
aria-labelledby="<?php echo esc_attr( $name . '-label' ); ?>"
aria-describedby="<?php echo esc_attr( $name . '-desc' ); ?>"
value="<?php echo (int) $level_basic; ?>"
<?php checked( $lossy_level_setting, $level_basic, true ); ?> />
<!-- Super -->
<button
type="button"
role="tab"
id="lossy-level__super"
class="sui-tab-item<?php echo $level_super === $lossy_level_setting ? ' active' : ''; ?>"
aria-controls="lossy-level__super-notice"
tabindex="-1">
<?php echo esc_html( $settings->get_lossy_level_label( $level_super ) ); ?>
</button>
<input
type="radio"
class="sui-screen-reader-text"
aria-hidden="true"
name="<?php echo esc_attr( $name ); ?>"
aria-labelledby="<?php echo esc_attr( $name . '-label' ); ?>"
aria-describedby="<?php echo esc_attr( $name . '-desc' ); ?>"
value="<?php echo (int) $level_super; ?>"
<?php checked( $lossy_level_setting, $level_super, true ); ?> />
<!-- Ultra -->
<?php if ( WP_Smush::is_pro() ) : ?>
<button
type="button"
role="tab"
id="lossy-level__ultra"
class="sui-tab-item<?php echo $level_ultra === $lossy_level_setting ? ' active' : ''; ?>"
aria-controls="lossy-level__ultra-notice"
tabindex="-1">
<?php echo esc_html( $settings->get_lossy_level_label( $level_ultra ) ); ?>
</button>
<input
type="radio"
class="sui-screen-reader-text"
aria-hidden="true"
name="<?php echo esc_attr( $name ); ?>"
aria-labelledby="<?php echo esc_attr( $name . '-label' ); ?>"
aria-describedby="<?php echo esc_attr( $name . '-desc' ); ?>"
value="<?php echo (int) $level_ultra; ?>"
<?php checked( $lossy_level_setting, $level_ultra, true ); ?> />
<?php else :
$utm_link = $this->get_utm_link(
array(
'utm_campaign' => 'smush_ultra_bulksmush_radio',
)
);
?>
<a target="_blank" href="<?php echo esc_url( $utm_link ); ?>" class="sui-tab-item wp-smush-ultra-compression-link wp-smush-upsell-ultra-compression">
<?php esc_html_e( '🚀 Ultra - unlock 5x more compression', 'wp-smushit' ); ?>
<span class="sui-icon-open-new-window" aria-hidden="true"></span>
</a>
<?php endif; ?>
</div>
<div class="sui-tabs-content">
<div role="tabpanel"
id="lossy-level__basic-notice"
class="sui-tab-content<?php echo $level_basic === $lossy_level_setting ? ' active' : ''; ?>"
aria-labelledby="lossy-level__basic"
tabindex="0">
<p>
<i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i>
<?php
echo wp_kses(
$level_notices[ $level_basic ],
array(
'strong' => array(),
)
);
?>
</p>
</div>
<div role="tabpanel"
id="lossy-level__super-notice"
class="sui-tab-content<?php echo $level_super === $lossy_level_setting ? ' active' : ''; ?>"
aria-labelledby="lossy-level__super"
tabindex="0"
hidden>
<p>
<i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i>
<?php
echo wp_kses(
$level_notices[ $level_super ],
array(
'strong' => array(),
)
);
?>
</p>
</div>
<div role="tabpanel"
id="lossy-level__ultra-notice"
class="sui-tab-content<?php echo $level_ultra === $lossy_level_setting ? ' active' : ''; ?>"
aria-labelledby="lossy-level__ultra"
tabindex="0"
hidden>
<p>
<i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i>
<?php
echo wp_kses(
$level_notices[ $level_ultra ],
array(
'strong' => array(),
)
);
?>
</p>
</div>
</div>
</div>