]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Minify/extlib/minify/min/builder/index.php
Issue #166 - we test exif data below, no need for error output
[quix0rs-gnu-social.git] / plugins / Minify / extlib / minify / min / builder / index.php
1 <?php 
2
3 if (phpversion() < 5) {
4     exit('Minify requires PHP5 or greater.');
5 }
6
7 // check for auto-encoding
8 $encodeOutput = (function_exists('gzdeflate')
9                  && !ini_get('zlib.output_compression'));
10
11 require dirname(__FILE__) . '/../config.php';
12
13 if (! $min_enableBuilder) {
14     header('Location: /');
15     exit();
16 }
17
18 ob_start();
19 ?>
20 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
21 <head>
22     <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
23     <title>Minify URI Builder</title>
24     <style type="text/css">
25 body {margin:1em 60px;}
26 h1, h2, h3 {margin-left:-25px; position:relative;}
27 h1 {margin-top:0;}
28 #sources {margin:0; padding:0;}
29 #sources li {margin:0 0 0 40px}
30 #sources li input {margin-left:2px}
31 #add {margin:5px 0 1em 40px}
32 .hide {display:none}
33 #uriTable {border-collapse:collapse;}
34 #uriTable td, #uriTable th {padding-top:10px;}
35 #uriTable th {padding-right:10px;}
36 #groupConfig {font-family:monospace;}
37 b {color:#c00}
38 .topNote {background: #ff9; display:inline-block; padding:.5em .6em; margin:0 0 1em;}
39 .topWarning {background:#c00; color:#fff; padding:.5em .6em; margin:0 0 1em;}
40     </style>
41 </head>
42
43 <?php if (! isset($min_cachePath)): ?>
44 <p class=topNote><strong>Note:</strong> Please set <code>$min_cachePath</code> 
45 in /min/config.php to improve performance.</p>
46 <?php endIf; ?>
47
48 <p id=minRewriteFailed class="hide"><strong>Note:</strong> Your webserver does not seem to
49  support mod_rewrite (used in /min/.htaccess). Your Minify URIs will contain "?", which 
50 <a href="http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/"
51 >may reduce the benefit of proxy cache servers</a>.</p>
52
53 <h1>Minify URI Builder</h1>
54
55 <noscript><p class="topNote">Javascript and a browser supported by jQuery 1.2.6 is required
56 for this application.</p></noscript>
57
58 <div id=app class=hide>
59
60 <p>Create a list of Javascript or CSS files (or 1 is fine) you'd like to combine
61 and click [Update].</p>
62
63 <ol id=sources><li></li></ol>
64 <div id=add><button>Add file +</button></div>
65
66 <div id=bmUris></div>
67
68 <p><button id=update class=hide>Update</button></p>
69
70 <div id=results class=hide>
71
72 <h2>Minify URI</h2>
73 <p>Place this URI in your HTML to serve the files above combined, minified, compressed and
74 with cache headers.</p>
75 <table id=uriTable>
76     <tr><th>URI</th><td><a id=uriA class=ext>/min</a> <small>(opens in new window)</small></td></tr>
77     <tr><th>HTML</th><td><input id=uriHtml type=text size=100 readonly></td></tr>
78 </table>
79
80 <h2>How to serve these files as a group</h2>
81 <p>For the best performance you can serve these files as a pre-defined group with a URI
82 like: <code><span class=minRoot>/min/?</span>g=keyName</code></p>
83 <p>To do this, add a line like this to /min/groupsConfig.php:</p>
84
85 <pre><code>return array(
86     <span style="color:#666">... your existing groups here ...</span>
87 <input id=groupConfig size=100 type=text readonly>
88 );</code></pre>
89
90 <p><em>Make sure to replace <code>keyName</code> with a unique key for this group.</em></p>
91 </div>
92
93 <div id=getBm>
94 <h3>Find URIs on a Page</h3>
95 <p>You can use the bookmarklet below to fetch all CSS &amp; Javascript URIs from a page
96 on your site. When you active it, this page will open in a new window with a list of
97 available URIs to add.</p>
98
99 <p><a id=bm>Create Minify URIs</a> <small>(right-click, add to bookmarks)</small></p>
100 </div>
101
102 <h3>Combining CSS files that contain <code>@import</code></h3>
103 <p>If your CSS files contain <code>@import</code> declarations, Minify will not 
104 remove them. Therefore, you will want to remove those that point to files already
105 in your list, and move any others to the top of the first file in your list 
106 (imports below any styles will be ignored by browsers as invalid).</p>
107 <p>If you desire, you can use Minify URIs in imports and they will not be touched
108 by Minify. E.g. <code>@import "<span class=minRoot>/min/?</span>g=css2";</code></p>
109
110 </div><!-- #app -->
111
112 <hr>
113 <p>Need help? Search or post to the <a class=ext 
114 href="http://groups.google.com/group/minify">Minify discussion list</a>.</p>
115 <p><small>This app is minified :) <a class=ext 
116 href="http://code.google.com/p/minify/source/browse/trunk/min/builder/index.php">view 
117 source</a></small></p>
118
119 <script type="text/javascript" 
120 src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
121
122 <script type="text/javascript">
123 $(function () {
124     // detection of double output encoding
125     var msg = '<\p class=topWarning><\strong>Warning:<\/strong> ';
126     var url = 'ocCheck.php?' + (new Date()).getTime();
127     $.get(url, function (ocStatus) {
128         $.get(url + '&hello=1', function (ocHello) {
129             if (ocHello != 'World!') {
130                 msg += 'It appears output is being automatically compressed, interfering ' 
131                      + ' with Minify\'s own compression. ';
132                 if (ocStatus == '1')
133                     msg += 'The option "zlib.output_compression" is enabled in your PHP configuration. '
134                          + 'Minify set this to "0", but it had no effect. This option must be disabled ' 
135                          + 'in php.ini or .htaccess.';
136                 else
137                     msg += 'The option "zlib.output_compression" is disabled in your PHP configuration '
138                          + 'so this behavior is likely due to a server option.';
139                 $(document.body).prepend(msg + '<\/p>');
140             } else
141                 if (ocStatus == '1')
142                     $(document.body).prepend('<\p class=topNote><\strong>Note:</\strong> The option '
143                         + '"zlib.output_compression" is enabled in your PHP configuration, but has been '
144                         + 'successfully disabled via ini_set(). If you experience mangled output you '
145                         + 'may want to consider disabling this option in your PHP configuration.<\/p>'
146                     );
147         });
148     });
149 });
150 </script>
151 <script type="text/javascript">
152     // workaround required to test when /min isn't child of web root
153     var src = location.pathname.replace(/\/[^\/]*$/, '/_index.js').substr(1);
154     document.write('<\script type="text/javascript" src="../?f=' + src + '"><\/script>');
155 </script>
156
157 <?php
158
159 $serveOpts = array(
160     'content' => ob_get_contents()
161     ,'id' => __FILE__
162     ,'lastModifiedTime' => max(
163         // regenerate cache if either of these change
164         filemtime(__FILE__)
165         ,filemtime(dirname(__FILE__) . '/../config.php')
166     )
167     ,'minifyAll' => true
168     ,'encodeOutput' => $encodeOutput
169 );
170 ob_end_clean();
171
172 set_include_path(dirname(__FILE__) . '/../lib' . PATH_SEPARATOR . get_include_path());
173
174 require 'Minify.php';
175
176 if (0 === stripos(PHP_OS, 'win')) {
177     Minify::setDocRoot(); // we may be on IIS
178 }
179 Minify::setCache(isset($min_cachePath) ? $min_cachePath : null);
180 Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
181
182 Minify::serve('Page', $serveOpts);