Advertisement
Guest User

Untitled

a guest
Apr 10th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. <?php
  2. # Purpose: to strip unwanted whitespace from $body so as to reduce bandwidth.
  3. # Santax: ramcms_remove_body_whitespace ( str $body )
  4. # Where:
  5. # $body is the contents of our webpage
  6. #
  7. function ramcms_remove_body_whitespace(&$body)
  8. {
  9.     # if <PRE> or <pre> or <textarea> or <TEXTAREA> is found in $body then preserve whitespace.
  10.     # otherwise remove all tabs and newlines.
  11.     if(strstr($body,'<PRE')==false && strstr($body,'<pre')==false && strstr($body,'<TEXTAREA')==false && strstr($body,'<textarea')==false)
  12.     {
  13.         # strip all newlines and tabs.
  14.         $body=str_replace("\t",'',str_replace("\n",'',str_replace("\r",'',$body)));
  15.     }
  16. }
  17.  
  18. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement