Changeset 3315193
- Timestamp:
- 06/20/2025 11:29:39 AM (10 months ago)
- Location:
- cache-using-gzip
- Files:
-
- 20 added
- 4 edited
-
tags/2.8.8 (added)
-
tags/2.8.8/autoload.php (added)
-
tags/2.8.8/cache-using-gzip.php (added)
-
tags/2.8.8/classes (added)
-
tags/2.8.8/classes/CUGZ (added)
-
tags/2.8.8/classes/CUGZ/class-cugz-gzip-cache.php (added)
-
tags/2.8.8/css (added)
-
tags/2.8.8/css/jquery-ui.css (added)
-
tags/2.8.8/css/jquery-ui.min.css (added)
-
tags/2.8.8/css/style.css (added)
-
tags/2.8.8/css/style.min.css (added)
-
tags/2.8.8/js (added)
-
tags/2.8.8/js/main.js (added)
-
tags/2.8.8/js/main.min.js (added)
-
tags/2.8.8/license.txt (added)
-
tags/2.8.8/readme.txt (added)
-
tags/2.8.8/templates (added)
-
tags/2.8.8/templates/htaccess.sample (added)
-
tags/2.8.8/templates/nginx.conf.sample (added)
-
tags/2.8.8/templates/options-page.php (added)
-
trunk/cache-using-gzip.php (modified) (1 diff)
-
trunk/classes/CUGZ/class-cugz-gzip-cache.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/templates/options-page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cache-using-gzip/trunk/cache-using-gzip.php
r3303203 r3315193 5 5 /* 6 6 * Plugin Name: Cache Using Gzip 7 * Version: 2.8. 77 * Version: 2.8.8 8 8 * Description: Creates gzip files on your server to immensly improve page speed for site visitors 9 9 * Author: Cache Using Gzip -
cache-using-gzip/trunk/classes/CUGZ/class-cugz-gzip-cache.php
r3303203 r3315193 264 264 add_action('cugz_cron_auto_preload', [$this, 'cugz_preload_cache']); 265 265 266 add_action('cugz_options_page_next_auto_preload', [$this, 'cugz_options_page_next_auto_preload']); 267 266 268 if ($this->zlib_enabled) { 267 269 add_action('admin_menu', [$this, 'cugz_register_options_page']); … … 293 295 294 296 add_filter('plugin_row_meta', [$this, 'cugz_plugin_row_meta'], 10, 2); 297 } 298 299 /** 300 * Displays a message on the options page with the next scheduled auto preload, if applicable. 301 */ 302 public function cugz_options_page_next_auto_preload() 303 { 304 if ($cugz_cron_auto_preload = wp_next_scheduled('cugz_cron_auto_preload')) { 305 $dt = new \DateTime("@{$cugz_cron_auto_preload}"); 306 $dt->setTimezone(wp_timezone()); 307 echo '<strong>Next auto preload:</strong> <code>'.esc_html($dt->format('F j, Y, g:i a')).'</code>'; 308 } 295 309 } 296 310 … … 1064 1078 1065 1079 /** 1080 * Accepts a string of CSS and replaces relative URL's with absolute ULR's. 1081 * 1082 * @param string $css CSS content 1083 * @param string $css_url URL to css file 1084 * 1085 * @return string returns CSS with corrected URL's before minifying and placing inline 1086 */ 1087 protected function fix_css_urls($css, $css_url) 1088 { 1089 return preg_replace_callback('/url\((["\']?)(?!data:|https?:|\/\/)([^"\')]+)(["\']?)\)/i', function ($matches) use ($css_url) { 1090 $quote = $matches[1]; 1091 $relative_path = $matches[2]; 1092 $parsed_url = wp_parse_url($css_url); 1093 $base_url = $parsed_url['scheme'].'://'.$parsed_url['host']; 1094 1095 if (!empty($parsed_url['port'])) { 1096 $base_url .= ':'.$parsed_url['port']; 1097 } 1098 1099 $base_path = rtrim(dirname($parsed_url['path']), '/').'/'; 1100 $full_path = $base_path.$relative_path; 1101 $normalized_path = []; 1102 $parts = explode('/', $full_path); 1103 1104 foreach ($parts as $part) { 1105 if ('..' === $part) { 1106 array_pop($normalized_path); 1107 } elseif ('.' !== $part && '' !== $part) { 1108 $normalized_path[] = $part; 1109 } 1110 } 1111 1112 $final_path = '/'.implode('/', $normalized_path); 1113 1114 return 'url('.$quote.$base_url.$final_path.$quote.')'; 1115 }, $css); 1116 } 1117 1118 /** 1066 1119 * Accepts a string on unminified CSS and removes spaces and comments. 1067 1120 * … … 1136 1189 error_log('Error: Unable to retrieve css content from '.$css_link); 1137 1190 } 1191 1192 $css_content = $this->fix_css_urls($css_content, $css_link); 1138 1193 1139 1194 $html = preg_replace('/<link[^>]+rel\s*=\s*[\'"]?stylesheet[\'"]?[^>]+href\s*=\s*[\'"]?'.preg_quote($css_link, '/').'[\'"]?[^>]*>/i', '<style>'.$this->cugz_minify_css($css_content).'</style>', $html); -
cache-using-gzip/trunk/readme.txt
r3303203 r3315193 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 2.8. 77 Stable tag: 2.8.8 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 84 84 85 85 == Changelog == 86 87 = 2.8.8 = 88 Bugfix: when move css/js inline chosen relative url's in minified css files break 89 Improvement: add message to options page with next auto preload date and time 86 90 87 91 = 2.8.7 = -
cache-using-gzip/trunk/templates/options-page.php
r3303203 r3315193 140 140 <p id="complete" class="cache-status">✔ Preloaded</p> 141 141 <p id="clean" class="cache-status">- Not preloaded</p> 142 <p><?php do_action('cugz_options_page_next_auto_preload'); ?></p> 142 143 </td> 143 144 </tr>
Note: See TracChangeset
for help on using the changeset viewer.