From cc558d869496f051c1b667d37e4dcfc474c007d1 Mon Sep 17 00:00:00 2001 From: rvelices Date: Thu, 4 Oct 2012 04:15:28 +0000 Subject: php optimizations: - use faster [] operator instead of array_push - if tags are grouped by letter, don't add level to tags, sort etc ... git-svn-id: http://piwigo.org/svn/trunk@18455 68402e56-0260-453c-a942-63ccdbb3a9ee --- tags.php | 58 ++++++++++++++++++++++++++++------------------------------ 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'tags.php') diff --git a/tags.php b/tags.php index ab6fa6fd2..518d46e58 100644 --- a/tags.php +++ b/tags.php @@ -159,43 +159,41 @@ if ($page['display_mode'] == 'letters') { ); } } +else +{ + // +-----------------------------------------------------------------------+ + // | tag cloud construction | + // +-----------------------------------------------------------------------+ -// +-----------------------------------------------------------------------+ -// | tag cloud construction | -// +-----------------------------------------------------------------------+ - -// we want only the first most represented tags, so we sort them by counter -// and take the first tags -usort($tags, 'counter_compare'); -$tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); + // we want only the first most represented tags, so we sort them by counter + // and take the first tags + usort($tags, 'counter_compare'); + $tags = array_slice($tags, 0, $conf['full_tag_cloud_items_number']); -// depending on its counter and the other tags counter, each tag has a level -$tags = add_level_to_tags($tags); + // depending on its counter and the other tags counter, each tag has a level + $tags = add_level_to_tags($tags); -// we want tags diplayed in alphabetic order -if ('letters' != $page['display_mode']) -{ + // we want tags diplayed in alphabetic order usort($tags, 'tag_alpha_compare'); -} -// display sorted tags -foreach ($tags as $tag) -{ - $template->append( - 'tags', - array_merge( - $tag, - array( - 'URL' => make_index_url( - array( - 'tags' => array($tag), - ) - ), + // display sorted tags + foreach ($tags as $tag) + { + $template->append( + 'tags', + array_merge( + $tag, + array( + 'URL' => make_index_url( + array( + 'tags' => array($tag), + ) + ), + ) ) - ) - ); + ); + } } - // include menubar $themeconf = $template->get_template_vars('themeconf'); if (!isset($themeconf['hide_menu_on']) OR !in_array('theTagsPage', $themeconf['hide_menu_on'])) -- cgit v1.2.3