[ 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/ -> ezstringutils.php (source)

   1  <?php
   2  //
   3  // Definition of eZStringUtils class
   4  //
   5  // Created on: <29-Sep-2006 21:35:51 sp>
   6  //
   7  
   8  // Copyright (C) 1999-2004 eZ systems as. All rights reserved.
   9  //
  10  // This source file is part of the eZ publish (tm) Open Source Content
  11  // Management System.
  12  //
  13  // This file may be distributed and/or modified under the terms of the
  14  // "GNU General Public License" version 2 as published by the Free
  15  // Software Foundation and appearing in the file LICENSE included in
  16  // the packaging of this file.
  17  //
  18  // Licencees holding a valid "eZ publish professional licence" version 2
  19  // may use this file in accordance with the "eZ publish professional licence"
  20  // version 2 Agreement provided with the Software.
  21  //
  22  // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
  23  // THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  24  // PURPOSE.
  25  //
  26  // The "eZ publish professional licence" version 2 is available at
  27  // http://ez.no/ez_publish/licences/professional/ and in the file
  28  // PROFESSIONAL_LICENCE included in the packaging of this file.
  29  // For pricing of this licence please contact us via e-mail to licence@ez.no.
  30  // Further contact information is available at http://ez.no/company/contact/.
  31  //
  32  // The "GNU General Public License" (GPL) is available at
  33  // http://www.gnu.org/copyleft/gpl.html.
  34  //
  35  // Contact licence@ez.no if any conditions of this licencing isn't clear to
  36  // you.
  37  //
  38  
  39  /*! \file ezstringutils.php
  40  */
  41  
  42  /*!
  43    \class eZStringUtils ezstringutils.php
  44    \brief The class eZStringUtils does
  45  
  46  */
  47  
  48  class eZStringUtils
  49  {
  50      /*!
  51       Constructor
  52      */
  53      function eZStringUtils()
  54      {
  55      }
  56  
  57      function  explodeStr( $str, $delimiter = '|' )
  58      {
  59          $offset = 0;
  60          $array = array();
  61  
  62          while( ( $pos = strpos( $str, $delimiter, $offset )  ) !== false )
  63          {
  64              $strPart = substr( $str, 0, $pos );
  65              if ( preg_match( '/(\\\\+)$/', $strPart, $matches ) )
  66              {
  67                  if ( strlen( $matches[0] ) % 2 !== 0 )
  68                  {
  69                      $offset = $pos+1;
  70                      continue;
  71                  }
  72              }
  73              $array[] = str_replace( '\\\\', '\\', str_replace("\\$delimiter", $delimiter, $strPart ) );
  74              $str = substr( $str, $pos + 1 );
  75              $offset = 0;
  76  
  77          }
  78          $array[] = str_replace( '\\\\', '\\', str_replace("\\$delimiter", $delimiter, $str ) );
  79          return $array;
  80      }
  81  
  82      function implodeStr( $values, $delimiter = '|' )
  83      {
  84          $str = '';
  85          while ( list( $key, $value ) = each( $values ) )
  86          {
  87              $values[$key] = str_replace( $delimiter, "\\$delimiter", str_replace( '\\', '\\\\', $value ) );
  88          }
  89          return implode( $delimiter, $values );
  90      }
  91  
  92  
  93  }
  94  
  95  ?>


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