diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a30b4e3c..50f855b2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,24 @@ +# v0.9.35 +## 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/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 } diff --git a/system/blueprints/pages/default.yaml b/system/blueprints/pages/default.yaml index 64a4bd029..d0f78c6ea 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 @@ -29,8 +25,6 @@ form: type: text style: vertical label: Title - validate: - required: true content: type: markdown @@ -118,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 @@ -150,6 +142,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 @@ -166,12 +169,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 diff --git a/system/blueprints/pages/modular.yaml b/system/blueprints/pages/modular.yaml index e90f1d2ee..a582cfe3d 100644 --- a/system/blueprints/pages/modular.yaml +++ b/system/blueprints/pages/modular.yaml @@ -44,3 +44,4 @@ form: type: ignore uploads: type: ignore + 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 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: 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 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 @@ class Config extends Data 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/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 @@ class Response 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]; diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 8bcc84fa4..0666b8fc4 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -332,7 +332,7 @@ class Page // 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 @@ -1058,43 +1058,34 @@ class Page // 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)); } } } @@ -1233,6 +1224,15 @@ class Page 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) { @@ -1943,7 +1943,7 @@ class Page */ protected function doRelocation($reorder) { - if (empty($this->_original)) { + if (empty($this->_original) ) { return; } 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 @@ class Pages } $list = array(); - if ($current->routable()) { + + if (!$current->root()) { $list[$current->route()] = str_repeat('  ', ($level-1)*2) . $current->title(); } 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 @@ class User extends Data 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. *