|
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 32 of file Minifier.php.
JShrink\Minifier::clean |
( |
| ) |
|
|
protected |
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 249 of file Minifier.php.
JShrink\Minifier::getChar |
( |
| ) |
|
|
protected |
Returns the next string for processing based off of the current index.
- Returns
- string
Definition at line 263 of file Minifier.php.
JShrink\Minifier::getNext |
( |
|
$string | ) |
|
|
protected |
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 415 of file Minifier.php.
JShrink\Minifier::getReal |
( |
| ) |
|
|
protected |
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 302 of file Minifier.php.
JShrink\Minifier::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 154 of file Minifier.php.
static JShrink\Minifier::isAlphaNumeric |
( |
|
$char | ) |
|
|
staticprotected |
Checks to see if a character is alphanumeric.
- Parameters
-
string | $char | Just one character |
- Returns
- bool
Definition at line 538 of file Minifier.php.
JShrink\Minifier::lock |
( |
|
$js | ) |
|
|
protected |
Replace patterns in the given string and store the replacement.
- Parameters
-
string | $js | The string to lock |
- Returns
- bool
Definition at line 549 of file Minifier.php.
JShrink\Minifier::loop |
( |
| ) |
|
|
protected |
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 176 of file Minifier.php.
static JShrink\Minifier::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 103 of file Minifier.php.
JShrink\Minifier::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 141 of file Minifier.php.
JShrink\Minifier::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 359 of file Minifier.php.
JShrink\Minifier::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 331 of file Minifier.php.
JShrink\Minifier::saveRegex |
( |
| ) |
|
|
protected |
When a regular expression is detected this function crawls for the end of it and saves the whole regex.
- Exceptions
-
Definition at line 511 of file Minifier.php.
JShrink\Minifier::saveString |
( |
| ) |
|
|
protected |
When a javascript string is detected this function crawls for the end of it and saves the whole string.
- Exceptions
-
Definition at line 438 of file Minifier.php.
JShrink\Minifier::unlock |
( |
|
$js | ) |
|
|
protected |
Replace "locks" with the original characters.
- Parameters
-
string | $js | The string to unlock |
- Returns
- bool
Definition at line 574 of file Minifier.php.
JShrink\Minifier::$a = '' |
|
protected |
JShrink\Minifier::$b = '' |
|
protected |
JShrink\Minifier::$defaultOptions = array('flaggedComments' => true) |
|
staticprotected |
JShrink\Minifier::$index = 0 |
|
protected |
JShrink\Minifier::$locks = array() |
|
protected |
JShrink\Minifier::$options |
|
protected |
The documentation for this class was generated from the following file: