X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fhtml2bbcode.php;h=b38da6b0a410f47546278cea35cd7e6ebd7385e9;hb=bbf9378a495106a452b2c6001902b44c7e88fef0;hp=69ccf41b71de3f2212217997358c59966e898fdc;hpb=4f927392f8d3791e55d9bf695a967a28d6dbceb0;p=friendica.git diff --git a/include/html2bbcode.php b/include/html2bbcode.php old mode 100755 new mode 100644 index 69ccf41b71..b38da6b0a4 --- a/include/html2bbcode.php +++ b/include/html2bbcode.php @@ -124,7 +124,7 @@ function html2bbcode($message) $node->nodeValue = str_replace("\n", "\r", $node->nodeValue); $message = $doc->saveHTML(); - $message = str_replace(array("\n<", ">\n", "\r", "\n", "\xC3\x82\xC2\xA0"), array("<", ">", "
", " ", ""), $message); + $message = str_replace(array("\n<", ">\n", "\r", "\n", "\xC3\x82\xC2\xA0"), array("<", ">", "
", " ", ""), $message); $message = preg_replace('= [\s]*=i', " ", $message); @$doc->loadHTML($message); @@ -156,12 +156,18 @@ function html2bbcode($message) //node2bbcode($doc, 'span', array('style'=>'/.*font-size:\s*(.+?)[,;].*/'), '[size=$1]', '[/size]'); node2bbcode($doc, 'span', array('style'=>'/.*color:\s*(.+?)[,;].*/'), '[color="$1"]', '[/color]'); + //node2bbcode($doc, 'span', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]'); //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)pt.*/'), '[font=$1][size=$2]', '[/size][/font]'); //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*font-size:\s*(\d+?)px.*/'), '[font=$1][size=$2]', '[/size][/font]'); //node2bbcode($doc, 'div', array('style'=>'/.*font-family:\s*(.+?)[,;].*/'), '[font=$1]', '[/font]'); + // Importing the classes - interesting for importing of posts from third party networks that were exported from friendica + // Test + //node2bbcode($doc, 'span', array('class'=>'/([\w ]+)/'), '[class=$1]', '[/class]'); + node2bbcode($doc, 'span', array('class'=>'type-link'), '[class=type-link]', '[/class]'); + node2bbcode($doc, 'strong', array(), '[b]', '[/b]'); node2bbcode($doc, 'em', array(), '[i]', '[/i]'); node2bbcode($doc, 'b', array(), '[b]', '[/b]');