[ Index ]
 

Code source de eZ Publish 3.9.0

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

title

Body

[fermer]

/lib/ezutils/classes/ -> eztexttool.php (source)

   1  <?php
   2  //
   3  // Definition of eZTextTool class
   4  //
   5  // Created on: <04-Jun-2002 09:12:36 bf>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*!
  30    \class eZTextTool eztexttool.php
  31    \ingroup eZUtils
  32    \brief eZTextTool is a class with different useful text functions
  33  
  34  */
  35  
  36  class eZTextTool
  37  {
  38      /*!
  39       \static
  40       Returns an HTML highlighted and displayable formatted HTML from the
  41       input text. < and > are converted to &lt; and &gt;
  42      */
  43      function highlightHTML( $input )
  44      {
  45          $input = str_replace( "<", "&lt;", $input );
  46          $input = str_replace( ">", "&gt;", $input );
  47  
  48          $input = preg_replace( "#&lt;(.*?)&gt;#m", "<font color='red'>&lt;$1&gt;</font>", $input );
  49  
  50          return $input;
  51      }
  52  
  53      function highlightPHP()
  54      {
  55  
  56      }
  57  
  58      function concatDelimited()
  59      {
  60          $numargs = func_num_args();
  61          $argList = func_get_args();
  62          $text = null;
  63          if ( $numargs > 1 )
  64          {
  65              $delimit = $argList[0];
  66              $text = implode( $delimit, eZTextTool::arrayFlatten( array_splice( $argList, 1 ) ) );
  67          }
  68          return $text;
  69      }
  70  
  71      function concat()
  72      {
  73          $numargs = func_num_args();
  74          $argList = func_get_args();
  75          $text = null;
  76          if ( $numargs > 0 )
  77          {
  78              $text = implode( '', eZTextTool::arrayFlatten( $argList ) );
  79          }
  80          return $text;
  81      }
  82  
  83      function arrayFlatten( $array )
  84      {
  85          $flatArray = array();
  86          $expandItems = $array;
  87          $done = false;
  88          while ( !$done )
  89          {
  90              $checkList = $expandItems;
  91              $leftOvers = array();
  92              $foundArray = false;
  93              foreach ( array_keys( $checkList ) as $key )
  94              {
  95                  $item = $checkList[$key];
  96                  if ( is_array ( $item ) )
  97                  {
  98                      $leftOvers = array_merge( $leftOvers, $item );
  99                      $foundArray = true;
 100                  }
 101                  else
 102                  {
 103                      if ( $foundArray )
 104                          $leftOvers[] = $item;
 105                      else
 106                          $flatArray[] = $item;
 107                  }
 108              }
 109              $expandItems = $leftOvers;
 110              if ( count( $expandItems ) == 0 )
 111              {
 112                  $done = true;
 113              }
 114          }
 115          return $flatArray;
 116      }
 117  }
 118  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7