LiteSpeed Cache - Version 1.9.1.1

Version Description

  • February 20 2018 =
  • [Hotfix] Removed empty crawler when no role simulation is set.
Download this release

Release Info

Developer LiteSpeedTech
Plugin Icon 128x128 LiteSpeed Cache
Version 1.9.1.1
Comparing to
See all releases

Code changes from version 1.8.3 to 1.9.1.1

Files changed (281) hide show
  1. admin/litespeed-cache-admin-report.class.php +1 -0
  2. admin/litespeed-cache-admin-settings.class.php +22 -0
  3. admin/tpl/crawler.php +121 -84
  4. admin/tpl/debug_log.php +6 -5
  5. admin/tpl/edit_htaccess.php +6 -5
  6. admin/tpl/image_optimization.php +6 -5
  7. admin/tpl/import_export.php +6 -5
  8. admin/tpl/manage.php +7 -5
  9. admin/tpl/manage/manage_cdn.php +0 -0
  10. admin/tpl/network_settings.php +7 -5
  11. admin/tpl/report.php +7 -5
  12. admin/tpl/setting/network_settings_advanced.php +2 -0
  13. admin/tpl/setting/network_settings_cache.php +0 -2
  14. admin/tpl/setting/settings_advanced.php +4 -0
  15. admin/tpl/setting/settings_cache.php +0 -7
  16. admin/tpl/setting/settings_cdn.php +43 -0
  17. admin/tpl/setting/settings_crawler.php +94 -82
  18. admin/tpl/setting/settings_esi.php +12 -3
  19. admin/tpl/setting/settings_inc.cache_mobile.php +1 -1
  20. admin/tpl/setting/settings_inc.cache_object.php +0 -0
  21. admin/tpl/setting/settings_inc.check_adv_file.php +0 -0
  22. admin/tpl/setting/settings_inc.login_cookie.php +1 -1
  23. admin/tpl/setting/settings_optimize.php +20 -0
  24. admin/tpl/settings.php +10 -9
  25. cli/litespeed-cache-cli-admin.class.php +3 -0
  26. css/litespeed.css +17 -0
  27. img/icons/purge-object.svg +0 -0
  28. img/icons/purge-opcache.svg +0 -0
  29. inc/config.class.php +14 -0
  30. inc/crawler.class.php +120 -30
  31. inc/gui.class.php +10 -2
  32. inc/import.class.php +1 -0
  33. inc/litespeed-cache.class.php +10 -5
  34. inc/litespeed.autoload.php +3 -0
  35. inc/object.class.php +0 -0
  36. inc/object.lib.php +0 -0
  37. inc/optimize.class.php +7 -149
  38. inc/optimizer.class.php +279 -0
  39. inc/router.class.php +37 -0
  40. inc/vary.class.php +14 -3
  41. includes/litespeed-cache-config.class.php +14 -0
  42. includes/litespeed-cache-crawler.class.php +120 -30
  43. includes/litespeed-cache-gui.class.php +10 -2
  44. includes/litespeed-cache-optimize.class.php +7 -149
  45. includes/litespeed-cache-router.class.php +37 -0
  46. includes/litespeed-cache-vary.class.php +14 -3
  47. includes/litespeed-cache.class.php +10 -5
  48. includes/litespeed.autoload.php +3 -0
  49. js/css_async.min.js +0 -0
  50. js/instant_click.min.js +0 -0
  51. js/instant_click.ori.js +0 -0
  52. js/litespeed-cache-admin.js +4 -9
  53. languages/litespeed-cache.pot +343 -283
  54. lib/{vendor/tubalmartin/cssmin/src/Minifier.php → css_min.class.php} +21 -21
  55. lib/{vendor/tubalmartin/cssmin/src/Colors.php → css_min.colors.class.php} +0 -0
  56. lib/{vendor/tubalmartin/cssmin/src/Utils.php → css_min.utils.class.php} +0 -0
  57. lib/{vendor/mrclay/minify/lib/Minify/HTML.php → html_min.class.php} +0 -0
  58. lib/{vendor/mrclay/jsmin-php/src/JSMin/JSMin.php → js_min.class.php} +4 -4
  59. lib/litespeed/litespeed-crawler.class.php +124 -41
  60. lib/object-cache.php +0 -0
  61. lib/{vendor/mrclay/minify/lib/Minify/CSS/UriRewriter.php → url_rewritter.class.php} +1 -1
  62. lib/vendor/autoload.php +0 -7
  63. lib/vendor/composer/ClassLoader.php +0 -445
  64. lib/vendor/composer/LICENSE +0 -21
  65. lib/vendor/composer/autoload_classmap.php +0 -59
  66. lib/vendor/composer/autoload_namespaces.php +0 -12
  67. lib/vendor/composer/autoload_psr4.php +0 -15
  68. lib/vendor/composer/autoload_real.php +0 -52
  69. lib/vendor/composer/autoload_static.php +0 -142
  70. lib/vendor/container-interop/container-interop/LICENSE +0 -20
  71. lib/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php +0 -15
  72. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php +0 -15
  73. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php +0 -15
  74. lib/vendor/intervention/httpauth/.travis.yml +0 -11
  75. lib/vendor/intervention/httpauth/LICENSE +0 -9
  76. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/BasicUser.php +0 -63
  77. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/DigestUser.php +0 -134
  78. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/Facades/Httpauth.php +0 -13
  79. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/Httpauth.php +0 -159
  80. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProvider.php +0 -82
  81. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php +0 -30
  82. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php +0 -37
  83. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/UserInterface.php +0 -22
  84. lib/vendor/intervention/httpauth/src/config/config.php +0 -49
  85. lib/vendor/monolog/monolog/.php_cs +0 -59
  86. lib/vendor/monolog/monolog/LICENSE +0 -19
  87. lib/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +0 -230
  88. lib/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +0 -78
  89. lib/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +0 -89
  90. lib/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +0 -116
  91. lib/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +0 -85
  92. lib/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php +0 -36
  93. lib/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +0 -138
  94. lib/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +0 -141
  95. lib/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +0 -208
  96. lib/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +0 -179
  97. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +0 -47
  98. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +0 -166
  99. lib/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +0 -105
  100. lib/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +0 -297
  101. lib/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php +0 -48
  102. lib/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +0 -113
  103. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +0 -186
  104. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +0 -66
  105. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +0 -101
  106. lib/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +0 -148
  107. lib/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +0 -230
  108. lib/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +0 -117
  109. lib/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +0 -211
  110. lib/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +0 -72
  111. lib/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +0 -151
  112. lib/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +0 -57
  113. lib/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +0 -169
  114. lib/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +0 -45
  115. lib/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +0 -107
  116. lib/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +0 -128
  117. lib/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +0 -82
  118. lib/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +0 -140
  119. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +0 -28
  120. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +0 -59
  121. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +0 -34
  122. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +0 -163
  123. lib/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +0 -195
  124. lib/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +0 -126
  125. lib/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +0 -127
  126. lib/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +0 -73
  127. lib/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +0 -104
  128. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +0 -90
  129. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +0 -108
  130. lib/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +0 -350
  131. lib/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +0 -69
  132. lib/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +0 -55
  133. lib/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +0 -102
  134. lib/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +0 -67
  135. lib/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +0 -68
  136. lib/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php +0 -21
  137. lib/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +0 -59
  138. lib/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +0 -185
  139. lib/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +0 -202
  140. lib/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +0 -45
  141. lib/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +0 -242
  142. lib/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +0 -56
  143. lib/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +0 -185
  144. lib/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +0 -232
  145. lib/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +0 -97
  146. lib/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +0 -132
  147. lib/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +0 -178
  148. lib/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +0 -82
  149. lib/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +0 -294
  150. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +0 -215
  151. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +0 -115
  152. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php +0 -80
  153. lib/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +0 -346
  154. lib/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +0 -176
  155. lib/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +0 -99
  156. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +0 -67
  157. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +0 -56
  158. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +0 -103
  159. lib/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +0 -154
  160. lib/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +0 -61
  161. lib/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +0 -95
  162. lib/vendor/monolog/monolog/src/Monolog/Logger.php +0 -700
  163. lib/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +0 -64
  164. lib/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +0 -112
  165. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +0 -35
  166. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +0 -63
  167. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +0 -35
  168. lib/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +0 -63
  169. lib/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +0 -31
  170. lib/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +0 -48
  171. lib/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +0 -44
  172. lib/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +0 -46
  173. lib/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +0 -113
  174. lib/vendor/monolog/monolog/src/Monolog/Registry.php +0 -134
  175. lib/vendor/mrclay/jsmin-php/.editorconfig +0 -19
  176. lib/vendor/mrclay/jsmin-php/HISTORY.txt +0 -24
  177. lib/vendor/mrclay/jsmin-php/LICENSE.txt +0 -26
  178. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedCommentException.php +0 -6
  179. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedRegExpException.php +0 -6
  180. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedStringException.php +0 -6
  181. lib/vendor/mrclay/minify/.htaccess +0 -13
  182. lib/vendor/mrclay/minify/.php_cs +0 -27
  183. lib/vendor/mrclay/minify/.travis.yml +0 -37
  184. lib/vendor/mrclay/minify/LICENSE.txt +0 -26
  185. lib/vendor/mrclay/minify/bootstrap.php +0 -25
  186. lib/vendor/mrclay/minify/config-test.php +0 -10
  187. lib/vendor/mrclay/minify/config.php +0 -201
  188. lib/vendor/mrclay/minify/groupsConfig.php +0 -19
  189. lib/vendor/mrclay/minify/lib/HTTP/ConditionalGet.php +0 -376
  190. lib/vendor/mrclay/minify/lib/HTTP/Encoder.php +0 -335
  191. lib/vendor/mrclay/minify/lib/Minify.php +0 -761
  192. lib/vendor/mrclay/minify/lib/Minify/App.php +0 -282
  193. lib/vendor/mrclay/minify/lib/Minify/Build.php +0 -102
  194. lib/vendor/mrclay/minify/lib/Minify/CSS.php +0 -98
  195. lib/vendor/mrclay/minify/lib/Minify/CSS/Compressor.php +0 -275
  196. lib/vendor/mrclay/minify/lib/Minify/CSSmin.php +0 -88
  197. lib/vendor/mrclay/minify/lib/Minify/Cache/APC.php +0 -136
  198. lib/vendor/mrclay/minify/lib/Minify/Cache/File.php +0 -183
  199. lib/vendor/mrclay/minify/lib/Minify/Cache/Memcache.php +0 -141
  200. lib/vendor/mrclay/minify/lib/Minify/Cache/Null.php +0 -67
  201. lib/vendor/mrclay/minify/lib/Minify/Cache/WinCache.php +0 -139
  202. lib/vendor/mrclay/minify/lib/Minify/Cache/XCache.php +0 -130
  203. lib/vendor/mrclay/minify/lib/Minify/Cache/ZendPlatform.php +0 -129
  204. lib/vendor/mrclay/minify/lib/Minify/CacheInterface.php +0 -58
  205. lib/vendor/mrclay/minify/lib/Minify/ClosureCompiler.php +0 -240
  206. lib/vendor/mrclay/minify/lib/Minify/CommentPreserver.php +0 -87
  207. lib/vendor/mrclay/minify/lib/Minify/Config.php +0 -78
  208. lib/vendor/mrclay/minify/lib/Minify/Controller/Base.php +0 -81
  209. lib/vendor/mrclay/minify/lib/Minify/Controller/Files.php +0 -71
  210. lib/vendor/mrclay/minify/lib/Minify/Controller/Groups.php +0 -76
  211. lib/vendor/mrclay/minify/lib/Minify/Controller/MinApp.php +0 -196
  212. lib/vendor/mrclay/minify/lib/Minify/Controller/Page.php +0 -69
  213. lib/vendor/mrclay/minify/lib/Minify/ControllerInterface.php +0 -22
  214. lib/vendor/mrclay/minify/lib/Minify/DebugDetector.php +0 -30
  215. lib/vendor/mrclay/minify/lib/Minify/Env.php +0 -127
  216. lib/vendor/mrclay/minify/lib/Minify/HTML/Helper.php +0 -250
  217. lib/vendor/mrclay/minify/lib/Minify/ImportProcessor.php +0 -217
  218. lib/vendor/mrclay/minify/lib/Minify/JS/ClosureCompiler.php +0 -234
  219. lib/vendor/mrclay/minify/lib/Minify/JS/JShrink.php +0 -48
  220. lib/vendor/mrclay/minify/lib/Minify/LessCssSource.php +0 -128
  221. lib/vendor/mrclay/minify/lib/Minify/Lines.php +0 -209
  222. lib/vendor/mrclay/minify/lib/Minify/Logger/LegacyHandler.php +0 -24
  223. lib/vendor/mrclay/minify/lib/Minify/NailgunClosureCompiler.php +0 -113
  224. lib/vendor/mrclay/minify/lib/Minify/Packer.php +0 -31
  225. lib/vendor/mrclay/minify/lib/Minify/ScssCssSource.php +0 -176
  226. lib/vendor/mrclay/minify/lib/Minify/ServeConfiguration.php +0 -71
  227. lib/vendor/mrclay/minify/lib/Minify/Source.php +0 -214
  228. lib/vendor/mrclay/minify/lib/Minify/Source/Factory.php +0 -197
  229. lib/vendor/mrclay/minify/lib/Minify/Source/FactoryException.php +0 -5
  230. lib/vendor/mrclay/minify/lib/Minify/SourceInterface.php +0 -82
  231. lib/vendor/mrclay/minify/lib/Minify/SourceSet.php +0 -31
  232. lib/vendor/mrclay/minify/lib/Minify/YUICompressor.php +0 -157
  233. lib/vendor/mrclay/minify/lib/MrClay/Cli.php +0 -393
  234. lib/vendor/mrclay/minify/lib/MrClay/Cli/Arg.php +0 -189
  235. lib/vendor/mrclay/minify/static/.htaccess +0 -40
  236. lib/vendor/mrclay/minify/static/gen.php +0 -127
  237. lib/vendor/mrclay/minify/static/lib.php +0 -68
  238. lib/vendor/mrclay/minify/utils.php +0 -78
  239. lib/vendor/mrclay/props-dic/.travis.yml +0 -30
  240. lib/vendor/mrclay/props-dic/LICENSE +0 -19
  241. lib/vendor/mrclay/props-dic/src/Props/BadMethodCallException.php +0 -9
  242. lib/vendor/mrclay/props-dic/src/Props/Container.php +0 -249
  243. lib/vendor/mrclay/props-dic/src/Props/FactoryUncallableException.php +0 -9
  244. lib/vendor/mrclay/props-dic/src/Props/NotFoundException.php +0 -9
  245. lib/vendor/mrclay/props-dic/src/Props/Pimple.php +0 -56
  246. lib/vendor/mrclay/props-dic/src/Props/ValueUnresolvableException.php +0 -9
  247. lib/vendor/pimple/pimple/.travis.yml +0 -40
  248. lib/vendor/pimple/pimple/LICENSE +0 -19
  249. lib/vendor/pimple/pimple/src/Pimple/Container.php +0 -298
  250. lib/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php +0 -38
  251. lib/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +0 -45
  252. lib/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php +0 -45
  253. lib/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php +0 -45
  254. lib/vendor/pimple/pimple/src/Pimple/Psr11/Container.php +0 -55
  255. lib/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +0 -75
  256. lib/vendor/pimple/pimple/src/Pimple/ServiceIterator.php +0 -69
  257. lib/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php +0 -46
  258. lib/vendor/psr/container/LICENSE +0 -21
  259. lib/vendor/psr/container/src/ContainerExceptionInterface.php +0 -13
  260. lib/vendor/psr/container/src/ContainerInterface.php +0 -37
  261. lib/vendor/psr/container/src/NotFoundExceptionInterface.php +0 -13
  262. lib/vendor/psr/log/LICENSE +0 -19
  263. lib/vendor/psr/log/Psr/Log/AbstractLogger.php +0 -128
  264. lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php +0 -7
  265. lib/vendor/psr/log/Psr/Log/LogLevel.php +0 -18
  266. lib/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +0 -18
  267. lib/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +0 -26
  268. lib/vendor/psr/log/Psr/Log/LoggerInterface.php +0 -123
  269. lib/vendor/psr/log/Psr/Log/LoggerTrait.php +0 -140
  270. lib/vendor/psr/log/Psr/Log/NullLogger.php +0 -28
  271. lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +0 -140
  272. lib/vendor/tubalmartin/cssmin/cssmin +0 -37
  273. lib/vendor/tubalmartin/cssmin/gui/scripts.js +0 -104
  274. lib/vendor/tubalmartin/cssmin/gui/styles.css +0 -68
  275. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/css/bootstrap.min.css +0 -339
  276. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/js/bootstrap.min.js +0 -7
  277. lib/vendor/tubalmartin/cssmin/gui/third-party/jquery-1.12.4.min.js +0 -5
  278. lib/vendor/tubalmartin/cssmin/gui/third-party/less-1.7.5.min.js +0 -16
  279. lib/vendor/tubalmartin/cssmin/src/Command.php +0 -223
  280. litespeed-cache.php +1 -1
  281. readme.txt +29 -4
