[ Index ] |
|
Code source de Typo3 4.1.3 |
[Code source] [Imprimer] [Statistiques]
News: I had once said that when PHP 4.0.5 comes out I will reccomend the built in ob_gzhandler over my code unless you are generating flash or images on the fly. I was wrong. PHP 4.0.5 is out and ob_gzhandler doesn't work for me.
Author: | Sandy McArthur, Jr. <leknor@leknor.com> |
Poids: | 371 lignes (13 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
gzip_encode:: (5 méthodes):
gzip_encode()
gzip_accepted()
get_complevel()
linux_loadavg()
freebsd_loadavg()
Classe: gzip_encode - X-Ref
gzip_encode - a class to gzip encode php outputgzip_encode($level=3, $debug=false, $outputCompressedSizes=false) X-Ref |
gzip_encode constructor - gzip encodes the current output buffer if the browser supports it. Note: all arguments are optionial. You can specify one of the following for the first argument: 0: No compression 1: Min compression ... Some compression (integer from 1 to 9) 9: Max compression true: Determin the compression level from the system load. The higher the load the less the compression. You can specify one of the following for the second argument: true: Don't actully output the compressed form but run as if it had. Used for debugging. param: integer $level: Define the level of compression between 0 (none) and 9 (best compression) param: boolean $debug: If true, no data will be outputted (default: false) param: boolean $outputCompressedSizes: If true, the original and compressed size appended as HTML (default: false) return: void |
gzip_accepted() X-Ref |
gzip_accepted() - Test headers for Accept-Encoding: gzip Returns: if proper headers aren't found: false if proper headers are found: 'gzip' or 'x-gzip' Tip: using this function you can test if the class will gzip the output without actually compressing it yet, eg: if (gzip_encode::gzip_accepted()) { echo "Page will be gziped"; } note the double colon syntax, I don't know where it is documented but somehow it got in my brain. return: mixed Returns 'gzip' if the client browser accepts gzip encoding, otherwise false |
get_complevel() X-Ref |
get_complevel() - The level of compression we should use. Returns an int between 0 and 9 inclusive. Tip: $gzleve = gzip_encode::get_complevel(); to get the compression level that will be used with out actually compressing the output. Help: if you use an OS other then linux please send me code to make this work with your OS - Thanks return: integer Suggests a level of compression (0..9) for the current situation |
linux_loadavg() X-Ref |
linux_loadavg() - Gets the max() system load average from /proc/loadavg The max() Load Average will be returned return: float Returns the current load average |
freebsd_loadavg() X-Ref |
freebsd_loadavg() - Gets the max() system load average from uname(1) The max() Load Average will be returned I've been told the code below will work on solaris too, anyone wanna test it? return: float Returns the current load average |
Généré le : Sun Nov 25 17:13:16 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |