From 1375cd362fb9e9b7b2c8d8bf88932887892d88aa Mon Sep 17 00:00:00 2001 From: vanmer Date: Sun, 9 Jul 2006 22:23:03 +0000 Subject: [PATCH] - intial revision of a template to display CSS links at the top of the page git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11377 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- templates/default/stylelink.tpl | 133 ++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 templates/default/stylelink.tpl diff --git a/templates/default/stylelink.tpl b/templates/default/stylelink.tpl new file mode 100644 index 00000000..2c514b7e --- /dev/null +++ b/templates/default/stylelink.tpl @@ -0,0 +1,133 @@ +$css_url) { + $css_file_theme=substr($css_file,0,-4); +// echo $css_file_theme; + $css_link_html.=css_link($css_url, $css_file_theme, ($css_file_theme!=$themeid), 'screen', ''); +} + +/** output CSS links **/ +echo $css_link_html; + +/** + * Function to list files within a css directory, used when querying for theme directories + * +**/ +function list_css_files($cssdir,$cssroot) { + if (!$cssroot OR !$cssdir) return false; + if (is_dir($cssdir)) { + $files=array(); + if ($dh = opendir($cssdir)) { + while (($file = readdir($dh)) !== false) { + if ((strlen($file)>3) AND strtolower(substr($file,strlen($file)-3,3))=='css') { + $files[$file]="$cssroot/$file"; + } + } + } + closedir($dh); + } + if ($files) { +// sort($files); + return $files; + } + return false; +} + +/** + * Function to create stylesheet links that will work for multiple browsers + * +**/ +function css_link($url, $name = null, $alt = true, $mtype = 'screen', $xhtml_end='/') { + global $http_site_root; + + if ( empty($url) ) + return ''; + // set to lower case to avoid errors + $browser_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] ); + + if (stristr($browser_user_agent, "msie 4")) + { + $browser = 'msie4'; + $dom_browser = false; + $is_IE = true; + } + elseif (stristr($browser_user_agent, "msie")) + { + $browser = 'msie'; + $dom_browser = true; + $is_IE = true; + } + + if ((strpos($url, '-ie')!== false) and !$is_IE) { + //not IE, so don't render this sheet + return; + } + + if ( strpos($url, 'print') !== false ) + $mtype = 'print'; + + $href = 'href="'.$url.'" '; + $media = 'media="'.$mtype.'" '; + + if ( empty($name) ) { + $title = ''; + $rel = 'rel="stylesheet" '; + } else { + $title = empty($name) ? '' : 'title="'.$name.'" '; + $rel = 'rel="'.( $alt ? 'alternate ' : '' ).'stylesheet" '; + } + + return ' \n"; +} + +/** + * $Log$ + * Revision 1.1 2006/07/09 22:23:03 vanmer + * - intial revision of a template to display CSS links at the top of the page + * + * +**/ +?> \ No newline at end of file -- 2.25.1