From 7f0e51f92f83a2e363b8c873e2b5edfb7b995851 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 15 Oct 2020 13:41:50 +0300 Subject: [PATCH 1/3] Minor fix to upgrade guide --- UPGRADE-1.7.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UPGRADE-1.7.md b/UPGRADE-1.7.md index dd0865f5a..141069ba0 100644 --- a/UPGRADE-1.7.md +++ b/UPGRADE-1.7.md @@ -232,7 +232,7 @@ ### Templating -* Added support for Twig 2.12 (still using Twig 1.42) +* Added support for Twig 2.12 (using Twig 1.43) * Added a new `{% cache %}` Twig tag eliminating need for `twigcache` extension. * Added `array_diff()` twig function * Added `template_from_string()` twig function From 972d32c969825d65f559dbcdcba892ed881b807a Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 16 Oct 2020 12:29:37 +0300 Subject: [PATCH 2/3] Added deprecation notice when using system.pages_fallback_only --- system/config/system.yaml | 2 +- system/src/Grav/Common/Language/Language.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/system/config/system.yaml b/system/config/system.yaml index 32bc095a1..56f0a2e07 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -21,13 +21,13 @@ languages: default_lang: # Default is the first supported language. Must be one of the supported languages include_default_lang: true # Include the default lang prefix in all URLs include_default_lang_file_extension: true # If true, include language code for the default language in file extension: default.en.md - pages_fallback_only: false # Only fallback to find page content through supported languages translations: true # If false, translation keys are used instead of translated strings translations_fallback: true # Fallback through supported translations if active lang doesn't exist session_store_active: false # Store active language in session http_accept_language: false # Attempt to set the language based on http_accept_language header in the browser override_locale: false # Override the default or system locale with language specific one content_fallback: {} # Custom language fallbacks. eg: {fr: ['fr', 'en']} + pages_fallback_only: false # DEPRECATED: Use `content_fallback` instead home: alias: '/home' # Default path for home, ie / diff --git a/system/src/Grav/Common/Language/Language.php b/system/src/Grav/Common/Language/Language.php index b839031be..49b1105c7 100644 --- a/system/src/Grav/Common/Language/Language.php +++ b/system/src/Grav/Common/Language/Language.php @@ -414,6 +414,8 @@ class Language $fallback_languages = []; if (null === $fallback && $this->config->get('system.languages.pages_fallback_only', false)) { + user_error('Configuration option `system.languages.pages_fallback_only` is deprecated since Grav 1.7, use `system.languages.content_fallback` instead', E_USER_DEPRECATED); + // Special fallback list returns itself and all the previous items in reverse order: // active: 'v2', languages: ['v1', 'v2', 'v3', 'v4'] => ['v2', 'v1', ''] if ($includeDefault) { From c0d819b97a4e67b48c19f507c6ff530f603c4b4c Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Sun, 18 Oct 2020 20:17:17 +0300 Subject: [PATCH 3/3] Fixed `print_r()` in twig --- CHANGELOG.md | 1 + system/src/Grav/Common/Twig/TwigExtension.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 494fe368f..ffc466287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ * Accessing page with unsupported file extension (jpg, pdf, xsl) will use wrong mime type [#3031](https://github.com/getgrav/grav/issues/3031) * Fixed media crashing on a bad image * Fixed bug in collections where filter `type: false` did not work + * Fixed `print_r()` in twig # v1.7.0-rc.17 ## 10/07/2020 diff --git a/system/src/Grav/Common/Twig/TwigExtension.php b/system/src/Grav/Common/Twig/TwigExtension.php index d8122f6a3..695ff4990 100644 --- a/system/src/Grav/Common/Twig/TwigExtension.php +++ b/system/src/Grav/Common/Twig/TwigExtension.php @@ -140,7 +140,7 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface new TwigFilter('array_unique', 'array_unique'), new TwigFilter('basename', 'basename'), new TwigFilter('dirname', 'dirname'), - new TwigFilter('print_r', 'print_r'), + new TwigFilter('print_r', [$this, 'print_r']), new TwigFilter('yaml_encode', [$this, 'yamlEncodeFilter']), new TwigFilter('yaml_decode', [$this, 'yamlDecodeFilter']), new TwigFilter('nicecron', [$this, 'niceCronFilter']), @@ -181,7 +181,7 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface new TwigFunction('debug', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new TwigFunction('dump', [$this, 'dump'], ['needs_context' => true, 'needs_environment' => true]), new TwigFunction('vardump', [$this, 'vardumpFunc']), - new TwigFunction('print_r', 'print_r'), + new TwigFunction('print_r', [$this, 'print_r']), new TwigFunction('http_response_code', 'http_response_code'), new TwigFunction('evaluate', [$this, 'evaluateStringFunc'], ['needs_context' => true]), new TwigFunction('evaluate_twig', [$this, 'evaluateTwigFunc'], ['needs_context' => true]), @@ -241,6 +241,11 @@ class TwigExtension extends AbstractExtension implements GlobalsInterface ]; } + public function print_r($var) + { + return print_r($var, true); + } + /** * Filters field name by changing dot notation into array notation. *