IMP_Prefs_Identity::getSignature PHP Méthode

getSignature() public méthode

Returns the full signature based on the current settings for the signature itself, the dashes and the position.
public getSignature ( string $type = 'text', integer $ident = null ) : string
$type string Either 'text' or 'html'.
$ident integer The identity to retrieve the signature from.
Résultat string The full signature.
    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;
    }