Plugin Directory

Changeset 3359287


Ignore:
Timestamp:
09/10/2025 03:48:29 PM (3 months ago)
Author:
LiteSpeedTech
Message:

Release v7.5

Location:
litespeed-cache
Files:
346 added
21 edited

Legend:

Unmodified
Added
Removed
  • litespeed-cache/trunk/assets/css/litespeed.css

    r3352087 r3359287  
    43114311    }
    43124312
    4313     input#input_api_key + .button {
    4314         margin-top: 10px;
    4315         margin-left: 0;
    4316     }
    4317 
    4318     input#input_api_key + .button + .litespeed-desc {
    4319         display: block;
    4320     }
    4321 
    4322     input#input_api_key + .button + .litespeed-desc + .button {
    4323         margin-left: 0;
    4324     }
    4325 
    43264313    .litespeed-body .litespeed-table td .litespeed-right {
    43274314        float: none !important;
  • litespeed-cache/trunk/lang/litespeed-cache.pot

    r3352087 r3359287  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: LiteSpeed Cache 7.4\n"
     5"Project-Id-Version: LiteSpeed Cache 7.5\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2025-08-28T14:08:48+00:00\n"
     12"POT-Creation-Date: 2025-09-10T14:42:22+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.11.0\n"
     
    9090msgstr ""
    9191
    92 #: src/admin-display.cls.php:304
     92#: src/admin-display.cls.php:250
    9393#: tpl/dash/entry.tpl.php:16
    9494msgid "Dashboard"
    9595msgstr ""
    9696
    97 #: src/admin-display.cls.php:307
     97#: src/admin-display.cls.php:251
     98#: src/lang.cls.php:269
     99msgid "OptimaX"
     100msgstr ""
     101
     102#: src/admin-display.cls.php:252
    98103msgid "Presets"
    99104msgstr ""
    100105
    101 #: src/admin-display.cls.php:310
     106#: src/admin-display.cls.php:253
    102107msgid "General"
    103108msgstr ""
    104109
    105 #: src/admin-display.cls.php:311
     110#: src/admin-display.cls.php:254
     111#: src/admin-display.cls.php:264
    106112#: tpl/cache/entry.tpl.php:16
    107113#: tpl/cache/entry_network.tpl.php:16
     
    109115msgstr ""
    110116
    111 #: src/admin-display.cls.php:314
     117#: src/admin-display.cls.php:255
    112118msgid "CDN"
    113119msgstr ""
    114120
    115 #: src/admin-display.cls.php:317
     121#: src/admin-display.cls.php:256
    116122#: src/gui.cls.php:727
    117123#: tpl/dash/dashboard.tpl.php:203
     
    124130msgstr ""
    125131
    126 #: src/admin-display.cls.php:320
     132#: src/admin-display.cls.php:257
    127133#: tpl/dash/dashboard.tpl.php:204
    128134#: tpl/dash/network_dash.tpl.php:37
     
    133139msgstr ""
    134140
    135 #: src/admin-display.cls.php:323
     141#: src/admin-display.cls.php:258
    136142msgid "Database"
    137143msgstr ""
    138144
    139 #: src/admin-display.cls.php:326
    140 #: src/lang.cls.php:248
     145#: src/admin-display.cls.php:259
     146#: src/lang.cls.php:249
    141147msgid "Crawler"
    142148msgstr ""
    143149
    144 #: src/admin-display.cls.php:329
     150#: src/admin-display.cls.php:260
    145151msgid "Toolbox"
    146152msgstr ""
    147153
    148 #: src/admin-display.cls.php:403
     154#: src/admin-display.cls.php:451
    149155msgid "Cookie Name"
    150156msgstr ""
    151157
    152 #: src/admin-display.cls.php:404
     158#: src/admin-display.cls.php:452
    153159#: tpl/crawler/settings.tpl.php:179
    154160msgid "Cookie Values"
    155161msgstr ""
    156162
    157 #: src/admin-display.cls.php:406
     163#: src/admin-display.cls.php:454
    158164msgid "Remove cookie simulation"
    159165msgstr ""
    160166
    161 #: src/admin-display.cls.php:407
     167#: src/admin-display.cls.php:455
    162168msgid "Add new cookie to simulate"
    163169msgstr ""
    164170
    165 #: src/admin-display.cls.php:430
     171#: src/admin-display.cls.php:478
    166172msgid "CDN URL to be used. For example, %s"
    167173msgstr ""
    168174
    169 #: src/admin-display.cls.php:432
     175#: src/admin-display.cls.php:480
    170176msgid "Remove CDN URL"
    171177msgstr ""
    172178
    173 #: src/admin-display.cls.php:433
     179#: src/admin-display.cls.php:481
    174180msgid "Add new CDN URL"
    175181msgstr ""
    176182
    177 #: src/admin-display.cls.php:434
    178 #: src/admin-display.cls.php:1240
    179 #: src/admin-display.cls.php:1270
    180 #: src/admin-display.cls.php:1352
     183#: src/admin-display.cls.php:482
     184#: src/admin-display.cls.php:1163
     185#: src/admin-display.cls.php:1193
     186#: src/admin-display.cls.php:1275
    181187#: src/doc.cls.php:39
    182188#: tpl/cache/settings-cache.tpl.php:28
     
    194200msgstr ""
    195201
    196 #: src/admin-display.cls.php:435
    197 #: src/admin-display.cls.php:1241
    198 #: src/admin-display.cls.php:1270
    199 #: src/admin-display.cls.php:1352
     202#: src/admin-display.cls.php:483
     203#: src/admin-display.cls.php:1164
     204#: src/admin-display.cls.php:1193
     205#: src/admin-display.cls.php:1275
    200206#: tpl/cache/settings-cache.tpl.php:28
    201207#: tpl/cache/settings_inc.object.tpl.php:280
     
    213219msgstr ""
    214220
    215 #: src/admin-display.cls.php:496
     221#: src/admin-display.cls.php:544
    216222#: src/gui.cls.php:718
    217223#: tpl/crawler/entry.tpl.php:17
     
    219225msgstr ""
    220226
    221 #: src/admin-display.cls.php:767
     227#: src/admin-display.cls.php:801
    222228#: tpl/banner/new_version.php:114
    223229#: tpl/banner/score.php:142
     
    226232msgstr ""
    227233
    228 #: src/admin-display.cls.php:1071
    229 #: src/admin-display.cls.php:1076
     234#: src/admin-display.cls.php:994
     235#: src/admin-display.cls.php:999
    230236msgid "Save Changes"
    231237msgstr ""
    232238
    233 #: src/admin-display.cls.php:1366
     239#: src/admin-display.cls.php:1289
    234240msgid "This value is overwritten by the %s variable."
    235241msgstr ""
    236242
    237 #: src/admin-display.cls.php:1370
     243#: src/admin-display.cls.php:1293
    238244msgid "This value is overwritten by the filter."
    239245msgstr ""
    240246
    241 #: src/admin-display.cls.php:1373
     247#: src/admin-display.cls.php:1296
    242248msgid "This value is overwritten by the PHP constant %s."
    243249msgstr ""
    244250
    245 #: src/admin-display.cls.php:1377
     251#: src/admin-display.cls.php:1300
    246252msgid "This value is overwritten by the primary site setting."
    247253msgstr ""
    248254
    249 #: src/admin-display.cls.php:1379
     255#: src/admin-display.cls.php:1302
    250256msgid "This value is overwritten by the Network setting."
    251257msgstr ""
    252258
    253 #: src/admin-display.cls.php:1383
     259#: src/admin-display.cls.php:1306
    254260msgid "Currently set to %s"
    255261msgstr ""
    256262
    257 #: src/admin-display.cls.php:1396
     263#: src/admin-display.cls.php:1319
    258264msgid "Value from filter applied"
    259265msgstr ""
    260266
    261 #: src/admin-display.cls.php:1410
     267#: src/admin-display.cls.php:1333
    262268#: tpl/cache/settings_inc.object.tpl.php:162
    263269#: tpl/crawler/settings.tpl.php:43
     
    266272msgstr ""
    267273
    268 #: src/admin-display.cls.php:1436
    269 #: src/admin-display.cls.php:1455
     274#: src/admin-display.cls.php:1359
     275#: src/admin-display.cls.php:1378
    270276#: tpl/cdn/other.tpl.php:108
    271277msgid "Default value"
    272278msgstr ""
    273279
    274 #: src/admin-display.cls.php:1483
     280#: src/admin-display.cls.php:1406
    275281msgid "Invalid rewrite rule"
    276282msgstr ""
    277283
    278 #: src/admin-display.cls.php:1503
     284#: src/admin-display.cls.php:1426
    279285msgid "Path must end with %s"
    280286msgstr ""
    281287
    282 #: src/admin-display.cls.php:1523
     288#: src/admin-display.cls.php:1446
    283289msgid "Minimum value"
    284290msgstr ""
    285291
    286 #: src/admin-display.cls.php:1526
     292#: src/admin-display.cls.php:1449
    287293msgid "Maximum value"
    288294msgstr ""
    289295
    290 #: src/admin-display.cls.php:1538
     296#: src/admin-display.cls.php:1461
    291297msgid "Zero, or"
    292298msgstr ""
    293299
    294 #: src/admin-display.cls.php:1544
     300#: src/admin-display.cls.php:1467
    295301msgid "Larger than"
    296302msgstr ""
    297303
    298 #: src/admin-display.cls.php:1546
     304#: src/admin-display.cls.php:1469
    299305msgid "Smaller than"
    300306msgstr ""
    301307
    302 #: src/admin-display.cls.php:1549
     308#: src/admin-display.cls.php:1472
    303309msgid "Value range"
    304310msgstr ""
    305311
    306 #: src/admin-display.cls.php:1577
     312#: src/admin-display.cls.php:1500
    307313msgid "Invalid IP"
    308314msgstr ""
    309315
    310 #: src/admin-display.cls.php:1597
     316#: src/admin-display.cls.php:1520
    311317#: tpl/cache/settings-esi.tpl.php:103
    312318#: tpl/page_optm/settings_css.tpl.php:87
     
    330336
    331337#. translators: %s: list of server variables in <code> tags
    332 #: src/admin-display.cls.php:1600
     338#: src/admin-display.cls.php:1523
    333339msgid "Server variable(s) %s available to override this setting."
    334340msgstr ""
    335341
    336 #: src/admin-display.cls.php:1616
     342#: src/admin-display.cls.php:1539
    337343msgid "The URLs will be compared to the REQUEST_URI server variable."
    338344msgstr ""
    339345
    340346#. translators: 1: example URL, 2: pattern example
    341 #: src/admin-display.cls.php:1618
     347#: src/admin-display.cls.php:1541
    342348msgid "For example, for %1$s, %2$s can be used here."
    343349msgstr ""
    344350
    345351#. translators: %s: caret symbol
    346 #: src/admin-display.cls.php:1621
     352#: src/admin-display.cls.php:1544
    347353msgid "To match the beginning, add %s to the beginning of the item."
    348354msgstr ""
    349355
    350356#. translators: %s: dollar symbol
    351 #: src/admin-display.cls.php:1623
     357#: src/admin-display.cls.php:1546
    352358msgid "To do an exact match, add %s to the end of the URL."
    353359msgstr ""
    354360
    355 #: src/admin-display.cls.php:1624
     361#: src/admin-display.cls.php:1547
    356362#: src/doc.cls.php:108
    357363msgid "One per line."
    358364msgstr ""
    359365
    360 #: src/admin-display.cls.php:1641
     366#: src/admin-display.cls.php:1564
    361367msgid "%s groups"
    362368msgstr ""
    363369
    364 #: src/admin-display.cls.php:1644
     370#: src/admin-display.cls.php:1567
    365371msgid "%s images"
    366372msgstr ""
    367373
    368 #: src/admin-display.cls.php:1653
     374#: src/admin-display.cls.php:1576
    369375msgid "%s group"
    370376msgstr ""
    371377
    372 #: src/admin-display.cls.php:1656
     378#: src/admin-display.cls.php:1579
    373379msgid "%s image"
    374380msgstr ""
    375381
    376382#: src/admin-settings.cls.php:40
    377 #: src/admin-settings.cls.php:307
     383#: src/admin-settings.cls.php:313
    378384msgid "No fields"
    379385msgstr ""
     
    383389msgstr ""
    384390
    385 #: src/admin-settings.cls.php:291
    386 #: src/admin-settings.cls.php:327
     391#: src/admin-settings.cls.php:297
     392#: src/admin-settings.cls.php:333
    387393msgid "Options saved."
    388394msgstr ""
     
    477483msgstr ""
    478484
    479 #: src/cloud.cls.php:973
    480 #: src/cloud.cls.php:986
    481 #: src/cloud.cls.php:1024
    482 #: src/cloud.cls.php:1090
    483 #: src/cloud.cls.php:1231
     485#: src/cloud.cls.php:978
     486#: src/cloud.cls.php:991
     487#: src/cloud.cls.php:1029
     488#: src/cloud.cls.php:1095
     489#: src/cloud.cls.php:1236
    484490msgid "Cloud Error"
    485491msgstr ""
    486492
    487 #: src/cloud.cls.php:1024
     493#: src/cloud.cls.php:1029
    488494msgid "No available Cloud Node after checked server load."
    489495msgstr ""
    490496
    491 #: src/cloud.cls.php:1090
     497#: src/cloud.cls.php:1095
    492498msgid "No available Cloud Node."
    493499msgstr ""
    494500
    495 #: src/cloud.cls.php:1185
     501#: src/cloud.cls.php:1190
    496502msgid "In order to use QC services, need a real domain name, cannot use an IP."
    497503msgstr ""
    498504
    499 #: src/cloud.cls.php:1234
     505#: src/cloud.cls.php:1239
    500506msgid "Please try after %1$s for service %2$s."
    501507msgstr ""
    502508
    503 #: src/cloud.cls.php:1411
    504 #: src/cloud.cls.php:1434
     509#: src/cloud.cls.php:1435
     510#: src/cloud.cls.php:1458
    505511msgid "Failed to request via WordPress"
    506512msgstr ""
    507513
    508 #: src/cloud.cls.php:1466
     514#: src/cloud.cls.php:1490
    509515msgid "Cloud server refused the current request due to unpulled images. Please pull the images first."
    510516msgstr ""
    511517
    512 #: src/cloud.cls.php:1471
     518#: src/cloud.cls.php:1495
    513519msgid "Your domain_key has been temporarily blocklisted to prevent abuse. You may contact support at QUIC.cloud to learn more."
    514520msgstr ""
    515521
    516 #: src/cloud.cls.php:1478
     522#: src/cloud.cls.php:1502
    517523msgid "Cloud server refused the current request due to rate limiting. Please try again later."
    518524msgstr ""
    519525
    520 #: src/cloud.cls.php:1486
     526#: src/cloud.cls.php:1510
    521527msgid "Redetected node"
    522528msgstr ""
    523529
    524 #: src/cloud.cls.php:1494
     530#: src/cloud.cls.php:1518
    525531msgid "We are working hard to improve your online service experience. The service will be unavailable while we work. We apologize for any inconvenience."
    526532msgstr ""
    527533
    528 #: src/cloud.cls.php:1539
    529 #: src/cloud.cls.php:1547
     534#: src/cloud.cls.php:1563
     535#: src/cloud.cls.php:1571
    530536msgid "Message from QUIC.cloud server"
    531537msgstr ""
    532538
    533 #: src/cloud.cls.php:1555
     539#: src/cloud.cls.php:1579
    534540msgid "Good news from QUIC.cloud server"
    535541msgstr ""
    536542
    537 #: src/cloud.cls.php:1565
     543#: src/cloud.cls.php:1589
    538544msgid "%1$s plugin version %2$s required for this action."
    539545msgstr ""
    540546
    541 #: src/cloud.cls.php:1632
     547#: src/cloud.cls.php:1656
    542548msgid "Failed to communicate with QUIC.cloud server"
    543549msgstr ""
    544550
    545 #: src/cloud.cls.php:1685
     551#: src/cloud.cls.php:1709
    546552msgid "Site not recognized. QUIC.cloud deactivated automatically. Please reactivate your QUIC.cloud account."
    547553msgstr ""
    548554
    549 #: src/cloud.cls.php:1686
     555#: src/cloud.cls.php:1710
    550556msgid "Click here to proceed."
    551557msgstr ""
    552558
    553 #: src/cloud.cls.php:1953
     559#: src/cloud.cls.php:1977
    554560msgid "Linked to QUIC.cloud preview environment, for testing purpose only."
    555561msgstr ""
    556562
    557 #: src/cloud.cls.php:2005
     563#: src/cloud.cls.php:2029
    558564msgid "Sync QUIC.cloud status successfully."
    559565msgstr ""
    560566
    561 #: src/cloud.cls.php:2012
     567#: src/cloud.cls.php:2036
    562568msgid "Sync credit allowance with Cloud Server successfully."
    563569msgstr ""
     
    10471053msgstr ""
    10481054
    1049 #: src/htaccess.cls.php:327
     1055#: src/htaccess.cls.php:325
    10501056msgid "Mobile Agent Rules"
    10511057msgstr ""
    10521058
    1053 #: src/htaccess.cls.php:786
     1059#: src/htaccess.cls.php:784
    10541060msgid "<p>Please add/replace the following codes into the beginning of %1$s:</p> %2$s"
    10551061msgstr ""
    10561062
    1057 #: src/img-optm.cls.php:342
     1063#: src/img-optm.cls.php:350
    10581064msgid "Pushed %1$s to Cloud server, accepted %2$s."
    10591065msgstr ""
    10601066
    1061 #: src/img-optm.cls.php:603
     1067#: src/img-optm.cls.php:618
    10621068msgid "Cleared %1$s invalid images."
    10631069msgstr ""
    10641070
    1065 #: src/img-optm.cls.php:660
     1071#: src/img-optm.cls.php:675
    10661072msgid "No valid image found in the current request."
    10671073msgstr ""
    10681074
    1069 #: src/img-optm.cls.php:685
     1075#: src/img-optm.cls.php:700
    10701076msgid "No valid image found by Cloud server in the current request."
    10711077msgstr ""
    10721078
    1073 #: src/img-optm.cls.php:875
     1079#: src/img-optm.cls.php:890
    10741080msgid "Started async image optimization request"
    10751081msgstr ""
    10761082
    1077 #: src/img-optm.cls.php:961
     1083#: src/img-optm.cls.php:976
    10781084msgid "Pull Cron is running"
    10791085msgstr ""
    10801086
    1081 #: src/img-optm.cls.php:1071
     1087#: src/img-optm.cls.php:1086
    10821088msgid "Some optimized image file(s) has expired and was cleared."
    10831089msgstr ""
    10841090
    1085 #: src/img-optm.cls.php:1086
     1091#: src/img-optm.cls.php:1101
    10861092msgid "Pulled WebP image md5 does not match the notified WebP image md5."
    10871093msgstr ""
    10881094
    1089 #: src/img-optm.cls.php:1115
     1095#: src/img-optm.cls.php:1130
    10901096msgid "Pulled AVIF image md5 does not match the notified AVIF image md5."
    10911097msgstr ""
    10921098
    1093 #: src/img-optm.cls.php:1150
     1099#: src/img-optm.cls.php:1165
    10941100msgid "One or more pulled images does not match with the notified image md5"
    10951101msgstr ""
    10961102
    1097 #: src/img-optm.cls.php:1342
     1103#: src/img-optm.cls.php:1357
    10981104msgid "Cleaned up unfinished data successfully."
    10991105msgstr ""
    11001106
    1101 #: src/img-optm.cls.php:1359
     1107#: src/img-optm.cls.php:1374
    11021108msgid "Reset image optimization counter successfully."
    11031109msgstr ""
    11041110
    1105 #: src/img-optm.cls.php:1443
     1111#: src/img-optm.cls.php:1458
    11061112msgid "Destroy all optimization data successfully."
    11071113msgstr ""
    11081114
    1109 #: src/img-optm.cls.php:1508
    1110 #: src/img-optm.cls.php:1570
     1115#: src/img-optm.cls.php:1523
     1116#: src/img-optm.cls.php:1587
    11111117msgid "Rescanned successfully."
    11121118msgstr ""
    11131119
    1114 #: src/img-optm.cls.php:1570
     1120#: src/img-optm.cls.php:1587
    11151121msgid "Rescanned %d images successfully."
    11161122msgstr ""
    11171123
    1118 #: src/img-optm.cls.php:1636
     1124#: src/img-optm.cls.php:1653
    11191125msgid "Calculated backups successfully."
    11201126msgstr ""
    11211127
    1122 #: src/img-optm.cls.php:1728
     1128#: src/img-optm.cls.php:1745
    11231129msgid "Removed backups successfully."
    11241130msgstr ""
    11251131
    1126 #: src/img-optm.cls.php:1875
     1132#: src/img-optm.cls.php:1892
    11271133msgid "Switched images successfully."
    11281134msgstr ""
    11291135
    1130 #: src/img-optm.cls.php:1972
    1131 #: src/img-optm.cls.php:2032
     1136#: src/img-optm.cls.php:1989
     1137#: src/img-optm.cls.php:2049
    11321138msgid "Switched to optimized file successfully."
    11331139msgstr ""
    11341140
    1135 #: src/img-optm.cls.php:1991
     1141#: src/img-optm.cls.php:2008
    11361142msgid "Disabled WebP file successfully."
    11371143msgstr ""
    11381144
    1139 #: src/img-optm.cls.php:1996
     1145#: src/img-optm.cls.php:2013
    11401146msgid "Enabled WebP file successfully."
    11411147msgstr ""
    11421148
    1143 #: src/img-optm.cls.php:2005
     1149#: src/img-optm.cls.php:2022
    11441150msgid "Disabled AVIF file successfully."
    11451151msgstr ""
    11461152
    1147 #: src/img-optm.cls.php:2010
     1153#: src/img-optm.cls.php:2027
    11481154msgid "Enabled AVIF file successfully."
    11491155msgstr ""
    11501156
    1151 #: src/img-optm.cls.php:2026
     1157#: src/img-optm.cls.php:2043
    11521158msgid "Restored original file successfully."
    11531159msgstr ""
    11541160
    1155 #: src/img-optm.cls.php:2082
     1161#: src/img-optm.cls.php:2099
    11561162msgid "Reset the optimized data successfully."
    11571163msgstr ""
     
    16821688
    16831689#: src/lang.cls.php:211
     1690msgid "Optimize Image Sizes"
     1691msgstr ""
     1692
     1693#: src/lang.cls.php:212
    16841694msgid "Preserve EXIF/XMP data"
    16851695msgstr ""
    16861696
    1687 #: src/lang.cls.php:212
     1697#: src/lang.cls.php:213
    16881698msgid "WebP/AVIF Attribute To Replace"
    16891699msgstr ""
    16901700
    1691 #: src/lang.cls.php:213
     1701#: src/lang.cls.php:214
    16921702msgid "WebP/AVIF For Extra srcset"
    16931703msgstr ""
    16941704
    1695 #: src/lang.cls.php:214
     1705#: src/lang.cls.php:215
    16961706msgid "WordPress Image Quality Control"
    16971707msgstr ""
    16981708
    1699 #: src/lang.cls.php:215
     1709#: src/lang.cls.php:216
    17001710#: tpl/esi_widget_edit.php:43
    17011711msgid "Enable ESI"
    17021712msgstr ""
    17031713
    1704 #: src/lang.cls.php:216
     1714#: src/lang.cls.php:217
    17051715msgid "Cache Admin Bar"
    17061716msgstr ""
    17071717
    1708 #: src/lang.cls.php:217
     1718#: src/lang.cls.php:218
    17091719msgid "Cache Comment Form"
    17101720msgstr ""
    17111721
    1712 #: src/lang.cls.php:218
     1722#: src/lang.cls.php:219
    17131723msgid "ESI Nonces"
    17141724msgstr ""
    17151725
    1716 #: src/lang.cls.php:219
     1726#: src/lang.cls.php:220
    17171727#: tpl/page_optm/settings_css.tpl.php:140
    17181728#: tpl/page_optm/settings_css.tpl.php:277
     
    17211731msgstr ""
    17221732
    1723 #: src/lang.cls.php:220
     1733#: src/lang.cls.php:221
    17241734msgid "Purge All Hooks"
    17251735msgstr ""
    17261736
    1727 #: src/lang.cls.php:221
     1737#: src/lang.cls.php:222
    17281738msgid "Improve HTTP/HTTPS Compatibility"
    17291739msgstr ""
    17301740
    1731 #: src/lang.cls.php:222
     1741#: src/lang.cls.php:223
    17321742msgid "Instant Click"
    17331743msgstr ""
    17341744
    1735 #: src/lang.cls.php:223
     1745#: src/lang.cls.php:224
    17361746msgid "Do Not Cache Cookies"
    17371747msgstr ""
    17381748
    1739 #: src/lang.cls.php:224
     1749#: src/lang.cls.php:225
    17401750msgid "Do Not Cache User Agents"
    17411751msgstr ""
    17421752
    1743 #: src/lang.cls.php:225
     1753#: src/lang.cls.php:226
    17441754msgid "Login Cookie"
    17451755msgstr ""
    17461756
    1747 #: src/lang.cls.php:226
     1757#: src/lang.cls.php:227
    17481758msgid "Vary Cookies"
    17491759msgstr ""
    17501760
    1751 #: src/lang.cls.php:228
     1761#: src/lang.cls.php:229
    17521762msgid "Frontend Heartbeat Control"
    17531763msgstr ""
    17541764
    1755 #: src/lang.cls.php:229
     1765#: src/lang.cls.php:230
    17561766msgid "Frontend Heartbeat TTL"
    17571767msgstr ""
    17581768
    1759 #: src/lang.cls.php:230
     1769#: src/lang.cls.php:231
    17601770msgid "Backend Heartbeat Control"
    17611771msgstr ""
    17621772
    1763 #: src/lang.cls.php:231
     1773#: src/lang.cls.php:232
    17641774msgid "Backend Heartbeat TTL"
    17651775msgstr ""
    17661776
    1767 #: src/lang.cls.php:232
     1777#: src/lang.cls.php:233
    17681778msgid "Editor Heartbeat"
    17691779msgstr ""
    17701780
    1771 #: src/lang.cls.php:233
     1781#: src/lang.cls.php:234
    17721782msgid "Editor Heartbeat TTL"
    17731783msgstr ""
    17741784
    1775 #: src/lang.cls.php:235
     1785#: src/lang.cls.php:236
    17761786msgid "Use CDN Mapping"
    17771787msgstr ""
    17781788
    1779 #: src/lang.cls.php:236
     1789#: src/lang.cls.php:237
    17801790msgid "CDN URL"
    17811791msgstr ""
    17821792
    1783 #: src/lang.cls.php:237
     1793#: src/lang.cls.php:238
    17841794msgid "Include Images"
    17851795msgstr ""
    17861796
    1787 #: src/lang.cls.php:238
     1797#: src/lang.cls.php:239
    17881798msgid "Include CSS"
    17891799msgstr ""
    17901800
    1791 #: src/lang.cls.php:239
     1801#: src/lang.cls.php:240
    17921802msgid "Include JS"
    17931803msgstr ""
    17941804
    1795 #: src/lang.cls.php:240
     1805#: src/lang.cls.php:241
    17961806#: tpl/cdn/other.tpl.php:113
    17971807msgid "Include File Types"
    17981808msgstr ""
    17991809
    1800 #: src/lang.cls.php:241
     1810#: src/lang.cls.php:242
    18011811msgid "HTML Attribute To Replace"
    18021812msgstr ""
    18031813
    1804 #: src/lang.cls.php:242
     1814#: src/lang.cls.php:243
    18051815msgid "Original URLs"
    18061816msgstr ""
    18071817
    1808 #: src/lang.cls.php:243
     1818#: src/lang.cls.php:244
    18091819msgid "Included Directories"
    18101820msgstr ""
    18111821
    1812 #: src/lang.cls.php:244
     1822#: src/lang.cls.php:245
    18131823msgid "Exclude Path"
    18141824msgstr ""
    18151825
    1816 #: src/lang.cls.php:245
     1826#: src/lang.cls.php:246
    18171827msgid "Cloudflare API"
    18181828msgstr ""
    18191829
    1820 #: src/lang.cls.php:246
     1830#: src/lang.cls.php:247
    18211831msgid "Clear Cloudflare cache"
    18221832msgstr ""
    18231833
    1824 #: src/lang.cls.php:249
     1834#: src/lang.cls.php:250
    18251835msgid "Crawl Interval"
    18261836msgstr ""
    18271837
    1828 #: src/lang.cls.php:250
     1838#: src/lang.cls.php:251
    18291839msgid "Server Load Limit"
    18301840msgstr ""
    18311841
    1832 #: src/lang.cls.php:251
     1842#: src/lang.cls.php:252
    18331843msgid "Role Simulation"
    18341844msgstr ""
    18351845
    1836 #: src/lang.cls.php:252
     1846#: src/lang.cls.php:253
    18371847msgid "Cookie Simulation"
    18381848msgstr ""
    18391849
    1840 #: src/lang.cls.php:253
     1850#: src/lang.cls.php:254
    18411851msgid "Custom Sitemap"
    18421852msgstr ""
    18431853
    1844 #: src/lang.cls.php:255
     1854#: src/lang.cls.php:256
    18451855msgid "Disable All Features"
    18461856msgstr ""
    18471857
    1848 #: src/lang.cls.php:256
     1858#: src/lang.cls.php:257
    18491859#: tpl/toolbox/log_viewer.tpl.php:18
    18501860msgid "Debug Log"
    18511861msgstr ""
    18521862
    1853 #: src/lang.cls.php:257
     1863#: src/lang.cls.php:258
    18541864msgid "Admin IPs"
    18551865msgstr ""
    18561866
    1857 #: src/lang.cls.php:258
     1867#: src/lang.cls.php:259
    18581868msgid "Debug Level"
    18591869msgstr ""
    18601870
    1861 #: src/lang.cls.php:259
     1871#: src/lang.cls.php:260
    18621872msgid "Log File Size Limit"
    18631873msgstr ""
    18641874
    1865 #: src/lang.cls.php:260
     1875#: src/lang.cls.php:261
    18661876msgid "Collapse Query Strings"
    18671877msgstr ""
    18681878
    1869 #: src/lang.cls.php:261
     1879#: src/lang.cls.php:262
    18701880msgid "Debug URI Includes"
    18711881msgstr ""
    18721882
    1873 #: src/lang.cls.php:262
     1883#: src/lang.cls.php:263
    18741884msgid "Debug URI Excludes"
    18751885msgstr ""
    18761886
    1877 #: src/lang.cls.php:263
     1887#: src/lang.cls.php:264
    18781888msgid "Debug String Excludes"
    18791889msgstr ""
    18801890
    1881 #: src/lang.cls.php:265
     1891#: src/lang.cls.php:266
    18821892msgid "Revisions Max Number"
    18831893msgstr ""
    18841894
    1885 #: src/lang.cls.php:266
     1895#: src/lang.cls.php:267
    18861896msgid "Revisions Max Age"
    18871897msgstr ""
     
    21472157#: tpl/cache/settings-advanced.tpl.php:21
    21482158#: tpl/cache/settings_inc.browser.tpl.php:23
    2149 #: tpl/toolbox/beta_test.tpl.php:39
     2159#: tpl/toolbox/beta_test.tpl.php:40
    21502160#: tpl/toolbox/heartbeat.tpl.php:24
    21512161#: tpl/toolbox/report.tpl.php:46
     
    22552265#: tpl/banner/new_version.php:77
    22562266#: tpl/banner/new_version_dev.tpl.php:41
    2257 #: tpl/toolbox/beta_test.tpl.php:85
     2267#: tpl/toolbox/beta_test.tpl.php:86
    22582268msgid "Upgrade"
    22592269msgstr ""
     
    32183228
    32193229#: tpl/cdn/other.tpl.php:137
    3220 #: tpl/img_optm/settings.tpl.php:124
     3230#: tpl/img_optm/settings.tpl.php:150
    32213231msgid "Only attributes listed here will be replaced."
    32223232msgstr ""
    32233233
    32243234#: tpl/cdn/other.tpl.php:141
    3225 #: tpl/img_optm/settings.tpl.php:125
     3235#: tpl/img_optm/settings.tpl.php:151
    32263236msgid "Use the format %1$s or %2$s (element is optional)."
    32273237msgstr ""
     
    45394549msgstr ""
    45404550
    4541 #: tpl/img_optm/settings.tpl.php:94
     4551#: tpl/img_optm/settings.tpl.php:104
     4552msgid "No sizes found."
     4553msgstr ""
     4554
     4555#: tpl/img_optm/settings.tpl.php:107
     4556msgid "Choose which image sizes to optimize."
     4557msgstr ""
     4558
     4559#: tpl/img_optm/settings.tpl.php:120
    45424560msgid "Preserve EXIF data (copyright, GPS, comments, keywords, etc) when optimizing."
    45434561msgstr ""
    45444562
    4545 #: tpl/img_optm/settings.tpl.php:95
     4563#: tpl/img_optm/settings.tpl.php:121
    45464564msgid "This will increase the size of optimized files."
    45474565msgstr ""
    45484566
    4549 #: tpl/img_optm/settings.tpl.php:123
     4567#: tpl/img_optm/settings.tpl.php:149
    45504568msgid "Specify which element attributes will be replaced with WebP/AVIF."
    45514569msgstr ""
    45524570
    4553 #: tpl/img_optm/settings.tpl.php:139
     4571#: tpl/img_optm/settings.tpl.php:165
    45544572msgid "Enable replacement of WebP/AVIF in %s elements that were generated outside of WordPress logic."
    45554573msgstr ""
     
    48854903#: tpl/inc/show_rule_conflict.php:16
    48864904msgid "Unexpected cache rule %2$s found in %1$s file. This rule may cause visitors to see old versions of pages due to the browser caching HTML pages. If you are sure that HTML pages are not being browser cached, this message can be dismissed. (%3$sLearn More%4$s)"
     4905msgstr ""
     4906
     4907#: tpl/optimax/entry.tpl.php:16
     4908msgid "OptimaX Summary"
     4909msgstr ""
     4910
     4911#: tpl/optimax/entry.tpl.php:17
     4912#: tpl/optimax/entry.tpl.php:22
     4913#: tpl/optimax/settings.tpl.php:19
     4914msgid "OptimaX Settings"
     4915msgstr ""
     4916
     4917#: tpl/optimax/entry.tpl.php:30
     4918msgid "LiteSpeed Cache OptimaX"
     4919msgstr ""
     4920
     4921#: tpl/optimax/settings.tpl.php:34
     4922msgid "Turn on OptimaX. This will automatically request your pages OptimaX result via cron job."
    48874923msgstr ""
    48884924
     
    52175253
    52185254#: tpl/page_optm/settings_localization.tpl.php:137
    5219 #: tpl/toolbox/beta_test.tpl.php:48
     5255#: tpl/toolbox/beta_test.tpl.php:49
    52205256msgid "Example"
    52215257msgstr ""
     
    57155751msgstr ""
    57165752
    5717 #: tpl/toolbox/beta_test.tpl.php:33
     5753#: tpl/toolbox/beta_test.tpl.php:34
    57185754msgid "Try GitHub Version"
    57195755msgstr ""
    57205756
    5721 #: tpl/toolbox/beta_test.tpl.php:40
     5757#: tpl/toolbox/beta_test.tpl.php:41
    57225758msgid "LiteSpeed Cache is disabled. This functionality will not work."
    57235759msgstr ""
    57245760
    5725 #: tpl/toolbox/beta_test.tpl.php:45
     5761#: tpl/toolbox/beta_test.tpl.php:46
    57265762msgid "Use this section to switch plugin versions. To beta test a GitHub commit, enter the commit URL in the field below."
    57275763msgstr ""
    57285764
    5729 #: tpl/toolbox/beta_test.tpl.php:54
     5765#: tpl/toolbox/beta_test.tpl.php:55
    57305766msgid "Use latest GitHub Dev commit"
    57315767msgstr ""
    57325768
    5733 #: tpl/toolbox/beta_test.tpl.php:58
     5769#: tpl/toolbox/beta_test.tpl.php:59
    57345770msgid "Use latest GitHub Master commit"
    57355771msgstr ""
    57365772
    5737 #: tpl/toolbox/beta_test.tpl.php:62
    5738 #: tpl/toolbox/beta_test.tpl.php:78
     5773#: tpl/toolbox/beta_test.tpl.php:63
     5774#: tpl/toolbox/beta_test.tpl.php:79
    57395775msgid "Use latest WordPress release version"
    57405776msgstr ""
    57415777
    5742 #: tpl/toolbox/beta_test.tpl.php:62
     5778#: tpl/toolbox/beta_test.tpl.php:63
    57435779msgid "OR"
    57445780msgstr ""
    57455781
    5746 #: tpl/toolbox/beta_test.tpl.php:70
     5782#: tpl/toolbox/beta_test.tpl.php:71
    57475783msgid "Downgrade not recommended. May cause fatal error due to refactored code."
    57485784msgstr ""
    57495785
    5750 #: tpl/toolbox/beta_test.tpl.php:75
     5786#: tpl/toolbox/beta_test.tpl.php:76
    57515787msgid "Press the %s button to use the most recent GitHub commit. Master is for release candidate & Dev is for experimental testing."
    57525788msgstr ""
    57535789
    5754 #: tpl/toolbox/beta_test.tpl.php:75
     5790#: tpl/toolbox/beta_test.tpl.php:76
    57555791msgid "Use latest GitHub Dev/Master commit"
    57565792msgstr ""
    57575793
    5758 #: tpl/toolbox/beta_test.tpl.php:78
     5794#: tpl/toolbox/beta_test.tpl.php:79
    57595795msgid "Press the %s button to stop beta testing and go back to the current release from the WordPress Plugin Directory."
    57605796msgstr ""
    57615797
    5762 #: tpl/toolbox/beta_test.tpl.php:82
     5798#: tpl/toolbox/beta_test.tpl.php:83
    57635799msgid "In order to avoid an upgrade error, you must be using %1$s or later before you can upgrade to %2$s versions."
    57645800msgstr ""
  • litespeed-cache/trunk/litespeed-cache.php

    r3352087 r3359287  
    44 * Plugin URI:        https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
    55 * Description:       High-performance page caching and site optimization from LiteSpeed
    6  * Version:           7.4
     6 * Version:           7.5
    77 * Author:            LiteSpeed Technologies
    88 * Author URI:        https://www.litespeedtech.com
     
    3636}
    3737
    38 ! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '7.4' );
     38! defined( 'LSCWP_V' ) && define( 'LSCWP_V', '7.5' );
    3939
    4040! defined( 'LSCWP_CONTENT_DIR' ) && define( 'LSCWP_CONTENT_DIR', WP_CONTENT_DIR );
     
    7676
    7777// Define CLI
    78 if ( ( defined( 'WP_CLI' ) && WP_CLI ) || 'cli' === PHP_SAPI ) {
     78if ( ( defined( 'WP_CLI' ) && constant('WP_CLI') ) || 'cli' === PHP_SAPI ) {
    7979    ! defined( 'LITESPEED_CLI' ) && define( 'LITESPEED_CLI', true );
    8080
  • litespeed-cache/trunk/readme.txt

    r3352091 r3359287  
    55Requires PHP: 7.2
    66Tested up to: 6.8
    7 Stable tag: 7.4
     7Stable tag: 7.5
    88License: GPLv3
    99License URI: http://www.gnu.org/licenses/gpl.html
     
    257257
    258258== Changelog ==
     259
     260= 7.5 - Sep 10 2025 =
     261* 🌱**Image Optimize** New option `Optimize Image Sizes` to allow user to choose which image sizes to include in optimization request.
     262* 🐞**Purge** Purge Time setting will respect WP timezone setting now. (PR#893)
     263* 🐞**Conf** Fixed a minor type-casting bug, which could cause unnecessary QUIC.cloud sync configuration when the setting is empty.
     264* **Misc** Dropped unused rewrite rule from htaccess.
    259265
    260266= 7.4 - Aug 28 2025 =
  • litespeed-cache/trunk/src/admin-display.cls.php

    r3352087 r3359287  
    234234
    235235    /**
     236     * Flat pages map: menu slug to template metadata.
     237     *
     238     * @var array<string,array{title:string,tpl:string,network?:bool}>
     239     */
     240    private $_pages = [];
     241
     242    /**
    236243     * Initialize the class and set its properties.
    237244     *
     
    239246     */
    240247    public function __construct() {
     248        $this->_pages = [
     249            // Site-level pages
     250            'litespeed'               => [ 'title' => __( 'Dashboard', 'litespeed-cache' ), 'tpl' => 'dash/entry.tpl.php' ],
     251            'litespeed-optimax'       => [ 'title' => __( 'OptimaX', 'litespeed-cache' ), 'tpl' => 'optimax/entry.tpl.php' ],
     252            'litespeed-presets'       => [ 'title' => __( 'Presets', 'litespeed-cache' ), 'tpl' => 'presets/entry.tpl.php' ],
     253            'litespeed-general'       => [ 'title' => __( 'General', 'litespeed-cache' ), 'tpl' => 'general/entry.tpl.php' ],
     254            'litespeed-cache'         => [ 'title' => __( 'Cache', 'litespeed-cache' ), 'tpl' => 'cache/entry.tpl.php' ],
     255            'litespeed-cdn'           => [ 'title' => __( 'CDN', 'litespeed-cache' ), 'tpl' => 'cdn/entry.tpl.php' ],
     256            'litespeed-img_optm'      => [ 'title' => __( 'Image Optimization', 'litespeed-cache'), 'tpl' => 'img_optm/entry.tpl.php' ],
     257            'litespeed-page_optm'     => [ 'title' => __( 'Page Optimization', 'litespeed-cache' ), 'tpl' => 'page_optm/entry.tpl.php' ],
     258            'litespeed-db_optm'       => [ 'title' => __( 'Database', 'litespeed-cache' ), 'tpl' => 'db_optm/entry.tpl.php' ],
     259            'litespeed-crawler'       => [ 'title' => __( 'Crawler', 'litespeed-cache' ), 'tpl' => 'crawler/entry.tpl.php' ],
     260            'litespeed-toolbox'       => [ 'title' => __( 'Toolbox', 'litespeed-cache' ), 'tpl' => 'toolbox/entry.tpl.php' ],
     261
     262            // Network-level pages
     263            'litespeed-network'       => [ 'title' => 'LiteSpeed Cache (Network)', 'tpl' => 'dash/entry_network.tpl.php', 'network' => true ],
     264            'litespeed-cache-network' => [ 'title' => __( 'Cache', 'litespeed-cache' ), 'tpl' => 'cache/entry_network.tpl.php', 'network' => true ],
     265        ];
     266
    241267        // main css
    242268        add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ) );
     
    290316
    291317    /**
     318     * Bind per-page admin hooks for a given page hook.
     319     *
     320     * Adds footer text filter and preview banner when loading the page.
     321     *
     322     * @param string $hook Page hook suffix returned by add_*_page().
     323     * @return void
     324     */
     325    private function bind_page( $hook ) {
     326        add_action( "load-$hook", function () {
     327            add_filter(
     328                'admin_footer_text',
     329                function ( $footer_text ) {
     330                    $this->cls( 'Cloud' )->maybe_preview_banner();
     331                    require_once LSCWP_DIR . 'tpl/inc/admin_footer.php';
     332                    return $footer_text;
     333                },
     334                1
     335            );
     336        } );
     337    }
     338
     339    /**
     340     * Render an admin page by slug using its mapped template file.
     341     *
     342     * @param string $slug The menu slug registered in $_pages.
     343     * @return void
     344     */
     345    private function render_page( $slug ) {
     346        $tpl = LSCWP_DIR . 'tpl/' . $this->_pages[ $slug ]['tpl'];
     347        is_file( $tpl ) ? require $tpl : wp_die( 'Template not found' );
     348    }
     349
     350    /**
    292351     * Register the admin menu display.
    293352     *
     
    297356    public function register_admin_menu() {
    298357        $capability = $this->_is_network_admin ? 'manage_network_options' : 'manage_options';
    299         if ( current_user_can( $capability ) ) {
    300             // root menu.
    301             add_menu_page( 'LiteSpeed Cache', 'LiteSpeed Cache', 'manage_options', 'litespeed' );
    302 
    303             // sub menus.
    304             $this->_add_submenu( __( 'Dashboard', 'litespeed-cache' ), 'litespeed', 'show_menu_dash' );
    305 
    306             if ( ! $this->_is_network_admin ) {
    307                 $this->_add_submenu( __( 'Presets', 'litespeed-cache' ), 'litespeed-presets', 'show_menu_presets' );
    308             }
    309 
    310             $this->_add_submenu( __( 'General', 'litespeed-cache' ), 'litespeed-general', 'show_menu_general' );
    311             $this->_add_submenu( __( 'Cache', 'litespeed-cache' ), 'litespeed-cache', 'show_menu_cache' );
    312 
    313             if ( ! $this->_is_network_admin ) {
    314                 $this->_add_submenu( __( 'CDN', 'litespeed-cache' ), 'litespeed-cdn', 'show_menu_cdn' );
    315             }
    316 
    317             $this->_add_submenu( __( 'Image Optimization', 'litespeed-cache' ), 'litespeed-img_optm', 'show_img_optm' );
    318 
    319             if ( ! $this->_is_network_admin ) {
    320                 $this->_add_submenu( __( 'Page Optimization', 'litespeed-cache' ), 'litespeed-page_optm', 'show_page_optm' );
    321             }
    322 
    323             $this->_add_submenu( __( 'Database', 'litespeed-cache' ), 'litespeed-db_optm', 'show_db_optm' );
    324 
    325             if ( ! $this->_is_network_admin ) {
    326                 $this->_add_submenu( __( 'Crawler', 'litespeed-cache' ), 'litespeed-crawler', 'show_crawler' );
    327             }
    328 
    329             $this->_add_submenu( __( 'Toolbox', 'litespeed-cache' ), 'litespeed-toolbox', 'show_toolbox' );
    330 
    331             // sub menus under options.
    332             add_options_page( 'LiteSpeed Cache', 'LiteSpeed Cache', $capability, 'litespeed-cache-options', array( $this, 'show_menu_cache' ) );
    333         }
    334     }
    335 
    336     /**
    337      * Helper to create a submenu.
    338      *
    339      * @since 1.0.4
    340      * @access private
    341      *
    342      * @param string $menu_title The title that appears on the menu.
    343      * @param string $menu_slug  The slug of the page.
    344      * @param string $callback   The callback to call if selected.
    345      * @return void
    346      */
    347     private function _add_submenu( $menu_title, $menu_slug, $callback ) {
    348         add_submenu_page( 'litespeed', $menu_title, $menu_title, 'manage_options', $menu_slug, array( $this, $callback ) );
     358        $scope      = $this->_is_network_admin ? 'network' : 'site';
     359        $root       = $this->_is_network_admin ? 'litespeed-network' : 'litespeed';
     360
     361        add_menu_page(
     362            'LiteSpeed Cache',
     363            'LiteSpeed Cache',
     364            $capability,
     365            $root,
     366        );
     367
     368        foreach ( $this->_pages as $slug => $meta ) {
     369            if ( 'litespeed-optimax' === $slug && !defined( 'LITESPEED_OX' ) ) {
     370                continue;
     371            }
     372            $curr_scope = ! empty( $meta['network'] ) ? 'network' : 'site';
     373            if ( $curr_scope !== $scope ) {
     374                continue;
     375            }
     376            $hook = add_submenu_page(
     377                $root,
     378                $meta['title'],
     379                $meta['title'],
     380                $capability,
     381                $slug,
     382                function () use ( $slug ) {
     383                    $this->render_page( $slug );
     384                }
     385            );
     386            $this->bind_page( $hook );
     387        }
     388
     389        // sub menus under options.
     390        $hook = add_options_page(
     391            'LiteSpeed Cache',
     392            'LiteSpeed Cache',
     393            $capability,
     394            'litespeed-cache-options',
     395            function () {
     396                $this->render_page( 'litespeed-cache' );
     397            }
     398        );
     399        $this->bind_page( $hook );
    349400    }
    350401
     
    385436
    386437        if ( 'admin.php' === $pagenow && $page && ( 0 === strpos( $page, 'litespeed-' ) || 'litespeed' === $page ) ) {
    387             // Admin footer
    388             add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
    389 
    390438            if ( in_array( $page, array( 'litespeed-crawler', 'litespeed-cdn' ), true ) ) {
    391439                // Babel JS type correction
     
    500548
    501549    /**
    502      * Change the admin footer text on LiteSpeed Cache admin pages.
    503      *
    504      * @since 1.0.13
    505      *
    506      * @param string $footer_text Footer text.
    507      * @return string
    508      */
    509     public function admin_footer_text( $footer_text ) {
    510         require_once LSCWP_DIR . 'tpl/inc/admin_footer.php';
    511 
    512         return $footer_text;
    513     }
    514 
    515     /**
    516550     * Build a single notice HTML string.
    517551     *
     
    671705        if ( defined( 'LITESPEED_CLI' ) || wp_doing_cron() ) {
    672706            // WP CLI will show the info directly
    673             if ( defined( 'WP_CLI' ) && WP_CLI ) {
     707            if ( defined( 'WP_CLI' ) && constant('WP_CLI') ) {
    674708                if ( ! is_array( $msg ) ) {
    675709                    $msg = array( $msg );
     
    871905    public function show_widget_edit( $widget, $return_val, $instance ) {
    872906        require LSCWP_DIR . 'tpl/esi_widget_edit.php';
    873     }
    874 
    875     /**
    876      * Displays the dashboard page.
    877      *
    878      * @since 3.0
    879      * @return void
    880      */
    881     public function show_menu_dash() {
    882         $this->cls( 'Cloud' )->maybe_preview_banner();
    883         require_once LSCWP_DIR . 'tpl/dash/entry.tpl.php';
    884     }
    885 
    886     /**
    887      * Displays the Presets page.
    888      *
    889      * @since 5.3
    890      * @return void
    891      */
    892     public function show_menu_presets() {
    893         require_once LSCWP_DIR . 'tpl/presets/entry.tpl.php';
    894     }
    895 
    896     /**
    897      * Displays the General page.
    898      *
    899      * @since 3.0
    900      * @return void
    901      */
    902     public function show_menu_general() {
    903         $this->cls( 'Cloud' )->maybe_preview_banner();
    904         require_once LSCWP_DIR . 'tpl/general/entry.tpl.php';
    905     }
    906 
    907     /**
    908      * Displays the CDN page.
    909      *
    910      * @since 3.0
    911      * @return void
    912      */
    913     public function show_menu_cdn() {
    914         $this->cls( 'Cloud' )->maybe_preview_banner();
    915         require_once LSCWP_DIR . 'tpl/cdn/entry.tpl.php';
    916     }
    917 
    918     /**
    919      * Outputs the LiteSpeed Cache settings page.
    920      *
    921      * @since 1.0.0
    922      * @return void
    923      */
    924     public function show_menu_cache() {
    925         if ( $this->_is_network_admin ) {
    926             require_once LSCWP_DIR . 'tpl/cache/entry_network.tpl.php';
    927         } else {
    928             require_once LSCWP_DIR . 'tpl/cache/entry.tpl.php';
    929         }
    930     }
    931 
    932     /**
    933      * Tools page.
    934      *
    935      * @since 3.0
    936      * @return void
    937      */
    938     public function show_toolbox() {
    939         $this->cls( 'Cloud' )->maybe_preview_banner();
    940         require_once LSCWP_DIR . 'tpl/toolbox/entry.tpl.php';
    941     }
    942 
    943     /**
    944      * Outputs the crawler operation page.
    945      *
    946      * @since 1.1.0
    947      * @return void
    948      */
    949     public function show_crawler() {
    950         $this->cls( 'Cloud' )->maybe_preview_banner();
    951         require_once LSCWP_DIR . 'tpl/crawler/entry.tpl.php';
    952     }
    953 
    954     /**
    955      * Outputs the image optimization page.
    956      *
    957      * @since 1.6
    958      * @return void
    959      */
    960     public function show_img_optm() {
    961         $this->cls( 'Cloud' )->maybe_preview_banner();
    962         require_once LSCWP_DIR . 'tpl/img_optm/entry.tpl.php';
    963     }
    964 
    965     /**
    966      * Page optimization page.
    967      *
    968      * @since 3.0
    969      * @return void
    970      */
    971     public function show_page_optm() {
    972         $this->cls( 'Cloud' )->maybe_preview_banner();
    973         require_once LSCWP_DIR . 'tpl/page_optm/entry.tpl.php';
    974     }
    975 
    976     /**
    977      * DB optimization page.
    978      *
    979      * @since 3.0
    980      * @return void
    981      */
    982     public function show_db_optm() {
    983         require_once LSCWP_DIR . 'tpl/db_optm/entry.tpl.php';
    984907    }
    985908
  • litespeed-cache/trunk/src/admin-settings.cls.php

    r3352087 r3359287  
    8080            if ( $child ) {
    8181                // []=xxx or [0]=xxx
    82                 $data = ! empty( $raw_data[ $id ][ $child ] ) ? $raw_data[ $id ][ $child ] : false;
     82                $data = ! empty( $raw_data[ $id ][ $child ] ) ? $raw_data[ $id ][ $child ] : $this->type_casting(false, $id);
    8383            } else {
    84                 $data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id ] : false;
     84                $data = ! empty( $raw_data[ $id ] ) ? $raw_data[ $id ] : $this->type_casting(false, $id);
    8585            }
    8686
     
    216216                    $data = $data2;
    217217                    break;
     218                   
     219                case self::O_IMG_OPTM_SIZES_SKIPPED: // Skip image sizes
     220                    $image_sizes = Utility::prepare_image_sizes_array();
     221                    $saved_sizes = isset( $raw_data[$id] ) ? $raw_data[$id] : [];
     222                    $data        = array_diff( $image_sizes, $saved_sizes );
     223                    break;
    218224
    219225                default:
  • litespeed-cache/trunk/src/base.cls.php

    r3352087 r3359287  
    11<?php
    2 // phpcs:ignoreFile
    32/**
    4  * The base consts
     3 * The base constants and defaults for LiteSpeed Cache.
    54 *
    6  * @since       3.7
     5 * Defines all option keys, default values, and helper methods shared across the plugin.
     6 *
     7 * @since 3.7
     8 * @package LiteSpeed
    79 */
    810
     
    1113defined('WPINC') || exit();
    1214
     15/**
     16 * Class Base
     17 *
     18 * Core definitions and helpers shared across LiteSpeed Cache.
     19 */
    1320class Base extends Root {
    1421
     
    2532    const HASH           = 'hash'; // Not set-able
    2633    const O_AUTO_UPGRADE = 'auto_upgrade';
    27     const O_API_KEY      = 'api_key'; // Deprecated since v6.4. TODO: Will drop after v6.5
     34    const O_API_KEY      = 'api_key'; // Deprecated since v6.4. TODO: Will drop after v8 (still need to keep for v7 upgrade conf usage as v6.5.4 has a major user base)
    2835    const O_SERVER_IP    = 'server_ip';
    2936    const O_GUEST        = 'guest';
     
    4148    const O_CACHE_REST           = 'cache-rest';
    4249    const O_CACHE_PAGE_LOGIN     = 'cache-page_login';
    43     const O_CACHE_FAVICON        = 'cache-favicon'; // Deprecated since v6.2. TODO: Will drop after v6.5
    4450    const O_CACHE_RES            = 'cache-resources'; // Deprecated since v7.2. TODO: Drop after v7.5
    4551    const O_CACHE_MOBILE         = 'cache-mobile';
     
    230236    const O_IMG_OPTM_WEBP                = 'img_optm-webp';
    231237    const O_IMG_OPTM_LOSSLESS            = 'img_optm-lossless';
     238    const O_IMG_OPTM_SIZES_SKIPPED       = 'img_optm-sizes_skipped';
    232239    const O_IMG_OPTM_EXIF                = 'img_optm-exif';
    233240    const O_IMG_OPTM_WEBP_ATTR           = 'img_optm-webp_attr';
     
    280287    const O_QC_CNAME             = 'qc-cname';
    281288
     289    // -------------------------------------------------- ##
     290    // --------------      OptimaX      ----------------- ##
     291    // -------------------------------------------------- ##
     292    const O_OPTIMAX = 'optimax';
     293
    282294    const NETWORK_O_USE_PRIMARY = 'use_primary_settings';
    283295
     
    312324    const IMG_OPTM_BM_AVIF     = 16; // @Deprecated since v7.0
    313325
    314     /* Site related options (Will not overwrite other sites' config) */
    315     protected static $SINGLE_SITE_OPTIONS = array(
     326    /**
     327     * Site related options (Will not overwrite other sites' config).
     328     *
     329     * @var string[]
     330     */
     331    protected static $single_site_options = [
    316332        self::O_CRAWLER,
    317333        self::O_CRAWLER_SITEMAP,
     
    330346        self::O_QC_NAMESERVERS,
    331347        self::O_QC_CNAME,
    332     );
    333 
    334     protected static $_default_options = array(
     348    ];
     349
     350    /**
     351     * Default options for single-site installs.
     352     *
     353     * @var array<string,mixed>
     354     */
     355    protected static $_default_options = [
    335356        self::_VER => '',
    336357        self::HASH => '',
     
    341362        self::O_GUEST_OPTM => false,
    342363        self::O_NEWS => false,
    343         self::O_GUEST_UAS => array(),
    344         self::O_GUEST_IPS => array(),
     364        self::O_GUEST_UAS => [],
     365        self::O_GUEST_IPS => [],
    345366
    346367        // Cache
     
    351372        self::O_CACHE_PAGE_LOGIN => false,
    352373        self::O_CACHE_MOBILE => false,
    353         self::O_CACHE_MOBILE_RULES => array(),
     374        self::O_CACHE_MOBILE_RULES => [],
    354375        self::O_CACHE_BROWSER => false,
    355         self::O_CACHE_EXC_USERAGENTS => array(),
    356         self::O_CACHE_EXC_COOKIES => array(),
    357         self::O_CACHE_EXC_QS => array(),
    358         self::O_CACHE_EXC_CAT => array(),
    359         self::O_CACHE_EXC_TAG => array(),
    360         self::O_CACHE_FORCE_URI => array(),
    361         self::O_CACHE_FORCE_PUB_URI => array(),
    362         self::O_CACHE_PRIV_URI => array(),
    363         self::O_CACHE_EXC => array(),
    364         self::O_CACHE_EXC_ROLES => array(),
    365         self::O_CACHE_DROP_QS => array(),
     376        self::O_CACHE_EXC_USERAGENTS => [],
     377        self::O_CACHE_EXC_COOKIES => [],
     378        self::O_CACHE_EXC_QS => [],
     379        self::O_CACHE_EXC_CAT => [],
     380        self::O_CACHE_EXC_TAG => [],
     381        self::O_CACHE_FORCE_URI => [],
     382        self::O_CACHE_FORCE_PUB_URI => [],
     383        self::O_CACHE_PRIV_URI => [],
     384        self::O_CACHE_EXC => [],
     385        self::O_CACHE_EXC_ROLES => [],
     386        self::O_CACHE_DROP_QS => [],
    366387        self::O_CACHE_TTL_PUB => 0,
    367388        self::O_CACHE_TTL_PRIV => 0,
     
    370391        self::O_CACHE_TTL_REST => 0,
    371392        self::O_CACHE_TTL_BROWSER => 0,
    372         self::O_CACHE_TTL_STATUS => array(),
     393        self::O_CACHE_TTL_STATUS => [],
    373394        self::O_CACHE_LOGIN_COOKIE => '',
    374         self::O_CACHE_AJAX_TTL => array(),
    375         self::O_CACHE_VARY_COOKIES => array(),
    376         self::O_CACHE_VARY_GROUP => array(),
     395        self::O_CACHE_AJAX_TTL => [],
     396        self::O_CACHE_VARY_COOKIES => [],
     397        self::O_CACHE_VARY_GROUP => [],
    377398
    378399        // Purge
     
    390411        self::O_PURGE_POST_TERM => false,
    391412        self::O_PURGE_POST_POSTTYPE => false,
    392         self::O_PURGE_TIMED_URLS => array(),
     413        self::O_PURGE_TIMED_URLS => [],
    393414        self::O_PURGE_TIMED_URLS_TIME => '',
    394         self::O_PURGE_HOOK_ALL => array(),
     415        self::O_PURGE_HOOK_ALL => [],
    395416
    396417        // ESI
     
    398419        self::O_ESI_CACHE_ADMBAR => false,
    399420        self::O_ESI_CACHE_COMMFORM => false,
    400         self::O_ESI_NONCE => array(),
     421        self::O_ESI_NONCE => [],
    401422
    402423        // Util
     
    407428        self::O_DEBUG_DISABLE_ALL => false,
    408429        self::O_DEBUG => false,
    409         self::O_DEBUG_IPS => array(),
     430        self::O_DEBUG_IPS => [],
    410431        self::O_DEBUG_LEVEL => false,
    411432        self::O_DEBUG_FILESIZE => 0,
    412433        self::O_DEBUG_COLLAPSE_QS => false,
    413         self::O_DEBUG_INC => array(),
    414         self::O_DEBUG_EXC => array(),
    415         self::O_DEBUG_EXC_STRINGS => array(),
     434        self::O_DEBUG_INC => [],
     435        self::O_DEBUG_EXC => [],
     436        self::O_DEBUG_EXC_STRINGS => [],
    416437
    417438        // DB Optm
     
    425446        self::O_OPTM_UCSS => false,
    426447        self::O_OPTM_UCSS_INLINE => false,
    427         self::O_OPTM_UCSS_SELECTOR_WHITELIST => array(),
    428         self::O_OPTM_UCSS_FILE_EXC_INLINE => array(),
    429         self::O_OPTM_UCSS_EXC => array(),
    430         self::O_OPTM_CSS_EXC => array(),
     448        self::O_OPTM_UCSS_SELECTOR_WHITELIST => [],
     449        self::O_OPTM_UCSS_FILE_EXC_INLINE => [],
     450        self::O_OPTM_UCSS_EXC => [],
     451        self::O_OPTM_CSS_EXC => [],
    431452        self::O_OPTM_JS_MIN => false,
    432453        self::O_OPTM_JS_COMB => false,
    433454        self::O_OPTM_JS_COMB_EXT_INL => false,
    434         self::O_OPTM_JS_DELAY_INC => array(),
    435         self::O_OPTM_JS_EXC => array(),
     455        self::O_OPTM_JS_DELAY_INC => [],
     456        self::O_OPTM_JS_EXC => [],
    436457        self::O_OPTM_HTML_MIN => false,
    437         self::O_OPTM_HTML_LAZY => array(),
    438         self::O_OPTM_HTML_SKIP_COMMENTS => array(),
     458        self::O_OPTM_HTML_LAZY => [],
     459        self::O_OPTM_HTML_SKIP_COMMENTS => [],
    439460        self::O_OPTM_QS_RM => false,
    440461        self::O_OPTM_GGFONTS_RM => false,
    441462        self::O_OPTM_CSS_ASYNC => false,
    442463        self::O_OPTM_CCSS_PER_URL => false,
    443         self::O_OPTM_CCSS_SEP_POSTTYPE => array(),
    444         self::O_OPTM_CCSS_SEP_URI => array(),
    445         self::O_OPTM_CCSS_SELECTOR_WHITELIST => array(),
     464        self::O_OPTM_CCSS_SEP_POSTTYPE => [],
     465        self::O_OPTM_CCSS_SEP_URI => [],
     466        self::O_OPTM_CCSS_SELECTOR_WHITELIST => [],
    446467        self::O_OPTM_CSS_ASYNC_INLINE => false,
    447468        self::O_OPTM_CSS_FONT_DISPLAY => false,
     
    450471        self::O_OPTM_NOSCRIPT_RM => false,
    451472        self::O_OPTM_GGFONTS_ASYNC => false,
    452         self::O_OPTM_EXC_ROLES => array(),
     473        self::O_OPTM_EXC_ROLES => [],
    453474        self::O_OPTM_CCSS_CON => '',
    454         self::O_OPTM_JS_DEFER_EXC => array(),
    455         self::O_OPTM_GM_JS_EXC => array(),
    456         self::O_OPTM_DNS_PREFETCH => array(),
     475        self::O_OPTM_JS_DEFER_EXC => [],
     476        self::O_OPTM_GM_JS_EXC => [],
     477        self::O_OPTM_DNS_PREFETCH => [],
    457478        self::O_OPTM_DNS_PREFETCH_CTRL => false,
    458         self::O_OPTM_DNS_PRECONNECT => array(),
    459         self::O_OPTM_EXC => array(),
     479        self::O_OPTM_DNS_PRECONNECT => [],
     480        self::O_OPTM_EXC => [],
    460481        self::O_OPTM_GUEST_ONLY => false,
    461482
     
    472493        self::O_OBJECT_USER => '',
    473494        self::O_OBJECT_PSWD => '',
    474         self::O_OBJECT_GLOBAL_GROUPS => array(),
    475         self::O_OBJECT_NON_PERSISTENT_GROUPS => array(),
     495        self::O_OBJECT_GLOBAL_GROUPS => [],
     496        self::O_OBJECT_NON_PERSISTENT_GROUPS => [],
    476497
    477498        // Discuss
     
    480501        self::O_DISCUSS_AVATAR_CACHE_TTL => 0,
    481502        self::O_OPTM_LOCALIZE => false,
    482         self::O_OPTM_LOCALIZE_DOMAINS => array(),
     503        self::O_OPTM_LOCALIZE_DOMAINS => [],
    483504
    484505        // Media
     
    495516        self::O_MEDIA_IFRAME_LAZY => false,
    496517        self::O_MEDIA_ADD_MISSING_SIZES => false,
    497         self::O_MEDIA_LAZY_EXC => array(),
    498         self::O_MEDIA_LAZY_CLS_EXC => array(),
    499         self::O_MEDIA_LAZY_PARENT_CLS_EXC => array(),
    500         self::O_MEDIA_IFRAME_LAZY_CLS_EXC => array(),
    501         self::O_MEDIA_IFRAME_LAZY_PARENT_CLS_EXC => array(),
    502         self::O_MEDIA_LAZY_URI_EXC => array(),
    503         self::O_MEDIA_LQIP_EXC => array(),
     518        self::O_MEDIA_LAZY_EXC => [],
     519        self::O_MEDIA_LAZY_CLS_EXC => [],
     520        self::O_MEDIA_LAZY_PARENT_CLS_EXC => [],
     521        self::O_MEDIA_IFRAME_LAZY_CLS_EXC => [],
     522        self::O_MEDIA_IFRAME_LAZY_PARENT_CLS_EXC => [],
     523        self::O_MEDIA_LAZY_URI_EXC => [],
     524        self::O_MEDIA_LQIP_EXC => [],
    504525        self::O_MEDIA_VPI => false,
    505526        self::O_MEDIA_VPI_CRON => false,
     
    512533        self::O_IMG_OPTM_WEBP => false,
    513534        self::O_IMG_OPTM_LOSSLESS => false,
     535        self::O_IMG_OPTM_SIZES_SKIPPED => [],
    514536        self::O_IMG_OPTM_EXIF => false,
    515         self::O_IMG_OPTM_WEBP_ATTR => array(),
     537        self::O_IMG_OPTM_WEBP_ATTR => [],
    516538        self::O_IMG_OPTM_WEBP_REPLACE_SRCSET => false,
    517539        self::O_IMG_OPTM_JPG_QUALITY => 0,
     
    522544        self::O_CRAWLER_LOAD_LIMIT => 0,
    523545        self::O_CRAWLER_SITEMAP => '',
    524         self::O_CRAWLER_ROLES => array(),
    525         self::O_CRAWLER_COOKIES => array(),
     546        self::O_CRAWLER_ROLES => [],
     547        self::O_CRAWLER_COOKIES => [],
    526548
    527549        // Misc
     
    535557        // CDN
    536558        self::O_CDN => false,
    537         self::O_CDN_ORI => array(),
    538         self::O_CDN_ORI_DIR => array(),
    539         self::O_CDN_EXC => array(),
     559        self::O_CDN_ORI => [],
     560        self::O_CDN_ORI_DIR => [],
     561        self::O_CDN_EXC => [],
    540562        self::O_CDN_QUIC => false,
    541563        self::O_CDN_CLOUDFLARE => false,
     
    545567        self::O_CDN_CLOUDFLARE_ZONE => '',
    546568        self::O_CDN_CLOUDFLARE_CLEAR => false,
    547         self::O_CDN_MAPPING => array(),
    548         self::O_CDN_ATTR => array(),
     569        self::O_CDN_MAPPING => [],
     570        self::O_CDN_ATTR => [],
    549571
    550572        self::O_QC_NAMESERVERS => '',
     
    552574
    553575        self::DEBUG_TMP_DISABLE => 0,
    554     );
    555 
    556     protected static $_default_site_options = array(
     576    ];
     577
     578    /**
     579     * Default options for multisite (site-level options stored network-wide).
     580     *
     581     * @var array<string,mixed>
     582     */
     583    protected static $_default_site_options = [
    557584        self::_VER => '',
    558585        self::O_CACHE => false,
     
    563590        self::O_CACHE_BROWSER => false,
    564591        self::O_CACHE_MOBILE => false,
    565         self::O_CACHE_MOBILE_RULES => array(),
     592        self::O_CACHE_MOBILE_RULES => [],
    566593        self::O_CACHE_LOGIN_COOKIE => '',
    567         self::O_CACHE_VARY_COOKIES => array(),
    568         self::O_CACHE_EXC_COOKIES => array(),
    569         self::O_CACHE_EXC_USERAGENTS => array(),
     594        self::O_CACHE_VARY_COOKIES => [],
     595        self::O_CACHE_EXC_COOKIES => [],
     596        self::O_CACHE_EXC_USERAGENTS => [],
    570597        self::O_CACHE_TTL_BROWSER => 0,
    571598
     
    583610        self::O_OBJECT_USER => '',
    584611        self::O_OBJECT_PSWD => '',
    585         self::O_OBJECT_GLOBAL_GROUPS => array(),
    586         self::O_OBJECT_NON_PERSISTENT_GROUPS => array(),
     612        self::O_OBJECT_GLOBAL_GROUPS => [],
     613        self::O_OBJECT_NON_PERSISTENT_GROUPS => [],
    587614
    588615        // Debug
    589616        self::O_DEBUG_DISABLE_ALL => false,
    590617        self::O_DEBUG => false,
    591         self::O_DEBUG_IPS => array(),
     618        self::O_DEBUG_IPS => [],
    592619        self::O_DEBUG_LEVEL => false,
    593620        self::O_DEBUG_FILESIZE => 0,
    594621        self::O_DEBUG_COLLAPSE_QS => false,
    595         self::O_DEBUG_INC => array(),
    596         self::O_DEBUG_EXC => array(),
    597         self::O_DEBUG_EXC_STRINGS => array(),
     622        self::O_DEBUG_INC => [],
     623        self::O_DEBUG_EXC => [],
     624        self::O_DEBUG_EXC_STRINGS => [],
    598625
    599626        self::O_IMG_OPTM_WEBP => false,
    600     );
    601 
    602     // NOTE: all the val of following items will be int while not bool
    603     protected static $_multi_switch_list = array(
     627    ];
     628
     629    /**
     630     * Multi-switch options: option ID => max state (int).
     631     * NOTE: all the val of following items will be int while not bool
     632     *
     633     * @var array<string,int>
     634     */
     635    protected static $_multi_switch_list = [
    604636        self::O_DEBUG => 2,
    605637        self::O_OPTM_JS_DEFER => 2,
    606638        self::O_IMG_OPTM_WEBP => 2,
    607     );
    608 
    609     /**
    610      * Correct the option type
     639    ];
     640
     641    /**
     642     * Correct the option type.
    611643     *
    612644     * TODO: add similar network func
    613645     *
    614      * @since  3.0.3
     646     * @since 3.0.3
     647     *
     648     * @param mixed  $val          Incoming value.
     649     * @param string $id           Option ID.
     650     * @param bool   $is_site_conf Whether using site-level defaults.
     651     * @return mixed
    615652     */
    616653    protected function type_casting( $val, $id, $is_site_conf = false ) {
    617         $default_v = !$is_site_conf ? self::$_default_options[$id] : self::$_default_site_options[$id];
    618         if (is_bool($default_v)) {
    619             if ($val === 'true') {
     654        $default_v = ! $is_site_conf ? self::$_default_options[ $id ] : self::$_default_site_options[ $id ];
     655        if ( is_bool( $default_v ) ) {
     656            if ( 'true' === $val ) {
    620657                $val = true;
    621658            }
    622             if ($val === 'false') {
     659            if ( 'false' === $val ) {
    623660                $val = false;
    624661            }
    625662
    626             $max = $this->_conf_multi_switch($id);
    627             if ($max) {
     663            $max = $this->_conf_multi_switch( $id );
     664            if ( $max ) {
    628665                $val  = (int) $val;
    629666                $val %= $max + 1;
     
    631668                $val = (bool) $val;
    632669            }
    633         } elseif (is_array($default_v)) {
     670        } elseif ( is_array( $default_v ) ) {
    634671            // from textarea input
    635             if (!is_array($val)) {
    636                 $val = Utility::sanitize_lines($val, $this->_conf_filter($id));
     672            if ( ! is_array( $val ) ) {
     673                $val = Utility::sanitize_lines( $val, $this->_conf_filter( $id ) );
    637674            }
    638         } elseif (!is_string($default_v)) {
     675        } elseif ( ! is_string( $default_v ) ) {
    639676            $val = (int) $val;
    640677        } else {
    641678            // Check if the string has a limit set
    642             $val = $this->_conf_string_val($id, $val);
     679            $val = $this->_conf_string_val( $id, $val );
    643680        }
    644681
     
    649686     * Load default network settings from data.ini
    650687     *
    651      * @since  3.0
     688     * @since 3.0
     689     * @return array<string,mixed>
    652690     */
    653691    public function load_default_site_vals() {
    654692        // Load network_default.json
    655         if (file_exists(LSCWP_DIR . 'data/const.network_default.json')) {
    656             $default_ini_cfg = json_decode(File::read(LSCWP_DIR . 'data/const.network_default.json'), true);
    657             foreach (self::$_default_site_options as $k => $v) {
    658                 if (!array_key_exists($k, $default_ini_cfg)) {
     693        if ( file_exists( LSCWP_DIR . 'data/const.network_default.json' ) ) {
     694            $default_ini_cfg = json_decode( File::read( LSCWP_DIR . 'data/const.network_default.json' ), true );
     695            foreach ( self::$_default_site_options as $k => $v ) {
     696                if ( ! array_key_exists( $k, $default_ini_cfg ) ) {
    659697                    continue;
    660698                }
    661699
    662700                // Parse value in ini file
    663                 $ini_v = $this->type_casting($default_ini_cfg[$k], $k, true);
    664 
    665                 if ($ini_v == $v) {
     701                $ini_v = $this->type_casting( $default_ini_cfg[ $k ], $k, true );
     702
     703                if ( $ini_v === $v ) {
    666704                    continue;
    667705                }
    668706
    669                 self::$_default_site_options[$k] = $ini_v;
     707                self::$_default_site_options[ $k ] = $ini_v;
    670708            }
    671709        }
    672710
    673         self::$_default_site_options[self::_VER] = Core::VER;
     711        self::$_default_site_options[ self::_VER ] = Core::VER;
    674712
    675713        return self::$_default_site_options;
     
    681719     * @since 3.0
    682720     * @access public
     721     * @return array<string,mixed>
    683722     */
    684723    public function load_default_vals() {
    685724        // Load default.json
    686         if (file_exists(LSCWP_DIR . 'data/const.default.json')) {
    687             $default_ini_cfg = json_decode(File::read(LSCWP_DIR . 'data/const.default.json'), true);
    688             foreach (self::$_default_options as $k => $v) {
    689                 if (!array_key_exists($k, $default_ini_cfg)) {
     725        if ( file_exists( LSCWP_DIR . 'data/const.default.json' ) ) {
     726            $default_ini_cfg = json_decode( File::read( LSCWP_DIR . 'data/const.default.json' ), true );
     727            foreach ( self::$_default_options as $k => $v ) {
     728                if ( ! array_key_exists( $k, $default_ini_cfg ) ) {
    690729                    continue;
    691730                }
    692731
    693732                // Parse value in ini file
    694                 $ini_v = $this->type_casting($default_ini_cfg[$k], $k);
     733                $ini_v = $this->type_casting( $default_ini_cfg[ $k ], $k );
    695734
    696735                // NOTE: Multiple lines value must be stored as array
     
    698737                 * Special handler for CDN_mapping
    699738                 *
    700                  * format in .ini:
     739                 * Format in .ini:
    701740                 *      [cdn-mapping]
    702741                 *      url[0] = 'https://example.com/'
     
    709748                 *      [0] = [ 'url' => 'https://example.com', 'inc_js' => true, 'filetype' => [ '.css', '.js', '.jpg' ] ]
    710749                 */
    711                 if ($k == self::O_CDN_MAPPING) {
    712                     $mapping_fields = array(
     750                if ( self::O_CDN_MAPPING === $k ) {
     751                    $mapping_fields = [
    713752                        self::CDN_MAPPING_URL,
    714753                        self::CDN_MAPPING_INC_IMG,
     
    716755                        self::CDN_MAPPING_INC_JS,
    717756                        self::CDN_MAPPING_FILETYPE, // Array
    718                     );
    719                     $ini_v2         = array();
    720                     foreach ($ini_v[self::CDN_MAPPING_URL] as $k2 => $v2) {
     757                    ];
     758                    $ini_v2         = [];
     759                    foreach ( $ini_v[ self::CDN_MAPPING_URL ] as $k2 => $v2 ) {
    721760                        // $k2 is numeric
    722                         $this_row = array();
    723                         foreach ($mapping_fields as $v3) {
    724                             $this_v = !empty($ini_v[$v3][$k2]) ? $ini_v[$v3][$k2] : false;
    725                             if ($v3 == self::CDN_MAPPING_URL) {
    726                                 $this_v = $this_v ?: '';
     761                        $this_row = [];
     762                        foreach ( $mapping_fields as $v3 ) {
     763                            $this_v = ! empty( $ini_v[ $v3 ][ $k2 ] ) ? $ini_v[ $v3 ][ $k2 ] : false;
     764                            if ( self::CDN_MAPPING_URL === $v3 ) {
     765                                if ( empty( $this_v ) ) {
     766                                    $this_v = '';
     767                                }
    727768                            }
    728                             if ($v3 == self::CDN_MAPPING_FILETYPE) {
    729                                 $this_v = $this_v ? Utility::sanitize_lines($this_v) : array(); // Note: Since v3.0 its already an array
     769                            if ( self::CDN_MAPPING_FILETYPE === $v3 ) {
     770                                $this_v = $this_v ? Utility::sanitize_lines( $this_v ) : []; // Note: Since v3.0 its already an array
    730771                            }
    731                             $this_row[$v3] = $this_v;
     772                            $this_row[ $v3 ] = $this_v;
    732773                        }
    733                         $ini_v2[$k2] = $this_row;
     774                        $ini_v2[ $k2 ] = $this_row;
    734775                    }
    735776                    $ini_v = $ini_v2;
    736777                }
    737778
    738                 if ($ini_v == $v) {
     779                if ( $ini_v === $v ) {
    739780                    continue;
    740781                }
    741782
    742                 self::$_default_options[$k] = $ini_v;
     783                self::$_default_options[ $k ] = $ini_v;
    743784            }
    744785        }
     
    746787        // Load internal default vals
    747788        // Setting the default bool to int is also to avoid type casting override it back to bool
    748         self::$_default_options[self::O_CACHE] = is_multisite() ? self::VAL_ON2 : self::VAL_ON; // For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
     789        self::$_default_options[ self::O_CACHE ] = is_multisite() ? self::VAL_ON2 : self::VAL_ON; // For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
    749790
    750791        // Load default vals containing variables
    751         if (!self::$_default_options[self::O_CDN_ORI_DIR]) {
    752             self::$_default_options[self::O_CDN_ORI_DIR] = LSCWP_CONTENT_FOLDER . "\nwp-includes";
    753             self::$_default_options[self::O_CDN_ORI_DIR] = explode("\n", self::$_default_options[self::O_CDN_ORI_DIR]);
    754             self::$_default_options[self::O_CDN_ORI_DIR] = array_map('trim', self::$_default_options[self::O_CDN_ORI_DIR]);
     792        if ( ! self::$_default_options[ self::O_CDN_ORI_DIR ] ) {
     793            self::$_default_options[ self::O_CDN_ORI_DIR ] = LSCWP_CONTENT_FOLDER . "\nwp-includes";
     794            self::$_default_options[ self::O_CDN_ORI_DIR ] = explode( "\n", self::$_default_options[ self::O_CDN_ORI_DIR ] );
     795            self::$_default_options[ self::O_CDN_ORI_DIR ] = array_map( 'trim', self::$_default_options[ self::O_CDN_ORI_DIR ] );
    755796        }
    756797
    757798        // Set security key if not initialized yet
    758         if (!self::$_default_options[self::HASH]) {
    759             self::$_default_options[self::HASH] = Str::rrand(32);
     799        if ( ! self::$_default_options[ self::HASH ] ) {
     800            self::$_default_options[ self::HASH ] = Str::rrand( 32 );
    760801        }
    761802
    762         self::$_default_options[self::_VER] = Core::VER;
     803        self::$_default_options[ self::_VER ] = Core::VER;
    763804
    764805        return self::$_default_options;
     
    766807
    767808    /**
    768      * Format the string value
    769      *
    770      * @since  3.0
     809     * Format the string value.
     810     *
     811     * @since 3.0
     812     *
     813     * @param string $id  Option ID.
     814     * @param mixed  $val Value.
     815     * @return string
    771816     */
    772817    protected function _conf_string_val( $id, $val ) {
    773         return $val;
    774     }
    775 
    776     /**
    777      * If the switch setting is a triple value or not
    778      *
    779      * @since  3.0
     818        return (string) $val;
     819    }
     820
     821    /**
     822     * If the switch setting is a triple value or not.
     823     *
     824     * @since 3.0
     825     *
     826     * @param string $id Option ID.
     827     * @return int|false
    780828     */
    781829    protected function _conf_multi_switch( $id ) {
    782         if (!empty(self::$_multi_switch_list[$id])) {
    783             return self::$_multi_switch_list[$id];
     830        if ( ! empty( self::$_multi_switch_list[ $id ] ) ) {
     831            return self::$_multi_switch_list[ $id ];
    784832        }
    785833
    786         if ($id == self::O_CACHE && is_multisite()) {
     834        if ( self::O_CACHE === $id && is_multisite() ) {
    787835            return self::VAL_ON2;
    788836        }
     
    792840
    793841    /**
    794      * Append a new multi switch max limit for the bool option
    795      *
    796      * @since  3.0
     842     * Append a new multi switch max limit for the bool option.
     843     *
     844     * @since 3.0
     845     *
     846     * @param string $id Option ID.
     847     * @param int    $v  Max state.
     848     * @return void
    797849     */
    798850    public static function set_multi_switch( $id, $v ) {
    799         self::$_multi_switch_list[$id] = $v;
    800     }
    801 
    802     /**
    803      * Generate const name based on $id
    804      *
    805      * @since  3.0
     851        self::$_multi_switch_list[ $id ] = $v;
     852    }
     853
     854    /**
     855     * Generate const name based on $id.
     856     *
     857     * @since 3.0
     858     *
     859     * @param string $id Option ID.
     860     * @return string
    806861     */
    807862    public static function conf_const( $id ) {
    808         return 'LITESPEED_CONF__' . strtoupper(str_replace('-', '__', $id));
    809     }
    810 
    811     /**
    812      * Filter to be used when saving setting
    813      *
    814      * @since  3.0
     863        return 'LITESPEED_CONF__' . strtoupper( str_replace( '-', '__', $id ) );
     864    }
     865
     866    /**
     867     * Filter to be used when saving setting.
     868     *
     869     * @since 3.0
     870     *
     871     * @param string $id Option ID.
     872     * @return string|false
    815873     */
    816874    protected function _conf_filter( $id ) {
    817         $filters = array(
     875        $filters = [
    818876            self::O_MEDIA_LAZY_EXC => 'uri',
    819877            self::O_DEBUG_INC => 'relative',
     
    835893            // self::   => '',
    836894            // self::   => '',
    837         );
    838 
    839         if (!empty($filters[$id])) {
    840             return $filters[$id];
     895        ];
     896
     897        if ( ! empty( $filters[ $id ] ) ) {
     898            return $filters[ $id ];
    841899        }
    842900
     
    845903
    846904    /**
    847      * If the setting changes worth a purge or not
    848      *
    849      * @since  3.0
     905     * If the setting changes worth a purge or not.
     906     *
     907     * @since 3.0
     908     *
     909     * @param string $id Option ID.
     910     * @return bool
    850911     */
    851912    protected function _conf_purge( $id ) {
    852         $check_ids = array(
     913        $check_ids = [
    853914            self::O_MEDIA_LAZY_URI_EXC,
    854915            self::O_OPTM_EXC,
     
    858919            self::O_CACHE_FORCE_PUB_URI,
    859920            self::O_CACHE_EXC,
    860         );
    861 
    862         return in_array($id, $check_ids);
    863     }
    864 
    865     /**
    866      * If the setting changes worth a purge ALL or not
    867      *
    868      * @since  3.0
     921        ];
     922
     923        return in_array( $id, $check_ids, true );
     924    }
     925
     926    /**
     927     * If the setting changes worth a purge ALL or not.
     928     *
     929     * @since 3.0
     930     *
     931     * @param string $id Option ID.
     932     * @return bool
    869933     */
    870934    protected function _conf_purge_all( $id ) {
    871         $check_ids = array( self::O_CACHE, self::O_ESI, self::O_DEBUG_DISABLE_ALL, self::NETWORK_O_USE_PRIMARY );
    872 
    873         return in_array($id, $check_ids);
    874     }
    875 
    876     /**
    877      * If the setting is a pswd or not
    878      *
    879      * @since  3.0
     935        $check_ids = [ self::O_CACHE, self::O_ESI, self::O_DEBUG_DISABLE_ALL, self::NETWORK_O_USE_PRIMARY ];
     936
     937        return in_array( $id, $check_ids, true );
     938    }
     939
     940    /**
     941     * If the setting is a password or not.
     942     *
     943     * @since 3.0
     944     *
     945     * @param string $id Option ID.
     946     * @return bool
    880947     */
    881948    protected function _conf_pswd( $id ) {
    882         $check_ids = array( self::O_CDN_CLOUDFLARE_KEY, self::O_OBJECT_PSWD );
    883 
    884         return in_array($id, $check_ids);
    885     }
    886 
    887     /**
    888      * If the setting is cron related or not
    889      *
    890      * @since  3.0
     949        $check_ids = [ self::O_CDN_CLOUDFLARE_KEY, self::O_OBJECT_PSWD ];
     950
     951        return in_array( $id, $check_ids, true );
     952    }
     953
     954    /**
     955     * If the setting is cron related or not.
     956     *
     957     * @since 3.0
     958     *
     959     * @param string $id Option ID.
     960     * @return bool
    891961     */
    892962    protected function _conf_cron( $id ) {
    893         $check_ids = array( self::O_OPTM_CSS_ASYNC, self::O_MEDIA_PLACEHOLDER_RESP_ASYNC, self::O_DISCUSS_AVATAR_CRON, self::O_IMG_OPTM_AUTO, self::O_CRAWLER );
    894 
    895         return in_array($id, $check_ids);
    896     }
    897 
    898     /**
    899      * If the setting changes worth a purge, return the tag
    900      *
    901      * @since  3.0
     963        $check_ids = [ self::O_OPTM_CSS_ASYNC, self::O_MEDIA_PLACEHOLDER_RESP_ASYNC, self::O_DISCUSS_AVATAR_CRON, self::O_IMG_OPTM_AUTO, self::O_CRAWLER ];
     964
     965        return in_array( $id, $check_ids, true );
     966    }
     967
     968    /**
     969     * If the setting changes worth a purge, return the tag.
     970     *
     971     * @since 3.0
     972     *
     973     * @param string $id Option ID.
     974     * @return string|false
    902975     */
    903976    protected function _conf_purge_tag( $id ) {
    904         $check_ids = array(
     977        $check_ids = [
    905978            self::O_CACHE_PAGE_LOGIN => Tag::TYPE_LOGIN,
    906         );
    907 
    908         if (!empty($check_ids[$id])) {
    909             return $check_ids[$id];
     979        ];
     980
     981        if ( ! empty( $check_ids[ $id ] ) ) {
     982            return $check_ids[ $id ];
    910983        }
    911984
     
    914987
    915988    /**
    916      * Generate server vars
     989     * Generate server vars.
    917990     *
    918991     * @since 2.4.1
     992     *
     993     * @return array<string,mixed> Map of constant name => value|null.
    919994     */
    920995    public function server_vars() {
    921         $consts      = array(
     996        $consts      = [
    922997            'WP_SITEURL',
    923998            'WP_HOME',
     
    9341009            'LSWCP_TAG_PREFIX',
    9351010            'COOKIEHASH',
    936         );
    937         $server_vars = array();
    938         foreach ($consts as $v) {
    939             $server_vars[$v] = defined($v) ? constant($v) : null;
     1011        ];
     1012        $server_vars = [];
     1013        foreach ( $consts as $v ) {
     1014            $server_vars[ $v ] = defined( $v ) ? constant( $v ) : null;
    9401015        }
    9411016
  • litespeed-cache/trunk/src/cloud.cls.php

    r3352087 r3359287  
    756756            'php' => phpversion(),
    757757        );
     758        // If code ver is smaller than db ver, bypass
     759        if (!empty($req_data['v']) && version_compare(Core::VER, $req_data['v'], '<')) {
     760            return;
     761        }
    758762        if (defined('LITESPEED_ERR')) {
    759             $req_data['err'] = base64_encode(!is_string(LITESPEED_ERR) ? \json_encode(LITESPEED_ERR) : LITESPEED_ERR);
     763            $LITESPEED_ERR = constant('LITESPEED_ERR');
     764            $req_data['err'] = base64_encode(!is_string($LITESPEED_ERR) ? \json_encode($LITESPEED_ERR) : $LITESPEED_ERR);
    760765        }
    761766        $data = self::post(self::API_VER, $req_data);
     
    11571162
    11581163        self::save_summary(array( 'curr_request.' . $service_tag => time() ));
    1159         File::save(LITESPEED_STATIC_DIR . '/qc_curr_request' . md5($service_tag), time(), true);
     1164        File::save($this->_qc_time_file($service_tag, 'curr'), time(), true);
    11601165
    11611166        $response = wp_safe_remote_get($url, array(
     
    12151220        $expiration_req = self::EXPIRATION_REQ;
    12161221        // Limit frequent unfinished request to 5min
    1217         $timestamp_tag = 'curr_request.';
     1222        $timestamp_tag = 'curr';
    12181223        if ($service_tag == self::SVC_IMG_OPTM . '-' . Img_Optm::TYPE_NEW_REQ) {
    1219             $timestamp_tag = 'last_request.';
     1224            $timestamp_tag = 'last';
    12201225        }
    12211226
    12221227        // For all other requests, if is under debug mode, will always allow
    12231228        if (!$this->conf(self::O_DEBUG)) {
    1224             if (!empty($this->_summary[$timestamp_tag . $service_tag])) {
    1225                 $expired = $this->_summary[$timestamp_tag . $service_tag] + $expiration_req - time();
     1229            if (!empty($this->_summary[$timestamp_tag . '_request.' . $service_tag])) {
     1230                $expired = $this->_summary[$timestamp_tag . '_request.' . $service_tag] + $expiration_req - time();
    12261231                if ($expired > 0) {
    12271232                    self::debug("❌ try [$service_tag] after $expired seconds");
     
    12421247                }
    12431248            } else {
    1244                 // May fail to store to db if db died. Need to store to file to prevent from duplicate calls
    1245                 $file_path = LITESPEED_STATIC_DIR . '/qc_' . $timestamp_tag . md5($service_tag);
     1249                // May fail to store to db if db is oc cached/dead/locked/readonly. Need to store to file to prevent from duplicate calls
     1250                $file_path = $this->_qc_time_file($service_tag, $timestamp_tag);
    12461251                if (file_exists($file_path)) {
    12471252                    $last_request = file_get_contents($file_path);
     
    12541259                // For ver check, additional check to prevent frequent calls as old DB ver may be cached
    12551260                if (self::API_VER === $service_tag) {
    1256                     $file_path = LITESPEED_STATIC_DIR . '/qc_last_request' . md5($service_tag);
     1261                    $file_path = $this->_qc_time_file($service_tag);
    12571262                    if (file_exists($file_path)) {
    12581263                        $last_request = file_get_contents($file_path);
     
    12621267                            return false;
    12631268                        }
     1269                    // } else {
     1270                    //  File::save(LITESPEED_STATIC_DIR . '/qc_curr_request' . md5($service_tag), time(), true);
    12641271                    }
    12651272                }
     
    12771284
    12781285        return true;
     1286    }
     1287
     1288    /**
     1289     * Get QC req ts file path
     1290     *
     1291     * @since 7.5
     1292     */
     1293    private function _qc_time_file( $service_tag, $type = 'last' ) {
     1294        if ('curr' !== $type) {
     1295            $type = 'last';
     1296        }
     1297        $legacy_file = LITESPEED_STATIC_DIR . '/qc_' . $type . '_request' . md5($service_tag);
     1298        if (file_exists($legacy_file)) {
     1299            wp_delete_file($legacy_file);
     1300        }
     1301        $service_tag = preg_replace('/[^a-zA-Z0-9]/', '', $service_tag);
     1302        return LITESPEED_STATIC_DIR . '/qc.' . $type . '.' . $service_tag;
    12791303    }
    12801304
     
    13801404
    13811405        self::save_summary(array( 'curr_request.' . $service_tag => time() ));
    1382         File::save(LITESPEED_STATIC_DIR . '/qc_curr_request' . md5($service_tag), time(), true);
     1406        File::save($this->_qc_time_file($service_tag, 'curr'), time(), true);
    13831407
    13841408        $response = wp_safe_remote_post($url, array(
     
    15161540            'curr_request.' . $service_tag => 0,
    15171541        ));
    1518         File::save(LITESPEED_STATIC_DIR . '/qc_last_request' . md5($service_tag), $curr_request, true);
    1519         File::save(LITESPEED_STATIC_DIR . '/qc_curr_request' . md5($service_tag), 0, true);
     1542        File::save($this->_qc_time_file($service_tag), $curr_request, true);
     1543        File::save($this->_qc_time_file($service_tag, 'curr'), 0, true);
    15201544
    15211545        if ($json) {
  • litespeed-cache/trunk/src/conf.cls.php

    r3352087 r3359287  
    164164            // This is to load the primary settings ONLY
    165165            // These options are the ones that can be overwritten by primary
    166             $options = array_diff_key($options, array_flip(self::$SINGLE_SITE_OPTIONS));
     166            $options = array_diff_key($options, array_flip(self::$single_site_options));
    167167
    168168            $this->set_primary_conf($options);
     
    435435     * @access public
    436436     */
    437     public function update_confs( $the_matrix = false ) {
     437    public function update_confs( $the_matrix = array() ) {
    438438        if ($the_matrix) {
    439439            foreach ($the_matrix as $id => $val) {
  • litespeed-cache/trunk/src/control.cls.php

    r3352087 r3359287  
    467467            // Use time limit ttl
    468468            $scheduled_time = strtotime($timed_urls_time);
    469             $ttl            = $scheduled_time - time();
     469            $ttl            = $scheduled_time - current_time('timestamp');
    470470            if ($ttl < 0) {
    471471                $ttl += 86400; // add one day
  • litespeed-cache/trunk/src/crawler-map.cls.php

    r3352087 r3359287  
    3737        $this->_tb               = $this->__data->tb('crawler');
    3838        $this->_tb_blacklist     = $this->__data->tb('crawler_blacklist');
    39         $this->_conf_map_timeout = defined('LITESPEED_CRAWLER_MAP_TIMEOUT') ? LITESPEED_CRAWLER_MAP_TIMEOUT : 180; // Specify the timeout while parsing the sitemap
     39        $this->_conf_map_timeout = defined('LITESPEED_CRAWLER_MAP_TIMEOUT') ? constant('LITESPEED_CRAWLER_MAP_TIMEOUT') : 180; // Specify the timeout while parsing the sitemap
    4040    }
    4141
     
    414414
    415415        if (is_array($this->_urls) && !empty($this->_urls)) {
    416             if (defined('LITESPEED_CRAWLER_DROP_DOMAIN') && LITESPEED_CRAWLER_DROP_DOMAIN) {
     416            if (defined('LITESPEED_CRAWLER_DROP_DOMAIN') && constant('LITESPEED_CRAWLER_DROP_DOMAIN')) {
    417417                foreach ($this->_urls as $k => $v) {
    418418                    if (stripos($v, $this->_site_url) !== 0) {
  • litespeed-cache/trunk/src/crawler.cls.php

    r3352087 r3359287  
    396396         */
    397397        $this->_crawler_conf['run_delay'] = 500; // microseconds
    398         if (defined('LITESPEED_CRAWLER_USLEEP') && LITESPEED_CRAWLER_USLEEP > $this->_crawler_conf['run_delay']) {
    399             $this->_crawler_conf['run_delay'] = LITESPEED_CRAWLER_USLEEP;
     398        if (defined('LITESPEED_CRAWLER_USLEEP') && constant('LITESPEED_CRAWLER_USLEEP') > $this->_crawler_conf['run_delay']) {
     399            $this->_crawler_conf['run_delay'] = constant('LITESPEED_CRAWLER_USLEEP');
    400400        }
    401401        if (!empty($_SERVER[Base::ENV_CRAWLER_USLEEP]) && $_SERVER[Base::ENV_CRAWLER_USLEEP] > $this->_crawler_conf['run_delay']) {
     
    442442     */
    443443    public function get_crawler_duration() {
    444         $RUN_DURATION = defined('LITESPEED_CRAWLER_DURATION') ? LITESPEED_CRAWLER_DURATION : 900;
     444        $RUN_DURATION = defined('LITESPEED_CRAWLER_DURATION') ? constant('LITESPEED_CRAWLER_DURATION') : 900;
    445445        if ($RUN_DURATION > 900) {
    446446            $RUN_DURATION = 900; // reset to default value if defined in conf file is higher than 900 seconds for security enhancement
     
    536536        $curload /= $this->_ncpu;
    537537        // $curload = 1;
    538         $CRAWLER_THREADS = defined('LITESPEED_CRAWLER_THREADS') ? LITESPEED_CRAWLER_THREADS : 3;
     538        $CRAWLER_THREADS = defined('LITESPEED_CRAWLER_THREADS') ? constant('LITESPEED_CRAWLER_THREADS') : 3;
    539539
    540540        if ($this->_cur_threads == -1) {
     
    916916        }
    917917        $mh                  = curl_multi_init();
    918         $CRAWLER_DROP_DOMAIN = defined('LITESPEED_CRAWLER_DROP_DOMAIN') ? LITESPEED_CRAWLER_DROP_DOMAIN : false;
     918        $CRAWLER_DROP_DOMAIN = defined('LITESPEED_CRAWLER_DROP_DOMAIN') ? constant('LITESPEED_CRAWLER_DROP_DOMAIN') : false;
    919919        $curls               = array();
    920920        foreach ($rows as $row) {
     
    10491049
    10501050            // If blacklist is disabled
    1051             if ((defined('LITESPEED_CRAWLER_DISABLE_BLOCKLIST') && LITESPEED_CRAWLER_DISABLE_BLOCKLIST) || apply_filters('litespeed_crawler_disable_blocklist', false, $url)) {
     1051            if ((defined('LITESPEED_CRAWLER_DISABLE_BLOCKLIST') && constant('LITESPEED_CRAWLER_DISABLE_BLOCKLIST')) || apply_filters('litespeed_crawler_disable_blocklist', false, $url)) {
    10521052                return self::STATUS_MISS;
    10531053            }
     
    10711071
    10721072        // If blacklist is disabled
    1073         if ((defined('LITESPEED_CRAWLER_DISABLE_BLOCKLIST') && LITESPEED_CRAWLER_DISABLE_BLOCKLIST) || apply_filters('litespeed_crawler_disable_blocklist', false, $url)) {
     1073        if ((defined('LITESPEED_CRAWLER_DISABLE_BLOCKLIST') && constant('LITESPEED_CRAWLER_DISABLE_BLOCKLIST')) || apply_filters('litespeed_crawler_disable_blocklist', false, $url)) {
    10741074            return self::STATUS_MISS;
    10751075        }
     
    10851085     */
    10861086    private function _get_curl_options( $crawler_only = false ) {
    1087         $CRAWLER_TIMEOUT               = defined('LITESPEED_CRAWLER_TIMEOUT') ? LITESPEED_CRAWLER_TIMEOUT : 30;
     1087        $CRAWLER_TIMEOUT               = defined('LITESPEED_CRAWLER_TIMEOUT') ? constant('LITESPEED_CRAWLER_TIMEOUT') : 30;
    10881088        $options                       = array(
    10891089            CURLOPT_RETURNTRANSFER => true,
  • litespeed-cache/trunk/src/db-optm.cls.php

    r3352087 r3359287  
    360360    public function handler_clean_db_cli($args)
    361361    {
    362         if (defined('WP_CLI') && WP_CLI) {
     362        if (defined('WP_CLI') && constant('WP_CLI')) {
    363363            return $this->_db_clean($args);
    364364        }
  • litespeed-cache/trunk/src/debug2.cls.php

    r3352087 r3359287  
    516516        $msg = '';
    517517
    518         $trace = version_compare(PHP_VERSION, '5.4.0', '<') ? debug_backtrace() : debug_backtrace(false, $backtrace_limit + 3);
     518        $trace = debug_backtrace(false, $backtrace_limit + 3);
    519519        for ($i = 2; $i <= $backtrace_limit + 2; $i++) {
    520520            // 0st => _backtrace_info(), 1st => push()
  • litespeed-cache/trunk/src/htaccess.cls.php

    r3352087 r3359287  
    5151    const MARKER_END                 = ' end ###';
    5252
    53     const RW_PATTERN_RES = '/.*/[^/]*(responsive|css|js|dynamic|loader|fonts)\.php';
    54 
    5553    /**
    5654     * Initialize the class and set its properties.
     
    6361        $this->_default_backend_htaccess  = $this->backend_htaccess;
    6462
    65         $frontend_htaccess = defined('LITESPEED_CFG_HTACCESS') ? LITESPEED_CFG_HTACCESS : false;
     63        $frontend_htaccess = defined('LITESPEED_CFG_HTACCESS') ? constant('LITESPEED_CFG_HTACCESS') : false;
    6664        if ($frontend_htaccess && substr($frontend_htaccess, -10) === '/.htaccess') {
    6765            $this->frontend_htaccess = $frontend_htaccess;
    6866        }
    69         $backend_htaccess = defined('LITESPEED_CFG_HTACCESS_BACKEND') ? LITESPEED_CFG_HTACCESS_BACKEND : false;
     67        $backend_htaccess = defined('LITESPEED_CFG_HTACCESS_BACKEND') ? constant('LITESPEED_CFG_HTACCESS_BACKEND') : false;
    7068        if ($backend_htaccess && substr($backend_htaccess, -10) === '/.htaccess') {
    7169            $this->backend_htaccess = $backend_htaccess;
  • litespeed-cache/trunk/src/img-optm.cls.php

    r3352087 r3359287  
    5959    private $tmp_type;
    6060    private $tmp_path;
    61     private $_img_in_queue     = array();
    62     private $_existed_src_list = array();
    63     private $_pids_set         = array();
     61    private $_img_in_queue     = [];
     62    private $_existed_src_list = [];
     63    private $_pids_set         = [];
    6464    private $_thumbnail_set    = '';
    6565    private $_table_img_optm;
    6666    private $_table_img_optming;
    6767    private $_cron_ran = false;
     68    private $_sizes_skipped     = [];
    6869
    6970    private $__media;
     
    9697            }
    9798        }
     99
     100        // Allow users to ignore custom sizes.
     101        $this->_sizes_skipped = apply_filters( 'litespeed_imgoptm_sizes_skipped', $this->conf( Base::O_IMG_OPTM_SIZES_SKIPPED ) );
    98102    }
    99103
     
    140144        $this->_append_img_queue($meta_value, true);
    141145        if (!empty($meta_value['sizes'])) {
    142             array_map(array( $this, '_append_img_queue' ), $meta_value['sizes']);
     146            foreach( $meta_value['sizes'] as $img_size_name => $img_size ){
     147                $this->_append_img_queue($img_size, false, $img_size_name );
     148            }
    143149        }
    144150
     
    269275
    270276        // May need to get more images
    271         $list = array();
     277        $list = [];
    272278        $more = $allowance - $total_new;
    273279        if ($more > 0) {
     
    306312                $this->_append_img_queue($meta_value, true);
    307313                if (!empty($meta_value['sizes'])) {
    308                     array_map(array( $this, '_append_img_queue' ), $meta_value['sizes']);
     314                    foreach( $meta_value['sizes'] as $img_size_name => $img_size ){
     315                        $this->_append_img_queue($img_size, false, $img_size_name );
     316                    }
    309317                }
    310318            }
     
    356364     *
    357365     * @since 1.6
     366     * @since 7.5 Allow to choose which image sizes should be optimized + added parameter $img_size_name.
    358367     * @access private
    359368     */
    360     private function _append_img_queue( $meta_value, $is_ori_file = false ) {
     369    private function _append_img_queue( $meta_value, $is_ori_file = false, $img_size_name = false ) {
    361370        if (empty($meta_value['file']) || empty($meta_value['width']) || empty($meta_value['height'])) {
    362371            self::debug2('bypass image due to lack of file/w/h: pid ' . $this->tmp_pid, $meta_value);
     
    366375        $short_file_path = $meta_value['file'];
    367376
     377        // Test if need to skip image size.
    368378        if (!$is_ori_file) {
    369379            $short_file_path = $this->tmp_path . $short_file_path;
     380            $skip = false !== array_search( $img_size_name, $this->_sizes_skipped, true );
     381            if($skip){
     382                self::debug2( 'bypass image ' . $short_file_path . ' due to skipped size: ' . $img_size_name );
     383                return;
     384            }
    370385        }
    371386
     
    427442            return;
    428443        }
    429         $data     = array();
    430         $pid_list = array();
     444        $data     = [];
     445        $pid_list = [];
    431446        foreach ($this->_img_in_queue as $k => $v) {
    432447            $_img_info = $this->__media->info($v['src'], $v['pid']);
     
    457472        self::debug('Added raw images [total] ' . $count);
    458473
    459         $this->_img_in_queue = array();
     474        $this->_img_in_queue = [];
    460475
    461476        // Save thumbnail groups for future rescan index
     
    468483
    469484        $existed_meta = $wpdb->get_results("SELECT * FROM `$wpdb->postmeta` WHERE post_id IN ('" . implode("','", $pid_list) . "') AND meta_key='" . self::DB_SET . "'");
    470         $existed_pid  = array();
     485        $existed_pid  = [];
    471486        if ($existed_meta) {
    472487            foreach ($existed_meta as $v) {
     
    503518            return;
    504519        }
    505         $set = array();
     520        $set = [];
    506521        foreach (Media::cls()->get_image_sizes() as $size) {
    507522            $curr_size = $size['width'] . 'x' . $size['height'];
     
    523538        global $wpdb;
    524539
    525         $srcpath_list = array();
     540        $srcpath_list = [];
    526541
    527542        $list = $wpdb->get_results("SELECT src FROM `$this->_table_img_optming`");
     
    556571        }
    557572
    558         $finished_ids = array();
     573        $finished_ids = [];
    559574
    560575        Utility::compatibility();
     
    584599     */
    585600    private function _filter_invalid_src() {
    586         $img_in_queue_invalid = array();
     601        $img_in_queue_invalid = [];
    587602        foreach ($this->_img_in_queue as $k => $v) {
    588603            if ($v['src']) {
     
    625640        self::debug('Load img in queue [total] ' . count($_img_in_queue));
    626641
    627         $list = array();
     642        $list = [];
    628643        foreach ($_img_in_queue as $v) {
    629644            $_img_info = $this->__media->info($v->src, $v->post_id);
     
    754769                ' )';
    755770            $list                            = $wpdb->get_results($wpdb->prepare($q, array_merge(array( self::DB_SIZE ), array_keys($notified_data))));
    756             $ls_optm_size_row_exists_postids = array();
     771            $ls_optm_size_row_exists_postids = [];
    757772            foreach ($list as $v) {
    758773                $json = $notified_data[$v->id];
     
    903918        }
    904919
    905         if (defined('LITESPEED_IMG_OPTM_PULL_CRON') && !LITESPEED_IMG_OPTM_PULL_CRON) {
     920        if (defined('LITESPEED_IMG_OPTM_PULL_CRON') && !constant('LITESPEED_IMG_OPTM_PULL_CRON')) {
    906921            self::debug('Cron disabled [define] LITESPEED_IMG_OPTM_PULL_CRON');
    907922            return;
     
    921936
    922937        if (defined('LITESPEED_IMG_OPTM_PULL_THREADS')) {
    923             return LITESPEED_IMG_OPTM_PULL_THREADS;
     938            return constant('LITESPEED_IMG_OPTM_PULL_THREADS');
    924939        }
    925940
     
    978993        $total_pulled_avif = 0;
    979994
    980         $server_list = array();
     995        $server_list = [];
    981996
    982997        try {
     
    10021017
    10031018                // Run requests in parallel
    1004                 $requests    = array(); // store each request URL for Requests::request_multiple()
    1005                 $imgs_by_req = array(); // store original request data so that we can reference it in the response
     1019                $requests    = []; // store each request URL for Requests::request_multiple()
     1020                $imgs_by_req = []; // store original request data so that we can reference it in the response
    10061021                $req_counter = 0;
    10071022                foreach ($img_rows as $row_img) {
     
    11821197                    // Save server_list to notify taken
    11831198                    if (empty($server_list[$server_info['server']])) {
    1184                         $server_list[$server_info['server']] = array();
     1199                        $server_list[$server_info['server']] = [];
    11851200                    }
    11861201
     
    11911206                };
    11921207
    1193                 $force_wp_remote_get = defined('LITESPEED_FORCE_WP_REMOTE_GET') && LITESPEED_FORCE_WP_REMOTE_GET;
    1194                 if (!$force_wp_remote_get && class_exists('\WpOrg\Requests\Requests') && class_exists('\WpOrg\Requests\Autoload') && version_compare(PHP_VERSION, '5.6.0', '>=')) {
     1208                $force_wp_remote_get = defined('LITESPEED_FORCE_WP_REMOTE_GET') && constant('LITESPEED_FORCE_WP_REMOTE_GET');
     1209                if (!$force_wp_remote_get && class_exists('\WpOrg\Requests\Requests') && class_exists('\WpOrg\Requests\Autoload')) {
    11951210                    // Make sure Requests can load internal classes.
    11961211                    Autoload::register();
     
    15211536
    15221537        // Prepare post_ids to inquery gathered images
    1523         $pid_set      = array();
    1524         $scanned_list = array();
     1538        $pid_set      = [];
     1539        $scanned_list = [];
    15251540        foreach ($list as $v) {
    15261541            $meta_value = $this->_parse_wp_meta_value($v);
     
    15521567            $this->_append_img_queue($meta_value, true);
    15531568            if (!empty($meta_value['sizes'])) {
    1554                 array_map(array( $this, '_append_img_queue' ), $meta_value['sizes']);
     1569                foreach( $meta_value['sizes'] as $img_size_name => $img_size ){
     1570                    $this->_append_img_queue($img_size, false, $img_size_name );
     1571                }
    15551572            }
    15561573        }
     
    20972114        self::debug('Check image [ID] ' . $pid);
    20982115
    2099         $data = array();
     2116        $data = [];
    21002117
    21012118        $data['img_count']    = $this->img_count();
     
    21082125        $q        = "SELECT * FROM `$this->_table_img_optm` WHERE post_id = %d";
    21092126        $list     = $wpdb->get_results($wpdb->prepare($q, $pid));
    2110         $img_data = array();
     2127        $img_data = [];
    21112128        if ($list) {
    21122129            foreach ($list as $v) {
  • litespeed-cache/trunk/src/lang.cls.php

    r3352087 r3359287  
    209209            self::O_IMG_OPTM_WEBP => __('Next-Gen Image Format', 'litespeed-cache'),
    210210            self::O_IMG_OPTM_LOSSLESS => __('Optimize Losslessly', 'litespeed-cache'),
     211            self::O_IMG_OPTM_SIZES_SKIPPED => __('Optimize Image Sizes', 'litespeed-cache'),
    211212            self::O_IMG_OPTM_EXIF => __('Preserve EXIF/XMP data', 'litespeed-cache'),
    212213            self::O_IMG_OPTM_WEBP_ATTR => __('WebP/AVIF Attribute To Replace', 'litespeed-cache'),
     
    265266            self::O_DB_OPTM_REVISIONS_MAX => __('Revisions Max Number', 'litespeed-cache'),
    266267            self::O_DB_OPTM_REVISIONS_AGE => __('Revisions Max Age', 'litespeed-cache'),
     268
     269            self::O_OPTIMAX => __('OptimaX', 'litespeed-cache'),
    267270        );
    268271
  • litespeed-cache/trunk/src/task.cls.php

    r3352087 r3359287  
    225225     */
    226226    public function lscache_cron_filter_crawler( $schedules ) {
    227         $CRAWLER_RUN_INTERVAL = defined('LITESPEED_CRAWLER_RUN_INTERVAL') ? LITESPEED_CRAWLER_RUN_INTERVAL : 600;
     227        $CRAWLER_RUN_INTERVAL = defined('LITESPEED_CRAWLER_RUN_INTERVAL') ? constant('LITESPEED_CRAWLER_RUN_INTERVAL') : 600;
    228228        // $wp_schedules = wp_get_schedules();
    229229        if (!array_key_exists(self::FILTER_CRAWLER, $schedules)) {
  • litespeed-cache/trunk/src/utility.cls.php

    r3352087 r3359287  
    694694        if (!defined('LITESPEED_FRONTEND_HOST')) {
    695695            if (defined('WP_HOME')) {
    696                 $home_host = WP_HOME; // Also think of `WP_SITEURL`
     696                $home_host = constant('WP_HOME'); // Also think of `WP_SITEURL`
    697697            } else {
    698698                $home_host = get_option('home');
     
    774774        if (substr($url_parsed['path'], 0, 1) === '/') {
    775775            if (defined('LITESPEED_WP_REALPATH')) {
    776                 $file_path_ori = $_SERVER['DOCUMENT_ROOT'] . LITESPEED_WP_REALPATH . $url_parsed['path'];
     776                $file_path_ori = $_SERVER['DOCUMENT_ROOT'] . constant('LITESPEED_WP_REALPATH') . $url_parsed['path'];
    777777            } else {
    778778                $file_path_ori = $_SERVER['DOCUMENT_ROOT'] . $url_parsed['path'];
     
    922922        return $q;
    923923    }
     924
     925    /**
     926     * Prepare image sizes for optimization.
     927     *
     928     * @since 7.5
     929     * @access public
     930     */
     931    public static function prepare_image_sizes_array( $detailed = false ) {
     932        $image_sizes  = wp_get_registered_image_subsizes();
     933        $sizes = [];
     934
     935        foreach ( $image_sizes as $current_size_name => $current_size ) {
     936            if( empty( $current_size['width'] ) && empty( $current_size['height'] ) ) continue;
     937           
     938            if( !$detailed ) {
     939                $sizes[] = $current_size_name;
     940            }
     941            else{
     942                $label =  $current_size['width']  . 'x' . $current_size['height'];
     943                if( $current_size_name !== $label ){
     944                    $label = ucfirst( $current_size_name ) . ' ( ' . $label  . ' )';
     945                }
     946
     947                $sizes[] = [
     948                    "label"     => $label,
     949                    "file_size" => $current_size_name,
     950                    "width"     => $current_size['width'],
     951                    "height"    => $current_size['height'],
     952                ];
     953            }
     954        }
     955
     956        return $sizes;
     957    }
    924958}
  • litespeed-cache/trunk/tpl/img_optm/settings.tpl.php

    r3333851 r3359287  
    8686        <tr>
    8787            <th>
     88                <?php
     89                    $option_id    = Base::O_IMG_OPTM_SIZES_SKIPPED;
     90                    $image_sizes  = Utility::prepare_image_sizes_array(true);
     91                    $option_value = $this->conf( $option_id );
     92                ?>
     93                <?php $this->title( $option_id ); ?>
     94            </th>
     95            <td>
     96                <?php if ( count($image_sizes) > 0 ) : ?>
     97                    <?php
     98                        foreach ( $image_sizes as $current_size ) {
     99                            $checked = false === array_search( $current_size['file_size'], $option_value, true );
     100                            $this->build_checkbox( $option_id . '[]', esc_html( $current_size['label'] ), $checked, $current_size['file_size'] );
     101                        }
     102                    ?>
     103                <?php else : ?>
     104                    <p><?php esc_html_e( 'No sizes found.', 'litespeed-cache' ); ?></p>
     105                <?php endif; ?>
     106                <div class="litespeed-desc">
     107                    <?php esc_html_e( 'Choose which image sizes to optimize.', 'litespeed-cache' ); ?>
     108                </div>
     109            </td>
     110        </tr>
     111
     112        <tr>
     113            <th>
    88114                <?php $option_id = Base::O_IMG_OPTM_EXIF; ?>
    89115                <?php $this->title( $option_id ); ?>
  • litespeed-cache/trunk/tpl/toolbox/beta_test.tpl.php

    r3352087 r3359287  
    1515// List of available public versions
    1616$v_list = array(
     17    '7.5',
    1718    '7.4',
    1819    '7.3.0.1',
Note: See TracChangeset for help on using the changeset viewer.