ZMPhpCompressor
public class ZMPhpCompressor
| Field Summary | |
|---|---|
| protected mixed | |
| protected mixed | |
| protected mixed | |
| protected mixed | |
| protected mixed | |
| protected mixed | |
| protected mixed | |
| protected mixed | |
| Method Summary | |
|---|---|
| void | __construct(mixed root, string out, string temp) Create new instance. |
| void | clean() Clean up all temp. |
| boolean | compress() Compress accoding to the current settings. |
| protected void | compressToSingleFile(string in, string outfile) Compress all files into a single file |
| protected array | finaliseFiles(array files) Empty callback to make final adjustments to the file list before compressing to a single file. |
| static array | findIncludes(string dir, string ext, boolean recursive) Scan (recursively) for .php files. |
| protected void | flattenDirStructure(string in, string out) Flatten the directory structure. |
| array | Get errors. |
| boolean | Check for errors. |
| void | setOut(string out) Set the output filename. |
| void | setRoot(mixed root) Set the root folder(s). |
| void | setStripCode(boolean strip) Configure whether or not to strip the compressed code. |
| void | setStripRef(boolean strip) Configure whether or not to strip the use of references; eg. |
| void | setTemp(string temp) Set the temp folder. |
| protected void | stripPhpDir(string in, string out, boolean recursive) Recursivley strip a directory. |
| protected void | stripPhpFile(string in, string out) Strip a PHP file. |
| protected string | stripPhpSource(string source) Strip the given PHP source text. |
protected mixed $errors_
protected mixed $flatFolder_
protected mixed $outputFilename_
protected mixed $rootFolders_
protected mixed $stripCode_
protected mixed $stripRef_
protected mixed $strippedFolder_
protected mixed $tempFolder_
public void __construct(mixed root, string out, string temp)
Create new instance.
null.null.null.public void clean()
Clean up all temp. files.
public boolean compress()
Compress accoding to the current settings.
true if successful, false on failure.protected void compressToSingleFile(string in, string outfile)
Compress all files into a single file
protected array finaliseFiles(array files)
Empty callback to make final adjustments to the file list before compressing to a single file.
public static array findIncludes(string dir, string ext, boolean recursive)
Scan (recursively) for .php files.
It is worth mentioning that directories will always be processed only after all plain files in a directory are done.
true, scan recursively..php files.protected void flattenDirStructure(string in, string out)
Flatten the directory structure.
public array getErrors()
Get errors.
public boolean hasErrors()
Check for errors.
true if errors exist.public void setOut(string out)
Set the output filename.
public void setRoot(mixed root)
Set the root folder(s).
null.public void setStripCode(boolean strip)
Configure whether or not to strip the compressed code.
Disabling stripping will have the following effects:
public void setStripRef(boolean strip)
Configure whether or not to strip the use of references; eg. &$ or = &.
public void setTemp(string temp)
Set the temp folder.
protected void stripPhpDir(string in, string out, boolean recursive)
Recursivley strip a directory.
Uses self::findIncludes() to find files to process.
protected void stripPhpFile(string in, string out)
Strip a PHP file.
null just echo; default is null.protected string stripPhpSource(string source)
Strip the given PHP source text.
Generic PHP code compressor.
Can be used to compress all PHP files of a given folder or folder tree into a single PHP file.
Supports some archaic form of inheritance/dependencies in that levels are processed one after the other. That means that a class in a second level folder may extend any class that resides in the root folder or any first level folder.
If no temp folder is configured, the location of this file will be used to store temporary files and folders.
This class maintains its own version of
findIncludes()as theZMLoaderversion does not reflect the hierachy (any more).