PHP Classes

File: compactor.example2.php

Recommend this page to a friend!
  Classes of Oliver Lillie   HTML Compactor   compactor.example2.php   Download  
File: compactor.example2.php
Role: Example script
Content type: text/plain
Description: Example File 2
Class: HTML Compactor
Reduce HTML document size by removing white-spaces
Author: By
Last change:
Date: 16 years ago
Size: 640 bytes
 

Contents

Class file image Download
<?php

   
/**
     * This example requires the minify javascript compacter library
     * Freeley available from http://code.google.com/p/minify/
     * Once download please unpack into the same directory as this file.
     **/

   
require_once 'compactor.php';
   
    function
minify($code)
    {
        require_once
dirname(__FILE__).'/lib/jsmin.php';
        return
trim(JSMin::minify($code));
    }

   
$compactor = new Compactor(array(
       
'use_buffer' => true,
       
'buffer_echo' => true,
       
'compact_on_shutdown' => true,
       
'compress_scripts' => true,
       
'script_compression_callback' => 'minify'
   
));
   
    echo
file_get_contents('http://www.bbc.co.uk');
    exit;