Horde_Text:: -> Horde_Text_Filter_Space2html
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 11 Jun 2009 04:39:09 +0000 (22:39 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 11 Jun 2009 04:39:09 +0000 (22:39 -0600)
framework/Mime/lib/Horde/Mime/Viewer/Rar.php
framework/Mime/lib/Horde/Mime/Viewer/Tgz.php
framework/Mime/lib/Horde/Mime/Viewer/Zip.php

index 3379b4d..024d6f6 100644 (file)
@@ -57,6 +57,8 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Driver
         if (is_a($rarData, 'PEAR_Error')) {
             return array();
         }
+
+        $charset = NLS::getCharset();
         $fileCount = count($rarData);
 
         $name = $this->_mimepart->getName(true);
@@ -66,18 +68,19 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Driver
 
         $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
             '<table><tr><td align="left"><tt><span class="fixed">' .
-            Horde_Text::htmlAllSpaces(_("Archive Name") . ':  ' . $name) . "\n" .
-            Horde_Text::htmlAllSpaces(_("Archive File Size") . ': ' . strlen($contents) . ' bytes') . "\n" .
-            Horde_Text::htmlAllSpaces(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount)) .
+            Horde_Text_Filter::filter(_("Archive Name") . ':  ' . $name, 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
+            Horde_Text_Filter::filter(_("Archive File Size") . ': ' . strlen($contents) . ' bytes', 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
+            Horde_Text_Filter::filter(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) .
             "\n\n" .
-            Horde_Text::htmlAllSpaces(
+            Horde_Text_Filter::filter(
                 Horde_String::pad(_("File Name"), 50, ' ', STR_PAD_RIGHT) .
                 Horde_String::pad(_("Attributes"), 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(_("Size"), 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(_("Modified Date"), 19, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(_("Method"), 10, ' ', STR_PAD_LEFT) .
-                Horde_String::pad(_("Ratio"), 10, ' ', STR_PAD_LEFT)
-            ) . "\n" .
+                Horde_String::pad(_("Ratio"), 10, ' ', STR_PAD_LEFT),
+                'space2html',
+                array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
             str_repeat('-', 109) . "\n";
 
         foreach ($rarData as $val) {
@@ -85,13 +88,15 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Driver
                 ? 0
                 : 100 * ($val['csize'] / $val['size']);
 
-            $text .= Horde_Text::htmlAllSpaces(
+            $text .= Horde_Text_Filter::filter(
                 Horde_String::pad($val['name'], 50, ' ', STR_PAD_RIGHT) .
                 Horde_String::pad($val['attr'], 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad($val['size'], 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(strftime("%d-%b-%Y %H:%M", $val['date']), 19, ' ', STR_PAD_LEFT) .
                 Horde_String::pad($val['method'], 10, ' ', STR_PAD_LEFT) .
-                Horde_String::pad(sprintf("%1.1f%%", $ratio), 10, ' ', STR_PAD_LEFT)
+                Horde_String::pad(sprintf("%1.1f%%", $ratio), 10, ' ', STR_PAD_LEFT),
+                'space2html',
+                array('encode' => true, 'encode_all' => true)
             ) . "\n";
         }
 
@@ -99,7 +104,7 @@ class Horde_Mime_Viewer_Rar extends Horde_Mime_Viewer_Driver
             $this->_mimepart->getMimeId() => array(
                 'data' => nl2br($text . str_repeat('-', 106) . "\n" . '</span></tt></td></tr></table>'),
                 'status' => array(),
-                'type' => 'text/html; charset=' . NLS::getCharset()
+                'type' => 'text/html; charset=' . $charset
             )
         );
     }
index e9d380d..f195ca7 100644 (file)
@@ -65,6 +65,8 @@ class Horde_Mime_Viewer_Tgz extends Horde_Mime_Viewer_Driver
         if (is_a($tarData, 'PEAR_Error')) {
             return array();
         }
+
+        $charset = NLS::getCharset();
         $fileCount = count($tarData);
 
         $name = $this->_mimepart->getName(true);
@@ -74,24 +76,28 @@ class Horde_Mime_Viewer_Tgz extends Horde_Mime_Viewer_Driver
 
         $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
             '<table><tr><td align="left"><tt><span class="fixed">' .
-            Horde_Text::htmlAllSpaces(_("Archive Name") . ':  ' . $name) . "\n" .
-            Horde_Text::htmlAllSpaces(_("Archive File Size") . ': ' . strlen($contents) . ' bytes') . "\n" .
-            Horde_Text::htmlAllSpaces(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount)) .
+            Horde_Text_Filter::filter(_("Archive Name") . ':  ' . $name, 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
+            Horde_Text_Filter::filter(_("Archive File Size") . ': ' . strlen($contents) . ' bytes', 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . "\n" .
+            Horde_Text_Filter::filter(sprintf(ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount), 'space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) .
             "\n\n" .
-            Horde_Text::htmlAllSpaces(
+            Horde_Text_Filter::filter(
                 str_pad(_("File Name"), 62, ' ', STR_PAD_RIGHT) .
                 str_pad(_("Attributes"), 15, ' ', STR_PAD_LEFT) .
                 str_pad(_("Size"), 10, ' ', STR_PAD_LEFT) .
-                str_pad(_("Modified Date"), 19, ' ', STR_PAD_LEFT)
+                str_pad(_("Modified Date"), 19, ' ', STR_PAD_LEFT),
+                'space2html',
+                array('charset' => $charset, 'encode' => true, 'encode_all' => true)
             ) . "\n" .
             str_repeat('-', 106) . "\n";
 
         foreach ($tarData as $val) {
-            $text .= Horde_Text::htmlAllSpaces(
+            $text .= Horde_Text_Filter::filter(
                 str_pad($val['name'], 62, ' ', STR_PAD_RIGHT) .
                 str_pad($val['attr'], 15, ' ', STR_PAD_LEFT) .
                 str_pad($val['size'], 10, ' ', STR_PAD_LEFT) .
-                str_pad(strftime("%d-%b-%Y %H:%M", $val['date']), 19, ' ', STR_PAD_LEFT)
+                str_pad(strftime("%d-%b-%Y %H:%M", $val['date']), 19, ' ', STR_PAD_LEFT),
+                'space2html',
+                array('charset' => $charset, 'encode' => true, 'encode_all' => true)
             ) . "\n";
         }
 
@@ -99,7 +105,7 @@ class Horde_Mime_Viewer_Tgz extends Horde_Mime_Viewer_Driver
             $this->_mimepart->getMimeId() => array(
                 'data' => nl2br($text . str_repeat('-', 106) . "\n" . '</span></tt></td></tr></table>'),
                 'status' => array(),
-                'type' => 'text/html; charset=' . NLS::getCharset()
+                'type' => 'text/html; charset=' . $charset
             )
         );
     }
index 0a854a7..ffe13a6 100644 (file)
@@ -95,7 +95,7 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Driver
 
         $text = '<strong>' . htmlspecialchars(sprintf(_("Contents of \"%s\""), $name)) . ':</strong>' . "\n" .
             '<table><tr><td align="left"><tt><span class="fixed">' .
-            Horde_Text::htmlAllSpaces(
+            Horde_Text_Filter::filter(
                 _("Archive Name") . ': ' . $name . "\n" .
                 _("Archive File Size") . ': ' . strlen($contents) .
                 ' bytes' . "\n" .
@@ -108,7 +108,9 @@ class Horde_Mime_Viewer_Zip extends Horde_Mime_Viewer_Driver
                 Horde_String::pad(_("Method"), 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(_("CRC"), 10, ' ', STR_PAD_LEFT) .
                 Horde_String::pad(_("Ratio"), 10, ' ', STR_PAD_LEFT) .
-                "\n"
+                "\n",
+                'space2html',
+                array('charset' => NLS::getCharset(), 'encode' => true, 'encode_all' => true)
             ) . str_repeat('-', 69 + $maxlen) . "\n";
 
         foreach ($zipInfo as $key => $val) {