1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-09 15:46:34 +02:00

Minify_HTML no longer affects TEXTAREAs

This commit is contained in:
Steve Clay
2008-07-31 15:16:42 +00:00
parent 6ce0e380f0
commit 7e1f77f5d0
3 changed files with 27 additions and 1 deletions

View File

@@ -56,6 +56,12 @@ class Minify_HTML {
,array('Minify_HTML', '_removePreCB')
, $html);
// replace TEXTAREAs with token text
self::$_tas = array();
$html = preg_replace_callback('/\\s*(<textarea\\b[^>]*?>[\\s\\S]*?<\\/textarea>)\\s*/i'
,array('Minify_HTML', '_removeTaCB')
, $html);
// trim each line.
// @todo take into account attribute values that span multiple lines.
$html = preg_replace('/^\\s+|\\s+$/m', '', $html);
@@ -80,6 +86,14 @@ class Minify_HTML {
$i--;
}
// replace TEXTAREAs
$i = count(self::$_tas);
while ($i > 0) {
$rep = array_pop(self::$_tas);
$html = str_replace(self::$_replacementHash . 'TEXTAREA' . $i, $rep, $html);
$i--;
}
// replace SCRIPTs
$i = count(self::$_scripts);
while ($i > 0) {
@@ -103,6 +117,7 @@ class Minify_HTML {
protected static $_isXhtml = false;
protected static $_replacementHash = null;
protected static $_pres = array();
protected static $_tas = array(); // textareas
protected static $_scripts = array();
protected static $_styles = array();
protected static $_cssMinifier = null;
@@ -113,6 +128,12 @@ class Minify_HTML {
self::$_pres[] = $m[1];
return self::$_replacementHash . 'PRE' . count(self::$_pres);
}
protected static function _removeTaCB($m)
{
self::$_tas[] = $m[1];
return self::$_replacementHash . 'TEXTAREA' . count(self::$_tas);
}
protected static function _removeStyleCB($m)
{