Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/minify/builder/index.php
Go to the documentation of this file.
00001 <?php 
00002 
00003 if (phpversion() < 5) {
00004     exit('Minify requires PHP5 or greater.');
00005 }
00006 
00007 // check for auto-encoding
00008 $encodeOutput = (function_exists('gzdeflate')
00009                  && !ini_get('zlib.output_compression'));
00010 
00011 require dirname(__FILE__) . '/../config.php';
00012 
00013 if (! $min_enableBuilder) {
00014     header('Location: /');
00015     exit();
00016 }
00017 
00018 ob_start();
00019 ?>
00020 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
00021 <head>
00022     <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
00023     <title>Minify URI Builder</title>
00024     <style type="text/css">
00025 body {margin:1em 60px;}
00026 h1, h2, h3 {margin-left:-25px; position:relative;}
00027 h1 {margin-top:0;}
00028 #sources {margin:0; padding:0;}
00029 #sources li {margin:0 0 0 40px}
00030 #sources li input {margin-left:2px}
00031 #add {margin:5px 0 1em 40px}
00032 .hide {display:none}
00033 #uriTable {border-collapse:collapse;}
00034 #uriTable td, #uriTable th {padding-top:10px;}
00035 #uriTable th {padding-right:10px;}
00036 #groupConfig {font-family:monospace;}
00037 b {color:#c00}
00038 .topNote {background: #ff9; display:inline-block; padding:.5em .6em; margin:0 0 1em;}
00039 .topWarning {background:#c00; color:#fff; padding:.5em .6em; margin:0 0 1em;}
00040     </style>
00041 </head>
00042 
00043 <?php if (! isset($min_cachePath)): ?>
00044 <p class=topNote><strong>Note:</strong> Please set <code>$min_cachePath</code> 
00045 in /min/config.php to improve performance.</p>
00046 <?php endIf; ?>
00047 
00048 <p id=minRewriteFailed class="hide"><strong>Note:</strong> Your webserver does not seem to
00049  support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which 
00050 <a href="http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/"
00051 >may reduce the benefit of proxy cache servers</a>.</p>
00052 
00053 <h1>Minify URI Builder</h1>
00054 
00055 <noscript><p class="topNote">Javascript and a browser supported by jQuery 1.2.6 is required
00056 for this application.</p></noscript>
00057 
00058 <div id=app class=hide>
00059 
00060 <p>Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine
00061 and click [Update].</p>
00062 
00063 <ol id=sources><li></li></ol>
00064 <div id=add><button>Add file +</button></div>
00065 
00066 <div id=bmUris></div>
00067 
00068 <p><button id=update class=hide>Update</button></p>
00069 
00070 <div id=results class=hide>
00071 
00072 <h2>Minify URI</h2>
00073 <p>Place this URI in your HTML to serve the files above combined, minified, compressed and
00074 with cache headers.</p>
00075 <table id=uriTable>
00076     <tr><th>URI</th><td><a id=uriA class=ext>/min</a> <small>(opens in new window)</small></td></tr>
00077     <tr><th>HTML</th><td><input id=uriHtml type=text size=100 readonly></td></tr>
00078 </table>
00079 
00080 <h2>How to serve these files as a group</h2>
00081 <p>For the best performance you can serve these files as a pre-defined group with a URI
00082 like: <code><span class=minRoot>/min/?</span>g=keyName</code></p>
00083 <p>To do this, add a line like this to /min/groupsConfig.php:</p>
00084 
00085 <pre><code>return array(
00086     <span style="color:#666">... your existing groups here ...</span>
00087 <input id=groupConfig size=100 type=text readonly>
00088 );</code></pre>
00089 
00090 <p><em>Make sure to replace <code>keyName</code> with a unique key for this group.</em></p>
00091 </div>
00092 
00093 <div id=getBm>
00094 <h3>Find URIs on a Page</h3>
00095 <p>You can use the bookmarklet below to fetch all CSS &amp; Javascript URIs from a page
00096 on your site. When you active it, this page will open in a new window with a list of
00097 available URIs to add.</p>
00098 
00099 <p><a id=bm>Create Minify URIs</a> <small>(right-click, add to bookmarks)</small></p>
00100 </div>
00101 
00102 <h3>Combining CSS files that contain <code>@import</code></h3>
00103 <p>If your CSS files contain <code>@import</code> declarations, Minify will not 
00104 remove them. Therefore, you will want to remove those that point to files already
00105 in your list, and move any others to the top of the first file in your list 
00106 (imports below any styles will be ignored by browsers as invalid).</p>
00107 <p>If you desire, you can use Minify URIs in imports and they will not be touched
00108 by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code></p>
00109 
00110 </div><!-- #app -->
00111 
00112 <hr>
00113 <p>Need help? Search or post to the <a class=ext 
00114 href="http://groups.google.com/group/minify">Minify discussion list</a>.</p>
00115 <p><small>This app is minified :) <a class=ext 
00116 href="http://code.google.com/p/minify/source/browse/trunk/min/builder/index.php">view 
00117 source</a></small></p>
00118 
00119 <script type="text/javascript" 
00120 src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
00121 
00122 <script type="text/javascript">
00123 $(function () {
00124     // detection of double output encoding
00125     var msg = '<\p class=topWarning><\strong>Warning:<\/strong> ';
00126     var url = 'ocCheck.php?' + (new Date()).getTime();
00127     $.get(url, function (ocStatus) {
00128         $.get(url + '&hello=1', function (ocHello) {
00129             if (ocHello != 'World!') {
00130                 msg += 'It appears output is being automatically compressed, interfering ' 
00131                      + ' with Minify\'s own compression. ';
00132                 if (ocStatus == '1')
00133                     msg += 'The option "zlib.output_compression" is enabled in your PHP configuration. '
00134                          + 'Minify set this to "0", but it had no effect. This option must be disabled ' 
00135                          + 'in php.ini or .htaccess.';
00136                 else
00137                     msg += 'The option "zlib.output_compression" is disabled in your PHP configuration '
00138                          + 'so this behavior is likely due to a server option.';
00139                 $(document.body).prepend(msg + '<\/p>');
00140             } else
00141                 if (ocStatus == '1')
00142                     $(document.body).prepend('<\p class=topNote><\strong>Note:</\strong> The option '
00143                         + '"zlib.output_compression" is enabled in your PHP configuration, but has been '
00144                         + 'successfully disabled via ini_set(). If you experience mangled output you '
00145                         + 'may want to consider disabling this option in your PHP configuration.<\/p>'
00146                     );
00147         });
00148     });
00149 });
00150 </script>
00151 <script type="text/javascript">
00152     // workaround required to test when /min isn't child of web root
00153     var src = location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
00154     document.write('<\script type="text/javascript" src="../?f=' + src + '"><\/script>');
00155 </script>
00156 
00157 <?php
00158 
00159 $serveOpts = array(
00160     'content' => ob_get_contents()
00161     ,'id' => __FILE__
00162     ,'lastModifiedTime' => max(
00163         // regenerate cache if either of these change
00164         filemtime(__FILE__)
00165         ,filemtime(dirname(__FILE__) . '/../config.php')
00166     )
00167     ,'minifyAll' => true
00168     ,'encodeOutput' => $encodeOutput
00169 );
00170 ob_end_clean();
00171 
00172 set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . get_include_path());
00173 
00174 require 'Minify.php';
00175 
00176 if (0 === stripos(PHP_OS, 'win')) {
00177     Minify::setDocRoot(); // we may be on IIS
00178 }
00179 Minify::setCache(isset($min_cachePath) ? $min_cachePath : null);
00180 Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
00181 
00182 Minify::serve('Page', $serveOpts);
 All Data Structures Namespaces Files Functions Variables Enumerations