Merge branch 'develop' of github.com:getgrav/grav into feature/asset_management

This commit is contained in:
Andy Miller 2014-08-17 15:50:47 -06:00
commit 57f969c806
18 changed files with 74 additions and 36 deletions

View File

@ -1,5 +1,4 @@
![](https://avatars1.githubusercontent.com/u/8237355?v=2&s=50) Grav
====
# ![](https://avatars1.githubusercontent.com/u/8237355?v=2&s=50) Grav
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.
@ -10,8 +9,7 @@ The underlying architecture of Grav has been designed to use well-established an
* [YAML](http://yaml.org): for simple configuration
* [Doctrine Cache](http://docs.doctrine-project.org/en/2.0.x/reference/caching.html): layer for incredible performance
QuickStart
==========
# QuickStart
You have two options to get Grav:
@ -36,8 +34,21 @@ You can download a **ready-built** package from the [Downloads page on http://ge
Check out the [install procedures](http://learn.getgrav.org/basics/installation) for more information.
Getting Started
===============
# Contributing
We appreciate any contribution to Grav, whether it is related to bugs, grammar, or simply a suggestion or improvement.
However, we ask that any contribution follow our simple guidelines in order to be properly received.
All our projects follow the [GitFlow branching model][gitflow-model], from development to release. If you are not familiar with it, there are several guides and tutorials to make you understand what it is about.
You will probably want to get started by installing [this very good collection of git extensions][gitflow-extensions].
What you mainly want to know is that:
- All the main activity happens in the `develop` branch. Any pull request should be addressed only to that branch. We will not consider pull requests made to the `master`.
- It's very well appreciated, and highly suggested, to start a new feature whenever you want to make changes or add functionalities. It will make it much easier for us to just checkout your feature branch and test it, before merging it into `develop`
# Getting Started
* [What is Grav?](http://learn.getgrav.org/basics/what-is-grav)
* [Install](http://learn.getgrav.org/basics/installation) Grav in few seconds
* Understand the [Configuration](http://learn.getgrav.org/basics/grav-configuration)
@ -45,11 +56,15 @@ Getting Started
* If you have questions, check out `#grav` on irc.freenode.net
* Have fun!
Exploring more
==============
# Exploring more
* Have a look at our [Basic Tutorial](http://learn.getgrav.org/basics/basic-tutorial)
* Dive into more [advanced](http://learn.getgrav.org/advanced) functions
License
=======
# License
See [LICENSE](LICENSE)
[gitflow-model]: http://nvie.com/posts/a-successful-git-branching-model/
[gitflow-extensions]: https://github.com/nvie/gitflow

View File

@ -2,7 +2,7 @@
namespace Grav\Common;
if (version_compare($ver = PHP_VERSION, $req = '5.4.0', '<')) {
throw new \RuntimeException(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
exit(sprintf('You are running PHP %s, but Grav needs at least <strong>PHP %s</strong> to run.', $ver, $req));
}
use Tracy\Debugger;

View File

@ -1,3 +1,12 @@
defaults:
type: file
thumb: media/thumb.png
mime: application/octet-stream
image:
filters:
default:
- enableProgressive
jpg:
type: image
thumb: media/thumb-jpg.png

View File

@ -26,10 +26,10 @@ cache:
prefix: 'g' # Cache prefix string (prevents cache conflicts)
twig:
cache: false # Set to true to enable twig caching
debug: true # Enable Twig debug
auto_reload: true # Refresh cache on changes
autoescape: false # Autoescape Twig vars
cache: true # Set to true to enable twig caching
debug: false # Enable Twig debug
auto_reload: true # Refresh cache on changes
autoescape: false # Autoescape Twig vars
assets: # Configuration for Assets Manager (JS, CSS)
css_pipeline: false # The CSS pipeline is the unification of multiple CSS resources into one file
@ -39,8 +39,9 @@ assets: # Configuration for Assets Manager (JS,
js_minify: true # Minify the JS during pipelining
debugger:
enabled: true # Enable Grav debugger
max_depth: 10 # How many nested levels to display for objects or arrays
enabled: false # Enable Grav debugger and following settings
strict: false # Throw fatal error also on PHP warnings and notices
max_depth: 10 # How many nested levels to display for objects or arrays
log:
enabled: true # Enable logging
timing: false # Enable timing logging
enabled: true # Enable logging
timing: false # Enable timing logging

View File

@ -85,7 +85,7 @@ class Config extends General
}
$vars = implode("\n", $vars);
return "<?php\nnamespace Grav;\n\nclass Config extends \\Grav\\Common\\Config {\n {$vars}\n}";
return "<?php\nnamespace Grav;\n\nclass Config extends \\Grav\\Common\\Config {\n {$vars}\n}";
}
/**

View File

@ -149,7 +149,7 @@ class General implements FileInterface
$this->handle = fopen($this->filename, 'wb+');
}
$lock = $block ? LOCK_EX : LOCK_EX | LOCK_NB;
return $this->locked = flock($this->handle, $lock);
return $this->locked = $this->handle ? flock($this->handle, $lock) : false;
}
/**

View File

@ -36,7 +36,7 @@ abstract class Getters implements \ArrayAccess, \Countable
*/
public function __get($offset)
{
return $this->offsetGet($offset);
return $this->offsetGet($offset);
}
/**

View File

@ -12,10 +12,10 @@ use \Grav\Common\Page\Pages;
* @author Andy Miller
* @link http://www.rockettheme.com
* @license http://opensource.org/licenses/MIT
* @version 0.1
* @version 0.8.0
*
* Originally based on Pico by Gilbert Pellegrom - http://pico.dev7studios.com
* Influeced by Pico, Stacey, Kirby, PieCrust and other great platforms...
* Influenced by Pico, Stacey, Kirby, PieCrust and other great platforms...
*
* @property Plugins $plugins
* @property Config $config
@ -92,6 +92,10 @@ class Grav extends Getters
// Switch debugger into development mode if configured
if ($this->config->get('system.debugger.enabled')) {
if ($this->config->get('system.debugger.strict')) {
Debugger::$strictMode = true;
}
if (function_exists('ini_set')) {
ini_set('display_errors', true);
}

View File

@ -85,6 +85,9 @@ class Media extends Getters
}
$filePath = $this->path . '/' . $filename;
// Add default settings for undefined variables.
$params += $config->get('media.defaults');
$params += array(
'type' => 'file',
'thumb' => 'media/thumb.png',

View File

@ -492,7 +492,7 @@ class Pages
$child = isset($this->instances[$key]) ? $this->instances[$key] : null;
if (!$child) {
throw new \RuntimeException("Page does not exist: {$key}");
throw new \RuntimeException("Page does not exist: {$key}");
}
switch ($order_by) {

View File

@ -79,7 +79,7 @@ class Session implements \IteratorAggregate
$this->started = true;
return $this;
}
}
/**
* Get session ID

View File

@ -16,7 +16,7 @@ class Themes
*
* @return array|Data\Data[]
*/
static public function all()
public static function all()
{
$list = array();
$iterator = new \DirectoryIterator(THEMES_DIR);
@ -43,7 +43,7 @@ class Themes
* @return Data\Data
* @throws \RuntimeException
*/
static public function get($type)
public static function get($type)
{
if (!$type) {
throw new \RuntimeException('Theme name not provided.');

View File

@ -239,7 +239,12 @@ class Twig
// Get Twig template layout
$template = $this->template($page->template() . $ext);
$output = $this->twig->render($template, $twig_vars);
try {
$output = $this->twig->render($template, $twig_vars);
} catch (\Twig_Error_Loader $e) {
throw new \RuntimeException('Resource not found.', 404, $e);
}
return $output;
}

View File

@ -15,7 +15,7 @@ abstract class Authentication
* @param string $password Plaintext password.
* @return string|bool
*/
static public function create($password)
public static function create($password)
{
return password_hash($password, PASSWORD_DEFAULT);
}
@ -27,7 +27,7 @@ abstract class Authentication
* @param string $hash Hash to verify against.
* @return int Returns 0 if the check fails, 1 if password matches, 2 if hash needs to be updated.
*/
static public function verify($password, $hash)
public static function verify($password, $hash)
{
// Always accept plaintext passwords (needs an update).
// FIXME: not safe to do this...

View File

@ -72,7 +72,7 @@ abstract class Utils
// delete tag from $open_tags list
$pos = array_search($tag_matchings[1], $open_tags);
if ($pos !== false) {
unset($open_tags[$pos]);
unset($open_tags[$pos]);
}
// if tag is an opening tag
} else if (preg_match('/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
@ -102,14 +102,14 @@ abstract class Utils
}
}
$truncate .= substr($line_matchings[2], 0, $left+$entities_length);
// maximum lenght is reached, so get off the loop
// maximum length is reached, so get off the loop
break;
} else {
$truncate .= $line_matchings[2];
$total_length += $content_length;
}
// if the maximum length is reached, get off the loop
if($total_length>= $length) {
if ($total_length >= $length) {
break;
}
}
@ -131,7 +131,7 @@ abstract class Utils
}
// add the defined ending to the text
$truncate .= $ending;
if($considerHtml) {
if ($considerHtml) {
// close all unclosed html-tags
foreach ($open_tags as $tag) {
$truncate .= '</' . $tag . '>';

View File

@ -81,7 +81,6 @@ EOT
// Copy the Core STuff
} else {
$options = true;
// Create Some core stuff if it doesn't exist
$this->createDirectories($output);

View File

@ -32,6 +32,7 @@ assets:
debugger:
enabled: true
strict: false
max_depth: 10
log:
enabled: false

View File

@ -3,6 +3,7 @@
<system.webServer>
<defaultDocument>
<files>
<remove value="index.php" />
<add value="index.php" />
</files>
</defaultDocument>