Beispiel #1
0
 /**
  *    Accessor for starting value.
  *    @return string        Parsed value.
  *    @access public
  */
 function getDefault()
 {
     return $this->_wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent()));
 }
Beispiel #2
0
 /**
  *    Turns HTML into text browser visible text. Images
  *    are converted to their alt text and tags are supressed.
  *    Entities are converted to their visible representation.
  *    @param string $html        HTML to convert.
  *    @return string             Plain text.
  *    @access public
  *    @static
  */
 function normalise($html)
 {
     $text = preg_replace('|<!--.*?-->|', '', $html);
     $text = preg_replace('|<img.*?alt\\s*=\\s*"(.*?)".*?>|', ' \\1 ', $text);
     $text = preg_replace('|<img.*?alt\\s*=\\s*\'(.*?)\'.*?>|', ' \\1 ', $text);
     $text = preg_replace('|<img.*?alt\\s*=\\s*([a-zA-Z_]+).*?>|', ' \\1 ', $text);
     $text = preg_replace('|<.*?>|', '', $text);
     $text = SimpleHtmlSaxParser::decodeHtml($text);
     $text = preg_replace('|\\s+|', ' ', $text);
     return trim($text);
 }
Beispiel #3
0
 /**
  *    Turns HTML into text browser visible text. Images
  *    are converted to their alt text and tags are supressed.
  *    Entities are converted to their visible representation.
  *    @param string $html        HTML to convert.
  *    @return string             Plain text.
  *    @access public
  */
 static function normalise($html)
 {
     $text = preg_replace('|<!--.*?-->|', '', $html);
     $text = preg_replace('|<script[^>]*>.*?</script>|', '', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*"([^"]*)"[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*\'([^\']*)\'[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*([a-zA-Z_]+)[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<[^>]*>|', '', $text);
     $text = SimpleHtmlSaxParser::decodeHtml($text);
     $text = preg_replace('|\\s+|', ' ', $text);
     return trim(trim($text), "�");
     // TODO: The \xAO is a &nbsp;. Add a test for this.
 }
Beispiel #4
0
 /**
  *    Turns HTML into text browser visible text. Images
  *    are converted to their alt text and tags are supressed.
  *    Entities are converted to their visible representation.
  *    @param string $html        HTML to convert.
  *    @return string             Plain text.
  *    @access public
  *    @static
  */
 function normalise($html)
 {
     $text = preg_replace('|<!--.*?-->|', '', $html);
     $text = preg_replace('|<script[^>]*>.*?</script>|', '', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*"([^>]*)"[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*\'([^>]*)\'[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<img[^>]*alt\\s*=\\s*([a-zA-Z_]+)[^>]*>|', ' \\1 ', $text);
     $text = preg_replace('|<[^>]*>|', '', $text);
     $text = SimpleHtmlSaxParser::decodeHtml($text);
     $text = preg_replace('|\\s+|', ' ', $text);
     return trim($text);
 }