summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-03-10 15:55:05 +0100
committerAndreas Gohr <andi@splitbrain.org>2012-03-10 15:55:05 +0100
commit9189204ab4405b5698d7a4f13131a7a2d6e9d2fe (patch)
treee166daa0f6d5a260f2835273d0d18788cf50e1e1
parent50fbf1b6522a235e93ba72c50d0f54e09506604a (diff)
parente67004f5b686076af0dbf00cf574ac643d003cae (diff)
downloadrpg-9189204ab4405b5698d7a4f13131a7a2d6e9d2fe.tar.gz
rpg-9189204ab4405b5698d7a4f13131a7a2d6e9d2fe.tar.bz2
Merge branch 'jscachekey'
* jscachekey: trigger JS_CACHE_USE in lib/exe/js.php added INIT_LANG_LOAD event let js.php use multiple caches
-rw-r--r--inc/init.php28
-rw-r--r--lib/exe/js.php8
2 files changed, 22 insertions, 14 deletions
diff --git a/inc/init.php b/inc/init.php
index 3aab0587b..cfd023e95 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -69,16 +69,6 @@ foreach (array('default','local','protected') as $config_group) {
}
}
-//prepare language array
-global $lang;
-$lang = array();
-
-//load the language files
-require_once(DOKU_INC.'inc/lang/en/lang.php');
-if ( $conf['lang'] && $conf['lang'] != 'en' ) {
- require_once(DOKU_INC.'inc/lang/'.$conf['lang'].'/lang.php');
-}
-
//prepare license array()
global $license;
$license = array();
@@ -214,6 +204,10 @@ $plugin_controller = new $plugin_controller_class();
global $EVENT_HANDLER;
$EVENT_HANDLER = new Doku_Event_Handler();
+$local = $conf['lang'];
+trigger_event('INIT_LANG_LOAD', $local, 'init_lang', true);
+
+
// setup authentication system
if (!defined('NOSESSION')) {
auth_setup();
@@ -256,6 +250,20 @@ function init_paths(){
$conf['media_changelog'] = $conf['metadir'].'/_media.changes';
}
+function init_lang($langCode) {
+ //prepare language array
+ global $lang;
+ $lang = array();
+
+ //load the language files
+ require_once(DOKU_INC.'inc/lang/en/lang.php');
+ if ($langCode && $langCode != 'en') {
+ if (file_exists(DOKU_INC."inc/lang/$langCode/lang.php")) {
+ require_once(DOKU_INC."inc/lang/$langCode/lang.php");
+ }
+ }
+}
+
/**
* Checks the existance of certain files and creates them if missing.
*/
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 963eebd5f..4b72014b2 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -32,8 +32,8 @@ function js_out(){
global $config_cascade;
// The generated script depends on some dynamic options
- $cache = new cache('scripts'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],
- '.js');
+ $cache = new cache('scripts'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'],'.js');
+ $cache->_event = 'JS_CACHE_USE';
// load minified version for some files
$min = $conf['compress'] ? '.min' : '';
@@ -79,8 +79,8 @@ function js_out(){
// check cache age & handle conditional request
// This may exit if a cache can be used
- http_cached($cache->cache,
- $cache->useCache(array('files' => $cache_files)));
+ $cache_ok = $cache->useCache(array('files' => $cache_files));
+ http_cached($cache->cache, $cache_ok);
// start output buffering and build the script
ob_start();