Methods summary
public
|
#
__clone( )
Function to run on clone.
Function to run on clone.
|
public
|
#
setDisposition( string $disposition = null )
Set the content-disposition of this part.
Set the content-disposition of this part.
Parameters
- $disposition
- <p>The content-disposition to set ('inline',
'attachment', or an empty value).</p>
|
public
string
|
#
getDisposition( )
Get the content-disposition of this part.
Get the content-disposition of this part.
Returns
string The part's content-disposition. An empty string means
q no desired disposition has been set for this part.
|
public
|
#
setDispositionParameter( string $label, string $data )
Add a disposition parameter to this part.
Add a disposition parameter to this part.
Parameters
- $label
- The disposition parameter label.
- $data
- The disposition parameter data.
|
public
string
|
#
getDispositionParameter( string $label )
Get a disposition parameter from this part.
Get a disposition parameter from this part.
Parameters
- $label
- The disposition parameter label.
Returns
string The data requested.
Returns null if $label is not set.
|
public
array
|
#
getAllDispositionParameters( )
Get all parameters from the Content-Disposition header.
Get all parameters from the Content-Disposition header.
Returns
array An array of all the parameters
Returns the empty array if no parameters set.
|
public
|
#
setName( string $name )
Set the name of this part.
Set the name of this part.
Parameters
|
public
string
|
#
getName( boolean $default = false )
Get the name of this part.
Get the name of this part.
Parameters
- $default
- <p>If the name parameter doesn't exist, should we
use the default name from the description
parameter?</p>
Returns
string The name of the part.
|
public
|
#
setContents( mixed $contents, array $options = array() )
Set the body contents of this part.
Set the body contents of this part.
Parameters
- $contents
- <p>The part body. Either a string or a stream
resource, or an array containing both.</p>
- $options
- Additional options:
<pre><span class="php-quote">'encoding'</span> - (string) The encoding of <span class="php-var">$contents</span>.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword2">Current</span> transfer encoding value.
<span class="php-quote">'usestream'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-var">$contents</span> is a stream, should we directly
<span class="php-keyword1">use</span> that stream?
<span class="php-keyword1">DEFAULT</span>: <span class="php-var">$contents</span> copied to a <span class="php-keyword1">new</span> stream.</pre>
|
public
|
#
appendContents( mixed $contents, mixed $options = array() )
Add to the body contents of this part.
Add to the body contents of this part.
Parameters
- $contents
- <p>The part body. Either a string or a stream
resource, or an array containing both.</p>
<pre><span class="php-quote">'encoding'</span> - (string) The encoding of <span class="php-var">$contents</span>.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword2">Current</span> transfer encoding value.
<span class="php-quote">'usestream'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-var">$contents</span> is a stream, should we directly
<span class="php-keyword1">use</span> that stream?
<span class="php-keyword1">DEFAULT</span>: <span class="php-var">$contents</span> copied to a <span class="php-keyword1">new</span> stream.</pre>
- $options
-
|
public
|
#
clearContents( )
Clears the body contents of this part.
Clears the body contents of this part.
|
public
mixed
|
#
getContents( array $options = array() )
Return the body of the part.
Return the body of the part.
Parameters
- $options
- Additional options:
<pre><span class="php-quote">'canonical'</span> - (boolean) Returns the contents in strict RFC <span class="php-num">822</span> &
<span class="php-num">2045</span> output - namely, all newlines <span class="php-keyword2">end</span> with the
canonical <CR><LF> sequence.
<span class="php-keyword1">DEFAULT</span>: No
<span class="php-quote">'stream'</span> - (boolean) <span class="php-keyword1">Return</span> the body <span class="php-keyword1">as</span> a stream resource.
<span class="php-keyword1">DEFAULT</span>: No</pre>
Returns
mixed The body text of the part, or a stream resource if
'stream' is true.
|
public
|
#
setType( string $type )
Set the MIME type of this part.
Set the MIME type of this part.
Parameters
- $type
- The MIME type to set (ex.: text/plain).
|
public
string
|
#
getType( boolean $charset = false )
Get the full MIME Content-Type of this part.
Get the full MIME Content-Type of this part.
Parameters
- $charset
- <p>Append character set information to the end
of the content type if this is a text/* part?</p>
Returns
string The mimetype of this part (ex.: text/plain;
charset=us-ascii) or false.
|
public
string
|
#
getDefaultType( )
If the subtype of a MIME part is unrecognized by an application, the
default type should be used instead (See RFC 2046). This method
returns the default subtype for a particular primary MIME type.
If the subtype of a MIME part is unrecognized by an application, the
default type should be used instead (See RFC 2046). This method
returns the default subtype for a particular primary MIME type.
Returns
string The default MIME type of this part (ex.: text/plain).
|
public
string
|
#
getPrimaryType( )
Get the primary type of this part.
Get the primary type of this part.
Returns
string The primary MIME type of this part.
|
public
string
|
#
getSubType( )
Get the subtype of this part.
Get the subtype of this part.
Returns
string The MIME subtype of this part.
|
public
|
#
setCharset( string $charset )
Set the character set of this part.
Set the character set of this part.
Parameters
- $charset
- The character set of this part.
|
public
string
|
#
getCharset( )
Get the character set to use for this part.
Get the character set to use for this part.
Returns
string The character set of this part. Returns null if there
is no character set.
|
public
|
#
setLanguage( mixed $lang )
Set the language(s) of this part.
Set the language(s) of this part.
Parameters
- $lang
- <p>A language string, or an array of language
strings.</p>
|
public
|
#
getLanguage( )
Get the language(s) of this part.
Get the language(s) of this part.
|
public
|
#
setDuration( integer $duration )
Set the content duration of the data contained in this part (see RFC
3803).
Set the content duration of the data contained in this part (see RFC
3803).
Parameters
- $duration
- <p>The duration of the data, in seconds. If
null, clears the duration information.</p>
|
public
integer
|
#
getDuration( )
Get the content duration of the data contained in this part (see RFC
3803).
Get the content duration of the data contained in this part (see RFC
3803).
Returns
integer The duration of the data, in seconds. Returns null if
there is no duration information.
|
public
|
#
setDescription( string $description )
Set the description of this part.
Set the description of this part.
Parameters
- $description
- The description of this part.
|
public
string
|
#
getDescription( boolean $default = false )
Get the description of this part.
Get the description of this part.
Parameters
- $default
- <p>If the description parameter doesn't exist,
should we use the name of the part?</p>
Returns
string The description of this part.
|
public
|
#
setTransferEncoding( string $encoding, array $options = array() )
Set the transfer encoding to use for this part. Only needed in the
following circumstances:
1.) Indicate what the transfer encoding is if the data has not yet been
set in the object (can only be set if there presently are not
any contents).
2.) Force the encoding to a certain type on a toString() call (if
'send' is true).
Set the transfer encoding to use for this part. Only needed in the
following circumstances:
1.) Indicate what the transfer encoding is if the data has not yet been
set in the object (can only be set if there presently are not
any contents).
2.) Force the encoding to a certain type on a toString() call (if
'send' is true).
Parameters
- $encoding
- The transfer encoding to use.
- $options
- Additional options:
<pre><span class="php-quote">'send'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, <span class="php-keyword1">use</span> <span class="php-var">$encoding</span> <span class="php-keyword1">as</span> the sending encoding.
<span class="php-keyword1">DEFAULT</span>: <span class="php-var">$encoding</span> is used to change the base encoding.</pre>
|
public
|
#
addPart( Horde_Mime_Part $mime_part )
Add a MIME subpart.
Parameters
- $mime_part
- Add a subpart to the current object.
|
public
array
|
#
getParts( )
Get a list of all MIME subparts.
Get a list of all MIME subparts.
Returns
array An array of the Horde_Mime_Part subparts.
|
public
Horde_Mime_Part
|
#
getPart( string $id )
Retrieve a specific MIME part.
Retrieve a specific MIME part.
Parameters
Returns
|
public
|
#
removePart( string $id )
Remove a subpart.
Parameters
- $id
- The MIME ID to delete.
|
public
|
#
alterPart( string $id, Horde_Mime_Part $mime_part )
Alter a current MIME subpart.
Alter a current MIME subpart.
Parameters
- $id
- The MIME ID to alter.
- $mime_part
- The MIME part to store.
|
public
|
#
setContentTypeParameter( string $label, string $data )
Add a content type parameter to this part.
Add a content type parameter to this part.
Parameters
- $label
- The disposition parameter label.
- $data
- The disposition parameter data.
|
public
|
#
clearContentTypeParameter( string $label )
Clears a content type parameter from this part.
Clears a content type parameter from this part.
Parameters
- $label
- The disposition parameter label.
|
public
string
|
#
getContentTypeParameter( string $label )
Get a content type parameter from this part.
Get a content type parameter from this part.
Parameters
- $label
- The content type parameter label.
Returns
string The data requested.
Returns null if $label is not set.
|
public
array
|
#
getAllContentTypeParameters( )
Get all parameters from the Content-Type header.
Get all parameters from the Content-Type header.
Returns
array An array of all the parameters
Returns the empty array if no parameters set.
|
public
|
#
setEOL( string $eol )
Sets a new string to use for EOLs.
Sets a new string to use for EOLs.
Parameters
- $eol
- The string to use for EOLs.
|
public
string
|
#
getEOL( )
Get the string to use for EOLs.
Get the string to use for EOLs.
Returns
string The string to use for EOLs.
|
public
mixed
|
#
toString( array $options = array() )
Return the entire part in MIME format.
Return the entire part in MIME format.
Parameters
- $options
- Additional options:
<pre><span class="php-quote">'canonical'</span> - (boolean) Returns the encoded part in strict RFC <span class="php-num">822</span> &
<span class="php-num">2045</span> output - namely, all newlines <span class="php-keyword2">end</span> with the canonical
<CR><LF> sequence.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span>
<span class="php-quote">'defserver'</span> - (string) The <span class="php-keyword1">default</span> server to <span class="php-keyword1">use</span> when creating the
<span class="php-keyword2">header</span> string.
<span class="php-keyword1">DEFAULT</span>: none
<span class="php-quote">'encode'</span> - (integer) A mask of allowable encodings.
<span class="php-keyword1">DEFAULT</span>: self::ENCODE_7BIT
<span class="php-quote">'headers'</span> - (mixed) <span class="php-keyword1">Include</span> the MIME headers? <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, create a <span class="php-keyword1">new</span>
headers object. <span class="php-keyword1">If</span> a Horde_Mime_Headers object, add MIME
headers to this object. <span class="php-keyword1">If</span> a string, <span class="php-keyword1">use</span> the string
verbatim.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">true</span>
<span class="php-quote">'id'</span> - (string) <span class="php-keyword1">Return</span> only this MIME ID part.
<span class="php-keyword1">DEFAULT</span>: Returns the base part.
<span class="php-quote">'stream'</span> - (boolean) <span class="php-keyword1">Return</span> a stream resource.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
mixed The MIME string (returned as a resource if $stream is
true).
|
public
string
|
#
replaceEOL( mixed $text, string $eol = null, boolean $stream = false )
Replace newlines in this part's contents with those specified by either
the given newline sequence or the part's current EOL setting.
Replace newlines in this part's contents with those specified by either
the given newline sequence or the part's current EOL setting.
Parameters
- $text
- <p>The text to replace. Either a string or a
stream resource. If a stream, and returning
a string, will close the stream when done.</p>
- $eol
- <p>The EOL sequence to use. If not present, uses
the part's current EOL setting.</p>
- $stream
- If true, returns a stream resource.
Returns
string The text with the newlines replaced by the desired
newline sequence (returned as a stream resource if
$stream is true).
|
public
integer
|
#
getBytes( boolean $approx = false )
Determine the size of this MIME part and its child members.
Determine the size of this MIME part and its child members.
Parameters
- $approx
- <p>If true, determines an approximate size for
parts consisting of base64 encoded data (since
1.1.0).</p>
Returns
integer Size of the part, in bytes.
|
public
|
#
setBytes( integer $bytes )
Explicitly set the size (in bytes) of this part. This value will only
be returned (via getBytes()) if there are no contents currently set.
This function is useful for setting the size of the part when the
contents of the part are not fully loaded (i.e. creating a
Horde_Mime_Part object from IMAP header information without loading the
data of the part).
Explicitly set the size (in bytes) of this part. This value will only
be returned (via getBytes()) if there are no contents currently set.
This function is useful for setting the size of the part when the
contents of the part are not fully loaded (i.e. creating a
Horde_Mime_Part object from IMAP header information without loading the
data of the part).
Parameters
- $bytes
- The size of this part in bytes.
|
public
string
|
#
getSize( boolean $approx = false )
Output the size of this MIME part in KB.
Output the size of this MIME part in KB.
Parameters
- $approx
- <p>If true, determines an approximate size for
parts consisting of base64 encoded data (since
1.1.0).</p>
Returns
string Size of the part in KB.
|
public
string
|
#
setContentId( string $cid = null )
Sets the Content-ID header for this part.
Sets the Content-ID header for this part.
Parameters
- $cid
- <p>Use this CID (if not already set). Else, generate
a random CID.</p>
Returns
string The Content-ID for this part.
|
public
string
|
#
getContentId( )
Returns the Content-ID for this part.
Returns the Content-ID for this part.
Returns
string The Content-ID for this part.
|
public
|
#
setMimeId( string $mimeid )
Alter the MIME ID of this part.
Alter the MIME ID of this part.
Parameters
|
public
string
|
#
getMimeId( )
Returns the MIME ID of this part.
Returns the MIME ID of this part.
Returns
string The MIME ID.
|
public
|
#
buildMimeIds( string $id = null, boolean $rfc822 = false )
Build the MIME IDs for this part and all subparts.
Build the MIME IDs for this part and all subparts.
Parameters
- $id
- The ID of this part.
- $rfc822
- Is this a message/rfc822 part?
|
public
array
|
#
contentTypeMap( boolean $sort = true )
Returns a mapping of all MIME IDs to their content-types.
Returns a mapping of all MIME IDs to their content-types.
Parameters
Returns
array Keys: MIME ID; values: content type.
|
public
|
#
isBasePart( boolean $base )
Is this the base MIME part?
Is this the base MIME part?
Parameters
- $base
- True if this is the base MIME part.
|
public
|
#
setMetadata( string $key, mixed $data = null )
Set a piece of metadata on this object.
Set a piece of metadata on this object.
Parameters
- $key
- The metadata key.
- $data
- The metadata. If null, clears the key.
|
public
mixed
|
#
getMetadata( string $key )
Retrieves metadata from this object.
Retrieves metadata from this object.
Parameters
Returns
mixed The metadata, or null if it doesn't exist.
|
public
|
#
send( string $email, Horde_Mime_Headers $headers, Horde_Mail_Transport $mailer, array $opts = array() )
Sends this message.
Parameters
- $email
- The address list to send to.
- $headers
- <p>The Horde_Mime_Headers object
holding this message's headers.</p>
- $mailer
- A Horde_Mail_Transport object.
- $opts
- <p>Additional options:
- encode: (integer) The encoding to use. A mask of self::ENCODE_*
values.
DEFAULT: Auto-determined based on transport driver.</p>
Throws
|
public
mixed
|
#
findBody( string $subtype = null )
Finds the main "body" text part (if any) in a message.
"Body" data is the first text part under this part.
Finds the main "body" text part (if any) in a message.
"Body" data is the first text part under this part.
Parameters
- $subtype
- Specifically search for this subtype.
Returns
mixed The MIME ID of the main body part, or null if a body
part is not found.
|
public static
Horde_Mime_Part
|
#
parseMessage( string $text, array $options = array() )
Attempts to build a Horde_Mime_Part object from message text.
This function can be called statically via:
$mime_part = Horde_Mime_Part::parseMessage();
Attempts to build a Horde_Mime_Part object from message text.
This function can be called statically via: $mime_part = Horde_Mime_Part::parseMessage();
Parameters
- $text
- The text of the MIME message.
- $options
- Additional options:
<pre><span class="php-quote">'forcemime'</span> - (boolean) <span class="php-keyword1">If</span> <span class="php-keyword1">true</span>, the message data is assumed to be
MIME data. <span class="php-keyword1">If</span> not, a MIME-Version <span class="php-keyword2">header</span> must exist (RFC
<span class="php-num">2045</span> [<span class="php-num">4</span>]) to be parsed <span class="php-keyword1">as</span> a MIME message.
<span class="php-keyword1">DEFAULT</span>: <span class="php-keyword1">false</span></pre>
Returns
Throws
|
public static
string
|
#
getRawPartText( mixed $text, string $type, string $id )
Attempts to obtain the raw text of a MIME part.
This function can be called statically via:
$data = Horde_Mime_Part::getRawPartText();
Attempts to obtain the raw text of a MIME part.
This function can be called statically via: $data = Horde_Mime_Part::getRawPartText();
Parameters
- $text
- <p>The full text of the MIME message. The text is
assumed to be MIME data (no MIME-Version checking
is performed). It can be either a stream or a
string.</p>
- $type
- Either 'header' or 'body'.
- $id
- The MIME ID.
Returns
string The raw text.
Throws
|
public
|
#
offsetExists( mixed $offset )
Implementation of
ArrayAccess::offsetExists()
|
public
|
#
offsetGet( mixed $offset )
Implementation of
ArrayAccess::offsetGet()
|
public
|
#
offsetSet( mixed $offset, mixed $value )
Implementation of
ArrayAccess::offsetSet()
|
public
|
#
offsetUnset( mixed $offset )
Implementation of
ArrayAccess::offsetUnset()
|
public
integer
|
#
count( )
Returns the number of message parts.
Returns the number of message parts.
Returns
integer Number of message parts.
Implementation of
Countable::count()
|
public
string
|
#
serialize( )
Serialization.
Returns
string Serialized data.
Implementation of
Serializable::serialize()
|
public
|
#
unserialize( string $data )
Unserialization.
Parameters
Throws
Exception
Implementation of
Serializable::unserialize()
|