Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Internal JSMin if external is not found

  • Loading branch information...
commit c1f838251571adff1ad198ad14c4eafe05a9d779 1 parent a152283
@vrana authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 compile.php
View
16 compile.php
@@ -3,6 +3,22 @@
include dirname(__FILE__) . "/adminer/include/version.inc.php";
include dirname(__FILE__) . "/externals/jsmin-php/jsmin.php";
+if (!class_exists("JSMin")) {
+ /** Simple JS minifier without full support for regex literals
+ * @link http://pastebin.com/2Jc2swSr
+ */
+ class JSMin {
+ /*private static*/ function callback($match) {
+ $s = trim($match[0]);
+ return ($s === "" ? "\n" : ($s[0] === "/" && ($s[1] === "*" || $s[1] === "/") ? "" : $s));
+ }
+
+ /*static*/ function minify($input) {
+ return preg_replace_callback('~//[^\n]*|/\*.*?\*/|/(?!\s)(?:\\\\.|[^/\\\\])*/|\'(?:\\\\.|[^\'\\\\])*\'|"(?:\\\\.|[^"\\\\])*"|\s*[^0-9a-z_$\'"/\s]\s*|\s+~si', array('JSMin', 'callback'), $input);
+ }
+ }
+}
+
function add_apo_slashes($s) {
return addcslashes($s, "\\'");
}
Please sign in to comment.
Something went wrong with that request. Please try again.