diff options
author | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 02:19:06 -0500 |
---|---|---|
committer | Paul Arthur <paul.arthur@flowerysong.com> | 2013-01-26 02:19:06 -0500 |
commit | a12679b13d8d06c87308b1d26bc23c6b4fa5d92e (patch) | |
tree | d78d1a63975bfe5760bed1e6c94d38237201d807 /lib/ui.lib.php | |
parent | 80b618ba403d4560938cd1bfbed861994875d6c7 (diff) | |
download | ampache-a12679b13d8d06c87308b1d26bc23c6b4fa5d92e.tar.gz ampache-a12679b13d8d06c87308b1d26bc23c6b4fa5d92e.tar.bz2 ampache-a12679b13d8d06c87308b1d26bc23c6b4fa5d92e.zip |
Move get_user_icon from ui.lib.php to UI::get_icon
Diffstat (limited to 'lib/ui.lib.php')
-rw-r--r-- | lib/ui.lib.php | 73 |
1 files changed, 1 insertions, 72 deletions
diff --git a/lib/ui.lib.php b/lib/ui.lib.php index 7755a939..a72c4c70 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -342,78 +342,7 @@ function show_playlist_select($name,$selected='',$style='') { } // show_playlist_select -/** - * get_user_icon - * this function takes a name and a returns either a text representation - * or an <img /> tag - */ -function get_user_icon($name,$title='',$id='') { - - /* Because we do a lot of calls cache the URLs */ - static $url_cache = array(); - - // If our name is an array - if (is_array($name)) { - $hover_name = $name['1']; - $name = $name['0']; - } - - if (!$title) { $title = T_(ucfirst($name)); } - - if ($id) { - $id = ' id="' . $id . '" '; - } - - if (isset($url_cache[$name])) { - $img_url = $url_cache[$name]; - $cache_url = true; - } - - if (empty($hover_name)) { - $cache_hover = true; - $hov_txt = ''; - } - elseif (isset($url_cache[$hover_name])) { - $hover_url = $url_cache[$hover_name]; - $cache_hover = true; - } - - if (!isset($cache_url) OR !isset($cache_hover)) { - - $icon_name = 'icon_' . $name . '.png'; - - /* Build the image url */ - if (file_exists(Config::get('prefix') . Config::get('theme_path') . '/images/icons/' . $icon_name)) { - $img_url = Config::get('web_path') . Config::get('theme_path') . '/images/icons/' . $icon_name; - } - else { - $img_url = Config::get('web_path') . '/images/' . $icon_name; - } - - $url_cache[$name] = $img_url; - - /* If Hover, then build its url */ - if (!empty($hover_name)) { - $hover_icon = 'icon_' . $hover_name . '.png'; - if (file_exists(Config::get('prefix') . Config::get('theme_path') . '/images/icons/' . $icon_name)) { - $hov_url = Config::get('web_path') . Config::get('theme_path') . '/images/icons/' . $hover_icon; - } - else { - $hov_url = Config::get('web_path') . '/images/' . $hover_icon; - } - - $hov_txt = " onmouseover=\"this.src='$hov_url'; return true;\" onmouseout=\"this.src='$img_url'; return true;\" "; - $url_cache[$hover_name] = $hov_txt; - } // end hover - - } // end if not cached - - $string = '<img src="' . $img_url . '"' . $id . 'alt="' . $title . '" title="' . $title . '"' . $hov_txt . '/>'; - - return $string; - -} // get_user_icon - +// FIXME: This should probably go in XML_Data /** * xml_from_array * This takes a one dimensional array and creates a XML document from it. For |