source: trunk/phpgwapi/inc/class.css.inc.php @ 2643

Revision 2643, 2.0 KB checked in by amuller, 14 years ago (diff)

Ticket #1044 - enviando arquivo faltante

  • Property svn:executable set to *
Line 
1<?php
2  /**************************************************************************\
3  * Expresso API - CSS                                                       *
4  * ------------------------------------------------------------------------ *
5  *  This program is Free Software; you can redistribute it and/or modify it *
6  *  under the terms of the GNU General Public License as published by the   *
7  *  Free Software Foundation; either version 2 of the License, or (at your  *
8  *  option) any later version.                                              *
9  \**************************************************************************/
10
11       /**
12       * Expresso CSS support class
13       *
14       * Only instanstiate this class using:
15       * <code>
16       *  if(!@is_object($GLOBALS['phpgw']->css))
17       *  {
18       *    $GLOBALS['phpgw']->css = CreateObject('phpgwapi.css');
19       *  }
20       * </code>
21       */
22        class css
23        {
24                private $files = array( );
25               
26                function css()
27                {
28
29                }
30               
31                function create_pack($cssFile){
32                        require_once('csstidy/class.csstidy.php');
33                        $csstidy = new csstidy();
34                        $csstidy->load_template('highest_compression');
35                        $cssFilePath=PHPGW_SERVER_ROOT.SEP.$cssFile.'pack.css';
36                        $fp = fopen($cssFilePath, 'w');
37                        if ($csstidy->parse(file_get_contents(PHPGW_SERVER_ROOT.SEP.$cssFile)))
38                                fwrite($fp, $csstidy->print->plain());
39                }
40
41                function get_css()
42                {
43                        if ($GLOBALS['phpgw_info']['server']['csspacker'] == "True")
44                                  foreach($this->files as $cssFile)
45                                  {
46                                          if (!file_exists(PHPGW_SERVER_ROOT.SEP.$cssFile."pack.css"))
47                                                $this->create_pack($cssFile);
48                                          $out .= "\n\t\t<link href='".$cssFile."pack.css' type='text/css' rel='StyleSheet'>";
49                                         
50                                  }
51                          else
52                                  foreach($this->files as $cssFile)
53                                          $out .= "\n\t\t<link href='".$cssFile."' type='text/css' rel='StyleSheet'>";
54                          return $out;
55                }
56
57                function validate_file($file, $stack = false )
58                {
59                        if (file_exists(PHPGW_SERVER_ROOT ."/". $file))
60                                $this->files[] = $file;
61                }
62        }
63?>
Note: See TracBrowser for help on using the repository browser.