Class IMAP_Tree

Description

The IMAP_Tree class provides a tree view of the folders supported with the PHP imap extension (IMAP/POP3/NNTP repositories). It provides access functions to iterate through this tree and query information about individual mailboxes/folders.

$Horde: framework/IMAP/IMAP/Tree.php,v 1.48.2.47 2009/01/06 15:23:11 jan Exp $

Copyright 2000-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (GPL). If you did not receive this file, see http://www.fsf.org/copyleft/gpl.html.

Located in /IMAP/IMAP/Tree.php (line 77)


	
			
Variable Summary
 string $_app
 string $_cachename
 boolean $_changed
 integer $_currkey
 string $_currparent
 array $_currstack
 string $_delimiter
 boolean $_dotfiles
 array $_eltdiff
 array $_expanded
 integer $_initmode
 integer $_mode
 string $_namespace
 array $_namespaces
 boolean $_nonimapelt
 array $_parent
 array $_poll
 string $_prefix
 string $_server
 boolean $_showunsub
 array $_subscribed
 array $_tree
 boolean $_unsubview
Method Summary
 IMAP_Tree IMAP_Tree ([integer $init = IMAPTREE_INIT_SUB], [string $cachename = 'imaptree'])
 void addPollList (mixed $id)
 void collapse (string $folder)
 void collapseAll ()
 array current ()
 boolean delete (mixed $id)
 array eltDiff ()
 void eltDiffStart ()
 void expand (string $folder, [boolean $expandall = false])
 void expandAll ()
 array get (string $name)
 array getElementInfo (string $name)
 array getPollList ()
 string getPrefix ()
 boolean hasChildren (array $elt)
 void IMAPchildrenSupport (boolean $support)
 void init (integer $init)
 boolean insert (mixed $id)
 integer isContainer (array $elt)
 integer isDiscovered (array $elt)
 integer isNamespace (array $elt)
 integer isOpen (array $elt)
 integer isPolled (array $elt)
 integer isSubscribed (array $elt)
 mixed next ([integer $mask = 0])
 string noTrailingDelimiter (string $name)
 boolean peek ()
 void removePollList (string $id)
 mixed reset ()
 void showUnsubscribed (boolean $unsub)
 IMAP_Tree &singleton (string $app, string $classname, [boolean $create = false], [integer $init = IMAPTREE_INIT_SUB], [string $cachename = 'imaptree'])
 void subscribe (mixed $id)
 void unsubscribe (mixed $id)
 array _addAliases (array $elt)
 integer _needSort (array $elt)
Variables
string $_app = null (line 199)

The application that generated this tree.

THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

string $_cachename (line 191)

The name to use when storing the object in the session.

boolean $_changed = false (line 161)

Tree changed flag. Set when something in the tree has been altered.

boolean $_childrensupport = null (line 229)

Does the IMAP server support the children extension?

integer $_currkey = null (line 98)

Location of current element in the tree.

string $_currparent = null (line 91)

Location of current element in the tree.

array $_currstack = array() (line 105)

Location of current element in the tree.

string $_delimiter = '/' (line 1919)

The server string used for the delimiter.

THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

  • deprecated: since Horde 3.1
boolean $_dotfiles = false (line 1945)

Should dotfiles be shown? THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

array $_eltdiff = null (line 236)

Used to determine the list of element changes.

array $_expanded = null (line 133)

The cached list of expanded folders.

IMAP_Sort $_imap_sort = null (line 175)

The IMAP_Sort object.

integer $_initmode = 0 (line 154)

Init mode flag.

integer $_mode = null (line 215)

Should we use 'mail' mode or 'news' mode? THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

string $_namespace = '' (line 1937)

The location of the first level of folders below the INBOX.

THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

  • deprecated: since Horde 3.1
array $_namespaces (line 222)

The list of namespaces to add to the tree.

boolean $_nonimapelt = false (line 184)

Insert an element in the tree that doesn't appear on the IMAP server.

If set, IMAP_Tree:: will call _getNonIMAPElt() to obtain the element to add to the tree.

array $_parent = array() (line 119)

Parent list.

array $_poll = null (line 126)

The cached list of mailboxes to poll.

string $_prefix = '' (line 1928)

