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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
<?php /** * Settings meta box. * * @since 3.0 * @package WP_Smush * * @var string $site_language Site language. * @var string $translation_link Link to plugin translation page. * @var array $settings Settings values. * @var array $settings_data Settings labels and descriptions. * @var array $settings_group Settings group. * @var mixed $networkwide Network wide settings. */
if ( ! defined( 'WPINC' ) ) { die; }
?>
<div class="sui-box-settings-row" xmlns="http://www.w3.org/1999/html"> <div class="sui-box-settings-col-1"> <span class="sui-settings-label "><?php esc_html_e( 'Translations', 'wp-smushit' ); ?></span> <span class="sui-description"> <?php printf( /* translators: %1$s: opening a tag, %2$s: closing a tag */ esc_html__( 'By default, Smush will use the language you’d set in your %1$sWordPress Admin Settings%2$s if a matching translation is available.', 'wp-smushit' ), '<a href="' . esc_html( admin_url( 'options-general.php' ) ) . '">', '</a>' ); ?> </span> </div> <div class="sui-box-settings-col-2"> <div class="sui-form-field"> <label for="language-input" class="sui-label"> <?php esc_html_e( 'Active Translation', 'wp-smushit' ); ?> </label> <input type="text" id="language-input" class="sui-form-control" disabled="disabled" placeholder="<?php echo esc_attr( $site_language ); ?>"> <span class="sui-description"> <?php printf( /* translators: %1$s: opening a tag, %2$s: closing a tag */ esc_html__( 'Not using your language, or have improvements? Help us improve translations by providing your own improvements %1$shere%2$s.', 'wp-smushit' ), '<a href="' . esc_html( $translation_link ) . '" target="_blank">', '</a>' ); ?> </span> </div> </div> </div>
<form id="wp-smush-settings-form" method="post"> <input type="hidden" name="setting_form" id="setting_form" value="settings"> <?php if ( is_multisite() && is_network_admin() ) : ?> <input type="hidden" name="setting-type" value="network"> <?php endif; ?>
<?php wp_nonce_field( 'save_wp_smush_options', 'wp_smush_options_nonce', '', true ); foreach ( $settings_data as $name => $values ) { if ( ! in_array( $name, $settings_group, true ) ) { continue; }
$label = ! empty( $settings_data[ $name ]['short_label'] ) ? $settings_data[ $name ]['short_label'] : $settings_data[ $name ]['label'];
// Show settings option. $this->settings_row( WP_SMUSH_PREFIX . $name, $label, $name, $settings[ $name ] ); } ?>
<?php if ( is_multisite() && is_network_admin() ) : ?> <div class="sui-box-settings-row"> <div class="sui-box-settings-col-1"> <span class="sui-settings-label"><?php echo esc_html( $settings_data['networkwide']['short_label'] ); ?></span> <span class="sui-description"><?php echo esc_html( $settings_data['networkwide']['desc'] ); ?></span> </div>
<div class="sui-box-settings-col-2"> <div class="sui-side-tabs sui-tabs"> <div data-tabs> <?php $selected = is_array( $networkwide ) ? 'custom' : $networkwide; ?> <label for="access-none" class="sui-tab-item <?php echo ! $networkwide ? 'active' : ''; ?>"> <input type="radio" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>subsite-access" value="0" id="access-none" <?php checked( $selected, false ); ?>> <?php esc_html_e( 'None', 'wp-smushit' ); ?> </label> <label for="access-all" class="sui-tab-item <?php echo '1' === $networkwide ? 'active' : ''; ?>"> <input type="radio" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>subsite-access" value="1" id="access-all" <?php checked( $selected, '1' ); ?>> <?php esc_html_e( 'All', 'wp-smushit' ); ?> </label> <label for="access-custom" class="sui-tab-item <?php echo is_array( $networkwide ) ? 'active' : ''; ?>"> <input type="radio" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>subsite-access" value="custom" id="access-custom" <?php checked( $selected, 'custom' ); ?>> <?php esc_html_e( 'Custom', 'wp-smushit' ); ?> </label> </div>
<div data-panes> <div class="sui-notice sui-notice-info <?php echo ! $networkwide ? 'active' : ''; ?>"> <div class="sui-notice-content"> <div class="sui-notice-message"> <i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i> <p><?php esc_html_e( "Subsite admins can't override any module settings and will always inherit your network settings.", 'wp-smushit' ); ?></p> </div> </div> </div> <div class="sui-notice sui-notice-info <?php echo '1' === $networkwide ? 'active' : ''; ?>"> <div class="sui-notice-content"> <div class="sui-notice-message"> <i class="sui-notice-icon sui-icon-info sui-md" aria-hidden="true"></i> <p><?php esc_html_e( 'Subsite admins can override all module settings.', 'wp-smushit' ); ?></p> </div> </div> </div> <div class="sui-tab-boxed <?php echo is_array( $networkwide ) ? 'active' : ''; ?>"> <p class="sui-description"> <?php esc_html_e( 'Choose which modules settings subsite admins have access to.', 'wp-smushit' ); ?> </p>
<label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-bulk" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="bulk" <?php checked( ! is_array( $networkwide ) || in_array( 'bulk', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'Bulk Smush', 'wp-smushit' ); ?></span> </label> <label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-integrations" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="integrations" <?php checked( ! is_array( $networkwide ) || in_array( 'integrations', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'Integrations', 'wp-smushit' ); ?></span> </label> <label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-lazy_load" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="lazy_load" <?php checked( ! is_array( $networkwide ) || in_array( 'lazy_load', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'Lazy Load', 'wp-smushit' ); ?></span> </label> <label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-cdn" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="cdn" <?php checked( ! is_array( $networkwide ) || in_array( 'cdn', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'CDN', 'wp-smushit' ); ?></span> </label> <label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-tools" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="tools" <?php checked( ! is_array( $networkwide ) || in_array( 'tools', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'Tools', 'wp-smushit' ); ?></span> </label> <?php // Don't display if Dashboard's whitelabel is hiding documentation. ?> <?php if ( ! apply_filters( 'wpmudev_branding_hide_doc_link', false ) ) : ?> <label class="sui-checkbox sui-checkbox-stacked sui-checkbox-sm"> <input type="checkbox" id="module-tutorials" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>access[]" value="tutorials" <?php checked( ! is_array( $networkwide ) || in_array( 'tutorials', $networkwide, true ) ); ?>> <span aria-hidden="true"> </span> <span><?php esc_html_e( 'Tutorials', 'wp-smushit' ); ?></span> </label> <?php endif; ?> </div> </div> </div> </div> </div> <?php endif; ?>
<div class="sui-box-settings-row smush-keep-data-form-row"> <div class="sui-box-settings-col-1"> <span class="sui-settings-label"><?php echo esc_html( $settings_data['keep_data']['short_label'] ); ?></span> <span class="sui-description"><?php echo esc_html( $settings_data['keep_data']['desc'] ); ?></span> </div>
<div class="sui-box-settings-col-2"> <?php if ( $this->should_render( 'tools' ) ) : ?> <strong><?php esc_html_e( 'Restore Images', 'wp-smushit' ); ?></strong> <span class="sui-description"> <?php esc_html_e( 'Made a mistake? No worries. We have a built-in bulk restore tool that will restore your image thumbnails to their original state.', 'wp-smushit' ); ?> </span> <span class="sui-description sui-margin-bottom"> <?php printf( /* translators: %1$s - <a> link, %2$s - </a> */ esc_html__( 'Navigate to %1$sTools%2$s to begin the process.', 'wp-smushit' ), '<a href="' . esc_url( $this->get_page_url() ) . '&view=tools">', '</a>' ); ?> </span> <?php endif; ?>
<strong><?php echo esc_html( $settings_data['keep_data']['label'] ); ?></strong> <span class="sui-description"> <?php esc_html_e( 'When you uninstall the plugin, what do you want to do with your settings? You can save them for next time, or wipe them back to factory settings.', 'wp-smushit' ); ?> </span>
<div class="sui-side-tabs"> <div class="sui-tabs-menu"> <label for="keep_data-true" class="sui-tab-item <?php echo $settings['keep_data'] ? 'active' : ''; ?>"> <input type="radio" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>keep_data" value="1" id="keep_data-true" <?php checked( $settings['keep_data'] ); ?>> <?php esc_html_e( 'Keep', 'wp-smushit' ); ?> </label>
<label for="keep_data-false" class="sui-tab-item <?php echo $settings['keep_data'] ? '' : 'active'; ?>"> <input type="radio" name="<?php echo esc_attr( WP_SMUSH_PREFIX ); ?>keep_data" value="0" id="keep_data-false" <?php checked( ! $settings['keep_data'] ); ?>> <?php esc_html_e( 'Delete', 'wp-smushit' ); ?> </label> </div> </div>
<strong><?php esc_html_e( 'Reset Factory Settings', 'wp-smushit' ); ?></strong> <span class="sui-description"> <?php esc_html_e( 'Need to revert back to the default settings? This button will instantly reset your settings to the defaults.', 'wp-smushit' ); ?> </span>
<button class="sui-button sui-button-ghost" data-modal-open="wp-smush-reset-settings-dialog" data-modal-open-focus="reset-setting-confirm" data-modal-mask="true"> <i class="sui-icon-undo" aria-hidden="true"></i> <?php esc_html_e( 'Reset Settings', 'wp-smushit' ); ?> </button> </div> </div>
<div class="sui-box-settings-row"> <div class="sui-box-settings-col-1"> <span class="sui-settings-label"><?php echo esc_html( $settings_data['api_auth']['short_label'] ); ?></span> <span class="sui-description"><?php echo esc_html( $settings_data['api_auth']['desc'] ); ?></span> </div>
<div class="sui-box-settings-col-2"> <button type="button" class="sui-button sui-button-ghost" id="wp-smush-update-api-status"> <span class="sui-loading-text"> <i class="sui-icon-undo" aria-hidden="true"></i> <?php esc_html_e( 'Update API status', 'wp-smushit' ); ?> </span> <i class="sui-icon-loader sui-loading" aria-hidden="true"></i> </button> </div> </div>
</form>
|