QPrintEncoding Class Reference

Quoted Printable Encoding class. More...

Inheritance diagram for QPrintEncoding:

iEncoding

List of all members.

Public Member Functions

 encode ($input)
 getType ()
 Returns type.


Detailed Description

Quoted Printable Encoding class.

Definition at line 1016 of file Rmail.php.


Member Function Documentation

QPrintEncoding::encode ( input  ) 

Implements iEncoding.

Definition at line 1024 of file Rmail.php.

01025     {
01026         // Replace non printables
01027         $input    = preg_replace('/([^\x20\x21-\x3C\x3E-\x7E\x0A\x0D])/e', 'sprintf("=%02X", ord("\1"))', $input);
01028         $inputLen = strlen($input);
01029         $outLines = array();
01030         $output   = '';
01031 
01032         $lines = preg_split('/\r?\n/', $input);
01033         
01034         // Walk through each line
01035         for ($i=0; $i<count($lines); $i++) {
01036             // Is line too long ?
01037             if (strlen($lines[$i]) > $lineMax) {
01038                 $outLines[] = substr($lines[$i], 0, $lineMax - 1) . "="; // \r\n Gets added when lines are imploded
01039                 $lines[$i] = substr($lines[$i], $lineMax - 1);
01040                 $i--; // Ensure this line gets redone as we just changed it
01041             } else {
01042                 $outLines[] = $lines[$i];
01043             }
01044         }
01045         
01046         // Convert trailing whitespace    
01047         $output = preg_replace('/(\x20+)$/me', 'str_replace(" ", "=20", "\1")', $outLines);
01048 
01049         return implode("\r\n", $output);
01050     }

QPrintEncoding::getType (  ) 

Returns type.

Implements iEncoding.

Definition at line 1055 of file Rmail.php.

01056     {
01057         return 'quoted-printable';
01058     }


The documentation for this class was generated from the following file:

Generated on Wed May 6 23:10:50 2009 for fareofficelib by  doxygen 1.5.8