Documentation

Ingo_Script_Sieve extends Ingo_Script_Base
in package

The Ingo_Script_Sieve class represents a Sieve Script.

Tags
author

Mike Cochrane mike@graftonhall.co.nz

author

Jan Schneider jan@horde.org

category

Horde

license

http://www.horde.org/licenses/apache ASL

Table of Contents

$_actions  : array<string|int, mixed>
The list of actions allowed (implemented) for this driver.
$_categories  : array<string|int, mixed>
The categories of filtering allowed.
$_categoryFeatures  : array<string|int, mixed>
Which form fields are supported in each category by this driver?
$_endBlocks  : array<string|int, mixed>
The blocks that have to appear at the end of the code.
$_features  : array<string|int, mixed>
A list of driver features.
$_generated  : bool
Have the recipes been generated yet?
$_params  : array<string|int, mixed>
The script class' additional parameters.
$_recipes  : array<string|int, mixed>
The recipes that make up the code.
$_special_types  : array<string|int, mixed>
A list of any special types that this driver supports.
$_tests  : array<string|int, mixed>
The list of tests allowed (implemented) for this driver.
$_types  : array<string|int, mixed>
The types of tests allowed (implemented) for this driver.
__construct()  : mixed
Constructor.
activate()  : mixed
Connects to the backend, uploads the scripts and sets them active.
availableActions()  : array<string|int, mixed>
Returns the available actions for this driver.
availableCategories()  : array<string|int, mixed>
Returns the available categories for this driver.
availableCategoryFeatures()  : array<string|int, mixed>
Returns the supported form fields for this driver.
availableTests()  : array<string|int, mixed>
Returns the available tests for this driver.
availableTypes()  : array<string|int, mixed>
Returns the available test types for this driver.
canPerform()  : bool
Is the perform() function available right now?
check()  : bool|string
Checks if all rules are valid.
escapeString()  : string
Escape a string according to Sieve RFC 3028 [2.4.2].
excludeRegexp()  : string
Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.
generate()  : array<string|int, mixed>
Generates the scripts to do the filtering specified in the rules.
hasFeature()  : bool
Returns whether the script driver supports a certain feature.
perform()  : mixed
Performs the filtering specified in the rules.
setParams()  : Ingo_Script
Updates the parameters.
specialTypes()  : array<string|int, mixed>
Returns any test types that are special for this driver.
_addBlacklistBlocks()  : mixed
Adds all blocks necessary for the blacklist rule.
_addForwardBlocks()  : mixed
Adds all blocks necessary for the forward rule.
_addItem()  : mixed
Adds an item to the recipe list.
_addSpamBlocks()  : mixed
Adds all blocks necessary for the spam rule.
_addVacationBlocks()  : mixed
Adds all blocks necessary for the vacation rule.
_addWhitelistBlocks()  : mixed
Adds all blocks necessary for the whitelist rule.
_generate()  : mixed
Generates the Sieve script to do the filtering specified in the rules.
_insertItem()  : mixed
Inserts an item into the recipe list.
_perform()  : mixed
_validRule()  : bool
Is this a valid rule?

Properties

$_actions

The list of actions allowed (implemented) for this driver.

protected array<string|int, mixed> $_actions = array('Ingo_Rule_User_Discard', 'Ingo_Rule_User_FlagOnly', 'Ingo_Rule_User_Keep', 'Ingo_Rule_User_Move', 'Ingo_Rule_User_MoveKeep', 'Ingo_Rule_User_Notify', 'Ingo_Rule_User_Redirect', 'Ingo_Rule_User_RedirectKeep', 'Ingo_Rule_User_Reject')

$_categories

The categories of filtering allowed.

protected array<string|int, mixed> $_categories = array('Ingo_Rule_System_Blacklist', 'Ingo_Rule_System_Forward', 'Ingo_Rule_System_Spam', 'Ingo_Rule_System_Vacation', 'Ingo_Rule_System_Whitelist')

$_categoryFeatures

Which form fields are supported in each category by this driver?

protected array<string|int, mixed> $_categoryFeatures = array('Ingo_Rule_System_Vacation' => array('period', 'subject', 'reason', 'addresses', 'excludes', 'ignorelist', 'days'))

$_endBlocks

The blocks that have to appear at the end of the code.

protected array<string|int, mixed> $_endBlocks = array()

$_features

A list of driver features.

protected array<string|int, mixed> $_features = array( /* Can tests be case sensitive? */ 'case_sensitive' => \true, /* Does the driver support setting IMAP flags? */ 'imap_flags' => \true, /* Can this driver perform on demand filtering? */ 'on_demand' => \false, /* Does the driver require a script file to be generated? */ 'script_file' => \true, /* Does the driver support the stop-script option? */ 'stop_script' => \true, /* Does the driver support vacation start and end on time level? */ 'vacation_time' => \false, )

$_generated

Have the recipes been generated yet?

protected bool $_generated = \false

$_params

The script class' additional parameters.

protected array<string|int, mixed> $_params = array()

$_recipes

The recipes that make up the code.

protected array<string|int, mixed> $_recipes = array()

$_special_types

A list of any special types that this driver supports.

protected array<string|int, mixed> $_special_types = array()

$_tests

The list of tests allowed (implemented) for this driver.

