cvs: pear /Mail_Mime mime.php

From: Date: Thu, 16 Dec 2004 19:37:32 +0000
Subject: cvs: pear /Mail_Mime mime.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-27504@lists.php.net to get a copy of this message
sean Thu Dec 16 14:37:32 2004 EDT Modified files: /pear/Mail_Mime mime.php Log: re-aligned doc blocks

http://cvs.php.net/diff.php/pear/Mail_Mime/mime.php?r1=1.27&r2=1.28&ty=u Index: pear/Mail_Mime/mime.php diff -u pear/Mail_Mime/mime.php:1.27 pear/Mail_Mime/mime.php:1.28 --- pear/Mail_Mime/mime.php:1.27 Thu Dec 16 14:00:37 2004 +++ pear/Mail_Mime/mime.php Thu Dec 16 14:37:32 2004 @@ -34,76 +34,76 @@ // | Tomas V.V.Cox <cox@idecnet.com> (port to PEAR) | // +-----------------------------------------------------------------------+ // -// $Id: mime.php,v 1.27 2004/12/16 19:00:37 sean Exp $ +// $Id: mime.php,v 1.28 2004/12/16 19:37:32 sean Exp $ require_once('PEAR.php'); require_once('Mail/mimePart.php'); /** -* Mime mail composer class. Can handle: text and html bodies, embedded html -* images and attachments. -* Documentation and examples of this class are avaible here: -* http://pear.php.net/manual/ -* -* @notes This class is based on HTML Mime Mail class from -* Richard Heyes <richard@phpguru.org> which was based also -* in the mime_mail.class by Tobias Ratschiller <tobias@dnet.it> and -* Sascha Schumann <sascha@schumann.cx> -* -* @author Richard Heyes <richard.heyes@heyes-computing.net> -* @author Tomas V.V.Cox <cox@idecnet.com> -* @package Mail -* @access public -*/ + * Mime mail composer class. Can handle: text and html bodies, embedded html + * images and attachments. + * Documentation and examples of this class are avaible here: + * http://pear.php.net/manual/ + * + * @notes This class is based on HTML Mime Mail class from + * Richard Heyes <richard@phpguru.org> which was based also + * in the mime_mail.class by Tobias Ratschiller <tobias@dnet.it> and + * Sascha Schumann <sascha@schumann.cx> + * + * @author Richard Heyes <richard.heyes@heyes-computing.net> + * @author Tomas V.V.Cox <cox@idecnet.com> + * @package Mail + * @access public + */ class Mail_mime { /** - * Contains the plain text part of the email - * @var string - */ + * Contains the plain text part of the email + * @var string + */ var $_txtbody; /** - * Contains the html part of the email - * @var string - */ + * Contains the html part of the email + * @var string + */ var $_htmlbody; /** - * contains the mime encoded text - * @var string - */ + * contains the mime encoded text + * @var string + */ var $_mime; /** - * contains the multipart content - * @var string - */ + * contains the multipart content + * @var string + */ var $_multipart; /** - * list of the attached images - * @var array - */ + * list of the attached images + * @var array + */ var $_html_images = array(); /** - * list of the attachements - * @var array - */ + * list of the attachements + * @var array + */ var $_parts = array(); /** - * Build parameters - * @var array - */ + * Build parameters + * @var array + */ var $_build_params = array(); /** - * Headers for the mail - * @var array - */ + * Headers for the mail + * @var array + */ var $_headers = array(); /** - * Constructor function - * - * @access public - */ + * Constructor function + * + * @access public + */ function Mail_mime($crlf = "\r\n") { if (!defined('MAIL_MIME_CRLF')) { @@ -121,21 +121,21 @@ } /** - * Accessor function to set the body text. Body text is used if - * it's not an html mail being sent or else is used to fill the - * text/plain part that emails clients who don't support - * html should show. - * - * @param string $data Either a string or - * the file name with the contents - * @param bool $isfile If true the first param should be treated - * as a file name, else as a string (default) - * @param bool $append If true the text or file is appended to - * the existing body, else the old body is - * overwritten - * @return mixed true on success or PEAR_Error object - * @access public - */ + * Accessor function to set the body text. Body text is used if + * it's not an html mail being sent or else is used to fill the + * text/plain part that emails clients who don't support + * html should show. + * + * @param string $data Either a string or + * the file name with the contents + * @param bool $isfile If true the first param should be treated + * as a file name, else as a string (default) + * @param bool $append If true the text or file is appended to + * the existing body, else the old body is + * overwritten + * @return mixed true on success or PEAR_Error object + * @access public + */ function setTXTBody($data, $isfile = false, $append = false) { if (!$isfile) { @@ -159,15 +159,15 @@ } /** - * Adds a html part to the mail - * - * @param string $data Either a string or the file name with the - * contents - * @param bool $isfile If true the first param should be treated - * as a file name, else as a string (default) - * @return mixed true on success or PEAR_Error object - * @access public - */ + * Adds a html part to the mail + * + * @param string $data Either a string or the file name with the + * contents + * @param bool $isfile If true the first param should be treated + * as a file name, else as a string (default) + * @return mixed true on success or PEAR_Error object + * @access public + */ function setHTMLBody($data, $isfile = false) { if (!$isfile) { @@ -184,17 +184,17 @@ } /** - * Adds an image to the list of embedded images. - * - * @param string $file The image file name OR image data itself - * @param string $c_type The content type - * @param string $name The filename of the image. - * Only use if $file is the image data - * @param bool $isfilename Whether $file is a filename or not - * Defaults to true - * @return mixed true on success or PEAR_Error object - * @access public - */ + * Adds an image to the list of embedded images. + * + * @param string $file The image file name OR image data itself + * @param string $c_type The content type + * @param string $name The filename of the image. + * Only use if $file is the image data + * @param bool $isfilename Whether $file is a filename or not + * Defaults to true + * @return mixed true on success or PEAR_Error object + * @access public + */ function addHTMLImage( $file, $c_type='application/octet-stream', $name = '', $isfilename = true @@ -217,18 +217,18 @@ } /** - * Adds a file to the list of attachments. - * - * @param string $file The file name of the file to attach - * OR the file data itself - * @param string $c_type The content type - * @param string $name The filename of the attachment - * Only use if $file is the file data - * @param bool $isFilename Whether $file is a filename or not - * Defaults to true - * @return mixed true on success or PEAR_Error object - * @access public - */ + * Adds a file to the list of attachments. + * + * @param string $file The file name of the file to attach + * OR the file data itself + * @param string $c_type The content type + * @param string $name The filename of the attachment + * Only use if $file is the file data + * @param bool $isFilename Whether $file is a filename or not + * Defaults to true + * @return mixed true on success or PEAR_Error object + * @access public + */ function addAttachment( $file, $c_type = 'application/octet-stream', $name = '', $isfilename = true, $encoding = 'base64' @@ -262,12 +262,12 @@ } /** - * Get the contents of the given file name as string - * - * @param string $file_name path of file to process - * @return string contents of $file_name - * @access private - */ + * Get the contents of the given file name as string + * + * @param string $file_name path of file to process + * @return string contents of $file_name + * @access private + */ function &_file2str($file_name) { if (!is_readable($file_name)) { @@ -282,15 +282,15 @@ } /** - * Adds a text subpart to the mimePart object and - * returns it during the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @param string The text to add. - * @return object The text mimePart object - * @access private - */ + * Adds a text subpart to the mimePart object and + * returns it during the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @param string The text to add. + * @return object The text mimePart object + * @access private + */ function &_addTextPart(&$obj, $text) { $params['content_type'] = 'text/plain'; @@ -304,14 +304,14 @@ } /** - * Adds a html subpart to the mimePart object and - * returns it during the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @return object The html mimePart object - * @access private - */ + * Adds a html subpart to the mimePart object and + * returns it during the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @return object The html mimePart object + * @access private + */ function &_addHtmlPart(&$obj) { $params['content_type'] = 'text/html'; @@ -325,13 +325,13 @@ } /** - * Creates a new mimePart object, using multipart/mixed as - * the initial content-type and returns it during the - * build process. - * - * @return object The multipart/mixed mimePart object - * @access private - */ + * Creates a new mimePart object, using multipart/mixed as + * the initial content-type and returns it during the + * build process. + * + * @return object The multipart/mixed mimePart object + * @access private + */ function &_addMixedPart() { $params['content_type'] = 'multipart/mixed'; @@ -339,15 +339,15 @@ } /** - * Adds a multipart/alternative part to a mimePart - * object (or creates one), and returns it during - * the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created. - * @return object The multipart/mixed mimePart object - * @access private - */ + * Adds a multipart/alternative part to a mimePart + * object (or creates one), and returns it during + * the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created. + * @return object The multipart/mixed mimePart object + * @access private + */ function &_addAlternativePart(&$obj) { $params['content_type'] = 'multipart/alternative'; @@ -359,15 +359,15 @@ } /** - * Adds a multipart/related part to a mimePart - * object (or creates one), and returns it during - * the build process. - * - * @param mixed The object to add the part to, or - * null if a new object is to be created - * @return object The multipart/mixed mimePart object - * @access private - */ + * Adds a multipart/related part to a mimePart + * object (or creates one), and returns it during + * the build process. + * + * @param mixed The object to add the part to, or + * null if a new object is to be created + * @return object The multipart/mixed mimePart object + * @access private + */ function &_addRelatedPart(&$obj) { $params['content_type'] = 'multipart/related'; @@ -379,14 +379,14 @@ } /** - * Adds an html image subpart to a mimePart object - * and returns it during the build process. - * - * @param object The mimePart to add the image to - * @param array The image information - * @return object The image mimePart object - * @access private - */ + * Adds an html image subpart to a mimePart object + * and returns it during the build process. + * + * @param object The mimePart to add the image to + * @param array The image information + * @return object The image mimePart object + * @access private + */ function &_addHtmlImagePart(&$obj, $value) { $params['content_type'] = $value['c_type']; @@ -398,14 +398,14 @@ } /** - * Adds an attachment subpart to a mimePart object - * and returns it during the build process. - * - * @param object The mimePart to add the image to - * @param array The attachment information - * @return object The image mimePart object - * @access private - */ + * Adds an attachment subpart to a mimePart object + * and returns it during the build process. + * + * @param object The mimePart to add the image to + * @param array The attachment information + * @return object The image mimePart object + * @access private + */ function &_addAttachmentPart(&$obj, $value) { $params['content_type'] = $value['c_type']; @@ -416,27 +416,27 @@ } /** - * Builds the multipart message from the list ($this->_parts) and - * returns the mime content. - * - * @param array Build parameters that change the way the email - * is built. Should be associative. Can contain: - * text_encoding - What encoding to use for plain text - * Default is 7bit - * html_encoding - What encoding to use for html - * Default is quoted-printable - * 7bit_wrap - Number of characters before text is - * wrapped in 7bit encoding - * Default is 998 - * html_charset - The character set to use for html. - * Default is iso-8859-1 - * text_charset - The character set to use for text. - * Default is iso-8859-1 - * head_charset - The character set to use for headers. - * Default is iso-8859-1 - * @return string The mime content - * @access public - */ + * Builds the multipart message from the list ($this->_parts) and + * returns the mime content. + * + * @param array Build parameters that change the way the email + * is built. Should be associative. Can contain: + * text_encoding - What encoding to use for plain text + * Default is 7bit + * html_encoding - What encoding to use for html + * Default is quoted-printable + * 7bit_wrap - Number of characters before text is + * wrapped in 7bit encoding + * Default is 998 + * html_charset - The character set to use for html. + * Default is iso-8859-1 + * text_charset - The character set to use for text. + * Default is iso-8859-1 + * head_charset - The character set to use for headers. + * Default is iso-8859-1 + * @return string The mime content + * @access public + */ function &get($build_params = null) { if (isset($build_params)) { @@ -551,15 +551,15 @@ } /** - * Returns an array with the headers needed to prepend to the email - * (MIME-Version and Content-Type). Format of argument is: - * $array['header-name'] = 'header-value'; - * - * @param array $xtra_headers Assoc array with any extra headers. - * Optional. - * @return array Assoc array with the mime headers - * @access public - */ + * Returns an array with the headers needed to prepend to the email + * (MIME-Version and Content-Type). Format of argument is: + * $array['header-name'] = 'header-value'; + * + * @param array $xtra_headers Assoc array with any extra headers. + * Optional. + * @return array Assoc array with the mime headers + * @access public + */ function &headers($xtra_headers = null) { // Content-Type header should already be present, @@ -574,14 +574,14 @@ } /** - * Get the text version of the headers - * (usefull if you want to use the PHP mail() function) - * - * @param array $xtra_headers Assoc array with any extra headers. - * Optional. - * @return string Plain text headers - * @access public - */ + * Get the text version of the headers + * (usefull if you want to use the PHP mail() function) + * + * @param array $xtra_headers Assoc array with any extra headers. + * Optional. + * @return string Plain text headers + * @access public + */ function txtHeaders($xtra_headers = null) { $headers = $this->headers($xtra_headers); @@ -593,34 +593,34 @@ } /** - * Sets the Subject header - * - * @param string $subject String to set the subject to - * access public - */ + * Sets the Subject header + * + * @param string $subject String to set the subject to + * access public + */ function setSubject($subject) { $this->_headers['Subject'] = $subject; } /** - * Set an email to the From (the sender) header - * - * @param string $email The email direction to add - * @access public - */ + * Set an email to the From (the sender) header + * + * @param string $email The email direction to add + * @access public + */ function setFrom($email) { $this->_headers['From'] = $email; } /** - * Add an email to the Cc (carbon copy) header - * (multiple calls to this method are allowed) - * - * @param string $email The email direction to add - * @access public - */ + * Add an email to the Cc (carbon copy) header + * (multiple calls to this method are allowed) + * + * @param string $email The email direction to add + * @access public + */ function addCc($email) { if (isset($this->_headers['Cc'])) { @@ -631,12 +631,12 @@ } /** - * Add an email to the Bcc (blank carbon copy) header - * (multiple calls to this method are allowed) - * - * @param string $email The email direction to add - * @access public - */ + * Add an email to the Bcc (blank carbon copy) header + * (multiple calls to this method are allowed) + * + * @param string $email The email direction to add + * @access public + */ function addBcc($email) { if (isset($this->_headers['Bcc'])) { @@ -647,12 +647,12 @@ } /** - * Encodes a header as per RFC2047 - * - * @param string $input The header data to encode - * @return string Encoded data - * @access private - */ + * Encodes a header as per RFC2047 + * + * @param string $input The header data to encode + * @return string Encoded data + * @access private + */ function _encodeHeaders($input) { foreach ($input as $hdr_name => $hdr_value) {
« previous php.pear.cvs (#27504) next »