From: pdontthink Date: Sat, 30 Dec 2006 20:29:59 +0000 (+0000) Subject: Moving template utilities... help appreciated moving the other util files too X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=62f9cbcc93db88276e2aab0b46404e5580792ee0;p=squirrelmail.git Moving template utilities... help appreciated moving the other util files too git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12017 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/template.php b/functions/template.php deleted file mode 100644 index c6b46a11..00000000 --- a/functions/template.php +++ /dev/null @@ -1,79 +0,0 @@ -\n"; -} - - diff --git a/templates/util_global.php b/functions/template/template.php similarity index 58% rename from templates/util_global.php rename to functions/template/template.php index 56c832c2..aeaea5b7 100644 --- a/templates/util_global.php +++ b/functions/template/template.php @@ -1,20 +1,86 @@ \n"; +} + + /** * 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 @@ -45,14 +111,15 @@ function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text='', $w=NULL $icon = $text_icon; } } - return $icon; + return $icon; } + /** * 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 @@ -65,40 +132,43 @@ function getIconPath ($icon_theme_path, $icon_name) { if (is_null($icon_theme_path)) return NULL; - + // 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 fallback } elseif (!is_null($fallback_icon_theme_path) && is_file($fallback_icon_theme_path . $icon_name)) { return $fallback_icon_theme_path . $icon_name; - + // Icon not found, return the SQM default icon } elseif (is_file(SM_PATH . 'images/themes/default/'.$icon_name)) { return SM_PATH . 'images/themes/default/'.$icon_name; - } - + } + return NULL; } + /** * Display error messages for use in footer.tpl - * + * * @author Steve Brown * @since 1.5.2 **/ function displayErrors () { global $oErrorHandler; - + if ($oErrorHandler) { $oErrorHandler->displayErrors(); } } + /** * Make the internal show_readable_size() function available to templates. - * +//FIXME: I think this is needless since there is no reason templates cannot just call directly to show_readable_size + * * @param int size to be converted to human-readable * @return string human-readable form * @since 1.5.2 @@ -107,3 +177,4 @@ function humanReadableSize ($size) { return show_readable_size($size); } +