Source for file util_global.php
Documentation is available at util_global.php
* Utility functions for use with all templates. Do not echo output here!
* @copyright © 1999-2006 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* Checks for an image icon and returns a complete HTML img tag or a text
* string with the text icon based on what is found and user prefs.
* @param string $icon_theme_path User's chosen icon set
* @param string $icon_name File name of the desired icon
* @param string $text_icon Text-based icon to display if desired
* @param string $alt_text Optional. Text for alt/title attribute of image
* @param integer $w Optional. Width of requested image.
* @param integer $h Optional. Height of requested image.
* @return string $icon String containing icon that can be echo'ed
function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text=
'', $w=
NULL, $h=
NULL) {
$icon_path =
getIconPath($icon_theme_path, $icon_name);
// If we found an icon, build an img tag to display it. If we didn't
// find an image, we will revert back to the text icon.
$icon =
'<img src="'.
$icon_path.
'" ' .
(!empty($alt_text) ?
'title="'.
$alt_text.
'" ' :
'') .
(!is_null($w) ?
'width="'.
$w.
'" ' :
'') .
(!is_null($h) ?
'height="'.
$h.
'" ' :
'') .
* Gets the path to the specified icon or returns NULL if the image is not
* found. This has been separated from getIcon to allow the path to be fetched
* for use w/ third party packages, e.g. dTree.
* @param string $icon_theme_path User's chosen icon set
* @param string $icon_name File name of the desired icon
* @return string $icon String containing path to icon that can be used in
* an IMG tag, or NULL if the image is not found.
global $default_icon_theme;
// Desired icon exists in the current theme?
if (is_file($icon_theme_path .
$icon_name)) {
return $icon_theme_path .
$icon_name;
// Icon not found, check for the admin-specified default
} elseif (!is_null($default_icon_theme) &&
is_file($default_icon_theme .
$icon_name)) {
return $default_icon_theme .
$icon_name;
// Icon not found, return the SQM default icon
return SM_PATH .
'images/themes/default/'.
$icon_name;
* Display error messages for use in footer.tpl
* Make the internal show_readable_size() function available to templates.
* @param int size to be converted to human-readable
* @return string human-readable form
Documentation generated on Sat, 07 Oct 2006 16:14:03 +0300 by phpDocumentor 1.3.0RC6