JCSSManagerCompressBaseYuiCommand Class Reference
Inheritance diagram for
JCSSManagerCompressBaseYuiCommand:
Protected Member Functions |
|
compress ($in_files, $out_file, &$files_to_unlink) | |
COmpress given files. |
|
concat ($arr_files, Status $err) | |
Concat the gicen files into one. |
|
get_file_contents ($file) | |
Return file content. |
|
invoke_yui ($in_file, $out_file) | |
Invoke YUICOmpressor. |
|
run_yui ($in_file, $out_file, $type) | |
Invoke YUICOmpressor. |
Detailed Description
Definition at line 4 of file compress.base.cmd.php.
Member Function Documentation
JCSSManagerCompressBaseYuiCommand::compress | ( | $ | in_files, | |
$ | out_file, | |||
&$ | files_to_unlink | |||
) | [protected] |
COmpress given files.
- Returns:
- Status
Reimplemented from JCSSManagerCompressBaseCommand.
Definition at line 10 of file compress.base.cmd.php.
JCSSManagerCompressBaseYuiCommand::concat | ( | $ | arr_files, | |
Status $ | err | |||
) | [protected] |
Concat the gicen files into one.
- Parameters:
-
array $arr_files Status $err
- Returns:
- string Created concatenation file
Definition at line 29 of file compress.base.cmd.php.
00029 { 00030 $tmp_file = tempnam('/tmp', 'jcss'); 00031 if ($tmp_file === false) { 00032 $err->merge('JCSSManager: Could not create tempfile'); 00033 } 00034 else { 00035 $handle = fopen($tmp_file, 'w'); 00036 foreach($arr_files as $file) { 00037 if (substr($file, 0, 1) !== '/') { 00038 $file = Config::get_value(Config::URL_ABSPATH) . $file; 00039 } 00040 fwrite($handle, $this->get_file_contents($file)); 00041 } 00042 fclose($handle); 00043 } 00044 return $tmp_file; 00045 }
JCSSManagerCompressBaseYuiCommand::get_file_contents | ( | $ | file | ) | [protected] |
Return file content.
- Parameters:
-
string $file
- Returns:
- string
Reimplemented in JCSSManagerCompressCSSYuiCommand.
Definition at line 53 of file compress.base.cmd.php.
JCSSManagerCompressBaseYuiCommand::invoke_yui | ( | $ | in_file, | |
$ | out_file | |||
) | [protected] |
Invoke YUICOmpressor.
TO be overloaded
- Parameters:
-
string $in_file string $out_file
- Returns:
- Status
Reimplemented in JCSSManagerCompressCSSYuiCommand, and JCSSManagerCompressJSYuiCommand.
Definition at line 64 of file compress.base.cmd.php.
00064 { 00065 $ret = new Status(); 00066 return $ret; 00067 }
JCSSManagerCompressBaseYuiCommand::run_yui | ( | $ | in_file, | |
$ | out_file, | |||
$ | type | |||
) | [protected] |
Invoke YUICOmpressor.
- Parameters:
-
string $in_file string $out_file array $yui_options
- Returns:
- Status
Definition at line 77 of file compress.base.cmd.php.
00077 { 00078 $module_dir = Load::get_module_dir('jcssmanager'); 00079 $yui_cmd = 'java -jar ' . $module_dir . '3rdparty/yuicompressor/yuicompressor.jar'; 00080 00081 $yui_options = array(); 00082 $yui_options['--type'] = $type; 00083 $yui_options['--charset'] = GyroLocale::get_charset(); 00084 $yui_options['--line-break'] = 1000; 00085 $yui_options['-o'] = $out_file; 00086 00087 $yui_cmd = $yui_cmd . ' ' . Arr::implode(' ', $yui_options, ' ') . ' ' . $in_file; 00088 00089 $output = array(); 00090 $return = 0; 00091 exec($yui_cmd, $output, $return); 00092 00093 $ret = new Status(); 00094 if ($return) { 00095 $ret->append('JCSSManager: Error running yuicompressor.'); 00096 $ret->append(implode(' ', $output)); 00097 } 00098 00099 return $ret; 00100 }
The documentation for this class was generated from the following file:
- contributions/jcssmanager/behaviour/commands/jcssmanager/yui/compress.base.cmd.php