Exemple #1
0
 function LinkImage(&$html, $match, $type)
 {
     $newval = '<img src="' . tmpPathInsert() . 'apppub/' . $match . '">';
     $html = preg_replace('/\\[\\[' . $type . ":" . $match . '\\]\\]/', $newval, $html);
 }
Exemple #2
0
/**
* @deprecated
*/
function jsOutput()
{
    // Get the array and see if there is anything to do
    $ajs = vgfGet('jsIncludes', array());
    $jqp = vgfGet('jqPlugins', array());
    $ajs = array_merge($ajs, $jqp);
    if (count($ajs) == 0) {
        return;
    }
    // Initialize array of files that must be minified
    $aj = array();
    // Loop through each file and either add it to list of
    // files to minify or output it directly
    $debug = trim(ConfigGet('js_css_debug', 'N'));
    if (vgfGet('x6')) {
        $debug = 'Y';
    }
    foreach ($ajs as $js) {
        $external = false;
        if (substr($js['file'], 0, 7) == 'http://') {
            $external = true;
        }
        if ($debug == 'N' && $external == false) {
            //if(false) {
            $aj[] = $js['file'];
            if ($js['comments'] != '') {
                ?>
                <!--
                <?php 
                echo $js['comments'];
                ?>
                -->
                <?php 
            }
        } else {
            $insert = $external ? '' : tmpPathInsert();
            ?>
            <script type="text/javascript"
                     src="<?php 
            echo $insert . $js['file'];
            ?>
" >
            <?php 
            echo $js['comments'];
            ?>
            </script>
            <?php 
        }
    }
    // If they needed minification, we have to work out now
    // what that file will be, maybe generate it, and create
    // a link to it
    //
    # KFD 8/20/08, Now minifying files during the build, so we
    #              grab that file if we can find it.  See below
    /*
    if(count($aj)==0) return;
    $list = implode('|',$aj);
    $md5  = substr(md5($list),0,15);
    $file = fsDirTop()."/clib/js-min-$md5.js";
    
    if(!file_exists($file)) {
        require 'jsmin-1.1.0.php';
        $string = '';
        foreach($aj as $ajone) {
            $f = fsDirTop().$ajone;
            $string.=JSMin::minify(file_get_contents($f));
        }
        file_put_contents($file,$string);
    }
    */
    if (count($aj) == 0) {
        return;
    }
    $list = implode('|', $aj);
    $md5 = substr(md5($list), 0, 15);
    $file = fsDirTop() . "/clib/js-min-{$md5}.js";
    if (!file_exists($file)) {
        $string = '';
        foreach ($aj as $ajone) {
            if (file_exists($ajone . '.mjs')) {
                $string .= file_get_contents(fsDirTop() . $ajone . '.mjs');
            } else {
                $string .= file_get_contents(fsDirTop() . $ajone);
            }
        }
        file_put_contents($file, $string);
        chmod($file, 0664);
    }
    // Finally, put out the file
    ?>
    <script type="text/javascript"
             src="<?php 
    echo tmpPathInsert() . "clib/js-min-{$md5}.js";
    ?>
" >
    </script>
    <?php 
}