PluginProbe
Autoptimize / trunk
Autoptimize vtrunk
3.1.16 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 All 108 releases
← All changes | classes/autoptimizeCacheChecker.php +16 -15 2.4.3 → trunk View file →
@@ -57,15 +57,15 @@
57 57 $do_cache_check = (bool) apply_filters( 'autoptimize_filter_cachecheck_do', true );
58 58 $stat_array = autoptimizeCache::stats();
59 59 $cache_size = round( $stat_array[1] );
60 60 if ( ( $cache_size > $max_size ) && ( $do_cache_check ) ) {
61 - update_option( 'autoptimize_cachesize_notice', true );
61 + autoptimizeOptionWrapper::update_option( 'autoptimize_cachesize_notice', true );
62 62 if ( apply_filters( 'autoptimize_filter_cachecheck_sendmail', true ) ) {
63 - $site_url = esc_url( site_url() );
64 - $ao_mailto = apply_filters( 'autoptimize_filter_cachecheck_mailto', get_option( 'admin_email', '' ) );
63 + $home_url = esc_url( home_url() );
64 + $ao_mailto = apply_filters( 'autoptimize_filter_cachecheck_mailto', autoptimizeOptionWrapper::get_option( 'admin_email', '' ) );
65 65
66 - $ao_mailsubject = __( 'Autoptimize cache size warning', 'autoptimize' ) . ' (' . $site_url . ')';
67 - $ao_mailbody = __( 'Autoptimize\'s cache size is getting big, consider purging the cache. Have a look at https://wordpress.org/plugins/autoptimize/faq/ to see how you can keep the cache size under control.', 'autoptimize' ) . ' (site: ' . $site_url . ')';
66 + $ao_mailsubject = esc_html__( 'Autoptimize cache size warning', 'autoptimize' ) . ' (' . $home_url . ')';
67 + $ao_mailbody = esc_html__( 'Autoptimize\'s cache size is getting big, consider purging the cache. Have a look at https://wordpress.org/plugins/autoptimize/faq/ to see how you can keep the cache size under control.', 'autoptimize' ) . ' (site: ' . $home_url . ')';
68 68
69 69 if ( ! empty( $ao_mailto ) ) {
70 70 $ao_mailresult = wp_mail( $ao_mailto, $ao_mailsubject, $ao_mailbody );
71 71 if ( ! $ao_mailresult ) {
@@ -77,31 +77,32 @@
77 77
78 78 // Check if 3rd party services (e.g. image proxy) are up.
79 79 autoptimizeUtils::check_service_availability();
80 80
81 - // Check image optimization stats.
82 - autoptimizeExtra::get_img_provider_stats();
83 -
84 81 // Nukes advanced cache clearing artifacts if they exists...
85 82 autoptimizeCache::delete_advanced_cache_clear_artifacts();
83 +
84 + // Check image optimization stats.
85 + autoptimizeImages::instance()->query_img_provider_stats();
86 86 }
87 87
88 88 public function show_admin_notice()
89 89 {
90 - if ( (bool) get_option( 'autoptimize_cachesize_notice', false ) && current_user_can( 'manage_options' ) ) {
90 + if ( (bool) autoptimizeOptionWrapper::get_option( 'autoptimize_cachesize_notice', false ) && current_user_can( 'manage_options' ) ) {
91 91 echo '<div class="notice notice-warning"><p>';
92 - _e( '<strong>Autoptimize\'s cache size is getting big</strong>, consider purging the cache. Have a look at <a href="https://wordpress.org/plugins/autoptimize/faq/" target="_blank" rel="noopener noreferrer">the Autoptimize FAQ</a> to see how you can keep the cache size under control.', 'autoptimize' );
92 + // Translators: first two variables are strong tags, 3rd is link to the AO FAQ and the 4th closes that tag.
93 + printf( esc_html__( '%1$sAutoptimize\'s cache size is getting big%2$s, consider purging the cache. Have a look at %3$sthe Autoptimize FAQ%4$s to see how you can keep the cache size under control.', 'autoptimize' ), '<strong>', '</strong>', '<a href="https://wordpress.org/plugins/autoptimize/faq/" target="_blank" rel="noopener noreferrer">', '</a>' );
93 94 echo '</p></div>';
94 - update_option( 'autoptimize_cachesize_notice', false );
95 + autoptimizeOptionWrapper::update_option( 'autoptimize_cachesize_notice', false );
95 96 }
96 97
97 98 // Notice for image proxy usage.
98 - $_imgopt_notice = autoptimizeExtra::get_imgopt_status_notice_wrapper();
99 - if ( current_user_can( 'manage_options' ) && is_array( $_imgopt_notice ) && array_key_exists( 'status', $_imgopt_notice ) && in_array( $_imgopt_notice['status'], array( 1, -1, -2 ) ) ) {
99 + $_imgopt_notice = autoptimizeImages::instance()->get_imgopt_status_notice_wrapper();
100 + if ( current_user_can( 'manage_options' ) && is_array( $_imgopt_notice ) && array_key_exists( 'status', $_imgopt_notice ) && in_array( $_imgopt_notice['status'], array( 1, -1, -2, -3 ) ) ) {
100 101 $_dismissible = 'ao-img-opt-notice-';
101 102 $_hide_notice = '7';
102 103
103 - if ( -1 == $_imgopt_notice['status'] ) {
104 + if ( -1 == $_imgopt_notice['status'] || -2 == $_imgopt_notice['status'] || -3 == $_imgopt_notice['status'] ) {
104 105 $_hide_notice = '1';
105 106 }
106 107
107 108 $_imgopt_notice_dismissible = apply_filters( 'autoptimize_filter_imgopt_notice_dismissable', $_dismissible . $_hide_notice );
@@ -106,9 +107,9 @@
106 107
107 108 $_imgopt_notice_dismissible = apply_filters( 'autoptimize_filter_imgopt_notice_dismissable', $_dismissible . $_hide_notice );
108 109
109 110 if ( $_imgopt_notice && PAnD::is_admin_notice_active( $_imgopt_notice_dismissible ) ) {
110 - echo '<div class="notice notice-warning is-dismissible" data-dismissible="' . $_imgopt_notice_dismissible . '"><p>' . $_imgopt_notice['notice'] . '</p></div>';
111 + echo '<div class="notice notice-warning is-dismissible" data-dismissible="' . $_imgopt_notice_dismissible . '"><p><strong>' . esc_html__( 'Autoptimize', 'autoptimize' ) . '</strong>: ' . $_imgopt_notice['notice'] . '</p></div>';
111 112 }
112 113 }
113 114 }
114 115 }