@@ -48,57 +48,57 @@ class Optml_Settings {
4848 * @var array Settings schema.
4949 */
5050 private $ default_schema = [
51- 'api_key ' => '' ,
52- 'service_data ' => '' ,
53- 'cache_buster ' => '' ,
54- 'cache_buster_assets ' => '' ,
55- 'cache_buster_images ' => '' ,
56- 'cdn ' => 'disabled ' ,
57- 'admin_bar_item ' => 'enabled ' ,
58- 'lazyload ' => 'disabled ' ,
59- 'scale ' => 'disabled ' ,
60- 'network_optimization ' => 'disabled ' ,
61- 'lazyload_placeholder ' => 'enabled ' ,
62- 'bg_replacer ' => 'enabled ' ,
63- 'video_lazyload ' => 'enabled ' ,
64- 'retina_images ' => 'disabled ' ,
65- 'limit_dimensions ' => 'enabled ' ,
66- 'limit_height ' => 1080 ,
67- 'limit_width ' => 1920 ,
68- 'resize_smart ' => 'disabled ' ,
69- 'no_script ' => 'disabled ' ,
70- 'filters ' => [],
71- 'cloud_sites ' => [ 'all ' => 'true ' ],
72- 'watchers ' => '' ,
73- 'quality ' => 'auto ' ,
74- 'wm_id ' => - 1 ,
75- 'wm_opacity ' => 1 ,
76- 'wm_position ' => Optml_Resize::GRAVITY_SOUTH_EAST ,
77- 'wm_x ' => 0 ,
78- 'wm_y ' => 0 ,
79- 'wm_scale ' => 0 ,
80- 'image_replacer ' => 'enabled ' ,
81- 'img_to_video ' => 'disabled ' ,
82- 'css_minify ' => 'enabled ' ,
83- 'js_minify ' => 'disabled ' ,
84- 'report_script ' => 'disabled ' ,
85- 'avif ' => 'enabled ' ,
86- 'autoquality ' => 'enabled ' ,
87- 'native_lazyload ' => 'disabled ' ,
88- 'offload_media ' => 'disabled ' ,
89- 'transfer_status ' => 'disabled ' ,
90- 'cloud_images ' => 'enabled ' ,
91- 'strip_metadata ' => 'enabled ' ,
92- 'skip_lazyload_images ' => 3 ,
93- 'defined_image_sizes ' => [ ],
94- 'banner_frontend ' => 'disabled ' ,
95- 'offloading_status ' => 'disabled ' ,
96- 'rollback_status ' => 'disabled ' ,
97- 'best_format ' => 'enabled ' ,
98- 'offload_limit_reached ' => 'disabled ' ,
99- 'offload_limit ' => 50000 ,
100- 'placeholder_color ' => '' ,
101- 'show_offload_finish_notice ' => '' ,
51+ 'api_key ' => '' ,
52+ 'service_data ' => '' ,
53+ 'cache_buster ' => '' ,
54+ 'cache_buster_assets ' => '' ,
55+ 'cache_buster_images ' => '' ,
56+ 'cdn ' => 'disabled ' ,
57+ 'admin_bar_item ' => 'enabled ' ,
58+ 'lazyload ' => 'disabled ' ,
59+ 'scale ' => 'disabled ' ,
60+ 'network_optimization ' => 'disabled ' ,
61+ 'lazyload_placeholder ' => 'enabled ' ,
62+ 'bg_replacer ' => 'enabled ' ,
63+ 'video_lazyload ' => 'enabled ' ,
64+ 'retina_images ' => 'disabled ' ,
65+ 'limit_dimensions ' => 'enabled ' ,
66+ 'limit_height ' => 1080 ,
67+ 'limit_width ' => 1920 ,
68+ 'resize_smart ' => 'disabled ' ,
69+ 'no_script ' => 'disabled ' ,
70+ 'filters ' => [],
71+ 'cloud_sites ' => [ 'all ' => 'true ' ],
72+ 'watchers ' => '' ,
73+ 'quality ' => 'auto ' ,
74+ 'wm_id ' => - 1 ,
75+ 'wm_opacity ' => 1 ,
76+ 'wm_position ' => Optml_Resize::GRAVITY_SOUTH_EAST ,
77+ 'wm_x ' => 0 ,
78+ 'wm_y ' => 0 ,
79+ 'wm_scale ' => 0 ,
80+ 'image_replacer ' => 'enabled ' ,
81+ 'img_to_video ' => 'disabled ' ,
82+ 'css_minify ' => 'enabled ' ,
83+ 'js_minify ' => 'disabled ' ,
84+ 'report_script ' => 'disabled ' ,
85+ 'avif ' => 'enabled ' ,
86+ 'autoquality ' => 'enabled ' ,
87+ 'native_lazyload ' => 'disabled ' ,
88+ 'offload_media ' => 'disabled ' ,
89+ 'transfer_status ' => 'disabled ' ,
90+ 'cloud_images ' => 'enabled ' ,
91+ 'strip_metadata ' => 'enabled ' ,
92+ 'skip_lazyload_images ' => 3 ,
93+ 'defined_image_sizes ' => [],
94+ 'banner_frontend ' => 'disabled ' ,
95+ 'offloading_status ' => 'disabled ' ,
96+ 'rollback_status ' => 'disabled ' ,
97+ 'best_format ' => 'enabled ' ,
98+ 'offload_limit_reached ' => 'disabled ' ,
99+ 'offload_limit ' => 50000 ,
100+ 'placeholder_color ' => '' ,
101+ 'show_offload_finish_notice ' => '' ,
102102 ];
103103 /**
104104 * Option key.
@@ -295,7 +295,7 @@ public function parse_settings( $new_settings ) {
295295 }
296296 break ;
297297 case 'defined_image_sizes ' :
298- $ current_sizes = $ this ->get ( 'defined_image_sizes ' );
298+ $ current_sizes = $ this ->get ( 'defined_image_sizes ' );
299299 foreach ( $ value as $ size_name => $ size_value ) {
300300 if ( $ size_value === 'remove ' ) {
301301 unset( $ current_sizes [ $ size_name ] );
@@ -455,6 +455,7 @@ public function update( $key, $value ) {
455455 if ( apply_filters ( 'optml_dont_trigger_settings_updated ' , false ) === false ) {
456456 do_action ( 'optml_settings_updated ' );
457457 }
458+
458459 return $ update ;
459460 }
460461
@@ -487,45 +488,45 @@ public function get_site_settings() {
487488 }
488489
489490 return [
490- 'quality ' => $ this ->get_quality (),
491- 'admin_bar_item ' => $ this ->get ( 'admin_bar_item ' ),
492- 'lazyload ' => $ this ->get ( 'lazyload ' ),
493- 'network_optimization ' => $ this ->get ( 'network_optimization ' ),
494- 'retina_images ' => $ this ->get ( 'retina_images ' ),
495- 'limit_dimensions ' => $ this ->get ( 'limit_dimensions ' ),
496- 'limit_height ' => $ this ->get ( 'limit_height ' ),
497- 'limit_width ' => $ this ->get ( 'limit_width ' ),
498- 'lazyload_placeholder ' => $ this ->get ( 'lazyload_placeholder ' ),
499- 'skip_lazyload_images ' => $ this ->get ( 'skip_lazyload_images ' ),
500- 'bg_replacer ' => $ this ->get ( 'bg_replacer ' ),
501- 'video_lazyload ' => $ this ->get ( 'video_lazyload ' ),
502- 'resize_smart ' => $ this ->get ( 'resize_smart ' ),
503- 'no_script ' => $ this ->get ( 'no_script ' ),
504- 'image_replacer ' => $ this ->get ( 'image_replacer ' ),
505- 'cdn ' => $ this ->get ( 'cdn ' ),
506- 'filters ' => $ this ->get_filters (),
507- 'cloud_sites ' => $ this ->get ( 'cloud_sites ' ),
508- 'defined_image_sizes ' => $ this ->get ( 'defined_image_sizes ' ),
509- 'watchers ' => $ this ->get_watchers (),
510- 'watermark ' => $ this ->get_watermark (),
511- 'img_to_video ' => $ this ->get ( 'img_to_video ' ),
512- 'scale ' => $ this ->get ( 'scale ' ),
513- 'css_minify ' => $ this ->get ( 'css_minify ' ),
514- 'js_minify ' => $ this ->get ( 'js_minify ' ),
515- 'native_lazyload ' => $ this ->get ( 'native_lazyload ' ),
516- 'report_script ' => $ this ->get ( 'report_script ' ),
517- 'avif ' => $ this ->get ( 'avif ' ),
518- 'autoquality ' => $ this ->get ( 'autoquality ' ),
519- 'offload_media ' => $ this ->get ( 'offload_media ' ),
520- 'cloud_images ' => $ this ->get ( 'cloud_images ' ),
521- 'strip_metadata ' => $ this ->get ( 'strip_metadata ' ),
522- 'whitelist_domains ' => $ whitelist ,
523- 'banner_frontend ' => $ this ->get ( 'banner_frontend ' ),
524- 'offloading_status ' => $ this ->get ( 'offloading_status ' ),
525- 'rollback_status ' => $ this ->get ( 'rollback_status ' ),
526- 'best_format ' => $ this ->get ( 'best_format ' ),
527- 'offload_limit_reached ' => $ this ->get ( 'offload_limit_reached ' ),
528- 'placeholder_color ' => $ this ->get ( 'placeholder_color ' ),
491+ 'quality ' => $ this ->get_quality (),
492+ 'admin_bar_item ' => $ this ->get ( 'admin_bar_item ' ),
493+ 'lazyload ' => $ this ->get ( 'lazyload ' ),
494+ 'network_optimization ' => $ this ->get ( 'network_optimization ' ),
495+ 'retina_images ' => $ this ->get ( 'retina_images ' ),
496+ 'limit_dimensions ' => $ this ->get ( 'limit_dimensions ' ),
497+ 'limit_height ' => $ this ->get ( 'limit_height ' ),
498+ 'limit_width ' => $ this ->get ( 'limit_width ' ),
499+ 'lazyload_placeholder ' => $ this ->get ( 'lazyload_placeholder ' ),
500+ 'skip_lazyload_images ' => $ this ->get ( 'skip_lazyload_images ' ),
501+ 'bg_replacer ' => $ this ->get ( 'bg_replacer ' ),
502+ 'video_lazyload ' => $ this ->get ( 'video_lazyload ' ),
503+ 'resize_smart ' => $ this ->get ( 'resize_smart ' ),
504+ 'no_script ' => $ this ->get ( 'no_script ' ),
505+ 'image_replacer ' => $ this ->get ( 'image_replacer ' ),
506+ 'cdn ' => $ this ->get ( 'cdn ' ),
507+ 'filters ' => $ this ->get_filters (),
508+ 'cloud_sites ' => $ this ->get ( 'cloud_sites ' ),
509+ 'defined_image_sizes ' => $ this ->get ( 'defined_image_sizes ' ),
510+ 'watchers ' => $ this ->get_watchers (),
511+ 'watermark ' => $ this ->get_watermark (),
512+ 'img_to_video ' => $ this ->get ( 'img_to_video ' ),
513+ 'scale ' => $ this ->get ( 'scale ' ),
514+ 'css_minify ' => $ this ->get ( 'css_minify ' ),
515+ 'js_minify ' => $ this ->get ( 'js_minify ' ),
516+ 'native_lazyload ' => $ this ->get ( 'native_lazyload ' ),
517+ 'report_script ' => $ this ->get ( 'report_script ' ),
518+ 'avif ' => $ this ->get ( 'avif ' ),
519+ 'autoquality ' => $ this ->get ( 'autoquality ' ),
520+ 'offload_media ' => $ this ->get ( 'offload_media ' ),
521+ 'cloud_images ' => $ this ->get ( 'cloud_images ' ),
522+ 'strip_metadata ' => $ this ->get ( 'strip_metadata ' ),
523+ 'whitelist_domains ' => $ whitelist ,
524+ 'banner_frontend ' => $ this ->get ( 'banner_frontend ' ),
525+ 'offloading_status ' => $ this ->get ( 'offloading_status ' ),
526+ 'rollback_status ' => $ this ->get ( 'rollback_status ' ),
527+ 'best_format ' => $ this ->get ( 'best_format ' ),
528+ 'offload_limit_reached ' => $ this ->get ( 'offload_limit_reached ' ),
529+ 'placeholder_color ' => $ this ->get ( 'placeholder_color ' ),
529530 'show_offload_finish_notice ' => $ this ->get ( 'show_offload_finish_notice ' ),
530531 ];
531532 }
@@ -702,6 +703,7 @@ public function reset() {
702703
703704 return $ update ;
704705 }
706+
705707 /**
706708 * Get raw settings value.
707709 *
@@ -737,7 +739,7 @@ public function register_settings() {
737739 * @return string|WP_Error
738740 */
739741 public function clear_cache ( $ type = '' ) {
740- $ token = $ this ->get ( 'cache_buster ' );
742+ $ token = $ this ->get ( 'cache_buster ' );
741743 $ token_images = $ this ->get ( 'cache_buster_images ' );
742744
743745 if ( ! empty ( $ token_images ) ) {
@@ -748,8 +750,8 @@ public function clear_cache( $type = '' ) {
748750 $ token = $ this ->get ( 'cache_buster_assets ' );
749751 }
750752
751- $ request = new Optml_Api ();
752- $ data = $ request ->get_cache_token ( $ token , $ type );
753+ $ request = new Optml_Api ();
754+ $ data = $ request ->get_cache_token ( $ token , $ type );
753755
754756 if ( $ data === false || is_wp_error ( $ data ) || empty ( $ data ) || ! isset ( $ data ['token ' ] ) ) {
755757 $ extra = '' ;
0 commit comments