Changeset 410 for branches/release-1_3/include
- Timestamp:
- Apr 1, 2004, 12:26:15 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/release-1_3/include/functions.inc.php
r274 r410 261 261 } 262 262 263 // - add_style replaces the 264 // $search into <span style="$style">$search</span> 265 // in the given $string. 266 // - The function does not replace characters in HTML tags 263 /** 264 * replaces the $search into <span style="$style">$search</span> in the 265 * given $string. 266 * 267 * case insensitive replacements, does not replace characters in HTML tags 268 * 269 * @param string $string 270 * @param string $search 271 * @param string $style 272 * @return string 273 */ 267 274 function add_style( $string, $search, $style ) 268 275 { … … 278 285 { 279 286 $treatment = substr ( $remaining, 0, $start ); 280 $treatment = str_replace( $search, '<span style="'.$style.'">'. 281 $search.'</span>', $treatment ); 287 $treatment = preg_replace( '/('.$search.')/i', 288 '<span style="'.$style.'">\\0</span>', 289 $treatment ); 282 290 $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 ); 283 291 $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) ); … … 285 293 $end = strpos ( $remaining, '>' ); 286 294 } 287 $treatment = str_replace( $search, '<span style="'.$style.'">'. 288 $search.'</span>', $remaining ); 295 $treatment = preg_replace( '/('.$search.')/i', 296 '<span style="'.$style.'">\\0</span>', 297 $remaining ); 289 298 $return_string.= $treatment; 290 299
Note: See TracChangeset
for help on using the changeset viewer.