mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-05 15:37: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
132
rainloop/v/0.0.0/app/libraries/MailSo/Mime/Parameter.php
Normal file
132
rainloop/v/0.0.0/app/libraries/MailSo/Mime/Parameter.php
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
namespace MailSo\Mime;
|
||||
|
||||
/**
|
||||
* @category MailSo
|
||||
* @package Mime
|
||||
*/
|
||||
class Parameter
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sName;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $sValue;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*
|
||||
* @param string $sName
|
||||
* @param string $sValue
|
||||
*/
|
||||
private function __construct($sName, $sValue)
|
||||
{
|
||||
$this->sName = $sName;
|
||||
$this->sValue = $sValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param string $sValue = ''
|
||||
*
|
||||
* @return \MailSo\Mime\Parameter
|
||||
*/
|
||||
public static function NewInstance($sName, $sValue = '')
|
||||
{
|
||||
return new self($sName, $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sName
|
||||
* @param string $sValue = ''
|
||||
*
|
||||
* @return \MailSo\Mime\Parameter
|
||||
*/
|
||||
public static function CreateFromParameterLine($sRawParam)
|
||||
{
|
||||
$oParameter = self::NewInstance('');
|
||||
return $oParameter->Parse($sRawParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Mime\Parameter
|
||||
*/
|
||||
public function Reset()
|
||||
{
|
||||
$this->sName = '';
|
||||
$this->sValue = '';
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function Name()
|
||||
{
|
||||
return $this->sName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function Value()
|
||||
{
|
||||
return $this->sValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sRawParam
|
||||
* @param string $sSeparator = '='
|
||||
*
|
||||
* @return \MailSo\Mime\Parameter
|
||||
*/
|
||||
public function Parse($sRawParam, $sSeparator = '=')
|
||||
{
|
||||
$this->Reset();
|
||||
|
||||
$aParts = explode($sSeparator, $sRawParam, 2);
|
||||
|
||||
$this->sName = trim(trim($aParts[0]), '"\'');
|
||||
if (2 === count($aParts))
|
||||
{
|
||||
$this->sValue = trim(trim($aParts[1]), '"\'');
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bConvertSpecialsName = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function ToString($bConvertSpecialsName = false)
|
||||
{
|
||||
$sResult = '';
|
||||
if (0 < strlen($this->sName))
|
||||
{
|
||||
$sResult = $this->sName.'=';
|
||||
if ($bConvertSpecialsName && in_array(strtolower($this->sName), array(
|
||||
strtolower(\MailSo\Mime\Enumerations\Parameter::NAME),
|
||||
strtolower(\MailSo\Mime\Enumerations\Parameter::FILENAME)
|
||||
)))
|
||||
{
|
||||
$sResult .= '"'.\MailSo\Base\Utils::EncodeUnencodedValue(
|
||||
\MailSo\Base\Enumerations\Encoding::BASE64_SHORT,
|
||||
$this->sValue).'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$sResult .= '"'.$this->sValue.'"';
|
||||
}
|
||||
}
|
||||
|
||||
return $sResult;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue