diff options
author | zottel <github@zottel.net> | 2012-03-29 10:23:45 +0200 |
---|---|---|
committer | zottel <github@zottel.net> | 2012-03-29 10:23:45 +0200 |
commit | 953840cf822718cba66a0727b576c674c6e44875 (patch) | |
tree | a924cf0031d16f6f15b7d84d5f519ca4257042b4 /include/text.php | |
parent | fb817a29a934a68f194a42c29d3ed11da2da558f (diff) | |
parent | 3ee529d095ac7e83ae1e71d86cbe6d443885d54e (diff) | |
download | volse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.tar.gz volse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.tar.bz2 volse-hubzilla-953840cf822718cba66a0727b576c674c6e44875.zip |
Merge remote branch 'upstream/master'
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index 6f66cef65..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); @@ -1300,6 +1330,7 @@ function file_tag_save_file($uid,$item,$file) { $saved = get_pconfig($uid,'system','filetags'); if((! strlen($saved)) || (! stristr($saved,'[' . file_tag_encode($file) . ']'))) set_pconfig($uid,'system','filetags',$saved . '[' . file_tag_encode($file) . ']'); + info( t('Item filed') ); } return true; } |