Skip to content

Commit

Permalink
Merge branch 'release/0.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
w00fz committed Aug 25, 2014
2 parents 83d3173 + 1e39c7d commit fbc7ca4
Show file tree
Hide file tree
Showing 200 changed files with 18,659 additions and 1,244 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ composer.lock
# Grav Specific
cache/*
!cache/.*
assets/*
!assets/.*
logs/*
!logs/.*
images/*
Expand Down
26 changes: 19 additions & 7 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,26 +1,38 @@
<IfModule mod_rewrite.c>

Options -Multiviews

RewriteEngine On

# access site
##
# If you are getting 404 errors on subpages, you may have to uncomment the RewriteBase entry
# You should change the '/' to your appropriate subfolder. For example if you have
# your Grav install at the root of your site '/' should work, else it might be something
# along the lines of: RewriteBase /<your_sub_folder>
##

# RewriteBase /

# Access site
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
RewriteRule .* index.php [L]

# block various user files from being accessed directly
# Block various user files from being accessed directly
RewriteRule ^user/accounts/(.*)$ error [R=301,L]
RewriteRule ^user/config/(.*)$ error [R=301,L]
RewriteRule ^user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ error [R=301,L]

# block cache
# Block cache/
RewriteRule ^cache/(.*) error [R=301,L]

# block bin
# Block bin/
RewriteRule ^bin/(.*)$ error [R=301,L]

# block system
# Block system/
RewriteRule ^system/(.*)$ error [R=301,L]

# block vendor
# Block vendor/
RewriteRule ^vendor/(.*)$ error [R=301,L]

</IfModule>
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 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)
Expand All @@ -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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.0
0.9.0
Empty file added assets/.gitkeep
Empty file.
6 changes: 5 additions & 1 deletion bin/grav
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/usr/bin/env php
<?php

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

use Symfony\Component\Console\Application;

require_once(__DIR__ . '/../system/autoload.php');
require_once(__DIR__ . '/../vendor/autoload.php');

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
Expand Down
43 changes: 25 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
{
"name": "rhuk/grav",
"name": "getgrav/grav",
"type": "library",
"description": "Grav is a powerful flat CMS influenced by Pico, Stacey, Kirby and others...",
"keywords": ["cms"],
"description": "Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS",
"keywords": ["cms","flat-file cms","flat cms","flatfile cms","php"],
"homepage": "http://getgrav.org",
"license": "MIT",
"authors": [
{
"name": "Andy Miller",
"email": "[email protected]"
}
],
"require": {
"php": ">=5.3.10",
"twig/twig": "1.16.*@dev",
"erusev/parsedown": "dev-master",
"symfony/yaml": "2.5.*@dev",
"symfony/console": "2.5.*@dev",
"doctrine/cache": "1.4.*@dev",
"tracy/tracy": "dev-master",
"gregwar/image": "dev-master",
"ircmaxell/password-compat": "1.0.*"
"php": ">=5.4.0",
"twig/twig": "~1.16",
"erusev/parsedown-extra": "dev-master",
"symfony/yaml": "~2.5",
"symfony/console": "~2.5",
"symfony/event-dispatcher": "~2.5",
"doctrine/cache": "~1.3",
"tracy/tracy": "~2.2",
"gregwar/image": "~2.0",
"ircmaxell/password-compat": "1.0.*",
"mrclay/minify": "~2.2",
"donatj/phpuseragentparser": "dev-master",
"pimple/pimple": "~3.0"
},
"autoload": {
"psr-4": {
"Grav\\": "system/src/"
},
"files": ["system/defines.php"]
},
"archive": {
"exclude": ["VERSION"]
}
}
45 changes: 18 additions & 27 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
<?php
namespace Grav\Common;
namespace Grav;

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));
}
$autoload = __DIR__ . '/vendor/autoload.php';
if (!is_file($autoload)) {
exit('Please run: <i>composer install -o</i>');
}

use Tracy\Debugger;
use Grav\Common\Grav;
use Grav\Common\Debugger;

// Register system libraries to the auto-loader.
$loader = require_once __DIR__ . '/system/autoload.php';
// Register the auto-loader.
$loader = require_once $autoload;

if (!ini_get('date.timezone')) {
date_default_timezone_set('UTC');
}

// Use output buffering to prevent headers from being sent too early.
ob_start();

// Start the timer and enable debugger in production mode as we do not have system configuration yet.
// Debugger catches all errors and logs them, for example if the script doesn't have write permissions.
Debugger::timer();
Debugger::enable(Debugger::DEVELOPMENT, is_dir(LOG_DIR) ? LOG_DIR : null);

$grav = new Grav;
$grav = Grav::instance(
[
'loader' => $loader,
'debugger' => new Debugger(Debugger::PRODUCTION)
]
);

try {
// Register all the Grav bits into registry.
$registry = Registry::instance();
$registry->store('autoloader', $loader);
$registry->store('Grav', $grav);
$registry->store('Uri', new Uri);
$registry->store('Config', Config::instance(CACHE_DIR . 'config.php'));
$registry->store('Cache', new Cache);
$registry->store('Twig', new Twig);
$registry->store('Pages', new Page\Pages);
$registry->store('Taxonomy', new Taxonomy);

$grav['debugger']->init();
$grav->process();

} catch (\Exception $e) {
$grav->fireEvent('onFatalException', $e);
$grav->fireEvent('onFatalException');
throw $e;
}

ob_end_flush();
8 changes: 0 additions & 8 deletions system/autoload.php

This file was deleted.

9 changes: 9 additions & 0 deletions system/config/media.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
36 changes: 36 additions & 0 deletions system/config/streams.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
schemes:
plugin:
type: ReadOnlyStream
paths:
- user/plugins
- system/plugins

# asset:
# type: ReadOnlyStream
# paths:
# - assets

# cache:
# type: ReadOnlyStream
# paths:
# - cache

# log:
# type: ReadOnlyStream
# paths:
# - logs

page:
type: ReadOnlyStream
paths:
- user/pages

account:
type: ReadOnlyStream
paths:
- user/accounts

data:
type: ReadOnlyStream
paths:
- user/data
28 changes: 19 additions & 9 deletions system/config/system.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ home:

pages:
theme: antimatter # Default theme (defaults to "antimatter" theme)
markdown_extra: false # Enable support for Markdown Extra support (GFM by default)
order:
by: defaults # Order pages by "default", "alpha" or "date"
dir: asc # Default ordering direction, "asc" or "desc"
Expand All @@ -15,7 +16,7 @@ pages:
markdown: true # Process Markdown
twig: false # Process Twig
events:
page: false # Enable page level events
page: true # Enable page level events
twig: true # Enable twig level events

cache:
Expand All @@ -26,14 +27,23 @@ 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
css_minify: true # Minify the CSS during pipelining
css_rewrite: true # Rewrite any CSS relative URLs during pipelining
js_pipeline: false # The JS pipeline is the unification of multiple JS resources into one file
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
mode: detect # Mode tracy Debugger should be set to when enabled: detect|development|production
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
4 changes: 2 additions & 2 deletions 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.8.0');
define('GRAV_VERSION', '0.9.0');
define('DS', '/');

// Directories and Paths
Expand All @@ -12,6 +12,7 @@
define('USER_PATH', 'user/');
define('USER_DIR', ROOT_DIR . USER_PATH);
define('SYSTEM_DIR', ROOT_DIR .'system/');
define('ASSETS_DIR', ROOT_DIR . 'assets/');
define('CACHE_DIR', ROOT_DIR .'cache/');
define('IMAGES_DIR', ROOT_DIR . 'images/');
define('LOG_DIR', ROOT_DIR .'logs/');
Expand All @@ -20,7 +21,6 @@
define('ACCOUNTS_DIR', USER_DIR .'accounts/');
define('DATA_DIR', USER_DIR .'data/');
define('PAGES_DIR', USER_DIR .'pages/');
define('BLOCKS_DIR', USER_DIR .'blocks/');

define('PLUGINS_DIR', USER_DIR .'plugins/');
define('THEMES_DIR', USER_DIR .'themes/');
Expand Down
36 changes: 36 additions & 0 deletions system/src/Grav/Browser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace Grav\Common;

/**
* Simple wrapper for the very simple parse_user_agent() function
*/
class Browser {

protected $useragent;

public function __construct()
{
$this->useragent = parse_user_agent();
}

public function getBrowser()
{
return strtolower($this->useragent['browser']);
}

public function getPlatform()
{
return strtolower($this->useragent['platform']);
}

public function getLongVersion()
{
return $this->useragent['version'];
}

public function getVersion()
{
$version = explode('.', $this->getLongVersion());
return intval($version[0]);
}
}
Loading

0 comments on commit fbc7ca4

Please sign in to comment.