ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Main JSMin application class. More...
Public Member Functions | |
isAlphaNum ($c) | |
Indicates whether a character is alphanumeric or _, $, \ or non-ASCII. More... | |
get () | |
Get the next character from the input stream. More... | |
peek () | |
Get the next character from the input stream, without gettng it. More... | |
put ($c) | |
Adds a char to the output steram / string. More... | |
next () | |
Get the next character from the input stream, excluding comments. More... | |
action ($action) | |
Do something ! More... | |
minify () | |
Run the JSMin application : minify some JS code. More... | |
__construct ($inFileName='-', $outFileName='-', $comments=null) | |
Prepare a new JSMin application. More... | |
JSMin_File ($inFileName='-', $outFileName='-', $comments=null) | |
JSMin_String ($inString, $comments=null) | |
Data Fields | |
$in | |
$out | |
$theA | |
$theB | |
$inLength = 0 | |
variables used for string-based parsing More... | |
$inPos = 0 | |
$isString = false | |
Main JSMin application class.
Example of use :
$jsMin = new JSMin(...input..., ...output...); $jsMin->minify();
Do not specify input and/or output (or default to '-') to use stdin and/or stdout.
Definition at line 180 of file JSMin_lib.php.
JSMin::__construct | ( | $inFileName = '-' , |
|
$outFileName = '-' , |
|||
$comments = null |
|||
) |
Prepare a new JSMin application.
The next step is to minify() the input into the output.
string | $inFileName | The pathname of the input (unminified JS) file. STDIN if '-' or absent. |
string | $outFileName | The pathname of the output (minified JS) file. STDOUT if '-' or absent. If outFileName === FALSE, we assume that inFileName is in fact the string to be minified!!! |
array | $comments | Optional lines to present as comments at the beginning of the output. |
Definition at line 682 of file JSMin_lib.php.
JSMin::action | ( | $action | ) |
Do something !
The action to perform is determined by the argument :
JSMin::ACT_FULL : Output A. Copy B to A. Get the next B. JSMin::ACT_BUF : Copy B to A. Get the next B. (Delete A). JSMin::ACT_IMM : Get the next B. (Delete B).
A string is treated as a single character. Also, regular expressions are recognized if preceded by '(', ',' or '='.
int | $action | The action to perform : one of the JSMin::ACT_* constants. |
Definition at line 423 of file JSMin_lib.php.
References $action, JSMIN_ACT_BUF, JSMIN_ACT_FULL, JSMIN_ACT_IMM, and ORD_NL.
JSMin::get | ( | ) |
Get the next character from the input stream.
If said character is a control character, translate it to a space or linefeed.
Definition at line 247 of file JSMin_lib.php.
References $c, EOF, and ORD_space.
JSMin::isAlphaNum | ( | $c | ) |
Indicates whether a character is alphanumeric or _, $, \ or non-ASCII.
string | $c | The single character to test. |
Definition at line 220 of file JSMin_lib.php.
References $c, ORD_0, ORD_9, ORD_a, ORD_cA, ORD_cZ, and ORD_z.
Referenced by minify().
JSMin::JSMin_File | ( | $inFileName = '-' , |
|
$outFileName = '-' , |
|||
$comments = null |
|||
) |
Definition at line 691 of file JSMin_lib.php.
JSMin::JSMin_String | ( | $inString, | |
$comments = null |
|||
) |
Definition at line 744 of file JSMin_lib.php.
JSMin::minify | ( | ) |
Run the JSMin application : minify some JS code.
The code is read from the input stream, and its minified version is written to the output one. In case input is a string, minified vesrions is also returned by this function as string. That is : characters which are insignificant to JavaScript are removed, as well as comments ; tabs are replaced with spaces ; carriage returns are replaced with linefeeds, and finally most spaces and linefeeds are deleted.
Note : name was changed from jsmin() because PHP identifiers are case-insensitive, and it is already the name of this class.
Definition at line 569 of file JSMin_lib.php.
References $out, EOF, isAlphaNum(), JSMIN_ACT_BUF, JSMIN_ACT_FULL, and JSMIN_ACT_IMM.
JSMin::next | ( | ) |
Get the next character from the input stream, excluding comments.
peek() is used to see if a '/' is followed by a '*' or '/'. Multiline comments are actually returned as a single space.
Definition at line 335 of file JSMin_lib.php.
References $c, EOF, and ORD_NL.
JSMin::peek | ( | ) |
Get the next character from the input stream, without gettng it.
Definition at line 290 of file JSMin_lib.php.
JSMin::put | ( | $c | ) |
Adds a char to the output steram / string.
Definition at line 317 of file JSMin_lib.php.
References $c.
JSMin::$in |
Definition at line 188 of file JSMin_lib.php.
JSMin::$inLength = 0 |
variables used for string-based parsing
Definition at line 210 of file JSMin_lib.php.
JSMin::$inPos = 0 |
Definition at line 211 of file JSMin_lib.php.
JSMin::$isString = false |
Definition at line 212 of file JSMin_lib.php.
JSMin::$out |
Definition at line 195 of file JSMin_lib.php.
JSMin::$theA |
Definition at line 201 of file JSMin_lib.php.
JSMin::$theB |
Definition at line 207 of file JSMin_lib.php.