linkify post categories
This commit is contained in:
parent
3a84124ef0
commit
9787872778
@ -1024,6 +1024,9 @@ function theme_attachments(&$item) {
|
|||||||
$icon = '';
|
$icon = '';
|
||||||
$icontype = substr($r['type'],0,strpos($r['type'],'/'));
|
$icontype = substr($r['type'],0,strpos($r['type'],'/'));
|
||||||
|
|
||||||
|
// FIXME This should probably be a giant "if" statement in the template so that we don't have icon names
|
||||||
|
// embedded in php code
|
||||||
|
|
||||||
switch($icontype) {
|
switch($icontype) {
|
||||||
case 'video':
|
case 'video':
|
||||||
$icon = 'icon-facetime-video';
|
$icon = 'icon-facetime-video';
|
||||||
@ -1073,8 +1076,10 @@ function format_categories(&$item,$writeable) {
|
|||||||
$categories = array();
|
$categories = array();
|
||||||
foreach($terms as $t) {
|
foreach($terms as $t) {
|
||||||
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8') ;
|
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8') ;
|
||||||
|
if(! trim($term))
|
||||||
|
continue;
|
||||||
$removelink = (($writeable) ? z_root() . '/filerm/' . $item['id'] . '?f=&cat=' . urlencode($t['term']) : '');
|
$removelink = (($writeable) ? z_root() . '/filerm/' . $item['id'] . '?f=&cat=' . urlencode($t['term']) : '');
|
||||||
$categories[] = array('term' => $term, 'writeable' => $writeable, 'removelink' => $removelink);
|
$categories[] = array('term' => $term, 'writeable' => $writeable, 'removelink' => $removelink, 'url' => $t['url']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$s = replace_macros(get_markup_template('item_categories.tpl'),array(
|
$s = replace_macros(get_markup_template('item_categories.tpl'),array(
|
||||||
@ -1093,6 +1098,8 @@ function format_filer(&$item) {
|
|||||||
$categories = array();
|
$categories = array();
|
||||||
foreach($terms as $t) {
|
foreach($terms as $t) {
|
||||||
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8') ;
|
$term = htmlspecialchars($t['term'],ENT_COMPAT,'UTF-8') ;
|
||||||
|
if(! trim($term))
|
||||||
|
continue;
|
||||||
$removelink = z_root() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']);
|
$removelink = z_root() . '/filerm/' . $item['id'] . '?f=&term=' . urlencode($t['term']);
|
||||||
$categories[] = array('term' => $term, 'removelink' => $removelink);
|
$categories[] = array('term' => $term, 'removelink' => $removelink);
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ function item_post(&$a) {
|
|||||||
'type' => TERM_CATEGORY,
|
'type' => TERM_CATEGORY,
|
||||||
'otype' => TERM_OBJ_POST,
|
'otype' => TERM_OBJ_POST,
|
||||||
'term' => trim($cat),
|
'term' => trim($cat),
|
||||||
'url' => ''
|
'url' => $owner_xchan['xchan_url'] . '?f=&cat=' . urlencode(trim($cat))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{{if $categories}}
|
{{if $categories}}
|
||||||
<div class="categorytags">
|
<div class="categorytags">
|
||||||
{{foreach $categories as $cat}}
|
{{foreach $categories as $cat}}
|
||||||
<span class="item-category"><i class="icon-asterisk cat-icons"></i> {{$cat.term}}{{if $cat.writeable}}<a href="{{$cat.removelink}}" class="category-remove-link" title="{{$remove}}"><i class="icon-remove drop-icons"></i></a>{{/if}}</span>
|
<span class="item-category"><i class="icon-asterisk cat-icons"></i> {{if $cat.url}}<a href="{{$cat.url}}">{{$cat.term}}</a>{{else}}{{$cat.term}}{{/if}}{{if $cat.writeable}} <a href="{{$cat.removelink}}" class="category-remove-link" title="{{$remove}}"><i class="icon-remove drop-icons"></i></a>{{/if}}</span>
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
Reference in New Issue
Block a user