-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of CONTENIDO extension mpMinify.
- Loading branch information
0 parents
commit 92d76e3
Showing
260 changed files
with
23,025 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* CONTENIDO mpMinify front controller | ||
* | ||
* @package Minify | ||
* @version SVN Id $Id: $ | ||
* | ||
* @author Murat Purc <murat@purc.de> | ||
* @copyright Murat Purc it-solutions <www.purc.de> | ||
* @license http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2 | ||
*/ | ||
|
||
|
||
// (string) Set path to current clients frontend | ||
$min_con_frontend_path = str_replace('\\', '/', realpath(dirname(__FILE__) . '/../')) . '/'; | ||
|
||
|
||
// (string) Path to minify | ||
$min_con_path = str_replace('\\', '/', realpath(dirname(__FILE__) . '/../../')) . '/vendor/minify/'; | ||
|
||
|
||
// (array) Overwrite minify configuration in vendor/minify/min/config.php | ||
$min_con_config = array(); | ||
$min_con_config['min_cachePath'] = $min_con_frontend_path . 'cache/'; | ||
$min_con_config['min_enableBuilder'] = false; | ||
|
||
|
||
// (array) Overwrite minify test configuration in vendor/minify/min/config-test.php | ||
$min_con_config_test = array(); | ||
|
||
|
||
// (array) Overwrite minify group configuration in vendor/minify/min/groupsConfig.php | ||
$min_con_groupsConfig = array( | ||
# 'js' => array('//cms/js/awesomelib.js', '//cms/js/awesomelib-tooltip.js', '//cms/js/awesomelib-gallery.js'), | ||
# 'css' => array('//cms/css/contenido_sample.css', '//cms/css/slideshow.css'), | ||
); | ||
|
||
|
||
include_once($min_con_path . 'min/index_contenido.php'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
mpMinify 0.1 Beta für CONTENIDO 4.8.x | ||
|
||
#################################################################################################### | ||
TOC (Table of contents) | ||
|
||
- BESCHREIBUNG | ||
- CHANGELOG | ||
- BEKANNTE PROBLEME | ||
- FEATURES | ||
- VORAUSSETZUNGEN | ||
- INSTALLATION | ||
- WICHTIGES ZUM INHALT | ||
- TIPPS | ||
- SCHLUSSBEMERKUNG | ||
|
||
|
||
|
||
#################################################################################################### | ||
BESCHREIBUNG | ||
|
||
minify ist eine PHP Applikation, die mehrere JavaScript- oder CSS-Dateien kombinieren, | ||
komprimieren und mit einem entsprechenden Header ausgeben kann, so dass die Anzahl | ||
der Anfragen (Requests) auf eine Webseite und die versendete Datenmenge reduziert wird. | ||
|
||
Mit mpMinify für CONTENIDO kann man die Ausgabe der JavaScript- oder CSS-Dateien | ||
im Frontend einer CONTENIDO-Installation optimieren. | ||
|
||
Beispiel: | ||
Auf der Webseite werden z. B. 3 JavaScript- und 5 CSS-Dateien eingebunden. | ||
Wenn man die Webseite besucht, macht der Browser 8 Anfragen, um die Dateien | ||
zu laden und der Server liefert die 8 Dateien aus. | ||
|
||
Mit minify kann man es im Idealfall erreichen, dass der Browser nur 2 Anfragen | ||
an den Server sendet, jeweils eine für JavaScript und für CSS-Datei. | ||
|
||
Bei entsprechender Konfiguration kümmert sich minify darum, die Dateien zusammenzuführen, | ||
und zu komprimieren, so dass der Browser wenig Requests hat und der Server weniger | ||
Daten versendet. | ||
|
||
Anderes Beispiel: | ||
Auch wenn man verschiedene JavaScript- und 5 CSS-Dateien Dateien nicht zusammenführen | ||
möchte, ist die Verwendung von minify von Vorteil. Jede einzelne über minify | ||
verarbeitete Datei wird von unnötigem Inhalt (Leerzeichen und Kommentare) entfernt | ||
und komprimiert, so dass am Ende die Menge der vom Server an den Browser versendeten | ||
Daten reduziert wird. | ||
|
||
Das Reduzieren der Anzahl der Requests und das Reduzieren der Datenmenge ist sowohl | ||
für den Browser als auch für den Server eine übliche Optimierungsmaßnahme. | ||
|
||
|
||
|
||
#################################################################################################### | ||
BEKANNTE PROBLEME | ||
|
||
Momentan keine | ||
|
||
|
||
|
||
#################################################################################################### | ||
CHANGELOG | ||
|
||
2012-10-26: mpMinify 0.1 Beta (for CONTENIDO 4.8.x) | ||
* First beta release | ||
|
||
|
||
|
||
#################################################################################################### | ||
FEATURES | ||
|
||
- Optimierte Ausgabe von JavaScript- oder CSS-Dateien im Frontend | ||
|
||
|
||
|
||
#################################################################################################### | ||
VORAUSSETZUNGEN | ||
|
||
- Alle Voraussetzungen von CONTENIDO 4.8.x gelten auch für mpMinify | ||
|
||
|
||
|
||
#################################################################################################### | ||
INSTALLATION | ||
|
||
Beispielhaft wird im Folgenden davon ausgegangen, dass das Mandantenverzeichnis 'cms' lautet. | ||
|
||
Dateien aus dem mpMinify-Package in die entsprechenden CONTENIDO-Verzeichnisse kopieren. | ||
- 'vendor' in das CONTENIDO Installationsverzeichnis kopieren | ||
- 'cms' oder den Inhalt davon in das Mandantenverzeichnis kopieren | ||
|
||
Die Datei 'cms/min/index.php' öffnen und für den Mandanten anpassen | ||
- Werte in $min_con_config überschreiben Einstellungen von 'vendor/minify/min/config.php' | ||
- Werte in $min_con_config_test überschreiben Einstellungen von 'vendor/minify/min/config-test.php' | ||
- Werte in min_con_groupsConfig überschreiben Einstellungen von 'vendor/minify/min/groupsConfig' | ||
|
||
Anpassen der URLs zu JavaScript- oder CSS-Dateien im Layout | ||
|
||
|
||
Anwendungsbeispiel: | ||
Im Layout werden folgende Dateien eingebunden | ||
[code] | ||
<script src="js/awesomelib.js" type="text/javascript"></script> | ||
<script src="js/awesomelib-tooltip.js" type="text/javascript"></script> | ||
<script src="js/awesomelib-gallery.js" type="text/javascript"></script> | ||
<link rel="stylesheet" href="css/main.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="css/navigation.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="css/forms.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="css/tooltip.css" type="text/css" media="all" /> | ||
<link rel="stylesheet" href="css/gallery.css" type="text/css" media="all" /> | ||
[/code] | ||
|
||
Um das mit minify zu optimieren, kann man folgende Schritte machen: | ||
|
||
In der Datei 'cms/min/index.php' die Konfiguration für Gruppen setzen. | ||
[code] | ||
$min_con_groupsConfig = array( | ||
'js' => array( | ||
'//cms/js/awesomelib.js', | ||
'//cms/js/awesomelib-tooltip.js', | ||
'//cms/js/awesomelib-gallery.js' | ||
), | ||
'css' => array( | ||
'//cms/css/main.css', | ||
'//cms/css/navigation.css' | ||
'//cms/css/forms.css' | ||
'//cms/css/tooltip.css' | ||
'//cms/css/gallery.css' | ||
), | ||
); | ||
[/code] | ||
Der Prefix '//cms/' ist für minify und referenziert den Pfad der Datei vom | ||
Documentroot des Webservers aus. | ||
|
||
Beispiel: | ||
/var/www/ -> Document Root | ||
/var/www/cms -> Mandantenverzeichnis | ||
/var/www/cms/js/awesomelib.js -> JavaScript Datei im Mandantenverzeichnis | ||
minify Wert -> //cms/js/awesomelib.js | ||
|
||
Im Layout die Angaben ändern in | ||
[code] | ||
<script src="min/?g=js" type="text/javascript"></script> | ||
<link rel="stylesheet" href="min/?g=css" type="text/css" media="all" /> | ||
[/code] | ||
Mit der URL "min/?g=js" werden alle Dateien in der Gruppe "js" zusammengefügt | ||
und komprimiert, also die 3 JavaScript-Dateien. | ||
|
||
Mit der URL "min/?g=css" werden alle Dateien in der Gruppe "css" zusammengefügt | ||
und komprimiert, also die 5 CSS-Dateien. | ||
|
||
Der erste Aufruf im Frontend kann etwas länger als üblich dauern, da minify die | ||
Dateien verarbeitet und cached. Danach geht es viel schneller. | ||
|
||
|
||
|
||
#################################################################################################### | ||
WICHTIGES ZUM INHALT | ||
|
||
cms/min/index.php: | ||
------------------ | ||
Die minify Konfiguration für das Frontend des Mandanten. | ||
|
||
|
||
vendor/minify: | ||
-------------- | ||
Die Sourcen der minify Applikation. | ||
vendor/minify/README.txt -> Sollte man sich immer durchlesen | ||
vendor/minify/MIN.txt -> Enthält weitere Anwendungsbeispiele zu minify | ||
|
||
|
||
|
||
#################################################################################################### | ||
TIPPS | ||
|
||
Bei Verwendung einer mod_rewrite Lösung kann es nötig sein, Anfragen auf das 'min' | ||
Verzeichnis im Mandantenordner vom Umschreiben ausschließt. | ||
|
||
|
||
|
||
#################################################################################################### | ||
SCHLUSSBEMERKUNG | ||
|
||
Benutzung auf eigene Gefahr! | ||
|
||
Murat Purc, murat@purc.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
# / | ||
/test | ||
/docs | ||
.idea/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
Minify Release History | ||
|
||
Version 2.1.5 | ||
* Removed XSS vulnerability | ||
* Disabled builder bby default | ||
* command line tools to minify and rewrite URIs in CSS | ||
* upgrade (optional) JSMin+ library | ||
* more efficient JS minification when using CC/YUIC | ||
* Closure Compiler uses cURL when allow_url_fopen is off | ||
* Missing file notices when using groups | ||
|
||
Version 2.1.4 | ||
* Option to minify JS with Closure Compiler API w/ JSMin failover | ||
* Cookie/bookmarklet-based debug mode. No HTML editing! | ||
* Allows 1 file to be missing w/o complete failure | ||
* Combine multiple groups and files in single URI | ||
* More useful HTML helpers for writing versioned URIs | ||
* More detailed error logging, including minifier exceptions | ||
* Builder offers more helpful messages/PHP environment warnings | ||
* Bypass minification based on filename pattern. e.g. foo.min.js / foo-min.css | ||
* JSMin won't choke on common Closure compiler syntaxes (i+ ++j) | ||
* Better caching in IE6 | ||
* Cache ids are influenced by group/file names | ||
* Debug mode for Javascript doesn't break on common XPath strings (Prototype 1.6) | ||
* Removed annoying maxFiles limit | ||
* mbstring.func_overload usage is safer | ||
|
||
Version 2.1.3 | ||
* HTTP fixes | ||
* ETag generation now valid (different when gzipped) | ||
* Vary header always sent when Accept-Encoding is sniffed | ||
* Cache-Control no longer has "must-revalidate" due to webkit bug | ||
See: http://mrclay.org/index.php/2009/02/24/safari-4-beta-cache-controlmust-revalidate-bug/ | ||
* Dropped deflate encoding. Browser and proxy support could be buggy. | ||
See: http://stackoverflow.com/questions/883841/ | ||
* File cache now works w/o setting $min_cachePath | ||
* Allow setting contentType in Minify_Source objects | ||
* No more 5.3 deprecation warnings: split() removed | ||
|
||
Version 2.1.2 | ||
* Javascript fixes | ||
* Debug mode no longer confused by "*/*" in strings/RegExps (jQuery) | ||
* quote characters inside RegExp literals no longer cause exception | ||
* files ending in single-line comments no longer cause code loss | ||
* CSS: data: URLs no longer mangled | ||
* Optional error logging to Firefox's FirePHP extension | ||
* Unit tests to check for common DOCUMENT_ROOT problems | ||
* DOCUMENT_ROOT no longer overwritten on IIS servers | ||
* Builder app doesn't fail on systems without gzdeflate() | ||
* APC caching class included | ||
|
||
Version 2.1.1 | ||
* Bug fix release | ||
* Detection and workarounds for zlib.output_compression and non-PHP encoding modules | ||
* Zlib not required (mod_rewrite, et.al., can still be used for encoding) | ||
* HTML : More IE conditional comments preserved | ||
* Minify_groupUri() utility fixed | ||
|
||
Version 2.1.0 | ||
* "min" default application for quick deployment | ||
* Minify URI Builder app & bookmarklet for quickly creating minify URIs | ||
* Relative URIs in CSS file are fixed automatically by default | ||
* "debug" mode for revealing original line #s in combined files | ||
* Better IIS support | ||
* Improved minifier classes: | ||
* JS: preserves IE conditional comments | ||
* CSS: smaller output, preserves more hacks and valid CSS syntax, | ||
shorter line lengths, other bug fixes | ||
* HTML: smaller output, shorter line lengths, other bug fixes | ||
* Default Cache-Control: max-age of 30 minutes | ||
* Conditional GETs supported even when max-age sent | ||
* Experimental memcache cache class (default is files) | ||
* Minify_Cache_File has flock()s (by default) | ||
* Workaround for Windows mtime reporting bug | ||
|
||
Version 2.0.2 beta (2008-06-24) | ||
* Fast new cache system. Cached files served almost 3x as fast. | ||
* Dropped support of compress encoding (though HTTP_Encoder still supports it) | ||
|
||
Version 2.0.1 (2008-05-31) | ||
* E_STRICT compliance (Cache_Lite_File). | ||
|
||
Version 2.0.0 (2008-05-22) | ||
* Complete code overhaul. Minify is now a PEAR-style class and toolkit | ||
for building customized minifying file servers. | ||
* Content-Encoding: deflate/gzip/compress, based on request headers | ||
* Expanded CSS and HTML minifiers with test cases | ||
* Easily plug-in 3rd-party minifiers (like Packer) | ||
* Plug-able front end controller allows changing the way files are chosen | ||
* Compression & encoding modules lazy-loaded as needed (304 responses use | ||
use minimal code) | ||
* Separate utility classes for HTTP encoding and cache control | ||
|
||
Version 1.0.1 (2007-05-05) | ||
* Fixed various problems resolving pathnames when hosted on an NFS mount. | ||
* Fixed 'undefined constant' notice. | ||
* Replaced old JSMin library with a much faster custom implementation. | ||
|
||
Version 1.0.0 (2007-05-02) | ||
* First release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Copyright (c) 2008 Ryan Grove <ryan@wonko.com> | ||
Copyright (c) 2008 Steve Clay <steve@mrclay.org> | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, | ||
this list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of this project nor the names of its contributors may be | ||
used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Oops, something went wrong.