PluginProbe ʕ •ᴥ•ʔ
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF / trunk
Robin Image Optimizer – Unlimited Image Optimization, WebP & AVIF vtrunk
2.0.6 2.0.5 trunk 1.3.7 1.4.0 1.4.1 1.4.2 1.4.6 1.5.0 1.5.3 1.5.6 1.5.8 1.6.5 1.6.6 1.6.9 1.7.0 1.7.4 1.8.1 1.8.2 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4
robin-image-optimizer / admin / pages / class-rio-settings.php
robin-image-optimizer / admin / pages Last commit date
class-rio-license.php 3 months ago class-rio-log.php 7 months ago class-rio-page.php 7 months ago class-rio-settings.php 7 months ago class-rio-statistic.php 7 months ago index.php 3 years ago
class-rio-settings.php
688 lines
1 <?php
2 // Exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 /**
8 * Класс отвечает за работу страницы настроек
9 *
10 * @version 1.0
11 */
12 class WRIO_SettingsPage extends WRIO_Page {
13
14 /**
15 * {@inheritdoc}
16 */
17 public $id = 'rio_settings';
18
19 /**
20 * {@inheritdoc}
21 */
22 public $page_menu_dashicon = 'dashicons-admin-generic';
23
24 /**
25 * {@inheritdoc}
26 *
27 * @var string
28 */
29 public $page_parent_page = 'rio_general';
30
31 /**
32 * {@inheritdoc}
33 *
34 * @var bool
35 */
36 public $show_right_sidebar_in_options = false;
37
38 /**
39 * {@inheritDoc}
40 *
41 * @since 1.1.3 - Added
42 * @var bool
43 */
44 public $show_bottom_sidebar = true;
45
46 /**
47 * @var bool
48 */
49 public $show_search_options_form = false;
50
51 /**
52 * Menu target for WordPress admin submenu.
53 *
54 * @var string
55 */
56 public $menu_target = 'rio_general-robin-image-optimizer';
57
58 /**
59 * Use admin.php as base URL instead of menu_target.
60 *
61 * @var bool
62 */
63 public $custom_target = true;
64
65 /**
66 * @var bool
67 */
68 public $internal = false;
69
70 /**
71 * @param WRIO_Plugin $plugin
72 */
73 public function __construct( WRIO_Plugin $plugin ) {
74
75 $this->menu_title = __( 'Settings', 'robin-image-optimizer' );
76 $this->page_menu_short_description = __( 'Plugin configuration', 'robin-image-optimizer' );
77
78 if ( defined( 'WBCR_CLEARFY_PLUGIN_ACTIVE' ) ) {
79 $this->show_search_options_form = true;
80 }
81
82 add_filter(
83 'wbcr/factory/option_image_optimization_type',
84 function ( $option_value ) {
85 if ( ! wrio_is_license_activate() && $option_value === 'background' ) {
86 $option_value = 'schedule';
87 }
88
89 return $option_value;
90 }
91 );
92
93 add_filter(
94 'wbcr/factory/option_convert_avif_format',
95 function ( $option_value ) {
96 if ( ! wrio_is_license_activate() && $option_value ) {
97 $option_value = false;
98 }
99
100 return $option_value;
101 }
102 );
103
104 parent::__construct( $plugin );
105 }
106
107 /**
108 * Подключаем скрипты и стили для страницы
109 *
110 * @return void
111 * @since 1.0.0
112 * @see Wbcr_FactoryPages600_AdminPage
113 */
114 public function assets( $scripts, $styles ) {
115 parent::assets( $scripts, $styles );
116
117 $this->styles->add( WRIO_PLUGIN_URL . '/admin/assets/css/base-statistic.css' );
118 $this->scripts->add( WRIO_PLUGIN_URL . '/admin/assets/js/restore-backup.js' );
119
120 if ( ! wrio_is_license_activate() ) {
121 $this->styles->add( WRIO_PLUGIN_URL . '/admin/assets/css/settings-premium.css' );
122 $this->scripts->add( WRIO_PLUGIN_URL . '/admin/assets/js/settings-premium.js' );
123 }
124
125 if ( defined( 'WBCR_CLEARFY_PLUGIN_ACTIVE' ) ) {
126 $this->styles->add( WCL_PLUGIN_URL . '/admin/assets/css/general.css' );
127 }
128 }
129
130
131 /**
132 * Выводим предупреждения
133 */
134 protected function warningNotice() {
135 $upload_dir = wp_upload_dir();
136
137 if ( ! wp_is_writable( $upload_dir['basedir'] ) ) {
138 $this->printErrorNotice(
139 sprintf(
140 // translators: %s is the folder path.
141 __( 'Folder %s is unavailable for writing', 'robin-image-optimizer' ),
142 'wp-content/uploads/'
143 )
144 );
145 }
146
147 $wio_backup = $upload_dir['basedir'] . '/wio_backup/';
148 if ( file_exists( $wio_backup ) && ! wp_is_writable( $wio_backup ) ) {
149 $this->printErrorNotice(
150 sprintf(
151 // translators: %s is the folder path.
152 __( 'Folder %s is unavailable for writing', 'robin-image-optimizer' ),
153 'wp-content/uploads/wio-backup/'
154 )
155 );
156 }
157
158 if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON == true ) {
159 $this->printErrorNotice(
160 sprintf(
161 // translators: %s is the file name (wp-config.php).
162 __( 'Cron is disabled in %s', 'robin-image-optimizer' ),
163 'wp-config.php'
164 )
165 );
166 }
167 }
168
169
170 /**
171 * Метод должен передать массив опций для создания формы с полями.
172 * Созданием страницы и формы занимается фреймворк
173 *
174 * @return mixed[]
175 * @since 1.0.0
176 */
177 public function getPageOptions() {
178 $options = [];
179
180 $options[] = [
181 'type' => 'html',
182 'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __( 'Main Settings', 'robin-image-optimizer' ) . '</strong><p>' . __( 'Configure image optimization settings.', 'robin-image-optimizer' ) . '</p></div>',
183 ];
184
185 // Радио переключатель
186 $options[] = [
187 'type' => 'dropdown',
188 'name' => 'image_optimization_level',
189 'way' => 'buttons',
190 'title' => __( 'Compression mode', 'robin-image-optimizer' ),
191 'data' => [
192 [
193 'normal',
194 __( 'Lossless', 'robin-image-optimizer' ),
195 __( 'This mode provides lossless compression and your images will be optimized without visible changes. If you want an ideal image quality, we recommend this mode. The size of the files will be reduced approximately 2 times. If this is not enough for you, try other modes.', 'robin-image-optimizer' ),
196 ],
197 [
198 'aggresive',
199 __( 'Lossy', 'robin-image-optimizer' ),
200 __( 'This mode provides an ideal optimization of your images without significant quality loss. The file size will be reduced approximately 5 times with a slight decrease in image quality. In most cases that cannot be seen with the naked eye.', 'robin-image-optimizer' ),
201 ],
202 [
203 'ultra',
204 __( 'High', 'robin-image-optimizer' ),
205 __( 'This mode will use all available optimization methods for maximum image compression. The file size will be reduced approximately 7 times. The quality of some images may deteriorate slightly. Use this mode if you need the maximum weight reduction, and you are ready to accept the loss of image quality.', 'robin-image-optimizer' ),
206 ],
207 [
208 'googlepage',
209 __( 'G PageSpeed', 'robin-image-optimizer' ),
210 __( 'This mode uses the optimal settings for Google Page Speed', 'robin-image-optimizer' ),
211 ],
212 [
213 'custom',
214 __( 'Custom', 'robin-image-optimizer' ),
215 __( 'This mode allows you to configure your own compression ratio.', 'robin-image-optimizer' ),
216 ],
217 ],
218 'layout' => [
219 'hint-type' => 'icon',
220 'hint-icon-color' => 'grey',
221 ],
222 'hint' => __( 'Select the compression mode appropriate for your case.', 'robin-image-optimizer' ),
223 'default' => 'normal',
224 'events' => [
225 'normal' => [
226 'hide' => '.factory-control-image_optimization_level_custom',
227 ],
228 'aggresive' => [
229 'hide' => '.factory-control-image_optimization_level_custom',
230 ],
231 'ultra' => [
232 'hide' => '.factory-control-image_optimization_level_custom',
233 ],
234 'googlepage' => [
235 'hide' => '.factory-control-image_optimization_level_custom',
236 ],
237 'custom' => [
238 'show' => '.factory-control-image_optimization_level_custom',
239 ],
240 ],
241 ];
242
243 // Текстовое поле
244 $options[] = [
245 'type' => 'textbox',
246 'name' => 'image_optimization_level_custom',
247 'title' => __( 'Enter custom quality', 'robin-image-optimizer' ),
248 'layout' => [
249 'hint-type' => 'icon',
250 'hint-icon-color' => 'grey',
251 ],
252 'hint' => __( 'Custom quality 1-100', 'robin-image-optimizer' ),
253 'default' => '70',
254 ];
255
256 // Переключатель
257 $options[] = [
258 'type' => 'checkbox',
259 'way' => 'buttons',
260 'name' => 'auto_optimize_when_upload',
261 'title' => __( 'Auto optimization on upload', 'robin-image-optimizer' ),
262 'layout' => [
263 'hint-type' => 'icon',
264 'hint-icon-color' => 'grey',
265 ],
266 'hint' => __( 'Automatically compress all images that you upload directly to the WordPress media library, when editing pages and posts or using themes and plugins.', 'robin-image-optimizer' ),
267 'default' => false,
268 ];
269
270 // Переключатель
271 $options[] = [
272 'type' => 'checkbox',
273 'way' => 'buttons',
274 'name' => 'backup_origin_images',
275 'title' => __( 'Backup images', 'robin-image-optimizer' ),
276 'layout' => [
277 'hint-type' => 'icon',
278 'hint-icon-color' => 'green',
279 ],
280 'hint' => __( 'Before optimizing, all your images will be saved in a separate folder for future recovery.', 'robin-image-optimizer' ),
281 'default' => true,
282 ];
283
284 // Переключатель
285 $options[] = [
286 'type' => 'checkbox',
287 'way' => 'buttons',
288 'name' => 'error_log',
289 'title' => __( 'Error Log', 'robin-image-optimizer' ),
290 'layout' => [
291 'hint-type' => 'icon',
292 'hint-icon-color' => 'grey',
293 ],
294 'hint' => __( 'Enable error logging. The log will be displayed on a separate tab.', 'robin-image-optimizer' ),
295 'default' => false,
296 'eventsOn' => [
297 'show' => '#wrio-error-log-options',
298 ],
299 'eventsOff' => [
300 'hide' => '#wrio-error-log-options',
301 ],
302 ];
303
304 $options[] = [
305 'type' => 'html',
306 'html' => [ $this, 'error_log_options' ],
307 ];
308
309 // WebP conversion option (FREE)
310 $options[] = [
311 'type' => 'checkbox',
312 'way' => 'buttons',
313 'name' => 'convert_webp_format',
314 'title' => __( 'Convert Images to WebP', 'robin-image-optimizer' ),
315 'layout' => [
316 'hint-type' => 'icon',
317 'hint-icon-color' => 'grey',
318 ],
319 'hint' => __( 'Convert JPEG & PNG images into WebP format and replace them for browsers which support it. Unsupported browsers would be skipped.', 'robin-image-optimizer' ),
320 'default' => false,
321 ];
322
323 // AVIF conversion option (PRO only)
324 $options[] = [
325 'type' => 'checkbox',
326 'way' => 'buttons',
327 'name' => 'convert_avif_format',
328 'title' => __( 'Convert Images to AVIF', 'robin-image-optimizer' ),
329 'layout' => [
330 'hint-type' => 'icon',
331 'hint-icon-color' => 'grey',
332 ],
333 'hint' => __( 'Convert JPEG & PNG images into AVIF format. AVIF provides superior compression but requires a premium license.', 'robin-image-optimizer' ),
334 'default' => false,
335 'cssClass' => ! wrio_is_license_activate() ? [ 'factory-checkbox-disabled', 'wrio-checkbox-premium-label' ] : [],
336 ];
337
338 $options[] = [
339 'type' => 'html',
340 'html' => [ $this, 'conver_webp_options' ],
341 ];
342
343 // восстановление
344 $options[] = [
345 'type' => 'html',
346 'html' => [ $this, 'rollbackButton' ],
347 ];
348
349 // Переключатель
350 $options[] = [
351 'type' => 'checkbox',
352 'way' => 'buttons',
353 'name' => 'save_exif_data',
354 'title' => __( 'Strip EXIF data', 'robin-image-optimizer' ),
355 'layout' => [
356 'hint-type' => 'icon',
357 'hint-icon-color' => 'grey',
358 ],
359 'hint' => __( 'EXIF is information stored in photos: camera model, shutter speed, exposure compensation, ISO, GPS, etc. By default, the plugin removes EXIF extended data. If your project is dedicated to photography and you need to display this data, then enable this option.', 'robin-image-optimizer' ),
360 'default' => true,
361 ];
362
363 $options[] = [
364 'type' => 'html',
365 'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __( 'Optimization', 'robin-image-optimizer' ) . '</strong><p>' . __( 'Here you can specify additional image optimization options.', 'robin-image-optimizer' ) . '</p></div>',
366 ];
367
368 $options[] = [
369 'type' => 'dropdown',
370 'name' => 'image_optimization_order',
371 'way' => 'buttons',
372 'title' => __( 'Optimization order', 'robin-image-optimizer' ),
373 'data' => [
374 [
375 'asc',
376 __( 'Ascending', 'robin-image-optimizer' ),
377 __( 'Optimization will start with old images in the media library', 'robin-image-optimizer' ),
378 ],
379 [
380 'desc',
381 __( 'Descending', 'robin-image-optimizer' ),
382 __( 'Optimization will start with new images in the media library', 'robin-image-optimizer' ),
383 ],
384 ],
385 'layout' => [
386 'hint-type' => 'icon',
387 'hint-icon-color' => 'grey',
388 ],
389 'hint' => __( /** @lang text */ 'Select the optimization order from the media library.', 'robin-image-optimizer' ),
390 'default' => 'asc',
391 ];
392
393 // Переключатель
394 $options[] = [
395 'type' => 'checkbox',
396 'way' => 'buttons',
397 'name' => 'resize_larger',
398 'title' => __( 'Resizing large images', 'robin-image-optimizer' ),
399 'layout' => [
400 'hint-type' => 'icon',
401 'hint-icon-color' => 'grey',
402 ],
403 'hint' => __( 'When you upload images from a camera or stock, they may be too high resolution and it is not necessary for web. The option allows you to automatically change images resolution on upload.', 'robin-image-optimizer' ),
404 'default' => false,
405 // когда чекбокс включен показываем поле с классом .factory-control-resize_larger_w
406 'eventsOn' => [
407 'show' => '.factory-control-resize_larger_w,.factory-control-resize_larger_h',
408 ],
409 // когда чекбокс выключен, скрываем поле с классом .factory-control-resize_larger_w
410 'eventsOff' => [
411 'hide' => '.factory-control-resize_larger_w,.factory-control-resize_larger_h',
412 ],
413 ];
414
415 // Текстовое поле
416 $options[] = [
417 'type' => 'textbox',
418 'name' => 'resize_larger_w',
419 'title' => __( 'Enter the maximum width (px)', 'robin-image-optimizer' ),
420 'layout' => [
421 'hint-type' => 'icon',
422 'hint-icon-color' => 'grey',
423 ],
424 'hint' => __( 'Set the maximum images resolution on the long side. For horizontal images, this will be the width, and for vertical images - the height. The resolution of the images will be changed proportionally according to the set value.', 'robin-image-optimizer' ),
425 'default' => '1600',
426 ];
427
428 // Текстовое поле
429 $options[] = [
430 'type' => 'textbox',
431 'name' => 'resize_larger_h',
432 'title' => __( 'Enter the maximum height (px)', 'robin-image-optimizer' ),
433 'layout' => [
434 'hint-type' => 'icon',
435 'hint-icon-color' => 'grey',
436 ],
437 'hint' => __( 'Set the maximum images resolution on the long side. For horizontal images, this will be the width, and for vertical images - the height. The resolution of the images will be changed proportionally according to the set value.', 'robin-image-optimizer' ),
438 'default' => '1600',
439 ];
440
441 $options[] = [
442 'type' => 'list',
443 'way' => 'checklist',
444 'name' => 'allowed_formats',
445 'title' => __( 'Optimize formats', 'robin-image-optimizer' ),
446 'data' => [
447 [ 'image/jpeg', 'JPG' ],
448 [ 'image/png', 'PNG' ],
449 [ 'image/gif', 'GIF' ],
450 ],
451 'layout' => [
452 'hint-type' => 'icon',
453 'hint-icon-color' => 'grey',
454 ],
455 'hint' => __( 'Choose which formats of images should be optimized and uncheck those that do not need optimization.', 'robin-image-optimizer' ),
456 'default' => 'image/jpeg,image/png,image/gif',
457 ];
458
459 // получаем зарегистрированные размеры изображений
460 $wp_image_sizes = wrio_get_image_sizes();
461 $wio_image_sizes = [];
462 foreach ( $wp_image_sizes as $key => $value ) {
463 $wio_image_sizes[] = [
464 $key,
465 $key . ' - ' . $value['width'] . 'x' . $value['height'],
466 ];
467 }
468
469 $options[] = [
470 'type' => 'list',
471 'way' => 'checklist',
472 'name' => 'allowed_sizes_thumbnail',
473 'title' => __( 'Optimize thumbnails', 'robin-image-optimizer' ),
474 'data' => $wio_image_sizes,
475 'layout' => [
476 'hint-type' => 'icon',
477 'hint-icon-color' => 'grey',
478 ],
479 'hint' => __( 'Choose which sizes of thumbnails should be optimized and uncheck those that do not need optimization.', 'robin-image-optimizer' ),
480 'default' => 'thumbnail,medium',
481 ];
482
483 // cron
484 $options[] = [
485 'type' => 'html',
486 'html' => '<div class="wbcr-factory-page-group-header"><strong>' . __( 'Scheduled and background optimization', 'robin-image-optimizer' ) . '</strong><p>' . __( 'Settings for scheduled and background image optimization.', 'robin-image-optimizer' ) . '</p></div>',
487 ];
488
489 $options[] = [
490 'type' => 'dropdown',
491 'name' => 'image_optimization_type',
492 'way' => 'buttons',
493 'title' => __( 'Background optimization type', 'robin-image-optimizer' ),
494 'data' => [
495 [
496 'schedule',
497 __( 'Scheduled', 'robin-image-optimizer' ),
498 __( 'Optimization will take place on a schedule', 'robin-image-optimizer' ),
499 ],
500 [
501 'background',
502 __( 'Background', 'robin-image-optimizer' ),
503 __( 'Optimization will occur in the background constantly', 'robin-image-optimizer' ),
504 ],
505 ],
506 'layout' => [
507 'hint-type' => 'icon',
508 'hint-icon-color' => 'grey',
509 ],
510 'hint' => sprintf(
511 // translators: %1$s is the bold start tag, %2$s is the bold end tag.
512 __( '%1$sScheduled optimization%2$s will occur on a scheduled basis.', 'robin-image-optimizer' ),
513 '<b>',
514 '</b>'
515 ) . '<br>' . sprintf(
516 // translators: %1$s is the bold start tag, %2$s is the bold end tag.
517 __( '%1$sBackground optimization%2$s will occur in the background constantly.', 'robin-image-optimizer' ),
518 '<b>',
519 '</b>'
520 ),
521 'default' => 'schedule',
522 'events' => [
523 'schedule' => [
524 'show' => '#wbcr-io-shedule-options',
525 ],
526 'background' => [
527 'hide' => '#wbcr-io-shedule-options',
528 ],
529 ],
530 ];
531
532 $group_items[] = [
533 'type' => 'dropdown',
534 'way' => 'buttons',
535 'name' => 'image_autooptimize_shedule_time',
536 'data' => [
537 [ 'wio_1_min', __( '1 minute', 'robin-image-optimizer' ) ],
538 // translators: %s is the number of minutes.
539 [ 'wio_2_min', sprintf( __( '%s minutes', 'robin-image-optimizer' ), '2' ) ],
540 // translators: %s is the number of minutes.
541 [ 'wio_5_min', sprintf( __( '%s minutes', 'robin-image-optimizer' ), '5' ) ],
542 // translators: %s is the number of minutes.
543 [ 'wio_10_min', sprintf( __( '%s minutes', 'robin-image-optimizer' ), '10' ) ],
544 // translators: %s is the number of minutes.
545 [ 'wio_30_min', sprintf( __( '%s minutes', 'robin-image-optimizer' ), '30' ) ],
546 [ 'wio_hourly', __( 'Hour', 'robin-image-optimizer' ) ],
547 [ 'wio_daily', __( 'Day', 'robin-image-optimizer' ) ],
548 ],
549 'default' => 'wio_5_min',
550 'title' => __( 'Run every', 'robin-image-optimizer' ),
551 'hint' => __( 'Select time at which the task will be repeated.', 'robin-image-optimizer' ),
552 ];
553
554 $group_items[] = [
555 'type' => 'textbox',
556 'name' => 'image_autooptimize_items_number_per_interation',
557 'title' => __( 'Images per iteration', 'robin-image-optimizer' ),
558 'layout' => [
559 'hint-type' => 'icon',
560 'hint-icon-color' => 'grey',
561 ],
562 'hint' => __( 'Specify the number of images that will be optimized during the job. For example, if you enter 5 and select 5 min, the plugin will optimize 5 images every 5 minutes.', 'robin-image-optimizer' ),
563 'default' => '3',
564 'htmlAttrs' => [
565 'type' => 'number',
566 'min' => '1',
567 'step' => '1',
568 ],
569 'filter_value' => function ( $value ) {
570 $int_value = intval( $value );
571 return $int_value < 1 ? 1 : $int_value;
572 },
573 ];
574
575 $options[] = [
576 'type' => 'div',
577 'id' => 'wbcr-io-shedule-options',
578 'items' => $group_items,
579 ];
580
581 $options = apply_filters( 'wbcr/rio/settings_page/options', $options );
582
583 $formOptions = [];
584
585 $formOptions[] = [
586 'type' => 'form-group',
587 'items' => $options,
588 // 'cssClass' => 'postbox'
589 ];
590
591 return $formOptions;
592 }
593
594 /**
595 * Save advanced options in database
596 *
597 * @since 1.3.6
598 */
599 public function beforeFormSave() {
600
601 /**
602 * Used to save webp options. It can also be used to intercept
603 * other unregistered fields.
604 *
605 * @since 1.3.6
606 */
607 do_action( 'wrio/settings_page/berfore_form_save' );
608
609 $error_log = (int) WRIO_Plugin::app()->request->post( WRIO_Plugin::app()->getPrefix() . 'error_log', 0 );
610
611 if ( ! $error_log ) {
612 return;
613 }
614
615 $keep_error_log_on_frontend = (int) WRIO_Plugin::app()->request->post( 'wrio_keep_error_log_on_frontend', 0 );
616
617 WRIO_Plugin::app()->updatePopulateOption( 'keep_error_log_on_frontend', $keep_error_log_on_frontend );
618 }
619
620 /**
621 * This method adds advanced options for the "Convert Images to WebP" checkbox.
622 *
623 * @since 1.3.6
624 */
625 public function conver_webp_options() {
626
627 /**
628 * This hook prints options for delivering webp images.
629 *
630 * @since 1.3.6
631 */
632 do_action( 'wrio/settings_page/conver_webp_options' );
633 }
634
635 /**
636 * This method adds advanced options for the "Error log" checkbox.
637 *
638 * @since 1.3.6
639 */
640 public function error_log_options() {
641 $this->view->print_template(
642 'part-settings-page-error-log-options',
643 [
644 'keep_error_log_on_frontend' => (int) WRIO_Plugin::app()->getPopulateOption( 'keep_error_log_on_frontend', 0 ),
645 ]
646 );
647 }
648
649 /**
650 * Кнопка восстановления изображений
651 */
652 public function rollbackButton() {
653 ?>
654 <div class="form-group form-group-checkbox factory-control-rollback-button">
655 <label for="wio-clear-backup-btn" class="col-sm-4 control-label">
656 <?php esc_html_e( 'Manage backups', 'robin-image-optimizer' ); ?>
657 <span class="factory-hint-icon factory-hint-icon-red" data-toggle="factory-tooltip"
658 data-placement="right" title=""
659 data-original-title="<?php esc_html_e( 'You can restore the original images from a backup or clear them.', 'robin-image-optimizer' ); ?>"
660 >
661 ?
662 </span>
663 </label>
664 <input type="hidden" value="<?php echo wp_create_nonce( 'wio-iph' ); ?>" id="wio-iph-nonce">
665 <div class="control-group col-sm-8">
666 <div class="factory-buttons-way btn-group">
667 <a class="btn btn-default" id="wio-restore-backup-btn"
668 data-confirm="<?php esc_html_e( 'Are you sure you want to restore all images? This cannot be undone.', 'robin-image-optimizer' ); ?>"
669 href="#"><?php esc_html_e( 'Restore', 'robin-image-optimizer' ); ?></a>
670 <a class="btn btn-default" id="wio-clear-backup-btn"
671 data-confirm="<?php esc_html_e( 'Are you sure you want to clear the backup folder? All backup images will be permanently deleted.', 'robin-image-optimizer' ); ?>"
672 href="#"><?php esc_html_e( 'Clear Backup', 'robin-image-optimizer' ); ?></a>
673 </div>
674 <div class="progress" id="wio-restore-backup-progress" style="display:none;">
675 <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="0"
676 aria-valuemin="0" aria-valuemax="100" style="width:0%">
677 </div>
678 </div>
679 <p id="wio-restore-backup-msg"
680 style="display:none;"><?php esc_html_e( 'Restore completed.', 'robin-image-optimizer' ); ?></p>
681 <p id="wio-clear-backup-msg"
682 style="display:none;"><?php esc_html_e( 'The backup folder was cleared.', 'robin-image-optimizer' ); ?></p>
683 </div>
684 </div>
685 <?php
686 }
687 }
688