1 |
2
|
Manuela
|
<?php
|
2 |
|
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @param string $content
|
5 |
|
|
* @return string
|
6 |
|
|
*/
|
7 |
|
|
function doFilterScriptVars($content) {
|
8 |
|
|
$aFilterSettings = getOutputFilterSettings();
|
9 |
|
|
$key = preg_replace('=^.*?filter([^\.\/\\\\]+)(\.[^\.]+)?$=is', '\1', __FILE__);
|
10 |
|
|
if ($aFilterSettings[$key]) {
|
11 |
|
|
$scriptLink = '';
|
12 |
|
|
if( !preg_match('/<head.*<.*src=\".*\/domReady.js.*>.*<\/head/siU', $content) ) {
|
13 |
|
|
$scriptLink .= "\t".'<script src="'.WB_URL.'/include/jquery/domReady.js" type="text/javascript"></script>'."\n";
|
14 |
|
|
}
|
15 |
|
|
if (!preg_match('/<head.*<.*var WB_URL.*<\/head/siU', $content) ) {
|
16 |
|
|
$scriptLink .= "\t"."<script type=\"text/javascript\">\n"
|
17 |
|
|
."\t\t"."<!--\n"
|
18 |
|
|
."\t\t"."var URL = '".WB_URL."';\n"
|
19 |
|
|
."\t\t"."var WB_URL = '".WB_URL."';\n"
|
20 |
|
|
."\t\t"."var THEME_URL = '".THEME_URL."';\n"
|
21 |
|
|
."\t\t"."var TEMPLATE_DIR = '".TEMPLATE_DIR."';\n"
|
22 |
|
|
."\t\t"."var TEMPLATE = '".TEMPLATE."';\n"
|
23 |
|
|
."\t\t"."var EDITOR = '".WYSIWYG_EDITOR."';\n"
|
24 |
|
|
."\t\t"."-->\n"
|
25 |
|
|
."\t"."</script>\n";
|
26 |
|
|
}
|
27 |
|
|
if ($scriptLink!='') {
|
28 |
|
|
$regex = '/(.*)(<\s*?\/\s*?head\s*>.*)/isU';
|
29 |
|
|
$replace = '$1'.$scriptLink.'$2';
|
30 |
|
|
$content = preg_replace ($regex, $replace, $content);
|
31 |
|
|
}
|
32 |
|
|
}
|
33 |
|
|
return $content;
|
34 |
|
|
}
|