Clean up options documentation, order.

This commit is contained in:
Justin Hileman
2012-11-28 20:28:03 -08:00
parent 1792140afa
commit 2e97db3fc0
+13 -13
View File
@@ -47,13 +47,17 @@ class Mustache_Engine
* Passing an $options array allows overriding certain Mustache options during instantiation: * Passing an $options array allows overriding certain Mustache options during instantiation:
* *
* $options = array( * $options = array(
* // The class prefix for compiled templates. Defaults to '__Mustache_' * // The class prefix for compiled templates. Defaults to '__Mustache_'.
* 'template_class_prefix' => '__MyTemplates_', * 'template_class_prefix' => '__MyTemplates_',
* *
* // A cache directory for compiled templates. Mustache will not cache templates unless this is set * // A cache directory for compiled templates. Mustache will not cache templates unless this is set
* 'cache' => dirname(__FILE__).'/tmp/cache/mustache', * 'cache' => dirname(__FILE__).'/tmp/cache/mustache',
* *
* // A Mustache template loader instance. Uses a StringLoader if not specified * // Override default permissions for cache files. Defaults to using the system-defined umask. It is
* // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
* 'cache_file_mode' => 0666,
*
* // A Mustache template loader instance. Uses a StringLoader if not specified.
* 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'), * 'loader' => new Mustache_Loader_FilesystemLoader(dirname(__FILE__).'/views'),
* *
* // A Mustache loader instance for partials. * // A Mustache loader instance for partials.
@@ -67,20 +71,16 @@ class Mustache_Engine
* // sections), or any other valid Mustache context value. They will be prepended to the context stack, * // sections), or any other valid Mustache context value. They will be prepended to the context stack,
* // so they will be available in any template loaded by this Mustache instance. * // so they will be available in any template loaded by this Mustache instance.
* 'helpers' => array('i18n' => function($text) { * 'helpers' => array('i18n' => function($text) {
* // do something translatey here... * // do something translatey here...
* }), * }),
* *
* // An 'escape' callback, responsible for escaping double-mustache variables. * // An 'escape' callback, responsible for escaping double-mustache variables.
* 'escape' => function($value) { * 'escape' => function($value) {
* return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8'); * return htmlspecialchars($buffer, ENT_COMPAT, 'UTF-8');
* }, * },
* *
* // Character set for `htmlspecialchars`. Defaults to 'UTF-8' * // Character set for `htmlspecialchars`. Defaults to 'UTF-8'. Use 'UTF-8'.
* 'charset' => 'ISO-8859-1', * 'charset' => 'ISO-8859-1',
*
* // Override default permissions for cache files. Defaults to using the system-defined umask. It is
* // *strongly* recommended that you configure your umask properly rather than overriding permissions here.
* 'cache_file_mode' => 0666,
* ); * );
* *
* @param array $options (default: array()) * @param array $options (default: array())
@@ -95,6 +95,10 @@ class Mustache_Engine
$this->cache = $options['cache']; $this->cache = $options['cache'];
} }
if (isset($options['cache_file_mode'])) {
$this->cacheFileMode = $options['cache_file_mode'];
}
if (isset($options['loader'])) { if (isset($options['loader'])) {
$this->setLoader($options['loader']); $this->setLoader($options['loader']);
} }
@@ -122,10 +126,6 @@ class Mustache_Engine
if (isset($options['charset'])) { if (isset($options['charset'])) {
$this->charset = $options['charset']; $this->charset = $options['charset'];
} }
if (isset($options['cache_file_mode'])) {
$this->cacheFileMode = $options['cache_file_mode'];
}
} }
/** /**