LiteSpeed Cache - Version 1.4

Version Description

  • October 11 2017 =
  • [New] Lazy load images/iframes.
  • [New] Clean CSS/JS optimizer data functionality in DB Optimizer panel.
  • [New] Exclude certain URIs from optimizer.
  • [Improvement] Improved optimizer HTML check compatibility to avoid conflicts with ESI functions.
  • [Improvement] Added support for using ^ when matching the start of a path in matching settings.
  • [Improvement] Added wildcard support in CDN original URL.
  • [Improvement] Moved optimizer table initialization to admin setting panel with failure warning.
  • [Update] Added a one-time welcome banner.
  • [Update] Partly relocated class: 'api'.
  • [API] Added API wrapper for removing wrapped HTML output.
  • [Integration] Fixed WooCommerce conflict with optimizer.
  • [Integration] Private cache support for WooCommerce v3.2.0+.
  • [GUI] Added No Optimization menu to frontend.
Download this release

Release Info

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

Code changes from version 1.0.15 to 1.4

Files changed (399) hide show
  1. admin/class-litespeed-cache-admin-display.php +0 -2974
  2. admin/class-litespeed-cache-admin-error.php +0 -368
  3. admin/class-litespeed-cache-admin-rules.php +0 -1520
  4. admin/class-litespeed-cache-admin.php +2 -1213
  5. admin/css/litespeed-cache-admin.css +0 -394
  6. admin/js/litespeed-cache-admin.js +0 -190
  7. admin/litespeed-cache-admin-display.class.php +836 -0
  8. admin/litespeed-cache-admin-error.class.php +262 -0
  9. admin/litespeed-cache-admin-optimize.class.php +199 -0
  10. admin/litespeed-cache-admin-report.class.php +197 -0
  11. admin/litespeed-cache-admin-rules.class.php +854 -0
  12. admin/litespeed-cache-admin-settings.class.php +1001 -0
  13. admin/litespeed-cache-admin.class.php +276 -0
  14. admin/tpl/admin_footer.php +19 -0
  15. admin/tpl/banner_promo.php +33 -0
  16. admin/tpl/crawler.php +228 -0
  17. admin/tpl/debug_log.php +27 -0
  18. admin/tpl/edit_htaccess.php +75 -0
  19. admin/tpl/esi_widget_edit.php +80 -0
  20. admin/tpl/help_tabs.php +26 -0
  21. admin/tpl/info.php +42 -0
  22. admin/tpl/info_admin_ip.php +33 -0
  23. admin/tpl/info_common_rewrite.php +58 -0
  24. admin/tpl/info_compatibility.php +57 -0
  25. admin/tpl/info_config.php +68 -0
  26. admin/tpl/info_crawler.php +67 -0
  27. admin/tpl/info_faqs.php +110 -0
  28. admin/tpl/manage.php +59 -0
  29. admin/tpl/manage_db.php +93 -0
  30. admin/tpl/manage_purge.php +187 -0
  31. admin/tpl/network_settings.php +59 -0
  32. admin/tpl/network_settings_cache.php +19 -0
  33. admin/tpl/network_settings_excludes.php +15 -0
  34. admin/tpl/network_settings_general.php +34 -0
  35. admin/tpl/network_settings_purge.php +10 -0
  36. admin/tpl/report.php +46 -0
  37. admin/tpl/settings.php +151 -0
  38. admin/tpl/settings_advanced.php +80 -0
  39. admin/tpl/settings_cache.php +80 -0
  40. admin/tpl/settings_cdn.php +106 -0
  41. admin/tpl/settings_compatibilities.php +38 -0
  42. admin/tpl/settings_crawler.php +196 -0
  43. admin/tpl/settings_debug.php +146 -0
  44. admin/tpl/settings_esi.php +90 -0
  45. admin/tpl/settings_excludes.php +119 -0
  46. admin/tpl/settings_general.php +144 -0
  47. admin/tpl/settings_inc.cache_browser.php +19 -0
  48. admin/tpl/settings_inc.cache_favicon.php +19 -0
  49. admin/tpl/settings_inc.cache_mobile.php +70 -0
  50. admin/tpl/settings_inc.cache_resources.php +20 -0
  51. admin/tpl/settings_inc.exclude_cookies.php +27 -0
  52. admin/tpl/settings_inc.exclude_useragent.php +26 -0
  53. admin/tpl/settings_inc.purge_on_upgrade.php +14 -0
  54. admin/tpl/settings_media.php +32 -0
  55. admin/tpl/settings_optimize.php +204 -0
  56. admin/tpl/settings_purge.php +96 -0
  57. admin/tpl/show_display_installed.php +21 -0
  58. admin/tpl/show_error_cookie.php +13 -0
  59. admin/tpl/show_rule_conflict.php +13 -0
  60. cli/class-litespeed-cache-cli-admin.php +0 -328
  61. cli/class-litespeed-cache-cli-purge.php +0 -316
  62. cli/litespeed-cache-cli-admin.class.php +369 -0
  63. cli/litespeed-cache-cli-purge.class.php +302 -0
  64. css/fonts/litespeedfont.eot +0 -0
  65. css/fonts/litespeedfont.svg +11 -0
  66. css/fonts/litespeedfont.ttf +0 -0
  67. css/fonts/litespeedfont.woff +0 -0
  68. css/litespeed.css +1202 -0
  69. img/Litespeed.icon.svg +30 -0
  70. img/icons/all.svg +65 -0
  71. img/icons/all_transients.svg +33 -0
  72. img/icons/auto_draft.svg +54 -0
  73. img/icons/cross_icon.svg +41 -0
  74. img/icons/db.svg +21 -0
  75. img/icons/empty-cache.svg +60 -0
  76. img/icons/expired_transient.svg +38 -0
  77. img/icons/optimize_tables.svg +30 -0
  78. img/icons/purge-403.svg +47 -0
  79. img/icons/purge-404.svg +41 -0
  80. img/icons/purge-500.svg +46 -0
  81. img/icons/purge-all.svg +46 -0
  82. img/icons/purge-cssjs.svg +50 -0
  83. img/icons/purge-front.svg +31 -0
  84. img/icons/purge-pages.svg +41 -0
  85. img/icons/revision.svg +64 -0
  86. img/icons/spam_comment.svg +38 -0
  87. img/icons/success_icon.svg +42 -0
  88. img/icons/trackback-pingback.svg +30 -0
  89. img/icons/trash_comment.svg +64 -0
  90. img/icons/trash_post.svg +48 -0
  91. img/lscwp-logo_256x256.png +0 -0
  92. inc/api.class.php +449 -0
  93. inc/crawler-sitemap.class.php +155 -0
  94. inc/data.class.php +194 -0
  95. inc/media.class.php +236 -0
  96. includes/class-litespeed-cache-config.php +0 -677
  97. includes/class-litespeed-cache-tags.php +0 -237
  98. includes/class-litespeed-cache.php +0 -2630
  99. includes/deprecated-litespeed-cache-tags.class.php +12 -0
  100. includes/litespeed-cache-activation.class.php +235 -0
  101. includes/litespeed-cache-cdn.class.php +413 -0
  102. includes/litespeed-cache-config.class.php +841 -0
  103. includes/litespeed-cache-control.class.php +610 -0
  104. includes/litespeed-cache-crawler.class.php +450 -0
  105. includes/litespeed-cache-esi.class.php +553 -0
  106. includes/litespeed-cache-gui.class.php +195 -0
  107. includes/litespeed-cache-log.class.php +321 -0
  108. includes/litespeed-cache-optimize.class.php +1002 -0
  109. includes/litespeed-cache-purge.class.php +753 -0
  110. includes/litespeed-cache-router.class.php +433 -0
  111. includes/litespeed-cache-tag.class.php +367 -0
  112. includes/litespeed-cache-task.class.php +128 -0
  113. includes/litespeed-cache-utility.class.php +278 -0
  114. includes/litespeed-cache-vary.class.php +465 -0
  115. includes/litespeed-cache.class.php +618 -0
  116. includes/litespeed.autoload.php +76 -0
  117. js/css_async.js +4 -0
  118. js/lazyload.js +29 -0
  119. js/lazyload.min.js +2 -0
  120. js/litespeed-cache-admin.js +396 -0
  121. languages/litespeed-cache.pot +2359 -1160
  122. lib/litespeed-php-compatibility.func.php +123 -0
  123. lib/litespeed/crawler/abstract/sitemap.php +0 -27
  124. lib/litespeed/crawler/config.php +0 -69
  125. lib/litespeed/crawler/crawler.php +0 -12
  126. lib/litespeed/crawler/metadata.php +0 -164
  127. lib/litespeed/litespeed-crawler.class.php +573 -0
  128. lib/litespeed/litespeed-file.class.php +402 -0
  129. lib/litespeed/litespeed-string.class.php +70 -0
  130. lib/vendor/autoload.php +7 -0
  131. lib/vendor/bin/cssmin +37 -0
  132. lib/vendor/composer/ClassLoader.php +445 -0
  133. lib/vendor/composer/LICENSE +21 -0
  134. lib/vendor/composer/autoload_classmap.php +59 -0
  135. lib/vendor/composer/autoload_namespaces.php +12 -0
  136. lib/vendor/composer/autoload_psr4.php +15 -0
  137. lib/vendor/composer/autoload_real.php +52 -0
  138. lib/vendor/composer/autoload_static.php +142 -0
  139. lib/vendor/container-interop/container-interop/LICENSE +20 -0
  140. lib/vendor/container-interop/container-interop/src/Interop/Container/ContainerInterface.php +15 -0
  141. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/ContainerException.php +15 -0
  142. lib/vendor/container-interop/container-interop/src/Interop/Container/Exception/NotFoundException.php +15 -0
  143. lib/vendor/intervention/httpauth/.travis.yml +11 -0
  144. lib/vendor/intervention/httpauth/LICENSE +9 -0
  145. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/BasicUser.php +63 -0
  146. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/DigestUser.php +134 -0
  147. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/Facades/Httpauth.php +13 -0
  148. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/Httpauth.php +159 -0
  149. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProvider.php +82 -0
  150. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel4.php +30 -0
  151. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/HttpauthServiceProviderLaravel5.php +37 -0
  152. lib/vendor/intervention/httpauth/src/Intervention/Httpauth/UserInterface.php +22 -0
  153. lib/vendor/intervention/httpauth/src/config/config.php +49 -0
  154. lib/vendor/monolog/monolog/.php_cs +59 -0
  155. lib/vendor/monolog/monolog/LICENSE +19 -0
  156. lib/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +230 -0
  157. lib/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +78 -0
  158. lib/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +89 -0
  159. lib/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +116 -0
  160. lib/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +85 -0
  161. lib/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php +36 -0
  162. lib/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +138 -0
  163. lib/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +141 -0
  164. lib/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +208 -0
  165. lib/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +179 -0
  166. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +47 -0
  167. lib/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +166 -0
  168. lib/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +105 -0
  169. lib/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +297 -0
  170. lib/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php +48 -0
  171. lib/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +113 -0
  172. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +186 -0
  173. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +66 -0
  174. lib/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +101 -0
  175. lib/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +148 -0
  176. lib/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +230 -0
  177. lib/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +117 -0
  178. lib/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +211 -0
  179. lib/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +72 -0
  180. lib/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +151 -0
  181. lib/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +57 -0
  182. lib/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +169 -0
  183. lib/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +45 -0
  184. lib/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +107 -0
  185. lib/vendor/monolog/monolog/src/Monolog/Handler/ElasticSearchHandler.php +128 -0
  186. lib/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +82 -0
  187. lib/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +140 -0
  188. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +28 -0
  189. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +59 -0
  190. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +34 -0
  191. lib/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +163 -0
  192. lib/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +195 -0
  193. lib/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +126 -0
  194. lib/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +127 -0
  195. lib/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +73 -0
  196. lib/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +104 -0
  197. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +90 -0
  198. lib/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +108 -0
  199. lib/vendor/monolog/monolog/src/Monolog/Handler/HipChatHandler.php +350 -0
  200. lib/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +69 -0
  201. lib/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +55 -0
  202. lib/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +102 -0
  203. lib/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +67 -0
  204. lib/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +68 -0
  205. lib/vendor/monolog/monolog/src/Monolog/Handler/MissingExtensionException.php +21 -0
  206. lib/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +59 -0
  207. lib/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +185 -0
  208. lib/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +202 -0
  209. lib/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +45 -0
  210. lib/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +242 -0
  211. lib/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +56 -0
  212. lib/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +185 -0
  213. lib/vendor/monolog/monolog/src/Monolog/Handler/RavenHandler.php +232 -0
  214. lib/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +97 -0
  215. lib/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +132 -0
  216. lib/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +178 -0
  217. lib/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +82 -0
  218. lib/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +294 -0
  219. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +215 -0
  220. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +115 -0
  221. lib/vendor/monolog/monolog/src/Monolog/Handler/SlackbotHandler.php +80 -0
  222. lib/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +346 -0
  223. lib/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +176 -0
  224. lib/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php +99 -0
  225. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +67 -0
  226. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +56 -0
  227. lib/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +103 -0
  228. lib/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +154 -0
  229. lib/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +61 -0
  230. lib/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +95 -0
  231. lib/vendor/monolog/monolog/src/Monolog/Logger.php +700 -0
  232. lib/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +64 -0
  233. lib/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +112 -0
  234. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +35 -0
  235. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +63 -0
  236. lib/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +35 -0
  237. lib/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +63 -0
  238. lib/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +31 -0
  239. lib/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +48 -0
  240. lib/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +44 -0
  241. lib/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +46 -0
  242. lib/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +113 -0
  243. lib/vendor/monolog/monolog/src/Monolog/Registry.php +134 -0
  244. lib/vendor/mrclay/jsmin-php/.editorconfig +19 -0
  245. lib/vendor/mrclay/jsmin-php/HISTORY.txt +24 -0
  246. lib/vendor/mrclay/jsmin-php/LICENSE.txt +26 -0
  247. lib/vendor/mrclay/jsmin-php/src/JSMin/JSMin.php +454 -0
  248. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedCommentException.php +6 -0
  249. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedRegExpException.php +6 -0
  250. lib/vendor/mrclay/jsmin-php/src/JSMin/UnterminatedStringException.php +6 -0
  251. lib/vendor/mrclay/minify/.htaccess +13 -0
  252. lib/vendor/mrclay/minify/.php_cs +27 -0
  253. lib/vendor/mrclay/minify/.travis.yml +37 -0
  254. lib/vendor/mrclay/minify/LICENSE.txt +26 -0
  255. lib/vendor/mrclay/minify/bootstrap.php +25 -0
  256. lib/vendor/mrclay/minify/config-test.php +10 -0
  257. lib/vendor/mrclay/minify/config.php +201 -0
  258. lib/vendor/mrclay/minify/groupsConfig.php +19 -0
  259. lib/vendor/mrclay/minify/lib/HTTP/ConditionalGet.php +376 -0
  260. lib/vendor/mrclay/minify/lib/HTTP/Encoder.php +335 -0
  261. lib/vendor/mrclay/minify/lib/Minify.php +761 -0
  262. lib/vendor/mrclay/minify/lib/Minify/App.php +282 -0
  263. lib/vendor/mrclay/minify/lib/Minify/Build.php +102 -0
  264. lib/vendor/mrclay/minify/lib/Minify/CSS.php +98 -0
  265. lib/vendor/mrclay/minify/lib/Minify/CSS/Compressor.php +275 -0
  266. lib/vendor/mrclay/minify/lib/Minify/CSS/UriRewriter.php +358 -0
  267. lib/vendor/mrclay/minify/lib/Minify/CSSmin.php +88 -0
  268. lib/vendor/mrclay/minify/lib/Minify/Cache/APC.php +136 -0
  269. lib/vendor/mrclay/minify/lib/Minify/Cache/File.php +183 -0
  270. lib/vendor/mrclay/minify/lib/Minify/Cache/Memcache.php +141 -0
  271. lib/vendor/mrclay/minify/lib/Minify/Cache/Null.php +67 -0
  272. lib/vendor/mrclay/minify/lib/Minify/Cache/WinCache.php +139 -0
  273. lib/vendor/mrclay/minify/lib/Minify/Cache/XCache.php +130 -0
  274. lib/vendor/mrclay/minify/lib/Minify/Cache/ZendPlatform.php +129 -0
  275. lib/vendor/mrclay/minify/lib/Minify/CacheInterface.php +58 -0
  276. lib/vendor/mrclay/minify/lib/Minify/ClosureCompiler.php +240 -0
  277. lib/vendor/mrclay/minify/lib/Minify/CommentPreserver.php +87 -0
  278. lib/vendor/mrclay/minify/lib/Minify/Config.php +78 -0
  279. lib/vendor/mrclay/minify/lib/Minify/Controller/Base.php +81 -0
  280. lib/vendor/mrclay/minify/lib/Minify/Controller/Files.php +71 -0
  281. lib/vendor/mrclay/minify/lib/Minify/Controller/Groups.php +76 -0
  282. lib/vendor/mrclay/minify/lib/Minify/Controller/MinApp.php +196 -0
  283. lib/vendor/mrclay/minify/lib/Minify/Controller/Page.php +69 -0
  284. lib/vendor/mrclay/minify/lib/Minify/ControllerInterface.php +22 -0
  285. lib/vendor/mrclay/minify/lib/Minify/DebugDetector.php +30 -0
  286. lib/vendor/mrclay/minify/lib/Minify/Env.php +127 -0
  287. lib/vendor/mrclay/minify/lib/Minify/HTML.php +258 -0
  288. lib/vendor/mrclay/minify/lib/Minify/HTML/Helper.php +250 -0
  289. lib/vendor/mrclay/minify/lib/Minify/ImportProcessor.php +217 -0
  290. lib/vendor/mrclay/minify/lib/Minify/JS/ClosureCompiler.php +234 -0
  291. lib/vendor/mrclay/minify/lib/Minify/JS/JShrink.php +48 -0
  292. lib/vendor/mrclay/minify/lib/Minify/LessCssSource.php +128 -0
  293. lib/vendor/mrclay/minify/lib/Minify/Lines.php +209 -0
  294. lib/vendor/mrclay/minify/lib/Minify/Logger/LegacyHandler.php +24 -0
  295. lib/vendor/mrclay/minify/lib/Minify/NailgunClosureCompiler.php +113 -0
  296. lib/vendor/mrclay/minify/lib/Minify/Packer.php +31 -0
  297. lib/vendor/mrclay/minify/lib/Minify/ScssCssSource.php +176 -0
  298. lib/vendor/mrclay/minify/lib/Minify/ServeConfiguration.php +71 -0
  299. lib/vendor/mrclay/minify/lib/Minify/Source.php +214 -0
  300. lib/vendor/mrclay/minify/lib/Minify/Source/Factory.php +197 -0
  301. lib/vendor/mrclay/minify/lib/Minify/Source/FactoryException.php +5 -0
  302. lib/vendor/mrclay/minify/lib/Minify/SourceInterface.php +82 -0
  303. lib/vendor/mrclay/minify/lib/Minify/SourceSet.php +31 -0
  304. lib/vendor/mrclay/minify/lib/Minify/YUICompressor.php +157 -0
  305. lib/vendor/mrclay/minify/lib/MrClay/Cli.php +393 -0
  306. lib/vendor/mrclay/minify/lib/MrClay/Cli/Arg.php +189 -0
  307. lib/vendor/mrclay/minify/static/.htaccess +40 -0
  308. lib/vendor/mrclay/minify/static/gen.php +127 -0
  309. lib/vendor/mrclay/minify/static/lib.php +68 -0
  310. lib/vendor/mrclay/minify/utils.php +78 -0
  311. lib/vendor/mrclay/props-dic/.travis.yml +30 -0
  312. lib/vendor/mrclay/props-dic/LICENSE +19 -0
  313. lib/vendor/mrclay/props-dic/src/Props/BadMethodCallException.php +9 -0
  314. lib/vendor/mrclay/props-dic/src/Props/Container.php +249 -0
  315. lib/vendor/mrclay/props-dic/src/Props/FactoryUncallableException.php +9 -0
  316. lib/vendor/mrclay/props-dic/src/Props/NotFoundException.php +9 -0
  317. lib/vendor/mrclay/props-dic/src/Props/Pimple.php +56 -0
  318. lib/vendor/mrclay/props-dic/src/Props/ValueUnresolvableException.php +9 -0
  319. lib/vendor/pimple/pimple/.travis.yml +40 -0
  320. lib/vendor/pimple/pimple/LICENSE +19 -0
  321. lib/vendor/pimple/pimple/ext/pimple/config.m4 +63 -0
  322. lib/vendor/pimple/pimple/ext/pimple/config.w32 +13 -0
  323. lib/vendor/pimple/pimple/ext/pimple/php_pimple.h +137 -0
  324. lib/vendor/pimple/pimple/ext/pimple/pimple.c +1114 -0
  325. lib/vendor/pimple/pimple/ext/pimple/pimple_compat.h +81 -0
  326. lib/vendor/pimple/pimple/src/Pimple/Container.php +298 -0
  327. lib/vendor/pimple/pimple/src/Pimple/Exception/ExpectedInvokableException.php +38 -0
  328. lib/vendor/pimple/pimple/src/Pimple/Exception/FrozenServiceException.php +45 -0
  329. lib/vendor/pimple/pimple/src/Pimple/Exception/InvalidServiceIdentifierException.php +45 -0
  330. lib/vendor/pimple/pimple/src/Pimple/Exception/UnknownIdentifierException.php +45 -0
  331. lib/vendor/pimple/pimple/src/Pimple/Psr11/Container.php +55 -0
  332. lib/vendor/pimple/pimple/src/Pimple/Psr11/ServiceLocator.php +75 -0
  333. lib/vendor/pimple/pimple/src/Pimple/ServiceIterator.php +69 -0
  334. lib/vendor/pimple/pimple/src/Pimple/ServiceProviderInterface.php +46 -0
  335. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Invokable.php +38 -0
  336. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/NonInvokable.php +34 -0
  337. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/PimpleServiceProvider.php +54 -0
  338. lib/vendor/pimple/pimple/src/Pimple/Tests/Fixtures/Service.php +35 -0
  339. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleServiceProviderInterfaceTest.php +76 -0
  340. lib/vendor/pimple/pimple/src/Pimple/Tests/PimpleTest.php +589 -0
  341. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ContainerTest.php +77 -0
  342. lib/vendor/pimple/pimple/src/Pimple/Tests/Psr11/ServiceLocatorTest.php +134 -0
  343. lib/vendor/pimple/pimple/src/Pimple/Tests/ServiceIteratorTest.php +52 -0
  344. lib/vendor/psr/container/LICENSE +21 -0
  345. lib/vendor/psr/container/src/ContainerExceptionInterface.php +13 -0
  346. lib/vendor/psr/container/src/ContainerInterface.php +37 -0
  347. lib/vendor/psr/container/src/NotFoundExceptionInterface.php +13 -0
  348. lib/vendor/psr/log/LICENSE +19 -0
  349. lib/vendor/psr/log/Psr/Log/AbstractLogger.php +128 -0
  350. lib/vendor/psr/log/Psr/Log/InvalidArgumentException.php +7 -0
  351. lib/vendor/psr/log/Psr/Log/LogLevel.php +18 -0
  352. lib/vendor/psr/log/Psr/Log/LoggerAwareInterface.php +18 -0
  353. lib/vendor/psr/log/Psr/Log/LoggerAwareTrait.php +26 -0
  354. lib/vendor/psr/log/Psr/Log/LoggerInterface.php +123 -0
  355. lib/vendor/psr/log/Psr/Log/LoggerTrait.php +140 -0
  356. lib/vendor/psr/log/Psr/Log/NullLogger.php +28 -0
  357. lib/vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php +140 -0
  358. lib/vendor/tubalmartin/cssmin/cssmin +37 -0
  359. lib/vendor/tubalmartin/cssmin/gui/scripts.js +104 -0
  360. lib/vendor/tubalmartin/cssmin/gui/styles.css +68 -0
  361. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/css/bootstrap.min.css +339 -0
  362. lib/vendor/tubalmartin/cssmin/gui/third-party/bootstrap/js/bootstrap.min.js +7 -0
  363. lib/vendor/tubalmartin/cssmin/gui/third-party/jquery-1.12.4.min.js +5 -0
  364. lib/vendor/tubalmartin/cssmin/gui/third-party/less-1.7.5.min.js +16 -0
  365. lib/vendor/tubalmartin/cssmin/src/Colors.php +155 -0
  366. lib/vendor/tubalmartin/cssmin/src/Command.php +223 -0
  367. lib/vendor/tubalmartin/cssmin/src/Minifier.php +862 -0
  368. lib/vendor/tubalmartin/cssmin/src/Utils.php +149 -0
  369. litespeed-cache.php +84 -60
  370. readme.txt +323 -200
  371. thirdparty/README.html +0 -230
  372. thirdparty/README.md +0 -232
  373. thirdparty/class-litespeed-cache-thirdparty-aelia-currencyswitcher.php +0 -108
  374. thirdparty/class-litespeed-cache-thirdparty-bbpress.php +0 -56
  375. thirdparty/class-litespeed-cache-thirdparty-plugin.php-template +0 -122
  376. thirdparty/class-litespeed-cache-thirdparty-theme-my-login.php +0 -56
  377. thirdparty/class-litespeed-cache-thirdparty-woocommerce.php +0 -470
  378. thirdparty/class-litespeed-cache-thirdparty-wp-polls.php +0 -30
  379. thirdparty/class-litespeed-cache-thirdparty-wpforo.php +0 -151
  380. thirdparty/class-litespeed-cache-thirdparty-wptouch.php +0 -53
  381. thirdparty/litespeed-cache-thirdparty-registry.php +0 -34
  382. thirdparty/lscwp-3rd-aelia-currencyswitcher.cls.php +89 -0
  383. thirdparty/{class-litespeed-cache-thirdparty-autoptimize.php → lscwp-3rd-autoptimize.cls.php} +8 -13
  384. thirdparty/lscwp-3rd-avada.cls.php +46 -0
  385. thirdparty/lscwp-3rd-bbpress.cls.php +87 -0
  386. thirdparty/{class-litespeed-cache-thirdparty-betterwp-minify.php → lscwp-3rd-betterwp-minify.cls.php} +12 -24
  387. thirdparty/{class-litespeed-cache-thirdparty-like-dislike-counter.php → lscwp-3rd-like-dislike-counter.cls.php} +18 -21
  388. thirdparty/{class-litespeed-cache-thirdparty-nextgengallery.php → lscwp-3rd-nextgengallery.cls.php} +60 -57
  389. thirdparty/lscwp-3rd-theme-my-login.cls.php +50 -0
  390. thirdparty/lscwp-3rd-woocommerce.cls.php +741 -0
  391. thirdparty/lscwp-3rd-wp-polls.cls.php +24 -0
  392. thirdparty/lscwp-3rd-wp-postratings.cls.php +43 -0
  393. thirdparty/lscwp-3rd-wpforo.cls.php +157 -0
  394. thirdparty/lscwp-3rd-wplister.cls.php +34 -0
  395. thirdparty/lscwp-3rd-wptouch.cls.php +47 -0
  396. thirdparty/lscwp-3rd-yith-wishlist.cls.php +113 -0
  397. thirdparty/lscwp-registry-3rd.php +37 -0
  398. tpl/dummy.tpl.php +9 -0
  399. tpl/esi.tpl.php +9 -0
