Skip to content

Commit

Permalink
Merge branch 'develop' into 2.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	composer.json
#	composer.lock
  • Loading branch information
w00fz committed May 12, 2017
2 parents d1654a3 + 8ff2003 commit 4f27ff1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@

1. [](#new)
* Added `Pages::baseUrl()`, `Pages::homeUrl()` and `Pages::url()` functions
* Added `base32_encode`, `base32_decode`, `base64_encode`, `base64_decode` Twig filters
* Added `Debugger::getCaller()` to figure out where the method was called from
* Added support for custom output providers like Slim Framework
* Added `Grav\Framework\Collection` classes for creating collections
1. [](#improved)
* Add more controls over HTML5 video attributes (autoplay, poster, loop controls) [#1442](https://github.com/getgrav/grav/pull/1442)
* Removed logging statement for invalid slug [#1459](https://github.com/getgrav/grav/issues/1459)
* Groups selection pre-filled in user form
* Improve error handling in Folder::move()
* Added extra parameter for Twig::processSite() to include custom context
* Improve error handling in `Folder::move()`
* Added extra parameter for `Twig::processSite()` to include custom context
1. [](#bugfix)
* Fix to force route/redirect matching from the start of the route by default [#1446](https://github.com/getgrav/grav/issues/1446)
* Edit check for valid slug [#1459](https://github.com/getgrav/grav/issues/1459)
Expand Down
1 change: 1 addition & 0 deletions system/src/Grav/Common/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* The GravCache object is used throughout Grav to store and retrieve cached data.
* It uses DoctrineCache library and supports a variety of caching mechanisms. Those include:
*
* APCu
* APC
* XCache
* RedisCache
Expand Down
2 changes: 1 addition & 1 deletion system/src/Grav/Common/Grav.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public function header()

// Calculate a Hash based on the raw file
if ($page->eTag()) {
header('ETag: ' . md5($page->raw() . $page->modified()));
header('ETag: "' . md5($page->raw() . $page->modified()).'"');
}

// Set debugger data in headers
Expand Down
50 changes: 50 additions & 0 deletions system/src/Grav/Common/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Grav\Common\Markdown\Parsedown;
use Grav\Common\Markdown\ParsedownExtra;
use Grav\Common\Uri;
use Grav\Common\Helpers\Base32;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;

class TwigExtension extends \Twig_Extension
Expand Down Expand Up @@ -71,6 +72,10 @@ public function getFilters()
new \Twig_SimpleFilter('ltrim', [$this, 'ltrimFilter']),
new \Twig_SimpleFilter('markdown', [$this, 'markdownFilter']),
new \Twig_SimpleFilter('md5', [$this, 'md5Filter']),
new \Twig_SimpleFilter('base32_encode', [$this, 'base32EncodeFilter']),
new \Twig_SimpleFilter('base32_decode', [$this, 'base32DecodeFilter']),
new \Twig_SimpleFilter('base64_encode', [$this, 'base64EncodeFilter']),
new \Twig_SimpleFilter('base64_decode', [$this, 'base64DecodeFilter']),
new \Twig_SimpleFilter('nicetime', [$this, 'nicetimeFilter']),
new \Twig_SimpleFilter('randomize', [$this, 'randomizeFilter']),
new \Twig_SimpleFilter('modulus', [$this, 'modulusFilter']),
Expand Down Expand Up @@ -274,6 +279,51 @@ public function md5Filter($str)
return md5($str);
}

/**
* Return Base32 encoded string
*
* @param $str
* @return string
*/
public function base32EncodeFilter($str)
{
return Base32::encode($str);
}

/**
* Return Base32 decoded string
*
* @param $str
* @return bool|string
*/
public function base32DecodeFilter($str)
{
return Base32::decode($str);
}

/**
* Return Base64 encoded string
*
* @param $str
* @return string
*/
public function base64EncodeFilter($str)
{
return base64_encode($str);
}

/**
* Return Base64 decoded string
*
* @param $str
* @return bool|string
*/
public function base64DecodeFilter($str)
{
return base64_decode($str);
}


/**
* Sorts a collection by key
*
Expand Down

0 comments on commit 4f27ff1

Please sign in to comment.