IMP_Compose_Link::__construct PHP Method

__construct() public method

public __construct ( mixed $in = null )
$in mixed
    public function __construct($in = null)
    {
        $fields = array('to', 'cc', 'bcc', 'message', 'body', 'subject');
        if (is_string($in)) {
            if (($pos = strpos($in, '?')) !== false) {
                parse_str(substr($in, $pos + 1), $this->args);
                $this->args['to'] = substr($in, 0, $pos);
            } else {
                $this->args['to'] = $in;
            }
        } elseif ($in instanceof Horde_Variables) {
            foreach ($fields as $val) {
                if (isset($in->{$val})) {
                    $this->args[$val] = $in->{$val};
                }
            }
        } elseif (is_array($in)) {
            $this->args = $in;
        }
        if (isset($this->args['to']) && strpos($this->args['to'], 'mailto:') === 0) {
            $mailto = @parse_url($this->args['to']);
            if (is_array($mailto)) {
                $this->args['to'] = isset($mailto['path']) ? $mailto['path'] : '';
                if (!empty($mailto['query'])) {
                    parse_str($mailto['query'], $vals);
                    foreach ($fields as $val) {
                        if (isset($vals[$val])) {
                            $this->args[$val] = $vals[$val];
                        }
                    }
                }
            }
        }
    }