Allow to load non-local templates

This commit is contained in:
Olav Schettler
2016-07-30 22:38:07 -07:00
committed by Justin Hileman
parent 6f6e3b9ddb
commit fee4544785
+2 -2
View File
@@ -52,11 +52,11 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
if (strpos($this->baseDir, '://') === false) { if (strpos($this->baseDir, '://') === false) {
$this->baseDir = realpath($this->baseDir); $this->baseDir = realpath($this->baseDir);
}
if (!is_dir($this->baseDir)) { if (!is_dir($this->baseDir)) {
throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir)); throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
} }
}
if (array_key_exists('extension', $options)) { if (array_key_exists('extension', $options)) {
if (empty($options['extension'])) { if (empty($options['extension'])) {
@@ -99,7 +99,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
{ {
$fileName = $this->getFileName($name); $fileName = $this->getFileName($name);
if (!file_exists($fileName)) { if (strpos($this->baseDir, '://') === false && !file_exists($fileName)) {
throw new Mustache_Exception_UnknownTemplateException($name); throw new Mustache_Exception_UnknownTemplateException($name);
} }