Where we start listing folders.

THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

  • deprecated: since Horde 3.1
string $_prefixnodelim = '' (line 1910)

The prefix without a trailing delimiter.

  • deprecated: since Horde 3.1
string $_server = '' (line 207)

The server string for the current server.

THIS SHOULD BE SET IN EVERY SUBCLASS CONSTRUCTOR.

boolean $_showunsub = false (line 112)

Show unsubscribed mailboxes?

array $_subscribed = null (line 140)

Cached list of subscribed mailboxes.

array $_tree (line 84)

Associative array containing the mailbox tree.

array $_unsubscribed = null (line 147)

Cached list of unsubscribed mailboxes.

boolean $_unsubview = false (line 168)

Have we shown unsubscribed folders previously?

Methods
Constructor IMAP_Tree (line 286)

Constructor.

IMAP_Tree IMAP_Tree ([integer $init = IMAPTREE_INIT_SUB], [string $cachename = 'imaptree'])
  • integer $init: The initialization mode to use.
  • string $cachename: The name to use when storing in the session.
addPollList (line 1415)

Add element to the poll list.

THIS METHOD SHOULD BE DEFINED IN ALL SUBCLASSES.

  • abstract:
void addPollList (mixed $id)
  • mixed $id: The element name or a list of element names to add.
collapse (line 549)

Collapse a mail folder.

void collapse (string $folder)
  • string $folder: The folder name to collapse.
collapseAll (line 1570)

Should we collapse all elements?

void collapseAll ()
current (line 688)

Return the current tree element.

  • return: The current tree element or false if there is no element.
array current ()
delete (line 877)

Delete an element from the tree.

  • return: Return true on success, false on error.
boolean delete (mixed $id)
  • mixed $id: The element name or an array of element names.
eltDiff (line 1876)

Return the list of elements that have changed since nodeDiffStart() was last called.

  • return: An array with the following keys:
     'a' => A list of elements that have been added.
     'c' => A list of elements that have been changed.
     'd' => A list of elements that have been deleted.
    Returns false if no changes have occurred.
  • since: Horde 3.1
array eltDiff ()
eltDiffStart (line 1857)

Set the start point for determining element differences via eltDiff().

  • since: Horde 3.1
void eltDiffStart ()
expand (line 504)

Expand a mail folder.

void expand (string $folder, [boolean $expandall = false])
  • string $folder: The folder name to expand.
  • boolean $expandall: Expand all folders under this one?
expandAll (line 1560)

Should we expand all elements?

void expandAll ()
extendedNamespaceSupport (line 1953)

The existence of this function in IMAP_Tree indicates that extended namespace support is available.

  • return: Returns true.
boolean extendedNamespaceSupport ()
get (line 741)

Returns the requested element.

  • return: Returns the requested element or false if not found.
array get (string $name)
  • string $name: The name of the tree element.
getElementInfo (line 1699)

Get information about new/unseen/total messages for the given element.

  • return: Array with the following fields:
     'messages'  --  Number of total messages.
     'newmsg'    --  Number of new messages.
     'unseen'    --  Number of unseen messages.
array getElementInfo (string $name)
  • string $name: The element name.
getPollList (line 1401)

Initialize/get the list of elements to poll.

THIS METHOD SHOULD BE DEFINED IN ALL SUBCLASSES.

  • return: The list of elements to poll (name in key field).
  • abstract:
array getPollList ()
getPrefix (line 1964)

Return the prefix.

  • return: The prefix where folders begin to be listed.
  • deprecated: since Horde 3.1
string getPrefix ()
hasChildren (line 1086)

Does the element have any active children?

  • return: True if the element has active children.
boolean hasChildren (array $elt)
  • array $elt: A tree element.
IMAPchildrenSupport (line 1847)

Does the IMAP server support the 'CHILDREN' IMAP extension?

void IMAPchildrenSupport (boolean $support)
  • boolean $support: True if the IMAP server supports the CHILDREN extension, false if it doesn't.
init (line 434)

Initalize the list at the top level of the hierarchy.

void init (integer $init)
  • integer $init: The initialization mode.
insert (line 760)

Insert a folder/mailbox into the tree.

  • return: True on success, false on error.
