Changeset 3263100
- Timestamp:
- 03/27/2025 08:12:12 PM (12 months ago)
- Location:
- cache-using-gzip
- Files:
-
- 20 added
- 3 edited
-
tags/2.8.5 (added)
-
tags/2.8.5/autoload.php (added)
-
tags/2.8.5/cache-using-gzip.php (added)
-
tags/2.8.5/classes (added)
-
tags/2.8.5/classes/CUGZ (added)
-
tags/2.8.5/classes/CUGZ/class-cugz-gzip-cache.php (added)
-
tags/2.8.5/css (added)
-
tags/2.8.5/css/jquery-ui.css (added)
-
tags/2.8.5/css/jquery-ui.min.css (added)
-
tags/2.8.5/css/style.css (added)
-
tags/2.8.5/css/style.min.css (added)
-
tags/2.8.5/js (added)
-
tags/2.8.5/js/main.js (added)
-
tags/2.8.5/js/main.min.js (added)
-
tags/2.8.5/license.txt (added)
-
tags/2.8.5/readme.txt (added)
-
tags/2.8.5/templates (added)
-
tags/2.8.5/templates/htaccess.sample (added)
-
tags/2.8.5/templates/nginx.conf.sample (added)
-
tags/2.8.5/templates/options-page.php (added)
-
trunk/cache-using-gzip.php (modified) (3 diffs)
-
trunk/classes/CUGZ/class-cugz-gzip-cache.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cache-using-gzip/trunk/cache-using-gzip.php
r3261720 r3263100 1 1 <?php 2 3 namespace CUGZ; 2 4 3 5 /* 4 6 * Plugin Name: Cache Using Gzip 5 * Version: 2.8. 47 * Version: 2.8.5 6 8 * Description: Creates gzip files on your server to immensly improve page speed for site visitors 7 9 * Author: Cache Using Gzip … … 19 21 } 20 22 21 use CUGZ\GzipCache;22 use CUGZ\GzipCacheEnterprise;23 use CUGZ\GzipCachePluginExtras;24 25 23 require_once 'autoload.php'; 26 24 … … 35 33 $GzipCache = new GzipCache(); 36 34 37 if (!extension_loaded('zlib')) { 38 $GzipCache->zlib_enabled = false; 39 40 add_action('admin_notices', function () use ($GzipCache) { 41 $GzipCache->cugz_notice('Zlib extension is not enabled. You must enable the zlib extension in order to use the <strong>'.esc_html($GzipCache->plugin_name).'</strong> plugin.', 'warning'); 42 }); 43 } 44 45 $GzipCache->GzipCachePluginExtras = CUGZ_PLUGIN_EXTRAS ? new GzipCachePluginExtras() : null; 35 $GzipCachePluginExtras = CUGZ_PLUGIN_EXTRAS ? new GzipCachePluginExtras() : null; 46 36 47 37 register_activation_hook(CUGZ_PLUGIN_PATH, [$GzipCache, 'cugz_plugin_activation']); -
cache-using-gzip/trunk/classes/CUGZ/class-cugz-gzip-cache.php
r3259429 r3263100 171 171 172 172 /** 173 * GzipCachePluginExtras class if exists.174 *175 * @var object176 */177 public $GzipCachePluginExtras;178 179 /**180 173 * Constructor for the class. 181 174 * Initializes class variables and sets up action hooks for option updates. … … 183 176 public function __construct() 184 177 { 185 foreach (self::$options as $option => $array) {186 if (self::cugz_skip_option($array)) {187 continue;188 }189 190 $this->{$option} = self::cugz_get_option($option);191 192 add_action("update_option_{$option}", [$this, 'cugz_clear_option_cache'], 10, 3);193 }194 195 178 $plugin_data = get_file_data(CUGZ_PLUGIN_PATH, [ 196 179 'Version' => 'Version', … … 209 192 210 193 $this->settings_url = admin_url(self::$options_page_url); 194 195 $this->cugz_set_props_from_options(); 196 197 $this->cugz_zlib_check(); 211 198 } 212 199 … … 594 581 public function cugz_get_links($post = null) 595 582 { 583 global $GzipCachePluginExtras; 584 596 585 $is_preload = null === $post; 597 586 … … 614 603 } 615 604 616 if (isset($ this->GzipCachePluginExtras)) {617 $links = $ this->GzipCachePluginExtras->get_archive_links($links, $term_ids, $cat_ids);605 if (isset($GzipCachePluginExtras)) { 606 $links = $GzipCachePluginExtras->get_archive_links($links, $term_ids, $cat_ids); 618 607 } 619 608 … … 630 619 public function cugz_create_folder_structure_from_url($url) 631 620 { 632 if (isset($this->GzipCachePluginExtras) && $this->GzipCachePluginExtras->cugz_never_cache($url)) { 621 global $GzipCachePluginExtras; 622 623 if (isset($GzipCachePluginExtras) && $GzipCachePluginExtras->cugz_never_cache($url)) { 633 624 return false; 634 625 } … … 884 875 885 876 /** 877 * Sets class properties using self::$options and adds an update_option_{option_name} hook for each one. 878 */ 879 protected function cugz_set_props_from_options() 880 { 881 foreach (self::$options as $option => $array) { 882 if (self::cugz_skip_option($array)) { 883 continue; 884 } 885 886 $this->{$option} = self::cugz_get_option($option); 887 888 add_action("update_option_{$option}", [$this, 'cugz_clear_option_cache'], 10, 3); 889 } 890 } 891 892 /** 893 * Check if the zlib extension is enabled and display an admin notice if not. 894 */ 895 protected function cugz_zlib_check() 896 { 897 if (!extension_loaded('zlib')) { 898 $this->zlib_enabled = false; 899 900 set_transient('cugz_notice', [ 901 'message' => 'Zlib extension is not enabled. You must enable the zlib extension in order to use the <strong>'.esc_html($this->plugin_name).'</strong> plugin.', 902 'type' => 'warning', 903 ], 3600); 904 } 905 } 906 907 /** 886 908 * Checks if the given array contains the necessary information to skip a certain option. 887 909 * -
cache-using-gzip/trunk/readme.txt
r3261720 r3263100 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 2.8. 47 Stable tag: 2.8.5 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 58 58 59 59 == Changelog == 60 61 = 2.8.5 = 62 Improvement: remove superfluous import statements 63 Improvement: minor refactor 60 64 61 65 = 2.8.4 =
Note: See TracChangeset
for help on using the changeset viewer.