From 99d78adde75e434b7139a4288aed5fcdfd2d2990 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Wed, 22 Jun 2011 16:38:58 +0000 Subject: feature:2322 display all localisations as independant tags in TokenInput git-svn-id: http://piwigo.org/svn/trunk@11487 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/functions.php | 35 +++++++++++++++++++++++++++-------- admin/tags.php | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'admin') 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; } diff --git a/admin/tags.php b/admin/tags.php index 8cc997f60..67cc9bf3c 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -221,7 +221,7 @@ $orphan_tags = get_orphan_tags(); $orphan_tag_names = array(); foreach ($orphan_tags as $tag) { - array_push($orphan_tag_names, $tag['name']); + array_push($orphan_tag_names, trigger_event('render_tag_name', $tag['name'])); } if (count($orphan_tag_names) > 0) -- cgit v1.2.3