public function EncodeString($str, $encoding = 'base64')
    {
        $encoded = '';
        switch (strtolower($encoding)) {
            case 'base64':
                $encoded = chunk_split(base64_encode($str), 76, $this->LE);
                break;
            case '7bit':
            case '8bit':
                $encoded = $this->FixEOL($str);
                //Make sure it ends with a line break
                if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
                    $encoded .= $this->LE;
                }

                break;
            case 'binary':
                $encoded = $str;
                break;
            case 'quoted-printable':
                $encoded = $this->EncodeQP($str);
                break;
            default:
                $this->SetError($this->Lang('encoding') . $encoding);
                break;
        }
        return $encoded;
    }
public function EncodeString($str, $encoding = 'base64')
    {
        $encoded = '';
        switch (strtolower($encoding)) {
            case 'base64':
                $encoded = chunk_split(base64_encode($str), 76, $this->LE);
                break;
            case '7bit':
            case '8bit':
                $encoded = $this->FixEOL($str);
                //Make sure it ends with a line break
                if (substr($encoded, -(strlen($this->LE))) != $this->LE) {
                    $encoded .= $this->LE;
                }

                break;
            case 'binary':
                $encoded = $str;
                break;
            case 'quoted-printable':
                $encoded = $this->EncodeQP($str);
                break;
            default:
                $this->SetError($this->Lang('encoding') . $encoding);
                break;
        }
        return $encoded;
    }
public function EncodeString ( $ str , $ encoding = 'base64' ) { $ encoded = '' ; switch ( strtolower ( $ encoding ) ) { case 'base64' : $ encoded = chunk_split ( base64_encode ( $ str ) , 76 , $ this -> LE ) ; break ; case '7bit' : case '8bit' : $ encoded = $ this -> FixEOL ( $ str ) ; //Make sure it ends with a line break if ( substr ( $ encoded , - ( strlen ( $ this -> LE ) ) ) != $ this -> LE ) { $ encoded .= $ this -> LE ; } break ; case 'binary' : $ encoded = $ str ; break ; case 'quoted-printable' : $ encoded = $ this -> EncodeQP ( $ str ) ; break ; default : $ this -> SetError ( $ this -> Lang ( 'encoding' ) . $ encoding ) ; break ; } return $ encoded ; }
Encodes string to requested format.
Returns an empty string on failure.
@param string $str The text to encode
@param string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
@access public
@return string
Encodes string to requested format . Returns an empty string on failure .