Skip to content

Commit

Permalink
Merge branch 'release/0.9.35'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Aug 7, 2015
2 parents c6ea5eb + 11fc34c commit 11869ad
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 48 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
15 changes: 15 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
28 changes: 16 additions & 12 deletions system/blueprints/pages/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ form:
validation: loose

fields:
type:
type: hidden
label: Page Type
default: default

tabs:
type: tabs
Expand All @@ -29,8 +25,6 @@ form:
type: text
style: vertical
label: Title
validate:
required: true

content:
type: markdown
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions system/blueprints/pages/modular.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ form:
type: ignore
uploads:
type: ignore

19 changes: 17 additions & 2 deletions system/blueprints/pages/new.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,13 +40,28 @@ form:

type:
type: select
help: "The page type that translates into which twig template renders the page"
classes: fancy
label: Display Template
default: default
@data-options: '\Grav\Common\Page\Pages::types'
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
1 change: 1 addition & 0 deletions system/blueprints/user/account.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ form:
type: text
size: large
label: Username
disabled: true
readonly: true

email:
Expand Down
2 changes: 1 addition & 1 deletion system/defines.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions system/src/Grav/Common/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
2 changes: 2 additions & 0 deletions system/src/Grav/Common/GPM/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
58 changes: 29 additions & 29 deletions system/src/Grav/Common/Page/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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));
}
}
}
Expand Down Expand Up @@ -1233,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) {
Expand Down Expand Up @@ -1943,7 +1943,7 @@ protected function cleanPath($path)
*/
protected function doRelocation($reorder)
{
if (empty($this->_original)) {
if (empty($this->_original) ) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion system/src/Grav/Common/Page/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
14 changes: 14 additions & 0 deletions system/src/Grav/Common/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit 11869ad

Please sign in to comment.