Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit dc8f292b215719506c2ab0abd8429f4c5ec5c0ed 1 parent 5f8406c
Aleksander Machniak authored September 26, 2012

Showing 1 changed file with 2 additions and 0 deletions. Show diff stats Hide diff stats

  1. 2  program/lib/html2text.php
2  program/lib/html2text.php
@@ -145,6 +145,7 @@ class html2text
145 145
     var $search = array(
146 146
         "/\r/",                                  // Non-legal carriage return
147 147
         "/[\n\t]+/",                             // Newlines and tabs
  148
+        '/<head[^>]*>.*?<\/head>/i',             // <head>
148 149
         '/<script[^>]*>.*?<\/script>/i',         // <script>s -- which strip_tags supposedly has problems with
149 150
         '/<style[^>]*>.*?<\/style>/i',           // <style>s -- which strip_tags supposedly has problems with
150 151
         '/<p[^>]*>/i',                           // <P>
@@ -172,6 +173,7 @@ class html2text
172 173
     var $replace = array(
173 174
         '',                                     // Non-legal carriage return
174 175
         ' ',                                    // Newlines and tabs
  176
+        '',                                     // <head>
175 177
         '',                                     // <script>s -- which strip_tags supposedly has problems with
176 178
         '',                                     // <style>s -- which strip_tags supposedly has problems with
177 179
         "\n\n",                                 // <P>

0 notes on commit dc8f292

Please sign in to comment.
Something went wrong with that request. Please try again.