From 7bfebeba76b7e0c9ca0abe86bce1c8b7f5968fac Mon Sep 17 00:00:00 2001 From: Jeffrey Frey Date: Wed, 10 May 2017 15:43:18 -0400 Subject: [PATCH 1/2] bootstrap3_metaheaders(): add .css and .js resources from assets/local (if present) --- tpl_functions.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tpl_functions.php b/tpl_functions.php index 054734ee..1c8043dd 100755 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -1589,6 +1589,26 @@ function bootstrap3_metaheaders(Doku_Event &$event, $param) { 'type' => 'text/javascript', 'src' => tpl_basedir() . 'assets/anchorjs/anchor.min.js'); + // If there's a "local" directory in the "assets" directory, then + // look for .css and .js files to add: + if ( is_dir(tpl_incdir() . 'assets/local') ) { + if ( ($dirH = opendir(tpl_incdir() . 'assets/local')) ) { + while ( ($fname = readdir($dirH)) !== false ) { + if ( substr_compare($fname, '.css', -4, 4) == 0 ) { + $event->data['link'][] = array( + 'type' => 'text/css', + 'rel' => 'stylesheet', + 'href' => tpl_basedir() . 'assets/local/' . $fname); + } + else if ( substr_compare($fname, '.js', -3, 3) == 0 ) { + $event->data['script'][] = array( + 'type' => 'text/javascript', + 'src' => tpl_basedir() . 'assets/local/' . $fname); + } + } + } + } + // Apply some FIX if ($ACT || defined('DOKU_MEDIADETAIL')) { From e310d8b9e4de55f02552fd764bb12f21a5d71458 Mon Sep 17 00:00:00 2001 From: Jeffrey Frey Date: Wed, 10 May 2017 15:45:13 -0400 Subject: [PATCH 2/2] Forgot a closedir() on opened directory handle --- tpl_functions.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tpl_functions.php b/tpl_functions.php index 1c8043dd..72dbc31c 100755 --- a/tpl_functions.php +++ b/tpl_functions.php @@ -1606,6 +1606,7 @@ function bootstrap3_metaheaders(Doku_Event &$event, $param) { 'src' => tpl_basedir() . 'assets/local/' . $fname); } } + closedir($dirH); } }