From facbd4f23620b0e7c58c551013cdb2d9209aef65 Mon Sep 17 00:00:00 2001 From: Cameron <e107inc@gmail.com> Date: Fri, 27 Jun 2014 20:05:01 -0700 Subject: [PATCH] Raw html as inline code (often used by google/bing analytics) now supported by js manager. eg. Inside a plugin's e_header.php : e107::js('footer-inline', '<script>...</script><iframe>...</iframe>'); --- e107_handlers/js_manager.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/e107_handlers/js_manager.php b/e107_handlers/js_manager.php index 800549008..dd5e68437 100644 --- a/e107_handlers/js_manager.php +++ b/e107_handlers/js_manager.php @@ -1237,6 +1237,28 @@ class e_jsmanager $content_array = array_unique($content_array); //TODO quick fix, we need better control! echo "\n"; + $raw = array(); + + if($type == 'js') // support for raw html as inline code. (eg. google/bing/yahoo analytics) + { + $script = array(); + foreach($content_array as $code) + { + $start = substr($code,0,7); + if($start == '<script' || $start == '<iframe') + { + $raw[] = $code; + } + else + { + $script[] = $code; + } + } + + $content_array = $script; + } + + switch ($type) { case 'js': @@ -1250,6 +1272,16 @@ class e_jsmanager echo "\n//]]>\n"; echo '</script>'; echo "\n"; + + if(!empty($raw)) + { + if($label) //TODO - print comments only if site debug is on + { + echo "\n<!-- [JSManager] (Raw) ".$label." -->\n"; + } + echo implode("\n\n", $raw); + echo "\n\n"; + } break; case 'css':