.

JCSSManagerCompressCSSCsstidyCommand Class Reference

Inheritance diagram for JCSSManagerCompressCSSCsstidyCommand:
JCSSManagerCompressBaseCommand CommandDelegate ICommand IAction ISerializable

List of all members.

Public Member Functions

  __construct ($in_files, $out_file, $type)
  COnstructor.

Protected Member Functions

  compress ($in_files, $out_file, &$files_to_unlink)
  COmpress given files.
  get_db_type ()
  Returns type of compressed file.
  run_csstidy ($css, $out_file)
  Invoke CSS Tidy.

Protected Attributes

  $type

Detailed Description

Definition at line 4 of file compress.css.cmd.php.


Constructor & Destructor Documentation

JCSSManagerCompressCSSCsstidyCommand::__construct ( in_files,
out_file,
type  
)

COnstructor.

Parameters:
$in_files  array
$out_file  string
Returns:
void

Definition at line 14 of file compress.css.cmd.php.

00014                                                                  {
00015                 $this->type = $type;
00016                 parent::__construct($in_files, $out_file);
00017         }       

Member Function Documentation

JCSSManagerCompressCSSCsstidyCommand::compress ( in_files,
out_file,
&$  files_to_unlink  
) [protected]

COmpress given files.

Returns:
Status

Reimplemented from JCSSManagerCompressBaseCommand.

Definition at line 24 of file compress.css.cmd.php.

00024                                                                              {
00025                 $ret = new Status();
00026                 if (count($in_files) > 0) {
00027                         $ret->merge($this->run_csstidy(JCSSManager::concat_css_files($in_files), $out_file));
00028                 }
00029                 
00030                 return $ret;
00031         }
JCSSManagerCompressCSSCsstidyCommand::get_db_type (  )  [protected]

Returns type of compressed file.

Returns:
string One of TYPE_X constants

Reimplemented from JCSSManagerCompressBaseCommand.

Definition at line 38 of file compress.css.cmd.php.

00038                                          {
00039                 return $this->type;
00040         }
JCSSManagerCompressCSSCsstidyCommand::run_csstidy ( css,
out_file  
) [protected]

Invoke CSS Tidy.

Parameters:
strnig  $css
string  $out_file
Returns:
Status

Definition at line 49 of file compress.css.cmd.php.

00049                                                         {
00050                 $ret = new Status();
00051                 
00052                 $old_lang = GyroLocale::set_locale('C');
00053                 $module_dir = Load::get_module_dir('jcssmanager');
00054                 require_once $module_dir . '3rdparty/csstidy/class.csstidy.php';
00055 
00056                 $tidy = new csstidy();
00057                 $tidy->set_cfg('remove_last_;',TRUE);
00058                 //$tidy->set_cfg('merge_selectors', 0);
00059                 $tidy->load_template('highest_compression');
00060                 $tidy->parse($css);
00061 
00062                 if (file_put_contents($out_file, $tidy->print->plain()) === false) {
00063                         $ret->append('CSS Tidy: Could not write output file ' . $out_file);
00064                 }               
00065                 GyroLocale::set_locale($old_lang);
00066                 return $ret;            
00067         } 

Member Data Documentation

JCSSManagerCompressCSSCsstidyCommand::$type [protected]

Definition at line 5 of file compress.css.cmd.php.


The documentation for this class was generated from the following file: