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 3.70 Years Ago
 
 
There are easier ways to do some of these you realize...
Page 1 of 1
 
 
Latest News About Coder Profile
Coder Profile Poll
Why do you get bored with programming?

Not enough time to do something productive
I run out of ideas
Too hard to show people my creations
Everything i do has too many errors, and it's too hard
I don't get bored!!!


please login to cast your vote
and see the results of this poll
Latest Coder Profile Changes
Coder Profile was last updated
3.20 Years Ago
Official Blog :: Make A Donation :: Credits :: Contact Me
Terms & Conditions :: Privacy Policy :: Documents :: Wallpapers
Version 1.46.00
Copyright © 2007 - 2012, Scott Thompson, All Rights Reserved