1
0
mirror of https://github.com/mrclay/minify.git synced 2025-08-23 06:02:51 +02:00

Update to version 1.1.0.

This commit is contained in:
Ryan Grove
2007-06-06 03:57:34 +00:00
parent ee20c7a291
commit 60943d4654

View File

@@ -12,7 +12,7 @@
* Permission is hereby granted to use this version of the library under the * Permission is hereby granted to use this version of the library under the
* same terms as jsmin.c, which has the following license: * same terms as jsmin.c, which has the following license:
* *
* -- * --
* Copyright (c) 2002 Douglas Crockford (www.crockford.com) * Copyright (c) 2002 Douglas Crockford (www.crockford.com)
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of * Permission is hereby granted, free of charge, to any person obtaining a copy of
@@ -34,14 +34,14 @@
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * 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 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE. * SOFTWARE.
* -- * --
* *
* @package JSMin * @package JSMin
* @author Ryan Grove <ryan@wonko.com> * @author Ryan Grove <ryan@wonko.com>
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c) * @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
* @copyright 2007 Ryan Grove <ryan@wonko.com> (PHP port) * @copyright 2007 Ryan Grove <ryan@wonko.com> (PHP port)
* @license http://opensource.org/licenses/mit-license.php MIT License * @license http://opensource.org/licenses/mit-license.php MIT License
* @version 1.0.0 (2007-05-04) * @version 1.1.0 (2007-06-01)
* @link http://code.google.com/p/jsmin-php/ * @link http://code.google.com/p/jsmin-php/
*/ */
@@ -58,17 +58,17 @@ class JSMin {
protected $output = array(); protected $output = array();
// -- Public Static Methods -------------------------------------------------- // -- Public Static Methods --------------------------------------------------
public static function minify($js) { public static function minify($js) {
$jsmin = new JSMin($js); $jsmin = new JSMin($js);
return $jsmin->jsmin(); return $jsmin->min();
} }
// -- Public Instance Methods ------------------------------------------------ // -- Public Instance Methods ------------------------------------------------
public function __construct($input) { public function __construct($input) {
$this->input = $input; $this->input = str_replace("\r\n", "\n", $input);
$this->inputLength = strlen($input); $this->inputLength = strlen($this->input);
} }
// -- Protected Instance Methods --------------------------------------------- // -- Protected Instance Methods ---------------------------------------------
@@ -164,7 +164,7 @@ class JSMin {
return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1;
} }
protected function jsmin() { protected function min() {
$this->a = "\n"; $this->a = "\n";
$this->action(3); $this->action(3);