|
@ -98,6 +98,12 @@ function pm_snippet($body, $len=null) { |
|
|
// Replace line breaks with some whitespace |
|
|
// Replace line breaks with some whitespace |
|
|
$body = preg_replace('@<br/?>@i', ' ', $body); |
|
|
$body = preg_replace('@<br/?>@i', ' ', $body); |
|
|
|
|
|
|
|
|
|
|
|
// Strip tags but leave span tags which contain spoiler |
|
|
|
|
|
$body_with_spoiler_tags = strip_tags($body,'<span>'); |
|
|
|
|
|
|
|
|
|
|
|
// Check for spoiler tags |
|
|
|
|
|
$spoiler = preg_match("/spoiler/", $body_with_spoiler_tags); |
|
|
|
|
|
|
|
|
// Strip tags |
|
|
// Strip tags |
|
|
$body = strip_tags($body); |
|
|
$body = strip_tags($body); |
|
|
|
|
|
|
|
@ -109,6 +115,13 @@ function pm_snippet($body, $len=null) { |
|
|
|
|
|
|
|
|
$body = mb_substr($body, 0, $len); |
|
|
$body = mb_substr($body, 0, $len); |
|
|
|
|
|
|
|
|
|
|
|
if ($spoiler){ |
|
|
|
|
|
$value = "<span class=\"spoiler\">" . utf8tohtml($body) . "</span>"; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$value = utf8tohtml($body); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// Re-escape the characters. |
|
|
// Re-escape the characters. |
|
|
return '<em>' . utf8tohtml($body) . ($strlen > $len ? '…' : '') . '</em>'; |
|
|
return '<em>' . utf8tohtml($body) . ($strlen > $len ? '…' : '') . '</em>'; |
|
|
} |
|
|
} |
|
|