Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/getgrav/grav into 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Jun 12, 2018
2 parents 9f75341 + 036fc2d commit 280d540
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 6 deletions.
2 changes: 1 addition & 1 deletion system/config/site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_lang: en # Default language for site (potenti

author:
name: John Appleseed # Default author name
email: 'john@email.com' # Default author email
email: 'john@example.com' # Default author email

taxonomies: [category,tag] # Arbitrary list of taxonomy types

Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Helpers/Truncator.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static function truncateLetters($html, $limit = 0, $ellipsis = "")
if ($letters->key() >= $limit) {

$currentText = $letters->currentTextPosition();
$currentText[0]->nodeValue = substr($currentText[0]->nodeValue, 0, $currentText[1] + 1);
$currentText[0]->nodeValue = mb_substr($currentText[0]->nodeValue, 0, $currentText[1] + 1);
self::removeProceedingNodes($currentText[0], $body);

if (!empty($ellipsis)) {
Expand Down
14 changes: 13 additions & 1 deletion system/src/Grav/Common/Page/Medium/ImageMedium.php
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,8 @@ public function derivatives($min_width, $max_width = 2500, $step = 200) {
$derivative->set('width', $width);
$derivative->set('height', $height);

$derivative->saveImage();
$derivative->resetImage();
$this->addAlternative($ratio, $derivative);
}
}
Expand Down Expand Up @@ -566,6 +568,14 @@ protected function image()
return $this;
}

/**
* Frees the cached image file.
*/
protected function resetImage()
{
$this->image = null;
}

/**
* Save the image with cache.
*
Expand Down Expand Up @@ -594,7 +604,9 @@ protected function saveImage()
$this->image->merge(ImageFile::open($overlay));
}

return $this->image->cacheFile($this->format, $this->quality);
$cachedPath = $this->image->cacheFile($this->format, $this->quality);
$this->set('filepath', $cachedPath);
return $cachedPath;
}

/**
Expand Down
22 changes: 22 additions & 0 deletions system/src/Grav/Common/Page/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -2976,4 +2976,26 @@ protected function adjustRouteCase($route)
return $route;
}
}

/**
* Gets the Page Unmodified (original) version of the page.
*
* @return Page
* The original version of the page.
*/
public function getOriginal()
{
return $this->_original;
}

/**
* Gets the action.
*
* @return string
* The Action string.
*/
public function getAction()
{
return $this->_action;
}
}
4 changes: 3 additions & 1 deletion system/src/Grav/Common/Twig/Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,9 @@ public function processPage(Page $item, $content = null)
// Process Modular Twig
if ($item->modularTwig()) {
$twig_vars['content'] = $content;
$template = $item->template() . TEMPLATE_EXT;
$extension = $this->grav['uri']->extension();
$extension = $extension ? ".{$extension}.twig" : TEMPLATE_EXT;
$template = $item->template() . $extension;
$output = $content = $local_twig->render($template, $twig_vars);
}

Expand Down
2 changes: 1 addition & 1 deletion user/config/site.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
title: Grav
author:
name: Joe Bloggs
email: 'joe@test.com'
email: 'joe@example.com'
metadata:
description: 'Grav is an easy to use, yet powerful, open source flat-file CMS'

3 changes: 2 additions & 1 deletion webserver-configs/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ server {
## Begin - PHP
location ~ \.php$ {
# Choose either a socket or TCP/IP address
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
# fastcgi_pass unix:/var/run/php5-fpm.sock; #legacy
# fastcgi_pass 127.0.0.1:9000;

fastcgi_split_path_info ^(.+\.php)(/.+)$;
Expand Down

0 comments on commit 280d540

Please sign in to comment.