fix some linebreak issues
This commit is contained in:
parent
050618a2b6
commit
fa1f2ce8f3
|
@ -11,6 +11,9 @@ function html2bbcode($s) {
|
||||||
|
|
||||||
$htmltags = array(
|
$htmltags = array(
|
||||||
'/\n/is',
|
'/\n/is',
|
||||||
|
'/\<pre\>(.*?)\<\/pre\>/is',
|
||||||
|
'/\<p(.*?)\>/is',
|
||||||
|
'/\<\/p\>/is',
|
||||||
'/\<b\>(.*?)\<\/b\>/is',
|
'/\<b\>(.*?)\<\/b\>/is',
|
||||||
'/\<i\>(.*?)\<\/i\>/is',
|
'/\<i\>(.*?)\<\/i\>/is',
|
||||||
'/\<u\>(.*?)\<\/u\>/is',
|
'/\<u\>(.*?)\<\/u\>/is',
|
||||||
|
@ -32,6 +35,9 @@ function html2bbcode($s) {
|
||||||
// Replace with
|
// Replace with
|
||||||
|
|
||||||
$bbtags = array(
|
$bbtags = array(
|
||||||
|
'',
|
||||||
|
'[code]$1[/code]',
|
||||||
|
'',
|
||||||
"\n",
|
"\n",
|
||||||
'[b]$1[/b]',
|
'[b]$1[/b]',
|
||||||
'[i]$1[/i]',
|
'[i]$1[/i]',
|
||||||
|
|
|
@ -381,7 +381,7 @@ function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
// It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
|
// It isn't certain at this point whether our content is plaintext or html and we'd be foolish to trust
|
||||||
// the content type. Our own network only emits text normally, though it might have been converted to
|
// the content type. Our own network only emits text normally, though it might have been converted to
|
||||||
// html if we used a pubsubhubbub transport. But if we see even one html open tag in our text, we will
|
// html if we used a pubsubhubbub transport. But if we see even one html tag in our text, we will
|
||||||
// have to assume it is all html and needs to be purified.
|
// have to assume it is all html and needs to be purified.
|
||||||
|
|
||||||
// It doesn't matter all that much security wise - because before this content is used anywhere, we are
|
// It doesn't matter all that much security wise - because before this content is used anywhere, we are
|
||||||
|
@ -390,7 +390,7 @@ function get_atom_elements($feed,$item) {
|
||||||
// html.
|
// html.
|
||||||
|
|
||||||
|
|
||||||
if(strpos($res['body'],'<')) {
|
if((strpos($res['body'],'<')) || (strpos($res['body'],'>'))) {
|
||||||
|
|
||||||
$res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$res['body'] = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $res['body']);
|
'[youtube]$1[/youtube]', $res['body']);
|
||||||
|
@ -404,10 +404,11 @@ function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
$purifier = new HTMLPurifier($config);
|
$purifier = new HTMLPurifier($config);
|
||||||
$res['body'] = $purifier->purify($res['body']);
|
$res['body'] = $purifier->purify($res['body']);
|
||||||
|
|
||||||
|
$res['body'] = html2bbcode($res['body']);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$res['body'] = escape_tags($res['body']);
|
||||||
$res['body'] = html2bbcode($res['body']);
|
|
||||||
|
|
||||||
|
|
||||||
$allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow');
|
$allow = $item->get_item_tags(NAMESPACE_DFRN,'comment-allow');
|
||||||
|
@ -496,7 +497,7 @@ function get_atom_elements($feed,$item) {
|
||||||
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
|
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
|
||||||
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
|
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
|
||||||
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
|
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
|
||||||
if(strpos($body,'<')) {
|
if((strpos($body,'<')) || (strpos($body,'>'))) {
|
||||||
|
|
||||||
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $body);
|
'[youtube]$1[/youtube]', $body);
|
||||||
|
@ -506,9 +507,11 @@ function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
$purifier = new HTMLPurifier($config);
|
$purifier = new HTMLPurifier($config);
|
||||||
$body = $purifier->purify($body);
|
$body = $purifier->purify($body);
|
||||||
|
$body = html2bbcode($body);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$body = escape_tags($body);
|
||||||
|
|
||||||
$body = html2bbcode($body);
|
|
||||||
$res['object'] .= '<content>' . $body . '</content>' . "\n";
|
$res['object'] .= '<content>' . $body . '</content>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -535,7 +538,7 @@ function get_atom_elements($feed,$item) {
|
||||||
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
|
$body = $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['summary'][0]['data'];
|
||||||
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
|
// preserve a copy of the original body content in case we later need to parse out any microformat information, e.g. events
|
||||||
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
|
$res['object'] .= '<orig>' . xmlify($body) . '</orig>' . "\n";
|
||||||
if(strpos($body,'<')) {
|
if((strpos($body,'<')) || (strpos($body,'>'))) {
|
||||||
|
|
||||||
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
$body = preg_replace('#<object[^>]+>.+?' . 'http://www.youtube.com/((?:v|cp)/[A-Za-z0-9\-_=]+).+?</object>#s',
|
||||||
'[youtube]$1[/youtube]', $body);
|
'[youtube]$1[/youtube]', $body);
|
||||||
|
@ -545,9 +548,11 @@ function get_atom_elements($feed,$item) {
|
||||||
|
|
||||||
$purifier = new HTMLPurifier($config);
|
$purifier = new HTMLPurifier($config);
|
||||||
$body = $purifier->purify($body);
|
$body = $purifier->purify($body);
|
||||||
|
$body = html2bbcode($body);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
$body = escape_tags($body);
|
||||||
|
|
||||||
$body = html2bbcode($body);
|
|
||||||
$res['target'] .= '<content>' . $body . '</content>' . "\n";
|
$res['target'] .= '<content>' . $body . '</content>' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user