diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b4ba2a..ed19566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## 1.0.14 - 2019-04-30 + +### Fixed +- Add urls to exclude + ## 1.0.13 - 2019-02-07 ### Fixed diff --git a/README.md b/README.md index b4339d1..e04211a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ To work in DEV-mode: use the force option in the settings. ## Configuring HTML Cache -If the plugin is enabled it works out of the box and no special cache tags are needed. If DevMode in Craft CMS is enabled, you will have to force enable the plugin by enabling the 'Force On' plugin setting. +If the plugin is enabled it works out of the box and no special cache tags are needed. If DevMode in Craft CMS is enabled, you will have to force enable the plugin by enabling the 'Force On' plugin setting. You can also exclude url path(s) from being cached. ## Using HTML Cache diff --git a/composer.json b/composer.json index 76ac743..b551d6b 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "bolden/htmlcache", "description": "Cache pages to HTML and boost website performance on Craft CMS 3.", "type": "craft-plugin", - "version": "1.0.13", + "version": "1.0.14", "keywords": [ "craft", "cms", diff --git a/src/services/HtmlcacheService.php b/src/services/HtmlcacheService.php index 0e8f316..6133219 100755 --- a/src/services/HtmlcacheService.php +++ b/src/services/HtmlcacheService.php @@ -161,15 +161,17 @@ private function isPathExcluded() $requestedSiteId = \Craft::$app->getSites()->getCurrentSite()->id; // compare with excluded paths and sites from the settings - foreach ($this->settings->excludedUrlPaths as $exclude) { - $path = reset($exclude); - $siteId = intval(next($exclude)); + if (!empty($this->settings->excludedUrlPaths)) { + foreach ($this->settings->excludedUrlPaths as $exclude) { + $path = reset($exclude); + $siteId = intval(next($exclude)); - // check if requested path is one of those of the settings - if ($requestedPath == $path || preg_match('@' . $path . '@', $requestedPath)) { - // and if requested site either corresponds to the exclude setting or if it's unimportant at all - if ($requestedSiteId == $siteId || $siteId < 0) { - return true; + // check if requested path is one of those of the settings + if ($requestedPath == $path || preg_match('@' . $path . '@', $requestedPath)) { + // and if requested site either corresponds to the exclude setting or if it's unimportant at all + if ($requestedSiteId == $siteId || $siteId < 0) { + return true; + } } } }