From ff52d613229dacddd200f6b78cbc3e7dc918df6f Mon Sep 17 00:00:00 2001 From: Klaatu Date: Wed, 5 Aug 2015 11:44:38 +1200 Subject: [PATCH 01/17] added conf settings for running grav in sud dir, on nginx --- nginx.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nginx.conf b/nginx.conf index afa450c23..7e7147adc 100644 --- a/nginx.conf +++ b/nginx.conf @@ -26,6 +26,21 @@ http { if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; } } + # if you want grav in a sub-directory of your main site + # (for example, example.com/mygrav) then you need this rewrite: + location /mygrav { + index index.php; + if (!-e $request_filename){ rewrite ^(.*)$ /mygrav/$2 last; } + try_files $uri $uri/ /index.php?$args; + } + + # if using grav in a sub-directory of your site, + # prepend the actual path to each location + # for example: /mygrav/images + # and: /mygrav/user + # and: /mygrav/cache + # and so on + location /images/ { # Serve images as static } From 82d11930908b0d1127c0431d53d1432ebdb687ac Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:02:48 -0600 Subject: [PATCH 02/17] removed required from title --- system/blueprints/pages/default.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index 64a4bd029..e376d357b 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -29,8 +29,6 @@ form: type: text style: vertical label: Title - validate: - required: true content: type: markdown From 1a21186ba18f5dae090f230d5e7f14591675a639 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:03:16 -0600 Subject: [PATCH 03/17] removed duplicate hidden type field --- system/blueprints/pages/default.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index e376d357b..3e4f4c3d3 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -10,10 +10,6 @@ form: validation: loose fields: - type: - type: hidden - label: Page Type - default: default tabs: type: tabs From 6bb47124a94ce42ef859f37e936ea6f78b66af51 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:03:34 -0600 Subject: [PATCH 04/17] added body classes --- system/blueprints/pages/default.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index 3e4f4c3d3..c5979ed6f 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -144,6 +144,17 @@ form: column1: type: column fields: + + settings: + type: section + title: Settings + underline: true + + header.body_classes: + type: text + label: Body Classes + + folder: type: text label: Folder Name From cd04572b78c3c528253fe926745e7ac39dcb3099 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:04:57 -0600 Subject: [PATCH 05/17] using new templates field type --- system/blueprints/pages/default.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index c5979ed6f..1cf8be584 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -171,12 +171,13 @@ form: '/': '- Root -' type: - type: select + type: templates classes: fancy label: Display Template default: default @data-options: '\Grav\Common\Page\Pages::types' + column2: type: column From 0687d2ff7816190353e06fc71e4d5da77ddc8feb Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:05:34 -0600 Subject: [PATCH 06/17] added body_classes to modular type --- system/blueprints/pages/modular.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/system/blueprints/pages/modular.yaml b/system/blueprints/pages/modular.yaml index e90f1d2ee..e744be727 100644 --- a/system/blueprints/pages/modular.yaml +++ b/system/blueprints/pages/modular.yaml @@ -44,3 +44,7 @@ form: type: ignore uploads: type: ignore + + header.body_classes: + type: hidden + default: 'modular' From 29cb55e91c95aebf284b17839a1186e7b3a2c688 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:06:07 -0600 Subject: [PATCH 07/17] visible toggle and help commands on new page --- system/blueprints/pages/new.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/system/blueprints/pages/new.yaml b/system/blueprints/pages/new.yaml index b48000f2c..0de6178cd 100644 --- a/system/blueprints/pages/new.yaml +++ b/system/blueprints/pages/new.yaml @@ -15,18 +15,18 @@ form: title: type: text label: Page Title + help: "The title of the page" validate: required: true folder: type: text label: Folder Name + help: "The folder name that will be stored in the filesystem for this page" validate: type: slug required: true - - route: type: select label: Parent Page @@ -40,6 +40,7 @@ form: type: type: select + help: "The page type that translates into which twig template renders the page" classes: fancy label: Display Template default: default @@ -47,6 +48,20 @@ form: validate: required: true + visible: + type: toggle + label: Visible + help: "Determines if a page is visible in the navigation." + highlight: '' + default: '' + options: + '': Auto + 1: Yes + 0: No + validate: + type: bool + required: true + blueprint: type: blueprint From a1ad9b7f4d654fe6b6e64ffb50042327ea4d93ae Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 18:06:50 -0600 Subject: [PATCH 08/17] list of pages should show all except root --- system/src/Grav/Common/Page/Pages.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index d8cad6e07..c132e158b 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -384,7 +384,8 @@ public function getList(Page $current = null, $level = 0) } $list = array(); - if ($current->routable()) { + + if (!$current->root()) { $list[$current->route()] = str_repeat('  ', ($level-1)*2) . $current->title(); } From 9d38d0818b5e609262d300e5b4c9adcb69320d8a Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 22:26:41 -0600 Subject: [PATCH 09/17] fix robots field --- system/blueprints/pages/default.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index 1cf8be584..d0f78c6ea 100644 --- a/system/blueprints/pages/default.yaml +++ b/system/blueprints/pages/default.yaml @@ -112,13 +112,11 @@ form: max: 120 header.metadata.robots: - type: checkboxes + type: text toggleable: true label: Robots - options: - noindex: No index - nofollow: No follow - use: keys + validate: + max: 120 taxonomies: type: section From f8fd0651927c363dd4b0ea272a4be6532521d62b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 22:26:57 -0600 Subject: [PATCH 10/17] removed unused body_classes in modular type --- system/blueprints/pages/modular.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/system/blueprints/pages/modular.yaml b/system/blueprints/pages/modular.yaml index e744be727..a582cfe3d 100644 --- a/system/blueprints/pages/modular.yaml +++ b/system/blueprints/pages/modular.yaml @@ -45,6 +45,3 @@ form: uploads: type: ignore - header.body_classes: - type: hidden - default: 'modular' From 4bebdfe0c720df668433754c57f86acb77c77483 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Wed, 5 Aug 2015 22:27:26 -0600 Subject: [PATCH 11/17] fixed metadata merging (hopefully!) --- system/src/Grav/Common/Page/Page.php | 47 +++++++++++----------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 8bcc84fa4..83b7a0588 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1058,43 +1058,34 @@ public function metadata($var = null) // if not metadata yet, process it. if (null === $this->metadata) { $header_tag_http_equivs = ['content-type', 'default-style', 'refresh']; - $this->metadata = array(); + + $this->metadata = []; // Set the Generator tag $this->metadata['generator'] = array('name'=>'generator', 'content'=>'GravCMS ' . GRAV_VERSION); + // Get initial metadata for the page + $metadata = self::getGrav()['config']->get('site.metadata'); if (isset($this->header->metadata)) { - $page_header = $this->header->metadata; - - - - - // Merge any site.metadata settings in with page metadata - $defaults = (array) self::getGrav()['config']->get('site.metadata'); + $metadata = array_merge($metadata, $this->header->metadata); + } - if (isset($page_header)) { - $page_header = array_merge($defaults, $page_header); + // Build an array of meta objects.. + foreach ((array)$metadata as $key => $value) { + // If this is a property type metadata: "og", "twitter", "facebook" etc + if (is_array($value)) { + foreach ($value as $property => $prop_value) { + $prop_key = $key.":".$property; + $this->metadata[$prop_key] = array('property'=>$prop_key, 'content'=>htmlspecialchars($prop_value, ENT_QUOTES)); + } + // If it this is a standard meta data type } else { - $page_header = $defaults; - } - - // Build an array of meta objects.. - foreach ((array)$page_header as $key => $value) { - // If this is a property type metadata: "og", "twitter", "facebook" etc - if (is_array($value)) { - foreach ($value as $property => $prop_value) { - $prop_key = $key.":".$property; - $this->metadata[$prop_key] = array('property'=>$prop_key, 'content'=>htmlspecialchars($prop_value, ENT_QUOTES)); - } - // If it this is a standard meta data type + if (in_array($key, $header_tag_http_equivs)) { + $this->metadata[$key] = array('http_equiv'=>$key, 'content'=>htmlspecialchars($value, ENT_QUOTES)); } else { - if (in_array($key, $header_tag_http_equivs)) { - $this->metadata[$key] = array('http_equiv'=>$key, 'content'=>htmlspecialchars($value, ENT_QUOTES)); - } else { - $this->metadata[$key] = array('name'=>$key, 'content'=>htmlspecialchars($value, ENT_QUOTES)); - } + $this->metadata[$key] = array('name'=>$key, 'content'=>htmlspecialchars($value, ENT_QUOTES)); } } } @@ -1943,7 +1934,7 @@ protected function cleanPath($path) */ protected function doRelocation($reorder) { - if (empty($this->_original)) { + if (empty($this->_original) ) { return; } From dc5ba9eff4e8511fae3babad0df80020fed3aecb Mon Sep 17 00:00:00 2001 From: Sommerregen Date: Thu, 6 Aug 2015 19:59:20 +0200 Subject: [PATCH 12/17] Fix #248 (Plugin language interference) and fixed summary --- system/src/Grav/Common/Config/Config.php | 4 +--- system/src/Grav/Common/Page/Page.php | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/system/src/Grav/Common/Config/Config.php b/system/src/Grav/Common/Config/Config.php index 98a7b3da8..cc1feeac6 100644 --- a/system/src/Grav/Common/Config/Config.php +++ b/system/src/Grav/Common/Config/Config.php @@ -371,9 +371,7 @@ protected function loadCompiledLanguages($languages, $plugins, $filename = null) foreach ((array) $languageFiles['user/plugins'] as $plugin => $item) { $lang_file = CompiledYamlFile::instance($item['file']); $content = $lang_file->content(); - foreach ((array) $content as $lang => $value) { - $this->languages->join($lang, $value, '/'); - } + $this->languages->mergeRecursive($content); } } diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 83b7a0588..ca5fabb7e 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -332,7 +332,7 @@ public function summary($size = null) // Return summary based on settings in site config file if (!$config['enabled']) { - return $content; + return $this->content(); } // Set up variables to process summary from page or from custom summary From 018f7a6decdefd5d80703acc70c170bf45d59167 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Thu, 6 Aug 2015 11:31:37 -0700 Subject: [PATCH 13/17] Fixed GPM issue when using cURL throwing an `Undefined offset: 1` exception --- CHANGELOG.md | 6 ++++++ system/src/Grav/Common/GPM/Response.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a30b4e3c..ac9a1da25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v0.9.35 +## XX/XX/2015 + +1. [](#bugfix) + * Fixed GPM issue when using cURL, throwing an `Undefined offset: 1` exception + # v0.9.34 ## 08/04/2015 diff --git a/system/src/Grav/Common/GPM/Response.php b/system/src/Grav/Common/GPM/Response.php index 530415870..a6789488a 100644 --- a/system/src/Grav/Common/GPM/Response.php +++ b/system/src/Grav/Common/GPM/Response.php @@ -160,6 +160,8 @@ private static function getAuto() private static function getCurl() { $args = func_get_args(); + $args = count($args) > 1 ? $args : array_shift($args); + $uri = $args[0]; $options = $args[1]; $callback = $args[2]; From 1e168b31008a75cdf3b4b53f3bb2d0254d23d87b Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 6 Aug 2015 18:30:24 -0600 Subject: [PATCH 14/17] made username disabled --- system/blueprints/user/account.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/system/blueprints/user/account.yaml b/system/blueprints/user/account.yaml index 7f9dfc9dc..cc03b8062 100644 --- a/system/blueprints/user/account.yaml +++ b/system/blueprints/user/account.yaml @@ -12,6 +12,7 @@ form: type: text size: large label: Username + disabled: true readonly: true email: From 5cee23cbfa38df9e07225511fc9a8e37a1753ce1 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 6 Aug 2015 18:30:50 -0600 Subject: [PATCH 15/17] Added new unsetRoute() to allow route() to rebuild --- system/src/Grav/Common/Page/Page.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 83b7a0588..5d53764f4 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -1224,6 +1224,15 @@ public function route($var = null) return $this->route; } + /** + * Helper method to clear the route out so it regenerates next time you use it + */ + public function unsetRoute() + { + unset($this->route); + + } + public function rawRoute($var = null) { if ($var !== null) { From 0c085a5aab55ab9c1b60d8a23984973cc43cf41e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 6 Aug 2015 18:31:08 -0600 Subject: [PATCH 16/17] Override save to not store the username field --- system/src/Grav/Common/User/User.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index 6528d9b0c..9c7e0d324 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -91,6 +91,20 @@ public function authenticate($password) return (bool) $result; } + /** + * Save user without the username + */ + public function save() + { + $file = $this->file(); + if ($file) { + $username = $this->get('username'); + unset($this->username); + $file->save($this->items); + $this->set('username', $username); + } + } + /** * Checks user authorization to the action. * From 11fc34cfedb1b88e3e7329eaba702c41aa8981b9 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Thu, 6 Aug 2015 18:38:35 -0600 Subject: [PATCH 17/17] version update --- CHANGELOG.md | 17 ++++++++++++++++- system/defines.php | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac9a1da25..50f855b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,23 @@ # v0.9.35 -## XX/XX/2015 +## 08/06/2015 +1. [](#new) + * Added `body_classes` field + * Added `visiblity` toggle and help tooltips on new page form + * Added new `Page.unsetRoute()` method to allow admin to regenerate the route +1. [](#improved) + * User save no longer stores username each time + * Page list form field now shows all pages except root + * Removed required option from page title + * Added configuration settings for running Nginx in sub directory 1. [](#bugfix) + * Fixed issue with GPM and cURL throwing `Undefined offset: 1` error + * Fixed deep translation merging + * Fixed broken **metadata** merging with site defaults + * Fixed broken **summary** field + * Fixed broken robots field * Fixed GPM issue when using cURL, throwing an `Undefined offset: 1` exception + * Removed duplicate hidden page `type` field # v0.9.34 ## 08/04/2015 diff --git a/system/defines.php b/system/defines.php index 707e7498f..6828ce4fe 100644 --- a/system/defines.php +++ b/system/defines.php @@ -2,7 +2,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '0.9.34'); +define('GRAV_VERSION', '0.9.35'); define('DS', '/'); // Directories and Paths