/** * Combines, minifies, and outputs the requested files. * * Inspects the $_GET array for a 'files' entry containing a comma-separated * list and uses this as the set of files to be combined and minified. */ function handleRequest() { // 404 if no files were requested. if (!isset($_GET['files'])) { header('HTTP/1.0 404 Not Found'); exit; } $files = array_map('trim', explode(',', $_GET['files'], MINIFY_MAX_FILES)); // 404 if the $files array is empty for some weird reason. if (!count($files)) { header('HTTP/1.0 404 Not Found'); exit; } // Determine the content type based on the extension of the first file // requested. $type = preg_match('/\\.js$/iD', $files[0]) ? TYPE_JS : TYPE_CSS; // Minify and spit out the result. $minify = new Minify($type); $minify->addFile($files); ob_start("ob_gzhandler"); header("Content-Type: {$type};charset=" . MINIFY_ENCODING); $minify->browserCache(); echo $minify->combine(); }
// Create new Minify objects. $minifyCSS = new Minify(TYPE_CSS); $minifyJS = new Minify(TYPE_JS); // Specify the files to be minified. $cssFiles = array('css/mediabrowser.css'); // Only load skin if $_GET["skin"] or $defaultSkin is set. if ($skin != "") { $cssFiles[count($cssFiles)] = 'skins/' . $skin . '/skin.css'; } $minifyCSS->addFile($cssFiles); $jsFiles = array('js/jquery.js', 'js/jquery.mediabrowser.js', 'js/jquery.plugins.js', 'swfupload/swfupload.min.js', 'swfupload/plugins/swfupload.queue.js', 'swfupload/fileprogress.js', 'swfupload/handlers.js'); //If editor is TinyMCE then add javascript file if ($editor == "tinymce") { $jsFiles[count($jsFiles)] = 'js/tiny_mce_popup.js'; } $minifyJS->addFile($jsFiles); // JAVASCRIPT echo '<script type="text/javascript">'; echo '//<![CDATA['; echo $minifyJS->combine(); echo '//]]>'; echo '</script>'; // CSS echo '<style type="text/css">'; echo $minifyCSS->combine(); echo '</style>'; ?> <script type="text/javascript"> //<![CDATA[ var swfu;
<title>Dog and Rooster | PDW Browser</title> <link rel="shortcut icon" href="mediabrowser.ico" /> <?php // MINIFY JS and CSS // Create new Minify objects. $minifyCSS = new Minify(TYPE_CSS); $minifyJS = new Minify(TYPE_JS); // Specify the files to be minified. $cssFiles = array('css/mediabrowser.css'); // Only load skin if $_GET["skin"] is set. if (isset($_GET["skin"])) { $cssFiles[count($cssFiles)] = 'skins/' . $_GET["skin"] . '/skin.css'; } $minifyCSS->addFile($cssFiles); $minifyJS->addFile(array('js/jquery.js', 'js/jquery.mediabrowser.js', 'js/jquery.plugins.js', 'swfupload/swfupload.min.js', 'swfupload/plugins/swfupload.queue.js', 'swfupload/fileprogress.js', 'swfupload/handlers.js', 'js/tiny_mce_popup.js')); // JAVASCRIPT echo '<script type="text/javascript">' . "\n"; echo '//<![CDATA[' . "\n"; echo $minifyJS->combine(); echo '//]]>' . "\n"; echo '</script>' . "\n"; // CSS echo '<style type="text/css">' . "\n"; echo $minifyCSS->combine(); echo '</style>' . "\n"; ?> <script type="text/javascript"> //<![CDATA[ var swfu;
<?php require_once 'minify/min/lib/minify.php'; // Create new Minify objects. $minifyCSS = new Minify(TYPE_CSS); $minifyJS = new Minify(TYPE_JS); // Specify the files to be minified. // Full URLs are allowed as long as they point // to the same server running Minify. $minifyCSS->addFile(array('/styles/fonts.css', '/styles/nifty.css', '/styles/public.css', '/styles/calendar.css', '/styles/navigation.css')); $minifyJS->addFile(array('/scripts/jquery.js', '/scripts/nifty.js', '/scripts/public.js')); ?> <html> <head> <style type="text/css"><?php echo $minifyCSS->combine(); ?> </style> <script type="text/javascript"><?php echo $minifyJS->combine(); ?> </script> </head> <body> </body> </html>