PageRenderTime 60ms CodeModel.GetById 33ms RepoModel.GetById 1ms app.codeStats 0ms

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

https://bitbucket.org/doubleface/jelix-jpu
PHP | 26 lines | 13 code | 1 blank | 12 comment | 1 complexity | 57ca2efdfba25ffa389b286abd410ce6 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * @package jelix
  4. * @subpackage plugin
  5. * @author Hugues Magnier
  6. * @contributor
  7. * @copyright 2007 Hugues Magnier
  8. * @link http://www.jelix.org
  9. * @licence GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
  10. */
  11. /**
  12. * remove all extra whitespaces
  13. */
  14. function jtpl_block_common_stripws($compiler, $begin, $param=array()) {
  15. if($begin){
  16. $content = 'ob_start();';
  17. }
  18. else{
  19. $content = '
  20. $buffer = preg_replace(\'![\\t ]*[\\r\\n]+[\\t ]*!\', \'\', ob_get_contents());
  21. ob_end_clean();
  22. print $buffer;';
  23. }
  24. return $content;
  25. }