Index: extensions/typetags/include/events_public.inc.php
===================================================================
--- extensions/typetags/typetags.php (revision 21361)
+++ extensions/typetags/include/events_public.inc.php (revision 26665)
@@ -1,37 +1,71 @@
[/lang]".$tag."[lang=all][/lang]";
+ $ret = '[lang=all][/lang]' . $tag_name . '[lang=all][/lang]';
}
else
{
- return "".$tag."";
+ $ret = '' . $tag_name . '';
}
+
+ $typetags_cache['tags'][$tag_name] = $ret;
+ return $ret;
}
@@ -42,13 +76,13 @@
{
global $template;
-
+
$tags = $template->get_template_vars('related_tags');
if (empty($tags)) return;
-
+
$query = '
SELECT
t.id ,
tt.color
- FROM '.typetags_TABLE.' AS tt
+ FROM '.TYPETAGS_TABLE.' AS tt
INNER JOIN '.TAGS_TABLE.' AS t
ON t.id_typetags = tt.id
@@ -65,5 +99,5 @@
}
}
-
+
$template->clear_assign('related_tags');
$template->assign('related_tags', $tags);
@@ -75,72 +109,79 @@
function typetags_tags()
{
- global $template;
+ global $template, $page, $tags;
+
+ if (empty($tags))
+ {
+ return;
+ }
$query = '
SELECT
- t.id ,
+ t.id,
tt.color
- FROM '.typetags_TABLE.' AS tt
- INNER JOIN '.TAGS_TABLE.' AS t
- ON t.id_typetags = tt.id
+ FROM ' . TYPETAGS_TABLE . ' AS tt
+ INNER JOIN ' . TAGS_TABLE . ' AS t
+ ON t.id_typetags = tt.id
WHERE t.id_typetags IS NOT NULL
;';
- $tagsColor = simple_hash_from_query($query, 'id', 'color');
- if (empty($tagsColor)) return;
+ $tagsColor = query2array($query, 'id', 'color');
- $display = $template->get_template_vars('display_mode');
- if ($display == 'letters')
+ if (empty($tagsColor))
+ {
+ return;
+ }
+
+ // LETTERS
+ if ($page['display_mode'] == 'letters')
{
$letters = $template->get_template_vars('letters');
- if (empty($letters)) return;
- foreach ($letters as $k1 => $letter)
+ foreach ($letters as &$letter)
{
- foreach ($letter['tags'] as $k2 => $tag)
+ foreach ($letter['tags'] as &$tag)
{
if (isset($tagsColor[ $tag['id'] ]))
{
- $letters[$k1]['tags'][$k2]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';';
+ $tag['URL'].= '" style="color:' . $tagsColor[ $tag['id'] ] . ';';
}
}
+ unset($tag);
}
-
- $template->clear_assign('letters');
+ unset($letter);
+
$template->assign('letters', $letters);
}
- elseif ($display == 'cloud')
+ // CLOUD
+ else if ($page['display_mode'] == 'cloud')
{
$tags = $template->get_template_vars('tags');
- if (empty($tags)) return;
- foreach ($tags as $key => $tag)
+ foreach ($tags as &$tag)
{
if (isset($tagsColor[ $tag['id'] ]))
{
- $tags[$key]['URL'].= '" style="color:'.$tagsColor[ $tag['id'] ].';';
+ $tag['URL'].= '" style="color:' . $tagsColor[ $tag['id'] ] . ';';
}
}
-
- $template->clear_assign('tags');
+ unset($tag);
+
$template->assign('tags', $tags);
}
- elseif ($display == 'cumulus')
+ // CUMULUS
+ else if ($page['display_mode'] == 'cumulus')
{
$tags = $template->get_template_vars('tags');
- if (empty($tags)) return;
- foreach ($tags as $key => $tag)
+ foreach ($tags as &$tag)
{
if (isset($tagsColor[ $tag['id'] ]))
{
$tagsColor[ $tag['id'] ] = str_replace('#', '0x', $tagsColor[ $tag['id'] ]);
- $tags[$key]['URL'].= '\' color=\''.$tagsColor[ $tag['id'] ].'\' hicolor=\''.$tagsColor[ $tag['id'] ];
+ $tag['URL'].= '\' color=\'' . $tagsColor[ $tag['id'] ] . '\' hicolor=\'' . $tagsColor[ $tag['id'] ];
}
}
-
- $template->clear_assign('tags');
+ unset($tag);
+
$template->assign('tags', $tags);
}
}
-
-?>