jelix-jpu /lib/jelix/plugins/tpl/common/block.stripws.php

Language PHP Lines 27
MD5 Hash 57ca2efdfba25ffa389b286abd410ce6 Estimated Cost $260 (why?)
Repository https://bitbucket.org/doubleface/jelix-jpu View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
/**
* @package     jelix
* @subpackage  plugin
* @author      Hugues Magnier
* @contributor
* @copyright   2007 Hugues Magnier
* @link        http://www.jelix.org
* @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
*/

/**
 * remove all extra whitespaces
 */
function jtpl_block_common_stripws($compiler, $begin, $param=array()) {
    if($begin){
        $content = 'ob_start();';
    }
    else{
        $content = '
        $buffer = preg_replace(\'![\\t ]*[\\r\\n]+[\\t ]*!\', \'\', ob_get_contents());
        ob_end_clean();
        print $buffer;';
    }
    return $content;
}
Back to Top