. * * @version 1.0 * @author Simon Wippich * @copyright Copyright (c) 2009, Simon Wippich * @license http://www.gnu.org/licenses/ GNU Lesser General Public License */ class Qs_Packer_Html { /** * Method for compressing HTML-sourcecode. * * @access public * @param $htmlSourceCode String The original HTML-sourcecode * @param $removeComments bool * @return String The compressed HTML-sourcecode * @throws Exception */ final public static function compressHtml($htmlSourceCode, $removeComments = true) { // Initialize a returning variable $returnValue = ''; try { // Check if the given parameter matches datatype string if (is_string($htmlSourceCode)) { // Exclude pre- or code-tags preg_match_all( '!(<(?:code|pre|textarea).*>[^<]+)!', $htmlSourceCode, $pre ); // Remove all pre- or code-tags $htmlSourceCode = preg_replace( '!<(?:code|pre|textarea).*>[^<]+!', '#pre#', $htmlSourceCode ); // Remove HTML-comments if required if ($removeComments === true) { $htmlSourceCode = preg_replace( '/\