| core_util

# Class: Bs_Stripper Source Location: /core/util/Bs_Stripper.class.php
### Class Overview
    Bs_Object
       |
       --Bs_Stripper
This class provides some functions to strip php code. #### Author(s): Sam Blum <at blueshoes dot org> #### Version: 4.3.$Revision: 1.2 $ $Date: 2003/10/29 17:48:43 $ #### Copyright: blueshoes.org | ### Variables $useSpecializedJsStripper $useSpecializedPhpStripper $_preserveCodeHash | ### Methods Bs_Stripper strip stripFile stripJs stripPhp
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 38] This class provides some functions to strip php code. Strip code, that means: remove comments and formatting from code. make it still usable (properly executable) but not readable. this has 2 advantages: a) protect it in some way, stealing code is a hell of a lot more complicated for larger things. b) make javascript code faster. for php code there is really no difference in speed. it can be used for js, but all that's recommened is to remove comments. newlines should be left unchanged. no dependencies here. #### Tags:
example: | example
version: | 4.3.$Revision: 1.2 $ $Date: 2003/10/29 17:48:43 $
status: | experimental
copyright: | blueshoes.org
author: | Sam Blum <at blueshoes dot org>
[ Top ] ### Class Variables #### $useSpecializedJsStripper = TRUE [line 53] #### Tags:
var: | (default is TRUE)
see: | var $useSpecializedPhpStripper
access: | public
Type: | bool
[ Top ] #### $useSpecializedPhpStripper = TRUE [line 46] #### Tags:
var: | (default is TRUE)
see: | var $useSpecializedJsStripper
access: | public
Type: | bool
[ Top ] #### $_preserveCodeHash = array() [line 62]
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_Stripper [line 81]
`Bs_Stripper Bs_Stripper( )`
constructor. [ Top ] ### method strip [line 178]
`string strip( string $toStripTxt, [int $stripModifier = BS_STRIP_ALL], [bool $debug = FALSE], [mixed $internalCall = FALSE])`
strips the given string using regular expressions. #### Tags:
return: | (new stripped text)
see: | $this->stripFile()
access: | public
#### Parameters:
string | $toStripTxt | (the text that will be stripped)
int | $stripModifier | (use the constants)
bool | $debug | (default is FALSE)
[ Top ] ### method stripFile [line 255]
`bool stripFile( string $sourceFile, string $targetFile, [int $stripModifier = BS_STRIP_ALL], [string $header = ''], [bool $debug = FALSE])`
strips the file specified. uses $this->stripPhp(), $this->stripJs() and/or $this->strip(). #### Tags:
return: | (TRUE on success, FALSE on failure, use getLastErrors().)
see: | Bs_Stripper::strip(), Bs_Stripper::stripPhp(), Bs_Stripper::stripJs()
access: | public
#### Parameters:
string | $sourceFile | (absolute path to the source file.)
string | $targetFile | (absolute path to the destination file. may be the same as $sourceFile. existing file will be overwritten.)
int | $stripModifier | (use the constants)
string | $header | (if you want to put a header into the new string, for example a copyright notice.)
bool | $debug | (default is FALSE)
[ Top ] ### method stripJs [line 300]
`string stripJs( string $string, [int $stripModifier = BS_STRIP_ALL], [bool $debug = FALSE])`
recommended way of stripping js code, uses Bs_JsCruncher. #### Tags:
access: | public
#### Parameters:
string | $string |
bool | $debug | (currently not supported)
int | $stripModifier | stripModifier (currently not supported, strips all)
[ Top ] ### method stripPhp [line 111]
`string stripPhp( string $toStripTxt, [int $stripModifier = BS_STRIP_ALL], [bool $debug = FALSE])`
Spezial stripper for PHP data. Uses PHP's highlight_string() and should be able to remove 100% of all comment. Should work with PHP code that has HTML sections too. NOTE: - Can only strip ALL comments at once; so if any comment flag is up, we strip all comments If BS_STRIP_FORMAT is set then we make a call to $this->strip() that uses regex to strip and is not that rock solid. (PHP + HTML mix may fail). #### Tags:
return: | (new stripped text)
see: | $this->stripFile()
access: | public
#### Parameters:
string | $toStripTxt | (the text that will be stripped)
int | $stripModifier | (use the constants)
bool | $debug | (default is FALSE)
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:13:01 +0100 by phpDocumentor 1.2.3