]> git.mxchange.org Git - friendica.git/blobdiff - include/html2plain.php
Merge pull request #2016 from fabrixxm/template_vars_hook
[friendica.git] / include / html2plain.php
index bcdf89c2cc9b5ef1da0197ae5f2af3a1dda078c1..1d5910d83bea975a11a02b2aef1e8c3eba01e68b 100644 (file)
@@ -113,12 +113,6 @@ function html2plain($html, $wraplength = 75, $compact = false)
 
        $message = str_replace("\r", "", $html);
 
-       // replace all hashtag addresses
-       if (get_config("system", "remove_hashtags_on_export")) {
-               $pattern = '/#<a.*?href="(.*?)".*?>(.*?)<\/a>/is';
-               $message = preg_replace($pattern, '#$2', $message);
-       }
-
        $doc = new DOMDocument();
        $doc->preserveWhiteSpace = false;
 
@@ -185,15 +179,15 @@ function html2plain($html, $wraplength = 75, $compact = false)
        node2bbcode($doc, 'h6', array(), "\n\n*", "*\n");
 
        // Problem: there is no reliable way to detect if it is a link to a tag or profile
-       //node2bbcode($doc, 'a', array('href'=>'/(.+)/'), ' $1 ', '', true);
-       node2bbcode($doc, 'a', array('href'=>'/(.+)/', 'rel'=>'oembed'), ' $1 ', '', true);
+       //node2bbcode($doc, 'a', array('href'=>'/(.+)/'), ' $1 ', ' ', true);
+       //node2bbcode($doc, 'a', array('href'=>'/(.+)/', 'rel'=>'oembed'), ' $1 ', '', true);
        //node2bbcode($doc, 'img', array('alt'=>'/(.+)/'), '$1', '');
        //node2bbcode($doc, 'img', array('title'=>'/(.+)/'), '$1', '');
        //node2bbcode($doc, 'img', array(), '', '');
        if (!$compact)
-               node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '[img]$1', '[/img]');
+               node2bbcode($doc, 'img', array('src'=>'/(.+)/'), ' [img]$1', '[/img] ');
        else
-               node2bbcode($doc, 'img', array('src'=>'/(.+)/'), '', '');
+               node2bbcode($doc, 'img', array('src'=>'/(.+)/'), ' ', ' ');
 
        node2bbcode($doc, 'iframe', array('src'=>'/(.+)/'), ' $1 ', '', true);
 
@@ -221,9 +215,10 @@ function html2plain($html, $wraplength = 75, $compact = false)
        if (!$compact AND ($message != "")) {
                $counter = 1;
                foreach ($urls as $id=>$url)
-                       if (strpos($message, $url) === false)
-                               $message .= "\n".$url." ";
-                               //$message .= "\n[".($counter++)."] ".$url;
+                       if ($url != "")
+                               if (strpos($message, $url) === false)
+                                       $message .= "\n".$url." ";
+                                       //$message .= "\n[".($counter++)."] ".$url;
        }
 
        $message = str_replace("\n«", "«\n", $message);
@@ -238,4 +233,4 @@ function html2plain($html, $wraplength = 75, $compact = false)
 
        return(trim($message));
 }
-
+?>