aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorTobias Diekershoff <tobias.diekershoff@gmx.net>2012-03-14 07:20:13 +0100
committerTobias Diekershoff <tobias.diekershoff@gmx.net>2012-03-14 07:20:13 +0100
commit4fcdada4320d5d5619eb3a1f517d0fea6b26857b (patch)
treebc2ba3aac0a08c1464718f688be8080d0dff6d2c /include/text.php
parent5bae7159cc7b182e40229bb6d547ccf303eb4282 (diff)
parentfb77bfa648c3dd06d1b3f343f5ad98f32a7ce313 (diff)
downloadvolse-hubzilla-4fcdada4320d5d5619eb3a1f517d0fea6b26857b.tar.gz
volse-hubzilla-4fcdada4320d5d5619eb3a1f517d0fea6b26857b.tar.bz2
volse-hubzilla-4fcdada4320d5d5619eb3a1f517d0fea6b26857b.zip
Merge branch 'master' of https://github.com/friendica/friendica
Diffstat (limited to 'include/text.php')
-rw-r--r--include/text.php30
1 files changed, 29 insertions, 1 deletions
diff --git a/include/text.php b/include/text.php
index 011006b76..199460d2c 100644
--- a/include/text.php
+++ b/include/text.php
@@ -874,6 +874,7 @@ function link_compare($a,$b) {
if(! function_exists('prepare_body')) {
function prepare_body($item,$attach = false) {
+ $a = get_app();
call_hooks('prepare_body_init', $item);
$s = prepare_text($item['body']);
@@ -913,6 +914,33 @@ function prepare_body($item,$attach = false) {
}
$s .= '<div class="clear"></div></div>';
}
+ $matches = false;
+ $cnt = preg_match_all('/<(.*?)>/',$item['file'],$matches,PREG_SET_ORDER);
+ if($cnt) {
+// logger('prepare_text: categories: ' . print_r($matches,true), LOGGER_DEBUG);
+ foreach($matches as $mtch) {
+ if(strlen($x))
+ $x .= ',';
+ $x .= file_tag_decode($mtch[1]);
+ }
+ if(strlen($x))
+ $s .= '<div class="categorytags"><span>' . t('Categories:') . ' </span>' . $x . '</div>';
+
+
+ }
+ $matches = false;
+ $x = '';
+ $cnt = preg_match_all('/\[(.*?)\]/',$item['file'],$matches,PREG_SET_ORDER);
+ if($cnt) {
+// logger('prepare_text: filed_under: ' . print_r($matches,true), LOGGER_DEBUG);
+ foreach($matches as $mtch) {
+ if(strlen($x))
+ $x .= '&nbsp;&nbsp;&nbsp;';
+ $x .= file_tag_decode($mtch[1]). ' <a href="' . $a->get_baseurl() . '/filerm/' . $item['id'] . '?f=&term=' . file_tag_decode($mtch[1]) . '" title="' . t('remove') . '" >' . t('[remove]') . '</a>';
+ }
+ if(strlen($x) && (local_user() == $item['uid']))
+ $s .= '<div class="filesavetags"><span>' . t('Filed under:') . ' </span>' . $x . '</div>';
+ }
$prep_arr = array('item' => $item, 'html' => $s);
@@ -1267,7 +1295,7 @@ function file_tag_save_file($uid,$item,$file) {
if(count($r)) {
if(! stristr($r[0]['file'],'[' . file_tag_encode($file) . ']'))
q("update item set file = '%s' where id = %d and uid = %d limit 1",
- dbesc($r[0]['file'] . '[' . $file_tag_encode($file) . ']'),
+ dbesc($r[0]['file'] . '[' . file_tag_encode($file) . ']'),
intval($item),
intval($uid)
);