Coder Profile - Show off your skills, get a coder profile.
 
 
 
code pin board A few functions Download Source Code
Author Details Code Information
Skepsis ( Matt )

Pinned 4 Codes
Posted 0 Coding Articles

Send A Message
View Coders Profile
Language PHP (Hypertext Preprocessor)
Expires Never
Length 1,064 Characters (31 Lines)
Password no password
Description

Here are a few useful functions, nothing special, just improving a few functions, very self explanatory.
  1. <?
  2. ////////////////////////////////////////////////////////
  3. // Function: new_linebreaks
  4. // Description: Convert \r\n and \r to \n
  5.  
  6. function new_linebreaks($str){ return str_replace("\r", "\n", str_replace("\r\n", "\n", $str)); }
  7.  
  8. ////////////////////////////////////////////////////////
  9. // Function: new_stripslashes
  10. // Description: Strip slashes
  11.  
  12. function new_stripslashes($str){ return (get_magic_quotes_gpc() == 1) ? stripslashes($str) : $str; }
  13.  
  14. ////////////////////////////////////////////////////////
  15. // Function: new_strlen
  16. // Description: A more special strlen()
  17.  
  18. function new_strlen($str){ return strlen(preg_replace('/&#([0-9]+);/', '!', $str)); }
  19.  
  20. ////////////////////////////////////////////////////////
  21. // Function: new_htmlspecialchars
  22. // Description: A more special htmlspecialchars()
  23.  
  24. function new_htmlspecialchars($str)
  25. {
  26.      $str = preg_replace('/&(?!#[0-9]+;)/s', '&amp;', $str);
  27.      $str = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $str);
  28.  
  29. return $str;
  30. }
  31. ?>
code pin board Back To Code Pin Board Post New Code
Please login to post comments.
 
Relish     Posted 135 Days Ago
 
 
There are easier ways to do some of these you realize...
Page 1 of 1
 
 
Part of the MyPingle Network
Development Blog :: Make A Donation :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents
Version 1.44.00
Copyright © 2007 - 2008, Scott Thompson, All Rights Reserved