From 2a06dc9bea3d91abbcdac37b84c62bfc795df0be Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 10 Apr 2015 13:21:03 -0600 Subject: [PATCH] customizable page types --- system/config/system.yaml | 1 + system/src/Grav/Common/Uri.php | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/system/config/system.yaml b/system/config/system.yaml index 59f4b36a9..a5eec78fe 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -30,6 +30,7 @@ pages: special_chars: # List of special characters to automatically convert to entities '>': 'gt' '<': 'lt' + types: 'txt|xml|html|json|rss|atom' # Pipe separated list of valid page types cache: enabled: true # Set to true to enable caching diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index d1dad9fda..3faa894a5 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -84,7 +84,11 @@ class Uri // remove the extension if there is one set $parts = pathinfo($uri); - if (preg_match("/\.(txt|xml|html|json|rss|atom)$/", $parts['basename'])) { + + // set the original basename + $this->basename = $parts['basename']; + + if (preg_match("/\.(".$config->get('system.pages.types').")$/", $parts['basename'])) { $uri = rtrim($parts['dirname'], '/').'/'.$parts['filename']; $this->extension = $parts['extension']; }