Changeset 6


Ignore:
Timestamp:
May 10, 2003, 1:29:52 PM (21 years ago)
Author:
z0rglub
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r2 r6  
    2121//----------------------------------------------------------- generic functions
    2222
    23 // The function get_boolean transforms a string to a boolean value. If the
    24 // string is "false" (case insensitive), then the boolean value false is
    25 // returned. In any other case, true is returned.
     23// get_boolean transforms a string to a boolean value. If the string is
     24// "false" (case insensitive), then the boolean value false is returned. In
     25// any other case, true is returned.
    2626function get_boolean( $string )
    2727{
     
    3434}
    3535
    36 // The function array_remove removes a value from the given array if the value
    37 // existed in this array.
     36// array_remove removes a value from the given array if the value existed in
     37// this array.
    3838function array_remove( $array, $value )
    3939{
     
    8282  $start = 0;
    8383  $end = 0;
    84   $start = strpos ( $remaining, "<" );
    85   $end = strpos ( $remaining, ">" );
     84  $start = strpos ( $remaining, '<' );
     85  $end   = strpos ( $remaining, '>' );
    8686  while ( is_numeric( $start ) and is_numeric( $end ) )
    8787  {
    8888    $treatment = substr ( $remaining, 0, $start );
    89     $treatment = str_replace( " ", "&nbsp;", $treatment );
    90     $treatment = str_replace( "-", "&minus;", $treatment );
     89    $treatment = str_replace( ' ', '&nbsp;', $treatment );
     90    $treatment = str_replace( '-', '&minus;', $treatment );
    9191    $return_string.= $treatment.substr ( $remaining, $start,
    9292                                         $end - $start + 1 );
    9393    $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
    94     $start = strpos ( $remaining, "<" );
    95     $end = strpos ( $remaining, ">" );
    96   }
    97   $treatment = str_replace( " ", "&nbsp;", $remaining );
    98   $treatment = str_replace( "-", "&minus;", $treatment );
     94    $start = strpos ( $remaining, '<' );
     95    $end   = strpos ( $remaining, '>' );
     96  }
     97  $treatment = str_replace( ' ', '&nbsp;', $remaining );
     98  $treatment = str_replace( '-', '&minus;', $treatment );
    9999  $return_string.= $treatment;
    100100               
     
    219219
    220220// - The replace_search function replaces a $search string by the search in
    221 // another color
     221//   another color
    222222// - The function does not replace characters in HTML tags
    223223function replace_search( $string, $search )
     
    230230  $start = 0;
    231231  $end = 0;
    232   $start = strpos ( $remaining, "<" );
    233   $end = strpos ( $remaining, ">" );
     232  $start = strpos ( $remaining, '<' );
     233  $end   = strpos ( $remaining, '>' );
    234234  while ( is_numeric( $start ) and is_numeric( $end ) )
    235235  {
    236236    $treatment = substr ( $remaining, 0, $start );
    237     $treatment = eregi_replace( $search, "<span style=\"".$style_search."\">".
    238                                 $search."</span>", $treatment );
     237    $treatment = str_replace( $search, '<span style="'.$style_search.'">'.
     238                              $search.'</span>', $treatment );
    239239    $return_string.= $treatment.substr ( $remaining, $start,
    240240                                         $end - $start + 1 );
    241241    $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
    242     $start = strpos ( $remaining, "<" );
    243     $end = strpos ( $remaining, ">" );
    244   }
    245   $treatment = eregi_replace( $search, "<span style=\"".$style_search."\">".
    246                               $search."</span>", $remaining );
     242    $start = strpos ( $remaining, '<' );
     243    $end   = strpos ( $remaining, '>' );
     244  }
     245  $treatment = str_replace( $search, '<span style="'.$style_search.'">'.
     246                            $search.'</span>', $remaining );
    247247  $return_string.= $treatment;
    248248               
Note: See TracChangeset for help on using the changeset viewer.