ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
JSMin_lib.php File Reference

Go to the source code of this file.

Data Structures

class  JSMinException
 Generic exception class related to JSMin. More...
 
class  FileOpenFailedJSMinException
 A JSMin exception indicating that a file provided for input or output could not be properly opened. More...
 
class  UnterminatedCommentJSMinException
 A JSMin exception indicating that an unterminated comment was encountered in input. More...
 
class  UnterminatedStringLiteralJSMinException
 A JSMin exception indicatig that an unterminated string literal was encountered in input. More...
 
class  UnterminatedRegExpLiteralJSMinException
 A JSMin exception indicatig that an unterminated regular expression lieteral was encountered in input. More...
 
class  JSMin
 Main JSMin application class. More...
 

Variables

const JSMIN_VERSION '0.2'
 JSMin_lib.php (for PHP 4, 5) More...
 
const EOF FALSE
 How fgetc() reports an End Of File. More...
 
const ORD_NL ord("\n")
 Some ASCII character ordinals. More...
 
const ORD_space ord(' ')
 
const ORD_cA ord('A')
 
const ORD_cZ ord('Z')
 
const ORD_a ord('a')
 
const ORD_z ord('z')
 
const ORD_0 ord('0')
 
const ORD_9 ord('9')
 
const JSMIN_ACT_FULL 1
 Constant describing an action() : Output A. More...
 
const JSMIN_ACT_BUF 2
 Constant describing an action() : Copy B to A. More...
 
const JSMIN_ACT_IMM 3
 Constant describing an action() : Get the next B. More...
 

Variable Documentation

◆ EOF

◆ JSMIN_ACT_BUF

const JSMIN_ACT_BUF 2

Constant describing an action() : Copy B to A.

Get the next B. (Delete A).

Definition at line 156 of file JSMin_lib.php.

Referenced by JSMin\action(), and JSMin\minify().

◆ JSMIN_ACT_FULL

const JSMIN_ACT_FULL 1

Constant describing an action() : Output A.

Copy B to A. Get the next B.

Definition at line 150 of file JSMin_lib.php.

Referenced by JSMin\action(), and JSMin\minify().

◆ JSMIN_ACT_IMM

const JSMIN_ACT_IMM 3

Constant describing an action() : Get the next B.

(Delete B).

Definition at line 162 of file JSMin_lib.php.

Referenced by JSMin\action(), and JSMin\minify().

◆ JSMIN_VERSION

const JSMIN_VERSION '0.2'

JSMin_lib.php (for PHP 4, 5)

PHP adaptation of JSMin, published by Douglas Crockford as jsmin.c, also based on its Java translation by John Reilly.

Permission is hereby granted to use the PHP version under the same conditions as jsmin.c, which has the following notice :


Copyright (c) 2002 Douglas Crockford (www.crockford.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software shall be used for Good, not Evil.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Author
David Holmes dholm.nosp@m.es@c.nosp@m.fdsof.nosp@m.twar.nosp@m.e.net of CFD Labs, France
Gaetano Giunta
Version
Id

Please note, this is a brutal and simple conversion : it could undoubtedly be improved, as a PHP implementation, by applying more PHP-specific programming features.

Exceptions and all PHP 5 - only features ahve been removed for compat with PHP 4

Note : whereas jsmin.c works specifically with the standard input and output streams, this implementation only falls back on them if file pathnames are not provided to the JSMin() constructor.

Examples comparing with the application compiled from jsmin.c :

jsmin < orig.js > mini.js JSMin.php orig.js mini.js JSMin.php orig.js > mini.js JSMin.php - mini.js < orig.js jsmin < orig.js JSMin.php orig.js JSMin.php orig.js - jsmin > mini.js JSMin.php - mini.js JSMin.php > mini.js jsmin comm1 comm2 < a.js > b.js JSMin.php a.js b.js comm1 comm2 JSMin.php a.js b.js -c comm1 comm2 JSMin.php a.js –comm comm1 comm2 > b.js JSMin.php -c comm1 comm2 < a.js > b.js (etc...)

See JSMin.php -h (or –help) for command-line documentation.

NEW AND IMPROVED in version 0.2: to take advantage of this file in your own code, you can do the following:

define('JSMIN_AS_LIB', true); // prevents auto-run on include include('jsmin.php'); // the JSMin class now works on php strings, too $jsMin = new JSMin(file_get_contents('e:/htdocs/awstats_misc_tracker.js'), false); // in that case, the modifies string is returned by minify(): $out = $jsMin->minify(); Version of this PHP translation.

Definition at line 85 of file JSMin_lib.php.

◆ ORD_0

const ORD_0 ord('0')

Definition at line 105 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().

◆ ORD_9

const ORD_9 ord('9')

Definition at line 106 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().

◆ ORD_a

const ORD_a ord('a')

Definition at line 103 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().

◆ ORD_cA

const ORD_cA ord('A')

Definition at line 101 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().

◆ ORD_cZ

const ORD_cZ ord('Z')

Definition at line 102 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().

◆ ORD_NL

const ORD_NL ord("\n")

Some ASCII character ordinals.

N.B. : PHP identifiers are case-insensitive !

Definition at line 99 of file JSMin_lib.php.

Referenced by JSMin\action(), and JSMin\next().

◆ ORD_space

const ORD_space ord(' ')

Definition at line 100 of file JSMin_lib.php.

Referenced by JSMin\get().

◆ ORD_z

const ORD_z ord('z')

Definition at line 104 of file JSMin_lib.php.

Referenced by JSMin\isAlphaNum().