PluginProbe
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score / 2.0
Powered Cache – Caching and Optimization for WordPress – Easily Improve PageSpeed & Web Vitals Score v2.0
trunk 1.0 1.0.1 1.1 1.1.1 1.1.2 1.2 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1 2.1.1 2.1.2 2.2 2.2.1 All 69 releases
← All changes | includes/utils.php +19 -99 2.22.0 View file →
@@ -63,16 +63,10 @@
63 63 'purge_additional_pages' => '',
64 64 // file optimization
65 65 'minify_html' => false,
66 66 'combine_google_fonts' => false,
67 - 'swap_google_fonts_display' => true,
68 67 'minify_css' => false,
69 68 'combine_css' => false,
70 - 'critical_css' => false,
71 - 'critical_css_additional_files' => '',
72 - 'critical_css_excluded_files' => '',
73 - 'critical_css_appended_content' => '',
74 - 'critical_css_fallback' => '',
75 69 'excluded_css_files' => '',
76 70 'minify_js' => false,
77 71 'combine_js' => false,
78 72 'excluded_js_files' => '',
@@ -78,9 +72,8 @@
78 72 'excluded_js_files' => '',
79 73 'js_execution_method' => 'blocking',
80 74 'js_execution_optimized_only' => true,
81 75 // media optimization
82 - 'enable_image_optimization' => false,
83 76 // lazyload
84 77 'enable_lazy_load' => false,
85 78 'lazy_load_post_content' => true,
86 79 'lazy_load_images' => true,
@@ -103,9 +96,8 @@
103 96 'preload_public_tax' => true,
104 97 'enable_sitemap_preload' => false,
105 98 'preload_sitemap' => '',
106 99 'prefetch_dns' => '',
107 - 'preconnect_resource' => '',
108 100 // db options
109 101 'db_cleanup_post_revisions' => false,
110 102 'db_cleanup_auto_drafts' => false,
111 103 'db_cleanup_trashed_posts' => false,
@@ -394,8 +386,26 @@
394 386 return apply_filters( 'powered_cache_cdn_zones', $zones );
395 387 }
396 388
397 389 /**
390 + * Get counts for db entities
391 + *
392 + * @return array
393 + */
394 +function get_db_cleanup_counts() {
395 + return [
396 + 'post_revision' => 0,
397 + 'post_auto_draft' => 1,
398 + 'post_trashed' => 4,
399 + 'comment_spam' => 4,
400 + 'comment_trashed' => 4,
401 + 'transient_expired' => 4,
402 + 'transient_all' => 4,
403 + 'table_count' => 0,
404 + ];
405 +}
406 +
407 +/**
398 408 * Which version of plugin running
399 409 *
400 410 * @return bool
401 411 */
@@ -697,9 +707,9 @@
697 707
698 708 // array to collect all our URLs
699 709 $related_urls = array();
700 710
701 - if ( get_permalink( $post_id ) ) {
711 + if ( get_permalink( $post_id ) === true ) {
702 712 // we're going to add a ton of things to flush.
703 713
704 714 // related category urls
705 715 $categories = get_the_category( $post_id );
@@ -849,12 +859,8 @@
849 859 $zones = $settings['cdn_zone'];
850 860
851 861 $cdn_addresses = array();
852 862 foreach ( $hostnames as $host_key => $host ) {
853 - if ( filter_var( $host, FILTER_VALIDATE_URL ) ) {
854 - $host = wp_parse_url( $host, PHP_URL_HOST );
855 - }
856 -
857 863 if ( ! empty( $host ) ) {
858 864 $cdn_addresses[ $zones[ $host_key ] ][] = $host;
859 865 }
860 866 }
@@ -1236,91 +1242,5 @@
1236 1242 $doc_url .= '#' . $fragment;
1237 1243 }
1238 1244
1239 1245 return $doc_url;
1240 -}
1241 -
1242 -/**
1243 - * Sanitize CSS
1244 - *
1245 - * @param string $css Input
1246 - *
1247 - * @return string|string[] $css
1248 - * @since 2.1
1249 - */
1250 -function sanitize_css( $css ) {
1251 - $css = wp_strip_all_tags( $css );
1252 -
1253 - if ( false !== strpos( $css, '<' ) ) {
1254 - $css = preg_replace( '#<(\/?\w+)#', '\00003C$1', $css );
1255 - }
1256 -
1257 - return $css;
1258 -}
1259 -
1260 -
1261 -/**
1262 - * Test if the current browser runs on a mobile device (smart phone, tablet, etc.)
1263 - * Sort of custom version of wp_is_mobile
1264 - */
1265 -function powered_cache_is_mobile() {
1266 -
1267 - global $powered_cache_mobile_browsers, $powered_cache_mobile_prefixes;
1268 -
1269 - $mobile_browsers = addcslashes( implode( '|', preg_split( '/[\s*,\s*]*,+[\s*,\s*]*/', $powered_cache_mobile_browsers ) ), ' ' );
1270 - $mobile_prefixes = addcslashes( implode( '|', preg_split( '/[\s*,\s*]*,+[\s*,\s*]*/', $powered_cache_mobile_prefixes ) ), ' ' );
1271 -
1272 - if ( ( preg_match( '#^.*(' . $mobile_browsers . ').*#i', $_SERVER['HTTP_USER_AGENT'] ) || preg_match( '#^(' . $mobile_prefixes . ').*#i', substr( $_SERVER['HTTP_USER_AGENT'], 0, 4 ) ) ) ) {
1273 - return true;
1274 - }
1275 -
1276 - return false;
1277 -}
1278 -
1279 -/**
1280 - * If the site is a local site.
1281 - *
1282 - * @return bool
1283 - * @since 2.2
1284 - */
1285 -function is_local_site() {
1286 - $site_url = site_url();
1287 -
1288 - // Check for localhost and sites using an IP only first.
1289 - $is_local = $site_url && false === strpos( $site_url, '.' );
1290 -
1291 - // Use Core's environment check, if available. Added in 5.5.0 / 5.5.1 (for `local` return value).
1292 - if ( function_exists( 'wp_get_environment_type' ) && 'local' === wp_get_environment_type() ) {
1293 - $is_local = true;
1294 - }
1295 -
1296 - // Then check for usual usual domains used by local dev tools.
1297 - $known_local = array(
1298 - '#\.local$#i',
1299 - '#\.localhost$#i',
1300 - '#\.test$#i',
1301 - '#\.docksal$#i', // Docksal.
1302 - '#\.docksal\.site$#i', // Docksal.
1303 - '#\.dev\.cc$#i', // ServerPress.
1304 - '#\.lndo\.site$#i', // Lando.
1305 - );
1306 -
1307 - if ( ! $is_local ) {
1308 - foreach ( $known_local as $url ) {
1309 - if ( preg_match( $url, $site_url ) ) {
1310 - $is_local = true;
1311 - break;
1312 - }
1313 - }
1314 - }
1315 -
1316 - /**
1317 - * Filters is_local_site check.
1318 - *
1319 - * @param bool $is_local If the current site is a local site.
1320 - *
1321 - * @since 2.2
1322 - */
1323 - $is_local = apply_filters( 'powered_cache_is_local_site', $is_local );
1324 -
1325 - return $is_local;
1326 1246 }