Changeset 306 for trunk/global.php


Ignore:
Timestamp:
Jan 30, 2011, 8:56:26 PM (14 years ago)
Author:
george
Message:
  • Přidáno: RSS import pro obec hovězí a kino Vatra.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/global.php

    r303 r306  
    489489}
    490490
     491function strip_cdata($string)
     492{
     493  preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches);
     494  return str_replace($matches[0], $matches[1], $string);
     495}
     496
     497function 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
    491508?>
Note: See TracChangeset for help on using the changeset viewer.