Plugin Directory

Changeset 3135111


Ignore:
Timestamp:
08/13/2024 06:05:33 PM (16 months ago)
Author:
LiteSpeedTech
Message:

Release v6.4

Location:
litespeed-cache
Files:
337 added
17 edited

Legend:

Unmodified
Added
Removed
  • litespeed-cache/trunk/assets/js/instant_click.min.js

    r3123399 r3135111  
    1 let t,e,n,o,i,a=null,s=65,c=new Set;const r=1111;function d(t){o=performance.now();const e=t.target.closest("a");m(e)&&p(e.href,"high")}function u(t){if(performance.now()-o<r)return;if(!("closest"in t.target))return;const e=t.target.closest("a");m(e)&&(e.addEventListener("mouseout",f,{passive:!0}),i=setTimeout(()=>{p(e.href,"high"),i=void 0},s))}function l(t){const e=t.target.closest("a");m(e)&&p(e.href,"high")}function f(t){t.relatedTarget&&t.target.closest("a")==t.relatedTarget.closest("a")||i&&(clearTimeout(i),i=void 0)}function h(t){if(performance.now()-o<r)return;const e=t.target.closest("a");if(t.which>1||t.metaKey||t.ctrlKey)return;if(!e)return;e.addEventListener("click",function(t){1337!=t.detail&&t.preventDefault()},{capture:!0,passive:!1,once:!0});const n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});e.dispatchEvent(n)}function m(o){if(o&&o.href&&(!n||"instant"in o.dataset)){if(o.origin!=location.origin){if(!(e||"instant"in o.dataset)||!a)return}if(["http:","https:"].includes(o.protocol)&&("http:"!=o.protocol||"https:"!=location.protocol)&&(t||!o.search||"instant"in o.dataset)&&!(o.hash&&o.pathname+o.search==location.pathname+location.search||"noInstant"in o.dataset))return!0}}function p(t,e="auto"){if(c.has(t))return;const n=document.createElement("link");n.rel="prefetch",n.href=t,n.fetchPriority=e,n.as="document",document.head.appendChild(n),c.add(t)}!function(){if(!document.createElement("link").relList.supports("prefetch"))return;const o="instantVaryAccept"in document.body.dataset||"Shopify"in window,i=navigator.userAgent.indexOf("Chrome/");i>-1&&(a=parseInt(navigator.userAgent.substring(i+"Chrome/".length)));if(o&&a&&a<110)return;const c="instantMousedownShortcut"in document.body.dataset;t="instantAllowQueryString"in document.body.dataset,e="instantAllowExternalLinks"in document.body.dataset,n="instantWhitelist"in document.body.dataset;const r={capture:!0,passive:!0};let f=!1,v=!1,g=!1;if("instantIntensity"in document.body.dataset){const t=document.body.dataset.instantIntensity;if(t.startsWith("mousedown"))f=!0,"mousedown-only"==t&&(v=!0);else if(t.startsWith("viewport")){const e=navigator.connection&&navigator.connection.saveData,n=navigator.connection&&navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g");e||n||("viewport"==t?document.documentElement.clientWidth*document.documentElement.clientHeight<45e4&&(g=!0):"viewport-all"==t&&(g=!0))}else{const e=parseInt(t);isNaN(e)||(s=e)}}v||document.addEventListener("touchstart",d,r);f?c||document.addEventListener("mousedown",l,r):document.addEventListener("mouseover",u,r);c&&document.addEventListener("mousedown",h,r);if(g){let t=window.requestIdleCallback;t||(t=(t=>{t()})),t(function(){const t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){const n=e.target;t.unobserve(n),p(n.href)}})});document.querySelectorAll("a").forEach(e=>{m(e)&&t.observe(e)})},{timeout:1500})}}();
     1let _chromiumMajorVersionInUserAgent=null,_speculationRulesType,_allowQueryString,_allowExternalLinks,_useWhitelist,_delayOnHover=65,_lastTouchstartEvent,_mouseoverTimer,_preloadedList=new Set;function init(){let e=document.createElement("link").relList,t=e.supports("prefetch")&&e.supports("modulepreload");if(!t)return;let n="instantVaryAccept"in document.body.dataset||"Shopify"in window,r=navigator.userAgent.indexOf("Chrome/");if(r>-1&&(_chromiumMajorVersionInUserAgent=parseInt(navigator.userAgent.substring(r+7))),n&&_chromiumMajorVersionInUserAgent&&_chromiumMajorVersionInUserAgent<110)return;if(_speculationRulesType="none",HTMLScriptElement.supports&&HTMLScriptElement.supports("speculationrules")){let s=document.body.dataset.instantSpecrules;"prerender"==s?_speculationRulesType="prerender":"no"!=s&&(_speculationRulesType="prefetch")}let i="instantMousedownShortcut"in document.body.dataset;_allowQueryString="instantAllowQueryString"in document.body.dataset,_allowExternalLinks="instantAllowExternalLinks"in document.body.dataset,_useWhitelist="instantWhitelist"in document.body.dataset;let o=!1,a=!1,l=!1;if("instantIntensity"in document.body.dataset){let u=document.body.dataset.instantIntensity;if("mousedown"!=u||i||(o=!0),"mousedown-only"!=u||i||(o=!0,a=!0),"viewport"==u){let c=document.documentElement.clientWidth*document.documentElement.clientHeight<45e4,d=navigator.connection&&navigator.connection.saveData,p=navigator.connection&&navigator.connection.effectiveType&&navigator.connection.effectiveType.includes("2g");!c||d||p||(l=!0)}"viewport-all"==u&&(l=!0);let h=parseInt(u);isNaN(h)||(_delayOnHover=h)}let m={capture:!0,passive:!0};if(a?document.addEventListener("touchstart",touchstartEmptyListener,m):document.addEventListener("touchstart",touchstartListener,m),o||document.addEventListener("mouseover",mouseoverListener,m),o&&document.addEventListener("mousedown",mousedownListener,m),i&&document.addEventListener("mousedown",mousedownShortcutListener,m),l){let f=window.requestIdleCallback;f||(f=e=>{e()}),f(function e(){let t=new IntersectionObserver(e=>{e.forEach(e=>{if(e.isIntersecting){let n=e.target;t.unobserve(n),preload(n.href)}})});document.querySelectorAll("a").forEach(e=>{isPreloadable(e)&&t.observe(e)})},{timeout:1500})}}function touchstartListener(e){_lastTouchstartEvent=e;let t=e.target.closest("a");isPreloadable(t)&&preload(t.href,"high")}function touchstartEmptyListener(e){_lastTouchstartEvent=e}function mouseoverListener(e){if(isEventLikelyTriggeredByTouch(e)||!("closest"in e.target))return;let t=e.target.closest("a");isPreloadable(t)&&(t.addEventListener("mouseout",mouseoutListener,{passive:!0}),_mouseoverTimer=setTimeout(()=>{preload(t.href,"high"),_mouseoverTimer=null},_delayOnHover))}function mousedownListener(e){if(isEventLikelyTriggeredByTouch(e))return;let t=e.target.closest("a");isPreloadable(t)&&preload(t.href,"high")}function mouseoutListener(e){(!e.relatedTarget||e.target.closest("a")!=e.relatedTarget.closest("a"))&&_mouseoverTimer&&(clearTimeout(_mouseoverTimer),_mouseoverTimer=null)}function mousedownShortcutListener(e){if(isEventLikelyTriggeredByTouch(e))return;let t=e.target.closest("a");if(e.which>1||e.metaKey||e.ctrlKey||!t)return;t.addEventListener("click",function(e){1337!=e.detail&&e.preventDefault()},{capture:!0,passive:!1,once:!0});let n=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!1,detail:1337});t.dispatchEvent(n)}function isEventLikelyTriggeredByTouch(e){if(!_lastTouchstartEvent||!e||e.target!=_lastTouchstartEvent.target)return!1;let t=e.timeStamp,n=t-_lastTouchstartEvent.timeStamp;return n<2500}function isPreloadable(e){if(e&&e.href&&(!_useWhitelist||"instant"in e.dataset)&&(e.origin==location.origin||(_allowExternalLinks||"instant"in e.dataset)&&_chromiumMajorVersionInUserAgent)){if(["http:","https:"].includes(e.protocol)&&("http:"!=e.protocol||"https:"!=location.protocol)&&(_allowQueryString||!e.search||"instant"in e.dataset)&&(!e.hash||e.pathname+e.search!=location.pathname+location.search)&&!("noInstant"in e.dataset))return!0}}function preload(e,t="auto"){!_preloadedList.has(e)&&("none"!=_speculationRulesType?preloadUsingSpeculationRules(e):preloadUsingLinkElement(e,t),_preloadedList.add(e))}function preloadUsingSpeculationRules(e){let t=document.createElement("script");t.type="speculationrules",t.textContent=JSON.stringify({[_speculationRulesType]:[{source:"list",urls:[e]}]}),document.head.appendChild(t)}function preloadUsingLinkElement(e,t="auto"){let n=document.createElement("link");n.rel="prefetch",n.href=e,n.fetchPriority=t,n.as="document",document.head.appendChild(n)}init();
  • litespeed-cache/trunk/assets/js/iziModal.min.js

    r2292926 r3135111  
    11/*
    22* iziModal | v1.6.0
    3 * http://izimodal.marcelodolce.com
     3* https://izimodal.marcelodolza.com/
    44* by Marcelo Dolce.
    55*/
  • litespeed-cache/trunk/cli/online.cls.php

    r3009052 r3135111  
    11<?php
     2
    23namespace LiteSpeed\CLI;
     4
    35defined('WPINC') || exit();
    46
  • litespeed-cache/trunk/litespeed-cache.php

    r3127657 r3135111  
    55 * Plugin URI:        https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
    66 * Description:       High-performance page caching and site optimization from LiteSpeed
    7  * Version:           6.3.0.1
     7 * Version:           6.4
    88 * Author:            LiteSpeed Technologies
    99 * Author URI:        https://www.litespeedtech.com
     
    3535}
    3636
    37 !defined('LSCWP_V') && define('LSCWP_V', '6.3.0.1');
     37!defined('LSCWP_V') && define('LSCWP_V', '6.4');
    3838
    3939!defined('LSCWP_CONTENT_DIR') && define('LSCWP_CONTENT_DIR', WP_CONTENT_DIR);
  • litespeed-cache/trunk/readme.txt

    r3127657 r3135111  
    11=== LiteSpeed Cache ===
    22Contributors: LiteSpeedTech
    3 Tags: caching, optimize, performance, pagespeed, core web vitals, seo, speed, image optimize, compress, object cache, redis, memcached, database cleaner
     3Tags: caching, optimize, performance, pagespeed, seo, image optimize, object cache, redis, memcached, database cleaner
    44Requires at least: 4.0
    5 Tested up to: 6.6
    6 Stable tag: 6.3.0.1
     5Tested up to: 6.6.1
     6Stable tag: 6.4
    77License: GPLv3
    88License URI: http://www.gnu.org/licenses/gpl.html
     
    251251== Changelog ==
    252252
     253= 6.4 - Aug 13 2024 =
     254* **Cache** Corrected QC and LSADC cache hit status.
     255* **Cloud** Allow partner info removal in QUIC.cloud notification.
     256* **Crawler** Separated CSS preparation validation from crawler validation.
     257* **GUI** Moved `WordPress Image Quality Control` setting from `Image Optimization` menu to `Page Optimization` menu.
     258* **3rd** Add Elementor Edit button back in ESI. (PR#635)
     259* **3rd** Fixed Instant click potential conflict w/ other plugins.
     260
    253261= 6.3.0.1 - Jul 29 2024 =
    254262* 🔥🐞**Rest** Disabled WP default Editor cache for REST requests to fix editor errors. (Shivam)
  • litespeed-cache/trunk/src/base.cls.php

    r3123399 r3135111  
    217217    const O_MEDIA_VPI = 'media-vpi';
    218218    const O_MEDIA_VPI_CRON = 'media-vpi_cron';
     219    const O_IMG_OPTM_JPG_QUALITY = 'img_optm-jpg_quality';
    219220
    220221    ## -------------------------------------------------- ##
     
    230231    const O_IMG_OPTM_WEBP_ATTR = 'img_optm-webp_attr';
    231232    const O_IMG_OPTM_WEBP_REPLACE_SRCSET = 'img_optm-webp_replace_srcset';
    232     const O_IMG_OPTM_JPG_QUALITY = 'img_optm-jpg_quality';
    233233
    234234    ## -------------------------------------------------- ##
  • litespeed-cache/trunk/src/cdn-setup.cls.php

    r3123399 r3135111  
    130130                '🎊 ' . __('Congratulations, QUIC.cloud successfully set this domain up for the CDN. Please update your nameservers to:', 'litespeed-cache') . $nameservers
    131131            );
     132        } elseif (isset($result['cname'])) {
     133            if (isset($this->_summary['cdn_setup_err'])) {
     134                unset($this->_summary['cdn_setup_err']);
     135            }
     136            if (isset($result['summary'])) {
     137                $this->_summary['cdn_dns_summary'] = $result['summary'];
     138            }
     139            $this->cls('Cloud')->set_linked();
     140            $cname = esc_html($result['cname']);
     141            $this->cls('Conf')->update_confs(array(self::O_QC_CNAME => $cname, self::O_CDN_QUIC => true));
     142            Admin_Display::succeed('🎊 ' . __('Congratulations, QUIC.cloud successfully set this domain up for the CDN. Please update your cname to:', 'litespeed-cache') . $cname);
    132143        } elseif (isset($result['done'])) {
    133144            if (isset($this->_summary['cdn_setup_err'])) {
  • litespeed-cache/trunk/src/cloud.cls.php

    r3123399 r3135111  
    869869            // Store generic info
    870870            foreach (array('usage', 'promo', 'partner', '_error', '_info', '_note', '_success') as $v) {
    871                 if (!empty($json['_carry_on'][$v])) {
     871                if (isset($json['_carry_on'][$v])) {
    872872                    switch ($v) {
    873873                        case 'usage':
  • litespeed-cache/trunk/src/crawler.cls.php

    r3123399 r3135111  
    239239    {
    240240        self::debug('------------async-------------start_async_handler');
    241         // self::debug('-------------async------------ check_ajax_referer');
    242         // add_action('check_ajax_referer', function ($a, $b) {
    243         //  \LiteSpeed\Crawler::debug('---------------' . $a . $b);
    244         // });
    245241        // check_ajax_referer('async_crawler', 'nonce');
    246         // self::debug('--------------async----------- start async crawling');
    247242        self::start($manually_run);
    248243    }
     
    264259            self::debug('......crawler manually ran......');
    265260        }
    266         // $i = 0;
    267         // while ($i < 100) {
    268         //  self::debug('......sleep ' . ($i++) . '......' . time());
    269         //  sleep(1);
    270         // }
    271         // return;
    272261
    273262        self::cls()->_crawl_data($manually_run);
     
    372361            $vary_val = $this->cls('Vary')->finalize_default_vary($current_crawler['uid']);
    373362            $this->_crawler_conf['cookies'][$vary_name] = $vary_val;
    374             $this->_crawler_conf['cookies']['litespeed_role'] = $current_crawler['uid'];
     363            $this->_crawler_conf['cookies']['litespeed_hash'] = Router::cls()->get_hash($current_crawler['uid']);
    375364        }
    376365
     
    897886        }
    898887
    899         $_cache_headers = array('x-litespeed-cache', 'x-lsadc-cache', 'x-qc-cache');
     888        $_cache_headers = array('x-qc-cache', 'x-lsadc-cache', 'x-litespeed-cache');
    900889
    901890        foreach ($_cache_headers as $_header) {
     
    985974        $options[CURLOPT_USERAGENT] = $this->_crawler_conf['ua'];
    986975
    987         /**
    988          * Append hash to cookie for validation
    989          * @since  1.9.1
    990          */
    991         if ($crawler_only) {
    992             $this->_crawler_conf['cookies']['litespeed_hash'] = Router::get_hash();
    993         }
    994 
    995976        // Cookies
    996977        $cookies = array();
     
    10221003        }
    10231004        if ($uid) {
    1024             $this->_crawler_conf['cookies']['litespeed_role'] = $uid;
    1025             $this->_crawler_conf['cookies']['litespeed_hash'] = Router::get_hash();
     1005            $this->_crawler_conf['cookies']['litespeed_flash_hash'] = Router::cls()->get_flash_hash($uid);
    10261006        }
    10271007
     
    13261306                break;
    13271307
    1328             // Handle the ajax request to proceed crawler manually by admin
    1329             case self::TYPE_START:
     1308            case self::TYPE_START: // Handle the ajax request to proceed crawler manually by admin
    13301309                self::start_async();
    13311310                break;
  • litespeed-cache/trunk/src/error.cls.php

    r3123399 r3135111  
    6262
    6363            case 'out_of_daily_quota':
    64                 $msg = __('You don\'t have enough daily quota left for current service today.', 'litespeed-cache');
     64                $msg = __('You have used all of your daily quota for today.', 'litespeed-cache');
     65                $msg .=
     66                    ' ' .
     67                    Doc::learn_more(
     68                        'https://docs.quic.cloud/billing/services/#daily-limits-on-free-quota-usage',
     69                        __('Learn more or purchase additional quota.', 'litespeed-cache'),
     70                        false,
     71                        false,
     72                        true
     73                    );
    6574                break;
    6675
    6776            case 'out_of_quota':
    68                 $msg = __('You don\'t have enough quota left for current service this month.', 'litespeed-cache');
     77                $msg = __('You have used all of your quota left for current service this month.', 'litespeed-cache');
     78                $msg .=
     79                    ' ' .
     80                    Doc::learn_more(
     81                        'https://docs.quic.cloud/billing/services/#daily-limits-on-free-quota-usage',
     82                        __('Learn more or purchase additional quota.', 'litespeed-cache'),
     83                        false,
     84                        false,
     85                        true
     86                    );
    6987                break;
    7088
  • litespeed-cache/trunk/src/esi.cls.php

    r3123399 r3135111  
    2222    private static $has_esi = false;
    2323    private static $_combine_ids = array();
     24    private $admin_rendered = false;
    2425    private $esi_args = null;
    2526    private $_esi_preserve_list = array();
     
    365366        // Add admin_bar esi
    366367        if (Router::is_logged_in()) {
     368            // Remove default Admin bar. Fix https://github.com/elementor/elementor/issues/25198
     369            remove_action('wp_body_open', 'wp_admin_bar_render', 0);
     370            add_action('wp_body_open', array($this, 'sub_admin_bar_block'), 0);
    367371            remove_action('wp_footer', 'wp_admin_bar_render', 1000);
    368372            add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000);
     
    767771        global $wp_admin_bar;
    768772
     773        if ($this->admin_rendered) {
     774            return;
     775        }
     776
    769777        if (!is_admin_bar_showing() || !is_object($wp_admin_bar)) {
    770778            return;
     
    776784        );
    777785
     786        $this->admin_rendered = true;
    778787        echo $this->sub_esi_block('admin-bar', 'adminbar', $params);
    779788    }
  • litespeed-cache/trunk/src/router.cls.php

    r3123399 r3135111  
    11<?php
     2
    23/**
    34 * The core plugin router class.
     
    89 * @since       1.5 Moved into /inc
    910 */
     11
    1012namespace LiteSpeed;
     13
    1114defined('WPINC') || exit();
    1215
    1316class Router extends Base
    1417{
     18    const LOG_TAG = '[Router]';
     19
    1520    const NONCE = 'LSCWP_NONCE';
    1621    const ACTION = 'LSCWP_CTRL';
     
    6469
    6570    const ITEM_HASH = 'hash';
     71    const ITEM_FLASH_HASH = 'flash_hash';
    6672
    6773    private static $_esi_enabled;
     
    241247        }
    242248
    243         if (empty($_COOKIE['litespeed_role']) || empty($_COOKIE['litespeed_hash'])) {
     249        if (empty($_COOKIE['litespeed_hash']) && empty($_COOKIE['litespeed_flash_hash'])) {
    244250            return;
    245251        }
    246252
    247         Debug2::debug('[Router] starting role validation');
     253        self::debug('starting role validation');
    248254
    249255        // Check if is from crawler
     
    253259        // }
    254260
     261        // Flash hash validation
     262        if (!empty($_COOKIE['litespeed_flash_hash'])) {
     263            $hash_data = self::get_option(self::ITEM_FLASH_HASH, array());
     264            if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts']) && !empty($hash_data['uid'])) {
     265                if (time() - $hash_data['ts'] < 120 && $_COOKIE['litespeed_flash_hash'] == $hash_data['hash']) {
     266                    self::debug('role simulate uid ' . $hash_data['uid']);
     267                    self::delete_option(self::ITEM_FLASH_HASH);
     268                    wp_set_current_user($hash_data['uid']);
     269                    return;
     270                }
     271            }
     272        }
    255273        // Hash validation
    256         $hash = self::get_option(self::ITEM_HASH);
    257         if (!$hash || $_COOKIE['litespeed_hash'] != $hash) {
    258             Debug2::debug('[Router] hash not match ' . $_COOKIE['litespeed_hash'] . ' != ' . $hash);
    259             return;
    260         }
    261 
    262         $role_uid = $_COOKIE['litespeed_role'];
    263         Debug2::debug('[Router] role simulate litespeed_role uid ' . $role_uid);
    264 
    265         wp_set_current_user($role_uid);
     274        if (!empty($_COOKIE['litespeed_hash'])) {
     275            $hash_data = self::get_option(self::ITEM_HASH, array());
     276            if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts']) && !empty($hash_data['uid'])) {
     277                if (time() - $hash_data['ts'] < $this->conf(Base::O_CRAWLER_RUN_DURATION) && $_COOKIE['litespeed_hash'] == $hash_data['hash']) {
     278                    if (empty($hash_data['ip'])) {
     279                        $hash_data['ip'] = self::get_ip();
     280                        self::update_option(self::ITEM_HASH, $hash_data);
     281                    } else {
     282                        $server_ips = apply_filters('litespeed_server_ips', array($hash_data['ip']));
     283                        if (!self::ip_access($server_ips)) {
     284                            self::debug('WARNING: role simulator ip check failed [db ip] ' . $hash_data['ip'], $server_ips);
     285                            return;
     286                        }
     287                    }
     288                    wp_set_current_user($hash_data['uid']);
     289                    return;
     290                }
     291            }
     292        }
     293
     294        self::debug('WARNING: role simulator hash not match');
     295    }
     296
     297    /**
     298     * Get a short ttl hash (2mins)
     299     *
     300     * @since  6.4
     301     */
     302    public function get_flash_hash($uid)
     303    {
     304        $hash_data = self::get_option(self::ITEM_FLASH_HASH, array());
     305        if ($hash_data && is_array($hash_data) && !empty($hash_data['hash']) && !empty($hash_data['ts'])) {
     306            if (time() - $hash_data['ts'] < 60) {
     307                return $hash_data['hash'];
     308            }
     309        }
     310
     311        $hash = Str::rrand(32);
     312        self::update_option(self::ITEM_FLASH_HASH, array('hash' => $hash, 'ts' => time(), 'uid' => $uid));
     313        return $hash;
    266314    }
    267315
     
    271319     * @since  3.3
    272320     */
    273     public static function get_hash()
    274     {
    275         // Reuse previous hash if existed
    276         $hash = self::get_option(self::ITEM_HASH);
    277         if ($hash) {
    278             return $hash;
    279         }
    280 
    281         $hash = Str::rrand(6);
    282         self::update_option(self::ITEM_HASH, $hash);
     321    public function get_hash($uid)
     322    {
     323        // As this is called only when starting crawling, not per page, no need to reuse
     324        $hash = Str::rrand(32);
     325        self::update_option(self::ITEM_HASH, array('hash' => $hash, 'ts' => time(), 'uid' => $uid));
    283326        return $hash;
    284327    }
     
    541584
    542585        switch ($action) {
    543             // Save network settings
    544             case self::ACTION_SAVE_SETTINGS_NETWORK:
     586            case self::ACTION_SAVE_SETTINGS_NETWORK: // Save network settings
    545587                if ($_can_network_option) {
    546588                    self::$_action = $action;
  • litespeed-cache/trunk/src/task.cls.php

    r3123399 r3135111  
    7777    public static function async_litespeed_handler()
    7878    {
     79        $hash_data = self::get_option('async_call-hash', array());
     80        if (!$hash_data || !is_array($hash_data) || empty($hash_data['hash']) || empty($hash_data['ts'])) {
     81            self::debug('async_litespeed_handler no hash data', $hash_data);
     82            return;
     83        }
     84        if (time() - $hash_data['ts'] > 120 || empty($_GET['nonce']) || $_GET['nonce'] != $hash_data['hash']) {
     85            self::debug('async_litespeed_handler nonce mismatch');
     86            return;
     87        }
     88        self::delete_option('async_call-hash');
     89
    7990        $type = Router::verify_type();
    80 
    8191        self::debug('type=' . $type);
    8292
     
    107117    public static function async_call($type)
    108118    {
     119        $hash = Str::rrand(32);
     120        self::update_option('async_call-hash', array('hash' => $hash, 'ts' => time()));
    109121        $args = array(
    110122            'timeout' => 0.01,
     
    115127        $qs = array(
    116128            'action' => 'async_litespeed',
    117             'nonce' => wp_create_nonce('async_litespeed'),
     129            'nonce' => $hash,
    118130            Router::TYPE => $type,
    119131        );
  • litespeed-cache/trunk/thirdparty/perfmatters.cls.php

    r3009052 r3135111  
    11<?php
     2
    23/**
    34 * The Third Party integration with the Perfmatters plugin.
     
    56 * @since       4.4.5
    67 */
     8
    79namespace LiteSpeed\Thirdparty;
     10
    811defined('WPINC') || exit();
    912
     
    2831    {
    2932        defined('LITESPEED_ESI_OFF') || define('LITESPEED_ESI_OFF', true);
     33        do_action('litespeed_debug', 'Disable ESI due to Perfmatters script manager');
    3034    }
    3135}
  • litespeed-cache/trunk/tpl/img_optm/settings.tpl.php

    r2808204 r3135111  
    11<?php
     2
    23namespace LiteSpeed;
    3 defined( 'WPINC' ) || exit;
     4
     5defined('WPINC') || exit;
    46
    57$this->form_action();
     
    79
    810<h3 class="litespeed-title-short">
    9     <?php echo __( 'Image Optimization Settings', 'litespeed-cache' ); ?>
    10     <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-settings-tab' ); ?>
     11    <?php echo __('Image Optimization Settings', 'litespeed-cache'); ?>
     12    <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/imageopt/#image-optimization-settings-tab'); ?>
    1113</h3>
    1214
    13 <table class="wp-list-table striped litespeed-table"><tbody>
     15<table class="wp-list-table striped litespeed-table">
     16    <tbody>
    1417
    15     <tr>
    16         <th>
    17             <?php $id = Base::O_IMG_OPTM_AUTO; ?>
    18             <?php $this->title( $id ); ?>
    19         </th>
    20         <td>
    21             <?php $this->build_switch( $id ); ?>
    22             <div class="litespeed-desc">
    23                 <?php echo __( 'Automatically request optimization via cron job.', 'litespeed-cache' ); ?>
    24             </div>
    25         </td>
    26     </tr>
     18        <tr>
     19            <th>
     20                <?php $id = Base::O_IMG_OPTM_AUTO; ?>
     21                <?php $this->title($id); ?>
     22            </th>
     23            <td>
     24                <?php $this->build_switch($id); ?>
     25                <div class="litespeed-desc">
     26                    <?php echo __('Automatically request optimization via cron job.', 'litespeed-cache'); ?>
     27                </div>
     28            </td>
     29        </tr>
    2730
    28     <tr>
    29         <th>
    30             <?php $id = Base::O_IMG_OPTM_CRON; ?>
    31             <?php $this->title( $id ); ?>
    32         </th>
    33         <td>
    34             <?php $this->build_switch( $id ); ?>
    35             <div class="litespeed-desc">
    36                 <?php echo __( 'Disabling this will stop the cron job responsible for pulling optimized images back from QUIC.cloud Image Server.', 'litespeed-cache' ); ?>
    37             </div>
    38         </td>
    39     </tr>
     31        <tr>
     32            <th>
     33                <?php $id = Base::O_IMG_OPTM_CRON; ?>
     34                <?php $this->title($id); ?>
     35            </th>
     36            <td>
     37                <?php $this->build_switch($id); ?>
     38                <div class="litespeed-desc">
     39                    <?php echo __('Disabling this will stop the cron job responsible for pulling optimized images back from QUIC.cloud Image Server.', 'litespeed-cache'); ?>
     40                </div>
     41            </td>
     42        </tr>
    4043
    41     <tr>
    42         <th>
    43             <?php $id = Base::O_IMG_OPTM_ORI; ?>
    44             <?php $this->title( $id ); ?>
    45         </th>
    46         <td>
    47             <?php $this->build_switch( $id ); ?>
    48             <div class="litespeed-desc">
    49                 <?php echo __( 'Optimize images and save backups of the originals in the same folder.', 'litespeed-cache' ); ?>
    50             </div>
    51         </td>
    52     </tr>
     44        <tr>
     45            <th>
     46                <?php $id = Base::O_IMG_OPTM_ORI; ?>
     47                <?php $this->title($id); ?>
     48            </th>
     49            <td>
     50                <?php $this->build_switch($id); ?>
     51                <div class="litespeed-desc">
     52                    <?php echo __('Optimize images and save backups of the originals in the same folder.', 'litespeed-cache'); ?>
     53                </div>
     54            </td>
     55        </tr>
    5356
    54     <tr>
    55         <th>
    56             <?php $id = Base::O_IMG_OPTM_RM_BKUP; ?>
    57             <?php $this->title( $id ); ?>
    58         </th>
    59         <td>
    60             <?php $this->build_switch( $id ); ?>
    61             <div class="litespeed-desc">
    62                 <?php echo __( 'Automatically remove the original image backups after fetching optimized images.', 'litespeed-cache' ); ?>
     57        <tr>
     58            <th>
     59                <?php $id = Base::O_IMG_OPTM_RM_BKUP; ?>
     60                <?php $this->title($id); ?>
     61            </th>
     62            <td>
     63                <?php $this->build_switch($id); ?>
     64                <div class="litespeed-desc">
     65                    <?php echo __('Automatically remove the original image backups after fetching optimized images.', 'litespeed-cache'); ?>
    6366
    64                 <br /><font class="litespeed-danger">
    65                     🚨
    66                     <?php echo __( 'This is irreversible.', 'litespeed-cache' ); ?>
    67                     <?php echo __( 'You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache' ); ?>
    68                 </font>
    69             </div>
    70         </td>
    71     </tr>
     67                    <br />
     68                    <font class="litespeed-danger">
     69                        🚨
     70                        <?php echo __('This is irreversible.', 'litespeed-cache'); ?>
     71                        <?php echo __('You will be unable to Revert Optimization once the backups are deleted!', 'litespeed-cache'); ?>
     72                    </font>
     73                </div>
     74            </td>
     75        </tr>
    7276
    73     <tr>
    74         <th>
    75             <?php $id = Base::O_IMG_OPTM_LOSSLESS; ?>
    76             <?php $this->title( $id ); ?>
    77         </th>
    78         <td>
    79             <?php $this->build_switch( $id ); ?>
    80             <div class="litespeed-desc">
    81                 <?php echo __( 'Optimize images using lossless compression.', 'litespeed-cache' ); ?>
    82                 <?php echo __( 'This can improve quality but may result in larger images than lossy compression will.', 'litespeed-cache' ); ?>
    83             </div>
    84         </td>
    85     </tr>
     77        <tr>
     78            <th>
     79                <?php $id = Base::O_IMG_OPTM_LOSSLESS; ?>
     80                <?php $this->title($id); ?>
     81            </th>
     82            <td>
     83                <?php $this->build_switch($id); ?>
     84                <div class="litespeed-desc">
     85                    <?php echo __('Optimize images using lossless compression.', 'litespeed-cache'); ?>
     86                    <?php echo __('This can improve quality but may result in larger images than lossy compression will.', 'litespeed-cache'); ?>
     87                </div>
     88            </td>
     89        </tr>
    8690
    87     <tr>
    88         <th>
    89             <?php $id = Base::O_IMG_OPTM_EXIF; ?>
    90             <?php $this->title( $id ); ?>
    91         </th>
    92         <td>
    93             <?php $this->build_switch( $id ); ?>
    94             <div class="litespeed-desc">
    95                 <?php echo __( 'Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing.', 'litespeed-cache' ); ?>
    96                 <?php echo __( 'This will increase the size of optimized files.', 'litespeed-cache' ); ?>
    97             </div>
    98         </td>
    99     </tr>
     91        <tr>
     92            <th>
     93                <?php $id = Base::O_IMG_OPTM_EXIF; ?>
     94                <?php $this->title($id); ?>
     95            </th>
     96            <td>
     97                <?php $this->build_switch($id); ?>
     98                <div class="litespeed-desc">
     99                    <?php echo __('Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing.', 'litespeed-cache'); ?>
     100                    <?php echo __('This will increase the size of optimized files.', 'litespeed-cache'); ?>
     101                </div>
     102            </td>
     103        </tr>
    100104
    101     <?php
    102         if ( ! is_multisite() ) :
     105        <?php
     106        if (!is_multisite()) :
    103107            // webp
    104108            require LSCWP_DIR . 'tpl/img_optm/settings.media_webp.tpl.php';
    105109
    106110        endif;
    107     ?>
     111        ?>
    108112
    109     <tr>
    110         <th>
    111             <?php $id = Base::O_IMG_OPTM_WEBP_ATTR; ?>
    112             <?php $this->title( $id ); ?>
    113         </th>
    114         <td>
     113        <tr>
     114            <th>
     115                <?php $id = Base::O_IMG_OPTM_WEBP_ATTR; ?>
     116                <?php $this->title($id); ?>
     117            </th>
     118            <td>
    115119
    116             <div class="litespeed-textarea-recommended">
    117                 <div>
    118                     <?php $this->build_textarea( $id, 40 ); ?>
     120                <div class="litespeed-textarea-recommended">
     121                    <div>
     122                        <?php $this->build_textarea($id, 40); ?>
     123                    </div>
     124                    <div>
     125                        <?php $this->recommended($id); ?>
     126                    </div>
    119127                </div>
    120                 <div>
    121                     <?php $this->recommended( $id ); ?>
     128
     129                <div class="litespeed-desc">
     130                    <?php echo __('Specify which element attributes will be replaced with WebP.', 'litespeed-cache'); ?>
     131                    <?php echo __('Only attributes listed here will be replaced.', 'litespeed-cache'); ?>
     132                    <br /><?php echo sprintf(__('Use the format %1$s or %2$s (element is optional).', 'litespeed-cache'), '<code>element.attribute</code>', '<code>.attribute</code>'); ?>
     133                    <?php Doc::one_per_line(); ?>
    122134                </div>
    123             </div>
     135            </td>
     136        </tr>
    124137
    125             <div class="litespeed-desc">
    126                 <?php echo __( 'Specify which element attributes will be replaced with WebP.', 'litespeed-cache' ); ?>
    127                 <?php echo __( 'Only attributes listed here will be replaced.', 'litespeed-cache' ); ?>
    128                 <br /><?php echo sprintf( __( 'Use the format %1$s or %2$s (element is optional).', 'litespeed-cache' ), '<code>element.attribute</code>', '<code>.attribute</code>' ); ?>
    129                 <?php Doc::one_per_line(); ?>
    130             </div>
    131         </td>
    132     </tr>
     138        <tr>
     139            <th>
     140                <?php $id = Base::O_IMG_OPTM_WEBP_REPLACE_SRCSET; ?>
     141                <?php $this->title($id); ?>
     142            </th>
     143            <td>
     144                <?php $this->build_switch($id); ?>
     145                <div class="litespeed-desc">
     146                    <?php echo sprintf(__('Enable replacement of WebP in %s elements that were generated outside of WordPress logic.', 'litespeed-cache'), '<code>srcset</code>'); ?>
     147                    <?php Doc::learn_more('https://docs.litespeedtech.com/lscache/lscwp/imageopt/#webp-for-extra-srcset'); ?>
     148                </div>
     149            </td>
     150        </tr>
    133151
    134     <tr>
    135         <th>
    136             <?php $id = Base::O_IMG_OPTM_WEBP_REPLACE_SRCSET; ?>
    137             <?php $this->title( $id ); ?>
    138         </th>
    139         <td>
    140             <?php $this->build_switch( $id ); ?>
    141             <div class="litespeed-desc">
    142                 <?php echo sprintf( __( 'Enable replacement of WebP in %s elements that were generated outside of WordPress logic.', 'litespeed-cache' ), '<code>srcset</code>' ); ?>
    143                 <?php Doc::learn_more( 'https://docs.litespeedtech.com/lscache/lscwp/imageopt/#webp-for-extra-srcset' ); ?>
    144             </div>
    145         </td>
    146     </tr>
    147 
    148     <tr>
    149         <th>
    150             <?php $id = Base::O_IMG_OPTM_JPG_QUALITY; ?>
    151             <?php $this->title( $id ); ?>
    152         </th>
    153         <td>
    154             <?php $this->build_input( $id, 'litespeed-input-short' ); ?>
    155             <div class="litespeed-desc">
    156                 <?php echo __('The image compression quality setting of WordPress out of 100.', 'litespeed-cache'); ?>
    157                 <?php $this->recommended( $id ); ?>
    158                 <?php $this->_validate_ttl( $id, 0, 100 ); ?>
    159             </div>
    160         </td>
    161     </tr>
    162 </tbody></table>
     152    </tbody>
     153</table>
    163154
    164155<?php
    165156
    166157$this->form_end();
    167 
    168 
    169 
  • litespeed-cache/trunk/tpl/page_optm/settings_media.tpl.php

    r3076030 r3135111  
    250250        </tr>
    251251
     252        <tr>
     253            <th>
     254                <?php $id = Base::O_IMG_OPTM_JPG_QUALITY; ?>
     255                <?php $this->title($id); ?>
     256            </th>
     257            <td>
     258                <?php $this->build_input($id, 'litespeed-input-short'); ?>
     259                <div class="litespeed-desc">
     260                    <?php echo __('The image compression quality setting of WordPress out of 100.', 'litespeed-cache'); ?>
     261                    <?php $this->recommended($id); ?>
     262                    <?php $this->_validate_ttl($id, 0, 100); ?>
     263                </div>
     264            </td>
     265        </tr>
    252266    </tbody>
    253267</table>
  • litespeed-cache/trunk/tpl/toolbox/beta_test.tpl.php

    r3127657 r3135111  
    77// Existing public version list
    88$v_list = array(
     9    '6.4',
    910    '6.3.0.1',
    1011    '6.2.0.1',
Note: See TracChangeset for help on using the changeset viewer.