Below are the first 65 lines of the WordPress file 'class-pop3.php'. WordPress is a free semantic personal publishing platform to make working with your blogging software easier. Note the large number of comment lines and waste white space.
<?php /** * mail_fetch/setup.php * * Copyright (c) 1999-2002 The SquirrelMail Project Team * * Copyright (c) 1999 CDI (cdi@thewebmasters.net) All Rights Reserved * Modified by Philippe Mingo 2001 mingo@rotedic.com * An RFC 1939 compliant wrapper class for the POP3 protocol. * * Licensed under the GNU GPL. For full terms see the file COPYING. * * pop3 class * * $Id: class-pop3.php 2066 2005-01-07 01:29:49Z saxmatt $ */ class POP3 {
var $ERROR = ''; var $TIMEOUT = 60; var $COUNT = -1; var $BUFFER = 512; var $FP = ''; var $MAILSERVER = ''; var $DEBUG = FALSE; var $BANNER = ''; var $RFC1939 = TRUE; var $ALLOWAPOP = FALSE;
|
// Error string. // Default timeout before giving up on a // network operation. // Mailbox msg count // Socket buffer for socket fgets() calls. // Per RFC 1939 the returned line a POP3 // server can send is 512 bytes. // The connection to the server's // file descriptor // Set this to hard code the server name // set to true to echo pop3 // commands and responses to error_log // this WILL log passwords! // Holds the banner returned by the // pop server - used for apop() // Set by noop(). See rfc1939.txt // // Allow or disallow apop() // This must be set to true // manually
|
function POP3 ( $server = '', $timeout = '' ) { settype($this->BUFFER,"integer"); if( !empty($server) ) { // Do not allow programs to alter MAILSERVER // if it is already specified. They can get around // this if they -really- want to, so don't count on it. if(empty($this->MAILSERVER)) $this->MAILSERVER = $server; } if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; set_time_limit($timeout); } return true; } // More functions to follow ?> | Below is the same code but optimized by HTML-Optimizer. 1858 bytes have been saved which is 78%. The remote PHP Interpreter will serve your php web pages much faster!
<?php class POP3 { var $ERROR = ''; var $TIMEOUT = 60; var $COUNT = -1; var $BUFFER = 512; var $FP = ''; var $MAILSERVER = ''; var $DEBUG = FALSE; var $BANNER = ''; var $RFC1939 = TRUE; var $ALLOWAPOP = FALSE; function POP3 ( $server = '', $timeout = '' ) { settype($this->BUFFER,"integer"); if( !empty($server) ) { if(empty($this->MAILSERVER)) $this->MAILSERVER = $server; } if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; set_time_limit($timeout); } return true; } ?>
Of course, you won't often achieve a result as shown above. But even if your savings in bytes is only 15%, which is normal for pages with the .htm or .html extension, then consider the 15% decrease in bandwidth! If you want to verify what we advertise, you may download a zipped copy of the file 'class-pop3.php' and optimize it yourself by simply dropping it on the drop spot of one of our programs. Note that this file contains more code than the 65 lines shown at left, so the end result will not be 78% of bytes saved but 48%, which is still very good.
The file 'class-pop3.php' is copyright-protected. The downloaded copy may only be used as an example for optimizing php code. |