Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @param string $content
5
 * @return string
6
 */
7
    function doFilterLoadOnFly($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.*<.*src=\".*\/LoadOnFly.js.*>.*<\/head/siU', $content) ) {
16
                  $scriptLink .= "\t".'<script src="'.WB_URL.'/include/jquery/LoadOnFly.js" type="text/javascript"></script>'."\n";
17
            }
18
            if ($scriptLink!='') {
19
                  $regex = '/(.*)(<\s*?\/\s*?head\s*>.*)/isU';
20
                  $replace = '$1'.$scriptLink.'$2';
21
                  $content = preg_replace ($regex, $replace, $content);
22
            }
23
        }
24
        return $content;
25
    }
(6-6/12)