Improvement for shortening of the new plaintext option.
This commit is contained in:
parent
35fbe3be14
commit
7cc2723e2d
|
@ -114,11 +114,11 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
||||||
$message = str_replace("\r", "", $html);
|
$message = str_replace("\r", "", $html);
|
||||||
|
|
||||||
// replace all hashtag addresses
|
// replace all hashtag addresses
|
||||||
if (get_config("system", "remove_hashtags_on_export")) {
|
/* if (get_config("system", "remove_hashtags_on_export")) {
|
||||||
$pattern = '/#<a.*?href="(.*?)".*?>(.*?)<\/a>/is';
|
$pattern = '/#<a.*?href="(.*?)".*?>(.*?)<\/a>/is';
|
||||||
$message = preg_replace($pattern, '#$2', $message);
|
$message = preg_replace($pattern, '#$2', $message);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->preserveWhiteSpace = false;
|
$doc->preserveWhiteSpace = false;
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ function html2plain($html, $wraplength = 75, $compact = false)
|
||||||
node2bbcode($doc, 'h6', array(), "\n\n*", "*\n");
|
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
|
// 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'=>'/(.+)/'), ' $1 ', ' ', true);
|
||||||
node2bbcode($doc, 'a', array('href'=>'/(.+)/', 'rel'=>'oembed'), ' $1 ', '', true);
|
//node2bbcode($doc, 'a', array('href'=>'/(.+)/', 'rel'=>'oembed'), ' $1 ', '', true);
|
||||||
//node2bbcode($doc, 'img', array('alt'=>'/(.+)/'), '$1', '');
|
//node2bbcode($doc, 'img', array('alt'=>'/(.+)/'), '$1', '');
|
||||||
//node2bbcode($doc, 'img', array('title'=>'/(.+)/'), '$1', '');
|
//node2bbcode($doc, 'img', array('title'=>'/(.+)/'), '$1', '');
|
||||||
//node2bbcode($doc, 'img', array(), '', '');
|
//node2bbcode($doc, 'img', array(), '', '');
|
||||||
|
|
|
@ -168,6 +168,8 @@ function plaintext($a, $b, $limit = 0, $includedlinks = false) {
|
||||||
// Is the new message empty by now or is it a reshared message?
|
// Is the new message empty by now or is it a reshared message?
|
||||||
elseif (($msg == "") OR (($row == 1) AND (substr($msg, 0, 4) == $recycle)))
|
elseif (($msg == "") OR (($row == 1) AND (substr($msg, 0, 4) == $recycle)))
|
||||||
$msg = substr(substr(trim($msg."\n".$line), 0, $limit), 0, -3)."...";
|
$msg = substr(substr(trim($msg."\n".$line), 0, $limit), 0, -3)."...";
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue