public function getSignature($type = 'text', $ident = null)
{
if (is_null($ident)) {
$ident = $this->getDefault();
}
$convert = false;
$key = $ident . '|' . $type;
$val = null;
if (isset($this->_cached['signatures'][$key])) {
return $this->_cached['signatures'][$key];
}
if ($type == 'html') {
$val = $this->getValue('signature_html', $ident);
if (!strlen($val)) {
$convert = true;
$val = null;
}
}
if (is_null($val)) {
$val = $this->getValue('signature', $ident);
if (strlen($val) && $type == 'text') {
$val = str_replace("\r\n", "\n", $val);
$val = $this->getValue('sig_dashes', $ident) ? "\n-- \n" . $val : "\n\n" . $val;
}
}
if ($val && $type == 'html') {
if ($convert) {
$val = IMP_Compose::text2html(trim($val));
}
$val = '<div>' . $val . '</div>';
}
$this->_cached['signatures'][$key] = $val;
return $val;
}