Merge branch 'develop' into feature/vendor_free

This commit is contained in:
Djamil Legato
2014-09-02 11:02:32 -07:00
6 changed files with 42 additions and 20 deletions

View File

@@ -1,7 +1,5 @@
<IfModule mod_rewrite.c>
Options -Multiviews
RewriteEngine On
##

View File

@@ -5,21 +5,20 @@ schemes:
- user/plugins
- system/plugins
# asset:
# type: ReadOnlyStream
# paths:
# - assets
asset:
type: ReadOnlyStream
paths:
- assets
# cache:
# type: ReadOnlyStream
# paths:
# - cache
# log:
# type: ReadOnlyStream
# paths:
# - logs
cache:
type: ReadOnlyStream
paths:
- cache
log:
type: ReadOnlyStream
paths:
- logs
user:
type: ReadOnlyStream

View File

@@ -112,7 +112,7 @@ class Themes
/** @var ResourceLocator $locator */
$locator = $grav['locator'];
$file = $locator("theme://{$name}.php");
$file = $locator("theme://theme.php") ?: $locator("theme://{$name}.php");
if ($file) {
// Local variables available in the file: $grav, $config, $name, $path, $file
$class = include $file;

View File

@@ -2,6 +2,7 @@
namespace Grav\Common;
use \Grav\Common\Page\Page;
use Grav\Component\Filesystem\ResourceLocator;
/**
* The Twig object handles all the Twig template rendering for Grav. It's a singleton object
@@ -66,8 +67,10 @@ class Twig
if (!isset($this->twig)) {
/** @var Config $config */
$config = $this->grav['config'];
/** @var ResourceLocator $locator */
$locator = $this->grav['locator'];
$this->twig_paths = array(THEMES_DIR . $config->get('system.pages.theme') . '/templates');
$this->twig_paths = $locator->findResources('theme://templates');
$this->grav->fireEvent('onTwigTemplatePaths');
$this->loader = new \Twig_Loader_Filesystem($this->twig_paths);
@@ -76,7 +79,7 @@ class Twig
$params = $config->get('system.twig');
if (!empty($params['cache'])) {
$params['cache'] = CACHE_DIR;
$params['cache'] = $locator->findResource('cache://');
}
$this->twig = new \Twig_Environment($loader_chain, $params);
@@ -106,7 +109,7 @@ class Twig
'base_dir' => rtrim(ROOT_DIR, '/'),
'base_url_absolute' => $baseUrlAbsolute,
'base_url_relative' => $baseUrlRelative,
'theme_dir' => THEMES_DIR . $theme,
'theme_dir' => $locator->findResource('theme://'),
'theme_url' => $themeUrl,
'site' => $config->get('site'),
'assets' => $this->grav['assets'],

View File

@@ -1,5 +1,6 @@
<?php
namespace Grav\Common;
use Grav\Component\Filesystem\ResourceLocator;
/**
* The Twig extension adds some filters and functions that are useful for Grav
@@ -44,7 +45,8 @@ class TwigExtension extends \Twig_Extension
public function getFunctions()
{
return array(
new \Twig_SimpleFunction('repeat', array($this, 'repeatFunc'))
new \Twig_SimpleFunction('repeat', array($this, 'repeatFunc')),
new \Twig_SimpleFunction('url', array($this, 'urlFunc'))
);
}
@@ -195,4 +197,22 @@ class TwigExtension extends \Twig_Extension
{
return str_repeat($input, $multiplier);
}
/**
* Return URL to the resource.
*
* @param string $input
* @param bool $domain
* @return string
*/
public function urlFunc($input, $domain = false)
{
$grav = Grav::instance();
/** @var ResourceLocator $locator */
$locator = $grav['locator'];
/** @var Uri $uri */
$uri = $grav['uri'];
return $uri->rootUrl($domain) . $locator->findResource($input, false);
}
}

View File

@@ -11,6 +11,8 @@ use Grav\Common\Data\Data;
*/
class User extends Data
{
protected $password;
/**
* Authenticate user.
*