boolean insert (mixed $id)
  • mixed $id: The name of the folder (or a list of folder names) to add (must be present on the mail server).
isContainer (line 1276)

Is this element a container only, not a mailbox (meaning you can not open it)?

  • return: True if the element is a container.
integer isContainer (array $elt)
  • array $elt: A tree element.
isDiscovered (line 1200)

Has the tree element been discovered?

  • return: Non-zero if the element has been discovered.
integer isDiscovered (array $elt)
  • array $elt: A tree element.
isNamespace (line 1329)

Is the element a namespace container?

  • return: True if the element is a namespace container?
integer isNamespace (array $elt)
  • array $elt: A tree element.
isOpen (line 1225)

Is the tree element open?

  • return: True if the element is open.
integer isOpen (array $elt)
  • array $elt: A tree element.
isPolled (line 1439)

Does the user want to poll this mailbox for new/unseen messages?

  • return: True if the user wants to poll the element.
integer isPolled (array $elt)
  • array $elt: A tree element.
isSubscribed (line 1304)

Is the user subscribed to this element?

  • return: True if the user is subscribed to the element.
integer isSubscribed (array $elt)
  • array $elt: A tree element.
next (line 576)

Sets the internal array pointer to the next element, and returns the next object.

  • return: Returns the next element or false if the element doesn't exist.
mixed next ([integer $mask = 0])
  • integer $mask: A mask with the following elements:
     IMAPTREE_NEXT_SHOWCLOSED - Don't ignore closed elements.
     IMAPTREE_NEXT_SHOWSUB - Only show subscribed elements.
noTrailingDelimiter (line 1999)

Make sure there is no trailing delimiter on the element name.

  • return: The element name with any trailing delimiter stripped off.
  • deprecated: since Horde 3.1
string noTrailingDelimiter (string $name)
  • string $name: The element name.
peek (line 703)

Determines if there are more elements in the current tree level.

  • return: True if there are more elements, false if this is the last element.
boolean peek ()
removePollList (line 1428)

Remove element from the poll list.

THIS METHOD SHOULD BE DEFINED IN ALL SUBCLASSES.

  • abstract:
void removePollList (string $id)
  • string $id: The folder/mailbox or a list of folders/mailboxes to remove.
reset (line 656)

Set internal pointer to the head of the tree.

This MUST be called before you can traverse the tree with next().

  • return: Returns the element at the head of the tree or false if the element doesn't exist.
mixed reset ()
showUnsubscribed (line 1626)

Switch subscribed/unsubscribed viewing.

void showUnsubscribed (boolean $unsub)
  • boolean $unsub: Show unsubscribed elements?
singleton (line 259)

Attempts to return a reference to a concrete IMAP_Tree instance.

If an IMAP_Tree object is currently stored in the local session, recreate that object. Else, if $create is true, will create a new instance. Ensures that only one IMAP_Tree instance is available at any time.

This method must be invoked as:

   $imap_tree = &IMAP_Tree::singleton($app, $classname, [$create[, $unsub]]);

  • return: The IMAP_Tree object or null.
IMAP_Tree &singleton (string $app, string $classname, [boolean $create = false], [integer $init = IMAPTREE_INIT_SUB], [string $cachename = 'imaptree'])
  • string $app: The current application name.
  • string $classname: The class name to use when instantiating a new object.
  • boolean $create: Create a new IMAP_Tree if it doesn't exist in the session?
  • integer $init: The initialization mode to use.
  • string $cachename: The name to use when storing in the session.
subscribe (line 962)

Subscribe an element to the tree.

void subscribe (mixed $id)
  • mixed $id: The element name or an array of element names.
unsubscribe (line 989)

Unsubscribe an element from the tree.

void unsubscribe (mixed $id)
  • mixed $id: The element name or an array of element names.
_addAliases (line 724)

Adds aliases to a tree element and returns the resulting array.

  • return: A tree element with the aliases added.
  • access: protected
array _addAliases (array $elt)
  • array $elt: A tree element.
_needSort (line 1477)

Does this element's children need sorting?

  • return: True if the children need to be sorted.
integer _needSort (array $elt)
  • array $elt: A tree element.

Documentation generated on Sun, 30 Jan 2011 05:22:56 +0000 by phpDocumentor 1.4.3