[ Index ]
 

Code source de IMP H3 (4.1.5)

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/lib/MIME/Viewer/ -> enriched.php (source)

   1  <?php
   2  
   3  require_once 'Horde/MIME/Viewer/enriched.php';
   4  
   5  /**
   6   * The IMP_MIME_Viewer_enriched class renders out plain text from
   7   * enriched content tags, ala RFC 1896
   8   *
   9   * $Horde: imp/lib/MIME/Viewer/enriched.php,v 1.33.10.7 2007/01/02 13:55:00 jan Exp $
  10   *
  11   * Copyright 2001-2007 Eric Rostetter <eric.rostetter@physics.utexas.edu>
  12   *
  13   * See the enclosed file COPYING for license information (GPL). If you
  14   * did not receive this file, see http://www.fsf.org/copyleft/gpl.html.
  15   *
  16   * @author  Eric Rostetter <eric.rostetter@physics.utexas.edu>
  17   * @since   IMP 3.1
  18   * @package Horde_MIME_Viewer
  19   */
  20  class IMP_MIME_Viewer_enriched extends MIME_Viewer_enriched {
  21  
  22      /**
  23       * Render out the currently set contents.
  24       *
  25       * @param array $params  An array with a reference to a MIME_Contents
  26       *                       object.
  27       *
  28       * @return string  The rendered text in HTML.
  29       */
  30      function render($params)
  31      {
  32          $contents = &$params[0];
  33  
  34          global $prefs;
  35  
  36          if (($text = $this->mime_part->getContents()) === false) {
  37              return $contents->formatPartError(_("There was an error displaying this message part"));
  38          }
  39  
  40          if (trim($text) == '') {
  41              return $text;
  42          }
  43  
  44          $text = parent::render();
  45  
  46          // Highlight quoted parts of an email.
  47          if ($prefs->getValue('highlight_text')) {
  48              $text = implode("\n", preg_replace('|^(\s*&gt;.+)$|', '<span class="quoted1">\1</span>', explode("\n", $text)));
  49              $indent = 1;
  50              while (preg_match('|&gt;(\s?&gt;){' . $indent . '}|', $text)) {
  51                  $text = implode("\n", preg_replace('|^<span class="quoted' . ((($indent - 1) % 5) + 1) . '">(\s*&gt;(\s?&gt;){' . $indent . '}.+)$|', '<span class="quoted' . (($indent % 5) + 1) . '">\1', explode("\n", $text)));
  52                  $indent++;
  53              }
  54          }
  55  
  56          // Dim signatures.
  57          if ($prefs->getValue('dim_signature')) {
  58              $parts = preg_split('|(\n--\s*\n)|', $text, 2, PREG_SPLIT_DELIM_CAPTURE);
  59              $text = array_shift($parts);
  60              if (count($parts)) {
  61                  $text .= '<span class="signature">' . $parts[0] .
  62                      preg_replace('|class="[^"]+"|', 'class="signature-fixed"', $parts[1]) .
  63                      '</span>';
  64              }
  65          }
  66  
  67          // Filter bad language.
  68          $text = IMP::filterText($text);
  69  
  70          return $text;
  71      }
  72  
  73  }


Généré le : Thu Nov 29 12:30:07 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics