From 83d3173a96fda542f7bb3680a5fb3805956168a1 Mon Sep 17 00:00:00 2001 From: Ryan Matthew Pierson Date: Wed, 13 Aug 2014 14:13:14 -0500 Subject: [PATCH 01/10] Update README.md --- README.md | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5300e5454..a6dbf236e 100644 --- a/README.md +++ b/README.md @@ -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,8 @@ 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 -=============== +# 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 +43,11 @@ 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) From ab868a4c1357e1840be054ae49a94331d5d403a7 Mon Sep 17 00:00:00 2001 From: Jelle Kok Date: Thu, 14 Aug 2014 20:49:29 +0200 Subject: [PATCH 02/10] Fix: error 500 When you have already set index.php as default, you get a error 500. So first you need to remove it then add it again. This is solving the error 500. --- web.config | 1 + 1 file changed, 1 insertion(+) diff --git a/web.config b/web.config index 8083c163f..72a041f63 100755 --- a/web.config +++ b/web.config @@ -3,6 +3,7 @@ + From 7612cee9d61f95b0e54d7e0267a5d1b4b609039a Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 14:17:14 +0300 Subject: [PATCH 03/10] Make images progressive by default --- system/config/media.yaml | 9 +++++++++ system/src/Grav/Common/Page/Media.php | 3 +++ 2 files changed, 12 insertions(+) diff --git a/system/config/media.yaml b/system/config/media.yaml index 0e8b592fa..40385268e 100644 --- a/system/config/media.yaml +++ b/system/config/media.yaml @@ -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 diff --git a/system/src/Grav/Common/Page/Media.php b/system/src/Grav/Common/Page/Media.php index cf210a389..4dcddc78f 100644 --- a/system/src/Grav/Common/Page/Media.php +++ b/system/src/Grav/Common/Page/Media.php @@ -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', From fee951813442c8d2c21b10021e5e268d5cd7e383 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 14:37:44 +0300 Subject: [PATCH 04/10] Update system default settings to be more suitable for production --- system/config/system.yaml | 17 +++++++++-------- system/src/Grav/Common/Grav.php | 6 +++++- user/config/system.yaml | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/system/config/system.yaml b/system/config/system.yaml index 67ca278f4..ac6e23c54 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -26,14 +26,15 @@ 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 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 diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index f224cf7ae..454e5fb98 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -12,7 +12,7 @@ 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... @@ -84,6 +84,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); } diff --git a/user/config/system.yaml b/user/config/system.yaml index e05c34ba0..d2fe4567d 100644 --- a/user/config/system.yaml +++ b/user/config/system.yaml @@ -25,6 +25,7 @@ twig: debugger: enabled: true + strict: false max_depth: 10 log: enabled: false From 0c0cc03394d2b900b17ee4df64371afa769a7a30 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 14:47:10 +0300 Subject: [PATCH 05/10] Exit instead of throwing exception when PHP < 5.4.0 --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index df77bbadc..02a6a352a 100644 --- a/index.php +++ b/index.php @@ -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 PHP %s to run.', $ver, $req)); + exit(sprintf('You are running PHP %s, but Grav needs at least PHP %s to run.', $ver, $req)); } use Tracy\Debugger; From ec8c3d9e602a669ff128f4e68045a7fe56537d3f Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 14:47:48 +0300 Subject: [PATCH 06/10] Better error message when template file isn't found --- system/src/Grav/Common/Twig.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Twig.php b/system/src/Grav/Common/Twig.php index d694ca160..f0c88bf5c 100644 --- a/system/src/Grav/Common/Twig.php +++ b/system/src/Grav/Common/Twig.php @@ -233,7 +233,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; } From 9ed16512fe39b88e0311b239662488c809e7ce98 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Fri, 15 Aug 2014 15:07:48 +0300 Subject: [PATCH 07/10] Fix PHP warning on locking without file handle --- system/src/Grav/Common/Filesystem/File/General.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Filesystem/File/General.php b/system/src/Grav/Common/Filesystem/File/General.php index 91fbb66c7..838c5e54d 100644 --- a/system/src/Grav/Common/Filesystem/File/General.php +++ b/system/src/Grav/Common/Filesystem/File/General.php @@ -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; } /** From ae2b6e1f74de53e735ec738c25c4bcac014decc8 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Fri, 15 Aug 2014 13:26:02 -0700 Subject: [PATCH 08/10] Added Contributing section --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index a6dbf236e..1b60079eb 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,19 @@ 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. +# 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 aren't 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 won't 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) @@ -51,3 +64,7 @@ Check out the [install procedures](http://learn.getgrav.org/basics/installation) # License See [LICENSE](LICENSE) + + +[gitflow-model]: http://nvie.com/posts/a-successful-git-branching-model/ +[gitflow-extensions]: https://github.com/nvie/gitflow \ No newline at end of file From 69ca8bc93443824b905e34ba9e979ce77fd0ed3e Mon Sep 17 00:00:00 2001 From: Ryan Matthew Pierson Date: Fri, 15 Aug 2014 15:31:49 -0500 Subject: [PATCH 09/10] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1b60079eb..5aceb9548 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,13 @@ Check out the [install procedures](http://learn.getgrav.org/basics/installation) 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 aren't familiar with it, there are several guides and tutorials to make you understand what it is about. +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 won't consider pull-requests made to the `master`. +- 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 @@ -67,4 +67,4 @@ See [LICENSE](LICENSE) [gitflow-model]: http://nvie.com/posts/a-successful-git-branching-model/ -[gitflow-extensions]: https://github.com/nvie/gitflow \ No newline at end of file +[gitflow-extensions]: https://github.com/nvie/gitflow From 41aadf25ed045cce3e2928e9dd39cf1b39014342 Mon Sep 17 00:00:00 2001 From: Pascal Borreli Date: Sun, 17 Aug 2014 20:29:40 +0100 Subject: [PATCH 10/10] Fixed typos/CS --- system/src/Grav/Common/Filesystem/File/Config.php | 2 +- system/src/Grav/Common/Getters.php | 2 +- system/src/Grav/Common/Grav.php | 2 +- system/src/Grav/Common/Page/Pages.php | 2 +- system/src/Grav/Common/Session/Session.php | 2 +- system/src/Grav/Common/Themes.php | 4 ++-- system/src/Grav/Common/User/Authentication.php | 4 ++-- system/src/Grav/Common/Utils.php | 8 ++++---- system/src/Grav/Console/SetupCommand.php | 1 - 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/system/src/Grav/Common/Filesystem/File/Config.php b/system/src/Grav/Common/Filesystem/File/Config.php index d697b1f65..c54f76c73 100644 --- a/system/src/Grav/Common/Filesystem/File/Config.php +++ b/system/src/Grav/Common/Filesystem/File/Config.php @@ -85,7 +85,7 @@ class Config extends General } $vars = implode("\n", $vars); - return "offsetGet($offset); + return $this->offsetGet($offset); } /** diff --git a/system/src/Grav/Common/Grav.php b/system/src/Grav/Common/Grav.php index 454e5fb98..80c7b19d3 100644 --- a/system/src/Grav/Common/Grav.php +++ b/system/src/Grav/Common/Grav.php @@ -15,7 +15,7 @@ use \Grav\Common\Page\Pages; * @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 diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 2de156167..eaca62eb8 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -489,7 +489,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) { diff --git a/system/src/Grav/Common/Session/Session.php b/system/src/Grav/Common/Session/Session.php index 0fe34d7f9..2f6596cbb 100644 --- a/system/src/Grav/Common/Session/Session.php +++ b/system/src/Grav/Common/Session/Session.php @@ -79,7 +79,7 @@ class Session implements \IteratorAggregate $this->started = true; return $this; - } + } /** * Get session ID diff --git a/system/src/Grav/Common/Themes.php b/system/src/Grav/Common/Themes.php index f21e8faac..72835e4a3 100644 --- a/system/src/Grav/Common/Themes.php +++ b/system/src/Grav/Common/Themes.php @@ -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.'); diff --git a/system/src/Grav/Common/User/Authentication.php b/system/src/Grav/Common/User/Authentication.php index 3a7af6d8f..265cac8fc 100644 --- a/system/src/Grav/Common/User/Authentication.php +++ b/system/src/Grav/Common/User/Authentication.php @@ -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... diff --git a/system/src/Grav/Common/Utils.php b/system/src/Grav/Common/Utils.php index 09e564ebd..068c6b20e 100644 --- a/system/src/Grav/Common/Utils.php +++ b/system/src/Grav/Common/Utils.php @@ -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 .= ''; diff --git a/system/src/Grav/Console/SetupCommand.php b/system/src/Grav/Console/SetupCommand.php index 41ba7c17e..4ad1c3516 100644 --- a/system/src/Grav/Console/SetupCommand.php +++ b/system/src/Grav/Console/SetupCommand.php @@ -86,7 +86,6 @@ EOT // Copy the Core STuff } else { - $options = true; // Create Some core stuff if it doesn't exist $this->createDirectories($output);