diff options
author | mistic100 <mistic@piwigo.org> | 2011-06-22 16:38:58 +0000 |
---|---|---|
committer | mistic100 <mistic@piwigo.org> | 2011-06-22 16:38:58 +0000 |
commit | 99d78adde75e434b7139a4288aed5fcdfd2d2990 (patch) | |
tree | 6de364cd2226f38f7ac3e7cee63eac8e8b3a87f8 /admin/include/functions.php | |
parent | 029688227b8c004ce660e06c61330c125f8b1c21 (diff) |
feature:2322 display all localisations as independant tags in TokenInput
git-svn-id: http://piwigo.org/svn/trunk@11487 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/functions.php | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php index 487327fd4..c19c202ca 100644 --- a/admin/include/functions.php +++ b/admin/include/functions.php @@ -2104,18 +2104,37 @@ function get_taglist($query) $taglist = array(); while ($row = pwg_db_fetch_assoc($result)) { - array_push( - $taglist, - array( - 'name' => trigger_event('render_tag_name', $row['tag_name']), - 'id' => '~~'.$row['tag_id'].'~~', - ) - ); + if (preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['tag_name'], $matches)) + { + foreach ($matches[2] as $tag_name) + { + array_push( + $taglist, + array( + 'name' => trigger_event('render_tag_name', $tag_name), + 'id' => '~~'.$row['tag_id'].'~~', + ) + ); + } + + $row['tag_name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['tag_name']); + } + + if (strlen($row['tag_name']) > 0) + { + array_push( + $taglist, + array( + 'name' => trigger_event('render_tag_name', $row['tag_name']), + 'id' => '~~'.$row['tag_id'].'~~', + ) + ); + } } $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);'); usort($taglist, $cmp); - + return $taglist; } |