[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/ -> Text.php (source)

   1  <?php
   2  /**
   3   * The Text:: class provides common methods for manipulating text.
   4   *
   5   * $Horde: framework/Horde/Horde/Text.php,v 1.2.10.5 2006/01/01 21:28:20 jan Exp $
   6   *
   7   * Copyright 1999-2006 Jon Parise <jon@horde.org>
   8   *
   9   * See the enclosed file COPYING for license information (LGPL). If you
  10   * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  11   *
  12   * @author  Jon Parise <jon@horde.org>
  13   * @since   Horde 1.3
  14   * @package Horde_Text
  15   */
  16  class Text {
  17  
  18      /**
  19       * Convert a line of text to display properly in HTML.
  20       *
  21       * @param string $text  The string of text to convert.
  22       *
  23       * @return string  The HTML-compliant converted text.
  24       */
  25      function htmlSpaces($text = '')
  26      {
  27          static $charset;
  28          if (!isset($charset)) {
  29              $charset = NLS::getCharset();
  30          }
  31  
  32          $text = @htmlspecialchars($text, ENT_COMPAT, $charset);
  33          $text = str_replace("\t", '&nbsp; &nbsp; &nbsp; &nbsp; ', $text);
  34          $text = str_replace('  ', '&nbsp; ', $text);
  35          $text = str_replace('  ', ' &nbsp;', $text);
  36  
  37          return $text;
  38      }
  39  
  40      /**
  41       * Same as htmlSpaces() but converts all spaces to &nbsp;
  42       *
  43       * @see htmlSpaces()
  44       *
  45       * @param string $text  The string of text to convert.
  46       *
  47       * @return string  The HTML-compliant converted text.
  48       */
  49      function htmlAllSpaces($text = '')
  50      {
  51          $text = Text::htmlSpaces($text);
  52          $text = str_replace(' ', '&nbsp;', $text);
  53  
  54          return $text;
  55      }
  56  
  57  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7