Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401]

Copyright 2008-2017 Horde LLC (http://www.horde.org/) See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Copyright: 2008-2017 Horde LLC
License: http://www.horde.org/licenses/lgpl21 LGPL 2.1
File Size: 918 lines (32 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Horde_Imap_Client_Search_Query:: (23 methods):
  __toString()
  charset()
  build()
  _buildAndOr()
  _addFuzzy()
  flag()
  flagSearch()
  newMsgs()
  headerText()
  text()
  size()
  ids()
  dateSearch()
  dateTimeSearch()
  intervalSearch()
  andSearch()
  orSearch()
  modseq()
  previousSearch()
  serialize()
  unserialize()
  __serialize()
  __unserialize()


Class: Horde_Imap_Client_Search_Query  - X-Ref

Abstraction of the IMAP4rev1 search criteria (see RFC 3501 [6.4.4]).
Allows translation between abstracted search criteria and a generated IMAP
search criteria string suitable for sending to a remote IMAP server.

__toString()   X-Ref
String representation: The IMAP search string.


charset($charset, $convert = true)   X-Ref
Sets the charset of the search text.

param: string $charset   The charset to use for the search.
param: boolean $convert  Convert existing text values?

build($exts = array()   X-Ref
Builds an IMAP4rev1 compliant search string.

param: Horde_Imap_Client_Base $exts  The server object this query will
return: array  An array with these elements:

_buildAndOr($type, $data, &$charset, &$exts_used,&$cmds)   X-Ref
Builds the AND/OR query.

param: string $type                               'AND' or 'OR'.
param: array $data                                Query data.
param: string &$charset                           Search charset.
param: array &$exts_used                          IMAP extensions used.
param: Horde_Imap_Client_Data_Format_List &$cmds  Command list.
return: boolean  True if query might return results.

_addFuzzy($add, &$temp)   X-Ref
Adds fuzzy modifier to search keys.

param: boolean $add  Add the fuzzy modifier?
param: array $temp   Temporary build data.

flag($name, $set = true, array $opts = array()   X-Ref
Search for a flag/keywords.

param: string $name  The flag or keyword name.
param: boolean $set  If true, search for messages that have the flag
param: array $opts   Additional options:

flagSearch()   X-Ref
Determines if flags are a part of the search.

return: boolean  True if search query involves flags.

newMsgs($newmsgs = true, array $opts = array()   X-Ref
Search for either new messages (messages that have the '\Recent' flag
but not the '\Seen' flag) or old messages (messages that do not have
the '\Recent' flag).  If new messages are searched, this will clear
any '\Recent' or '\Unseen' flag searches.  If old messages are searched,
this will clear any '\Recent' flag search.

param: boolean $newmsgs  If true, searches for new messages.  Else,
param: array $opts       Additional options:

headerText($header, $text, $not = false,array $opts = array()   X-Ref
Search for text in the header of a message.

param: string $header  The header field.
param: string $text    The search text.
param: boolean $not    If true, do a 'NOT' search of $text.
param: array $opts     Additional options:

text($text, $bodyonly = true, $not = false,array $opts = array()   X-Ref
Search for text in either the entire message, or just the body.

param: string $text      The search text.
param: boolean $bodyonly  If true, only search in the body of the
param: boolean $not      If true, do a 'NOT' search of $text.
param: array $opts       Additional options:

size($size, $larger = false, $not = false,array $opts = array()   X-Ref
Search for messages smaller/larger than a certain size.

param: integer $size    The size (in bytes).
param: boolean $larger  Search for messages larger than $size?
param: boolean $not     If true, do a 'NOT' search of $text.
param: array $opts      Additional options:

ids(Horde_Imap_Client_Ids $ids, $not = false,array $opts = array()   X-Ref
Search for messages within a given UID range. Only one message range
can be specified per query.

param: Horde_Imap_Client_Ids $ids  The list of UIDs to search.
param: boolean $not                If true, do a 'NOT' search of the
param: array $opts                 Additional options:

dateSearch($date, $range, $header = true, $not = false,array $opts = array()   X-Ref
Search for messages within a date range.

param: mixed $date    DateTime or Horde_Date object.
param: string $range  Either:
param: boolean $header  If true, search using the date in the message
param: boolean $not     If true, do a 'NOT' search of the range.
param: array $opts      Additional options:

dateTimeSearch($date, $range, $header = true, $not = false,array $opts = array()   X-Ref
Search for messages within a date and time range.

param: mixed $date    DateTime or Horde_Date object.
param: string $range  Either:
param: boolean $header  If true, search using the date in the message
param: boolean $not     If true, do a 'NOT' search of the range.
param: array $opts      Additional options:

intervalSearch($interval, $range, $not = false,array $opts = array()   X-Ref
Search for messages within a given interval. Only one interval of each
type can be specified per search query. If the IMAP server supports
the WITHIN extension (RFC 5032), it will be used.  Otherwise, the
search query will be dynamically created using IMAP4rev1 search
terms.

param: integer $interval  Seconds from the present.
param: string $range      Either:
param: boolean $not       If true, do a 'NOT' search.
param: array $opts        Additional options:

andSearch($queries)   X-Ref
AND queries - the contents of this query will be AND'ed (in its
entirety) with the contents of EACH of the queries passed in.  All
AND'd queries must share the same charset as this query.

param: mixed $queries  A query, or an array of queries, to AND with the

orSearch($queries)   X-Ref
OR a query - the contents of this query will be OR'ed (in its entirety)
with the contents of EACH of the queries passed in.  All OR'd queries
must share the same charset as this query.  All contents of any single
query will be AND'ed together.

param: mixed $queries  A query, or an array of queries, to OR with the

modseq($value, $name = null, $type = null, $not = false,array $opts = array()   X-Ref
Search for messages modified since a specific moment. The IMAP server
must support the CONDSTORE extension (RFC 7162) for this query to be
used.

param: integer $value  The mod-sequence value.
param: string $name    The entry-name string.
param: string $type    Either 'shared', 'priv', or 'all'. Defaults to
param: boolean $not    If true, do a 'NOT' search.
param: array $opts     Additional options:

previousSearch($not = false, array $opts = array()   X-Ref
Use the results from the previous SEARCH command. The IMAP server must
support the SEARCHRES extension (RFC 5182) for this query to be used.

param: boolean $not  If true, don't match the previous query.
param: array $opts   Additional options:

serialize()   X-Ref
No description

unserialize($data)   X-Ref
No description

__serialize()   X-Ref
Serialization.

return: string  Serialized data.

__unserialize($data)   X-Ref
Unserialization.

param: string $data  Serialized data.