예제 #1
0
 /**
  * Prepare a content for output
  *
  * @param mixed $content
  * @return string
  */
 public function prepareContent($content)
 {
     if (is_array($content)) {
         $ctt = '';
         foreach ($content as $key => $ctt) {
             $content .= $ctt;
         }
         $content = $ctt;
     }
     $_escaped_output = strip_tags((string) $content);
     if ($_escaped_output != (string) $content) {
         if (preg_match('/(.*)<body(.*)</body>/i', (string) $content, $matches)) {
             $_output = $matches[0];
         } else {
             $_output = (string) $content;
         }
         $content = Html2Text::convert($_output);
     }
     return (string) $content;
 }
예제 #2
0
 /**
  * Converts HTML to plain text
  *
  * @param string $str The HTML content to transform
  * @return string The associated plain text version
  */
 public static function html2text($str)
 {
     return Html2Text::convert($str);
 }