5 * CSS Utility functions for use with all templates. Do not echo output here!
7 * @copyright © 1999-2006 The SquirrelMail Project Team
8 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @package squirrelmail
11 * @subpackage templates
15 * Function to list files within a css directory, used when querying for theme directories
18 function list_css_files($cssdir,$cssroot) {
19 if (!$cssroot OR !$cssdir) return false;
21 if (is_dir($cssdir)) {
22 if ($dh = opendir($cssdir)) {
23 while (($file = readdir($dh)) !== false) {
24 if ((strlen($file)>3) AND strtolower(substr($file,strlen($file)-3,3))=='css') {
25 $files[$file]="$cssroot/$file";
31 if (count($files)>0) {
39 * Function to create stylesheet links that will work for multiple browsers
42 function css_link($url, $name = null, $alt = true, $mtype = 'screen', $xhtml_end='/') {
43 global $http_site_root;
47 // set to lower case to avoid errors
48 $browser_user_agent = strtolower( $_SERVER['HTTP_USER_AGENT'] );
50 if (stristr($browser_user_agent, "msie 4"))
56 elseif (stristr($browser_user_agent, "msie"))
63 if ((strpos($url, '-ie')!== false) and !$is_IE) {
64 //not IE, so don't render this sheet
68 if ( strpos($url, 'print') !== false )
71 $href = 'href="'.$url.'" ';
72 $media = 'media="'.$mtype.'" ';
76 $rel = 'rel="stylesheet" ';
78 $title = empty($name) ?
'' : 'title="'.$name.'" ';
79 $rel = 'rel="'.( $alt ?
'alternate ' : '' ).'stylesheet" ';
82 return ' <link '.$media.$title.$rel.'type="text/css" '.$href." $xhtml_end>\n";