protected array<string|int, mixed> $_tests = array('contains', 'not contain', 'is', 'not is', 'begins with', 'not begins with', 'ends with', 'not ends with', 'exists', 'not exist', 'less than', 'less than or equal to', 'equal', 'not equal', 'greater than', 'greater than or equal to', 'regex', 'not regex', 'matches', 'not matches')

$_types

The types of tests allowed (implemented) for this driver.

protected array<string|int, mixed> $_types = array(\Ingo_Rule_User::TEST_HEADER, \Ingo_Rule_User::TEST_SIZE, \Ingo_Rule_User::TEST_BODY)

Methods

__construct()

Constructor.

public __construct([array<string|int, mixed> $params = array() ]) : mixed
Parameters
$params : array<string|int, mixed> = array()

A hash containing parameters needed.

Return values
mixed

activate()

Connects to the backend, uploads the scripts and sets them active.

public activate([bool $activate = true ][, bool $auto_update = true ]) : mixed
Parameters
$activate : bool = true

Activate the script?

$auto_update : bool = true

Only update if auto_update is active?

Tags
throws
Ingo_Exception
Return values
mixed

availableActions()

Returns the available actions for this driver.

public availableActions() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of available actions.

availableCategories()

Returns the available categories for this driver.

public availableCategories() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of categories.

availableCategoryFeatures()

Returns the supported form fields for this driver.

public availableCategoryFeatures(mixed $category) : array<string|int, mixed>
Parameters
$category : mixed
Return values
array<string|int, mixed>

An array with the supported field names of the requested category.

availableTests()

Returns the available tests for this driver.

public availableTests() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of tests actions.

availableTypes()

Returns the available test types for this driver.

public availableTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of test types.

canPerform()

Is the perform() function available right now?

public canPerform() : bool

This is not a duplication of hasFeature() because drivers might override this to do real-time checks if on-demand filtering is not only available theoretically but practically in this very moment.

Return values
bool

True if perform() is available, false if not.

check()

Checks if all rules are valid.

public check() : bool|string
Return values
bool|string

True if all rules are valid, an error message otherwise.

escapeString()

Escape a string according to Sieve RFC 3028 [2.4.2].

public static escapeString(string $string[, bool $regexmode = false ]) : string
Parameters
$string : string

The string to escape.

$regexmode : bool = false

Is the escaped string a regex value? Defaults to no.

Return values
string

The escaped string.

excludeRegexp()

Returns a regular expression that should catch mails coming from most daemons, mailing list, newsletters, and other bulk.

public excludeRegexp() : string

This is the expression used for procmail's FROM_DAEMON, including all mailinglist headers.

Return values
string

A regular expression.

generate()

Generates the scripts to do the filtering specified in the rules.

public generate() : array<string|int, mixed>
Return values
array<string|int, mixed>

The scripts.

hasFeature()

Returns whether the script driver supports a certain feature.

public hasFeature(string $feature) : bool
Parameters
$feature : string

A feature name.

Tags
see

$_features

Return values
bool

True if this feature is supported.

perform()

Performs the filtering specified in the rules.

public perform([int $change = null ]) : mixed
Parameters
$change : int = null

The timestamp of the latest rule change during the current session (uses session value if null).

Return values
mixed

setParams()

Updates the parameters.

public setParams([array<string|int, mixed> $params = array() ]) : Ingo_Script
Parameters
$params : array<string|int, mixed> = array()

A hash containing parameters.

Return values
Ingo_Script

This object, for chaining.

specialTypes()

Returns any test types that are special for this driver.

public specialTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

The list of special types

_addBlacklistBlocks()

Adds all blocks necessary for the blacklist rule.

protected _addBlacklistBlocks(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_addForwardBlocks()

Adds all blocks necessary for the forward rule.

protected _addForwardBlocks(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_addItem()

Adds an item to the recipe list.

protected _addItem(int $rule, Ingo_Script_Item $item[, string $name = null ]) : mixed
Parameters
$rule : int

One of the Ingo::RULE_* constants.

$item : Ingo_Script_Item

An item to add to the recipe list.

$name : string = null

A script name.

Return values
mixed

_addSpamBlocks()

Adds all blocks necessary for the spam rule.

protected _addSpamBlocks(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_addVacationBlocks()

Adds all blocks necessary for the vacation rule.

protected _addVacationBlocks(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_addWhitelistBlocks()

Adds all blocks necessary for the whitelist rule.

protected _addWhitelistBlocks(Ingo_Rule $rule) : mixed
Parameters
$rule : Ingo_Rule

Rule object.

Return values
mixed

_generate()

Generates the Sieve script to do the filtering specified in the rules.

protected _generate() : mixed
Return values
mixed

_insertItem()

Inserts an item into the recipe list.

protected _insertItem(int $rule, Ingo_Script_Item $item[, string $name = null ], mixed $position) : mixed
Parameters
$rule : int

One of the Ingo::RULE_* constants.

$item : Ingo_Script_Item

An item to add to the recipe list.

$name : string = null

A script name.

$position : mixed
Tags
þaram

integer $position Where to add the item.

Return values
mixed

_perform()

protected _perform(mixed $change) : mixed
Parameters
$change : mixed
Tags
see
perform()
Return values
mixed

_validRule()

Is this a valid rule?

protected _validRule(Ingo_Rule $rule) : bool
Parameters
$rule : Ingo_Rule

The rule object.

Return values
bool

Whether the rule is valid for this driver.

Search results