IMP_Filter::canApplyFilters PHP Method

canApplyFilters() public static method

Are appliable filters available?
public static canApplyFilters ( ) : voolean
return voolean True if appliable filters are available.
    public static function canApplyFilters()
    {
        global $registry, $session;
        if (!$session->exists('imp', 'filteravail')) {
            $apply = false;
            try {
                $apply = $registry->call('mail/canApplyFilters');
            } catch (Horde_Exception $e) {
            }
            $session->set('imp', 'filteravail', $apply);
        }
        return $session->get('imp', 'filteravail');
    }

Usage Example

Example #1
0
        $GLOBALS['registry']->link('mail/showWhitelist');
        return false;
    } catch (Horde_Exception $e) {
    }
    return true;
}, 'on_init' => function ($ui) {
    $ui->prefs['filters_whitelist_link']['url'] = $GLOBALS['registry']->link('mail/showWhitelist');
});
$_prefs['filter_on_login'] = array('value' => 0, 'type' => 'checkbox', 'desc' => _("Apply filter rules upon logging on?"), 'help' => 'filter-on-login', 'suppress' => function () {
    return !IMP_Filter::canApplyFilters();
});
$_prefs['filter_on_display'] = array('value' => 0, 'type' => 'checkbox', 'desc' => _("Apply filter rules whenever Inbox is displayed?"), 'help' => 'filter-on-display', 'suppress' => function () {
    return !IMP_Filter::canApplyFilters();
});
$_prefs['filter_any_mailbox'] = array('value' => 0, 'type' => 'checkbox', 'desc' => _("Allow filter rules to be applied in any mailbox?"), 'help' => 'filter-any-mailbox', 'suppress' => function () {
    return !IMP_Filter::canApplyFilters();
});
// *** Event Request Preferences ***
$prefGroups['events'] = array('column' => _("General"), 'label' => _("Event Requests"), 'desc' => _("Configure how event or meeting requests should be handled."), 'members' => array('conflict_interval'));
$_prefs['conflict_interval'] = array('value' => 30, 'type' => 'number', 'desc' => _("Minutes needed to consider a event as non-conflicting in iTip"));
// *** PGP Preferences ***
$prefGroups['pgp'] = array('column' => _("General"), 'label' => _("PGP"), 'desc' => _("Configure PGP encryption support."), 'members' => array('pgpmanagement'), 'suppress' => function () {
    return !isset($GLOBALS['conf']['gnupg']['path']);
});
// These preferences MUST appear on the same page.
$_prefs['pgpmanagement'] = array('value' => array('use_pgp', 'use_pgp_text', 'pgp_attach_pubkey', 'pgp_verify', 'pgp_reply_pubkey', 'pgppublickey', 'pgpprivatekey'), 'type' => 'container');
$_prefs['use_pgp'] = array('value' => 0, 'type' => 'checkbox', 'desc' => _("Enable PGP functionality?"), 'help' => 'pgp-overview');
$_prefs['use_pgp_text'] = array('value' => '<div class="prefsPgpWarning">' . _("PGP support requires popup windows to be used.  If your browser is currently set to disable popup windows, you must change this setting or else the PGP features will not work correctly.") . '</div>', 'type' => 'rawhtml', 'requires' => array('use_pgp'));
$_prefs['pgp_attach_pubkey'] = array('value' => 0, 'type' => 'checkbox', 'desc' => _("Should your PGP public key to be attached to your messages by default?"), 'help' => 'pgp-option-attach-pubkey', 'requires' => array('use_pgp'));
$_prefs['pgp_verify'] = array('value' => 1, 'type' => 'checkbox', 'desc' => _("Should PGP signed messages be automatically verified when viewed?"), 'help' => 'pgp-option-verify', 'requires' => array('use_pgp'));
$_prefs['pgp_reply_pubkey'] = array('value' => 1, 'advanced' => true, 'type' => 'checkbox', 'desc' => _("Check for valid recipient PGP public keys while replying?"), 'help' => 'pgp-option-reply-pubkey', 'requires' => array('use_pgp'));
All Usage Examples Of IMP_Filter::canApplyFilters