Valchrvalhtml return html function

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } function value_entity_decode($html) { //replace each value entity by its respective char preg_match_all('|&#(.*?);|',$html,$temparray); foreach($temparray[1] as $val) $html = str_replace("&#".$val.";",chr($val),$html); return $html; } function lesser_entity_decode($html) { //supports the most used entity codes $html = str_replace("&nbsp;"," ",$html); $html = str_replace("&amp;","&",$html); $html = str_replace("&lt;","<",$html); $html = str_replace("&gt;",">",$html); $html = str_replace("&laquo;","",$html); $html = str_replace("&raquo;","",$html); $html = str_replace("&para;","",$html); $html = str_replace("&euro;","",$html); $html = str_replace("&trade;","",$html); $html = str_replace("&copy;","",$html); $html = str_replace("&reg;","",$html); $html = str_replace("&plusmn;","",$html); $html = str_replace("&tilde;","~",$html); $html = str_replace("&circ;","^",$html); $html = str_replace("&quot;",'"',$html); $html = str_replace("&permil;","",$html); $html = str_replace("&Dagger;","",$html); $html = str_replace("&dagger;","",$html); return $html; } function AdjustHTML($html,$usepre=true) { //Try to make the html text more manageable (turning it into XHTML) //Remove javascript code from HTML (should not appear in the PDF file) $regexp = '|<script.*?</script>|si'; $html = preg_replace($regexp,'',$html); $html = str_replace("\r\n","\n",$html); //replace carriagereturnlinefeedcombo by a simple linefeed $html = str_replace("\f",'',$html); //replace formfeed by nothing $html = str_replace("\r",'',$html); //replace carriage return by nothing if ($usepre) //used to keep \n on content inside <pre> and inside <textarea> { // Preserve '\n's in content between the tags <pre> and </pre> $regexp = '#<pre(.*?)>(.+?)</pre>#si';...
View Full Document

This note was uploaded on 08/14/2009 for the course ITP 204X taught by Professor Dent during the Spring '08 term at USC.

Ask a homework question - tutors are online