Ingo_Script_Procmail_Recipe::procmailPath PHP Method

procmailPath() public method

Returns a procmail-ready mailbox path, converting IMAP folder pathname conventions as necessary.
public procmailPath ( string $folder ) : string
$folder string The IMAP folder name.
return string The procmail mailbox path.
    public function procmailPath($folder)
    {
        /* NOTE: '$DEFAULT' here is a literal, not a PHP variable. */
        if (empty($folder) || $folder == 'INBOX') {
            return '$DEFAULT';
        }
        if (isset($this->_params)) {
            if ($this->_params['path_style'] == 'maildir') {
                if (substr($folder, 0, 6) == 'INBOX.') {
                    $folder = substr($folder, 6);
                }
                $mbox = new Horde_Imap_Client_Mailbox($folder);
                return '".' . $mbox->utf7imap . '/"';
            }
            if ($this->_params['path_style'] == 'mboxutf7') {
                $mbox = new Horde_Imap_Client_Mailbox($folder);
                return '"' . $mbox->utf7imap . '/"';
            }
        }
        return str_replace(' ', '\\ ', escapeshellcmd($folder));
    }