Plugin Directory

Changeset 3321408


Ignore:
Timestamp:
07/02/2025 06:07:52 PM (9 months ago)
Author:
marknokes
Message:

Version 2.9.0

Location:
cache-using-gzip
Files:
20 added
3 edited

Legend:

Unmodified
Added
Removed
  • cache-using-gzip/trunk/cache-using-gzip.php

    r3316386 r3321408  
    55/*
    66 * Plugin Name: Cache Using Gzip
    7  * Version: 2.8.9
     7 * Version: 2.9.0
    88 * Description: Creates gzip files on your server to immensly improve page speed for site visitors
    99 * Author: Cache Using Gzip
  • cache-using-gzip/trunk/classes/CUGZ/class-cugz-gzip-cache.php

    r3316386 r3321408  
    217217        $this->site_url = get_site_url();
    218218
    219         $this->host = getenv('HTTP_HOST');
    220 
    221         $this->cache_dir = strtok(WP_CONTENT_DIR.'/cugz_gzip_cache/'.$this->host, ':');
     219        $this->host = $this->get_host();
     220
     221        $this->cache_dir = WP_CONTENT_DIR.'/cugz_gzip_cache/'.$this->host;
    222222
    223223        $this->settings_url = admin_url(self::$options_page_url);
     
    13251325
    13261326    /**
     1327     * Retrieves the hostname for use in the cache directory file path.
     1328     *
     1329     * @return string the hostname or localhost if unable to determine
     1330     */
     1331    private function get_host()
     1332    {
     1333        if (!empty($_SERVER['HTTP_HOST'])) {
     1334            $host = $_SERVER['HTTP_HOST'];
     1335        } elseif ($env_host = getenv('HTTP_HOST')) {
     1336            $host = $env_host;
     1337        } elseif (!empty($_SERVER['SERVER_NAME'])) {
     1338            $host = $_SERVER['SERVER_NAME'];
     1339        } else {
     1340            $host = 'localhost';
     1341        }
     1342
     1343        $host = strtolower($host);
     1344        $host = preg_replace('/:\d+$/', '', $host); // remove port if present
     1345        $host = preg_replace('/[^a-z0-9\-\.]/', '_', $host); // replace unwanted chars
     1346
     1347        return $host;
     1348    }
     1349
     1350    /**
    13271351     * Updates the value of a specified option in the WordPress database.
    13281352     *
  • cache-using-gzip/trunk/readme.txt

    r3316386 r3321408  
    55Tested up to: 6.8
    66Requires PHP: 7.4
    7 Stable tag: 2.8.9
     7Stable tag: 2.9.0
    88License: GPLv2
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    8484
    8585== Changelog ==
     86
     87= 2.9.0 =
     88Bugfix: In specific environments, the hostname is undetermined, causing the wp-content directory to be deleted upon plugin deactivation
    8689
    8790= 2.8.9 =
Note: See TracChangeset for help on using the changeset viewer.