admin/litespeed-cache-admin-report.class.php CHANGED
@@ -159,6 +159,7 @@ class LiteSpeed_Cache_Admin_Report
159
160
// Security: Remove cf key in report
161
$secure_fields = array(
162
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY,
163
LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_PSWD,
164
) ;
159
160
// Security: Remove cf key in report
161
$secure_fields = array(
162
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY,
163
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE_KEY,
164
LiteSpeed_Cache_Config::OPID_CACHE_OBJECT_PSWD,
165
) ;
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -534,6 +534,7 @@ class LiteSpeed_Cache_Admin_Settings
534
$cdn_cloudflare_changed = false ;
535
$ids = array(
536
LiteSpeed_Cache_Config::OPID_CDN,
537
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
538
) ;
539
foreach ( $ids as $id ) {
@@ -600,6 +601,22 @@ class LiteSpeed_Cache_Admin_Settings
600
$id = LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ;
601
$this->_options[ $id ] = self::is_checked_radio( $this->_input[ $id ] ) ;
602
603
/**
604
* CLoudflare API
605
* @since 1.7.2
@@ -672,10 +689,12 @@ class LiteSpeed_Cache_Admin_Settings
672
{
673
$ids = array(
674
LiteSpeed_Cache_Config::OPID_CSS_MINIFY,
675
LiteSpeed_Cache_Config::OPID_CSS_COMBINE,
676
LiteSpeed_Cache_Config::OPID_CSS_COMBINED_PRIORITY,
677
LiteSpeed_Cache_Config::OPID_CSS_HTTP2,
678
LiteSpeed_Cache_Config::OPID_JS_MINIFY,
679
LiteSpeed_Cache_Config::OPID_JS_COMBINE,
680
LiteSpeed_Cache_Config::OPID_JS_COMBINED_PRIORITY,
681
LiteSpeed_Cache_Config::OPID_JS_HTTP2,
@@ -924,6 +943,9 @@ class LiteSpeed_Cache_Admin_Settings
924
$this->_options[ $id ] = $this->_input[ $id ] ;
925
}
926
927
}
928
929
/**
534
$cdn_cloudflare_changed = false ;
535
$ids = array(
536
LiteSpeed_Cache_Config::OPID_CDN,
537
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC,
538
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
539
) ;
540
foreach ( $ids as $id ) {
601
$id = LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ;
602
$this->_options[ $id ] = self::is_checked_radio( $this->_input[ $id ] ) ;
603
604
+ /**
605
+ * Quic API
606
+ * @since 1.9.1
607
+ */
608
+ $ids = array(
609
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC_EMAIL,
610
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY,
611
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC_SITE,
612
+ ) ;
613
+ foreach ( $ids as $id ) {
614
+ if ( $this->_options[ $id ] === $this->_input[ $id ] ) {
615
+ continue ;
616
+ }
617
+ $this->_options[ $id ] = $this->_input[ $id ] ;
618
+ }
619
+
620
/**
621
* CLoudflare API
622
* @since 1.7.2
689
{
690
$ids = array(
691
LiteSpeed_Cache_Config::OPID_CSS_MINIFY,
692
+ LiteSpeed_Cache_Config::OPID_CSS_INLINE_MINIFY,
693
LiteSpeed_Cache_Config::OPID_CSS_COMBINE,
694
LiteSpeed_Cache_Config::OPID_CSS_COMBINED_PRIORITY,
695
LiteSpeed_Cache_Config::OPID_CSS_HTTP2,
696
LiteSpeed_Cache_Config::OPID_JS_MINIFY,
697
+ LiteSpeed_Cache_Config::OPID_JS_INLINE_MINIFY,
698
LiteSpeed_Cache_Config::OPID_JS_COMBINE,
699
LiteSpeed_Cache_Config::OPID_JS_COMBINED_PRIORITY,
700
LiteSpeed_Cache_Config::OPID_JS_HTTP2,
943
$this->_options[ $id ] = $this->_input[ $id ] ;
944
}
945
946
+ $id = LiteSpeed_Cache_Config::ITEM_CRWL_AS_UIDS ;
947
+ update_option( $id, ! empty( $this->_input[ $id ] ) ? LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) : '' ) ;
948
+
949
}
950
951
/**
admin/tpl/crawler.php CHANGED
@@ -3,7 +3,18 @@ if (!defined('WPINC')) die ;
3
4
$_options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
5
6
- $sitemap_time = LiteSpeed_Cache_Crawler::get_instance()->sitemap_time() ;
7
8
$disabled = LiteSpeed_Cache_Router::can_crawl() ? '' : 'disabled' ;
9
@@ -11,12 +22,14 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
11
?>
12
13
<div class="wrap">
14
- <h2>
15
<?php echo __('LiteSpeed Cache Crawler', 'litespeed-cache') ; ?>
16
- <span class="litespeed-desc">
17
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
18
- </span>
19
- </h2>
20
</div>
21
22
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
@@ -61,7 +74,21 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
61
}
62
}
63
?>
64
- <h3 class="litespeed-title"><?php echo __('Crawler Cron', 'litespeed-cache') ; ?></h3>
65
<?php if ( ! LiteSpeed_Cache_Router::can_crawl() ): ?>
66
<div class="litespeed-callout-danger">
67
<h4><?php echo __('WARNING', 'litespeed-cache'); ?></h4>
@@ -69,99 +96,109 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
69
<p><?php echo sprintf(__('See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation.', 'litespeed-cache'), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler" target="_blank"') ; ?></p>
70
</div>
71
<?php endif; ?>
72
<table class="litespeed-table">
73
<thead><tr >
74
<th scope="col"><?php echo __('Cron Name', 'litespeed-cache') ; ?></th>
75
<th scope="col"><?php echo __('Run Frequency', 'litespeed-cache') ; ?></th>
76
- <th scope="col"><?php echo __('Last Status', 'litespeed-cache') ; ?></th>
77
- <th scope="col"><?php echo __('Activation', 'litespeed-cache') ; ?></th>
78
- <th scope="col"><?php echo __('Actions', 'litespeed-cache') ; ?></th>
79
</tr></thead>
80
<tbody>
81
<tr>
82
- <td>
83
- <?php
84
- echo __('LiteSpeed Cache Crawler', 'litespeed-cache');
85
- ?>
86
- <div class='litespeed-desc'>
87
- <?php
88
- $meta = LiteSpeed_Cache_Crawler::get_instance()->get_meta() ;
89
- $is_running = $meta && $meta->is_running && time() - $meta->is_running <= $_options[LiteSpeed_Cache_Config::CRWL_RUN_DURATION] ;
90
- if ( $meta && $meta->this_full_beginning_time ) {
91
- echo sprintf( __( 'The current sitemap crawl started at %s', 'litespeed-cache' ), LiteSpeed_Cache_Utility::readable_time( $meta->this_full_beginning_time ) ) ;
92
- if ( ! $is_running ) {
93
- echo "</div><div class='litespeed-desc'>";
94
- echo sprintf(__('The next complete sitemap crawl will start at %s', 'litespeed-cache'),
95
- date('m/d/Y H:i:s',$meta->this_full_beginning_time + LITESPEED_TIME_OFFSET
96
- + $meta->last_full_time_cost + $_options[LiteSpeed_Cache_Config::CRWL_CRAWL_INTERVAL]));
97
- }
98
-
99
- }
100
- ?>
101
- </div>
102
- </td>
103
- <td>
104
- <?php echo $recurrence ; ?>
105
- <div class='litespeed-desc'>
106
- <?php
107
- if ( $meta && $meta->last_full_time_cost ) {
108
- echo sprintf(__('The last complete run cost %s seconds', 'litespeed-cache'), $meta->last_full_time_cost) ;
109
- }
110
- ?>
111
- </div>
112
- </td>
113
<td>
114
<?php
115
- if ( $meta ) {
116
- echo "Size: {$meta->list_size}<br />Position: " . ($meta->last_pos + 1) ;
117
- if ( $is_running ) {
118
- echo "<br /><div class='litespeed-label-success'>" . __('Is running', 'litespeed-cache') . "</div>" ;
119
- }
120
- }
121
- else {
122
- echo "-" ;
123
}
124
?>
125
</td>
126
<td>
127
- <div class="litespeed-switch-drag">
128
- <input type="checkbox" name="litespeed_crawler_cron_enable" id="litespeed_crawler_cron_enable" value="1"
129
- data-url="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE, false, true ) ; ?>"
130
- <?php if( $_options[LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE] && LiteSpeed_Cache_Router::can_crawl() ) echo "checked"; ?>
131
- <?php echo $disabled ; ?>
132
- />
133
- <label class="litespeed-switch-drag-label" for="litespeed_crawler_cron_enable">
134
- <span class="litespeed-switch-drag-inner" data-on="<?php echo __('Enable', 'litespeed-cache'); ?>" data-off="<?php echo __('Disable', 'litespeed-cache'); ?>"></span>
135
- <span class="litespeed-switch-drag-switch"></span>
136
- </label>
137
- </div>
138
</td>
139
<td>
140
<?php
141
- echo " <a href='" . LiteSpeed_Cache_Utility::build_url(LiteSpeed_Cache::ACTION_CRAWLER_RESET_POS) . "' class='litespeed-btn-warning litespeed-btn-xs'>" . __('Reset position', 'litespeed-cache') . "</a>" ;
142
-
143
- $href = LiteSpeed_Cache_Router::can_crawl() ? LiteSpeed_Cache_Utility::build_url(LiteSpeed_Cache::ACTION_DO_CRAWL) : 'javascript:;' ;
144
- echo " <a href='$href' id='litespeed_manual_trigger' target='litespeedHiddenIframe' class='litespeed-btn-success litespeed-btn-xs' $disabled>" . __('Manually run', 'litespeed-cache') . "</a>" ;
145
?>
146
- <?php if ( $meta && $meta->last_start_time ): ?>
147
- <div class='litespeed-desc'>
148
- <?php echo sprintf(__('<b>Last interval:</b> %s', 'litespeed-cache'), LiteSpeed_Cache_Utility::readable_time( $meta->last_start_time ) ) ; ?>
149
- </div>
150
- <?php endif ; ?>
151
-
152
- <?php if ( $meta && $meta->end_reason ): ?>
153
- <div class='litespeed-desc'>
154
- <?php echo sprintf(__('<b>Ended reason:</b> %s', 'litespeed-cache'), $meta->end_reason) ; ?>
155
- </div>
156
- <?php endif ; ?>
157
-
158
- <?php if ( $meta && $meta->last_crawled ): ?>
159
- <div class='litespeed-desc'>
160
- <?php echo sprintf(__('<b>Last crawled:</b> %s item(s)', 'litespeed-cache'), $meta->last_crawled) ; ?>
161
- </div>
162
- <?php endif ; ?>
163
</td>
164
</tr>
165
</tbody>
166
</table>
167
<div class="litespeed-desc">
@@ -176,7 +213,7 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
176
<h3 class="litespeed-title"><?php echo __('Watch Crawler Status', 'litespeed-cache') ; ?></h3>
177
178
<?php
179
- $ajaxUrl = LiteSpeed_Cache_Crawler::get_instance()->get_crawler_json_path() ;
180
if ( $ajaxUrl ):
181
?>
182
@@ -208,7 +245,7 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
208
<form method="post" action="admin.php?page=lscache-crawler">
209
<?php $this->form_action(LiteSpeed_Cache::ACTION_BLACKLIST_SAVE); ?>
210
<p>
211
- <textarea name="<?php echo LiteSpeed_Cache_Crawler::CRWL_BLACKLIST; ?>" rows="10" class="litespeed-textarea"><?php echo LiteSpeed_Cache_Crawler::get_instance()->get_blacklist(); ?></textarea>
212
</p>
213
214
<p>
@@ -216,7 +253,7 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
216
</p>
217
</form>
218
<div class="litespeed-desc">
219
- <p><?php echo sprintf(__('Current blacklist has %s item(s).', 'litespeed-cache'), LiteSpeed_Cache_Crawler::get_instance()->count_blacklist()); ?></p>
220
<p><?php echo __('All Urls which returned no-cache tags will be added here, after the initial crawling.', 'litespeed-cache'); ?></p>
221
</div>
222
3
4
$_options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
5
6
+ $_crawler_instance = LiteSpeed_Cache_Crawler::get_instance() ;
7
+
8
+ $sitemap_time = $_crawler_instance->sitemap_time() ;
9
+
10
+ $crawler_list = $_crawler_instance->list_crawlers() ;
11
+
12
+ $meta = $_crawler_instance->read_meta() ;
13
+ if ( $meta[ 'curr_crawler' ] >= count( $crawler_list ) ) {
14
+ $meta[ 'curr_crawler' ] = 0 ;
15
+ }
16
+
17
+ $is_running = time() - $meta[ 'is_running' ] <= $_options[LiteSpeed_Cache_Config::CRWL_RUN_DURATION] ;
18
19
$disabled = LiteSpeed_Cache_Router::can_crawl() ? '' : 'disabled' ;
20
22
?>
23
24
<div class="wrap">
25
+ <h1 class="litespeed-h1">
26
<?php echo __('LiteSpeed Cache Crawler', 'litespeed-cache') ; ?>
27
+ </h1>
28
+ <span class="litespeed-desc">
29
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
30
+ </span>
31
+ <hr class="wp-header-end">
32
+
33
</div>
34
35
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
74
}
75
}
76
?>
77
+
78
+ <h3 class="litespeed-title litespeed-relative">
79
+ <?php echo __('Crawler Cron', 'litespeed-cache') ; ?>
80
+ <span class="litespeed-switch-drag litespeed-cron-onoff-btn">
81
+ <input type="checkbox" name="litespeed_crawler_cron_enable" id="litespeed_crawler_cron_enable" value="1"
82
+ data-url="<?php echo LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE, false, true ) ; ?>"
83
+ <?php if( $_options[LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE] && LiteSpeed_Cache_Router::can_crawl() ) echo "checked"; ?>
84
+ <?php echo $disabled ; ?>
85
+ />
86
+ <label class="litespeed-switch-drag-label" for="litespeed_crawler_cron_enable">
87
+ <span class="litespeed-switch-drag-inner" data-on="<?php echo __('Enable', 'litespeed-cache'); ?>" data-off="<?php echo __('Disable', 'litespeed-cache'); ?>"></span>
88
+ <span class="litespeed-switch-drag-switch"></span>
89
+ </label>
90
+ </span>
91
+ </h3>
92
<?php if ( ! LiteSpeed_Cache_Router::can_crawl() ): ?>
93
<div class="litespeed-callout-danger">
94
<h4><?php echo __('WARNING', 'litespeed-cache'); ?></h4>
96
<p><?php echo sprintf(__('See <a %s>Introduction for Enabling the Crawler</a> for detailed infomation.', 'litespeed-cache'), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:enabling_the_crawler" target="_blank"') ; ?></p>
97
</div>
98
<?php endif; ?>
99
+
100
+
101
+ <?php if ( $meta[ 'this_full_beginning_time' ] ) : ?>
102
+ <p>
103
+ <b><?php echo __( 'Current sitemap crawl started at', 'litespeed-cache' ) ; ?>:</b>
104
+ <?php echo LiteSpeed_Cache_Utility::readable_time( $meta[ 'this_full_beginning_time' ] ) ; ?>
105
+ </p>
106
+
107
+ <?php if ( ! $is_running ) : ?>
108
+ <p>
109
+ <b><?php echo __( 'The next complete sitemap crawl will start at', 'litespeed-cache' ) ; ?>:</b>
110
+ <?php echo date('m/d/Y H:i:s',$meta[ 'this_full_beginning_time' ] + LITESPEED_TIME_OFFSET + $meta[ 'last_full_time_cost' ] + $_options[LiteSpeed_Cache_Config::CRWL_CRAWL_INTERVAL]) ; ?>
111
+ <?php endif ; ?>
112
+ </p>
113
+
114
+ <?php endif ; ?>
115
+ <?php if ( $meta[ 'last_full_time_cost' ] ) : ?>
116
+ <p>
117
+ <b><?php echo __( 'Last complete run time for all crawlers', 'litespeed-cache' ) ; ?>:</b>
118
+ <?php echo sprintf( __( '%d seconds', 'litespeed-cache' ), $meta[ 'last_full_time_cost' ] ) ; ?>
119
+ </p>
120
+ <?php endif ; ?>
121
+
122
+ <?php if ( $meta[ 'last_crawler_total_cost' ] ) : ?>
123
+ <p>
124
+ <b><?php echo __('Run time for previous crawler', 'litespeed-cache') ; ?>:</b>
125
+ <?php echo sprintf( __( '%d seconds', 'litespeed-cache' ), $meta[ 'last_crawler_total_cost' ] ) ; ?>
126
+ </p>
127
+ <?php endif ; ?>
128
+
129
+ <?php if ( $meta[ 'curr_crawler_beginning_time' ] ) : ?>
130
+ <p>
131
+ <b><?php echo __('Current crawler started at', 'litespeed-cache') ; ?>:</b>
132
+ <?php echo LiteSpeed_Cache_Utility::readable_time( $meta[ 'curr_crawler_beginning_time' ] ) ; ?>
133
+ </p>
134
+ <?php endif ; ?>
135
+
136
+ <?php if ( $meta[ 'last_start_time' ] ) : ?>
137
+ <p class='litespeed-desc'>
138
+ <b><?php echo __('Last interval', 'litespeed-cache') ; ?>:</b>
139
+ <?php echo LiteSpeed_Cache_Utility::readable_time( $meta[ 'last_start_time' ] ) ; ?>
140
+ </p>
141
+ <?php endif ; ?>
142
+
143
+ <?php if ( $meta[ 'end_reason' ] ) : ?>
144
+ <p class='litespeed-desc'>
145
+ <b><?php echo __( 'Ended reason', 'litespeed-cache' ) ; ?>:</b>
146
+ <?php echo $meta[ 'end_reason' ] ; ?>
147
+ </p>
148
+ <?php endif ; ?>
149
+
150
+ <?php if ( $meta[ 'last_crawled' ] ) : ?>
151
+ <p class='litespeed-desc'>
152
+ <?php echo sprintf(__('<b>Last crawled:</b> %s item(s)', 'litespeed-cache'), $meta[ 'last_crawled' ] ) ; ?>
153
+ </p>
154
+ <?php endif ; ?>
155
+
156
+ <?php echo " <a href='" . LiteSpeed_Cache_Utility::build_url(LiteSpeed_Cache::ACTION_CRAWLER_RESET_POS) . "' class='litespeed-btn-warning litespeed-btn-xs'>" . __('Reset position', 'litespeed-cache') . "</a>" ;
157
+
158
+ $href = LiteSpeed_Cache_Router::can_crawl() ? LiteSpeed_Cache_Utility::build_url(LiteSpeed_Cache::ACTION_DO_CRAWL) : 'javascript:;' ;
159
+ echo " <a href='$href' id='litespeed_manual_trigger' target='litespeedHiddenIframe' class='litespeed-btn-success litespeed-btn-xs' $disabled>" . __('Manually run', 'litespeed-cache') . "</a>" ;
160
+ ?>
161
+
162
+
163
<table class="litespeed-table">
164
<thead><tr >
165
+ <th scope="col">#</th>
166
<th scope="col"><?php echo __('Cron Name', 'litespeed-cache') ; ?></th>
167
<th scope="col"><?php echo __('Run Frequency', 'litespeed-cache') ; ?></th>
168
+ <th scope="col"><?php echo __('Size', 'litespeed-cache') ; ?></th>
169
+ <th scope="col"><?php echo __('Status', 'litespeed-cache') ; ?></th>
170
</tr></thead>
171
<tbody>
172
+ <?php foreach ( $crawler_list as $i => $v ) : ?>
173
<tr>
174
<td>
175
<?php
176
+ echo $i + 1 ;
177
+ if ( $i == $meta[ 'curr_crawler' ] ) {
178
+ echo "<img class='litespeed-crawler-curr' src='" . LSWCP_PLUGIN_URL . "img/Litespeed.icon.svg' />" ;
179
}
180
?>
181
</td>
182
<td>
183
+ <?php echo ucfirst( $v[ 'role_title' ] ) ; ?>
184
+ <?php if ( $v[ 'webp' ] ) {
185
+ echo ' - WebP' ;
186
+ } ?>
187
</td>
188
+ <td><?php echo $recurrence ; ?></td>
189
+ <td><?php echo "Size: $meta[list_size]" ; ?></td>
190
<td>
191
<?php
192
+ if ( $i == $meta[ 'curr_crawler' ] ) {
193
+ echo "Position: " . ( $meta[ 'last_pos' ] + 1 ) ;
194
+ if ( $is_running ) {
195
+ echo " <span class='litespeed-label-success'>" . __( 'running', 'litespeed-cache' ) . "</span>" ;
196
+ }
197
+ }
198
?>
199
</td>
200
</tr>
201
+ <?php endforeach ; ?>
202
</tbody>
203
</table>
204
<div class="litespeed-desc">
213
<h3 class="litespeed-title"><?php echo __('Watch Crawler Status', 'litespeed-cache') ; ?></h3>
214
215
<?php
216
+ $ajaxUrl = $_crawler_instance->get_crawler_json_path() ;
217
if ( $ajaxUrl ):
218
?>
219
245
<form method="post" action="admin.php?page=lscache-crawler">
246
<?php $this->form_action(LiteSpeed_Cache::ACTION_BLACKLIST_SAVE); ?>
247
<p>
248
+ <textarea name="<?php echo LiteSpeed_Cache_Crawler::CRWL_BLACKLIST; ?>" rows="10" class="litespeed-textarea"><?php echo $_crawler_instance->get_blacklist(); ?></textarea>
249
</p>
250
251
<p>
253
</p>
254
</form>
255
<div class="litespeed-desc">
256
+ <p><?php echo sprintf(__('Current blacklist has %s item(s).', 'litespeed-cache'), $_crawler_instance->count_blacklist()); ?></p>
257
<p><?php echo __('All Urls which returned no-cache tags will be added here, after the initial crawling.', 'litespeed-cache'); ?></p>
258
</div>
259
admin/tpl/debug_log.php CHANGED
@@ -5,12 +5,13 @@ if ( ! defined( 'WPINC' ) ) die ;
5
?>
6
7
<div class="wrap">
8
- <h2>
9
<?php echo __( 'LiteSpeed Cache Debug Log Viewer', 'litespeed-cache' ) ; ?>
10
- <span class="litespeed-desc">
11
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
12
- </span>
13
- </h2>
14
</div>
15
<div class="wrap">
16
<?php
5
?>
6
7
<div class="wrap">
8
+ <h1 class="litespeed-h1">
9
<?php echo __( 'LiteSpeed Cache Debug Log Viewer', 'litespeed-cache' ) ; ?>
10
+ </h1>
11
+ <span class="litespeed-desc">
12
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
13
+ </span>
14
+ <hr class="wp-header-end">
15
</div>
16
<div class="wrap">
17
<?php
admin/tpl/edit_htaccess.php CHANGED
@@ -27,12 +27,13 @@ if ( defined( 'LITESPEED_ON' ) ) {
27
?>
28
29
<div class="wrap">
30
- <h2>
31
<?php echo __('LiteSpeed Cache Edit .htaccess', 'litespeed-cache'); ?>
32
- <span class="litespeed-desc">
33
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
34
- </span>
35
- </h2>
36
</div>
37
<div class="litespeed-wrap">
38
<div class="litespeed-body">
27
?>
28
29
<div class="wrap">
30
+ <h1 class="litespeed-h1">
31
<?php echo __('LiteSpeed Cache Edit .htaccess', 'litespeed-cache'); ?>
32
+ </h1>
33
+ <span class="litespeed-desc">
34
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
35
+ </span>
36
+ <hr class="wp-header-end">
37
</div>
38
<div class="litespeed-wrap">
39
<div class="litespeed-body">
admin/tpl/image_optimization.php CHANGED
@@ -45,12 +45,13 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
45
?>
46
47
<div class="wrap">
48
- <h2>
49
<?php echo __('LiteSpeed Cache Image Optimization', 'litespeed-cache') ; ?>
50
- <span class="litespeed-desc">
51
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
52
- </span>
53
- </h2>
54
</div>
55
56
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
45
?>
46
47
<div class="wrap">
48
+ <h1 class="litespeed-h1">
49
<?php echo __('LiteSpeed Cache Image Optimization', 'litespeed-cache') ; ?>
50
+ </h1>
51
+ <span class="litespeed-desc">
52
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
53
+ </span>
54
+ <hr class="wp-header-end">
55
</div>
56
57
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
admin/tpl/import_export.php CHANGED
@@ -5,12 +5,13 @@ $log = get_option( LiteSpeed_Cache_Import::DB_IMPORT_LOG, array() ) ;
5
?>
6
7
<div class="wrap">
8
- <h2>
9
<?php echo __('LiteSpeed Cache Import / Export', 'litespeed-cache') ; ?>
10
- <span class="litespeed-desc">
11
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
12
- </span>
13
- </h2>
14
</div>
15
16
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
5
?>
6
7
<div class="wrap">
8
+ <h1 class="litespeed-h1">
9
<?php echo __('LiteSpeed Cache Import / Export', 'litespeed-cache') ; ?>
10
+ </h1>
11
+ <span class="litespeed-desc">
12
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
13
+ </span>
14
+ <hr class="wp-header-end">
15
</div>
16
17
<?php include_once LSCWP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
admin/tpl/manage.php CHANGED
@@ -16,7 +16,7 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
16
?>
17
18
<div class="wrap">
19
- <h2>
20
<?php
21
if ( is_network_admin() ) {
22
echo __('LiteSpeed Cache Network Management', 'litespeed-cache');
@@ -25,11 +25,13 @@ include_once LSCWP_DIR . "admin/tpl/inc/banner_promo.php" ;
25
echo __('LiteSpeed Cache Management', 'litespeed-cache');
26
}
27
?>
28
- <span class="litespeed-desc">
29
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
30
- </span>
31
- </h2>
32
</div>
33
<div class="litespeed-wrap">
34
<h2 class="litespeed-header">
35
<?php
16
?>
17
18
<div class="wrap">
19
+ <h1 class="litespeed-h1">
20
<?php
21
if ( is_network_admin() ) {
22
echo __('LiteSpeed Cache Network Management', 'litespeed-cache');
25
echo __('LiteSpeed Cache Management', 'litespeed-cache');
26
}
27
?>
28
+ </h1>
29
+ <span class="litespeed-desc">
30
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
31
+ </span>
32
+ <hr class="wp-header-end">
33
</div>
34
+
35
<div class="litespeed-wrap">
36
<h2 class="litespeed-header">
37
<?php
admin/tpl/manage/manage_cdn.php CHANGED
File without changes
admin/tpl/network_settings.php CHANGED
@@ -18,12 +18,14 @@ $_hide_in_basic_mode = '' ;
18
?>
19
20
<div class="wrap">
21
- <h2>
22
<?php echo __('LiteSpeed Cache Network Settings', 'litespeed-cache'); ?>
23
- <span class="litespeed-desc">
24
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
25
- </span>
26
- </h2>
27
</div>
28
<div class="litespeed-wrap">
29
<h2 class="litespeed-header">
18
?>
19
20
<div class="wrap">
21
+ <h1 class="litespeed-h1">
22
<?php echo __('LiteSpeed Cache Network Settings', 'litespeed-cache'); ?>
23
+ </h1>
24
+ <span class="litespeed-desc">
25
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
26
+ </span>
27
+ <hr class="wp-header-end">
28
+
29
</div>
30
<div class="litespeed-wrap">
31
<h2 class="litespeed-header">
admin/tpl/report.php CHANGED
@@ -9,13 +9,15 @@ $env_ref = $_report->get_env_ref() ;
9
?>
10
11
<div class="wrap">
12
- <h2>
13
<?php echo __('LiteSpeed Cache Report', 'litespeed-cache'); ?>
14
- <span class="litespeed-desc">
15
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
16
- </span>
17
- </h2>
18
</div>
19
<div class="litespeed-wrap">
20
<div class="litespeed-body">
21
9
?>
10
11
<div class="wrap">
12
+ <h1 class="litespeed-h1">
13
<?php echo __('LiteSpeed Cache Report', 'litespeed-cache'); ?>
14
+ </h1>
15
+ <span class="litespeed-desc">
16
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION; ?>
17
+ </span>
18
+ <hr class="wp-header-end">
19
</div>
20
+
21
<div class="litespeed-wrap">
22
<div class="litespeed-body">
23
admin/tpl/setting/network_settings_advanced.php CHANGED
@@ -5,6 +5,8 @@ if ( ! defined( 'WPINC' ) ) die ;
5
6
<table><tbody>
7
8
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.check_adv_file.php' ; ?>
9
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.login_cookie.php' ; ?>
10
5
6
<table><tbody>
7
8
+ <?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_object.php' ; ?>
9
+ <?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ; ?>
10
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.check_adv_file.php' ; ?>
11
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.login_cookie.php' ; ?>
12
admin/tpl/setting/network_settings_cache.php CHANGED
@@ -13,8 +13,6 @@ if ( ! defined( 'WPINC' ) ) die ;
13
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_favicon.php' ; ?>
14
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_resources.php' ; ?>
15
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_mobile.php' ; ?>
16
- <?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_object.php' ; ?>
17
- <?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ; ?>
18
19
</tbody></table>
20
13
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_favicon.php' ; ?>
14
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_resources.php' ; ?>
15
<?php require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_mobile.php' ; ?>
16
17
</tbody></table>
18
admin/tpl/setting/settings_advanced.php CHANGED
@@ -16,8 +16,12 @@ if (!defined('WPINC')) die;
16
</div>
17
18
<table><tbody>
19
<?php
20
if ( ! is_multisite() ) :
21
require LSCWP_DIR . 'admin/tpl/setting/settings_inc.check_adv_file.php' ;
22
require LSCWP_DIR . 'admin/tpl/setting/settings_inc.login_cookie.php' ;
23
endif ;
16
</div>
17
18
<table><tbody>
19
+
20
<?php
21
if ( ! is_multisite() ) :
22
+ require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_object.php' ;
23
+ require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ;
24
+
25
require LSCWP_DIR . 'admin/tpl/setting/settings_inc.check_adv_file.php' ;
26
require LSCWP_DIR . 'admin/tpl/setting/settings_inc.login_cookie.php' ;
27
endif ;
admin/tpl/setting/settings_cache.php CHANGED
@@ -74,13 +74,6 @@ if ( ! defined( 'WPINC' ) ) die ;
74
</td>
75
</tr>
76
77
- <?php
78
- if ( ! is_multisite() ) :
79
- require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_object.php' ;
80
- require LSCWP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ;
81
- endif ;
82
- ?>
83
-
84
<tr <?php echo $_hide_in_basic_mode ; ?>>
85
<th><?php echo __( 'Drop Query String', 'litespeed-cache' ) ; ?></th>
86
<td>
74
</td>
75
</tr>
76
77
<tr <?php echo $_hide_in_basic_mode ; ?>>
78
<th><?php echo __( 'Drop Query String', 'litespeed-cache' ) ; ?></th>
79
<td>
admin/tpl/setting/settings_cdn.php CHANGED
@@ -172,6 +172,49 @@ if ( ! $cdn_mapping ) {
172
</td>
173
</tr>
174
175
<tr>
176
<th><?php echo __( 'Cloudflare API', 'litespeed-cache' ) ; ?></th>
177
<td>
172
</td>
173
</tr>
174
175
+ <tr class="litespeed-hide">
176
+ <th><?php echo __( 'Quic Cloud API', 'litespeed-cache' ) ; ?></th>
177
+ <td>
178
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CDN_QUIC ) ; ?>
179
+ <div class="litespeed-desc">
180
+ <?php echo __( 'Use Quic Cloud API functionality.', 'litespeed-cache' ) ; ?>
181
+ <?php echo sprintf( __( 'This can be managed from <a %2$s>%1$s</a>.', 'litespeed-cache' ), '<b>' . __( 'Manage', 'litespeed-cache' ) . '</b> -&gt; <b>' . __( 'CDN', 'litespeed-cache' ) . '</b>', 'href="admin.php?page=lscache-dash#cdn"' ) ; ?>
182
+ </div>
183
+ <div class="litespeed-cdn-mapping-block">
184
+ <div class='litespeed-child-col'>
185
+ <h4><?php echo __( 'Email Address', 'litespeed-cache' ) ; ?></h4>
186
+
187
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_EMAIL ) ; ?>
188
+ <div class="litespeed-desc">
189
+ <?php echo __( 'Your Email address on Quic Cloud.', 'litespeed-cache' ) ; ?>
190
+ </div>
191
+ </div>
192
+
193
+ <div class='litespeed-child-col'>
194
+ <h4><?php echo __( 'User API Key', 'litespeed-cache' ) ; ?></h4>
195
+
196
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_KEY ) ; ?>
197
+ <div class="litespeed-desc">
198
+ <?php echo __( 'Your API key is used to access Quic Cloud APIs.', 'litespeed-cache' ) ; ?>
199
+ <?php echo sprintf( __( 'Get it from <a %s>Quic Cloud</a>.', 'litespeed-cache' ), 'href="https://quic.cloud/dashboard" target="_blank"' ) ; ?>
200
+ </div>
201
+ </div>
202
+
203
+ <div class='litespeed-child-col'>
204
+ <h4><?php echo __( 'Site Domain', 'litespeed-cache' ) ; ?></h4>
205
+
206
+ <?php
207
+ $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_QUIC_SITE ) ;
208
+ ?>
209
+ <div class="litespeed-desc">
210
+ <?php echo __( 'You can just type part of the domain.', 'litespeed-cache' ) ; ?>
211
+ <?php echo __( 'Once saved, it will be matched with the current list and completed automatically.', 'litespeed-cache' ) ; ?>
212
+ </div>
213
+ </div>
214
+ </div>
215
+ </td>
216
+ </tr>
217
+
218
<tr>
219
<th><?php echo __( 'Cloudflare API', 'litespeed-cache' ) ; ?></th>
220
<td>
admin/tpl/setting/settings_crawler.php CHANGED
@@ -123,105 +123,117 @@ if ( !defined('WPINC') ) die;
123
</tr>
124
125
<tr>
126
- <th><?php echo __('Custom Sitemap', 'litespeed-cache'); ?></th>
127
<td>
128
- <?php $id = LiteSpeed_Cache_Config::CRWL_CUSTOM_SITEMAP ; ?>
129
- <?php $this->build_input($id, false, null, 'litespeed_custom_sitemap'); ?>
130
- <div class="litespeed-desc">
131
- <?php echo __('The crawler can use your Google XML Sitemap instead of its own. Enter the full URL to your sitemap here.', 'litespeed-cache'); ?>
132
- </div>
133
- </td>
134
- </tr>
135
136
- <tr data-litespeed-selfsitemap="1">
137
- <th><?php echo __('Include Posts', 'litespeed-cache'); ?></th>
138
- <td>
139
- <?php $this->build_switch(LiteSpeed_Cache_Config::CRWL_POSTS); ?>
140
<div class="litespeed-desc">
141
- <?php echo __('Include Posts in crawler sitemap generation.', 'litespeed-cache'); ?>
142
</div>
143
- </td>
144
- </tr>
145
-
146
- <tr data-litespeed-selfsitemap="1">
147
- <th><?php echo __('Include Pages', 'litespeed-cache'); ?></th>
148
- <td>
149
- <?php $this->build_switch(LiteSpeed_Cache_Config::CRWL_PAGES); ?>
150
- <div class="litespeed-desc">
151
- <?php echo __('Include Pages in crawler sitemap generation.', 'litespeed-cache'); ?>
152
- </div>
153
- </td>
154
- </tr>
155
156
- <tr data-litespeed-selfsitemap="1">
157
- <th><?php echo __('Include Categories', 'litespeed-cache'); ?></th>
158
- <td>
159
- <?php $this->build_switch(LiteSpeed_Cache_Config::CRWL_CATS); ?>
160
- <div class="litespeed-desc">
161
- <?php echo __('Include Categories pages in crawler sitemap generation.', 'litespeed-cache'); ?>
162
- </div>
163
</td>
164
</tr>
165
166
- <tr data-litespeed-selfsitemap="1">
167
- <th><?php echo __('Include Tags', 'litespeed-cache'); ?></th>
168
<td>
169
- <?php $this->build_switch(LiteSpeed_Cache_Config::CRWL_TAGS); ?>
170
<div class="litespeed-desc">
171
- <?php echo __('Include Tags pages in crawler sitemap generation.', 'litespeed-cache'); ?>
172
</div>
173
</td>
174
</tr>
175
176
- <tr data-litespeed-selfsitemap="1">
177
- <th><?php echo __('Exclude Custom Post Types', 'litespeed-cache'); ?></th>
178
<td>
179
- <?php $this->build_textarea(LiteSpeed_Cache_Config::CRWL_EXCLUDES_CPT); ?>
180
-
181
- <div class="litespeed-desc">
182
- <?php echo __('If you want to exclude certain Custom Post Types in sitemap, add the Custom Post Types in the box, one per line.', 'litespeed-cache'); ?>
183
</div>
184
185
- <div class="litespeed-callout-warning">
186
- <h4><?php echo __('Available Custom Post Type','litespeed-cache'); ?></h4>
187
- <p>
188
- <?php echo implode('<br />', array_diff(get_post_types( '', 'names' ), array('post', 'page'))); ?>
189
- </p>
190
- </div>
191
- </td>
192
- </tr>
193
-
194
- <tr data-litespeed-selfsitemap="1">
195
- <th><?php echo __('Order links by', 'litespeed-cache'); ?></th>
196
- <td>
197
- <div class="litespeed-switch">
198
- <?php echo $this->build_radio(
199
- LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
200
- LiteSpeed_Cache_Config::CRWL_DATE_DESC,
201
- __('Date, descending (Default)', 'litespeed-cache')
202
- ); ?>
203
-
204
- <?php echo $this->build_radio(
205
- LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
206
- LiteSpeed_Cache_Config::CRWL_DATE_ASC,
207
- __('Date, ascending', 'litespeed-cache')
208
- ); ?>
209
-
210
- <?php echo $this->build_radio(
211
- LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
212
- LiteSpeed_Cache_Config::CRWL_ALPHA_DESC,
213
- __('Alphabetical, descending', 'litespeed-cache')
214
- ); ?>
215
-
216
- <?php echo $this->build_radio(
217
- LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
218
- LiteSpeed_Cache_Config::CRWL_ALPHA_ASC,
219
- __('Alphabetical, ascending', 'litespeed-cache')
220
- ); ?>
221
- </div>
222
- <div class="litespeed-desc">
223
- <?php echo __('Please choose one of the above options to set the order in which the sitemap will be parsed.', 'litespeed-cache'); ?>
224
- </div>
225
</td>
226
</tr>
227
123
</tr>
124
125
<tr>
126
+ <th><?php echo __('Role Simulation', 'litespeed-cache'); ?></th>
127
<td>
128
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_CRWL_AS_UIDS, 20 ) ; ?>
129
130
<div class="litespeed-desc">
131
+ <?php echo __('To crawl the site as a logged-in user, enter the user ids to be simulated.', 'litespeed-cache'); ?>
132
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
133
</div>
134
135
</td>
136
</tr>
137
138
+ <tr>
139
+ <th><?php echo __('Custom Sitemap', 'litespeed-cache'); ?></th>
140
<td>
141
+ <?php $id = LiteSpeed_Cache_Config::CRWL_CUSTOM_SITEMAP ; ?>
142
+ <?php $this->build_input( $id, 'litespeed-input-long' ) ; ?>
143
<div class="litespeed-desc">
144
+ <?php echo __('The crawler can use your Google XML Sitemap instead of its own. Enter the full URL to your sitemap here.', 'litespeed-cache'); ?>
145
</div>
146
</td>
147
</tr>
148
149
+ <tr>
150
+ <th><?php echo __('Sitemap Generation', 'litespeed-cache'); ?></th>
151
<td>
152
+ <div class="litespeed-cdn-mapping-block">
153
+ <div class='litespeed-cdn-mapping-col2'>
154
+ <div class="litespeed-row">
155
+ <div class="litespeed-child-col-inc"><?php echo __( 'Include Posts', 'litespeed-cache' ) ; ?></div>
156
+ <?php
157
+ $this->build_toggle( LiteSpeed_Cache_Config::CRWL_POSTS ) ;
158
+ ?>
159
+ </div>
160
+
161
+ <div class="litespeed-row">
162
+ <div class="litespeed-child-col-inc"><?php echo __( 'Include Pages', 'litespeed-cache' ) ; ?></div>
163
+ <?php
164
+ $this->build_toggle( LiteSpeed_Cache_Config::CRWL_PAGES ) ;
165
+ ?>
166
+ </div>
167
+
168
+ <div class="litespeed-row">
169
+ <div class="litespeed-child-col-inc"><?php echo __( 'Include Categories', 'litespeed-cache' ) ; ?></div>
170
+ <?php
171
+ $this->build_toggle( LiteSpeed_Cache_Config::CRWL_CATS ) ;
172
+ ?>
173
+ </div>
174
+
175
+ <div class="litespeed-row">
176
+ <div class="litespeed-child-col-inc"><?php echo __( 'Include Tags', 'litespeed-cache' ) ; ?></div>
177
+ <?php
178
+ $this->build_toggle( LiteSpeed_Cache_Config::CRWL_TAGS ) ;
179
+ ?>
180
+ </div>
181
+
182
+ </div>
183
+
184
+ <div class='litespeed-child-col-auto'>
185
+ <h4><?php echo __('Exclude Custom Post Types', 'litespeed-cache'); ?></h4>
186
+
187
+ <?php $this->build_textarea( LiteSpeed_Cache_Config::CRWL_EXCLUDES_CPT, 40 ) ; ?>
188
+
189
+ <div class="litespeed-desc">
190
+ <?php echo __('Exclude certain Custom Post Types in sitemap.', 'litespeed-cache'); ?>
191
+ </div>
192
+ </div>
193
+
194
+ <div class='litespeed-child-col-auto'>
195
+ <div class="litespeed-callout-warning">
196
+ <h4><?php echo __('Available Custom Post Type','litespeed-cache'); ?></h4>
197
+ <p>
198
+ <?php echo implode('<br />', array_diff(get_post_types( '', 'names' ), array('post', 'page'))); ?>
199
+ </p>
200
+ </div>
201
+ </div>
202
+
203
+ <div class='litespeed-child-col-auto'>
204
+ <h4><?php echo __('Order links by', 'litespeed-cache'); ?></h4>
205
+
206
+ <div class="litespeed-switch">
207
+ <?php echo $this->build_radio(
208
+ LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
209
+ LiteSpeed_Cache_Config::CRWL_DATE_DESC,
210
+ __('Date, descending (Default)', 'litespeed-cache')
211
+ ); ?>
212
+
213
+ <?php echo $this->build_radio(
214
+ LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
215
+ LiteSpeed_Cache_Config::CRWL_DATE_ASC,
216
+ __('Date, ascending', 'litespeed-cache')
217
+ ); ?>
218
+
219
+ <?php echo $this->build_radio(
220
+ LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
221
+ LiteSpeed_Cache_Config::CRWL_ALPHA_DESC,
222
+ __('Alphabetical, descending', 'litespeed-cache')
223
+ ); ?>
224
+
225
+ <?php echo $this->build_radio(
226
+ LiteSpeed_Cache_Config::CRWL_ORDER_LINKS,
227
+ LiteSpeed_Cache_Config::CRWL_ALPHA_ASC,
228
+ __('Alphabetical, ascending', 'litespeed-cache')
229
+ ); ?>
230
+ </div>
231
+ <div class="litespeed-desc">
232
+ <?php echo sprintf( __( 'These options will be invalid when using %s.', 'litespeed-cache' ), '<code>' . __( 'Custom Sitemap', 'litespeed-cache' ) . '</code>' ) ; ?>
233
+ </div>
234
+ </div>
235
</div>
236
237
</td>
238
</tr>
239
admin/tpl/setting/settings_esi.php CHANGED
@@ -3,14 +3,23 @@ if ( ! defined( 'WPINC' ) ) die ;
3
4
?>
5
6
- <h3 class="litespeed-title"><?php echo __('ESI Settings', 'litespeed-cache'); ?></h3>
7
8
<div class="litespeed-desc">
9
<p><?php echo __('With ESI (Edge Side Includes), pages may be served from cache for logged-in users.', 'litespeed-cache'); ?></p>
10
- <p><?php echo __('ESI allows you to designate parts of your dynamic page as separate fragments that are then assembled together to make the whole page. In other words, ESI lets you “punch holes” in a page, and then fill those holes with content that may be cached privately, cached publicly with its own TTL, or not cached at all.', 'litespeed-cache'); ?></p>
11
- <p><?php echo sprintf(
12
__( 'Learn more about public cache vs. private cache <a %s>on our blog</a>.', 'litespeed-cache' ),
13
'href="https://blog.litespeedtech.com/2017/08/30/wpw-private-cache-vs-public-cache/" target="_blank"'
14
) ; ?></p>
15
</div>
16
3
4
?>
5
6
+ <h3 class="litespeed-title-short">
7
+ <?php echo __('ESI Settings', 'litespeed-cache'); ?>
8
+ <a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:configuration:esi" target="_blank" class="litespeed-learn-more"><?php echo __('Learn More', 'litespeed-cache') ; ?></a>
9
+ </h3>
10
+
11
12
<div class="litespeed-desc">
13
<p><?php echo __('With ESI (Edge Side Includes), pages may be served from cache for logged-in users.', 'litespeed-cache'); ?></p>
14
+ <p><?php echo __('ESI allows you to designate parts of your dynamic page as separate fragments that are then assembled together to make the whole page. In other words, ESI lets you “punch holes” in a page, and then fill those holes with content that may be cached privately, cached publicly with its own TTL, or not cached at all.', 'litespeed-cache'); ?>
15
+ <?php echo sprintf(
16
__( 'Learn more about public cache vs. private cache <a %s>on our blog</a>.', 'litespeed-cache' ),
17
'href="https://blog.litespeedtech.com/2017/08/30/wpw-private-cache-vs-public-cache/" target="_blank"'
18
+ ) ; ?>
19
+ </p>
20
+ <p><?php echo sprintf(
21
+ __( '<a %s>ESI sample for developers</a>.', 'litespeed-cache' ),
22
+ 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:esi_sample" target="_blank"'
23
) ; ?></p>
24
</div>
25
admin/tpl/setting/settings_inc.cache_mobile.php CHANGED
@@ -21,7 +21,7 @@ if (!defined('WPINC')) die;
21
</td>
22
</tr>
23
24
- <tr <?php echo $_hide_in_basic_mode ; ?>>
25
<th><?php echo __('List of Mobile User Agents', 'litespeed-cache'); ?></th>
26
<td>
27
<?php
21
</td>
22
</tr>
23
24
+ <tr>
25
<th><?php echo __('List of Mobile User Agents', 'litespeed-cache'); ?></th>
26
<td>
27
<?php
admin/tpl/setting/settings_inc.cache_object.php CHANGED
File without changes
admin/tpl/setting/settings_inc.check_adv_file.php CHANGED
File without changes
admin/tpl/setting/settings_inc.login_cookie.php CHANGED
@@ -15,7 +15,7 @@ if ( ! defined( 'WPINC' ) ) die ;
15
. ' ' . __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache')
16
. '</p>'
17
. '<p>'
18
- . sprintf(__('The default login cookie is %s.', 'litespeed-cache'), '_lscache_vary')
19
. ' ' . __('The server will determine if the user is logged in based on the existance of this cookie.', 'litespeed-cache')
20
. ' ' . __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache')
21
. ' ' . __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache')
15
. ' ' . __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache')
16
. '</p>'
17
. '<p>'
18
+ . sprintf(__('The default login cookie is %s.', 'litespeed-cache'), '<code>_lscache_vary</code>')
19
. ' ' . __('The server will determine if the user is logged in based on the existance of this cookie.', 'litespeed-cache')
20
. ' ' . __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache')
21
. ' ' . __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache')
admin/tpl/setting/settings_optimize.php CHANGED
@@ -32,6 +32,16 @@ if ( ! defined( 'WPINC' ) ) die ;
32
</td>
33
</tr>
34
35
<tr>
36
<th><?php echo __( 'CSS Combine', 'litespeed-cache' ) ; ?></th>
37
<td>
@@ -63,6 +73,16 @@ if ( ! defined( 'WPINC' ) ) die ;
63
</td>
64
</tr>
65
66
<tr>
67
<th><?php echo __( 'JS Combine', 'litespeed-cache' ) ; ?></th>
68
<td>
32
</td>
33
</tr>
34
35
+ <tr>
36
+ <th><?php echo __( 'Inline CSS Minify', 'litespeed-cache' ) ; ?></th>
37
+ <td>
38
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CSS_INLINE_MINIFY ) ; ?>
39
+ <div class="litespeed-desc">
40
+ <?php echo __( 'Minify inline CSS code.', 'litespeed-cache' ) ; ?>
41
+ </div>
42
+ </td>
43
+ </tr>
44
+
45
<tr>
46
<th><?php echo __( 'CSS Combine', 'litespeed-cache' ) ; ?></th>
47
<td>
73
</td>
74
</tr>
75
76
+ <tr>
77
+ <th><?php echo __( 'Inline JS Minify', 'litespeed-cache' ) ; ?></th>
78
+ <td>
79
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_JS_INLINE_MINIFY ) ; ?>
80
+ <div class="litespeed-desc">
81
+ <?php echo __( 'Minify inline JS code.', 'litespeed-cache' ) ; ?>
82
+ </div>
83
+ </td>
84
+ </tr>
85
+
86
<tr>
87
<th><?php echo __( 'JS Combine', 'litespeed-cache' ) ; ?></th>
88
<td>
admin/tpl/settings.php CHANGED
@@ -122,16 +122,17 @@ if ( ! $adv_mode ) {
122
?>
123
124
<div class="wrap">
125
- <h2>
126
<?php echo __('LiteSpeed Cache Settings', 'litespeed-cache') ; ?>
127
- <span class="litespeed-desc">
128
- v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
129
- </span>
130
- <span class="litespeed-desc">
131
- <a href="admin.php?page=lscache-settings&mode=basic" class="litespeed-setting-basic <?php echo $class_basic ; ?>"><?php echo __( 'Basic View', 'litespeed-cache' ) ; ?></a>
132
- <a href="admin.php?page=lscache-settings&mode=advanced" class="litespeed-setting-advanced <?php echo $class_advanced ; ?>"><?php echo __( 'Advanced View', 'litespeed-cache' ) ; ?></a>
133
- </span>
134
- </h2>
135
</div>
136
<div class="litespeed-wrap">
137
<h2 class="litespeed-header">
122
?>
123
124
<div class="wrap">
125
+ <h1 class="litespeed-h1">
126
<?php echo __('LiteSpeed Cache Settings', 'litespeed-cache') ; ?>
127
+ </h1>
128
+ <span class="litespeed-desc">
129
+ v<?php echo LiteSpeed_Cache::PLUGIN_VERSION ; ?>
130
+ </span>
131
+ <span class="litespeed-desc">
132
+ <a href="admin.php?page=lscache-settings&mode=basic" class="litespeed-setting-basic <?php echo $class_basic ; ?>"><?php echo __( 'Basic View', 'litespeed-cache' ) ; ?></a>
133
+ <a href="admin.php?page=lscache-settings&mode=advanced" class="litespeed-setting-advanced <?php echo $class_advanced ; ?>"><?php echo __( 'Advanced View', 'litespeed-cache' ) ; ?></a>
134
+ </span>
135
+ <hr class="wp-header-end">
136
</div>
137
<div class="litespeed-wrap">
138
<h2 class="litespeed-header">
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -39,10 +39,12 @@ class LiteSpeed_Cache_Cli_Admin
39
LiteSpeed_Cache_Config::OPID_LOG_FILTERS,
40
41
LiteSpeed_Cache_Config::OPID_CSS_MINIFY,
42
LiteSpeed_Cache_Config::OPID_CSS_COMBINE,
43
LiteSpeed_Cache_Config::OPID_CSS_COMBINED_PRIORITY,
44
LiteSpeed_Cache_Config::OPID_CSS_HTTP2,
45
LiteSpeed_Cache_Config::OPID_JS_MINIFY,
46
LiteSpeed_Cache_Config::OPID_JS_COMBINE,
47
LiteSpeed_Cache_Config::OPID_JS_COMBINED_PRIORITY,
48
LiteSpeed_Cache_Config::OPID_JS_HTTP2,
@@ -57,6 +59,7 @@ class LiteSpeed_Cache_Cli_Admin
57
LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT,
58
59
LiteSpeed_Cache_Config::OPID_CDN,
60
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
61
62
LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
39
LiteSpeed_Cache_Config::OPID_LOG_FILTERS,
40
41
LiteSpeed_Cache_Config::OPID_CSS_MINIFY,
42
+ LiteSpeed_Cache_Config::OPID_CSS_INLINE_MINIFY,
43
LiteSpeed_Cache_Config::OPID_CSS_COMBINE,
44
LiteSpeed_Cache_Config::OPID_CSS_COMBINED_PRIORITY,
45
LiteSpeed_Cache_Config::OPID_CSS_HTTP2,
46
LiteSpeed_Cache_Config::OPID_JS_MINIFY,
47
+ LiteSpeed_Cache_Config::OPID_JS_INLINE_MINIFY,
48
LiteSpeed_Cache_Config::OPID_JS_COMBINE,
49
LiteSpeed_Cache_Config::OPID_JS_COMBINED_PRIORITY,
50
LiteSpeed_Cache_Config::OPID_JS_HTTP2,
59
LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT,
60
61
LiteSpeed_Cache_Config::OPID_CDN,
62
+ LiteSpeed_Cache_Config::OPID_CDN_QUIC,
63
LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE,
64
65
LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY,
css/litespeed.css CHANGED
@@ -92,6 +92,10 @@
92
padding: 5px;
93
}
94
95
h3 .litespeed-learn-more {
96
font-size: 12px;
97
font-weight: normal;
@@ -1458,6 +1462,19 @@ g.litespeed-pie_info text{
1458
border-bottom:1px solid #6699cc;
1459
}
1460
1461
/********************************* todo *******************************/
1462
/* input field */
1463
.litespeed-textarea {
92
padding: 5px;
93
}
94
95
+ .litespeed-h1 {
96
+ display: inline-block ;
97
+ }
98
+
99
h3 .litespeed-learn-more {
100
font-size: 12px;
101
font-weight: normal;
1462
border-bottom:1px solid #6699cc;
1463
}
1464
1465
+ /********************************* crawler *******************************/
1466
+ .litespeed-crawler-curr{
1467
+ vertical-align: middle;
1468
+ height: 20px;
1469
+ margin-left: 10px;
1470
+ }
1471
+
1472
+ .litespeed-cron-onoff-btn {
1473
+ position: absolute ;
1474
+ left: 180px ;
1475
+ top: -7px ;
1476
+ }
1477
+
1478
/********************************* todo *******************************/
1479
/* input field */
1480
.litespeed-textarea {
img/icons/purge-object.svg CHANGED
File without changes
img/icons/purge-opcache.svg CHANGED
File without changes
inc/config.class.php CHANGED
@@ -31,8 +31,10 @@ class LiteSpeed_Cache_Config
31
const ITEM_LOG_IGNORE_PART_FILTERS = 'litespeed-log_ignore_part_filters' ;
32
const ITEM_OBJECT_GLOBAL_GROUPS = 'litespeed-object_global_groups' ;
33
const ITEM_OBJECT_NON_PERSISTENT_GROUPS = 'litespeed-object_non_persistent_groups' ;
34
35
const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
36
37
// Server variables
38
const ENV_CRAWLER_USLEEP = 'CRAWLER_USLEEP' ;
@@ -132,11 +134,13 @@ class LiteSpeed_Cache_Config
132
const OPID_ADV_INSTANT_CLICK = 'instant_click' ;
133
134
const OPID_CSS_MINIFY = 'css_minify' ;
135
const OPID_CSS_COMBINE = 'css_combine' ;
136
const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
137
const OPID_CSS_HTTP2 = 'css_http2' ;
138
const OPID_CSS_EXCLUDES = 'css_exclude' ;
139
const OPID_JS_MINIFY = 'js_minify' ;
140
const OPID_JS_COMBINE = 'js_combine' ;
141
const OPID_JS_COMBINED_PRIORITY = 'js_combined_priority' ;
142
const OPID_JS_HTTP2 = 'js_http2' ;
@@ -158,6 +162,10 @@ class LiteSpeed_Cache_Config
158
const OPID_CDN_ORI = 'cdn_ori' ;
159
const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
160
const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
161
const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
162
const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
163
const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
@@ -587,11 +595,13 @@ class LiteSpeed_Cache_Config
587
self::OPID_ADV_INSTANT_CLICK => false,
588
589
self::OPID_CSS_MINIFY => false,
590
self::OPID_CSS_COMBINE => false,
591
self::OPID_CSS_COMBINED_PRIORITY => false,
592
self::OPID_CSS_HTTP2 => false,
593
self::OPID_CSS_EXCLUDES => '',
594
self::OPID_JS_MINIFY => false,
595
self::OPID_JS_COMBINE => false,
596
self::OPID_JS_COMBINED_PRIORITY => false,
597
self::OPID_JS_HTTP2 => false,
@@ -613,6 +623,10 @@ class LiteSpeed_Cache_Config
613
self::OPID_CDN_ORI => '',
614
self::OPID_CDN_EXCLUDE => '',
615
self::OPID_CDN_REMOTE_JQUERY => false,
616
self::OPID_CDN_CLOUDFLARE => false,
617
self::OPID_CDN_CLOUDFLARE_EMAIL => '',
618
self::OPID_CDN_CLOUDFLARE_KEY => '',
31
const ITEM_LOG_IGNORE_PART_FILTERS = 'litespeed-log_ignore_part_filters' ;
32
const ITEM_OBJECT_GLOBAL_GROUPS = 'litespeed-object_global_groups' ;
33
const ITEM_OBJECT_NON_PERSISTENT_GROUPS = 'litespeed-object_non_persistent_groups' ;
34
+ const ITEM_CRWL_AS_UIDS = 'litespeed-crawler-as-uids' ;
35
36
const ITEM_SETTING_MODE = 'litespeed-setting-mode' ;
37
+ const ITEM_CRAWLER_HASH = 'litespeed-crawler-hash' ;
38
39
// Server variables
40
const ENV_CRAWLER_USLEEP = 'CRAWLER_USLEEP' ;
134
const OPID_ADV_INSTANT_CLICK = 'instant_click' ;
135
136
const OPID_CSS_MINIFY = 'css_minify' ;
137
+ const OPID_CSS_INLINE_MINIFY = 'css_inline_minify' ;
138
const OPID_CSS_COMBINE = 'css_combine' ;
139
const OPID_CSS_COMBINED_PRIORITY = 'css_combined_priority' ;
140
const OPID_CSS_HTTP2 = 'css_http2' ;
141
const OPID_CSS_EXCLUDES = 'css_exclude' ;
142
const OPID_JS_MINIFY = 'js_minify' ;
143
+ const OPID_JS_INLINE_MINIFY = 'js_inline_minify' ;
144
const OPID_JS_COMBINE = 'js_combine' ;
145
const OPID_JS_COMBINED_PRIORITY = 'js_combined_priority' ;
146
const OPID_JS_HTTP2 = 'js_http2' ;
162
const OPID_CDN_ORI = 'cdn_ori' ;
163
const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
164
const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
165
+ const OPID_CDN_QUIC = 'cdn_quic' ;
166
+ const OPID_CDN_QUIC_EMAIL = 'cdn_quic_email' ;
167
+ const OPID_CDN_QUIC_KEY = 'cdn_quic_key' ;
168
+ const OPID_CDN_QUIC_SITE = 'cdn_quic_site' ;
169
const OPID_CDN_CLOUDFLARE = 'cdn_cloudflare' ;
170
const OPID_CDN_CLOUDFLARE_EMAIL = 'cdn_cloudflare_email' ;
171
const OPID_CDN_CLOUDFLARE_KEY = 'cdn_cloudflare_key' ;
595
self::OPID_ADV_INSTANT_CLICK => false,
596
597
self::OPID_CSS_MINIFY => false,
598
+ self::OPID_CSS_INLINE_MINIFY => false,
599
self::OPID_CSS_COMBINE => false,
600
self::OPID_CSS_COMBINED_PRIORITY => false,
601
self::OPID_CSS_HTTP2 => false,
602
self::OPID_CSS_EXCLUDES => '',
603
self::OPID_JS_MINIFY => false,
604
+ self::OPID_JS_INLINE_MINIFY => false,
605
self::OPID_JS_COMBINE => false,
606
self::OPID_JS_COMBINED_PRIORITY => false,
607
self::OPID_JS_HTTP2 => false,
623
self::OPID_CDN_ORI => '',
624
self::OPID_CDN_EXCLUDE => '',
625
self::OPID_CDN_REMOTE_JQUERY => false,
626
+ self::OPID_CDN_QUIC => false,
627
+ self::OPID_CDN_QUIC_EMAIL => '',
628
+ self::OPID_CDN_QUIC_KEY => '',
629
+ self::OPID_CDN_QUIC_SITE => '',
630
self::OPID_CDN_CLOUDFLARE => false,
631
self::OPID_CDN_CLOUDFLARE_EMAIL => '',
632
self::OPID_CDN_CLOUDFLARE_KEY => '',
inc/crawler.class.php CHANGED
@@ -38,7 +38,7 @@ class LiteSpeed_Cache_Crawler
38
}
39
$this->_blacklist_file = $this->_sitemap_file . '.blacklist' ;
40
41
- LiteSpeed_Cache_Log::debug('Crawler log: Initialized') ;
42
}
43
44
/**
@@ -57,21 +57,6 @@ class LiteSpeed_Cache_Crawler
57
return $this->_home_url . '/' . $metaUrl ;
58
}
59
60
- /**
61
- * Return crawler meta info
62
- *
63
- * @since 1.1.0
64
- * @access public
65
- * @return array Meta array
66
- */
67
- public function get_meta()
68
- {
69
- if ( ! file_exists($this->_sitemap_file . '.meta') || ! $meta = Litespeed_File::read($this->_sitemap_file . '.meta') ) {
70
- return false ;
71
- }
72
- return json_decode($meta) ;
73
- }
74
-
75
/**
76
* Return blacklist content
77
*
@@ -139,7 +124,7 @@ class LiteSpeed_Cache_Crawler
139
*/
140
public function append_blacklist( $list )
141
{
142
- defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Crawler log: append blacklist ' . count( $list ) ) ;
143
144
$ori_list = Litespeed_File::read( $this->_blacklist_file ) ;
145
$ori_list = explode( "\n", $ori_list ) ;
@@ -151,7 +136,7 @@ class LiteSpeed_Cache_Crawler
151
// save blacklist
152
$ret = Litespeed_File::save( $this->_blacklist_file, $content, true, false, false ) ;
153
if ( $ret !== true ) {
154
- LiteSpeed_Cache_Log::debug( 'Crawler log: append blacklist failed: ' . $ret ) ;
155
return false ;
156
}
157
@@ -278,10 +263,12 @@ class LiteSpeed_Cache_Crawler
278
$blacklist = Litespeed_File::read( $this->_blacklist_file ) ;
279
$blacklist = explode( "\n", $blacklist ) ;
280
$urls = array_diff( $urls, $blacklist ) ;
281
- LiteSpeed_Cache_Log::debug( 'Crawler log: Generate sitemap' ) ;
282
283
$ret = Litespeed_File::save( $this->_sitemap_file, implode( "\n", $urls ), true, false, false ) ;
284
285
// refresh list size in meta
286
$crawler = new Litespeed_Crawler( $this->_sitemap_file ) ;
287
$crawler->refresh_list_size() ;
@@ -317,7 +304,7 @@ class LiteSpeed_Cache_Crawler
317
{
318
$crawler = new Litespeed_Crawler($this->_sitemap_file) ;
319
$ret = $crawler->reset_pos() ;
320
- $log = 'Crawler log: Reset pos. ' ;
321
if ( $ret !== true ) {
322
$log .= "Error: $ret" ;
323
$msg = sprintf(__('Failed to send position reset notification: %s', 'litespeed-cache'), $ret) ;
@@ -340,15 +327,27 @@ class LiteSpeed_Cache_Crawler
340
public static function crawl_data($force = false)
341
{
342
if ( ! LiteSpeed_Cache_Router::can_crawl() ) {
343
- LiteSpeed_Cache_Log::debug('Crawler log: ......crawler is NOT allowed by the server admin......') ;
344
return false;
345
}
346
if ( $force ) {
347
- LiteSpeed_Cache_Log::debug('Crawler log: ......crawler manually ran......') ;
348
}
349
return self::get_instance()->_crawl_data($force) ;
350
}
351
352
/**
353
* Crawling start
354
*
@@ -358,12 +357,12 @@ class LiteSpeed_Cache_Crawler
358
*/
359
protected function _crawl_data($force)
360
{
361
- LiteSpeed_Cache_Log::debug('Crawler log: ......crawler started......') ;
362
// for the first time running
363
if ( ! file_exists($this->_sitemap_file) ) {
364
$ret = $this->_generate_sitemap() ;
365
if ( $ret !== true ) {
366
- LiteSpeed_Cache_Log::debug('Crawler log: ' . $ret) ;
367
return $this->output($ret) ;
368
}
369
}
@@ -375,10 +374,11 @@ class LiteSpeed_Cache_Crawler
375
if ( $last_fnished_at = $crawler->get_done_status() ) {
376
// check whole crawling interval
377
if ( ! $force && time() - $last_fnished_at < $options[LiteSpeed_Cache_Config::CRWL_CRAWL_INTERVAL] ) {
378
- LiteSpeed_Cache_Log::debug('Crawler log: Cron abort: cache warmed already.') ;
379
// if not reach whole crawling interval, exit
380
return;
381
}
382
$this->_generate_sitemap() ;
383
}
384
$crawler->set_base_url($this->_home_url) ;
@@ -406,6 +406,43 @@ class LiteSpeed_Cache_Crawler
406
if ( $options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP] ) {
407
$crawler->set_domain_ip($options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP]) ;
408
}
409
$ret = $crawler->engine_start() ;
410
411
// merge blacklist
@@ -414,22 +451,75 @@ class LiteSpeed_Cache_Crawler
414
}
415
416
if ( ! empty($ret['crawled']) ) {
417
- defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Crawler log: Last crawled ' . $ret[ 'crawled' ] . ' item(s)' ) ;
418
}
419
420
// return error
421
if ( $ret['error'] !== false ) {
422
- LiteSpeed_Cache_Log::debug('Crawler log: ' . $ret['error']) ;
423
return $this->output($ret['error']) ;
424
}
425
else {
426
- $msg = 'Reached end of sitemap file. Crawling completed.' ;
427
- $msg_t = __('Reached end of sitemap file. Crawling completed.', 'litespeed-cache') ;
428
- LiteSpeed_Cache_Log::debug('Crawler log: ' . $msg) ;
429
return $this->output($msg_t) ;
430
}
431
}
432
433
/**
434
* Output info and exit
435
*
38
}
39
$this->_blacklist_file = $this->_sitemap_file . '.blacklist' ;
40
41
+ LiteSpeed_Cache_Log::debug('Crawler: Initialized') ;
42
}
43
44
/**
57
return $this->_home_url . '/' . $metaUrl ;
58
}
59
60
/**
61
* Return blacklist content
62
*
124
*/
125
public function append_blacklist( $list )
126
{
127
+ defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Crawler: append blacklist ' . count( $list ) ) ;
128
129
$ori_list = Litespeed_File::read( $this->_blacklist_file ) ;
130
$ori_list = explode( "\n", $ori_list ) ;
136
// save blacklist
137
$ret = Litespeed_File::save( $this->_blacklist_file, $content, true, false, false ) ;
138
if ( $ret !== true ) {
139
+ LiteSpeed_Cache_Log::debug( 'Crawler: append blacklist failed: ' . $ret ) ;
140
return false ;
141
}
142
263
$blacklist = Litespeed_File::read( $this->_blacklist_file ) ;
264
$blacklist = explode( "\n", $blacklist ) ;
265
$urls = array_diff( $urls, $blacklist ) ;
266
+ LiteSpeed_Cache_Log::debug( 'Crawler: Generate sitemap' ) ;
267
268
$ret = Litespeed_File::save( $this->_sitemap_file, implode( "\n", $urls ), true, false, false ) ;
269
270
+ clearstatcache() ;
271
+
272
// refresh list size in meta
273
$crawler = new Litespeed_Crawler( $this->_sitemap_file ) ;
274
$crawler->refresh_list_size() ;
304
{
305
$crawler = new Litespeed_Crawler($this->_sitemap_file) ;
306
$ret = $crawler->reset_pos() ;
307
+ $log = 'Crawler: Reset pos. ' ;
308
if ( $ret !== true ) {
309
$log .= "Error: $ret" ;
310
$msg = sprintf(__('Failed to send position reset notification: %s', 'litespeed-cache'), $ret) ;
327
public static function crawl_data($force = false)
328
{
329
if ( ! LiteSpeed_Cache_Router::can_crawl() ) {
330
+ LiteSpeed_Cache_Log::debug('Crawler: ......crawler is NOT allowed by the server admin......') ;
331
return false;
332
}
333
if ( $force ) {
334
+ LiteSpeed_Cache_Log::debug('Crawler: ......crawler manually ran......') ;
335
}
336
return self::get_instance()->_crawl_data($force) ;
337
}
338
339
+ /**
340
+ * Receive meta info from crawler
341
+ *
342
+ * @since 1.9.1
343
+ * @access public
344
+ */
345
+ public function read_meta()
346
+ {
347
+ $crawler = new Litespeed_Crawler( $this->_sitemap_file ) ;
348
+ return $crawler->read_meta() ;
349
+ }
350
+
351
/**
352
* Crawling start
353
*
357
*/
358
protected function _crawl_data($force)
359
{
360
+ LiteSpeed_Cache_Log::debug('Crawler: ......crawler started......') ;
361
// for the first time running
362
if ( ! file_exists($this->_sitemap_file) ) {
363
$ret = $this->_generate_sitemap() ;
364
if ( $ret !== true ) {
365
+ LiteSpeed_Cache_Log::debug('Crawler: ' . $ret) ;
366
return $this->output($ret) ;
367
}
368
}
374
if ( $last_fnished_at = $crawler->get_done_status() ) {
375
// check whole crawling interval
376
if ( ! $force && time() - $last_fnished_at < $options[LiteSpeed_Cache_Config::CRWL_CRAWL_INTERVAL] ) {
377
+ LiteSpeed_Cache_Log::debug('Crawler: Cron abort: cache warmed already.') ;
378
// if not reach whole crawling interval, exit
379
return;
380
}
381
+ LiteSpeed_Cache_Log::debug( 'Crawler: TouchedEnd. regenerate sitemap....' ) ;
382
$this->_generate_sitemap() ;
383
}
384
$crawler->set_base_url($this->_home_url) ;
406
if ( $options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP] ) {
407
$crawler->set_domain_ip($options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP]) ;
408
}
409
+
410
+ // Get current crawler
411
+ $meta = $crawler->read_meta() ;
412
+ $curr_crawler_pos = $meta[ 'curr_crawler' ] ;
413
+
414
+ // Generate all crawlers
415
+ $crawlers = $this->list_crawlers() ;
416
+
417
+ // In case crawlers are all done but not reload, reload it
418
+ if ( empty( $crawlers[ $curr_crawler_pos ] ) ) {
419
+ $curr_crawler_pos = 0 ;
420
+ }
421
+ $current_crawler = $crawlers[ $curr_crawler_pos ] ;
422
+ /**
423
+ * Set role simulation
424
+ * @since 1.9.1
425
+ */
426
+ if ( $current_crawler[ 'uid' ] ) {
427
+ // Get role simulation vary name
428
+ $vary_inst = LiteSpeed_Cache_Vary::get_instance() ;
429
+ $vary_name = $vary_inst->get_vary_name() ;
430
+ $vary_val = $vary_inst->finalize_default_vary( $current_crawler[ 'uid' ] ) ;
431
+ $cookies = array(
432
+ $vary_name => $vary_val,
433
+ 'litespeed_role' => $current_crawler[ 'uid' ],
434
+ ) ;
435
+
436
+ $crawler->set_cookies( $cookies ) ;
437
+ }
438
+ /**
439
+ * Set WebP simulation
440
+ * @since 1.9.1
441
+ */
442
+ if ( $current_crawler[ 'webp' ] ) {
443
+ $crawler->set_headers( array( 'Accept: image/webp,*/*' ) ) ;
444
+ }
445
+
446
$ret = $crawler->engine_start() ;
447
448
// merge blacklist
451
}
452
453
if ( ! empty($ret['crawled']) ) {
454
+ defined( 'LSCWP_LOG' ) && LiteSpeed_Cache_Log::debug( 'Crawler: Last crawled ' . $ret[ 'crawled' ] . ' item(s)' ) ;
455
}
456
457
// return error
458
if ( $ret['error'] !== false ) {
459
+ LiteSpeed_Cache_Log::debug('Crawler: ' . $ret['error']) ;
460
return $this->output($ret['error']) ;
461
}
462
else {
463
+ $msg = 'Crawler #' . ( $curr_crawler_pos + 1 ) . ' reached end of sitemap file.' ;
464
+ $msg_t = sprintf( __( 'Crawler %s reached end of sitemap file.', 'litespeed-cache' ), '#' . ( $curr_crawler_pos + 1 ) ) ;
465
+ LiteSpeed_Cache_Log::debug('Crawler: ' . $msg) ;
466
return $this->output($msg_t) ;
467
}
468
}
469
470
+ /**
471
+ * List all crawlers
472
+ *
473
+ * @since 1.9.1
474
+ * @access public
475
+ */
476
+ public function list_crawlers( $count_only = false )
477
+ {
478
+ // Get roles set
479
+ $roles = get_option( LiteSpeed_Cache_Config::ITEM_CRWL_AS_UIDS ) ;
480
+ $roles = $roles ? explode( "\n", $roles ) : array() ;
481
+
482
+ // WebP on/off
483
+ $webp = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_WEBP ) ;
484
+
485
+ if ( $count_only ) {
486
+ $count = count( $roles ) + 1 ;
487
+ if ( $webp ) {
488
+ $count *= 2 ;
489
+ }
490
+ return $count ;
491
+ }
492
+
493
+ $crawler_list = array(
494
+ array( 'uid' => 0, 'role_title' => __( 'Guest', 'litespeed-cache' ), 'webp' => 0 ),
495
+ ) ;
496
+
497
+ if ( $webp ) {
498
+ $crawler_list[] = array( 'uid' => 0, 'role_title' => __( 'Guest', 'litespeed-cache' ), 'webp' => 1 ) ;
499
+ }
500
+
501
+ // List all roles
502
+ foreach ( $roles as $v ) {
503
+ $role_title = '' ;
504
+ $udata = get_userdata( $v ) ;
505
+ if ( isset( $udata->roles ) && is_array( $udata->roles ) ) {
506
+ $tmp = array_values( $udata->roles ) ;
507
+ $role_title = array_shift( $tmp ) ;
508
+ }
509
+ if ( ! $role_title ) {
510
+ continue ;
511
+ }
512
+ $crawler_list[] = array( 'uid' => $v, 'role_title' => $role_title, 'webp' => 0 ) ;
513
+
514
+ if ( $webp ) {
515
+ $crawler_list[] = array( 'uid' => $v, 'role_title' => $role_title, 'webp' => 1 ) ;
516
+ }
517
+ }
518
+
519
+ return $crawler_list ;
520
+
521
+ }
522
+
523
/**
524
* Output info and exit
525
*
inc/gui.class.php CHANGED
@@ -260,8 +260,8 @@ class LiteSpeed_Cache_GUI
260
261
$wp_admin_bar->add_menu( array(
262
'id' => 'litespeed-menu',
263
- 'title' => '<span class="ab-icon"></span><span class="ab-label">' . __( 'LiteSpeed Cache Purge All', 'litespeed-cache' ) . '</span>',
264
- 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
265
'meta' => array( 'tabindex' => 0, 'class' => 'litespeed-top-toolbar' ),
266
) ) ;
267
@@ -291,6 +291,14 @@ class LiteSpeed_Cache_GUI
291
) );
292
}
293
294
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
295
$wp_admin_bar->add_menu( array(
296
'parent' => 'litespeed-menu',
260
261
$wp_admin_bar->add_menu( array(
262
'id' => 'litespeed-menu',
263
+ 'title' => '<span class="ab-icon" title="' . __( 'LiteSpeed Cache Purge All', 'litespeed-cache' ) . '""></span>',
264
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
265
'meta' => array( 'tabindex' => 0, 'class' => 'litespeed-top-toolbar' ),
266
) ) ;
267
291
) );
292
}
293
294
+ $wp_admin_bar->add_menu( array(
295
+ 'parent' => 'litespeed-menu',
296
+ 'id' => 'litespeed-purge-all',
297
+ 'title' => __( 'LiteSpeed Cache Purge All', 'litespeed-cache' ),
298
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_PURGE_ALL ),
299
+ 'meta' => array( 'tabindex' => '0' ),
300
+ ) );
301
+
302
if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_CLOUDFLARE ) ) {
303
$wp_admin_bar->add_menu( array(
304
'parent' => 'litespeed-menu',
inc/import.class.php CHANGED
@@ -46,6 +46,7 @@ class LiteSpeed_Cache_Import
46
LiteSpeed_Cache_Config::ITEM_LOG_IGNORE_PART_FILTERS,
47
LiteSpeed_Cache_Config::ITEM_OBJECT_GLOBAL_GROUPS,
48
LiteSpeed_Cache_Config::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
49
) ;
50
}
51
46
LiteSpeed_Cache_Config::ITEM_LOG_IGNORE_PART_FILTERS,
47
LiteSpeed_Cache_Config::ITEM_OBJECT_GLOBAL_GROUPS,
48
LiteSpeed_Cache_Config::ITEM_OBJECT_NON_PERSISTENT_GROUPS,
49
+ LiteSpeed_Cache_Config::ITEM_CRWL_AS_UIDS,
50
) ;
51
}
52
inc/litespeed-cache.class.php CHANGED
@@ -19,7 +19,7 @@ class LiteSpeed_Cache
19
private static $_instance ;
20
21
const PLUGIN_NAME = 'litespeed-cache' ;
22
- const PLUGIN_VERSION = '1.8.3' ;
23
24
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
@@ -95,6 +95,13 @@ class LiteSpeed_Cache
95
include_once LSCWP_DIR . 'thirdparty/lscwp-registry-3rd.php' ;
96
}
97
98
// Register plugin activate/deactivate/uninstall hooks
99
// NOTE: this can't be moved under after_setup_theme, otherwise activation will be bypassed somehow
100
if( is_admin() || defined( 'LITESPEED_CLI' ) ) {
@@ -146,10 +153,6 @@ class LiteSpeed_Cache
146
*/
147
do_action( 'litespeed_init' ) ;
148
149
- define( 'LSCWP_CONTENT_FOLDER', str_replace( home_url( '/' ), '', WP_CONTENT_URL ) ) ; // `wp-content`
150
- define( 'LSWCP_PLUGIN_URL', plugin_dir_url( dirname( __FILE__ ) ) ) ;// Full URL path '//example.com/wp-content/plugins/litespeed-cache/'
151
-
152
-
153
if ( ! self::config( LiteSpeed_Cache_Config::OPID_HEARTBEAT ) ) {
154
add_action( 'init', 'LiteSpeed_Cache_Log::disable_heartbeat', 1 ) ;
155
}
@@ -162,6 +165,8 @@ class LiteSpeed_Cache
162
return ;
163
}
164
165
ob_start( array( $this, 'send_headers_force' ) ) ;
166
add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
167
add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
19
private static $_instance ;
20
21
const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '1.9.1.1' ;
23
24
const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
95
include_once LSCWP_DIR . 'thirdparty/lscwp-registry-3rd.php' ;
96
}
97
98
+ /**
99
+ * This needs to be before activation because admin-rules.class.php need const `LSCWP_CONTENT_FOLDER`
100
+ * @since 1.9.1 Moved up
101
+ */
102
+ define( 'LSCWP_CONTENT_FOLDER', str_replace( home_url( '/' ), '', WP_CONTENT_URL ) ) ; // `wp-content`
103
+ define( 'LSWCP_PLUGIN_URL', plugin_dir_url( dirname( __FILE__ ) ) ) ;// Full URL path '//example.com/wp-content/plugins/litespeed-cache/'
104
+
105
// Register plugin activate/deactivate/uninstall hooks
106
// NOTE: this can't be moved under after_setup_theme, otherwise activation will be bypassed somehow
107
if( is_admin() || defined( 'LITESPEED_CLI' ) ) {
153
*/
154
do_action( 'litespeed_init' ) ;
155
156
if ( ! self::config( LiteSpeed_Cache_Config::OPID_HEARTBEAT ) ) {
157
add_action( 'init', 'LiteSpeed_Cache_Log::disable_heartbeat', 1 ) ;
158
}
165
return ;
166
}
167
168
+ LiteSpeed_Cache_Router::get_instance()->is_crawler_role_simulation() ;
169
+
170
ob_start( array( $this, 'send_headers_force' ) ) ;
171
add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
172
add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
inc/litespeed.autoload.php CHANGED
@@ -38,6 +38,7 @@ if ( !function_exists('_litespeed_autoload') ) {
38
'LiteSpeed_Cache_Media' => 'inc/media.class.php',
39
'LiteSpeed_Cache_Object' => 'inc/object.class.php',
40
'LiteSpeed_Cache_Optimize' => 'inc/optimize.class.php',
41
'LiteSpeed_Cache_Purge' => 'inc/purge.class.php',
42
'LiteSpeed_Cache_Router' => 'inc/router.class.php',
43
'LiteSpeed_Cache_Tag' => 'inc/tag.class.php',
@@ -58,6 +59,8 @@ if ( !function_exists('_litespeed_autoload') ) {
58
'LiteSpeed_Cache_Cli_Purge' => 'cli/litespeed-cache-cli-purge.class.php',
59
60
'LiteSpeed_Cache_Tags' => 'includes/deprecated-litespeed-cache-tags.class.php',
61
);
62
if( array_key_exists($cls, $class2fileArr) && file_exists(LSCWP_DIR . $class2fileArr[$cls]) ) {
63
require_once LSCWP_DIR . $class2fileArr[$cls];
38
'LiteSpeed_Cache_Media' => 'inc/media.class.php',
39
'LiteSpeed_Cache_Object' => 'inc/object.class.php',
40
'LiteSpeed_Cache_Optimize' => 'inc/optimize.class.php',
41
+ 'LiteSpeed_Cache_Optimizer' => 'inc/optimizer.class.php',
42
'LiteSpeed_Cache_Purge' => 'inc/purge.class.php',
43
'LiteSpeed_Cache_Router' => 'inc/router.class.php',
44
'LiteSpeed_Cache_Tag' => 'inc/tag.class.php',
59
'LiteSpeed_Cache_Cli_Purge' => 'cli/litespeed-cache-cli-purge.class.php',
60
61
'LiteSpeed_Cache_Tags' => 'includes/deprecated-litespeed-cache-tags.class.php',
62
+
63
+ 'Minify_HTML' => 'lib/html_min.class.php',
64
);
65
if( array_key_exists($cls, $class2fileArr) && file_exists(LSCWP_DIR . $class2fileArr[$cls]) ) {
66
require_once LSCWP_DIR . $class2fileArr[$cls];
inc/object.class.php CHANGED
File without changes
inc/object.lib.php CHANGED
File without changes
inc/optimize.class.php CHANGED
@@ -217,26 +217,23 @@ class LiteSpeed_Cache_Optimize
217
// Proceed css/js file generation
218
define( 'LITESPEED_MIN_FILE', true ) ;
219
220
- $result = $this->_minify( $match[ 1 ] ) ;
221
222
- if ( ! $result ) {
223
LiteSpeed_Cache_Control::set_nocache( 'Empty content from optimizer' ) ;
224
exit ;
225
}
226
227
- foreach ( $result[ 'headers' ] as $key => $val ) {
228
- if ( in_array( $key, array( 'Content-Length', 'Content-Type' ) ) ) {
229
- header( $key . ': ' . $val ) ;
230
- }
231
- }
232
-
233
LiteSpeed_Cache_Control::set_cacheable() ;
234
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
235
LiteSpeed_Cache_Control::set_no_vary() ;
236
LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
237
LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
238
239
- echo $result[ 'content' ] ;
240
exit ;
241
}
242
@@ -605,8 +602,7 @@ class LiteSpeed_Cache_Optimize
605
606
set_error_handler( 'litespeed_exception_handler' ) ;
607
try {
608
- litespeed_load_vendor() ;
609
- $this->content = Minify_HTML::minify( $this->content ) ;
610
$this->content .= "\n" . '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
611
612
} catch ( ErrorException $e ) {
@@ -828,50 +824,6 @@ class LiteSpeed_Cache_Optimize
828
return array( $ignored_html, $src_queue_list, $file_size_list ) ;
829
}
830
831
- /**
832
- * Run minify process and return final content
833
- *
834
- * @since 1.2.2
835
- * @access private
836
- * @return string The final content
837
- */
838
- private function _minify( $filename )
839
- {
840
- // Search filename in db for src URLs
841
- $urls = LiteSpeed_Cache_Data::optm_hash2src( $filename ) ;
842
- if ( ! $urls || ! is_array( $urls ) ) {
843
- return false;
844
- }
845
-
846
- $file_type = substr( $filename, strrpos( $filename, '.' ) + 1 ) ;
847
-
848
- // Parse real file path
849
- $real_files = array() ;
850
- foreach ( $urls as $url ) {
851
- $real_file = LiteSpeed_Cache_Utility::is_internal_file( $url ) ;
852
- if ( ! $real_file ) {
853
- continue ;
854
- }
855
- $real_files[] = $real_file[ 0 ] ;
856
- }
857
-
858
- if ( ! $real_files ) {
859
- return false;
860
- }
861
-
862
- // Request to minify
863
- $result = $this->_minify_serve( $real_files, $file_type ) ;
864
-
865
- if ( empty( $result[ 'success' ] ) ) {
866
- LiteSpeed_Cache_Log::debug( 'Optm: Lib serve failed ' . $result[ 'statusCode' ] ) ;
867
- return false ;
868
- }
869
-
870
- LiteSpeed_Cache_Log::debug( 'Optm: Generated content' ) ;
871
-
872
- return $result ;
873
- }
874
-
875
/**
876
* Generate full URL path with hash for a list of src
877
*
@@ -1188,100 +1140,6 @@ class LiteSpeed_Cache_Optimize
1188
$this->http2_headers[] = '<' . $uri . '>; rel=preload; as=' . ( $file_type === 'css' ? 'style' : 'script' ) ;
1189
}
1190
1191
- /**
1192
- * Run minify serve
1193
- *
1194
- * @since 1.2.2
1195
- * @access private
1196
- * @param array|string $files The file(s) to minify/combine
1197
- * @return string The string after effect
1198
- */
1199
- private function _minify_serve( $files, $file_type )
1200
- {
1201
- set_error_handler( 'litespeed_exception_handler' ) ;
1202
- try {
1203
- litespeed_load_vendor() ;
1204
- if ( ! isset( $this->minify_cache ) ) {
1205
- $this->minify_cache = new Minify_Cache_File() ;
1206
- }
1207
- if ( ! isset( $this->minify_minify ) ) {
1208
- $this->minify_minify = new Minify( $this->minify_cache ) ;
1209
- }
1210
- if ( ! isset( $this->minify_env ) ) {
1211
- $this->minify_env = new Minify_Env() ;
1212
- }
1213
- if ( ! isset( $this->minify_sourceFactory ) ) {
1214
- $this->minify_sourceFactory = new Minify_Source_Factory( $this->minify_env, array(), $this->minify_cache ) ;
1215
- }
1216
- if ( ! isset( $this->minify_controller ) ) {
1217
- $this->minify_controller = new Minify_Controller_Files( $this->minify_env, $this->minify_sourceFactory ) ;
1218
- }
1219
- if ( ! isset( $this->minify_options ) ) {
1220
- $this->minify_options = array(
1221
- 'encodeOutput' => false,
1222
- 'quiet' => true,
1223
- ) ;
1224
- }
1225
-
1226
- $this->minify_options[ 'concatOnly' ] = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
1227
-
1228
- $this->minify_options[ 'files' ] = $files ;
1229
-
1230
- /**
1231
- * Clean comment when minify
1232
- * @since 1.7.1
1233
- */
1234
- if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_RM_COMMENT ) ) {
1235
- $this->minify_options[ 'postprocessor' ] = __CLASS__ . '::remove_comment' ;
1236
- }
1237
-
1238
- $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1239
-
1240
- } catch ( ErrorException $e ) {
1241
- LiteSpeed_Cache_Log::debug( 'Error when serving from optimizer: ' . $e->getMessage() ) ;
1242
- error_log( 'LiteSpeed Optimizer serving Error: ' . $e->getMessage() ) ;
1243
- return false ;
1244
- }
1245
- restore_error_handler() ;
1246
-
1247
- return $content ;
1248
- }
1249
-
1250
- /**
1251
- * Remove comment when minify
1252
- *
1253
- * @since 1.7.1
1254
- * @access public
1255
- */
1256
- public static function remove_comment( $content, $type )
1257
- {
1258
- $_from = array(
1259
- '|\/\*.*\*\/|U',
1260
- '|\/\*.*\*\/|sU',
1261
- "|\n+|",
1262
- // "|;+\n*;+|",
1263
- // "|\n+;|",
1264
- // "|;\n+|"
1265
- ) ;
1266
-
1267
- $_to = array(
1268
- '',
1269
- "\n",
1270
- "\n",
1271
- // ';',
1272
- // ';',
1273
- // ';',
1274
- ) ;
1275
-
1276
- $content = preg_replace( $_from, $_to, $content ) ;
1277
- if ( $type == 'text/css' ) {
1278
- $content = preg_replace( "|: *|", ':', $content ) ;
1279
- $content = preg_replace( "| */ *|", '/', $content ) ;
1280
- }
1281
- $content = trim( $content ) ;
1282
- return $content ;
1283
- }
1284
-
1285
/**
1286
* Get the current instance object.
1287
*
217
// Proceed css/js file generation
218
define( 'LITESPEED_MIN_FILE', true ) ;
219
220
+ $file_type = substr( $match[ 1 ], strrpos( $match[ 1 ], '.' ) + 1 ) ;
221
+ $concat_only = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
222
223
+ $content = LiteSpeed_Cache_Optimizer::get_instance()->serve( $match[ 1 ], $concat_only ) ;
224
+
225
+ if ( ! $content ) {
226
LiteSpeed_Cache_Control::set_nocache( 'Empty content from optimizer' ) ;
227
exit ;
228
}
229
230
LiteSpeed_Cache_Control::set_cacheable() ;
231
LiteSpeed_Cache_Control::set_public_forced( 'OPTM: min file ' . $match[ 1 ] ) ;
232
LiteSpeed_Cache_Control::set_no_vary() ;
233
LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
234
LiteSpe