- added new utils_css file to contain CSS-related functions for use in templates
authorvanmer <vanmer@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 10 Jul 2006 15:48:51 +0000 (15:48 +0000)
committervanmer <vanmer@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 10 Jul 2006 15:48:51 +0000 (15:48 +0000)
- altered stylelink template to use new util_css.php file for all function definitions

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11388 7612ce4b-ef26-0410-bec9-ea0150e637f0

templates/default/stylelink.tpl
templates/util_css.php [new file with mode: 0644]

index 45d87a6abb42c8a5cb833d70963a52a8b9715c43..d3e1f940f41f1ed55e37d7c0922b9094c263a1ee 100644 (file)
@@ -12,7 +12,7 @@
  */
 
 /** add required includes */
-
+require_once(SM_PATH.'templates/util_css.php');
 
 /** extract variables */
 extract($t);
@@ -52,79 +52,12 @@ foreach ($base_css_files as $css_file=>$css_url) {
 /** 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;
-    $files=array();
-   if (is_dir($cssdir)) {
-        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 (count($files)>0) {
-//        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 '    <link '.$media.$title.$rel.'type="text/css" '.$href." $xhtml_end>\n";
-}
-
 /**
  * $Log$
+ * Revision 1.3  2006/07/10 15:48:51  vanmer
+ * - added new utils_css file to contain CSS-related functions for use in templates
+ * - altered stylelink template to use new util_css.php file for all function definitions
+ *
  * Revision 1.2  2006/07/09 22:37:35  vanmer
  * - added variable initalization and check on variable
  *
diff --git a/templates/util_css.php b/templates/util_css.php
new file mode 100644 (file)
index 0000000..98e21a4
--- /dev/null
@@ -0,0 +1,94 @@
+<?php
+/**
+ * util_css.php
+ *
+ * CSS Utility functions for use with all templates.  Do not echo output here!
+ *
+ * @copyright &copy; 1999-2006 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage templates
+ */
+/**
+ * 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;
+    $files=array();
+   if (is_dir($cssdir)) {
+        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 (count($files)>0) {
+//        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 '    <link '.$media.$title.$rel.'type="text/css" '.$href." $xhtml_end>\n";
+}
+
+
+/**
+ * $Log$
+ * Revision 1.1  2006/07/10 15:48:50  vanmer
+ * - added new utils_css file to contain CSS-related functions for use in templates
+ * - altered stylelink template to use new util_css.php file for all function definitions
+ *
+**/
+
+?>
\ No newline at end of file