Does anyone have a custom function to strip all tags apart from: <br /> <p></p> <strong></strong> <b></b> Code (markup): Thanks +
http://forums.digitalpoint.com/showthread.php?t=1421903 function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len); } $str = "hell my name is [andrew]"; echo get_string_between($str, "[", "]");
I'm also trying to strip the following javascript with the following, but it only removes the tags and not the content? <?=str_replace('@<script[^>]*?>.*?</script>@si','',$desc);?> PHP: <SCRIPT LANGUAGE=\'JavaScript\' type=\'text/javascript\'> var itemNumber = window.ItemID ? window.ItemID : -1; function passpara(){return \'&id=755539&itembgcolor=0xFFFFFF&bordercolor=0x000000&storewindowbgcolor= 0xb8d6b6&toptextcolor=0xFFFFFF&bottomtextcolor=0xFFFFFF&stripcolor=0x516bc6&auctionclosemessagecolor =0xff0000&emptyboxmessagecolor=0xFFFFFF&buttovercolor=0x660000&buttoutcolor=0x00000AA&searchtitleco lor=0xFFFFFF&searchbuttbgcolor=0xc0c0c0&searchbutttextcolor=0x000000&searchbuttbordercolor=0x000000& itemhighlightcolor=0xfff000&navbuttonactivecolor=0x4bc1ee&navbuttonoutlinecolor=0xff9900&navbuttoninacti vebgcolor=0x000000&siteid=0&cat=115280&item=\' + itemNumber + \'&baseurl=\'+escape(location.href.substr ing(0, location.href.lastIndexOf(\'/\') + 1));} </script> Code (markup):
Try this code: <?=str_replace('@<script[^>]*?>([^<]*?)</script>@si','',$desc);?> <script LANGUAGE=\'JavaScript\' type=\'text/javascript\'> var itemNumber = window.ItemID ? window.ItemID : -1; function passpara(){return \'&id=755539&itembgcolor=0xFFFFFF&bordercolor=0x000000&storewindowbgcolor= 0xb8d6b6&toptextcolor=0xFFFFFF&bottomtextcolor=0xFFFFFF&stripcolor=0x516bc6&auctionclosemessagecolor =0xff0000&emptyboxmessagecolor=0xFFFFFF&buttovercolor=0x660000&buttoutcolor=0x00000AA&searchtitleco lor=0xFFFFFF&searchbuttbgcolor=0xc0c0c0&searchbutttextcolor=0x000000&searchbuttbordercolor=0x000000& itemhighlightcolor=0xfff000&navbuttonactivecolor=0x4bc1ee&navbuttonoutlinecolor=0xff9900&navbuttoninacti vebgcolor=0x000000&siteid=0&cat=115280&item=\' + itemNumber + \'&baseurl=\'+escape(location.href.substr ing(0, location.href.lastIndexOf(\'/\') + 1));} </script> PHP: