Skip to content

Commit

Permalink
Merge branch 'release/0.9.18'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Feb 19, 2015
2 parents ab358dd + 9ab3524 commit 3397d5d
Show file tree
Hide file tree
Showing 44 changed files with 668 additions and 238 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
# v0.9.18
## 02/19/2015

1. [](#new)
* Added ability for GPM `install` to automatically install `_demo` content if found (w/backup)
* Added ability for themes and plugins to have dependencies required to install via GPM
* Added ability to override the system timezone rather than relying on server setting only
* Added new Twig filter `random_string` for generating random id values
* Added new Twig filter `markdown` for on-the-fly markdown processing
* Added new Twig filter `absoluteUrl` to convert relative to absolute URLs
* Added new `processTemplate()` method to Twig object for on-the-fly processing of twig template
* Added `rcopy()` and `contains()` helper methods in Utils
2. [](#improved)
* Provied new `param_sep` variable to better support Apache on Windows
* Moved parsedown configuration into the trait
* Added optional **deep-copy** option to `mergeConfig()` for plugins
* Updated bundled `composer.phar` package
* Various Sensiolabs Insight fixes - Silver level now!
* Various PSR Fixes
3. [](#bugfix)
* Fix for windows platforms not displaying installed themes/plugins via GPM
* Fix page IDs not picking up folder-only pages

# v0.9.17
## 02/05/2015

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# ![](https://avatars1.githubusercontent.com/u/8237355?v=2&s=50) Grav
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/getgrav/grav?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Grav is a **Fast**, **Simple**, and **Flexible**, file-based Web-platform. There is **Zero** installation required. Just extract the ZIP archive, and you are already up and running. It follows similar principals to other flat-file CMS platforms, but has a different design philosophy than most. Grav comes with a powerful **Package Management System** to allow for simple installation and upgrading of plugins and themes, as well as simple updating of Grav itself.

Expand Down
Binary file modified bin/composer.phar
Binary file not shown.
13 changes: 7 additions & 6 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@
namespace Grav;

if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
exit(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
throw new \RuntimeException(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}

// Ensure vendor libraries exist
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
exit('Please run: <i>bin/grav install</i>');
throw new \RuntimeException("Please run: <i>bin/grav install</i>");
}

use Grav\Common\Grav;

// Register the auto-loader.
$loader = require_once $autoload;

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}
// Set timezone to default, falls back to system if php.ini not set
date_default_timezone_set(@date_default_timezone_get());

// Get the Grav instance
$grav = Grav::instance(
array(
'loader' => $loader
)
);

// Process the page
try {
$grav->process();

} catch (\Exception $e) {
$grav->fireEvent('onFatalException');
throw $e;
Expand Down
33 changes: 16 additions & 17 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,26 @@ http {
}

location /user {
rewrite ^/user/accounts/(.*)$ /error redirect;
rewrite ^/user/config/(.*)$ /error redirect;
rewrite ^/user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}
rewrite ^/user/accounts/(.*)$ /error redirect;
rewrite ^/user/config/(.*)$ /error redirect;
rewrite ^/user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}

location /cache {
rewrite ^/cache/(.*) /error redirect;
}
location /cache {
rewrite ^/cache/(.*) /error redirect;
}

location /bin {
rewrite ^/bin/(.*)$ /error redirect;
}
location /bin {
rewrite ^/bin/(.*)$ /error redirect;
}

location /system {
rewrite ^/system/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}
location /system {
rewrite ^/system/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}

location /vendor {
rewrite ^/vendor/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}
location /vendor {
rewrite ^/vendor/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
}

# Remember to change 127.0.0.1:9000 to the Ip/port
# you configured php-cgi.exe to run from
Expand All @@ -60,7 +60,6 @@ http {
include fastcgi_params;
}


}

}
2 changes: 2 additions & 0 deletions system/config/system.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
absolute_urls: false # Absolute or relative URLs for `base_url`
timezone: '' # Valid values: http://php.net/manual/en/timezones.php
param_sep: ':' # Parameter separator

home:
alias: '/home' # Default path for home, ie /
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.17');
define('GRAV_VERSION', '0.9.18');
define('DS', '/');

// Directories and Paths
Expand Down
14 changes: 7 additions & 7 deletions system/src/Grav/Common/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function config(array $config)
}

// Set custom pipeline fetch command
if (isset($config['fetch_command']) and ($config['fetch_command'] instanceof Closure)) {
if (isset($config['fetch_command']) && ($config['fetch_command'] instanceof Closure)) {
$this->fetch_command = $config['fetch_command'];
}

Expand All @@ -143,12 +143,12 @@ public function config(array $config)
}

