aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-03-28 15:08:15 -0700
committerfriendica <info@friendica.com>2012-03-28 15:08:15 -0700
commit75f3d41da2d85cb61ac627807011c312b96e3bb1 (patch)
tree2bee850bc2c4c8fcc3e5e53fd941dc77ecbf8d6d /include/text.php
parenta2b1aca27c936991d02ab10d97f1f7980500c460 (diff)
parentbdd275474044152a5d9a33ea6b8a8071b931d27e (diff)
downloadvolse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.tar.gz
volse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.tar.bz2
volse-hubzilla-75f3d41da2d85cb61ac627807011c312b96e3bb1.zip
Merge pull request #184 from annando/master
Enhancing the API - Preparations for a better facebook export
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index 5aaf04729..6d557ed84 100644
--- a/include/text.php
+++ b/include/text.php
@@ -940,6 +940,36 @@ function prepare_body($item,$attach = false) {
$s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
}
+ // Look for spoiler
+ $spoilersearch = '<blockquote class="spoiler">';
+
+ // Remove line breaks before the spoiler
+ while ((strpos($s, "\n".$spoilersearch) !== false))
+ $s = str_replace("\n".$spoilersearch, $spoilersearch, $s);
+ while ((strpos($s, "<br />".$spoilersearch) !== false))
+ $s = str_replace("<br />".$spoilersearch, $spoilersearch, $s);
+
+ while ((strpos($s, $spoilersearch) !== false)) {
+
+ $pos = strpos($s, $spoilersearch);
+ $rnd = random_string(8);
+ $spoilerreplace = '<br /> <span id="spoiler-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'spoiler-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
+ '<blockquote class="spoiler" id="spoiler-'.$rnd.'" style="display: none;">';
+ $s = substr($s, 0, $pos).$spoilerreplace.substr($s, $pos+strlen($spoilersearch));
+ }
+
+ // Look for quote with author
+ $authorsearch = '<blockquote class="author">';
+
+ while ((strpos($s, $authorsearch) !== false)) {
+
+ $pos = strpos($s, $authorsearch);
+ $rnd = random_string(8);
+ $authorreplace = '<br /> <span id="author-wrap-'.$rnd.'" style="white-space:nowrap;" class="fakelink" onclick="openClose(\'author-'.$rnd.'\');">'.sprintf(t('Click to open/close')).'</span>'.
+ '<blockquote class="author" id="author-'.$rnd.'" style="display: block;">';
+ $s = substr($s, 0, $pos).$authorreplace.substr($s, $pos+strlen($authorsearch));
+ }
+
$prep_arr = array('item' => $item, 'html' => $s);
call_hooks('prepare_body_final', $prep_arr);