LiteSpeed Cache - Version 1.5

Version Description

  • October 17 2017 =
  • [NEW FEATURE] Exclude JQuery (to fix inline JS error when using JS Combine).
  • [NEW FEATURE] Load JQuery Remotely.
  • [NEW FEATURE] JS Deferred Excludes.
  • [NEW FEATURE] Lazy Load Images Excludes.
  • [NEW FEATURE] Lazy Load Image Placeholder.
  • [IMPROVEMENT] Improved Lazy Load size attribute for w3c validator.
  • [UPDATE] Added basic caching info and LSCWP version to HTML comment.
  • [UPDATE] Added debug log to HTML detection.
  • [BUGFIX] Fixed potential font CORS issue when using CDN.
  • [GUI] Added API docs to setting description.
  • [REFACTOR] Relocated all classes under includes with backwards compatibility.
  • [REFACTOR] Relocated admin templates.
Download this release

Release Info

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

Code changes from version 1.4 to 1.5

Files changed (360) hide show
  1. admin/admin-api.class.php +201 -0
  2. admin/class-litespeed-cache-admin.php +0 -0
  3. admin/litespeed-cache-admin-display.class.php +45 -19
  4. admin/litespeed-cache-admin-error.class.php +0 -0
  5. admin/litespeed-cache-admin-optimize.class.php +0 -0
  6. admin/litespeed-cache-admin-report.class.php +0 -0
  7. admin/litespeed-cache-admin-rules.class.php +28 -0
  8. admin/litespeed-cache-admin-settings.class.php +21 -0
  9. admin/litespeed-cache-admin.class.php +0 -0
  10. admin/tpl/crawler.php +0 -0
  11. admin/tpl/debug_log.php +0 -0
  12. admin/tpl/edit_htaccess.php +2 -2
  13. admin/tpl/esi_widget_edit.php +0 -0
  14. admin/tpl/{admin_footer.php → inc/admin_footer.php} +0 -0
  15. admin/tpl/{banner_promo.php → inc/banner_promo.php} +0 -0
  16. admin/tpl/inc/check_cache_disabled.php +12 -0
  17. admin/tpl/{help_tabs.php → inc/help_tabs.php} +0 -0
  18. admin/tpl/{show_display_installed.php → inc/show_display_installed.php} +0 -0
  19. admin/tpl/{show_error_cookie.php → inc/show_error_cookie.php} +0 -0
  20. admin/tpl/{show_rule_conflict.php → inc/show_rule_conflict.php} +0 -0
  21. admin/tpl/info.php +1 -1
  22. admin/tpl/{info_admin_ip.php → info/info_admin_ip.php} +0 -0
  23. admin/tpl/{info_common_rewrite.php → info/info_common_rewrite.php} +0 -0
  24. admin/tpl/{info_compatibility.php → info/info_compatibility.php} +0 -0
  25. admin/tpl/{info_config.php → info/info_config.php} +0 -0
  26. admin/tpl/{info_crawler.php → info/info_crawler.php} +0 -0
  27. admin/tpl/{info_faqs.php → info/info_faqs.php} +0 -0
  28. admin/tpl/manage.php +3 -7
  29. admin/tpl/{manage_db.php → manage/manage_db.php} +0 -0
  30. admin/tpl/{manage_purge.php → manage/manage_purge.php} +0 -0
  31. admin/tpl/network_settings.php +2 -2
  32. admin/tpl/report.php +0 -0
  33. admin/tpl/{network_settings_cache.php → setting/network_settings_cache.php} +4 -4
  34. admin/tpl/{network_settings_excludes.php → setting/network_settings_excludes.php} +2 -2
  35. admin/tpl/{network_settings_general.php → setting/network_settings_general.php} +0 -0
  36. admin/tpl/{network_settings_purge.php → setting/network_settings_purge.php} +1 -1
  37. admin/tpl/{settings_advanced.php → setting/settings_advanced.php} +0 -0
  38. admin/tpl/{settings_cache.php → setting/settings_cache.php} +4 -4
  39. admin/tpl/{settings_cdn.php → setting/settings_cdn.php} +31 -3
  40. admin/tpl/{settings_compatibilities.php → setting/settings_compatibilities.php} +0 -0
  41. admin/tpl/{settings_crawler.php → setting/settings_crawler.php} +0 -0
  42. admin/tpl/{settings_debug.php → setting/settings_debug.php} +0 -0
  43. admin/tpl/{settings_esi.php → setting/settings_esi.php} +0 -0
  44. admin/tpl/{settings_excludes.php → setting/settings_excludes.php} +2 -2
  45. admin/tpl/{settings_general.php → setting/settings_general.php} +0 -0
  46. admin/tpl/{settings_inc.cache_browser.php → setting/settings_inc.cache_browser.php} +3 -3
  47. admin/tpl/{settings_inc.cache_favicon.php → setting/settings_inc.cache_favicon.php} +2 -2
  48. admin/tpl/{settings_inc.cache_mobile.php → setting/settings_inc.cache_mobile.php} +3 -4
  49. admin/tpl/{settings_inc.cache_resources.php → setting/settings_inc.cache_resources.php} +2 -2
  50. admin/tpl/{settings_inc.exclude_cookies.php → setting/settings_inc.exclude_cookies.php} +2 -2
  51. admin/tpl/{settings_inc.exclude_useragent.php → setting/settings_inc.exclude_useragent.php} +2 -2
  52. admin/tpl/{settings_inc.purge_on_upgrade.php → setting/settings_inc.purge_on_upgrade.php} +0 -0
  53. admin/tpl/setting/settings_media.php +62 -0
  54. admin/tpl/{settings_optimize.php → setting/settings_optimize.php} +46 -1
  55. admin/tpl/{settings_purge.php → setting/settings_purge.php} +1 -1
  56. admin/tpl/settings.php +2 -2
  57. admin/tpl/settings_media.php +0 -32
  58. cli/litespeed-cache-cli-admin.class.php +2 -0
  59. cli/litespeed-cache-cli-purge.class.php +0 -0
  60. css/litespeed.css +5 -0
  61. img/Litespeed.icon.svg +0 -0
  62. img/icons/purge-cssjs.svg +0 -0
  63. img/lscwp-logo_256x256.png +0 -0
  64. inc/activation.class.php +236 -0
  65. inc/api.class.php +5 -4
  66. inc/cdn.class.php +451 -0
  67. inc/config.class.php +851 -0
  68. inc/control.class.php +611 -0
  69. inc/crawler-sitemap.class.php +5 -4
  70. inc/crawler.class.php +451 -0
  71. inc/data.class.php +5 -4
  72. inc/esi.class.php +554 -0
  73. inc/gui.class.php +196 -0
  74. inc/litespeed-cache.class.php +632 -0
  75. inc/litespeed.autoload.php +78 -0
  76. inc/log.class.php +322 -0
  77. inc/media.class.php +28 -7
  78. inc/optimize.class.php +1112 -0
  79. inc/purge.class.php +754 -0
  80. inc/router.class.php +452 -0
  81. inc/tag.class.php +368 -0
  82. inc/task.class.php +129 -0
  83. inc/utility.class.php +279 -0
  84. inc/vary.class.php +466 -0
  85. includes/advanced-cache.php +0 -0
  86. includes/deprecated-litespeed-cache-tags.class.php +0 -0
  87. includes/litespeed-cache-activation.class.php +5 -4
  88. includes/litespeed-cache-api.class.php +450 -0
  89. includes/litespeed-cache-cdn.class.php +42 -4
  90. includes/litespeed-cache-config.class.php +14 -4
  91. includes/litespeed-cache-control.class.php +5 -4
  92. includes/litespeed-cache-crawler.class.php +5 -4
  93. includes/litespeed-cache-esi.class.php +5 -4
  94. includes/litespeed-cache-gui.class.php +5 -4
  95. includes/litespeed-cache-log.class.php +5 -4
  96. includes/litespeed-cache-optimize.class.php +129 -19
  97. includes/litespeed-cache-purge.class.php +5 -4
  98. includes/litespeed-cache-router.class.php +24 -5
  99. includes/litespeed-cache-tag.class.php +5 -4
  100. includes/litespeed-cache-task.class.php +5 -4
  101. includes/litespeed-cache-utility.class.php +5 -4
  102. includes/litespeed-cache-vary.class.php +5 -4
  103. includes/litespeed-cache.class.php +36 -22
  104. includes/litespeed.autoload.php +22 -20
  105. js/css_async.js +0 -0
  106. js/{lazyload.js → lazyload.init.js} +0 -0
  107. js/lazyload.lib.js +261 -0
  108. js/lazyload.min.js +1 -1
  109. languages/litespeed-cache.pot +928 -792
  110. lib/litespeed-php-compatibility.func.php +0 -0
  111. lib/litespeed/litespeed-crawler.class.php +0 -0
  112. lib/litespeed/litespeed-file.class.php +0 -0
  113. lib/litespeed/litespeed-string.class.php +0 -0
  114. lib/vendor/autoload.php +0 -0
  115. lib/vendor/composer/ClassLoader.php +0 -0
  116. lib/vendor/composer/LICENSE +0 -0
  117. lib/vendor/composer/autoload_classmap.php +0 -0
  118. lib/vendor/composer/autoload_namespaces.php +0 -0
  119. lib/vendor/composer/autoload_psr4.php +0 -0
  120. lib/vendor/composer/autoload_real.php +0 -0
  121. lib/vendor/composer/autoload_static.php +0 -0
  122. lib/vendor/container-interop/container-interop/LICENSE +0 -0
  123. lib/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php +0 -0
  124. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php +0 -0
  125. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php +0 -0
  126. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php +0 -0
  127. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php +0 -0
  128. lib/vendor/monolog/monolog/.php_cs +0 -0
  129. lib/vendor/monolog/monolog/LICENSE +0 -0
  130. lib/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +0 -0
  131. lib/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +0 -0
  132. lib/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +0 -0
  133. lib/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +0 -0
  134. lib/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +0 -0
  135. lib/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php +0 -0
  136. lib/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +0 -0
  137. lib/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +0 -0
  138. lib/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +0 -0
  139. lib/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +0 -0
  140. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +0 -0
  141. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +0 -0
  142. lib/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +0 -0
  143. lib/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +0 -0
  144. lib/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php +0 -0
  145. lib/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +0 -0
  146. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +0 -0
  147. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +0 -0
  148. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +0 -0
  149. lib/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +0 -0
  150. lib/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +0 -0
  151. lib/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +0 -0
  152. lib/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +0 -0
  153. lib/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +0 -0
  154. lib/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +0 -0
  155. lib/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +0 -0
  156. lib/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +0 -0
  157. lib/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +0 -0
  158. lib/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +0 -0
  159. lib/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +0 -0
  160. lib/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +0 -0
  161. lib/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +0 -0
  162. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +0 -0
  163. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +0 -0
  164. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +0 -0
  165. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +0 -0
  166. lib/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +0 -0
  167. lib/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +0 -0
  168. lib/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +0 -0
  169. lib/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +0 -0
  170. lib/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +0 -0
  171. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +0 -0
  172. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +0 -0
  173. lib/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +0 -0
  174. lib/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +0 -0
  175. lib/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +0 -0
  176. lib/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +0 -0
  177. lib/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +0 -0
  178. lib/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +0 -0
  179. lib/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php +0 -0
  180. lib/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +0 -0
  181. lib/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +0 -0
  182. lib/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +0 -0
  183. lib/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +0 -0
  184. lib/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +0 -0
  185. lib/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +0 -0
  186. lib/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +0 -0
  187. lib/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +0 -0
  188. lib/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +0 -0
  189. lib/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +0 -0
  190. lib/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +0 -0
  191. lib/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +0 -0
  192. lib/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +0 -0
  193. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +0 -0
  194. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +0 -0
  195. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php +0 -0
  196. lib/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +0 -0
  197. lib/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +0 -0
  198. lib/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +0 -0
  199. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +0 -0
  200. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +0 -0
  201. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +0 -0
  202. lib/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +0 -0
  203. lib/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +0 -0
  204. lib/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +0 -0
  205. lib/vendor/monolog/monolog/src/Monolog/Logger.php +0 -0
  206. lib/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +0 -0
  207. lib/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +0 -0
  208. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +0 -0
  209. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +0 -0
  210. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +0 -0
  211. lib/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +0 -0
  212. lib/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +0 -0
  213. lib/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +0 -0
  214. lib/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +0 -0
  215. lib/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +0 -0
  216. lib/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +0 -0
  217. lib/vendor/monolog/monolog/src/Monolog/Registry.php +0 -0
  218. lib/vendor/mrclay/jsmin-php/.editorconfig +0 -0
  219. lib/vendor/mrclay/jsmin-php/HISTORY.txt +0 -0
  220. lib/vendor/mrclay/jsmin-php/LICENSE.txt +0 -0
  221. lib/vendor/mrclay/jsmin-php/src/JSMin/JSMin.php +0 -0
  222. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedCommentException.php +0 -0
  223. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedRegExpException.php +0 -0
  224. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedStringException.php +0 -0
  225. lib/vendor/mrclay/minify/.htaccess +0 -0
  226. lib/vendor/mrclay/minify/.php_cs +0 -0
  227. lib/vendor/mrclay/minify/.travis.yml +0 -0
  228. lib/vendor/mrclay/minify/LICENSE.txt +0 -0
  229. lib/vendor/mrclay/minify/bootstrap.php +0 -0
  230. lib/vendor/mrclay/minify/config-test.php +0 -0
  231. lib/vendor/mrclay/minify/config.php +0 -0
  232. lib/vendor/mrclay/minify/groupsConfig.php +0 -0
  233. lib/vendor/mrclay/minify/lib/HTTP/ConditionalGet.php +0 -0
  234. lib/vendor/mrclay/minify/lib/HTTP/Encoder.php +0 -0
  235. lib/vendor/mrclay/minify/lib/Minify.php +0 -0
  236. lib/vendor/mrclay/minify/lib/Minify/App.php +0 -0
  237. lib/vendor/mrclay/minify/lib/Minify/Build.php +0 -0
  238. lib/vendor/mrclay/minify/lib/Minify/CSS.php +0 -0
  239. lib/vendor/mrclay/minify/lib/Minify/CSS/Compressor.php +0 -0
  240. lib/vendor/mrclay/minify/lib/Minify/CSS/UriRewriter.php +0 -0
  241. lib/vendor/mrclay/minify/lib/Minify/CSSmin.php +0 -0
  242. lib/vendor/mrclay/minify/lib/Minify/Cache/APC.php +0 -0
  243. lib/vendor/mrclay/minify/lib/Minify/Cache/File.php +0 -0
  244. lib/vendor/mrclay/minify/lib/Minify/Cache/Memcache.php +0 -0
  245. lib/vendor/mrclay/minify/lib/Minify/Cache/Null.php +0 -0
  246. lib/vendor/mrclay/minify/lib/Minify/Cache/WinCache.php +0 -0
  247. lib/vendor/mrclay/minify/lib/Minify/Cache/XCache.php +0 -0
  248. lib/vendor/mrclay/minify/lib/Minify/Cache/ZendPlatform.php +0 -0
  249. lib/vendor/mrclay/minify/lib/Minify/CacheInterface.php +0 -0
  250. lib/vendor/mrclay/minify/lib/Minify/ClosureCompiler.php +0 -0
  251. lib/vendor/mrclay/minify/lib/Minify/CommentPreserver.php +0 -0
  252. lib/vendor/mrclay/minify/lib/Minify/Config.php +0 -0
  253. lib/vendor/mrclay/minify/lib/Minify/Controller/Base.php +0 -0
  254. lib/vendor/mrclay/minify/lib/Minify/Controller/Files.php +0 -0
  255. lib/vendor/mrclay/minify/lib/Minify/Controller/Groups.php +0 -0
  256. lib/vendor/mrclay/minify/lib/Minify/Controller/MinApp.php +0 -0
  257. lib/vendor/mrclay/minify/lib/Minify/Controller/Page.php +0 -0
  258. lib/vendor/mrclay/minify/lib/Minify/ControllerInterface.php +0 -0
  259. lib/vendor/mrclay/minify/lib/Minify/DebugDetector.php +0 -0
  260. lib/vendor/mrclay/minify/lib/Minify/Env.php +0 -0
  261. lib/vendor/mrclay/minify/lib/Minify/HTML.php +0 -0
  262. lib/vendor/mrclay/minify/lib/Minify/HTML/Helper.php +0 -0
  263. lib/vendor/mrclay/minify/lib/Minify/ImportProcessor.php +0 -0
  264. lib/vendor/mrclay/minify/lib/Minify/JS/ClosureCompiler.php +0 -0
  265. lib/vendor/mrclay/minify/lib/Minify/JS/JShrink.php +0 -0
  266. lib/vendor/mrclay/minify/lib/Minify/LessCssSource.php +0 -0
  267. lib/vendor/mrclay/minify/lib/Minify/Lines.php +0 -0
  268. lib/vendor/mrclay/minify/lib/Minify/Logger/LegacyHandler.php +0 -0
  269. lib/vendor/mrclay/minify/lib/Minify/NailgunClosureCompiler.php +0 -0
  270. lib/vendor/mrclay/minify/lib/Minify/Packer.php +0 -0
  271. lib/vendor/mrclay/minify/lib/Minify/ScssCssSource.php +0 -0
  272. lib/vendor/mrclay/minify/lib/Minify/ServeConfiguration.php +0 -0
  273. lib/vendor/mrclay/minify/lib/Minify/Source.php +0 -0
  274. lib/vendor/mrclay/minify/lib/Minify/Source/Factory.php +0 -0
  275. lib/vendor/mrclay/minify/lib/Minify/Source/FactoryException.php +0 -0
  276. lib/vendor/mrclay/minify/lib/Minify/SourceInterface.php +0 -0
  277. lib/vendor/mrclay/minify/lib/Minify/SourceSet.php +0 -0
  278. lib/vendor/mrclay/minify/lib/Minify/YUICompressor.php +0 -0
  279. lib/vendor/mrclay/minify/lib/MrClay/Cli.php +0 -0
  280. lib/vendor/mrclay/minify/lib/MrClay/Cli/Arg.php +0 -0
  281. lib/vendor/mrclay/minify/static/.htaccess +0 -0
  282. lib/vendor/mrclay/minify/static/gen.php +0 -0
  283. lib/vendor/mrclay/minify/static/lib.php +0 -0
  284. lib/vendor/mrclay/minify/utils.php +0 -0
  285. lib/vendor/mrclay/props-dic/.travis.yml +0 -0
  286. lib/vendor/mrclay/props-dic/LICENSE +0 -0
  287. lib/vendor/mrclay/props-dic/src/Props/BadMethodCallException.php +0 -0
  288. lib/vendor/mrclay/props-dic/src/Props/Container.php +0 -0
  289. lib/vendor/mrclay/props-dic/src/Props/FactoryUncallableException.php +0 -0
  290. lib/vendor/mrclay/props-dic/src/Props/NotFoundException.php +0 -0
  291. lib/vendor/mrclay/props-dic/src/Props/Pimple.php +0 -0
  292. lib/vendor/mrclay/props-dic/src/Props/ValueUnresolvableException.php +0 -0
  293. lib/vendor/pimple/pimple/.travis.yml +0 -0
  294. lib/vendor/pimple/pimple/LICENSE +0 -0
  295. lib/vendor/pimple/pimple/ext/pimple/config.m4 +0 -0
  296. lib/vendor/pimple/pimple/ext/pimple/config.w32 +0 -0
  297. lib/vendor/pimple/pimple/ext/pimple/php_pimple.h +0 -0
  298. lib/vendor/pimple/pimple/ext/pimple/pimple.c +0 -0
  299. lib/vendor/pimple/pimple/ext/pimple/pimple_compat.h +0 -0
  300. lib/vendor/pimple/pimple/src/Pimple/Container.php +0 -0
  301. lib/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php +0 -0
  302. lib/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +0 -0
  303. lib/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php +0 -0
  304. lib/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php +0 -0
  305. lib/vendor/pimple/pimple/src/Pimple/Psr11/Container.php +0 -0
  306. lib/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +0 -0
  307. lib/vendor/pimple/pimple/src/Pimple/ServiceIterator.php +0 -0
  308. lib/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php +0 -0
  309. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php +0 -0
  310. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +0 -0
  311. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php +0 -0
  312. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +0 -0
  313. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +0 -0
  314. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +0 -0
  315. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +0 -0
  316. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +0 -0
  317. lib/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +0 -0
  318. lib/vendor/psr/container/LICENSE +0 -0
  319. lib/vendor/psr/container/src/ContainerExceptionInterface.php +0 -0
  320. lib/vendor/psr/container/src/ContainerInterface.php +0 -0
  321. lib/vendor/psr/container/src/NotFoundExceptionInterface.php +0 -0
  322. lib/vendor/psr/log/LICENSE +0 -0
  323. lib/vendor/psr/log/Psr/Log/AbstractLogger.php +0 -0
  324. lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php +0 -0
  325. lib/vendor/psr/log/Psr/Log/LogLevel.php +0 -0
  326. lib/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +0 -0
  327. lib/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +0 -0
  328. lib/vendor/psr/log/Psr/Log/LoggerInterface.php +0 -0
  329. lib/vendor/psr/log/Psr/Log/LoggerTrait.php +0 -0
  330. lib/vendor/psr/log/Psr/Log/NullLogger.php +0 -0
  331. lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +0 -0
  332. lib/vendor/tubalmartin/cssmin/gui/scripts.js +0 -0
  333. lib/vendor/tubalmartin/cssmin/gui/styles.css +0 -0
  334. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/css/bootstrap.min.css +0 -0
  335. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/js/bootstrap.min.js +0 -0
  336. lib/vendor/tubalmartin/cssmin/gui/third-party/jquery-1.12.4.min.js +0 -0
  337. lib/vendor/tubalmartin/cssmin/src/Colors.php +0 -0
  338. lib/vendor/tubalmartin/cssmin/src/Command.php +0 -0
  339. lib/vendor/tubalmartin/cssmin/src/Minifier.php +0 -0
  340. lib/vendor/tubalmartin/cssmin/src/Utils.php +0 -0
  341. litespeed-cache.php +2 -2
  342. readme.txt +26 -12
  343. thirdparty/lscwp-3rd-aelia-currencyswitcher.cls.php +0 -0
  344. thirdparty/lscwp-3rd-autoptimize.cls.php +0 -0
  345. thirdparty/lscwp-3rd-avada.cls.php +0 -0
  346. thirdparty/lscwp-3rd-bbpress.cls.php +0 -0
  347. thirdparty/lscwp-3rd-betterwp-minify.cls.php +0 -0
  348. thirdparty/lscwp-3rd-like-dislike-counter.cls.php +0 -0
  349. thirdparty/lscwp-3rd-nextgengallery.cls.php +0 -0
  350. thirdparty/lscwp-3rd-theme-my-login.cls.php +0 -0
  351. thirdparty/lscwp-3rd-woocommerce.cls.php +0 -0
  352. thirdparty/lscwp-3rd-wp-polls.cls.php +0 -0
  353. thirdparty/lscwp-3rd-wp-postratings.cls.php +0 -0
  354. thirdparty/lscwp-3rd-wpforo.cls.php +0 -0
  355. thirdparty/lscwp-3rd-wplister.cls.php +0 -0
  356. thirdparty/lscwp-3rd-wptouch.cls.php +0 -0
  357. thirdparty/lscwp-3rd-yith-wishlist.cls.php +0 -0
  358. thirdparty/lscwp-registry-3rd.php +0 -0
  359. tpl/dummy.tpl.php +0 -0
  360. tpl/esi.tpl.php +0 -0
admin/admin-api.class.php ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin API
4
+ *
5
+ * @since 1.5
6
+ * @package LiteSpeed_Cache
7
+ * @subpackage LiteSpeed_Cache/admin
8
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
9
+ */
10
+ class LiteSpeed_Cache_Admin_API
11
+ {
12
+ private static $_instance ;
13
+
14
+ private $_sapi_key ;
15
+
16
+ const DB_SAPI_KEY = 'litespeed_sapi_key' ;
17
+ const DB_SAPI_SERVER = 'litespeed_sapi_server' ;
18
+ const DB_SAPI_KEY_HASH = 'litespeed_sapi_key_hash' ;
19
+
20
+ const ACTION_REQUEST_KEY = 'request_key' ;
21
+ const ACTION_REQUEST_KEY_CALLBACK = 'request_key_callback' ;
22
+
23
+ const SAPI_ACTION_REQUEST_KEY = 'request_key' ;
24
+
25
+ /**
26
+ * Init
27
+ *
28
+ * @since 1.5
29
+ * @access private
30
+ */
31
+ private function __construct()
32
+ {
33
+ $this->_sapi_key = get_option( self::DB_SAPI_KEY ) ;
34
+ }
35
+
36
+
37
+ /**
38
+ * Handle callback requests from LiteSpeed server
39
+ *
40
+ * @since 1.5
41
+ * @access public
42
+ */
43
+ public static function sapi_callback()
44
+ {
45
+ if ( empty( $_GET[ 'type' ] ) ) {
46
+ LiteSpeed_Cache_Log::debug( 'SAPI callback no type ' ) ;
47
+ return ;
48
+ }
49
+ LiteSpeed_Cache_Log::debug( 'SAPI callback type: ' . $_GET[ 'type' ] ) ;
50
+
51
+ $instance = self::get_instance() ;
52
+
53
+ switch ( $_GET[ 'type' ] ) {
54
+ case self::ACTION_REQUEST_KEY_CALLBACK :
55
+ $instance->_request_key_callback() ;
56
+ break ;
57
+
58
+ default:
59
+ break ;
60
+ }
61
+
62
+
63
+ }
64
+
65
+ /**
66
+ * Handle local request
67
+ *
68
+ * @since 1.5
69
+ * @access public
70
+ * @return string The msg shown in admin page
71
+ */
72
+ public static function sapi_proceed()
73
+ {
74
+ if ( empty( $_GET[ 'type' ] ) ) {
75
+ return ;
76
+ }
77
+
78
+ LiteSpeed_Cache_Log::debug( 'SAPI proceed type: ' . $_GET[ 'type' ] ) ;
79
+
80
+ $instance = self::get_instance() ;
81
+
82
+ switch ( $_GET[ 'type' ] ) {
83
+ case self::ACTION_REQUEST_KEY :
84
+ return $instance->_request_key() ;
85
+ break ;
86
+
87
+ default:
88
+ break ;
89
+ }
90
+
91
+ }
92
+
93
+ /**
94
+ * request key callback from LiteSpeed
95
+ *
96
+ * @since 1.5
97
+ * @access private
98
+ */
99
+ private function _request_key_callback()
100
+ {
101
+ $key_hash = get_transient( self::DB_SAPI_KEY_HASH ) ;
102
+ LiteSpeed_Cache_Log::debug( 'SAPI callback request key hash: ' . $key_hash ) ;
103
+ exit( $key_hash ) ;
104
+ }
105
+
106
+ /**
107
+ * request key from LiteSpeed
108
+ *
109
+ * @since 1.5
110
+ * @access private
111
+ */
112
+ private function _request_key()
113
+ {
114
+ $hash = Litespeed_String::rrand( 16 ) ;
115
+ // store hash
116
+ set_transient( self::DB_SAPI_KEY_HASH, $hash, 300 ) ;
117
+
118
+ // send the request
119
+ $url = 'https://wp.api.litespeedtech.com/' . self::SAPI_ACTION_REQUEST_KEY ;
120
+ $param = array(
121
+ 'hash' => $hash,
122
+ 'callback' => home_url(),
123
+ ) ;
124
+ $response = wp_remote_post( $url, array( 'body' => $param ) ) ;
125
+
126
+ if ( is_wp_error( $response ) ) {
127
+ $error_message = $response->get_error_message() ;
128
+ LiteSpeed_Cache_Log::debug( 'SAPI failed to send request' ) ;
129
+ return ;
130
+ }
131
+
132
+ // parse data from server
133
+ set_error_handler( 'litespeed_exception_handler' ) ;
134
+ try {
135
+ $json = json_decode( $response[ 'body' ], true ) ;
136
+ }
137
+ catch ( ErrorException $e ) {
138
+ LiteSpeed_Cache_Log::debug( 'SAPI failed to decode json: ' . $response[ 'body' ] ) ;
139
+ return ;
140
+ }
141
+ restore_error_handler() ;
142
+
143
+ if ( empty( $json[ 'auth_key' ] ) || empty( $json[ 'distribute_server' ] ) ) {
144
+ LiteSpeed_Cache_Log::debug( 'SAPI failed to get key and server: ' . $response[ 'body' ] ) ;
145
+ return ;
146
+ }
147
+
148
+ // store data into option locally
149
+ update_option( self::DB_SAPI_KEY, $json[ 'auth_key' ] ) ;
150
+ update_option( self::DB_SAPI_SERVER, $json[ 'distribute_server' ] ) ;
151
+ LiteSpeed_Cache_Log::debug( 'SAPI distribute server: ' . $json[ 'distribute_server' ] ) ;
152
+
153
+ return __( 'Generate the key from server successfully', 'litespeed-cache' ) ;
154
+ }
155
+
156
+ /**
157
+ * Check if the get token is correct with server api key
158
+ *
159
+ * @since 1.5
160
+ * @access public
161
+ * @return bool True if correct
162
+ */
163
+ public static function sapi_token_check()
164
+ {
165
+ if ( empty( $_GET[ 'token' ] ) ) {
166
+ LiteSpeed_Cache_Log::debug( 'SAPI bypassed token check' ) ;
167
+ return false ;
168
+ }
169
+ $instance = self::get_instance() ;
170
+
171
+ // don't have auth_key yet
172
+ if ( ! $instance->_sapi_key ) {
173
+ // use tmp hash to check
174
+ $key_hash = get_transient( self::DB_SAPI_KEY_HASH ) ;
175
+ $res = md5( $key_hash ) === $_GET[ 'token' ] ;
176
+
177
+ LiteSpeed_Cache_Log::debug( 'SAPI token init check ' . $key_hash . ': ' . ( $res ? 'passed' : 'failed' ) ) ;
178
+ return $res ;
179
+ }
180
+
181
+ $res = md5( $instance->_sapi_key ) === $_GET[ 'token' ] ;
182
+ LiteSpeed_Cache_Log::debug( 'SAPI token check: ' . ( $res ? 'passed' : 'failed' ) ) ;
183
+ return $res ;
184
+ }
185
+
186
+ /**
187
+ * Get the current instance object.
188
+ *
189
+ * @since 1.5
190
+ * @access public
191
+ * @return Current class instance.
192
+ */
193
+ public static function get_instance()
194
+ {
195
+ if ( ! isset( self::$_instance ) ) {
196
+ self::$_instance = new self() ;
197
+ }
198
+
199
+ return self::$_instance ;
200
+ }
201
+ }
admin/class-litespeed-cache-admin.php CHANGED
File without changes
admin/litespeed-cache-admin-display.class.php CHANGED
@@ -146,14 +146,16 @@ class LiteSpeed_Cache_Admin_Display
146
  }
147
 
148
  $this->add_submenu(__('Information', 'litespeed-cache'), 'lscache-info', 'show_info') ;
149
- if ( ! is_multisite() || is_network_admin() ) {
150
- $this->add_submenu(__('Environment Report', 'litespeed-cache'), 'lscache-report', 'show_report') ;
151
- }
152
 
153
  if ( ! is_network_admin() ) {
 
154
  $this->add_submenu(__('Crawler', 'litespeed-cache'), 'lscache-crawler', 'show_crawler') ;
155
  }
156
 
 
 
 
 
157
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
158
  $this->add_submenu(__('Debug Log', 'litespeed-cache'), 'lscache-debug', 'show_debug_log') ;
159
  }
@@ -307,7 +309,7 @@ class LiteSpeed_Cache_Admin_Display
307
  */
308
  public function admin_footer_text($footer_text)
309
  {
310
- require_once LSWCP_DIR . 'admin/tpl/admin_footer.php' ;
311
 
312
  return $footer_text ;
313
  }
@@ -355,7 +357,7 @@ class LiteSpeed_Cache_Admin_Display
355
  */
356
  public function add_help_tabs()
357
  {
358
- require_once LSWCP_DIR . 'admin/tpl/help_tabs.php' ;
359
  }
360
 
361
  /**
@@ -578,6 +580,17 @@ class LiteSpeed_Cache_Admin_Display
578
  require_once LSWCP_DIR . 'admin/tpl/crawler.php' ;
579
  }
580
 
 
 
 
 
 
 
 
 
 
 
 
581
  /**
582
  * Outputs the debug log.
583
  *
@@ -605,17 +618,6 @@ class LiteSpeed_Cache_Admin_Display
605
  require_once LSWCP_DIR . 'admin/tpl/info.php' ;
606
  }
607
 
608
- /**
609
- * Outputs a notice to the admin panel when ExpiresDefault is detected
610
- *
611
- * @since 1.1.5
612
- * @access public
613
- */
614
- public function show_rule_conflict()
615
- {
616
- require_once LSWCP_DIR . 'admin/tpl/show_rule_conflict.php' ;
617
- }
618
-
619
  /**
620
  * Outputs a notice to the admin panel when the plugin is installed
621
  * via the WHM plugin.
@@ -625,7 +627,7 @@ class LiteSpeed_Cache_Admin_Display
625
  */
626
  public function show_display_installed()
627
  {
628
- require_once LSWCP_DIR . 'admin/tpl/show_display_installed.php' ;
629
  }
630
 
631
  /**
@@ -636,7 +638,7 @@ class LiteSpeed_Cache_Admin_Display
636
  */
637
  public static function show_error_cookie()
638
  {
639
- require_once LSWCP_DIR . 'admin/tpl/show_error_cookie.php' ;
640
  }
641
 
642
  /**
@@ -649,7 +651,7 @@ class LiteSpeed_Cache_Admin_Display
649
  * @param boolean $disabled If this input is disabled or not
650
  * @param int $cols The width of textarea
651
  */
652
- public function build_textarea($id, $val = null, $disabled = false, $cols = false)
653
  {
654
  if ( $val === null ) {
655
  global $_options ;
@@ -664,6 +666,30 @@ class LiteSpeed_Cache_Admin_Display
664
  echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' rows='5' cols='$cols' $disabled>" . esc_textarea($val) . "</textarea>" ;
665
  }
666
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  /**
668
  * Build a text input field
669
  *
146
  }
147
 
148
  $this->add_submenu(__('Information', 'litespeed-cache'), 'lscache-info', 'show_info') ;
 
 
 
149
 
150
  if ( ! is_network_admin() ) {
151
+ // $this->add_submenu(__('Image Optimization', 'litespeed-cache'), 'lscache-optimization', 'show_optimization') ;
152
  $this->add_submenu(__('Crawler', 'litespeed-cache'), 'lscache-crawler', 'show_crawler') ;
153
  }
154
 
155
+ if ( ! is_multisite() || is_network_admin() ) {
156
+ $this->add_submenu(__('Environment Report', 'litespeed-cache'), 'lscache-report', 'show_report') ;
157
+ }
158
+
159
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
160
  $this->add_submenu(__('Debug Log', 'litespeed-cache'), 'lscache-debug', 'show_debug_log') ;
161
  }
309
  */
310
  public function admin_footer_text($footer_text)
311
  {
312
+ require_once LSWCP_DIR . 'admin/tpl/inc/admin_footer.php' ;
313
 
314
  return $footer_text ;
315
  }
357
  */
358
  public function add_help_tabs()
359
  {
360
+ require_once LSWCP_DIR . 'admin/tpl/inc/help_tabs.php' ;
361
  }
362
 
363
  /**
580
  require_once LSWCP_DIR . 'admin/tpl/crawler.php' ;
581
  }
582
 
583
+ /**
584
+ * Outputs the optimization operation page.
585
+ *
586
+ * @since 1.6
587
+ * @access public
588
+ */
589
+ public function show_optimization()
590
+ {
591
+ require_once LSWCP_DIR . 'admin/tpl/image_optimization.php' ;
592
+ }
593
+
594
  /**
595
  * Outputs the debug log.
596
  *
618
  require_once LSWCP_DIR . 'admin/tpl/info.php' ;
619
  }
620
 
 
 
 
 
 
 
 
 
 
 
 
621
  /**
622
  * Outputs a notice to the admin panel when the plugin is installed
623
  * via the WHM plugin.
627
  */
628
  public function show_display_installed()
629
  {
630
+ require_once LSWCP_DIR . 'admin/tpl/inc/show_display_installed.php' ;
631
  }
632
 
633
  /**
638
  */
639
  public static function show_error_cookie()
640
  {
641
+ require_once LSWCP_DIR . 'admin/tpl/inc/show_error_cookie.php' ;
642
  }
643
 
644
  /**
651
  * @param boolean $disabled If this input is disabled or not
652
  * @param int $cols The width of textarea
653
  */
654
+ public function build_textarea( $id, $val = null, $disabled = false, $cols = false )
655
  {
656
  if ( $val === null ) {
657
  global $_options ;
666
  echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' rows='5' cols='$cols' $disabled>" . esc_textarea($val) . "</textarea>" ;
667
  }
668
 
669
+ /**
670
+ * Build a textarea based on separate stored option data
671
+ *
672
+ * @since 1.5
673
+ * @access public
674
+ * @param string $id
675
+ * @param string $val Value of input
676
+ * @param boolean $disabled If this input is disabled or not
677
+ * @param int $cols The width of textarea
678
+ */
679
+ public function build_textarea2( $id, $val = null, $disabled = false, $cols = false, $default_val = null )
680
+ {
681
+ if ( $val === null ) {
682
+ $val = get_option( $id, $default_val ) ;
683
+ }
684
+ $disabled = $disabled ? ' disabled ' : '' ;
685
+
686
+ if ( $cols === false ) {
687
+ $cols = 80 ;
688
+ }
689
+
690
+ echo "<textarea name='" . LiteSpeed_Cache_Config::OPTION_NAME . "[$id]' rows='5' cols='$cols' $disabled>" . esc_textarea( $val ) . "</textarea>" ;
691
+ }
692
+
693
  /**
694
  * Build a text input field
695
  *
admin/litespeed-cache-admin-error.class.php CHANGED
File without changes
admin/litespeed-cache-admin-optimize.class.php CHANGED
File without changes
admin/litespeed-cache-admin-report.class.php CHANGED
File without changes
admin/litespeed-cache-admin-rules.class.php CHANGED
@@ -42,6 +42,7 @@ class LiteSpeed_Cache_Admin_Rules
42
  const MARKER_FAVICON = '### marker FAVICON' ;
43
  const MARKER_BROWSER_CACHE = '### marker BROWSER CACHE' ;
44
  const MARKER_MINIFY = '### marker MINIFY' ;
 
45
  const MARKER_START = ' start ###' ;
46
  const MARKER_END = ' end ###' ;
47
 
@@ -513,6 +514,24 @@ class LiteSpeed_Cache_Admin_Rules
513
  return $rules ;
514
  }
515
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  /**
517
  * Generate rewrite rules based on settings
518
  *
@@ -612,6 +631,15 @@ class LiteSpeed_Cache_Admin_Rules
612
  $new_rules[] = '' ;
613
  }
614
 
 
 
 
 
 
 
 
 
 
615
  return array( $new_rules, $new_rules_backend ) ;
616
 
617
  }
42
  const MARKER_FAVICON = '### marker FAVICON' ;
43
  const MARKER_BROWSER_CACHE = '### marker BROWSER CACHE' ;
44
  const MARKER_MINIFY = '### marker MINIFY' ;
45
+ const MARKER_CORS = '### marker CORS' ;
46
  const MARKER_START = ' start ###' ;
47
  const MARKER_END = ' end ###' ;
48
 
514
  return $rules ;
515
  }
516
 
517
+ /**
518
+ * Generate CORS rules for fonts
519
+ *
520
+ * @since 1.5
521
+ * @access private
522
+ * @return array Rules set
523
+ */
524
+ private function _cors_rules()
525
+ {
526
+ return array(
527
+ '<FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|font\.css)$">',
528
+ '<IfModule mod_headers.c>',
529
+ 'Header set Access-Control-Allow-Origin "*"',
530
+ '</IfModule>',
531
+ '</FilesMatch>',
532
+ ) ;
533
+ }
534
+
535
  /**
536
  * Generate rewrite rules based on settings
537
  *
631
  $new_rules[] = '' ;
632
  }
633
 
634
+ // CORS font rules
635
+ $id = LiteSpeed_Cache_Config::OPID_CDN ;
636
+ if ( ! empty( $cfg[ $id ] ) ) {
637
+ $new_rules[] = self::MARKER_CORS . self::MARKER_START ;
638
+ $new_rules = array_merge( $new_rules, $this->_cors_rules() ) ;
639
+ $new_rules[] = self::MARKER_CORS . self::MARKER_END ;
640
+ $new_rules[] = '' ;
641
+ }
642
+
643
  return array( $new_rules, $new_rules_backend ) ;
644
 
645
  }
admin/litespeed-cache-admin-settings.class.php CHANGED
@@ -460,6 +460,14 @@ class LiteSpeed_Cache_Admin_Settings
460
  foreach ( $ids as $id ) {
461
  $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) ;
462
  }
 
 
 
 
 
 
 
 
463
  }
464
 
465
  /**
@@ -477,6 +485,14 @@ class LiteSpeed_Cache_Admin_Settings
477
  foreach ( $ids as $id ) {
478
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
479
  }
 
 
 
 
 
 
 
 
480
  }
481
 
482
  /**
@@ -500,6 +516,7 @@ class LiteSpeed_Cache_Admin_Settings
500
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
501
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
502
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
 
503
  ) ;
504
  foreach ( $ids as $id ) {
505
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
@@ -528,6 +545,10 @@ class LiteSpeed_Cache_Admin_Settings
528
  $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
529
  }
530
 
 
 
 
 
531
  }
532
 
533
  /**
460
  foreach ( $ids as $id ) {
461
  $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ] ) ;
462
  }
463
+
464
+ /**
465
+ * Load jQuery from cdn
466
+ * @since 1.5
467
+ */
468
+ $id = LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ;
469
+ $this->_options[ $id ] = self::is_checked_radio( $this->_input[ $id ] ) ;
470
+
471
  }
472
 
473
  /**
485
  foreach ( $ids as $id ) {
486
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
487
  }
488
+
489
+ $id = LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY_PLACEHOLDER ;
490
+ $this->_options[ $id ] = $this->_input[ $id ] ;
491
+
492
+ // Update lazyload image excludes
493
+ $id = LiteSpeed_Cache_Config::ITEM_MEDIA_LAZY_IMG_EXC ;
494
+ update_option( $id, LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'uri' ) ) ;
495
+
496
  }
497
 
498
  /**
516
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
517
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
518
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
519
+ LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
520
  ) ;
521
  foreach ( $ids as $id ) {
522
  $this->_options[ $id ] = self::parse_onoff( $this->_input, $id ) ;
545
  $this->_options[ $id ] = LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'relative' ) ;
546
  }
547
 
548
+ // Update js deferred excludes
549
+ $id = LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ;
550
+ update_option( $id, LiteSpeed_Cache_Utility::sanitize_lines( $this->_input[ $id ], 'uri' ) ) ;
551
+
552
  }
553
 
554
  /**
admin/litespeed-cache-admin.class.php CHANGED
File without changes
admin/tpl/crawler.php CHANGED
File without changes
admin/tpl/debug_log.php CHANGED
File without changes
admin/tpl/edit_htaccess.php CHANGED
@@ -14,7 +14,7 @@ if ( defined( 'LITESPEED_ON' ) ) {
14
  if ( $is_dismissed !== self::RULECONFLICT_ON ) {
15
  update_option( self::DISMISS_MSG, self::RULECONFLICT_ON ) ;
16
  }
17
- $this->show_rule_conflict() ;
18
  }
19
  }
20
  // don't dismiss the msg automatically
@@ -68,7 +68,7 @@ if ( defined( 'LITESPEED_ON' ) ) {
68
  <button type="submit" class="litespeed-btn-primary"><?php echo __('Save', 'litespeed-cache'); ?></button>
69
  </form>
70
 
71
- <?php require LSWCP_DIR . 'admin/tpl/info_common_rewrite.php'; ?>
72
 
73
  <?php endif; ?>
74
  </div>
14
  if ( $is_dismissed !== self::RULECONFLICT_ON ) {
15
  update_option( self::DISMISS_MSG, self::RULECONFLICT_ON ) ;
16
  }
17
+ require_once LSWCP_DIR . 'admin/tpl/inc/show_rule_conflict.php' ;
18
  }
19
  }
20
  // don't dismiss the msg automatically
68
  <button type="submit" class="litespeed-btn-primary"><?php echo __('Save', 'litespeed-cache'); ?></button>
69
  </form>
70
 
71
+ <?php require LSWCP_DIR . 'admin/tpl/info/info_common_rewrite.php'; ?>
72
 
73
  <?php endif; ?>
74
  </div>
admin/tpl/esi_widget_edit.php CHANGED
File without changes
admin/tpl/{admin_footer.php → inc/admin_footer.php} RENAMED
File without changes
admin/tpl/{banner_promo.php → inc/banner_promo.php} RENAMED
File without changes
admin/tpl/inc/check_cache_disabled.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) die ;
3
+
4
+ if ( defined( 'LITESPEED_ON' ) ) {
5
+ return ;
6
+ }
7
+ ?>
8
+
9
+ <div class="litespeed-callout-warning">
10
+ <h4><?php echo __('WARNING: LiteSpeed cache is disabled. The functionalities here can not work.', 'litespeed-cache'); ?></h4>
11
+ </div>
12
+
admin/tpl/{help_tabs.php → inc/help_tabs.php} RENAMED
File without changes
admin/tpl/{show_display_installed.php → inc/show_display_installed.php} RENAMED
File without changes
admin/tpl/{show_error_cookie.php → inc/show_error_cookie.php} RENAMED
File without changes
admin/tpl/{show_rule_conflict.php → inc/show_rule_conflict.php} RENAMED
File without changes
admin/tpl/info.php CHANGED
@@ -33,7 +33,7 @@ $menuArr = array(
33
  // include all tpl for faster UE
34
  foreach ($menuArr as $tab => $val) {
35
  echo "<div data-litespeed-layout='$tab'>";
36
- require LSWCP_DIR . "admin/tpl/info_$tab.php";
37
  echo "</div>";
38
  }
39
 
33
  // include all tpl for faster UE
34
  foreach ($menuArr as $tab => $val) {
35
  echo "<div data-litespeed-layout='$tab'>";
36
+ require LSWCP_DIR . "admin/tpl/info/info_$tab.php";
37
  echo "</div>";
38
  }
39
 
admin/tpl/{info_admin_ip.php → info/info_admin_ip.php} RENAMED
File without changes
admin/tpl/{info_common_rewrite.php → info/info_common_rewrite.php} RENAMED
File without changes
admin/tpl/{info_compatibility.php → info/info_compatibility.php} RENAMED
File without changes
admin/tpl/{info_config.php → info/info_config.php} RENAMED
File without changes
admin/tpl/{info_crawler.php → info/info_crawler.php} RENAMED
File without changes
admin/tpl/{info_faqs.php → info/info_faqs.php} RENAMED
File without changes
admin/tpl/manage.php CHANGED
@@ -8,7 +8,7 @@ $menu_list = array(
8
  'db' => __('DB Optimizer', 'litespeed-cache'),
9
  ) ;
10
 
11
- include_once LSWCP_DIR . "admin/tpl/banner_promo.php" ;
12
  ?>
13
 
14
  <div class="wrap">
@@ -38,11 +38,7 @@ include_once LSWCP_DIR . "admin/tpl/banner_promo.php" ;
38
  ?>
39
  </h2>
40
 
41
- <?php if ( ! defined( 'LITESPEED_ON' ) ) : ?>
42
- <div class="litespeed-callout-warning">
43
- <h4><?php echo __('WARNING: LiteSpeed cache is disabled. The functionalities here can not work.', 'litespeed-cache'); ?></h4>
44
- </div>
45
- <?php endif ; ?>
46
 
47
  <div class="litespeed-body">
48
  <?php
@@ -50,7 +46,7 @@ include_once LSWCP_DIR . "admin/tpl/banner_promo.php" ;
50
  // include all tpl for faster UE
51
  foreach ($menu_list as $tab => $val) {
52
  echo "<div data-litespeed-layout='$tab'>" ;
53
- require LSWCP_DIR . "admin/tpl/manage_$tab.php" ;
54
  echo "</div>" ;
55
  }
56
 
8
  'db' => __('DB Optimizer', 'litespeed-cache'),
9
  ) ;
10
 
11
+ include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
12
  ?>
13
 
14
  <div class="wrap">
38
  ?>
39
  </h2>
40
 
41
+ <?php include_once LSWCP_DIR . "admin/tpl/inc/check_cache_disabled.php" ; ?>
 
 
 
 
42
 
43
  <div class="litespeed-body">
44
  <?php
46
  // include all tpl for faster UE
47
  foreach ($menu_list as $tab => $val) {
48
  echo "<div data-litespeed-layout='$tab'>" ;
49
+ require LSWCP_DIR . "admin/tpl/manage/manage_$tab.php" ;
50
  echo "</div>" ;
51
  }
52
 
admin/tpl/{manage_db.php → manage/manage_db.php} RENAMED
File without changes
admin/tpl/{manage_purge.php → manage/manage_purge.php} RENAMED
File without changes
admin/tpl/network_settings.php CHANGED
@@ -42,9 +42,9 @@ $_options = LiteSpeed_Cache_Config::get_instance()->get_site_options();
42
  foreach ($menuArr as $tab => $val) {
43
  echo "<div data-litespeed-layout='$tab'>";
44
  if($tab == 'advanced') {
45
- require LSWCP_DIR . 'admin/tpl/settings_advanced.php';
46
  }else{
47
- require LSWCP_DIR . "admin/tpl/network_settings_$tab.php";
48
  }
49
  echo "</div>";
50
  }
42
  foreach ($menuArr as $tab => $val) {
43
  echo "<div data-litespeed-layout='$tab'>";
44
  if($tab == 'advanced') {
45
+ require LSWCP_DIR . 'admin/tpl/setting/settings_advanced.php';
46
  }else{
47
+ require LSWCP_DIR . "admin/tpl/setting/network_settings_$tab.php";
48
  }
49
  echo "</div>";
50
  }
admin/tpl/report.php CHANGED
File without changes
admin/tpl/{network_settings_cache.php → setting/network_settings_cache.php} RENAMED
@@ -10,10 +10,10 @@ if ( ! defined( 'WPINC' ) ) die ;
10
 
11
  <table><tbody>
12
 
13
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.cache_favicon.php' ; ?>
14
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.cache_resources.php' ; ?>
15
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.cache_mobile.php' ; ?>
16
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.cache_browser.php' ; ?>
17
 
18
  </tbody></table>
19
 
10
 
11
  <table><tbody>
12
 
13
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_favicon.php' ; ?>
14
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_resources.php' ; ?>
15
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_mobile.php' ; ?>
16
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ; ?>
17
 
18
  </tbody></table>
19
 
admin/tpl/{network_settings_excludes.php → setting/network_settings_excludes.php} RENAMED
@@ -7,9 +7,9 @@ if (!defined('WPINC')) die;
7
  <table><tbody>
8
 
9
  <!-- User Agent List -->
10
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.exclude_useragent.php'; ?>
11
 
12
  <!-- Cookie List -->
13
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.exclude_cookies.php'; ?>
14
 
15
  </tbody></table>
7
  <table><tbody>
8
 
9
  <!-- User Agent List -->
10
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.exclude_useragent.php'; ?>
11
 
12
  <!-- Cookie List -->
13
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.exclude_cookies.php'; ?>
14
 
15
  </tbody></table>
admin/tpl/{network_settings_general.php → setting/network_settings_general.php} RENAMED
File without changes
admin/tpl/{network_settings_purge.php → setting/network_settings_purge.php} RENAMED
@@ -5,6 +5,6 @@ if ( ! defined( 'WPINC' ) ) die ;
5
 
6
  <table><tbody>
7
 
8
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.purge_on_upgrade.php' ; ?>
9
 
10
  </tbody></table>
5
 
6
  <table><tbody>
7
 
8
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.purge_on_upgrade.php' ; ?>
9
 
10
  </tbody></table>
admin/tpl/{settings_advanced.php → setting/settings_advanced.php} RENAMED
File without changes
admin/tpl/{settings_cache.php → setting/settings_cache.php} RENAMED
@@ -46,9 +46,9 @@ if ( ! defined( 'WPINC' ) ) die ;
46
 
47
  <?php
48
  if ( ! is_multisite() ) :
49
- require LSWCP_DIR . 'admin/tpl/settings_inc.cache_favicon.php' ;
50
- require LSWCP_DIR . 'admin/tpl/settings_inc.cache_resources.php' ;
51
- require LSWCP_DIR . 'admin/tpl/settings_inc.cache_mobile.php' ;
52
  endif ;
53
  ?>
54
 
@@ -72,7 +72,7 @@ if ( ! defined( 'WPINC' ) ) die ;
72
 
73
  <?php
74
  if ( ! is_multisite() ) :
75
- require LSWCP_DIR . 'admin/tpl/settings_inc.cache_browser.php' ;
76
  endif ;
77
  ?>
78
 
46
 
47
  <?php
48
  if ( ! is_multisite() ) :
49
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_favicon.php' ;
50
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_resources.php' ;
51
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_mobile.php' ;
52
  endif ;
53
  ?>
54
 
72
 
73
  <?php
74
  if ( ! is_multisite() ) :
75
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.cache_browser.php' ;
76
  endif ;
77
  ?>
78
 
admin/tpl/{settings_cdn.php → setting/settings_cdn.php} RENAMED
@@ -37,7 +37,7 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
37
  <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
38
  <div class="litespeed-desc">
39
  <?php echo sprintf( __( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ), '<code>//</code>', '<code>' . $home_url . '</code>' ) ; ?>
40
- <p><?php echo sprintf( __( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>//www.aa.com</code>', '<code>//aa.com</code>', '<code>//*aa.com</code>' ) ; ?></p>
41
  </div>
42
  </td>
43
  </tr>
@@ -79,8 +79,8 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
79
  <?php $id = LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ; ?>
80
  <?php $this->build_textarea( $id, null, false, 30 ) ; ?>
81
  <div class="litespeed-desc">
82
- <p><?php echo __( 'Static file type links to be replaced by CDN links. One per line.', 'litespeed-cache' ) ; ?></p>
83
- <p><?php echo sprintf( __( 'This will affect all tags containing attributes: %s %s %s.', 'litespeed-cache' ), '<code>src=""</code>', '<code>data-src=""</code>', '<code>href=""</code>' ) ; ?></p>
84
  </div>
85
  </div>
86
  <div style="float:left; display:flex;">
@@ -103,4 +103,32 @@ $cdn_url = 'https://cdn.' . substr( $home_url, 2 ) ;
103
  </td>
104
  </tr>
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  </tbody></table>
37
  <?php $this->build_input( LiteSpeed_Cache_Config::OPID_CDN_ORI, 'litespeed-input-long' ) ; ?>
38
  <div class="litespeed-desc">
39
  <?php echo sprintf( __( 'Site URL to be served through the CDN. Beginning with %1$s. For example, %2$s.', 'litespeed-cache' ), '<code>//</code>', '<code>' . $home_url . '</code>' ) ; ?>
40
+ <br /><?php echo sprintf( __( 'Wildcard %1$s supported (match zero or more characters). For example, to match %2$s and %3$s, use %4$s.', 'litespeed-cache' ), '<code>*</code>', '<code>//www.aa.com</code>', '<code>//aa.com</code>', '<code>//*aa.com</code>' ) ; ?>
41
  </div>
42
  </td>
43
  </tr>
79
  <?php $id = LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ; ?>
80
  <?php $this->build_textarea( $id, null, false, 30 ) ; ?>
81
  <div class="litespeed-desc">
82
+ <?php echo __( 'Static file type links to be replaced by CDN links. One per line.', 'litespeed-cache' ) ; ?>
83
+ <br /><?php echo sprintf( __( 'This will affect all tags containing attributes: %s %s %s.', 'litespeed-cache' ), '<code>src=""</code>', '<code>data-src=""</code>', '<code>href=""</code>' ) ; ?>
84
  </div>
85
  </div>
86
  <div style="float:left; display:flex;">
103
  </td>
104
  </tr>
105
 
106
+ <tr>
107
+ <th><?php echo __( 'Load JQuery Remotely', 'litespeed-cache' ) ; ?></th>
108
+ <td>
109
+ <div class="litespeed-switch">
110
+ <?php echo $this->build_radio(
111
+ LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY,
112
+ LiteSpeed_Cache_Config::VAL_OFF,
113
+ __( 'Off', 'litespeed-cache' )
114
+ ) ; ?>
115
+
116
+ <?php echo $this->build_radio(
117
+ LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY,
118
+ LiteSpeed_Cache_Config::VAL_ON,
119
+ __( 'Google', 'litespeed-cache' )
120
+ ) ; ?>
121
+
122
+ <?php echo $this->build_radio(
123
+ LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY,
124
+ LiteSpeed_Cache_Config::VAL_ON2,
125
+ __( 'cdnjs', 'litespeed-cache' )
126
+ ) ; ?>
127
+ </div>
128
+ <div class="litespeed-desc">
129
+ <?php echo __( 'Improve page load time by loading jQuery from a remote CDN service instead of locally.', 'litespeed-cache' ) ; ?>
130
+ </div>
131
+ </td>
132
+ </tr>
133
+
134
  </tbody></table>
admin/tpl/{settings_compatibilities.php → setting/settings_compatibilities.php} RENAMED
File without changes
admin/tpl/{settings_crawler.php → setting/settings_crawler.php} RENAMED
File without changes
admin/tpl/{settings_debug.php → setting/settings_debug.php} RENAMED
File without changes
admin/tpl/{settings_esi.php → setting/settings_esi.php} RENAMED
File without changes
admin/tpl/{settings_excludes.php → setting/settings_excludes.php} RENAMED
@@ -108,10 +108,10 @@ if ( ! defined( 'WPINC' ) ) die ;
108
  <?php
109
  if ( ! is_multisite() ) :
110
  // Cookie
111
- require LSWCP_DIR . 'admin/tpl/settings_inc.exclude_cookies.php' ;
112
 
113
  // User Agent
114
- require LSWCP_DIR . 'admin/tpl/settings_inc.exclude_useragent.php' ;
115
 
116
  endif ;
117
  ?>
108
  <?php
109
  if ( ! is_multisite() ) :
110
  // Cookie
111
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.exclude_cookies.php' ;
112
 
113
  // User Agent
114
+ require LSWCP_DIR . 'admin/tpl/setting/settings_inc.exclude_useragent.php' ;
115
 
116
  endif ;
117
  ?>
admin/tpl/{settings_general.php → setting/settings_general.php} RENAMED
File without changes
admin/tpl/{settings_inc.cache_browser.php → setting/settings_inc.cache_browser.php} RENAMED
@@ -8,11 +8,11 @@ if ( ! defined( 'WPINC' ) ) die ;
8
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CACHE_BROWSER ) ; ?>
9
  <div class="litespeed-desc">
10
  <?php echo __( 'Browser caching stores static files locally in the user\'s browser. Turn on this setting to reduce repeated requests for static files.', 'litespeed-cache' ) ; ?>
11
- <i class="litespeed-warning">
12
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
13
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
14
- </i>
15
- <p><?php echo sprintf( __( 'You can turn on browser caching in server admin too. <a %s>Learn more about LiteSpeed browser cache setting</a>.', 'litespeed-cache' ), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:browser_cache" target="_blank"' ) ; ?></p>
16
  </div>
17
  </td>
18
  </tr>
8
  <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_CACHE_BROWSER ) ; ?>
9
  <div class="litespeed-desc">
10
  <?php echo __( 'Browser caching stores static files locally in the user\'s browser. Turn on this setting to reduce repeated requests for static files.', 'litespeed-cache' ) ; ?>
11
+ <br /><font class="litespeed-warning">
12
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
13
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
14
+ </font>
15
+ <br /><?php echo sprintf( __( 'You can turn on browser caching in server admin too. <a %s>Learn more about LiteSpeed browser cache setting</a>.', 'litespeed-cache' ), 'href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:browser_cache" target="_blank"' ) ; ?>
16
  </div>
17
  </td>
18
  </tr>
admin/tpl/{settings_inc.cache_favicon.php → setting/settings_inc.cache_favicon.php} RENAMED
@@ -10,10 +10,10 @@ $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
10
  <div class="litespeed-desc">
11
  <?php echo __('favicon.ico is requested on most pages.', 'litespeed-cache'); ?>
12
  <?php echo __('Caching this resource may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
13
- <i class="litespeed-warning">
14
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
15
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
16
- </i>
17
  </div>
18
  </td>
19
  </tr>
10
  <div class="litespeed-desc">
11
  <?php echo __('favicon.ico is requested on most pages.', 'litespeed-cache'); ?>
12
  <?php echo __('Caching this resource may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
13
+ <br /><font class="litespeed-warning">
14
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
15
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
16
+ </font>
17
  </div>
18
  </td>
19
  </tr>
admin/tpl/{settings_inc.cache_mobile.php → setting/settings_inc.cache_mobile.php} RENAMED
@@ -14,10 +14,10 @@ if (!defined('WPINC')) die;
14
  <div class="litespeed-desc">
15
  <?php echo __('When enabled, mobile views will be cached separately.', 'litespeed-cache'); ?>
16
  <?php echo __('A site built with responsive design does not need to check this.', 'litespeed-cache'); ?>
17
- <i class="litespeed-warning">
18
  <?php echo __( 'NOTE:', 'litespeed-cache' ) ; ?>
19
  <?php echo __( 'This setting will edit the .htaccess file.', 'litespeed-cache' ) ; ?>
20
- </i>
21
  </div>
22
  </td>
23
  </tr>
@@ -61,9 +61,8 @@ if (!defined('WPINC')) die;
61
  <?php echo sprintf( __( 'SYNTAX: Each entry should be separated with a bar, %s.', 'litespeed-cache'), "<code>|</code>" ) ; ?>
62
  <?php echo sprintf( __( 'Any spaces should be escaped with a backslash before the space, %s.', 'litespeed-cache' ), "<code>\\</code>" ) ; ?>
63
  </i>
64
- <p>
65
  <?php echo sprintf( __( 'The default list WordPress uses is %s', 'litespeed-cache' ), "<code>$wp_default_mobile</code>" ) ; ?>
66
- </p>
67
  </div>
68
  </td>
69
  </tr>
14
  <div class="litespeed-desc">
15
  <?php echo __('When enabled, mobile views will be cached separately.', 'litespeed-cache'); ?>
16
  <?php echo __('A site built with responsive design does not need to check this.', 'litespeed-cache'); ?>
17
+ <br /><font class="litespeed-warning">
18
  <?php echo __( 'NOTE:', 'litespeed-cache' ) ; ?>
19
  <?php echo __( 'This setting will edit the .htaccess file.', 'litespeed-cache' ) ; ?>
20
+ </font>
21
  </div>
22
  </td>
23
  </tr>
61
  <?php echo sprintf( __( 'SYNTAX: Each entry should be separated with a bar, %s.', 'litespeed-cache'), "<code>|</code>" ) ; ?>
62
  <?php echo sprintf( __( 'Any spaces should be escaped with a backslash before the space, %s.', 'litespeed-cache' ), "<code>\\</code>" ) ; ?>
63
  </i>
64
+ <br />
65
  <?php echo sprintf( __( 'The default list WordPress uses is %s', 'litespeed-cache' ), "<code>$wp_default_mobile</code>" ) ; ?>
 
66
  </div>
67
  </td>
68
  </tr>
admin/tpl/{settings_inc.cache_resources.php → setting/settings_inc.cache_resources.php} RENAMED
@@ -11,10 +11,10 @@ $file_writable = LiteSpeed_Cache_Admin_Rules::writable();
11
  <div class="litespeed-desc">
12
  <?php echo __('Some themes and plugins add resources via a PHP request.', 'litespeed-cache'); ?>
13
  <?php echo __('Caching these pages may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
14
- <i class="litespeed-warning">
15
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
16
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
17
- </i>
18
  </div>
19
  </td>
20
  </tr>
11
  <div class="litespeed-desc">
12
  <?php echo __('Some themes and plugins add resources via a PHP request.', 'litespeed-cache'); ?>
13
  <?php echo __('Caching these pages may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'); ?>
14
+ <br /><font class="litespeed-warning">
15
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
16
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
17
+ </font>
18
  </div>
19
  </td>
20
  </tr>
admin/tpl/{settings_inc.exclude_cookies.php → setting/settings_inc.exclude_cookies.php} RENAMED
@@ -18,10 +18,10 @@ if ( ! defined( 'WPINC' ) ) die ;
18
  <?php echo sprintf(__('Spaces should have a backslash in front of them, %s.', 'litespeed-cache'), '<code>\ </code>'); ?>
19
  <?php echo __('One per line.', 'litespeed-cache'); ?>
20
  </i>
21
- <i class="litespeed-warning">
22
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
23
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
24
- </i>
25
  </div>
26
  </td>
27
  </tr>
18
  <?php echo sprintf(__('Spaces should have a backslash in front of them, %s.', 'litespeed-cache'), '<code>\ </code>'); ?>
19
  <?php echo __('One per line.', 'litespeed-cache'); ?>
20
  </i>
21
+ <br /><font class="litespeed-warning">
22
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
23
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
24
+ </font>
25
  </div>
26
  </td>
27
  </tr>
admin/tpl/{settings_inc.exclude_useragent.php → setting/settings_inc.exclude_useragent.php} RENAMED
@@ -17,10 +17,10 @@ if (!defined('WPINC')) die;
17
  <?php echo sprintf( __( 'SYNTAX: Separate each user agent with a bar, %s.', 'litespeed-cache' ), '<code>|</code>' ) ; ?>
18
  <?php echo sprintf( __( 'Spaces should have a backslash in front of them, %s.', 'litespeed-cache' ), '<code>\</code>' ) ; ?>
19
  </i>
20
- <i class="litespeed-warning">
21
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
22
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
23
- </i>
24
  </div>
25
  </td>
26
  </tr>
17
  <?php echo sprintf( __( 'SYNTAX: Separate each user agent with a bar, %s.', 'litespeed-cache' ), '<code>|</code>' ) ; ?>
18
  <?php echo sprintf( __( 'Spaces should have a backslash in front of them, %s.', 'litespeed-cache' ), '<code>\</code>' ) ; ?>
19
  </i>
20
+ <br /><font class="litespeed-warning">
21
  <?php echo __('NOTE:', 'litespeed-cache'); ?>
22
  <?php echo __('This setting will edit the .htaccess file.', 'litespeed-cache'); ?>
23
+ </font>
24
  </div>
25
  </td>
26
  </tr>
admin/tpl/{settings_inc.purge_on_upgrade.php → setting/settings_inc.purge_on_upgrade.php} RENAMED
File without changes
admin/tpl/setting/settings_media.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'WPINC' ) ) die ;
3
+
4
+ ?>
5
+
6
+ <h3 class="litespeed-title"><?php echo __( 'Media Settings', 'litespeed-cache' ) ; ?></h3>
7
+
8
+ <table><tbody>
9
+ <tr>
10
+ <th><?php echo __( 'Lazy Load Images', 'litespeed-cache' ) ; ?></th>
11
+ <td>
12
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY ) ; ?>
13
+ <div class="litespeed-desc">
14
+ <?php echo __( 'Load images only when they enter the viewport.', 'litespeed-cache' ) ; ?>
15
+ <?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
16
+ </div>
17
+ </td>
18
+ </tr>
19
+
20
+ <tr>
21
+ <th><?php echo __( 'Lazy Load Image Excludes', 'litespeed-cache' ) ; ?></th>
22
+ <td>
23
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_MEDIA_LAZY_IMG_EXC ) ; ?>
24
+ <div class="litespeed-desc">
25
+ <?php echo __( 'Listed images will not be lazy loaded.', 'litespeed-cache' ) ; ?>
26
+ <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
27
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
28
+ <br /><font class="litespeed-success">
29
+ <?php echo __('API:', 'litespeed-cache'); ?>
30
+ <?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_cache_media_lazy_img_excludes</code>' ) ; ?>
31
+ <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-lazy="1"</code>' ) ; ?>
32
+ </font>
33
+ </div>
34
+ </td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <th><?php echo __( 'Lazy Load Image Placeholder', 'litespeed-cache' ) ; ?></th>
39
+ <td>
40
+ <?php $this->build_input( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY_PLACEHOLDER, 'litespeed-input-long' ) ; ?>
41
+ <div class="litespeed-desc">
42
+ <?php echo __( 'Specify a base64 image to be used as a placeholder while other images finish loading.', 'litespeed-cache' ) ; ?>
43
+ <br /><?php echo sprintf( __( 'This can be predefined in %2$s as well using constant %1$s, with this setting taking priority.', 'litespeed-cache' ), '<code>LITESPEED_PLACEHOLDER</code>', '<code>wp-config.php</code>' ) ; ?>
44
+ <br /><?php echo sprintf( __( 'By default a gray image placeholder %s will be used.', 'litespeed-cache' ), '<code>data:image/gif;base64,R0lGODdhAQABAPAAAMPDwwAAACwAAAAAAQABAAACAkQBADs=</code>' ) ; ?>
45
+ <br /><?php echo sprintf( __( 'For example, %s can be used for a transparent placeholder.', 'litespeed-cache' ), '<code>data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7</code>' ) ; ?>
46
+ </div>
47
+ </td>
48
+ </tr>
49
+
50
+ <tr>
51
+ <th><?php echo __( 'Lazy Load Iframes', 'litespeed-cache' ) ; ?></th>
52
+ <td>
53
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY ) ; ?>
54
+ <div class="litespeed-desc">
55
+ <?php echo __( 'Load iframes only when they enter the viewport.', 'litespeed-cache' ) ; ?>
56
+ <?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
57
+ </div>
58
+ </td>
59
+ </tr>
60
+
61
+
62
+ </tbody></table>
admin/tpl/{settings_optimize.php → setting/settings_optimize.php} RENAMED
@@ -56,6 +56,11 @@ if ( ! defined( 'WPINC' ) ) die ;
56
  <?php echo __( 'Listed CSS files will not be minified/combined.', 'litespeed-cache' ) ; ?>
57
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
58
  <?php echo __('One per line.', 'litespeed-cache'); ?>
 
 
 
 
 
59
  </div>
60
  </td>
61
  </tr>
@@ -98,6 +103,11 @@ if ( ! defined( 'WPINC' ) ) die ;
98
  <?php echo __( 'Listed JS files will not be minified/combined.', 'litespeed-cache' ) ; ?>
99
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
100
  <?php echo __('One per line.', 'litespeed-cache'); ?>
 
 
 
 
 
101
  </div>
102
  </td>
103
  </tr>
@@ -152,6 +162,10 @@ if ( ! defined( 'WPINC' ) ) die ;
152
  <div class="litespeed-desc">
153
  <?php echo __( 'Optimize CSS delivery. This will load Google Fonts asynchronously too.', 'litespeed-cache' ) ; ?>
154
  <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?>
 
 
 
 
155
  </div>
156
  </td>
157
  </tr>
@@ -159,7 +173,7 @@ if ( ! defined( 'WPINC' ) ) die ;
159
  <tr>
160
  <th><?php echo __( 'Critical CSS Rules', 'litespeed-cache' ) ; ?></th>
161
  <td>
162
- <?php $this->build_textarea( LiteSpeed_Cache_Config::ITEM_OPTM_CSS, get_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ) ; ?>
163
  <div class="litespeed-desc">
164
  <?php echo sprintf( __( 'Specify critical CSS rules for above-the-fold content when enabling %s.', 'litespeed-cache' ), __( 'Load CSS Asynchronously', 'litespeed-cache' ) ) ; ?>
165
  </div>
@@ -177,6 +191,23 @@ if ( ! defined( 'WPINC' ) ) die ;
177
  </td>
178
  </tr>
179
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  <tr>
181
  <th><?php echo __( 'Remove WordPress Emoji', 'litespeed-cache' ) ; ?></th>
182
  <td>
@@ -201,4 +232,18 @@ if ( ! defined( 'WPINC' ) ) die ;
201
  </td>
202
  </tr>
203
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
  </tbody></table>
56
  <?php echo __( 'Listed CSS files will not be minified/combined.', 'litespeed-cache' ) ; ?>
57
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
58
  <?php echo __('One per line.', 'litespeed-cache'); ?>
59
+ <br /><font class="litespeed-success">
60
+ <?php echo __('API:', 'litespeed-cache'); ?>
61
+ <?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_cache_optimize_css_excludes</code>' ) ; ?>
62
+ <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ) ; ?>
63
+ </font>
64
  </div>
65
  </td>
66
  </tr>
103
  <?php echo __( 'Listed JS files will not be minified/combined.', 'litespeed-cache' ) ; ?>
104
  <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
105
  <?php echo __('One per line.', 'litespeed-cache'); ?>
106
+ <br /><font class="litespeed-success">
107
+ <?php echo __('API:', 'litespeed-cache'); ?>
108
+ <?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_cache_optimize_js_excludes</code>' ) ; ?>
109
+ <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-optimize="1"</code>' ) ; ?>
110
+ </font>
111
  </div>
112
  </td>
113
  </tr>
162
  <div class="litespeed-desc">
163
  <?php echo __( 'Optimize CSS delivery. This will load Google Fonts asynchronously too.', 'litespeed-cache' ) ; ?>
164
  <?php echo __( 'This can improve your speed score in services like Pingdom, GTmetrix and PageSpeed.', 'litespeed-cache' ) ; ?>
165
+ <br /><font class="litespeed-success">
166
+ <?php echo __('API:', 'litespeed-cache'); ?>
167
+ <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-async="1"</code>' ) ; ?>
168
+ </font>
169
  </div>
170
  </td>
171
  </tr>
173
  <tr>
174
  <th><?php echo __( 'Critical CSS Rules', 'litespeed-cache' ) ; ?></th>
175
  <td>
176
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ; ?>
177
  <div class="litespeed-desc">
178
  <?php echo sprintf( __( 'Specify critical CSS rules for above-the-fold content when enabling %s.', 'litespeed-cache' ), __( 'Load CSS Asynchronously', 'litespeed-cache' ) ) ; ?>
179
  </div>
191
  </td>
192
  </tr>
193
 
194
+ <tr>
195
+ <th><?php echo __( 'JS Deferred Excludes', 'litespeed-cache' ) ; ?></th>
196
+ <td>
197
+ <?php $this->build_textarea2( LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ) ; ?>
198
+ <div class="litespeed-desc">
199
+ <?php echo __( 'Listed JS files will not be deferred.', 'litespeed-cache' ) ; ?>
200
+ <?php echo __( 'Both full URLs and partial strings can be used.', 'litespeed-cache' ) ; ?>
201
+ <?php echo __('One per line.', 'litespeed-cache'); ?>
202
+ <br /><font class="litespeed-success">
203
+ <?php echo __('API:', 'litespeed-cache'); ?>
204
+ <?php echo sprintf( __( 'Filter %s is supported.', 'litespeed-cache' ), '<code>litespeed_optm_js_defer_exc</code>' ) ; ?>
205
+ <?php echo sprintf( __( 'Elements with attribute %s in html code will be excluded.', 'litespeed-cache' ), '<code>data-no-defer="1"</code>' ) ; ?>
206
+ </font>
207
+ </div>
208
+ </td>
209
+ </tr>
210
+
211
  <tr>
212
  <th><?php echo __( 'Remove WordPress Emoji', 'litespeed-cache' ) ; ?></th>
213
  <td>
232
  </td>
233
  </tr>
234
 
235
+ <tr>
236
+ <th><?php echo __( 'Exclude JQuery', 'litespeed-cache' ) ; ?></th>
237
+ <td>
238
+ <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ; ?>
239
+ <div class="litespeed-desc">
240
+ <?php echo sprintf( __( 'Improve compatibility with inline JS by preventing jQuery optimization. (Recommended Setting: %s)', 'litespeed-cache' ), __( 'ON', 'litespeed-cache' ) ) ; ?>
241
+ <br /><font class="litespeed-warning">
242
+ <?php echo __('NOTE:', 'litespeed-cache'); ?>
243
+ <?php echo sprintf( __( 'If there is any JS error related to %1$s when enabled %2$s, please try this option.', 'litespeed-cache' ), 'jQuery', __( 'JS Combine', 'litespeed-cache' ) ) ; ?>
244
+ </font>
245
+ </div>
246
+ </td>
247
+ </tr>
248
+
249
  </tbody></table>
admin/tpl/{settings_purge.php → setting/settings_purge.php} RENAMED
@@ -37,7 +37,7 @@ $breakArr = array(
37
  <table><tbody>
38
 
39
  <?php if (!is_multisite()): ?>
40
- <?php require LSWCP_DIR . 'admin/tpl/settings_inc.purge_on_upgrade.php'; ?>
41
  <?php endif; ?>
42
 
43
  <tr>
37
  <table><tbody>
38
 
39
  <?php if (!is_multisite()): ?>
40
+ <?php require LSWCP_DIR . 'admin/tpl/setting/settings_inc.purge_on_upgrade.php'; ?>
41
  <?php endif; ?>
42
 
43
  <tr>
admin/tpl/settings.php CHANGED
@@ -81,7 +81,7 @@ else {
81
  }
82
 
83
 
84
- include_once LSWCP_DIR . "admin/tpl/banner_promo.php" ;
85
  ?>
86
 
87
  <div class="wrap">
@@ -128,7 +128,7 @@ include_once LSWCP_DIR . "admin/tpl/banner_promo.php" ;
128
  // include all tpl for faster UE
129
  foreach ($menu_list as $tab => $val) {
130
  echo "<div data-litespeed-layout='$tab'>" ;
131
- require LSWCP_DIR . "admin/tpl/settings_$tab.php" ;
132
  echo "</div>" ;
133
  }
134
 
81
  }
82
 
83
 
84
+ include_once LSWCP_DIR . "admin/tpl/inc/banner_promo.php" ;
85
  ?>
86
 
87
  <div class="wrap">
128
  // include all tpl for faster UE
129
  foreach ($menu_list as $tab => $val) {
130
  echo "<div data-litespeed-layout='$tab'>" ;
131
+ require LSWCP_DIR . "admin/tpl/setting/settings_$tab.php" ;
132
  echo "</div>" ;
133
  }
134
 
admin/tpl/settings_media.php DELETED
@@ -1,32 +0,0 @@
1
- <?php
2
- if ( ! defined( 'WPINC' ) ) die ;
3
-
4
- ?>
5
-
6
- <h3 class="litespeed-title"><?php echo __( 'Media Settings', 'litespeed-cache' ) ; ?></h3>
7
-
8
- <table><tbody>
9
- <tr>
10
- <th><?php echo __( 'Lazyload Images', 'litespeed-cache' ) ; ?></th>
11
- <td>
12
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY ) ; ?>
13
- <div class="litespeed-desc">
14
- <?php echo __( 'Load images only when they enter the viewport.', 'litespeed-cache' ) ; ?>
15
- <?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
16
- </div>
17
- </td>
18
- </tr>
19
-
20
- <tr>
21
- <th><?php echo __( 'Lazyload Iframes', 'litespeed-cache' ) ; ?></th>
22
- <td>
23
- <?php $this->build_switch( LiteSpeed_Cache_Config::OPID_MEDIA_IFRAME_LAZY ) ; ?>
24
- <div class="litespeed-desc">
25
- <?php echo __( 'Load iframes only when they enter the viewport.', 'litespeed-cache' ) ; ?>
26
- <?php echo __( 'This can improve page loading time by reducing initial HTTP requests.', 'litespeed-cache' ) ; ?>
27
- </div>
28
- </td>
29
- </tr>
30
-
31
-
32
- </tbody></table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cli/litespeed-cache-cli-admin.class.php CHANGED
@@ -47,6 +47,7 @@ class LiteSpeed_Cache_Cli_Admin
47
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
48
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
49
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
 
50
 
51
  LiteSpeed_Cache_Config::OPID_CDN,
52
  LiteSpeed_Cache_Config::OPID_CDN_INC_IMG,
@@ -144,6 +145,7 @@ class LiteSpeed_Cache_Cli_Admin
144
  case LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC:
145
  case LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER:
146
  case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
 
147
 
148
  case LiteSpeed_Cache_Config::OPID_CDN:
149
  case LiteSpeed_Cache_Config::OPID_CDN_INC_IMG:
47
  LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC,
48
  LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER,
49
  LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM,
50
+ LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY,
51
 
52
  LiteSpeed_Cache_Config::OPID_CDN,
53
  LiteSpeed_Cache_Config::OPID_CDN_INC_IMG,
145
  case LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC:
146
  case LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER:
147
  case LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM:
148
+ case LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY:
149
 
150
  case LiteSpeed_Cache_Config::OPID_CDN:
151
  case LiteSpeed_Cache_Config::OPID_CDN_INC_IMG:
cli/litespeed-cache-cli-purge.class.php CHANGED
File without changes
css/litespeed.css CHANGED
@@ -17,6 +17,10 @@
17
  display: inline-block;
18
  }
19
 
 
 
 
 
20
  .litespeed-warning {
21
  color: #e59544!important;
22
  }
@@ -43,6 +47,7 @@
43
  color: #9e9e9e;
44
  color: #7a919e;
45
  margin: 10px 5px;
 
46
  }
47
 
48
  .litespeed-hide {
17
  display: inline-block;
18
  }
19
 
20
+ .litespeed-success {
21
+ color: #73b38d!important;
22
+ }
23
+
24
  .litespeed-warning {
25
  color: #e59544!important;
26
  }
47
  color: #9e9e9e;
48
  color: #7a919e;
49
  margin: 10px 5px;
50
+ line-height: 1.7;
51
  }
52
 
53
  .litespeed-hide {
img/Litespeed.icon.svg CHANGED
File without changes
img/icons/purge-cssjs.svg CHANGED
File without changes
img/lscwp-logo_256x256.png CHANGED
File without changes
inc/activation.class.php ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin activation class.
4
+ *
5
+ * @since 1.1.0
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+ class LiteSpeed_Cache_Activation
12
+ {
13
+ const NETWORK_TRANSIENT_COUNT = 'lscwp_network_count' ;
14
+
15
+ /**
16
+ * The activation hook callback.
17
+ *
18
+ * Attempts to set up the advanced cache file. If it fails for any reason,
19
+ * the plugin will not activate.
20
+ *
21
+ * @since 1.0.0
22
+ * @access public
23
+ */
24
+ public static function register_activation()
25
+ {
26
+ $count = 0 ;
27
+ ! defined( 'LSCWP_LOG_TAG' ) && define( 'LSCWP_LOG_TAG', 'Activate_' . get_current_blog_id() ) ;
28
+
29
+ self::try_copy_advanced_cache() ;
30
+ LiteSpeed_Cache_Config::wp_cache_var_setter( true ) ;
31
+
32
+ if ( is_multisite() ) {
33
+ $count = self::get_network_count() ;
34
+ if ( $count !== false ) {
35
+ $count = intval( $count ) + 1 ;
36
+ set_site_transient( self::NETWORK_TRANSIENT_COUNT, $count, DAY_IN_SECONDS ) ;
37
+ }
38
+ }
39
+ do_action( 'litespeed_cache_api_load_thirdparty' ) ;
40
+ LiteSpeed_Cache_Config::get_instance()->plugin_activation( $count ) ;
41
+ LiteSpeed_Cache_Admin_Report::get_instance()->generate_environment_report() ;
42
+
43
+ if ( defined( 'LSCWP_PLUGIN_NAME' ) ) {
44
+ set_transient( LiteSpeed_Cache::WHM_TRANSIENT, LiteSpeed_Cache::WHM_TRANSIENT_VAL ) ;
45
+ }
46
+
47
+ // Register crawler cron task
48
+ LiteSpeed_Cache_Task::update() ;
49
+ }
50
+
51
+ /**
52
+ * Uninstall plugin
53
+ * @since 1.1.0
54
+ */
55
+ public static function uninstall_litespeed_cache()
56
+ {
57
+ LiteSpeed_Cache_Task::clear() ;
58
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
59
+ delete_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
60
+ if ( is_multisite() ) {
61
+ delete_site_option( LiteSpeed_Cache_Config::OPTION_NAME ) ;
62
+ }
63
+ }
64
+
65
+ /**
66
+ * Get the blog ids for the network. Accepts function arguments.
67
+ *
68
+ * Will use wp_get_sites for WP versions less than 4.6
69
+ *
70
+ * @since 1.0.12
71
+ * @access public
72
+ * @param array $args Arguments to pass into get_sites/wp_get_sites.
73
+ * @return array The array of blog ids.
74
+ */
75
+ public static function get_network_ids( $args = array() )
76
+ {
77
+ global $wp_version ;
78
+ if ( version_compare( $wp_version, '4.6', '<' ) ) {
79
+ $blogs = wp_get_sites( $args ) ;
80
+ if ( ! empty( $blogs ) ) {
81
+ foreach ( $blogs as $key => $blog ) {
82
+ $blogs[ $key ] = $blog[ 'blog_id' ] ;
83
+ }
84
+ }
85
+ }
86
+ else {
87
+ $args[ 'fields' ] = 'ids' ;
88
+ $blogs = get_sites( $args ) ;
89
+ }
90
+ return $blogs ;
91
+ }
92
+
93
+ /**
94
+ * Gets the count of active litespeed cache plugins on multisite.
95
+ *
96
+ * @since 1.0.12
97
+ * @access private
98
+ * @return mixed The count on success, false on failure.
99
+ */
100
+ private static function get_network_count()
101
+ {
102
+ $count = get_site_transient( self::NETWORK_TRANSIENT_COUNT ) ;
103
+ if ( $count !== false ) {
104
+ return intval( $count ) ;
105
+ }
106
+ // need to update
107
+ $default = array() ;
108
+ $count = 0 ;
109
+
110
+ $sites = self::get_network_ids( array( 'deleted' => 0 ) ) ;
111
+ if ( empty( $sites ) ) {
112
+ return false ;
113
+ }
114
+
115
+ foreach ( $sites as $site ) {
116
+ $bid = is_object( $site ) && property_exists( $site, 'blog_id' ) ? $site->blog_id : $site ;
117
+ $plugins = get_blog_option( $bid , 'active_plugins', $default ) ;
118
+ if ( in_array( LSWCP_BASENAME, $plugins, true ) ) {
119
+ $count++ ;
120
+ }
121
+ }
122
+ if ( is_plugin_active_for_network( LSWCP_BASENAME ) ) {
123
+ $count++ ;
124
+ }
125
+ return $count ;
126
+ }
127
+
128
+ /**
129
+ * Is this deactivate call the last active installation on the multisite
130
+ * network?
131
+ *
132
+ * @since 1.0.12
133
+ * @access private
134
+ * @return bool True if yes, false otherwise.
135
+ */
136
+ private static function is_deactivate_last()
137
+ {
138
+ $count = self::get_network_count() ;
139
+ if ( $count === false ) {
140
+ return false ;
141
+ }
142
+ if ( $count !== 1 ) {
143
+ // Not deactivating the last one.
144
+ $count-- ;
145
+ set_site_transient( self::NETWORK_TRANSIENT_COUNT, $count, DAY_IN_SECONDS ) ;
146
+ return false ;
147
+ }
148
+
149
+ delete_site_transient( self::NETWORK_TRANSIENT_COUNT ) ;
150
+ return true ;
151
+ }
152
+
153
+ /**
154
+ * The deactivation hook callback.
155
+ *
156
+ * Initializes all clean up functionalities.
157
+ *
158
+ * @since 1.0.0
159
+ * @access public
160
+ */
161
+ public static function register_deactivation()
162
+ {
163
+ LiteSpeed_Cache_Task::clear() ;
164
+
165
+ ! defined( 'LSCWP_LOG_TAG' ) && define( 'LSCWP_LOG_TAG', 'Deactivate_' . get_current_blog_id() ) ;
166
+
167
+ LiteSpeed_Cache_Purge::purge_all() ;
168
+
169
+ if ( is_multisite() ) {
170
+
171
+ if ( ! self::is_deactivate_last() ) {
172
+ if ( is_network_admin() ) {
173
+ // Still other activated subsite left, set .htaccess with only CacheLookUp
174
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
175
+ }
176
+ return ;
177
+ }
178
+ }
179
+
180
+ $adv_cache_path = LSWCP_CONTENT_DIR . '/advanced-cache.php' ;
181
+ // this file can be generated by other cache plugin like w3tc, we only delete our own file
182
+ if ( file_exists( $adv_cache_path ) && is_writable( $adv_cache_path ) ) {
183
+ if ( strpos( file_get_contents( $adv_cache_path ), 'LSCACHE_ADV_CACHE' ) !== false ) {
184
+ unlink( $adv_cache_path ) ;
185
+ }
186
+ else {
187
+ error_log(' Keep advanced-cache.php as it belongs to other plugins' ) ;
188
+ }
189
+ }
190
+ else {
191
+ error_log( 'Failed to remove advanced-cache.php, file does not exist or is not writable!' ) ;
192
+ }
193
+
194
+ if ( ! LiteSpeed_Cache_Config::wp_cache_var_setter( false ) ) {
195
+ error_log('In wp-config.php: WP_CACHE could not be set to false during deactivation!') ;
196
+ }
197
+
198
+ LiteSpeed_Cache_Admin_Rules::get_instance()->clear_rules( true ) ;
199
+
200
+ // delete in case it's not deleted prior to deactivation.
201
+ self::dismiss_whm() ;
202
+ }
203
+
204
+ /**
205
+ * Try to copy our advanced-cache.php file to the wordpress directory.
206
+ *
207
+ * @since 1.0.11
208
+ * @access public
209
+ * @return boolean True on success, false on failure.
210
+ */
211
+ public static function try_copy_advanced_cache()
212
+ {
213
+ $adv_cache_path = LSWCP_CONTENT_DIR . '/advanced-cache.php' ;
214
+ if ( file_exists( $adv_cache_path ) && ( filesize( $adv_cache_path ) !== 0 || ! is_writable( $adv_cache_path ) ) ) {
215
+ return false ;
216
+ }
217
+
218
+ copy( LSWCP_DIR . 'includes/advanced-cache.php', $adv_cache_path ) ;
219
+ include( $adv_cache_path ) ;
220
+ $ret = defined( 'LSCACHE_ADV_CACHE' ) ;
221
+ return $ret ;
222
+ }
223
+
224
+ /**
225
+ * Delete whm transient msg tag
226
+ *
227
+ * @since 1.1.1
228
+ * @access public
229
+ */
230
+ public static function dismiss_whm()
231
+ {
232
+ delete_transient( LiteSpeed_Cache::WHM_TRANSIENT ) ;
233
+ }
234
+
235
+
236
+ }
inc/api.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The plugin API class.
5
  *
6
- * @since 1.1.3
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
  class LiteSpeed_Cache_API
12
  {
3
  /**
4
  * The plugin API class.
5
  *
6
+ * @since 1.1.3
7
+ * @since 1.4 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
  class LiteSpeed_Cache_API
13
  {
inc/cdn.class.php ADDED
@@ -0,0 +1,451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The CDN class.
5
+ *
6
+ * @since 1.2.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+
13
+ class LiteSpeed_Cache_CDN
14
+ {
15
+ private static $_instance ;
16
+
17
+ const BYPASS = 'LITESPEED_BYPASS_CDN' ;
18
+
19
+ private $content ;
20
+
21
+ private $cfg_cdn ;
22
+ private $cfg_url_ori ;
23
+ private $cfg_cdn_url ;
24
+ private $cfg_cdn_inc_img ;
25
+ private $cfg_cdn_inc_css ;
26
+ private $cfg_cdn_inc_js ;
27
+ private $cfg_cdn_filetype ;
28
+ private $cfg_cdn_exclude ;
29
+ private $cfg_cdn_remote_jquery ;
30
+
31
+ /**
32
+ * Init
33
+ *
34
+ * @since 1.2.3
35
+ * @access private
36
+ */
37
+ private function __construct()
38
+ {
39
+ LiteSpeed_Cache_Log::debug2( 'CDN init' ) ;
40
+
41
+ if ( ! $this->can_cdn() ) {
42
+ if ( ! defined( self::BYPASS ) ) {
43
+ define( self::BYPASS, true ) ;
44
+ }
45
+ return ;
46
+ }
47
+
48
+ /**
49
+ * Remotely load jQuery
50
+ * This is separate from CDN on/off
51
+ * @since 1.5
52
+ */
53
+ $this->cfg_cdn_remote_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ) ;
54
+ if ( $this->cfg_cdn_remote_jquery ) {
55
+ add_action( 'init', array( $this, 'load_jquery_remotely' ) ) ;
56
+ }
57
+
58
+ $this->cfg_cdn = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN ) ;
59
+ if ( ! $this->cfg_cdn ) {
60
+ if ( ! defined( self::BYPASS ) ) {
61
+ define( self::BYPASS, true ) ;
62
+ }
63
+ return ;
64
+ }
65
+
66
+ $this->cfg_url_ori = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_ORI ) ;
67
+ $this->cfg_cdn_url = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_URL ) ;
68
+ if ( ! $this->cfg_url_ori || ! $this->cfg_cdn_url ) {
69
+ if ( ! defined( self::BYPASS ) ) {
70
+ define( self::BYPASS, true ) ;
71
+ }
72
+ return ;
73
+ }
74
+
75
+ // Check if need preg_replace
76
+ if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
77
+ LiteSpeed_Cache_Log::debug( 'CDN: wildcard rule in ' . $this->cfg_url_ori ) ;
78
+ $this->cfg_url_ori = preg_quote( $this->cfg_url_ori, '#' ) ;
79
+ $this->cfg_url_ori = str_replace( '\*', '.*', $this->cfg_url_ori ) ;
80
+ LiteSpeed_Cache_Log::debug2( 'CDN: translated rule is ' . $this->cfg_url_ori ) ;
81
+ }
82
+
83
+ $this->cfg_cdn_inc_img = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_IMG ) ;
84
+ $this->cfg_cdn_inc_css = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_CSS ) ;
85
+ $this->cfg_cdn_inc_js = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_INC_JS ) ;
86
+ $this->cfg_cdn_filetype = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_FILETYPE ) ;
87
+ if ( ! $this->cfg_cdn_inc_img && ! $this->cfg_cdn_inc_css && ! $this->cfg_cdn_inc_js && ! $this->cfg_cdn_filetype ) {
88
+ if ( ! defined( self::BYPASS ) ) {
89
+ define( self::BYPASS, true ) ;
90
+ }
91
+ return ;
92
+ }
93
+
94
+ $this->cfg_cdn_filetype = explode( "\n", $this->cfg_cdn_filetype ) ;
95
+
96
+ $this->cfg_cdn_exclude = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_EXCLUDE ) ;
97
+ $this->cfg_cdn_exclude = explode( "\n", $this->cfg_cdn_exclude ) ;
98
+
99
+ if ( $this->cfg_cdn_inc_img ) {
100
+ // Hook to srcset
101
+ if ( function_exists( 'wp_calculate_image_srcset' ) ) {
102
+ add_filter( 'wp_calculate_image_srcset', __CLASS__ . '::srcset', 999 ) ;
103
+ }
104
+ // Hook to mime icon
105
+ add_filter( 'wp_get_attachment_image_src', __CLASS__ . '::attach_img_src', 999 ) ;
106
+ add_filter( 'wp_get_attachment_url', __CLASS__ . '::url', 999 ) ;
107
+ }
108
+
109
+ if ( $this->cfg_cdn_inc_css ) {
110
+ add_filter( 'style_loader_src', __CLASS__ . '::url', 999 ) ;
111
+ }
112
+
113
+ if ( $this->cfg_cdn_inc_js ) {
114
+ add_filter( 'script_loader_src', __CLASS__ . '::url', 999 ) ;
115
+ }
116
+
117
+ }
118
+
119
+ /**
120
+ * Check if the host is the CDN internal host
121
+ *
122
+ * @since 1.2.3
123
+ *
124
+ */
125
+ public static function internal( $host )
126
+ {
127
+ if ( defined( self::BYPASS ) ) {
128
+ return false ;
129
+ }
130
+
131
+ if ( ! defined( 'LITESPEED_CDN_HOST' ) ) {
132
+ $instance = self::get_instance() ;
133
+ define( 'LITESPEED_CDN_HOST', parse_url( $instance->cfg_cdn_url, PHP_URL_HOST ) ) ;
134
+ }
135
+
136
+ return $host === LITESPEED_CDN_HOST ;
137
+ }
138
+
139
+ /**
140
+ * Run CDN process
141
+ * NOTE: As this is after cache finalized, can NOT set any cache control anymore
142
+ *
143
+ * @since 1.2.3
144
+ * @access public
145
+ * @return string The content that is after optimization
146
+ */
147
+ public static function run( $content )
148
+ {
149
+ $instance = self::get_instance() ;
150
+ $instance->content = $content ;
151
+
152
+ $instance->_process() ;
153
+ return $instance->content ;
154
+ }
155
+
156
+ /**
157
+ * Check if it can use CDN replacement
158
+ *
159
+ * @since 1.2.3
160
+ * @access public
161
+ */
162
+ public function can_cdn()
163
+ {
164
+ if ( is_admin() ) {
165
+ return false ;
166
+ }
167
+
168
+ if ( is_feed() ) {
169
+ return false ;
170
+ }
171
+
172
+ if ( is_preview() ) {
173
+ return false ;
174
+ }
175
+
176
+ return true ;
177
+ }
178
+
179
+ /**
180
+ * Replace CDN url
181
+ *
182
+ * @since 1.2.3
183
+ * @access private
184
+ */
185
+ private function _process()
186
+ {
187
+ if ( defined( self::BYPASS ) ) {
188
+ LiteSpeed_Cache_Log::debug2( 'CDN bypass' ) ;
189
+ return ;
190
+ }
191
+
192
+ LiteSpeed_Cache_Log::debug( 'CDN _process' ) ;
193
+
194
+ // Start replacing img src
195
+ if ( $this->cfg_cdn_inc_img ) {
196
+ $this->_replace_img() ;
197
+ $this->_replace_inline_css() ;
198
+ }
199
+
200
+ if ( $this->cfg_cdn_filetype ) {
201
+ $this->_replace_file_types() ;
202
+ }
203
+
204
+ }
205
+
206
+ /**
207
+ * Parse all file types
208
+ *
209
+ * @since 1.2.3
210
+ * @access private
211
+ */
212
+ private function _replace_file_types()
213
+ {
214
+ preg_match_all( '#(src|data-src|href)\s*=\s*[\'"]([^\'"]+)[\'"]#i', $this->content, $matches ) ;
215
+ if ( empty( $matches[ 2 ] ) ) {
216
+ return ;
217
+ }
218
+ foreach ( $matches[ 2 ] as $k => $url ) {
219
+ $url_parsed = parse_url( $url ) ;
220
+ if ( empty( $url_parsed[ 'path' ] ) ) {
221
+ continue ;
222
+ }
223
+ $postfix = substr( $url_parsed[ 'path' ], strrpos( $url_parsed[ 'path' ], '.' ) ) ;
224
+ if ( ! in_array( $postfix, $this->cfg_cdn_filetype ) ) {
225
+ continue ;
226
+ }
227
+
228
+ LiteSpeed_Cache_Log::debug2( 'CDN matched file_type ' . $postfix . ' : ' . $url ) ;
229
+
230
+ if( ! $url2 = $this->rewrite( $url ) ) {
231
+ continue ;
232
+ }
233
+
234
+ $attr = str_replace( $url, $url2, $matches[ 0 ][ $k ] ) ;
235
+ $this->content = str_replace( $matches[ 0 ][ $k ], $attr, $this->content ) ;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * Parse all images
241
+ *
242
+ * @since 1.2.3
243
+ * @access private
244
+ */
245
+ private function _replace_img()
246
+ {
247
+ preg_match_all( '#<img([^>]+?)src=([\'"\\\]*)([^\'"\s\\\>]+)([\'"\\\]*)([^>]*)>#i', $this->content, $matches ) ;
248
+ foreach ( $matches[ 3 ] as $k => $url ) {
249
+ // Check if is a DATA-URI
250
+ if ( strpos( $url, 'data:image' ) !== false ) {
251
+ continue ;
252
+ }
253
+
254
+ if ( ! $url2 = $this->rewrite( $url ) ) {
255
+ continue ;
256
+ }
257
+
258
+ $html_snippet = sprintf(
259
+ '<img %1$s src=%2$s %3$s>',
260
+ $matches[ 1 ][ $k ],
261
+ $matches[ 2 ][ $k ] . $url2 . $matches[ 4 ][ $k ],
262
+ $matches[ 5 ][ $k ]
263
+ ) ;
264
+ $this->content = str_replace( $matches[ 0 ][ $k ], $html_snippet, $this->content ) ;
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Parse and replace all inline styles containing url()
270
+ *
271
+ * @since 1.2.3
272
+ * @access private
273
+ */
274
+ private function _replace_inline_css()
275
+ {
276
+ // preg_match_all( '/url\s*\(\s*(?!["\']?data:)(?![\'|\"]?[\#|\%|])([^)]+)\s*\)([^;},\s]*)/i', $this->content, $matches ) ;
277
+ preg_match_all( '#url\((?![\'"]?data)[\'"]?([^\)\'"]+)[\'"]?\)#i', $this->content, $matches ) ;
278
+ foreach ( $matches[ 1 ] as $k => $url ) {
279
+ $url = str_replace( array( ' ', '\t', '\n', '\r', '\0', '\x0B', '"', "'", '&quot;', '&#039;' ), '', $url ) ;
280
+
281
+ if ( ! $url2 = $this->rewrite( $url ) ) {
282
+ continue ;
283
+ }
284
+ $attr = str_replace( $matches[ 1 ][ $k ], $url2, $matches[ 0 ][ $k ] ) ;
285
+ $this->content = str_replace( $matches[ 0 ][ $k ], $attr, $this->content ) ;
286
+ }
287
+ }
288
+
289
+ /**
290
+ * Hook to wp_get_attachment_image_src
291
+ *
292
+ * @since 1.2.3
293
+ * @access public
294
+ * @param array $img The URL of the attachment image src, the width, the height
295
+ * @return array
296
+ */
297
+ public static function attach_img_src( $img )
298
+ {
299
+ $instance = self::get_instance() ;
300
+ if ( $img && $url = $instance->rewrite( $img[ 0 ] ) ) {
301
+ $img[ 0 ] = $url ;
302
+ }
303
+ return $img ;
304
+ }
305
+
306
+ /**
307
+ * Try to rewrite one URL with CDN
308
+ *
309
+ * @since 1.2.3
310
+ * @access public
311
+ * @param string $url
312
+ * @return string
313
+ */
314
+ public static function url( $url )
315
+ {
316
+ $instance = self::get_instance() ;
317
+ if ( $url && $url2 = $instance->rewrite( $url ) ) {
318
+ $url = $url2 ;
319
+ }
320
+ return $url ;
321
+ }
322
+
323
+ /**
324
+ * Hook to replace WP responsive images
325
+ *
326
+ * @since 1.2.3
327
+ * @access public
328
+ * @param array $srcs
329
+ * @return array
330
+ */
331
+ public static function srcset( $srcs )
332
+ {
333
+ if ( $srcs ) {
334
+ $instance = self::get_instance() ;
335
+ foreach ( $srcs as $w => $data ) {
336
+ if( ! $url = $instance->rewrite( $data[ 'url' ] ) ) {
337
+ continue ;
338
+ }
339
+ $srcs[ $w ][ 'url' ] = $url ;
340
+ }
341
+ }
342
+ return $srcs ;
343
+ }
344
+
345
+ /**
346
+ * Replace URL to CDN URL
347
+ *
348
+ * @since 1.2.3
349
+ * @access public
350
+ * @param string $url
351
+ * @return string Replaced URL
352
+ */
353
+ public function rewrite( $url )
354
+ {
355
+ LiteSpeed_Cache_Log::debug2( 'CDN: try rewriting ' . $url ) ;
356
+ $url_parsed = parse_url( $url ) ;
357
+
358
+ // Only images under wp-cotnent/wp-includes can be replaced
359
+ if ( stripos( $url_parsed[ 'path' ], LSWCP_CONTENT_FOLDER ) === false && stripos( $url_parsed[ 'path' ], 'wp-includes' ) === false && stripos( $url_parsed[ 'path' ], '/min/' ) === false ) {
360
+ if ( defined( 'UPLOADS' ) && stripos( $url_parsed[ 'path' ], UPLOADS ) === false ) {
361
+ LiteSpeed_Cache_Log::debug2( 'CDN: rewriting failed: path not match ' ) ;
362
+ return false ;
363
+ }
364
+ }
365
+
366
+ // Check if is external url
367
+ if ( ! empty( $url_parsed[ 'host' ] ) && ! LiteSpeed_Cache_Utility::internal( $url_parsed[ 'host' ] ) ) {
368
+ LiteSpeed_Cache_Log::debug2( 'CDN: rewriting failed: host not internal' ) ;
369
+ return false ;
370
+ }
371
+
372
+ if ( $this->cfg_cdn_exclude ) {
373
+ foreach ( $this->cfg_cdn_exclude as $exclude ) {
374
+ if ( stripos( $url, $exclude ) !== false ) {
375
+ LiteSpeed_Cache_Log::debug2( 'CDN: Abort excludes ' . $exclude ) ;
376
+ return false ;
377
+ }
378
+ }
379
+ }
380
+
381
+ // Fill full url before replacement
382
+ if ( empty( $url_parsed[ 'host' ] ) ) {
383
+ $url = LiteSpeed_Cache_Utility::uri2url( $url ) ;
384
+ LiteSpeed_Cache_Log::debug2( 'CDN: fill before rewritten: ' . $url ) ;
385
+
386
+ $url_parsed = parse_url( $url ) ;
387
+ }
388
+
389
+ $scheme = ! empty( $url_parsed[ 'scheme' ] ) ? $url_parsed[ 'scheme' ] . ':' : '' ;
390
+ if ( $scheme ) {
391
+ LiteSpeed_Cache_Log::debug2( 'CDN: scheme from url: ' . $scheme ) ;
392
+ }
393
+
394
+ // Now lets replace CDN url
395
+ if ( strpos( $this->cfg_url_ori, '*' ) !== false ) {
396
+ $url = preg_replace( '#' . $scheme . $this->cfg_url_ori . '#iU', $this->cfg_cdn_url, $url ) ;
397
+ }
398
+ else {
399
+ $url = str_replace( $scheme . $this->cfg_url_ori, $this->cfg_cdn_url, $url ) ;
400
+ }
401
+ LiteSpeed_Cache_Log::debug2( 'CDN: after rewritten: ' . $url ) ;
402
+
403
+ return $url ;
404
+ }
405
+
406
+ /**
407
+ * Remote load jQuery remotely
408
+ *
409
+ * @since 1.5
410
+ * @access public
411
+ */
412
+ public function load_jquery_remotely()
413
+ {
414
+ // default jq version
415
+ $v = '1.12.4' ;
416
+
417
+ // load wp's jq version
418
+ global $wp_scripts ;
419
+ if ( isset( $wp_scripts->registered[ 'jquery' ]->ver ) ) {
420
+ $v = $wp_scripts->registered[ 'jquery' ]->ver ;
421
+ }
422
+
423
+ $src = $this->cfg_cdn_remote_jquery === LiteSpeed_Cache_Config::VAL_ON ? "//ajax.googleapis.com/ajax/libs/jquery/$v/jquery.min.js" : "//cdnjs.cloudflare.com/ajax/libs/jquery/$v/jquery.min.js" ;
424
+
425
+ LiteSpeed_Cache_Log::debug2( 'CDN: load_jquery_remotely: ' . $src ) ;
426
+
427
+ wp_deregister_script( 'jquery' ) ;
428
+
429
+ wp_register_script( 'jquery', $src, false, $v ) ;
430
+ }
431
+
432
+ /**
433
+ * Get the current instance object.
434
+ *
435
+ * @since 1.2.3
436
+ * @access public
437
+ * @return Current class instance.
438
+ */
439
+ public static function get_instance()
440
+ {
441
+ if ( ! isset(self::$_instance) ) {
442
+ self::$_instance = new self() ;
443
+ }
444
+
445
+ return self::$_instance ;
446
+ }
447
+
448
+ }
449
+
450
+
451
+
inc/config.class.php ADDED
@@ -0,0 +1,851 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The core plugin config class.
4
+ *
5
+ * This maintains all the options and settings for this plugin.
6
+ *
7
+ * @since 1.0.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
+ */
13
+ class LiteSpeed_Cache_Config
14
+ {
15
+ private static $_instance ;
16
+
17
+ const OPTION_NAME = 'litespeed-cache-conf' ;
18
+ const VARY_GROUP = 'litespeed-cache-vary-group' ;
19
+ const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
20
+ const ITEM_OPTM_JS_DEFER_EXC = 'litespeed-optm-js-defer-excludes' ;
21
+ const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
22
+
23
+ const VAL_OFF = 0 ;
24
+ const VAL_ON = 1 ;
25
+ const VAL_ON2 = 2 ;
26
+
27
+ const LOG_LEVEL_NONE = 0 ;
28
+ const LOG_LEVEL_ERROR = 1 ;
29
+ const LOG_LEVEL_NOTICE = 2 ;
30
+ const LOG_LEVEL_INFO = 3 ;
31
+ const LOG_LEVEL_DEBUG = 4 ;
32
+ const OPID_VERSION = 'version' ;
33
+ const OPID_ENABLED_RADIO = 'radio_select' ;
34
+
35
+ const OPID_CACHE_PRIV = 'cache_priv' ;
36
+ const OPID_CACHE_COMMENTER = 'cache_commenter' ;
37
+ const OPID_CACHE_REST = 'cache_rest' ;
38
+ const OPID_CACHE_PAGE_LOGIN = 'cache_page_login' ;
39
+ const OPID_CACHE_FAVICON = 'cache_favicon' ;
40
+ const OPID_CACHE_RES = 'cache_resources' ;
41
+ const OPID_CACHE_MOBILE = 'mobileview_enabled' ;
42
+ const ID_MOBILEVIEW_LIST = 'mobileview_rules' ;
43
+ const OPID_CACHE_URI_PRIV = 'cache_uri_priv' ;
44
+ const OPID_CACHE_BROWSER = 'cache_browser' ;
45
+
46
+ const OPID_PURGE_ON_UPGRADE = 'purge_upgrade' ;
47
+ const OPID_TIMED_URLS = 'timed_urls' ;
48
+ const OPID_TIMED_URLS_TIME = 'timed_urls_time' ;
49
+
50
+ const OPID_LOGIN_COOKIE = 'login_cookie' ;
51
+ const OPID_CHECK_ADVANCEDCACHE = 'check_advancedcache' ;
52
+ // do NOT set default options for these three, it is used for admin.
53
+ const ID_NOCACHE_COOKIES = 'nocache_cookies' ;
54
+ const ID_NOCACHE_USERAGENTS = 'nocache_useragents' ;
55
+ const OPID_DEBUG = 'debug' ;
56
+ const OPID_ADMIN_IPS = 'admin_ips' ;
57
+ const OPID_DEBUG_LEVEL = 'debug_level' ;
58
+ const OPID_LOG_FILE_SIZE = 'log_file_size' ;
59
+ const OPID_HEARTBEAT = 'heartbeat' ;
60
+ const OPID_DEBUG_COOKIE = 'debug_cookie' ;
61
+ const OPID_COLLAPS_QS = 'collaps_qs' ;
62
+ const OPID_LOG_FILTERS = 'log_filters' ;
63
+ const OPID_LOG_IGNORE_FILTERS = 'log_ignore_filters' ;
64
+ const OPID_LOG_IGNORE_PART_FILTERS = 'log_ignore_part_filters' ;
65
+
66
+ const OPID_PUBLIC_TTL = 'public_ttl' ;
67
+ const OPID_PRIVATE_TTL = 'private_ttl' ;
68
+ const OPID_FRONT_PAGE_TTL = 'front_page_ttl' ;
69
+ const OPID_FEED_TTL = 'feed_ttl' ;
70
+ const OPID_403_TTL = '403_ttl' ;
71
+ const OPID_404_TTL = '404_ttl' ;
72
+ const OPID_500_TTL = '500_ttl' ;
73
+ const OPID_PURGE_BY_POST = 'purge_by_post' ;
74
+ const OPID_ESI_ENABLE = 'esi_enabled' ;
75
+ const OPID_ESI_CACHE_ADMBAR = 'esi_cached_admbar' ;
76
+ const OPID_ESI_CACHE_COMMFORM = 'esi_cached_commform' ;
77
+ const PURGE_ALL_PAGES = '-' ;
78
+ const PURGE_FRONT_PAGE = 'F' ;
79
+ const PURGE_HOME_PAGE = 'H' ;
80
+ const PURGE_PAGES = 'PGS' ;
81
+ const PURGE_PAGES_WITH_RECENT_POSTS = 'PGSRP' ;
82
+ const PURGE_AUTHOR = 'A' ;
83
+ const PURGE_YEAR = 'Y' ;
84
+ const PURGE_MONTH = 'M' ;
85
+ const PURGE_DATE = 'D' ;
86
+ const PURGE_TERM = 'T' ; // include category|tag|tax
87
+ const PURGE_POST_TYPE = 'PT' ;
88
+ const OPID_EXCLUDES_URI = 'excludes_uri' ;
89
+ const OPID_EXCLUDES_QS = 'excludes_qs' ;
90
+ const OPID_EXCLUDES_CAT = 'excludes_cat' ;
91
+ const OPID_EXCLUDES_TAG = 'excludes_tag' ;
92
+
93
+ const OPID_CSS_MINIFY = 'css_minify' ;
94
+ const OPID_CSS_COMBINE = 'css_combine' ;
95
+ const OPID_CSS_HTTP2 = 'css_http2' ;
96
+ const OPID_CSS_EXCLUDES = 'css_exclude' ;
97
+ const OPID_JS_MINIFY = 'js_minify' ;
98
+ const OPID_JS_COMBINE = 'js_combine' ;
99
+ const OPID_JS_HTTP2 = 'js_http2' ;
100
+ const OPID_JS_EXCLUDES = 'js_exclude' ;
101
+ const OPID_OPTIMIZE_TTL = 'optimize_ttl' ;
102
+ const OPID_HTML_MINIFY = 'html_minify' ;
103
+ const OPID_OPTM_QS_RM = 'optm_qs_rm' ;
104
+ const OPID_OPTM_GGFONTS_RM = 'optm_ggfonts_rm' ;
105
+ const OPID_OPTM_CSS_ASYNC = 'optm_css_async' ;
106
+ const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
107
+ const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
108
+ const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
109
+ const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
110
+
111
+ const OPID_CDN = 'cdn' ;
112
+ const OPID_CDN_ORI = 'cdn_ori' ;
113
+ const OPID_CDN_URL = 'cdn_url' ;
114
+ const OPID_CDN_INC_IMG = 'cdn_inc_img' ;
115
+ const OPID_CDN_INC_CSS = 'cdn_inc_css' ;
116
+ const OPID_CDN_INC_JS = 'cdn_inc_js' ;
117
+ const OPID_CDN_FILETYPE = 'cdn_filetype' ;
118
+ const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
119
+ const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
120
+
121
+ const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
122
+ const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
123
+ const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
124
+
125
+ const HASH = 'hash' ;
126
+
127
+ const NETWORK_OPID_ENABLED = 'network_enabled' ;
128
+ const NETWORK_OPID_USE_PRIMARY = 'use_primary_settings' ;
129
+
130
+ const CRWL_POSTS = 'crawler_include_posts' ;
131
+ const CRWL_PAGES = 'crawler_include_pages' ;
132
+ const CRWL_CATS = 'crawler_include_cats' ;
133
+ const CRWL_TAGS = 'crawler_include_tags' ;
134
+ const CRWL_EXCLUDES_CPT = 'crawler_excludes_cpt' ;
135
+ const CRWL_ORDER_LINKS = 'crawler_order_links' ;
136
+ const CRWL_USLEEP = 'crawler_usleep' ;
137
+ const CRWL_RUN_DURATION = 'crawler_run_duration' ;
138
+ const CRWL_RUN_INTERVAL = 'crawler_run_interval' ;
139
+ const CRWL_CRAWL_INTERVAL = 'crawler_crawl_interval' ;
140
+ const CRWL_THREADS = 'crawler_threads' ;
141
+ const CRWL_LOAD_LIMIT = 'crawler_load_limit' ;
142
+ const CRWL_DOMAIN_IP = 'crawler_domain_ip' ;
143
+ const CRWL_CUSTOM_SITEMAP = 'crawler_custom_sitemap' ;
144
+
145
+ const CRWL_CRON_ACTIVE = 'crawler_cron_active' ;
146
+
147
+ const CRWL_DATE_DESC = 'date_desc' ;
148
+ const CRWL_DATE_ASC = 'date_asc' ;
149
+ const CRWL_ALPHA_DESC = 'alpha_desc' ;
150
+ const CRWL_ALPHA_ASC = 'alpha_asc' ;
151
+
152
+ protected $options ;
153
+ protected $vary_groups ;
154
+ protected $purge_options ;
155
+
156
+ /**
157
+ * Initialize the class and set its properties.
158
+ *
159
+ * @since 1.0.0
160
+ * @access private
161
+ */
162
+ private function __construct()
163
+ {
164
+ if ( is_multisite() ) {
165
+ $options = $this->construct_multisite_options() ;
166
+ }
167
+ else {
168
+ $options = get_option( self::OPTION_NAME, $this->get_default_options() ) ;
169
+ }
170
+
171
+ $this->options = $options ;
172
+ $this->purge_options = explode('.', $options[ self::OPID_PURGE_BY_POST ] ) ;
173
+
174
+ // Init global const cache on set
175
+ if ( $this->options[ self::OPID_ENABLED_RADIO ] === self::VAL_ON
176
+ // || ( is_multisite() && is_network_admin() && current_user_can( 'manage_network_options' ) && $this->options[ LiteSpeed_Cache_Config::NETWORK_OPID_ENABLED ] ) todo: need to check when primary is off and network is on, if can manage
177
+ ) {
178
+ defined( 'LITESPEED_ALLOWED' ) && ! defined( 'LITESPEED_ON' ) && define( 'LITESPEED_ON', true ) ;
179
+ }
180
+
181
+ // Check advanced_cache set
182
+ if ( isset( $this->options[ self::OPID_CHECK_ADVANCEDCACHE ] ) && $this->options[ self::OPID_CHECK_ADVANCEDCACHE ] === false && ! defined( 'LSCACHE_ADV_CACHE' ) ) {
183
+ define( 'LSCACHE_ADV_CACHE', true ) ;
184
+ }
185
+
186
+ // Vary group settings
187
+ $this->vary_groups = (array) get_option( self::VARY_GROUP ) ;
188
+
189
+ // Set security key if not initialized yet
190
+ if ( isset( $this->options[ self::HASH ] ) && empty( $this->options[ self::HASH ] ) ) {
191
+ $this->update_options( array( self::HASH => Litespeed_String::rrand( 32 ) ) ) ;
192
+ }
193
+
194
+ }
195
+
196
+ /**
197
+ * For multisite installations, the single site options need to be updated with the network wide options.
198
+ *
199
+ * @since 1.0.13
200
+ * @access private
201
+ * @return array The updated options.
202
+ */
203
+ private function construct_multisite_options()
204
+ {
205
+ $site_options = get_site_option( self::OPTION_NAME ) ;
206
+
207
+ if ( ! function_exists('is_plugin_active_for_network') ) { // todo: check if needed
208
+ require_once(ABSPATH . '/wp-admin/includes/plugin.php') ;
209
+ }
210
+
211
+ $options = get_option( self::OPTION_NAME, $this->get_default_options() ) ;
212
+
213
+ // If don't have site options
214
+ if ( ! $site_options || ! is_array( $site_options ) || ! is_plugin_active_for_network( 'litespeed-cache/litespeed-cache.php' ) ) {
215
+ if ( $options[ self::OPID_ENABLED_RADIO ] === self::VAL_ON2 ) { // Default to cache on
216
+ defined( 'LITESPEED_ALLOWED' ) && ! defined( 'LITESPEED_ON' ) && define( 'LITESPEED_ON', true ) ;
217
+ }
218
+ return $options ;
219
+ }
220
+
221
+ // If network set to use primary setting
222
+ if ( ! empty ( $site_options[ self::NETWORK_OPID_USE_PRIMARY ] ) ) {
223
+
224
+ // save temparary cron setting
225
+ $CRWL_CRON_ACTIVE = $options[ self::CRWL_CRON_ACTIVE ] ;
226
+
227
+ // Get the primary site settings
228
+ $options = get_blog_option( BLOG_ID_CURRENT_SITE, LiteSpeed_Cache_Config::OPTION_NAME, array() ) ;
229
+
230
+ // crawler cron activation is separated
231
+ $options[ self::CRWL_CRON_ACTIVE ] = $CRWL_CRON_ACTIVE ;
232
+ }
233
+
234
+ // If use network setting
235
+ if ( $options[ self::OPID_ENABLED_RADIO ] === self::VAL_ON2 && $site_options[ self::NETWORK_OPID_ENABLED ] ) {
236
+ defined( 'LITESPEED_ALLOWED' ) && ! defined( 'LITESPEED_ON' ) && define( 'LITESPEED_ON', true ) ;
237
+ }
238
+ // Set network eanble to on
239
+ if ( $site_options[ self::NETWORK_OPID_ENABLED ] ) {
240
+ ! defined( 'LITESPEED_NETWORK_ON' ) && define( 'LITESPEED_NETWORK_ON', true ) ;
241
+ }
242
+
243
+ // These two are not for single blog options
244
+ unset( $site_options[ self::NETWORK_OPID_ENABLED ] ) ;
245
+ unset( $site_options[ self::NETWORK_OPID_USE_PRIMARY ] ) ;
246
+
247
+ // Append site options to single blog options
248
+ $options = array_merge( $options, $site_options ) ;
249
+
250
+ return $options ;
251
+ }
252
+
253
+ /**
254
+ * Get the list of configured options for the blog.
255
+ *
256
+ * @since 1.0.0
257
+ * @access public
258
+ * @return array The list of configured options.
259
+ */
260
+ public function get_options()
261
+ {
262
+ return $this->options ;
263
+ }
264
+
265
+ /**
266
+ * Get the selected configuration option.
267
+ *
268
+ * @since 1.0.0
269
+ * @access public
270
+ * @param string $id Configuration ID.
271
+ * @return mixed Selected option if set, NULL if not.
272
+ */
273
+ public function get_option( $id )
274
+ {
275
+ if ( isset( $this->options[$id] ) ) {
276
+ return $this->options[$id] ;
277
+ }
278
+ if ( LiteSpeed_Cache_Log::initialized() ) {
279
+ LiteSpeed_Cache_Log::debug( 'Invalid option ID ' . $id ) ;
280
+ }
281
+ return NULL ;
282
+ }
283
+
284
+ /**
285
+ * Set the configured options.
286
+ *
287
+ * NOTE: No validation here. Do validate before use this function with LiteSpeed_Cache_Admin_Settings->validate_plugin_settings().
288
+ *
289
+ * @since 1.1.3
290
+ * @access public
291
+ * @param array $new_cfg The new settings to update, which will be update $this->options too.
292
+ * @return array The result of update.
293
+ */
294
+ public function update_options( $new_cfg = array() )
295
+ {
296
+ if ( ! empty( $new_cfg ) ) {
297
+ $this->options = array_merge( $this->options, $new_cfg ) ;
298
+ }
299
+ return update_option( self::OPTION_NAME, $this->options ) ;
300
+ }
301
+
302
+ /**
303
+ * Save frontend url to private cached uri/no cache uri
304
+ *
305
+ * @since 1.3
306
+ * @access public
307
+ */
308
+ public static function frontend_save()
309
+ {
310
+ if ( empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
311
+ exit( 'no referer' ) ;
312
+ }
313
+
314
+ if ( empty( $_GET[ 'type' ] ) ) {
315
+ exit( 'no type' ) ;
316
+ }
317
+
318
+ switch ( $_GET[ 'type' ] ) {
319
+ case 'private' :
320
+ $id = self::OPID_CACHE_URI_PRIV ;
321
+ break ;
322
+
323
+ case 'nonoptimize' :
324
+ $id = self::OPID_OPTM_EXCLUDES ;
325
+ break ;
326
+
327
+ case 'nocache' :
328
+ default:
329
+ $id = self::OPID_EXCLUDES_URI ;
330
+ break ;
331
+ }
332
+
333
+ $instance = self::get_instance() ;
334
+ $list = $instance->get_option( $id ) ;
335
+
336
+ $list = explode( "\n", $list ) ;
337
+ $list[] = $_SERVER[ 'HTTP_REFERER' ] ;
338
+ $list = array_map( 'LiteSpeed_Cache_Utility::make_relative', $list ) ;// Remove domain
339
+ $list = array_unique( $list ) ;
340
+ $list = array_filter( $list ) ;
341
+ $list = implode( "\n", $list ) ;
342
+
343
+ $instance->update_options( array( $id => $list ) ) ;
344
+
345
+ // Purge this page & redirect
346
+ LiteSpeed_Cache_Purge::frontend_purge() ;
347
+ exit() ;
348
+ }
349
+
350
+ /**
351
+ * Check if one user role is in vary group settings
352
+ *
353
+ * @since 1.2.0
354
+ * @access public
355
+ * @param string $role The user role
356
+ * @return int The set value if already set
357
+ */
358
+ public function in_vary_group( $role )
359
+ {
360
+ $group = 0 ;
361
+ if ( array_key_exists( $role, $this->vary_groups ) ) {
362
+ $group = $this->vary_groups[ $role ] ;
363
+ }
364
+ elseif ( $role === 'administrator' ) {
365
+ $group = 99 ;
366
+ }
367
+
368
+ return $group ;
369
+ }
370
+
371
+ /**
372
+ * Get the configured purge options.
373
+ *
374
+ * @since 1.0.0
375
+ * @access public
376
+ * @return array The list of purge options.
377
+ */
378
+ public function get_purge_options()
379
+ {
380
+ return $this->purge_options ;
381
+ }
382
+
383
+ /**
384
+ * Check if the flag type of posts should be purged on updates.
385
+ *
386
+ * @since 1.0.0
387
+ * @access public
388
+ * @param string $flag Post type. Refer to LiteSpeed_Cache_Config::PURGE_*
389
+ * @return boolean True if the post type should be purged, false otherwise.
390
+ */
391
+ public function purge_by_post( $flag )
392
+ {
393
+ return in_array( $flag, $this->purge_options ) ;
394
+ }
395
+
396
+ /**
397
+ * Gets the default single site options
398
+ *
399
+ * @since 1.0.0
400
+ * @access public
401
+ * @param bool $include_thirdparty Whether to include the thirdparty options.
402
+ * @return array An array of the default options.
403
+ */
404
+ public function get_default_options($include_thirdparty = true)
405
+ {
406
+ $default_purge_options = array(
407
+ self::PURGE_FRONT_PAGE,
408
+ self::PURGE_HOME_PAGE,
409
+ self::PURGE_PAGES,
410
+ self::PURGE_PAGES_WITH_RECENT_POSTS,
411
+ self::PURGE_AUTHOR,
412
+ self::PURGE_MONTH,
413
+ self::PURGE_TERM,
414
+ self::PURGE_POST_TYPE
415
+ ) ;
416
+ sort($default_purge_options) ;
417
+
418
+ //For multi site, default is 2 (Use Network Admin Settings). For single site, default is 1 (Enabled).
419
+ if ( is_multisite() ) {
420
+ $default_radio = 2 ;
421
+ }
422
+ else {
423
+ $default_radio = 1 ;
424
+ }
425
+
426
+ $default_options = array(
427
+ self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
428
+ self::OPID_ENABLED_RADIO => $default_radio,
429
+ self::OPID_PURGE_ON_UPGRADE => true,
430
+ self::OPID_CACHE_PRIV => true,
431
+ self::OPID_CACHE_COMMENTER => true,
432
+ self::OPID_CACHE_REST => true,
433
+ self::OPID_CACHE_PAGE_LOGIN => true,
434
+ self::OPID_TIMED_URLS => '',
435
+ self::OPID_TIMED_URLS_TIME => '',
436
+ self::OPID_CACHE_FAVICON => true,
437
+ self::OPID_CACHE_RES => true,
438
+ self::OPID_CACHE_MOBILE => false,
439
+ self::ID_MOBILEVIEW_LIST => false,
440
+ self::OPID_CACHE_URI_PRIV => '',
441
+ self::OPID_CACHE_BROWSER => false,
442
+
443
+ self::OPID_LOGIN_COOKIE => '',
444
+ self::OPID_CHECK_ADVANCEDCACHE => true,
445
+ self::OPID_DEBUG => self::LOG_LEVEL_NONE,
446
+ self::OPID_ADMIN_IPS => '127.0.0.1',
447
+ self::OPID_DEBUG_LEVEL => false,
448
+ self::OPID_LOG_FILE_SIZE => 30,
449
+ self::OPID_HEARTBEAT => true,
450
+ self::OPID_DEBUG_COOKIE => false,
451
+ self::OPID_COLLAPS_QS => false,
452
+ self::OPID_LOG_FILTERS => false,
453
+ self::OPID_LOG_IGNORE_FILTERS => "gettext\ngettext_with_context\nget_the_terms\nget_term",
454
+ self::OPID_LOG_IGNORE_PART_FILTERS => "i18n\nlocale\nsettings\noption",
455
+ self::OPID_PUBLIC_TTL => 604800,
456
+ self::OPID_PRIVATE_TTL => 1800,
457
+ self::OPID_FRONT_PAGE_TTL => 604800,
458
+ self::OPID_FEED_TTL => 0,
459
+ self::OPID_403_TTL => 3600,
460
+ self::OPID_404_TTL => 3600,
461
+ self::OPID_500_TTL => 3600,
462
+ self::OPID_PURGE_BY_POST => implode('.', $default_purge_options),
463
+ self::OPID_EXCLUDES_URI => '',
464
+ self::OPID_EXCLUDES_QS => '',
465
+ self::OPID_EXCLUDES_CAT => '',
466
+ self::OPID_EXCLUDES_TAG => '',
467
+
468
+ self::OPID_CSS_MINIFY => false,
469
+ self::OPID_CSS_COMBINE => false,
470
+ self::OPID_CSS_HTTP2 => false,
471
+ self::OPID_CSS_EXCLUDES => '',
472
+ self::OPID_JS_MINIFY => false,
473
+ self::OPID_JS_COMBINE => false,
474
+ self::OPID_JS_HTTP2 => false,
475
+ self::OPID_JS_EXCLUDES => '',
476
+ self::OPID_OPTIMIZE_TTL => 604800,
477
+ self::OPID_HTML_MINIFY => false,
478
+ self::OPID_OPTM_QS_RM => false,
479
+ self::OPID_OPTM_GGFONTS_RM => false,
480
+ self::OPID_OPTM_CSS_ASYNC => false,
481
+ self::OPID_OPTM_JS_DEFER => false,
482
+ self::OPID_OPTM_EMOJI_RM => false,
483
+ self::OPID_OPTM_EXCLUDES => '',
484
+ self::OPID_OPTM_EXC_JQUERY => true,
485
+
486
+ self::OPID_CDN => false,
487
+ self::OPID_CDN_ORI => '',
488
+ self::OPID_CDN_URL => '',
489
+ self::OPID_CDN_INC_IMG => false,
490
+ self::OPID_CDN_INC_CSS => false,
491
+ self::OPID_CDN_INC_JS => false,
492
+ self::OPID_CDN_FILETYPE => ".aac\n.css\n.eot\n.gif\n.jpeg\n.js\n.jpg\n.less\n.mp3\n.mp4\n.ogg\n.otf\n.pdf\n.png\n.svg\n.ttf\n.woff",
493
+ self::OPID_CDN_EXCLUDE => '',
494
+ self::OPID_CDN_REMOTE_JQUERY => false,
495
+
496
+ self::OPID_MEDIA_IMG_LAZY => false,
497
+ self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
498
+ self::OPID_MEDIA_IFRAME_LAZY => false,
499
+
500
+ self::HASH => '',
501
+
502
+ self::ID_NOCACHE_COOKIES => '',
503
+ self::ID_NOCACHE_USERAGENTS => '',
504
+ self::CRWL_POSTS => true,
505
+ self::CRWL_PAGES => true,
506
+ self::CRWL_CATS => true,
507
+ self::CRWL_TAGS => true,
508
+ self::CRWL_EXCLUDES_CPT => '',
509
+ self::CRWL_ORDER_LINKS => self::CRWL_DATE_DESC,
510
+ self::CRWL_USLEEP => 500,
511
+ self::CRWL_RUN_DURATION => 400,
512
+ self::CRWL_RUN_INTERVAL => 600,
513
+ self::CRWL_CRAWL_INTERVAL => 302400,
514
+ self::CRWL_THREADS => 3,
515
+ self::CRWL_LOAD_LIMIT => 1,
516
+ self::CRWL_DOMAIN_IP => '',
517
+ self::CRWL_CUSTOM_SITEMAP => '',
518
+ self::CRWL_CRON_ACTIVE => false,
519
+ ) ;
520
+
521
+ if ( LSWCP_ESI_SUPPORT ) {
522
+ $default_options[self::OPID_ESI_ENABLE] = false ;
523
+ $default_options[self::OPID_ESI_CACHE_ADMBAR] = true ;
524
+ $default_options[self::OPID_ESI_CACHE_COMMFORM] = true ;
525
+ }
526
+
527
+ if ( ! $include_thirdparty ) {
528
+ return $default_options ;
529
+ }
530
+
531
+ $tp_options = $this->get_thirdparty_options($default_options) ;
532
+ if ( ! isset($tp_options) || ! is_array($tp_options) ) {
533
+ return $default_options ;
534
+ }
535
+ return array_merge($default_options, $tp_options) ;
536
+ }
537
+
538
+ /**
539
+ * Gets the default network options
540
+ *
541
+ * @since 1.0.11
542
+ * @access protected
543
+ * @return array An array of the default options.
544
+ */
545
+ protected function get_default_site_options()
546
+ {
547
+ $default_site_options = array(
548
+ self::OPID_VERSION => LiteSpeed_Cache::PLUGIN_VERSION,
549
+ self::NETWORK_OPID_ENABLED => false,
550
+ self::NETWORK_OPID_USE_PRIMARY => false,
551
+ self::OPID_PURGE_ON_UPGRADE => true,
552
+ self::OPID_CACHE_FAVICON => true,
553
+ self::OPID_CACHE_RES => true,
554
+ self::OPID_CACHE_MOBILE => 0, // todo: why not false
555
+ self::ID_MOBILEVIEW_LIST => false,
556
+ self::OPID_CACHE_BROWSER => false,
557
+ self::OPID_LOGIN_COOKIE => '',
558
+ self::OPID_CHECK_ADVANCEDCACHE => true,
559
+ self::ID_NOCACHE_COOKIES => '',
560
+ self::ID_NOCACHE_USERAGENTS => '',
561
+ ) ;
562
+ return $default_site_options ;
563
+ }
564
+
565
+ /**
566
+ * Get the plugin's site wide options.
567
+ *
568
+ * If the site wide options are not set yet, set it to default.
569
+ *
570
+ * @since 1.0.2
571
+ * @access public
572
+ * @return array Returns the current site options.
573
+ */
574
+ public function get_site_options()
575
+ {
576
+ if ( ! is_multisite() ) {
577
+ return null ;
578
+ }
579
+ $site_options = get_site_option( self::OPTION_NAME ) ;
580
+
581
+ if ( isset( $site_options ) && is_array( $site_options ) ) {
582
+ return $site_options ;
583
+ }
584
+
585
+ $default_site_options = $this->get_default_site_options() ;
586
+ add_site_option( self::OPTION_NAME, $default_site_options ) ;
587
+
588
+ return $default_site_options ;
589
+ }
590
+
591
+ /**
592
+ * Gets the third party options.
593
+ * Will also strip the options that are actually normal options.
594
+ *
595
+ * @access public
596
+ * @since 1.0.9
597
+ * @param array $options Optional. The default options to compare against.
598
+ * @return mixed boolean on failure, array of keys on success.
599
+ */
600
+ public function get_thirdparty_options($options = null)
601
+ {
602
+ $tp_options = apply_filters('litespeed_cache_get_options', array()) ;
603
+ if ( empty($tp_options) ) {
604
+ return false ;
605
+ }
606
+ if ( ! isset($options) ) {
607
+ $options = $this->get_default_options(false) ;
608
+ }
609
+ return array_diff_key($tp_options, $options) ;
610
+ }
611
+
612
+ /**
613
+ * Helper function to convert the options to replicate the input format.
614
+ *
615
+ * The only difference is the checkboxes.
616
+ *
617
+ * @since 1.0.15
618
+ * @access public
619
+ * @param array $options The options array to port to input format.
620
+ * @return array $options The options array with input format.
621
+ */
622
+ public static function convert_options_to_input($options)
623
+ {
624
+ foreach ( $options as $key => $val ) {
625
+ if ( $val === true ) {
626
+ $options[$key] = self::VAL_ON ;
627
+ }
628
+ elseif ( $val === false ) {
629
+ $options[$key] = self::VAL_OFF ;
630
+ }
631
+ }
632
+ if ( isset($options[self::OPID_PURGE_BY_POST]) ) {
633
+ $purge_opts = explode('.', $options[self::OPID_PURGE_BY_POST]) ;
634
+
635
+ foreach ($purge_opts as $purge_opt) {
636
+ $options['purge_' . $purge_opt] = self::VAL_ON ;
637
+ }
638
+ }
639
+
640
+ return $options ;
641
+ }
642
+
643
+ /**
644
+ * Get the difference between the current options and the default options.
645
+ *
646
+ * @since 1.0.11
647
+ * @access public
648
+ * @param array $default_options The default options.
649
+ * @param array $options The current options.
650
+ * @return array New options.
651
+ */
652
+ public static function option_diff($default_options, $options)
653
+ {
654
+ $dkeys = array_keys($default_options) ;
655
+ $keys = array_keys($options) ;
656
+ $newkeys = array_diff($dkeys, $keys) ;
657
+ $log = '' ;//todo: useless
658
+ if ( ! empty($newkeys) ) {
659
+ foreach ( $newkeys as $newkey ) {
660
+ $options[$newkey] = $default_options[$newkey] ;
661
+ $log .= ' Added ' . $newkey . ' = ' . $default_options[$newkey] ;
662
+ }
663
+ }
664
+ $retiredkeys = array_diff($keys, $dkeys) ;
665
+ if ( ! empty($retiredkeys) ) {
666
+ foreach ( $retiredkeys as $retired ) {
667
+ unset($options[$retired]) ;
668
+ $log .= 'Removed ' . $retired ;
669
+ }
670
+ }
671
+ $options[self::OPID_VERSION] = LiteSpeed_Cache::PLUGIN_VERSION ;
672
+
673
+ return $options ;
674
+ }
675
+
676
+ /**
677
+ * Verify that the options are still valid.
678
+ *
679
+ * This is used only when upgrading the plugin versions.
680
+ *
681
+ * @since 1.0.0
682
+ * @access public
683
+ */
684
+ public function plugin_upgrade()
685
+ {
686
+ $default_options = $this->get_default_options() ;
687
+
688
+ if ( $this->options[ self::OPID_VERSION ] == $default_options[ self::OPID_VERSION ] && count( $default_options ) == count( $this->options ) ) {
689
+ return ;
690
+ }
691
+
692
+ $this->options = self::option_diff( $default_options, $this->options ) ;
693
+
694
+ $res = $this->update_options() ;
695
+ define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
696
+ LiteSpeed_Cache_Purge::purge_all() ;
697
+ LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
698
+ }
699
+
700
+ /**
701
+ * Upgrade network options when the plugin is upgraded.
702
+ *
703
+ * @since 1.0.11
704
+ * @access public
705
+ */
706
+ public function plugin_site_upgrade()
707
+ {
708
+ $default_options = $this->get_default_site_options() ;
709
+ $options = $this->get_site_options() ;
710
+
711
+ if ( $options[ self::OPID_VERSION ] == $default_options[ self::OPID_VERSION ] && count( $default_options ) == count( $options ) ) {
712
+ return ;
713
+ }
714
+
715
+ $options = self::option_diff( $default_options, $options ) ;
716
+
717
+ $res = update_site_option( self::OPTION_NAME, $options ) ;
718
+
719
+ LiteSpeed_Cache_Log::debug( "plugin_upgrade option changed = $res\n" ) ;
720
+ }
721
+
722
+ /**
723
+ * Update the WP_CACHE variable in the wp-config.php file.
724
+ *
725
+ * If enabling, check if the variable is defined, and if not, define it.
726
+ * Vice versa for disabling.
727
+ *
728
+ * @since 1.0.0
729
+ * @access public
730
+ * @param boolean $enable True if enabling, false if disabling.
731
+ * @return boolean True if the variable is the correct value, false if something went wrong.
732
+ */
733
+ public static function wp_cache_var_setter( $enable )
734
+ {
735
+ if ( $enable ) {
736
+ if ( defined( 'WP_CACHE' ) && WP_CACHE ) {
737
+ return true ;
738
+ }
739
+ }
740
+ elseif ( ! defined( 'WP_CACHE' ) || ( defined( 'WP_CACHE' ) && ! WP_CACHE ) ) {
741
+ return true ;
742
+ }
743
+
744
+ $file = ABSPATH . 'wp-config.php' ;
745
+
746
+ if ( ! is_writeable( $file ) ) {
747
+ $file = dirname( ABSPATH ) . '/wp-config.php' ; // todo: is the path correct?
748
+ if ( ! is_writeable( $file ) ) {
749
+ error_log( 'wp-config file not writable for \'WP_CACHE\'' ) ;
750
+ return LiteSpeed_Cache_Admin_Error::E_CONF_WRITE ;
751
+ }
752
+ }
753
+
754
+ $file_content = file_get_contents( $file ) ;
755
+
756
+ if ( $enable ) {
757
+ $count = 0 ;
758
+
759
+ $new_file_content = preg_replace( '/[\/]*define\(.*\'WP_CACHE\'.+;/', "define('WP_CACHE', true);", $file_content, -1, $count ) ;
760
+ if ( $count == 0 ) {
761
+ $new_file_content = preg_replace( '/(\$table_prefix)/', "define('WP_CACHE', true);\n$1", $file_content ) ;
762
+ if ( $count == 0 ) {
763
+ $new_file_content = preg_replace( '/(\<\?php)/', "$1\ndefine('WP_CACHE', true);", $file_content, -1, $count ) ;
764
+ }
765
+
766
+ if ( $count == 0 ) {
767
+ error_log( 'wp-config file did not find a place to insert define.' ) ;
768
+ return LiteSpeed_Cache_Admin_Error::E_CONF_FIND ;
769
+ }
770
+ }
771
+ }
772
+ else {
773
+ $new_file_content = preg_replace( '/define\(.*\'WP_CACHE\'.+;/', "define('WP_CACHE', false);", $file_content ) ;
774
+ }
775
+
776
+ file_put_contents( $file, $new_file_content ) ;
777
+ return true ;
778
+ }
779
+
780
+ /**
781
+ * On plugin activation, load the default options.
782
+ *
783
+ * @since 1.0.0
784
+ * @access public
785
+ * @param int $count The count of blogs active in multisite.
786
+ */
787
+ public function plugin_activation( $count )
788
+ {
789
+ $errors = array() ;
790
+
791
+ $res = add_option( self::OPTION_NAME, $this->get_default_options() ) ;
792
+
793
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
794
+ LiteSpeed_Cache_Log::push( "plugin_activation update option = " . var_export( $res, true ) ) ;
795
+ }
796
+
797
+ if ( is_multisite() ) {
798
+
799
+ if ( ! is_network_admin() ) {
800
+ if ( $count === 1 ) {
801
+ // Only itself is activated, set .htaccess with only CacheLookUp
802
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
803
+ }
804
+ return ;
805
+ }
806
+ else {
807
+ // Network admin should make a wapper to avoid subblogs cache not work
808
+ LiteSpeed_Cache_Admin_Rules::get_instance()->insert_wrapper() ;
809
+ }
810
+
811
+ $options = $this->get_site_options() ;
812
+
813
+ if ( $res == true || $options[ self::NETWORK_OPID_ENABLED ] == false ) {
814
+ return ;
815
+ }
816
+
817
+ }
818
+ elseif ( $res == false && ! defined( 'LITESPEED_ON' ) ) {// todo: why do this
819
+ return ;
820
+ }
821
+ else {
822
+ $options = $this->get_options() ;
823
+ }
824
+
825
+ $res = LiteSpeed_Cache_Admin_Rules::get_instance()->update( $options ) ;
826
+
827
+ if ( $res !== true ) {
828
+ if ( ! is_array( $res ) ) {
829
+ exit( $res ) ;
830
+ }
831
+ exit( implode( "\n", $res ) ) ;
832
+ }
833
+
834
+ }
835
+
836
+ /**
837
+ * Get the current instance object.
838
+ *
839
+ * @since 1.1.0
840
+ * @access public
841
+ * @return Current class instance.
842
+ */
843
+ public static function get_instance()
844
+ {
845
+ if ( ! isset( self::$_instance ) ) {
846
+ self::$_instance = new self() ;
847
+ }
848
+
849
+ return self::$_instance ;
850
+ }
851
+ }
inc/control.class.php ADDED
@@ -0,0 +1,611 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin cache-control class for X-Litespeed-Cache-Control
4
+ *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+ class LiteSpeed_Cache_Control
12
+ {
13
+ private static $_instance ;
14
+
15
+ const BM_CACHEABLE = 1 ;
16
+ const BM_PRIVATE = 2 ;
17
+ const BM_SHARED = 4 ;
18
+ const BM_NO_VARY = 8 ;
19
+ const BM_STALE = 128 ;
20
+ const BM_NOTCACHEABLE = 256 ;
21
+
22
+ const X_HEADER = 'X-LiteSpeed-Cache-Control' ;
23
+
24
+ protected static $_control = 0 ;
25
+ protected static $_custom_ttl = 0 ;
26
+ private static $_mobile = false ;
27
+
28
+ /**
29
+ * 1. Initialize cacheable status for `wp` hook
30
+ * 2. Hook error page tags for cacheable pages
31
+ *
32
+ * @since 1.1.3
33
+ * @access public
34
+ */
35
+ public static function init_cacheable()
36
+ {
37
+ // Hook `wp` to mark default cacheable status
38
+ // NOTE: Any process that does NOT run into `wp` hook will not get cacheable by default
39
+ add_action( 'wp', 'LiteSpeed_Cache_Control::set_cacheable', 5 ) ;
40
+
41
+ // Hook WP REST to be cacheable
42
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_REST ) ) {
43
+ add_action( 'rest_api_init', 'LiteSpeed_Cache_Control::set_cacheable', 5 ) ;
44
+ }
45
+
46
+ // Cache resources
47
+ // NOTE: If any strange resource doesn't use normal WP logic `wp_loaded` hook, rewrite rule can handle it
48
+ $cache_res = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_RES ) ;
49
+ if ( $cache_res ) {
50
+ $uri = esc_url( $_SERVER["REQUEST_URI"] ) ;
51
+ $pattern = '!' . LSWCP_CONTENT_FOLDER . LiteSpeed_Cache_Admin_Rules::RW_PATTERN_RES . '!' ;
52
+ if ( preg_match( $pattern, $uri ) ) {
53
+ add_action( 'wp_loaded', 'LiteSpeed_Cache_Control::set_cacheable', 5 ) ;
54
+ }
55
+ }
56
+
57
+ // Check error page
58
+ add_filter( 'status_header', 'LiteSpeed_Cache_Tag::check_error_codes', 10, 2 ) ;
59
+ }
60
+
61
+ /**
62
+ * Set no vary setting
63
+ *
64
+ * @access public
65
+ * @since 1.1.3
66
+ */
67
+ public static function set_no_vary()
68
+ {
69
+ if ( self::is_no_vary() ) {
70
+ return ;
71
+ }
72
+ self::$_control |= self::BM_NO_VARY ;
73
+ LiteSpeed_Cache_Log::debug('X Cache_control -> no-vary') ;
74
+ }
75
+
76
+ /**
77
+ * Get no vary setting
78
+ *
79
+ * @access public
80
+ * @since 1.1.3
81
+ */
82
+ public static function is_no_vary()
83
+ {
84
+ return self::$_control & self::BM_NO_VARY ;
85
+ }
86
+
87
+ /**
88
+ * Set stale
89
+ *
90
+ * @access public
91
+ * @since 1.1.3
92
+ */
93
+ public static function set_stale()
94
+ {
95
+ if ( self::is_stale() ) {
96
+ return ;
97
+ }
98
+ self::$_control |= self::BM_STALE ;
99
+ LiteSpeed_Cache_Log::debug('X Cache_control -> stale') ;
100
+ }
101
+
102
+ /**
103
+ * Get stale
104
+ *
105
+ * @access public
106
+ * @since 1.1.3
107
+ */
108
+ public static function is_stale()
109
+ {
110
+ return self::$_control & self::BM_STALE ;
111
+ }
112
+
113
+ /**
114
+ * Set cache control to shared private
115
+ *
116
+ * @access public
117
+ * @since 1.1.3
118
+ * @param string $reason The reason to no cache
119
+ */
120
+ public static function set_shared( $reason = false )
121
+ {
122
+ if ( self::is_shared() ) {
123
+ return ;
124
+ }
125
+ self::$_control |= self::BM_SHARED ;
126
+ self::set_private() ;
127
+ if ( $reason ) {
128
+ $reason = "( $reason )" ;
129
+ }
130
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> shared ' . $reason ) ;
131
+ }
132
+
133
+ /**
134
+ * Check if is shared private
135
+ *
136
+ * @access public
137
+ * @since 1.1.3
138
+ */
139
+ public static function is_shared()
140
+ {
141
+ return (self::$_control & self::BM_SHARED) && self::is_private() ;
142
+ }
143
+
144
+ /**
145
+ * Set cache control to private
146
+ *
147
+ * @access public
148
+ * @since 1.1.3
149
+ * @param string $reason The reason to no cache
150
+ */
151
+ public static function set_private( $reason = false )
152
+ {
153
+ if ( self::is_private() ) {
154
+ return ;
155
+ }
156
+ self::$_control |= self::BM_PRIVATE ;
157
+ if ( $reason ) {
158
+ $reason = "( $reason )" ;
159
+ }
160
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> private ' . $reason) ;
161
+ }
162
+
163
+ /**
164
+ * Check if is private
165
+ *
166
+ * @access public
167
+ * @since 1.1.3
168
+ */
169
+ public static function is_private()
170
+ {
171
+ return self::$_control & self::BM_PRIVATE ;
172
+ }
173
+
174
+ /**
175
+ * Initialize cacheable status in `wp` hook, if not call this, by default it will be non-cacheable
176
+ *
177
+ * @access public
178
+ * @since 1.1.3
179
+ */
180
+ public static function set_cacheable()
181
+ {
182
+ self::$_control |= self::BM_CACHEABLE ;
183
+ LiteSpeed_Cache_Log::debug( 'X Cache_control init on' ) ;
184
+ }
185
+
186
+ /**
187
+ * Switch to nocacheable status
188
+ *
189
+ * @access public
190
+ * @since 1.1.3
191
+ * @param string $reason The reason to no cache
192
+ */
193
+ public static function set_nocache( $reason = false )
194
+ {
195
+ self::$_control |= self::BM_NOTCACHEABLE ;
196
+ if ( $reason ) {
197
+ $reason = "( $reason )" ;
198
+ }
199
+ LiteSpeed_Cache_Log::debug( 'X Cache_control -> no Cache ' . $reason, 2 ) ;
200
+ }
201
+
202
+ /**
203
+ * Check current notcacheable bit set
204
+ *
205
+ * @access public
206
+ * @since 1.1.3
207
+ * @return bool True if notcacheable bit is set, otherwise false.
208
+ */
209
+ public static function isset_notcacheable()
210
+ {
211
+ return self::$_control & self::BM_NOTCACHEABLE ;
212
+ }
213
+
214
+ /**
215
+ * Check current cacheable status
216
+ *
217
+ * @access public
218
+ * @since 1.1.3
219
+ * @return bool True if is still cacheable, otherwise false.
220
+ */
221
+ public static function is_cacheable()
222
+ {
223
+ return ! self::isset_notcacheable() && self::$_control & self::BM_CACHEABLE ;
224
+ }
225
+
226
+
227
+
228
+
229
+ /**
230
+ * Set a custom TTL to use with the request if needed.
231
+ *
232
+ * @access public
233
+ * @since 1.1.3
234
+ * @param mixed $ttl An integer or string to use as the TTL. Must be numeric.
235
+ */
236
+ public static function set_custom_ttl($ttl)
237
+ {
238
+ if ( is_numeric($ttl) ) {
239
+ self::$_custom_ttl = $ttl ;
240
+ LiteSpeed_Cache_Log::debug('X Cache_control TTL -> ' . $ttl) ;
241
+ }
242
+ }
243
+
244
+ /**
245
+ * Generate final TTL.
246
+ *
247
+ * @access public
248
+ * @since 1.1.3
249
+ * @return int $ttl An integer to use as the TTL.
250
+ */
251
+ public static function get_ttl()
252
+ {
253
+ if ( self::$_custom_ttl != 0 ) {
254
+ return self::$_custom_ttl ;
255
+ }
256
+
257
+ // Check if is in timed url list or not
258
+ $timed_urls = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_TIMED_URLS ) ;
259
+ $timed_urls_time = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_TIMED_URLS_TIME ) ;
260
+ if ( $timed_urls && $timed_urls_time ) {
261
+ $timed_urls = explode( "\n", $timed_urls ) ;
262
+ $current_url = LiteSpeed_Cache_Tag::build_uri_tag( true ) ;
263
+ if ( in_array( $current_url, $timed_urls ) ) {
264
+ // Use time limit ttl
265
+ $scheduled_time = strtotime( $timed_urls_time ) ;
266
+ $ttl = $scheduled_time - time() ;
267
+ if ( $ttl < 0 ) {
268
+ $ttl += 86400 ;// add one day
269
+ }
270
+ LiteSpeed_Cache_Log::debug( 'X Cache_control TTL is limited to ' . $ttl ) ;
271
+ return $ttl ;
272
+ }
273
+ }
274
+
275
+ // Private cache uses private ttl setting
276
+ if ( self::is_private() ) {
277
+ return LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_PRIVATE_TTL ) ;
278
+ }
279
+
280
+ if ( is_front_page() ){
281
+ return LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_FRONT_PAGE_TTL ) ;
282
+ }
283
+
284
+ $feed_ttl = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_FEED_TTL ) ;
285
+ if ( is_feed() && $feed_ttl > 0 ) {
286
+ return $feed_ttl ;
287
+ }
288
+
289
+ $ttl_404 = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_404_TTL ) ;
290
+ if ( is_404() && $ttl_404 > 0 ) {
291
+ return $ttl_404 ;
292
+ }
293
+
294
+ if ( LiteSpeed_Cache_Tag::get_error_code() === 403 ) {
295
+ $ttl_403 = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_403_TTL ) ;
296
+ return $ttl_403 ;
297
+ }
298
+
299
+ $ttl_500 = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_500_TTL ) ;
300
+ if ( LiteSpeed_Cache_Tag::get_error_code() >= 500 ) {
301
+ return $ttl_500 ;
302
+ }
303
+
304
+ return LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_PUBLIC_TTL ) ;
305
+ }
306
+
307
+ /**
308
+ * Check if need to set no cache status for redirection or not
309
+ *
310
+ * @access public
311
+ * @since 1.1.3
312
+ */
313
+ public static function check_redirect( $location, $status )
314
+ {
315
+ if ( ! empty( $_SERVER[ 'SCRIPT_URI' ] ) ) { // dont check $status == '301' anymore
316
+ LiteSpeed_Cache_Log::debug( "301 from " . $_SERVER[ 'SCRIPT_URI' ] ) ;
317
+ LiteSpeed_Cache_Log::debug( "301 to $location" ) ;
318
+ if ( parse_url( $_SERVER[ 'SCRIPT_URI' ], PHP_URL_PATH ) == parse_url( $location, PHP_URL_PATH ) ) {
319
+ self::set_nocache( '301 to same url' ) ;
320
+ }
321
+ }
322
+ return $location ;
323
+ }
324
+
325
+ /**
326
+ * Sets up the Cache Control header.
327
+ *
328
+ * @since 1.1.3
329
+ * @access public
330
+ * @return string empty string if empty, otherwise the cache control header.
331
+ */
332
+ public static function output()
333
+ {
334
+ $esi_hdr = '' ;
335
+ if ( LSWCP_ESI_SUPPORT && LiteSpeed_Cache_ESI::has_esi() ) {
336
+ $esi_hdr = ',esi=on' ;
337
+ }
338
+
339
+ $hdr = self::X_HEADER . ': ' ;
340
+
341
+ if ( ! self::is_cacheable() ) {
342
+ $hdr .= 'no-cache' . $esi_hdr ;
343
+ return $hdr ;
344
+ }
345
+
346
+ if ( self::is_shared() ) {
347
+ $hdr .= 'shared,private' ;
348
+ }
349
+ elseif ( self::is_private() ) {
350
+ $hdr .= 'private' ;
351
+ }
352
+ else {
353
+ $hdr .= 'public' ;
354
+ }
355
+
356
+ if ( self::is_no_vary() ) {
357
+ $hdr .= ',no-vary' ;
358
+ }
359
+
360
+ $hdr .= ',max-age=' . self::get_ttl() . $esi_hdr ;
361
+ return $hdr ;
362
+ }
363
+
364
+ /**
365
+ * Generate all `control` tags before output
366
+ *
367
+ * @access public
368
+ * @since 1.1.3
369
+ */
370
+ public static function finalize()
371
+ {
372
+ // if is not cacheable, terminate check
373
+ // Even no need to run 3rd party hook
374
+ if ( ! self::is_cacheable() ) {
375
+ LiteSpeed_Cache_Log::debug( 'not cacheable before ctrl finalize' ) ;
376
+ return ;
377
+ }
378
+
379
+ if ( defined('LSCACHE_NO_CACHE') && LSCACHE_NO_CACHE ) {
380
+ self::set_nocache('LSCACHE_NO_CACHE constant defined') ;
381
+ return ;
382
+ }
383
+
384
+ $instance = self::get_instance() ;
385
+
386
+ // Apply 3rd party filter
387
+ // Parse ESI block id
388
+ $esi_id = false ;
389
+ if ( defined( 'LSCACHE_IS_ESI' ) ) {
390
+ $params = LiteSpeed_Cache_ESI::parse_esi_param() ;
391
+ if ( $params !== false ) {
392
+ $esi_id = $params[LiteSpeed_Cache_ESI::PARAM_BLOCK_ID] ;
393
+ }
394
+ }
395
+ // NOTE: Hook always needs to run asap because some 3rd party set is_mobile in this hook
396
+ do_action('litespeed_cache_api_control', $esi_id) ;
397
+
398
+ // if is not cacheable, terminate check
399
+ if ( ! self::is_cacheable() ) {
400
+ LiteSpeed_Cache_Log::debug( 'not cacheable after api_control' ) ;
401
+ return ;
402
+ }
403
+
404
+ if ( is_preview() ) {
405
+ self::set_nocache( 'preview page' ) ;
406
+ return ;
407
+ }
408
+
409
+ // Check litespeed setting to set cacheable status
410
+ if ( ! $instance->_setting_cacheable() ) {
411
+ self::set_nocache() ;
412
+ return ;
413
+ }
414
+
415
+ // If user has password cookie, do not cache (moved from vary)
416
+ global $post ;
417
+ if ( ! empty($post->post_password) && isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) {
418
+ // If user has password cookie, do not cache
419
+ self::set_nocache('pswd cookie') ;
420
+ return ;
421
+ }
422
+
423
+ // The following check to the end is ONLY for mobile
424
+ if ( ! LiteSpeed_Cache::config(LiteSpeed_Cache_Config::OPID_CACHE_MOBILE) ) {
425
+ if ( self::is_mobile() ) {
426
+ self::set_nocache('mobile') ;
427
+ }
428
+ return ;
429
+ }
430
+
431
+ if ( isset($_SERVER['LSCACHE_VARY_VALUE']) && $_SERVER['LSCACHE_VARY_VALUE'] === 'ismobile' ) {
432
+ if ( ! wp_is_mobile() && ! self::is_mobile() ) {
433
+ self::set_nocache( 'is not mobile' ) ;
434
+ return ;
435
+ }
436
+ }
437
+ elseif ( wp_is_mobile() || self::is_mobile() ) {
438
+ self::set_nocache( 'is mobile' ) ;
439
+ return ;
440
+ }
441
+
442
+ }
443
+
444
+ /**
445
+ * Check if a page is cacheable based on litespeed setting.
446
+ *
447
+ * @since 1.0.0
448
+ * @access private
449
+ * @return boolean True if cacheable, false otherwise.
450
+ */
451
+ private function _setting_cacheable()
452
+ {
453
+ // logged_in users already excluded, no hook added
454
+
455
+ if( ! empty( $_REQUEST[ LiteSpeed_Cache::ACTION_KEY ] ) ) {
456
+ return $this->_no_cache_for( 'Query String Action' ) ;
457
+ }
458
+
459
+ if ( $_SERVER["REQUEST_METHOD"] !== 'GET' ) {
460
+ return $this->_no_cache_for('not GET method:' . $_SERVER["REQUEST_METHOD"]) ;
461
+ }
462
+
463
+ if ( is_feed() && LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_FEED_TTL ) == 0 ) {
464
+ return $this->_no_cache_for('feed') ;
465
+ }
466
+
467
+ if ( is_trackback() ) {
468
+ return $this->_no_cache_for('trackback') ;
469
+ }
470
+
471
+ if ( is_404() && LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_404_TTL ) == 0 ) {
472
+ return $this->_no_cache_for('404 pages') ;
473
+ }
474
+
475
+ if ( is_search() ) {
476
+ return $this->_no_cache_for('search') ;
477
+ }
478
+
479
+ // if ( !defined('WP_USE_THEMES') || !WP_USE_THEMES ) {
480
+ // return $this->_no_cache_for('no theme used') ;
481
+ // }
482
+
483
+ // Check private cache URI setting
484
+ $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_URI_PRIV ) ;
485
+ if ( ! empty( $excludes ) ) {
486
+ $uri = esc_url( $_SERVER[ 'REQUEST_URI' ] ) ;
487
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $uri, explode( "\n", $excludes ) ) ;
488
+ if ( $result ) {
489
+ self::set_private( 'Admin cfg Private Cached URI: ' . $result ) ;
490
+ }
491
+ }
492
+
493
+ // Check if URI is excluded from cache
494
+ $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_EXCLUDES_URI ) ;
495
+ if ( ! empty( $excludes ) ) {
496
+ $uri = esc_url( $_SERVER[ 'REQUEST_URI' ] ) ;
497
+ $result = LiteSpeed_Cache_Utility::str_hit_array( $uri, explode( "\n", $excludes ) ) ;
498
+ if ( $result ) {
499
+ return $this->_no_cache_for( 'Admin configured URI Do not cache: ' . $result ) ;
500
+ }
501
+ }
502
+
503
+ // Check QS excluded setting
504
+ $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_EXCLUDES_QS ) ;
505
+ if ( ! empty( $excludes ) && $qs = $this->_is_qs_excluded( explode( "\n", $excludes ) ) ) {
506
+ return $this->_no_cache_for( 'Admin configured QS Do not cache: ' . $qs ) ;
507
+ }
508
+
509
+ $excludes = LiteSpeed_Cache::config(LiteSpeed_Cache_Config::OPID_EXCLUDES_CAT) ;
510
+ if ( ! empty($excludes) && has_category(explode(',', $excludes)) ) {
511
+ return $this->_no_cache_for('Admin configured Category Do not cache.') ;
512
+ }
513
+
514
+ $excludes = LiteSpeed_Cache::config(LiteSpeed_Cache_Config::OPID_EXCLUDES_TAG) ;
515
+ if ( ! empty($excludes) && has_tag(explode(',', $excludes)) ) {
516
+ return $this->_no_cache_for('Admin configured Tag Do not cache.') ;
517
+ }
518
+
519
+ $excludes = LiteSpeed_Cache::config(LiteSpeed_Cache_Config::ID_NOCACHE_COOKIES) ;
520
+ if ( ! empty($excludes) && ! empty($_COOKIE) ) {
521
+ $exclude_list = explode('|', $excludes) ;
522
+
523
+ foreach( $_COOKIE as $key=>$val) {
524
+ if ( in_array($key, $exclude_list) ) {
525
+ return $this->_no_cache_for('Admin configured Cookie Do not cache.') ;
526
+ }
527
+ }
528
+ }
529
+
530
+ $excludes = LiteSpeed_Cache::config(LiteSpeed_Cache_Config::ID_NOCACHE_USERAGENTS) ;
531
+ if ( ! empty($excludes) && isset($_SERVER['HTTP_USER_AGENT']) ) {
532
+ $pattern = '/' . $excludes . '/' ;
533
+ $nummatches = preg_match($pattern, $_SERVER['HTTP_USER_AGENT']) ;
534
+ if ( $nummatches ) {
535
+ return $this->_no_cache_for('Admin configured User Agent Do not cache.') ;
536
+ }
537
+ }
538
+
539
+ return true ;
540
+ }
541
+
542
+ /**
543
+ * Write a debug message for if a page is not cacheable.
544
+ *
545
+ * @since 1.0.0
546
+ * @access private
547
+ * @param string $reason An explanation for why the page is not cacheable.
548
+ * @return boolean Return false.
549
+ */
550
+ private function _no_cache_for( $reason )
551
+ {
552
+ LiteSpeed_Cache_Log::debug('X Cache_control off - ' . $reason) ;
553
+ return false ;
554
+ }
555
+
556
+ /**
557
+ * Check if current request has qs excluded setting
558
+ *
559
+ * @since 1.3
560
+ * @access private
561
+ * @param array $excludes QS excludes setting
562
+ * @return boolean|string False if not excluded, otherwise the hit qs list
563
+ */
564
+ private function _is_qs_excluded( $excludes )
565
+ {
566
+ if ( ! empty( $_GET ) && $intersect = array_intersect( array_keys( $_GET ), $excludes ) ) {
567
+ return implode( ',', $intersect ) ;
568
+ }
569
+ return false ;
570
+ }
571
+
572
+ /**
573
+ * Gets whether any plugins determined that the current page is mobile.
574
+ *
575
+ * @access public
576
+ * @return boolean True if the current page was deemed mobile, false otherwise.
577
+ */
578
+ public static function is_mobile()
579
+ {
580
+ return self::$_mobile ;
581
+ }
582
+
583
+ /**
584
+ * Mark the current page as mobile. This may be useful for if the plugin does not override wp_is_mobile.
585
+ *
586
+ * Must be called before the shutdown hook point.
587
+ *
588
+ * @since 1.0.7
589
+ * @access public
590
+ */
591
+ public static function set_mobile()
592
+ {
593
+ self::$_mobile = true ;
594
+ }
595
+
596
+ /**
597
+ * Get the current instance object.
598
+ *
599
+ * @since 1.3
600
+ * @access public
601
+ * @return Current class instance.
602
+ */
603
+ public static function get_instance()
604
+ {
605
+ if ( ! isset( self::$_instance ) ) {
606
+ self::$_instance = new self() ;
607
+ }
608
+
609
+ return self::$_instance ;
610
+ }
611
+ }
inc/crawler-sitemap.class.php CHANGED
@@ -3,10 +3,11 @@
3
  * The Crawler Sitemap Class
4
  *
5
  *
6
- * @since 1.1.0
7
- * @package LiteSpeed_Cache_Crawler_Sitemap
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_Crawler_Sitemap
3
  * The Crawler Sitemap Class
4
  *
5
  *
6
+ * @since 1.1.0
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache_Crawler_Sitemap
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_Crawler_Sitemap
inc/crawler.class.php ADDED
@@ -0,0 +1,451 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The crawler class
5
+ *
6
+ *
7
+ * @since 1.1.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
+ */
13
+ class LiteSpeed_Cache_Crawler
14
+ {
15
+ private static $_instance;
16
+ private $_sitemap_file ;
17
+ private $_blacklist_file ;
18
+ private $_home_url ;
19
+ const CRWL_BLACKLIST = 'crawler_blacklist' ;
20
+
21
+ /**
22
+ * Initialize crawler, assign sitemap path
23
+ *
24
+ * @since 1.1.0
25
+ * @access private
26
+ */
27
+ private function __construct()
28
+ {
29
+ $sitemapPath = LSWCP_DIR . 'var' ;
30
+ if ( is_multisite() ) {
31
+ $blogID = get_current_blog_id() ;
32
+ $this->_sitemap_file = $sitemapPath . '/crawlermap-' . $blogID . '.data' ;
33
+ $this->_home_url = get_home_url( $blogID ) ;
34
+ }
35
+ else{
36
+ $this->_sitemap_file = $sitemapPath . '/crawlermap.data' ;
37
+ $this->_home_url = get_home_url() ;
38
+ }
39
+ $this->_blacklist_file = $this->_sitemap_file . '.blacklist' ;
40
+
41
+ LiteSpeed_Cache_Log::debug('Crawler log: Initialized') ;
42
+ }
43
+
44
+ /**
45
+ * Return crawler meta file
46
+ *
47
+ * @since 1.1.0
48
+ * @access public
49
+ * @return string Json data file path
50
+ */
51
+ public function get_crawler_json_path()
52
+ {
53
+ if ( ! file_exists($this->_sitemap_file . '.meta') ) {
54
+ return false ;
55
+ }
56
+ $metaUrl = implode('/', array_slice(explode('/', $this->_sitemap_file . '.meta'), -5)) ;
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
+ *
78
+ * @since 1.1.0
79
+ * @access public
80
+ * @return string
81
+ */
82
+ public function get_blacklist()
83
+ {
84
+ return Litespeed_File::read($this->_blacklist_file) ;
85
+ }
86
+
87
+ /**
88
+ * Return blacklist count
89
+ *
90
+ * @since 1.1.0
91
+ * @access public
92
+ * @return string
93
+ */
94
+ public function count_blacklist()
95
+ {
96
+ return Litespeed_File::count_lines($this->_blacklist_file) ;
97
+ }
98
+
99
+ /**
100
+ * Save blacklist to file
101
+ *
102
+ * @since 1.1.0
103
+ * @access public
104
+ * @return bool If saved successfully
105
+ */
106
+ public function save_blacklist()
107
+ {
108
+ if ( ! isset( $_POST[ self::CRWL_BLACKLIST ] ) ) {
109
+ $msg = __( 'Can not find any form data for blacklist', 'litespeed-cache' ) ;
110
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_RED, $msg ) ;
111
+ return false ;
112
+ }
113
+ $content = $_POST[ self::CRWL_BLACKLIST ] ;
114
+ $content = array_map( 'trim', explode( "\n", $content ) ) ;// remove space
115
+ $content = implode( "\n", array_filter( $content ) ) ;
116
+
117
+ // save blacklist file
118
+ $ret = Litespeed_File::save( $this->_blacklist_file, $content, true, false, false ) ;
119
+ if ( $ret !== true ) {
120
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_RED, $ret ) ;
121
+ }
122
+ else {
123
+ $msg = sprintf(
124
+ __( 'File saved successfully: %s', 'litespeed-cache' ),
125
+ $this->_blacklist_file
126
+ ) ;
127
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, $msg ) ;
128
+ }
129
+
130
+ return true ;
131
+ }
132
+
133
+ /**
134
+ * Append urls to current list
135
+ *
136
+ * @since 1.1.0
137
+ * @access public
138
+ * @param array $list The url list needs to be appended
139
+ */
140
+ public function append_blacklist( $list )
141
+ {
142
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
143
+ LiteSpeed_Cache_Log::push( 'Crawler log: append blacklist ' . count( $list ) ) ;
144
+ }
145
+ $ori_list = Litespeed_File::read( $this->_blacklist_file ) ;
146
+ $ori_list = explode( "\n", $ori_list ) ;
147
+ $ori_list = array_merge( $ori_list, $list ) ;
148
+ $ori_list = array_map( 'trim', $ori_list ) ;
149
+ $ori_list = array_filter( $ori_list ) ;
150
+ $content = implode( "\n", $ori_list ) ;
151
+
152
+ // save blacklist
153
+ $ret = Litespeed_File::save( $this->_blacklist_file, $content, true, false, false ) ;
154
+ if ( $ret !== true ) {
155
+ LiteSpeed_Cache_Log::debug( 'Crawler log: append blacklist failed: ' . $ret ) ;
156
+ return false ;
157
+ }
158
+
159
+ return true ;
160
+ }
161
+
162
+ /**
163
+ * Generate sitemap
164
+ *
165
+ * @since 1.1.0
166
+ * @access public
167
+ */
168
+ public function generate_sitemap()
169
+ {
170
+ $ret = $this->_generate_sitemap() ;
171
+ if ( $ret !== true ) {
172
+ LiteSpeed_Cache_Admin_Display::add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_RED, $ret) ;
173
+ }
174
+ else {
175
+ $msg = sprintf(
176
+ __('File created successfully: %s', 'litespeed-cache'),
177
+ $this->_sitemap_file
178
+ ) ;
179
+ LiteSpeed_Cache_Admin_Display::add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, $msg) ;
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Parse custom sitemap and return urls
185
+ *
186
+ * @since 1.1.1
187
+ * @access public
188
+ * @param string $sitemap The url set map address
189
+ * @param boolean $return_detail If return url list
190
+ * @return bollean|array Url list or if is a sitemap
191
+ */
192
+ public function parse_custom_sitemap($sitemap, $return_detail = true)
193
+ {
194
+ if ( ! file_get_contents($sitemap) ) {
195
+ return LiteSpeed_Cache_Admin_Error::E_SETTING_CUSTOM_SITEMAP_READ ;
196
+ }
197
+ $xml_object = simplexml_load_file($sitemap) ;
198
+ if ( ! $xml_object ) {
199
+ return LiteSpeed_Cache_Admin_Error::E_SETTING_CUSTOM_SITEMAP_PARSE ;
200
+ }
201
+ if ( ! $return_detail ) {
202
+ return true ;
203
+ }
204
+ // start parsing
205
+ $_urls = array() ;
206
+
207
+ $xml_array = (array)$xml_object ;
208
+ if ( !empty($xml_array['sitemap']) ) {// parse sitemap set
209
+ if ( is_object($xml_array['sitemap']) ) {
210
+ $xml_array['sitemap'] = (array)$xml_array['sitemap'] ;
211
+ }
212
+ if ( !empty($xml_array['sitemap']['loc']) ) {// is single sitemap
213
+ $urls = $this->parse_custom_sitemap($xml_array['sitemap']['loc']) ;
214
+ if ( is_array($urls) && !empty($urls) ) {
215
+ $_urls = array_merge($_urls, $urls) ;
216
+ }
217
+ }
218
+ else {
219
+ // parse multiple sitemaps
220
+ foreach ($xml_array['sitemap'] as $val) {
221
+ $val = (array)$val ;
222
+ if ( !empty($val['loc']) ) {
223
+ $urls = $this->parse_custom_sitemap($val['loc']) ;// recursive parse sitemap
224
+ if ( is_array($urls) && !empty($urls) ) {
225
+ $_urls = array_merge($_urls, $urls) ;
226
+ }
227
+ }
228
+ }
229
+ }
230
+ }
231
+ elseif ( !empty($xml_array['url']) ) {// parse url set
232
+ if ( is_object($xml_array['url']) ) {
233
+ $xml_array['url'] = (array)$xml_array['url'] ;
234
+ }
235
+ // if only 1 element
236
+ if ( !empty($xml_array['url']['loc']) ) {
237
+ $_urls[] = $xml_array['url']['loc'] ;
238
+ }
239
+ else {
240
+ foreach ($xml_array['url'] as $val) {
241
+ $val = (array)$val ;
242
+ if ( !empty($val['loc']) ) {
243
+ $_urls[] = $val['loc'] ;
244
+ }
245
+ }
246
+ }
247
+ }
248
+
249
+ return $_urls ;
250
+ }
251
+
252
+ /**
253
+ * Generate the sitemap
254
+ *
255
+ * @since 1.1.0
256
+ * @access protected
257
+ * @return string|true
258
+ */
259
+ protected function _generate_sitemap()
260
+ {
261
+ // use custom sitemap
262
+ if ( $sitemap = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::CRWL_CUSTOM_SITEMAP ) ) {
263
+ $sitemap_urls = $this->parse_custom_sitemap( $sitemap ) ;
264
+ $urls = array() ;
265
+ $offset = strlen( $this->_home_url ) ;
266
+ if ( is_array( $sitemap_urls ) && ! empty( $sitemap_urls ) ) {
267
+ foreach ( $sitemap_urls as $val ) {
268
+ if ( stripos( $val, $this->_home_url ) === 0 ) {
269
+ $urls[] = substr( $val, $offset ) ;
270
+ }
271
+ }
272
+ }
273
+ }
274
+ else {
275
+ $urls = LiteSpeed_Cache_Crawler_Sitemap::get_instance()->generate_data() ;
276
+ }
277
+
278
+ // filter urls
279
+ $blacklist = Litespeed_File::read( $this->_blacklist_file ) ;
280
+ $blacklist = explode( "\n", $blacklist ) ;
281
+ $urls = array_diff( $urls, $blacklist ) ;
282
+ LiteSpeed_Cache_Log::debug( 'Crawler log: Generate sitemap' ) ;
283
+
284
+ $ret = Litespeed_File::save( $this->_sitemap_file, implode( "\n", $urls ), true, false, false ) ;
285
+
286
+ // refresh list size in meta
287
+ $crawler = new Litespeed_Crawler( $this->_sitemap_file ) ;
288
+ $crawler->refresh_list_size() ;
289
+
290
+ return $ret ;
291
+ }
292
+
293
+ /**
294
+ * Get sitemap file info
295
+ *
296
+ * @since 1.1.0
297
+ * @access public
298
+ */
299
+ public function sitemap_time()
300
+ {
301
+ if ( ! file_exists($this->_sitemap_file) ) {
302
+ return false ;
303
+ }
304
+
305
+ $filetime = date('m/d/Y H:i:s', filemtime($this->_sitemap_file) + LITESPEED_TIME_OFFSET ) ;
306
+
307
+ return $filetime ;
308
+ }
309
+
310
+ /**
311
+ * Create reset pos file
312
+ *
313
+ * @since 1.1.0
314
+ * @access public
315
+ * @return mixed True or error message
316
+ */
317
+ public function reset_pos()
318
+ {
319
+ $crawler = new Litespeed_Crawler($this->_sitemap_file) ;
320
+ $ret = $crawler->reset_pos() ;
321
+ $log = 'Crawler log: Reset pos. ' ;
322
+ if ( $ret !== true ) {
323
+ $log .= "Error: $ret" ;
324
+ $msg = sprintf(__('Failed to send position reset notification: %s', 'litespeed-cache'), $ret) ;
325
+ LiteSpeed_Cache_Admin_Display::add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_RED, $msg) ;
326
+ }
327
+ else {
328
+ $msg = __('Position reset notification sent successfully', 'litespeed-cache') ;
329
+ LiteSpeed_Cache_Admin_Display::add_notice(LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, $msg) ;
330
+ }
331
+ LiteSpeed_Cache_Log::debug($log) ;
332
+ }
333
+
334
+ /**
335
+ * Proceed crawling
336
+ *
337
+ * @since 1.1.0
338
+ * @access public
339
+ * @param bool $force If ignore whole crawling interval
340
+ */
341
+ public static function crawl_data($force = false)
342
+ {
343
+ if ( ! LiteSpeed_Cache_Router::can_crawl() ) {
344
+ LiteSpeed_Cache_Log::debug('Crawler log: ......crawler is NOT allowed by the server admin......') ;
345
+ return false;
346
+ }
347
+ if ( $force ) {
348
+ LiteSpeed_Cache_Log::debug('Crawler log: ......crawler manually ran......') ;
349
+ }
350
+ return self::get_instance()->_crawl_data($force) ;
351
+ }
352
+
353
+ /**
354
+ * Crawling start
355
+ *
356
+ * @since 1.1.0
357
+ * @access protected
358
+ * @param bool $force If ignore whole crawling interval
359
+ */
360
+ protected function _crawl_data($force)
361
+ {
362
+ LiteSpeed_Cache_Log::debug('Crawler log: ......crawler started......') ;
363
+ // for the first time running
364
+ if ( ! file_exists($this->_sitemap_file) ) {
365
+ $ret = $this->_generate_sitemap() ;
366
+ if ( $ret !== true ) {
367
+ LiteSpeed_Cache_Log::debug('Crawler log: ' . $ret) ;
368
+ return $this->output($ret) ;
369
+ }
370
+ }
371
+
372
+ $options = LiteSpeed_Cache_Config::get_instance()->get_options() ;
373
+
374
+ $crawler = new Litespeed_Crawler($this->_sitemap_file) ;
375
+ // if finished last time, regenerate sitemap
376
+ if ( $last_fnished_at = $crawler->get_done_status() ) {
377
+ // check whole crawling interval
378
+ if ( ! $force && time() - $last_fnished_at < $options[LiteSpeed_Cache_Config::CRWL_CRAWL_INTERVAL] ) {
379
+ LiteSpeed_Cache_Log::debug('Crawler log: Cron abort: cache warmed already.') ;
380
+ // if not reach whole crawling interval, exit
381
+ return;
382
+ }
383
+ $this->_generate_sitemap() ;
384
+ }
385
+ $crawler->set_base_url($this->_home_url) ;
386
+ $crawler->set_run_duration($options[LiteSpeed_Cache_Config::CRWL_RUN_DURATION]) ;
387
+ $crawler->set_run_delay($options[LiteSpeed_Cache_Config::CRWL_USLEEP]) ;
388
+ $crawler->set_threads_limit($options[LiteSpeed_Cache_Config::CRWL_THREADS]) ;
389
+ $crawler->set_load_limit($options[LiteSpeed_Cache_Config::CRWL_LOAD_LIMIT]) ;
390
+ if ( $options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP] ) {
391
+ $crawler->set_domain_ip($options[LiteSpeed_Cache_Config::CRWL_DOMAIN_IP]) ;
392
+ }
393
+ $ret = $crawler->engine_start() ;
394
+
395
+ // merge blacklist
396
+ if ( $ret['blacklist'] ) {
397
+ $this->append_blacklist($ret['blacklist']) ;
398
+ }
399
+
400
+ if ( ! empty($ret['crawled']) && LiteSpeed_Cache_Log::get_enabled() ) {
401
+ LiteSpeed_Cache_Log::push('Crawler log: Last crawled ' . $ret['crawled'] . ' item(s)') ;
402
+ }
403
+
404
+ // return error
405
+ if ( $ret['error'] !== false ) {
406
+ LiteSpeed_Cache_Log::debug('Crawler log: ' . $ret['error']) ;
407
+ return $this->output($ret['error']) ;
408
+ }
409
+ else {
410
+ $msg = 'Reached end of sitemap file. Crawling completed.' ;
411
+ $msg_t = __('Reached end of sitemap file. Crawling completed.', 'litespeed-cache') ;
412
+ LiteSpeed_Cache_Log::debug('Crawler log: ' . $msg) ;
413
+ return $this->output($msg_t) ;
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Output info and exit
419
+ *
420
+ * @since 1.1.0
421
+ * @access protected
422
+ * @param string $error Error info
423
+ */
424
+ protected function output($msg)
425
+ {
426
+ if ( defined('DOING_CRON') ) {
427
+ echo $msg ;
428
+ // exit();
429
+ }
430
+ else {
431
+ echo "<script>alert('" . htmlspecialchars($msg) . "');</script>" ;
432
+ // exit;
433
+ }
434
+ }
435
+
436
+ /**
437
+ * Get the current instance object.
438
+ *
439
+ * @since 1.1.0
440
+ * @access public
441
+ * @return Current class instance.
442
+ */
443
+ public static function get_instance()
444
+ {
445
+ if ( ! isset(self::$_instance) ) {
446
+ self::$_instance = new self() ;
447
+ }
448
+
449
+ return self::$_instance ;
450
+ }
451
+ }
inc/data.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The class to store and manage litespeed db data.
5
  *
6
- * @since 1.3.1
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_Data
3
  /**
4
  * The class to store and manage litespeed db data.
5
  *
6
+ * @since 1.3.1
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_Data
inc/esi.class.php ADDED
@@ -0,0 +1,554 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The esi class.
5
+ *
6
+ * This is used to define all esi related functions.
7
+ *
8
+ * @since 1.1.3
9
+ * @since 1.5 Moved into /inc
10
+ * @package LiteSpeed_Cache
11
+ * @subpackage LiteSpeed_Cache/inc
12
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
13
+ */
14
+ class LiteSpeed_Cache_ESI
15
+ {
16
+ private static $_instance ;
17
+
18
+ private static $has_esi = false ;
19
+ private $esi_args = null ;
20
+
21
+ const QS_ACTION = 'lsesi' ;
22
+ const POSTTYPE = 'lswcp' ;
23
+ const QS_PARAMS = 'esi' ;
24
+
25
+ const PARAM_ARGS = 'args' ;
26
+ const PARAM_BLOCK_ID = 'block_id' ;
27
+ const PARAM_ID = 'id' ;
28
+ const PARAM_INSTANCE = 'instance' ;
29
+ const PARAM_NAME = 'name' ;
30
+
31
+ const WIDGET_OPID_ESIENABLE = 'widget_esi_enable' ;
32
+ const WIDGET_OPID_TTL = 'widget_ttl' ;
33
+
34
+ /**
35
+ * Constructor of ESI
36
+ *
37
+ * @since 1.2.0
38
+ * @access private
39
+ */
40
+ private function __construct()
41
+ {
42
+ add_action( 'template_include', 'LiteSpeed_Cache_ESI::esi_template', 100 ) ;
43
+ add_action( 'load-widgets.php', 'LiteSpeed_Cache_Purge::purge_widget' ) ;
44
+ add_action( 'wp_update_comment_count', 'LiteSpeed_Cache_Purge::purge_comment_widget' ) ;
45
+ }
46
+
47
+ /**
48
+ * Check if the requested page has esi elements. If so, return esi on
49
+ * header.
50
+ *
51
+ * @since 1.1.3
52
+ * @access public
53
+ * @return string Esi On header if request has esi, empty string otherwise.
54
+ */
55
+ public static function has_esi()
56
+ {
57
+ return self::$has_esi ;
58
+ }
59
+
60
+ /**
61
+ * Sets that the requested page has esi elements.
62
+ *
63
+ * @since 1.1.3
64
+ * @access public
65
+ */
66
+ public static function set_has_esi()
67
+ {
68
+ self::$has_esi = true ;
69
+ }
70
+
71
+ /**
72
+ * Hooked to the template_include action.
73
+ * Selects the esi template file when the post type is a LiteSpeed ESI page.
74
+ *
75
+ * @since 1.1.3
76
+ * @access public
77
+ * @param string $template The template path filtered.
78
+ * @return string The new template path.
79
+ */
80
+ public static function esi_template($template)
81
+ {
82
+ // Check if is an ESI request
83
+ if ( ! empty( $_GET[ LiteSpeed_Cache_ESI::QS_ACTION ] ) && $_GET[ LiteSpeed_Cache_ESI::QS_ACTION ] == LiteSpeed_Cache_ESI::POSTTYPE ) {
84
+ define('LSCACHE_IS_ESI', true) ;
85
+
86
+ self::get_instance()->register_esi_actions() ;
87
+
88
+ return LSWCP_DIR . 'tpl/esi.tpl.php' ;
89
+ }
90
+ self::get_instance()->register_not_esi_actions() ;
91
+ return $template ;
92
+ }
93
+
94
+ /**
95
+ * Register all of the hooks related to the esi logic of the plugin.
96
+ * Specifically when the page IS an esi page.
97
+ *
98
+ * @since 1.1.3
99
+ * @access public
100
+ */
101
+ public function register_esi_actions()
102
+ {
103
+ add_action('litespeed_cache_load_esi_block-widget', array($this, 'load_widget_block')) ;
104
+ add_action('litespeed_cache_load_esi_block-admin-bar', array($this, 'load_admin_bar_block')) ;
105
+ add_action('litespeed_cache_load_esi_block-comment-form', array($this, 'load_comment_form_block')) ;
106
+ }
107
+
108
+ /**
109
+ * Register all of the hooks related to the esi logic of the plugin.
110
+ * Specifically when the page is NOT an esi page.
111
+ *
112
+ * @since 1.1.3
113
+ * @access public
114
+ */
115
+ public function register_not_esi_actions()
116
+ {
117
+ do_action('litespeed_cache_is_not_esi_template') ;
118
+
119
+ if ( LiteSpeed_Cache_Router::is_ajax() ) {
120
+ return ;
121
+ }
122
+
123
+ add_filter('widget_display_callback', array($this, 'sub_widget_block'), 0, 3) ;
124
+
125
+ // Add admin_bar esi
126
+ if ( LiteSpeed_Cache_Router::is_logged_in() ) {
127
+ remove_action('wp_footer', 'wp_admin_bar_render', 1000) ;
128
+ add_action('wp_footer', array($this, 'sub_admin_bar_block'), 1000) ;
129
+ }
130
+
131
+ // Add comment forum esi for logged-in user or commenter
132
+ if ( ! LiteSpeed_Cache_Router::is_ajax() && LiteSpeed_Cache_Vary::has_vary() ) {
133
+ add_filter( 'comment_form_defaults', array( $this, 'register_comment_form_actions' ) ) ;
134
+ }
135
+
136
+ }
137
+
138
+ /**
139
+ * Build the esi url. This method will build the html comment wrapper as well as serialize and encode the parameter array.
140
+ *
141
+ * The block_id parameter should contain alphanumeric and '-_' only.
142
+ *
143
+ * @since 1.1.3
144
+ * @access private
145
+ * @param string $block_id The id to use to display the correct esi block.
146
+ * @param string $wrapper The wrapper for the esi comments.
147
+ * @param array $params The esi parameters.
148
+ * @param string $control The cache control attribute if any.
149
+ * @param bool $silence If generate wrapper comment or not
150
+ * @return bool|string False on error, the output otherwise.
151
+ */
152
+ public static function sub_esi_block( $block_id, $wrapper, $params = array(), $control = 'private,no-vary', $silence = false )
153
+ {
154
+ if ( empty($block_id) || ! is_array($params) || preg_match('/[^\w-]/', $block_id) ) {
155
+ return false ;
156
+ }
157
+
158
+ $params[ self::PARAM_BLOCK_ID ] = $block_id ;
159
+ if ( $silence ) {
160
+ // Don't add comment to esi block ( orignal for nonce used in tag property data-nonce='esi_block' )
161
+ $params[ '_ls_silence' ] = true ;
162
+ }
163
+
164
+ $params = apply_filters('litespeed_cache_sub_esi_params-' . $block_id, $params) ;
165
+ $control = apply_filters('litespeed_cache_sub_esi_control-' . $block_id, $control) ;
166
+ if ( !is_array($params) || !is_string($control) ) {
167
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
168
+ LiteSpeed_Cache_Log::push("Sub esi hooks returned Params: \n"
169
+ . var_export($params, true) . "\ncache control: \n"
170
+ . var_export($control, true)) ;
171
+ }
172
+ return false ;
173
+ }
174
+
175
+ $url = trailingslashit( wp_make_link_relative( home_url() ) ) . '?' . self::QS_ACTION . '=' . self::POSTTYPE . '&' . self::QS_PARAMS . '=' . urlencode(base64_encode(serialize($params))) ;
176
+ $output = "<esi:include src='$url'" ;
177
+ if ( ! empty( $control ) ) {
178
+ $output .= " cache-control='$control'" ;
179
+ }
180
+ $output .= " />" ;
181
+
182
+ if ( ! $silence ) {
183
+ $output = "<!-- lscwp $wrapper -->$output<!-- lscwp $wrapper esi end -->" ;
184
+ }
185
+
186
+ LiteSpeed_Cache_Log::debug( "ESI block ID:$block_id; $wrapper; $control" ) ;
187
+
188
+ self::set_has_esi() ;
189
+ return $output ;
190
+ }
191
+
192
+ /**
193
+ * Parses the request parameters on an ESI request
194
+ *
195
+ * @since 1.1.3
196
+ * @access public
197
+ */
198
+ public static function parse_esi_param()
199
+ {
200
+ if ( ! isset($_REQUEST[self::QS_PARAMS]) ) {
201
+ return false ;
202
+ }
203
+ $req_params = $_REQUEST[self::QS_PARAMS] ;
204
+ $unencrypted = base64_decode($req_params) ;
205
+ if ( $unencrypted === false ) {
206
+ return false ;
207
+ }
208
+ $unencoded = urldecode($unencrypted) ;
209
+ $params = unserialize($unencoded) ;
210
+ if ( $params === false || ! isset($params[self::PARAM_BLOCK_ID]) ) {
211
+ return false ;
212
+ }
213
+
214
+ return $params ;
215
+ }
216
+
217
+ /**
218
+ * Select the correct esi output based on the parameters in an ESI request.
219
+ *
220
+ * @since 1.1.3
221
+ * @access public
222
+ */
223
+ public static function load_esi_block()
224
+ {
225
+ $params = self::parse_esi_param() ;
226
+ if ( $params === false ) {
227
+ return ;
228
+ }
229
+ $esi_id = $params[ self::PARAM_BLOCK_ID ] ;
230
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
231
+ $logInfo = '------- ESI ------- ' ;
232
+ if( ! empty( $params[ self::PARAM_NAME ] ) ) {
233
+ $logInfo .= ' Name: ' . $params[ self::PARAM_NAME ] . ' ----- ' ;
234
+ }
235
+ $logInfo .= $esi_id . ' -------' ;
236
+ LiteSpeed_Cache_Log::push( $logInfo ) ;
237
+ }
238
+
239
+ if ( ! empty( $params[ '_ls_silence' ] ) ) {
240
+ define( 'LSCACHE_ESI_SILENCE', true ) ;
241
+ }
242
+
243
+ $orig = $_SERVER[ 'REQUEST_URI' ] ;
244
+ $_SERVER[ 'REQUEST_URI' ] = !empty( $_SERVER[ 'ESI_REFERER' ] ) ? $_SERVER[ 'ESI_REFERER' ] : false ;
245
+
246
+ LiteSpeed_Cache_Tag::add( rtrim( LiteSpeed_Cache_Tag::TYPE_ESI, '.' ) ) ;
247
+ LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_ESI . $esi_id ) ;
248
+
249
+ // LiteSpeed_Cache_Log::debug(var_export($params, true ));
250
+
251
+ do_action('litespeed_cache_load_esi_block-' . $esi_id, $params) ;
252
+
253
+ $_SERVER[ 'REQUEST_URI' ] = $orig ;
254
+ }
255
+
256
+ // BEGIN helper functions
257
+ // The *_sub_* functions are helpers for the sub_* functions.
258
+ // The *_load_* functions are helpers for the load_* functions.
259
+
260
+ /**
261
+ * Get the configuration option for the current widget.
262
+ *
263
+ * @since 1.1.3
264
+ * @access public
265
+ * @param WP_Widget $widget The widget to get the options for.
266
+ * @return mixed null if not found, an array of the options otherwise.
267
+ */
268
+ public static function widget_load_get_options($widget)
269
+ {
270
+ add_filter('litespeed_cache_widget_default_options', 'LiteSpeed_Cache_ESI::widget_default_options', 10, 2) ;
271
+
272
+ if ( ! is_numeric($widget->number) ) {
273
+ return null ;
274
+ }
275
+
276
+ if ( $widget->updated ) {
277
+ $settings = get_option($widget->option_name) ;
278
+ }
279
+ else {
280
+ $settings = $widget->get_settings() ;
281
+ }
282
+
283
+ if ( ! isset($settings) ) {
284
+ return null ;
285
+ }
286
+
287
+ $instance = $settings[$widget->number] ;
288
+
289
+ if ( ! isset($instance) || ! isset($instance[LiteSpeed_Cache_Config::OPTION_NAME]) ) {
290
+ return null;
291
+ }
292
+
293
+ return $instance[LiteSpeed_Cache_Config::OPTION_NAME] ;
294
+ }
295
+
296
+ /**
297
+ * Loads the default options for default WordPress widgets.
298
+ *
299
+ * @since 1.1.3
300
+ * @access public
301
+ * @param array $options The current options selected.
302
+ * @param WP_Widget $widget The widget to be configured.
303
+ * @return array The updated options.
304
+ */
305
+ public static function widget_default_options($options, $widget)
306
+ {
307
+ if ( ! is_array($options) ) {
308
+ return $options ;
309
+ }
310
+
311
+ $widget_name = get_class($widget) ;
312
+ switch ($widget_name) {
313
+ case 'WP_Widget_Recent_Posts' :
314
+ case 'WP_Widget_Recent_Comments' :
315
+ $options[self::WIDGET_OPID_ESIENABLE] = LiteSpeed_Cache_Config::VAL_OFF ;
316
+ $options[self::WIDGET_OPID_TTL] = 86400 ;
317
+ break ;
318
+ default :
319
+ break ;
320
+ }
321
+ return $options ;
322
+ }
323
+
324
+ // END helper functions.
325
+
326
+ /**
327
+ * Hooked to the widget_display_callback filter.
328
+ * If the admin configured the widget to display via esi, this function
329
+ * will set up the esi request and cancel the widget display.
330
+ *
331
+ * @since 1.1.3
332
+ * @access public
333
+ * @param array $instance Parameter used to build the widget.
334
+ * @param WP_Widget $widget The widget to build.
335
+ * @param array $args Parameter used to build the widget.
336
+ * @return mixed Return false if display through esi, instance otherwise.
337
+ */
338
+ public function sub_widget_block( array $instance, WP_Widget $widget, array $args )
339
+ {
340
+ $name = get_class( $widget ) ;
341
+ if ( ! isset( $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ) ) {
342
+ return $instance ;
343
+ }
344
+ $options = $instance[ LiteSpeed_Cache_Config::OPTION_NAME ] ;
345
+ if ( ! isset( $options ) || ! $options[ self::WIDGET_OPID_ESIENABLE ] ) {
346
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
347
+ LiteSpeed_Cache_Log::push( 'ESI 0 ' . $name . ': '. ( ! isset( $options ) ? 'not set' : 'set off' ) ) ;
348
+ }
349
+ return $instance ;
350
+ }
351
+
352
+ $esi_private = $options[ self::WIDGET_OPID_ESIENABLE ] === LiteSpeed_Cache_Config::VAL_ON2 ? 'private,' : '' ;
353
+
354
+ $params = array(
355
+ self::PARAM_NAME => $name,
356
+ self::PARAM_ID => $widget->id,
357
+ self::PARAM_INSTANCE => $instance,
358
+ self::PARAM_ARGS => $args
359
+ ) ;
360
+
361
+ echo self::sub_esi_block( 'widget', 'widget ' . $name, $params, $esi_private . 'no-vary' ) ;
362
+ return false ;
363
+ }
364
+
365
+ /**
366
+ * Hooked to the wp_footer action.
367
+ * Sets up the ESI request for the admin bar.
368
+ *
369
+ * @access public
370
+ * @since 1.1.3
371
+ * @global type $wp_admin_bar
372
+ */
373
+ public function sub_admin_bar_block()
374
+ {
375
+ global $wp_admin_bar ;
376
+
377
+ if ( ! is_admin_bar_showing() || ! is_object($wp_admin_bar) ) {
378
+ return ;
379
+ }
380
+
381
+ echo self::sub_esi_block('admin-bar', 'adminbar') ;
382
+ }
383
+
384
+ /**
385
+ * Parses the esi input parameters and generates the widget for esi display.
386
+ *
387
+ * @access public
388
+ * @since 1.1.3
389
+ * @global $wp_widget_factory
390
+ * @param array $params Input parameters needed to correctly display widget
391
+ */
392
+ public function load_widget_block( $params )
393
+ {
394
+ global $wp_widget_factory ;
395
+ $widget = $wp_widget_factory->widgets[ $params[ self::PARAM_NAME ] ] ;
396
+ $option = self::widget_load_get_options( $widget ) ;
397
+ // Since we only reach here via esi, safe to assume setting exists.
398
+ $ttl = $option[ self::WIDGET_OPID_TTL ] ;
399
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
400
+ LiteSpeed_Cache_Log::push( 'ESI widget render: name ' . $params[ self::PARAM_NAME ] . ', id ' . $params[ self::PARAM_ID ] . ', ttl ' . $ttl ) ;
401
+ }
402
+ if ( $ttl == 0 ) {
403
+ LiteSpeed_Cache_Control::set_nocache( 'ESI Widget time to live set to 0' ) ;
404
+ }
405
+ else {
406
+ LiteSpeed_Cache_Control::set_custom_ttl( $ttl ) ;
407
+
408
+ if ( $option[ self::WIDGET_OPID_ESIENABLE ] === LiteSpeed_Cache_Config::VAL_ON2 ) {
409
+ LiteSpeed_Cache_Control::set_private() ;
410
+ }
411
+ LiteSpeed_Cache_Control::set_no_vary() ;
412
+ LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_WIDGET . $params[ self::PARAM_ID ] ) ;
413
+ }
414
+ the_widget( $params[ self::PARAM_NAME ], $params[ self::PARAM_INSTANCE ], $params[ self::PARAM_ARGS ] ) ;
415
+ }
416
+
417
+ /**
418
+ * Generates the admin bar for esi display.
419
+ *
420
+ * @access public
421
+ * @since 1.1.3
422
+ */
423
+ public function load_admin_bar_block()
424
+ {
425
+ wp_admin_bar_render() ;
426
+ if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_ADMBAR ) ) {
427
+ LiteSpeed_Cache_Control::set_nocache( 'build-in set to not cacheable' ) ;
428
+ }
429
+ else {
430
+ LiteSpeed_Cache_Control::set_private() ;
431
+ LiteSpeed_Cache_Control::set_no_vary() ;
432
+ }
433
+ }
434
+
435
+
436
+ /**
437
+ * Parses the esi input parameters and generates the comment form for esi display.
438
+ *
439
+ * @access public
440
+ * @since 1.1.3
441
+ * @param array $params Input parameters needed to correctly display comment form
442
+ */
443
+ public function load_comment_form_block($params)
444
+ {
445
+ comment_form( $params[ self::PARAM_ARGS ], $params[ self::PARAM_ID ] ) ;
446
+
447
+ if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_CACHE_COMMFORM ) ) {
448
+ LiteSpeed_Cache_Control::set_nocache( 'build-in set to not cacheable' ) ;
449
+ }
450
+ else {
451
+ // by default comment form is public
452
+ if ( LiteSpeed_Cache_Vary::has_vary() ) {
453
+ LiteSpeed_Cache_Control::set_private() ;
454
+ LiteSpeed_Cache_Control::set_no_vary() ;
455
+ }
456
+ }
457
+ }
458
+
459
+ /**
460
+ * Hooked to the comment_form_defaults filter.
461
+ * Stores the default comment form settings.
462
+ * If sub_comment_form_block is triggered, the output buffer is cleared and an esi block is added. The remaining comment form is also buffered and cleared.
463
+ * Else there is no need to make the comment form ESI.
464
+ *
465
+ * @since 1.1.3
466
+ * @access public
467
+ * @param array $defaults The default comment form settings.
468
+ * @return array The default comment form settings.
469
+ */
470
+ public function register_comment_form_actions( $defaults )
471
+ {
472
+ $this->esi_args = $defaults ;
473
+ echo LiteSpeed_Cache_GUI::clean_wrapper_begin() ;
474
+ add_filter( 'comment_form_submit_button', array( $this, 'sub_comment_form_block' ), 1000, 2 ) ;// Needs to get param from this hook and generate esi block
475
+ return $defaults ;
476
+ }
477
+
478
+ /**
479
+ * Hooked to the comment_form_submit_button filter.
480
+ *
481
+ * This method will compare the used comment form args against the default args. The difference will be passed to the esi request.
482
+ *
483
+ * @access public
484
+ * @since 1.1.3
485
+ * @global type $post
486
+ * @param $unused
487
+ * @param array $args The used comment form args.
488
+ * @return unused.
489
+ */
490
+ public function sub_comment_form_block( $unused, $args )
491
+ {
492
+ if ( empty( $args ) || empty( $this->esi_args ) ) {
493
+ LiteSpeed_Cache_Log::debug( 'comment form args empty?' ) ;
494
+ return $unused ;
495
+ }
496
+ $esi_args = array() ;
497
+
498
+ // compare current args with default ones
499
+ foreach ( $args as $k => $v ) {
500
+ if ( ! isset( $this->esi_args[ $k ] ) ) {
501
+ $esi_args[ $k ] = $v ;
502
+ }
503
+ elseif ( is_array( $v ) ) {
504
+ $diff = array_diff_assoc( $v, $this->esi_args[ $k ] ) ;
505
+ if ( ! empty( $diff ) ) {
506
+ $esi_args[ $k ] = $diff ;
507
+ }
508
+ }
509
+ elseif ( $v !== $this->esi_args[ $k ] ) {
510
+ $esi_args[ $k ] = $v ;
511
+ }
512
+ }
513
+
514
+ echo LiteSpeed_Cache_GUI::clean_wrapper_end() ;
515
+ global $post ;
516
+ $params = array(
517
+ self::PARAM_ID => $post->ID,
518
+ self::PARAM_ARGS => $esi_args,
519
+ ) ;
520
+
521
+ echo self::sub_esi_block( 'comment-form', 'comment form', $params ) ;
522
+ echo LiteSpeed_Cache_GUI::clean_wrapper_begin() ;
523
+ add_action( 'comment_form_after', array( $this, 'comment_form_sub_clean' ) ) ;
524
+ return $unused ;
525
+ }
526
+
527
+ /**
528
+ * Hooked to the comment_form_after action.
529
+ * Cleans up the remaining comment form output.
530
+ *
531
+ * @since 1.1.3
532
+ * @access public
533
+ */
534
+ public function comment_form_sub_clean()
535
+ {
536
+ echo LiteSpeed_Cache_GUI::clean_wrapper_end() ;
537
+ }
538
+
539
+ /**
540
+ * Get the current instance object.
541
+ *
542
+ * @since 1.1.3
543
+ * @access public
544
+ * @return Current class instance.
545
+ */
546
+ public static function get_instance()
547
+ {
548
+ if ( ! isset(self::$_instance) ) {
549
+ self::$_instance = new self() ;
550
+ }
551
+
552
+ return self::$_instance ;
553
+ }
554
+ }
inc/gui.class.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The frontend GUI class.
5
+ *
6
+ * @since 1.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+
13
+ class LiteSpeed_Cache_GUI
14
+ {
15
+ private static $_instance ;
16
+
17
+ private static $_clean_counter = 0 ;
18
+
19
+ /**
20
+ * Init
21
+ *
22
+ * @since 1.3
23
+ * @access private
24
+ */
25
+ private function __construct()
26
+ {
27
+ if ( ! is_admin() && is_admin_bar_showing() && current_user_can( 'manage_options' ) ) {
28
+ LiteSpeed_Cache_Log::debug( 'GUI init' ) ;
29
+ add_action( 'wp_enqueue_scripts', array( $this, 'frontend_enqueue_style' ) ) ;
30
+ add_action( 'admin_bar_menu', array( $this, 'frontend_shortcut' ), 95 ) ;
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Load frontend menu shortcut
36
+ *
37
+ * @since 1.3
38
+ * @access private
39
+ */
40
+ public function frontend_enqueue_style()
41
+ {
42
+ wp_enqueue_style( LiteSpeed_Cache::PLUGIN_NAME, LSWCP_PLUGIN_URL . 'css/litespeed.css', array(), LiteSpeed_Cache::PLUGIN_VERSION, 'all' ) ;
43
+ }
44
+
45
+ /**
46
+ * Load frontend menu shortcut
47
+ *
48
+ * @since 1.3
49
+ * @access private
50
+ */
51
+ public function frontend_shortcut()
52
+ {
53
+
54
+ global $wp_admin_bar ;
55
+ $wp_admin_bar->add_menu( array(
56
+ 'id' => 'litespeed-menu',
57
+ 'title' => '<span class="ab-icon"></span>',
58
+ 'href' => get_admin_url( null, 'admin.php?page=lscache-settings' ),
59
+ 'meta' => array( 'tabindex' => 0, 'class' => 'litespeed-top-toolbar' ),
60
+ ) ) ;
61
+
62
+ $wp_admin_bar->add_menu( array(
63
+ 'parent' => 'litespeed-menu',
64
+ 'id' => 'litespeed-purge-single',
65
+ 'title' => __( 'Purge this page', 'litespeed-cache' ),
66
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_FRONT_PURGE, false, false, true ),
67
+ 'meta' => array( 'tabindex' => '0' ),
68
+ ) );
69
+
70
+ $wp_admin_bar->add_menu( array(
71
+ 'parent' => 'litespeed-menu',
72
+ 'id' => 'litespeed-single-action',
73
+ 'title' => __( 'Mark this page as ', 'litespeed-cache' ),
74
+ 'meta' => array( 'tabindex' => '0' ),
75
+ ) );
76
+
77
+ $wp_admin_bar->add_menu( array(
78
+ 'parent' => 'litespeed-single-action',
79
+ 'id' => 'litespeed-single-noncache',
80
+ 'title' => __( 'Non cacheable', 'litespeed-cache' ),
81
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_FRONT_EXCLUDE, false, 'type=nocache', true ),
82
+ ) );
83
+
84
+ $wp_admin_bar->add_menu( array(
85
+ 'parent' => 'litespeed-single-action',
86
+ 'id' => 'litespeed-single-private',
87
+ 'title' => __( 'Private cache', 'litespeed-cache' ),
88
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_FRONT_EXCLUDE, false, 'type=private', true ),
89
+ ) );
90
+
91
+ $wp_admin_bar->add_menu( array(
92
+ 'parent' => 'litespeed-single-action',
93
+ 'id' => 'litespeed-single-nonoptimize',
94
+ 'title' => __( 'No optimization', 'litespeed-cache' ),
95
+ 'href' => LiteSpeed_Cache_Utility::build_url( LiteSpeed_Cache::ACTION_FRONT_EXCLUDE, false, 'type=nonoptimize', true ),
96
+ ) );
97
+
98
+ $wp_admin_bar->add_menu( array(
99
+ 'parent' => 'litespeed-single-action',
100
+ 'id' => 'litespeed-single-more',
101
+ 'title' => __( 'More settings', 'litespeed-cache' ),
102
+ 'href' => get_admin_url( null, 'admin.php?page=lscache-settings#excludes' ),
103
+ ) );
104
+ }
105
+
106
+ /**
107
+ * Clean wrapper from buffer
108
+ *
109
+ * @since 1.4
110
+ * @access public
111
+ */
112
+ public static function clean_wrapper( $buffer )
113
+ {
114
+ if ( self::$_clean_counter < 1 ) {
115
+ LiteSpeed_Cache_Log::debug2( "GUI bypassed by no counter" ) ;
116
+ return $buffer ;
117
+ }
118
+
119
+ LiteSpeed_Cache_Log::debug2( "GUI start cleaning counter " . self::$_clean_counter ) ;
120
+
121
+ for ( $i = 1 ; $i <= self::$_clean_counter ; $i ++ ) {
122
+ // If miss beginning
123
+ $start = strpos( $buffer, self::clean_wrapper_begin( $i ) ) ;
124
+ if ( $start === false ) {
125
+ $buffer = str_replace( self::clean_wrapper_end( $i ), '', $buffer ) ;
126
+ LiteSpeed_Cache_Log::debug2( "GUI lost beginning wrapper $i" ) ;
127
+ continue;
128
+ }
129
+
130
+ // If miss end
131
+ $end_wrapper = self::clean_wrapper_end( $i ) ;
132
+ $end = strpos( $buffer, $end_wrapper ) ;
133
+ if ( $end === false ) {
134
+ $buffer = str_replace( self::clean_wrapper_begin( $i ), '', $buffer ) ;
135
+ LiteSpeed_Cache_Log::debug2( "GUI lost ending wrapper $i" ) ;
136
+ continue;
137
+ }
138
+
139
+ // Now replace wrapped content
140
+ $buffer = substr_replace( $buffer, '', $start, $end - $start + strlen( $end_wrapper ) ) ;
141
+ LiteSpeed_Cache_Log::debug2( "GUI cleaned wrapper $i" ) ;
142
+ }
143
+
144
+ return $buffer ;
145
+ }
146
+
147
+ /**
148
+ * Display a to-be-removed html wrapper
149
+ *
150
+ * @since 1.4
151
+ * @access public
152
+ */
153
+ public static function clean_wrapper_begin( $counter = false )
154
+ {
155
+ if ( $counter === false ) {
156
+ self::$_clean_counter ++ ;
157
+ $counter = self::$_clean_counter ;
158
+ LiteSpeed_Cache_Log::debug( "GUI clean wrapper $counter begin" ) ;
159
+ }
160
+ return '<!-- LiteSpeed To Be Removed begin ' . $counter . ' -->' ;
161
+ }
162
+
163
+ /**
164
+ * Display a to-be-removed html wrapper
165
+ *
166
+ * @since 1.4
167
+ * @access public
168
+ */
169
+ public static function clean_wrapper_end( $counter = false )
170
+ {
171
+ if ( $counter === false ) {
172
+ $counter = self::$_clean_counter ;
173
+ LiteSpeed_Cache_Log::debug( "GUI clean wrapper $counter end" ) ;
174
+ }
175
+ return '<!-- LiteSpeed To Be Removed end ' . $counter . ' -->' ;
176
+ }
177
+
178
+ /**
179
+ * Get the current instance object.
180
+ *
181
+ * @since 1.3
182
+ * @access public
183
+ * @return Current class instance.
184
+ */
185
+ public static function get_instance()
186
+ {
187
+ if ( ! isset( self::$_instance ) ) {
188
+ self::$_instance = new self() ;
189
+ }
190
+
191
+ return self::$_instance ;
192
+ }
193
+
194
+ }
195
+
196
+
inc/litespeed-cache.class.php ADDED
@@ -0,0 +1,632 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The core plugin class.
4
+ *
5
+ * This is used to define internationalization, admin-specific hooks, and
6
+ * public-facing site hooks.
7
+ *
8
+ * Also maintains the unique identifier of this plugin as well as the current
9
+ * version of the plugin.
10
+ *
11
+ * @since 1.0.0
12
+ * @since 1.5 Moved into /inc
13
+ * @package LiteSpeed_Cache
14
+ * @subpackage LiteSpeed_Cache/inc
15
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
16
+ */
17
+ class LiteSpeed_Cache
18
+ {
19
+ private static $_instance ;
20
+
21
+ const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '1.5' ;
23
+
24
+ const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
+
26
+ const NONCE_NAME = 'LSCWP_NONCE' ;
27
+ const ACTION_KEY = 'LSCWP_CTRL' ;
28
+ const ACTION_DISMISS_WHM = 'dismiss-whm' ;
29
+ const ACTION_DISMISS_EXPIRESDEFAULT = 'dismiss-ExpiresDefault' ;
30
+ const ACTION_DISMISS_PROMO = 'dismiss-promo' ;
31
+ const ACTION_SAVE_HTACCESS = 'save-htaccess' ;
32
+ const ACTION_SAVE_SETTINGS = 'save-settings' ;
33
+ const ACTION_SAVE_SETTINGS_NETWORK = 'save-settings-network' ;
34
+ const ACTION_PURGE_ERRORS = 'PURGE_ERRORS' ;
35
+ const ACTION_PURGE_PAGES = 'PURGE_PAGES' ;
36
+ const ACTION_PURGE_CSSJS = 'PURGE_CSSJS' ;
37
+ const ACTION_PURGE_BY = 'PURGE_BY' ;
38
+ const ACTION_PURGE_FRONT = 'PURGE_FRONT' ;
39
+ const ACTION_PURGE_ALL = 'PURGE_ALL' ;
40
+ const ACTION_PURGE_EMPTYCACHE = 'PURGE_EMPTYCACHE' ;
41
+ const ACTION_QS_PURGE = 'PURGE' ;
42
+ const ACTION_QS_PURGE_SINGLE = 'PURGESINGLE' ;
43
+ const ACTION_QS_SHOW_HEADERS = 'SHOWHEADERS' ;
44
+ const ACTION_QS_PURGE_ALL = 'purge_all' ;
45
+ const ACTION_QS_PURGE_EMPTYCACHE = 'empty_all' ;
46
+ const ACTION_QS_NOCACHE = 'NOCACHE' ;
47
+ const ACTION_CRAWLER_GENERATE_FILE = 'crawler-generate-file' ;
48
+ const ACTION_CRAWLER_RESET_POS = 'crawler-reset-pos' ;
49
+ const ACTION_CRAWLER_CRON_ENABLE = 'crawler-cron-enable' ;
50
+ const ACTION_DO_CRAWL = 'do-crawl' ;
51
+ const ACTION_BLACKLIST_SAVE = 'blacklist-save' ;
52
+
53
+ const ACTION_FRONT_PURGE = 'front-purge' ;
54
+ const ACTION_FRONT_EXCLUDE = 'front-exclude' ;
55
+
56
+ const ACTION_DB_OPTIMIZE = 'db_optimize' ;
57
+
58
+ const ACTION_SAPI_PROCEED = 'sapi_proceed' ;
59
+ const ACTION_SAPI_CALLBACK = 'sapi_callback' ;
60
+
61
+ const WHM_TRANSIENT = 'lscwp_whm_install' ;
62
+ const WHM_TRANSIENT_VAL = 'whm_install' ;
63
+
64
+ const HEADER_DEBUG = 'X-LiteSpeed-Debug' ;
65
+
66
+ protected static $_debug_show_header = false ;
67
+
68
+ private $footer_comment = '' ;
69
+
70
+ /**
71
+ * Define the core functionality of the plugin.
72
+ *
73
+ * Set the plugin name and the plugin version that can be used throughout the plugin.
74
+ * Load the dependencies, define the locale, and set the hooks for the admin area and
75
+ * the public-facing side of the site.
76
+ *
77
+ * @since 1.0.0
78
+ */
79
+ private function __construct()
80
+ {
81
+ LiteSpeed_Cache_Config::get_instance() ;
82
+ // Check if debug is on
83
+ if ( defined( 'LITESPEED_ON' ) ) {
84
+ $should_debug = intval(self::config(LiteSpeed_Cache_Config::OPID_DEBUG)) ;
85
+ if ( $should_debug == LiteSpeed_Cache_Config::VAL_ON || ($should_debug == LiteSpeed_Cache_Config::VAL_ON2 && LiteSpeed_Cache_Router::is_admin_ip()) ) {
86
+ LiteSpeed_Cache_Log::set_enabled() ;
87
+ }
88
+
89
+ // Load third party detection if lscache enabled.
90
+ include_once LSWCP_DIR . 'thirdparty/lscwp-registry-3rd.php' ;
91
+ }
92
+
93
+ // Register plugin activate/deactivate/uninstall hooks
94
+ // NOTE: this can't be moved under after_setup_theme, otherwise activation will be bypassed somehow
95
+ if( is_admin() || defined( 'LITESPEED_CLI' ) ) {
96
+ $plugin_file = LSWCP_DIR . 'litespeed-cache.php' ;
97
+ register_activation_hook($plugin_file, array('LiteSpeed_Cache_Activation', 'register_activation' )) ;
98
+ register_deactivation_hook($plugin_file, array('LiteSpeed_Cache_Activation', 'register_deactivation' )) ;
99
+ register_uninstall_hook($plugin_file, 'LiteSpeed_Cache_Activation::uninstall_litespeed_cache') ;
100
+ }
101
+
102
+ add_action( 'after_setup_theme', array( $this, 'init' ) ) ;
103
+
104
+ // Check if there is a purge request in queue
105
+ if ( $purge_queue = get_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ) {
106
+ @header( $purge_queue ) ;
107
+ LiteSpeed_Cache_Log::debug( 'Purge Queue found&sent: ' . $purge_queue ) ;
108
+ delete_option( LiteSpeed_Cache_Purge::PURGE_QUEUE ) ;
109
+ }
110
+ }
111
+
112
+ /**
113
+ * The plugin initializer.
114
+ *
115
+ * This function checks if the cache is enabled and ready to use, then
116
+ * determines what actions need to be set up based on the type of user
117
+ * and page accessed. Output is buffered if the cache is enabled.
118
+ *
119
+ * @since 1.0.0
120
+ * @access public
121
+ */
122
+ public function init()
123
+ {
124
+ if ( ! self::config( LiteSpeed_Cache_Config::OPID_HEARTBEAT ) ) {
125
+ add_action( 'init', 'LiteSpeed_Cache_Log::disable_heartbeat', 1 ) ;
126
+ }
127
+
128
+ if( is_admin() ) {
129
+ LiteSpeed_Cache_Admin::get_instance() ;
130
+ }
131
+
132
+ if ( ! defined( 'LITESPEED_ON' ) || ! defined( 'LSCACHE_ADV_CACHE' ) || ! LSCACHE_ADV_CACHE ) {
133
+ return ;
134
+ }
135
+
136
+ ob_start( array( $this, 'send_headers_force' ) ) ;
137
+ add_action( 'shutdown', array( $this, 'send_headers' ), 0 ) ;
138
+ add_action( 'wp_footer', 'LiteSpeed_Cache::footer_hook' ) ;
139
+
140
+ /**
141
+ * Check lazy lib request in the very beginning
142
+ * @since 1.4
143
+ * Note: this should be before optimizer to avoid lazyload lib catched wrongly
144
+ */
145
+ LiteSpeed_Cache_Media::get_instance() ;
146
+
147
+ // Check minify file request in the very beginning
148
+ LiteSpeed_Cache_Optimize::get_instance() ;
149
+
150
+ // 1. Init vary
151
+ // 2. Init cacheable status
152
+ LiteSpeed_Cache_Vary::get_instance() ;
153
+
154
+ // Hook cdn for attachements
155
+ LiteSpeed_Cache_CDN::get_instance() ;
156
+
157
+ // Load public hooks
158
+ $this->load_public_actions() ;
159
+
160
+ // load cron task for crawler
161
+ if ( self::config( LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE ) && LiteSpeed_Cache_Router::can_crawl() ) {
162
+ // keep cron intval filter
163
+ LiteSpeed_Cache_Task::schedule_filter() ;
164
+
165
+ // cron hook
166
+ add_action( LiteSpeed_Cache_Task::CRON_ACTION_HOOK, 'LiteSpeed_Cache_Crawler::crawl_data' ) ;
167
+ }
168
+
169
+ // Load 3rd party hooks
170
+ add_action( 'wp_loaded', array( $this, 'load_thirdparty' ), 2 ) ;
171
+
172
+ // load litespeed actions
173
+ if ( $action = LiteSpeed_Cache_Router::get_action() ) {
174
+ $this->proceed_action( $action ) ;
175
+ }
176
+
177
+ // Load frontend GUI
178
+ LiteSpeed_Cache_GUI::get_instance() ;
179
+
180
+ }
181
+
182
+ /**
183
+ * Run frontend actions
184
+ *
185
+ * @since 1.1.0
186
+ * @access public
187
+ */
188
+ public function proceed_action( $action )
189
+ {
190
+ $msg = false ;
191
+ // handle actions
192
+ switch ( $action ) {
193
+ case LiteSpeed_Cache::ACTION_QS_PURGE:
194
+ LiteSpeed_Cache_Purge::set_purge_related() ;
195
+ break;
196
+
197
+ case self::ACTION_QS_SHOW_HEADERS:
198
+ self::$_debug_show_header = true ;
199
+ break;
200
+
201
+ case LiteSpeed_Cache::ACTION_QS_PURGE_SINGLE:
202
+ LiteSpeed_Cache_Purge::set_purge_single() ;
203
+ break;
204
+
205
+ case LiteSpeed_Cache::ACTION_CRAWLER_GENERATE_FILE:
206
+ LiteSpeed_Cache_Crawler::get_instance()->generate_sitemap() ;
207
+ LiteSpeed_Cache_Admin::redirect() ;
208
+ break;
209
+
210
+ case LiteSpeed_Cache::ACTION_CRAWLER_RESET_POS:
211
+ LiteSpeed_Cache_Crawler::get_instance()->reset_pos() ;
212
+ LiteSpeed_Cache_Admin::redirect() ;
213
+ break;
214
+
215
+ case LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE:
216
+ LiteSpeed_Cache_Task::enable() ;
217
+ break;
218
+
219
+ // Handle the ajax request to proceed crawler manually by admin
220
+ case LiteSpeed_Cache::ACTION_DO_CRAWL:
221
+ LiteSpeed_Cache_Crawler::crawl_data( true ) ;
222
+ break ;
223
+
224
+ case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
225
+ LiteSpeed_Cache_Crawler::get_instance()->save_blacklist() ;
226
+ $msg = __( 'Crawler blacklist is saved.', 'litespeed-cache' ) ;
227
+ break ;
228
+
229
+ case LiteSpeed_Cache::ACTION_PURGE_FRONT:
230
+ LiteSpeed_Cache_Purge::purge_front() ;
231
+ $msg = __( 'Notified LiteSpeed Web Server to purge the front page.', 'litespeed-cache' ) ;
232
+ break ;
233
+
234
+ case LiteSpeed_Cache::ACTION_PURGE_PAGES:
235
+ LiteSpeed_Cache_Purge::purge_pages() ;
236
+ $msg = __( 'Notified LiteSpeed Web Server to purge pages.', 'litespeed-cache' ) ;
237
+ break ;
238
+
239
+ case LiteSpeed_Cache::ACTION_PURGE_CSSJS:
240
+ LiteSpeed_Cache_Purge::purge_cssjs() ;
241
+ $msg = __( 'Notified LiteSpeed Web Server to purge CSS/JS entries.', 'litespeed-cache' ) ;
242
+ break ;
243
+
244
+ case LiteSpeed_Cache::ACTION_PURGE_ERRORS:
245
+ LiteSpeed_Cache_Purge::purge_errors() ;
246
+ $msg = __( 'Notified LiteSpeed Web Server to purge error pages.', 'litespeed-cache' ) ;
247
+ break ;
248
+
249
+ case LiteSpeed_Cache::ACTION_PURGE_ALL:
250
+ case LiteSpeed_Cache::ACTION_QS_PURGE_ALL:
251
+ LiteSpeed_Cache_Purge::purge_all() ;
252
+ $msg = __( 'Notified LiteSpeed Web Server to purge all caches.', 'litespeed-cache' ) ;
253
+ break;
254
+
255
+ case LiteSpeed_Cache::ACTION_PURGE_EMPTYCACHE:
256
+ case LiteSpeed_Cache::ACTION_QS_PURGE_EMPTYCACHE:
257
+ define( 'LSWCP_EMPTYCACHE', true ) ;// clear all sites caches
258
+ LiteSpeed_Cache_Purge::purge_all() ;
259
+ $msg = __( 'Notified LiteSpeed Web Server to purge everything.', 'litespeed-cache' ) ;
260
+ break;
261
+
262
+ case LiteSpeed_Cache::ACTION_FRONT_PURGE:
263
+ // redirect inside
264
+ LiteSpeed_Cache_Purge::frontend_purge() ;
265
+ break ;
266
+
267
+ case LiteSpeed_Cache::ACTION_FRONT_EXCLUDE:
268
+ // redirect inside
269
+ LiteSpeed_Cache_Config::frontend_save() ;
270
+ break ;
271
+
272
+ case LiteSpeed_Cache::ACTION_PURGE_BY:
273
+ LiteSpeed_Cache_Purge::get_instance()->purge_list() ;
274
+ $msg = __( 'Notified LiteSpeed Web Server to purge the list.', 'litespeed-cache' ) ;
275
+ break;
276
+
277
+ case LiteSpeed_Cache::ACTION_DISMISS_WHM:// Even its from ajax, we don't need to register wp ajax callback function but directly use our action
278
+ LiteSpeed_Cache_Activation::dismiss_whm() ;
279
+ break ;
280
+
281
+ case LiteSpeed_Cache::ACTION_DISMISS_EXPIRESDEFAULT:
282
+ update_option( LiteSpeed_Cache_Admin_Display::DISMISS_MSG, LiteSpeed_Cache_Admin_Display::RULECONFLICT_DISMISSED ) ;
283
+ break ;
284
+
285
+ case LiteSpeed_Cache::ACTION_DISMISS_PROMO:
286
+ LiteSpeed_Cache_Router::dismiss_promo_msg() ;
287
+ break ;
288
+
289
+ case LiteSpeed_Cache::ACTION_DB_OPTIMIZE:
290
+ $msg = LiteSpeed_Cache_Admin_Optimize::run_db_clean() ;
291
+ break ;
292
+
293
+ case LiteSpeed_Cache::ACTION_SAPI_PROCEED:
294
+ $msg = LiteSpeed_Cache_Admin_API::sapi_proceed() ;
295
+ break ;
296
+
297
+ case LiteSpeed_Cache::ACTION_SAPI_CALLBACK:
298
+ LiteSpeed_Cache_Admin_API::sapi_callback() ;
299
+ break ;
300
+
301
+ default:
302
+ break ;
303
+ }
304
+ if ( $msg && ! LiteSpeed_Cache_Router::is_ajax() ) {
305
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, $msg ) ;
306
+ LiteSpeed_Cache_Admin::redirect() ;
307
+ return ;
308
+ }
309
+ }
310
+
311
+ /**
312
+ * Callback used to call the detect third party action.
313
+ *
314
+ * The detect action is used by third party plugin integration classes to determine if they should add the rest of their hooks.
315
+ *
316
+ * @since 1.0.5
317
+ * @access public
318
+ */
319
+ public function load_thirdparty()
320
+ {
321
+ do_action( 'litespeed_cache_api_load_thirdparty' ) ;
322
+ }
323
+
324
+ /**
325
+ * Register all of the hooks related to the all users
326
+ * of the plugin.
327
+ *
328
+ * @since 1.0.0
329
+ * @access private
330
+ */
331
+ private function load_public_actions()
332
+ {
333
+ //register purge actions
334
+ $purge_post_events = array(
335
+ 'edit_post',
336
+ 'save_post',
337
+ 'deleted_post',
338
+ 'trashed_post',
339
+ 'delete_attachment',
340
+ // 'clean_post_cache', // This will disable wc's not purge product when stock status not change setting
341
+ ) ;
342
+ foreach ( $purge_post_events as $event ) {
343
+ // this will purge all related tags
344
+ add_action( $event, 'LiteSpeed_Cache_Purge::purge_post', 10, 2 ) ;
345
+ }
346
+
347
+ // The ESI functionality is an enterprise feature.
348
+ // Removing the openlitespeed check will simply break the page.
349
+ if ( ! LiteSpeed_Cache_Router::is_ajax() && LiteSpeed_Cache_Router::esi_enabled() ) {
350
+ LiteSpeed_Cache_ESI::get_instance() ;
351
+ }
352
+
353
+ add_action( 'wp_update_comment_count', 'LiteSpeed_Cache_Purge::purge_feeds' ) ;
354
+
355
+ // register recent posts widget tag before theme renders it to make it work
356
+ add_filter( 'widget_posts_args', 'LiteSpeed_Cache_Tag::add_widget_recent_posts' ) ;
357
+
358
+ // 301 redirect hook
359
+ add_filter( 'wp_redirect', 'LiteSpeed_Cache_Control::check_redirect', 10, 2 ) ;
360
+ }
361
+
362
+ /**
363
+ * A shortcut to get the LiteSpeed_Cache_Config config value
364
+ *
365
+ * @since 1.0.0
366
+ * @access public
367
+ * @param string $opt_id An option ID if getting an option.
368
+ * @return the option value
369
+ */
370
+ public static function config( $opt_id )
371
+ {
372
+ return LiteSpeed_Cache_Config::get_instance()->get_option( $opt_id ) ;
373
+ }
374
+
375
+ /**
376
+ * Mark wp_footer called
377
+ *
378
+ * @since 1.3
379
+ * @access public
380
+ */
381
+ public static function footer_hook()
382
+ {
383
+ LiteSpeed_Cache_Log::debug( 'Footer hook called' ) ;
384
+ if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
385
+ define( 'LITESPEED_FOOTER_CALLED', true ) ;
386
+ }
387
+ }
388
+
389
+ /**
390
+ * Tigger coment info display hook
391
+ *
392
+ * @since 1.3
393
+ * @access private
394
+ */
395
+ private function _check_is_html( $buffer = null )
396
+ {
397
+ if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
398
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: miss footer const' ) ;
399
+ return ;
400
+ }
401
+
402
+ if ( defined( 'DOING_AJAX' ) ) {
403
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing ajax' ) ;
404
+ return ;
405
+ }
406
+
407
+ if ( defined( 'DOING_CRON' ) ) {
408
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing cron' ) ;
409
+ return ;
410
+ }
411
+
412
+ if ( $buffer === null ) {
413
+ $buffer = ob_get_contents() ;
414
+ }
415
+
416
+ // double check to make sure it is a html file
417
+ if ( strlen( $buffer ) > 300 ) {
418
+ $buffer = substr( $buffer, 0, 300 ) ;
419
+ }
420
+ if ( strstr( $buffer, '<!--' ) !== false ) {
421
+ $buffer = preg_replace( '|<!--.*?-->|s', '', $buffer ) ;
422
+ }
423
+ $buffer = trim( $buffer ) ;
424
+ $is_html = stripos( $buffer, '<html' ) === 0 || stripos( $buffer, '<!DOCTYPE' ) === 0 ;
425
+
426
+ if ( ! $is_html ) {
427
+ LiteSpeed_Cache_Log::debug( 'Footer check failed: ' . ob_get_level() . '-' . substr( $buffer, 0, 100 ) ) ;
428
+ return ;
429
+ }
430
+
431
+ LiteSpeed_Cache_Log::debug( 'Footer check passed' ) ;
432
+
433
+ if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
434
+ define( 'LITESPEED_IS_HTML', true ) ;
435
+ }
436
+ }
437
+
438
+ /**
439
+ * For compatibility with those plugins have 'Bad' logic that forced all buffer output even it is NOT their buffer :(
440
+ *
441
+ * Usually this is called after send_headers() if following orignal WP process
442
+ *
443
+ * @since 1.1.5
444
+ * @access public
445
+ * @param string $buffer
446
+ * @return string
447
+ */
448
+ public function send_headers_force( $buffer )
449
+ {
450
+ $this->_check_is_html( $buffer ) ;
451
+
452
+ // Image lazy load check
453
+ $buffer = LiteSpeed_Cache_Media::run( $buffer ) ;
454
+
455
+ /**
456
+ * Clean wrapper mainly for esi block
457
+ * NOTE: this needs to be before optimizer to avoid wrapper being removed
458
+ * @since 1.4
459
+ */
460
+ $buffer = LiteSpeed_Cache_GUI::clean_wrapper( $buffer ) ;
461
+
462
+ $buffer = LiteSpeed_Cache_Optimize::run( $buffer ) ;
463
+
464
+ $buffer = LiteSpeed_Cache_CDN::run( $buffer ) ;
465
+
466
+ $this->send_headers( true ) ;
467
+
468
+ if ( $this->footer_comment ) {
469
+ $buffer .= $this->footer_comment ;
470
+ }
471
+
472
+ LiteSpeed_Cache_Log::debug( "End response\n--------------------------------------------------------------------------------\n" ) ;
473
+
474
+ return $buffer ;
475
+ }
476
+
477
+ /**
478
+ * Sends the headers out at the end of processing the request.
479
+ *
480
+ * This will send out all LiteSpeed Cache related response headers needed for the post.
481
+ *
482
+ * @since 1.0.5
483
+ * @access public
484
+ * @param boolean $is_forced If the header is sent following our normal finalizing logic
485
+ */
486
+ public function send_headers( $is_forced = false )
487
+ {
488
+ // Make sure header output only run once
489
+ if ( ! defined( 'LITESPEED_DID_' . __FUNCTION__ ) ) {
490
+ define( 'LITESPEED_DID_' . __FUNCTION__, true ) ;
491
+ }
492
+ else {
493
+ return ;
494
+ }
495
+
496
+ $this->_check_is_html() ;
497
+
498
+ // NOTE: cache ctrl output needs to be done first, as currently some varies are added in 3rd party hook `litespeed_cache_api_control`.
499
+ LiteSpeed_Cache_Control::finalize() ;
500
+
501
+ $vary_header = LiteSpeed_Cache_Vary::output() ;
502
+
503
+ // If is not cacheable but Admin QS is `purge` or `purgesingle`, `tag` still needs to be generated
504
+ $tag_header = LiteSpeed_Cache_Tag::output() ;
505
+ if ( LiteSpeed_Cache_Control::is_cacheable() && ! $tag_header ) {
506
+ LiteSpeed_Cache_Control::set_nocache( 'empty tag header' ) ;
507
+ }
508
+
509
+ // NOTE: `purge` output needs to be after `tag` output as Admin QS may need to send `tag` header
510
+ $purge_header = LiteSpeed_Cache_Purge::output() ;
511
+
512
+ // generate `control` header in the end in case control status is changed by other headers.
513
+ $control_header = LiteSpeed_Cache_Control::output() ;
514
+
515
+ // Init comment info
516
+ $running_info_showing = defined( 'LITESPEED_IS_HTML' ) || defined( 'LSCACHE_IS_ESI' ) ;
517
+ if ( defined( 'LSCACHE_ESI_SILENCE' ) ) {
518
+ $running_info_showing = false ;
519
+ LiteSpeed_Cache_Log::debug( 'ESI silence' ) ;
520
+ }
521
+
522
+ if ( $running_info_showing ) {
523
+ $this->footer_comment .= sprintf(
524
+ '<!-- %1$s %2$s by LiteSpeed Cache %4$s on %3$s -->',
525
+ defined( 'LSCACHE_IS_ESI' ) ? 'Block' : 'Page',
526
+ LiteSpeed_Cache_Control::is_cacheable() ? 'generated' : 'uncached',
527
+ date( 'Y-m-d H:i:s', time() + LITESPEED_TIME_OFFSET ),
528
+ self::PLUGIN_VERSION
529
+ ) ;
530
+ }
531
+
532
+ // send Control header
533
+ if ( $control_header ) {
534
+ @header( $control_header ) ;
535
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
536
+ LiteSpeed_Cache_Log::push( $control_header ) ;
537
+ if ( $running_info_showing ) {
538
+ $this->footer_comment .= "\n<!-- " . $control_header . " -->" ;
539
+ }
540
+ }
541
+ }
542
+ // send PURGE header
543
+ if ( $purge_header ) {
544
+ @header( $purge_header ) ;
545
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
546
+ LiteSpeed_Cache_Log::push( $purge_header ) ;
547
+ if ( $running_info_showing ) {
548
+ $this->footer_comment .= "\n<!-- " . $purge_header . " -->" ;
549
+ }
550
+ }
551
+ }
552
+ // send Vary header
553
+ if ( $vary_header ) {
554
+ @header( $vary_header ) ;
555
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
556
+ LiteSpeed_Cache_Log::push( $vary_header ) ;
557
+ if ( $running_info_showing ) {
558
+ $this->footer_comment .= "\n<!-- " . $vary_header . " -->" ;
559
+ }
560
+ }
561
+ }
562
+
563
+ // Admin QS show header action
564
+ if ( self::$_debug_show_header ) {
565
+ $debug_header = self::HEADER_DEBUG . ': ' ;
566
+ if ( $control_header ) {
567
+ $debug_header .= $control_header . '; ' ;
568
+ }
569
+ if ( $purge_header ) {
570
+ $debug_header .= $purge_header . '; ' ;
571
+ }
572
+ if ( $tag_header ) {
573
+ $debug_header .= $tag_header . '; ' ;
574
+ }
575
+ if ( $vary_header ) {
576
+ $debug_header .= $vary_header . '; ' ;
577
+ }
578
+ @header( $debug_header ) ;
579
+ LiteSpeed_Cache_Log::debug( $debug_header ) ;
580
+ }
581
+ else {
582
+ // Control header
583
+ if ( LiteSpeed_Cache_Control::is_cacheable() && $tag_header ) {
584
+ @header( $tag_header ) ;
585
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
586
+ LiteSpeed_Cache_Log::push( $tag_header ) ;
587
+ if ( $running_info_showing ) {
588
+ $this->footer_comment .= "\n<!-- " . $tag_header . " -->" ;
589
+ }
590
+ }
591
+ }
592
+ }
593
+
594
+ if ( $is_forced ) {
595
+ LiteSpeed_Cache_Log::debug( '--forced--' ) ;
596
+ }
597
+
598
+ }
599
+
600
+ /**
601
+ * Deprecated calls for backward compatibility to v1.1.2.2
602
+ */
603
+ public function purge_post( $id )
604
+ {
605
+ litespeed_purge_single_post( $id ) ;
606
+ }
607
+
608
+ /**
609
+ * Deprecated calls for backward compatibility to v1.1.2.2
610
+ */
611
+ public function purge_all()
612
+ {
613
+ LiteSpeed_Cache_API::purge_all() ;
614
+ }
615
+
616
+ /**
617
+ * Get the current instance object.
618
+ *
619
+ * @since 1.1.0
620
+ * @access public
621
+ * @return Current class instance.
622
+ */
623
+ public static function get_instance()
624
+ {
625
+ if ( ! isset(self::$_instance) ) {
626
+ self::$_instance = new self() ;
627
+ }
628
+
629
+ return self::$_instance ;
630
+ }
631
+
632
+ }
inc/litespeed.autoload.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Auto registration for LiteSpeed classes
4
+ *
5
+ * @since 1.1.0
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+
12
+ if ( ! defined('WPINC') ) {
13
+ die ;
14
+ }
15
+
16
+ if ( !function_exists('_litespeed_autoload') ) {
17
+ function _litespeed_autoload($cls)
18
+ {
19
+ $class2fileArr = array(
20
+ 'LiteSpeed' => 'lib/litespeed/litespeed.class.php',
21
+ 'Litespeed_Crawler' => 'lib/litespeed/litespeed-crawler.class.php',
22
+ 'Litespeed_File' => 'lib/litespeed/litespeed-file.class.php',
23
+ 'Litespeed_String' => 'lib/litespeed/litespeed-string.class.php',
24
+
25
+ 'LiteSpeed_Cache' => 'inc/litespeed-cache.class.php',
26
+ 'LiteSpeed_Cache_Activation' => 'inc/activation.class.php',
27
+ 'LiteSpeed_Cache_API' => 'inc/api.class.php',
28
+ 'LiteSpeed_Cache_CDN' => 'inc/cdn.class.php',
29
+ 'LiteSpeed_Cache_Config' => 'inc/config.class.php',
30
+ 'LiteSpeed_Cache_Control' => 'inc/control.class.php',
31
+ 'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
32
+ 'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
33
+ 'LiteSpeed_Cache_Data' => 'inc/data.class.php',
34
+ 'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
35
+ 'LiteSpeed_Cache_GUI' => 'inc/gui.class.php',
36
+ 'LiteSpeed_Cache_Log' => 'inc/log.class.php',
37
+ 'LiteSpeed_Cache_Media' => 'inc/media.class.php',
38
+ 'LiteSpeed_Cache_Optimize' => 'inc/optimize.class.php',
39
+ 'LiteSpeed_Cache_Purge' => 'inc/purge.class.php',
40
+ 'LiteSpeed_Cache_Router' => 'inc/router.class.php',
41
+ 'LiteSpeed_Cache_Tag' => 'inc/tag.class.php',
42
+ 'LiteSpeed_Cache_Task' => 'inc/task.class.php',
43
+ 'LiteSpeed_Cache_Vary' => 'inc/vary.class.php',
44
+ 'LiteSpeed_Cache_Utility' => 'inc/utility.class.php',
45
+
46
+ 'LiteSpeed_Cache_Admin' => 'admin/litespeed-cache-admin.class.php',
47
+ 'LiteSpeed_Cache_Admin_API' => 'admin/admin-api.class.php',
48
+ 'LiteSpeed_Cache_Admin_Display' => 'admin/litespeed-cache-admin-display.class.php',
49
+ 'LiteSpeed_Cache_Admin_Error' => 'admin/litespeed-cache-admin-error.class.php',
50
+ 'LiteSpeed_Cache_Admin_Optimize' => 'admin/litespeed-cache-admin-optimize.class.php',
51
+ 'LiteSpeed_Cache_Admin_Report' => 'admin/litespeed-cache-admin-report.class.php',
52
+ 'LiteSpeed_Cache_Admin_Rules' => 'admin/litespeed-cache-admin-rules.class.php',
53
+ 'LiteSpeed_Cache_Admin_Settings' => 'admin/litespeed-cache-admin-settings.class.php',
54
+
55
+ 'LiteSpeed_Cache_Cli_Admin' => 'cli/litespeed-cache-cli-admin.class.php',
56
+ 'LiteSpeed_Cache_Cli_Purge' => 'cli/litespeed-cache-cli-purge.class.php',
57
+
58
+ 'LiteSpeed_Cache_Tags' => 'includes/deprecated-litespeed-cache-tags.class.php',
59
+ );
60
+ if( array_key_exists($cls, $class2fileArr) && file_exists(LSWCP_DIR . $class2fileArr[$cls]) ) {
61
+ require_once LSWCP_DIR . $class2fileArr[$cls];
62
+ }
63
+ }
64
+ }
65
+
66
+ spl_autoload_register('_litespeed_autoload');
67
+
68
+ /**
69
+ * Load vendor loader
70
+ *
71
+ * @since 1.2.2
72
+ */
73
+ if ( !function_exists('litespeed_load_vendor') ) {
74
+ function litespeed_load_vendor()
75
+ {
76
+ require_once LSWCP_DIR.'lib/vendor/autoload.php';
77
+ }
78
+ }
inc/log.class.php ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin logging class.
4
+ *
5
+ * This generate the valid action.
6
+ *
7
+ * @since 1.1.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
+ */
13
+ class LiteSpeed_Cache_Log
14
+ {
15
+ private static $_instance ;
16
+ private static $_debug ;
17
+ private static $log_path ;
18
+ private static $_prefix ;
19
+ private static $_enabled = false ;
20
+
21
+ /**
22
+ * Log class Constructor
23
+ *
24
+ * NOTE: in this process, until last step ( self::$_debug = true ), any usage to WP filter should not be used to prevent infinite loop with log_filters()
25
+ *
26
+ * @since 1.1.2
27
+ * @access public
28
+ */
29
+ private function __construct()
30
+ {
31
+ self::$log_path = LSWCP_CONTENT_DIR . '/debug.log' ;
32
+ if ( ! empty( $_SERVER[ 'HTTP_USER_AGENT' ] ) && $_SERVER[ 'HTTP_USER_AGENT' ] === Litespeed_Crawler::FAST_USER_AGENT ) {
33
+ self::$log_path = LSWCP_CONTENT_DIR . '/crawler.log' ;
34
+ }
35
+ if ( ! defined( 'LSCWP_LOG_TAG' ) ) {
36
+ define( 'LSCWP_LOG_TAG', get_current_blog_id() ) ;
37
+ }
38
+
39
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_LEVEL ) ) {
40
+ define( 'LSCWP_LOG_MORE', true ) ;
41
+ }
42
+
43
+ $this->_init_request() ;
44
+ self::$_debug = true ;
45
+ }
46
+
47
+ /**
48
+ * Heartbeat control
49
+ *
50
+ * @since 1.1.5
51
+ * @access public
52
+ */
53
+ public static function disable_heartbeat()
54
+ {
55
+ wp_deregister_script( 'heartbeat' ) ;
56
+ }
57
+
58
+ /**
59
+ * Check if log class finished initialized
60
+ *
61
+ * @since 1.1.3
62
+ * @access public
63
+ */
64
+ public static function initialized()
65
+ {
66
+ return isset( self::$_debug ) ;
67
+ }
68
+
69
+ /**
70
+ * Enable debug log
71
+ *
72
+ * @since 1.1.0
73
+ * @access public
74
+ */
75
+ public static function set_enabled()
76
+ {
77
+ self::$_enabled = true ;
78
+
79
+ if ( ! isset( self::$_debug ) ) {// If not initialized, do it now
80
+ self::get_instance() ;
81
+ }
82
+
83
+ // Check if hook filters
84
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILTERS ) ) {
85
+ add_action( 'all', 'LiteSpeed_Cache_Log::log_filters' ) ;
86
+ }
87
+ }
88
+
89
+ /**
90
+ * Log all filters and action hooks
91
+ *
92
+ * @since 1.1.5
93
+ * @access public
94
+ */
95
+ public static function log_filters()
96
+ {
97
+ $action = current_filter() ;
98
+ if ( $ignore_filters = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_FILTERS ) ) {
99
+ $ignore_filters = explode( "\n", $ignore_filters ) ;
100
+ if ( in_array( $action, $ignore_filters ) ) {
101
+ return ;
102
+ }
103
+ }
104
+
105
+ if ( $ignore_part_filters = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_IGNORE_PART_FILTERS ) ) {
106
+ $ignore_part_filters = explode( "\n", $ignore_part_filters ) ;
107
+ foreach ( $ignore_part_filters as $val ) {
108
+ if ( stripos( $action, $val ) !== false ) {
109
+ return ;
110
+ }
111
+ }
112
+ }
113
+
114
+ self::debug( "===log filter: $action" ) ;
115
+ }
116
+
117
+ /**
118
+ * Get debug log status
119
+ *
120
+ * @since 1.1.0
121
+ * @access public
122
+ */
123
+ public static function get_enabled()
124
+ {
125
+ return self::$_enabled ;
126
+ }
127
+
128
+ /**
129
+ * Formats the log message with a consistent prefix.
130
+ *
131
+ * @since 1.0.12
132
+ * @access private
133
+ * @param string $msg The log message to write.
134
+ * @return string The formatted log message.
135
+ */
136
+ private static function format_message( $msg )
137
+ {
138
+ // If call here without calling get_enabled() first, improve compatibility
139
+ if ( ! defined( 'LSCWP_LOG_TAG' ) ) {
140
+ return $msg . "\n" ;
141
+ }
142
+
143
+ if ( ! isset( self::$_prefix ) ) {
144
+ // address
145
+ if ( PHP_SAPI == 'cli' ) {
146
+ $addr = '=CLI=' ;
147
+ if ( isset( $_SERVER[ 'USER' ] ) ) {
148
+ $addr .= $_SERVER[ 'USER' ] ;
149
+ }
150
+ elseif ( $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ) {
151
+ $addr .= $_SERVER[ 'HTTP_X_FORWARDED_FOR' ] ;
152
+ }
153
+ }
154
+ else {
155
+ $addr = $_SERVER[ 'REMOTE_ADDR' ] . ':' . $_SERVER[ 'REMOTE_PORT' ] ;
156
+ }
157
+
158
+ // Generate a unique string per request
159
+ self::$_prefix = sprintf( " [%s %s %s] ", $addr, LSCWP_LOG_TAG, Litespeed_String::rrand( 3 ) ) ;
160
+ }
161
+ list( $usec, $sec ) = explode(' ', microtime() ) ;
162
+ return date( 'm/d/y H:i:s', $sec + LITESPEED_TIME_OFFSET ) . substr( $usec, 1, 4 ) . self::$_prefix . $msg . "\n" ;
163
+ }
164
+
165
+ /**
166
+ * Direct call to log a debug message.
167
+ *
168
+ * @since 1.1.3
169
+ * @access public
170
+ * @param string $msg The debug message.
171
+ * @param int $backtrace_limit Backtrace depth.
172
+ */
173
+ public static function debug( $msg, $backtrace_limit = false )
174
+ {
175
+ if ( self::get_enabled() ) {
176
+ self::push( $msg, $backtrace_limit !== false ? $backtrace_limit+1 : false ) ;
177
+ }
178
+ }
179
+
180
+ /**
181
+ * Direct call to log an advanced debug message.
182
+ *
183
+ * @since 1.2.0
184
+ * @access public
185
+ * @param string $msg The debug message.
186
+ * @param int $backtrace_limit Backtrace depth.
187
+ */
188
+ public static function debug2( $msg, $backtrace_limit = false )
189
+ {
190
+ if ( ! defined( 'LSCWP_LOG_MORE' ) ) {
191
+ return ;
192
+ }
193
+ if ( self::get_enabled() ) {
194
+ self::push( $msg, $backtrace_limit !== false ? $backtrace_limit+1 : false ) ;
195
+ }
196
+ }
197
+
198
+ /**
199
+ * Logs a debug message.
200
+ *
201
+ * @since 1.1.0
202
+ * @access public
203
+ * @param string $msg The debug message.
204
+ * @param int $backtrace_limit Backtrace depth.
205
+ */
206
+ public static function push( $msg, $backtrace_limit = false )
207
+ {
208
+ // backtrace handler
209
+ if ( defined( 'LSCWP_LOG_MORE' ) && $backtrace_limit !== false ) {
210
+ $trace = version_compare( PHP_VERSION, '5.4.0', '<' ) ? debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ) : debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, $backtrace_limit + 2 ) ;
211
+ for ( $i=1 ; $i <= $backtrace_limit + 1 ; $i++ ) {// the 0st item is push()
212
+ if ( empty( $trace[$i]['class'] ) ) {
213
+ break ;
214
+ }
215
+ if ( $trace[$i]['class'] == 'LiteSpeed_Cache_Log' ) {
216
+ continue ;
217
+ }
218
+ $log = str_replace('LiteSpeed_Cache', 'LSC', $trace[$i]['class']) . $trace[$i]['type'] . $trace[$i]['function'] . '()' ;
219
+ if ( ! empty( $trace[$i-1]['line'] ) ) {
220
+ $log .= '@' . $trace[$i-1]['line'] ;
221
+ }
222
+ $msg .= " \ $log" ;
223
+ }
224
+
225
+ }
226
+
227
+ Litespeed_File::append( self::$log_path, self::format_message( $msg ) ) ;
228
+ }
229
+
230
+ /**
231
+ * Create the initial log messages with the request parameters.
232
+ *
233
+ * @since 1.0.12
234
+ * @access private
235
+ */
236
+ private function _init_request()
237
+ {
238
+ // Check log file size
239
+ $log_file_size = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_LOG_FILE_SIZE ) ;
240
+ if ( file_exists( self::$log_path ) && filesize( self::$log_path ) > $log_file_size*1000000 ) {
241
+ Litespeed_File::save( self::$log_path, '' ) ;
242
+ }
243
+
244
+ // For more than 2s's requests, add more break
245
+ if ( file_exists( self::$log_path ) && time() - filemtime( self::$log_path ) > 2 ) {
246
+ Litespeed_File::append( self::$log_path, "\n\n\n\n" ) ;
247
+ }
248
+
249
+ if ( PHP_SAPI == 'cli' ) {
250
+ return ;
251
+ }
252
+
253
+ $servervars = array(
254
+ 'Query String' => '',
255
+ 'HTTP_USER_AGENT' => '',
256
+ 'HTTP_ACCEPT_ENCODING' => '',
257
+ 'HTTP_COOKIE' => '',
258
+ 'X-LSCACHE' => '',
259
+ 'LSCACHE_VARY_COOKIE' => '',
260
+ 'LSCACHE_VARY_VALUE' => ''
261
+ ) ;
262
+ $server = array_merge( $servervars, $_SERVER ) ;
263
+ $params = array() ;
264
+
265
+ $param = sprintf( '%s %s %s', $server['REQUEST_METHOD'], $server['SERVER_PROTOCOL'], strtok( $server['REQUEST_URI'], '?' ) ) ;
266
+
267
+ $qs = ! empty( $server['QUERY_STRING'] ) ? $server['QUERY_STRING'] : '' ;
268
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_COLLAPS_QS ) ) {
269
+ if ( strlen( $qs ) > 53 ) {
270
+ $qs = substr( $qs, 0, 53 ) . '...' ;
271
+ }
272
+ if ( $qs ) {
273
+ $param .= ' ? ' . $qs ;
274
+ }
275
+ $params[] = $param ;
276
+ }
277
+ else {
278
+ $params[] = $param ;
279
+ $params[] = 'Query String: ' . $qs ;
280
+ }
281
+
282
+ if ( defined( 'LSCWP_LOG_MORE' ) ) {
283
+ $params[] = 'User Agent: ' . $server[ 'HTTP_USER_AGENT' ] ;
284
+ $params[] = 'Accept Encoding: ' . $server['HTTP_ACCEPT_ENCODING'] ;
285
+ }
286
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_DEBUG_COOKIE ) ) {
287
+ $params[] = 'Cookie: ' . $server['HTTP_COOKIE'] ;
288
+ }
289
+ if ( isset( $_COOKIE[ '_lscache_vary' ] ) ) {
290
+ $params[] = 'Cookie _lscache_vary: ' . $_COOKIE[ '_lscache_vary' ] ;
291
+ }
292
+ if ( defined( 'LSCWP_LOG_MORE' ) ) {
293
+ $params[] = 'X-LSCACHE: ' . ( $server[ 'X-LSCACHE' ] ? 'true' : 'false' ) ;
294
+ }
295
+ if( $server['LSCACHE_VARY_COOKIE'] ) {
296
+ $params[] = 'LSCACHE_VARY_COOKIE: ' . $server['LSCACHE_VARY_COOKIE'] ;
297
+ }
298
+ if( $server['LSCACHE_VARY_VALUE'] ) {
299
+ $params[] = 'LSCACHE_VARY_VALUE: ' . $server['LSCACHE_VARY_VALUE'] ;
300
+ }
301
+
302
+ $request = array_map( 'self::format_message', $params ) ;
303
+
304
+ Litespeed_File::append( self::$log_path, $request ) ;
305
+ }
306
+
307
+ /**
308
+ * Get the current instance object.
309
+ *
310
+ * @since 1.1.0
311
+ * @access public
312
+ * @return Current class instance.
313
+ */
314
+ public static function get_instance()
315
+ {
316
+ if ( ! isset( self::$_instance ) ) {
317
+ self::$_instance = new self() ;
318
+ }
319
+
320
+ return self::$_instance ;
321
+ }
322
+ }
inc/media.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The class to operate media data.
5
  *
6
- * @since 1.4
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_Media
@@ -105,10 +106,12 @@ class LiteSpeed_Cache_Media
105
  $html_list = $this->_parse_img() ;
106
  $html_list_ori = $html_list ;
107
 
 
 
108
  foreach ( $html_list as $k => $v ) {
109
  $snippet = '<noscript>' . $v . '</noscript>' ;
110
- $v = str_replace( array( ' src=', ' srcset=' ), array( ' data-src=', ' data-srcset=' ), $v ) ;
111
- $v = str_replace( '<img ', '<img data-lazyloaded="1" src="' . LITESPEED_PLACEHOLDER . '" ', $v ) ;
112
  $snippet = $v . $snippet ;
113
 
114
  $html_list[ $k ] = $snippet ;
@@ -150,6 +153,15 @@ class LiteSpeed_Cache_Media
150
  */
151
  private function _parse_img()
152
  {
 
 
 
 
 
 
 
 
 
153
  $html_list = array() ;
154
 
155
  $content = preg_replace( '#<!--.*-->#sU', '', $this->content ) ;
@@ -161,13 +173,22 @@ class LiteSpeed_Cache_Media
161
  continue ;
162
  }
163
 
164
- LiteSpeed_Cache_Log::debug2( 'Media found: ' . $attrs[ 'src' ] ) ;
165
 
166
  if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) || ! empty( $attrs[ 'data-srcset' ] ) ) {
167
  LiteSpeed_Cache_Log::debug2( 'Media bypassed' ) ;
168
  continue ;
169
  }
170
 
 
 
 
 
 
 
 
 
 
171
  // to avoid multiple replacement
172
  if ( in_array( $match[ 0 ], $html_list ) ) {
173
  continue ;
3
  /**
4
  * The class to operate media data.
5
  *
6
+ * @since 1.4
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_Media
106
  $html_list = $this->_parse_img() ;
107
  $html_list_ori = $html_list ;
108
 
109
+ $placeholder = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_MEDIA_IMG_LAZY_PLACEHOLDER ) ?: LITESPEED_PLACEHOLDER ;
110
+
111
  foreach ( $html_list as $k => $v ) {
112
  $snippet = '<noscript>' . $v . '</noscript>' ;
113
+ $v = str_replace( array( ' src=', ' srcset=', ' sizes=' ), array( ' data-src=', ' data-srcset=', ' data-sizes=' ), $v ) ;
114
+ $v = str_replace( '<img ', '<img data-lazyloaded="1" src="' . $placeholder . '" ', $v ) ;
115
  $snippet = $v . $snippet ;
116
 
117
  $html_list[ $k ] = $snippet ;
153
  */
154
  private function _parse_img()
155
  {
156
+ /**
157
+ * Exclude list
158
+ * @since 1.5
159
+ */
160
+ $excludes = apply_filters( 'litespeed_cache_media_lazy_img_excludes', get_option( LiteSpeed_Cache_Config::ITEM_MEDIA_LAZY_IMG_EXC ) ) ;
161
+ if ( $excludes ) {
162
+ $excludes = explode( "\n", $excludes ) ;
163
+ }
164
+
165
  $html_list = array() ;
166
 
167
  $content = preg_replace( '#<!--.*-->#sU', '', $this->content ) ;
173
  continue ;
174
  }
175
 
176
+ LiteSpeed_Cache_Log::debug2( 'Media: found: ' . $attrs[ 'src' ] ) ;
177
 
178
  if ( ! empty( $attrs[ 'data-no-lazy' ] ) || ! empty( $attrs[ 'data-lazyloaded' ] ) || ! empty( $attrs[ 'data-src' ] ) || ! empty( $attrs[ 'data-srcset' ] ) ) {
179
  LiteSpeed_Cache_Log::debug2( 'Media bypassed' ) ;
180
  continue ;
181
  }
182
 
183
+ /**
184
+ * Exclude from lazyload by setting
185
+ * @since 1.5
186
+ */
187
+ if ( $excludes && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'src' ], $excludes ) ) {
188
+ LiteSpeed_Cache_Log::debug2( 'Media: lazyload image exclude ' . $attrs[ 'src' ] ) ;
189
+ continue ;
190
+ }
191
+
192
  // to avoid multiple replacement
193
  if ( in_array( $match[ 0 ], $html_list ) ) {
194
  continue ;
inc/optimize.class.php ADDED
@@ -0,0 +1,1112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The optimize class.
5
+ *
6
+ * @since 1.2.2
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+
13
+ class LiteSpeed_Cache_Optimize
14
+ {
15
+ private static $_instance ;
16
+
17
+ const DIR_MIN = '/min' ;
18
+ const CSS_ASYNC_LIB = '/min/css_async.js' ;
19
+
20
+ private $content ;
21
+ private $http2_headers = array() ;
22
+
23
+ private $cfg_http2_css ;
24
+ private $cfg_http2_js ;
25
+ private $cfg_css_minify ;
26
+ private $cfg_css_combine ;
27
+ private $cfg_js_minify ;
28
+ private $cfg_js_combine ;
29
+ private $cfg_html_minify ;
30
+ private $cfg_css_async ;
31
+ private $cfg_js_defer ;
32
+ private $cfg_js_defer_exc = false ;
33
+ private $cfg_qs_rm ;
34
+ private $cfg_exc_jquery ;
35
+
36
+
37
+ private $html_foot = '' ; // The html info append to <body>
38
+ private $html_head = '' ; // The html info prepend to <body>
39
+ private $css_to_be_removed = array() ;
40
+
41
+ private $minify_cache ;
42
+ private $minify_minify ;
43
+ private $minify_env ;
44
+ private $minify_sourceFactory ;
45
+ private $minify_controller ;
46
+ private $minify_options ;
47
+
48
+ /**
49
+ * Init optimizer
50
+ *
51
+ * @since 1.2.2
52
+ * @access private
53
+ */
54
+ private function __construct()
55
+ {
56
+ $this->cfg_http2_css = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_HTTP2 ) ;
57
+ $this->cfg_http2_js = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_HTTP2 ) ;
58
+ $this->cfg_css_minify = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_MINIFY ) ;
59
+ $this->cfg_css_combine = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_COMBINE ) ;
60
+ $this->cfg_js_minify = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_MINIFY ) ;
61
+ $this->cfg_js_combine = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_COMBINE ) ;
62
+ $this->cfg_html_minify = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_HTML_MINIFY ) ;
63
+ $this->cfg_css_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC ) ;
64
+ $this->cfg_js_defer = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER ) ;
65
+ $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
66
+ $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
67
+
68
+ $this->_static_request_check() ;
69
+
70
+ if ( ! $this->_can_optm() ) {
71
+ return ;
72
+ }
73
+
74
+ // To remove emoji from WP
75
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EMOJI_RM ) ) {
76
+ add_action( 'init', array( $this, 'emoji_rm' ) ) ;
77
+ }
78
+
79
+ if ( $this->cfg_qs_rm ) {
80
+ add_filter( 'style_loader_src', array( $this, 'remove_query_strings' ), 999 ) ;
81
+ add_filter( 'script_loader_src', array( $this, 'remove_query_strings' ), 999 ) ;
82
+ }
83
+
84
+ // Check if there is any critical css rules setting
85
+ if ( $this->cfg_css_async ) {
86
+ add_action( 'wp_head', array( $this, 'prepend_critical_css' ), 1 ) ;
87
+ }
88
+
89
+ /**
90
+ * Exclude js from deferred setting
91
+ * @since 1.5
92
+ */
93
+ if ( $this->cfg_js_defer ) {
94
+ $this->cfg_js_defer_exc = apply_filters( 'litespeed_optm_js_defer_exc', get_option( LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ) ) ;
95
+ if ( $this->cfg_js_defer_exc ) {
96
+ $this->cfg_js_defer_exc = explode( "\n", $this->cfg_js_defer_exc ) ;
97
+ }
98
+ }
99
+
100
+ }
101
+
102
+ /**
103
+ * Remove emoji from WP
104
+ *
105
+ * @since 1.4
106
+ * @access public
107
+ */
108
+ public function emoji_rm()
109
+ {
110
+ remove_action( 'wp_head' , 'print_emoji_detection_script', 7 ) ;
111
+ remove_action( 'admin_print_scripts' , 'print_emoji_detection_script' ) ;
112
+ remove_filter( 'the_content_feed' , 'wp_staticize_emoji' ) ;
113
+ remove_filter( 'comment_text_rss' , 'wp_staticize_emoji' ) ;
114
+ }
115
+
116
+ /**
117
+ * Output critical css
118
+ *
119
+ * @since 1.3
120
+ * @access public
121
+ * @return string The static file content
122
+ */
123
+ public function prepend_critical_css()
124
+ {
125
+
126
+ $rules = get_option( LiteSpeed_Cache_Config::ITEM_OPTM_CSS ) ;
127
+ if ( ! $rules ) {
128
+ return ;
129
+ }
130
+
131
+ echo '<style id="litespeed-optm-css-rules">' . $rules . '</style>' ;
132
+ }
133
+
134
+ /**
135
+ * Check if the request is for static file
136
+ *
137
+ * @since 1.2.2
138
+ * @access private
139
+ * @return string The static file content
140
+ */
141
+ private function _static_request_check()
142
+ {
143
+ // This request is for js/css_async.js
144
+ if ( $this->cfg_css_async && strpos( $_SERVER[ 'REQUEST_URI' ], self::CSS_ASYNC_LIB ) !== false ) {
145
+ LiteSpeed_Cache_Log::debug( 'Optimizer start serving static file' ) ;
146
+
147
+ LiteSpeed_Cache_Control::set_cacheable() ;
148
+ LiteSpeed_Cache_Control::set_no_vary() ;
149
+ LiteSpeed_Cache_Control::set_custom_ttl( 8640000 ) ;
150
+ LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN . '_CSS_ASYNC' ) ;
151
+
152
+ $file = LSWCP_DIR . 'js/css_async.js' ;
153
+
154
+ header( 'Content-Length: ' . filesize( $file ) ) ;
155
+ header( 'Content-Type: application/x-javascript; charset=utf-8' ) ;
156
+
157
+ echo file_get_contents( $file ) ;
158
+ exit ;
159
+ }
160
+
161
+ // If not turn on min files
162
+ if ( ! $this->cfg_css_minify && ! $this->cfg_css_combine && ! $this->cfg_js_minify && ! $this->cfg_js_combine ) {
163
+ return ;
164
+ }
165
+
166
+ if ( empty( $_SERVER[ 'REQUEST_URI' ] ) || strpos( $_SERVER[ 'REQUEST_URI' ], self::DIR_MIN . '/' ) === false ) {
167
+ return ;
168
+ }
169
+
170
+ // try to match `http://home_url/min/xx.css
171
+ if ( ! preg_match( '#' . self::DIR_MIN . '/(\w+\.(css|js))#U', $_SERVER[ 'REQUEST_URI' ], $match ) ) {
172
+ return ;
173
+ }
174
+
175
+ LiteSpeed_Cache_Log::debug( 'Optimizer start minifying file' ) ;
176
+
177
+ // Proceed css/js file generation
178
+ define( 'LITESPEED_MIN_FILE', true ) ;
179
+
180
+ $result = $this->_minify( $match[ 1 ] ) ;
181
+
182
+ if ( ! $result ) {
183
+ LiteSpeed_Cache_Control::set_nocache( 'Empty content from optimizer' ) ;
184
+ exit ;
185
+ }
186
+
187
+ foreach ( $result[ 'headers' ] as $key => $val ) {
188
+ if ( in_array( $key, array( 'Content-Length', 'Content-Type' ) ) ) {
189
+ header( $key . ': ' . $val ) ;
190
+ }
191
+ }
192
+
193
+ LiteSpeed_Cache_Control::set_cacheable() ;
194
+ LiteSpeed_Cache_Control::set_no_vary() ;
195
+ LiteSpeed_Cache_Control::set_custom_ttl( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTIMIZE_TTL ) ) ;
196
+ LiteSpeed_Cache_Tag::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
197
+
198
+ echo $result[ 'content' ] ;
199
+ exit ;
200
+ }
201
+
202
+ /**
203
+ * Remove QS
204
+ *
205
+ * @since 1.3
206
+ * @access public
207
+ */
208
+ public function remove_query_strings( $src )
209
+ {
210
+ if ( strpos( $src, 'ver=' ) !== false ) {
211
+ $src = preg_replace( '#[&\?]+(ver=([\w\-\.]+))#i', '', $src ) ;
212
+ }
213
+ return $src ;
214
+ }
215
+
216
+ /**
217
+ * Check if can run optimize
218
+ *
219
+ * @since 1.3
220
+ * @access private
221
+ */
222
+ private function _can_optm()
223
+ {
224
+ if ( is_admin() ) {
225
+ return false ;
226
+ }
227
+
228
+ if ( is_feed() ) {
229
+ return false ;
230
+ }
231
+
232
+ if ( is_preview() ) {
233
+ return false ;
234
+ }
235
+
236
+ if ( LiteSpeed_Cache_Router::is_ajax() ) {
237
+ return false ;
238
+ }
239
+
240
+ return true ;
241
+ }
242
+
243
+ /**
244
+ * Run optimize process
245
+ * NOTE: As this is after cache finalized, can NOT set any cache control anymore
246
+ *
247
+ * @since 1.2.2
248
+ * @access public
249
+ * @return string The content that is after optimization
250
+ */
251
+ public static function run( $content )
252
+ {
253
+ if ( defined( 'LITESPEED_MIN_FILE' ) ) {// Must have this to avoid css/js from optimization again ( But can be removed as mini file doesn't have LITESPEED_IS_HTML, keep for efficiency)
254
+ return $content ;
255
+ }
256
+
257
+ if ( ! defined( 'LITESPEED_IS_HTML' ) ) {
258
+ LiteSpeed_Cache_Log::debug( 'Optimizer bypass: Not frontend HTML type' ) ;
259
+ return $content ;
260
+ }
261
+
262
+ // Check if hit URI excludes
263
+ $excludes = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXCLUDES ) ;
264
+ if ( ! empty( $excludes ) ) {
265
+ $result = LiteSpeed_Cache_Utility::str_hit_array( esc_url( $_SERVER[ 'REQUEST_URI' ] ), explode( "\n", $excludes ) ) ;
266
+ if ( $result ) {
267
+ LiteSpeed_Cache_Log::debug( 'Optimizer bypass: hit URI Excludes setting: ' . $result ) ;
268
+ return $content ;
269
+ }
270
+ }
271
+
272
+ LiteSpeed_Cache_Log::debug( 'Optimizer start' ) ;
273
+
274
+ $instance = self::get_instance() ;
275
+ $instance->content = $content ;
276
+
277
+ $instance->_optimize() ;
278
+ return $instance->content ;
279
+ }
280
+
281
+ /**
282
+ * Optimize css src
283
+ *
284
+ * @since 1.2.2
285
+ * @access private
286
+ */
287
+ private function _optimize()
288
+ {
289
+ if ( ! $this->_can_optm() ) {
290
+ LiteSpeed_Cache_Log::debug( 'Optimizer bypass: admin/feed/preview' ) ;
291
+ return ;
292
+ }
293
+
294
+ do_action( 'litespeed_optm' ) ;
295
+
296
+ // Parse css from content
297
+ $ggfonts_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_GGFONTS_RM ) ;
298
+ if ( $this->cfg_css_minify || $this->cfg_css_combine || $this->cfg_http2_css || $ggfonts_rm || $this->cfg_css_async ) {
299
+ // To remove google fonts
300
+ if ( $ggfonts_rm ) {
301
+ $this->css_to_be_removed[] = 'fonts.googleapis.com' ;
302
+ }
303
+ list( $src_list, $html_list ) = $this->_handle_css() ;
304
+ }
305
+
306
+ // css optimizer
307
+ if ( $this->cfg_css_minify || $this->cfg_css_combine || $this->cfg_http2_css ) {
308
+
309
+ if ( $src_list ) {
310
+ // Analyze local file
311
+ list( $ignored_html, $src_queue_list, $file_size_list ) = $this->_analyse_links( $src_list, $html_list ) ;
312
+
313
+ // IF combine
314
+ if ( $this->cfg_css_combine ) {
315
+ $urls = $this->_limit_size_build_hash_url( $src_queue_list, $file_size_list ) ;
316
+
317
+ $snippet = '' ;
318
+ foreach ( $urls as $url ) {
319
+ $snippet .= "<link data-optimized='2' rel='stylesheet' href='$url' />" ;// use 2 as combined
320
+ }
321
+
322
+ // Handle css async load
323
+ if ( $this->cfg_css_async ) {
324
+ // Only ignored html snippet needs async
325
+ list( $noscript, $ignored_html_async ) = $this->_async_css_list( $ignored_html ) ;
326
+
327
+ $noscript .= $snippet ;
328
+ $snippet = '' ;
329
+ foreach ( $urls as $url ) {
330
+ $snippet .= "<link rel='preload' data-asynced='1' data-optimized='2' as='style' onload='this.rel=\"stylesheet\"' href='$url' />" ;
331
+ }
332
+
333
+ $this->html_head .= implode( '', $ignored_html_async ) . $snippet ;
334
+ $this->html_head .= '<noscript>' . $noscript . '</noscript>' ;
335
+ }
336
+ else {
337
+ $this->html_head .= implode( '', $ignored_html ) . $snippet ;
338
+ }
339
+
340
+ // Move all css to top
341
+ $this->content = str_replace( $html_list, '', $this->content ) ;
342
+
343
+ // Add to HTTP2
344
+ foreach ( $urls as $url ) {
345
+ $this->append_http2( $url ) ;
346
+ }
347
+
348
+ }
349
+ // Only minify
350
+ elseif ( $this->cfg_css_minify ) {
351
+ // will handle async css load inside
352
+ $this->_src_queue_handler( $src_queue_list, $html_list ) ;
353
+ }
354
+ // Only HTTP2 push
355
+ else {
356
+ foreach ( $src_queue_list as $val ) {
357
+ $this->append_http2( $val ) ;
358
+ }
359
+ }
360
+ }
361
+ }
362
+
363
+ // Handle css lazy load if not handled async loaded yet
364
+ if ( $this->cfg_css_async && ! $this->cfg_css_minify && ! $this->cfg_css_combine ) {
365
+ // async html
366
+ list( $noscript, $html_list_async ) = $this->_async_css_list( $html_list ) ;
367
+
368
+ // add noscript
369
+ $this->html_head .= '<noscript>' . $noscript . '</noscript>' ;
370
+
371
+ // Replace async css
372
+ $this->content = str_replace( $html_list, $html_list_async, $this->content ) ;
373
+
374
+ }
375
+
376
+ // Parse js from buffer as needed
377
+ if ( $this->cfg_js_minify || $this->cfg_js_combine || $this->cfg_http2_js || $this->cfg_js_defer ) {
378
+ list( $src_list, $html_list, $head_src_list ) = $this->_parse_js() ;
379
+ }
380
+
381
+ // js optimizer
382
+ if ( $this->cfg_js_minify || $this->cfg_js_combine || $this->cfg_http2_js ) {
383
+
384
+ if ( $src_list ) {
385
+ list( $ignored_html, $src_queue_list, $file_size_list ) = $this->_analyse_links( $src_list, $html_list, 'js' ) ;
386
+
387
+ // IF combine
388
+ if ( $this->cfg_js_combine ) {
389
+ // separate head/foot js/raw html
390
+ $head_js = array() ;
391
+ $head_ignored_html = array() ;
392
+ $foot_js = array() ;
393
+ $foot_ignored_html = array() ;
394
+ foreach ( $src_queue_list as $k => $src ) {
395
+ if ( in_array( $src, $head_src_list ) ) {
396
+ $head_js[ $k ] = $src ;
397
+ }
398
+ else {
399
+ $foot_js[ $k ] = $src ;
400
+ }
401
+ }
402
+ foreach ( $ignored_html as $src => $html ) {
403
+ if ( in_array( $src, $head_src_list ) ) {
404
+ $head_ignored_html[] = $html ;
405
+ }
406
+ else {
407
+ $foot_ignored_html[] = $html ;
408
+ }
409
+ }
410
+
411
+ $snippet = '' ;
412
+ if ( $head_js ) {
413
+ $urls = $this->_limit_size_build_hash_url( $head_js, $file_size_list, 'js' ) ;
414
+ foreach ( $urls as $url ) {
415
+ $snippet .= "<script data-optimized='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
416
+
417
+ // Add to HTTP2
418
+ $this->append_http2( $url, 'js' ) ;
419
+ }
420
+ }
421
+ if ( $this->cfg_js_defer ) {
422
+ $head_ignored_html = $this->_js_defer( $head_ignored_html ) ;
423
+ }
424
+ $this->html_head .= implode( '', $head_ignored_html ) . $snippet ;
425
+
426
+ $snippet = '' ;
427
+ if ( $foot_js ) {
428
+ $urls = $this->_limit_size_build_hash_url( $foot_js, $file_size_list, 'js' ) ;
429
+ foreach ( $urls as $url ) {
430
+ $snippet .= "<script data-optimized='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
431
+
432
+ // Add to HTTP2
433
+ $this->append_http2( $url, 'js' ) ;
434
+ }
435
+ }
436
+ if ( $this->cfg_js_defer ) {
437
+ $foot_ignored_html = $this->_js_defer( $foot_ignored_html ) ;
438
+ }
439
+ $this->html_foot .= implode( '', $foot_ignored_html ) . $snippet ;
440
+
441
+ // Will move all js to top/bottom
442
+ $this->content = str_replace( $html_list, '', $this->content ) ;
443
+
444
+ }
445
+ // Only minify
446
+ elseif ( $this->cfg_js_minify ) {
447
+ // Will handle js defer inside
448
+ $this->_src_queue_handler( $src_queue_list, $html_list, 'js' ) ;
449
+ }
450
+ // Only HTTP2 push
451
+ else {
452
+ foreach ( $src_queue_list as $val ) {
453
+ $this->append_http2( $val, 'js' ) ;
454
+ }
455
+ }
456
+ }
457
+ }
458
+
459
+ // Handle js defer if not handled defer yet
460
+ if ( $this->cfg_js_defer && ! $this->cfg_js_minify && ! $this->cfg_js_combine ) {
461
+ // defer html
462
+ $html_list2 = $this->_js_defer( $html_list ) ;
463
+
464
+ // Replace async js
465
+ $this->content = str_replace( $html_list, $html_list2, $this->content ) ;
466
+ }
467
+
468
+
469
+ // Append async compatibility lib to head
470
+ if ( $this->cfg_css_async ) {
471
+ $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
472
+ $this->html_head .= "<script src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
473
+ $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
474
+ }
475
+
476
+ // Replace html head part
477
+ $this->html_head = apply_filters( 'litespeed_optm_html_head', $this->html_head ) ;
478
+ if ( $this->html_head ) {
479
+ $this->content = preg_replace( '#<head([^>]*)>#isU', '<head$1>' . $this->html_head , $this->content, 1 ) ;
480
+ }
481
+
482
+ // Replace html foot part
483
+ $this->html_foot = apply_filters( 'litespeed_optm_html_foot', $this->html_foot ) ;
484
+ if ( $this->html_foot ) {
485
+ $this->content = str_replace( '</body>', $this->html_foot . '</body>' , $this->content ) ;
486
+ }
487
+
488
+ // HTML minify
489
+ if ( $this->cfg_html_minify ) {
490
+ $ori = $this->content ;
491
+
492
+ set_error_handler( 'litespeed_exception_handler' ) ;
493
+ try {
494
+ litespeed_load_vendor() ;
495
+ $this->content = Minify_HTML::minify( $this->content ) ;
496
+ $this->content .= '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
497
+
498
+ } catch ( ErrorException $e ) {
499
+ LiteSpeed_Cache_Control::debug( 'Error when optimizing HTML: ' . $e->getMessage() ) ;
500
+ error_log( 'LiteSpeed Optimizer optimizing HTML Error: ' . $e->getMessage() ) ;
501
+ // If failed to minify HTML, restore original content
502
+ $this->content = $ori ;
503
+ }
504
+ restore_error_handler() ;
505
+
506
+ }
507
+
508
+ if ( $this->http2_headers ) {
509
+ @header( 'Link: ' . implode( ',', $this->http2_headers ), false ) ;
510
+ }
511
+
512
+ }
513
+
514
+ /**
515
+ * Limit combined filesize when build hash url
516
+ *
517
+ * @since 1.3
518
+ * @access private
519
+ */
520
+ private function _limit_size_build_hash_url( $src_queue_list, $file_size_list, $file_type = 'css' )
521
+ {
522
+ $total = 0 ;
523
+ $i = 0 ;
524
+ $src_arr = array() ;
525
+ foreach ( $src_queue_list as $k => $v ) {
526
+
527
+ empty( $src_arr[ $i ] ) && $src_arr[ $i ] = array() ;
528
+
529
+ $src_arr[ $i ][] = $v ;
530
+
531
+ $total += $file_size_list[ $k ] ;
532
+
533
+ if ( $total > 1000000 ) { // If larger than 1M, separate them
534
+ $total = 0;
535
+ $i ++ ;
536
+ }
537
+ }
538
+ if ( count( $src_arr ) > 1 ) {
539
+ LiteSpeed_Cache_Log::debug( 'Optimizer: separate ' . $file_type . ' to ' . count( $src_arr ) ) ;
540
+ }
541
+
542
+ // group build
543
+ $hashed_arr = array() ;
544
+ foreach ( $src_arr as $v ) {
545
+ $hashed_arr[] = $this->_build_hash_url( $v, $file_type ) ;
546
+ }
547
+
548
+ return $hashed_arr ;
549
+ }
550
+
551
+ /**
552
+ * Run minify with src queue list
553
+ *
554
+ * @since 1.2.2
555
+ * @access private
556
+ */
557
+ private function _src_queue_handler( $src_queue_list, $html_list, $file_type = 'css' )
558
+ {
559
+ $noscript = '' ;
560
+ $html_list_ori = $html_list ;
561
+
562
+ $tag = $file_type === 'css' ? 'link' : 'script' ;
563
+ foreach ( $src_queue_list as $key => $src ) {
564
+ $url = $this->_build_hash_url( $src, $file_type ) ;
565
+ $snippet = str_replace( $src, $url, $html_list[ $key ] ) ;
566
+ $snippet = str_replace( "<$tag ", "<$tag data-optimized='1' ", $snippet ) ;
567
+
568
+ $html_list[ $key ] = $snippet ;
569
+
570
+ // Add to HTTP2
571
+ $this->append_http2( $url, $file_type ) ;
572
+ }
573
+
574
+ // Handle css async load
575
+ if ( $file_type === 'css' && $this->cfg_css_async ) {
576
+ list( $noscript, $html_list ) = $this->_async_css_list( $html_list ) ;
577
+ $this->html_head .= '<noscript>' . $noscript . '</noscript>' ;
578
+ }
579
+
580
+ // Handle js defer
581
+ if ( $file_type === 'js' && $this->cfg_js_defer ) {
582
+ $html_list = $this->_js_defer( $html_list ) ;
583
+ }
584
+
585
+ $this->content = str_replace( $html_list_ori, $html_list, $this->content ) ;
586
+ }
587
+
588
+ /**
589
+ * Check that links are internal or external
590
+ *
591
+ * @since 1.2.2
592
+ * @access private
593
+ * @return array Array(Ignored raw html, src needed to be handled list, filesize for param 2nd )
594
+ */
595
+ private function _analyse_links( $src_list, $html_list, $file_type = 'css' )
596
+ {
597
+ if ( $file_type == 'css' ) {
598
+ $excludes = apply_filters( 'litespeed_cache_optimize_css_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CSS_EXCLUDES ) ) ;
599
+ }
600
+ else {
601
+ $excludes = apply_filters( 'litespeed_cache_optimize_js_excludes', LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_JS_EXCLUDES ) ) ;
602
+ }
603
+ if ( $excludes ) {
604
+ $excludes = explode( "\n", $excludes ) ;
605
+ }
606
+
607
+ $ignored_html = array() ;
608
+ $src_queue_list = array() ;
609
+ $file_size_list = array() ;
610
+
611
+ // Analyse links
612
+ foreach ( $src_list as $key => $src ) {
613
+ LiteSpeed_Cache_Log::debug2( 'Optm: ' . $src ) ;
614
+
615
+ if ( $excludes ) {
616
+ foreach ( $excludes as $exclude ) {
617
+ if ( stripos( $src, $exclude ) !== false ) {
618
+ $ignored_html[] = $html_list[ $key ] ;
619
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
620
+ continue 2 ;
621
+ }
622
+ }
623
+ }
624
+
625
+ // Check if has no-optimize attr
626
+ if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
627
+ $ignored_html[] = $html_list[ $key ] ;
628
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: attr data-no-optimize' ) ;
629
+ continue ;
630
+ }
631
+
632
+ // Check if is external URL
633
+ $url_parsed = parse_url( $src ) ;
634
+ if ( ! $file_info = $this->_is_file_url( $src ) ) {
635
+ $ignored_html[ $src ] = $html_list[ $key ] ;
636
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort external/non-exist' ) ;
637
+ continue ;
638
+ }
639
+
640
+ /**
641
+ * Check if exclude jQuery or not
642
+ * Exclude from minify/combine
643
+ * @since 1.5
644
+ */
645
+ if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
646
+ $ignored_html[ $src ] = $html_list[ $key ] ;
647
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort jQuery by setting' ) ;
648
+
649
+ // Add to HTTP2 as its ignored but still internal src
650
+ $this->append_http2( $src, 'js' ) ;
651
+
652
+ continue ;
653
+ }
654
+
655
+ $src_queue_list[ $key ] = $src ;
656
+ $file_size_list[ $key ] = $file_info[ 1 ] ;
657
+ }
658
+
659
+ return array( $ignored_html, $src_queue_list, $file_size_list ) ;
660
+ }
661
+
662
+ /**
663
+ * Check if an URL is a internal existing file
664
+ *
665
+ * @since 1.2.2
666
+ * @access private
667
+ * @return string|bool The real path of file OR false
668
+ */
669
+ private function _is_file_url( $url )
670
+ {
671
+ $url_parsed = parse_url( $url ) ;
672
+ if ( isset( $url_parsed[ 'host' ] ) && ! LiteSpeed_Cache_Utility::internal( $url_parsed[ 'host' ] ) ) {
673
+ // Check if is cdn path
674
+ if ( ! LiteSpeed_Cache_CDN::internal( $url_parsed[ 'host' ] ) ) {
675
+ return false ;
676
+ }
677
+ }
678
+
679
+ if ( empty( $url_parsed[ 'path' ] ) ) {
680
+ return false ;
681
+ }
682
+
683
+ // Need to replace child blog path for assets, ref: .htaccess
684
+ if ( is_multisite() && defined( 'PATH_CURRENT_SITE' ) ) {
685
+ $pattern = '#^' . PATH_CURRENT_SITE . '([_0-9a-zA-Z-]+/)(wp-(content|admin|includes))#U' ;
686
+ $replacement = PATH_CURRENT_SITE . '$2' ;
687
+ $url_parsed[ 'path' ] = preg_replace( $pattern, $replacement, $url_parsed[ 'path' ] ) ;
688
+ // $current_blog = (int) get_current_blog_id() ;
689
+ // $main_blog_id = (int) get_network()->site_id ;
690
+ // if ( $current_blog === $main_blog_id ) {
691
+ // define( 'LITESPEED_IS_MAIN_BLOG', true ) ;
692
+ // }
693
+ // else {
694
+ // define( 'LITESPEED_IS_MAIN_BLOG', false ) ;
695
+ // }
696
+ }
697
+
698
+ // Parse file path
699
+ if ( substr( $url_parsed[ 'path' ], 0, 1 ) === '/' ) {
700
+ $file_path = $_SERVER[ 'DOCUMENT_ROOT' ] . $url_parsed[ 'path' ] ;
701
+ }
702
+ else {
703
+ $file_path = LiteSpeed_Cache_Router::frontend_path() . '/' . $url_parsed[ 'path' ] ;
704
+ }
705
+ $file_path = realpath( $file_path ) ;
706
+ if ( ! is_file( $file_path ) ) {
707
+ return false ;
708
+ }
709
+
710
+ return array( $file_path, filesize( $file_path ) ) ;
711
+ }
712
+
713
+ /**
714
+ * Run minify process and return final content
715
+ *
716
+ * @since 1.2.2
717
+ * @access private
718
+ * @return string The final content
719
+ */
720
+ private function _minify( $filename )
721
+ {
722
+ // Search filename in db for src URLs
723
+ $urls = LiteSpeed_Cache_Data::optm_hash2src( $filename ) ;
724
+ if ( ! $urls || ! is_array( $urls ) ) {
725
+ return false;
726
+ }
727
+
728
+ $file_type = substr( $filename, strrpos( $filename, '.' ) + 1 ) ;
729
+
730
+ // Parse real file path
731
+ $real_files = array() ;
732
+ foreach ( $urls as $url ) {
733
+ $real_file = $this->_is_file_url( $url ) ;
734
+ if ( ! $real_file ) {
735
+ continue ;
736
+ }
737
+ $real_files[] = $real_file[ 0 ] ;
738
+ }
739
+
740
+ if ( ! $real_files ) {
741
+ return false;
742
+ }
743
+
744
+ // Request to minify
745
+ $result = $this->_minify_serve( $real_files, $file_type ) ;
746
+
747
+ if ( empty( $result[ 'success' ] ) ) {
748
+ LiteSpeed_Cache_Log::debug( 'Optm: Lib serve failed ' . $result[ 'statusCode' ] ) ;
749
+ return false ;
750
+ }
751
+
752
+ LiteSpeed_Cache_Log::debug( 'Optm: Generated content' ) ;
753
+
754
+ return $result ;
755
+ }
756
+
757
+ /**
758
+ * Generate full URL path with hash for a list of src
759
+ *
760
+ * @since 1.2.2
761
+ * @access private
762
+ * @return string The final URL
763
+ */
764
+ private function _build_hash_url( $src, $file_type = 'css' )
765
+ {
766
+ if ( ! $src ) {
767
+ return false ;
768
+ }
769
+
770
+ if ( ! is_array( $src ) ) {
771
+ $src = array( $src ) ;
772
+ }
773
+ $src = array_values( $src ) ;
774
+
775
+ $hash = md5( serialize( $src ) ) ;
776
+
777
+ $short = substr( $hash, -5 ) ;
778
+
779
+ $filename = $short ;
780
+
781
+ // Need to check conflicts
782
+ // If short hash exists
783
+ if ( $urls = LiteSpeed_Cache_Data::optm_hash2src( $short . '.' . $file_type ) ) {
784
+ // If conflicts
785
+ if ( $urls !== $src ) {
786
+ LiteSpeed_Cache_Data::optm_save_src( $hash . '.' . $file_type, $src ) ;
787
+ $filename = $hash ;
788
+ }
789
+ }
790
+ else {
791
+ // Short hash is safe now
792
+ LiteSpeed_Cache_Data::optm_save_src( $short . '.' . $file_type, $src ) ;
793
+ }
794
+
795
+ $file_to_save = self::DIR_MIN . '/' . $filename . '.' . $file_type ;
796
+
797
+ return LiteSpeed_Cache_Utility::get_permalink_url( $file_to_save ) ;
798
+ }
799
+
800
+ /**
801
+ * Parse js src
802
+ *
803
+ * @since 1.2.2
804
+ * @access private
805
+ * @return array All the src & related raw html list
806
+ */
807
+ private function _parse_js()
808
+ {
809
+ $src_list = array() ;
810
+ $html_list = array() ;
811
+ $head_src_list = array() ;
812
+
813
+ $content = preg_replace( '#<!--.*-->#sU', '', $this->content ) ;
814
+ preg_match_all( '#<script \s*([^>]+)>\s*</script>|</head>#isU', $content, $matches, PREG_SET_ORDER ) ;
815
+ $is_head = true ;
816
+ foreach ( $matches as $match ) {
817
+ if ( $match[ 0 ] === '</head>' ) {
818
+ $is_head = false ;
819
+ continue ;
820
+ }
821
+ $attrs = LiteSpeed_Cache_Utility::parse_attr( $match[ 1 ] ) ;
822
+
823
+ if ( ! empty( $attrs[ 'data-optimized' ] ) ) {
824
+ continue ;
825
+ }
826
+ if ( empty( $attrs[ 'src' ] ) ) {
827
+ continue ;
828
+ }
829
+
830
+ // to avoid multiple replacement
831
+ if ( in_array( $match[ 0 ], $html_list ) ) {
832
+ continue ;
833
+ }
834
+
835
+ $src_list[] = $attrs[ 'src' ] ;
836
+ $html_list[] = $match[ 0 ] ;
837
+
838
+ if ( $is_head ) {
839
+ $head_src_list[] = $attrs[ 'src' ] ;
840
+ }
841
+ }
842
+
843
+ return array( $src_list, $html_list, $head_src_list ) ;
844
+ }
845
+
846
+ /**
847
+ * Parse css src and remove to-be-removed css
848
+ *
849
+ * @since 1.2.2
850
+ * @access private
851
+ * @return array All the src & related raw html list
852
+ */
853
+ private function _handle_css()
854
+ {
855
+ $this->css_to_be_removed = apply_filters( 'litespeed_optm_css_to_be_removed', $this->css_to_be_removed ) ;
856
+
857
+ $src_list = array() ;
858
+ $html_list = array() ;
859
+
860
+ // $dom = new PHPHtmlParser\Dom ;
861
+ // $dom->load( $content ) ;return $val;
862
+ // $items = $dom->find( 'link' ) ;
863
+
864
+ $content = preg_replace( '#<!--.*-->#sU', '', $this->content ) ;
865
+ preg_match_all( '#<link \s*([^>]+)/?>#isU', $content, $matches, PREG_SET_ORDER ) ;
866
+ foreach ( $matches as $match ) {
867
+ $attrs = LiteSpeed_Cache_Utility::parse_attr( $match[ 1 ] ) ;
868
+
869
+ if ( empty( $attrs[ 'rel' ] ) || $attrs[ 'rel' ] !== 'stylesheet' ) {
870
+ continue ;
871
+ }
872
+ if ( ! empty( $attrs[ 'data-optimized' ] ) ) {
873
+ continue ;
874
+ }
875
+ if ( ! empty( $attrs[ 'data-no-optimize' ] ) ) {
876
+ continue ;
877
+ }
878
+ if ( ! empty( $attrs[ 'media' ] ) && strpos( $attrs[ 'media' ], 'print' ) !== false ) {
879
+ continue ;
880
+ }
881
+ if ( empty( $attrs[ 'href' ] ) ) {
882
+ continue ;
883
+ }
884
+
885
+ // Check if need to remove this css
886
+ if ( $this->css_to_be_removed && LiteSpeed_Cache_Utility::str_hit_array( $attrs[ 'href' ], $this->css_to_be_removed ) ) {
887
+ LiteSpeed_Cache_Log::debug( 'Optm: rm css snippet ' . $attrs[ 'href' ] ) ;
888
+ // Delete this css snippet from orig html
889
+ $this->content = str_replace( $match[ 0 ], '', $this->content ) ;
890
+ continue ;
891
+ }
892
+
893
+ // to avoid multiple replacement
894
+ if ( in_array( $match[ 0 ], $html_list ) ) {
895
+ continue ;
896
+ }
897
+
898
+ $src_list[] = $attrs[ 'href' ] ;
899
+ $html_list[] = $match[ 0 ] ;
900
+ }
901
+
902
+ return array( $src_list, $html_list ) ;
903
+ }
904
+
905
+ /**
906
+ * Replace css to async loaded css
907
+ *
908
+ * @since 1.3
909
+ * @access private
910
+ * @param array $html_list Orignal css array
911
+ * @return array array( (string)noscript, (array)css_async_list )
912
+ */
913
+ private function _async_css_list( $html_list )
914
+ {
915
+ $noscript = '' ;
916
+ foreach ( $html_list as $k => $ori ) {
917
+ if ( strpos( $ori, 'data-asynced' ) !== false ) {
918
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-asynced exist' ) ;
919
+ continue ;
920
+ }
921
+
922
+ if ( strpos( $ori, 'data-no-async' ) !== false ) {
923
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-async' ) ;
924
+ continue ;
925
+ }
926
+
927
+ // Append to noscript content
928
+ $noscript .= $ori ;
929
+ // async replacement
930
+ $v = str_replace( 'stylesheet', 'preload', $ori ) ;
931
+ $v = str_replace( '<link', "<link data-asynced='1' as='style' onload='this.rel=\"stylesheet\"' ", $v ) ;
932
+ $html_list[ $k ] = $v ;
933
+ }
934
+ return array( $noscript, $html_list ) ;
935
+ }
936
+
937
+ /**
938
+ * Add defer to js
939
+ *
940
+ * @since 1.3
941
+ * @access private
942
+ */
943
+ private function _js_defer( $html_list )
944
+ {
945
+ foreach ( $html_list as $k => $v ) {
946
+ if ( strpos( $v, 'async' ) !== false ) {
947
+ continue ;
948
+ }
949
+ if ( strpos( $v, 'defer' ) !== false ) {
950
+ continue ;
951
+ }
952
+ if ( strpos( $v, 'data-deferred' ) !== false ) {
953
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-deferred exist' ) ;
954
+ continue ;
955
+ }
956
+ if ( strpos( $v, 'data-no-defer' ) !== false ) {
957
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-defer' ) ;
958
+ continue ;
959
+ }
960
+
961
+ /**
962
+ * Parse src for excluding js from setting
963
+ * @since 1.5
964
+ */
965
+ if ( $this->cfg_js_defer_exc || $this->cfg_exc_jquery ) {
966
+ // parse js src
967
+ preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
968
+ if ( empty( $matches[ 1 ] ) ) {
969
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer parse html failed: ' . $v ) ;
970
+ continue ;
971
+ }
972
+
973
+ $attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
974
+
975
+ if ( empty( $attrs[ 'src' ] ) ) {
976
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer parse src failed: ' . $matches[ 1 ] ) ;
977
+ continue ;
978
+ }
979
+
980
+ $src = $attrs[ 'src' ] ;
981
+ }
982
+
983
+ /**
984
+ * Exclude js from setting
985
+ * @since 1.5
986
+ */
987
+ if ( $this->cfg_js_defer_exc ) {
988
+
989
+ if ( LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
990
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
991
+ continue ;
992
+ }
993
+ }
994
+
995
+ /**
996
+ * Check if exclude jQuery
997
+ * @since 1.5
998
+ */
999
+ if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
1000
+ LiteSpeed_Cache_Log::debug2( 'Optm: js defer Abort jQuery by setting' ) ;
1001
+ continue ;
1002
+ }
1003
+
1004
+ $html_list[ $k ] = str_replace( '></script>', ' defer data-deferred="1"></script>', $v ) ;
1005
+ }
1006
+
1007
+ return $html_list ;
1008
+ }
1009
+
1010
+ /**
1011
+ * Check if is jq lib
1012
+ *
1013
+ * @since 1.5
1014
+ * @access private
1015
+ */
1016
+ private function _is_jquery( $src )
1017
+ {
1018
+ return stripos( $src, 'jquery.js' ) !== false || stripos( $src, 'jquery.min.js' ) !== false ;
1019
+ }
1020
+
1021
+ /**
1022
+ * Append to HTTP2 header
1023
+ *
1024
+ * @since 1.2.2
1025
+ * @access private
1026
+ */
1027
+ private function append_http2( $url, $file_type = 'css' )
1028
+ {
1029
+ if ( ! ( $file_type === 'css' ? $this->cfg_http2_css : $this->cfg_http2_js ) ) {
1030
+ return ;
1031
+ }
1032
+
1033
+ $uri = LiteSpeed_Cache_Utility::url2uri( $url ) ;
1034
+
1035
+ if ( ! $uri ) {
1036
+ return ;
1037
+ }
1038
+
1039
+ $this->http2_headers[] = '<' . $uri . '>; rel=preload; as=' . ( $file_type === 'css' ? 'style' : 'script' ) ;
1040
+ }
1041
+
1042
+ /**
1043
+ * Run minify serve
1044
+ *
1045
+ * @since 1.2.2
1046
+ * @access private
1047
+ * @param array|string $files The file(s) to minify/combine
1048
+ * @return string The string after effect
1049
+ */
1050
+ private function _minify_serve( $files, $file_type )
1051
+ {
1052
+ set_error_handler( 'litespeed_exception_handler' ) ;
1053
+ try {
1054
+ litespeed_load_vendor() ;
1055
+ if ( ! isset( $this->minify_cache ) ) {
1056
+ $this->minify_cache = new Minify_Cache_File() ;
1057
+ }
1058
+ if ( ! isset( $this->minify_minify ) ) {
1059
+ $this->minify_minify = new Minify( $this->minify_cache ) ;
1060
+ }
1061
+ if ( ! isset( $this->minify_env ) ) {
1062
+ $this->minify_env = new Minify_Env() ;
1063
+ }
1064
+ if ( ! isset( $this->minify_sourceFactory ) ) {
1065
+ $this->minify_sourceFactory = new Minify_Source_Factory( $this->minify_env, array(), $this->minify_cache ) ;
1066
+ }
1067
+ if ( ! isset( $this->minify_controller ) ) {
1068
+ $this->minify_controller = new Minify_Controller_Files( $this->minify_env, $this->minify_sourceFactory ) ;
1069
+ }
1070
+ if ( ! isset( $this->minify_options ) ) {
1071
+ $this->minify_options = array(
1072
+ 'encodeOutput' => false,
1073
+ 'quiet' => true,
1074
+ ) ;
1075
+ }
1076
+
1077
+ $this->minify_options[ 'concatOnly' ] = ! ( $file_type === 'css' ? $this->cfg_css_minify : $this->cfg_js_minify ) ;
1078
+
1079
+ $this->minify_options[ 'files' ] = $files ;
1080
+
1081
+ $content = $this->minify_minify->serve( $this->minify_controller, $this->minify_options ) ;
1082
+
1083
+ } catch ( ErrorException $e ) {
1084
+ LiteSpeed_Cache_Control::debug( 'Error when serving from optimizer: ' . $e->getMessage() ) ;
1085
+ error_log( 'LiteSpeed Optimizer serving Error: ' . $e->getMessage() ) ;
1086
+ return false ;
1087
+ }
1088
+ restore_error_handler() ;
1089
+
1090
+ return $content ;
1091
+ }
1092
+
1093
+ /**
1094
+ * Get the current instance object.
1095
+ *
1096
+ * @since 1.2.2
1097
+ * @access public
1098
+ * @return Current class instance.
1099
+ */
1100
+ public static function get_instance()
1101
+ {
1102
+ if ( ! isset(self::$_instance) ) {
1103
+ self::$_instance = new self() ;
1104
+ }
1105
+
1106
+ return self::$_instance ;
1107
+ }
1108
+
1109
+ }
1110
+
1111
+
1112
+
inc/purge.class.php ADDED
@@ -0,0 +1,754 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin purge class for X-LiteSpeed-Purge
4
+ *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+ class LiteSpeed_Cache_Purge
12
+ {
13
+ private static $_instance ;
14
+ protected static $_pub_purge = array() ;
15
+ protected static $_priv_purge = array() ;
16
+ protected static $_purge_related = false ;
17
+ protected static $_purge_single = false ;
18
+
19
+ const X_HEADER = 'X-LiteSpeed-Purge' ;
20
+ const PURGE_QUEUE = 'litespeed-cache-purge-queue' ;
21
+
22
+ /**
23
+ * Adds new public purge tags to the array of purge tags for the request.
24
+ *
25
+ * @since 1.1.3
26
+ * @access public
27
+ * @param mixed $tags Tags to add to the list.
28
+ */
29
+ public static function add( $tags )
30
+ {
31
+ if ( ! is_array( $tags ) ) {
32
+ $tags = array( $tags ) ;
33
+ }
34
+ if ( ! array_diff( $tags, self::$_pub_purge ) ) {
35
+ return ;
36
+ }
37
+
38
+ self::$_pub_purge = array_merge( self::$_pub_purge, $tags ) ;
39
+
40
+ // Send purge header immediately
41
+ $curr_built = self::_build() ;
42
+ if ( defined( 'LITESPEED_DID_send_headers' ) ) {
43
+ // Can't send, already has output, need to save and wait for next run
44
+ update_option( self::PURGE_QUEUE, $curr_built ) ;
45
+ LiteSpeed_Cache_Log::debug( 'Output existed, Purge queue stored: ' . $curr_built ) ;
46
+ }
47
+ else {
48
+ @header( $curr_built ) ;
49
+ LiteSpeed_Cache_Log::debug( $curr_built ) ;
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Adds new private purge tags to the array of purge tags for the request.
55
+ *
56
+ * @since 1.1.3
57
+ * @access public
58
+ * @param mixed $tags Tags to add to the list.
59
+ */
60
+ public static function add_private( $tags )
61
+ {
62
+ if ( ! is_array( $tags ) ) {
63
+ $tags = array( $tags ) ;
64
+ }
65
+ if ( ! array_diff( $tags, self::$_priv_purge ) ) {
66
+ return ;
67
+ }
68
+
69
+ self::$_priv_purge = array_merge( self::$_priv_purge, $tags ) ;
70
+
71
+ // Send purge header immediately
72
+ @header( self::_build() ) ;
73
+ }
74
+
75
+ /**
76
+ * Activate `purge related tags` for Admin QS.
77
+ *
78
+ * @since 1.1.3
79
+ * @access public
80
+ */
81
+ public static function set_purge_related()
82
+ {
83
+ self::$_purge_related = true ;
84
+ }
85
+
86
+ /**
87
+ * Activate `purge single url tag` for Admin QS.
88
+ *
89
+ * @since 1.1.3
90
+ * @access public
91
+ */
92
+ public static function set_purge_single()
93
+ {
94
+ self::$_purge_single = true ;
95
+ }
96
+
97
+ /**
98
+ * Check qs purge status
99
+ *
100
+ * @since 1.1.3
101
+ * @access public
102
+ */
103
+ public static function get_qs_purge()
104
+ {
105
+ return self::$_purge_single || self::$_purge_related ;
106
+ }
107
+
108
+ /**
109
+ * Alerts LiteSpeed Web Server to purge all pages.
110
+ *
111
+ * For multisite installs, if this is called by a site admin (not network admin),
112
+ * it will only purge all posts associated with that site.
113
+ *
114
+ * @since 1.0.0
115
+ * @access public
116
+ */
117
+ public static function purge_all()
118
+ {
119
+ self::add( '*' ) ;
120
+
121
+ // check if need to reset crawler
122
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE ) ) {
123
+ LiteSpeed_Cache_Crawler::get_instance()->reset_pos() ;
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Alerts LiteSpeed Web Server to purge the front page.
129
+ *
130
+ * @since 1.0.3
131
+ * @access public
132
+ */
133
+ public static function purge_front()
134
+ {
135
+ self::add( LiteSpeed_Cache_Tag::TYPE_FRONTPAGE ) ;
136
+ if ( LITESPEED_SERVER_TYPE !== 'LITESPEED_SERVER_OLS' ) {
137
+ self::add_private( LiteSpeed_Cache_Tag::TYPE_FRONTPAGE ) ;
138
+ }
139
+ }
140
+
141
+ /**
142
+ * Alerts LiteSpeed Web Server to purge pages.
143
+ *
144
+ * @since 1.0.15
145
+ * @access public
146
+ */
147
+ public static function purge_pages()
148
+ {
149
+ self::add( LiteSpeed_Cache_Tag::TYPE_PAGES ) ;
150
+ }
151
+
152
+ /**
153
+ * Alerts LiteSpeed Web Server to purge pages.
154
+ *
155
+ * @since 1.2.2
156
+ * @access public
157
+ */
158
+ public static function purge_cssjs()
159
+ {
160
+ self::add( LiteSpeed_Cache_Tag::TYPE_MIN ) ;
161
+ }
162
+
163
+ /**
164
+ * Alerts LiteSpeed Web Server to purge error pages.
165
+ *
166
+ * @since 1.0.14
167
+ * @access public
168
+ */
169
+ public static function purge_errors()
170
+ {
171
+ self::add( LiteSpeed_Cache_Tag::TYPE_ERROR ) ;
172
+ if ( ! isset( $_GET[ 'lserr' ] ) || ! in_array( $_GET[ 'lserr' ], array( '403', '404', '500' ) ) ) {
173
+ return ;
174
+ }
175
+
176
+ self::add( LiteSpeed_Cache_Tag::TYPE_ERROR . $_GET[ 'lserr' ] ) ;
177
+ }
178
+
179
+ /**
180
+ * Callback to add purge tags if admin selects to purge selected category pages.
181
+ *
182
+ * @since 1.0.7
183
+ * @access public
184
+ * @param string $value The category slug.
185
+ * @param string $key Unused.
186
+ */
187
+ public function purgeby_cat_cb( $value, $key )
188
+ {
189
+ $val = trim( $value ) ;
190
+ if ( empty( $val ) ) {
191
+ return ;
192
+ }
193
+ if ( preg_match( '/^[a-zA-Z0-9-]+$/', $val ) == 0 ) {
194
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_CAT_INV ) ;
195
+ return ;
196
+ }
197
+ $cat = get_category_by_slug( $val ) ;
198
+ if ( $cat == false ) {
199
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_CAT_DNE, $val ) ;
200
+ return ;
201
+ }
202
+
203
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, sprintf( __( 'Purge category %s', 'litespeed-cache' ), $val ) ) ;
204
+
205
+ self::add( LiteSpeed_Cache_Tag::TYPE_ARCHIVE_TERM . $cat->term_id ) ;
206
+ }
207
+
208
+ /**
209
+ * Callback to add purge tags if admin selects to purge selected post IDs.
210
+ *
211
+ * @since 1.0.7
212
+ * @access public
213
+ * @param string $value The post ID.
214
+ * @param string $key Unused.
215
+ */
216
+ public function purgeby_pid_cb( $value, $key )
217
+ {
218
+ $val = trim( $value ) ;
219
+ if ( empty( $val ) ) {
220
+ return ;
221
+ }
222
+ if ( ! is_numeric( $val ) ) {
223
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_PID_NUM, $val ) ;
224
+ return ;
225
+ }
226
+ elseif ( get_post_status( $val ) !== 'publish' ) {
227
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_PID_DNE, $val ) ;
228
+ return ;
229
+ }
230
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, sprintf( __( 'Purge Post ID %s', 'litespeed-cache' ), $val ) ) ;
231
+
232
+ self::add( LiteSpeed_Cache_Tag::TYPE_POST . $val ) ;
233
+ }
234
+
235
+ /**
236
+ * Callback to add purge tags if admin selects to purge selected tag pages.
237
+ *
238
+ * @since 1.0.7
239
+ * @access public
240
+ * @param string $value The tag slug.
241
+ * @param string $key Unused.
242
+ */
243
+ public function purgeby_tag_cb( $value, $key )
244
+ {
245
+ $val = trim( $value ) ;
246
+ if ( empty( $val ) ) {
247
+ return ;
248
+ }
249
+ if ( preg_match( '/^[a-zA-Z0-9-]+$/', $val ) == 0 ) {
250
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_TAG_INV ) ;
251
+ return ;
252
+ }
253
+ $term = get_term_by( 'slug', $val, 'post_tag' ) ;
254
+ if ( $term == 0 ) {
255
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_TAG_DNE, $val ) ;
256
+ return ;
257
+ }
258
+
259
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, sprintf( __( 'Purge tag %s', 'litespeed-cache' ), $val ) ) ;
260
+
261
+ self::add( LiteSpeed_Cache_Tag::TYPE_ARCHIVE_TERM . $term->term_id ) ;
262
+ }
263
+
264
+ /**
265
+ * Callback to add purge tags if admin selects to purge selected urls.
266
+ *
267
+ * @since 1.0.7
268
+ * @access public
269
+ * @param string $value A url to purge.
270
+ * @param string $key Unused.
271
+ */
272
+ public function purgeby_url_cb( $value, $key = false )
273
+ {
274
+ $val = trim( $value ) ;
275
+ if ( empty( $val ) ) {
276
+ return ;
277
+ }
278
+
279
+ if ( strpos( $val, '<' ) !== false ) {
280
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_URL_BAD ) ;
281
+ return ;
282
+ }
283
+
284
+ $val = LiteSpeed_Cache_Utility::make_relative( $val ) ;
285
+
286
+ $hash = LiteSpeed_Cache_Tag::get_uri_tag( $val ) ;
287
+
288
+ if ( $hash === false ) {
289
+ LiteSpeed_Cache_Admin_Display::add_error( LiteSpeed_Cache_Admin_Error::E_PURGEBY_URL_INV, $val ) ;
290
+ return ;
291
+ }
292
+
293
+ LiteSpeed_Cache_Admin_Display::add_notice( LiteSpeed_Cache_Admin_Display::NOTICE_GREEN, sprintf( __( 'Purge url %s', 'litespeed-cache' ), $val ) ) ;
294
+
295
+ self::add( $hash ) ;
296
+ return ;
297
+ }
298
+
299
+ /**
300
+ * Purge a list of pages when selected by admin. This method will
301
+ * look at the post arguments to determine how and what to purge.
302
+ *
303
+ * @since 1.0.7
304
+ * @access public
305
+ */
306
+ public function purge_list()
307
+ {
308
+ if ( ! isset($_REQUEST[LiteSpeed_Cache_Admin_Display::PURGEBYOPT_SELECT]) || ! isset($_REQUEST[LiteSpeed_Cache_Admin_Display::PURGEBYOPT_LIST]) ) {
309
+ LiteSpeed_Cache_Admin_Display::add_error(LiteSpeed_Cache_Admin_Error::E_PURGE_FORM) ;
310
+ return ;
311
+ }
312
+ $sel = $_REQUEST[LiteSpeed_Cache_Admin_Display::PURGEBYOPT_SELECT] ;
313
+ $list_buf = $_REQUEST[LiteSpeed_Cache_Admin_Display::PURGEBYOPT_LIST] ;
314
+ if ( empty($list_buf) ) {
315
+ LiteSpeed_Cache_Admin_Display::add_error(LiteSpeed_Cache_Admin_Error::E_PURGEBY_EMPTY) ;
316
+ return ;
317
+ }
318
+ $list_buf = str_replace(",", "\n", $list_buf) ;// for cli
319
+ $list = explode("\n", $list_buf) ;
320
+ switch($sel) {
321
+ case LiteSpeed_Cache_Admin_Display::PURGEBY_CAT:
322
+ $cb = 'purgeby_cat_cb' ;
323
+ break ;
324
+ case LiteSpeed_Cache_Admin_Display::PURGEBY_PID:
325
+ $cb = 'purgeby_pid_cb' ;
326
+ break ;
327
+ case LiteSpeed_Cache_Admin_Display::PURGEBY_TAG:
328
+ $cb = 'purgeby_tag_cb' ;
329
+ break ;
330
+ case LiteSpeed_Cache_Admin_Display::PURGEBY_URL:
331
+ $cb = 'purgeby_url_cb' ;
332
+ break ;
333
+ default:
334
+ LiteSpeed_Cache_Admin_Display::add_error(LiteSpeed_Cache_Admin_Error::E_PURGEBY_BAD) ;
335
+ return ;
336
+ }
337
+ array_walk($list, Array($this, $cb)) ;
338
+
339
+ // for redirection
340
+ $_GET[LiteSpeed_Cache_Admin_Display::PURGEBYOPT_SELECT] = $sel ;
341
+ }
342
+
343
+ /**
344
+ * Purge frontend url
345
+ *
346
+ * @since 1.3
347
+ * @access public
348
+ */
349
+ public static function frontend_purge()
350
+ {
351
+ if ( empty( $_SERVER[ 'HTTP_REFERER' ] ) ) {
352
+ exit( 'no referer' ) ;
353
+ }
354
+ $instance = self::get_instance() ;
355
+
356
+ $instance->purgeby_url_cb( $_SERVER[ 'HTTP_REFERER' ] ) ;
357
+
358
+ wp_redirect( $_SERVER[ 'HTTP_REFERER' ] ) ;
359
+ exit() ;
360
+ }
361
+
362
+ /**
363
+ * Purge a post on update.
364
+ *
365
+ * This function will get the relevant purge tags to add to the response
366
+ * as well.
367
+ *
368
+ * @since 1.0.0
369
+ * @access public
370
+ * @param integer $id The post id to purge.
371
+ */
372
+ public static function purge_post( $id )
373
+ {
374
+ $post_id = intval($id) ;
375
+ // ignore the status we don't care
376
+ if ( ! in_array(get_post_status($post_id), array( 'publish', 'trash', 'private', 'draft' )) ) {
377
+ return ;
378
+ }
379
+
380
+ $purge_tags = self::get_purge_tags_by_post($post_id) ;
381
+ if ( empty($purge_tags) ) {
382
+ return ;
383
+ }
384
+ if ( in_array( '*', $purge_tags ) ) {
385
+ self::purge_all() ;
386
+ }
387
+ else {
388
+ self::add( $purge_tags ) ;
389
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_REST ) ) {
390
+ self::add( LiteSpeed_Cache_Tag::TYPE_REST ) ;
391
+ }
392
+ }
393
+ LiteSpeed_Cache_Control::set_stale() ;
394
+ }
395
+
396
+ /**
397
+ * Hooked to the load-widgets.php action.
398
+ * Attempts to purge a single widget from cache.
399
+ * If no widget id is passed in, the method will attempt to find the widget id.
400
+ *
401
+ * @since 1.1.3
402
+ * @access public
403
+ * @param type $widget_id The id of the widget to purge.
404
+ */
405
+ public static function purge_widget($widget_id = null)
406
+ {
407
+ if ( is_null($widget_id) ) {
408
+ $widget_id = $_POST['widget-id'] ;
409
+ if ( is_null($widget_id) ) {
410
+ return ;
411
+ }
412
+ }
413
+ self::add(LiteSpeed_Cache_Tag::TYPE_WIDGET . $widget_id) ;
414
+ self::add_private(LiteSpeed_Cache_Tag::TYPE_WIDGET . $widget_id) ;
415
+ }
416
+
417
+ /**
418
+ * Hooked to the wp_update_comment_count action.
419
+ * Purges the comment widget when the count is updated.
420
+ *
421
+ * @access public
422
+ * @since 1.1.3
423
+ * @global type $wp_widget_factory
424
+ */
425
+ public static function purge_comment_widget()
426
+ {
427
+ global $wp_widget_factory ;
428
+ $recent_comments = $wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ;
429
+ if ( !is_null($recent_comments) ) {
430
+ self::add(LiteSpeed_Cache_Tag::TYPE_WIDGET . $recent_comments->id) ;
431
+ self::add_private(LiteSpeed_Cache_Tag::TYPE_WIDGET . $recent_comments->id) ;
432
+ }
433
+ }
434
+
435
+ /**
436
+ * Purges feeds on comment count update.
437
+ *
438
+ * @since 1.0.9
439
+ * @access public
440
+ */
441
+ public static function purge_feeds()
442
+ {
443
+ if ( LiteSpeed_Cache::config(LiteSpeed_Cache_Config::OPID_FEED_TTL) > 0 ) {
444
+ self::add(LiteSpeed_Cache_Tag::TYPE_FEED) ;
445
+ }
446
+ }
447
+
448
+ /**
449
+ * Purges all private cache entries when the user logs out.
450
+ *
451
+ * @access public
452
+ * @since 1.1.3
453
+ */
454
+ public static function purge_on_logout()
455
+ {
456
+ self::add_private('*') ;
457
+ }
458
+
459
+ /**
460
+ * Generate all purge tags before output
461
+ *
462
+ * @access private
463
+ * @since 1.1.3
464
+ */
465
+ private static function _finalize()
466
+ {
467
+ // Make sure header output only run once
468
+ if ( ! defined( 'LITESPEED_DID_' . __FUNCTION__ ) ) {
469
+ define( 'LITESPEED_DID_' . __FUNCTION__, true ) ;
470
+ }
471
+ else {
472
+ return ;
473
+ }
474
+
475
+ do_action('litespeed_cache_api_purge') ;
476
+
477
+ // Append unique uri purge tags if Admin QS is `PURGESINGLE`
478
+ if ( self::$_purge_single ) {
479
+ self::$_pub_purge[] = LiteSpeed_Cache_Tag::build_uri_tag() ; // TODO: add private tag too
480
+ }
481
+ // Append related purge tags if Admin QS is `PURGE`
482
+ if ( self::$_purge_related ) {
483
+ // Before this, tags need to be finalized
484
+ $tags_related = LiteSpeed_Cache_Tag::output_tags() ;
485
+ // NOTE: need to remove the empty item `B1_` to avoid purging all
486
+ $tags_related = array_filter($tags_related) ;
487
+ if ( $tags_related ) {
488
+ self::$_pub_purge = array_merge(self::$_pub_purge, $tags_related) ;
489
+ }
490
+ }
491
+
492
+ if ( ! empty(self::$_pub_purge) ) {
493
+ self::$_pub_purge = array_unique(self::$_pub_purge) ;
494
+ }
495
+
496
+ if ( ! empty(self::$_priv_purge) ) {
497
+ self::$_priv_purge = array_unique(self::$_priv_purge) ;
498
+ }
499
+ }
500
+
501
+ /**
502
+ * Gathers all the purge headers.
503
+ *
504
+ * This will collect all site wide purge tags as well as third party plugin defined purge tags.
505
+ *
506
+ * @since 1.1.0
507
+ * @access public
508
+ * @return string the built purge header
509
+ */
510
+ public static function output()
511
+ {
512
+ self::_finalize() ;
513
+
514
+ return self::_build() ;
515
+ }
516
+
517
+ /**
518
+ * Build the current purge headers.
519
+ *
520
+ * @since 1.1.5
521
+ * @access private
522
+ * @return string the built purge header
523
+ */
524
+ private static function _build()
525
+ {
526
+ if ( empty( self::$_pub_purge ) && empty( self::$_priv_purge ) ) {
527
+ return ;
528
+ }
529
+
530
+ $purge_header = '' ;
531
+ $private_prefix = self::X_HEADER . ': private,' ;
532
+
533
+ if ( ! empty( self::$_pub_purge ) ) {
534
+ $public_tags = self::_append_prefix( self::$_pub_purge ) ;
535
+ if ( empty( $public_tags ) ) {
536
+ // If this ends up empty, private will also end up empty
537
+ return ;
538
+ }
539
+ $purge_header = self::X_HEADER . ': public,' ;
540
+ if ( LiteSpeed_Cache_Control::is_stale() ) {
541
+ $purge_header .= 'stale,' ;
542
+ }
543
+ $purge_header .= implode( ',', $public_tags ) ;
544
+ $private_prefix = ';private,' ;
545
+ }
546
+
547
+ // Handle priv purge tags
548
+ if ( ! empty( self::$_priv_purge ) ) {
549
+ $private_tags = self::_append_prefix( self::$_priv_purge, true ) ;
550
+ $purge_header .= $private_prefix . implode( ',', $private_tags ) ;
551
+ }
552
+
553
+ return $purge_header ;
554
+ }
555
+
556
+ /**
557
+ * Append prefix to an array of purge headers
558
+ *
559
+ * @since 1.1.0
560
+ * @access private
561
+ * @param array $purge_tags The purge tags to apply the prefix to.
562
+ * @param boolean $is_private If is private tags or not.
563
+ * @return array The array of built purge tags.
564
+ */
565
+ private static function _append_prefix( $purge_tags, $is_private = false )
566
+ {
567
+ $curr_bid = get_current_blog_id() ;
568
+
569
+ if ( ! in_array('*', $purge_tags) ) {
570
+ $tags = array() ;
571
+ foreach ($purge_tags as $val) {
572
+ $tags[] = LSWCP_TAG_PREFIX . $curr_bid . '_' . $val ;
573
+ }
574
+ return $tags ;
575
+ }
576
+
577
+ if ( defined('LSWCP_EMPTYCACHE') || $is_private ) {
578
+ return array('*') ;
579
+ }
580
+
581
+ // Would only use multisite and network admin except is_network_admin
582
+ // is false for ajax calls, which is used by wordpress updates v4.6+
583
+ if ( is_multisite() && (is_network_admin() || (
584
+ LiteSpeed_Cache_Router::is_ajax() && (check_ajax_referer('updates', false, false) || check_ajax_referer('litespeed-purgeall-network', false, false))
585
+ )) ) {
586
+ $blogs = LiteSpeed_Cache_Activation::get_network_ids() ;
587
+ if ( empty($blogs) ) {
588
+ LiteSpeed_Cache_Log::debug('build_purge_headers: blog list is empty') ;
589
+ return '' ;
590
+ }
591
+ $tags = array() ;
592
+ foreach ($blogs as $blog_id) {
593
+ $tags[] = LSWCP_TAG_PREFIX . $blog_id . '_' ;
594
+ }
595
+ return $tags ;
596
+ }
597
+ else {
598
+ return array(LSWCP_TAG_PREFIX . $curr_bid . '_') ;
599
+ }
600
+ }
601
+
602
+ /**
603
+ * Gets all the purge tags correlated with the post about to be purged.
604
+ *
605
+ * If the purge all pages configuration is set, all pages will be purged.
606
+ *
607
+ * This includes site wide post types (e.g. front page) as well as
608
+ * any third party plugin specific post tags.
609
+ *
610
+ * @since 1.0.0
611
+ * @access public
612
+ * @param integer $post_id The id of the post about to be purged.
613
+ * @return array The list of purge tags correlated with the post.
614
+ */
615
+ public static function get_purge_tags_by_post( $post_id )
616
+ {
617
+ // If this is a valid post we want to purge the post, the home page and any associated tags & cats
618
+ // If not, purge everything on the site.
619
+
620
+ $purge_tags = array() ;
621
+ $config = LiteSpeed_Cache_Config::get_instance() ;
622
+
623
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_ALL_PAGES) ) {
624
+ // ignore the rest if purge all
625
+ return array( '*' ) ;
626
+ }
627
+
628
+ // now do API hook action for post purge
629
+ do_action('litespeed_cache_api_purge_post', $post_id) ;
630
+
631
+ // post
632
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_POST . $post_id ;
633
+ $purge_tags[] = LiteSpeed_Cache_Tag::get_uri_tag(wp_make_link_relative(get_permalink($post_id))) ;
634
+
635
+ // for archive of categories|tags|custom tax
636
+ global $post ;
637
+ $post = get_post($post_id) ;
638
+ $post_type = $post->post_type ;
639
+
640
+ global $wp_widget_factory ;
641
+ $recent_posts = $wp_widget_factory->widgets['WP_Widget_Recent_Posts'] ;
642
+ if ( ! is_null($recent_posts) ) {
643
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_WIDGET . $recent_posts->id ;
644
+ }
645
+
646
+ // get adjacent posts id as related post tag
647
+ if( $post_type == 'post' ){
648
+ $prev_post = get_previous_post() ;
649
+ $next_post = get_next_post() ;
650
+ if( ! empty($prev_post->ID) ) {
651
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_POST . $prev_post->ID ;
652
+ LiteSpeed_Cache_Log::debug('--------purge_tags prev is: '.$prev_post->ID) ;
653
+ }
654
+ if( ! empty($next_post->ID) ) {
655
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_POST . $next_post->ID ;
656
+ LiteSpeed_Cache_Log::debug('--------purge_tags next is: '.$next_post->ID) ;
657
+ }
658
+ }
659
+
660
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_TERM) ) {
661
+ $taxonomies = get_object_taxonomies($post_type) ;
662
+ //LiteSpeed_Cache_Log::push('purge by post, check tax = ' . var_export($taxonomies, true)) ;
663
+ foreach ( $taxonomies as $tax ) {
664
+ $terms = get_the_terms($post_id, $tax) ;
665
+ if ( ! empty($terms) ) {
666
+ foreach ( $terms as $term ) {
667
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_TERM . $term->term_id ;
668
+ }
669
+ }
670
+ }
671
+ }
672
+
673
+ if ( $config->get_option(LiteSpeed_Cache_Config::OPID_FEED_TTL) > 0 ) {
674
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_FEED ;
675
+ }
676
+
677
+ // author, for author posts and feed list
678
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_AUTHOR) ) {
679
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_AUTHOR . get_post_field('post_author', $post_id) ;
680
+ }
681
+
682
+ // archive and feed of post type
683
+ // todo: check if type contains space
684
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_POST_TYPE) ) {
685
+ if ( get_post_type_archive_link($post_type) ) {
686
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_POSTTYPE . $post_type ;
687
+ }
688
+ }
689
+
690
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_FRONT_PAGE) ) {
691
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_FRONTPAGE ;
692
+ }
693
+
694
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_HOME_PAGE) ) {
695
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_HOME ;
696
+ }
697
+
698
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_PAGES) ) {
699
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_PAGES ;
700
+ }
701
+
702
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_PAGES_WITH_RECENT_POSTS) ) {
703
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_PAGES_WITH_RECENT_POSTS ;
704
+ }
705
+
706
+ // if configured to have archived by date
707
+ $date = $post->post_date ;
708
+ $date = strtotime($date) ;
709
+
710
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_DATE) ) {
711
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_DATE . date('Ymd', $date) ;
712
+ }
713
+
714
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_MONTH) ) {
715
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_DATE . date('Ym', $date) ;
716
+ }
717
+
718
+ if ( $config->purge_by_post(LiteSpeed_Cache_Config::PURGE_YEAR) ) {
719
+ $purge_tags[] = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_DATE . date('Y', $date) ;
720
+ }
721
+
722
+ return array_unique($purge_tags) ;
723
+ }
724
+
725
+ /**
726
+ * The dummy filter for purge all
727
+ *
728
+ * @since 1.1.5
729
+ * @access public
730
+ * @param string $val The filter value
731
+ * @return string The filter value
732
+ */
733
+ public static function filter_with_purge_all( $val )
734
+ {
735
+ self::purge_all() ;
736
+ return $val ;
737
+ }
738
+
739
+ /**
740
+ * Get the current instance object.
741
+ *
742
+ * @since 1.1.3
743
+ * @access public
744
+ * @return Current class instance.
745
+ */
746
+ public static function get_instance()
747
+ {
748
+ if ( ! isset(self::$_instance) ) {
749
+ self::$_instance = new self() ;
750
+ }
751
+
752
+ return self::$_instance ;
753
+ }
754
+ }
inc/router.class.php ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The core plugin router class.
5
+ *
6
+ * This generate the valid action.
7
+ *
8
+ * @since 1.1.0
9
+ * @since 1.5 Moved into /inc
10
+ * @package LiteSpeed_Cache
11
+ * @subpackage LiteSpeed_Cache/inc
12
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
13
+ */
14
+ class LiteSpeed_Cache_Router
15
+ {
16
+ private static $_instance ;
17
+ private static $_esi_enabled ;
18
+ private static $_is_ajax ;
19
+ private static $_is_logged_in ;
20
+ private static $_can_crawl ;
21
+ private static $_ip ;
22
+ private static $_action ;
23
+ private static $_is_admin_ip ;
24
+ private static $_has_whm_msg ;
25
+ private static $_has_msg_ruleconflict ;
26
+ private static $_frontend_path ;
27
+
28
+ /**
29
+ * Get frontend path
30
+ *
31
+ * @since 1.2.2
32
+ * @access public
33
+ * @return boolean
34
+ */
35
+ public static function frontend_path()
36
+ {
37
+ if ( ! isset( self::$_frontend_path ) ) {
38
+ $frontend = rtrim( ABSPATH, '/' ) ; // /home/user/public_html/frontend
39
+ // get home path failed. Trac ticket #37668 (e.g. frontend:/blog backend:/wordpress)
40
+ if ( ! $frontend ) {
41
+ $frontend = parse_url( get_option( 'home' ) ) ;
42
+ $frontend = ! empty( $frontend[ 'path' ] ) ? $frontend[ 'path' ] : '' ;
43
+ $frontend = $_SERVER[ 'DOCUMENT_ROOT' ] . $frontend ;
44
+ }
45
+ $frontend = realpath( $frontend ) ;
46
+
47
+ self::$_frontend_path = $frontend ;
48
+ }
49
+ return self::$_frontend_path ;
50
+ }
51
+
52
+ /**
53
+ * Check if ESI is enabled or not
54
+ *
55
+ * @since 1.2.0
56
+ * @access public
57
+ * @return boolean
58
+ */
59
+ public static function esi_enabled()
60
+ {
61
+ if ( ! isset( self::$_esi_enabled ) ) {
62
+ self::$_esi_enabled = LSWCP_ESI_SUPPORT && defined( 'LITESPEED_ON' ) && LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ESI_ENABLE ) ;
63
+ }
64
+ return self::$_esi_enabled ;
65
+ }
66
+
67
+ /**
68
+ * Check if has rule conflict notice
69
+ *
70
+ * @since 1.1.5
71
+ * @access public
72
+ * @return boolean
73
+ */
74
+ public static function has_msg_ruleconflict()
75
+ {
76
+ if ( ! isset( self::$_has_msg_ruleconflict ) ) {
77
+ self::$_has_msg_ruleconflict = get_option( LiteSpeed_Cache_Admin_Display::DISMISS_MSG ) == LiteSpeed_Cache_Admin_Display::RULECONFLICT_ON ;
78
+ }
79
+ return self::$_has_msg_ruleconflict ;
80
+ }
81
+
82
+ /**
83
+ * Check if has whm notice
84
+ *
85
+ * @since 1.1.1
86
+ * @access public
87
+ * @return boolean
88
+ */
89
+ public static function has_whm_msg()
90
+ {
91
+ if ( ! isset( self::$_has_whm_msg ) ) {
92
+ self::$_has_whm_msg = get_transient( LiteSpeed_Cache::WHM_TRANSIENT ) == LiteSpeed_Cache::WHM_TRANSIENT_VAL ;
93
+ }
94
+ return self::$_has_whm_msg ;
95
+ }
96
+
97
+ /**
98
+ * Check if has promotion notice
99
+ *
100
+ * @since 1.3.2
101
+ * @access public
102
+ * @return boolean
103
+ */
104
+ public static function has_promo_msg()
105
+ {
106
+ $promo = get_option( 'litespeed-banner-promo' ) ;
107
+ if ( ! $promo ) {
108
+ update_option( 'litespeed-banner-promo', time() - 86400 * 8 ) ;
109
+ return false ;
110
+ }
111
+ if ( $promo == 'done' ) {
112
+ return false ;
113
+ }
114
+ if ( $promo && time() - $promo < 864000 ) {
115
+ return false ;
116
+ }
117
+ return true ;
118
+ }
119
+
120
+ /**
121
+ * update promotion notice
122
+ *
123
+ * @since 1.3.2
124
+ * @access public
125
+ * @return boolean
126
+ */
127
+ public static function dismiss_promo_msg()
128
+ {
129
+ update_option( 'litespeed-banner-promo', ! empty( $_GET[ 'done' ] ) ? 'done' : time() ) ;
130
+ }
131
+
132
+ /**
133
+ * Check if crawler is enabled on server level
134
+ *
135
+ * @since 1.1.1
136
+ * @access public
137
+ * @return boolean
138
+ */
139
+ public static function can_crawl()
140
+ {
141
+ if ( ! isset( self::$_can_crawl ) ) {
142
+ self::$_can_crawl = false ;
143
+ if ( isset( $_SERVER['X-LSCACHE'] ) && strpos( $_SERVER['X-LSCACHE'], 'crawler' ) !== false ) {
144
+ self::$_can_crawl = true ;
145
+ }
146
+ // CLI will bypass this check as crawler library can always do the 428 check
147
+ if ( defined( 'LITESPEED_CLI' ) ) {
148
+ self::$_can_crawl = true ;
149
+ }
150
+ }
151
+ return self::$_can_crawl ;
152
+ }
153
+
154
+ /**
155
+ * Check action
156
+ *
157
+ * @since 1.1.0
158
+ * @access public
159
+ * @return string
160
+ */
161
+ public static function get_action()
162
+ {
163
+ if ( ! isset( self::$_action ) ) {
164
+ self::$_action = false;
165
+ self::get_instance()->verify_action() ;
166
+ if ( self::$_action && LiteSpeed_Cache_Log::get_enabled() ) {
167
+ LiteSpeed_Cache_Log::push( 'LSCWP_CTRL verified: ' . var_export( self::$_action, true ) ) ;
168
+ }
169
+
170
+ }
171
+ return self::$_action ;
172
+ }
173
+
174
+ /**
175
+ * Check if is logged in
176
+ *
177
+ * @since 1.1.3
178
+ * @access public
179
+ * @return boolean
180
+ */
181
+ public static function is_logged_in()
182
+ {
183
+ if ( ! isset( self::$_is_logged_in ) ) {
184
+ self::$_is_logged_in = is_user_logged_in() ;
185
+ }
186
+ return self::$_is_logged_in ;
187
+ }
188
+
189
+ /**
190
+ * Check if is ajax call
191
+ *
192
+ * @since 1.1.0
193
+ * @access public
194
+ * @return boolean
195
+ */
196
+ public static function is_ajax()
197
+ {
198
+ if ( ! isset( self::$_is_ajax ) ) {
199
+ self::$_is_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX ;
200
+ }
201
+ return self::$_is_ajax ;
202
+ }
203
+
204
+ /**
205
+ * Check if is admin ip
206
+ *
207
+ * @since 1.1.0
208
+ * @access public
209
+ * @return boolean
210
+ */
211
+ public static function is_admin_ip()
212
+ {
213
+ if ( ! isset( self::$_is_admin_ip ) ) {
214
+ $ips = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_ADMIN_IPS ) ;
215
+
216
+ self::$_is_admin_ip = self::get_instance()->ip_access( $ips ) ;
217
+ }
218
+ return self::$_is_admin_ip ;
219
+ }
220
+
221
+ /**
222
+ * Check privilege and nonce for the action
223
+ *
224
+ * @since 1.1.0
225
+ * @access private
226
+ */
227
+ private function verify_action()
228
+ {
229
+ if( empty( $_REQUEST[LiteSpeed_Cache::ACTION_KEY] ) ) {
230
+ return ;
231
+ }
232
+
233
+ $action = $_REQUEST[LiteSpeed_Cache::ACTION_KEY] ;
234
+ $_is_public_action = false ;
235
+
236
+ // Each action must have a valid nonce unless its from admin ip and is public action
237
+ // Validate requests nonce (from admin logged in page or cli)
238
+ if ( ! $this->verify_nonce( $action ) && ! $this->_verify_sapi_token( $action ) ) {
239
+ // check if it is from admin ip
240
+ if ( ! $this->is_admin_ip() ) {
241
+ LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL query string - did not match admin IP: ' . $action ) ;
242
+ return ;
243
+ }
244
+
245
+ // check if it is public action
246
+ if ( ! in_array( $action, array(
247
+ LiteSpeed_Cache::ACTION_QS_NOCACHE,
248
+ LiteSpeed_Cache::ACTION_QS_PURGE,
249
+ LiteSpeed_Cache::ACTION_QS_PURGE_SINGLE,
250
+ LiteSpeed_Cache::ACTION_QS_SHOW_HEADERS,
251
+ LiteSpeed_Cache::ACTION_QS_PURGE_ALL,
252
+ LiteSpeed_Cache::ACTION_QS_PURGE_EMPTYCACHE,
253
+ ) ) ) {
254
+ LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL query string - did not match admin IP Actions: ' . $action ) ;
255
+ return ;
256
+ }
257
+
258
+ $_is_public_action = true ;
259
+ }
260
+
261
+ /* Now it is a valid action, lets log and check the permission */
262
+ LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL: ' . $action ) ;
263
+
264
+ // OK, as we want to do something magic, lets check if its allowed
265
+ $_is_multisite = is_multisite() ;
266
+ $_is_network_admin = $_is_multisite && is_network_admin() ;
267
+ $_can_network_option = $_is_network_admin && current_user_can( 'manage_network_options' ) ;
268
+ $_can_option = current_user_can( 'manage_options' ) ;
269
+
270
+ switch ( $action ) {
271
+ // Save htaccess
272
+ case LiteSpeed_Cache::ACTION_SAVE_HTACCESS:
273
+ if ( ( ! $_is_multisite && $_can_option ) || $_can_network_option ) {
274
+ self::$_action = $action ;
275
+ }
276
+ return ;
277
+
278
+ // Save network settings
279
+ case LiteSpeed_Cache::ACTION_SAVE_SETTINGS_NETWORK:
280
+ if ( $_can_network_option ) {
281
+ self::$_action = $action ;
282
+ }
283
+ return ;
284
+
285
+ case LiteSpeed_Cache::ACTION_PURGE_FRONT:
286
+ case LiteSpeed_Cache::ACTION_PURGE_PAGES:
287
+ case LiteSpeed_Cache::ACTION_PURGE_CSSJS:
288
+ case LiteSpeed_Cache::ACTION_PURGE_ERRORS:
289
+ case LiteSpeed_Cache::ACTION_PURGE_ALL:
290
+ case LiteSpeed_Cache::ACTION_PURGE_BY:
291
+ case LiteSpeed_Cache::ACTION_FRONT_PURGE:
292
+ case LiteSpeed_Cache::ACTION_FRONT_EXCLUDE:
293
+ if ( defined( 'LITESPEED_ON' ) && ( $_can_network_option || $_can_option || self::is_ajax() ) ) {//here may need more security
294
+ self::$_action = $action ;
295
+ }
296
+ return ;
297
+
298
+ case LiteSpeed_Cache::ACTION_DB_OPTIMIZE:
299
+ if ( defined( 'LITESPEED_ON' ) && ( $_can_network_option || $_can_option ) ) {
300
+ self::$_action = $action ;
301
+ }
302
+ return ;
303
+
304
+ case LiteSpeed_Cache::ACTION_PURGE_EMPTYCACHE:
305
+ if ( defined( 'LITESPEED_ON' ) && ( $_can_network_option || ( ! $_is_multisite && $_can_option ) ) ) {
306
+ self::$_action = $action ;
307
+ }
308
+ return ;
309
+
310
+ case LiteSpeed_Cache::ACTION_QS_NOCACHE:
311
+ case LiteSpeed_Cache::ACTION_QS_PURGE:
312
+ case LiteSpeed_Cache::ACTION_QS_PURGE_SINGLE:
313
+ case LiteSpeed_Cache::ACTION_QS_SHOW_HEADERS:
314
+ case LiteSpeed_Cache::ACTION_QS_PURGE_ALL:
315
+ case LiteSpeed_Cache::ACTION_QS_PURGE_EMPTYCACHE:
316
+ if ( defined( 'LITESPEED_ON' ) && ( $_is_public_action || self::is_ajax() ) ) {
317
+ self::$_action = $action ;
318
+ }
319
+ return ;
320
+
321
+ case LiteSpeed_Cache::ACTION_CRAWLER_GENERATE_FILE:
322
+ case LiteSpeed_Cache::ACTION_CRAWLER_RESET_POS:
323
+ case LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE:
324
+ case LiteSpeed_Cache::ACTION_DO_CRAWL:
325
+ case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
326
+ case LiteSpeed_Cache::ACTION_SAPI_PROCEED:
327
+ if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
328
+ self::$_action = $action ;
329
+ }
330
+ return ;
331
+
332
+ case LiteSpeed_Cache::ACTION_SAPI_CALLBACK : // as long as it passed nonce check
333
+ self::$_action = $action ;
334
+ return ;
335
+
336
+ case LiteSpeed_Cache::ACTION_DISMISS_WHM:
337
+ case LiteSpeed_Cache::ACTION_DISMISS_EXPIRESDEFAULT:
338
+ case LiteSpeed_Cache::ACTION_DISMISS_PROMO:
339
+ if ( self::is_ajax() ) {
340
+ self::$_action = $action ;
341
+ }
342
+ return ;
343
+
344
+ default:
345
+ LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL match falied: ' . $action ) ;
346
+ return ;
347
+ }
348
+
349
+ }
350
+
351
+ /**
352
+ * Verify sapi token
353
+ *
354
+ * @since 1.5
355
+ * @access private
356
+ * @param string $action
357
+ * @return bool
358
+ */
359
+ private function _verify_sapi_token( $action )
360
+ {
361
+ return LiteSpeed_Cache_Admin_API::sapi_token_check() && $action === LiteSpeed_Cache::ACTION_SAPI_CALLBACK ;
362
+ }
363
+
364
+ /**
365
+ * Verify nonce
366
+ *
367
+ * @since 1.1.0
368
+ * @access private
369
+ * @param string $action
370
+ * @return bool
371
+ */
372
+ private function verify_nonce( $action )
373
+ {
374
+ if ( ! isset( $_REQUEST[LiteSpeed_Cache::NONCE_NAME] ) || ! wp_verify_nonce( $_REQUEST[LiteSpeed_Cache::NONCE_NAME], $action ) ) {
375
+ return false ;
376
+ }
377
+ else{
378
+ return true ;
379
+ }
380
+ }
381
+
382
+ /**
383
+ * Check if the ip is in the range
384
+ *
385
+ * @since 1.1.0
386
+ * @access private
387
+ * @param string $ip_list IP list
388
+ * @return bool
389
+ */
390
+ private function ip_access( $ip_list )
391
+ {
392
+ if ( ! $ip_list ) {
393
+ return false ;
394
+ }
395
+ if ( ! isset( self::$_ip ) ) {
396
+ self::$_ip = $this->get_ip() ;
397
+ }
398
+ // $uip = explode('.', $_ip) ;
399
+ // if(empty($uip) || count($uip) != 4) Return false ;
400
+ if ( ! is_array( $ip_list ) ) {
401
+ $ip_list = explode( "\n", $ip_list ) ;
402
+ }
403
+ // foreach($ip_list as $key => $ip) $ip_list[$key] = explode('.', trim($ip)) ;
404
+ // foreach($ip_list as $key => $ip) {
405
+ // if(count($ip) != 4) continue ;
406
+ // for($i = 0 ; $i <= 3 ; $i++) if($ip[$i] == '*') $ip_list[$key][$i] = $uip[$i] ;
407
+ // }
408
+ return in_array( self::$_ip, $ip_list ) ;
409
+ }
410
+
411
+ /**
412
+ * Get client ip
413
+ *
414
+ * @since 1.1.0
415
+ * @access private
416
+ * @return string
417
+ */
418
+ private function get_ip()
419
+ {
420
+ $_ip = '' ;
421
+ if ( function_exists( 'apache_request_headers' ) ) {
422
+ $apache_headers = apache_request_headers() ;
423
+ $_ip = ! empty( $apache_headers['True-Client-IP'] ) ? $apache_headers['True-Client-IP'] : false ;
424
+ if ( ! $_ip ) {
425
+ $_ip = ! empty( $apache_headers['X-Forwarded-For'] ) ? $apache_headers['X-Forwarded-For'] : false ;
426
+ $_ip = explode( ", ", $_ip ) ;
427
+ $_ip = array_shift( $_ip ) ;
428
+ }
429
+
430
+ if ( ! $_ip ) {
431
+ $_ip = ! empty( $_SERVER['REMOTE_ADDR'] ) ? $_SERVER['REMOTE_ADDR'] : false ;
432
+ }
433
+ }
434
+ return $_ip ;
435
+ }
436
+
437
+ /**
438
+ * Get the current instance object.
439
+ *
440
+ * @since 1.1.0
441
+ * @access public
442
+ * @return Current class instance.
443
+ */
444
+ public static function get_instance()
445
+ {
446
+ if ( ! isset( self::$_instance ) ) {
447
+ self::$_instance = new self() ;
448
+ }
449
+
450
+ return self::$_instance ;
451
+ }
452
+ }
inc/tag.class.php ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin cache-tag class for X-LiteSpeed-Tag
4
+ *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+ class LiteSpeed_Cache_Tag
12
+ {
13
+ // private static $_instance ;
14
+
15
+ const TYPE_FEED = 'FD' ;
16
+ const TYPE_FRONTPAGE = 'F' ;
17
+ const TYPE_HOME = 'H' ;
18
+ const TYPE_PAGES = 'PGS' ;
19
+ const TYPE_PAGES_WITH_RECENT_POSTS = 'PGSRP' ;
20
+ const TYPE_ERROR = 'ERR.' ;
21
+ const TYPE_POST = 'Po.' ; // Post. Cannot use P, reserved for litemage.
22
+ const TYPE_ARCHIVE_POSTTYPE = 'PT.' ;
23
+ const TYPE_ARCHIVE_TERM = 'T.' ; //for is_category|is_tag|is_tax
24
+ const TYPE_AUTHOR = 'A.' ;
25
+ const TYPE_ARCHIVE_DATE = 'D.' ;
26
+ const TYPE_BLOG = 'B.' ;
27
+ const TYPE_LOGIN = 'L' ;
28
+ const TYPE_URL = 'URL.' ;
29
+ const TYPE_WIDGET = 'W.' ;
30
+ const TYPE_ESI = 'ESI.' ;
31
+ const TYPE_REST = 'REST' ;
32
+ const TYPE_LIST = 'LIST' ;
33
+ const TYPE_MIN = 'MIN' ;
34
+
35
+ const X_HEADER = 'X-LiteSpeed-Tag' ;
36
+
37
+ private static $_tags = array() ;
38
+ private static $_tags_priv = array( 'tag_priv' ) ;
39
+ protected static $_error_status = false ;
40
+
41
+ /**
42
+ * Check if the login page is cacheable.
43
+ * If not, unset the cacheable member variable.
44
+ *
45
+ * NOTE: This is checked separately because login page doesn't go through WP logic.
46
+ *
47
+ * @since 1.0.0
48
+ * @access public
49
+ */
50
+ public static function check_login_cacheable()
51
+ {
52
+ if ( ! LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_PAGE_LOGIN ) ) {
53
+ return ;
54
+ }
55
+ if ( LiteSpeed_Cache_Control::isset_notcacheable() ) {
56
+ return ;
57
+ }
58
+
59
+ if ( ! empty( $_GET ) ) {
60
+ LiteSpeed_Cache_Control::set_nocache( 'has GET request' ) ;
61
+ return ;
62
+ }
63
+
64
+ LiteSpeed_Cache_Control::set_cacheable() ;
65
+
66
+ self::add( self::TYPE_LOGIN ) ;
67
+
68
+ // we need to send lsc-cookie manually to make it be sent to all other users when is cacheable
69
+ $list = headers_list() ;
70
+ if ( empty( $list ) ) {
71
+ return ;
72
+ }
73
+ foreach ( $list as $hdr ) {
74
+ if ( strncasecmp( $hdr, 'set-cookie:', 11 ) == 0 ) {
75
+ $cookie = substr( $hdr, 12 ) ;
76
+ @header( 'lsc-cookie: ' . $cookie, false ) ;
77
+ }
78
+ }
79
+ }
80
+
81
+ /**
82
+ * Check if the page returns 403 and 500 errors.
83
+ *
84
+ * @since 1.0.13.1
85
+ * @access public
86
+ * @param $header
87
+ * @param $code
88
+ * @return $eror_status
89
+ */
90
+ public static function check_error_codes( $header, $code )
91
+ {
92
+ $ttl_403 = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_403_TTL ) ;
93
+ $ttl_500 = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_500_TTL ) ;
94
+ if ( $code == 403 ) {
95
+ if ( $ttl_403 <= 30 && LiteSpeed_Cache_Control::is_cacheable() ) {
96
+ LiteSpeed_Cache_Control::set_nocache( '403 TTL is less than 30s' ) ;
97
+ }
98
+ else {
99
+ self::$_error_status = $code ;
100
+ }
101
+ }
102
+ elseif ( $code >= 500 && $code < 600 ) {
103
+ if ( $ttl_500 <= 30 && LiteSpeed_Cache_Control::is_cacheable() ) {
104
+ LiteSpeed_Cache_Control::set_nocache( 'TTL is less than 30s' ) ;
105
+ }
106
+ }
107
+ elseif ( $code > 400 ) {
108
+ self::$_error_status = $code ;
109
+ }
110
+ return self::$_error_status ;
111
+ }
112
+
113
+ /**
114
+ * Get error code.
115
+ *
116
+ * @since 1.1.3
117
+ * @access public
118
+ */
119
+ public static function get_error_code()
120
+ {
121
+ return self::$_error_status ;
122
+ }
123
+
124
+ /**
125
+ * Register purge tag for pages with recent posts widget
126
+ * of the plugin.
127
+ *
128
+ * @since 1.0.15
129
+ * @access public
130
+ * @param array $params [wordpress params for widget_posts_args]
131
+ */
132
+ public static function add_widget_recent_posts( $params )
133
+ {
134
+ self::add( self::TYPE_PAGES_WITH_RECENT_POSTS ) ;
135
+ return $params ;
136
+ }
137
+
138
+ /**
139
+ * Adds cache tags to the list of cache tags for the current page.
140
+ *
141
+ * @since 1.0.5
142
+ * @access public
143
+ * @param mixed $tags A string or array of cache tags to add to the current list.
144
+ */
145
+ public static function add( $tags )
146
+ {
147
+ if ( ! is_array( $tags ) ) {
148
+ $tags = array( $tags ) ;
149
+ }
150
+
151
+ self::$_tags = array_merge( self::$_tags, $tags ) ;
152
+ }
153
+
154
+ /**
155
+ * Return tags for Admin QS
156
+ *
157
+ * @since 1.1.3
158
+ * @access public
159
+ */
160
+ public static function output_tags()
161
+ {
162
+ return self::$_tags ;
163
+ }
164
+
165
+ /**
166
+ * Will get a hash of the URI. Removes query string and appends a '/' if it is missing.
167
+ *
168
+ * @since 1.0.12
169
+ * @access public
170
+ * @param string $uri The uri to get the hash of.
171
+ * @param boolean $ori Return the original url or not
172
+ * @return bool|string False on input error, hash otherwise.
173
+ */
174
+ public static function get_uri_tag( $uri, $ori = false )
175
+ {
176
+ $no_qs = strtok( $uri, '?' ) ;
177
+ if ( empty( $no_qs ) ) {
178
+ return false ;
179
+ }
180
+ $slashed = trailingslashit( $no_qs ) ;
181
+
182
+ // If only needs uri tag
183
+ if ( $ori ) {
184
+ return $slashed ;
185
+ }
186
+ // return self::TYPE_URL . ( $slashed ) ;
187
+ return self::TYPE_URL . md5( $slashed ) ;
188
+ }
189
+
190
+ /**
191
+ * Get the unique tag based on self url.
192
+ *
193
+ * @since 1.1.3
194
+ * @access public
195
+ * @param boolean $ori Return the original url or not
196
+ */
197
+ public static function build_uri_tag( $ori = false )
198
+ {
199
+ return self::get_uri_tag( urldecode( $_SERVER['REQUEST_URI'] ), $ori ) ;
200
+ }
201
+
202
+ /**
203
+ * Gets the cache tags to set for the page.
204
+ *
205
+ * This includes site wide post types (e.g. front page) as well as
206
+ * any third party plugin specific cache tags.
207
+ *
208
+ * @since 1.0.0
209
+ * @access private
210
+ * @return array The list of cache tags to set.
211
+ */
212
+ private static function _build_type_tags()
213
+ {
214
+ $tags = array() ;
215
+
216
+ $tags[] = self::build_uri_tag() ;
217
+
218
+ if ( is_front_page() ) {
219
+ $tags[] = self::TYPE_FRONTPAGE ;
220
+ }
221
+ elseif ( is_home() ) {
222
+ $tags[] = self::TYPE_HOME ;
223
+ }
224
+
225
+ $err = self::get_error_code() ;
226
+ if ( $err !== false ) {
227
+ $tags[] = self::TYPE_ERROR . $err ;
228
+ }
229
+
230
+ $queried_obj_id = get_queried_object_id() ;
231
+ if ( is_archive() ) {
232
+ //An Archive is a Category, Tag, Author, Date, Custom Post Type or Custom Taxonomy based pages.
233
+ if ( is_category() || is_tag() || is_tax() ) {
234
+ $tags[] = self::TYPE_ARCHIVE_TERM . $queried_obj_id ;
235
+ }
236
+ elseif ( is_post_type_archive() ) {
237
+ global $wp_query ;
238
+ $post_type = $wp_query->get( 'post_type' ) ;
239
+ $tags[] = self::TYPE_ARCHIVE_POSTTYPE . $post_type ;
240
+ }
241
+ elseif ( is_author() ) {
242
+ $tags[] = self::TYPE_AUTHOR . $queried_obj_id ;
243
+ }
244
+ elseif ( is_date() ) {
245
+ global $post ;
246
+ $date = $post->post_date ;
247
+ $date = strtotime( $date ) ;
248
+ if ( is_day() ) {
249
+ $tags[] = self::TYPE_ARCHIVE_DATE . date( 'Ymd', $date ) ;
250
+ }
251
+ elseif ( is_month() ) {
252
+ $tags[] = self::TYPE_ARCHIVE_DATE . date( 'Ym', $date ) ;
253
+ }
254
+ elseif ( is_year() ) {
255
+ $tags[] = self::TYPE_ARCHIVE_DATE . date( 'Y', $date ) ;
256
+ }
257
+ }
258
+ }
259
+ elseif ( is_singular() ) {
260
+ //$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
261
+ $tags[] = self::TYPE_POST . $queried_obj_id ;
262
+
263
+ if ( is_page() ) {
264
+ $tags[] = self::TYPE_PAGES ;
265
+ }
266
+ }
267
+ elseif ( is_feed() ) {
268
+ $tags[] = self::TYPE_FEED ;
269
+ }
270
+
271
+ // Check REST API
272
+ if ( defined( 'REST_REQUEST' ) ) {
273
+ $tags[] = self::TYPE_REST ;
274
+
275
+ $path = ! empty( $_SERVER[ 'SCRIPT_URL' ] ) ? $_SERVER[ 'SCRIPT_URL' ] : false ;
276
+ if ( $path ) {
277
+ // posts collections tag
278
+ if ( substr( $path, -6 ) == '/posts' ) {
279
+ $tags[] = self::TYPE_LIST ;// Not used for purge yet
280
+ }
281
+
282
+ // single post tag
283
+ global $post;
284
+ if ( ! empty( $post->ID ) && substr( $path, - strlen( $post->ID ) - 1 ) === '/' . $post->ID ) {
285
+ $tags[] = self::TYPE_POST . $post->ID ;
286
+ }
287
+
288
+ // pages collections & single page tag
289
+ if ( stripos( $path, '/pages' ) !== false ) {
290
+ $tags[] = self::TYPE_PAGES ;
291
+ }
292
+ }
293
+
294
+ }
295
+
296
+ return $tags ;
297
+ }
298
+
299
+ /**
300
+ * Generate all cache tags before output
301
+ *
302
+ * @access private
303
+ * @since 1.1.3
304
+ */
305
+ private static function _finalize()
306
+ {
307
+ // run 3rdparty hooks to tag
308
+ do_action( 'litespeed_cache_api_tag' ) ;
309
+ // generate wp tags
310
+ if ( ! defined( 'LSCACHE_IS_ESI' ) ) {
311
+ $type_tags = self::_build_type_tags() ;
312
+ self::$_tags = array_merge( self::$_tags, $type_tags ) ;
313
+ }
314
+ // append blog main tag
315
+ self::$_tags[] = '' ;
316
+ // removed duplicates
317
+ self::$_tags = array_unique( self::$_tags ) ;
318
+ }
319
+
320
+ /**
321
+ * Sets up the Cache Tags header.
322
+ * ONLY need to run this if is cacheable
323
+ *
324
+ * @since 1.1.3
325
+ * @access public
326
+ * @return string empty string if empty, otherwise the cache tags header.
327
+ */
328
+ public static function output()
329
+ {
330
+ self::_finalize() ;
331
+
332
+ $prefix_tags = array() ;
333
+ $prefix = LSWCP_TAG_PREFIX . get_current_blog_id() . '_' ;
334
+
335
+ // If is_private and has private tags, append them first, then specify prefix to `public` for public tags
336
+ if ( LiteSpeed_Cache_Control::is_private() ) {
337
+ foreach ( self::$_tags_priv as $priv_tag ) {
338
+ $prefix_tags[] = $prefix . $priv_tag ;
339
+ }
340
+ $prefix = 'public:' . $prefix ;
341
+ }
342
+
343
+ foreach ( self::$_tags as $tag ) {
344
+ $prefix_tags[] = $prefix . $tag ;
345
+ }
346
+
347
+ $hdr = self::X_HEADER . ': ' . implode( ',', $prefix_tags ) ;
348
+
349
+ return $hdr ;
350
+ }
351
+
352
+ /**
353
+ * Get the current instance object.
354
+ *
355
+ * @since 1.1.3
356
+ * @access public
357
+ * @return Current class instance.
358
+ */
359
+ // public static function get_instance()
360
+ // {
361
+ // if ( ! isset(self::$_instance) ) {
362
+ // self::$_instance = new self() ;
363
+ // }
364
+
365
+ // return self::$_instance ;
366
+ // }
367
+
368
+ }
inc/task.class.php ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The cron task class.
5
+ *
6
+ * @since 1.1.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+ class LiteSpeed_Cache_Task
13
+ {
14
+ const CRON_ACTION_HOOK = 'litespeed_crawl_trigger' ;
15
+ const CRON_FITLER = 'litespeed_crawl_filter' ;
16
+
17
+ /**
18
+ * Enable/Disable cron task
19
+ *
20
+ * @since 1.1.0
21
+ * @access public
22
+ */
23
+ public static function enable()
24
+ {
25
+ $id = LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE ;
26
+
27
+ // get new setting
28
+ $is_enabled = ! LiteSpeed_Cache::config( $id ) ;
29
+
30
+ // log
31
+ LiteSpeed_Cache_Log::debug( 'Crawler log: Crawler is ' . ( $is_enabled ? 'enabled' : 'disabled' ) ) ;
32
+
33
+ // update config
34
+ LiteSpeed_Cache_Config::get_instance()->update_options( array( $id => $is_enabled ) ) ;
35
+
36
+ self::update() ;
37
+
38
+ echo json_encode( array( 'enable' => $is_enabled ) ) ;
39
+ wp_die() ;
40
+ }
41
+
42
+ /**
43
+ * Update cron status
44
+ *
45
+ * @since 1.1.0
46
+ * @access public
47
+ * @param array $options The options to check if cron should be enabled
48
+ */
49
+ public static function update( $options = false )
50
+ {
51
+ $id = LiteSpeed_Cache_Config::CRWL_CRON_ACTIVE ;
52
+ if ( $options && isset( $options[ $id ] ) ) {
53
+ $is_active = $options[$id] ;
54
+ }
55
+ else {
56
+ $is_active = LiteSpeed_Cache::config( $id ) ;
57
+ }
58
+
59
+ // If cron setting is on, check cache status
60
+ if ( $is_active ) {
61
+ if ( defined( 'LITESPEED_NEW_OFF' ) ) {
62
+ $is_active = false ;
63
+ }
64
+ elseif ( ! defined( 'LITESPEED_ON' ) && ! defined( 'LITESPEED_NEW_ON' ) ) {
65
+ $is_active = false ;
66
+ }
67
+ }
68
+
69
+ if ( $is_active ) {
70
+ self::schedule_filter() ;
71
+ }
72
+ else {
73
+ self::clear() ;
74
+ }
75
+
76
+ }
77
+
78
+ /**
79
+ * Schedule cron
80
+ *
81
+ * @since 1.1.0
82
+ * @access public
83
+ */
84
+ public static function schedule_filter()
85
+ {
86
+ add_filter( 'cron_schedules', 'LiteSpeed_Cache_Task::lscache_cron_filter' ) ;
87
+
88
+ // Schedule event here to see if it can lost again or not
89
+ if( ! wp_next_scheduled( self::CRON_ACTION_HOOK ) ) {
90
+ LiteSpeed_Cache_Log::debug( 'Crawler cron log: ......cron hook register......' ) ;
91
+ wp_schedule_event( time(), self::CRON_FITLER, self::CRON_ACTION_HOOK ) ;
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Register cron interval
97
+ *
98
+ * @since 1.1.0
99
+ * @access public
100
+ * @param array $schedules WP Hook
101
+ */
102
+ public static function lscache_cron_filter( $schedules )
103
+ {
104
+ $interval = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::CRWL_RUN_INTERVAL ) ;
105
+ // $wp_schedules = wp_get_schedules() ;
106
+ if ( ! array_key_exists( self::CRON_FITLER, $schedules ) ) {
107
+ // if ( LiteSpeed_Cache_Log::get_enabled() ) {
108
+ // LiteSpeed_Cache_Log::push('Crawler cron log: ......cron filter '.$interval.' added......') ;
109
+ // }
110
+ $schedules[self::CRON_FITLER] = array(
111
+ 'interval' => $interval,
112
+ 'display' => __( 'LiteSpeed Cache Custom Cron', 'litespeed-cache' ),
113
+ ) ;
114
+ }
115
+ return $schedules ;
116
+ }
117
+
118
+ /**
119
+ * Clear cron
120
+ *
121
+ * @since 1.1.0
122
+ * @access public
123
+ */
124
+ public static function clear()
125
+ {
126
+ LiteSpeed_Cache_Log::debug( 'Crawler cron log: ......cron hook cleared......' ) ;
127
+ wp_clear_scheduled_hook( self::CRON_ACTION_HOOK ) ;
128
+ }
129
+ }
inc/utility.class.php ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The utility class.
5
+ *
6
+ * @since 1.1.5
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+ class LiteSpeed_Cache_Utility
13
+ {
14
+ /**
15
+ * Parse attributes from string
16
+ *
17
+ * @since 1.2.2
18
+ * @since 1.4 Moved from optimize to utility
19
+ * @access private
20
+ * @param string $str
21
+ * @return array All the attributes
22
+ */
23
+ public static function parse_attr( $str )
24
+ {
25
+ $attrs = array() ;
26
+ preg_match_all( '#(\w+)=["\']([^"\']*)["\']#isU', $str, $matches, PREG_SET_ORDER ) ;
27
+ foreach ( $matches as $match ) {
28
+ $attrs[ $match[ 1 ] ] = trim( $match[ 2 ] ) ;
29
+ }
30
+ return $attrs ;
31
+ }
32
+
33
+ /**
34
+ * Get url based on permalink setting
35
+ *
36
+ * @since 1.3
37
+ * @access public
38
+ * @return string
39
+ */
40
+ public static function get_permalink_url( $relative_url )
41
+ {
42
+ return $GLOBALS[ 'wp_rewrite' ]->using_permalinks() ? home_url( $relative_url ) : home_url() . '/?' . $relative_url ;
43
+ }
44
+
45
+ /**
46
+ * Check if an array has a string
47
+ *
48
+ * Support $ exact match
49
+ *
50
+ * @since 1.3
51
+ * @access private
52
+ * @param string $needle The string to search with
53
+ * @param array $haystack
54
+ * @return bool|string False if not found, otherwise return the matched string in haystack.
55
+ */
56
+ public static function str_hit_array( $needle, $haystack )
57
+ {
58
+ foreach( $haystack as $item ) {
59
+ if ( substr( $item, -1 ) === '$' ) {
60
+ // do exact match
61
+ if ( substr( $item, 0, -1 ) === $needle ) {
62
+ return $item ;
63
+ }
64
+ }
65
+ elseif ( substr( $item, 0, 1 ) === '^' ) {
66
+ // match beginning
67
+ if ( substr( $item, 1 ) === substr( $needle, 0, strlen( $item ) - 1 ) ) {
68
+ return $item ;
69
+ }
70
+ }
71
+ else {
72
+ if ( strpos( $needle, $item ) !== false ) {
73
+ return $item ;
74
+ }
75
+ }
76
+ }
77
+
78
+ return false ;
79
+ }
80
+
81
+ /**
82
+ * Improve compatibility to PHP old versions
83
+ *
84
+ * @since 1.2.2
85
+ *
86
+ */
87
+ public static function compatibility()
88
+ {
89
+ require_once LSWCP_DIR . 'lib/litespeed-php-compatibility.func.php' ;
90
+ }
91
+
92
+ /**
93
+ * Check if the host is the internal host
94
+ *
95
+ * @since 1.2.3
96
+ *
97
+ */
98
+ public static function internal( $host )
99
+ {
100
+ if ( ! defined( 'LITESPEED_FRONTEND_HOST' ) ) {
101
+ define( 'LITESPEED_FRONTEND_HOST', parse_url( get_option( 'home' ), PHP_URL_HOST ) ) ;
102
+ }
103
+
104
+ return $host === LITESPEED_FRONTEND_HOST ;
105
+ }
106
+
107
+ /**
108
+ * Convert URI to URL
109
+ *
110
+ * @since 1.3
111
+ * @access public
112
+ * @param string $uri `xx/xx.html` or `/subfolder/xx/xx.html`
113
+ * @return string http://www.example.com/subfolder/xx/xx.html
114
+ */
115
+ public static function uri2url( $uri )
116
+ {
117
+ if ( substr( $uri, 0, 1 ) === '/' ) {
118
+ self::domain_const() ;
119
+ $url = LSCWP_DOMAIN . $uri ;
120
+ }
121
+ else {
122
+ $url = home_url( '/' ) . $uri ;
123
+ }
124
+
125
+ return $url ;
126
+ }
127
+
128
+ /**
129
+ * Convert URL to URI
130
+ *
131
+ * @since 1.2.2
132
+ * @access public
133
+ */
134
+ public static function url2uri( $url )
135
+ {
136
+ $url = trim( $url ) ;
137
+ $uri = @parse_url( $url, PHP_URL_PATH ) ;
138
+ return $uri ;
139
+ }
140
+
141
+ /**
142
+ * Make URL to be relative
143
+ *
144
+ * NOTE: for subfolder home_url, will keep subfolder part (strip nothing but scheme and host)
145
+ *
146
+ * @param string $url
147
+ * @return string Relative URL, start with /
148
+ */
149
+ public static function make_relative( $url )
150
+ {
151
+ // replace home_url if the url is full url
152
+ self::domain_const() ;
153
+ if ( strpos( $url, LSCWP_DOMAIN ) === 0 ) {
154
+ $url = substr( $url, strlen( LSCWP_DOMAIN ) ) ;
155
+ }
156
+ return trim( $url ) ;
157
+ }
158
+
159
+ /**
160
+ * Generate domain const
161
+ *
162
+ * This will generate http://www.example.com even there is a subfolder in home_url setting
163
+ *
164
+ * Const LSCWP_DOMAIN has NO trailing /
165
+ *
166
+ * @since 1.3
167
+ * @access public
168
+ */
169
+ public static function domain_const()
170
+ {
171
+ if ( defined( 'LSCWP_DOMAIN' ) ) {
172
+ return ;
173
+ }
174
+
175
+ $home_url = get_home_url( is_multisite() ? get_current_blog_id() : null ) ;
176
+
177
+ self::compatibility() ;
178
+ $domain = http_build_url( $home_url, array(), HTTP_URL_STRIP_ALL ) ;
179
+
180
+ define( 'LSCWP_DOMAIN', $domain ) ;
181
+ }
182
+
183
+ /**
184
+ * Array map one textarea to sanitize the url
185
+ *
186
+ * @since 1.3
187
+ * @access public
188
+ * @param string $content
189
+ * @param bool $type String handler type
190
+ * @return string
191
+ */
192
+ public static function sanitize_lines( $content, $type = null )
193
+ {
194
+ if ( ! $content ) {
195
+ return $content ;
196
+ }
197
+
198
+ $arr = explode( "\n", $content ) ;
199
+ if ( $type === 'uri' ) {
200
+ $arr = array_map( 'LiteSpeed_Cache_Utility::url2uri', $arr ) ;
201
+ }
202
+ if ( $type === 'relative' ) {
203
+ $arr = array_map( 'LiteSpeed_Cache_Utility::make_relative', $arr ) ;// Remove domain
204
+ }
205
+ $arr = array_map( 'trim', $arr ) ;
206
+ $arr = array_unique( $arr ) ;
207
+ $arr = array_filter( $arr ) ;
208
+ return implode( "\n", $arr ) ;
209
+ }
210
+
211
+ /**
212
+ * Builds an url with an action and a nonce.
213
+ *
214
+ * Assumes user capabilities are already checked.
215
+ *
216
+ * @access public
217
+ * @param string $action The LSCWP_CTRL action to do in the url.
218
+ * @param string $ajax_action AJAX call's action
219
+ * @param string $append_str The appending string to url
220
+ * @return string The built url.
221
+ */
222
+ public static function build_url( $action, $ajax_action = false, $append_str = false, $page = null )
223
+ {
224
+ $prefix = '?' ;
225
+
226
+ if ( $ajax_action === false ) {
227
+ if ( $page ) {
228
+ // If use admin url
229
+ if ( $page === true ) {
230
+ $page = 'admin.php' ;
231
+ }
232
+ else {
233
+ if ( strpos( $page, '?' ) !== false ) {
234
+ $prefix = '&' ;
235
+ }
236
+ }
237
+ $combined = $page . $prefix . LiteSpeed_Cache::ACTION_KEY . '=' . $action ;
238
+ }
239
+ else {
240
+ // Current page rebuild URL
241
+ $params = $_GET ;
242
+
243
+ if ( ! empty( $params ) ) {
244
+ if ( isset( $params[ 'LSCWP_CTRL' ] ) ) {
245
+ unset( $params[ 'LSCWP_CTRL' ] ) ;
246
+ }
247
+ if ( isset( $params[ '_wpnonce' ] ) ) {
248
+ unset( $params[ '_wpnonce' ] ) ;
249
+ }
250
+ if ( ! empty( $params ) ) {
251
+ $prefix .= http_build_query( $params ) . '&' ;
252
+ }
253
+ }
254
+ global $pagenow ;
255
+ $combined = $pagenow . $prefix . LiteSpeed_Cache::ACTION_KEY . '=' . $action ;
256
+ }
257
+ }
258
+ else {
259
+ $combined = 'admin-ajax.php?action=' . $ajax_action . '&' . LiteSpeed_Cache::ACTION_KEY . '=' . $action ;
260
+ }
261
+
262
+ if ( is_network_admin() ) {
263
+ $prenonce = network_admin_url( $combined ) ;
264
+ }
265
+ else {
266
+ $prenonce = admin_url( $combined ) ;
267
+ }
268
+ $url = wp_nonce_url( $prenonce, $action, LiteSpeed_Cache::NONCE_NAME ) ;
269
+
270
+ if ( $append_str ) {
271
+ $url .= '&' . $append_str ;
272
+ }
273
+
274
+ return $url ;
275
+ }
276
+ }
277
+
278
+
279
+
inc/vary.class.php ADDED
@@ -0,0 +1,466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * The plugin vary class to manage X-LiteSpeed-Vary
4
+ *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
+ */
11
+ class LiteSpeed_Cache_Vary
12
+ {
13
+ private static $_instance ;
14
+
15
+ const X_HEADER = 'X-LiteSpeed-Vary' ;
16
+
17
+ private static $_vary_name = '_lscache_vary' ; // this default vary cookie is used for logged in status check
18
+ private static $_vary_cookies = array() ; // vary header only!
19
+
20
+ /**
21
+ * Adds the actions used for setting up cookies on log in/out.
22
+ *
23
+ * Also checks if the database matches the rewrite rule.
24
+ *
25
+ * @since 1.0.4
26
+ */
27
+ private function __construct()
28
+ {
29
+ // logged in user
30
+ if ( LiteSpeed_Cache_Router::is_logged_in() ) {
31
+ // Make sure the cookie value is corrent
32
+ self::add_logged_in() ;
33
+
34
+ // If not esi, check cache logged-in user setting
35
+ if ( ! LiteSpeed_Cache_Router::esi_enabled() ) {
36
+ // If cache logged-in, then init cacheable to private
37
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_PRIV ) ) {
38
+ add_action( 'wp_logout', 'LiteSpeed_Cache_Purge::purge_on_logout' ) ;
39
+
40
+ LiteSpeed_Cache_Control::init_cacheable() ;
41
+ LiteSpeed_Cache_Control::set_private( 'logged in user' ) ;
42
+ }
43
+ // No cache for logged-in user
44
+ else {
45
+ LiteSpeed_Cache_Control::set_nocache( 'logged in user' ) ;
46
+ }
47
+ }
48
+ // ESI is on, can be public cache
49
+ else {
50
+ // Need to make sure vary is using group id
51
+ LiteSpeed_Cache_Control::init_cacheable() ;
52
+ }
53
+
54
+ // register logout hook to clear login status
55
+ add_action( 'clear_auth_cookie', 'LiteSpeed_Cache_Vary::remove_logged_in' ) ;
56
+
57
+ }
58
+ else {
59
+ // Make sure the cookie value is corrent
60
+ self::remove_logged_in() ;
61
+
62
+ // Set vary cookie for logging in user, otherwise the user will hit public with vary=0 (guest version)
63
+ add_action( 'set_logged_in_cookie', 'LiteSpeed_Cache_Vary::add_logged_in', 10, 4 ) ;
64
+ add_action( 'wp_login', 'LiteSpeed_Cache_Purge::purge_on_logout' ) ;
65
+
66
+ LiteSpeed_Cache_Control::init_cacheable() ;
67
+
68
+ // Check `login page` cacheable setting because they don't go through main WP logic
69
+ add_action( 'login_init', 'LiteSpeed_Cache_Tag::check_login_cacheable', 5 ) ;
70
+
71
+ }
72
+
73
+ // Add comment list ESI
74
+ add_filter('comments_array', array( $this, 'check_commenter' ) ) ;
75
+
76
+ // Set vary cookie for commenter.
77
+ add_action('set_comment_cookies', array( $this, 'append_commenter' ) ) ;
78
+
79
+ /******** Below to the end is only for cookie name setting check ********/
80
+ // Get specific cookie name
81
+ $db_cookie = false ;
82
+ if ( is_multisite() ) {
83
+ $options = LiteSpeed_Cache_Config::get_instance()->get_site_options() ;
84
+ $db_cookie = $options[ LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE ] ;
85
+ }
86
+ else {
87
+ $db_cookie = LiteSpeed_Cache::config(LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE) ;
88
+ }
89
+
90
+ // If no vary set in rewrite rule
91
+ if ( ! isset($_SERVER['LSCACHE_VARY_COOKIE']) ) {
92
+ if ( $db_cookie ) {
93
+ // Display cookie error msg to admin
94
+ if ( is_multisite() ? is_network_admin() : is_admin() ) {
95
+ LiteSpeed_Cache_Admin_Display::show_error_cookie() ;
96
+ }
97
+ LiteSpeed_Cache_Control::set_nocache('vary cookie setting error') ;
98
+ return ;
99
+ }
100
+ return ;
101
+ }
102
+ // If db setting does not exist, skip checking db value
103
+ if ( ! $db_cookie ) {
104
+ return ;
105
+ }
106
+
107
+ // beyond this point, need to make sure db vary setting is in $_SERVER env.
108
+ $vary_arr = explode(',', $_SERVER['LSCACHE_VARY_COOKIE']) ;
109
+
110
+ if ( in_array($db_cookie, $vary_arr) ) {
111
+ self::$_vary_name = $db_cookie ;
112
+ return ;
113
+ }
114
+
115
+ if ( is_multisite() ? is_network_admin() : is_admin() ) {
116
+ LiteSpeed_Cache_Admin_Display::show_error_cookie() ;
117
+ }
118
+ LiteSpeed_Cache_Control::set_nocache('vary cookie setting lost error') ;
119
+ }
120
+
121
+ /**
122
+ * Hooked to the comments_array filter.
123
+ *
124
+ * Check if the user accessing the page has the commenter cookie.
125
+ *
126
+ * If the user does not want to cache commenters, just check if user is commenter.
127
+ * Otherwise if the vary cookie is set, unset it. This is so that when the page is cached, the page will appear as if the user was a normal user.
128
+ * Normal user is defined as not a logged in user and not a commenter.
129
+ *
130
+ * @since 1.0.4
131
+ * @access public
132
+ * @global type $post
133
+ * @param array $comments The current comments to output
134
+ * @return array The comments to output.
135
+ */
136
+ public function check_commenter( $comments )
137
+ {
138
+ $pending = false ;
139
+ foreach ( $comments as $comment ) {
140
+ if ( ! $comment->comment_approved ) {// current user has pending comment
141
+ $pending = true ;
142
+ break ;
143
+ }
144
+ }
145
+
146
+ // No pending comments, don't need to add private cache
147
+ if ( ! $pending ) {
148
+ $this->remove_commenter() ;
149
+
150
+ // Remove commenter prefilled info if exists, for public cache
151
+ foreach( $_COOKIE as $cookie_name => $cookie_value ) {
152
+ if ( strlen( $cookie_name ) >= 15 && strncmp( $cookie_name, 'comment_author_', 15 ) == 0 ) {
153
+ unset( $_COOKIE[ $cookie_name ] ) ;
154
+ }
155
+ }
156
+
157
+ return $comments ;
158
+ }
159
+
160
+ // Current user/visitor has pending comments
161
+ // set vary=2 for next time vary lookup
162
+ $this->add_commenter() ;
163
+
164
+ if ( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CACHE_COMMENTER ) ) {
165
+ LiteSpeed_Cache_Control::set_private( 'existing commenter' ) ;
166
+ }
167
+ else {
168
+ LiteSpeed_Cache_Control::set_nocache( 'existing commenter' ) ;
169
+ }
170
+
171
+ return $comments ;
172
+ }
173
+
174
+ /**
175
+ * Check if default vary has a value
176
+ *
177
+ * @since 1.1.3
178
+ * @access public
179
+ */
180
+ public static function has_vary()
181
+ {
182
+ if ( empty( $_COOKIE[ self::$_vary_name ] ) ) {
183
+ return false ;
184
+ }
185
+ return $_COOKIE[ self::$_vary_name ] ;
186
+ }
187
+
188
+ /**
189
+ * Append user status with logged in
190
+ *
191
+ * @since 1.1.3
192
+ * @access public
193
+ */
194
+ public static function add_logged_in( $logged_in_cookie = false, $expire = false, $expiration = false, $user_id = false )
195
+ {
196
+ // If the cookie is lost somehow, set it
197
+ $vary = self::generate_vary( $user_id ) ;
198
+ $current_vary = self::has_vary() ;
199
+ if ( $current_vary !== $vary && $current_vary !== 'commenter' ) {
200
+ // $_COOKIE[ self::$_vary_name ] = $vary ; // not needed
201
+
202
+ // save it
203
+ if ( ! $expire ) {
204
+ $expire = time() + 2 * DAY_IN_SECONDS ;
205
+ }
206
+ self::_cookie( $vary, $expire ) ;
207
+ LiteSpeed_Cache_Control::set_nocache( 'adding logged in status' ) ;
208
+ }
209
+ }
210
+
211
+ /**
212
+ * Remove user logged in status
213
+ *
214
+ * @since 1.1.3
215
+ * @access public
216
+ */
217
+ public static function remove_logged_in()
218
+ {
219
+ // If the cookie is set and not commenter, unset it.
220
+ $current_vary = self::has_vary() ;
221
+ if ( $current_vary && $current_vary !== 'commenter' ) {
222
+ // remove logged in status from global var
223
+ // unset( $_COOKIE[ self::$_vary_name ] ) ; // not needed
224
+
225
+ // save it
226
+ self::_cookie() ;
227
+ LiteSpeed_Cache_Control::set_nocache( 'removing logged in status' ) ;
228
+ }
229
+ }
230
+
231
+ /**
232
+ * Get user vary tag based on admin_bar & role
233
+ *
234
+ * @since 1.2.0
235
+ * @access public
236
+ */
237
+ public static function generate_vary( $user_id )
238
+ {
239
+ if ( ! $user_id ) {
240
+ $user = wp_get_current_user() ;
241
+ $user_id = $user->ID ;
242
+ LiteSpeed_Cache_Log::debug2( 'getting user_id: ' . $user_id ) ;
243
+ }
244
+ $vary = array( 'logged-in' => 1 ) ;
245
+ // get user's group id
246
+ $user = get_userdata( $user_id ) ;
247
+ if ( empty( $user->roles[ 0 ] ) ) {
248
+ // Guest user
249
+ LiteSpeed_Cache_Log::debug( 'Vary role id: failed, guest' ) ;
250
+ return false ;
251
+ }
252
+
253
+ // parge role group from settings
254
+ $gid = $user->roles[ 0 ] ?: 0 ;
255
+ if ( $role_group = LiteSpeed_Cache_Config::get_instance()->in_vary_group( $gid ) ) {
256
+ $vary[ 'role' ] = $role_group ;
257
+ LiteSpeed_Cache_Log::debug2( 'Vary role group: ' . $gid ) ;
258
+ }
259
+
260
+ // Get admin bar set
261
+ // see @_get_admin_bar_pref()
262
+ $pref = get_user_option( 'show_admin_bar_front', $user_id ) ;
263
+ LiteSpeed_Cache_Log::debug2( 'Vary show_admin_bar_front: ' . $pref ) ;
264
+ $admin_bar = $pref === false || $pref === 'true' ;
265
+
266
+ if ( $admin_bar ) {
267
+ $vary[ 'admin_bar' ] = 1 ;
268
+ LiteSpeed_Cache_Log::debug2( 'Vary admin bar : true' ) ;
269
+ }
270
+
271
+ ksort( $vary ) ;
272
+ $res = array() ;
273
+ foreach ( $vary as $key => $val ) {
274
+ $res[] = $key . ':' . $val ;
275
+ }
276
+
277
+ if ( ! $res ) {
278
+ return false ;
279
+ }
280
+
281
+ $res = implode( ';', $res ) ;
282
+ if ( LiteSpeed_Cache_Log::get_enabled() ) {
283
+ return $res ;
284
+ }
285
+ // Encrypt in production
286
+ return md5( LiteSpeed_Cache::config( LiteSpeed_Cache_Config::HASH ) . $res ) ;
287
+ }
288
+
289
+ /**
290
+ * Append user status with commenter
291
+ *
292
+ * This is ONLY used when submit a comment
293
+ *
294
+ * @since 1.1.6
295
+ * @access public
296
+ */
297
+ public function append_commenter()
298
+ {
299
+ $this->add_commenter( true ) ;
300
+ }
301
+
302
+ /**
303
+ * Correct user status with commenter
304
+ *
305
+ * @since 1.1.3
306
+ * @access private
307
+ * @param boolean $from_redirect If the request is from redirect page or not
308
+ */
309
+ private function add_commenter( $from_redirect = false )
310
+ {
311
+ // If the cookie is lost somehow, set it
312
+ if ( self::has_vary() !== 'commenter' ) {
313
+ // $_COOKIE[ self::$_vary_name ] = 'commenter' ; // not needed
314
+
315
+ // save it
316
+ // only set commenter status for current domain path
317
+ self::_cookie( 'commenter', time() + apply_filters( 'comment_cookie_lifetime', 30000000 ), self::_relative_path( $from_redirect ) ) ;
318
+ LiteSpeed_Cache_Control::set_nocache( 'adding commenter status' ) ;
319
+ }
320
+ }
321
+
322
+ /**
323
+ * Remove user commenter status
324
+ *
325
+ * @since 1.1.3
326
+ * @access private
327
+ */
328
+ private function remove_commenter()
329
+ {
330
+ if ( self::has_vary() === 'commenter' ) {
331
+ // remove logged in status from global var
332
+ // unset( $_COOKIE[ self::$_vary_name ] ) ; // not needed
333
+
334
+ // save it
335
+ self::_cookie( false, false, self::_relative_path() ) ;
336
+ LiteSpeed_Cache_Control::set_nocache( 'removing commenter status' ) ;
337
+ }
338
+ }
339
+
340
+ /**
341
+ * Generate relative path for cookie
342
+ *
343
+ * @since 1.1.3
344
+ * @access private
345
+ * @param boolean $from_redirect If the request is from redirect page or not
346
+ */
347
+ private static function _relative_path( $from_redirect = false )
348
+ {
349
+ $path = false ;
350
+ $tag = $from_redirect ? 'HTTP_REFERER' : 'SCRIPT_URL' ;
351
+ if ( ! empty( $_SERVER[ $tag ] ) ) {
352
+ $path = parse_url( $_SERVER[ $tag ] ) ;
353
+ $path = ! empty( $path[ 'path' ] ) ? $path[ 'path' ] : false ;
354
+ LiteSpeed_Cache_Log::debug( 'Cookie Vary path: ' . $path ) ;
355
+ }
356
+ return $path ;
357
+ }
358
+
359
+ /**
360
+ * Gets vary cookies that are already added for the current page.
361
+ *
362
+ * @since 1.0.13
363
+ * @access private
364
+ * @return array An array of all vary cookies currently added.
365
+ */
366
+ private static function _format_vary_cookies()
367
+ {
368
+ if ( empty(self::$_vary_cookies) ) {
369
+ return false ;
370
+ }
371
+ $cookies = array_filter(array_unique(self::$_vary_cookies)) ;
372
+ if ( empty($cookies) ) {
373
+ return false ;
374
+ }
375
+ foreach ($cookies as $key => $val) {
376
+ $cookies[$key] = 'cookie=' . $val ;
377
+ }
378
+ return $cookies ;
379
+ }
380
+
381
+ /**
382
+ * Builds the vary header.
383
+ *
384
+ * Currently, this only checks post passwords.
385
+ *
386
+ * @since 1.0.13
387
+ * @access public
388
+ * @global $post
389
+ * @return mixed false if the user has the postpass cookie. Empty string
390
+ * if the post is not password protected. Vary header otherwise.
391
+ */
392
+ public static function output()
393
+ {
394
+ if ( ! LiteSpeed_Cache_Control::is_cacheable() ) {
395
+ return ;
396
+ }
397
+ $tp_cookies = self::_format_vary_cookies() ;
398
+ global $post ;
399
+ if ( ! empty($post->post_password) ) {
400
+ if ( isset($_COOKIE['wp-postpass_' . COOKIEHASH]) ) {
401
+ // If user has password cookie, do not cache
402
+ LiteSpeed_Cache_Control::set_nocache('password protected vary') ;
403
+ return ;
404
+ }
405
+
406
+ $tp_cookies[] = 'cookie=wp-postpass_' . COOKIEHASH ;
407
+ }
408
+
409
+ if ( empty($tp_cookies) ) {
410
+ return ;
411
+ }
412
+ return self::X_HEADER . ': ' . implode(',', $tp_cookies) ;
413
+ }
414
+
415
+ /**
416
+ * Adds vary to the list of vary cookies for the current page.
417
+ *
418
+ * @since 1.0.13
419
+ * @access public
420
+ * @param mixed $vary A string or array of vary cookies to add to the current list.
421
+ */
422
+ public static function add($vary)
423
+ {
424
+ if ( ! is_array($vary) ) {
425
+ $vary = array($vary) ;
426
+ }
427
+
428
+ self::$_vary_cookies = array_merge(self::$_vary_cookies, $vary) ;
429
+ }
430
+
431
+ /**
432
+ * Set the vary cookie.
433
+ *
434
+ * If vary cookie changed, must set non cacheable.
435
+ *
436
+ * @since 1.0.4
437
+ * @access private
438
+ * @param integer $val The value to update.
439
+ * @param integer $expire Expire time.
440
+ * @param boolean $path False if use wp root path as cookie path
441
+ */
442
+ private static function _cookie($val = false, $expire = false, $path = false)
443
+ {
444
+ if ( ! $val ) {
445
+ $expire = 1 ;
446
+ }
447
+
448
+ setcookie(self::$_vary_name, $val, $expire, $path?: COOKIEPATH, COOKIE_DOMAIN, is_ssl(), true) ;
449
+ }
450
+
451
+ /**
452
+ * Get the current instance object.
453
+ *
454
+ * @since 1.1.3
455
+ * @access public
456
+ * @return Current class instance.
457
+ */
458
+ public static function get_instance()
459
+ {
460
+ if ( ! isset(self::$_instance) ) {
461
+ self::$_instance = new self() ;
462
+ }
463
+
464
+ return self::$_instance ;
465
+ }
466
+ }
includes/advanced-cache.php CHANGED
File without changes
includes/deprecated-litespeed-cache-tags.class.php CHANGED
File without changes
includes/litespeed-cache-activation.class.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * The plugin activation class.
4
  *
5
- * @since 1.1.0
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
  class LiteSpeed_Cache_Activation
11
  {
2
  /**
3
  * The plugin activation class.
4
  *
5
+ * @since 1.1.0
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
  class LiteSpeed_Cache_Activation
12
  {
includes/litespeed-cache-api.class.php ADDED
@@ -0,0 +1,450 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * The plugin API class.
5
+ *
6
+ * @since 1.1.3
7
+ * @since 1.4 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
+ */
12
+ class LiteSpeed_Cache_API
13
+ {
14
+ const VERSION = LiteSpeed_Cache::PLUGIN_VERSION ;
15
+
16
+ const TYPE_FEED = LiteSpeed_Cache_Tag::TYPE_FEED ;
17
+ const TYPE_FRONTPAGE = LiteSpeed_Cache_Tag::TYPE_FRONTPAGE ;
18
+ const TYPE_HOME = LiteSpeed_Cache_Tag::TYPE_HOME ;
19
+ const TYPE_PAGES = LiteSpeed_Cache_Tag::TYPE_PAGES ;
20
+ const TYPE_PAGES_WITH_RECENT_POSTS = LiteSpeed_Cache_Tag::TYPE_PAGES_WITH_RECENT_POSTS ;
21
+ const TYPE_ERROR = LiteSpeed_Cache_Tag::TYPE_ERROR ;
22
+ const TYPE_POST = LiteSpeed_Cache_Tag::TYPE_POST ;
23
+ const TYPE_ARCHIVE_POSTTYPE = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_POSTTYPE ;
24
+ const TYPE_ARCHIVE_TERM = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_TERM ;
25
+ const TYPE_AUTHOR = LiteSpeed_Cache_Tag::TYPE_AUTHOR ;
26
+ const TYPE_ARCHIVE_DATE = LiteSpeed_Cache_Tag::TYPE_ARCHIVE_DATE ;
27
+ const TYPE_BLOG = LiteSpeed_Cache_Tag::TYPE_BLOG ;
28
+ const TYPE_LOGIN = LiteSpeed_Cache_Tag::TYPE_LOGIN ;
29
+ const TYPE_URL = LiteSpeed_Cache_Tag::TYPE_URL ;
30
+ const TYPE_WIDGET = LiteSpeed_Cache_Tag::TYPE_WIDGET ;
31
+
32
+ const PARAM_NAME = LiteSpeed_Cache_ESI::PARAM_NAME ;
33
+ const WIDGET_OPID_ESIENABLE = LiteSpeed_Cache_ESI::WIDGET_OPID_ESIENABLE ;
34
+ const WIDGET_OPID_TTL = LiteSpeed_Cache_ESI::WIDGET_OPID_TTL ;
35
+
36
+ const VAL_OFF = LiteSpeed_Cache_Config::VAL_OFF ;
37
+ const VAL_ON = LiteSpeed_Cache_Config::VAL_ON ;
38
+ const VAL_ON2 = LiteSpeed_Cache_Config::VAL_ON2 ;
39
+
40
+ /**
41
+ * Start a to-be-removed html wrapper
42
+ *
43
+ * @since 1.4
44
+ * @access public
45
+ */
46
+ public static function clean_wrapper_begin( $counter = false )
47
+ {
48
+ return LiteSpeed_Cache_GUI::clean_wrapper_begin( $counter ) ;
49
+ }
50
+
51
+ /**
52
+ * End a to-be-removed html wrapper
53
+ *
54
+ * @since 1.4
55
+ * @access public
56
+ */
57
+ public static function clean_wrapper_end( $counter = false )
58
+ {
59
+ return LiteSpeed_Cache_GUI::clean_wrapper_end( $counter ) ;
60
+ }
61
+
62
+ /**
63
+ * Compare version
64
+ *
65
+ * @since 1.3
66
+ * @access public
67
+ */
68
+ public static function v( $v )
69
+ {
70
+ return version_compare( self::VERSION, $v, '>=' ) ;
71
+ }
72
+
73
+ /**
74
+ * Set mobile
75
+ *
76
+ * @since 1.1.3
77
+ * @access public
78
+ */
79
+ public static function set_mobile()
80
+ {
81
+ LiteSpeed_Cache_Control::set_mobile() ;
82
+ }
83
+
84
+ /**
85
+ * Set cache status to not cacheable
86
+ *
87
+ * @since 1.1.3
88
+ * @access public
89
+ */
90
+ public static function set_cache_private()
91
+ {
92
+ LiteSpeed_Cache_Control::set_private() ;
93
+ }
94
+
95
+ /**
96
+ * Set cache status to no vary
97
+ *
98
+ * @since 1.2.0
99
+ * @access public
100
+ */
101
+ public static function set_cache_no_vary()
102
+ {
103
+ LiteSpeed_Cache_Control::set_no_vary() ;
104
+ }
105
+
106
+ /**
107
+ * Set cache status to not cacheable
108
+ *
109
+ * @since 1.1.3
110
+ * @access public
111
+ */
112
+ public static function set_nocache( $reason = false )
113
+ {
114
+ LiteSpeed_Cache_Control::set_nocache( $reason ?: 'api' ) ;
115
+ }
116
+
117
+ /**
118
+ * Get current not cacheable status
119
+ *
120
+ * @since 1.1.3
121
+ * @access public
122
+ */
123
+ public static function not_cacheable()
124
+ {
125
+ return ! LiteSpeed_Cache_Control::is_cacheable() ;
126
+ }
127
+
128
+ /**
129
+ * Set cache control ttl to use frontpage ttl
130
+ *
131
+ * @since 1.1.3
132
+ * @access public
133
+ */
134
+ public static function set_use_frontpage_ttl()
135
+ {
136
+ LiteSpeed_Cache_Control::set_custom_ttl(self::config(LiteSpeed_Cache_Config::OPID_FRONT_PAGE_TTL)) ;
137
+ }
138
+
139
+ /**
140
+ * Set cache control ttl
141
+ *
142
+ * @since 1.1.5
143
+ * @access public
144
+ */
145
+ public static function set_ttl( $val )
146
+ {
147
+ LiteSpeed_Cache_Control::set_custom_ttl( $val ) ;
148
+ }
149
+
150
+ /**
151
+ * Get current cache control ttl
152
+ *
153
+ * @since 1.1.5
154
+ * @access public
155
+ */
156
+ public static function get_ttl()
157
+ {
158
+ return LiteSpeed_Cache_Control::get_ttl() ;
159
+ }
160
+
161
+ /**
162
+ * Add public tag to cache
163
+ *
164
+ * @since 1.1.3
165
+ * @access public
166
+ */
167
+ public static function tag_add($tags)
168
+ {
169
+ LiteSpeed_Cache_Tag::add($tags) ;
170
+ }
171
+
172
+ /**
173
+ * Add vary
174
+ *
175
+ * @since 1.1.3
176
+ * @access public
177
+ */
178
+ public static function vary_add($vary)
179
+ {
180
+ LiteSpeed_Cache_Vary::add($vary) ;
181
+ }
182
+
183
+ /**
184
+ * Purge all action
185
+ *
186
+ * @since 1.1.3
187
+ * @access public
188
+ */
189
+ public static function purge_all()
190
+ {
191
+ LiteSpeed_Cache_Purge::purge_all() ;
192
+ }
193
+
194
+ /**
195
+ * Purge single action
196
+ *
197
+ * @since 1.3
198
+ * @access public
199
+ * @param int $pid The ID of a post
200
+ */
201
+ public static function purge_post( $pid )
202
+ {
203
+ LiteSpeed_Cache_Purge::purge_post( $pid ) ;
204
+ }
205
+
206
+ /**
207
+ * Add purge tags
208
+ *
209
+ * @since 1.1.3
210
+ * @access public
211
+ */
212
+ public static function purge($tags)
213
+ {
214
+ LiteSpeed_Cache_Purge::add($tags) ;
215
+ }
216
+
217
+ /**
218
+ * Build a switch div html snippet
219
+ *
220
+ * @since 1.1.3
221
+ * @access public
222
+ * @param string $id
223
+ * @param boolean $disabled Disable this field
224
+ * @param boolean $return Return the html or echo it
225
+ */
226
+ public static function build_switch($id, $disabled = false, $return = false)
227
+ {
228
+ return LiteSpeed_Cache_Admin_Display::get_instance()->build_switch($id, $disabled, $return) ;
229
+ }
230
+
231
+ /**
232
+ * Filter the value for checkbox via input and id (enabled/disabled)
233
+ *
234
+ * @since 1.1.6
235
+ * @access public
236
+ * @param int $input The whole input array
237
+ * @param string $id The ID of the option
238
+ * @return bool Filtered value
239
+ */
240
+ public static function parse_onoff( $input, $id )
241
+ {
242
+ return LiteSpeed_Cache_Admin_Settings::parse_onoff( $input, $id ) ;
243
+ }
244
+
245
+
246
+ /**
247
+ * Hook cacheable check to cache control
248
+ *
249
+ * @since 1.1.3
250
+ * @access public
251
+ */
252
+ public static function hook_control($hook)
253
+ {
254
+ add_action('litespeed_cache_api_control', $hook) ;
255
+ }
256
+
257
+ /**
258
+ * Hook tag appending to tag
259
+ *
260
+ * @since 1.1.3
261
+ * @access public
262
+ */
263
+ public static function hook_tag($hook)
264
+ {
265
+ add_action('litespeed_cache_api_tag', $hook) ;
266
+ }
267
+
268
+ /**
269
+ * Hook vary appending to vary
270
+ *
271
+ * NOTE: This will add vary to rewrite rule
272
+ *
273
+ * @since 1.1.3
274
+ * @access public
275
+ */
276
+ public static function hook_vary($hook)
277
+ {
278
+ add_action('litespeed_cache_api_vary', $hook) ;
279
+ }
280
+
281
+ /**
282
+ * Hook purge tags appending to purge
283
+ *
284
+ * @since 1.1.3
285
+ * @access public
286
+ */
287
+ public static function hook_purge($hook)
288
+ {
289
+ add_action('litespeed_cache_api_purge', $hook) ;
290
+ }
291
+
292
+ /**
293
+ * Hook purge post action to purge
294
+ *
295
+ * @since 1.1.3
296
+ * @access public
297
+ */
298
+ public static function hook_purge_post($hook)
299
+ {
300
+ add_action('litespeed_cache_api_purge_post', $hook) ;
301
+ }
302
+
303
+ /**
304
+ * Hook not ESI template
305
+ *
306
+ * @since 1.1.3
307
+ * @access public
308
+ */
309
+ public static function hook_tpl_not_esi($hook)
310
+ {
311
+ add_action('litespeed_cache_is_not_esi_template', $hook) ;
312
+ }
313
+
314
+ /**
315
+ * Hook ESI template block
316
+ *
317
+ * @since 1.1.3
318
+ * @access public
319
+ */
320
+ public static function hook_tpl_esi($block, $hook)
321
+ {
322
+ add_action('litespeed_cache_load_esi_block-' . $block, $hook) ;
323
+ }
324
+
325
+ /**
326
+ * Hook ESI params
327
+ *
328
+ * @since 1.1.3
329
+ * @access public
330
+ */
331
+ public static function hook_esi_param($block, $hook)
332
+ {
333
+ add_filter('litespeed_cache_sub_esi_params-' . $block, $hook) ;
334
+ }
335
+
336
+ /**
337
+ * Hook setting tab
338
+ *
339
+ * @since 1.1.3
340
+ * @access public
341
+ */
342
+ public static function hook_setting_tab($hook, $priority = 10, $args = 1)
343
+ {
344
+ add_filter('litespeed_cache_add_config_tab', $hook, $priority, $args) ;
345
+ }
346
+
347
+ /**
348
+ * Hook setting saving
349
+ *
350
+ * @since 1.1.3
351
+ * @access public
352
+ */
353
+ public static function hook_setting_save($hook, $priority = 10, $args = 1)
354
+ {
355
+ add_filter('litespeed_cache_save_options', $hook, $priority, $args) ;
356
+ }
357
+
358
+ /**
359
+ * Hook widget default settings value
360
+ *
361
+ * @since 1.1.3
362
+ * @access public
363
+ */
364
+ public static function hook_widget_default_options($hook, $priority = 10, $args = 1)
365
+ {
366
+ add_filter('litespeed_cache_widget_default_options', $hook, $priority, $args) ;
367
+ }
368
+
369
+ /**
370
+ * Hook get options value
371
+ *
372
+ * @since 1.1.3
373
+ * @access public
374
+ */
375
+ public static function hook_get_options($hook)
376
+ {
377
+ add_filter('litespeed_cache_get_options', $hook) ;
378
+ }
379
+
380
+ /**
381
+ * Generate ESI block url
382
+ *
383
+ * @since 1.1.3
384
+ * @access public
385
+ * @param string $control Cache control tag
386
+ */
387
+ public static function esi_url( $block_id, $wrapper, $params = array(), $control = 'default', $silence = false )
388
+ {
389
+ if ( $control === 'default' ) {
390
+ $control = 'private,no-vary' ;
391
+ }
392
+ return LiteSpeed_Cache_ESI::sub_esi_block( $block_id, $wrapper, $params, $control, $silence ) ;
393
+ }
394
+
395
+ /**
396
+ * Log debug info
397
+ *
398
+ * @since 1.1.3
399
+ * @access public
400
+ */
401
+ public static function debug($info)
402
+ {
403
+ LiteSpeed_Cache_Log::debug($info) ;
404
+ }
405
+
406
+ /**
407
+ * Get ESI enable setting value
408
+ *
409
+ * @since 1.2.0
410
+ * @access public
411
+ */
412
+ public static function esi_enabled()
413
+ {
414
+ return LiteSpeed_Cache_Router::esi_enabled() ;
415
+ }
416
+
417
+ /**
418
+ * Get cache enable setting value
419
+ *
420
+ * @since 1.3
421
+ * @access public
422
+ */
423
+ public static function cache_enabled()
424
+ {
425
+ return defined( 'LITESPEED_ON' ) ;
426
+ }
427
+
428
+ /**
429
+ * Get cfg setting value
430
+ *
431
+ * @since 1.1.3
432
+ * @access public
433
+ */
434
+ public static function config($id)
435
+ {
436
+ return LiteSpeed_Cache::config($id) ;
437
+ }
438
+
439
+ /**
440
+ * register 3rd party detect hooks
441
+ *
442
+ * @since 1.1.3
443
+ * @access public
444
+ */
445
+ public static function register($cls)
446
+ {
447
+ add_action('litespeed_cache_api_load_thirdparty', $cls . '::detect') ;
448
+ }
449
+
450
+ }
includes/litespeed-cache-cdn.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The CDN class.
5
  *
6
- * @since 1.2.3
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_CDN
@@ -25,6 +26,7 @@ class LiteSpeed_Cache_CDN
25
  private $cfg_cdn_inc_js ;
26
  private $cfg_cdn_filetype ;
27
  private $cfg_cdn_exclude ;
 
28
 
29
  /**
30
  * Init
@@ -43,6 +45,16 @@ class LiteSpeed_Cache_CDN
43
  return ;
44
  }
45
 
 
 
 
 
 
 
 
 
 
 
46
  $this->cfg_cdn = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN ) ;
47
  if ( ! $this->cfg_cdn ) {
48
  if ( ! defined( self::BYPASS ) ) {
@@ -391,6 +403,32 @@ class LiteSpeed_Cache_CDN
391
  return $url ;
392
  }
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  /**
395
  * Get the current instance object.
396
  *
3
  /**
4
  * The CDN class.
5
  *
6
+ * @since 1.2.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_CDN
26
  private $cfg_cdn_inc_js ;
27
  private $cfg_cdn_filetype ;
28
  private $cfg_cdn_exclude ;
29
+ private $cfg_cdn_remote_jquery ;
30
 
31
  /**
32
  * Init
45
  return ;
46
  }
47
 
48
+ /**
49
+ * Remotely load jQuery
50
+ * This is separate from CDN on/off
51
+ * @since 1.5
52
+ */
53
+ $this->cfg_cdn_remote_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN_REMOTE_JQUERY ) ;
54
+ if ( $this->cfg_cdn_remote_jquery ) {
55
+ add_action( 'init', array( $this, 'load_jquery_remotely' ) ) ;
56
+ }
57
+
58
  $this->cfg_cdn = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_CDN ) ;
59
  if ( ! $this->cfg_cdn ) {
60
  if ( ! defined( self::BYPASS ) ) {
403
  return $url ;
404
  }
405
 
406
+ /**
407
+ * Remote load jQuery remotely
408
+ *
409
+ * @since 1.5
410
+ * @access public
411
+ */
412
+ public function load_jquery_remotely()
413
+ {
414
+ // default jq version
415
+ $v = '1.12.4' ;
416
+
417
+ // load wp's jq version
418
+ global $wp_scripts ;
419
+ if ( isset( $wp_scripts->registered[ 'jquery' ]->ver ) ) {
420
+ $v = $wp_scripts->registered[ 'jquery' ]->ver ;
421
+ }
422
+
423
+ $src = $this->cfg_cdn_remote_jquery === LiteSpeed_Cache_Config::VAL_ON ? "//ajax.googleapis.com/ajax/libs/jquery/$v/jquery.min.js" : "//cdnjs.cloudflare.com/ajax/libs/jquery/$v/jquery.min.js" ;
424
+
425
+ LiteSpeed_Cache_Log::debug2( 'CDN: load_jquery_remotely: ' . $src ) ;
426
+
427
+ wp_deregister_script( 'jquery' ) ;
428
+
429
+ wp_register_script( 'jquery', $src, false, $v ) ;
430
+ }
431
+
432
  /**
433
  * Get the current instance object.
434
  *
includes/litespeed-cache-config.class.php CHANGED
@@ -4,10 +4,11 @@
4
  *
5
  * This maintains all the options and settings for this plugin.
6
  *
7
- * @since 1.0.0
8
- * @package LiteSpeed_Cache
9
- * @subpackage LiteSpeed_Cache/includes
10
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
11
  */
12
  class LiteSpeed_Cache_Config
13
  {
@@ -16,6 +17,9 @@ class LiteSpeed_Cache_Config
16
  const OPTION_NAME = 'litespeed-cache-conf' ;
17
  const VARY_GROUP = 'litespeed-cache-vary-group' ;
18
  const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
 
 
 
19
  const VAL_OFF = 0 ;
20
  const VAL_ON = 1 ;
21
  const VAL_ON2 = 2 ;
@@ -102,6 +106,7 @@ class LiteSpeed_Cache_Config
102
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
103
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
104
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
 
105
 
106
  const OPID_CDN = 'cdn' ;
107
  const OPID_CDN_ORI = 'cdn_ori' ;
@@ -111,8 +116,10 @@ class LiteSpeed_Cache_Config
111
  const OPID_CDN_INC_JS = 'cdn_inc_js' ;
112
  const OPID_CDN_FILETYPE = 'cdn_filetype' ;
113
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
 
114
 
115
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
 
116
  const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
117
 
118
  const HASH = 'hash' ;
@@ -474,6 +481,7 @@ class LiteSpeed_Cache_Config
474
  self::OPID_OPTM_JS_DEFER => false,
475
  self::OPID_OPTM_EMOJI_RM => false,
476
  self::OPID_OPTM_EXCLUDES => '',
 
477
 
478
  self::OPID_CDN => false,
479
  self::OPID_CDN_ORI => '',
@@ -483,8 +491,10 @@ class LiteSpeed_Cache_Config
483
  self::OPID_CDN_INC_JS => false,
484
  self::OPID_CDN_FILETYPE => ".aac\n.css\n.eot\n.gif\n.jpeg\n.js\n.jpg\n.less\n.mp3\n.mp4\n.ogg\n.otf\n.pdf\n.png\n.svg\n.ttf\n.woff",
485
  self::OPID_CDN_EXCLUDE => '',
 
486
 
487
  self::OPID_MEDIA_IMG_LAZY => false,
 
488
  self::OPID_MEDIA_IFRAME_LAZY => false,
489
 
490
  self::HASH => '',
4
  *
5
  * This maintains all the options and settings for this plugin.
6
  *
7
+ * @since 1.0.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
  class LiteSpeed_Cache_Config
14
  {
17
  const OPTION_NAME = 'litespeed-cache-conf' ;
18
  const VARY_GROUP = 'litespeed-cache-vary-group' ;
19
  const ITEM_OPTM_CSS = 'litespeed-optm-css' ;// separate critical css that should be stored in option table
20
+ const ITEM_OPTM_JS_DEFER_EXC = 'litespeed-optm-js-defer-excludes' ;
21
+ const ITEM_MEDIA_LAZY_IMG_EXC = 'litespeed-media-lazy-img-excludes' ;
22
+
23
  const VAL_OFF = 0 ;
24
  const VAL_ON = 1 ;
25
  const VAL_ON2 = 2 ;
106
  const OPID_OPTM_JS_DEFER = 'optm_js_defer' ;
107
  const OPID_OPTM_EMOJI_RM = 'optm_emoji_rm' ;
108
  const OPID_OPTM_EXCLUDES = 'optm_excludes' ;
109
+ const OPID_OPTM_EXC_JQUERY = 'optm_exclude_jquery' ;
110
 
111
  const OPID_CDN = 'cdn' ;
112
  const OPID_CDN_ORI = 'cdn_ori' ;
116
  const OPID_CDN_INC_JS = 'cdn_inc_js' ;
117
  const OPID_CDN_FILETYPE = 'cdn_filetype' ;
118
  const OPID_CDN_EXCLUDE = 'cdn_exclude' ;
119
+ const OPID_CDN_REMOTE_JQUERY = 'cdn_remote_jquery' ;
120
 
121
  const OPID_MEDIA_IMG_LAZY = 'media_img_lazy' ;
122
+ const OPID_MEDIA_IMG_LAZY_PLACEHOLDER = 'media_img_lazy_placeholder' ;
123
  const OPID_MEDIA_IFRAME_LAZY = 'media_iframe_lazy' ;
124
 
125
  const HASH = 'hash' ;
481
  self::OPID_OPTM_JS_DEFER => false,
482
  self::OPID_OPTM_EMOJI_RM => false,
483
  self::OPID_OPTM_EXCLUDES => '',
484
+ self::OPID_OPTM_EXC_JQUERY => true,
485
 
486
  self::OPID_CDN => false,
487
  self::OPID_CDN_ORI => '',
491
  self::OPID_CDN_INC_JS => false,
492
  self::OPID_CDN_FILETYPE => ".aac\n.css\n.eot\n.gif\n.jpeg\n.js\n.jpg\n.less\n.mp3\n.mp4\n.ogg\n.otf\n.pdf\n.png\n.svg\n.ttf\n.woff",
493
  self::OPID_CDN_EXCLUDE => '',
494
+ self::OPID_CDN_REMOTE_JQUERY => false,
495
 
496
  self::OPID_MEDIA_IMG_LAZY => false,
497
+ self::OPID_MEDIA_IMG_LAZY_PLACEHOLDER => '',
498
  self::OPID_MEDIA_IFRAME_LAZY => false,
499
 
500
  self::HASH => '',
includes/litespeed-cache-control.class.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * The plugin cache-control class for X-Litespeed-Cache-Control
4
  *
5
- * @since 1.1.3
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
  class LiteSpeed_Cache_Control
11
  {
2
  /**
3
  * The plugin cache-control class for X-Litespeed-Cache-Control
4
  *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
  class LiteSpeed_Cache_Control
12
  {
includes/litespeed-cache-crawler.class.php CHANGED
@@ -4,10 +4,11 @@
4
  * The crawler class
5
  *
6
  *
7
- * @since 1.1.0
8
- * @package LiteSpeed_Cache
9
- * @subpackage LiteSpeed_Cache/includes
10
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
11
  */
12
  class LiteSpeed_Cache_Crawler
13
  {
4
  * The crawler class
5
  *
6
  *
7
+ * @since 1.1.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
  class LiteSpeed_Cache_Crawler
14
  {
includes/litespeed-cache-esi.class.php CHANGED
@@ -5,10 +5,11 @@
5
  *
6
  * This is used to define all esi related functions.
7
  *
8
- * @since 1.1.3
9
- * @package LiteSpeed_Cache
10
- * @subpackage LiteSpeed_Cache/includes
11
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
12
  */
13
  class LiteSpeed_Cache_ESI
14
  {
5
  *
6
  * This is used to define all esi related functions.
7
  *
8
+ * @since 1.1.3
9
+ * @since 1.5 Moved into /inc
10
+ * @package LiteSpeed_Cache
11
+ * @subpackage LiteSpeed_Cache/inc
12
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
13
  */
14
  class LiteSpeed_Cache_ESI
15
  {
includes/litespeed-cache-gui.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The frontend GUI class.
5
  *
6
- * @since 1.3
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_GUI
3
  /**
4
  * The frontend GUI class.
5
  *
6
+ * @since 1.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_GUI
includes/litespeed-cache-log.class.php CHANGED
@@ -4,10 +4,11 @@
4
  *
5
  * This generate the valid action.
6
  *
7
- * @since 1.1.0
8
- * @package LiteSpeed_Cache
9
- * @subpackage LiteSpeed_Cache/includes
10
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
11
  */
12
  class LiteSpeed_Cache_Log
13
  {
4
  *
5
  * This generate the valid action.
6
  *
7
+ * @since 1.1.0
8
+ * @since 1.5 Moved into /inc
9
+ * @package LiteSpeed_Cache
10
+ * @subpackage LiteSpeed_Cache/inc
11
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
12
  */
13
  class LiteSpeed_Cache_Log
14
  {
includes/litespeed-cache-optimize.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The optimize class.
5
  *
6
- * @since 1.2.2
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
 
12
  class LiteSpeed_Cache_Optimize
@@ -28,7 +29,9 @@ class LiteSpeed_Cache_Optimize
28
  private $cfg_html_minify ;
29
  private $cfg_css_async ;
30
  private $cfg_js_defer ;
 
31
  private $cfg_qs_rm ;
 
32
 
33
 
34
  private $html_foot = '' ; // The html info append to <body>
@@ -60,6 +63,7 @@ class LiteSpeed_Cache_Optimize
60
  $this->cfg_css_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC ) ;
61
  $this->cfg_js_defer = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER ) ;
62
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
 
63
 
64
  $this->_static_request_check() ;
65
 
@@ -81,6 +85,18 @@ class LiteSpeed_Cache_Optimize
81
  if ( $this->cfg_css_async ) {
82
  add_action( 'wp_head', array( $this, 'prepend_critical_css' ), 1 ) ;
83
  }
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
  /**
@@ -300,7 +316,7 @@ class LiteSpeed_Cache_Optimize
300
 
301
  $snippet = '' ;
302
  foreach ( $urls as $url ) {
303
- $snippet .= "<link data-minified='1' rel='stylesheet' href='$url' />" ;
304
  }
305
 
306
  // Handle css async load
@@ -311,7 +327,7 @@ class LiteSpeed_Cache_Optimize
311
  $noscript .= $snippet ;
312
  $snippet = '' ;
313
  foreach ( $urls as $url ) {
314
- $snippet .= "<link rel='preload' data-preload='1' data-minified='1' as='style' onload='this.rel=\"stylesheet\"' href='$url' />" ;
315
  }
316
 
317
  $this->html_head .= implode( '', $ignored_html_async ) . $snippet ;
@@ -396,7 +412,7 @@ class LiteSpeed_Cache_Optimize
396
  if ( $head_js ) {
397
  $urls = $this->_limit_size_build_hash_url( $head_js, $file_size_list, 'js' ) ;
398
  foreach ( $urls as $url ) {
399
- $snippet .= "<script data-minified='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
400
 
401
  // Add to HTTP2
402
  $this->append_http2( $url, 'js' ) ;
@@ -411,7 +427,7 @@ class LiteSpeed_Cache_Optimize
411
  if ( $foot_js ) {
412
  $urls = $this->_limit_size_build_hash_url( $foot_js, $file_size_list, 'js' ) ;
413
  foreach ( $urls as $url ) {
414
- $snippet .= "<script data-minified='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
415
 
416
  // Add to HTTP2
417
  $this->append_http2( $url, 'js' ) ;
@@ -453,7 +469,7 @@ class LiteSpeed_Cache_Optimize
453
  // Append async compatibility lib to head
454
  if ( $this->cfg_css_async ) {
455
  $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
456
- $this->html_head .= "<script src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
457
  $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
458
  }
459
 
@@ -477,7 +493,7 @@ class LiteSpeed_Cache_Optimize
477
  try {
478
  litespeed_load_vendor() ;
479
  $this->content = Minify_HTML::minify( $this->content ) ;
480
- $this->content .= '<!-- Page minified by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
481
 
482
  } catch ( ErrorException $e ) {
483
  LiteSpeed_Cache_Control::debug( 'Error when optimizing HTML: ' . $e->getMessage() ) ;
@@ -547,7 +563,7 @@ class LiteSpeed_Cache_Optimize
547
  foreach ( $src_queue_list as $key => $src ) {
548
  $url = $this->_build_hash_url( $src, $file_type ) ;
549
  $snippet = str_replace( $src, $url, $html_list[ $key ] ) ;
550
- $snippet = str_replace( "<$tag ", "<$tag data-minified='1' ", $snippet ) ;
551
 
552
  $html_list[ $key ] = $snippet ;
553
 
@@ -570,7 +586,7 @@ class LiteSpeed_Cache_Optimize
570
  }
571
 
572
  /**
573
- * Check if links are internal or external
574
  *
575
  * @since 1.2.2
576
  * @access private
@@ -600,17 +616,39 @@ class LiteSpeed_Cache_Optimize
600
  foreach ( $excludes as $exclude ) {
601
  if ( stripos( $src, $exclude ) !== false ) {
602
  $ignored_html[] = $html_list[ $key ] ;
603
- LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes ' . $exclude ) ;
604
  continue 2 ;
605
  }
606
  }
607
  }
608
 
 
 
 
 
 
 
 
609
  // Check if is external URL
610
  $url_parsed = parse_url( $src ) ;
611
  if ( ! $file_info = $this->_is_file_url( $src ) ) {
612
  $ignored_html[ $src ] = $html_list[ $key ] ;
613
- LiteSpeed_Cache_Log::debug2( 'Optm: Abort external/non-exist ' ) ;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
614
  continue ;
615
  }
616
 
@@ -782,7 +820,7 @@ class LiteSpeed_Cache_Optimize
782
  }
783
  $attrs = LiteSpeed_Cache_Utility::parse_attr( $match[ 1 ] ) ;
784
 
785
- if ( ! empty( $attrs[ 'data-minified' ] ) ) {
786
  continue ;
787
  }
788
  if ( empty( $attrs[ 'src' ] ) ) {
@@ -831,7 +869,10 @@ class LiteSpeed_Cache_Optimize
831
  if ( empty( $attrs[ 'rel' ] ) || $attrs[ 'rel' ] !== 'stylesheet' ) {
832
  continue ;
833
  }
834
- if ( ! empty( $attrs[ 'data-minified' ] ) ) {
 
 
 
835
  continue ;
836
  }
837
  if ( ! empty( $attrs[ 'media' ] ) && strpos( $attrs[ 'media' ], 'print' ) !== false ) {
@@ -873,11 +914,21 @@ class LiteSpeed_Cache_Optimize
873
  {
874
  $noscript = '' ;
875
  foreach ( $html_list as $k => $ori ) {
 
 
 
 
 
 
 
 
 
 
876
  // Append to noscript content
877
  $noscript .= $ori ;
878
  // async replacement
879
  $v = str_replace( 'stylesheet', 'preload', $ori ) ;
880
- $v = str_replace( '<link', "<link data-preload='1' as='style' onload='this.rel=\"stylesheet\"' ", $v ) ;
881
  $html_list[ $k ] = $v ;
882
  }
883
  return array( $noscript, $html_list ) ;
@@ -898,16 +949,75 @@ class LiteSpeed_Cache_Optimize
898
  if ( strpos( $v, 'defer' ) !== false ) {
899
  continue ;
900
  }
901
- if ( strpos( $v, 'data-defer' ) !== false ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
902
  continue ;
903
  }
904
 
905
- $html_list[ $k ] = str_replace( '></script>', ' defer></script>', $v ) ;
906
  }
907
 
908
  return $html_list ;
909
  }
910
 
 
 
 
 
 
 
 
 
 
 
 
911
  /**
912
  * Append to HTTP2 header
913
  *
3
  /**
4
  * The optimize class.
5
  *
6
+ * @since 1.2.2
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
 
13
  class LiteSpeed_Cache_Optimize
29
  private $cfg_html_minify ;
30
  private $cfg_css_async ;
31
  private $cfg_js_defer ;
32
+ private $cfg_js_defer_exc = false ;
33
  private $cfg_qs_rm ;
34
+ private $cfg_exc_jquery ;
35
 
36
 
37
  private $html_foot = '' ; // The html info append to <body>
63
  $this->cfg_css_async = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_CSS_ASYNC ) ;
64
  $this->cfg_js_defer = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_JS_DEFER ) ;
65
  $this->cfg_qs_rm = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_QS_RM ) ;
66
+ $this->cfg_exc_jquery = LiteSpeed_Cache::config( LiteSpeed_Cache_Config::OPID_OPTM_EXC_JQUERY ) ;
67
 
68
  $this->_static_request_check() ;
69
 
85
  if ( $this->cfg_css_async ) {
86
  add_action( 'wp_head', array( $this, 'prepend_critical_css' ), 1 ) ;
87
  }
88
+
89
+ /**
90
+ * Exclude js from deferred setting
91
+ * @since 1.5
92
+ */
93
+ if ( $this->cfg_js_defer ) {
94
+ $this->cfg_js_defer_exc = apply_filters( 'litespeed_optm_js_defer_exc', get_option( LiteSpeed_Cache_Config::ITEM_OPTM_JS_DEFER_EXC ) ) ;
95
+ if ( $this->cfg_js_defer_exc ) {
96
+ $this->cfg_js_defer_exc = explode( "\n", $this->cfg_js_defer_exc ) ;
97
+ }
98
+ }
99
+
100
  }
101
 
102
  /**
316
 
317
  $snippet = '' ;
318
  foreach ( $urls as $url ) {
319
+ $snippet .= "<link data-optimized='2' rel='stylesheet' href='$url' />" ;// use 2 as combined
320
  }
321
 
322
  // Handle css async load
327
  $noscript .= $snippet ;
328
  $snippet = '' ;
329
  foreach ( $urls as $url ) {
330
+ $snippet .= "<link rel='preload' data-asynced='1' data-optimized='2' as='style' onload='this.rel=\"stylesheet\"' href='$url' />" ;
331
  }
332
 
333
  $this->html_head .= implode( '', $ignored_html_async ) . $snippet ;
412
  if ( $head_js ) {
413
  $urls = $this->_limit_size_build_hash_url( $head_js, $file_size_list, 'js' ) ;
414
  foreach ( $urls as $url ) {
415
+ $snippet .= "<script data-optimized='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
416
 
417
  // Add to HTTP2
418
  $this->append_http2( $url, 'js' ) ;
427
  if ( $foot_js ) {
428
  $urls = $this->_limit_size_build_hash_url( $foot_js, $file_size_list, 'js' ) ;
429
  foreach ( $urls as $url ) {
430
+ $snippet .= "<script data-optimized='1' src='$url' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;
431
 
432
  // Add to HTTP2
433
  $this->append_http2( $url, 'js' ) ;
469
  // Append async compatibility lib to head
470
  if ( $this->cfg_css_async ) {
471
  $css_async_lib_url = LiteSpeed_Cache_Utility::get_permalink_url( self::CSS_ASYNC_LIB ) ;
472
+ $this->html_head .= "<script src='" . $css_async_lib_url . "' " . ( $this->cfg_js_defer ? 'defer' : '' ) . "></script>" ;// Don't exclude it from defer for now
473
  $this->append_http2( $css_async_lib_url, 'js' ) ; // async lib will be http/2 pushed always
474
  }
475
 
493
  try {
494
  litespeed_load_vendor() ;
495
  $this->content = Minify_HTML::minify( $this->content ) ;
496
+ $this->content .= '<!-- Page optimized by LiteSpeed Cache on '.date('Y-m-d H:i:s').' -->' ;
497
 
498
  } catch ( ErrorException $e ) {
499
  LiteSpeed_Cache_Control::debug( 'Error when optimizing HTML: ' . $e->getMessage() ) ;
563
  foreach ( $src_queue_list as $key => $src ) {
564
  $url = $this->_build_hash_url( $src, $file_type ) ;
565
  $snippet = str_replace( $src, $url, $html_list[ $key ] ) ;
566
+ $snippet = str_replace( "<$tag ", "<$tag data-optimized='1' ", $snippet ) ;
567
 
568
  $html_list[ $key ] = $snippet ;
569
 
586
  }
587
 
588
  /**
589
+ * Check that links are internal or external
590
  *
591
  * @since 1.2.2
592
  * @access private
616
  foreach ( $excludes as $exclude ) {
617
  if ( stripos( $src, $exclude ) !== false ) {
618
  $ignored_html[] = $html_list[ $key ] ;
619
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: ' . $exclude ) ;
620
  continue 2 ;
621
  }
622
  }
623
  }
624
 
625
+ // Check if has no-optimize attr
626
+ if ( strpos( $html_list[ $key ], 'data-no-optimize' ) !== false ) {
627
+ $ignored_html[] = $html_list[ $key ] ;
628
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort excludes: attr data-no-optimize' ) ;
629
+ continue ;
630
+ }
631
+
632
  // Check if is external URL
633
  $url_parsed = parse_url( $src ) ;
634
  if ( ! $file_info = $this->_is_file_url( $src ) ) {
635
  $ignored_html[ $src ] = $html_list[ $key ] ;
636
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort external/non-exist' ) ;
637
+ continue ;
638
+ }
639
+
640
+ /**
641
+ * Check if exclude jQuery or not
642
+ * Exclude from minify/combine
643
+ * @since 1.5
644
+ */
645
+ if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
646
+ $ignored_html[ $src ] = $html_list[ $key ] ;
647
+ LiteSpeed_Cache_Log::debug2( 'Optm: Abort jQuery by setting' ) ;
648
+
649
+ // Add to HTTP2 as its ignored but still internal src
650
+ $this->append_http2( $src, 'js' ) ;
651
+
652
  continue ;
653
  }
654
 
820
  }
821
  $attrs = LiteSpeed_Cache_Utility::parse_attr( $match[ 1 ] ) ;
822
 
823
+ if ( ! empty( $attrs[ 'data-optimized' ] ) ) {
824
  continue ;
825
  }
826
  if ( empty( $attrs[ 'src' ] ) ) {
869
  if ( empty( $attrs[ 'rel' ] ) || $attrs[ 'rel' ] !== 'stylesheet' ) {
870
  continue ;
871
  }
872
+ if ( ! empty( $attrs[ 'data-optimized' ] ) ) {
873
+ continue ;
874
+ }
875
+ if ( ! empty( $attrs[ 'data-no-optimize' ] ) ) {
876
  continue ;
877
  }
878
  if ( ! empty( $attrs[ 'media' ] ) && strpos( $attrs[ 'media' ], 'print' ) !== false ) {
914
  {
915
  $noscript = '' ;
916
  foreach ( $html_list as $k => $ori ) {
917
+ if ( strpos( $ori, 'data-asynced' ) !== false ) {
918
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-asynced exist' ) ;
919
+ continue ;
920
+ }
921
+
922
+ if ( strpos( $ori, 'data-no-async' ) !== false ) {
923
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-async' ) ;
924
+ continue ;
925
+ }
926
+
927
  // Append to noscript content
928
  $noscript .= $ori ;
929
  // async replacement
930
  $v = str_replace( 'stylesheet', 'preload', $ori ) ;
931
+ $v = str_replace( '<link', "<link data-asynced='1' as='style' onload='this.rel=\"stylesheet\"' ", $v ) ;
932
  $html_list[ $k ] = $v ;
933
  }
934
  return array( $noscript, $html_list ) ;
949
  if ( strpos( $v, 'defer' ) !== false ) {
950
  continue ;
951
  }
952
+ if ( strpos( $v, 'data-deferred' ) !== false ) {
953
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr data-deferred exist' ) ;
954
+ continue ;
955
+ }
956
+ if ( strpos( $v, 'data-no-defer' ) !== false ) {
957
+ LiteSpeed_Cache_Log::debug2( 'Optm bypass: attr api data-no-defer' ) ;
958
+ continue ;
959
+ }
960
+
961
+ /**
962
+ * Parse src for excluding js from setting
963
+ * @since 1.5
964
+ */
965
+ if ( $this->cfg_js_defer_exc || $this->cfg_exc_jquery ) {
966
+ // parse js src
967
+ preg_match( '#<script \s*([^>]+)>#isU', $v, $matches ) ;
968
+ if ( empty( $matches[ 1 ] ) ) {
969
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer parse html failed: ' . $v ) ;
970
+ continue ;
971
+ }
972
+
973
+ $attrs = LiteSpeed_Cache_Utility::parse_attr( $matches[ 1 ] ) ;
974
+
975
+ if ( empty( $attrs[ 'src' ] ) ) {
976
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer parse src failed: ' . $matches[ 1 ] ) ;
977
+ continue ;
978
+ }
979
+
980
+ $src = $attrs[ 'src' ] ;
981
+ }
982
+
983
+ /**
984
+ * Exclude js from setting
985
+ * @since 1.5
986
+ */
987
+ if ( $this->cfg_js_defer_exc ) {
988
+
989
+ if ( LiteSpeed_Cache_Utility::str_hit_array( $src, $this->cfg_js_defer_exc ) ) {
990
+ LiteSpeed_Cache_Log::debug( 'Optm: js defer exclude ' . $src ) ;
991
+ continue ;
992
+ }
993
+ }
994
+
995
+ /**
996
+ * Check if exclude jQuery
997
+ * @since 1.5
998
+ */
999
+ if ( $this->cfg_exc_jquery && $this->_is_jquery( $src ) ) {
1000
+ LiteSpeed_Cache_Log::debug2( 'Optm: js defer Abort jQuery by setting' ) ;
1001
  continue ;
1002
  }
1003
 
1004
+ $html_list[ $k ] = str_replace( '></script>', ' defer data-deferred="1"></script>', $v ) ;
1005
  }
1006
 
1007
  return $html_list ;
1008
  }
1009
 
1010
+ /**
1011
+ * Check if is jq lib
1012
+ *
1013
+ * @since 1.5
1014
+ * @access private
1015
+ */
1016
+ private function _is_jquery( $src )
1017
+ {
1018
+ return stripos( $src, 'jquery.js' ) !== false || stripos( $src, 'jquery.min.js' ) !== false ;
1019
+ }
1020
+
1021
  /**
1022
  * Append to HTTP2 header
1023
  *
includes/litespeed-cache-purge.class.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * The plugin purge class for X-LiteSpeed-Purge
4
  *
5
- * @since 1.1.3
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
  class LiteSpeed_Cache_Purge
11
  {
2
  /**
3
  * The plugin purge class for X-LiteSpeed-Purge
4
  *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
  class LiteSpeed_Cache_Purge
12
  {
includes/litespeed-cache-router.class.php CHANGED
@@ -5,10 +5,11 @@
5
  *
6
  * This generate the valid action.
7
  *
8
- * @since 1.1.0
9
- * @package LiteSpeed_Cache
10
- * @subpackage LiteSpeed_Cache/includes
11
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
12
  */
13
  class LiteSpeed_Cache_Router
14
  {
@@ -234,7 +235,7 @@ class LiteSpeed_Cache_Router
234
 
235
  // Each action must have a valid nonce unless its from admin ip and is public action
236
  // Validate requests nonce (from admin logged in page or cli)
237
- if ( ! $this->verify_nonce( $action ) ) {
238
  // check if it is from admin ip
239
  if ( ! $this->is_admin_ip() ) {
240
  LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL query string - did not match admin IP: ' . $action ) ;
@@ -322,11 +323,16 @@ class LiteSpeed_Cache_Router
322
  case LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE:
323
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
324
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
 
325
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
326
  self::$_action = $action ;
327
  }
328
  return ;
329
 
 
 
 
 
330
  case LiteSpeed_Cache::ACTION_DISMISS_WHM:
331
  case LiteSpeed_Cache::ACTION_DISMISS_EXPIRESDEFAULT:
332
  case LiteSpeed_Cache::ACTION_DISMISS_PROMO:
@@ -342,6 +348,19 @@ class LiteSpeed_Cache_Router
342
 
343
  }
344
 
 
 
 
 
 
 
 
 
 
 
 
 
 
345
  /**
346
  * Verify nonce
347
  *
5
  *
6
  * This generate the valid action.
7
  *
8
+ * @since 1.1.0
9
+ * @since 1.5 Moved into /inc
10
+ * @package LiteSpeed_Cache
11
+ * @subpackage LiteSpeed_Cache/inc
12
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
13
  */
14
  class LiteSpeed_Cache_Router
15
  {
235
 
236
  // Each action must have a valid nonce unless its from admin ip and is public action
237
  // Validate requests nonce (from admin logged in page or cli)
238
+ if ( ! $this->verify_nonce( $action ) && ! $this->_verify_sapi_token( $action ) ) {
239
  // check if it is from admin ip
240
  if ( ! $this->is_admin_ip() ) {
241
  LiteSpeed_Cache_Log::debug( 'LSCWP_CTRL query string - did not match admin IP: ' . $action ) ;
323
  case LiteSpeed_Cache::ACTION_CRAWLER_CRON_ENABLE:
324
  case LiteSpeed_Cache::ACTION_DO_CRAWL:
325
  case LiteSpeed_Cache::ACTION_BLACKLIST_SAVE:
326
+ case LiteSpeed_Cache::ACTION_SAPI_PROCEED:
327
  if ( defined( 'LITESPEED_ON' ) && $_can_option && ! $_is_network_admin ) {
328
  self::$_action = $action ;
329
  }
330
  return ;
331
 
332
+ case LiteSpeed_Cache::ACTION_SAPI_CALLBACK : // as long as it passed nonce check
333
+ self::$_action = $action ;
334
+ return ;
335
+
336
  case LiteSpeed_Cache::ACTION_DISMISS_WHM:
337
  case LiteSpeed_Cache::ACTION_DISMISS_EXPIRESDEFAULT:
338
  case LiteSpeed_Cache::ACTION_DISMISS_PROMO:
348
 
349
  }
350
 
351
+ /**
352
+ * Verify sapi token
353
+ *
354
+ * @since 1.5
355
+ * @access private
356
+ * @param string $action
357
+ * @return bool
358
+ */
359
+ private function _verify_sapi_token( $action )
360
+ {
361
+ return LiteSpeed_Cache_Admin_API::sapi_token_check() && $action === LiteSpeed_Cache::ACTION_SAPI_CALLBACK ;
362
+ }
363
+
364
  /**
365
  * Verify nonce
366
  *
includes/litespeed-cache-tag.class.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * The plugin cache-tag class for X-LiteSpeed-Tag
4
  *
5
- * @since 1.1.3
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
  class LiteSpeed_Cache_Tag
11
  {
2
  /**
3
  * The plugin cache-tag class for X-LiteSpeed-Tag
4
  *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
  class LiteSpeed_Cache_Tag
12
  {
includes/litespeed-cache-task.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The cron task class.
5
  *
6
- * @since 1.1.3
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
  class LiteSpeed_Cache_Task
12
  {
3
  /**
4
  * The cron task class.
5
  *
6
+ * @since 1.1.3
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
  class LiteSpeed_Cache_Task
13
  {
includes/litespeed-cache-utility.class.php CHANGED
@@ -3,10 +3,11 @@
3
  /**
4
  * The utility class.
5
  *
6
- * @since 1.1.5
7
- * @package LiteSpeed_Cache
8
- * @subpackage LiteSpeed_Cache/includes
9
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
10
  */
11
  class LiteSpeed_Cache_Utility
12
  {
3
  /**
4
  * The utility class.
5
  *
6
+ * @since 1.1.5
7
+ * @since 1.5 Moved into /inc
8
+ * @package LiteSpeed_Cache
9
+ * @subpackage LiteSpeed_Cache/inc
10
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
11
  */
12
  class LiteSpeed_Cache_Utility
13
  {
includes/litespeed-cache-vary.class.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * The plugin vary class to manage X-LiteSpeed-Vary
4
  *
5
- * @since 1.1.3
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
  class LiteSpeed_Cache_Vary
11
  {
2
  /**
3
  * The plugin vary class to manage X-LiteSpeed-Vary
4
  *
5
+ * @since 1.1.3
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
  class LiteSpeed_Cache_Vary
12
  {
includes/litespeed-cache.class.php CHANGED
@@ -8,17 +8,18 @@
8
  * Also maintains the unique identifier of this plugin as well as the current
9
  * version of the plugin.
10
  *
11
- * @since 1.0.0
12
- * @package LiteSpeed_Cache
13
- * @subpackage LiteSpeed_Cache/includes
14
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
15
  */
16
  class LiteSpeed_Cache
17
  {
18
  private static $_instance ;
19
 
20
  const PLUGIN_NAME = 'litespeed-cache' ;
21
- const PLUGIN_VERSION = '1.4' ;
22
 
23
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
24
 
@@ -54,6 +55,9 @@ class LiteSpeed_Cache
54
 
55
  const ACTION_DB_OPTIMIZE = 'db_optimize' ;
56
 
 
 
 
57
  const WHM_TRANSIENT = 'lscwp_whm_install' ;
58
  const WHM_TRANSIENT_VAL = 'whm_install' ;
59
 
@@ -61,6 +65,8 @@ class LiteSpeed_Cache
61
 
62
  protected static $_debug_show_header = false ;
63
 
 
 
64
  /**
65
  * Define the core functionality of the plugin.
66
  *
@@ -284,6 +290,14 @@ class LiteSpeed_Cache
284
  $msg = LiteSpeed_Cache_Admin_Optimize::run_db_clean() ;
285
  break ;
286
 
 
 
 
 
 
 
 
 
287
  default:
288
  break ;
289
  }
@@ -366,6 +380,7 @@ class LiteSpeed_Cache
366
  */
367
  public static function footer_hook()
368
  {
 
369
  if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
370
  define( 'LITESPEED_FOOTER_CALLED', true ) ;
371
  }
@@ -380,14 +395,17 @@ class LiteSpeed_Cache
380
  private function _check_is_html( $buffer = null )
381
  {
382
  if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
 
383
  return ;
384
  }
385
 
386
  if ( defined( 'DOING_AJAX' ) ) {
 
387
  return ;
388
  }
389
 
390
  if ( defined( 'DOING_CRON' ) ) {
 
391
  return ;
392
  }
393
 
@@ -445,7 +463,11 @@ class LiteSpeed_Cache
445
 
446
  $buffer = LiteSpeed_Cache_CDN::run( $buffer ) ;
447
 
448
- $buffer .= $this->send_headers( true ) ;
 
 
 
 
449
 
450
  LiteSpeed_Cache_Log::debug( "End response\n--------------------------------------------------------------------------------\n" ) ;
451
 
@@ -497,13 +519,13 @@ class LiteSpeed_Cache
497
  LiteSpeed_Cache_Log::debug( 'ESI silence' ) ;
498
  }
499
 
500
- $comment = '' ;
501
  if ( $running_info_showing ) {
502
- $comment .= sprintf(
503
- '<!-- %1$s %2$s by LiteSpeed Cache on %3$s -->',
504
  defined( 'LSCACHE_IS_ESI' ) ? 'Block' : 'Page',
505
  LiteSpeed_Cache_Control::is_cacheable() ? 'generated' : 'uncached',
506
- date( 'Y-m-d H:i:s', time() + LITESPEED_TIME_OFFSET )
 
507
  ) ;
508
  }
509
 
@@ -513,7 +535,7 @@ class LiteSpeed_Cache
513
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
514
  LiteSpeed_Cache_Log::push( $control_header ) ;
515
  if ( $running_info_showing ) {
516
- $comment .= "\n<!-- " . $control_header . " -->" ;
517
  }
518
  }
519
  }
@@ -523,7 +545,7 @@ class LiteSpeed_Cache
523
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
524
  LiteSpeed_Cache_Log::push( $purge_header ) ;
525
  if ( $running_info_showing ) {
526
- $comment .= "\n<!-- " . $purge_header . " -->" ;
527
  }
528
  }
529
  }
@@ -533,7 +555,7 @@ class LiteSpeed_Cache
533
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
534
  LiteSpeed_Cache_Log::push( $vary_header ) ;
535
  if ( $running_info_showing ) {
536
- $comment .= "\n<!-- " . $vary_header . " -->" ;
537
  }
538
  }
539
  }
@@ -563,7 +585,7 @@ class LiteSpeed_Cache
563
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
564
  LiteSpeed_Cache_Log::push( $tag_header ) ;
565
  if ( $running_info_showing ) {
566
- $comment .= "\n<!-- " . $tag_header . " -->" ;
567
  }
568
  }
569
  }
@@ -573,14 +595,6 @@ class LiteSpeed_Cache
573
  LiteSpeed_Cache_Log::debug( '--forced--' ) ;
574
  }
575
 
576
- if ( $comment ) {
577
- if ( $is_forced ) {
578
- return $comment ;
579
- }
580
- else {
581
- echo $comment ;
582
- }
583
- }
584
  }
585
 
586
  /**
8
  * Also maintains the unique identifier of this plugin as well as the current
9
  * version of the plugin.
10
  *
11
+ * @since 1.0.0
12
+ * @since 1.5 Moved into /inc
13
+ * @package LiteSpeed_Cache
14
+ * @subpackage LiteSpeed_Cache/inc
15
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
16
  */
17
  class LiteSpeed_Cache
18
  {
19
  private static $_instance ;
20
 
21
  const PLUGIN_NAME = 'litespeed-cache' ;
22
+ const PLUGIN_VERSION = '1.5' ;
23
 
24
  const PAGE_EDIT_HTACCESS = 'lscache-edit-htaccess' ;
25
 
55
 
56
  const ACTION_DB_OPTIMIZE = 'db_optimize' ;
57
 
58
+ const ACTION_SAPI_PROCEED = 'sapi_proceed' ;
59
+ const ACTION_SAPI_CALLBACK = 'sapi_callback' ;
60
+
61
  const WHM_TRANSIENT = 'lscwp_whm_install' ;
62
  const WHM_TRANSIENT_VAL = 'whm_install' ;
63
 
65
 
66
  protected static $_debug_show_header = false ;
67
 
68
+ private $footer_comment = '' ;
69
+
70
  /**
71
  * Define the core functionality of the plugin.
72
  *
290
  $msg = LiteSpeed_Cache_Admin_Optimize::run_db_clean() ;
291
  break ;
292
 
293
+ case LiteSpeed_Cache::ACTION_SAPI_PROCEED:
294
+ $msg = LiteSpeed_Cache_Admin_API::sapi_proceed() ;
295
+ break ;
296
+
297
+ case LiteSpeed_Cache::ACTION_SAPI_CALLBACK:
298
+ LiteSpeed_Cache_Admin_API::sapi_callback() ;
299
+ break ;
300
+
301
  default:
302
  break ;
303
  }
380
  */
381
  public static function footer_hook()
382
  {
383
+ LiteSpeed_Cache_Log::debug( 'Footer hook called' ) ;
384
  if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
385
  define( 'LITESPEED_FOOTER_CALLED', true ) ;
386
  }
395
  private function _check_is_html( $buffer = null )
396
  {
397
  if ( ! defined( 'LITESPEED_FOOTER_CALLED' ) ) {
398
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: miss footer const' ) ;
399
  return ;
400
  }
401
 
402
  if ( defined( 'DOING_AJAX' ) ) {
403
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing ajax' ) ;
404
  return ;
405
  }
406
 
407
  if ( defined( 'DOING_CRON' ) ) {
408
+ LiteSpeed_Cache_Log::debug2( 'CHK html bypass: doing cron' ) ;
409
  return ;
410
  }
411
 
463
 
464
  $buffer = LiteSpeed_Cache_CDN::run( $buffer ) ;
465
 
466
+ $this->send_headers( true ) ;
467
+
468
+ if ( $this->footer_comment ) {
469
+ $buffer .= $this->footer_comment ;
470
+ }
471
 
472
  LiteSpeed_Cache_Log::debug( "End response\n--------------------------------------------------------------------------------\n" ) ;
473
 
519
  LiteSpeed_Cache_Log::debug( 'ESI silence' ) ;
520
  }
521
 
 
522
  if ( $running_info_showing ) {
523
+ $this->footer_comment .= sprintf(
524
+ '<!-- %1$s %2$s by LiteSpeed Cache %4$s on %3$s -->',
525
  defined( 'LSCACHE_IS_ESI' ) ? 'Block' : 'Page',
526
  LiteSpeed_Cache_Control::is_cacheable() ? 'generated' : 'uncached',
527
+ date( 'Y-m-d H:i:s', time() + LITESPEED_TIME_OFFSET ),
528
+ self::PLUGIN_VERSION
529
  ) ;
530
  }
531
 
535
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
536
  LiteSpeed_Cache_Log::push( $control_header ) ;
537
  if ( $running_info_showing ) {
538
+ $this->footer_comment .= "\n<!-- " . $control_header . " -->" ;
539
  }
540
  }
541
  }
545
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
546
  LiteSpeed_Cache_Log::push( $purge_header ) ;
547
  if ( $running_info_showing ) {
548
+ $this->footer_comment .= "\n<!-- " . $purge_header . " -->" ;
549
  }
550
  }
551
  }
555
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
556
  LiteSpeed_Cache_Log::push( $vary_header ) ;
557
  if ( $running_info_showing ) {
558
+ $this->footer_comment .= "\n<!-- " . $vary_header . " -->" ;
559
  }
560
  }
561
  }
585
  if ( LiteSpeed_Cache_Log::get_enabled() ) {
586
  LiteSpeed_Cache_Log::push( $tag_header ) ;
587
  if ( $running_info_showing ) {
588
+ $this->footer_comment .= "\n<!-- " . $tag_header . " -->" ;
589
  }
590
  }
591
  }
595
  LiteSpeed_Cache_Log::debug( '--forced--' ) ;
596
  }
597
 
 
 
 
 
 
 
 
 
598
  }
599
 
600
  /**
includes/litespeed.autoload.php CHANGED
@@ -2,10 +2,11 @@
2
  /**
3
  * Auto registration for LiteSpeed classes
4
  *
5
- * @since 1.1.0
6
- * @package LiteSpeed_Cache
7
- * @subpackage LiteSpeed_Cache/includes
8
- * @author LiteSpeed Technologies <info@litespeedtech.com>
 
9
  */
10
 
11
  if ( ! defined('WPINC') ) {
@@ -21,28 +22,29 @@ if ( !function_exists('_litespeed_autoload') ) {
21
  'Litespeed_File' => 'lib/litespeed/litespeed-file.class.php',
22
  'Litespeed_String' => 'lib/litespeed/litespeed-string.class.php',
23
 
24
- 'LiteSpeed_Cache' => 'includes/litespeed-cache.class.php',
25
- 'LiteSpeed_Cache_Activation' => 'includes/litespeed-cache-activation.class.php',
26
  'LiteSpeed_Cache_API' => 'inc/api.class.php',
27
- 'LiteSpeed_Cache_CDN' => 'includes/litespeed-cache-cdn.class.php',
28
- 'LiteSpeed_Cache_Config' => 'includes/litespeed-cache-config.class.php',
29
- 'LiteSpeed_Cache_Control' => 'includes/litespeed-cache-control.class.php',
30
- 'LiteSpeed_Cache_Crawler' => 'includes/litespeed-cache-crawler.class.php',
31
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
32
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
33
- 'LiteSpeed_Cache_ESI' => 'includes/litespeed-cache-esi.class.php',
34
- 'LiteSpeed_Cache_GUI' => 'includes/litespeed-cache-gui.class.php',
35
- 'LiteSpeed_Cache_Log' => 'includes/litespeed-cache-log.class.php',
36
  'LiteSpeed_Cache_Media' => 'inc/media.class.php',
37
- 'LiteSpeed_Cache_Optimize' => 'includes/litespeed-cache-optimize.class.php',
38
- 'LiteSpeed_Cache_Purge' => 'includes/litespeed-cache-purge.class.php',
39
- 'LiteSpeed_Cache_Router' => 'includes/litespeed-cache-router.class.php',
40
- 'LiteSpeed_Cache_Tag' => 'includes/litespeed-cache-tag.class.php',
41
- 'LiteSpeed_Cache_Task' => 'includes/litespeed-cache-task.class.php',
42
- 'LiteSpeed_Cache_Vary' => 'includes/litespeed-cache-vary.class.php',
43
- 'LiteSpeed_Cache_Utility' => 'includes/litespeed-cache-utility.class.php',
44
 
45
  'LiteSpeed_Cache_Admin' => 'admin/litespeed-cache-admin.class.php',
 
46
  'LiteSpeed_Cache_Admin_Display' => 'admin/litespeed-cache-admin-display.class.php',
47
  'LiteSpeed_Cache_Admin_Error' => 'admin/litespeed-cache-admin-error.class.php',
48
  'LiteSpeed_Cache_Admin_Optimize' => 'admin/litespeed-cache-admin-optimize.class.php',
2
  /**
3
  * Auto registration for LiteSpeed classes
4
  *
5
+ * @since 1.1.0
6
+ * @since 1.5 Moved into /inc
7
+ * @package LiteSpeed_Cache
8
+ * @subpackage LiteSpeed_Cache/inc
9
+ * @author LiteSpeed Technologies <info@litespeedtech.com>
10
  */
11
 
12
  if ( ! defined('WPINC') ) {
22
  'Litespeed_File' => 'lib/litespeed/litespeed-file.class.php',
23
  'Litespeed_String' => 'lib/litespeed/litespeed-string.class.php',
24
 
25
+ 'LiteSpeed_Cache' => 'inc/litespeed-cache.class.php',
26
+ 'LiteSpeed_Cache_Activation' => 'inc/activation.class.php',
27
  'LiteSpeed_Cache_API' => 'inc/api.class.php',
28
+ 'LiteSpeed_Cache_CDN' => 'inc/cdn.class.php',
29
+ 'LiteSpeed_Cache_Config' => 'inc/config.class.php',
30
+ 'LiteSpeed_Cache_Control' => 'inc/control.class.php',
31
+ 'LiteSpeed_Cache_Crawler' => 'inc/crawler.class.php',
32
  'LiteSpeed_Cache_Crawler_Sitemap' => 'inc/crawler-sitemap.class.php',
33
  'LiteSpeed_Cache_Data' => 'inc/data.class.php',
34
+ 'LiteSpeed_Cache_ESI' => 'inc/esi.class.php',
35
+ 'LiteSpeed_Cache_GUI' => 'inc/gui.class.php',
36
+ 'LiteSpeed_Cache_Log' => 'inc/log.class.php',
37
  'LiteSpeed_Cache_Media' => 'inc/media.class.php',
38
+ 'LiteSpeed_Cache_Optimize' => 'inc/optimize.class.php',
39
+ 'LiteSpeed_Cache_Purge' => 'inc/purge.class.php',
40
+ 'LiteSpeed_Cache_Router' => 'inc/router.class.php',
41
+ 'LiteSpeed_Cache_Tag' => 'inc/tag.class.php',
42
+ 'LiteSpeed_Cache_Task' => 'inc/task.class.php',
43
+ 'LiteSpeed_Cache_Vary' => 'inc/vary.class.php',
44
+ 'LiteSpeed_Cache_Utility' => 'inc/utility.class.php',
45
 
46
  'LiteSpeed_Cache_Admin' => 'admin/litespeed-cache-admin.class.php',
47
+ 'LiteSpeed_Cache_Admin_API' => 'admin/admin-api.class.php',
48
  'LiteSpeed_Cache_Admin_Display' => 'admin/litespeed-cache-admin-display.class.php',
49
  'LiteSpeed_Cache_Admin_Error' => 'admin/litespeed-cache-admin-error.class.php',
50
  'LiteSpeed_Cache_Admin_Optimize' => 'admin/litespeed-cache-admin-optimize.class.php',
js/css_async.js CHANGED
File without changes
js/{lazyload.js → lazyload.init.js} RENAMED
File without changes
js/lazyload.lib.js ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
2
+
3
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
+
5
+ (function (global, factory) {
6
+ (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.LazyLoad = factory();
7
+ })(this, function () {
8
+ 'use strict';
9
+
10
+ var defaultSettings = {
11
+ elements_selector: "img",
12
+ container: document,
13
+ threshold: 300,
14
+ data_src: "src",
15
+ data_srcset: "srcset",
16
+ data_sizes: "sizes",
17
+ class_loading: "loading",
18
+ class_loaded: "loaded",
19
+ class_error: "error",
20
+ callback_load: null,
21
+ callback_error: null,
22
+ callback_set: null
23
+ };
24
+
25
+ var dataPrefix = "data-";
26
+
27
+ var getData = function getData(element, attribute) {
28
+ return element.getAttribute(dataPrefix + attribute);
29
+ };
30
+
31
+ var setData = function setData(element, attribute, value) {
32
+ return element.setAttribute(dataPrefix + attribute, value);
33
+ };
34
+
35
+ var purgeElements = function purgeElements(elements) {
36
+ return elements.filter(function (element) {
37
+ return !getData(element, "was-processed");
38
+ });
39
+ };
40
+
41
+ /* Creates instance and notifies it through the window element */
42
+ var createInstance = function createInstance(classObj, options) {
43
+ var instance = new classObj(options);
44
+ var event = new CustomEvent("LazyLoad::Initialized", { detail: { instance: instance } });
45
+ window.dispatchEvent(event);
46
+ };
47
+
48
+ /* Auto initialization of one or more instances of lazyload, depending on the
49
+ options passed in (plain object or an array) */
50
+ var autoInitialize = function autoInitialize(classObj, options) {
51
+ if (!options.length) {
52
+ // Plain object
53
+ createInstance(classObj, options);
54
+ } else {
55
+ // Array of objects
56
+ for (var i = 0, optionsItem; optionsItem = options[i]; i += 1) {
57
+ createInstance(classObj, optionsItem);
58
+ }
59
+ }
60
+ };
61
+
62
+ var setSourcesForPicture = function setSourcesForPicture(element, settings) {
63
+ var dataSrcSet = settings.data_srcset;
64
+ var data_sizes = settings.data_sizes ;
65
+
66
+ var parent = element.parentElement;
67
+ if (parent.tagName !== "PICTURE") {
68
+ return;
69
+ }
70
+ for (var i = 0, pictureChild; pictureChild = parent.children[i]; i += 1) {
71
+ if (pictureChild.tagName === "SOURCE") {
72
+ var sourceSrcset = getData(pictureChild, dataSrcSet);
73
+ if (sourceSrcset) {
74
+ pictureChild.setAttribute("srcset", sourceSrcset);
75
+ }
76
+
77
+ /**
78
+ * Add data-sizes attr
79
+ * @since 1.5
80
+ */
81
+ var source_data_sizes = getData( pictureChild, data_sizes ) ;
82
+ if ( source_data_sizes ) {
83
+ pictureChild.setAttribute( "sizes", source_data_sizes ) ;
84
+ }
85
+ }
86
+ }
87
+ };
88
+
89
+ var setSources = function setSources(element, settings) {
90
+ var dataSrc = settings.data_src,
91
+ dataSrcSet = settings.data_srcset;
92
+ var data_sizes = settings.data_sizes ;
93
+
94
+ var tagName = element.tagName;
95
+ var elementSrc = getData(element, dataSrc);
96
+ if (tagName === "IMG") {
97
+ setSourcesForPicture(element, settings);
98
+ var imgSrcset = getData(element, dataSrcSet);
99
+ if (imgSrcset) {
100
+ element.setAttribute("srcset", imgSrcset);
101
+ }
102
+
103
+ /**
104
+ * Add data-sizes attr
105
+ * @since 1.5
106
+ */
107
+ var img_data_sizes = getData( element, data_sizes ) ;
108
+ if ( img_data_sizes ) {
109
+ element.setAttribute( "sizes", img_data_sizes ) ;
110
+ }
111
+ if (elementSrc) {
112
+ element.setAttribute("src", elementSrc);
113
+ }
114
+ return;
115
+ }
116
+ if (tagName === "IFRAME") {
117
+ if (elementSrc) {
118
+ element.setAttribute("src", elementSrc);
119
+ }
120
+ return;
121
+ }
122
+ if (elementSrc) {
123
+ element.style.backgroundImage = 'url("' + elementSrc + '")';
124
+ }
125
+ };
126
+
127
+ var supportsClassList = !!document.body.classList;
128
+
129
+ var addClass = function addClass(element, className) {
130
+ if (supportsClassList) {
131
+ element.classList.add(className);
132
+ return;
133
+ }
134
+ element.className += (element.className ? " " : "") + className;
135
+ };
136
+
137
+ var removeClass = function removeClass(element, className) {
138
+ if (supportsClassList) {
139
+ element.classList.remove(className);
140
+ return;
141
+ }
142
+ element.className = element.className.replace(new RegExp("(^|\\s+)" + className + "(\\s+|$)"), " ").replace(/^\s+/, "").replace(/\s+$/, "");
143
+ };
144
+
145
+ var callCallback = function callCallback(callback, argument) {
146
+ if (callback) {
147
+ callback(argument);
148
+ }
149
+ };
150
+
151
+ var loadString = "load";
152
+ var errorString = "error";
153
+
154
+ var removeListeners = function removeListeners(element, loadHandler, errorHandler) {
155
+ element.removeEventListener(loadString, loadHandler);
156
+ element.removeEventListener(errorString, errorHandler);
157
+ };
158
+
159
+ var addOneShotListeners = function addOneShotListeners(element, settings) {
160
+ var onLoad = function onLoad(event) {
161
+ onEvent(event, true, settings);
162
+ removeListeners(element, onLoad, onError);
163
+ };
164
+ var onError = function onError(event) {
165
+ onEvent(event, false, settings);
166
+ removeListeners(element, onLoad, onError);
167
+ };
168
+ element.addEventListener(loadString, onLoad);
169
+ element.addEventListener(errorString, onError);
170
+ };
171
+
172
+ var onEvent = function onEvent(event, success, settings) {
173
+ var element = event.target;
174
+ removeClass(element, settings.class_loading);
175
+ addClass(element, success ? settings.class_loaded : settings.class_error); // Setting loaded or error class
176
+ callCallback(success ? settings.callback_load : settings.callback_error, element); // Calling loaded or error callback
177
+ };
178
+
179
+ var revealElement = function revealElement(element, settings) {
180
+ if (["IMG", "IFRAME"].indexOf(element.tagName) > -1) {
181
+ addOneShotListeners(element, settings);
182
+ addClass(element, settings.class_loading);
183
+ }
184
+ setSources(element, settings);
185
+ setData(element, "was-processed", true);
186
+ callCallback(settings.callback_set, element);
187
+ };
188
+
189
+ var LazyLoad = function LazyLoad(instanceSettings, elements) {
190
+ this._settings = _extends({}, defaultSettings, instanceSettings);
191
+ this._setObserver();
192
+ this.update(elements);
193
+ };
194
+
195
+ LazyLoad.prototype = {
196
+ _setObserver: function _setObserver() {
197
+ var _this = this;
198
+
199
+ if (!("IntersectionObserver" in window)) {
200
+ return;
201
+ }
202
+
203
+ var settings = this._settings;
204
+ var onIntersection = function onIntersection(entries) {
205
+ entries.forEach(function (entry) {
206
+ if (entry.intersectionRatio > 0) {
207
+ var element = entry.target;
208
+ revealElement(element, settings);
209
+ _this._observer.unobserve(element);
210
+ }
211
+ });
212
+ _this._elements = purgeElements(_this._elements);
213
+ };
214
+ this._observer = new IntersectionObserver(onIntersection, {
215
+ root: settings.container === document ? null : settings.container,
216
+ rootMargin: settings.threshold + "px"
217
+ });
218
+ },
219
+
220
+ update: function update(elements) {
221
+ var _this2 = this;
222
+
223
+ var settings = this._settings;
224
+ var nodeSet = elements || settings.container.querySelectorAll(settings.elements_selector);
225
+
226
+ this._elements = purgeElements(Array.prototype.slice.call(nodeSet)); // nodeset to array for IE compatibility
227
+ if (this._observer) {
228
+ this._elements.forEach(function (element) {
229
+ _this2._observer.observe(element);
230
+ });
231
+ return;
232
+ }
233
+ // Fallback: load all elements at once
234
+ this._elements.forEach(function (element) {
235
+ revealElement(element, settings);
236
+ });
237
+ this._elements = purgeElements(this._elements);
238
+ },
239
+
240
+ destroy: function destroy() {
241
+ var _this3 = this;
242
+
243
+ if (this._observer) {
244
+ purgeElements(this._elements).forEach(function (element) {
245
+ _this3._observer.unobserve(element);
246
+ });
247
+ this._observer = null;
248
+ }
249
+ this._elements = null;
250
+ this._settings = null;
251
+ }
252
+ };
253
+
254
+ /* Automatic instances creation if required (useful for async script loading!) */
255
+ var autoInitOptions = window.lazyLoadOptions;
256
+ if (autoInitOptions) {
257
+ autoInitialize(LazyLoad, autoInitOptions);
258
+ }
259
+
260
+ return LazyLoad;
261
+ });
js/lazyload.min.js CHANGED
@@ -1,2 +1,2 @@
1
- var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},r=function(e){return e.filter(function(e){return!t(e,"was-processed")})},s=function(e,t){var n=new e(t),r=new CustomEvent("LazyLoad::Initialized",{detail:{instance:n}});window.dispatchEvent(r)},o=function(e,n){var r=n.data_srcset,s=e.parentElement;if("PICTURE"===s.tagName)for(var o,a=0;o=s.children[a];a+=1)if("SOURCE"===o.tagName){var i=t(o,r);i&&o.setAttribute("srcset",i)}},a=function(e,n){var r=n.data_src,s=n.data_srcset,a=e.tagName,i=t(e,r);if("IMG"===a){o(e,n);var c=t(e,s);return c&&e.setAttribute("srcset",c),void(i&&e.setAttribute("src",i))}"IFRAME"!==a?i&&(e.style.backgroundImage='url("'+i+'")'):i&&e.setAttribute("src",i)},i=!!document.body.classList,c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},f=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},d=function(e,t){var n=function n(s){_(s,!0,t),f(e,n,r)},r=function r(s){_(s,!1,t),f(e,n,r)};e.addEventListener("load",n),e.addEventListener("error",r)},_=function(e,t,n){var r=e.target;l(r,n.class_loading),c(r,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,r)},v=function(e,t){["IMG","IFRAME"].indexOf(e.tagName)>-1&&(d(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},m=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};m.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.intersectionRatio>0){var r=n.target;v(r,t),e._observer.unobserve(r)}}),e._elements=r(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,s=e||n.container.querySelectorAll(n.elements_selector);this._elements=r(Array.prototype.slice.call(s)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){v(e,n)}),this._elements=r(this._elements))},destroy:function(){var e=this;this._observer&&(r(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var b=window.lazyLoadOptions;return b&&function(e,t){if(t.length)for(var n,r=0;n=t[r];r+=1)s(e,n);else s(e,t)}(m,b),m});
2
  !function(e,t){"use strict";var n,a,d=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),a=function(){n.update()},e.MutationObserver&&new MutationObserver(a).observe(t.documentElement,{childList:!0,subtree:!0,attributes:!0})};e.addEventListener?e.addEventListener("load",d,!1):e.attachEvent("onload",d)}(window,document);
1
+ var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(e,t){"object"===("undefined"==typeof exports?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.LazyLoad=t()}(this,function(){"use strict";var e={elements_selector:"img",container:document,threshold:300,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",class_loading:"loading",class_loaded:"loaded",class_error:"error",callback_load:null,callback_error:null,callback_set:null},t=function(e,t){return e.getAttribute("data-"+t)},n=function(e,t,n){return e.setAttribute("data-"+t,n)},s=function(e){return e.filter(function(e){return!t(e,"was-processed")})},r=function(e,t){var n=new e(t),s=new CustomEvent("LazyLoad::Initialized",{detail:{instance:n}});window.dispatchEvent(s)},o=function(e,n){var s=n.data_srcset,r=n.data_sizes,o=e.parentElement;if("PICTURE"===o.tagName)for(var a,i=0;a=o.children[i];i+=1)if("SOURCE"===a.tagName){var c=t(a,s);c&&a.setAttribute("srcset",c);var l=t(a,r);l&&a.setAttribute("sizes",l)}},a=function(e,n){var s=n.data_src,r=n.data_srcset,a=n.data_sizes,i=e.tagName,c=t(e,s);if("IMG"===i){o(e,n);var l=t(e,r);l&&e.setAttribute("srcset",l);var u=t(e,a);return u&&e.setAttribute("sizes",u),void(c&&e.setAttribute("src",c))}"IFRAME"!==i?c&&(e.style.backgroundImage='url("'+c+'")'):c&&e.setAttribute("src",c)},i=!!document.body.classList,c=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},l=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},u=function(e,t){e&&e(t)},d=function(e,t,n){e.removeEventListener("load",t),e.removeEventListener("error",n)},f=function(e,t){var n=function n(r){_(r,!0,t),d(e,n,s)},s=function s(r){_(r,!1,t),d(e,n,s)};e.addEventListener("load",n),e.addEventListener("error",s)},_=function(e,t,n){var s=e.target;l(s,n.class_loading),c(s,t?n.class_loaded:n.class_error),u(t?n.callback_load:n.callback_error,s)},v=function(e,t){["IMG","IFRAME"].indexOf(e.tagName)>-1&&(f(e,t),c(e,t.class_loading)),a(e,t),n(e,"was-processed",!0),u(t.callback_set,e)},b=function(t,n){this._settings=_extends({},e,t),this._setObserver(),this.update(n)};b.prototype={_setObserver:function(){var e=this;if("IntersectionObserver"in window){var t=this._settings;this._observer=new IntersectionObserver(function(n){n.forEach(function(n){if(n.intersectionRatio>0){var s=n.target;v(s,t),e._observer.unobserve(s)}}),e._elements=s(e._elements)},{root:t.container===document?null:t.container,rootMargin:t.threshold+"px"})}},update:function(e){var t=this,n=this._settings,r=e||n.container.querySelectorAll(n.elements_selector);this._elements=s(Array.prototype.slice.call(r)),this._observer?this._elements.forEach(function(e){t._observer.observe(e)}):(this._elements.forEach(function(e){v(e,n)}),this._elements=s(this._elements))},destroy:function(){var e=this;this._observer&&(s(this._elements).forEach(function(t){e._observer.unobserve(t)}),this._observer=null),this._elements=null,this._settings=null}};var m=window.lazyLoadOptions;return m&&function(e,t){if(t.length)for(var n,s=0;n=t[s];s+=1)r(e,n);else r(e,t)}(b,m),b});
2
  !function(e,t){"use strict";var n,a,d=function(){n=new LazyLoad({elements_selector:"[data-lazyloaded]"}),a=function(){n.update()},e.MutationObserver&&new MutationObserver(a).observe(t.documentElement,{childList:!0,subtree:!0,attributes:!0})};e.addEventListener?e.addEventListener("load",d,!1):e.attachEvent("onload",d)}(window,document);
languages/litespeed-cache.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: LiteSpeed Cache 1.4\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
- "POT-Creation-Date: 2017-10-11 15:27:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -12,12 +12,16 @@ msgstr ""
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
 
 
 
 
15
  #: admin/litespeed-cache-admin-display.class.php:140
16
  msgid "Manage"
17
  msgstr ""
18
 
19
  #: admin/litespeed-cache-admin-display.class.php:142
20
- #: admin/litespeed-cache-admin-display.class.php:235
21
  msgid "Settings"
22
  msgstr ""
23
 
@@ -29,38 +33,39 @@ msgstr ""
29
  msgid "Information"
30
  msgstr ""
31
 
32
- #: admin/litespeed-cache-admin-display.class.php:150
33
- msgid "Environment Report"
34
- msgstr ""
35
-
36
- #: admin/litespeed-cache-admin-display.class.php:154 admin/tpl/info.php:10
37
  #: admin/tpl/settings.php:28
38
  msgid "Crawler"
39
  msgstr ""
40
 
41
- #: admin/litespeed-cache-admin-display.class.php:158
42
- #: admin/tpl/settings_debug.php:10
 
 
 
 
43
  msgid "Debug Log"
44
  msgstr ""
45
 
46
- #: admin/litespeed-cache-admin-display.class.php:255
47
  msgid ""
48
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
49
  msgstr ""
50
 
51
- #: admin/litespeed-cache-admin-display.class.php:295
52
  msgid "LiteSpeed Cache Purge All"
53
  msgstr ""
54
 
55
- #: admin/litespeed-cache-admin-display.class.php:780
 
56
  msgid "ON"
57
  msgstr ""
58
 
59
- #: admin/litespeed-cache-admin-display.class.php:784
60
  msgid "OFF"
61
  msgstr ""
62
 
63
- #: admin/litespeed-cache-admin-display.class.php:817
64
  msgid "Recommended value: %s"
65
  msgstr ""
66
 
@@ -324,13 +329,13 @@ msgstr ""
324
  msgid "Clean all CSS/JS optimizer data successfully."
325
  msgstr ""
326
 
327
- #: admin/litespeed-cache-admin-rules.class.php:629
328
  msgid ""
329
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
330
  "%2$s"
331
  msgstr ""
332
 
333
- #: admin/litespeed-cache-admin-rules.class.php:827
334
  msgid "File Saved."
335
  msgstr ""
336
 
@@ -370,31 +375,31 @@ msgstr ""
370
  msgid "500"
371
  msgstr ""
372
 
373
- #: admin/litespeed-cache-admin-settings.class.php:569
374
- #: admin/tpl/settings_debug.php:75
375
  msgid "Log File Size Limit"
376
  msgstr ""
377
 
378
- #: admin/litespeed-cache-admin-settings.class.php:635
379
- #: admin/tpl/settings_crawler.php:10
380
  msgid "Delay"
381
  msgstr ""
382
 
383
- #: admin/litespeed-cache-admin-settings.class.php:636
384
- #: admin/tpl/settings_crawler.php:22
385
  msgid "Run Duration"
386
  msgstr ""
387
 
388
- #: admin/litespeed-cache-admin-settings.class.php:637
389
  msgid "Cron Interval"
390
  msgstr ""
391
 
392
- #: admin/litespeed-cache-admin-settings.class.php:638
393
  msgid "Whole Interval"
394
  msgstr ""
395
 
396
- #: admin/litespeed-cache-admin-settings.class.php:639
397
- #: admin/tpl/settings_crawler.php:58
398
  msgid "Threads"
399
  msgstr ""
400
 
@@ -422,50 +427,6 @@ msgid ""
422
  "page caching offerings—such as minifying css/js files."
423
  msgstr ""
424
 
425
- #: admin/tpl/admin_footer.php:5
426
- msgid ""
427
- "Rate <strong>LiteSpeed Cache</strong> with %s on WordPress.org if you like "
428
- "us!"
429
- msgstr ""
430
-
431
- #: admin/tpl/admin_footer.php:8
432
- msgid ""
433
- "If there are any questions that are not answered in the <a %s>FAQs</a>, do "
434
- "not hesitate to ask them on the <a %s>support forum</a>."
435
- msgstr ""
436
-
437
- #: admin/tpl/banner_promo.php:14
438
- msgid "Welcome to LiteSpeed"
439
- msgstr ""
440
-
441
- #: admin/tpl/banner_promo.php:17
442
- msgid "Thank you for using LiteSpeed."
443
- msgstr ""
444
-
445
- #: admin/tpl/banner_promo.php:19
446
- msgid ""
447
- "If you have any questions, please do not hesitate to let us know in <a "
448
- "%s>our support forum</a> or by <a %s>submitting a ticket with us</a>."
449
- msgstr ""
450
-
451
- #: admin/tpl/banner_promo.php:26
452
- msgid ""
453
- "This plugin is created with love by LiteSpeed. Your rating is the simplest "
454
- "way to support us. We really appreciate it!"
455
- msgstr ""
456
-
457
- #: admin/tpl/banner_promo.php:29
458
- msgid "Sure I'd love to!"
459
- msgstr ""
460
-
461
- #: admin/tpl/banner_promo.php:30
462
- msgid "I've already left a review"
463
- msgstr ""
464
-
465
- #: admin/tpl/banner_promo.php:31
466
- msgid "Maybe later"
467
- msgstr ""
468
-
469
  #: admin/tpl/crawler.php:14 admin/tpl/crawler.php:80
470
  msgid "LiteSpeed Cache Crawler"
471
  msgstr ""
@@ -507,8 +468,8 @@ msgstr ""
507
  msgid "Crawler Cron"
508
  msgstr ""
509
 
510
- #: admin/tpl/crawler.php:63 admin/tpl/settings.php:117
511
- #: admin/tpl/settings_optimize.php:9
512
  msgid "WARNING"
513
  msgstr ""
514
 
@@ -559,12 +520,12 @@ msgstr ""
559
  msgid "Is running"
560
  msgstr ""
561
 
562
- #: admin/tpl/crawler.php:136 admin/tpl/settings_general.php:30
563
  msgid "Enable"
564
  msgstr ""
565
 
566
  #: admin/tpl/crawler.php:136 admin/tpl/esi_widget_edit.php:58
567
- #: admin/tpl/settings_general.php:24
568
  msgid "Disable"
569
  msgstr ""
570
 
@@ -676,7 +637,7 @@ msgid ""
676
  "changed."
677
  msgstr ""
678
 
679
- #: admin/tpl/esi_widget_edit.php:30 admin/tpl/settings_esi.php:35
680
  msgid "Enable ESI"
681
  msgstr ""
682
 
@@ -692,12 +653,17 @@ msgstr ""
692
  msgid "Widget Cache TTL:"
693
  msgstr ""
694
 
695
- #: admin/tpl/esi_widget_edit.php:72 admin/tpl/settings_crawler.php:25
696
- #: admin/tpl/settings_crawler.php:37 admin/tpl/settings_crawler.php:49
697
- #: admin/tpl/settings_general.php:59 admin/tpl/settings_general.php:71
698
- #: admin/tpl/settings_general.php:83 admin/tpl/settings_general.php:95
699
- #: admin/tpl/settings_general.php:108 admin/tpl/settings_general.php:121
700
- #: admin/tpl/settings_general.php:134 admin/tpl/settings_optimize.php:109
 
 
 
 
 
701
  msgid "seconds"
702
  msgstr ""
703
 
@@ -709,332 +675,440 @@ msgstr ""
709
  msgid "A TTL of 0 indicates do not cache."
710
  msgstr ""
711
 
712
- #: admin/tpl/help_tabs.php:7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
713
  msgid "Overview"
714
  msgstr ""
715
 
716
- #: admin/tpl/help_tabs.php:9
717
  msgid "LiteSpeed Cache is a page cache built into LiteSpeed Web Server."
718
  msgstr ""
719
 
720
- #: admin/tpl/help_tabs.php:10
721
  msgid ""
722
  "This plugin communicates with LiteSpeed Web Server to let it know which "
723
  "pages are cacheable and when to purge them."
724
  msgstr ""
725
 
726
- #: admin/tpl/help_tabs.php:11
727
  msgid ""
728
  "A LiteSpeed server (OLS, LSWS, WebADC) and its LSCache module must be "
729
  "installed and enabled."
730
  msgstr ""
731
 
732
- #: admin/tpl/help_tabs.php:22
733
  msgid "For more information:"
734
  msgstr ""
735
 
736
- #: admin/tpl/help_tabs.php:24
737
  msgid "Support Forum"
738
  msgstr ""
739
 
740
- #: admin/tpl/info.php:5
741
- msgid "FAQs"
742
  msgstr ""
743
 
744
- #: admin/tpl/info.php:6
745
- msgid "Configuration"
 
746
  msgstr ""
747
 
748
- #: admin/tpl/info.php:7
749
- msgid "Plugin Compatibilities"
 
 
750
  msgstr ""
751
 
752
- #: admin/tpl/info.php:8
753
- msgid "Common Rewrite Rules"
 
 
754
  msgstr ""
755
 
756
- #: admin/tpl/info.php:9
757
- msgid "Admin IP Commands"
 
 
758
  msgstr ""
759
 
760
- #: admin/tpl/info.php:16
761
- msgid "LiteSpeed Cache Information"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
762
  msgstr ""
763
 
764
- #: admin/tpl/info_admin_ip.php:5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  msgid "This is used to display a page without caching it."
766
  msgstr ""
767
 
768
- #: admin/tpl/info_admin_ip.php:6
769
  msgid ""
770
  "An example use case is to compare a cached version of a page with an "
771
  "uncached version."
772
  msgstr ""
773
 
774
- #: admin/tpl/info_admin_ip.php:9
775
  msgid "This is used to purge most cache tags associated with the page."
776
  msgstr ""
777
 
778
- #: admin/tpl/info_admin_ip.php:10
779
  msgid "The lone exception is the blog ID tag."
780
  msgstr ""
781
 
782
- #: admin/tpl/info_admin_ip.php:11
783
  msgid ""
784
  "Note that this means that pages with the same cache tag will be purged as "
785
  "well."
786
  msgstr ""
787
 
788
- #: admin/tpl/info_admin_ip.php:14
789
  msgid "This is used to show all the cache headers associated with a page."
790
  msgstr ""
791
 
792
- #: admin/tpl/info_admin_ip.php:15
793
  msgid "This may be useful for debugging purposes."
794
  msgstr ""
795
 
796
- #: admin/tpl/info_admin_ip.php:19
797
  msgid "Admin IP Query String Actions"
798
  msgstr ""
799
 
800
- #: admin/tpl/info_admin_ip.php:21
801
  msgid ""
802
  "The following commands are available to the admin and do not require log-in, "
803
  "providing quick access to actions on the various pages."
804
  msgstr ""
805
 
806
- #: admin/tpl/info_admin_ip.php:23
807
  msgid "Action List:"
808
  msgstr ""
809
 
810
- #: admin/tpl/info_admin_ip.php:28
811
  msgid "This is used to purge the first cache tag associated with the page."
812
  msgstr ""
813
 
814
- #: admin/tpl/info_admin_ip.php:32
815
  msgid ""
816
  "To trigger the action for a page, access the page with the query string %s"
817
  msgstr ""
818
 
819
- #: admin/tpl/info_common_rewrite.php:8 admin/tpl/settings_excludes.php:60
820
- #: admin/tpl/settings_excludes.php:98
821
- #: admin/tpl/settings_inc.cache_browser.php:12
822
- #: admin/tpl/settings_inc.cache_favicon.php:14
823
- #: admin/tpl/settings_inc.cache_mobile.php:18
824
- #: admin/tpl/settings_inc.cache_resources.php:15
825
- #: admin/tpl/settings_inc.exclude_cookies.php:22
826
- #: admin/tpl/settings_inc.exclude_useragent.php:21
 
 
827
  msgid "NOTE:"
828
  msgstr ""
829
 
830
- #: admin/tpl/info_common_rewrite.php:10
831
  msgid "The following configuration can only be changed by the network admin."
832
  msgstr ""
833
 
834
- #: admin/tpl/info_common_rewrite.php:11
835
  msgid "Please contact the network admin to make any changes."
836
  msgstr ""
837
 
838
- #: admin/tpl/info_common_rewrite.php:14 admin/tpl/settings_advanced.php:6
 
839
  msgid "NOTICE:"
840
  msgstr ""
841
 
842
- #: admin/tpl/info_common_rewrite.php:17
843
  msgid ""
844
  "The following rewrite rules can be configured in the LiteSpeed Cache "
845
  "settings page."
846
  msgstr ""
847
 
848
- #: admin/tpl/info_common_rewrite.php:18
849
  msgid "Please make any needed changes on that page."
850
  msgstr ""
851
 
852
- #: admin/tpl/info_common_rewrite.php:19
853
  msgid "It will automatically generate the correct rules in the htaccess file."
854
  msgstr ""
855
 
856
- #: admin/tpl/info_common_rewrite.php:24
857
  msgid "LiteSpeed Cache Common Rewrite Rules"
858
  msgstr ""
859
 
860
- #: admin/tpl/info_common_rewrite.php:31
861
  msgid "Mobile Views:"
862
  msgstr ""
863
 
864
- #: admin/tpl/info_common_rewrite.php:34
865
  msgid ""
866
  "Some sites have adaptive views, meaning the page sent will adapt to the "
867
  "browser type (desktop vs mobile)."
868
  msgstr ""
869
 
870
- #: admin/tpl/info_common_rewrite.php:35
871
  msgid ""
872
  "This rewrite rule is used for sites that load a different page for each type."
873
  msgstr ""
874
 
875
- #: admin/tpl/info_common_rewrite.php:38
876
  msgid ""
877
  "This configuration can be added on the settings page in the General tab."
878
  msgstr ""
879
 
880
- #: admin/tpl/info_common_rewrite.php:44
881
  msgid "Do Not Cache Cookies:"
882
  msgstr ""
883
 
884
- #: admin/tpl/info_common_rewrite.php:46
885
  msgid ""
886
  "Another common rewrite rule is to notify the cache not to cache when it sees "
887
  "a specified cookie name."
888
  msgstr ""
889
 
890
- #: admin/tpl/info_common_rewrite.php:47 admin/tpl/info_common_rewrite.php:55
 
891
  msgid ""
892
  "This configuration can be added on the settings page in the Do Not Cache tab."
893
  msgstr ""
894
 
895
- #: admin/tpl/info_common_rewrite.php:52
896
  msgid "Do Not Cache User Agent:"
897
  msgstr ""
898
 
899
- #: admin/tpl/info_common_rewrite.php:54
900
  msgid ""
901
  "A not so commonly used rewrite rule is to notify the cache not to cache when "
902
  "it sees a specified User Agent."
903
  msgstr ""
904
 
905
- #: admin/tpl/info_compatibility.php:27
906
  msgid "LiteSpeed Cache Plugin Compatibility"
907
  msgstr ""
908
 
909
- #: admin/tpl/info_compatibility.php:29
910
  msgid "Link Here"
911
  msgstr ""
912
 
913
- #: admin/tpl/info_compatibility.php:31
914
  msgid ""
915
  "Please add a comment listing the plugins that you are using and how they are "
916
  "functioning on the support thread."
917
  msgstr ""
918
 
919
- #: admin/tpl/info_compatibility.php:32
920
  msgid "With your help, we can provide the best WordPress caching solution."
921
  msgstr ""
922
 
923
- #: admin/tpl/info_compatibility.php:35
924
  msgid ""
925
  "This is a list of plugins that are confirmed to be compatible with LiteSpeed "
926
  "Cache Plugin:"
927
  msgstr ""
928
 
929
- #: admin/tpl/info_compatibility.php:44
930
  msgid "This is a list of known UNSUPPORTED plugins:"
931
  msgstr ""
932
 
933
- #: admin/tpl/info_config.php:4
934
  msgid "LiteSpeed Cache Configuration"
935
  msgstr ""
936
 
937
- #: admin/tpl/info_config.php:7
938
  msgid "Instructions for LiteSpeed Web Server Enterprise"
939
  msgstr ""
940
 
941
- #: admin/tpl/info_config.php:9
942
  msgid "Make sure that the server license has the LSCache module enabled."
943
  msgstr ""
944
 
945
- #: admin/tpl/info_config.php:10
946
  msgid ""
947
  "A <a %s>2-CPU trial license with LSCache module</a> is available for free "
948
  "for %d days."
949
  msgstr ""
950
 
951
- #: admin/tpl/info_config.php:14
952
  msgid "The server must be configured to have caching enabled."
953
  msgstr ""
954
 
955
- #: admin/tpl/info_config.php:15
956
  msgid "If you are the server admin, <a %s>click here.</a>"
957
  msgstr ""
958
 
959
- #: admin/tpl/info_config.php:17
960
  msgid ""
961
  "Otherwise request that the server admin configure the cache root for the "
962
  "server."
963
  msgstr ""
964
 
965
- #: admin/tpl/info_config.php:20
966
  msgid ""
967
  "In the .htaccess file for the WordPress installation, add the following:"
968
  msgstr ""
969
 
970
- #: admin/tpl/info_config.php:27
971
  msgid "Instructions for OpenLiteSpeed"
972
  msgstr ""
973
 
974
- #: admin/tpl/info_config.php:28
975
  msgid "This integration utilizes OLS's cache module."
976
  msgstr ""
977
 
978
- #: admin/tpl/info_config.php:30
979
  msgid ""
980
  "If it is a fresh OLS installation, the easiest way to integrate is to use <a "
981
  "%s>ols1clk.</a>"
982
  msgstr ""
983
 
984
- #: admin/tpl/info_config.php:32
985
  msgid "If using an existing WordPress installation, use the %s parameter."
986
  msgstr ""
987
 
988
- #: admin/tpl/info_config.php:33
989
  msgid ""
990
  "Else if OLS and WordPress are already installed, please follow the "
991
  "instructions <a %s>here.</a>"
992
  msgstr ""
993
 
994
- #: admin/tpl/info_config.php:38
995
  msgid "How to test the plugin"
996
  msgstr ""
997
 
998
- #: admin/tpl/info_config.php:39
999
  msgid ""
1000
  "The LiteSpeed Cache Plugin utilizes LiteSpeed specific response headers."
1001
  msgstr ""
1002
 
1003
- #: admin/tpl/info_config.php:41
1004
  msgid ""
1005
  "Visiting a page for the first time should result in a %s or %s response "
1006
  "header for the page."
1007
  msgstr ""
1008
 
1009
- #: admin/tpl/info_config.php:46
1010
  msgid ""
1011
  "Subsequent requests should have the %s response header until the page is "
1012
  "updated, expired, or purged."
1013
  msgstr ""
1014
 
1015
- #: admin/tpl/info_config.php:49
1016
  msgid "Please visit <a %s>this page</a> for more information."
1017
  msgstr ""
1018
 
1019
- #: admin/tpl/info_config.php:53
1020
  msgid "Cache tag prefix setting"
1021
  msgstr ""
1022
 
1023
- #: admin/tpl/info_config.php:56
1024
  msgid ""
1025
  "The value of this wordpress cache tag prefix is %1$s. If you want to change "
1026
  "the value to avoid conflicts with multiple sites, please add %2$s to %3$s."
1027
  msgstr ""
1028
 
1029
- #: admin/tpl/info_crawler.php:7
1030
  msgid "Crawler Introduction"
1031
  msgstr ""
1032
 
1033
- #: admin/tpl/info_crawler.php:11
1034
  msgid "How Does the Crawler Work?"
1035
  msgstr ""
1036
 
1037
- #: admin/tpl/info_crawler.php:13
1038
  msgid ""
1039
  "Using a sitemap as a guide, LSCache’s crawler, travels its way throughout "
1040
  "the backend, refreshing pages that have expired in the cache. The purpose is "
@@ -1042,34 +1116,34 @@ msgid ""
1042
  "uncached content."
1043
  msgstr ""
1044
 
1045
- #: admin/tpl/info_crawler.php:15
1046
  msgid ""
1047
  "The sitemap can be generated by the crawler, or you can provide your own "
1048
  "custom map."
1049
  msgstr ""
1050
 
1051
- #: admin/tpl/info_crawler.php:17
1052
  msgid ""
1053
  "To learn more about each of the crawler settings, see <a %s>our wiki - "
1054
  "Crawler Settings</a>."
1055
  msgstr ""
1056
 
1057
- #: admin/tpl/info_crawler.php:21
1058
  msgid "Should I Enable the Crawler?"
1059
  msgstr ""
1060
 
1061
- #: admin/tpl/info_crawler.php:23
1062
  msgid "Not every site needs a crawler."
1063
  msgstr ""
1064
 
1065
- #: admin/tpl/info_crawler.php:25
1066
  msgid ""
1067
  "In WordPress, the first visitor to an uncached page waits for the page to "
1068
  "be dynamically-generated and served, and the page is then cached for "
1069
  "subsequent visitors."
1070
  msgstr ""
1071
 
1072
- #: admin/tpl/info_crawler.php:27
1073
  msgid ""
1074
  "The LSCache crawler makes the first visitor’s experience better by "
1075
  "essentially becoming the first visitor. The crawler caches the page, and the "
@@ -1080,38 +1154,38 @@ msgid ""
1080
  "large crowd."
1081
  msgstr ""
1082
 
1083
- #: admin/tpl/info_crawler.php:29
1084
  msgid ""
1085
  "You should weigh this benefit against your server’s resources. If resources "
1086
  "are plentiful, then the crawler is a nice thing to have."
1087
  msgstr ""
1088
 
1089
- #: admin/tpl/info_crawler.php:31
1090
  msgid ""
1091
  "If your site is busy, you’ll find that commonly-visited pages are quickly re-"
1092
  "cached by new visitors, without the aid of a crawler. An extra crawler task "
1093
  "would compete for server resources while delivering minimal benefits."
1094
  msgstr ""
1095
 
1096
- #: admin/tpl/info_crawler.php:33
1097
  msgid ""
1098
  "The decision to use a crawler depends on the busy-ness of the site and the "
1099
  "availability of server resources. Ultimately, it is the hosting provider who "
1100
  "can best make this call."
1101
  msgstr ""
1102
 
1103
- #: admin/tpl/info_crawler.php:38
1104
  msgid "Enabling the Crawler"
1105
  msgstr ""
1106
 
1107
- #: admin/tpl/info_crawler.php:40
1108
  msgid ""
1109
  "Due to the potential of the crawler to consume considerable resources, we "
1110
  "have put the on/off switch in the hands of the server administrators. The "
1111
  "crawler is disabled by default and can only be enabled by an admin."
1112
  msgstr ""
1113
 
1114
- #: admin/tpl/info_crawler.php:42
1115
  msgid ""
1116
  "Instructions for enabling the crawler can be found in <a %s>our wiki - "
1117
  "Enabling the Crawler</a>. If you do not have access to server configuration "
@@ -1119,42 +1193,42 @@ msgid ""
1119
  "assistance."
1120
  msgstr ""
1121
 
1122
- #: admin/tpl/info_crawler.php:47
1123
  msgid "Testing the Crawler"
1124
  msgstr ""
1125
 
1126
- #: admin/tpl/info_crawler.php:49
1127
  msgid ""
1128
  "To determine whether the crawler is working as expected, you can test it "
1129
  "with a single URL."
1130
  msgstr ""
1131
 
1132
- #: admin/tpl/info_crawler.php:53
1133
  msgid "Pick a URL from your sitemap and purge it:"
1134
  msgstr ""
1135
 
1136
- #: admin/tpl/info_crawler.php:54
1137
  msgid ""
1138
  "Navigate to <b>LiteSpeed Cache > Manage > Purge By… > URL</b> and enter the "
1139
  "full URL in the text box."
1140
  msgstr ""
1141
 
1142
- #: admin/tpl/info_crawler.php:57
1143
  msgid "Manually run the crawler:"
1144
  msgstr ""
1145
 
1146
- #: admin/tpl/info_crawler.php:58
1147
  msgid ""
1148
  "Navigate to <b>LiteSpeed Cache > Crawler</b>, make sure <b>Activation</b> is "
1149
  "set to Enable, and press the <b>Manually run</b> button. Wait for it to "
1150
  "finish."
1151
  msgstr ""
1152
 
1153
- #: admin/tpl/info_crawler.php:61
1154
  msgid "See if the purged URL was cached during the crawl:"
1155
  msgstr ""
1156
 
1157
- #: admin/tpl/info_crawler.php:62
1158
  msgid ""
1159
  "Turn on your browser’s Developer Tool/Inspector. Visit the URL that should "
1160
  "have been crawled. Select the <b>Network</b> tab in the inspector, select "
@@ -1163,444 +1237,470 @@ msgid ""
1163
  "correctly, you will see the response header X-LiteSpeed-Cache: hit."
1164
  msgstr ""
1165
 
1166
- #: admin/tpl/info_crawler.php:67
1167
  msgid ""
1168
  "If you don’t see X-LiteSpeed-Cache: hit, and you can’t figure out why the "
1169
  "crawler didn’t cache the purged URL, you can visit <a %s>our support forum</"
1170
  "a> for help."
1171
  msgstr ""
1172
 
1173
- #: admin/tpl/info_faqs.php:5
1174
  msgid "LiteSpeed Cache FAQs"
1175
  msgstr ""
1176
 
1177
- #: admin/tpl/info_faqs.php:9
1178
  msgid "Is the LiteSpeed Cache Plugin for WordPress free?"
1179
  msgstr ""
1180
 
1181
- #: admin/tpl/info_faqs.php:12
1182
  msgid "Yes, the plugin itself will remain free and open source."
1183
  msgstr ""
1184
 
1185
- #: admin/tpl/info_faqs.php:13
1186
  msgid "That said, a LiteSpeed server is required (see question 2)"
1187
  msgstr ""
1188
 
1189
- #: admin/tpl/info_faqs.php:17
1190
  msgid "What server software is required for this plugin?"
1191
  msgstr ""
1192
 
1193
- #: admin/tpl/info_faqs.php:19
1194
  msgid "A LiteSpeed server is required in order to use this plugin."
1195
  msgstr ""
1196
 
1197
- #: admin/tpl/info_faqs.php:25
1198
  msgid "Any single server or cluster including a LiteSpeed server will work."
1199
  msgstr ""
1200
 
1201
- #: admin/tpl/info_faqs.php:28
1202
  msgid "Does this plugin work in a clustered environment?"
1203
  msgstr ""
1204
 
1205
- #: admin/tpl/info_faqs.php:31
1206
  msgid "The cache entries are stored at the litespeed server level."
1207
  msgstr ""
1208
 
1209
- #: admin/tpl/info_faqs.php:32
1210
  msgid ""
1211
  "The simplest solution is to use LiteSpeed WebADC, as the cache entries will "
1212
  "be cached at that level."
1213
  msgstr ""
1214
 
1215
- #: admin/tpl/info_faqs.php:35
1216
  msgid ""
1217
  "If using another load balancer, the cache entries will only be stored at the "
1218
  "backend nodes, not at the load balancer."
1219
  msgstr ""
1220
 
1221
- #: admin/tpl/info_faqs.php:36
1222
  msgid ""
1223
  "The purges will also not be synchronized across the nodes, so this is not "
1224
  "recommended."
1225
  msgstr ""
1226
 
1227
- #: admin/tpl/info_faqs.php:39
1228
  msgid "If a customized solution is required, please contact %s at %s"
1229
  msgstr ""
1230
 
1231
- #: admin/tpl/info_faqs.php:42
1232
  msgid ""
1233
  "NOTICE: The rewrite rules created by this plugin must be copied to the WebADC"
1234
  msgstr ""
1235
 
1236
- #: admin/tpl/info_faqs.php:45
1237
  msgid "Where are the cache entries stored?"
1238
  msgstr ""
1239
 
1240
- #: admin/tpl/info_faqs.php:47
1241
  msgid ""
1242
  "The actual cached pages are stored and managed by LiteSpeed Servers. Nothing "
1243
  "is stored on the PHP side."
1244
  msgstr ""
1245
 
1246
- #: admin/tpl/info_faqs.php:50
1247
  msgid "Is WooCommerce supported?"
1248
  msgstr ""
1249
 
1250
- #: admin/tpl/info_faqs.php:53
1251
  msgid "In short, yes."
1252
  msgstr ""
1253
 
1254
- #: admin/tpl/info_faqs.php:54
1255
  msgid ""
1256
  "However, for some woocommerce themes, the cart may not be updated correctly."
1257
  msgstr ""
1258
 
1259
- #: admin/tpl/info_faqs.php:56
1260
  msgid "To test the cart:"
1261
  msgstr ""
1262
 
1263
- #: admin/tpl/info_faqs.php:58
1264
  msgid ""
1265
  "On a non-logged-in browser, visit and cache a page, then visit and cache a "
1266
  "product page."
1267
  msgstr ""
1268
 
1269
- #: admin/tpl/info_faqs.php:59
1270
  msgid ""
1271
  "The first page should be accessible from the product page (e.g. the shop)."
1272
  msgstr ""
1273
 
1274
- #: admin/tpl/info_faqs.php:60
1275
  msgid "Once both pages are confirmed cached, add the product to the cart."
1276
  msgstr ""
1277
 
1278
- #: admin/tpl/info_faqs.php:61
1279
  msgid "After adding to the cart, visit the first page."
1280
  msgstr ""
1281
 
1282
- #: admin/tpl/info_faqs.php:62
1283
  msgid "The page should still be cached, and the cart should be up to date."
1284
  msgstr ""
1285
 
1286
- #: admin/tpl/info_faqs.php:63
1287
  msgid ""
1288
  "If that is not the case, please add woocommerce_items_in_cart to the do not "
1289
  "cache cookie list."
1290
  msgstr ""
1291
 
1292
- #: admin/tpl/info_faqs.php:66
1293
  msgid ""
1294
  "Some themes like Storefront and Shop Isle are built such that the cart works "
1295
  "without the rule."
1296
  msgstr ""
1297
 
1298
- #: admin/tpl/info_faqs.php:67
1299
  msgid ""
1300
  "However, other themes like the E-Commerce theme, do not, so please verify "
1301
  "the theme used."
1302
  msgstr ""
1303
 
1304
- #: admin/tpl/info_faqs.php:71
1305
  msgid "Are my images optimized?"
1306
  msgstr ""
1307
 
1308
- #: admin/tpl/info_faqs.php:74
1309
  msgid "The cache plugin does not do anything with the images themselves."
1310
  msgstr ""
1311
 
1312
- #: admin/tpl/info_faqs.php:75
1313
  msgid ""
1314
  "We recommend you trying an image optimization plugin like %s to optimize "
1315
  "your images."
1316
  msgstr ""
1317
 
1318
- #: admin/tpl/info_faqs.php:77
1319
  msgid "It can reduce your site's images up to 90%."
1320
  msgstr ""
1321
 
1322
- #: admin/tpl/info_faqs.php:81
1323
  msgid "How do I get WP-PostViews to display an updating view count?"
1324
  msgstr ""
1325
 
1326
- #: admin/tpl/info_faqs.php:84
1327
  msgid "Use %1$s to replace %2$s"
1328
  msgstr ""
1329
 
1330
- #: admin/tpl/info_faqs.php:88
1331
  msgid ""
1332
  "NOTE: The id can be changed, but the div id and the ajax function must match."
1333
  msgstr ""
1334
 
1335
- #: admin/tpl/info_faqs.php:91
1336
  msgid "Replace the ajax query in %1$s with %2$s"
1337
  msgstr ""
1338
 
1339
- #: admin/tpl/info_faqs.php:106
1340
  msgid "Purge the cache to use the updated pages."
1341
  msgstr ""
1342
 
1343
- #: admin/tpl/manage.php:7 admin/tpl/manage_purge.php:75
1344
- #: admin/tpl/network_settings.php:7 admin/tpl/settings.php:9
1345
- msgid "Purge"
1346
  msgstr ""
1347
 
1348
- #: admin/tpl/manage.php:8
1349
- msgid "DB Optimizer"
1350
  msgstr ""
1351
 
1352
- #: admin/tpl/manage.php:18
1353
- msgid "LiteSpeed Cache Network Management"
1354
  msgstr ""
1355
 
1356
- #: admin/tpl/manage.php:21
1357
- msgid "LiteSpeed Cache Management"
1358
  msgstr ""
1359
 
1360
- #: admin/tpl/manage.php:43
1361
- msgid ""
1362
- "WARNING: LiteSpeed cache is disabled. The functionalities here can not work."
1363
  msgstr ""
1364
 
1365
- #: admin/tpl/manage_db.php:6
 
 
 
 
1366
  msgid "Clean All"
1367
  msgstr ""
1368
 
1369
- #: admin/tpl/manage_db.php:10
1370
  msgid "Post Revisions"
1371
  msgstr ""
1372
 
1373
- #: admin/tpl/manage_db.php:11
1374
  msgid "Clean all post revisions"
1375
  msgstr ""
1376
 
1377
- #: admin/tpl/manage_db.php:14
1378
  msgid "Auto Drafts"
1379
  msgstr ""
1380
 
1381
- #: admin/tpl/manage_db.php:15
1382
  msgid "Clean all auto saved drafts"
1383
  msgstr ""
1384
 
1385
- #: admin/tpl/manage_db.php:18
1386
  msgid "Trashed Posts"
1387
  msgstr ""
1388
 
1389
- #: admin/tpl/manage_db.php:19
1390
  msgid "Clean all trashed posts and pages"
1391
  msgstr ""
1392
 
1393
- #: admin/tpl/manage_db.php:22
1394
  msgid "Spam Comments"
1395
  msgstr ""
1396
 
1397
- #: admin/tpl/manage_db.php:23
1398
  msgid "Clean all spam comments"
1399
  msgstr ""
1400
 
1401
- #: admin/tpl/manage_db.php:26
1402
  msgid "Trashed Comments"
1403
  msgstr ""
1404
 
1405
- #: admin/tpl/manage_db.php:27
1406
  msgid "Clean all trashed comments"
1407
  msgstr ""
1408
 
1409
- #: admin/tpl/manage_db.php:30
1410
  msgid "Trackbacks/Pingbacks"
1411
  msgstr ""
1412
 
1413
- #: admin/tpl/manage_db.php:31
1414
  msgid "Clean all trackbacks and pingbacks"
1415
  msgstr ""
1416
 
1417
- #: admin/tpl/manage_db.php:34
1418
  msgid "Expired Transients"
1419
  msgstr ""
1420
 
1421
- #: admin/tpl/manage_db.php:35
1422
  msgid "Clean expired transient options"
1423
  msgstr ""
1424
 
1425
- #: admin/tpl/manage_db.php:38
1426
  msgid "All Transients"
1427
  msgstr ""
1428
 
1429
- #: admin/tpl/manage_db.php:39
1430
  msgid "Clean all transient options"
1431
  msgstr ""
1432
 
1433
- #: admin/tpl/manage_db.php:42
1434
  msgid "Optimize Tables"
1435
  msgstr ""
1436
 
1437
- #: admin/tpl/manage_db.php:43
1438
  msgid "Optimize all tables in your database"
1439
  msgstr ""
1440
 
1441
- #: admin/tpl/manage_db.php:46
1442
  msgid "Clean CSS/JS Optimizer"
1443
  msgstr ""
1444
 
1445
- #: admin/tpl/manage_db.php:47
1446
  msgid "Purge all and clean all minified/combined CSS/JS data"
1447
  msgstr ""
1448
 
1449
- #: admin/tpl/manage_db.php:68
1450
  msgid "Database Optimizer"
1451
  msgstr ""
1452
 
1453
- #: admin/tpl/manage_purge.php:7
1454
  msgid "Purge Front Page"
1455
  msgstr ""
1456
 
1457
- #: admin/tpl/manage_purge.php:8
1458
  msgid "This will Purge Front Page only"
1459
  msgstr ""
1460
 
1461
- #: admin/tpl/manage_purge.php:13
1462
  msgid "Purge Pages"
1463
  msgstr ""
1464
 
1465
- #: admin/tpl/manage_purge.php:14
1466
  msgid "This will Purge Pages only"
1467
  msgstr ""
1468
 
1469
- #: admin/tpl/manage_purge.php:19
1470
  msgid "Purge CSS/JS Cache"
1471
  msgstr ""
1472
 
1473
- #: admin/tpl/manage_purge.php:20
1474
  msgid "This will purge all minified/combined CSS/JS entries only"
1475
  msgstr ""
1476
 
1477
- #: admin/tpl/manage_purge.php:25
1478
  msgid "Purge 403 Error"
1479
  msgstr ""
1480
 
1481
- #: admin/tpl/manage_purge.php:26
1482
  msgid "Purge error pages, including 403 pages"
1483
  msgstr ""
1484
 
1485
- #: admin/tpl/manage_purge.php:32
1486
  msgid "Purge 404 Error"
1487
  msgstr ""
1488
 
1489
- #: admin/tpl/manage_purge.php:33
1490
  msgid "Purge error pages, including 404 pages"
1491
  msgstr ""
1492
 
1493
- #: admin/tpl/manage_purge.php:39
1494
  msgid "Purge 500 Error"
1495
  msgstr ""
1496
 
1497
- #: admin/tpl/manage_purge.php:40
1498
  msgid "Purge error pages, including 500 pages"
1499
  msgstr ""
1500
 
1501
- #: admin/tpl/manage_purge.php:46
1502
  msgid "Purge All"
1503
  msgstr ""
1504
 
1505
- #: admin/tpl/manage_purge.php:47
1506
  msgid "Purge the cache entries created by this plugin"
1507
  msgstr ""
1508
 
1509
- #: admin/tpl/manage_purge.php:52
1510
  msgid "This will purge everything for all blogs."
1511
  msgstr ""
1512
 
1513
- #: admin/tpl/manage_purge.php:53 admin/tpl/manage_purge.php:55
1514
  msgid "Are you sure you want to purge all?"
1515
  msgstr ""
1516
 
1517
- #: admin/tpl/manage_purge.php:61
1518
  msgid "Empty Entire Cache"
1519
  msgstr ""
1520
 
1521
- #: admin/tpl/manage_purge.php:62
1522
  msgid ""
1523
  "Clears all cache entries related to this site, <i>including other web "
1524
  "applications</i>."
1525
  msgstr ""
1526
 
1527
- #: admin/tpl/manage_purge.php:63
1528
  msgid "This action should only be used if things are cached incorrectly."
1529
  msgstr ""
1530
 
1531
- #: admin/tpl/manage_purge.php:67
1532
  msgid "This will clear EVERYTHING inside the cache."
1533
  msgstr ""
1534
 
1535
- #: admin/tpl/manage_purge.php:68
1536
  msgid "This may cause heavy load on the server."
1537
  msgstr ""
1538
 
1539
- #: admin/tpl/manage_purge.php:69
1540
  msgid "If only the WordPress site should be purged, use purge all."
1541
  msgstr ""
1542
 
1543
- #: admin/tpl/manage_purge.php:102
 
 
 
 
 
1544
  msgid "Purge By..."
1545
  msgstr ""
1546
 
1547
- #: admin/tpl/manage_purge.php:104
1548
  msgid "Select below for \"Purge by\" options."
1549
  msgstr ""
1550
 
1551
- #: admin/tpl/manage_purge.php:105 admin/tpl/settings_cache.php:67
1552
- #: admin/tpl/settings_cdn.php:101 admin/tpl/settings_excludes.php:19
1553
- #: admin/tpl/settings_excludes.php:33 admin/tpl/settings_excludes.php:56
1554
- #: admin/tpl/settings_excludes.php:94
1555
- #: admin/tpl/settings_inc.exclude_cookies.php:19
1556
- #: admin/tpl/settings_optimize.php:58 admin/tpl/settings_optimize.php:100
1557
- #: admin/tpl/settings_optimize.php:199 admin/tpl/settings_purge.php:79
 
 
 
 
 
 
 
1558
  msgid "One per line."
1559
  msgstr ""
1560
 
1561
- #: admin/tpl/manage_purge.php:132
1562
  msgid "Category"
1563
  msgstr ""
1564
 
1565
- #: admin/tpl/manage_purge.php:138
1566
  msgid "Post ID"
1567
  msgstr ""
1568
 
1569
- #: admin/tpl/manage_purge.php:144
1570
  msgid "Tag"
1571
  msgstr ""
1572
 
1573
- #: admin/tpl/manage_purge.php:150
1574
  msgid "URL"
1575
  msgstr ""
1576
 
1577
- #: admin/tpl/manage_purge.php:156
1578
  msgid ""
1579
  "Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
1580
  msgstr ""
1581
 
1582
- #: admin/tpl/manage_purge.php:161
1583
  msgid "Purge pages by post ID."
1584
  msgstr ""
1585
 
1586
- #: admin/tpl/manage_purge.php:165
1587
  msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
1588
  msgstr ""
1589
 
1590
- #: admin/tpl/manage_purge.php:170
1591
  msgid "Purge pages by relative or full URL."
1592
  msgstr ""
1593
 
1594
- #: admin/tpl/manage_purge.php:171
1595
  msgid "e.g. Use %s or %s."
1596
  msgstr ""
1597
 
1598
- #: admin/tpl/manage_purge.php:184
1599
  msgid "Purge List"
1600
  msgstr ""
1601
 
1602
- #: admin/tpl/network_settings.php:5 admin/tpl/settings.php:7
1603
- #: admin/tpl/settings_general.php:5
 
 
 
 
 
 
 
 
 
 
 
 
1604
  msgid "General"
1605
  msgstr ""
1606
 
@@ -1612,8 +1712,8 @@ msgstr ""
1612
  msgid "Excludes"
1613
  msgstr ""
1614
 
1615
- #: admin/tpl/network_settings.php:9 admin/tpl/settings.php:19
1616
- #: admin/tpl/settings_debug.php:65
1617
  msgid "Advanced"
1618
  msgstr ""
1619
 
@@ -1621,70 +1721,6 @@ msgstr ""
1621
  msgid "LiteSpeed Cache Network Settings"
1622
  msgstr ""
1623
 
1624
- #: admin/tpl/network_settings_cache.php:4
1625
- msgid "Cache Control Network Settings"
1626
- msgstr ""
1627
-
1628
- #: admin/tpl/network_settings_cache.php:7
1629
- msgid ""
1630
- "Separate Mobile Views should be enabled if any of the network enabled themes "
1631
- "require a different view for mobile devices."
1632
- msgstr ""
1633
-
1634
- #: admin/tpl/network_settings_cache.php:8
1635
- msgid "Responsive themes can handle this part automatically."
1636
- msgstr ""
1637
-
1638
- #: admin/tpl/network_settings_excludes.php:5
1639
- msgid "Network Do Not Cache Rules"
1640
- msgstr ""
1641
-
1642
- #: admin/tpl/network_settings_general.php:5
1643
- msgid "General Network Configuration"
1644
- msgstr ""
1645
-
1646
- #: admin/tpl/network_settings_general.php:7
1647
- msgid "These configuration are only available network wide."
1648
- msgstr ""
1649
-
1650
- #: admin/tpl/network_settings_general.php:11
1651
- msgid "Network Enable Cache"
1652
- msgstr ""
1653
-
1654
- #: admin/tpl/network_settings_general.php:15
1655
- msgid ""
1656
- "Enabling LiteSpeed Cache for WordPress here enables the cache for the "
1657
- "network."
1658
- msgstr ""
1659
-
1660
- #: admin/tpl/network_settings_general.php:16
1661
- msgid ""
1662
- "It is <b>STRONGLY</b> recommend that the compatibility with other plugins on "
1663
- "a single/few sites is tested first."
1664
- msgstr ""
1665
-
1666
- #: admin/tpl/network_settings_general.php:17
1667
- msgid ""
1668
- "This is to ensure compatibility prior to enabling the cache for all sites."
1669
- msgstr ""
1670
-
1671
- #: admin/tpl/network_settings_general.php:23
1672
- msgid "Use Primary Site Configuration"
1673
- msgstr ""
1674
-
1675
- #: admin/tpl/network_settings_general.php:27
1676
- msgid ""
1677
- "Check this option to use the primary site's configuration for all subsites."
1678
- msgstr ""
1679
-
1680
- #: admin/tpl/network_settings_general.php:28
1681
- msgid "This will disable the settings page on all subsites."
1682
- msgstr ""
1683
-
1684
- #: admin/tpl/network_settings_purge.php:4
1685
- msgid "Purge Network Settings"
1686
- msgstr ""
1687
-
1688
  #: admin/tpl/report.php:10
1689
  msgid "LiteSpeed Cache Report"
1690
  msgstr ""
@@ -1729,396 +1765,437 @@ msgstr ""
1729
  msgid "Environment Report copied to Clipboard!"
1730
  msgstr ""
1731
 
1732
- #: admin/tpl/settings.php:11
1733
- msgid "Optimize"
1734
  msgstr ""
1735
 
1736
- #: admin/tpl/settings.php:12
1737
- msgid "Media"
 
 
1738
  msgstr ""
1739
 
1740
- #: admin/tpl/settings.php:13
1741
- msgid "CDN"
1742
  msgstr ""
1743
 
1744
- #: admin/tpl/settings.php:16
1745
- msgid "ESI"
1746
  msgstr ""
1747
 
1748
- #: admin/tpl/settings.php:22
1749
- msgid "Debug"
1750
  msgstr ""
1751
 
1752
- #: admin/tpl/settings.php:25
1753
- msgid "Compatibilities"
1754
  msgstr ""
1755
 
1756
- #: admin/tpl/settings.php:65
1757
- msgid "WARNING: Third party tab input invalid."
1758
  msgstr ""
1759
 
1760
- #: admin/tpl/settings.php:72
1761
- msgid "WARNING: Third party config slug contains invalid characters."
 
 
1762
  msgstr ""
1763
 
1764
- #: admin/tpl/settings.php:89
1765
- msgid "LiteSpeed Cache Settings"
 
 
1766
  msgstr ""
1767
 
1768
- #: admin/tpl/settings.php:119
1769
- msgid "The network admin selected use primary site configs for all subsites."
 
1770
  msgstr ""
1771
 
1772
- #: admin/tpl/settings.php:120
 
 
 
 
1773
  msgid ""
1774
- "The following options are selected, but are not editable in this settings "
1775
- "page."
1776
  msgstr ""
1777
 
1778
- #: admin/tpl/settings.php:142 admin/tpl/settings.php:145
1779
- msgid "Save Changes"
1780
  msgstr ""
1781
 
1782
- #: admin/tpl/settings_advanced.php:8
 
 
 
 
1783
  msgid "These settings are meant for ADVANCED USERS ONLY."
1784
  msgstr ""
1785
 
1786
- #: admin/tpl/settings_advanced.php:9
1787
  msgid "Please take great care when changing any of these settings."
1788
  msgstr ""
1789
 
1790
- #: admin/tpl/settings_advanced.php:10
1791
  msgid "If there are any questions, do not hesitate to submit a support thread."
1792
  msgstr ""
1793
 
1794
- #: admin/tpl/settings_advanced.php:14
1795
  msgid "Check Advanced Cache"
1796
  msgstr ""
1797
 
1798
- #: admin/tpl/settings_advanced.php:17
1799
  msgid "Include advanced-cache.php"
1800
  msgstr ""
1801
 
1802
- #: admin/tpl/settings_advanced.php:20
1803
  msgid ""
1804
  "The advanced-cache.php file is used by many caching plugins to signal that a "
1805
  "cache is active."
1806
  msgstr ""
1807
 
1808
- #: admin/tpl/settings_advanced.php:21
1809
  msgid ""
1810
  "When this option is checked and this file is detected as belonging to "
1811
  "another plugin, LiteSpeed Cache will not cache."
1812
  msgstr ""
1813
 
1814
- #: admin/tpl/settings_advanced.php:24
1815
  msgid ""
1816
  "Uncheck this option only if the other plugin is used for non-caching "
1817
  "purposes, such as minifying css/js files."
1818
  msgstr ""
1819
 
1820
- #: admin/tpl/settings_advanced.php:27
1821
  msgid "Login Cookie"
1822
  msgstr ""
1823
 
1824
- #: admin/tpl/settings_advanced.php:30
1825
  msgid "SYNTAX: alphanumeric and \"_\"."
1826
  msgstr ""
1827
 
1828
- #: admin/tpl/settings_advanced.php:31
1829
  msgid "No spaces and case sensitive."
1830
  msgstr ""
1831
 
1832
- #: admin/tpl/settings_advanced.php:32
1833
  msgid "MUST BE UNIQUE FROM OTHER WEB APPLICATIONS."
1834
  msgstr ""
1835
 
1836
- #: admin/tpl/settings_advanced.php:35
1837
  msgid "The default login cookie is %s."
1838
  msgstr ""
1839
 
1840
- #: admin/tpl/settings_advanced.php:36
1841
  msgid ""
1842
  "The server will determine if the user is logged in based on the existance of "
1843
  "this cookie."
1844
  msgstr ""
1845
 
1846
- #: admin/tpl/settings_advanced.php:37
1847
  msgid ""
1848
  "This setting is useful for those that have multiple web applications for the "
1849
  "same domain."
1850
  msgstr ""
1851
 
1852
- #: admin/tpl/settings_advanced.php:38
1853
  msgid ""
1854
  "If every web application uses the same cookie, the server may confuse "
1855
  "whether a user is logged in or not."
1856
  msgstr ""
1857
 
1858
- #: admin/tpl/settings_advanced.php:39
1859
  msgid "The cookie set here will be used for this WordPress installation."
1860
  msgstr ""
1861
 
1862
- #: admin/tpl/settings_advanced.php:42
1863
  msgid "Example use case:"
1864
  msgstr ""
1865
 
1866
- #: admin/tpl/settings_advanced.php:44
1867
  msgid "There is a WordPress installed for %s."
1868
  msgstr ""
1869
 
1870
- #: admin/tpl/settings_advanced.php:46
1871
  msgid "Then another WordPress is installed (NOT MULTISITE) at %s"
1872
  msgstr ""
1873
 
1874
- #: admin/tpl/settings_advanced.php:47
1875
  msgid ""
1876
  "The cache needs to distinguish who is logged into which WordPress site in "
1877
  "order to cache correctly."
1878
  msgstr ""
1879
 
1880
- #: admin/tpl/settings_advanced.php:53
1881
  msgid "Error: invalid login cookie. Please check the %s file"
1882
  msgstr ""
1883
 
1884
- #: admin/tpl/settings_advanced.php:62
1885
  msgid "Error getting current rules from %s: %s"
1886
  msgstr ""
1887
 
1888
- #: admin/tpl/settings_advanced.php:70
1889
  msgid ""
1890
  "WARNING: The .htaccess login cookie and Database login cookie do not match."
1891
  msgstr ""
1892
 
1893
- #: admin/tpl/settings_cache.php:4
1894
  msgid "Cache Control Settings"
1895
  msgstr ""
1896
 
1897
- #: admin/tpl/settings_cache.php:8
1898
  msgid "Cache Logged-in Users"
1899
  msgstr ""
1900
 
1901
- #: admin/tpl/settings_cache.php:12
1902
  msgid "Privately cache frontend pages for logged-in users. (LSWS %s required)"
1903
  msgstr ""
1904
 
1905
- #: admin/tpl/settings_cache.php:18
1906
  msgid "Cache Commenters"
1907
  msgstr ""
1908
 
1909
- #: admin/tpl/settings_cache.php:22
1910
  msgid ""
1911
  "Privately cache commenters that have pending comments. Disabling this option "
1912
  "will serve non-cacheable pages to commenters. (LSWS %s required)"
1913
  msgstr ""
1914
 
1915
- #: admin/tpl/settings_cache.php:28
1916
  msgid "Cache REST API"
1917
  msgstr ""
1918
 
1919
- #: admin/tpl/settings_cache.php:32
1920
  msgid "Cache requests made by WordPress REST API calls."
1921
  msgstr ""
1922
 
1923
- #: admin/tpl/settings_cache.php:38
1924
  msgid "Cache Login Page"
1925
  msgstr ""
1926
 
1927
- #: admin/tpl/settings_cache.php:42
1928
  msgid "Disabling this option may negatively affect performance."
1929
  msgstr ""
1930
 
1931
- #: admin/tpl/settings_cache.php:56
1932
  msgid "Private Cached URIs"
1933
  msgstr ""
1934
 
1935
- #: admin/tpl/settings_cache.php:60
1936
  msgid "URI Paths containing these strings will NOT be cached as public."
1937
  msgstr ""
1938
 
1939
- #: admin/tpl/settings_cache.php:61 admin/tpl/settings_excludes.php:13
 
1940
  msgid "The URLs will be compared to the REQUEST_URI server variable."
1941
  msgstr ""
1942
 
1943
- #: admin/tpl/settings_cache.php:62 admin/tpl/settings_excludes.php:14
1944
- #: admin/tpl/settings_optimize.php:198
 
1945
  msgid "For example, for %s, %s can be used here."
1946
  msgstr ""
1947
 
1948
- #: admin/tpl/settings_cache.php:65 admin/tpl/settings_excludes.php:17
 
1949
  msgid "To match the beginning, add %s to the beginning of the item."
1950
  msgstr ""
1951
 
1952
- #: admin/tpl/settings_cache.php:66 admin/tpl/settings_excludes.php:18
 
1953
  msgid "To do an exact match, add %s to the end of the URL."
1954
  msgstr ""
1955
 
1956
- #: admin/tpl/settings_cdn.php:11
1957
  msgid "CDN Settings"
1958
  msgstr ""
1959
 
1960
- #: admin/tpl/settings_cdn.php:15
1961
  msgid "Enable CDN"
1962
  msgstr ""
1963
 
1964
- #: admin/tpl/settings_cdn.php:19
1965
  msgid "Enable Content Delivery Network use."
1966
  msgstr ""
1967
 
1968
- #: admin/tpl/settings_cdn.php:25
1969
  msgid "CDN URL"
1970
  msgstr ""
1971
 
1972
- #: admin/tpl/settings_cdn.php:29
1973
  msgid "CDN URL to be used. For example, %s"
1974
  msgstr ""
1975
 
1976
- #: admin/tpl/settings_cdn.php:35
1977
  msgid "Original URL"
1978
  msgstr ""
1979
 
1980
- #: admin/tpl/settings_cdn.php:39
1981
  msgid ""
1982
  "Site URL to be served through the CDN. Beginning with %1$s. For example, "
1983
  "%2$s."
1984
  msgstr ""
1985
 
1986
- #: admin/tpl/settings_cdn.php:40
1987
  msgid ""
1988
  "Wildcard %1$s supported (match zero or more characters). For example, to "
1989
  "match %2$s and %3$s, use %4$s."
1990
  msgstr ""
1991
 
1992
- #: admin/tpl/settings_cdn.php:46
1993
  msgid "Include Images"
1994
  msgstr ""
1995
 
1996
- #: admin/tpl/settings_cdn.php:50
1997
  msgid ""
1998
  "Serve all image files through the CDN. This will affect all attachments, "
1999
  "HTML %s tags, and CSS %s attributes."
2000
  msgstr ""
2001
 
2002
- #: admin/tpl/settings_cdn.php:56
2003
  msgid "Include CSS"
2004
  msgstr ""
2005
 
2006
- #: admin/tpl/settings_cdn.php:60
2007
  msgid ""
2008
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
2009
  "files."
2010
  msgstr ""
2011
 
2012
- #: admin/tpl/settings_cdn.php:66
2013
  msgid "Include JS"
2014
  msgstr ""
2015
 
2016
- #: admin/tpl/settings_cdn.php:70
2017
  msgid ""
2018
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
2019
  "JavaScript files."
2020
  msgstr ""
2021
 
2022
- #: admin/tpl/settings_cdn.php:76
2023
  msgid "Include File Types"
2024
  msgstr ""
2025
 
2026
- #: admin/tpl/settings_cdn.php:82
2027
  msgid "Static file type links to be replaced by CDN links. One per line."
2028
  msgstr ""
2029
 
2030
- #: admin/tpl/settings_cdn.php:83
2031
  msgid "This will affect all tags containing attributes: %s %s %s."
2032
  msgstr ""
2033
 
2034
- #: admin/tpl/settings_cdn.php:95
2035
  msgid "Exclude Path"
2036
  msgstr ""
2037
 
2038
- #: admin/tpl/settings_cdn.php:100
2039
  msgid "Paths containing these strings will not be served from the CDN."
2040
  msgstr ""
2041
 
2042
- #: admin/tpl/settings_compatibilities.php:7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2043
  msgid "Compatibility with WP-PostViews"
2044
  msgstr ""
2045
 
2046
- #: admin/tpl/settings_compatibilities.php:9
2047
  msgid "To make LiteSpeed Cache compatible with WP-PostViews:"
2048
  msgstr ""
2049
 
2050
- #: admin/tpl/settings_compatibilities.php:13
2051
  msgid ""
2052
  "Replace the following calls in the active theme's template files with a div "
2053
  "or span with a unique ID."
2054
  msgstr ""
2055
 
2056
- #: admin/tpl/settings_compatibilities.php:14
2057
  msgid "e.g. Replace <br> <pre>%1$s</pre> with<br> <pre>%2$s</pre>"
2058
  msgstr ""
2059
 
2060
- #: admin/tpl/settings_compatibilities.php:21
2061
  msgid "Update the ajax request to output the results to that div."
2062
  msgstr ""
2063
 
2064
- #: admin/tpl/settings_compatibilities.php:22
2065
  msgid "Example:"
2066
  msgstr ""
2067
 
2068
- #: admin/tpl/settings_compatibilities.php:34
2069
  msgid "The ajax code can be found at"
2070
  msgstr ""
2071
 
2072
- #: admin/tpl/settings_compatibilities.php:37
2073
  msgid "After purging the cache, the view count should be updating."
2074
  msgstr ""
2075
 
2076
- #: admin/tpl/settings_crawler.php:6
2077
  msgid "Crawler Settings"
2078
  msgstr ""
2079
 
2080
- #: admin/tpl/settings_crawler.php:13
2081
  msgid "microseconds"
2082
  msgstr ""
2083
 
2084
- #: admin/tpl/settings_crawler.php:15
2085
  msgid ""
2086
  "Specify time in microseconds for the delay between requests during a crawl."
2087
  msgstr ""
2088
 
2089
- #: admin/tpl/settings_crawler.php:27
2090
  msgid "Specify time in seconds for the duration of the crawl interval."
2091
  msgstr ""
2092
 
2093
- #: admin/tpl/settings_crawler.php:34
2094
  msgid "Interval Between Runs"
2095
  msgstr ""
2096
 
2097
- #: admin/tpl/settings_crawler.php:39
2098
  msgid ""
2099
  "Specify time in seconds for the time between each run interval. Must be "
2100
  "greater than 60."
2101
  msgstr ""
2102
 
2103
- #: admin/tpl/settings_crawler.php:46
2104
  msgid "Crawl Interval"
2105
  msgstr ""
2106
 
2107
- #: admin/tpl/settings_crawler.php:51
2108
  msgid ""
2109
  "Specify how long in seconds before the crawler should initiate crawling the "
2110
  "entire sitemap again."
2111
  msgstr ""
2112
 
2113
- #: admin/tpl/settings_crawler.php:63
2114
  msgid "Specify Number of Threads to use while crawling."
2115
  msgstr ""
2116
 
2117
- #: admin/tpl/settings_crawler.php:70
2118
  msgid "Server Load Limit"
2119
  msgstr ""
2120
 
2121
- #: admin/tpl/settings_crawler.php:75
2122
  msgid ""
2123
  "The maximum average server load allowed while crawling. The number of "
2124
  "crawler threads in use will be actively reduced until average server load "
@@ -2126,234 +2203,230 @@ msgid ""
2126
  "current crawler run will be terminated."
2127
  msgstr ""
2128
 
2129
- #: admin/tpl/settings_crawler.php:83
2130
  msgid "Site IP"
2131
  msgstr ""
2132
 
2133
- #: admin/tpl/settings_crawler.php:88
2134
  msgid ""
2135
  "Enter this site's IP address to crawl by IP instead of domain name. This "
2136
  "eliminates the overhead of DNS and CDN lookups. (optional)"
2137
  msgstr ""
2138
 
2139
- #: admin/tpl/settings_crawler.php:94
2140
  msgid "Custom Sitemap"
2141
  msgstr ""
2142
 
2143
- #: admin/tpl/settings_crawler.php:99
2144
  msgid ""
2145
  "The crawler can use your Google XML Sitemap instead of its own. Enter the "
2146
  "full URL to your sitemap here."
2147
  msgstr ""
2148
 
2149
- #: admin/tpl/settings_crawler.php:105
2150
  msgid "Include Posts"
2151
  msgstr ""
2152
 
2153
- #: admin/tpl/settings_crawler.php:109
2154
  msgid "Include Posts in crawler sitemap generation."
2155
  msgstr ""
2156
 
2157
- #: admin/tpl/settings_crawler.php:115
2158
  msgid "Include Pages"
2159
  msgstr ""
2160
 
2161
- #: admin/tpl/settings_crawler.php:119
2162
  msgid "Include Pages in crawler sitemap generation."
2163
  msgstr ""
2164
 
2165
- #: admin/tpl/settings_crawler.php:125
2166
  msgid "Include Categories"
2167
  msgstr ""
2168
 
2169
- #: admin/tpl/settings_crawler.php:129
2170
  msgid "Include Categories pages in crawler sitemap generation."
2171
  msgstr ""
2172
 
2173
- #: admin/tpl/settings_crawler.php:135
2174
  msgid "Include Tags"
2175
  msgstr ""
2176
 
2177
- #: admin/tpl/settings_crawler.php:139
2178
  msgid "Include Tags pages in crawler sitemap generation."
2179
  msgstr ""
2180
 
2181
- #: admin/tpl/settings_crawler.php:145
2182
  msgid "Exclude Custom Post Types"
2183
  msgstr ""
2184
 
2185
- #: admin/tpl/settings_crawler.php:150
2186
  msgid ""
2187
  "If you want to exclude certain Custom Post Types in sitemap, add the Custom "
2188
  "Post Types in the box, one per line."
2189
  msgstr ""
2190
 
2191
- #: admin/tpl/settings_crawler.php:154
2192
  msgid "Available Custom Post Type"
2193
  msgstr ""
2194
 
2195
- #: admin/tpl/settings_crawler.php:163
2196
  msgid "Order links by"
2197
  msgstr ""
2198
 
2199
- #: admin/tpl/settings_crawler.php:169
2200
  msgid "Date, descending (Default)"
2201
  msgstr ""
2202
 
2203
- #: admin/tpl/settings_crawler.php:175
2204
  msgid "Date, ascending"
2205
  msgstr ""
2206
 
2207
- #: admin/tpl/settings_crawler.php:181
2208
  msgid "Alphabetical, descending"
2209
  msgstr ""
2210
 
2211
- #: admin/tpl/settings_crawler.php:187
2212
  msgid "Alphabetical, ascending"
2213
  msgstr ""
2214
 
2215
- #: admin/tpl/settings_crawler.php:191
2216
  msgid ""
2217
  "Please choose one of the above options to set the order in which the sitemap "
2218
  "will be parsed."
2219
  msgstr ""
2220
 
2221
- #: admin/tpl/settings_debug.php:6
2222
  msgid "Developer Testing"
2223
  msgstr ""
2224
 
2225
- #: admin/tpl/settings_debug.php:16
2226
- msgid "Off"
2227
- msgstr ""
2228
-
2229
- #: admin/tpl/settings_debug.php:22
2230
  msgid "On"
2231
  msgstr ""
2232
 
2233
- #: admin/tpl/settings_debug.php:28
2234
  msgid "Admin IP only"
2235
  msgstr ""
2236
 
2237
- #: admin/tpl/settings_debug.php:32
2238
  msgid "Outputs to WordPress debug log."
2239
  msgstr ""
2240
 
2241
- #: admin/tpl/settings_debug.php:33
2242
  msgid ""
2243
  "This should be set to off once everything is working to prevent filling the "
2244
  "disk."
2245
  msgstr ""
2246
 
2247
- #: admin/tpl/settings_debug.php:34
2248
  msgid ""
2249
  "The Admin IP option will only output log messages on requests from admin IPs."
2250
  msgstr ""
2251
 
2252
- #: admin/tpl/settings_debug.php:35
2253
  msgid "The logs will be outputted to %s."
2254
  msgstr ""
2255
 
2256
- #: admin/tpl/settings_debug.php:41
2257
  msgid "Admin IPs"
2258
  msgstr ""
2259
 
2260
- #: admin/tpl/settings_debug.php:45
2261
  msgid ""
2262
  "Allows listed IPs (one per line) to perform certain actions from their "
2263
  "browsers."
2264
  msgstr ""
2265
 
2266
- #: admin/tpl/settings_debug.php:46
2267
  msgid ""
2268
  "More information about the available commands can be found <a href=\"%s"
2269
  "\">here</a>."
2270
  msgstr ""
2271
 
2272
- #: admin/tpl/settings_debug.php:53
2273
  msgid "Debug Level"
2274
  msgstr ""
2275
 
2276
- #: admin/tpl/settings_debug.php:59
2277
  msgid "Basic"
2278
  msgstr ""
2279
 
2280
- #: admin/tpl/settings_debug.php:69
2281
  msgid "Advanced level will log more details."
2282
  msgstr ""
2283
 
2284
- #: admin/tpl/settings_debug.php:78
2285
  msgid "MB"
2286
  msgstr ""
2287
 
2288
- #: admin/tpl/settings_debug.php:80
2289
  msgid ""
2290
  "Specify the maximum size of the log file. Minimum is 3MB. Maximum is 3000MB."
2291
  msgstr ""
2292
 
2293
- #: admin/tpl/settings_debug.php:87
2294
  msgid "Heartbeat"
2295
  msgstr ""
2296
 
2297
- #: admin/tpl/settings_debug.php:91
2298
  msgid ""
2299
  "Disable WordPress heartbeat to prevent AJAX calls from breaking debug "
2300
  "logging. WARNING: Disabling this may cause WordPress tasks triggered by AJAX "
2301
  "to stop working."
2302
  msgstr ""
2303
 
2304
- #: admin/tpl/settings_debug.php:97
2305
  msgid "Log Cookies"
2306
  msgstr ""
2307
 
2308
- #: admin/tpl/settings_debug.php:101
2309
  msgid "Log request cookie values."
2310
  msgstr ""
2311
 
2312
- #: admin/tpl/settings_debug.php:107
2313
  msgid "Collapse Query Strings"
2314
  msgstr ""
2315
 
2316
- #: admin/tpl/settings_debug.php:111
2317
  msgid "Shorten query strings in the debug log to improve readability."
2318
  msgstr ""
2319
 
2320
- #: admin/tpl/settings_debug.php:117
2321
  msgid "Log Filters"
2322
  msgstr ""
2323
 
2324
- #: admin/tpl/settings_debug.php:121
2325
  msgid ""
2326
  "Log all WordPress filter hooks. WARNING: Enabling this option will cause log "
2327
  "file size to grow quickly."
2328
  msgstr ""
2329
 
2330
- #: admin/tpl/settings_debug.php:127
2331
  msgid "Exclude Filters"
2332
  msgstr ""
2333
 
2334
- #: admin/tpl/settings_debug.php:131
2335
  msgid "Listed filters (one per line) will not be logged."
2336
  msgstr ""
2337
 
2338
- #: admin/tpl/settings_debug.php:137
2339
  msgid "Exclude Part Filters"
2340
  msgstr ""
2341
 
2342
- #: admin/tpl/settings_debug.php:141
2343
  msgid "Filters containing these strings (one per line) will not be logged."
2344
  msgstr ""
2345
 
2346
- #: admin/tpl/settings_esi.php:14
2347
  msgid "ESI Settings"
2348
  msgstr ""
2349
 
2350
- #: admin/tpl/settings_esi.php:17
2351
  msgid ""
2352
  "With ESI (Edge Side Includes), pages may be served from cache for logged-in "
2353
  "users."
2354
  msgstr ""
2355
 
2356
- #: admin/tpl/settings_esi.php:18
2357
  msgid ""
2358
  "ESI allows you to designate parts of your dynamic page as separate fragments "
2359
  "that are then assembled together to make the whole page. In other words, ESI "
@@ -2362,42 +2435,42 @@ msgid ""
2362
  "cached at all."
2363
  msgstr ""
2364
 
2365
- #: admin/tpl/settings_esi.php:20
2366
  msgid "Learn more about public cache vs. private cache <a %s>on our blog</a>."
2367
  msgstr ""
2368
 
2369
- #: admin/tpl/settings_esi.php:29
2370
  msgid "Available in LiteSpeed Enterprise version"
2371
  msgstr ""
2372
 
2373
- #: admin/tpl/settings_esi.php:39
2374
  msgid ""
2375
  "Enable caches public pages for logged in users and serves the Admin Bar and "
2376
  "Comment Form via ESI blocks. These two blocks will be uncached unless "
2377
  "enabled below."
2378
  msgstr ""
2379
 
2380
- #: admin/tpl/settings_esi.php:45
2381
  msgid "Cache Admin Bar"
2382
  msgstr ""
2383
 
2384
- #: admin/tpl/settings_esi.php:49
2385
  msgid "Cache the build-in Admin Bar ESI block."
2386
  msgstr ""
2387
 
2388
- #: admin/tpl/settings_esi.php:55
2389
  msgid "Cache Comment Form"
2390
  msgstr ""
2391
 
2392
- #: admin/tpl/settings_esi.php:59
2393
  msgid "Cache the build-in Comment Form ESI block."
2394
  msgstr ""
2395
 
2396
- #: admin/tpl/settings_esi.php:65
2397
  msgid "Vary Group"
2398
  msgstr ""
2399
 
2400
- #: admin/tpl/settings_esi.php:80
2401
  msgid ""
2402
  "If your site contains public content that certain user roles can see but "
2403
  "other roles cannot, you can specify a Vary Group for those user roles. For "
@@ -2406,680 +2479,743 @@ msgid ""
2406
  "etc), while all other user roles see the default public page."
2407
  msgstr ""
2408
 
2409
- #: admin/tpl/settings_excludes.php:4
2410
  msgid "Do Not Cache Settings"
2411
  msgstr ""
2412
 
2413
- #: admin/tpl/settings_excludes.php:8
2414
  msgid "Do Not Cache URIs"
2415
  msgstr ""
2416
 
2417
- #: admin/tpl/settings_excludes.php:12
2418
  msgid "Paths containing these strings will not be cached."
2419
  msgstr ""
2420
 
2421
- #: admin/tpl/settings_excludes.php:26
2422
  msgid "Do Not Cache Query Strings"
2423
  msgstr ""
2424
 
2425
- #: admin/tpl/settings_excludes.php:30
2426
  msgid "Query string containing these parameters will not be cached."
2427
  msgstr ""
2428
 
2429
- #: admin/tpl/settings_excludes.php:31
2430
  msgid "For example, for %s, %s and %s can be used here."
2431
  msgstr ""
2432
 
2433
- #: admin/tpl/settings_excludes.php:40
2434
  msgid "Do Not Cache Categories"
2435
  msgstr ""
2436
 
2437
- #: admin/tpl/settings_excludes.php:53
2438
  msgid "All categories are cached by default."
2439
  msgstr ""
2440
 
2441
- #: admin/tpl/settings_excludes.php:54 admin/tpl/settings_excludes.php:92
2442
- #: admin/tpl/settings_inc.exclude_cookies.php:16
2443
- #: admin/tpl/settings_inc.exclude_useragent.php:15
 
2444
  msgid "To prevent %s from being cached, enter it here."
2445
  msgstr ""
2446
 
2447
- #: admin/tpl/settings_excludes.php:54
2448
  msgid "categories"
2449
  msgstr ""
2450
 
2451
- #: admin/tpl/settings_excludes.php:62
2452
  msgid "If the Category ID is not found, the name will be removed on save."
2453
  msgstr ""
2454
 
2455
- #: admin/tpl/settings_excludes.php:63 admin/tpl/settings_excludes.php:101
 
2456
  msgid "To exclude %1$s, insert %2$s."
2457
  msgstr ""
2458
 
2459
- #: admin/tpl/settings_excludes.php:71
2460
  msgid "Do Not Cache Tags"
2461
  msgstr ""
2462
 
2463
- #: admin/tpl/settings_excludes.php:91
2464
  msgid "All tags are cached by default."
2465
  msgstr ""
2466
 
2467
- #: admin/tpl/settings_excludes.php:92
2468
  msgid "tags"
2469
  msgstr ""
2470
 
2471
- #: admin/tpl/settings_excludes.php:100
2472
  msgid "If the Tag ID is not found, the name will be removed on save."
2473
  msgstr ""
2474
 
2475
- #: admin/tpl/settings_general.php:9
2476
  msgid "Enable LiteSpeed Cache"
2477
  msgstr ""
2478
 
2479
- #: admin/tpl/settings_general.php:38
2480
  msgid "Use Network Admin Setting"
2481
  msgstr ""
2482
 
2483
- #: admin/tpl/settings_general.php:44
2484
  msgid "Please visit the <a %s>Information</a> page on how to test the cache."
2485
  msgstr ""
2486
 
2487
- #: admin/tpl/settings_general.php:47 admin/tpl/settings_optimize.php:15
 
2488
  msgid "NOTICE"
2489
  msgstr ""
2490
 
2491
- #: admin/tpl/settings_general.php:47
2492
  msgid ""
2493
  "When disabling the cache, all cached entries for this blog will be purged."
2494
  msgstr ""
2495
 
2496
- #: admin/tpl/settings_general.php:49
2497
  msgid "The network admin setting can be overridden here."
2498
  msgstr ""
2499
 
2500
- #: admin/tpl/settings_general.php:56
2501
  msgid "Default Public Cache TTL"
2502
  msgstr ""
2503
 
2504
- #: admin/tpl/settings_general.php:61
2505
  msgid ""
2506
  "Specify how long, in seconds, public pages are cached. Minimum is 30 seconds."
2507
  msgstr ""
2508
 
2509
- #: admin/tpl/settings_general.php:68
2510
  msgid "Default Private Cache TTL"
2511
  msgstr ""
2512
 
2513
- #: admin/tpl/settings_general.php:73
2514
  msgid ""
2515
  "Specify how long, in seconds, private pages are cached. Minimum is %1$s "
2516
  "seconds. Maximum is %2$s seconds."
2517
  msgstr ""
2518
 
2519
- #: admin/tpl/settings_general.php:80
2520
  msgid "Default Front Page TTL"
2521
  msgstr ""
2522
 
2523
- #: admin/tpl/settings_general.php:85
2524
  msgid ""
2525
  "Specify how long, in seconds, the front page is cached. Minimum is 30 "
2526
  "seconds."
2527
  msgstr ""
2528
 
2529
- #: admin/tpl/settings_general.php:92
2530
  msgid "Default Feed TTL"
2531
  msgstr ""
2532
 
2533
- #: admin/tpl/settings_general.php:97
2534
  msgid "Specify how long, in seconds, feeds are cached."
2535
  msgstr ""
2536
 
2537
- #: admin/tpl/settings_general.php:98
2538
  msgid "If this is set to a number less than 30, feeds will not be cached."
2539
  msgstr ""
2540
 
2541
- #: admin/tpl/settings_general.php:105
2542
  msgid "Default 404 Page TTL"
2543
  msgstr ""
2544
 
2545
- #: admin/tpl/settings_general.php:110
2546
  msgid "Specify how long, in seconds, 404 pages are cached."
2547
  msgstr ""
2548
 
2549
- #: admin/tpl/settings_general.php:111
2550
  msgid "If this is set to a number less than 30, 404 pages will not be cached."
2551
  msgstr ""
2552
 
2553
- #: admin/tpl/settings_general.php:118
2554
  msgid "Default 403 Page TTL"
2555
  msgstr ""
2556
 
2557
- #: admin/tpl/settings_general.php:123
2558
  msgid "Specify how long, in seconds, 403 pages are cached."
2559
  msgstr ""
2560
 
2561
- #: admin/tpl/settings_general.php:124
2562
  msgid "If this is set to a number less than 30, 403 pages will not be cached."
2563
  msgstr ""
2564
 
2565
- #: admin/tpl/settings_general.php:131
2566
  msgid "Default 500 Page TTL"
2567
  msgstr ""
2568
 
2569
- #: admin/tpl/settings_general.php:136
2570
  msgid "Specify how long, in seconds, 500 pages are cached."
2571
  msgstr ""
2572
 
2573
- #: admin/tpl/settings_general.php:137
2574
  msgid "If this is set to a number less than 30, 500 pages will not be cached."
2575
  msgstr ""
2576
 
2577
- #: admin/tpl/settings_inc.cache_browser.php:6
2578
  msgid "Browser Cache"
2579
  msgstr ""
2580
 
2581
- #: admin/tpl/settings_inc.cache_browser.php:10
2582
  msgid ""
2583
  "Browser caching stores static files locally in the user's browser. Turn on "
2584
  "this setting to reduce repeated requests for static files."
2585
  msgstr ""
2586
 
2587
- #: admin/tpl/settings_inc.cache_browser.php:13
2588
- #: admin/tpl/settings_inc.cache_favicon.php:15
2589
- #: admin/tpl/settings_inc.cache_mobile.php:19
2590
- #: admin/tpl/settings_inc.cache_resources.php:16
2591
- #: admin/tpl/settings_inc.exclude_cookies.php:23
2592
- #: admin/tpl/settings_inc.exclude_useragent.php:22
2593
  msgid "This setting will edit the .htaccess file."
2594
  msgstr ""
2595
 
2596
- #: admin/tpl/settings_inc.cache_browser.php:15
2597
  msgid ""
2598
  "You can turn on browser caching in server admin too. <a %s>Learn more about "
2599
  "LiteSpeed browser cache setting</a>."
2600
  msgstr ""
2601
 
2602
- #: admin/tpl/settings_inc.cache_favicon.php:7
2603
  msgid "Cache favicon.ico"
2604
  msgstr ""
2605
 
2606
- #: admin/tpl/settings_inc.cache_favicon.php:11
2607
  msgid "favicon.ico is requested on most pages."
2608
  msgstr ""
2609
 
2610
- #: admin/tpl/settings_inc.cache_favicon.php:12
2611
  msgid ""
2612
  "Caching this resource may improve server performance by avoiding unnecessary "
2613
  "PHP calls."
2614
  msgstr ""
2615
 
2616
- #: admin/tpl/settings_inc.cache_mobile.php:8
2617
  msgid "Cache Mobile"
2618
  msgstr ""
2619
 
2620
- #: admin/tpl/settings_inc.cache_mobile.php:15
2621
  msgid "When enabled, mobile views will be cached separately."
2622
  msgstr ""
2623
 
2624
- #: admin/tpl/settings_inc.cache_mobile.php:16
2625
  msgid "A site built with responsive design does not need to check this."
2626
  msgstr ""
2627
 
2628
- #: admin/tpl/settings_inc.cache_mobile.php:26
2629
  msgid "List of Mobile User Agents"
2630
  msgstr ""
2631
 
2632
- #: admin/tpl/settings_inc.cache_mobile.php:43
2633
  msgid "Htaccess did not match configuration option."
2634
  msgstr ""
2635
 
2636
- #: admin/tpl/settings_inc.cache_mobile.php:44
2637
  msgid "Please re-enter the mobile view setting."
2638
  msgstr ""
2639
 
2640
- #: admin/tpl/settings_inc.cache_mobile.php:45
2641
  msgid "List in WordPress database is: %s"
2642
  msgstr ""
2643
 
2644
- #: admin/tpl/settings_inc.cache_mobile.php:61
2645
  msgid "SYNTAX: Each entry should be separated with a bar, %s."
2646
  msgstr ""
2647
 
2648
- #: admin/tpl/settings_inc.cache_mobile.php:62
2649
  msgid "Any spaces should be escaped with a backslash before the space, %s."
2650
  msgstr ""
2651
 
2652
- #: admin/tpl/settings_inc.cache_mobile.php:65
2653
  msgid "The default list WordPress uses is %s"
2654
  msgstr ""
2655
 
2656
- #: admin/tpl/settings_inc.cache_resources.php:8
2657
  msgid "Cache PHP Resources"
2658
  msgstr ""
2659
 
2660
- #: admin/tpl/settings_inc.cache_resources.php:12
2661
  msgid "Some themes and plugins add resources via a PHP request."
2662
  msgstr ""
2663
 
2664
- #: admin/tpl/settings_inc.cache_resources.php:13
2665
  msgid ""
2666
  "Caching these pages may improve server performance by avoiding unnecessary "
2667
  "PHP calls."
2668
  msgstr ""
2669
 
2670
- #: admin/tpl/settings_inc.exclude_cookies.php:6
2671
  msgid "Do Not Cache Cookies"
2672
  msgstr ""
2673
 
2674
- #: admin/tpl/settings_inc.exclude_cookies.php:16
2675
  msgid "cookies"
2676
  msgstr ""
2677
 
2678
- #: admin/tpl/settings_inc.exclude_cookies.php:18
2679
- #: admin/tpl/settings_inc.exclude_useragent.php:18
2680
  msgid "Spaces should have a backslash in front of them, %s."
2681
  msgstr ""
2682
 
2683
- #: admin/tpl/settings_inc.exclude_useragent.php:7
2684
  msgid "Do Not Cache User Agents"
2685
  msgstr ""
2686
 
2687
- #: admin/tpl/settings_inc.exclude_useragent.php:15
2688
  msgid "user agents"
2689
  msgstr ""
2690
 
2691
- #: admin/tpl/settings_inc.exclude_useragent.php:17
2692
  msgid "SYNTAX: Separate each user agent with a bar, %s."
2693
  msgstr ""
2694
 
2695
- #: admin/tpl/settings_inc.purge_on_upgrade.php:7
2696
  msgid "Purge All On Upgrade"
2697
  msgstr ""
2698
 
2699
- #: admin/tpl/settings_inc.purge_on_upgrade.php:11
2700
  msgid ""
2701
  "When enabled, the cache will automatically purge when any plugins, themes, "
2702
  "or WordPress core is upgraded."
2703
  msgstr ""
2704
 
2705
- #: admin/tpl/settings_media.php:6
2706
  msgid "Media Settings"
2707
  msgstr ""
2708
 
2709
- #: admin/tpl/settings_media.php:10
2710
- msgid "Lazyload Images"
2711
  msgstr ""
2712
 
2713
- #: admin/tpl/settings_media.php:14
2714
  msgid "Load images only when they enter the viewport."
2715
  msgstr ""
2716
 
2717
- #: admin/tpl/settings_media.php:15 admin/tpl/settings_media.php:26
 
2718
  msgid "This can improve page loading time by reducing initial HTTP requests."
2719
  msgstr ""
2720
 
2721
- #: admin/tpl/settings_media.php:21
2722
- msgid "Lazyload Iframes"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2723
  msgstr ""
2724
 
2725
- #: admin/tpl/settings_media.php:25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2726
  msgid "Load iframes only when they enter the viewport."
2727
  msgstr ""
2728
 
2729
- #: admin/tpl/settings_optimize.php:5
2730
  msgid "Optimization Settings"
2731
  msgstr ""
2732
 
2733
- #: admin/tpl/settings_optimize.php:10
2734
  msgid ""
2735
  "Failed to create Optimizer table. Please follow <a %s>Table Creation "
2736
  "guidance from LiteSpeed Wiki</a> to finish setup."
2737
  msgstr ""
2738
 
2739
- #: admin/tpl/settings_optimize.php:16
2740
  msgid ""
2741
  "Please test thoroughly when enabling any option in this list. After changing "
2742
  "Minify/Combine settings, please do a Purge All action."
2743
  msgstr ""
2744
 
2745
- #: admin/tpl/settings_optimize.php:22
2746
  msgid "CSS Minify"
2747
  msgstr ""
2748
 
2749
- #: admin/tpl/settings_optimize.php:26
2750
  msgid "Minify CSS files."
2751
  msgstr ""
2752
 
2753
- #: admin/tpl/settings_optimize.php:32
2754
  msgid "CSS Combine"
2755
  msgstr ""
2756
 
2757
- #: admin/tpl/settings_optimize.php:36
2758
  msgid "Combine CSS files."
2759
  msgstr ""
2760
 
2761
- #: admin/tpl/settings_optimize.php:42
2762
  msgid "CSS HTTP/2 Push"
2763
  msgstr ""
2764
 
2765
- #: admin/tpl/settings_optimize.php:46
2766
  msgid ""
2767
  "Pre-send internal CSS files to the browser before they are requested. "
2768
  "(Requires the HTTP/2 protocol)"
2769
  msgstr ""
2770
 
2771
- #: admin/tpl/settings_optimize.php:52
2772
  msgid "CSS Excludes"
2773
  msgstr ""
2774
 
2775
- #: admin/tpl/settings_optimize.php:56
2776
  msgid "Listed CSS files will not be minified/combined."
2777
  msgstr ""
2778
 
2779
- #: admin/tpl/settings_optimize.php:57 admin/tpl/settings_optimize.php:99
2780
- #: admin/tpl/settings_optimize.php:197
2781
- msgid "Both full URLs and partial strings can be used."
2782
- msgstr ""
2783
-
2784
- #: admin/tpl/settings_optimize.php:64
2785
  msgid "JS Minify"
2786
  msgstr ""
2787
 
2788
- #: admin/tpl/settings_optimize.php:68
2789
  msgid "Minify JS files."
2790
  msgstr ""
2791
 
2792
- #: admin/tpl/settings_optimize.php:74
 
2793
  msgid "JS Combine"
2794
  msgstr ""
2795
 
2796
- #: admin/tpl/settings_optimize.php:78
2797
  msgid "Combine JS files."
2798
  msgstr ""
2799
 
2800
- #: admin/tpl/settings_optimize.php:84
2801
  msgid "JS HTTP/2 Push"
2802
  msgstr ""
2803
 
2804
- #: admin/tpl/settings_optimize.php:88
2805
  msgid ""
2806
  "Pre-send internal JS files to the browser before they are requested. "
2807
  "(Requires the HTTP/2 protocol)"
2808
  msgstr ""
2809
 
2810
- #: admin/tpl/settings_optimize.php:94
2811
  msgid "JS Excludes"
2812
  msgstr ""
2813
 
2814
- #: admin/tpl/settings_optimize.php:98
2815
  msgid "Listed JS files will not be minified/combined."
2816
  msgstr ""
2817
 
2818
- #: admin/tpl/settings_optimize.php:106
2819
  msgid "CSS/JS Cache TTL"
2820
  msgstr ""
2821
 
2822
- #: admin/tpl/settings_optimize.php:111
2823
  msgid ""
2824
  "Specify how long, in seconds, CSS/JS files are cached. Minimum is %1$s "
2825
  "seconds."
2826
  msgstr ""
2827
 
2828
- #: admin/tpl/settings_optimize.php:118
2829
  msgid "HTML Minify"
2830
  msgstr ""
2831
 
2832
- #: admin/tpl/settings_optimize.php:122
2833
  msgid "Minify HTML content."
2834
  msgstr ""
2835
 
2836
- #: admin/tpl/settings_optimize.php:128
2837
  msgid "Remove Query Strings"
2838
  msgstr ""
2839
 
2840
- #: admin/tpl/settings_optimize.php:132
2841
  msgid "Remove query strings from static resources."
2842
  msgstr ""
2843
 
2844
- #: admin/tpl/settings_optimize.php:133 admin/tpl/settings_optimize.php:154
2845
- #: admin/tpl/settings_optimize.php:175 admin/tpl/settings_optimize.php:186
 
 
2846
  msgid ""
2847
  "This can improve your speed score in services like Pingdom, GTmetrix and "
2848
  "PageSpeed."
2849
  msgstr ""
2850
 
2851
- #: admin/tpl/settings_optimize.php:139
2852
  msgid "Remove Google Fonts"
2853
  msgstr ""
2854
 
2855
- #: admin/tpl/settings_optimize.php:143
2856
  msgid "Prevent google fonts from loading on all your pages."
2857
  msgstr ""
2858
 
2859
- #: admin/tpl/settings_optimize.php:149 admin/tpl/settings_optimize.php:164
 
2860
  msgid "Load CSS Asynchronously"
2861
  msgstr ""
2862
 
2863
- #: admin/tpl/settings_optimize.php:153
2864
  msgid "Optimize CSS delivery. This will load Google Fonts asynchronously too."
2865
  msgstr ""
2866
 
2867
- #: admin/tpl/settings_optimize.php:160
2868
  msgid "Critical CSS Rules"
2869
  msgstr ""
2870
 
2871
- #: admin/tpl/settings_optimize.php:164
2872
  msgid "Specify critical CSS rules for above-the-fold content when enabling %s."
2873
  msgstr ""
2874
 
2875
- #: admin/tpl/settings_optimize.php:170
2876
  msgid "Load JS Deferred"
2877
  msgstr ""
2878
 
2879
- #: admin/tpl/settings_optimize.php:174
2880
  msgid "Doing so can help reduce resource contention and improve performance."
2881
  msgstr ""
2882
 
2883
- #: admin/tpl/settings_optimize.php:181
 
 
 
 
 
 
 
 
2884
  msgid "Remove WordPress Emoji"
2885
  msgstr ""
2886
 
2887
- #: admin/tpl/settings_optimize.php:185
2888
  msgid ""
2889
  "Stop loading wordpress.org emoji. Browser default emoji will be displayed "
2890
  "instead."
2891
  msgstr ""
2892
 
2893
- #: admin/tpl/settings_optimize.php:192
2894
  msgid "URI Excludes"
2895
  msgstr ""
2896
 
2897
- #: admin/tpl/settings_optimize.php:196
2898
  msgid "Prevent any optimization of listed pages."
2899
  msgstr ""
2900
 
2901
- #: admin/tpl/settings_purge.php:5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2902
  msgid "Purge Settings"
2903
  msgstr ""
2904
 
2905
- #: admin/tpl/settings_purge.php:10
2906
  msgid "All pages"
2907
  msgstr ""
2908
 
2909
- #: admin/tpl/settings_purge.php:11
2910
  msgid "Front page"
2911
  msgstr ""
2912
 
2913
- #: admin/tpl/settings_purge.php:12
2914
  msgid "Home page"
2915
  msgstr ""
2916
 
2917
- #: admin/tpl/settings_purge.php:13
2918
  msgid "Pages"
2919
  msgstr ""
2920
 
2921
- #: admin/tpl/settings_purge.php:15
2922
  msgid "All pages with Recent Posts Widget"
2923
  msgstr ""
2924
 
2925
- #: admin/tpl/settings_purge.php:17
2926
  msgid "Author archive"
2927
  msgstr ""
2928
 
2929
- #: admin/tpl/settings_purge.php:18
2930
  msgid "Post type archive"
2931
  msgstr ""
2932
 
2933
- #: admin/tpl/settings_purge.php:20
2934
  msgid "Yearly archive"
2935
  msgstr ""
2936
 
2937
- #: admin/tpl/settings_purge.php:21
2938
  msgid "Monthly archive"
2939
  msgstr ""
2940
 
2941
- #: admin/tpl/settings_purge.php:22
2942
  msgid "Daily archive"
2943
  msgstr ""
2944
 
2945
- #: admin/tpl/settings_purge.php:24
2946
  msgid "Term archive (include category, tag, and tax)"
2947
  msgstr ""
2948
 
2949
- #: admin/tpl/settings_purge.php:44
2950
  msgid "Auto Purge Rules For Publish/Update"
2951
  msgstr ""
2952
 
2953
- #: admin/tpl/settings_purge.php:47
2954
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:654
2955
  msgid "Note:"
2956
  msgstr ""
2957
 
2958
- #: admin/tpl/settings_purge.php:49
2959
  msgid ""
2960
  "Select \"All\" if there are dynamic widgets linked to posts on pages other "
2961
  "than the front or home pages."
2962
  msgstr ""
2963
 
2964
- #: admin/tpl/settings_purge.php:50
2965
  msgid "Other checkboxes will be ignored."
2966
  msgstr ""
2967
 
2968
- #: admin/tpl/settings_purge.php:51
2969
  msgid ""
2970
  "Select only the archive types that are currently used, the others can be "
2971
  "left unchecked."
2972
  msgstr ""
2973
 
2974
- #: admin/tpl/settings_purge.php:67
2975
  msgid ""
2976
  "Select which pages will be automatically purged when posts are published/"
2977
  "updated."
2978
  msgstr ""
2979
 
2980
- #: admin/tpl/settings_purge.php:73 admin/tpl/settings_purge.php:90
 
2981
  msgid "Scheduled Purge URLs"
2982
  msgstr ""
2983
 
2984
- #: admin/tpl/settings_purge.php:77
2985
  msgid ""
2986
  "The URLs here (one per line) will be purged automatically at the time set in "
2987
  "the option \"%s\"."
2988
  msgstr ""
2989
 
2990
- #: admin/tpl/settings_purge.php:77 admin/tpl/settings_purge.php:85
 
2991
  msgid "Scheduled Purge Time"
2992
  msgstr ""
2993
 
2994
- #: admin/tpl/settings_purge.php:78
2995
  msgid "Both %1$s and %2$s are acceptable."
2996
  msgstr ""
2997
 
2998
- #: admin/tpl/settings_purge.php:90
2999
  msgid "Specify the time to purge the \"%s\" list."
3000
  msgstr ""
3001
 
3002
- #: admin/tpl/settings_purge.php:91
3003
  msgid "Current server time is %s."
3004
  msgstr ""
3005
 
3006
- #: admin/tpl/show_display_installed.php:5
3007
- msgid "LiteSpeed Cache plugin is installed!"
3008
- msgstr ""
3009
-
3010
- #: admin/tpl/show_display_installed.php:6
3011
- msgid ""
3012
- "This message indicates that the plugin was installed by the server admin."
3013
- msgstr ""
3014
-
3015
- #: admin/tpl/show_display_installed.php:7
3016
- msgid ""
3017
- "The LiteSpeed Cache plugin is used to cache pages - a simple way to improve "
3018
- "the performance of the site."
3019
- msgstr ""
3020
-
3021
- #: admin/tpl/show_display_installed.php:8
3022
- msgid ""
3023
- "However, there is no way of knowing all the possible customizations that "
3024
- "were implemented."
3025
  msgstr ""
3026
 
3027
- #: admin/tpl/show_display_installed.php:9
3028
- msgid ""
3029
- "For that reason, please test the site to make sure everything still "
3030
- "functions properly."
3031
  msgstr ""
3032
 
3033
- #: admin/tpl/show_display_installed.php:11
3034
- msgid "Examples of test cases include:"
3035
  msgstr ""
3036
 
3037
- #: admin/tpl/show_display_installed.php:13
3038
- msgid "Visit the site while logged out."
3039
  msgstr ""
3040
 
3041
- #: admin/tpl/show_display_installed.php:14
3042
- msgid "Create a post, make sure the front page is accurate."
3043
  msgstr ""
3044
 
3045
- #: admin/tpl/show_display_installed.php:16
3046
- msgid ""
3047
- "If there are any questions, the team is always happy to answer any questions "
3048
- "on the <a %s>support forum</a>."
3049
  msgstr ""
3050
 
3051
- #: admin/tpl/show_display_installed.php:19
3052
- msgid ""
3053
- "If you would rather not move at litespeed, you can deactivate this plugin."
3054
  msgstr ""
3055
 
3056
- #: admin/tpl/show_error_cookie.php:4
3057
- msgid "NOTICE: Database login cookie did not match your login cookie."
3058
  msgstr ""
3059
 
3060
- #: admin/tpl/show_error_cookie.php:5
3061
- msgid ""
3062
- "If the login cookie was recently changed in the settings, please log out and "
3063
- "back in."
3064
  msgstr ""
3065
 
3066
- #: admin/tpl/show_error_cookie.php:6
3067
- msgid ""
3068
- "If not, please verify the setting in the <a href=\"%1$s\">Advanced tab</a>."
3069
  msgstr ""
3070
 
3071
- #: admin/tpl/show_error_cookie.php:10
3072
  msgid ""
3073
- "If using OpenLiteSpeed, the server must be restarted once for the changes to "
3074
- "take effect."
3075
  msgstr ""
3076
 
3077
- #: admin/tpl/show_rule_conflict.php:5
3078
- msgid ""
3079
- "Unexpected cache rule %2$s found in %1$s file. This rule may cause visitors "
3080
- "to see old versions of pages due to the browser caching html pages. If you "
3081
- "are sure that html pages are not being browser cached, this message can be "
3082
- "dismissed. (<a %3$s>Learn More</a>)"
3083
  msgstr ""
3084
 
3085
  #: cli/litespeed-cache-cli-purge.class.php:90
@@ -3098,105 +3234,105 @@ msgstr ""
3098
  msgid "Purged the tags!"
3099
  msgstr ""
3100
 
3101
- #: includes/litespeed-cache-crawler.class.php:108
3102
  msgid "Can not find any form data for blacklist"
3103
  msgstr ""
3104
 
3105
- #: includes/litespeed-cache-crawler.class.php:123
3106
  msgid "File saved successfully: %s"
3107
  msgstr ""
3108
 
3109
- #: includes/litespeed-cache-crawler.class.php:175
3110
  msgid "File created successfully: %s"
3111
  msgstr ""
3112
 
3113
- #: includes/litespeed-cache-crawler.class.php:323
3114
  msgid "Failed to send position reset notification: %s"
3115
  msgstr ""
3116
 
3117
- #: includes/litespeed-cache-crawler.class.php:327
3118
  msgid "Position reset notification sent successfully"
3119
  msgstr ""
3120
 
3121
- #: includes/litespeed-cache-crawler.class.php:410
3122
  #: lib/litespeed/litespeed-crawler.class.php:327
3123
  msgid "Reached end of sitemap file. Crawling completed."
3124
  msgstr ""
3125
 
3126
- #: includes/litespeed-cache-gui.class.php:64
3127
  msgid "Purge this page"
3128
  msgstr ""
3129
 
3130
- #: includes/litespeed-cache-gui.class.php:72
3131
  msgid "Mark this page as "
3132
  msgstr ""
3133
 
3134
- #: includes/litespeed-cache-gui.class.php:79
3135
  msgid "Non cacheable"
3136
  msgstr ""
3137
 
3138
- #: includes/litespeed-cache-gui.class.php:86
3139
  msgid "Private cache"
3140
  msgstr ""
3141
 
3142
- #: includes/litespeed-cache-gui.class.php:93
3143
  msgid "No optimization"
3144
  msgstr ""
3145
 
3146
- #: includes/litespeed-cache-gui.class.php:100
3147
  msgid "More settings"
3148
  msgstr ""
3149
 
3150
- #: includes/litespeed-cache-purge.class.php:202
3151
- msgid "Purge category %s"
3152
  msgstr ""
3153
 
3154
- #: includes/litespeed-cache-purge.class.php:229
3155
- msgid "Purge Post ID %s"
3156
  msgstr ""
3157
 
3158
- #: includes/litespeed-cache-purge.class.php:258
3159
- msgid "Purge tag %s"
3160
  msgstr ""
3161
 
3162
- #: includes/litespeed-cache-purge.class.php:292
3163
- msgid "Purge url %s"
3164
  msgstr ""
3165
 
3166
- #: includes/litespeed-cache-task.class.php:111
3167
- msgid "LiteSpeed Cache Custom Cron"
3168
  msgstr ""
3169
 
3170
- #: includes/litespeed-cache.class.php:220
3171
- msgid "Crawler blacklist is saved."
3172
  msgstr ""
3173
 
3174
- #: includes/litespeed-cache.class.php:225
3175
- msgid "Notified LiteSpeed Web Server to purge the front page."
3176
  msgstr ""
3177
 
3178
- #: includes/litespeed-cache.class.php:230
3179
- msgid "Notified LiteSpeed Web Server to purge pages."
3180
  msgstr ""
3181
 
3182
- #: includes/litespeed-cache.class.php:235
3183
- msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
3184
  msgstr ""
3185
 
3186
- #: includes/litespeed-cache.class.php:240
3187
- msgid "Notified LiteSpeed Web Server to purge error pages."
3188
  msgstr ""
3189
 
3190
- #: includes/litespeed-cache.class.php:246
3191
- msgid "Notified LiteSpeed Web Server to purge all caches."
3192
  msgstr ""
3193
 
3194
- #: includes/litespeed-cache.class.php:253
3195
- msgid "Notified LiteSpeed Web Server to purge everything."
3196
  msgstr ""
3197
 
3198
- #: includes/litespeed-cache.class.php:268
3199
- msgid "Notified LiteSpeed Web Server to purge the list."
3200
  msgstr ""
3201
 
3202
  #: lib/litespeed/litespeed-crawler.class.php:174
@@ -3252,67 +3388,67 @@ msgstr ""
3252
  msgid "Failed to write to %s."
3253
  msgstr ""
3254
 
3255
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:598
3256
  msgid "WooCommerce"
3257
  msgstr ""
3258
 
3259
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:601
3260
  msgid "Purge product on changes to the quantity or stock status."
3261
  msgstr ""
3262
 
3263
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:602
3264
  msgid "Purge categories only when stock status changes."
3265
  msgstr ""
3266
 
3267
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:603
3268
  msgid "Purge product and categories only when the stock status changes."
3269
  msgstr ""
3270
 
3271
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:604
3272
  msgid "Purge product only when the stock status changes."
3273
  msgstr ""
3274
 
3275
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:605
3276
  msgid "Do not purge categories on changes to the quantity or stock status."
3277
  msgstr ""
3278
 
3279
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:606
3280
  msgid ""
3281
  "Always purge both product and categories on changes to the quantity or stock "
3282
  "status."
3283
  msgstr ""
3284
 
3285
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:609
3286
  msgid ""
3287
  "Determines how changes in product quantity and product stock status affect "
3288
  "product pages and their associated category pages."
3289
  msgstr ""
3290
 
3291
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:610
3292
  msgid ""
3293
  "Checking this option will force the shop page to use the front page TTL "
3294
  "setting."
3295
  msgstr ""
3296
 
3297
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:611
3298
  msgid ""
3299
  "For example, if the homepage for the site is located at %1$s, the shop page "
3300
  "may be located at %2$s."
3301
  msgstr ""
3302
 
3303
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:639
3304
  msgid "Product Update Interval"
3305
  msgstr ""
3306
 
3307
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:646
3308
  msgid "Use Front Page TTL for the Shop Page"
3309
  msgstr ""
3310
 
3311
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:656
3312
  msgid "After verifying that the cache works in general, please test the cart."
3313
  msgstr ""
3314
 
3315
- #: thirdparty/lscwp-3rd-woocommerce.cls.php:657
3316
  msgid "To test the cart, visit the %s."
3317
  msgstr ""
3318
 
2
  # This file is distributed under the same license as the LiteSpeed Cache package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: LiteSpeed Cache 1.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/litespeed-cache\n"
7
+ "POT-Creation-Date: 2017-10-17 18:43:22+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
+ #: admin/admin-api.class.php:153
16
+ msgid "Generate the key from server successfully"
17
+ msgstr ""
18
+
19
  #: admin/litespeed-cache-admin-display.class.php:140
20
  msgid "Manage"
21
  msgstr ""
22
 
23
  #: admin/litespeed-cache-admin-display.class.php:142
24
+ #: admin/litespeed-cache-admin-display.class.php:237
25
  msgid "Settings"
26
  msgstr ""
27
 
33
  msgid "Information"
34
  msgstr ""
35
 
36
+ #: admin/litespeed-cache-admin-display.class.php:152 admin/tpl/info.php:10
 
 
 
 
37
  #: admin/tpl/settings.php:28
38
  msgid "Crawler"
39
  msgstr ""
40
 
41
+ #: admin/litespeed-cache-admin-display.class.php:156
42
+ msgid "Environment Report"
43
+ msgstr ""
44
+
45
+ #: admin/litespeed-cache-admin-display.class.php:160
46
+ #: admin/tpl/setting/settings_debug.php:10
47
  msgid "Debug Log"
48
  msgstr ""
49
 
50
+ #: admin/litespeed-cache-admin-display.class.php:257
51
  msgid ""
52
  "It is recommended that LiteSpeed Cache be purged after updating a plugin."
53
  msgstr ""
54
 
55
+ #: admin/litespeed-cache-admin-display.class.php:297
56
  msgid "LiteSpeed Cache Purge All"
57
  msgstr ""
58
 
59
+ #: admin/litespeed-cache-admin-display.class.php:806
60
+ #: admin/tpl/setting/settings_optimize.php:240
61
  msgid "ON"
62
  msgstr ""
63
 
64
+ #: admin/litespeed-cache-admin-display.class.php:810
65
  msgid "OFF"
66
  msgstr ""
67
 
68
+ #: admin/litespeed-cache-admin-display.class.php:843
69
  msgid "Recommended value: %s"
70
  msgstr ""
71
 
329
  msgid "Clean all CSS/JS optimizer data successfully."
330
  msgstr ""
331
 
332
+ #: admin/litespeed-cache-admin-rules.class.php:657
333
  msgid ""
334
  "<p>Please add/replace the following codes into the beginning of %1$s:</p> "
335
  "%2$s"
336
  msgstr ""
337
 
338
+ #: admin/litespeed-cache-admin-rules.class.php:855
339
  msgid "File Saved."
340
  msgstr ""
341
 
375
  msgid "500"
376
  msgstr ""
377
 
378
+ #: admin/litespeed-cache-admin-settings.class.php:590
379
+ #: admin/tpl/setting/settings_debug.php:75
380
  msgid "Log File Size Limit"
381
  msgstr ""
382
 
383
+ #: admin/litespeed-cache-admin-settings.class.php:656
384
+ #: admin/tpl/setting/settings_crawler.php:10
385
  msgid "Delay"
386
  msgstr ""
387
 
388
+ #: admin/litespeed-cache-admin-settings.class.php:657
389
+ #: admin/tpl/setting/settings_crawler.php:22
390
  msgid "Run Duration"
391
  msgstr ""
392
 
393
+ #: admin/litespeed-cache-admin-settings.class.php:658
394
  msgid "Cron Interval"
395
  msgstr ""
396
 
397
+ #: admin/litespeed-cache-admin-settings.class.php:659
398
  msgid "Whole Interval"
399
  msgstr ""
400
 
401
+ #: admin/litespeed-cache-admin-settings.class.php:660
402
+ #: admin/tpl/setting/settings_crawler.php:58
403
  msgid "Threads"
404
  msgstr ""
405
 
427
  "page caching offerings—such as minifying css/js files."
428
  msgstr ""
429
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
430
  #: admin/tpl/crawler.php:14 admin/tpl/crawler.php:80
431
  msgid "LiteSpeed Cache Crawler"
432
  msgstr ""
468
  msgid "Crawler Cron"
469
  msgstr ""
470
 
471
+ #: admin/tpl/crawler.php:63 admin/tpl/setting/settings_optimize.php:9
472
+ #: admin/tpl/settings.php:117
473
  msgid "WARNING"
474
  msgstr ""
475
 
520
  msgid "Is running"
521
  msgstr ""
522
 
523
+ #: admin/tpl/crawler.php:136 admin/tpl/setting/settings_general.php:30
524
  msgid "Enable"
525
  msgstr ""
526
 
527
  #: admin/tpl/crawler.php:136 admin/tpl/esi_widget_edit.php:58
528
+ #: admin/tpl/setting/settings_general.php:24
529
  msgid "Disable"
530
  msgstr ""
531
 
637
  "changed."
638
  msgstr ""
639
 
640
+ #: admin/tpl/esi_widget_edit.php:30 admin/tpl/setting/settings_esi.php:35
641
  msgid "Enable ESI"
642
  msgstr ""
643
 
653
  msgid "Widget Cache TTL:"
654
  msgstr ""
655
 
656
+ #: admin/tpl/esi_widget_edit.php:72 admin/tpl/setting/settings_crawler.php:25
657
+ #: admin/tpl/setting/settings_crawler.php:37
658
+ #: admin/tpl/setting/settings_crawler.php:49
659
+ #: admin/tpl/setting/settings_general.php:59
660
+ #: admin/tpl/setting/settings_general.php:71
661
+ #: admin/tpl/setting/settings_general.php:83
662
+ #: admin/tpl/setting/settings_general.php:95
663
+ #: admin/tpl/setting/settings_general.php:108
664
+ #: admin/tpl/setting/settings_general.php:121
665
+ #: admin/tpl/setting/settings_general.php:134
666
+ #: admin/tpl/setting/settings_optimize.php:119
667
  msgid "seconds"
668
  msgstr ""
669
 
675
  msgid "A TTL of 0 indicates do not cache."
676
  msgstr ""
677
 
678
+ #: admin/tpl/inc/admin_footer.php:5
679
+ msgid ""
680
+ "Rate <strong>LiteSpeed Cache</strong> with %s on WordPress.org if you like "
681
+ "us!"
682
+ msgstr ""
683
+
684
+ #: admin/tpl/inc/admin_footer.php:8
685
+ msgid ""
686
+ "If there are any questions that are not answered in the <a %s>FAQs</a>, do "
687
+ "not hesitate to ask them on the <a %s>support forum</a>."
688
+ msgstr ""
689
+
690
+ #: admin/tpl/inc/banner_promo.php:14
691
+ msgid "Welcome to LiteSpeed"
692
+ msgstr ""
693
+
694
+ #: admin/tpl/inc/banner_promo.php:17
695
+ msgid "Thank you for using LiteSpeed."
696
+ msgstr ""
697
+
698
+ #: admin/tpl/inc/banner_promo.php:19
699
+ msgid ""
700
+ "If you have any questions, please do not hesitate to let us know in <a "
701
+ "%s>our support forum</a> or by <a %s>submitting a ticket with us</a>."
702
+ msgstr ""
703
+
704
+ #: admin/tpl/inc/banner_promo.php:26
705
+ msgid ""
706
+ "This plugin is created with love by LiteSpeed. Your rating is the simplest "
707
+ "way to support us. We really appreciate it!"
708
+ msgstr ""
709
+
710
+ #: admin/tpl/inc/banner_promo.php:29
711
+ msgid "Sure I'd love to!"
712
+ msgstr ""
713
+
714
+ #: admin/tpl/inc/banner_promo.php:30
715
+ msgid "I've already left a review"
716
+ msgstr ""
717
+
718
+ #: admin/tpl/inc/banner_promo.php:31
719
+ msgid "Maybe later"
720
+ msgstr ""
721
+
722
+ #: admin/tpl/inc/check_cache_disabled.php:10
723
+ msgid ""
724
+ "WARNING: LiteSpeed cache is disabled. The functionalities here can not work."
725
+ msgstr ""
726
+
727
+ #: admin/tpl/inc/help_tabs.php:7
728
  msgid "Overview"
729
  msgstr ""
730
 
731
+ #: admin/tpl/inc/help_tabs.php:9
732
  msgid "LiteSpeed Cache is a page cache built into LiteSpeed Web Server."
733
  msgstr ""
734
 
735
+ #: admin/tpl/inc/help_tabs.php:10
736
  msgid ""
737
  "This plugin communicates with LiteSpeed Web Server to let it know which "
738
  "pages are cacheable and when to purge them."
739
  msgstr ""
740
 
741
+ #: admin/tpl/inc/help_tabs.php:11
742
  msgid ""
743
  "A LiteSpeed server (OLS, LSWS, WebADC) and its LSCache module must be "
744
  "installed and enabled."
745
  msgstr ""
746
 
747
+ #: admin/tpl/inc/help_tabs.php:22
748
  msgid "For more information:"
749
  msgstr ""
750
 
751
+ #: admin/tpl/inc/help_tabs.php:24
752
  msgid "Support Forum"
753
  msgstr ""
754
 
755
+ #: admin/tpl/inc/show_display_installed.php:5
756
+ msgid "LiteSpeed Cache plugin is installed!"
757
  msgstr ""
758
 
759
+ #: admin/tpl/inc/show_display_installed.php:6
760
+ msgid ""
761
+ "This message indicates that the plugin was installed by the server admin."
762
  msgstr ""
763
 
764
+ #: admin/tpl/inc/show_display_installed.php:7
765
+ msgid ""
766
+ "The LiteSpeed Cache plugin is used to cache pages - a simple way to improve "
767
+ "the performance of the site."
768
  msgstr ""
769
 
770
+ #: admin/tpl/inc/show_display_installed.php:8
771
+ msgid ""
772
+ "However, there is no way of knowing all the possible customizations that "
773
+ "were implemented."
774
  msgstr ""
775
 
776
+ #: admin/tpl/inc/show_display_installed.php:9
777
+ msgid ""
778
+ "For that reason, please test the site to make sure everything still "
779
+ "functions properly."
780
  msgstr ""
781
 
782
+ #: admin/tpl/inc/show_display_installed.php:11
783
+ msgid "Examples of test cases include:"
784
+ msgstr ""
785
+
786
+ #: admin/tpl/inc/show_display_installed.php:13
787
+ msgid "Visit the site while logged out."
788
+ msgstr ""
789
+
790
+ #: admin/tpl/inc/show_display_installed.php:14
791
+ msgid "Create a post, make sure the front page is accurate."
792
+ msgstr ""
793
+
794
+ #: admin/tpl/inc/show_display_installed.php:16
795
+ msgid ""
796
+ "If there are any questions, the team is always happy to answer any questions "
797
+ "on the <a %s>support forum</a>."
798
+ msgstr ""
799
+
800
+ #: admin/tpl/inc/show_display_installed.php:19
801
+ msgid ""
802
+ "If you would rather not move at litespeed, you can deactivate this plugin."
803
+ msgstr ""
804
+
805
+ #: admin/tpl/inc/show_error_cookie.php:4
806
+ msgid "NOTICE: Database login cookie did not match your login cookie."
807
+ msgstr ""
808
+
809
+ #: admin/tpl/inc/show_error_cookie.php:5
810
+ msgid ""
811
+ "If the login cookie was recently changed in the settings, please log out and "
812
+ "back in."
813
  msgstr ""
814
 
815
+ #: admin/tpl/inc/show_error_cookie.php:6
816
+ msgid ""
817
+ "If not, please verify the setting in the <a href=\"%1$s\">Advanced tab</a>."
818
+ msgstr ""
819
+
820
+ #: admin/tpl/inc/show_error_cookie.php:10
821
+ msgid ""
822
+ "If using OpenLiteSpeed, the server must be restarted once for the changes to "
823
+ "take effect."
824
+ msgstr ""
825
+
826
+ #: admin/tpl/inc/show_rule_conflict.php:5
827
+ msgid ""
828
+ "Unexpected cache rule %2$s found in %1$s file. This rule may cause visitors "
829
+ "to see old versions of pages due to the browser caching html pages. If you "
830
+ "are sure that html pages are not being browser cached, this message can be "
831
+ "dismissed. (<a %3$s>Learn More</a>)"
832
+ msgstr ""
833
+
834
+ #: admin/tpl/info/info_admin_ip.php:5
835
  msgid "This is used to display a page without caching it."
836
  msgstr ""
837
 
838
+ #: admin/tpl/info/info_admin_ip.php:6
839
  msgid ""
840
  "An example use case is to compare a cached version of a page with an "
841
  "uncached version."
842
  msgstr ""
843
 
844
+ #: admin/tpl/info/info_admin_ip.php:9
845
  msgid "This is used to purge most cache tags associated with the page."
846
  msgstr ""
847
 
848
+ #: admin/tpl/info/info_admin_ip.php:10
849
  msgid "The lone exception is the blog ID tag."
850
  msgstr ""
851
 
852
+ #: admin/tpl/info/info_admin_ip.php:11
853
  msgid ""
854
  "Note that this means that pages with the same cache tag will be purged as "
855
  "well."
856
  msgstr ""
857
 
858
+ #: admin/tpl/info/info_admin_ip.php:14
859
  msgid "This is used to show all the cache headers associated with a page."
860
  msgstr ""
861
 
862
+ #: admin/tpl/info/info_admin_ip.php:15
863
  msgid "This may be useful for debugging purposes."
864
  msgstr ""
865
 
866
+ #: admin/tpl/info/info_admin_ip.php:19
867
  msgid "Admin IP Query String Actions"
868
  msgstr ""
869
 
870
+ #: admin/tpl/info/info_admin_ip.php:21
871
  msgid ""
872
  "The following commands are available to the admin and do not require log-in, "
873
  "providing quick access to actions on the various pages."
874
  msgstr ""
875
 
876
+ #: admin/tpl/info/info_admin_ip.php:23
877
  msgid "Action List:"
878
  msgstr ""
879
 
880
+ #: admin/tpl/info/info_admin_ip.php:28
881
  msgid "This is used to purge the first cache tag associated with the page."
882
  msgstr ""
883
 
884
+ #: admin/tpl/info/info_admin_ip.php:32
885
  msgid ""
886
  "To trigger the action for a page, access the page with the query string %s"
887
  msgstr ""
888
 
889
+ #: admin/tpl/info/info_common_rewrite.php:8
890
+ #: admin/tpl/setting/settings_excludes.php:60
891
+ #: admin/tpl/setting/settings_excludes.php:98
892
+ #: admin/tpl/setting/settings_inc.cache_browser.php:12
893
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:14
894
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:18
895
+ #: admin/tpl/setting/settings_inc.cache_resources.php:15
896
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:22
897
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:21
898
+ #: admin/tpl/setting/settings_optimize.php:242
899
  msgid "NOTE:"
900
  msgstr ""
901
 
902
+ #: admin/tpl/info/info_common_rewrite.php:10
903
  msgid "The following configuration can only be changed by the network admin."
904
  msgstr ""
905
 
906
+ #: admin/tpl/info/info_common_rewrite.php:11
907
  msgid "Please contact the network admin to make any changes."
908
  msgstr ""
909
 
910
+ #: admin/tpl/info/info_common_rewrite.php:14
911
+ #: admin/tpl/setting/settings_advanced.php:6
912
  msgid "NOTICE:"
913
  msgstr ""
914
 
915
+ #: admin/tpl/info/info_common_rewrite.php:17
916
  msgid ""
917
  "The following rewrite rules can be configured in the LiteSpeed Cache "
918
  "settings page."
919
  msgstr ""
920
 
921
+ #: admin/tpl/info/info_common_rewrite.php:18
922
  msgid "Please make any needed changes on that page."
923
  msgstr ""
924
 
925
+ #: admin/tpl/info/info_common_rewrite.php:19
926
  msgid "It will automatically generate the correct rules in the htaccess file."
927
  msgstr ""
928
 
929
+ #: admin/tpl/info/info_common_rewrite.php:24
930
  msgid "LiteSpeed Cache Common Rewrite Rules"
931
  msgstr ""
932
 
933
+ #: admin/tpl/info/info_common_rewrite.php:31
934
  msgid "Mobile Views:"
935
  msgstr ""
936
 
937
+ #: admin/tpl/info/info_common_rewrite.php:34
938
  msgid ""
939
  "Some sites have adaptive views, meaning the page sent will adapt to the "
940
  "browser type (desktop vs mobile)."
941
  msgstr ""
942
 
943
+ #: admin/tpl/info/info_common_rewrite.php:35
944
  msgid ""
945
  "This rewrite rule is used for sites that load a different page for each type."
946
  msgstr ""
947
 
948
+ #: admin/tpl/info/info_common_rewrite.php:38
949
  msgid ""
950
  "This configuration can be added on the settings page in the General tab."
951
  msgstr ""
952
 
953
+ #: admin/tpl/info/info_common_rewrite.php:44
954
  msgid "Do Not Cache Cookies:"
955
  msgstr ""
956
 
957
+ #: admin/tpl/info/info_common_rewrite.php:46
958
  msgid ""
959
  "Another common rewrite rule is to notify the cache not to cache when it sees "
960
  "a specified cookie name."
961
  msgstr ""
962
 
963
+ #: admin/tpl/info/info_common_rewrite.php:47
964
+ #: admin/tpl/info/info_common_rewrite.php:55
965
  msgid ""
966
  "This configuration can be added on the settings page in the Do Not Cache tab."
967
  msgstr ""
968
 
969
+ #: admin/tpl/info/info_common_rewrite.php:52
970
  msgid "Do Not Cache User Agent:"
971
  msgstr ""
972
 
973
+ #: admin/tpl/info/info_common_rewrite.php:54
974
  msgid ""
975
  "A not so commonly used rewrite rule is to notify the cache not to cache when "
976
  "it sees a specified User Agent."
977
  msgstr ""
978
 
979
+ #: admin/tpl/info/info_compatibility.php:27
980
  msgid "LiteSpeed Cache Plugin Compatibility"
981
  msgstr ""
982
 
983
+ #: admin/tpl/info/info_compatibility.php:29
984
  msgid "Link Here"
985
  msgstr ""
986
 
987
+ #: admin/tpl/info/info_compatibility.php:31
988
  msgid ""
989
  "Please add a comment listing the plugins that you are using and how they are "
990
  "functioning on the support thread."
991
  msgstr ""
992
 
993
+ #: admin/tpl/info/info_compatibility.php:32
994
  msgid "With your help, we can provide the best WordPress caching solution."
995
  msgstr ""
996
 
997
+ #: admin/tpl/info/info_compatibility.php:35
998
  msgid ""
999
  "This is a list of plugins that are confirmed to be compatible with LiteSpeed "
1000
  "Cache Plugin:"
1001
  msgstr ""
1002
 
1003
+ #: admin/tpl/info/info_compatibility.php:44
1004
  msgid "This is a list of known UNSUPPORTED plugins:"
1005
  msgstr ""
1006
 
1007
+ #: admin/tpl/info/info_config.php:4
1008
  msgid "LiteSpeed Cache Configuration"
1009
  msgstr ""
1010
 
1011
+ #: admin/tpl/info/info_config.php:7
1012
  msgid "Instructions for LiteSpeed Web Server Enterprise"
1013
  msgstr ""
1014
 
1015
+ #: admin/tpl/info/info_config.php:9
1016
  msgid "Make sure that the server license has the LSCache module enabled."
1017
  msgstr ""
1018
 
1019
+ #: admin/tpl/info/info_config.php:10
1020
  msgid ""
1021
  "A <a %s>2-CPU trial license with LSCache module</a> is available for free "
1022
  "for %d days."
1023
  msgstr ""
1024
 
1025
+ #: admin/tpl/info/info_config.php:14
1026
  msgid "The server must be configured to have caching enabled."
1027
  msgstr ""
1028
 
1029
+ #: admin/tpl/info/info_config.php:15
1030
  msgid "If you are the server admin, <a %s>click here.</a>"
1031
  msgstr ""
1032
 
1033
+ #: admin/tpl/info/info_config.php:17
1034
  msgid ""
1035
  "Otherwise request that the server admin configure the cache root for the "
1036
  "server."
1037
  msgstr ""
1038
 
1039
+ #: admin/tpl/info/info_config.php:20
1040
  msgid ""
1041
  "In the .htaccess file for the WordPress installation, add the following:"
1042
  msgstr ""
1043
 
1044
+ #: admin/tpl/info/info_config.php:27
1045
  msgid "Instructions for OpenLiteSpeed"
1046
  msgstr ""
1047
 
1048
+ #: admin/tpl/info/info_config.php:28
1049
  msgid "This integration utilizes OLS's cache module."
1050
  msgstr ""
1051
 
1052
+ #: admin/tpl/info/info_config.php:30
1053
  msgid ""
1054
  "If it is a fresh OLS installation, the easiest way to integrate is to use <a "
1055
  "%s>ols1clk.</a>"
1056
  msgstr ""
1057
 
1058
+ #: admin/tpl/info/info_config.php:32
1059
  msgid "If using an existing WordPress installation, use the %s parameter."
1060
  msgstr ""
1061
 
1062
+ #: admin/tpl/info/info_config.php:33
1063
  msgid ""
1064
  "Else if OLS and WordPress are already installed, please follow the "
1065
  "instructions <a %s>here.</a>"
1066
  msgstr ""
1067
 
1068
+ #: admin/tpl/info/info_config.php:38
1069
  msgid "How to test the plugin"
1070
  msgstr ""
1071
 
1072
+ #: admin/tpl/info/info_config.php:39
1073
  msgid ""
1074
  "The LiteSpeed Cache Plugin utilizes LiteSpeed specific response headers."
1075
  msgstr ""
1076
 
1077
+ #: admin/tpl/info/info_config.php:41
1078
  msgid ""
1079
  "Visiting a page for the first time should result in a %s or %s response "
1080
  "header for the page."
1081
  msgstr ""
1082
 
1083
+ #: admin/tpl/info/info_config.php:46
1084
  msgid ""
1085
  "Subsequent requests should have the %s response header until the page is "
1086
  "updated, expired, or purged."
1087
  msgstr ""
1088
 
1089
+ #: admin/tpl/info/info_config.php:49
1090
  msgid "Please visit <a %s>this page</a> for more information."
1091
  msgstr ""
1092
 
1093
+ #: admin/tpl/info/info_config.php:53
1094
  msgid "Cache tag prefix setting"
1095
  msgstr ""
1096
 
1097
+ #: admin/tpl/info/info_config.php:56
1098
  msgid ""
1099
  "The value of this wordpress cache tag prefix is %1$s. If you want to change "
1100
  "the value to avoid conflicts with multiple sites, please add %2$s to %3$s."
1101
  msgstr ""
1102
 
1103
+ #: admin/tpl/info/info_crawler.php:7
1104
  msgid "Crawler Introduction"
1105
  msgstr ""
1106
 
1107
+ #: admin/tpl/info/info_crawler.php:11
1108
  msgid "How Does the Crawler Work?"
1109
  msgstr ""
1110
 
1111
+ #: admin/tpl/info/info_crawler.php:13
1112
  msgid ""
1113
  "Using a sitemap as a guide, LSCache’s crawler, travels its way throughout "
1114
  "the backend, refreshing pages that have expired in the cache. The purpose is "
1116
  "uncached content."
1117
  msgstr ""
1118
 
1119
+ #: admin/tpl/info/info_crawler.php:15
1120
  msgid ""
1121
  "The sitemap can be generated by the crawler, or you can provide your own "
1122
  "custom map."
1123
  msgstr ""
1124
 
1125
+ #: admin/tpl/info/info_crawler.php:17
1126
  msgid ""
1127
  "To learn more about each of the crawler settings, see <a %s>our wiki - "
1128
  "Crawler Settings</a>."
1129
  msgstr ""
1130
 
1131
+ #: admin/tpl/info/info_crawler.php:21
1132
  msgid "Should I Enable the Crawler?"
1133
  msgstr ""
1134
 
1135
+ #: admin/tpl/info/info_crawler.php:23
1136
  msgid "Not every site needs a crawler."
1137
  msgstr ""
1138
 
1139
+ #: admin/tpl/info/info_crawler.php:25
1140
  msgid ""
1141
  "In WordPress, the first visitor to an uncached page waits for the page to "
1142
  "be dynamically-generated and served, and the page is then cached for "
1143
  "subsequent visitors."
1144
  msgstr ""
1145
 
1146
+ #: admin/tpl/info/info_crawler.php:27
1147
  msgid ""
1148
  "The LSCache crawler makes the first visitor’s experience better by "
1149
  "essentially becoming the first visitor. The crawler caches the page, and the "
1154
  "large crowd."
1155
  msgstr ""
1156
 
1157
+ #: admin/tpl/info/info_crawler.php:29
1158
  msgid ""
1159
  "You should weigh this benefit against your server’s resources. If resources "
1160
  "are plentiful, then the crawler is a nice thing to have."
1161
  msgstr ""
1162
 
1163
+ #: admin/tpl/info/info_crawler.php:31
1164
  msgid ""
1165
  "If your site is busy, you’ll find that commonly-visited pages are quickly re-"
1166
  "cached by new visitors, without the aid of a crawler. An extra crawler task "
1167
  "would compete for server resources while delivering minimal benefits."
1168
  msgstr ""
1169
 
1170
+ #: admin/tpl/info/info_crawler.php:33
1171
  msgid ""
1172
  "The decision to use a crawler depends on the busy-ness of the site and the "
1173
  "availability of server resources. Ultimately, it is the hosting provider who "
1174
  "can best make this call."
1175
  msgstr ""
1176
 
1177
+ #: admin/tpl/info/info_crawler.php:38
1178
  msgid "Enabling the Crawler"
1179
  msgstr ""
1180
 
1181
+ #: admin/tpl/info/info_crawler.php:40
1182
  msgid ""
1183
  "Due to the potential of the crawler to consume considerable resources, we "
1184
  "have put the on/off switch in the hands of the server administrators. The "
1185
  "crawler is disabled by default and can only be enabled by an admin."
1186
  msgstr ""
1187
 
1188
+ #: admin/tpl/info/info_crawler.php:42
1189
  msgid ""
1190
  "Instructions for enabling the crawler can be found in <a %s>our wiki - "
1191
  "Enabling the Crawler</a>. If you do not have access to server configuration "
1193
  "assistance."
1194
  msgstr ""
1195
 
1196
+ #: admin/tpl/info/info_crawler.php:47
1197
  msgid "Testing the Crawler"
1198
  msgstr ""
1199
 
1200
+ #: admin/tpl/info/info_crawler.php:49
1201
  msgid ""
1202
  "To determine whether the crawler is working as expected, you can test it "
1203
  "with a single URL."
1204
  msgstr ""
1205
 
1206
+ #: admin/tpl/info/info_crawler.php:53
1207
  msgid "Pick a URL from your sitemap and purge it:"
1208
  msgstr ""
1209
 
1210
+ #: admin/tpl/info/info_crawler.php:54
1211
  msgid ""
1212
  "Navigate to <b>LiteSpeed Cache > Manage > Purge By… > URL</b> and enter the "
1213
  "full URL in the text box."
1214
  msgstr ""
1215
 
1216
+ #: admin/tpl/info/info_crawler.php:57
1217
  msgid "Manually run the crawler:"
1218
  msgstr ""
1219
 
1220
+ #: admin/tpl/info/info_crawler.php:58
1221
  msgid ""
1222
  "Navigate to <b>LiteSpeed Cache > Crawler</b>, make sure <b>Activation</b> is "
1223
  "set to Enable, and press the <b>Manually run</b> button. Wait for it to "
1224
  "finish."
1225
  msgstr ""
1226
 
1227
+ #: admin/tpl/info/info_crawler.php:61
1228
  msgid "See if the purged URL was cached during the crawl:"
1229
  msgstr ""
1230
 
1231
+ #: admin/tpl/info/info_crawler.php:62
1232
  msgid ""
1233
  "Turn on your browser’s Developer Tool/Inspector. Visit the URL that should "
1234
  "have been crawled. Select the <b>Network</b> tab in the inspector, select "
1237
  "correctly, you will see the response header X-LiteSpeed-Cache: hit."
1238
  msgstr ""
1239
 
1240
+ #: admin/tpl/info/info_crawler.php:67
1241
  msgid ""
1242
  "If you don’t see X-LiteSpeed-Cache: hit, and you can’t figure out why the "
1243
  "crawler didn’t cache the purged URL, you can visit <a %s>our support forum</"
1244
  "a> for help."
1245
  msgstr ""
1246
 
1247
+ #: admin/tpl/info/info_faqs.php:5
1248
  msgid "LiteSpeed Cache FAQs"
1249
  msgstr ""
1250
 
1251
+ #: admin/tpl/info/info_faqs.php:9
1252
  msgid "Is the LiteSpeed Cache Plugin for WordPress free?"
1253
  msgstr ""
1254
 
1255
+ #: admin/tpl/info/info_faqs.php:12
1256
  msgid "Yes, the plugin itself will remain free and open source."
1257
  msgstr ""
1258
 
1259
+ #: admin/tpl/info/info_faqs.php:13
1260
  msgid "That said, a LiteSpeed server is required (see question 2)"
1261
  msgstr ""
1262
 
1263
+ #: admin/tpl/info/info_faqs.php:17
1264
  msgid "What server software is required for this plugin?"
1265
  msgstr ""
1266
 
1267
+ #: admin/tpl/info/info_faqs.php:19
1268
  msgid "A LiteSpeed server is required in order to use this plugin."
1269
  msgstr ""
1270
 
1271
+ #: admin/tpl/info/info_faqs.php:25
1272
  msgid "Any single server or cluster including a LiteSpeed server will work."
1273
  msgstr ""
1274
 
1275
+ #: admin/tpl/info/info_faqs.php:28
1276
  msgid "Does this plugin work in a clustered environment?"
1277
  msgstr ""
1278
 
1279
+ #: admin/tpl/info/info_faqs.php:31
1280
  msgid "The cache entries are stored at the litespeed server level."
1281
  msgstr ""
1282
 
1283
+ #: admin/tpl/info/info_faqs.php:32
1284
  msgid ""
1285
  "The simplest solution is to use LiteSpeed WebADC, as the cache entries will "
1286
  "be cached at that level."
1287
  msgstr ""
1288
 
1289
+ #: admin/tpl/info/info_faqs.php:35
1290
  msgid ""
1291
  "If using another load balancer, the cache entries will only be stored at the "
1292
  "backend nodes, not at the load balancer."
1293
  msgstr ""
1294
 
1295
+ #: admin/tpl/info/info_faqs.php:36
1296
  msgid ""
1297
  "The purges will also not be synchronized across the nodes, so this is not "
1298
  "recommended."
1299
  msgstr ""
1300
 
1301
+ #: admin/tpl/info/info_faqs.php:39
1302
  msgid "If a customized solution is required, please contact %s at %s"
1303
  msgstr ""
1304
 
1305
+ #: admin/tpl/info/info_faqs.php:42
1306
  msgid ""
1307
  "NOTICE: The rewrite rules created by this plugin must be copied to the WebADC"
1308
  msgstr ""
1309
 
1310
+ #: admin/tpl/info/info_faqs.php:45
1311
  msgid "Where are the cache entries stored?"
1312
  msgstr ""
1313
 
1314
+ #: admin/tpl/info/info_faqs.php:47
1315
  msgid ""
1316
  "The actual cached pages are stored and managed by LiteSpeed Servers. Nothing "
1317
  "is stored on the PHP side."
1318
  msgstr ""
1319
 
1320
+ #: admin/tpl/info/info_faqs.php:50
1321
  msgid "Is WooCommerce supported?"
1322
  msgstr ""
1323
 
1324
+ #: admin/tpl/info/info_faqs.php:53
1325
  msgid "In short, yes."
1326
  msgstr ""
1327
 
1328
+ #: admin/tpl/info/info_faqs.php:54
1329
  msgid ""
1330
  "However, for some woocommerce themes, the cart may not be updated correctly."
1331
  msgstr ""
1332
 
1333
+ #: admin/tpl/info/info_faqs.php:56
1334
  msgid "To test the cart:"
1335
  msgstr ""
1336
 
1337
+ #: admin/tpl/info/info_faqs.php:58
1338
  msgid ""
1339
  "On a non-logged-in browser, visit and cache a page, then visit and cache a "
1340
  "product page."
1341
  msgstr ""
1342
 
1343
+ #: admin/tpl/info/info_faqs.php:59
1344
  msgid ""
1345
  "The first page should be accessible from the product page (e.g. the shop)."
1346
  msgstr ""
1347
 
1348
+ #: admin/tpl/info/info_faqs.php:60
1349
  msgid "Once both pages are confirmed cached, add the product to the cart."
1350
  msgstr ""
1351
 
1352
+ #: admin/tpl/info/info_faqs.php:61
1353
  msgid "After adding to the cart, visit the first page."
1354
  msgstr ""
1355
 
1356
+ #: admin/tpl/info/info_faqs.php:62
1357
  msgid "The page should still be cached, and the cart should be up to date."
1358
  msgstr ""
1359
 
1360
+ #: admin/tpl/info/info_faqs.php:63
1361
  msgid ""
1362
  "If that is not the case, please add woocommerce_items_in_cart to the do not "
1363
  "cache cookie list."
1364
  msgstr ""
1365
 
1366
+ #: admin/tpl/info/info_faqs.php:66
1367
  msgid ""
1368
  "Some themes like Storefront and Shop Isle are built such that the cart works "
1369
  "without the rule."
1370
  msgstr ""
1371
 
1372
+ #: admin/tpl/info/info_faqs.php:67
1373
  msgid ""
1374
  "However, other themes like the E-Commerce theme, do not, so please verify "
1375
  "the theme used."
1376
  msgstr ""
1377
 
1378
+ #: admin/tpl/info/info_faqs.php:71
1379
  msgid "Are my images optimized?"
1380
  msgstr ""
1381
 
1382
+ #: admin/tpl/info/info_faqs.php:74
1383
  msgid "The cache plugin does not do anything with the images themselves."
1384
  msgstr ""
1385
 
1386
+ #: admin/tpl/info/info_faqs.php:75
1387
  msgid ""
1388
  "We recommend you trying an image optimization plugin like %s to optimize "
1389
  "your images."
1390
  msgstr ""
1391
 
1392
+ #: admin/tpl/info/info_faqs.php:77
1393
  msgid "It can reduce your site's images up to 90%."
1394
  msgstr ""
1395
 
1396
+ #: admin/tpl/info/info_faqs.php:81
1397
  msgid "How do I get WP-PostViews to display an updating view count?"
1398
  msgstr ""
1399
 
1400
+ #: admin/tpl/info/info_faqs.php:84
1401
  msgid "Use %1$s to replace %2$s"
1402
  msgstr ""
1403
 
1404
+ #: admin/tpl/info/info_faqs.php:88
1405
  msgid ""
1406
  "NOTE: The id can be changed, but the div id and the ajax function must match."
1407
  msgstr ""
1408
 
1409
+ #: admin/tpl/info/info_faqs.php:91
1410
  msgid "Replace the ajax query in %1$s with %2$s"
1411
  msgstr ""
1412
 
1413
+ #: admin/tpl/info/info_faqs.php:106
1414
  msgid "Purge the cache to use the updated pages."
1415
  msgstr ""
1416
 
1417
+ #: admin/tpl/info.php:5
1418
+ msgid "FAQs"
 
1419
  msgstr ""
1420
 
1421
+ #: admin/tpl/info.php:6
1422
+ msgid "Configuration"
1423
  msgstr ""
1424
 
1425
+ #: admin/tpl/info.php:7
1426
+ msgid "Plugin Compatibilities"
1427
  msgstr ""
1428
 
1429
+ #: admin/tpl/info.php:8
1430
+ msgid "Common Rewrite Rules"
1431
  msgstr ""
1432
 
1433
+ #: admin/tpl/info.php:9
1434
+ msgid "Admin IP Commands"
 
1435
  msgstr ""
1436
 
1437
+ #: admin/tpl/info.php:16
1438
+ msgid "LiteSpeed Cache Information"
1439
+ msgstr ""
1440
+
1441
+ #: admin/tpl/manage/manage_db.php:6
1442
  msgid "Clean All"
1443
  msgstr ""
1444
 
1445
+ #: admin/tpl/manage/manage_db.php:10
1446
  msgid "Post Revisions"
1447
  msgstr ""
1448
 
1449
+ #: admin/tpl/manage/manage_db.php:11
1450
  msgid "Clean all post revisions"
1451
  msgstr ""
1452
 
1453
+ #: admin/tpl/manage/manage_db.php:14
1454
  msgid "Auto Drafts"
1455
  msgstr ""
1456
 
1457
+ #: admin/tpl/manage/manage_db.php:15
1458
  msgid "Clean all auto saved drafts"
1459
  msgstr ""
1460
 
1461
+ #: admin/tpl/manage/manage_db.php:18
1462
  msgid "Trashed Posts"
1463
  msgstr ""
1464
 
1465
+ #: admin/tpl/manage/manage_db.php:19
1466
  msgid "Clean all trashed posts and pages"
1467
  msgstr ""
1468
 
1469
+ #: admin/tpl/manage/manage_db.php:22
1470
  msgid "Spam Comments"
1471
  msgstr ""
1472
 
1473
+ #: admin/tpl/manage/manage_db.php:23
1474
  msgid "Clean all spam comments"
1475
  msgstr ""
1476
 
1477
+ #: admin/tpl/manage/manage_db.php:26
1478
  msgid "Trashed Comments"
1479
  msgstr ""
1480
 
1481
+ #: admin/tpl/manage/manage_db.php:27
1482
  msgid "Clean all trashed comments"
1483
  msgstr ""
1484
 
1485
+ #: admin/tpl/manage/manage_db.php:30
1486
  msgid "Trackbacks/Pingbacks"
1487
  msgstr ""
1488
 
1489
+ #: admin/tpl/manage/manage_db.php:31
1490
  msgid "Clean all trackbacks and pingbacks"
1491
  msgstr ""
1492
 
1493
+ #: admin/tpl/manage/manage_db.php:34
1494
  msgid "Expired Transients"
1495
  msgstr ""
1496
 
1497
+ #: admin/tpl/manage/manage_db.php:35
1498
  msgid "Clean expired transient options"
1499
  msgstr ""
1500
 
1501
+ #: admin/tpl/manage/manage_db.php:38
1502
  msgid "All Transients"
1503
  msgstr ""
1504
 
1505
+ #: admin/tpl/manage/manage_db.php:39
1506
  msgid "Clean all transient options"
1507
  msgstr ""
1508
 
1509
+ #: admin/tpl/manage/manage_db.php:42
1510
  msgid "Optimize Tables"
1511
  msgstr ""
1512
 
1513
+ #: admin/tpl/manage/manage_db.php:43
1514
  msgid "Optimize all tables in your database"
1515
  msgstr ""
1516
 
1517
+ #: admin/tpl/manage/manage_db.php:46
1518
  msgid "Clean CSS/JS Optimizer"
1519
  msgstr ""
1520
 
1521
+ #: admin/tpl/manage/manage_db.php:47
1522
  msgid "Purge all and clean all minified/combined CSS/JS data"
1523
  msgstr ""
1524
 
1525
+ #: admin/tpl/manage/manage_db.php:68
1526
  msgid "Database Optimizer"
1527
  msgstr ""
1528
 
1529
+ #: admin/tpl/manage/manage_purge.php:7
1530
  msgid "Purge Front Page"
1531
  msgstr ""
1532
 
1533
+ #: admin/tpl/manage/manage_purge.php:8
1534
  msgid "This will Purge Front Page only"
1535
  msgstr ""
1536
 
1537
+ #: admin/tpl/manage/manage_purge.php:13
1538
  msgid "Purge Pages"
1539
  msgstr ""
1540
 
1541
+ #: admin/tpl/manage/manage_purge.php:14
1542
  msgid "This will Purge Pages only"
1543
  msgstr ""
1544
 
1545
+ #: admin/tpl/manage/manage_purge.php:19
1546
  msgid "Purge CSS/JS Cache"
1547
  msgstr ""
1548
 
1549
+ #: admin/tpl/manage/manage_purge.php:20
1550
  msgid "This will purge all minified/combined CSS/JS entries only"
1551
  msgstr ""
1552
 
1553
+ #: admin/tpl/manage/manage_purge.php:25
1554
  msgid "Purge 403 Error"
1555
  msgstr ""
1556
 
1557
+ #: admin/tpl/manage/manage_purge.php:26
1558
  msgid "Purge error pages, including 403 pages"
1559
  msgstr ""
1560
 
1561
+ #: admin/tpl/manage/manage_purge.php:32
1562
  msgid "Purge 404 Error"
1563
  msgstr ""
1564
 
1565
+ #: admin/tpl/manage/manage_purge.php:33
1566
  msgid "Purge error pages, including 404 pages"
1567
  msgstr ""
1568
 
1569
+ #: admin/tpl/manage/manage_purge.php:39
1570
  msgid "Purge 500 Error"
1571
  msgstr ""
1572
 
1573
+ #: admin/tpl/manage/manage_purge.php:40
1574
  msgid "Purge error pages, including 500 pages"
1575
  msgstr ""
1576
 
1577
+ #: admin/tpl/manage/manage_purge.php:46
1578
  msgid "Purge All"
1579
  msgstr ""
1580
 
1581
+ #: admin/tpl/manage/manage_purge.php:47
1582
  msgid "Purge the cache entries created by this plugin"
1583
  msgstr ""
1584
 
1585
+ #: admin/tpl/manage/manage_purge.php:52
1586
  msgid "This will purge everything for all blogs."
1587
  msgstr ""
1588
 
1589
+ #: admin/tpl/manage/manage_purge.php:53 admin/tpl/manage/manage_purge.php:55
1590
  msgid "Are you sure you want to purge all?"
1591
  msgstr ""
1592
 
1593
+ #: admin/tpl/manage/manage_purge.php:61
1594
  msgid "Empty Entire Cache"
1595
  msgstr ""
1596
 
1597
+ #: admin/tpl/manage/manage_purge.php:62
1598
  msgid ""
1599
  "Clears all cache entries related to this site, <i>including other web "
1600
  "applications</i>."
1601
  msgstr ""
1602
 
1603
+ #: admin/tpl/manage/manage_purge.php:63
1604
  msgid "This action should only be used if things are cached incorrectly."
1605
  msgstr ""
1606
 
1607
+ #: admin/tpl/manage/manage_purge.php:67
1608
  msgid "This will clear EVERYTHING inside the cache."
1609
  msgstr ""
1610
 
1611
+ #: admin/tpl/manage/manage_purge.php:68
1612
  msgid "This may cause heavy load on the server."
1613
  msgstr ""
1614
 
1615
+ #: admin/tpl/manage/manage_purge.php:69
1616
  msgid "If only the WordPress site should be purged, use purge all."
1617
  msgstr ""
1618
 
1619
+ #: admin/tpl/manage/manage_purge.php:75 admin/tpl/manage.php:7
1620
+ #: admin/tpl/network_settings.php:7 admin/tpl/settings.php:9
1621
+ msgid "Purge"
1622
+ msgstr ""
1623
+
1624
+ #: admin/tpl/manage/manage_purge.php:102
1625
  msgid "Purge By..."
1626
  msgstr ""
1627
 
1628
+ #: admin/tpl/manage/manage_purge.php:104
1629
  msgid "Select below for \"Purge by\" options."
1630
  msgstr ""
1631
 
1632
+ #: admin/tpl/manage/manage_purge.php:105
1633
+ #: admin/tpl/setting/settings_cache.php:67
1634
+ #: admin/tpl/setting/settings_cdn.php:101
1635
+ #: admin/tpl/setting/settings_excludes.php:19
1636
+ #: admin/tpl/setting/settings_excludes.php:33
1637
+ #: admin/tpl/setting/settings_excludes.php:56
1638
+ #: admin/tpl/setting/settings_excludes.php:94
1639
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:19
1640
+ #: admin/tpl/setting/settings_media.php:27
1641
+ #: admin/tpl/setting/settings_optimize.php:58
1642
+ #: admin/tpl/setting/settings_optimize.php:105
1643
+ #: admin/tpl/setting/settings_optimize.php:201
1644
+ #: admin/tpl/setting/settings_optimize.php:230
1645
+ #: admin/tpl/setting/settings_purge.php:79
1646
  msgid "One per line."
1647
  msgstr ""
1648
 
1649
+ #: admin/tpl/manage/manage_purge.php:132
1650
  msgid "Category"
1651
  msgstr ""
1652
 
1653
+ #: admin/tpl/manage/manage_purge.php:138
1654
  msgid "Post ID"
1655
  msgstr ""
1656
 
1657
+ #: admin/tpl/manage/manage_purge.php:144
1658
  msgid "Tag"
1659
  msgstr ""
1660
 
1661
+ #: admin/tpl/manage/manage_purge.php:150
1662
  msgid "URL"
1663
  msgstr ""
1664
 
1665
+ #: admin/tpl/manage/manage_purge.php:156
1666
  msgid ""
1667
  "Purge pages by category name - e.g. %2$s should be used for the URL %1$s."
1668
  msgstr ""
1669
 
1670
+ #: admin/tpl/manage/manage_purge.php:161
1671
  msgid "Purge pages by post ID."
1672
  msgstr ""
1673
 
1674
+ #: admin/tpl/manage/manage_purge.php:165
1675
  msgid "Purge pages by tag name - e.g. %2$s should be used for the URL %1$s."
1676
  msgstr ""
1677
 
1678
+ #: admin/tpl/manage/manage_purge.php:170
1679
  msgid "Purge pages by relative or full URL."
1680
  msgstr ""
1681
 
1682
+ #: admin/tpl/manage/manage_purge.php:171
1683
  msgid "e.g. Use %s or %s."
1684
  msgstr ""
1685
 
1686
+ #: admin/tpl/manage/manage_purge.php:184
1687
  msgid "Purge List"
1688
  msgstr ""
1689
 
1690
+ #: admin/tpl/manage.php:8
1691
+ msgid "DB Optimizer"
1692
+ msgstr ""
1693
+
1694
+ #: admin/tpl/manage.php:18
1695
+ msgid "LiteSpeed Cache Network Management"
1696
+ msgstr ""
1697
+
1698
+ #: admin/tpl/manage.php:21
1699
+ msgid "LiteSpeed Cache Management"
1700
+ msgstr ""
1701
+
1702
+ #: admin/tpl/network_settings.php:5 admin/tpl/setting/settings_general.php:5
1703
+ #: admin/tpl/settings.php:7
1704
  msgid "General"
1705
  msgstr ""
1706
 
1712
  msgid "Excludes"
1713
  msgstr ""
1714
 
1715
+ #: admin/tpl/network_settings.php:9 admin/tpl/setting/settings_debug.php:65
1716
+ #: admin/tpl/settings.php:19
1717
  msgid "Advanced"
1718
  msgstr ""
1719
 
1721
  msgid "LiteSpeed Cache Network Settings"
1722
  msgstr ""
1723
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1724
  #: admin/tpl/report.php:10
1725
  msgid "LiteSpeed Cache Report"
1726
  msgstr ""
1765
  msgid "Environment Report copied to Clipboard!"
1766
  msgstr ""
1767
 
1768
+ #: admin/tpl/setting/network_settings_cache.php:4
1769
+ msgid "Cache Control Network Settings"
1770
  msgstr ""
1771
 
1772
+ #: admin/tpl/setting/network_settings_cache.php:7
1773
+ msgid ""
1774
+ "Separate Mobile Views should be enabled if any of the network enabled themes "
1775
+ "require a different view for mobile devices."
1776
  msgstr ""
1777
 
1778
+ #: admin/tpl/setting/network_settings_cache.php:8
1779
+ msgid "Responsive themes can handle this part automatically."
1780
  msgstr ""
1781
 
1782
+ #: admin/tpl/setting/network_settings_excludes.php:5
1783
+ msgid "Network Do Not Cache Rules"
1784
  msgstr ""
1785
 
1786
+ #: admin/tpl/setting/network_settings_general.php:5
1787
+ msgid "General Network Configuration"
1788
  msgstr ""
1789
 
1790
+ #: admin/tpl/setting/network_settings_general.php:7
1791
+ msgid "These configuration are only available network wide."
1792
  msgstr ""
1793
 
1794
+ #: admin/tpl/setting/network_settings_general.php:11
1795
+ msgid "Network Enable Cache"
1796
  msgstr ""
1797
 
1798
+ #: admin/tpl/setting/network_settings_general.php:15
1799
+ msgid ""
1800
+ "Enabling LiteSpeed Cache for WordPress here enables the cache for the "
1801
+ "network."
1802
  msgstr ""
1803
 
1804
+ #: admin/tpl/setting/network_settings_general.php:16
1805
+ msgid ""
1806
+ "It is <b>STRONGLY</b> recommend that the compatibility with other plugins on "
1807
+ "a single/few sites is tested first."
1808
  msgstr ""
1809
 
1810
+ #: admin/tpl/setting/network_settings_general.php:17
1811
+ msgid ""
1812
+ "This is to ensure compatibility prior to enabling the cache for all sites."
1813
  msgstr ""
1814
 
1815
+ #: admin/tpl/setting/network_settings_general.php:23
1816
+ msgid "Use Primary Site Configuration"
1817
+ msgstr ""
1818
+
1819
+ #: admin/tpl/setting/network_settings_general.php:27
1820
  msgid ""
1821
+ "Check this option to use the primary site's configuration for all subsites."
 
1822
  msgstr ""
1823
 
1824
+ #: admin/tpl/setting/network_settings_general.php:28
1825
+ msgid "This will disable the settings page on all subsites."
1826
  msgstr ""
1827
 
1828
+ #: admin/tpl/setting/network_settings_purge.php:4
1829
+ msgid "Purge Network Settings"
1830
+ msgstr ""
1831
+
1832
+ #: admin/tpl/setting/settings_advanced.php:8
1833
  msgid "These settings are meant for ADVANCED USERS ONLY."
1834
  msgstr ""
1835
 
1836
+ #: admin/tpl/setting/settings_advanced.php:9
1837
  msgid "Please take great care when changing any of these settings."
1838
  msgstr ""
1839
 
1840
+ #: admin/tpl/setting/settings_advanced.php:10
1841
  msgid "If there are any questions, do not hesitate to submit a support thread."
1842
  msgstr ""
1843
 
1844
+ #: admin/tpl/setting/settings_advanced.php:14
1845
  msgid "Check Advanced Cache"
1846
  msgstr ""
1847
 
1848
+ #: admin/tpl/setting/settings_advanced.php:17
1849
  msgid "Include advanced-cache.php"
1850
  msgstr ""
1851
 
1852
+ #: admin/tpl/setting/settings_advanced.php:20
1853
  msgid ""
1854
  "The advanced-cache.php file is used by many caching plugins to signal that a "
1855
  "cache is active."
1856
  msgstr ""
1857
 
1858
+ #: admin/tpl/setting/settings_advanced.php:21
1859
  msgid ""
1860
  "When this option is checked and this file is detected as belonging to "
1861
  "another plugin, LiteSpeed Cache will not cache."
1862
  msgstr ""
1863
 
1864
+ #: admin/tpl/setting/settings_advanced.php:24
1865
  msgid ""
1866
  "Uncheck this option only if the other plugin is used for non-caching "
1867
  "purposes, such as minifying css/js files."
1868
  msgstr ""
1869
 
1870
+ #: admin/tpl/setting/settings_advanced.php:27
1871
  msgid "Login Cookie"
1872
  msgstr ""
1873
 
1874
+ #: admin/tpl/setting/settings_advanced.php:30
1875
  msgid "SYNTAX: alphanumeric and \"_\"."
1876
  msgstr ""
1877
 
1878
+ #: admin/tpl/setting/settings_advanced.php:31
1879
  msgid "No spaces and case sensitive."
1880
  msgstr ""
1881
 
1882
+ #: admin/tpl/setting/settings_advanced.php:32
1883
  msgid "MUST BE UNIQUE FROM OTHER WEB APPLICATIONS."
1884
  msgstr ""
1885
 
1886
+ #: admin/tpl/setting/settings_advanced.php:35
1887
  msgid "The default login cookie is %s."
1888
  msgstr ""
1889
 
1890
+ #: admin/tpl/setting/settings_advanced.php:36
1891
  msgid ""
1892
  "The server will determine if the user is logged in based on the existance of "
1893
  "this cookie."
1894
  msgstr ""
1895
 
1896
+ #: admin/tpl/setting/settings_advanced.php:37
1897
  msgid ""
1898
  "This setting is useful for those that have multiple web applications for the "
1899
  "same domain."
1900
  msgstr ""
1901
 
1902
+ #: admin/tpl/setting/settings_advanced.php:38
1903
  msgid ""
1904
  "If every web application uses the same cookie, the server may confuse "
1905
  "whether a user is logged in or not."
1906
  msgstr ""
1907
 
1908
+ #: admin/tpl/setting/settings_advanced.php:39
1909
  msgid "The cookie set here will be used for this WordPress installation."
1910
  msgstr ""
1911
 
1912
+ #: admin/tpl/setting/settings_advanced.php:42
1913
  msgid "Example use case:"
1914
  msgstr ""
1915
 
1916
+ #: admin/tpl/setting/settings_advanced.php:44
1917
  msgid "There is a WordPress installed for %s."
1918
  msgstr ""
1919
 
1920
+ #: admin/tpl/setting/settings_advanced.php:46
1921
  msgid "Then another WordPress is installed (NOT MULTISITE) at %s"
1922
  msgstr ""
1923
 
1924
+ #: admin/tpl/setting/settings_advanced.php:47
1925
  msgid ""
1926
  "The cache needs to distinguish who is logged into which WordPress site in "
1927
  "order to cache correctly."
1928
  msgstr ""
1929
 
1930
+ #: admin/tpl/setting/settings_advanced.php:53
1931
  msgid "Error: invalid login cookie. Please check the %s file"
1932
  msgstr ""
1933
 
1934
+ #: admin/tpl/setting/settings_advanced.php:62
1935
  msgid "Error getting current rules from %s: %s"
1936
  msgstr ""
1937
 
1938
+ #: admin/tpl/setting/settings_advanced.php:70
1939
  msgid ""
1940
  "WARNING: The .htaccess login cookie and Database login cookie do not match."
1941
  msgstr ""
1942
 
1943
+ #: admin/tpl/setting/settings_cache.php:4
1944
  msgid "Cache Control Settings"
1945
  msgstr ""
1946
 
1947
+ #: admin/tpl/setting/settings_cache.php:8
1948
  msgid "Cache Logged-in Users"
1949
  msgstr ""
1950
 
1951
+ #: admin/tpl/setting/settings_cache.php:12
1952
  msgid "Privately cache frontend pages for logged-in users. (LSWS %s required)"
1953
  msgstr ""
1954
 
1955
+ #: admin/tpl/setting/settings_cache.php:18
1956
  msgid "Cache Commenters"
1957
  msgstr ""
1958
 
1959
+ #: admin/tpl/setting/settings_cache.php:22
1960
  msgid ""
1961
  "Privately cache commenters that have pending comments. Disabling this option "
1962
  "will serve non-cacheable pages to commenters. (LSWS %s required)"
1963
  msgstr ""
1964
 
1965
+ #: admin/tpl/setting/settings_cache.php:28
1966
  msgid "Cache REST API"
1967
  msgstr ""
1968
 
1969
+ #: admin/tpl/setting/settings_cache.php:32
1970
  msgid "Cache requests made by WordPress REST API calls."
1971
  msgstr ""
1972
 
1973
+ #: admin/tpl/setting/settings_cache.php:38
1974
  msgid "Cache Login Page"
1975
  msgstr ""
1976
 
1977
+ #: admin/tpl/setting/settings_cache.php:42
1978
  msgid "Disabling this option may negatively affect performance."
1979
  msgstr ""
1980
 
1981
+ #: admin/tpl/setting/settings_cache.php:56
1982
  msgid "Private Cached URIs"
1983
  msgstr ""
1984
 
1985
+ #: admin/tpl/setting/settings_cache.php:60
1986
  msgid "URI Paths containing these strings will NOT be cached as public."
1987
  msgstr ""
1988
 
1989
+ #: admin/tpl/setting/settings_cache.php:61
1990
+ #: admin/tpl/setting/settings_excludes.php:13
1991
  msgid "The URLs will be compared to the REQUEST_URI server variable."
1992
  msgstr ""
1993
 
1994
+ #: admin/tpl/setting/settings_cache.php:62
1995
+ #: admin/tpl/setting/settings_excludes.php:14
1996
+ #: admin/tpl/setting/settings_optimize.php:229
1997
  msgid "For example, for %s, %s can be used here."
1998
  msgstr ""
1999
 
2000
+ #: admin/tpl/setting/settings_cache.php:65
2001
+ #: admin/tpl/setting/settings_excludes.php:17
2002
  msgid "To match the beginning, add %s to the beginning of the item."
2003
  msgstr ""
2004
 
2005
+ #: admin/tpl/setting/settings_cache.php:66
2006
+ #: admin/tpl/setting/settings_excludes.php:18
2007
  msgid "To do an exact match, add %s to the end of the URL."
2008
  msgstr ""
2009
 
2010
+ #: admin/tpl/setting/settings_cdn.php:11
2011
  msgid "CDN Settings"
2012
  msgstr ""
2013
 
2014
+ #: admin/tpl/setting/settings_cdn.php:15
2015
  msgid "Enable CDN"
2016
  msgstr ""
2017
 
2018
+ #: admin/tpl/setting/settings_cdn.php:19
2019
  msgid "Enable Content Delivery Network use."
2020
  msgstr ""
2021
 
2022
+ #: admin/tpl/setting/settings_cdn.php:25
2023
  msgid "CDN URL"
2024
  msgstr ""
2025
 
2026
+ #: admin/tpl/setting/settings_cdn.php:29
2027
  msgid "CDN URL to be used. For example, %s"
2028
  msgstr ""
2029
 
2030
+ #: admin/tpl/setting/settings_cdn.php:35
2031
  msgid "Original URL"
2032
  msgstr ""
2033
 
2034
+ #: admin/tpl/setting/settings_cdn.php:39
2035
  msgid ""
2036
  "Site URL to be served through the CDN. Beginning with %1$s. For example, "
2037
  "%2$s."
2038
  msgstr ""
2039
 
2040
+ #: admin/tpl/setting/settings_cdn.php:40
2041
  msgid ""
2042
  "Wildcard %1$s supported (match zero or more characters). For example, to "
2043
  "match %2$s and %3$s, use %4$s."
2044
  msgstr ""
2045
 
2046
+ #: admin/tpl/setting/settings_cdn.php:46
2047
  msgid "Include Images"
2048
  msgstr ""
2049
 
2050
+ #: admin/tpl/setting/settings_cdn.php:50
2051
  msgid ""
2052
  "Serve all image files through the CDN. This will affect all attachments, "
2053
  "HTML %s tags, and CSS %s attributes."
2054
  msgstr ""
2055
 
2056
+ #: admin/tpl/setting/settings_cdn.php:56
2057
  msgid "Include CSS"
2058
  msgstr ""
2059
 
2060
+ #: admin/tpl/setting/settings_cdn.php:60
2061
  msgid ""
2062
  "Serve all CSS files through the CDN. This will affect all enqueued WP CSS "
2063
  "files."
2064
  msgstr ""
2065
 
2066
+ #: admin/tpl/setting/settings_cdn.php:66
2067
  msgid "Include JS"
2068
  msgstr ""
2069
 
2070
+ #: admin/tpl/setting/settings_cdn.php:70
2071
  msgid ""
2072
  "Serve all JavaScript files through the CDN. This will affect all enqueued WP "
2073
  "JavaScript files."
2074
  msgstr ""
2075
 
2076
+ #: admin/tpl/setting/settings_cdn.php:76
2077
  msgid "Include File Types"
2078
  msgstr ""
2079
 
2080
+ #: admin/tpl/setting/settings_cdn.php:82
2081
  msgid "Static file type links to be replaced by CDN links. One per line."
2082
  msgstr ""
2083
 
2084
+ #: admin/tpl/setting/settings_cdn.php:83
2085
  msgid "This will affect all tags containing attributes: %s %s %s."
2086
  msgstr ""
2087
 
2088
+ #: admin/tpl/setting/settings_cdn.php:95
2089
  msgid "Exclude Path"
2090
  msgstr ""
2091
 
2092
+ #: admin/tpl/setting/settings_cdn.php:100
2093
  msgid "Paths containing these strings will not be served from the CDN."
2094
  msgstr ""
2095
 
2096
+ #: admin/tpl/setting/settings_cdn.php:107
2097
+ msgid "Load JQuery Remotely"
2098
+ msgstr ""
2099
+
2100
+ #: admin/tpl/setting/settings_cdn.php:113
2101
+ #: admin/tpl/setting/settings_debug.php:16
2102
+ msgid "Off"
2103
+ msgstr ""
2104
+
2105
+ #: admin/tpl/setting/settings_cdn.php:119
2106
+ msgid "Google"
2107
+ msgstr ""
2108
+
2109
+ #: admin/tpl/setting/settings_cdn.php:125
2110
+ msgid "cdnjs"
2111
+ msgstr ""
2112
+
2113
+ #: admin/tpl/setting/settings_cdn.php:129
2114
+ msgid ""
2115
+ "Improve page load time by loading jQuery from a remote CDN service instead "
2116
+ "of locally."
2117
+ msgstr ""
2118
+
2119
+ #: admin/tpl/setting/settings_compatibilities.php:7
2120
  msgid "Compatibility with WP-PostViews"
2121
  msgstr ""
2122
 
2123
+ #: admin/tpl/setting/settings_compatibilities.php:9
2124
  msgid "To make LiteSpeed Cache compatible with WP-PostViews:"
2125
  msgstr ""
2126
 
2127
+ #: admin/tpl/setting/settings_compatibilities.php:13
2128
  msgid ""
2129
  "Replace the following calls in the active theme's template files with a div "
2130
  "or span with a unique ID."
2131
  msgstr ""
2132
 
2133
+ #: admin/tpl/setting/settings_compatibilities.php:14
2134
  msgid "e.g. Replace <br> <pre>%1$s</pre> with<br> <pre>%2$s</pre>"
2135
  msgstr ""
2136
 
2137
+ #: admin/tpl/setting/settings_compatibilities.php:21
2138
  msgid "Update the ajax request to output the results to that div."
2139
  msgstr ""
2140
 
2141
+ #: admin/tpl/setting/settings_compatibilities.php:22
2142
  msgid "Example:"
2143
  msgstr ""
2144
 
2145
+ #: admin/tpl/setting/settings_compatibilities.php:34
2146
  msgid "The ajax code can be found at"
2147
  msgstr ""
2148
 
2149
+ #: admin/tpl/setting/settings_compatibilities.php:37
2150
  msgid "After purging the cache, the view count should be updating."
2151
  msgstr ""
2152
 
2153
+ #: admin/tpl/setting/settings_crawler.php:6
2154
  msgid "Crawler Settings"
2155
  msgstr ""
2156
 
2157
+ #: admin/tpl/setting/settings_crawler.php:13
2158
  msgid "microseconds"
2159
  msgstr ""
2160
 
2161
+ #: admin/tpl/setting/settings_crawler.php:15
2162
  msgid ""
2163
  "Specify time in microseconds for the delay between requests during a crawl."
2164
  msgstr ""
2165
 
2166
+ #: admin/tpl/setting/settings_crawler.php:27
2167
  msgid "Specify time in seconds for the duration of the crawl interval."
2168
  msgstr ""
2169
 
2170
+ #: admin/tpl/setting/settings_crawler.php:34
2171
  msgid "Interval Between Runs"
2172
  msgstr ""
2173
 
2174
+ #: admin/tpl/setting/settings_crawler.php:39
2175
  msgid ""
2176
  "Specify time in seconds for the time between each run interval. Must be "
2177
  "greater than 60."
2178
  msgstr ""
2179
 
2180
+ #: admin/tpl/setting/settings_crawler.php:46
2181
  msgid "Crawl Interval"
2182
  msgstr ""
2183
 
2184
+ #: admin/tpl/setting/settings_crawler.php:51
2185
  msgid ""
2186
  "Specify how long in seconds before the crawler should initiate crawling the "
2187
  "entire sitemap again."
2188
  msgstr ""
2189
 
2190
+ #: admin/tpl/setting/settings_crawler.php:63
2191
  msgid "Specify Number of Threads to use while crawling."
2192
  msgstr ""
2193
 
2194
+ #: admin/tpl/setting/settings_crawler.php:70
2195
  msgid "Server Load Limit"
2196
  msgstr ""
2197
 
2198
+ #: admin/tpl/setting/settings_crawler.php:75
2199
  msgid ""
2200
  "The maximum average server load allowed while crawling. The number of "
2201
  "crawler threads in use will be actively reduced until average server load "
2203
  "current crawler run will be terminated."
2204
  msgstr ""
2205
 
2206
+ #: admin/tpl/setting/settings_crawler.php:83
2207
  msgid "Site IP"
2208
  msgstr ""
2209
 
2210
+ #: admin/tpl/setting/settings_crawler.php:88
2211
  msgid ""
2212
  "Enter this site's IP address to crawl by IP instead of domain name. This "
2213
  "eliminates the overhead of DNS and CDN lookups. (optional)"
2214
  msgstr ""
2215
 
2216
+ #: admin/tpl/setting/settings_crawler.php:94
2217
  msgid "Custom Sitemap"
2218
  msgstr ""
2219
 
2220
+ #: admin/tpl/setting/settings_crawler.php:99
2221
  msgid ""
2222
  "The crawler can use your Google XML Sitemap instead of its own. Enter the "
2223
  "full URL to your sitemap here."
2224
  msgstr ""
2225
 
2226
+ #: admin/tpl/setting/settings_crawler.php:105
2227
  msgid "Include Posts"
2228
  msgstr ""
2229
 
2230
+ #: admin/tpl/setting/settings_crawler.php:109
2231
  msgid "Include Posts in crawler sitemap generation."
2232
  msgstr ""
2233
 
2234
+ #: admin/tpl/setting/settings_crawler.php:115
2235
  msgid "Include Pages"
2236
  msgstr ""
2237
 
2238
+ #: admin/tpl/setting/settings_crawler.php:119
2239
  msgid "Include Pages in crawler sitemap generation."
2240
  msgstr ""
2241
 
2242
+ #: admin/tpl/setting/settings_crawler.php:125
2243
  msgid "Include Categories"
2244
  msgstr ""
2245
 
2246
+ #: admin/tpl/setting/settings_crawler.php:129
2247
  msgid "Include Categories pages in crawler sitemap generation."
2248
  msgstr ""
2249
 
2250
+ #: admin/tpl/setting/settings_crawler.php:135
2251
  msgid "Include Tags"
2252
  msgstr ""
2253
 
2254
+ #: admin/tpl/setting/settings_crawler.php:139
2255
  msgid "Include Tags pages in crawler sitemap generation."
2256
  msgstr ""
2257
 
2258
+ #: admin/tpl/setting/settings_crawler.php:145
2259
  msgid "Exclude Custom Post Types"
2260
  msgstr ""
2261
 
2262
+ #: admin/tpl/setting/settings_crawler.php:150
2263
  msgid ""
2264
  "If you want to exclude certain Custom Post Types in sitemap, add the Custom "
2265
  "Post Types in the box, one per line."
2266
  msgstr ""
2267
 
2268
+ #: admin/tpl/setting/settings_crawler.php:154
2269
  msgid "Available Custom Post Type"
2270
  msgstr ""
2271
 
2272
+ #: admin/tpl/setting/settings_crawler.php:163
2273
  msgid "Order links by"
2274
  msgstr ""
2275
 
2276
+ #: admin/tpl/setting/settings_crawler.php:169
2277
  msgid "Date, descending (Default)"
2278
  msgstr ""
2279
 
2280
+ #: admin/tpl/setting/settings_crawler.php:175
2281
  msgid "Date, ascending"
2282
  msgstr ""
2283
 
2284
+ #: admin/tpl/setting/settings_crawler.php:181
2285
  msgid "Alphabetical, descending"
2286
  msgstr ""
2287
 
2288
+ #: admin/tpl/setting/settings_crawler.php:187
2289
  msgid "Alphabetical, ascending"
2290
  msgstr ""
2291
 
2292
+ #: admin/tpl/setting/settings_crawler.php:191
2293
  msgid ""
2294
  "Please choose one of the above options to set the order in which the sitemap "
2295
  "will be parsed."
2296
  msgstr ""
2297
 
2298
+ #: admin/tpl/setting/settings_debug.php:6
2299
  msgid "Developer Testing"
2300
  msgstr ""
2301
 
2302
+ #: admin/tpl/setting/settings_debug.php:22
 
 
 
 
2303
  msgid "On"
2304
  msgstr ""
2305
 
2306
+ #: admin/tpl/setting/settings_debug.php:28
2307
  msgid "Admin IP only"
2308
  msgstr ""
2309
 
2310
+ #: admin/tpl/setting/settings_debug.php:32
2311
  msgid "Outputs to WordPress debug log."
2312
  msgstr ""
2313
 
2314
+ #: admin/tpl/setting/settings_debug.php:33
2315
  msgid ""
2316
  "This should be set to off once everything is working to prevent filling the "
2317
  "disk."
2318
  msgstr ""
2319
 
2320
+ #: admin/tpl/setting/settings_debug.php:34
2321
  msgid ""
2322
  "The Admin IP option will only output log messages on requests from admin IPs."
2323
  msgstr ""
2324
 
2325
+ #: admin/tpl/setting/settings_debug.php:35
2326
  msgid "The logs will be outputted to %s."
2327
  msgstr ""
2328
 
2329
+ #: admin/tpl/setting/settings_debug.php:41
2330
  msgid "Admin IPs"
2331
  msgstr ""
2332
 
2333
+ #: admin/tpl/setting/settings_debug.php:45
2334
  msgid ""
2335
  "Allows listed IPs (one per line) to perform certain actions from their "
2336
  "browsers."
2337
  msgstr ""
2338
 
2339
+ #: admin/tpl/setting/settings_debug.php:46
2340
  msgid ""
2341
  "More information about the available commands can be found <a href=\"%s"
2342
  "\">here</a>."
2343
  msgstr ""
2344
 
2345
+ #: admin/tpl/setting/settings_debug.php:53
2346
  msgid "Debug Level"
2347
  msgstr ""
2348
 
2349
+ #: admin/tpl/setting/settings_debug.php:59
2350
  msgid "Basic"
2351
  msgstr ""
2352
 
2353
+ #: admin/tpl/setting/settings_debug.php:69
2354
  msgid "Advanced level will log more details."
2355
  msgstr ""
2356
 
2357
+ #: admin/tpl/setting/settings_debug.php:78
2358
  msgid "MB"
2359
  msgstr ""
2360
 
2361
+ #: admin/tpl/setting/settings_debug.php:80
2362
  msgid ""
2363
  "Specify the maximum size of the log file. Minimum is 3MB. Maximum is 3000MB."
2364
  msgstr ""
2365
 
2366
+ #: admin/tpl/setting/settings_debug.php:87
2367
  msgid "Heartbeat"
2368
  msgstr ""
2369
 
2370
+ #: admin/tpl/setting/settings_debug.php:91
2371
  msgid ""
2372
  "Disable WordPress heartbeat to prevent AJAX calls from breaking debug "
2373
  "logging. WARNING: Disabling this may cause WordPress tasks triggered by AJAX "
2374
  "to stop working."
2375
  msgstr ""
2376
 
2377
+ #: admin/tpl/setting/settings_debug.php:97
2378
  msgid "Log Cookies"
2379
  msgstr ""
2380
 
2381
+ #: admin/tpl/setting/settings_debug.php:101
2382
  msgid "Log request cookie values."
2383
  msgstr ""
2384
 
2385
+ #: admin/tpl/setting/settings_debug.php:107
2386
  msgid "Collapse Query Strings"
2387
  msgstr ""
2388
 
2389
+ #: admin/tpl/setting/settings_debug.php:111
2390
  msgid "Shorten query strings in the debug log to improve readability."
2391
  msgstr ""
2392
 
2393
+ #: admin/tpl/setting/settings_debug.php:117
2394
  msgid "Log Filters"
2395
  msgstr ""
2396
 
2397
+ #: admin/tpl/setting/settings_debug.php:121
2398
  msgid ""
2399
  "Log all WordPress filter hooks. WARNING: Enabling this option will cause log "
2400
  "file size to grow quickly."
2401
  msgstr ""
2402
 
2403
+ #: admin/tpl/setting/settings_debug.php:127
2404
  msgid "Exclude Filters"
2405
  msgstr ""
2406
 
2407
+ #: admin/tpl/setting/settings_debug.php:131
2408
  msgid "Listed filters (one per line) will not be logged."
2409
  msgstr ""
2410
 
2411
+ #: admin/tpl/setting/settings_debug.php:137
2412
  msgid "Exclude Part Filters"
2413
  msgstr ""
2414
 
2415
+ #: admin/tpl/setting/settings_debug.php:141
2416
  msgid "Filters containing these strings (one per line) will not be logged."
2417
  msgstr ""
2418
 
2419
+ #: admin/tpl/setting/settings_esi.php:14
2420
  msgid "ESI Settings"
2421
  msgstr ""
2422
 
2423
+ #: admin/tpl/setting/settings_esi.php:17
2424
  msgid ""
2425
  "With ESI (Edge Side Includes), pages may be served from cache for logged-in "
2426
  "users."
2427
  msgstr ""
2428
 
2429
+ #: admin/tpl/setting/settings_esi.php:18
2430
  msgid ""
2431
  "ESI allows you to designate parts of your dynamic page as separate fragments "
2432
  "that are then assembled together to make the whole page. In other words, ESI "
2435
  "cached at all."
2436
  msgstr ""
2437
 
2438
+ #: admin/tpl/setting/settings_esi.php:20
2439
  msgid "Learn more about public cache vs. private cache <a %s>on our blog</a>."
2440
  msgstr ""
2441
 
2442
+ #: admin/tpl/setting/settings_esi.php:29
2443
  msgid "Available in LiteSpeed Enterprise version"
2444
  msgstr ""
2445
 
2446
+ #: admin/tpl/setting/settings_esi.php:39
2447
  msgid ""
2448
  "Enable caches public pages for logged in users and serves the Admin Bar and "
2449
  "Comment Form via ESI blocks. These two blocks will be uncached unless "
2450
  "enabled below."
2451
  msgstr ""
2452
 
2453
+ #: admin/tpl/setting/settings_esi.php:45
2454
  msgid "Cache Admin Bar"
2455
  msgstr ""
2456
 
2457
+ #: admin/tpl/setting/settings_esi.php:49
2458
  msgid "Cache the build-in Admin Bar ESI block."
2459
  msgstr ""
2460
 
2461
+ #: admin/tpl/setting/settings_esi.php:55
2462
  msgid "Cache Comment Form"
2463
  msgstr ""
2464
 
2465
+ #: admin/tpl/setting/settings_esi.php:59
2466
  msgid "Cache the build-in Comment Form ESI block."
2467
  msgstr ""
2468
 
2469
+ #: admin/tpl/setting/settings_esi.php:65
2470
  msgid "Vary Group"
2471
  msgstr ""
2472
 
2473
+ #: admin/tpl/setting/settings_esi.php:80
2474
  msgid ""
2475
  "If your site contains public content that certain user roles can see but "
2476
  "other roles cannot, you can specify a Vary Group for those user roles. For "
2479
  "etc), while all other user roles see the default public page."
2480
  msgstr ""
2481
 
2482
+ #: admin/tpl/setting/settings_excludes.php:4
2483
  msgid "Do Not Cache Settings"
2484
  msgstr ""
2485
 
2486
+ #: admin/tpl/setting/settings_excludes.php:8
2487
  msgid "Do Not Cache URIs"
2488
  msgstr ""
2489
 
2490
+ #: admin/tpl/setting/settings_excludes.php:12
2491
  msgid "Paths containing these strings will not be cached."
2492
  msgstr ""
2493
 
2494
+ #: admin/tpl/setting/settings_excludes.php:26
2495
  msgid "Do Not Cache Query Strings"
2496
  msgstr ""
2497
 
2498
+ #: admin/tpl/setting/settings_excludes.php:30
2499
  msgid "Query string containing these parameters will not be cached."
2500
  msgstr ""
2501
 
2502
+ #: admin/tpl/setting/settings_excludes.php:31
2503
  msgid "For example, for %s, %s and %s can be used here."
2504
  msgstr ""
2505
 
2506
+ #: admin/tpl/setting/settings_excludes.php:40
2507
  msgid "Do Not Cache Categories"
2508
  msgstr ""
2509
 
2510
+ #: admin/tpl/setting/settings_excludes.php:53
2511
  msgid "All categories are cached by default."
2512
  msgstr ""
2513
 
2514
+ #: admin/tpl/setting/settings_excludes.php:54
2515
+ #: admin/tpl/setting/settings_excludes.php:92
2516
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:16
2517
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:15
2518
  msgid "To prevent %s from being cached, enter it here."
2519
  msgstr ""
2520
 
2521
+ #: admin/tpl/setting/settings_excludes.php:54
2522
  msgid "categories"
2523
  msgstr ""
2524
 
2525
+ #: admin/tpl/setting/settings_excludes.php:62
2526
  msgid "If the Category ID is not found, the name will be removed on save."
2527
  msgstr ""
2528
 
2529
+ #: admin/tpl/setting/settings_excludes.php:63
2530
+ #: admin/tpl/setting/settings_excludes.php:101
2531
  msgid "To exclude %1$s, insert %2$s."
2532
  msgstr ""
2533
 
2534
+ #: admin/tpl/setting/settings_excludes.php:71
2535
  msgid "Do Not Cache Tags"
2536
  msgstr ""
2537
 
2538
+ #: admin/tpl/setting/settings_excludes.php:91
2539
  msgid "All tags are cached by default."
2540
  msgstr ""
2541
 
2542
+ #: admin/tpl/setting/settings_excludes.php:92
2543
  msgid "tags"
2544
  msgstr ""
2545
 
2546
+ #: admin/tpl/setting/settings_excludes.php:100
2547
  msgid "If the Tag ID is not found, the name will be removed on save."
2548
  msgstr ""
2549
 
2550
+ #: admin/tpl/setting/settings_general.php:9
2551
  msgid "Enable LiteSpeed Cache"
2552
  msgstr ""
2553
 
2554
+ #: admin/tpl/setting/settings_general.php:38
2555
  msgid "Use Network Admin Setting"
2556
  msgstr ""
2557
 
2558
+ #: admin/tpl/setting/settings_general.php:44
2559
  msgid "Please visit the <a %s>Information</a> page on how to test the cache."
2560
  msgstr ""
2561
 
2562
+ #: admin/tpl/setting/settings_general.php:47
2563
+ #: admin/tpl/setting/settings_optimize.php:15
2564
  msgid "NOTICE"
2565
  msgstr ""
2566
 
2567
+ #: admin/tpl/setting/settings_general.php:47
2568
  msgid ""
2569
  "When disabling the cache, all cached entries for this blog will be purged."
2570
  msgstr ""
2571
 
2572
+ #: admin/tpl/setting/settings_general.php:49
2573
  msgid "The network admin setting can be overridden here."
2574
  msgstr ""
2575
 
2576
+ #: admin/tpl/setting/settings_general.php:56
2577
  msgid "Default Public Cache TTL"
2578
  msgstr ""
2579
 
2580
+ #: admin/tpl/setting/settings_general.php:61
2581
  msgid ""
2582
  "Specify how long, in seconds, public pages are cached. Minimum is 30 seconds."
2583
  msgstr ""
2584
 
2585
+ #: admin/tpl/setting/settings_general.php:68
2586
  msgid "Default Private Cache TTL"
2587
  msgstr ""
2588
 
2589
+ #: admin/tpl/setting/settings_general.php:73
2590
  msgid ""
2591
  "Specify how long, in seconds, private pages are cached. Minimum is %1$s "
2592
  "seconds. Maximum is %2$s seconds."
2593
  msgstr ""
2594
 
2595
+ #: admin/tpl/setting/settings_general.php:80
2596
  msgid "Default Front Page TTL"
2597
  msgstr ""
2598
 
2599
+ #: admin/tpl/setting/settings_general.php:85
2600
  msgid ""
2601
  "Specify how long, in seconds, the front page is cached. Minimum is 30 "
2602
  "seconds."
2603
  msgstr ""
2604
 
2605
+ #: admin/tpl/setting/settings_general.php:92
2606
  msgid "Default Feed TTL"
2607
  msgstr ""
2608
 
2609
+ #: admin/tpl/setting/settings_general.php:97
2610
  msgid "Specify how long, in seconds, feeds are cached."
2611
  msgstr ""
2612
 
2613
+ #: admin/tpl/setting/settings_general.php:98
2614
  msgid "If this is set to a number less than 30, feeds will not be cached."
2615
  msgstr ""
2616
 
2617
+ #: admin/tpl/setting/settings_general.php:105
2618
  msgid "Default 404 Page TTL"
2619
  msgstr ""
2620
 
2621
+ #: admin/tpl/setting/settings_general.php:110
2622
  msgid "Specify how long, in seconds, 404 pages are cached."
2623
  msgstr ""
2624
 
2625
+ #: admin/tpl/setting/settings_general.php:111
2626
  msgid "If this is set to a number less than 30, 404 pages will not be cached."
2627
  msgstr ""
2628
 
2629
+ #: admin/tpl/setting/settings_general.php:118
2630
  msgid "Default 403 Page TTL"
2631
  msgstr ""
2632
 
2633
+ #: admin/tpl/setting/settings_general.php:123
2634
  msgid "Specify how long, in seconds, 403 pages are cached."
2635
  msgstr ""
2636
 
2637
+ #: admin/tpl/setting/settings_general.php:124
2638
  msgid "If this is set to a number less than 30, 403 pages will not be cached."
2639
  msgstr ""
2640
 
2641
+ #: admin/tpl/setting/settings_general.php:131
2642
  msgid "Default 500 Page TTL"
2643
  msgstr ""
2644
 
2645
+ #: admin/tpl/setting/settings_general.php:136
2646
  msgid "Specify how long, in seconds, 500 pages are cached."
2647
  msgstr ""
2648
 
2649
+ #: admin/tpl/setting/settings_general.php:137
2650
  msgid "If this is set to a number less than 30, 500 pages will not be cached."
2651
  msgstr ""
2652
 
2653
+ #: admin/tpl/setting/settings_inc.cache_browser.php:6
2654
  msgid "Browser Cache"
2655
  msgstr ""
2656
 
2657
+ #: admin/tpl/setting/settings_inc.cache_browser.php:10
2658
  msgid ""
2659
  "Browser caching stores static files locally in the user's browser. Turn on "
2660
  "this setting to reduce repeated requests for static files."
2661
  msgstr ""
2662
 
2663
+ #: admin/tpl/setting/settings_inc.cache_browser.php:13
2664
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:15
2665
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:19
2666
+ #: admin/tpl/setting/settings_inc.cache_resources.php:16
2667
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:23
2668
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:22
2669
  msgid "This setting will edit the .htaccess file."
2670
  msgstr ""
2671
 
2672
+ #: admin/tpl/setting/settings_inc.cache_browser.php:15
2673
  msgid ""
2674
  "You can turn on browser caching in server admin too. <a %s>Learn more about "
2675
  "LiteSpeed browser cache setting</a>."
2676
  msgstr ""
2677
 
2678
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:7
2679
  msgid "Cache favicon.ico"
2680
  msgstr ""
2681
 
2682
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:11
2683
  msgid "favicon.ico is requested on most pages."
2684
  msgstr ""
2685
 
2686
+ #: admin/tpl/setting/settings_inc.cache_favicon.php:12
2687
  msgid ""
2688
  "Caching this resource may improve server performance by avoiding unnecessary "
2689
  "PHP calls."
2690
  msgstr ""
2691
 
2692
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:8
2693
  msgid "Cache Mobile"
2694
  msgstr ""
2695
 
2696
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:15
2697
  msgid "When enabled, mobile views will be cached separately."
2698
  msgstr ""
2699
 
2700
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:16
2701
  msgid "A site built with responsive design does not need to check this."
2702
  msgstr ""
2703
 
2704
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:26
2705
  msgid "List of Mobile User Agents"
2706
  msgstr ""
2707
 
2708
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:43
2709
  msgid "Htaccess did not match configuration option."
2710
  msgstr ""
2711
 
2712
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:44
2713
  msgid "Please re-enter the mobile view setting."
2714
  msgstr ""
2715
 
2716
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:45
2717
  msgid "List in WordPress database is: %s"
2718
  msgstr ""
2719
 
2720
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:61
2721
  msgid "SYNTAX: Each entry should be separated with a bar, %s."
2722
  msgstr ""
2723
 
2724
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:62
2725
  msgid "Any spaces should be escaped with a backslash before the space, %s."
2726
  msgstr ""
2727
 
2728
+ #: admin/tpl/setting/settings_inc.cache_mobile.php:65
2729
  msgid "The default list WordPress uses is %s"
2730
  msgstr ""
2731
 
2732
+ #: admin/tpl/setting/settings_inc.cache_resources.php:8
2733
  msgid "Cache PHP Resources"
2734
  msgstr ""
2735
 
2736
+ #: admin/tpl/setting/settings_inc.cache_resources.php:12
2737
  msgid "Some themes and plugins add resources via a PHP request."
2738
  msgstr ""
2739
 
2740
+ #: admin/tpl/setting/settings_inc.cache_resources.php:13
2741
  msgid ""
2742
  "Caching these pages may improve server performance by avoiding unnecessary "
2743
  "PHP calls."
2744
  msgstr ""
2745
 
2746
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:6
2747
  msgid "Do Not Cache Cookies"
2748
  msgstr ""
2749
 
2750
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:16
2751
  msgid "cookies"
2752
  msgstr ""
2753
 
2754
+ #: admin/tpl/setting/settings_inc.exclude_cookies.php:18
2755
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:18
2756
  msgid "Spaces should have a backslash in front of them, %s."
2757
  msgstr ""
2758
 
2759
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:7
2760
  msgid "Do Not Cache User Agents"
2761
  msgstr ""
2762
 
2763
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:15
2764
  msgid "user agents"
2765
  msgstr ""
2766
 
2767
+ #: admin/tpl/setting/settings_inc.exclude_useragent.php:17
2768
  msgid "SYNTAX: Separate each user agent with a bar, %s."
2769
  msgstr ""
2770
 
2771
+ #: admin/tpl/setting/settings_inc.purge_on_upgrade.php:7
2772
  msgid "Purge All On Upgrade"
2773
  msgstr ""
2774
 
2775
+ #: admin/tpl/setting/settings_inc.purge_on_upgrade.php:11
2776
  msgid ""
2777
  "When enabled, the cache will automatically purge when any plugins, themes, "
2778
  "or WordPress core is upgraded."
2779
  msgstr ""
2780
 
2781
+ #: admin/tpl/setting/settings_media.php:6
2782
  msgid "Media Settings"
2783
  msgstr ""
2784
 
2785
+ #: admin/tpl/setting/settings_media.php:10
2786
+ msgid "Lazy Load Images"
2787
  msgstr ""
2788
 
2789
+ #: admin/tpl/setting/settings_media.php:14
2790
  msgid "Load images only when they enter the viewport."
2791
  msgstr ""
2792
 
2793
+ #: admin/tpl/setting/settings_media.php:15
2794
+ #: admin/tpl/setting/settings_media.php:56
2795
  msgid "This can improve page loading time by reducing initial HTTP requests."
2796
  msgstr ""
2797
 
2798
+ #: admin/tpl/setting/settings_media.php:21
2799
+ msgid "Lazy Load Image Excludes"
2800
+ msgstr ""
2801
+
2802
+ #: admin/tpl/setting/settings_media.php:25
2803
+ msgid "Listed images will not be lazy loaded."
2804
+ msgstr ""
2805
+
2806
+ #: admin/tpl/setting/settings_media.php:26
2807
+ #: admin/tpl/setting/settings_optimize.php:57
2808
+ #: admin/tpl/setting/settings_optimize.php:104
2809
+ #: admin/tpl/setting/settings_optimize.php:200
2810
+ #: admin/tpl/setting/settings_optimize.php:228
2811
+ msgid "Both full URLs and partial strings can be used."
2812
+ msgstr ""
2813
+
2814
+ #: admin/tpl/setting/settings_media.php:29
2815
+ #: admin/tpl/setting/settings_optimize.php:60
2816
+ #: admin/tpl/setting/settings_optimize.php:107
2817
+ #: admin/tpl/setting/settings_optimize.php:166
2818
+ #: admin/tpl/setting/settings_optimize.php:203
2819
+ msgid "API:"
2820
+ msgstr ""
2821
+
2822
+ #: admin/tpl/setting/settings_media.php:30
2823
+ #: admin/tpl/setting/settings_optimize.php:61
2824
+ #: admin/tpl/setting/settings_optimize.php:108
2825
+ #: admin/tpl/setting/settings_optimize.php:204
2826
+ msgid "Filter %s is supported."
2827
+ msgstr ""
2828
+
2829
+ #: admin/tpl/setting/settings_media.php:31
2830
+ #: admin/tpl/setting/settings_optimize.php:62
2831
+ #: admin/tpl/setting/settings_optimize.php:109
2832
+ #: admin/tpl/setting/settings_optimize.php:167
2833
+ #: admin/tpl/setting/settings_optimize.php:205
2834
+ msgid "Elements with attribute %s in html code will be excluded."
2835
+ msgstr ""
2836
+
2837
+ #: admin/tpl/setting/settings_media.php:38
2838
+ msgid "Lazy Load Image Placeholder"
2839
  msgstr ""
2840
 
2841
+ #: admin/tpl/setting/settings_media.php:42
2842
+ msgid ""
2843
+ "Specify a base64 image to be used as a placeholder while other images finish "
2844
+ "loading."
2845
+ msgstr ""
2846
+
2847
+ #: admin/tpl/setting/settings_media.php:43
2848
+ msgid ""
2849
+ "This can be predefined in %2$s as well using constant %1$s, with this "
2850
+ "setting taking priority."
2851
+ msgstr ""
2852
+
2853
+ #: admin/tpl/setting/settings_media.php:44
2854
+ msgid "By default a gray image placeholder %s will be used."
2855
+ msgstr ""
2856
+
2857
+ #: admin/tpl/setting/settings_media.php:45
2858
+ msgid "For example, %s can be used for a transparent placeholder."
2859
+ msgstr ""
2860
+
2861
+ #: admin/tpl/setting/settings_media.php:51
2862
+ msgid "Lazy Load Iframes"
2863
+ msgstr ""
2864
+
2865
+ #: admin/tpl/setting/settings_media.php:55
2866
  msgid "Load iframes only when they enter the viewport."
2867
  msgstr ""
2868
 
2869
+ #: admin/tpl/setting/settings_optimize.php:5
2870
  msgid "Optimization Settings"
2871
  msgstr ""
2872
 
2873
+ #: admin/tpl/setting/settings_optimize.php:10
2874
  msgid ""
2875
  "Failed to create Optimizer table. Please follow <a %s>Table Creation "
2876
  "guidance from LiteSpeed Wiki</a> to finish setup."
2877
  msgstr ""
2878
 
2879
+ #: admin/tpl/setting/settings_optimize.php:16
2880
  msgid ""
2881
  "Please test thoroughly when enabling any option in this list. After changing "
2882
  "Minify/Combine settings, please do a Purge All action."
2883
  msgstr ""
2884
 
2885
+ #: admin/tpl/setting/settings_optimize.php:22
2886
  msgid "CSS Minify"
2887
  msgstr ""
2888
 
2889
+ #: admin/tpl/setting/settings_optimize.php:26
2890
  msgid "Minify CSS files."
2891
  msgstr ""
2892
 
2893
+ #: admin/tpl/setting/settings_optimize.php:32
2894
  msgid "CSS Combine"
2895
  msgstr ""
2896
 
2897
+ #: admin/tpl/setting/settings_optimize.php:36
2898
  msgid "Combine CSS files."
2899
  msgstr ""
2900
 
2901
+ #: admin/tpl/setting/settings_optimize.php:42
2902
  msgid "CSS HTTP/2 Push"
2903
  msgstr ""
2904
 
2905
+ #: admin/tpl/setting/settings_optimize.php:46
2906
  msgid ""
2907
  "Pre-send internal CSS files to the browser before they are requested. "
2908
  "(Requires the HTTP/2 protocol)"
2909
  msgstr ""
2910
 
2911
+ #: admin/tpl/setting/settings_optimize.php:52
2912
  msgid "CSS Excludes"
2913
  msgstr ""
2914
 
2915
+ #: admin/tpl/setting/settings_optimize.php:56
2916
  msgid "Listed CSS files will not be minified/combined."
2917
  msgstr ""
2918
 
2919
+ #: admin/tpl/setting/settings_optimize.php:69
 
 
 
 
 
2920
  msgid "JS Minify"
2921
  msgstr ""
2922
 
2923
+ #: admin/tpl/setting/settings_optimize.php:73
2924
  msgid "Minify JS files."
2925
  msgstr ""
2926
 
2927
+ #: admin/tpl/setting/settings_optimize.php:79
2928
+ #: admin/tpl/setting/settings_optimize.php:243
2929
  msgid "JS Combine"
2930
  msgstr ""
2931
 
2932
+ #: admin/tpl/setting/settings_optimize.php:83
2933
  msgid "Combine JS files."
2934
  msgstr ""
2935
 
2936
+ #: admin/tpl/setting/settings_optimize.php:89
2937
  msgid "JS HTTP/2 Push"
2938
  msgstr ""
2939
 
2940
+ #: admin/tpl/setting/settings_optimize.php:93
2941
  msgid ""
2942
  "Pre-send internal JS files to the browser before they are requested. "
2943
  "(Requires the HTTP/2 protocol)"
2944
  msgstr ""
2945
 
2946
+ #: admin/tpl/setting/settings_optimize.php:99
2947
  msgid "JS Excludes"
2948
  msgstr ""
2949
 
2950
+ #: admin/tpl/setting/settings_optimize.php:103
2951
  msgid "Listed JS files will not be minified/combined."
2952
  msgstr ""
2953
 
2954
+ #: admin/tpl/setting/settings_optimize.php:116
2955
  msgid "CSS/JS Cache TTL"
2956
  msgstr ""
2957
 
2958
+ #: admin/tpl/setting/settings_optimize.php:121
2959
  msgid ""
2960
  "Specify how long, in seconds, CSS/JS files are cached. Minimum is %1$s "
2961
  "seconds."
2962
  msgstr ""
2963
 
2964
+ #: admin/tpl/setting/settings_optimize.php:128
2965
  msgid "HTML Minify"
2966
  msgstr ""
2967
 
2968
+ #: admin/tpl/setting/settings_optimize.php:132
2969
  msgid "Minify HTML content."
2970
  msgstr ""
2971
 
2972
+ #: admin/tpl/setting/settings_optimize.php:138
2973
  msgid "Remove Query Strings"
2974
  msgstr ""
2975
 
2976
+ #: admin/tpl/setting/settings_optimize.php:142
2977
  msgid "Remove query strings from static resources."
2978
  msgstr ""
2979
 
2980
+ #: admin/tpl/setting/settings_optimize.php:143
2981
+ #: admin/tpl/setting/settings_optimize.php:164
2982
+ #: admin/tpl/setting/settings_optimize.php:189
2983
+ #: admin/tpl/setting/settings_optimize.php:217
2984
  msgid ""
2985
  "This can improve your speed score in services like Pingdom, GTmetrix and "
2986
  "PageSpeed."
2987
  msgstr ""
2988
 
2989
+ #: admin/tpl/setting/settings_optimize.php:149
2990
  msgid "Remove Google Fonts"
2991
  msgstr ""
2992
 
2993
+ #: admin/tpl/setting/settings_optimize.php:153
2994
  msgid "Prevent google fonts from loading on all your pages."
2995
  msgstr ""
2996
 
2997
+ #: admin/tpl/setting/settings_optimize.php:159
2998
+ #: admin/tpl/setting/settings_optimize.php:178
2999
  msgid "Load CSS Asynchronously"
3000
  msgstr ""
3001
 
3002
+ #: admin/tpl/setting/settings_optimize.php:163
3003
  msgid "Optimize CSS delivery. This will load Google Fonts asynchronously too."
3004
  msgstr ""
3005
 
3006
+ #: admin/tpl/setting/settings_optimize.php:174
3007
  msgid "Critical CSS Rules"
3008
  msgstr ""
3009
 
3010
+ #: admin/tpl/setting/settings_optimize.php:178
3011
  msgid "Specify critical CSS rules for above-the-fold content when enabling %s."
3012
  msgstr ""
3013
 
3014
+ #: admin/tpl/setting/settings_optimize.php:184
3015
  msgid "Load JS Deferred"
3016
  msgstr ""
3017
 
3018
+ #: admin/tpl/setting/settings_optimize.php:188
3019
  msgid "Doing so can help reduce resource contention and improve performance."
3020
  msgstr ""
3021
 
3022
+ #: admin/tpl/setting/settings_optimize.php:195
3023
+ msgid "JS Deferred Excludes"
3024
+ msgstr ""
3025
+
3026
+ #: admin/tpl/setting/settings_optimize.php:199
3027
+ msgid "Listed JS files will not be deferred."
3028
+ msgstr ""
3029
+
3030
+ #: admin/tpl/setting/settings_optimize.php:212
3031
  msgid "Remove WordPress Emoji"
3032
  msgstr ""
3033
 
3034
+ #: admin/tpl/setting/settings_optimize.php:216
3035
  msgid ""
3036
  "Stop loading wordpress.org emoji. Browser default emoji will be displayed "
3037
  "instead."
3038
  msgstr ""
3039
 
3040
+ #: admin/tpl/setting/settings_optimize.php:223
3041
  msgid "URI Excludes"
3042
  msgstr ""
3043
 
3044
+ #: admin/tpl/setting/settings_optimize.php:227
3045
  msgid "Prevent any optimization of listed pages."
3046
  msgstr ""
3047
 
3048
+ #: admin/tpl/setting/settings_optimize.php:236
3049
+ msgid "Exclude JQuery"
3050
+ msgstr ""
3051
+
3052
+ #: admin/tpl/setting/settings_optimize.php:240
3053
+ msgid ""
3054
+ "Improve compatibility with inline JS by preventing jQuery optimization. "
3055
+ "(Recommended Setting: %s)"
3056
+ msgstr ""
3057
+
3058
+ #: admin/tpl/setting/settings_optimize.php:243
3059
+ msgid ""
3060
+ "If there is any JS error related to %1$s when enabled %2$s, please try this "
3061
+ "option."
3062
+ msgstr ""
3063
+
3064
+ #: admin/tpl/setting/settings_purge.php:5
3065
  msgid "Purge Settings"
3066
  msgstr ""
3067
 
3068
+ #: admin/tpl/setting/settings_purge.php:10
3069
  msgid "All pages"
3070
  msgstr ""
3071
 
3072
+ #: admin/tpl/setting/settings_purge.php:11
3073
  msgid "Front page"
3074
  msgstr ""
3075
 
3076
+ #: admin/tpl/setting/settings_purge.php:12
3077
  msgid "Home page"
3078
  msgstr ""
3079
 
3080
+ #: admin/tpl/setting/settings_purge.php:13
3081
  msgid "Pages"
3082
  msgstr ""
3083
 
3084
+ #: admin/tpl/setting/settings_purge.php:15
3085
  msgid "All pages with Recent Posts Widget"
3086
  msgstr ""
3087
 
3088
+ #: admin/tpl/setting/settings_purge.php:17
3089
  msgid "Author archive"
3090
  msgstr ""
3091
 
3092
+ #: admin/tpl/setting/settings_purge.php:18
3093
  msgid "Post type archive"
3094
  msgstr ""
3095
 
3096
+ #: admin/tpl/setting/settings_purge.php:20
3097
  msgid "Yearly archive"
3098
  msgstr ""
3099
 
3100
+ #: admin/tpl/setting/settings_purge.php:21
3101
  msgid "Monthly archive"
3102
  msgstr ""
3103
 
3104
+ #: admin/tpl/setting/settings_purge.php:22
3105
  msgid "Daily archive"
3106
  msgstr ""
3107
 
3108
+ #: admin/tpl/setting/settings_purge.php:24
3109
  msgid "Term archive (include category, tag, and tax)"
3110
  msgstr ""
3111
 
3112
+ #: admin/tpl/setting/settings_purge.php:44
3113
  msgid "Auto Purge Rules For Publish/Update"
3114
  msgstr ""
3115
 
3116
+ #: admin/tpl/setting/settings_purge.php:47
3117
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:663
3118
  msgid "Note:"
3119
  msgstr ""
3120
 
3121
+ #: admin/tpl/setting/settings_purge.php:49
3122
  msgid ""
3123
  "Select \"All\" if there are dynamic widgets linked to posts on pages other "
3124
  "than the front or home pages."
3125
  msgstr ""
3126
 
3127
+ #: admin/tpl/setting/settings_purge.php:50
3128
  msgid "Other checkboxes will be ignored."
3129
  msgstr ""
3130
 
3131
+ #: admin/tpl/setting/settings_purge.php:51
3132
  msgid ""
3133
  "Select only the archive types that are currently used, the others can be "
3134
  "left unchecked."
3135
  msgstr ""
3136
 
3137
+ #: admin/tpl/setting/settings_purge.php:67
3138
  msgid ""
3139
  "Select which pages will be automatically purged when posts are published/"
3140
  "updated."
3141
  msgstr ""
3142
 
3143
+ #: admin/tpl/setting/settings_purge.php:73
3144
+ #: admin/tpl/setting/settings_purge.php:90
3145
  msgid "Scheduled Purge URLs"
3146
  msgstr ""
3147
 
3148
+ #: admin/tpl/setting/settings_purge.php:77
3149
  msgid ""
3150
  "The URLs here (one per line) will be purged automatically at the time set in "
3151
  "the option \"%s\"."
3152
  msgstr ""
3153
 
3154
+ #: admin/tpl/setting/settings_purge.php:77
3155
+ #: admin/tpl/setting/settings_purge.php:85
3156
  msgid "Scheduled Purge Time"
3157
  msgstr ""
3158
 
3159
+ #: admin/tpl/setting/settings_purge.php:78
3160
  msgid "Both %1$s and %2$s are acceptable."
3161
  msgstr ""
3162
 
3163
+ #: admin/tpl/setting/settings_purge.php:90
3164
  msgid "Specify the time to purge the \"%s\" list."
3165
  msgstr ""
3166
 
3167
+ #: admin/tpl/setting/settings_purge.php:91
3168
  msgid "Current server time is %s."
3169
  msgstr ""
3170
 
3171
+ #: admin/tpl/settings.php:11
3172
+ msgid "Optimize"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3173
  msgstr ""
3174
 
3175
+ #: admin/tpl/settings.php:12
3176
+ msgid "Media"
 
 
3177
  msgstr ""
3178
 
3179
+ #: admin/tpl/settings.php:13
3180
+ msgid "CDN"
3181
  msgstr ""
3182
 
3183
+ #: admin/tpl/settings.php:16
3184
+ msgid "ESI"
3185
  msgstr ""
3186
 
3187
+ #: admin/tpl/settings.php:22
3188
+ msgid "Debug"
3189
  msgstr ""
3190
 
3191
+ #: admin/tpl/settings.php:25
3192
+ msgid "Compatibilities"
 
 
3193
  msgstr ""
3194
 
3195
+ #: admin/tpl/settings.php:65
3196
+ msgid "WARNING: Third party tab input invalid."
 
3197
  msgstr ""
3198
 
3199
+ #: admin/tpl/settings.php:72
3200
+ msgid "WARNING: Third party config slug contains invalid characters."
3201
  msgstr ""
3202
 
3203
+ #: admin/tpl/settings.php:89
3204
+ msgid "LiteSpeed Cache Settings"
 
 
3205
  msgstr ""
3206
 
3207
+ #: admin/tpl/settings.php:119
3208
+ msgid "The network admin selected use primary site configs for all subsites."
 
3209
  msgstr ""
3210
 
3211
+ #: admin/tpl/settings.php:120
3212
  msgid ""
3213
+ "The following options are selected, but are not editable in this settings "
3214
+ "page."
3215
  msgstr ""
3216
 
3217
+ #: admin/tpl/settings.php:142 admin/tpl/settings.php:145
3218
+ msgid "Save Changes"
 
 
 
 
3219
  msgstr ""
3220
 
3221
  #: cli/litespeed-cache-cli-purge.class.php:90
3234
  msgid "Purged the tags!"
3235
  msgstr ""
3236
 
3237
+ #: inc/crawler.class.php:109 includes/litespeed-cache-crawler.class.php:109
3238
  msgid "Can not find any form data for blacklist"
3239
  msgstr ""
3240
 
3241
+ #: inc/crawler.class.php:124 includes/litespeed-cache-crawler.class.php:124
3242
  msgid "File saved successfully: %s"
3243
  msgstr ""
3244
 
3245
+ #: inc/crawler.class.php:176 includes/litespeed-cache-crawler.class.php:176
3246
  msgid "File created successfully: %s"
3247
  msgstr ""
3248
 
3249
+ #: inc/crawler.class.php:324 includes/litespeed-cache-crawler.class.php:324
3250
  msgid "Failed to send position reset notification: %s"
3251
  msgstr ""
3252
 
3253
+ #: inc/crawler.class.php:328 includes/litespeed-cache-crawler.class.php:328
3254
  msgid "Position reset notification sent successfully"
3255
  msgstr ""
3256
 
3257
+ #: inc/crawler.class.php:411 includes/litespeed-cache-crawler.class.php:411
3258
  #: lib/litespeed/litespeed-crawler.class.php:327
3259
  msgid "Reached end of sitemap file. Crawling completed."
3260
  msgstr ""
3261
 
3262
+ #: inc/gui.class.php:65 includes/litespeed-cache-gui.class.php:65
3263
  msgid "Purge this page"
3264
  msgstr ""
3265
 
3266
+ #: inc/gui.class.php:73 includes/litespeed-cache-gui.class.php:73
3267
  msgid "Mark this page as "
3268
  msgstr ""
3269
 
3270
+ #: inc/gui.class.php:80 includes/litespeed-cache-gui.class.php:80
3271
  msgid "Non cacheable"
3272
  msgstr ""
3273
 
3274
+ #: inc/gui.class.php:87 includes/litespeed-cache-gui.class.php:87
3275
  msgid "Private cache"
3276
  msgstr ""
3277
 
3278
+ #: inc/gui.class.php:94 includes/litespeed-cache-gui.class.php:94
3279
  msgid "No optimization"
3280
  msgstr ""
3281
 
3282
+ #: inc/gui.class.php:101 includes/litespeed-cache-gui.class.php:101
3283
  msgid "More settings"
3284
  msgstr ""
3285
 
3286
+ #: inc/litespeed-cache.class.php:226 includes/litespeed-cache.class.php:226
3287
+ msgid "Crawler blacklist is saved."
3288
  msgstr ""
3289
 
3290
+ #: inc/litespeed-cache.class.php:231 includes/litespeed-cache.class.php:231
3291
+ msgid "Notified LiteSpeed Web Server to purge the front page."
3292
  msgstr ""
3293
 
3294
+ #: inc/litespeed-cache.class.php:236 includes/litespeed-cache.class.php:236
3295
+ msgid "Notified LiteSpeed Web Server to purge pages."
3296
  msgstr ""
3297
 
3298
+ #: inc/litespeed-cache.class.php:241 includes/litespeed-cache.class.php:241
3299
+ msgid "Notified LiteSpeed Web Server to purge CSS/JS entries."
3300
  msgstr ""
3301
 
3302
+ #: inc/litespeed-cache.class.php:246 includes/litespeed-cache.class.php:246
3303
+ msgid "Notified LiteSpeed Web Server to purge error pages."
3304
  msgstr ""
3305
 
3306
+ #: inc/litespeed-cache.class.php:252 includes/litespeed-cache.class.php:252
3307
+ msgid "Notified LiteSpeed Web Server to purge all caches."
3308
  msgstr ""
3309
 
3310
+ #: inc/litespeed-cache.class.php:259 includes/litespeed-cache.class.php:259
3311
+ msgid "Notified LiteSpeed Web Server to purge everything."
3312
  msgstr ""
3313
 
3314
+ #: inc/litespeed-cache.class.php:274 includes/litespeed-cache.class.php:274
3315
+ msgid "Notified LiteSpeed Web Server to purge the list."
3316
  msgstr ""
3317
 
3318
+ #: inc/purge.class.php:203 includes/litespeed-cache-purge.class.php:203
3319
+ msgid "Purge category %s"
3320
  msgstr ""
3321
 
3322
+ #: inc/purge.class.php:230 includes/litespeed-cache-purge.class.php:230
3323
+ msgid "Purge Post ID %s"
3324
  msgstr ""
3325
 
3326
+ #: inc/purge.class.php:259 includes/litespeed-cache-purge.class.php:259
3327
+ msgid "Purge tag %s"
3328
  msgstr ""
3329
 
3330
+ #: inc/purge.class.php:293 includes/litespeed-cache-purge.class.php:293
3331
+ msgid "Purge url %s"
3332
  msgstr ""
3333
 
3334
+ #: inc/task.class.php:112 includes/litespeed-cache-task.class.php:112
3335
+ msgid "LiteSpeed Cache Custom Cron"
3336
  msgstr ""
3337
 
3338
  #: lib/litespeed/litespeed-crawler.class.php:174
3388
  msgid "Failed to write to %s."
3389
  msgstr ""
3390
 
3391
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:607
3392
  msgid "WooCommerce"
3393
  msgstr ""
3394
 
3395
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:610
3396
  msgid "Purge product on changes to the quantity or stock status."
3397
  msgstr ""
3398
 
3399
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:611
3400
  msgid "Purge categories only when stock status changes."
3401
  msgstr ""
3402
 
3403
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:612
3404
  msgid "Purge product and categories only when the stock status changes."
3405
  msgstr ""
3406
 
3407
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:613
3408
  msgid "Purge product only when the stock status changes."
3409
  msgstr ""
3410
 
3411
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:614
3412
  msgid "Do not purge categories on changes to the quantity or stock status."
3413
  msgstr ""
3414
 
3415
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:615
3416
  msgid ""
3417
  "Always purge both product and categories on changes to the quantity or stock "
3418
  "status."
3419
  msgstr ""
3420
 
3421
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:618
3422
  msgid ""
3423
  "Determines how changes in product quantity and product stock status affect "
3424
  "product pages and their associated category pages."
3425
  msgstr ""
3426
 
3427
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:619
3428
  msgid ""
3429
  "Checking this option will force the shop page to use the front page TTL "
3430
  "setting."
3431
  msgstr ""
3432
 
3433
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:620
3434
  msgid ""
3435
  "For example, if the homepage for the site is located at %1$s, the shop page "
3436
  "may be located at %2$s."
3437
  msgstr ""
3438
 
3439
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:648
3440
  msgid "Product Update Interval"
3441
  msgstr ""
3442
 
3443
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:655
3444
  msgid "Use Front Page TTL for the Shop Page"
3445
  msgstr ""
3446
 
3447
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:665
3448
  msgid "After verifying that the cache works in general, please test the cart."
3449
  msgstr ""
3450
 
3451
+ #: thirdparty/lscwp-3rd-woocommerce.cls.php:666
3452
  msgid "To test the cart, visit the %s."
3453
  msgstr ""
3454
 
lib/litespeed-php-compatibility.func.php CHANGED
File without changes
lib/litespeed/litespeed-crawler.class.php CHANGED
File without changes
lib/litespeed/litespeed-file.class.php CHANGED
File without changes
lib/litespeed/litespeed-string.class.php CHANGED
File without changes
lib/vendor/autoload.php CHANGED
File without changes
lib/vendor/composer/ClassLoader.php CHANGED
File without changes
lib/vendor/composer/LICENSE CHANGED
File without changes
lib/vendor/composer/autoload_classmap.php CHANGED
File without changes
lib/vendor/composer/autoload_namespaces.php CHANGED
File without changes
lib/vendor/composer/autoload_psr4.php CHANGED
File without changes
lib/vendor/composer/autoload_real.php CHANGED
File without changes
lib/vendor/composer/autoload_static.php CHANGED
File without changes
lib/vendor/container-interop/container-interop/LICENSE CHANGED
File without changes
lib/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php CHANGED
File without changes
lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php CHANGED
File without changes
lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php CHANGED
File without changes
lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php CHANGED
File without changes
lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php CHANGED
File without changes
lib/vendor/monolog/monolog/.php_cs CHANGED
File without changes
lib/vendor/monolog/monolog/LICENSE CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/ErrorHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Logger.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php CHANGED
File without changes
lib/vendor/monolog/monolog/src/Monolog/Registry.php CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/.editorconfig CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/HISTORY.txt CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/LICENSE.txt CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/src/JSMin/JSMin.php CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedCommentException.php CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedRegExpException.php CHANGED
File without changes
lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedStringException.php CHANGED
File without changes
lib/vendor/mrclay/minify/.htaccess CHANGED
File without changes
lib/vendor/mrclay/minify/.php_cs CHANGED
File without changes
lib/vendor/mrclay/minify/.travis.yml CHANGED
File without changes
lib/vendor/mrclay/minify/LICENSE.txt CHANGED
File without changes
lib/vendor/mrclay/minify/bootstrap.php CHANGED
File without changes
lib/vendor/mrclay/minify/config-test.php CHANGED
File without changes
lib/vendor/mrclay/minify/config.php CHANGED
File without changes
lib/vendor/mrclay/minify/groupsConfig.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/HTTP/ConditionalGet.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/HTTP/Encoder.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/App.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Build.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CSS.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CSS/Compressor.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CSS/UriRewriter.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CSSmin.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/APC.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/File.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/Memcache.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/Null.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/WinCache.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/XCache.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Cache/ZendPlatform.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CacheInterface.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/ClosureCompiler.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/CommentPreserver.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Config.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Controller/Base.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Controller/Files.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Controller/Groups.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Controller/MinApp.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Controller/Page.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/ControllerInterface.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/DebugDetector.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Env.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/HTML.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/HTML/Helper.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/ImportProcessor.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/JS/ClosureCompiler.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/JS/JShrink.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/LessCssSource.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Lines.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Logger/LegacyHandler.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/NailgunClosureCompiler.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Packer.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/ScssCssSource.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/ServeConfiguration.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Source.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Source/Factory.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/Source/FactoryException.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/SourceInterface.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/SourceSet.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/Minify/YUICompressor.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/MrClay/Cli.php CHANGED
File without changes
lib/vendor/mrclay/minify/lib/MrClay/Cli/Arg.php CHANGED
File without changes
lib/vendor/mrclay/minify/static/.htaccess CHANGED
File without changes
lib/vendor/mrclay/minify/static/gen.php CHANGED
File without changes
lib/vendor/mrclay/minify/static/lib.php CHANGED
File without changes
lib/vendor/mrclay/minify/utils.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/.travis.yml CHANGED
File without changes
lib/vendor/mrclay/props-dic/LICENSE CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/BadMethodCallException.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/Container.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/FactoryUncallableException.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/NotFoundException.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/Pimple.php CHANGED
File without changes
lib/vendor/mrclay/props-dic/src/Props/ValueUnresolvableException.php CHANGED
File without changes
lib/vendor/pimple/pimple/.travis.yml CHANGED
File without changes
lib/vendor/pimple/pimple/LICENSE CHANGED
File without changes
lib/vendor/pimple/pimple/ext/pimple/config.m4 CHANGED
File without changes
lib/vendor/pimple/pimple/ext/pimple/config.w32 CHANGED
File without changes
lib/vendor/pimple/pimple/ext/pimple/php_pimple.h CHANGED
File without changes
lib/vendor/pimple/pimple/ext/pimple/pimple.c CHANGED
File without changes
lib/vendor/pimple/pimple/ext/pimple/pimple_compat.h CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Container.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Psr11/Container.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/ServiceIterator.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php CHANGED
File without changes
lib/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php CHANGED
File without changes
lib/vendor/psr/container/LICENSE CHANGED
File without changes
lib/vendor/psr/container/src/ContainerExceptionInterface.php CHANGED
File without changes
lib/vendor/psr/container/src/ContainerInterface.php CHANGED
File without changes
lib/vendor/psr/container/src/NotFoundExceptionInterface.php CHANGED
File without changes
lib/vendor/psr/log/LICENSE CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/AbstractLogger.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/LogLevel.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/LoggerAwareInterface.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/LoggerAwareTrait.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/LoggerInterface.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/LoggerTrait.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/NullLogger.php CHANGED
File without changes
lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/gui/scripts.js CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/gui/styles.css CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/css/bootstrap.min.css CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/js/bootstrap.min.js CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/gui/third-party/jquery-1.12.4.min.js CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/src/Colors.php CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/src/Command.php CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/src/Minifier.php CHANGED
File without changes
lib/vendor/tubalmartin/cssmin/src/Utils.php CHANGED
File without changes
litespeed-cache.php CHANGED
@@ -15,7 +15,7 @@
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
- * Version: 1.4
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
@@ -62,7 +62,7 @@ define( 'LSWCP_CONTENT_FOLDER', str_replace( home_url( '/' ), '', WP_CONTENT_URL
62
 
63
 
64
  // Auto register LiteSpeed classes
65
- require_once LSWCP_DIR . 'includes/litespeed.autoload.php' ;
66
 
67
  // Define CLI
68
  if ( ( defined( 'WP_CLI' ) && WP_CLI ) || PHP_SAPI == 'cli' ) {
15
  * Plugin Name: LiteSpeed Cache
16
  * Plugin URI: https://www.litespeedtech.com/products/cache-plugins/wordpress-acceleration
17
  * Description: WordPress plugin to connect to LSCache on LiteSpeed Web Server.
18
+ * Version: 1.5
19
  * Author: LiteSpeed Technologies
20
  * Author URI: https://www.litespeedtech.com
21
  * License: GPLv3
62
 
63
 
64
  // Auto register LiteSpeed classes
65
+ require_once LSWCP_DIR . 'inc/litespeed.autoload.php' ;
66
 
67
  // Define CLI
68
  if ( ( defined( 'WP_CLI' ) && WP_CLI ) || PHP_SAPI == 'cli' ) {
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: LiteSpeedTech
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, wordfence
4
  Requires at least: 4.0
5
  Tested up to: 4.8.2
6
- Stable tag: 1.4
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
@@ -238,19 +238,33 @@ For more detailed information about crawler setup, please see [our blog post](ht
238
 
239
  == Changelog ==
240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
241
  = 1.4 - October 11 2017 =
242
- * [New] Lazy load images/iframes.
243
- * [New] Clean CSS/JS optimizer data functionality in DB Optimizer panel.
244
- * [New] Exclude certain URIs from optimizer.
245
- * [Improvement] Improved optimizer HTML check compatibility to avoid conflicts with ESI functions.
246
- * [Improvement] Added support for using ^ when matching the start of a path in matching settings.
247
- * [Improvement] Added wildcard support in CDN original URL.
248
- * [Improvement] Moved optimizer table initialization to admin setting panel with failure warning.
249
- * [Update] Added a one-time welcome banner.
250
- * [Update] Partly relocated class: 'api'.
251
  * [API] Added API wrapper for removing wrapped HTML output.
252
- * [Integration] Fixed WooCommerce conflict with optimizer.
253
- * [Integration] Private cache support for WooCommerce v3.2.0+.
254
  * [GUI] Added No Optimization menu to frontend.
255
 
256
  = 1.3.1.1 - October 6 2017 =
3
  Tags: cache, wp-cache, litespeed, super cache, http2, total cache, wordfence
4
  Requires at least: 4.0
5
  Tested up to: 4.8.2
6
+ Stable tag: 1.5
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl.html
9
 
238
 
239
  == Changelog ==
240
 
241
+ = 1.5 - October 17 2017 =
242
+ * [NEW FEATURE] Exclude JQuery (to fix inline JS error when using JS Combine).
243
+ * [NEW FEATURE] Load JQuery Remotely.
244
+ * [NEW FEATURE] JS Deferred Excludes.
245
+ * [NEW FEATURE] Lazy Load Images Excludes.
246
+ * [NEW FEATURE] Lazy Load Image Placeholder.
247
+ * [IMPROVEMENT] Improved Lazy Load size attribute for w3c validator.
248
+ * [UPDATE] Added basic caching info and LSCWP version to HTML comment.
249
+ * [UPDATE] Added debug log to HTML detection.
250
+ * [BUGFIX] Fixed potential font CORS issue when using CDN.
251
+ * [GUI] Added API docs to setting description.
252
+ * [REFACTOR] Relocated all classes under includes with backwards compatibility.
253
+ * [REFACTOR] Relocated admin templates.
254
+
255
  = 1.4 - October 11 2017 =
256
+ * [NEW FEATURE] Lazy load images/iframes.
257
+ * [NEW FEATURE] Clean CSS/JS optimizer data functionality in DB Optimizer panel.
258
+ * [NEW FEATURE] Exclude certain URIs from optimizer.
259
+ * [IMPROVEMENT] Improved optimizer HTML check compatibility to avoid conflicts with ESI functions.
260
+ * [IMPROVEMENT] Added support for using ^ when matching the start of a path in matching settings.
261
+ * [IMPROVEMENT] Added wildcard support in CDN original URL.
262
+ * [IMPROVEMENT] Moved optimizer table initialization to admin setting panel with failure warning.
263
+ * [UPDATE] Added a one-time welcome banner.
264
+ * [UPDATE] Partly relocated class: 'api'.
265
  * [API] Added API wrapper for removing wrapped HTML output.
266
+ * [INTEGRATION] Fixed WooCommerce conflict with optimizer.
267
+ * [INTEGRATION] Private cache support for WooCommerce v3.2.0+.
268
  * [GUI] Added No Optimization menu to frontend.
269
 
270
  = 1.3.1.1 - October 6 2017 =
thirdparty/lscwp-3rd-aelia-currencyswitcher.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-autoptimize.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-avada.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-bbpress.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-betterwp-minify.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-like-dislike-counter.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-nextgengallery.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-theme-my-login.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-woocommerce.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-wp-polls.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-wp-postratings.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-wpforo.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-wplister.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-wptouch.cls.php CHANGED
File without changes
thirdparty/lscwp-3rd-yith-wishlist.cls.php CHANGED
File without changes
thirdparty/lscwp-registry-3rd.php CHANGED
File without changes
tpl/dummy.tpl.php CHANGED
File without changes
tpl/esi.tpl.php CHANGED
File without changes