ILIAS
Release_4_4_x_branch Revision 61816
|
Main JSMin application class. More...
Public Member Functions | |
isAlphaNum ($c) | |
Indicates whether a character is alphanumeric or _, $, \ or non-ASCII. | |
get () | |
Get the next character from the input stream. | |
peek () | |
Get the next character from the input stream, without gettng it. | |
put ($c) | |
Adds a char to the output steram / string. | |
next () | |
Get the next character from the input stream, excluding comments. | |
action ($action) | |
Do something ! | |
minify () | |
Run the JSMin application : minify some JS code. | |
JSMin ($inFileName= '-', $outFileName= '-', $comments=NULL) | |
Prepare a new JSMin application. | |
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 | |
$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 175 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 418 of file JSMin_lib.php.
References $theA, $theB, JSMIN_ACT_BUF, JSMIN_ACT_FULL, JSMIN_ACT_IMM, next(), ORD_NL, and put().
Referenced by minify().
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 240 of file JSMin_lib.php.
References $inPos, 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 214 of file JSMin_lib.php.
References ORD_0, ORD_9, ORD_a, ORD_cA, ORD_cZ, and ORD_z.
Referenced by minify().
JSMin::JSMin | ( | $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.
References JSMin_File(), and JSMin_String().
JSMin::JSMin_File | ( | $inFileName = '-' , |
|
$outFileName = '-' , |
|||
$comments = NULL |
|||
) |
Definition at line 691 of file JSMin_lib.php.
Referenced by JSMin().
JSMin::JSMin_String | ( | $inString, | |
$comments = NULL |
|||
) |
Definition at line 740 of file JSMin_lib.php.
Referenced by JSMin().
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 564 of file JSMin_lib.php.
References $out, action(), 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 331 of file JSMin_lib.php.
References EOF, ORD_NL, and peek().
Referenced by action().
JSMin::peek | ( | ) |
Get the next character from the input stream, without gettng it.
Definition at line 283 of file JSMin_lib.php.
Referenced by next().
JSMin::put | ( | $c | ) |
Adds a char to the output steram / string.
Definition at line 312 of file JSMin_lib.php.
Referenced by action().
JSMin::$in |
Definition at line 182 of file JSMin_lib.php.
JSMin::$inLength = 0 |
variables used for string-based parsing
Definition at line 204 of file JSMin_lib.php.
JSMin::$inPos = 0 |
Definition at line 205 of file JSMin_lib.php.
JSMin::$isString = false |
Definition at line 206 of file JSMin_lib.php.
JSMin::$out |
Definition at line 189 of file JSMin_lib.php.
Referenced by minify().
JSMin::$theA |
Definition at line 195 of file JSMin_lib.php.
Referenced by action().
JSMin::$theB |
Definition at line 201 of file JSMin_lib.php.
Referenced by action().