<?php
class cleanCss
{
public $input;
public $output;
public $debug;
public $cache_path;
function __construct( $debug = false )
{
$this->debug = $debug;
}
function clean( $input, $cache_path )
{
$this->input = $input;
$this->cache_path = $cache_path;
{
$this->output = preg_replace( '!/*(.*?)*/!', '', $this->input ); $this->output = trim( $this->output ); if( $this->debug == true )
$this->log( $out );
$this->save();
}
else
$this->output = $this->input;
return $this->output;
}
function save()
{
$f = fopen( $this->cache_path . 'style.css', 'w+' ); }
function log( $array )
{
$i = 0;
foreach( $array as $arr )
{
if( $i > 0
) { echo 'Deleted unnecessary contents. <br/><pre>' . $arr[0] . '</pre><hr/>'; }; $i++; }
}
}
class cacheCss
{
const OPTIMIZE_CSS = true;
public $csspath = 'style.css';
public $cleaner;
public $csscachepath = 'cache/css/';
function __construct( $file, $cleanobject )
{
$this->csspath = $file;
$this->cleaner = $cleanobject;
}
function load()
{
if( $this->checkInCache() )
return $this->loadFromCache();
else
{
switch( self::OPTIMIZE_CSS )
{
case true:
return $this->cleaner->clean( $this->loadFromFile(), $this->csscachepath );
case false:
return $this->loadFromFile();
}
}
return false;
}
function loadFromFile()
{
}
function loadFromCache()
{
return implode( "n", file( $this->csscachepath . 'style.css' ) ); }
function checkInCache()
{
return file_exists( $this->csscachepath . $this->csspath ); }
}
$css = new cacheCss( 'style.css', new cleanCss( true ) );
$css->load();
?>
i teraz problem jest taki ze wywolanie metody load obiektu cachecss ma powodowac wywolanie metody clean obiektu cleancss, jednak niby jest on wykonywany, ale nic nie zwraca.... chociaz w kazdym przypadku poowinien zwracac cokolwiek ..
prosze o pomoc