|
static | minify ($js, $options=array()) |
| Takes a string containing javascript and removes unneeded characters in order to shrink the code without altering it's functionality. More...
|
|
|
| minifyDirectToOutput ($js, $options) |
| Processes a javascript string and outputs only the required characters, stripping out all unneeded characters. More...
|
|
| initialize ($js, $options) |
| Initializes internal variables, normalizes new lines,. More...
|
|
| loop () |
| The primary action occurs here. More...
|
|
| clean () |
| Resets attributes that do not need to be stored between requests so that the next request is ready to go. More...
|
|
| getChar () |
| Returns the next string for processing based off of the current index. More...
|
|
| getReal () |
| This function gets the next "real" character. More...
|
|
| processOneLineComments ($startIndex) |
| Removed one line comments, with the exception of some very specific types of conditional comments. More...
|
|
| processMultiLineComments ($startIndex) |
| Skips multiline comments where appropriate, and includes them where needed. More...
|
|
| getNext ($string) |
| Pushes the index ahead to the next instance of the supplied string. More...
|
|
| saveString () |
| When a javascript string is detected this function crawls for the end of it and saves the whole string. More...
|
|
| saveRegex () |
| When a regular expression is detected this function crawls for the end of it and saves the whole regex. More...
|
|
| lock ($js) |
| Replace patterns in the given string and store the replacement. More...
|
|
| unlock ($js) |
| Replace "locks" with the original characters. More...
|
|
Definition at line 30 of file JShrink.php.
Resets attributes that do not need to be stored between requests so that the next request is ready to go.
Another reason for this is to make sure the variables are cleared and are not taking up memory.
Definition at line 246 of file JShrink.php.
Returns the next string for processing based off of the current index.
- Returns
- string
Definition at line 260 of file JShrink.php.
Pushes the index ahead to the next instance of the supplied string.
If it is found the first character of the string is returned and the index is set to it's position.
- Parameters
-
- Returns
- string|false Returns the first character of the string or false.
Definition at line 412 of file JShrink.php.
This function gets the next "real" character.
It is essentially a wrapper around the getChar function that skips comments. This has significant performance benefits as the skipping is done using native functions (ie, c code) rather than in script php.
- Returns
- string Next 'real' character to be processed.
- Exceptions
-
Definition at line 299 of file JShrink.php.
initialize |
( |
|
$js, |
|
|
|
$options |
|
) |
| |
|
protected |
Initializes internal variables, normalizes new lines,.
- Parameters
-
string | $js | The raw javascript to be minified |
array | $options | Various runtime options in an associative array |
Definition at line 152 of file JShrink.php.
static isAlphaNumeric |
( |
|
$char | ) |
|
|
staticprotected |
Checks to see if a character is alphanumeric.
- Parameters
-
string | $char | Just one character |
- Returns
- bool
Definition at line 535 of file JShrink.php.
Replace patterns in the given string and store the replacement.
- Parameters
-
string | $js | The string to lock |
- Returns
- bool
Definition at line 546 of file JShrink.php.
The primary action occurs here.
This function loops through the input string, outputting anything that's relevant and discarding anything that is not.
Definition at line 173 of file JShrink.php.
static minify |
( |
|
$js, |
|
|
|
$options = array() |
|
) |
| |
|
static |
Takes a string containing javascript and removes unneeded characters in order to shrink the code without altering it's functionality.
- Parameters
-
string | $js | The raw javascript to be minified |
array | $options | Various runtime options in an associative array |
- Exceptions
-
Definition at line 101 of file JShrink.php.
minifyDirectToOutput |
( |
|
$js, |
|
|
|
$options |
|
) |
| |
|
protected |
Processes a javascript string and outputs only the required characters, stripping out all unneeded characters.
- Parameters
-
string | $js | The raw javascript to be minified |
array | $options | Various runtime options in an associative array |
Definition at line 139 of file JShrink.php.
processMultiLineComments |
( |
|
$startIndex | ) |
|
|
protected |
Skips multiline comments where appropriate, and includes them where needed.
Conditional comments and "license" style blocks are preserved.
- Parameters
-
int | $startIndex | The index point where "getReal" function started |
- Returns
- bool|string False if there's no character
- Exceptions
-
Definition at line 356 of file JShrink.php.
processOneLineComments |
( |
|
$startIndex | ) |
|
|
protected |
Removed one line comments, with the exception of some very specific types of conditional comments.
- Parameters
-
int | $startIndex | The index point where "getReal" function started |
- Returns
- string
Definition at line 328 of file JShrink.php.
When a regular expression is detected this function crawls for the end of it and saves the whole regex.
- Exceptions
-
Definition at line 508 of file JShrink.php.
When a javascript string is detected this function crawls for the end of it and saves the whole string.
- Exceptions
-
Definition at line 435 of file JShrink.php.
Replace "locks" with the original characters.
- Parameters
-
string | $js | The string to unlock |
- Returns
- bool
Definition at line 571 of file JShrink.php.
$defaultOptions = array('flaggedComments' => true) |
|
staticprotected |
The documentation for this class was generated from the following file: