mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-08 17:07:03 +03:00
Uploading and preparing the repository to the dev version.
Original unminified source code (dev folder - js, css, less) (fixes #6) Grunt build system Multiple identities correction (fixes #9) Compose html editor (fixes #12) New general settings - Loading Description New warning about default admin password Split general and login screen settings
This commit is contained in:
parent
afad45137e
commit
4cc2207513
846 changed files with 99453 additions and 2123 deletions
104
rainloop/v/0.0.0/app/libraries/MailSo/Imap/SearchBuilder.php
Normal file
104
rainloop/v/0.0.0/app/libraries/MailSo/Imap/SearchBuilder.php
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
|
||||
namespace MailSo\Imap;
|
||||
|
||||
/**
|
||||
* @category MailSo
|
||||
* @package Imap
|
||||
*/
|
||||
class SearchBuilder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $aList;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$this->Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Imap\SearchBuilder
|
||||
*/
|
||||
public static function NewInstance()
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Imap\SearchBuilder
|
||||
*/
|
||||
public function Clear()
|
||||
{
|
||||
$this->aList = array();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param string $sValue = ''
|
||||
*
|
||||
* @return \MailSo\Imap\SearchBuilder
|
||||
*/
|
||||
public function AddAnd($sName, $sValue = '')
|
||||
{
|
||||
return $this->addCri('AND', $sName, $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param string $sValue = ''
|
||||
*
|
||||
* @return \MailSo\Imap\SearchBuilder
|
||||
*/
|
||||
public function AddOr($sName, $sValue = '')
|
||||
{
|
||||
return $this->addCri('OR', $sName, $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function Complete()
|
||||
{
|
||||
$sResult = '';
|
||||
foreach ($this->aList as $iIndex => $aItem)
|
||||
{
|
||||
$sResult = trim((0 < $iIndex && 'OR' === $aItem[0] ? $aItem[0] : '').
|
||||
(0 === strlen($sResult) ? '' : ' ('.$sResult.')').' '.$aItem[1].
|
||||
(0 < strlen($aItem[2]) ? ' '.$aItem[2] : ''));
|
||||
}
|
||||
|
||||
if (0 === strlen($sResult))
|
||||
{
|
||||
$sResult = 'ALL';
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->Complete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sType
|
||||
* @param string $sName
|
||||
* @param string $sValue = ''
|
||||
*
|
||||
* @return \MailSo\Imap\SearchBuilder
|
||||
*/
|
||||
private function addCri($sType, $sName, $sValue = '')
|
||||
{
|
||||
$this->aList[] = array($sType, $sName, $sValue);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue