Permalink
Browse files

Make sure <head> content (e.g. title) is not converted to plain text

  • Loading branch information...
1 parent 5f8406c commit dc8f292b215719506c2ab0abd8429f4c5ec5c0ed @alecpl alecpl committed Sep 26, 2012
Showing with 2 additions and 0 deletions.
  1. +2 −0 program/lib/html2text.php
@@ -145,6 +145,7 @@ class html2text
var $search = array(
"/\r/", // Non-legal carriage return
"/[\n\t]+/", // Newlines and tabs
+ '/<head[^>]*>.*?<\/head>/i', // <head>
'/<script[^>]*>.*?<\/script>/i', // <script>s -- which strip_tags supposedly has problems with
'/<style[^>]*>.*?<\/style>/i', // <style>s -- which strip_tags supposedly has problems with
'/<p[^>]*>/i', // <P>
@@ -172,6 +173,7 @@ class html2text
var $replace = array(
'', // Non-legal carriage return
' ', // Newlines and tabs
+ '', // <head>
'', // <script>s -- which strip_tags supposedly has problems with
'', // <style>s -- which strip_tags supposedly has problems with
"\n\n", // <P>

0 comments on commit dc8f292

Please sign in to comment.