From 376eddfbeff5c7ad3932b33de4fbf78b61b3dc5d Mon Sep 17 00:00:00 2001 From: Andrew Welch Date: Wed, 2 Aug 2017 12:33:26 -0400 Subject: [PATCH] * Fixed an issue with template metas on Windows --- CHANGELOG.md | 1 + releases.json | 3 ++- twigextensions/SeomaticTwigExtension.php | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf3bbf5..3fdbe01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Changed `referrer` from `always` to `no-referrer-when-downgrade` * Fixed an issue where meta vars were not sanitized with a custom template passed via `seomaticTemplatePath` * Fixed a cosmetic bug where the SEOmatic FieldType settings didn't display the OpenGraph Image Source Changeable properly +* Fixed an issue with template metas on Windows ## 1.1.48 - 2017.06.18 ### Changed diff --git a/releases.json b/releases.json index 41e9578..9607c45 100644 --- a/releases.json +++ b/releases.json @@ -8,7 +8,8 @@ "[Improved] Changed `referrer` from `always` to `no-referrer-when-downgrade`", "[Fixed] Fix issue when passing a string containing the `à` character to _cleanupText()", "[Fixed] Fixed an issue where meta vars were not sanitized with a custom template passed via `seomaticTemplatePath`", - "[Fixed] Fixed a cosmetic bug where the SEOmatic FieldType settings didn't display the 'OpenGraph Image Source Changeable' properly" + "[Fixed] Fixed a cosmetic bug where the SEOmatic FieldType settings didn't display the 'OpenGraph Image Source Changeable' properly", + "[Fixed] Fixed an issue with template metas on Windows" ] }, { diff --git a/twigextensions/SeomaticTwigExtension.php b/twigextensions/SeomaticTwigExtension.php index bb47eed..bff49af 100755 --- a/twigextensions/SeomaticTwigExtension.php +++ b/twigextensions/SeomaticTwigExtension.php @@ -210,6 +210,10 @@ private function _get_current_template_path() $currentTemplate = craft()->templates->getRenderingTemplate(); $templatesPath = method_exists(craft()->templates, 'getTemplatesPath') ? craft()->templates->getTemplatesPath() : craft()->path->getTemplatesPath(); + // Try to normalize things for Windows + $currentTemplate = str_replace('\\', '/', $currentTemplate); + $templatesPath = str_replace('\\', '/', $templatesPath); + $path_parts = pathinfo($currentTemplate); if ($path_parts && isset($path_parts['dirname']) && isset($path_parts['filename']))