admin/class-litespeed-cache-admin-display.php DELETED
@@ -1,2974 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * The admin-panel specific functionality of the plugin.
5
- *
6
- *
7
- * @since 1.0.0
8
- * @package LiteSpeed_Cache
9
- * @subpackage LiteSpeed_Cache/admin
10
- * @author LiteSpeed Technologies <info@litespeedtech.com>
11
- */
12
- class LiteSpeed_Cache_Admin_Display
13
- {
14
- private static $instance;
15
-
16
- const NOTICE_BLUE = 'notice notice-info';
17
- const NOTICE_GREEN = 'notice notice-success';
18
- const NOTICE_RED = 'notice notice-error';
19
- const NOTICE_YELLOW = 'notice notice-warning';
20
-
21
- const PURGEBY_CAT = '0';
22
- const PURGEBY_PID = '1';
23
- const PURGEBY_TAG = '2';
24
- const PURGEBY_URL = '3';
25
-
26
- const PURGEBYOPT_SELECT = 'purgeby';
27
- const PURGEBYOPT_LIST = 'purgebylist';
28
-
29
- private $notices = array();
30
- private $disable_all = false;
31
-
32
- /**
33
- * Initialize the class and set its properties.
34
- *
35
- * @since 1.0.7
36
- * @access private
37
- */
38
- private function __construct()
39
- {
40
- }
41
-
42
- /**
43
- * Get the LiteSpeed_Cache_Admin_Display object.
44
- *
45
- * @since 1.0.7
46
- * @access public
47
- * @return LiteSpeed_Cache_Admin_Display Static instance of the
48
- * LiteSpeed_Cache_Admin_Display class.
49
- */
50
- public static function get_instance()
51
- {
52
- if (!isset(self::$instance)) {
53
- self::$instance = new LiteSpeed_Cache_Admin_Display();
54
- }
55
-
56
- return self::$instance;
57
- }
58
-
59
- /**
60
- * Change the admin footer text on LiteSpeed Cache admin pages.
61
- *
62
- * @since 1.0.13
63
- * @param string $footer_text
64
- * @return string
65
- */
66
- public function admin_footer_text($footer_text)
67
- {
68
- $rate_us = sprintf(wp_kses(
69
- __('Rate <strong>LiteSpeed Cache</strong> with %s on WordPress.org if you like us!', 'litespeed-cache'),
70
- array('strong' => array())
71
- ),
72
- '<a href="https://wordpress.org/support/plugin/litespeed-cache/reviews/?filter=5#new-post" '
73
- . 'rel="noopener noreferer" target="_blank">&#10030;&#10030;&#10030;&#10030;&#10030;</a>'
74
- );
75
- $questions = sprintf(wp_kses(
76
- __('If there are any questions that are not answered in the <a href="%s">FAQs</a>, do not hesitate to ask them on the <a href="%s" rel="%s" target="%s">support forum</a>.',
77
- 'litespeed-cache'),
78
- array(
79
- 'a' => array(
80
- 'href' => array(),
81
- 'rel' => array(),
82
- 'target' => array(),
83
- ),
84
- )),
85
- get_admin_url() . 'admin.php?page=lscache-info',
86
- 'https://wordpress.org/support/plugin/litespeed-cache',
87
- 'noopener noreferrer', '_blank'
88
- );
89
- // Change the footer text
90
- if (!is_multisite() || is_network_admin()){
91
- $footer_text = self::build_paragraph($rate_us, $questions);
92
- }else{
93
- $footer_text = self::build_paragraph($questions);
94
- }
95
-
96
- return $footer_text;
97
- }
98
-
99
- /**
100
- * Whether to disable all settings or not.
101
- *
102
- * Currently used for 'use primary subsite settings'
103
- *
104
- * @since 1.0.13
105
- * @access public
106
- * @return bool True to disable all settings, false otherwise.
107
- */
108
- public function get_disable_all()
109
- {
110
- return $this->disable_all;
111
- }
112
-
113
- /**
114
- * Set to disable all settings.
115
- *
116
- * @since 1.0.13
117
- * @access public
118
- */
119
- public function set_disable_all()
120
- {
121
- $this->disable_all = true;
122
- }
123
-
124
- /**
125
- * Displays the help tab in the admin pages.
126
- *
127
- * @since 1.0.0
128
- * @access public
129
- */
130
- public function add_help_tabs()
131
- {
132
- $content_para = self::build_paragraph(
133
- __('LiteSpeed Cache is a page cache built into LiteSpeed Web Server.', 'litespeed-cache'),
134
- __('This plugin communicates with LiteSpeed Web Server to let it know which pages are cache-able and when to purge them.', 'litespeed-cache')
135
- );
136
-
137
- $screen = get_current_screen();
138
- $screen->add_help_tab(array(
139
- 'id' => 'lsc-overview',
140
- 'title' => __('Overview', 'litespeed-cache'),
141
- 'content' => '<p>' . $content_para . '</p><p>'
142
- . __('A LiteSpeed server (OLS, LSWS, WebADC) and its LSCache module must be installed and enabled.', 'litespeed-cache')
143
- . '</p>',
144
- ));
145
-
146
- // $screen->add_help_tab(array(
147
- // 'id' => 'lst-purgerules',
148
- // 'title' => __('Auto Purge Rules', 'litespeed-cache'),
149
- // 'content' => '<p>' . __('You can set what pages will be purged when a post is published or updated.', 'litespeed-cache') . '</p>',
150
- // ));
151
-
152
- $screen->set_help_sidebar(
153
- '<p><strong>' . __('For more information:', 'litespeed-cache') . '</strong></p>' .
154
- // '<p><a href="https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache" rel="noopener noreferrer" target="_blank">' . __('LSCache Documentation', 'litespeed-cache') . '</a></p>' .
155
- '<p><a href="https://wordpress.org/support/plugin/litespeed-cache" rel="noopener noreferrer" target="_blank">' . __('Support Forum', 'litespeed-cache') . '</a></p>'
156
- );
157
- }
158
-
159
- /**
160
- * Check to make sure that caching is enabled.
161
- *
162
- * @since 1.0.0
163
- * @access public
164
- * @param LiteSpeed_Cache_Config $config The current configurations object.
165
- * @return mixed True if enabled, error message otherwise.
166
- */
167
- public function check_license($config)
168
- {
169
- if ($config->is_caching_allowed() == false) {
170
- $sentences = LiteSpeed_Cache_Admin_Error::get_error(
171
- LiteSpeed_Cache_Admin_Error::E_SERVER
172
- );
173
-
174
- return $sentences;
175
- }
176
-
177
- return true;
178
- }
179
-
180
- /**
181
- * Helper function to build paragraphs out of all the string sentences
182
- * passed in.
183
- *
184
- * @since 1.0.11
185
- * @access public
186
- * @param string $args,... Variable number of strings to combine to a paragraph.
187
- * @return string The built paragraph.
188
- */
189
- public static function build_paragraph()
190
- {
191
- $args = func_get_args();
192
- $para = implode(' ', $args);
193
- return $para;
194
- }
195
-
196
- /**
197
- * Helper function to build a list out of an array of strings.
198
- *
199
- * @since 1.0.14
200
- * @access public
201
- * @param array $items The list of strings to build into a list.
202
- * @param bool $ordered Whether to make it an ordered or unordered list.
203
- * @param string $style Any styling to apply to the list.
204
- * @return string The built list.
205
- */
206
- public static function build_list($items, $ordered = false, $style = '')
207
- {
208
- $buf = '<';
209
- if ($ordered) {
210
- $type = 'ol';
211
- }
212
- else {
213
- $type = 'ul';
214
- }
215
- $buf .= $type;
216
- if ($style) {
217
- $buf .= ' style="' . $style . '"';
218
- }
219
- $buf .= '><li>';
220
- $buf .= implode('</li><li>', $items);
221
- $buf .= '</li></' . $type . '>';
222
- return $buf;
223
- }
224
-
225
- /**
226
- * Builds the html for a single notice.
227
- *
228
- * @since 1.0.7
229
- * @access private
230
- * @param string $color The color to use for the notice.
231
- * @param string $str The notice message.
232
- * @return string The built notice html.
233
- */
234
- private static function build_notice($color, $str)
235
- {
236
- return '<div class="' . $color . ' is-dismissible"><p>'
237
- . $str . '</p></div>';
238
- }
239
-
240
- /**
241
- * Builds the html for a tooltip text.
242
- *
243
- * @since 1.0.14
244
- * @access private
245
- * @param string $msg Text that needs to be displayed in tooltip
246
- * @param string $class_suffix Class name for the tooltip
247
- * @param string $field_style Extra styles if required for outer span
248
- * @param string $tip_style Extra styles if required for inner span
249
- * @return string tooltip message.
250
- */
251
- private static function build_tip($msg, $class_suffix = '',
252
- $field_style = '', $tip_style = '')
253
- {
254
- $buf = '<span class="litespeed-cache-field-tip';
255
- if (!empty($class_suffix)) {
256
- $buf .= $class_suffix;
257
- }
258
- if (!empty($field_style)) {
259
- $buf .= '" style="' . $field_style;
260
- }
261
- $buf .= '"><span class="litespeed-cache-tip-content';
262
- if (!empty($class_suffix)) {
263
- $buf .= $class_suffix;
264
- }
265
- if (!empty($tip_style)) {
266
- $buf .= '" style="' . $tip_style;
267
- }
268
-
269
- $buf .= '">' . $msg . '</span></span>';
270
-
271
- return $buf;
272
- }
273
-
274
- /**
275
- * Builds the html for buttons that depend on rtl/ltr orientation.
276
- *
277
- * @since 1.0.14
278
- * @access private
279
- * @param string $class_suffix The class name used for the button
280
- * @param string $button_text The text used for the button
281
- * @param string $notice The notice message to be display after button
282
- * click
283
- * @param boolean $extra_br Optional if extra br is required to adjust the
284
- * layout.
285
- * @return string button text.
286
- */
287
- private static function build_button($class_suffix, $button_text = '',
288
- $notice = '', $extra_br = true)
289
- {
290
- $buf = '<span class="' . $class_suffix . '"';
291
-
292
- if (!is_rtl()) {
293
- $buf .= ' style="float:left;"';
294
- }
295
-
296
- $buf .= '>' . $button_text . '</span>';
297
-
298
- if (!empty($notice)) {
299
- $buf .= '<span class="copy-select-all-span" style="display:none; font-size:11px; font-style:italic;margin-left:10px; position:relative; top:3px; color: green;">'
300
- . $notice . '</span>';
301
- }
302
-
303
- $buf .= '<br>';
304
-
305
- if ($extra_br) {
306
- $buf .= '<br>';
307
- }
308
-
309
- return $buf;
310
- }
311
-
312
- /**
313
- * Builds the html for the expand/collapse all button.
314
- *
315
- * @since 1.0.14
316
- * @access private
317
- * @param boolean $br Whether to include an extra br tag at the end or not.
318
- * @return string The built button html.
319
- */
320
- private static function build_expand_collapse($extra_br = true)
321
- {
322
- $buf = self::build_button('litespeed-cache-jquery-button', '', '', $extra_br);
323
-
324
- $buf .= self::get_instance()->input_field_hidden('litespeed-cache-jquery-button-expand-val', __("Expand All", "litespeed-cache"))
325
- . self::get_instance()->input_field_hidden('litespeed-cache-jquery-button-collapse-val', __("Collapse All", "litespeed-cache"));
326
-
327
-
328
- return $buf;
329
- }
330
-
331
- /**
332
- * Adds a notice to display on the admin page. Multiple messages of the
333
- * same color may be added in a single call. If the list is empty, this
334
- * method will add the action to display notices.
335
- *
336
- * @since 1.0.7
337
- * @access public
338
- * @param string $color One of the available constants provided by this
339
- * class.
340
- * @param mixed $msg May be a string for a single message or an array for
341
- * multiple.
342
- */
343
- public function add_notice($color, $msg)
344
- {
345
- if (empty($this->notices)) {
346
- add_action(
347
- (is_network_admin() ? 'network_admin_notices' : 'admin_notices'),
348
- array($this, 'display_notices'));
349
- }
350
- if (!is_array($msg)) {
351
- $this->notices[] = self::build_notice($color, $msg);
352
-
353
- return;
354
- }
355
- foreach ($msg as $str) {
356
- $this->notices[] = self::build_notice($color, $str);
357
- }
358
- }
359
-
360
- /**
361
- * Callback function to display any notices from editing cache settings.
362
- *
363
- * @since 1.0.7
364
- * @access public
365
- */
366
- public function display_notices()
367
- {
368
- foreach ($this->notices as $msg) {
369
- echo $msg;
370
- }
371
- }
372
-
373
- /**
374
- * add_submenu_page callback to determine which submenu page to display
375
- * if the admin selected a LiteSpeed Cache dashboard page.
376
- *
377
- * @since 1.0.4
378
- */
379
- public function show_menu_select()
380
- {
381
- $page = $_REQUEST['page'];
382
- if (strncmp($page, 'lscache-', 8) != 0) {
383
- // either I messed up writing the slug, or someone entered this function elsewhere.
384
- die();
385
- }
386
- $selection = substr($page, 8);
387
- $selection_len = strlen($selection);
388
- add_filter('admin_footer_text', array($this, 'admin_footer_text'), 1);
389
-
390
- //install, faqs
391
- switch ($selection[0]) {
392
- case 'd':
393
- if (($selection_len == 4)
394
- && (strncmp($selection, 'dash', $selection_len) == 0)
395
- ) {
396
- $this->show_menu_manage();
397
- }
398
- break;
399
- case 'i':
400
- if (($selection_len == 4)
401
- && (strncmp($selection, 'info', $selection_len) == 0)
402
- ) {
403
- $this->show_menu_info();
404
- }
405
- break;
406
- case 's':
407
- if (($selection_len == 8)
408
- && (strncmp($selection, 'settings', $selection_len) == 0)
409
- ) {
410
- if (is_network_admin()) {
411
- $this->show_menu_network_settings();
412
- }
413
- else {
414
- settings_errors();
415
- $this->show_menu_settings();
416
- }
417
- }
418
- break;
419
- case 'e':
420
- if (($selection_len == 13)
421
- && (strncmp($selection, 'edit-htaccess', $selection_len) == 0)
422
- ) {
423
- $this->show_menu_edit_htaccess();
424
- }
425
- break;
426
- case 'r':
427
- if (($selection_len == 6)
428
- && (strncmp($selection, 'report', $selection_len) == 0)
429
- ) {
430
- $this->show_menu_report();
431
- }
432
- break;
433
- default:
434
- break;
435
- }
436
- }
437
-
438
- /**
439
- * Displays the cache management page.
440
- *
441
- * @since 1.0.0
442
- * @access public
443
- */
444
- public function show_menu_manage()
445
- {
446
- $config = LiteSpeed_Cache::config();
447
- $intro_sentences =
448
- __('From this screen, one can inform the server to purge the selected cached pages or empty the entire cache.', 'litespeed-cache');
449
- $purgeall_confirm_para = self::build_paragraph(
450
- __('This will purge everything for all blogs.', 'litespeed-cache'),
451
- __('Are you sure you want to purge all?', 'litespeed-cache')
452
- );
453
- $purgeby_desc_para = self::build_paragraph(
454
- __('Select dropdown below for "Purge by" options.', 'litespeed-cache'),
455
- __('Please enter one per line.', 'litespeed-cache')
456
- );
457
- $clearcache_confirm_para = self::build_paragraph(
458
- __('This will clear EVERYTHING inside the cache.', 'litespeed-cache'),
459
- __('This may cause heavy load on the server.', 'litespeed-cache'),
460
- __('If only the WordPress site should be purged, use purge all.', 'litespeed-cache')
461
- );
462
- $clearcache_desc_para = self::build_paragraph(
463
- wp_kses(__('Clears all cache entries related to this site, <i>including other web applications</i>.', 'litespeed-cache'),
464
- array('i' => array())),
465
- wp_kses(__('<b>This action should only be used if things are cached incorrectly.</b>', 'litespeed-cache'),
466
- array('b' => array()))
467
- );
468
-
469
- $purgeby_cat_desc =
470
- sprintf(__('Purge pages by category name - e.g. %2$s should be used for the URL %1$s.', "litespeed-cache"),
471
- 'http://example.com/category/category-name/', 'category-name');
472
-
473
- $purgeby_url_desc = self::build_paragraph(
474
- __('Purge pages by relative URL.', 'litespeed-cache'),
475
- __('Must be exact match.', 'litespeed-cache'),
476
- sprintf(__('e.g. Use %s for %s.', 'litespeed-cache'),
477
- '<b><u>/2016/02/24/hello-world/</u></b>',
478
- 'http://www.myexamplesite.com<b><u>/2016/02/24/hello-world/</u></b>'
479
- ));
480
-
481
- $purgeby_tag_desc =
482
- sprintf(__('Purge pages by tag name - e.g. %2$s should be used for the URL %1$s.', "litespeed-cache"),
483
- 'http://example.com/tag/tag-name/', 'tag-name');
484
-
485
- if (($error_msg = $this->check_license($config)) !== true) {
486
- echo '<div class="error"><p>' . $error_msg . '</p></div>' . "\n";
487
- }
488
-
489
- $purgeby_options = array(
490
- __('Category', 'litespeed-cache'),
491
- __('Post ID', 'litespeed-cache'),
492
- __('Tag', 'litespeed-cache'),
493
- __('URL', 'litespeed-cache'),
494
- );
495
-
496
- // Page intro
497
- $buf = '<div class="wrap"><h2>'
498
- . __('LiteSpeed Cache Management', 'litespeed-cache') . '</h2>'
499
- . '<div class="litespeed-cache-welcome-panel"><p>'
500
- . $intro_sentences . '</p>';
501
-
502
- // Begin form
503
- $buf .= '<form method="post">'
504
- . '<input type="hidden" name="lscwp_management" value="manage_lscwp" />'
505
- . wp_nonce_field('lscwp_manage', 'management_run');
506
-
507
- $purge_front = get_submit_button(
508
- __('Purge Front Page', 'litespeed-cache'), 'primary', 'purgefront', false);
509
-
510
- $purge_pages = get_submit_button(
511
- __('Purge Pages', 'litespeed-cache'), 'primary', 'purgepages', false);
512
-
513
- $atts = array();
514
- $atts['id'] = 'litespeedcache-purgeall';
515
-
516
- $purge_all = get_submit_button(
517
- __('Purge All', 'litespeed-cache'), 'primary', 'purgeall', false,
518
- $atts);
519
-
520
- $atts['id'] = 'litespeedcache-purgeerrors';
521
-
522
- $purge_errors = get_submit_button(
523
- __('Purge Error Pages', 'litespeed-cache'), 'primary',
524
- 'purgeerrors', false, $atts);
525
-
526
- $incl_403 = $this->input_field_checkbox('include_403', true, true,
527
- __('Include 403', 'litespeed-cache'));
528
-
529
- $incl_404 = $this->input_field_checkbox('include_404', true, false,
530
- __('Include 404', 'litespeed-cache'));
531
-
532
- $incl_500 = $this->input_field_checkbox('include_500', true, true,
533
- __('Include 500s', 'litespeed-cache'));
534
-
535
- // Form entries purge front, purge all
536
- $buf .= '<div class="litespeed-cache-div-table>">';
537
- $buf .= '<table class="form-table"><tbody>'
538
- . '<tr><th>'
539
- . __('Purge the Front Page.', 'litespeed-cache')
540
- . '</th><td>'
541
- . self::build_tip(
542
- __('This will Purge Front Page only', 'litespeed-cache'))
543
- . $purge_front
544
- . '</td></tr>'
545
- . '<tr><th>'
546
- . __('Purge Pages.', 'litespeed-cache')
547
- . '</th><td>'
548
- . self::build_tip(
549
- __('This will Purge Pages only', 'litespeed-cache'))
550
- . $purge_pages
551
- . '</td></tr>'
552
- . '<tr><th>'
553
- . __('Purge all WordPress pages.', 'litespeed-cache')
554
- . '</th><td>'
555
- . self::build_tip(
556
- __('Purge the cache entries created by this plugin.', 'litespeed-cache'))
557
- . $purge_all
558
- . '</td></tr>'
559
- . '<tr><th>'
560
- . __('Purge the error pages.', 'litespeed-cache')
561
- . '</th><td>'
562
- . self::build_tip(
563
- __('Purges the error page cache entries created by this plugin.', 'litespeed-cache'))
564
- . $incl_403 . '&nbsp;&nbsp;' . $incl_404 . '&nbsp;&nbsp;' . $incl_500 . '<br>'
565
- . $purge_errors . '&nbsp;'
566
- . '</td></tr>';
567
-
568
- if ((!is_multisite()) || (is_network_admin())) {
569
- $buf .=
570
- '<tr><th>'
571
- . __('Clear all cache entries.', 'litespeed-cache')
572
- . '</th><td>'
573
- . self::build_tip(__($clearcache_desc_para, 'litespeed-cache'))
574
- . '<input type="submit" class="litespeedcache-button-danger" name="clearcache"'
575
- . 'id="litespeedcache-clearcache" value="'
576
- . __('Empty Entire Cache', 'litespeed-cache')
577
- . '" />'
578
- . $this->input_field_hidden('litespeedcache-clearcache-confirm',
579
- $clearcache_confirm_para)
580
- . '</td></tr>';
581
- }
582
-
583
- if ((is_multisite()) && (is_network_admin())) {
584
- echo $buf
585
- . $this->input_field_hidden('litespeedcache-purgeall-confirm',
586
- $purgeall_confirm_para)
587
- . "<br><br></tbody></table></form></div></div>\n";
588
-
589
- return;
590
- }
591
- $buf .= '</tbody></table></div>';
592
-
593
- $buf .= $this->input_field_hidden('litespeedcache-purgeall-confirm',
594
- __('Are you sure you want to purge all?', 'litespeed-cache'));
595
-
596
-
597
- // Purge by description.
598
- $buf .= '<h3>' . __('Purge By...', 'litespeed-cache') . '</h3>';
599
- $buf .= '<hr/>' . '<p>' . $purgeby_desc_para . '</p>';
600
-
601
-
602
- if (($_POST) && (isset($_POST[LiteSpeed_Cache_Config::OPTION_NAME]))) {
603
- $selected = $_POST[LiteSpeed_Cache_Config::OPTION_NAME][self::PURGEBYOPT_SELECT];
604
- if ((intval($selected) < 0) || (intval($selected) > 3)) {
605
- $selected = 0;
606
- }
607
- }
608
- else {
609
- $selected = 0;
610
- }
611
-
612
- $buf .= $this->input_field_select(self::PURGEBYOPT_SELECT,
613
- $purgeby_options, $selected)
614
- . '&nbsp;&nbsp;<span class="litespeed-cache-purgeby-text" style="font-size: 11px;font-style: italic; "></span>'
615
- . $this->input_field_hidden('purgeby-category', $purgeby_cat_desc)
616
- . $this->input_field_hidden('purgeby-postid',
617
- __("Purge pages by post ID.", "litespeed-cache"))
618
- . $this->input_field_hidden('purgeby-tag', $purgeby_tag_desc)
619
- . $this->input_field_hidden('purgeby-url', $purgeby_url_desc)
620
- . '<br>'
621
- . $this->input_field_textarea(self::PURGEBYOPT_LIST, '', '5', '', 'code')
622
- . '<input type="submit" class="button button-primary" '
623
- . 'name="purgelist" value="' . __('Purge List', 'litespeed-cache')
624
- . '" />';
625
-
626
- // End form
627
- $buf .= "<br><br></form></div></div>";
628
-
629
- echo $buf;
630
- }
631
-
632
- /**
633
- * Outputs the LiteSpeed Cache settings page.
634
- *
635
- * @since 1.0.0
636
- * @access public
637
- */
638
- public function show_menu_settings()
639
- {
640
- $config = LiteSpeed_Cache::config();
641
-
642
- if (($error_msg = $this->check_license($config)) !== true) {
643
- echo '<div class="error"><p>' . $error_msg . '</p></div>' . "\n";
644
-
645
- }
646
-
647
- $options = $config->get_options();
648
-
649
- /**
650
- * This hook allows third party plugins to create litespeed cache
651
- * specific configurations.
652
- *
653
- * Each config should append an array containing the following:
654
- * 'title' (required) - The tab's title.
655
- * 'slug' (required) - The slug used for the tab. [a-z][A-Z], [0-9], -, _ permitted.
656
- * 'content' (required) - The tab's content.
657
- *
658
- * Upon saving, only the options with the option group in the input's
659
- * name will be retrieved.
660
- * For example, name="litespeed-cache-conf[my-opt]".
661
- *
662
- * @see TODO: add option save filter.
663
- * @since 1.0.9
664
- * @param array $tabs An array of third party configurations.
665
- * @param array $options The current configuration options.
666
- * @param string $option_group The option group to use for options.
667
- * @param boolean $disableall Whether to disable the settings or not.
668
- * @return mixed An array of third party configs else false on failure.
669
- */
670
- $tp_tabs = apply_filters('litespeed_cache_add_config_tab', array(),
671
- $options, LiteSpeed_Cache_Config::OPTION_NAME,
672
- $this->get_disable_all());
673
-
674
- echo '<div class="wrap"><h2>'
675
- . __('LiteSpeed Cache Settings', 'litespeed-cache')
676
- . '<span style="font-size:0.5em"> v'
677
- . LiteSpeed_Cache::PLUGIN_VERSION
678
- . '</span></h2><form method="post" action="options.php" id="ls_form_options">';
679
- if ($this->get_disable_all()) {
680
- $desc = self::build_paragraph(
681
- __('The network admin selected use primary site configs for all subsites.', 'litespeed-cache'),
682
- __('The following options are selected, but are not editable in this settings page.', 'litespeed-cache')
683
- );
684
- echo '<p>' . $desc . '</p>';
685
- }
686
-
687
- $lscwp_active_tab = 0;
688
- $tab_count = 5;
689
- if (!empty($tp_tabs)) {
690
- $tab_count += count($tp_tabs);
691
- }
692
-
693
- settings_fields(LiteSpeed_Cache_Config::OPTION_NAME);
694
-
695
- $compatibilities_tab = '';
696
- $compatibilities_settings = '';
697
- $compatibilities_buf = $this->show_settings_compatibilities();
698
- if (!empty($compatibilities_buf)) {
699
- $compatibilities_tab .= '<li><a href="#wp-compatibilities-settings">'
700
- . __('Plugin Compatibilities', 'litespeed-cache') . '</a></li>';
701
- $compatibilities_settings .= '<div id ="wp-compatibilities-settings">'
702
- . $compatibilities_buf .
703
- '</div>';
704
- ++$tab_count;
705
- }
706
-
707
- $advanced_tab = '';
708
- $advanced_settings = '';
709
- if (!is_multisite()) {
710
- $advanced_tab = '<li><a href="#advanced-settings">'
711
- . __('Advanced Settings', 'litespeed-cache') . '</a></li>';
712
- $advanced_settings = '<div id="advanced-settings">'
713
- . $this->show_settings_advanced($options)
714
- . '</div>';
715
- ++$tab_count;
716
- }
717
-
718
- if (isset($_REQUEST['tab'])) {
719
- $lscwp_active_tab = intval($_REQUEST['tab']);
720
- if (($lscwp_active_tab < 0) || ($lscwp_active_tab >= $tab_count)) {
721
- $lscwp_active_tab = 0;
722
- }
723
- }
724
-
725
- echo '<input type="hidden" name="active_tab" id="active_tab" value="'
726
- . $lscwp_active_tab . '" />
727
- <div id="lsc-tabs">
728
- <ul>
729
- <li><a href="#general-settings">' . __('General', 'litespeed-cache') . '</a></li>
730
- <li><a href="#specific-settings">' . __('Specific Pages', 'litespeed-cache') . '</a></li>
731
- <li><a href="#purge-settings">' . __('Purge Rules', 'litespeed-cache') . '</a></li>
732
- <li><a href="#exclude-settings">' . __('Do Not Cache Rules', 'litespeed-cache') . '</a></li>
733
- ' . $advanced_tab . '
734
- <li><a href="#debug-settings">' . __('Debug', 'litespeed-cache') . '</a></li>'
735
- . $compatibilities_tab;
736
-
737
- if ((!empty($tp_tabs)) && (is_array($tp_tabs))) {
738
- foreach ($tp_tabs as $key => $tab) {
739
- if ((!is_array($tab))
740
- || (!isset($tab['title']))
741
- || (!isset($tab['slug']))
742
- || (!isset($tab['content']))
743
- ) {
744
- if (defined('LSCWP_LOG')) {
745
- LiteSpeed_Cache::debug_log(
746
- __('WARNING: Third party tab input invalid.',
747
- 'litespeed-cache'));
748
- }
749
- unset($tp_tabs[$key]);
750
- continue;
751
- }
752
- elseif (preg_match('/[^-\w]/', $tab['slug'])) {
753
- if (defined('LSCWP_LOG')) {
754
- LiteSpeed_Cache::debug_log(
755
- __('WARNING: Third party config slug contains invalid characters.',
756
- 'litespeed-cache'));
757
- }
758
- unset($tp_tabs[$key]);
759
- continue;
760
- }
761
- echo '
762
- <li><a href="#' . $tab['slug'] . '-settings">'
763
- . $tab['title'] . '</a></li>';
764
- }
765
- }
766
- else {
767
- $tp_tabs = false;
768
- }
769
-
770
- echo '
771
- </ul>
772
- <div id="general-settings">'
773
- . $this->show_settings_general($options) .
774
- '</div>
775
- <div id="specific-settings">'
776
- . $this->show_settings_specific($options) .
777
- '</div>
778
- <div id="purge-settings">'
779
- . $this->show_settings_purge($config->get_purge_options()) .
780
- '</div>
781
- <div id="exclude-settings">'
782
- . $this->show_settings_excludes($options) .
783
- '</div>'
784
- . $advanced_settings .
785
- '<div id ="debug-settings">'
786
- . $this->show_settings_test($options) .
787
- '</div>'
788
- . $compatibilities_settings;
789
-
790
- if (!empty($tp_tabs)) {
791
- foreach ($tp_tabs as $tab) {
792
- echo '
793
- <div id ="' . $tab['slug'] . '-settings">'
794
- . $tab['content'] . '</div>';
795
- }
796
- }
797
-
798
- echo '</div>';
799
-
800
- if ($this->get_disable_all()) {
801
- submit_button(__('Save Changes', 'litespeed-cache'),
802
- 'primary', 'submit', true, array('disabled' => true));
803
- }
804
- else {
805
- submit_button();
806
- }
807
- echo "</form></div>\n";
808
- }
809
-
810
- /**
811
- * Display the network admin settings page.
812
- *
813
- * Since multisite setups only have one .htaccess file, these settings
814
- * are only available for the network admin in multisite setups.
815
- *
816
- * @since 1.0.4
817
- * @access private
818
- */
819
- private function show_menu_network_settings()
820
- {
821
- $network_desc =
822
- __('These configurations are only available network wide.', 'litespeed-cache')
823
- . '<br>'
824
- . self::build_paragraph(
825
- __('Separate Mobile Views should be enabled if any of the network enabled themes require a different view for mobile devices.', 'litespeed-cache'),
826
- __('Responsive themes can handle this part automatically.', 'litespeed-cache'));
827
- $enable_desc =
828
- __('Enabling LiteSpeed Cache for WordPress here enables the cache for the network.', 'litespeed-cache')
829
- . '<br>'
830
- . wp_kses(__('It is <b>STRONGLY</b> recommend that the compatibility with other plugins on a single/few sites is tested first.', 'litespeed-cache'),
831
- array('b' => array()))
832
- . __('This is to ensure compatibility prior to enabling the cache for all sites.', 'litespeed-cache');
833
-
834
-
835
- if (isset($_REQUEST['tab'])) {
836
- $lscwp_active_tab = intval($_REQUEST['tab']);
837
- if (($lscwp_active_tab < 0) || ($lscwp_active_tab >= 3)) {
838
- $lscwp_active_tab = 0;
839
- }
840
- }
841
-
842
- $buf = '<div class="wrap"><h2>' . __('LiteSpeed Cache Settings', 'litespeed-cache') . '</h2>';
843
-
844
- $config = LiteSpeed_Cache::config();
845
-
846
- $buf .= '<form method="post" action="admin.php?page=lscache-settings">'
847
- . '<input type="hidden" name="lscwp_settings_save" value="save_settings" />'
848
- . wp_nonce_field('lscwp_settings', 'save');
849
-
850
- $buf .= '<input type="hidden" name="active_tab" id="active_tab" value="'
851
- . $lscwp_active_tab . '" />';
852
-
853
- $buf .= '<div id="lsc-tabs">'
854
- . '<ul>'
855
- . '<li><a href="#general">' . __('General', 'litespeed-cache') . '</a></li>'
856
- . '<li><a href="#exclude">' . __('Do Not Cache Rules', 'litespeed-cache') . '</a></li>'
857
- . '<li><a href="#advanced">' . __('Advanced', 'litespeed-cache') . '</a></li>'
858
- . '</ul>';
859
-
860
- $buf .= '<div id="general">'
861
- . $this->input_group_start(__('General Network Configurations',
862
- 'litespeed-cache'), $network_desc);
863
- $id = LiteSpeed_Cache_Config::NETWORK_OPID_ENABLED;
864
-
865
- $site_options = $config->get_site_options();
866
-
867
- $network_enable = $this->input_field_checkbox('lscwp_' . $id, $id,
868
- $site_options[$id]);
869
- $buf .= $this->display_config_row(
870
- __('Network Enable Cache', 'litespeed-cache'), $network_enable, '',
871
- '', $enable_desc);
872
-
873
- $id = LiteSpeed_Cache_Config::NETWORK_OPID_USE_PRIMARY;
874
- $use_primary = $this->input_field_checkbox('lscwp_' . $id, $id,
875
- $site_options[$id]);
876
-
877
- $use_primary_desc = self::build_paragraph(
878
- __("Check this option to use the primary site's configurations for all subsites.",
879
- 'litespeed-cache'),
880
- __('This will disable the settings page on all subsites.', 'litespeed-cache')
881
- );
882
-
883
- $buf .= $this->display_config_row(
884
- __('Use Primary Site Configurations', 'litespeed-cache'),
885
- $use_primary,
886
- '',
887
- '',
888
- $use_primary_desc
889
- );
890
-
891
- $buf .= $this->build_setting_purge_on_upgrade($site_options);
892
- $buf .= $this->build_setting_cache_favicon($site_options);
893
- $buf .= $this->build_setting_cache_resources($site_options);
894
- $buf .= $this->build_setting_mobile_view($site_options);
895
- $buf .= $this->input_group_end() . '</div>';
896
-
897
- $buf .= '<div id="exclude">'
898
- . $this->input_group_start(__('Network Do Not Cache Rules', 'litespeed-cache'));
899
- $ua_title = '';
900
- $ua_desc = '';
901
- $ua_buf = $this->build_setting_exclude_useragent($site_options, $ua_title, $ua_desc);
902
- $buf .= $this->display_config_row(
903
- __('Do Not Cache User Agents', 'litespeed-cache'),
904
- $ua_buf,
905
- $ua_desc
906
- );
907
-
908
- $cookie_title = '';
909
- $cookie_desc = '';
910
- $cookie_buf = $this->build_setting_exclude_cookies($site_options, $cookie_title, $cookie_desc);
911
- $buf .= $this->display_config_row(
912
- __('Do Not Cache Cookies', 'litespeed-cache'),
913
- $cookie_buf,
914
- $cookie_desc
915
- );
916
-
917
- $buf .= $this->input_group_end() . '</div>';
918
-
919
- $buf .= '<div id="advanced">'
920
- . $this->show_settings_advanced($site_options) . '</div></div>';
921
-
922
- $buf .= '<br><br>'
923
- . '<input type="submit" class="button button-primary" name="submit" value="'
924
- . __('Save', 'litespeed-cache') . '" /></td></tr>';
925
- $buf .= '</form><br><br></div>';
926
- echo $buf;
927
- }
928
-
929
- /**
930
- * Displays the edit_htaccess admin page.
931
- *
932
- * This function will try to load the .htaccess file contents.
933
- * If it fails, it will echo the error message.
934
- *
935
- * @since 1.0.4
936
- * @access private
937
- */
938
- private function show_menu_edit_htaccess()
939
- {
940
- $warning_para = self::build_paragraph(
941
- __('Any changes made to the .htaccess file may break the site.', 'litespeed-cache'),
942
- __('Please consult the host/server admin before making any changes.', 'litespeed-cache')
943
- );
944
- $buf = '<div class="wrap"><h2>' . __('LiteSpeed Cache Edit .htaccess', 'litespeed-cache') . '</h2>';
945
- $buf .= '<div class="litespeed-cache-welcome-panel">';
946
- $contents = '';
947
- $rules = LiteSpeed_Cache_Admin_Rules::get_instance();
948
- if (defined('DISALLOW_FILE_EDIT') && (constant('DISALLOW_FILE_EDIT'))) {
949
- $buf .= '<h3>'
950
- . __('File editing is disabled in configuration.', 'litespeed-cache')
951
- . '</h3></div>';
952
- echo $buf;
953
-
954
- return;
955
- }
956
- elseif (LiteSpeed_Cache_Admin_Rules::file_get($contents) === false) {
957
- $buf .= '<h3>' . $contents . '</h3></div>';
958
- echo $buf;
959
-
960
- return;
961
- }
962
- $file_writable = $rules->is_file_able(
963
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
964
-
965
- $buf .= '<p><span class="attention">'
966
- . __('WARNING: This page is meant for advanced users.', 'litespeed-cache')
967
- . '</span><br>' . $warning_para . '</p>';
968
-
969
- $buf .= $this->show_info_common_rewrite();
970
-
971
- $buf .= '<form method="post" action="admin.php?page=lscache-edit-htaccess">';
972
- $buf .= '<input type="hidden" name="'
973
- . LiteSpeed_Cache_Admin_Rules::EDITOR_INPUT_NAME . '" value="'
974
- . LiteSpeed_Cache_Admin_Rules::EDITOR_INPUT_VAL . '" />';
975
- $buf .= wp_nonce_field(LiteSpeed_Cache_Admin_Rules::EDITOR_NONCE_NAME,
976
- LiteSpeed_Cache_Admin_Rules::EDITOR_NONCE_VAL);
977
-
978
- $buf .= '<h3>' . sprintf(__('Current %s contents:', 'litespeed-cache'), '.htaccess') . '</h3>';
979
-
980
- $buf .= '<p><span class="attention">'
981
- . sprintf(__('DO NOT EDIT ANYTHING WITHIN %s', 'litespeed-cache'),
982
- '###LSCACHE START/END XXXXXX###')
983
- . '</span><br>'
984
- . __('These are added by the LS Cache plugin and may cause problems if they are changed.', 'litespeed-cache')
985
- . '</p>';
986
-
987
- $buf .= '<textarea id="wpwrap" name="'
988
- . LiteSpeed_Cache_Admin_Rules::EDITOR_TEXTAREA_NAME
989
- . '" wrap="off" rows="20" class="code" ';
990
- if (!$file_writable) {
991
- $buf .= 'readonly';
992
- }
993
- $buf .= '>' . esc_textarea($contents) . '</textarea>';
994
- unset($contents);
995
-
996
- $buf .= '<input type="submit" class="button button-primary" name="submit" value="'
997
- . __('Save', 'litespeed-cache') . '" /></form><br><br>';
998
-
999
- $buf .= '</div></div>';
1000
- echo $buf;
1001
- }
1002
-
1003
- /**
1004
- * Outputs the html for the info page.
1005
- *
1006
- * This page includes three tabs:
1007
- * - configurations
1008
- * - third party plugin compatibilities
1009
- * - common rewrite rules.
1010
- *
1011
- * @since 1.0.4
1012
- * @access private
1013
- */
1014
- private function show_menu_info()
1015
- {
1016
- $trial_para = self::build_paragraph(
1017
- __('Make sure that the server license has the LSCache module enabled.', 'litespeed-cache'),
1018
- sprintf(wp_kses(
1019
- __('A <a href="%1$s" rel="%2$s" target="%3$s">2-CPU trial license with LSCache module</a> is available for free for %4$d days.',
1020
- 'litespeed-cache'),
1021
- array(
1022
- 'a' => array(
1023
- 'href' => array(), 'rel' => array(),
1024
- 'target' => array(),
1025
- ),
1026
- )),
1027
- 'https://www.litespeedtech.com/products/litespeed-web-server/download/get-a-trial-license',
1028
- 'noopener noreferrer', '_blank', 15)
1029
- );
1030
-
1031
- $caching_para = self::build_paragraph(
1032
- __('The server must be configured to have caching enabled.', 'litespeed-cache'),
1033
- sprintf(wp_kses(
1034
- __('If you are the server admin, <a href="%s" rel="%s" target="%s">click here.</a>',
1035
- 'litespeed-cache'),
1036
- array(
1037
- 'a' => array(
1038
- 'href' => array(), 'rel' => array(),
1039
- 'target' => array(),
1040
- ),
1041
- )),
1042
- 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:common_installation#web_server_configuration',
1043
- 'noopener noreferrer', '_blank'),
1044
- __('Otherwise request that the server admin configure the cache root for the server.', 'litespeed-cache')
1045
- );
1046
-
1047
- $ols_para =
1048
- self::build_list(
1049
- array(
1050
- __('This integration utilizes OLS\'s cache module.', 'litespeed-cache'),
1051
- self::build_paragraph(
1052
- sprintf(wp_kses(
1053
- __('If it is a fresh OLS installation, the easiest way to integrate is to use <a href="%s" rel="%s" target="%s">ols1clk.</a>',
1054
- 'litespeed-cache'),
1055
- array(
1056
- 'a' => array(
1057
- 'href' => array(), 'rel' => array(),
1058
- 'target' => array(),
1059
- ),
1060
- )),
1061
- 'http://open.litespeedtech.com/mediawiki/index.php/Help:1-Click_Install',
1062
- 'noopener noreferrer', '_blank'),
1063
- sprintf(__('If using an existing WordPress installation, use the %s parameter.', 'litespeed-cache'),
1064
- '--wordpresspath')
1065
- ),
1066
- sprintf(wp_kses(
1067
- __('Else if OLS and WordPress are already installed, please follow the instructions <a href="%s" rel="%s" target="%s">here.</a>',
1068
- 'litespeed-cache'),
1069
- array(
1070
- 'a' => array(
1071
- 'href' => array(), 'rel' => array(),
1072
- 'target' => array(),
1073
- ),
1074
- )),
1075
- 'http://open.litespeedtech.com/mediawiki/index.php/Help:How_To_Set_Up_LSCache_For_WordPress',
1076
- 'noopener noreferrer', '_blank'
1077
- )
1078
- )
1079
- );
1080
-
1081
- $test_para = self::build_paragraph(
1082
- sprintf(__('Subsequent requests should have the %s response header until the page is updated, expired, or purged.',
1083
- 'litespeed-cache'), '<code>X-LiteSpeed-Cache-Control:hit</code><br>'),
1084
- sprintf(wp_kses(
1085
- __('Please visit <a href="%s" rel="%s" target="%s">this page</a> for more information.',
1086
- 'litespeed-cache'),
1087
- array(
1088
- 'a' => array(
1089
- 'href' => array(), 'rel' => array(),
1090
- 'target' => array(),
1091
- ),
1092
- )),
1093
- 'https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cache:lscwp:installation#testing',
1094
- 'noopener noreferrer', '_blank')
1095
- );
1096
-
1097
- // Configurations help.
1098
- $buf = '<div class="wrap"><h2>'
1099
- . __('LiteSpeed Cache Information', 'litespeed-cache') . '</h2>';
1100
-
1101
- $buf .= '<div id="lsc-tabs">'
1102
- . '<ul>'
1103
- . '<li><a href="#faq">' . __('FAQs', 'litespeed-cache') . '</a></li>'
1104
- . '<li><a href="#config">' . __('Configurations', 'litespeed-cache') . '</a></li>'
1105
- . '<li><a href="#compat">' . __('Plugin Compatibilities', 'litespeed-cache') . '</a></li>'
1106
- . '<li><a href="#commonrw">' . __('Common Rewrite Rules', 'litespeed-cache') . '</a></li>'
1107
- . '<li><a href="#adminip">' . __('Admin IP Commands', 'litespeed-cache') . '</a></li>'
1108
- . '</ul>';
1109
-
1110
- // FAQs.
1111
- $buf .= '<div id="faq">';
1112
- $buf .= $this->show_info_faqs();
1113
- $buf .= '</div>'; // id=faq
1114
-
1115
- $buf .= '<div id="config"><h3>'
1116
- . __('LiteSpeed Cache Configurations', 'litespeed-cache') . '</h3>'
1117
- . '<h4>' . __('Instructions for LiteSpeed Web Server Enterprise', 'litespeed-cache') . '</h4>';
1118
-
1119
- $buf .=
1120
- self::build_list(
1121
- array(
1122
- $trial_para,
1123
- $caching_para,
1124
- __('In the .htaccess file for the WordPress installation, add the following:',
1125
- 'litespeed-cache')
1126
- . '<textarea id="wpwrap" rows="3" readonly>&lt;IfModule LiteSpeed&gt;
1127
- CacheLookup public on
1128
- &lt;/IfModule&gt;</textarea>'
1129
- )
1130
- );
1131
-
1132
- $buf .= '<h4>' . __('Instructions for OpenLiteSpeed', 'litespeed-cache') . '</h4>';
1133
- $buf .= '<p>' . $ols_para . '</p>';
1134
-
1135
- $buf .= '<h3>' . __('How to test the plugin', 'litespeed-cache') . '</h3>';
1136
- $buf .= '<p>' . __('The LiteSpeed Cache Plugin utilizes LiteSpeed specific response headers.', 'litespeed-cache')
1137
- . '<br>'
1138
- . sprintf(__('Visiting a page for the first time should result in a %s or %s response header for the page.',
1139
- 'litespeed-cache'), '<br><code>X-LiteSpeed-Cache-Control:miss</code><br>',
1140
- '<br><code>X-LiteSpeed-Cache-Control:no-cache</code><br>')
1141
- . '<br>'
1142
- . $test_para
1143
- . '</p>';
1144
-
1145
- $buf .= '</div>'; // id=config
1146
-
1147
- // Compatibility with other plugins.
1148
- $buf .= '<div id="compat">';
1149
- $buf .= $this->show_info_compatibility();
1150
- $buf .= '</div>'; // id=compat
1151
-
1152
- $buf .= '<div id="commonrw">';
1153
- $buf .= $this->show_info_common_rewrite();
1154
- $buf .= '</div>'; // id=commonrw
1155
-
1156
- $buf .= '<div id="adminip">';
1157
- $buf .= $this->show_info_admin_ip();
1158
- $buf .= '</div>'; // id=adminip
1159
-
1160
- $buf .= '</div></div>'; // id=lsc_tabs and class=wrap
1161
- echo $buf;
1162
- }
1163
-
1164
- /**
1165
- * Outputs the html for the Environment Report page.
1166
- *
1167
- * @since 1.0.12
1168
- * @access private
1169
- */
1170
- private function show_menu_report()
1171
- {
1172
- $report = LiteSpeed_Cache::generate_environment_report();
1173
- $desc =
1174
- self::build_list(
1175
- array(
1176
- __('The environment report contains detailed information about the WordPress configuration.', 'litespeed-cache'),
1177
- __('If you run into any issues, please include the contents of this text area in your support message.', 'litespeed-cache'),
1178
- wp_kses(
1179
- __('To easily grab the content, click the <b>Select All and Copy to Clipboard</b> button, to select and copy to clipboard.', 'litespeed-cache'),
1180
- array('b' => array())),
1181
- sprintf(__('Alternatively, this information is also saved in %s.', 'litespeed-cache'),
1182
- 'wp-content/plugins/litespeed-cache/environment_report.php')
1183
- )
1184
- )
1185
- . '<p><b>'
1186
- . __('The text area below contains the following content:', 'litespeed-cache')
1187
- . '</b><br><span style="font-size:11px; font-style:italic">'
1188
- . __('Server Variables, Plugin Options, WordPress information (version, locale, active plugins, etc.), and .htaccess file content.', 'litespeed-cache')
1189
- . '</span></p>';
1190
-
1191
- $buf = '<div class="wrap"><h2>LiteSpeed Cache Report</h2>';
1192
- $buf .= '<div class="litespeed-cache-welcome-panel">' . $desc;
1193
- $buf .= $this->build_button('litespeed-cache-select-all-button',
1194
- __("Select All and Copy to Clipboard", "litespeed-cache"),
1195
- __("Environment Report copied to Clipboard!", "litespeed-cache"));
1196
- $buf .= $this->input_field_textarea('litespeed-report', $report, '20',
1197
- '80', '', true);
1198
-
1199
- $buf .= '</div></div>';
1200
-
1201
- echo $buf;
1202
- }
1203
-
1204
- /**
1205
- * Builds the html for the general settings tab.
1206
- *
1207
- * @since 1.0.0
1208
- * @access private
1209
- * @param array $options The current configuration options.
1210
- * @return string The html for the general tab.
1211
- */
1212
- private function show_settings_general($options)
1213
- {
1214
- $feed_ttl_desc = self::build_paragraph(
1215
- __('Specify how long, in seconds, feeds are cached.', 'litespeed-cache'),
1216
- __('If this is set to a number less than 30, feeds will not be cached.', 'litespeed-cache')
1217
- );
1218
- $notfound_ttl_desc = self::build_paragraph(
1219
- __('Specify how long, in seconds, 404 pages are cached.', 'litespeed-cache'),
1220
- __('If this is set to a number less than 30, 404 pages will not be cached.', 'litespeed-cache')
1221
- );
1222
- $forbidden_ttl_desc = self::build_paragraph(
1223
- __('Specify how long, in seconds, 403 pages are cached.', 'litespeed-cache'),
1224
- __('If this is set to a number less than 30, 403 pages will not be cached.', 'litespeed-cache')
1225
- );
1226
- $ise_ttl_desc = self::build_paragraph(
1227
- __('Specify how long, in seconds, 500 pages are cached.', 'litespeed-cache'),
1228
- __('If this is set to a number less than 30, 500 pages will not be cached.', 'litespeed-cache')
1229
- );
1230
- $cache_commenters_desc = self::build_paragraph(
1231
- __('When checked, commenters will not be able to see their comments awaiting moderation.', 'litespeed-cache'),
1232
- __('Disabling this option will display those types of comments, but the cache will not perform as well.', 'litespeed-cache')
1233
- );
1234
- $buf = $this->input_group_start(__('General', 'litespeed-cache'));
1235
-
1236
- $id = LiteSpeed_Cache_Config::OPID_ENABLED_RADIO;
1237
-
1238
- $enable_levels = array(
1239
- LiteSpeed_Cache_Config::OPID_ENABLED_ENABLE => __('Enable', 'litespeed-cache'),
1240
- LiteSpeed_Cache_Config::OPID_ENABLED_DISABLE => __('Disable', 'litespeed-cache'),
1241
- );
1242
-
1243
- //IF multisite: Add 'Use Network Admin' option,
1244
- //ELSE: Change 'Enable LiteSpeed Cache' selection to 'Enabled' if the 'Use Network Admin' option was previously selected.
1245
- // Selection will not actually be changed unless settings are saved.
1246
- if (is_multisite()) {
1247
- $enable_levels[LiteSpeed_Cache_Config::OPID_ENABLED_NOTSET] = __('Use Network Admin Setting', 'litespeed-cache');
1248
- }
1249
- elseif (intval($options[$id]) === 2) {
1250
- $options[$id] = 1;
1251
- }
1252
-
1253
- $below_text = sprintf(wp_kses(
1254
- __('Please visit the <a href="%sadmin.php?page=lscache-info">information</a> page on how to test the cache.',
1255
- 'litespeed-cache'),
1256
- array('a' => array('href' => array()))), get_admin_url());
1257
-
1258
-
1259
- $input_enable = $this->input_field_radio($id, $enable_levels, intval($options[$id]), $below_text);
1260
-
1261
- $enable_desc = '<strong>' . __('NOTICE', 'litespeed-cache') . ': </strong>'
1262
- . __('When disabling the cache, all cached entries for this blog will be purged.', 'litespeed-cache');
1263
-
1264
- if (is_multisite()) {
1265
- $enable_desc .= '<br>'
1266
- . __('The network admin setting can be overridden here.', 'litespeed-cache');
1267
- }
1268
-
1269
- $buf .= $this->display_config_row(
1270
- __('Enable LiteSpeed Cache', 'litespeed-cache'),
1271
- $input_enable, '', $enable_desc);
1272
-
1273
- $id = LiteSpeed_Cache_Config::OPID_PUBLIC_TTL;
1274
- $input_public_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1275
- __('seconds', 'litespeed-cache'));
1276
-
1277
- $buf .= $this->display_config_row(
1278
- __('Default Public Cache TTL', 'litespeed-cache'),
1279
- $input_public_ttl,
1280
- __('Specify how long, in seconds, public pages are cached. Minimum is 30 seconds.', 'litespeed-cache')
1281
- );
1282
-
1283
- $id = LiteSpeed_Cache_Config::OPID_FRONT_PAGE_TTL;
1284
- $input_front_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1285
- __('seconds', 'litespeed-cache'));
1286
- $buf .= $this->display_config_row(
1287
- __('Default Front Page TTL', 'litespeed-cache'),
1288
- $input_front_ttl,
1289
- __('Specify how long, in seconds, the front page is cached. Minimum is 30 seconds.', 'litespeed-cache')
1290
- );
1291
-
1292
- $id = LiteSpeed_Cache_Config::OPID_FEED_TTL;
1293
- $input_feed_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1294
- __('seconds', 'litespeed-cache'));
1295
- $buf .= $this->display_config_row(
1296
- __('Default Feed TTL', 'litespeed-cache'),
1297
- $input_feed_ttl,
1298
- $feed_ttl_desc
1299
- );
1300
-
1301
- $id = LiteSpeed_Cache_Config::OPID_404_TTL;
1302
- $input_404_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1303
- __('seconds', 'litespeed-cache'));
1304
- $buf .= $this->display_config_row(
1305
- __('Default 404 Page TTL', 'litespeed-cache'),
1306
- $input_404_ttl,
1307
- $notfound_ttl_desc
1308
- );
1309
-
1310
- $id = LiteSpeed_Cache_Config::OPID_403_TTL;
1311
- $input_403_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1312
- __('seconds', 'litespeed-cache'));
1313
- $buf .= $this->display_config_row(
1314
- __('Default 403 Page TTL', 'litespeed-cache'),
1315
- $input_403_ttl,
1316
- $forbidden_ttl_desc
1317
- );
1318
-
1319
- $id = LiteSpeed_Cache_Config::OPID_500_TTL;
1320
- $input_500_ttl = $this->input_field_text($id, $options[$id], 10, 'regular-text',
1321
- __('seconds', 'litespeed-cache'));
1322
- $buf .= $this->display_config_row(
1323
- __('Default 500 Page TTL', 'litespeed-cache'),
1324
- $input_500_ttl,
1325
- $ise_ttl_desc
1326
- );
1327
-
1328
- $id = LiteSpeed_Cache_Config::OPID_CACHE_COMMENTERS;
1329
- $cache_commenters = $this->input_field_checkbox('lscwp_' . $id, $id, $options[$id]);
1330
- $buf .= $this->display_config_row(
1331
- __('Enable Cache for Commenters', 'litespeed-cache'),
1332
- $cache_commenters,
1333
- $cache_commenters_desc
1334
- );
1335
-
1336
- if (!is_multisite()) {
1337
- $buf .= $this->build_setting_purge_on_upgrade($options);
1338
- $buf .= $this->build_setting_mobile_view($options);
1339
- }
1340
-
1341
- $buf .= $this->input_group_end();
1342
-
1343
- return $buf;
1344
- }
1345
-
1346
- /**
1347
- * Builds the html for the specific pages settings tab.
1348
- *
1349
- * @since 1.0.10
1350
- * @access private
1351
- * @param array $options The current configuration options.
1352
- * @return string The html for the specific pages tab.
1353
- */
1354
- private function show_settings_specific($options)
1355
- {
1356
- $buf = $this->input_group_start(__('Specific Pages', 'litespeed-cache'));
1357
-
1358
- $id = LiteSpeed_Cache_Config::OPID_CACHE_LOGIN;
1359
- $cache_login = $this->input_field_checkbox('lscwp_' . $id, $id, $options[$id]);
1360
- $buf .= $this->display_config_row(
1361
- __('Enable Cache for Login Page', 'litespeed-cache'),
1362
- $cache_login,
1363
- __('Unchecking this option may negatively affect performance.', 'litespeed-cache')
1364
- );
1365
-
1366
- if (!is_multisite()) {
1367
- $buf .= $this->build_setting_cache_favicon($options);
1368
- $buf .= $this->build_setting_cache_resources($options);
1369
- }
1370
-
1371
- $buf .= $this->input_group_end();
1372
-
1373
- return $buf;
1374
- }
1375
-
1376
- /**
1377
- * Builds the html for the purge settings tab.
1378
- *
1379
- * @since 1.0.0
1380
- * @access private
1381
- * @param array $purge_options The current configuration purge options.
1382
- * @return string The html for the purge tab.
1383
- */
1384
- private function show_settings_purge($purge_options)
1385
- {
1386
- $select_all_desc =
1387
- self::build_list(
1388
- array(
1389
- __('Select "All" if there are dynamic widgets linked to posts on pages other than the front or home pages.', 'litespeed-cache'),
1390
- __('Other checkboxes will be ignored.', 'litespeed-cache'),
1391
- __('Select only the archive types that are currently used, the others can be left unchecked.', 'litespeed-cache')
1392
- ),
1393
- false,
1394
- 'top: -12px;position: relative;font-style:italic; font-size:11px;'
1395
- );
1396
-
1397
- $buf = $this->input_group_start(__('Auto Purge Rules For Publish/Update', 'litespeed-cache'),
1398
- __('Select which pages will be automatically purged when posts are published/updated.', 'litespeed-cache')
1399
- . '<br>'
1400
- . '<b style="font-style:italic;">' . __('Note:', 'litespeed-cache') . '</b>' . $select_all_desc
1401
- );
1402
-
1403
- $tr = '<tr><th scope="row" colspan="2" class="th-full">';
1404
- $endtr = "</th></tr>\n";
1405
- $buf .= $tr;
1406
-
1407
- $spacer = '&nbsp;&nbsp;&nbsp;';
1408
-
1409
- $pval = LiteSpeed_Cache_Config::PURGE_ALL_PAGES;
1410
- $buf .= $this->input_field_checkbox(
1411
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1412
- __('All pages', 'litespeed-cache'));
1413
-
1414
- $buf .= $spacer;
1415
-
1416
- $pval = LiteSpeed_Cache_Config::PURGE_FRONT_PAGE;
1417
- $buf .= $this->input_field_checkbox(
1418
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1419
- __('Front page', 'litespeed-cache'));
1420
-
1421
- $buf .= $spacer;
1422
-
1423
- $pval = LiteSpeed_Cache_Config::PURGE_HOME_PAGE;
1424
- $buf .= $this->input_field_checkbox(
1425
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1426
- __('Home page', 'litespeed-cache'));
1427
-
1428
- $buf .= $spacer;
1429
- $pval = LiteSpeed_Cache_Config::PURGE_PAGES;
1430
- $buf .= $this->input_field_checkbox(
1431
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1432
- __('Pages', 'litespeed-cache'));
1433
-
1434
- $buf .= $endtr . $tr;
1435
-
1436
- $pval = LiteSpeed_Cache_Config::PURGE_PAGES_WITH_RECENT_POSTS;
1437
- $buf .= $this->input_field_checkbox(
1438
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1439
- __('All pages with Recent Posts Widget', 'litespeed-cache'));
1440
-
1441
- $buf .= $endtr . $tr;
1442
-
1443
- $pval = LiteSpeed_Cache_Config::PURGE_AUTHOR;
1444
- $buf .= $this->input_field_checkbox(
1445
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1446
- __('Author archive', 'litespeed-cache'));
1447
-
1448
- $buf .= $spacer;
1449
-
1450
- $pval = LiteSpeed_Cache_Config::PURGE_POST_TYPE;
1451
- $buf .= $this->input_field_checkbox(
1452
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1453
- __('Post type archive', 'litespeed-cache'));
1454
-
1455
- $buf .= $endtr . $tr;
1456
-
1457
- $pval = LiteSpeed_Cache_Config::PURGE_YEAR;
1458
- $buf .= $this->input_field_checkbox(
1459
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1460
- __('Yearly archive', 'litespeed-cache'));
1461
-
1462
- $buf .= $spacer;
1463
-
1464
- $pval = LiteSpeed_Cache_Config::PURGE_MONTH;
1465
- $buf .= $this->input_field_checkbox(
1466
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1467
- __('Monthly archive', 'litespeed-cache'));
1468
-
1469
- $buf .= $spacer;
1470
-
1471
- $pval = LiteSpeed_Cache_Config::PURGE_DATE;
1472
- $buf .= $this->input_field_checkbox(
1473
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1474
- __('Daily archive', 'litespeed-cache'));
1475
-
1476
- $buf .= $endtr . $tr;
1477
-
1478
- $pval = LiteSpeed_Cache_Config::PURGE_TERM;
1479
- $buf .= $this->input_field_checkbox(
1480
- 'purge_' . $pval, $pval, in_array($pval, $purge_options),
1481
- __('Term archive (include category, tag, and tax)', 'litespeed-cache'));
1482
-
1483
- $buf .= $endtr;
1484
- $buf .= $this->input_group_end();
1485
-
1486
- return $buf;
1487
- }
1488
-
1489
- /**
1490
- * Builds the html for the do not cache settings tab.
1491
- *
1492
- * @since 1.0.1
1493
- * @access private
1494
- * @param array $options The current configuration options.
1495
- * @return string The html for the do not cache tab.
1496
- */
1497
- private function show_settings_excludes($options)
1498
- {
1499
-
1500
- $uri_description =
1501
- self::build_list(
1502
- array(
1503
- __('Enter a list of urls that should not be cached.', 'litespeed-cache'),
1504
- __('The urls will be compared to the REQUEST_URI server variable.', 'litespeed-cache'),
1505
- __('There should only be one url per line.', 'litespeed-cache')
1506
- ),
1507
- true
1508
- );
1509
-
1510
- $uri_do_not_cache_text = '<b>' . __('NOTE:', 'litespeed-cache') . ' </b>'
1511
- . self::build_list(
1512
- array(
1513
- __('URLs must start with a \'/\' to be correctly matched.', 'litespeed-cache'),
1514
- __('To do an exact match, add \'$\' to the end of the URL.', 'litespeed-cache'),
1515
- __('Any surrounding whitespaces will be trimmed.', 'litespeed-cache'),
1516
- sprintf(__('e.g. to exclude %1$s, insert %2$s', 'litespeed-cache'),
1517
- 'http://www.example.com/excludethis.php',
1518
- '/excludethis.php'),
1519
- sprintf(__('Similarly, to exclude %1$s(accessed with the /blog), insert %2$s', 'litespeed-cache'),
1520
- 'http://www.example.com/blog/excludethis.php',
1521
- '/blog/excludethis.php')
1522
- ),
1523
- true
1524
- );
1525
-
1526
- $cat_description =
1527
- self::build_list(
1528
- array(
1529
- '<b>'
1530
- . __('All categories are cached by default.', 'litespeed-cache')
1531
- . '</b>',
1532
- __('To prevent a category from being cached, enter it in the text area below, one per line.', 'litespeed-cache')
1533
- ),
1534
- true
1535
- );
1536
- $cat_do_not_cache_text =
1537
- '<b>' . __('NOTE:', 'litespeed-cache') . '</b>'
1538
- . self::build_list(
1539
- array(
1540
- __('If the Category ID is not found, the name will be removed on save.', 'litespeed-cache'),
1541
- sprintf(__('e.g. to exclude %1$s, insert %2$s', 'litespeed-cache'),
1542
- '<code style="font-size: 11px;">http://www.example.com/category/category/category-id/</code>',
1543
- 'category-id')
1544
- . '</code>'
1545
- ),
1546
- true
1547
- );
1548
-
1549
- $tag_description =
1550
- self::build_list(
1551
- array(
1552
- '<b>'
1553
- . __('All tags are cached by default.', 'litespeed-cache')
1554
- . '</b>',
1555
- __('To prevent tags from being cached, enter the tag in the text area below, one per line.', 'litespeed-cache')
1556
- ),
1557
- true
1558
- );
1559
- $tag_do_not_cache_text =
1560
- '<b>' . __('NOTE:', 'litespeed-cache')
1561
- . '</b>'
1562
- . self::build_list(
1563
- array(
1564
- __('If the Tag ID is not found, the name will be removed on save.', 'litespeed-cache'),
1565
- sprintf(__('e.g. to exclude %1$s, insert %2$s', 'litespeed-cache'),
1566
- 'http://www.example.com/tag/category/tag-id/', 'tag-id')
1567
- ),
1568
- true
1569
- );
1570
-
1571
-
1572
- $tr = '<tr><td>';
1573
- $endtr = "</td></tr>\n";
1574
-
1575
- $excludes_id = LiteSpeed_Cache_Config::OPID_EXCLUDES_URI;
1576
- $excludes_buf = $options[$excludes_id];
1577
- $buf = $this->input_group_start(__('URI List', 'litespeed-cache'),
1578
- $uri_description);
1579
- $buf .= $tr;
1580
- $buf .= self::build_tip($uri_do_not_cache_text,
1581
- '-do-not',
1582
- 'margin-right:5px; top:-5px;',
1583
- 'margin-right:-420px; width:400px;'
1584
- );
1585
- $buf .= '<span style="font-size: 11px; font-style:italic;display:inline-block;">'
1586
- . __('SYNTAX: URLs must start with a \'/\' to be correctly matched.', 'litespeed-cache')
1587
- . "<br>"
1588
- . __('To do an exact match, add \'$\' to the end of the URL. One URL per line.', 'litespeed-cache')
1589
- . '</span><br>';
1590
-
1591
- $buf .= $this->input_field_textarea($excludes_id, $excludes_buf,
1592
- '10', '80', '');
1593
- $buf .= $endtr;
1594
-
1595
- $buf .= $this->input_group_end();
1596
-
1597
- $excludes_id = LiteSpeed_Cache_Config::OPID_EXCLUDES_CAT;
1598
- $excludes_buf = '';
1599
- $cat_ids = $options[$excludes_id];
1600
- if ($cat_ids != '') {
1601
- $id_list = explode(',', $cat_ids);
1602
- $excludes_buf = implode("\n", array_map('get_cat_name', $id_list));
1603
- }
1604
- $buf .= $this->input_group_start(__('Category List', 'litespeed-cache'),
1605
- $cat_description);
1606
- $buf .= $tr;
1607
- $buf .= self::build_tip($cat_do_not_cache_text,
1608
- '-do-not',
1609
- 'margin-right:5px; top:1px;',
1610
- 'margin-right:-420px; width:400px;'
1611
- );
1612
- $buf .= '<span style="font-size: 11px; font-style:italic;">'
1613
- . __('SYNTAX: One category id per line.', 'litespeed-cache')
1614
- . '</span><br>';
1615
-
1616
- $buf .= $this->input_field_textarea($excludes_id, $excludes_buf,
1617
- '5', '80', '');
1618
- $buf .= $endtr;
1619
-
1620
- $buf .= $this->input_group_end();
1621
-
1622
- $excludes_id = LiteSpeed_Cache_Config::OPID_EXCLUDES_TAG;
1623
- $excludes_buf = '';
1624
- $tag_ids = $options[$excludes_id];
1625
- if ($tag_ids != '') {
1626
- $id_list = explode(',', $tag_ids);
1627
- $tags_list = array_map('get_tag', $id_list);
1628
- $tag_names = array();
1629
- foreach ($tags_list as $tag) {
1630
- $tag_names[] = $tag->name;
1631
- }
1632
- if (!empty($tag_names)) {
1633
- $excludes_buf = implode("\n", $tag_names);
1634
- }
1635
- }
1636
- $buf .= $this->input_group_start(__('Tag List', 'litespeed-cache'),
1637
- $tag_description);
1638
- $buf .= $tr;
1639
- $buf .= self::build_tip($tag_do_not_cache_text,
1640
- '-do-not',
1641
- 'margin-right:5px; top:1px;',
1642
- 'margin-right:-420px; width:400px;'
1643
- );
1644
- $buf .= '<span style="font-size: 11px; font-style:italic;">'
1645
- . __('SYNTAX: One tag id per line.', 'litespeed-cache')
1646
- . '</span><br>';
1647
-
1648
- $buf .= $this->input_field_textarea($excludes_id, $excludes_buf,
1649
- '5', '80', '');
1650
- $buf .= $endtr;
1651
-
1652
- $buf .= $this->input_group_end();
1653
-
1654
- if (is_multisite()) {
1655
- return $buf;
1656
- }
1657
- $cookie_title = '';
1658
- $cookie_desc = '';
1659
- $cookie_buf = $this->build_setting_exclude_cookies($options, $cookie_title, $cookie_desc, false);
1660
-
1661
- $syntax = self::build_paragraph(
1662
- __('SYNTAX: Cookies should be listed one per line.', 'litespeed-cache'),
1663
- sprintf(__('Spaces should have a backslash in front of them, %s', 'litespeed-cache'), "'\ '.")
1664
- );
1665
-
1666
- $cookie_title = __('Cookie List', 'litespeed-cache');
1667
- $cookie_desc = __('To prevent cookies from being cached, enter it in the text area below.', 'litespeed-cache');
1668
- $htaccess_notice = '<br><strong>' . __('NOTICE:', 'litespeed-cache') . ' </strong>'
1669
- . __('This setting will edit the .htaccess file.', 'litespeed-cache');
1670
-
1671
- $buf .= $this->input_group_start($cookie_title, $cookie_desc);
1672
- $buf .= $tr;
1673
- $buf .= self::build_tip($htaccess_notice,
1674
- '-do-not',
1675
- 'margin-right:5px; top:1px;',
1676
- 'margin-right:-280px; width:260px;'
1677
- );
1678
- $buf .= '<span style="font-size: 11px; font-style:italic;">' . $syntax
1679
- . '</span><br>' . $cookie_buf . $endtr;
1680
- $buf .= $this->input_group_end();
1681
-
1682
- $ua_title = '';
1683
- $ua_desc = '';
1684
- $ua_buf = $this->build_setting_exclude_useragent($options, $ua_title, $ua_desc, false);
1685
-
1686
- $syntax = self::build_paragraph(
1687
- sprintf(__('SYNTAX: Separate each user agent with a bar, <style="font-style:normal">%s</style>.', 'litespeed-cache'), "'|'"),
1688
- sprintf(__('Spaces should have a backslash in front of them, %s.', 'litespeed-cache'), "'\'")
1689
- );
1690
-
1691
- $ua_title = __('User Agent List', 'litespeed-cache');
1692
- $ua_desc = __('To prevent user agents from being cached, enter it in the text field below.', 'litespeed-cache');
1693
-
1694
- $buf .= $tr;
1695
- $buf .= $this->input_group_start($ua_title, $ua_desc);
1696
- $buf .= self::build_tip($htaccess_notice,
1697
- '-do-not',
1698
- 'margin-right:5px; top:1px;',
1699
- 'margin-right:-280px; width:260px; z-index:9999 !important;'
1700
- );
1701
- $buf .= '<span style="font-size: 11px; font-style:italic;">' . $syntax
1702
- . '</span><br>' . $ua_buf . $endtr;
1703
- $buf .= $this->input_group_end();
1704
-
1705
- return $buf;
1706
- }
1707
-
1708
- /**
1709
- * Builds the html for the advanced settings tab.
1710
- *
1711
- * @since 1.0.1
1712
- * @access private
1713
- * @param array $options The current configuration options.
1714
- * @return string The html for the advanced settings tab.
1715
- */
1716
- private function show_settings_advanced($options)
1717
- {
1718
- $cookie_title = '';
1719
- $cookie_desc = '';
1720
- $buf = '<div class="litespeed-cache-advanced-settings">';
1721
- $advanced_desc = self::build_paragraph(
1722
- '<strong>' . __('NOTICE', 'litespeed-cache') . ':</strong>',
1723
- __('These settings are meant for ADVANCED USERS ONLY.', 'litespeed-cache'),
1724
- __('Please take great care when changing any of these settings.', 'litespeed-cache'),
1725
- __("If there are any questions, do not hesitate to submit a support thread.", 'litespeed-cache')
1726
- );
1727
-
1728
- $adv_cache_desc = self::build_paragraph(
1729
- __('The advanced-cache.php file is used by many caching plugins to signal that a cache is active.', 'litespeed-cache'),
1730
- __('When this option is checked and this file is detected as belonging to another plugin, LiteSpeed Cache will not cache.', 'litespeed-cache')
1731
- );
1732
-
1733
- $tag_prefix_desc = self::build_paragraph(
1734
- __('Add an alpha-numeric prefix to cache and purge tags.', 'litespeed-cache'),
1735
- __('This can be used to prevent issues when using multiple LiteSpeed caching extensions on the same server.', 'litespeed-cache')
1736
- );
1737
-
1738
- $buf .= $this->input_group_start(__('Advanced Settings', 'litespeed-cache'),
1739
- '', '', $advanced_desc, true);
1740
- $buf .= $this->input_group_end();
1741
- $buf .= '<hr>';
1742
- $buf .= self::build_expand_collapse(false);
1743
-
1744
- $id = LiteSpeed_Cache_Config::OPID_CHECK_ADVANCEDCACHE;
1745
- $check_adv = $this->input_field_checkbox('lscwp_' . $id, $id, $options[$id]);
1746
- $ac_title = __('Check advanced-cache.php', 'litespeed-cache');
1747
- $ac_desc = $check_adv . "&nbsp;" . __('Check this option to include advanced-cache.php', 'litespeed-cache')
1748
- . '<ul><li>'
1749
- . $adv_cache_desc
1750
- . '</li><li>'
1751
- . __('<i>Uncheck this option only if the other plugin is used for non-caching purposes, such as minifying css/js files.</i>', 'litespeed-cache')
1752
- . '</li></ul>';
1753
-
1754
-
1755
- $cookie_buf = $this->build_setting_login_cookie($options,
1756
- $cookie_title, $cookie_desc);
1757
-
1758
- $cookie_desc = $cookie_desc . '<br>' . $cookie_buf;
1759
-
1760
- $id = LiteSpeed_Cache_Config::OPID_TAG_PREFIX;
1761
- $tag_title = __('Cache Tag Prefix', 'litespeed-cache');
1762
- $tag_inputs = $this->input_field_text($id, $options[$id]);
1763
- $tag_prefix_desc = $tag_prefix_desc . '<br>' . $tag_inputs;
1764
-
1765
- $buf .= $this->input_collapsible_start();
1766
-
1767
- $buf .= $this->input_field_collapsible($ac_title, $ac_desc);
1768
- $buf .= $this->input_field_collapsible($cookie_title, $cookie_desc);
1769
- $buf .= $this->input_field_collapsible($tag_title, $tag_prefix_desc);
1770
- $buf .= $this->input_collapsible_end();
1771
-
1772
- $buf .= '</div>';
1773
-
1774
- return $buf;
1775
-
1776
- }
1777
-
1778
- /**
1779
- * Builds the html for the debug settings tab.
1780
- *
1781
- * @since 1.0.0
1782
- * @access private
1783
- * @param array $options The current configuration options.
1784
- * @return string The html for the debug settings tab.
1785
- */
1786
- private function show_settings_test($options)
1787
- {
1788
- $buf = $this->input_group_start(__('Developer Testing', 'litespeed-cache'));
1789
-
1790
- $admin_ip_desc =
1791
- __('Allows listed IPs (space or comma separated) to perform certain actions from their browsers.', 'litespeed-cache');
1792
-
1793
- $below_text = '<br><i style="font-size:11px;margin-left: 22px;">'
1794
- . sprintf(wp_kses(__('More information about the available commands can be found <a href="%s">here</a>.', 'litespeed-cache'),
1795
- array('a' => array('href' => array()))),
1796
- get_admin_url() . 'admin.php?page=lscache-info#adminip')
1797
- . '</i>';
1798
-
1799
- $debug_desc = self::build_paragraph(
1800
- __('Outputs to WordPress debug log.', 'litespeed-cache'),
1801
- __('This should be set to off once everything is working to prevent filling the disk.', 'litespeed-cache'),
1802
- __('The Admin IP option will only output log messages on requests from admin IPs.', 'litespeed-cache'),
1803
- __('The logs will be outputted to the debug.log in the wp-content directory.', 'litespeed-cache')
1804
- );
1805
-
1806
- $id = LiteSpeed_Cache_Config::OPID_ADMIN_IPS;
1807
- $input_admin_ips = $this->input_field_text($id, $options[$id], '',
1808
- 'regular-text', $below_text);
1809
- $buf .= $this->display_config_row(
1810
- __('Admin IPs', 'litespeed-cache'),
1811
- $input_admin_ips,
1812
- $admin_ip_desc
1813
- );
1814
-
1815
- $id = LiteSpeed_Cache_Config::OPID_DEBUG;
1816
- $debug_levels = array(
1817
- LiteSpeed_Cache_Config::OPID_ENABLED_DISABLE => __('Off', 'litespeed-cache'),
1818
- LiteSpeed_Cache_Config::OPID_ENABLED_ENABLE => __('On', 'litespeed-cache'),
1819
- LiteSpeed_Cache_Config::OPID_ENABLED_NOTSET => __('Admin IP only', 'litespeed-cache'),
1820
- );
1821
- $input_debug = $this->input_field_select($id, $debug_levels, $options[$id]);
1822
- $buf .= $this->display_config_row(
1823
- __('Debug Log', 'litespeed-cache'),
1824
- $input_debug,
1825
- $debug_desc
1826
- );
1827
-
1828
- /* Maybe add this feature later
1829
- $id = LiteSpeed_Cache_Config::OPID_TEST_IPS;
1830
- $input_test_ips = $this->input_field_text($id, $options[$id], '', 'regular-text');
1831
- $buf .= $this->display_config_row('Test IPs', $input_test_ips,
1832
- 'Enable LiteSpeed Cache only for specified IPs. (Space or comma separated.)
1833
- * Allows testing on a live site. If empty, cache will be served to everyone.');
1834
- *
1835
- */
1836
-
1837
- $buf .= $this->input_group_end();
1838
-
1839
- return $buf;
1840
- }
1841
-
1842
- /**
1843
- * Checks if wp_postviews is installed. If so, show this tab.
1844
- *
1845
- * @since 1.0.4
1846
- * @access private
1847
- * @return string The html for the compatibility tab.
1848
- */
1849
- private function show_settings_compatibilities()
1850
- {
1851
-
1852
- $buf = '';
1853
-
1854
- if (function_exists('the_views')) {
1855
- $buf .= $this->build_compatibility_wp_postviews();
1856
- }
1857
-
1858
- return $buf;
1859
- }
1860
-
1861
- /**
1862
- * Builds the html for the mobile views configurations.
1863
- *
1864
- * @since 1.0.4
1865
- * @access private
1866
- * @param array $options The currently configured options.
1867
- * @return string The html for mobile views configurations.
1868
- */
1869
- private function build_setting_mobile_view($options)
1870
- {
1871
- $checkbox_desc = self::build_paragraph(
1872
- __('When checked, mobile views will be cached separately.', 'litespeed-cache'),
1873
- __('A site built with responsive design does not need to check this.', 'litespeed-cache')
1874
- );
1875
- $list_para = self::build_paragraph(
1876
- sprintf(__('SYNTAX: Each entry should be separated with a bar, %s', 'litespeed-cache'), "'|'."),
1877
- sprintf(__('Any spaces should be escaped with a backslash before the space, %s', 'litespeed-cache'), "'\\ '.")
1878
- );
1879
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
1880
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
1881
- $wp_default_mobile = 'Mobile|Android|Silk/|Kindle|BlackBerry|Opera\ Mini|Opera\ Mobi';
1882
-
1883
- $id = LiteSpeed_Cache_Config::OPID_MOBILEVIEW_ENABLED;
1884
- $list_id = LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST;
1885
- $default_id = 'lscwp_' . $id . '_default';
1886
- $warning_id = 'lscwp_' . $id . '_warning';
1887
- $cache_enable_id = is_network_admin()
1888
- ? LiteSpeed_Cache_Config::NETWORK_OPID_ENABLED
1889
- : LiteSpeed_Cache_Config::OPID_ENABLED;
1890
- $enabled = $options[$id];
1891
-
1892
- clearstatcache();
1893
- $buf = $this->input_field_hidden($warning_id,
1894
- self::build_paragraph(
1895
- __('WARNING: Unchecking this option will clear the Mobile View List.', 'litespeed-cache'),
1896
- __('Press OK to confirm this action.', 'litespeed-cache')
1897
- ));
1898
- $mv_enabled = $this->input_field_checkbox('lscwp_' . $id, $id, $enabled, '',
1899
- 'lscwpCheckboxConfirm(this, \'' . $list_id . '\')', !$file_writable);
1900
-
1901
- $buf .= $this->display_config_row(
1902
- __('Enable Separate Mobile View', 'litespeed-cache'), $mv_enabled,
1903
- $checkbox_desc);
1904
-
1905
- $mv_list_desc = $list_para . '<br>'
1906
- . sprintf(__('The default list WordPress uses is %s', 'litespeed-cache'), $wp_default_mobile);
1907
-
1908
- $notice_settings = '<strong>' . __('NOTICE:', 'litespeed-cache') . ' </strong>'
1909
- . __('This setting will edit the .htaccess file.', 'litespeed-cache');
1910
-
1911
- $mv_str = '';
1912
- if (($options[$cache_enable_id]) && ($enabled)) {
1913
- $ret = LiteSpeed_Cache_Admin_Rules::get_instance()->get_common_rule(
1914
- 'MOBILE VIEW', 'HTTP_USER_AGENT', $mv_str);
1915
- }
1916
- elseif ($enabled) {
1917
- $ret = true;
1918
- $mv_str = $options[LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST];
1919
- }
1920
- elseif ($options[LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST] == false) {
1921
- $ret = true;
1922
- $mv_str = '';
1923
- }
1924
- else {
1925
- $ret = false;
1926
- $mv_str = sprintf(__('Expected false, got %s', 'litespeed-cache'),
1927
- $mv_str);
1928
- }
1929
- if ($ret !== true) {
1930
- $mv_list = '<p class="attention">'
1931
- . sprintf(__('Error getting current rules: %s', 'litespeed-cache'),
1932
- $mv_str) . '</p>';
1933
- }
1934
- elseif ((($enabled) && ($mv_str === $options[LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST]))
1935
- || ((!$enabled) && ($mv_str === ''))
1936
- ) {
1937
- // can also use class 'mejs-container' for 100% width.
1938
- $mv_list = $this->input_field_text($list_id, $mv_str, '', 'widget ui-draggable-dragging code', '',
1939
- ($options[$id] ? false : true));
1940
-
1941
- $default_fill = (($mv_str == '') ? $wp_default_mobile : $mv_str);
1942
- $buf .= $this->input_field_hidden($default_id, $default_fill);
1943
- }
1944
- else {
1945
- $list_error = self::build_paragraph(
1946
- __('Htaccess did not match configuration option.', 'litespeed-cache'),
1947
- __('Please re-enter the mobile view setting.', 'litespeed-cache'),
1948
- sprintf(__('List in WordPress database: %s', 'litespeed-cache'),
1949
- $options[LiteSpeed_Cache_Config::ID_MOBILEVIEW_LIST])
1950
- );
1951
- $mv_list = $this->input_field_text($list_id, '', '',
1952
- 'widget ui-draggable-dragging code', '', ($options[$id] ? false : true))
1953
- . '<p class="attention">' . $list_error . '</p>';
1954
-
1955
- $default_fill = (($mv_str == '') ? $wp_default_mobile : $mv_str);
1956
- $buf .= $this->input_field_hidden($default_id, $default_fill);
1957
- }
1958
- $buf .= $this->display_config_row(__('List of Mobile View User Agents', 'litespeed-cache'),
1959
- $mv_list, '', $notice_settings, $mv_list_desc);
1960
-
1961
- //$buf .= '<span style="font-size: 11px; font-style:italic;"">'.$mv_list_desc.'</span>';
1962
- return $buf;
1963
- }
1964
-
1965
- /**
1966
- * Builds the html for the cookie excludes configuration.
1967
- *
1968
- * @since 1.0.4
1969
- * @access private
1970
- * @param array $options The currently configured options.
1971
- * @param string $cookie_title Returns the cookie title string.
1972
- * @param string $cookie_desc Returns the cookie description string.
1973
- * @return string Returns the cookie text area on success, error message on
1974
- * failure.
1975
- */
1976
- private function build_setting_exclude_cookies($options, &$cookie_title,
1977
- &$cookie_desc, $do_not = false)
1978
- {
1979
- if ($do_not) {
1980
- $desc_para = self::build_paragraph(
1981
- __('SYNTAX: Cookies should be listed one per line.', 'litespeed-cache'),
1982
- sprintf(__('Spaces should have a backslash in front of them, %s', 'litespeed-cache'), "'\ '.")
1983
- );
1984
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
1985
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
1986
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_COOKIES;
1987
- $cookie_title = __('Cookie List', 'litespeed-cache');
1988
- $cookie_desc = __('To prevent cookies from being cached, enter it in the text area below.', 'litespeed-cache')
1989
- . '<br>' . $desc_para
1990
- . '<br><strong>' . __('NOTICE:', 'litespeed-cache') . ' </strong>'
1991
- . __('This setting will edit the .htaccess file.', 'litespeed-cache');
1992
-
1993
- $excludes_buf = str_replace('|', "\n", $options[$id]);
1994
- }
1995
- else {
1996
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
1997
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
1998
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_COOKIES;
1999
- $excludes_buf = str_replace('|', "\n", $options[$id]);
2000
- }
2001
-
2002
- return $this->input_field_textarea($id, $excludes_buf, '5', '80', '',
2003
- !$file_writable);
2004
- }
2005
-
2006
- /**
2007
- * Builds the html for the user agent excludes configuration.
2008
- *
2009
- * @since 1.0.4
2010
- * @access private
2011
- * @param array $options The currently configured options.
2012
- * @param string $ua_title Returns the user agent title string.
2013
- * @param string $ua_desc Returns the user agent description string.
2014
- * @return string Returns the user agent text field on success,
2015
- * error message on failure.
2016
- */
2017
- private function build_setting_exclude_useragent($options, &$ua_title,
2018
- &$ua_desc, $user_agent_text = false)
2019
- {
2020
- if ($user_agent_text) {
2021
- $desc_para = self::build_paragraph(
2022
- sprintf(__('SYNTAX: Separate each user agent with a bar, %s.', 'litespeed-cache'), "'|'"),
2023
- sprintf(__('Spaces should have a backslash in front of them, %s.', 'litespeed-cache'), "")
2024
- );
2025
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
2026
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
2027
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_USERAGENTS;
2028
- $ua_title = __('User Agent List', 'litespeed-cache');
2029
- $ua_desc = __('To prevent user agents from being cached, enter it in the text field below.', 'litespeed-cache')
2030
- . '<br>' . $desc_para
2031
- . '<br><strong>' . __('NOTICE:', 'litespeed-cache') . ' </strong>'
2032
- . __('This setting will edit the .htaccess file.', 'litespeed-cache');
2033
- $ua_list = $this->input_field_text($id, $options[$id], '',
2034
- 'widget ui-draggable-dragging', '', !$file_writable);
2035
- }
2036
- else {
2037
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
2038
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
2039
- $id = LiteSpeed_Cache_Config::ID_NOCACHE_USERAGENTS;
2040
- $ua_list = $this->input_field_text($id, $options[$id], '',
2041
- 'widget ui-draggable-dragging', '', !$file_writable);
2042
- }
2043
-
2044
- return $ua_list;
2045
- }
2046
-
2047
- /**
2048
- * Builds the html for the user agent excludes configuration.
2049
- *
2050
- * @since 1.0.7
2051
- * @access private
2052
- * @param array $options The currently configured options.
2053
- * @param string $cookie_title Returns the cookie title string.
2054
- * @param string $cookie_desc Returns the cookie description string.
2055
- * @return string Returns the cookie text field on success,
2056
- * error message on failure.
2057
- */
2058
- private function build_setting_login_cookie($options, &$cookie_title,
2059
- &$cookie_desc)
2060
- {
2061
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
2062
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
2063
- $id = LiteSpeed_Cache_Config::OPID_LOGIN_COOKIE;
2064
- $cookie = '';
2065
- $match = '';
2066
- $sub = '';
2067
-
2068
- $cookie_title = __('Login Cookie', 'litespeed-cache');
2069
- $cookie_desc =
2070
- self::build_paragraph(
2071
- __('SYNTAX: alphanumeric and "_".', 'litespeed-cache'),
2072
- __('No spaces and case sensitive.', 'litespeed-cache'),
2073
- __('MUST BE UNIQUE FROM OTHER WEB APPLICATIONS.', 'litespeed-cache')
2074
- ) . '<br>'
2075
- . self::build_paragraph(
2076
- sprintf(__('The default login cookie is %s.', 'litespeed-cache'),
2077
- '_lscache_vary'),
2078
- __('The server will determine if the user is logged in based on the existance of this cookie.', 'litespeed-cache'),
2079
- __('This setting is useful for those that have multiple web applications for the same domain.', 'litespeed-cache'),
2080
- __('If every web application uses the same cookie, the server may confuse whether a user is logged in or not.', 'litespeed-cache'),
2081
- __('The cookie set here will be used for this WordPress installation.', 'litespeed-cache')
2082
- )
2083
- . '<br><br>'
2084
- . __('Example use case:', 'litespeed-cache')
2085
- . '<br>'
2086
- . sprintf(__('There is a WordPress install for %s.', 'litespeed-cache'),
2087
- '<u>www.example.com</u>')
2088
- . '<br>'
2089
- . sprintf(__('Then there is another WordPress install (NOT MULTISITE) at %s', 'litespeed-cache'),
2090
- '<u>www.example.com/blog/</u>')
2091
- . '<br>'
2092
- . __('The cache needs to distinguish who is logged into which WordPress site in order to cache correctly.', 'litespeed-cache');
2093
-
2094
-
2095
- if (LiteSpeed_Cache_Admin_Rules::get_instance()->get_rewrite_rule('LOGIN COOKIE',
2096
- $match, $sub, $cookie) === false
2097
- ) {
2098
- return '<p class="attention">'
2099
- . sprintf(__('Error getting current rules: %s', 'litespeed-cache'), $match) . '</p>';
2100
- }
2101
- if (!empty($cookie)) {
2102
- $cookie = trim($cookie, '"');
2103
- if (strncasecmp($cookie, 'Cache-Vary:', 11)) {
2104
- return '<p class="attention">'
2105
- . sprintf(__('Error: invalid login cookie. Please check the %s file', 'litespeed-cache'), '.htaccess')
2106
- . '</p>';
2107
- }
2108
- $cookie = substr($cookie, 11);
2109
- $cookie_arr = explode(',', $cookie);
2110
- }
2111
- if (($options[LiteSpeed_Cache_Config::OPID_ENABLED])
2112
- && (isset($options[$id]))
2113
- && (isset($cookie_arr))
2114
- && (!in_array($options[$id], $cookie_arr))
2115
- ) {
2116
- echo $this->build_notice(self::NOTICE_YELLOW,
2117
- __('WARNING: The .htaccess login cookie and Database login cookie do not match.', 'litespeed-cache'));
2118
- }
2119
-
2120
- return $this->input_field_text($id, $options[$id], '', '', '',
2121
- !$file_writable);
2122
- }
2123
-
2124
- /**
2125
- * Builds the html for the purge on upgrade configurations.
2126
- *
2127
- * @since 1.0.10
2128
- * @access private
2129
- * @param array $options The currently configured options.
2130
- * @return string The html for purging on upgrade configurations.
2131
- */
2132
- private function build_setting_purge_on_upgrade($options)
2133
- {
2134
- $id = LiteSpeed_Cache_Config::OPID_PURGE_ON_UPGRADE;
2135
- $purge_upgrade = $this->input_field_checkbox('lscwp_' . $id, $id, $options[$id]);
2136
-
2137
- return $this->display_config_row(__('Purge All on upgrade', 'litespeed-cache'), $purge_upgrade,
2138
- __('When checked, the cache will automatically purge when any plugins, themes, or WordPress core is upgraded.', 'litespeed-cache'));
2139
- }
2140
-
2141
- /**
2142
- * Builds the html for the cache favicon configurations.
2143
- *
2144
- * @since 1.0.8
2145
- * @access private
2146
- * @param array $options The currently configured options.
2147
- * @return string The html for caching favicon configurations.
2148
- */
2149
- private function build_setting_cache_favicon($options)
2150
- {
2151
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
2152
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
2153
- $title = __('Cache favicon.ico', 'litespeed-cache');
2154
- $desc = self::build_paragraph(
2155
- __('favicon.ico is requested on most pages.', 'litespeed-cache'),
2156
- __('Caching this recource may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache')
2157
- );
2158
- $id = LiteSpeed_Cache_Config::OPID_CACHE_FAVICON;
2159
- $cache_favicon = $this->input_field_checkbox('lscwp_' . $id, $id,
2160
- $options[$id], '', '', !$file_writable);
2161
-
2162
- return $this->display_config_row($title, $cache_favicon, $desc);
2163
- }
2164
-
2165
- /**
2166
- * Builds the html for the cache PHP resources configurations.
2167
- *
2168
- * @since 1.0.8
2169
- * @access private
2170
- * @param array $options The currently configured options.
2171
- * @return string The html for caching resource configurations.
2172
- */
2173
- private function build_setting_cache_resources($options)
2174
- {
2175
- $file_writable = LiteSpeed_Cache_Admin_Rules::is_file_able(
2176
- LiteSpeed_Cache_Admin_Rules::WRITABLE);
2177
- $title = __('Enable Cache for PHP Resources', 'litespeed-cache');
2178
- $desc = self::build_paragraph(
2179
- __('Some themes and plugins add resources via a PHP request.', 'litespeed-cache'),
2180
- __('Caching these pages may improve server performance by avoiding unnecessary PHP calls.', 'litespeed-cache'));
2181
- $id = LiteSpeed_Cache_Config::OPID_CACHE_RES;
2182
- $cache_res = $this->input_field_checkbox('lscwp_' . $id, $id,
2183
- $options[$id], '', '', !$file_writable);
2184
-
2185
- return $this->display_config_row($title, $cache_res, $desc);
2186
- }
2187
-
2188
- /**
2189
- * Builds the html for the wp_postviews help page.
2190
- *
2191
- * @since 1.0.1
2192
- * @access private
2193
- * @return string The html for the wp_postviews help page.
2194
- */
2195
- private function build_compatibility_wp_postviews()
2196
- {
2197
- $buf = '';
2198
- $example_src = htmlspecialchars('<?php if(function_exists(\'the_views\' )) { the_views(); } ?>');
2199
- $example_div = htmlspecialchars('<div id="postviews_lscwp" > </div>');
2200
- $example_ajax_path = '/wp-content/plugins/wp-postviews/postviews-cache.js';
2201
- $example_ajax = 'jQuery.ajax({
2202
- type:"GET",
2203
- url:viewsCacheL10n.admin_ajax_url,
2204
- data:"postviews_id="+viewsCacheL10n.post_id+"&action=postviews",
2205
- cache:!1,
2206
- success:function(data) {
2207
- if(data) {
2208
- jQuery(\'#postviews_lscwp\').html(data+\' views\');
2209
- }
2210
- }
2211
- });';
2212
- $wp_postviews_desc = __('To make LiteSpeed Cache compatible with WP-PostViews:', 'litespeed-cache')
2213
- . '<br>'
2214
- . self::build_list(
2215
- array(
2216
- __('Replace the following calls in the active theme\'s template files with a div or span with a unique ID.', 'litespeed-cache')
2217
- . '<br>'
2218
- . sprintf(wp_kses(__('e.g. Replace <br> <pre>%1$s</pre> with<br> <pre>%2$s</pre>', 'litespeed-cache'),
2219
- array('br' => array(), 'pre' => array())),
2220
- $example_src,
2221
- $example_div),
2222
- __('Update the ajax request to output the results to that div.', 'litespeed-cache')
2223
- . '<br><br>'
2224
- . __('Example:', 'litespeed-cache')
2225
- . '<br>'
2226
- . '<pre>' . $example_ajax . '</pre><br>'
2227
- . __('The ajax code can be found at', 'litespeed-cache') . '<br>'
2228
- . '<pre>' . $example_ajax_path . '</pre>',
2229
- __('After purging the cache, the view count should be updating.', 'litespeed-cache')
2230
- ),
2231
- true
2232
- );
2233
- $buf .= $this->input_group_start(
2234
- __('Compatibility with WP-PostViews', 'litespeed-cache'), $wp_postviews_desc);
2235
- $buf .= $this->input_group_end();
2236
-
2237
- return $buf;
2238
- }
2239
-
2240
- /**
2241
- * Builds the html for the third party compatibilities tab.
2242
- *
2243
- * @since 1.0.4
2244
- * @access private
2245
- * @return string The html for the compatibilities tab.
2246
- */
2247
- private function show_info_compatibility()
2248
- {
2249
- $known_compat = array(
2250
- 'bbPress',
2251
- 'WooCommerce',
2252
- 'Contact Form 7',
2253
- 'Google XML Sitemaps',
2254
- 'Yoast SEO',
2255
- 'Wordfence Security',
2256
- 'NextGen Gallery',
2257
- );
2258
-
2259
- $known_uncompat = array();
2260
-
2261
- $compat_desc = self::build_paragraph(
2262
- __('Please add a comment listing the plugins that you are using and how they are functioning on the support thread.', 'litespeed-cache'),
2263
- __('With your help, we can provide the best WordPress caching solution.', 'litespeed-cache')
2264
- );
2265
-
2266
-
2267
- $buf = '<h3>' . __('LiteSpeed Cache Plugin Compatibility', 'litespeed-cache') . '</h3>'
2268
- . '<h4>'
2269
- . $compat_desc
2270
- . '<br /><a href="https://wordpress.org/support/topic/known-supported-plugins?replies=1" rel="noopener noreferrer" target="_blank">'
2271
- . __('Link Here', 'litespeed-cache') . '</a>'
2272
- . '</h4>'
2273
- . '<h4>'
2274
- . __('This is a list of plugins that are confirmed to be compatible with LiteSpeed Cache Plugin:', 'litespeed-cache')
2275
- . '</h4>'
2276
- . '<ul>';
2277
- foreach ($known_compat as $plugin_name) {
2278
- $buf .= '<li>' . $plugin_name . '</li>';
2279
- }
2280
- $buf .= '</ul><br><br>'
2281
- . '<h4>' . __('This is a list of known UNSUPPORTED plugins:', 'litespeed-cache') . '</h4>'
2282
- . '<ul>';
2283
- foreach ($known_uncompat as $plugin_name) {
2284
- $buf .= '<li>' . $plugin_name . '</li>';
2285
- }
2286
-
2287
- $buf .= '</ul><br><br>';
2288
-
2289
- return $buf;
2290
- }
2291
-
2292
- /**
2293
- * Builds the html for the admin ip tab.
2294
- *
2295
- * @since 1.0.7
2296