Overview

Packages

  • Imap
    • Client

Classes

  • Horde_Imap_Client
  • Horde_Imap_Client_Auth_DigestMD5
  • Horde_Imap_Client_Base
  • Horde_Imap_Client_Cache
  • Horde_Imap_Client_Data_Acl
  • Horde_Imap_Client_Data_AclCommon
  • Horde_Imap_Client_Data_AclNegative
  • Horde_Imap_Client_Data_AclRights
  • Horde_Imap_Client_Data_Envelope
  • Horde_Imap_Client_Data_Fetch
  • Horde_Imap_Client_Data_Fetch_Pop3
  • Horde_Imap_Client_Data_Thread
  • Horde_Imap_Client_DateTime
  • Horde_Imap_Client_Exception
  • Horde_Imap_Client_Exception_NoSupportExtension
  • Horde_Imap_Client_Fetch_Query
  • Horde_Imap_Client_Ids
  • Horde_Imap_Client_Ids_Pop3
  • Horde_Imap_Client_Mailbox
  • Horde_Imap_Client_Search_Query
  • Horde_Imap_Client_Socket
  • Horde_Imap_Client_Socket_Pop3
  • Horde_Imap_Client_Sort
  • Horde_Imap_Client_Translation
  • Horde_Imap_Client_Utf7imap
  • Horde_Imap_Client_Utils
  • Horde_Imap_Client_Utils_Pop3
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Imap_Client_Utils

Utility functions for the Horde IMAP client.

Copyright 2008-2012 Horde LLC (http://www.horde.org/)

getBaseSubject() code adapted from imap-base-subject.c (Dovecot 1.2) Original code released under the LGPL-2.0.1 Copyright (c) 2002-2008 Timo Sirainen tss@iki.fi

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Direct known subclasses

Horde_Imap_Client_Utils_Pop3
Package: Imap\Client
Category: Horde
License: LGPL 2.1
Author: Michael Slusarz slusarz@horde.org
Located at Horde/Imap/Client/Utils.php
Methods summary
public string
# toSequenceString( mixed $in, array $options = array() )

Create an IMAP message sequence string from a list of indices.

Create an IMAP message sequence string from a list of indices.

Index Format: range_start:range_end,uid,uid2,...

Mailbox Format: {mbox_length}[mailbox]range_start:range_end,uid,uid2,...

Parameters

$in
<p>An array of indices (or a single index). See 'mailbox' below.</p>
$options
<p>Additional options: - mailbox: (boolean) If true, store mailbox information with the ID list. $in should be an array of arrays, with keys as mailbox names and values as IDs. DEFAULT: false - nosort: (boolean) Do not numerically sort the IDs before creating the range? DEFAULT: false</p>

Returns

string
The IMAP message sequence string.
public array
# fromSequenceString( string $str )

Parse an IMAP message sequence string into a list of indices. See toSequenceString() for allowed formats.

Parse an IMAP message sequence string into a list of indices. See toSequenceString() for allowed formats.

Parameters

$str
The IMAP message sequence string.

Returns

array

An array of indices. If string contains mailbox info, return value will be an array of arrays, with keys as mailbox names and values as IDs. Otherwise, return the list of IDs.

See

Horde_Imap_Client_Utils::toSequenceString()
public string
# removeBareNewlines( string $str )

Remove "bare newlines" from a string.

Remove "bare newlines" from a string.

Parameters

$str
The original string.

Returns

string
The string with all bare newlines removed.
public string
# escape( string $str, boolean $force = false )

Escape IMAP output via a quoted string (see RFC 3501 [4.3]). Note that IMAP quoted strings support 7-bit characters only and can not contain either CR or LF.

Escape IMAP output via a quoted string (see RFC 3501 [4.3]). Note that IMAP quoted strings support 7-bit characters only and can not contain either CR or LF.

Parameters

$str
The unescaped string.
$force
Always add quotes?

Returns

string
The escaped string.
public string
# stripNonAtomChars( string $str )

Given a string, will strip out any characters that are not allowed in the IMAP 'atom' definition (RFC 3501 [9]).

Given a string, will strip out any characters that are not allowed in the IMAP 'atom' definition (RFC 3501 [9]).

Parameters

$str
An ASCII string.

Returns

string

The string with the disallowed atom characters stripped out.

public string
# getBaseSubject( string $str, array $options = array() )

Return the "base subject" defined in RFC 5256 [2.1].

Return the "base subject" defined in RFC 5256 [2.1].

Parameters

$str
The original subject string.
$options
<p>Additional options: - keepblob: (boolean) Don't remove any "blob" information (i.e. text leading text between square brackets) from string.</p>

Returns

string
The cleaned up subject string.
public mixed
# parseUrl( string $url )

Parse a POP3 (RFC 2384) or IMAP (RFC 5092/5593) URL.

Parse a POP3 (RFC 2384) or IMAP (RFC 5092/5593) URL.

Absolute IMAP URLs takes one of the following forms: - imap://[/] - imap:///[][?] - imap:///[][][][]

POP URLs take one of the following forms: - pop://;auth=@:

Parameters

$url
A URL string.

Returns

mixed

False if the URL is invalid. If valid, an array with the following fields: - auth: (string) The authentication method to use. - hostspec: (string) The remote server. (Not present for relative URLs). - mailbox: (string) The IMAP mailbox. - partial: (string) A byte range for use with IMAP FETCH. - port: (integer) The remote port. (Not present for relative URLs). - relative: (boolean) True if this is a relative URL. - search: (string) A search query to be run with IMAP SEARCH. - section: (string) A MIME part ID. - type: (string) Either 'imap' or 'pop'. (Not present for relative URLs). - username: (string) The username to use on the remote server. - uid: (string) The IMAP UID. - uidvalidity: (integer) The IMAP UIDVALIDITY for the given mailbox. - urlauth: (string) URLAUTH info (not parsed).

public string
# createUrl( array $data )

Create a POP3 (RFC 2384) or IMAP (RFC 5092/5593) URL.

Create a POP3 (RFC 2384) or IMAP (RFC 5092/5593) URL.

Parameters

$data
<p>The data used to create the URL. See the return value from parseUrl() for the available fields.</p>

Returns

string
A URL string.
public string
# parseCommandArray( string $query, callable $callback = null, array $out = '' )

Parses a client command array to create a server command string.

Parses a client command array to create a server command string.

Parameters

$query
$out The unprocessed command string.
$callback
<p>A callback function to use if literal data is found. Two arguments are passed: the command string (as built so far) and the literal data. The return value should be the new value for the current command string.</p>
$out
$query An array with the following format: <ul> <li> Array <ul> <li> Array with keys 't' and 'v' <ul> <li>t: IMAP data type (Horde_Imap_Client::DATA_* constants)</li> <li>v: Data value</li> </ul> </li> <li> Array with only values <ul> <li>Treated as a parenthesized list</li> </ul> </li> </ul> </li> <li> Null <ul> <li>Ignored</li> </ul> </li> <li> Resource <ul> <li>Treated as literal data</li> </ul> </li> <li> String <ul> <li>Output as-is (raw)</li> </ul> </li> </ul>

Returns

string
The command string.

Since

1.2.0
API documentation generated by ApiGen