Compare commits
4 commits
c346252f55
...
4f46c38643
Author | SHA1 | Date | |
---|---|---|---|
|
4f46c38643 | ||
|
7e8b6ee5f2 | ||
|
eea359056b | ||
|
765844bee9 |
7 changed files with 51 additions and 9 deletions
|
@ -95,8 +95,8 @@ templates:
|
||||||
# Translations
|
# Translations
|
||||||
#
|
#
|
||||||
i18n:
|
i18n:
|
||||||
# Default locale (see locales directory for available languages list)
|
# Default locale (see locales directory for available languages list, default: 'en_US.UTF8')
|
||||||
default_locale: 'en_US.UTF8'
|
#default_locale: 'en_US.UTF8'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Session
|
# Session
|
||||||
|
@ -302,6 +302,6 @@ email:
|
||||||
catch_all: false
|
catch_all: false
|
||||||
|
|
||||||
# Web Stats JS code
|
# Web Stats JS code
|
||||||
webstats_js_code: ''
|
#webstats_js_code: ''
|
||||||
|
|
||||||
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
|
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
|
||||||
|
|
|
@ -38,6 +38,12 @@ App::init(
|
||||||
"$root_dir_path/static"
|
"$root_dir_path/static"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'default' => array(
|
||||||
|
'upload_max_filesize' => 10485760,
|
||||||
|
'i18n' => array(
|
||||||
|
'default_locale' => "en_US.UTF8",
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
$root_dir_path
|
$root_dir_path
|
||||||
);
|
);
|
||||||
|
|
|
@ -30,9 +30,6 @@ function define_common_template_variables($event) {
|
||||||
$status_list:array()
|
$status_list:array()
|
||||||
);
|
);
|
||||||
Tpl :: assign('admin', isset($admin) && $admin);
|
Tpl :: assign('admin', isset($admin) && $admin);
|
||||||
Tpl :: assign(
|
|
||||||
'webstats_js_code',
|
|
||||||
App::get('webstats_js_code', null, 'string'));
|
|
||||||
}
|
}
|
||||||
Hook :: register('before_displaying_template', 'define_common_template_variables');
|
Hook :: register('before_displaying_template', 'define_common_template_variables');
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,6 @@ email:
|
||||||
catch_all: false
|
catch_all: false
|
||||||
|
|
||||||
# Web Stats JS code
|
# Web Stats JS code
|
||||||
webstats_js_code: ''
|
#webstats_js_code: ''
|
||||||
|
|
||||||
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
|
# vim: tabstop=2 shiftwidth=2 softtabstop=2 expandtab
|
||||||
|
|
|
@ -38,6 +38,9 @@ App::init(
|
||||||
"$root_dir_path/static"
|
"$root_dir_path/static"
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'default' => array(
|
||||||
|
// Set here your configuration parameters default value
|
||||||
|
),
|
||||||
),
|
),
|
||||||
$root_dir_path
|
$root_dir_path
|
||||||
);
|
);
|
||||||
|
|
29
src/App.php
29
src/App.php
|
@ -95,10 +95,9 @@ class App {
|
||||||
* Check if a specific configuration variable is set
|
* Check if a specific configuration variable is set
|
||||||
*
|
*
|
||||||
* @param string $key The configuration variable key
|
* @param string $key The configuration variable key
|
||||||
* @param array|null $config Optional configuration to use instead of current loaded configuration
|
|
||||||
* @return bool
|
* @return bool
|
||||||
**/
|
**/
|
||||||
public static function isset($key, &$config=null) {
|
public static function isset($key) {
|
||||||
return Config::isset($key, self :: $options) || (Config::loaded() && Config::isset($key));
|
return Config::isset($key, self :: $options) || (Config::loaded() && Config::isset($key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,6 +115,7 @@ class App {
|
||||||
* @return mixed The configuration variable value
|
* @return mixed The configuration variable value
|
||||||
**/
|
**/
|
||||||
public static function get($key, $default=null, $cast=null, $split=true) {
|
public static function get($key, $default=null, $cast=null, $split=true) {
|
||||||
|
$default = self :: get_default($key, $default, $cast, $split);
|
||||||
return Config::get(
|
return Config::get(
|
||||||
$key,
|
$key,
|
||||||
Config::loaded()?Config::get($key, $default, $cast, $split):$default,
|
Config::loaded()?Config::get($key, $default, $cast, $split):$default,
|
||||||
|
@ -125,6 +125,31 @@ class App {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a specific option default value
|
||||||
|
*
|
||||||
|
* @param string $key The configuration variable key
|
||||||
|
* @param mixed $default Default value provided by context
|
||||||
|
* (optional, priority if not nul, default : null)
|
||||||
|
* @param string $cast The type of expected value. The configuration variable
|
||||||
|
* default value will be cast as this type. Could be : bool, int,
|
||||||
|
* float or string. (Optional, default : raw value)
|
||||||
|
* @param bool $split If true, $cast is 'array' and value retreived from configuration
|
||||||
|
* is a string, split the value by comma (optional, default: true)
|
||||||
|
* @return mixed The configuration variable default value
|
||||||
|
**/
|
||||||
|
public static function get_default($key, $default=null, $cast=null, $split=true) {
|
||||||
|
if (!is_null($default))
|
||||||
|
return $default;
|
||||||
|
return Config::get(
|
||||||
|
"default.$key",
|
||||||
|
$default,
|
||||||
|
$cast,
|
||||||
|
$split,
|
||||||
|
self :: $options
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a specific option value
|
* Set a specific option value
|
||||||
*
|
*
|
||||||
|
|
11
src/Tpl.php
11
src/Tpl.php
|
@ -380,6 +380,17 @@ class Tpl {
|
||||||
// Authenticated user info
|
// Authenticated user info
|
||||||
if (Auth::user())
|
if (Auth::user())
|
||||||
self :: assign('auth_user', Auth::user());
|
self :: assign('auth_user', Auth::user());
|
||||||
|
|
||||||
|
// Webstats JS code
|
||||||
|
Tpl :: assign(
|
||||||
|
'webstats_js_code',
|
||||||
|
App::get('webstats_js_code', null, 'string'));
|
||||||
|
|
||||||
|
// Upload max size
|
||||||
|
if (App::get('upload_max_filesize', null, 'int'))
|
||||||
|
Tpl :: assign(
|
||||||
|
'upload_max_filesize',
|
||||||
|
App::get('upload_max_filesize', null, 'int'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue