mirror of
https://github.com/friendica/friendica
synced 2025-04-25 23:10:12 +00:00
allow users to set categories on their posts
This commit is contained in:
parent
06e9a8b7a0
commit
581b54c974
11 changed files with 226 additions and 18 deletions
|
@ -103,3 +103,31 @@ function fileas_widget($baseurl,$selected = '') {
|
|||
));
|
||||
}
|
||||
|
||||
function categories_widget($baseurl,$selected = '') {
|
||||
$a = get_app();
|
||||
|
||||
$saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
|
||||
if(! strlen($saved))
|
||||
return;
|
||||
|
||||
$matches = false;
|
||||
$terms = array();
|
||||
$cnt = preg_match_all('/<(.*?)>/',$saved,$matches,PREG_SET_ORDER);
|
||||
if($cnt) {
|
||||
foreach($matches as $mtch) {
|
||||
$unescaped = xmlify(file_tag_decode($mtch[1]));
|
||||
$terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
|
||||
}
|
||||
}
|
||||
|
||||
return replace_macros(get_markup_template('categories_widget.tpl'),array(
|
||||
'$title' => t('Categories'),
|
||||
'$desc' => '',
|
||||
'$sel_all' => (($selected == '') ? 'selected' : ''),
|
||||
'$all' => t('Everything'),
|
||||
'$terms' => $terms,
|
||||
'$base' => $baseurl,
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue