Merge branch 'release/4.0.3'
This commit is contained in:
commit
e9b1c79f00
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
*.swp
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,3 +0,0 @@
|
|||
[submodule "vendor/mustache"]
|
||||
path = vendor/mustache
|
||||
url = git://github.com/bobthecow/mustache.php.git
|
|
@ -5,12 +5,14 @@
|
|||
* @package Kostache
|
||||
* @category Base
|
||||
* @author Jeremy Bush <jeremy.bush@kohanaframework.org>
|
||||
* @author Woody Gilk <woody.gilk@kohanaframework.org>
|
||||
* @copyright (c) 2010-2012 Jeremy Bush
|
||||
* @copyright (c) 2012-2014 Woody Gilk
|
||||
* @license MIT
|
||||
*/
|
||||
class Kohana_Kostache {
|
||||
|
||||
const VERSION = '4.0.0';
|
||||
const VERSION = '4.0.3';
|
||||
|
||||
protected $_engine;
|
||||
|
||||
|
@ -23,7 +25,7 @@ class Kohana_Kostache {
|
|||
'escape' => function($value) {
|
||||
return HTML::chars($value);
|
||||
},
|
||||
'cache' => APPPATH.'cache/mustache',
|
||||
'cache' => Kohana::$cache_dir.DIRECTORY_SEPARATOR.'mustache',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -40,11 +42,18 @@ class Kohana_Kostache {
|
|||
{
|
||||
if ($template == NULL)
|
||||
{
|
||||
$template = explode('_', get_class($class));
|
||||
array_shift($template);
|
||||
$template = implode('/', $template);
|
||||
$template = $this->_detect_template_path($class);
|
||||
}
|
||||
|
||||
return $this->_engine->loadTemplate($template)->render($class);
|
||||
}
|
||||
|
||||
protected function _detect_template_path($class)
|
||||
{
|
||||
$path = explode('_', get_class($class));
|
||||
array_shift($path);
|
||||
|
||||
return implode('/', $path);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,11 +34,13 @@ class Kohana_Kostache_Layout extends Kohana_Kostache {
|
|||
|
||||
public function render($class, $template = NULL)
|
||||
{
|
||||
$this->_engine->setPartials(
|
||||
array(
|
||||
Kostache_Layout::CONTENT_PARTIAL => parent::render($class, $template)
|
||||
)
|
||||
);
|
||||
$content = $this->_engine
|
||||
->getLoader()
|
||||
->load($this->_detect_template_path($class));
|
||||
|
||||
$this->_engine->setPartials(array(
|
||||
Kostache_Layout::CONTENT_PARTIAL => $content
|
||||
));
|
||||
|
||||
return $this->_engine->loadTemplate($this->_layout)->render($class);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class Mustache_Loader_Kohana implements Mustache_Loader, Mustache_Loader_Mutable
|
|||
|
||||
protected function _load_file($name)
|
||||
{
|
||||
$filename = Kohana::find_file($this->_base_dir, strtolower($name), $this->_extension);
|
||||
$filename = Kohana::find_file($this->_base_dir, $name = strtolower($name), $this->_extension);
|
||||
|
||||
if ( ! $filename)
|
||||
{
|
||||
|
|
25
composer.json
Normal file
25
composer.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "zombor/kostache",
|
||||
"description": "Logic-less View/Mustache Module for the Kohana Framework",
|
||||
"keywords": ["kohana", "mustache", "templating", "view"],
|
||||
"homepage": "https://github.com/zombor/KOstache",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jeremy Bush",
|
||||
"email": "jeremy.bush@kohanaframework.org"
|
||||
},
|
||||
{
|
||||
"name": "Woody Gilk",
|
||||
"email": "woody.gilk@kohanaframework.org"
|
||||
}
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/zombor/KOstache/issues",
|
||||
"source": "https://github.com/zombor/KOstache"
|
||||
},
|
||||
"require": {
|
||||
"mustache/mustache": "~2.6.0",
|
||||
"php": ">=5.3.0"
|
||||
}
|
||||
}
|
5
init.php
5
init.php
|
@ -1,5 +0,0 @@
|
|||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
// Load Mustache for PHP
|
||||
include Kohana::find_file('vendor', 'mustache/src/Mustache/Autoloader');
|
||||
Mustache_Autoloader::register();
|
1
vendor/mustache
vendored
1
vendor/mustache
vendored
|
@ -1 +0,0 @@
|
|||
Subproject commit d99be3444e5b2f0fb605941d7e692d3b5159360c
|
Loading…
Reference in a new issue