Changeset 306 for trunk/global.php
- Timestamp:
- Jan 30, 2011, 8:56:26 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/global.php
r303 r306 489 489 } 490 490 491 function strip_cdata($string) 492 { 493 preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches); 494 return str_replace($matches[0], $matches[1], $string); 495 } 496 497 function html2txt($document) 498 { 499 $search = array('@<script[^>]*?>.*?</script>@si', // Strip out javascript 500 '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags 501 '@<style[^>]*?>.*?</style>@siU', // Strip style tags properly 502 '@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA 503 ); 504 $text = preg_replace($search, '', $document); 505 return $text; 506 } 507 491 508 ?>
Note:
See TracChangeset
for help on using the changeset viewer.