aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2012-09-05 20:49:12 +0000
committerrvelices <rv-github@modusoptimus.com>2012-09-05 20:49:12 +0000
commit53a0522894ac474e5e614f2d0d1894b21ab0216f (patch)
tree7d03c076e0c8f4887b7be61951660f97277d42f0 /admin/include/functions.php
parent5f23fa1473dbbaacd9a6e76db255ac8378301e6f (diff)
merge-r17765 from trunk to branch 2.4 feature 2737: improve tag administration screen
show for every tag - the number of photos - link to public index page - link to batch manager edit add an event for extended description multi language strings (used for autocompletion and shown in the tag admin screen) instead of hard coded in the core [lang=.. git-svn-id: http://piwigo.org/svn/branches/2.4@17766 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r--admin/include/functions.php67
1 files changed, 39 insertions, 28 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index d67e97d69..3d17e2a0a 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -1205,7 +1205,7 @@ function create_virtual_category($category_name, $parent_id=null, $options=array
{
return array('error' => l10n('The name of an album must not be empty'));
}
-
+
$insert = array(
'name' => $category_name,
'rank' => 0,
@@ -1474,11 +1474,14 @@ DELETE
}
}
- mass_inserts(
- IMAGE_TAG_TABLE,
- array_keys($inserts[0]),
- $inserts
- );
+ if (count($inserts))
+ {
+ mass_inserts(
+ IMAGE_TAG_TABLE,
+ array_keys($inserts[0]),
+ $inserts
+ );
+ }
}
}
@@ -2095,38 +2098,46 @@ function get_taglist($query, $only_user_language=true)
$result = pwg_query($query);
$taglist = array();
+ $altlist = array();
while ($row = pwg_db_fetch_assoc($result))
{
- if (!$only_user_language and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
+ $raw_name = $row['name'];
+ $name = trigger_event('render_tag_name', $raw_name);
+
+ $taglist[] = array(
+ 'name' => $name,
+ 'id' => '~~'.$row['id'].'~~',
+ );
+
+ if (!$only_user_language)
{
- foreach ($matches[2] as $tag_name)
+ $alt_names = trigger_event('get_tag_alt_names', array(), $raw_name);
+
+ // TEMP 2.4
+ if (count($alt_names)==0 and preg_match_all('#\[lang=(.*?)\](.*?)\[/lang\]#is', $row['name'], $matches))
{
- array_push(
- $taglist,
- array(
- 'name' => trigger_event('render_tag_name', $tag_name),
+ foreach ($matches[2] as $alt)
+ {
+ $alt_names[] = $alt;
+ }
+ }
+
+ foreach( array_diff( array_unique($alt_names), array($name) ) as $alt)
+ {
+ $altlist[] = array(
+ 'name' => $alt,
'id' => '~~'.$row['id'].'~~',
- )
);
}
-
- $row['name'] = preg_replace('#\[lang=(.*?)\](.*?)\[/lang\]#is', null, $row['name']);
- }
-
- if (strlen($row['name']) > 0)
- {
- array_push(
- $taglist,
- array(
- 'name' => trigger_event('render_tag_name', $row['name']),
- 'id' => '~~'.$row['id'].'~~',
- )
- );
}
}
- $cmp = create_function('$a,$b', 'return strcasecmp($a["name"], $b["name"]);');
- usort($taglist, $cmp);
+ usort($taglist, 'tag_alpha_compare');
+ if (count($altlist))
+ {
+ usort($altlist, 'tag_alpha_compare');
+ $taglist = array_merge($taglist, $altlist);
+ }
return $taglist;
}