* if(!@is_object($GLOBALS['phpgw']->css))
* {
* $GLOBALS['phpgw']->css = CreateObject('phpgwapi.css');
* }
*
*/
class css
{
private $files = array( );
function css()
{
}
function create_pack($cssFile){
require_once('csstidy/class.csstidy.php');
$csstidy = new csstidy();
$csstidy->load_template('highest_compression');
$cssFilePath=PHPGW_SERVER_ROOT.SEP.$cssFile.'pack.css';
$fp = fopen($cssFilePath, 'w');
if ($csstidy->parse(file_get_contents(PHPGW_SERVER_ROOT.SEP.$cssFile)))
fwrite($fp, $csstidy->print->plain());
}
function get_css()
{
$path = ( ! empty( $GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ] ) ) ?
$GLOBALS[ 'phpgw_info' ][ 'server' ][ 'webserver_url' ] : '/';
if ( strpos( $path, '/' ) != ( strlen( $path ) - 1 ) )
$path .= '/';
if ($GLOBALS['phpgw_info']['server']['csspacker'] == "True")
foreach($this->files as $cssFile)
{
if (!file_exists(PHPGW_SERVER_ROOT.SEP.$cssFile."pack.css"))
$this->create_pack($cssFile);
$out .= "\n\t\t";
}
else
foreach($this->files as $cssFile)
{
$_SESSION['debug'][] = "/".$cssFile;
$out .= "\n\t\t";
}
return $out;
}
function validate_file($file, $stack = false )
{
if (file_exists(PHPGW_SERVER_ROOT . SEP . $file))
$this->files[] = $file;
}
}
?>