// Set collections
if (isset($config['collections']) and is_array($config['collections'])) {
if (isset($config['collections']) && is_array($config['collections'])) {
$this->collections = $config['collections'];
}

// Autoload assets
if (isset($config['autoload']) and is_array($config['autoload'])) {
if (isset($config['autoload']) && is_array($config['autoload'])) {
foreach ($config['autoload'] as $asset) {
$this->add($asset);
}
Expand Down Expand Up @@ -651,9 +651,9 @@ public function addDir($directory, $pattern = self::DEFAULT_REGEX)
$info = pathinfo($asset);
if (isset($info['extension'])) {
$ext = strtolower($info['extension']);
if ($ext === 'css' and !in_array($asset, $this->css)) {
if ($ext === 'css' && !in_array($asset, $this->css)) {
$this->css[] = $asset;
} elseif ($ext === 'js' and !in_array($asset, $this->js)) {
} elseif ($ext === 'js' && !in_array($asset, $this->js)) {
$this->js[] = $asset;
}
}
Expand All @@ -673,8 +673,8 @@ public function addDir($directory, $pattern = self::DEFAULT_REGEX)
*/
protected function isRemoteLink($link)
{
return ('http://' === substr($link, 0, 7) or 'https://' === substr($link, 0, 8)
or '//' === substr($link, 0, 2));
return ('http://' === substr($link, 0, 7) || 'https://' === substr($link, 0, 8)
|| '//' === substr($link, 0, 2));
}

/**
Expand Down
3 changes: 1 addition & 2 deletions system/src/Grav/Common/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ public function fetch($id)
public function save($id, $data, $lifetime = null)
{
if ($this->enabled) {

if ($lifetime == null) {
if ($lifetime === null) {
$lifetime = $this->getLifetime();
}
$this->driver->save($id, $data, $lifetime);
Expand Down
1 change: 0 additions & 1 deletion system/src/Grav/Common/Config/Blueprints.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

use Grav\Common\File\CompiledYamlFile;
use Grav\Common\Grav;
use Grav\Common\GravTrait;
use Grav\Common\Filesystem\Folder;
use RocketTheme\Toolbox\Blueprints\Blueprints as BaseBlueprints;
use RocketTheme\Toolbox\File\PhpFile;
Expand Down
3 changes: 0 additions & 3 deletions system/src/Grav/Common/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@

use Grav\Common\File\CompiledYamlFile;
use Grav\Common\Grav;
use Grav\Common\GravTrait;
use Grav\Common\Uri;
use Grav\Common\Data\Data;
use Grav\Common\Filesystem\Folder;
use RocketTheme\Toolbox\Blueprints\Blueprints;
use RocketTheme\Toolbox\File\PhpFile;
use RocketTheme\Toolbox\ResourceLocator\UniformResourceLocator;
Expand Down
5 changes: 3 additions & 2 deletions system/src/Grav/Common/Data/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,15 @@ protected function getRule($rule)
* @throws \RuntimeException
* @internal
*/
protected function checkRequired(array $data, array $fields) {
protected function checkRequired(array $data, array $fields)
{
foreach ($fields as $name => $field) {
if (!is_string($field)) {
continue;
}
$field = $this->rules[$field];
if (isset($field['validate']['required'])
&& $field['validate']['required'] == true
&& $field['validate']['required'] === true
&& empty($data[$name])) {
throw new \RuntimeException("Missing required field: {$field['name']}");
}
Expand Down
1 change: 0 additions & 1 deletion system/src/Grav/Common/Data/Blueprints.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function get($type)
$file = CompiledYamlFile::instance($filename);
$blueprints = $file->content();
} else {
// throw new \RuntimeException("Blueprints for '{$type}' cannot be found! {$this->search}{$type}");
$blueprints = [];
}

Expand Down
4 changes: 2 additions & 2 deletions system/src/Grav/Common/Data/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public static function typeDatetime($value, array $params, array $field)
* @param array $field Blueprint for the field.
* @return bool True if validation succeeded.
*/
public static function typeDatetime_local($value, array $params, array $field)
public static function typeDatetimeLocal($value, array $params, array $field)
{
return self::typeDatetime($value, $params, $field);
}
Expand Down Expand Up @@ -517,7 +517,7 @@ public static function typeIgnore($value, array $params, array $field)

public static function validateRequired($value, $params)
{
return (bool) $params != true || !empty($value);
return (bool) $params !== true || !empty($value);
}

public static function validatePattern($value, $params)
Expand Down
2 changes: 0 additions & 2 deletions system/src/Grav/Common/Debugger.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?php
namespace Grav\Common;

use DebugBar\Bridge\Twig\TraceableTwigEnvironment;
use DebugBar\JavascriptRenderer;
use DebugBar\StandardDebugBar;
//use \Tracy\Debugger as TracyDebugger;

/**
* Class Debugger
Expand Down
5 changes: 1 addition & 4 deletions system/src/Grav/Common/Errors/Errors.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
use Grav\Common\Grav;
use Whoops\Handler\CallbackHandler;
use Whoops\Handler\HandlerInterface;
use Whoops\Handler\JsonResponseHandler;
use Whoops\Handler\PrettyPageHandler;
use Whoops\Handler\PlainTextHandler;
use Whoops\Run;

/**
Expand All @@ -23,7 +20,7 @@ public function pushHandler($handler, $key = null)
}

if (!$handler instanceof HandlerInterface) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
"Argument to " . __METHOD__ . " must be a callable, or instance of"
. "Whoops\\Handler\\HandlerInterface"
);
Expand Down
11 changes: 7 additions & 4 deletions system/src/Grav/Common/Errors/SimplePageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ public function __construct()
*/
public function handle()
{
$exception = $this->getException();
$inspector = $this->getInspector();
$run = $this->getRun();

$helper = new TemplateHelper();
$templateFile = $this->getResource("layout.html.php");
Expand All @@ -46,6 +44,11 @@ public function handle()
return Handler::QUIT;
}

/**
* @param $resource
*
* @return string
*/
protected function getResource($resource)
{
// If the resource was found before, we can speed things up
Expand All @@ -67,7 +70,7 @@ protected function getResource($resource)
}

// If we got this far, nothing was found.
throw new RuntimeException(
throw new \RuntimeException(
"Could not find resource '$resource' in any resource paths."
. "(searched: " . join(", ", $this->searchPaths). ")"
);
Expand All @@ -76,7 +79,7 @@ protected function getResource($resource)
public function addResourcePath($path)
{
if (!is_dir($path)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
"'$path' is not a valid directory"
);
}
Expand Down
Loading

0 comments on commit 3397d5d

Please sign in to comment.