[ class tree: JSMin ] [ index: JSMin ] [ all elements ]

Class: JSMin

Source Location: /zp-extensions/GoogleMap/JSMin.php

Class JSMin

Class Overview

jsmin.php - PHP implementation of Douglas Crockford's JSMin.

This is a direct port of jsmin.c to PHP with a few PHP performance tweaks and modifications to preserve some comments (see below). Also, rather than using stdin/stdout, JSMin::minify() accepts a string as input and returns another string as output.

Comments containing IE conditional compilation are preserved, as are multi-line comments that begin with "/*!" (for documentation purposes). In the latter case newlines are inserted around the comment to enhance readability.

PHP 5 or higher is required.

Permission is hereby granted to use this version of the library under the same terms as jsmin.c, which has the following license:

-- 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. --

Located in /zp-extensions/GoogleMap/JSMin.php [line 53]



		
				Author(s):
		
		
		
Information Tags:
Copyright:  2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
Copyright:  2008 Ryan Grove <ryan@wonko.com> (PHP port)
Link:  http://code.google.com/p/jsmin-php/
License:  MIT License

Properties

Methods

[ Top ]
Property Summary
mixed   $a  
mixed   $b  
mixed   $input  
mixed   $inputIndex  
mixed   $inputLength  
mixed   $lookAhead  
mixed   $output  

[ Top ]
Method Summary
static string   minify()   Minify Javascript
JSMin   __construct()   Setup process
void   action()   ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
void   get()   Get next char. Convert ctrl char to space.
void   isAlphaNum()   Is $c a letter, digit, underscore, dollar sign, escape, or non-ASCII?
void   isRegexpLiteral()  
void   min()   Perform minification, return result
void   multipleLineComment()  
void   next()   Get the next character, skipping over comments.
void   peek()   Get next char. If is ctrl character, translate to a space or newline.
void   singleLineComment()  

[ Top ]
Properties
mixed   $a = "\n" [line 60]
API Tags:
Access:  protected


[ Top ]
mixed   $b = '' [line 61]
API Tags:
Access:  protected


[ Top ]
mixed   $input = '' [line 62]
API Tags:
Access:  protected


[ Top ]
mixed   $inputIndex = 0 [line 63]
API Tags:
Access:  protected


[ Top ]
mixed   $inputLength = 0 [line 64]
API Tags:
Access:  protected


[ Top ]
mixed   $lookAhead = null [line 65]
API Tags:
Access:  protected


[ Top ]
mixed   $output = '' [line 66]
API Tags:
Access:  protected


[ Top ]
Methods
static method minify  [line 74]

  static string minify( string $js  )

Minify Javascript

Parameters:
string   $js:  Javascript to be minified

API Tags:
Access:  public


[ Top ]
Constructor __construct  [line 83]

  JSMin __construct( $input  )

Setup process

Parameters:
   $input: 

API Tags:
Access:  public


[ Top ]
action  [line 131]

  void action( $command  )

ACTION_KEEP_A = Output A. Copy B to A. Get the next B.

ACTION_DELETE_A = Copy B to A. Get the next B. ACTION_DELETE_A_B = Get the next B.

Parameters:
   $command: 

API Tags:
Access:  protected


[ Top ]
get  [line 214]

  void get( )

Get next char. Convert ctrl char to space.


API Tags:
Access:  protected


[ Top ]
isAlphaNum  [line 247]

  void isAlphaNum( $c  )

Is $c a letter, digit, underscore, dollar sign, escape, or non-ASCII?

Parameters:
   $c: 

API Tags:
Access:  protected


[ Top ]
isRegexpLiteral  [line 186]

  void isRegexpLiteral( )


API Tags:
Access:  protected


[ Top ]
min  [line 92]

  void min( )

Perform minification, return result


API Tags:
Access:  public


[ Top ]
multipleLineComment  [line 268]

  void multipleLineComment( )


API Tags:
Access:  protected


[ Top ]
next  [line 298]

  void next( )

Get the next character, skipping over comments.

Some comments may be preserved.


API Tags:
Access:  protected


[ Top ]
peek  [line 238]

  void peek( )

Get next char. If is ctrl character, translate to a space or newline.


API Tags:
Access:  protected


[ Top ]
singleLineComment  [line 252]

  void singleLineComment( )


API Tags:
Access:  protected


[ Top ]
Constants
ACTION_DELETE_A = 2 [line 57]

[ Top ]
ACTION_DELETE_A_B = 3 [line 58]

[ Top ]
ACTION_KEEP_A = 1 [line 56]

[ Top ]
ORD_LF = 10 [line 54]

[ Top ]
ORD_SPACE = 32 [line 55]

[ Top ]

Documentation generated on Tue, 20 Dec 2011 16:07:32 +0100 by phpDocumentor 1.4.3