Changeset 6
- Timestamp:
- May 10, 2003, 1:29:52 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/functions.inc.php
r2 r6 21 21 //----------------------------------------------------------- generic functions 22 22 23 // The function get_boolean transforms a string to a boolean value. If the24 // string is "false" (case insensitive), then the boolean value false is25 // returned. Inany 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. 26 26 function get_boolean( $string ) 27 27 { … … 34 34 } 35 35 36 // The function array_remove removes a value from the given array if the value37 // existed inthis array.36 // array_remove removes a value from the given array if the value existed in 37 // this array. 38 38 function array_remove( $array, $value ) 39 39 { … … 82 82 $start = 0; 83 83 $end = 0; 84 $start = strpos ( $remaining, "<");85 $end = strpos ( $remaining, ">");84 $start = strpos ( $remaining, '<' ); 85 $end = strpos ( $remaining, '>' ); 86 86 while ( is_numeric( $start ) and is_numeric( $end ) ) 87 87 { 88 88 $treatment = substr ( $remaining, 0, $start ); 89 $treatment = str_replace( " ", " ", $treatment );90 $treatment = str_replace( "-", "−", $treatment );89 $treatment = str_replace( ' ', ' ', $treatment ); 90 $treatment = str_replace( '-', '−', $treatment ); 91 91 $return_string.= $treatment.substr ( $remaining, $start, 92 92 $end - $start + 1 ); 93 93 $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) ); 94 $start = strpos ( $remaining, "<");95 $end = strpos ( $remaining, ">");96 } 97 $treatment = str_replace( " ", " ", $remaining );98 $treatment = str_replace( "-", "−", $treatment );94 $start = strpos ( $remaining, '<' ); 95 $end = strpos ( $remaining, '>' ); 96 } 97 $treatment = str_replace( ' ', ' ', $remaining ); 98 $treatment = str_replace( '-', '−', $treatment ); 99 99 $return_string.= $treatment; 100 100 … … 219 219 220 220 // - The replace_search function replaces a $search string by the search in 221 // another color221 // another color 222 222 // - The function does not replace characters in HTML tags 223 223 function replace_search( $string, $search ) … … 230 230 $start = 0; 231 231 $end = 0; 232 $start = strpos ( $remaining, "<");233 $end = strpos ( $remaining, ">");232 $start = strpos ( $remaining, '<' ); 233 $end = strpos ( $remaining, '>' ); 234 234 while ( is_numeric( $start ) and is_numeric( $end ) ) 235 235 { 236 236 $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 ); 239 239 $return_string.= $treatment.substr ( $remaining, $start, 240 240 $end - $start + 1 ); 241 241 $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 ); 247 247 $return_string.= $treatment; 248 248
Note: See TracChangeset
for help on using the changeset viewer.