Properties

$_params

$_params : array

The script class' additional parameters.

Type

array

$_features

$_features : array

A list of driver features.

Type

array

$_actions

$_actions : array

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

This SHOULD be defined in each subclass.

Type

array

$_categories

$_categories : array

The categories of filtering allowed.

This SHOULD be defined in each subclass.

Type

array

$_categoryFeatures

$_categoryFeatures : array

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

This is an associative array with the keys taken from $_categories, each value is a list of strings with the supported feature names. An absent key is interpreted as "all features supported".

Type

array

$_tests

$_tests : array

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

This SHOULD be defined in each subclass.

Type

array

$_types

$_types : array

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

This SHOULD be defined in each subclass.

Type

array

$_special_types

$_special_types : array

A list of any special types that this driver supports.

Type

array

$_recipes

$_recipes : array

The recipes that make up the code.

Type

array

$_generated

$_generated : boolean

Have the recipes been generated yet?

Type

boolean

$_endBlocks

$_endBlocks : array

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

Type

array

Methods

__construct()

__construct(array  $params = array()) 

Constructor.

Parameters

array $params

A hash containing parameters needed.

setParams()

setParams(array  $params = array()) : \Ingo_Script

Updates the parameters.

Parameters

array $params

A hash containing parameters.

Returns

\Ingo_Script —

This object, for chaining.

hasFeature()

hasFeature(string  $feature) : boolean

Returns whether the script driver supports a certain feature.

Parameters

string $feature

A feature name.

Returns

boolean —

True if this feature is supported.

excludeRegexp()

excludeRegexp() : string

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

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

Returns

string —

A regular expression.

availableActions()

availableActions() : array

Returns the available actions for this driver.

Returns

array —

The list of available actions.

availableCategories()

availableCategories() : array

Returns the available categories for this driver.

Returns

array —

The list of categories.

availableCategoryFeatures()

availableCategoryFeatures(  $category) : array

Returns the supported form fields for this driver.

Parameters

$category

Returns

array —

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

availableTests()

availableTests() : array

Returns the available tests for this driver.

Returns

array —

The list of tests actions.

availableTypes()

availableTypes() : array

Returns the available test types for this driver.

Returns

array —

The list of test types.

specialTypes()

specialTypes() : array

Returns any test types that are special for this driver.

Returns

array —

The list of special types

generate()

generate() : array

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

Returns

array —

The scripts.

perform()

perform(integer  $change = null) 

Performs the filtering specified in the rules.

Parameters

integer $change

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

canPerform()

canPerform() : boolean

Is the perform() function available right now?

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.

Returns

boolean —

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

activate()

activate(boolean  $activate = true, boolean  $auto_update = true) 

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

Parameters

boolean $activate

Activate the script?

boolean $auto_update

Only update if auto_update is active?

Throws

\Ingo_Exception

escapeString()

escapeString(string  $string, boolean  $regexmode = false) : string

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

Parameters

string $string

The string to escape.

boolean $regexmode

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

Returns

string —

The escaped string.

check()

check() : boolean|string

Checks if all rules are valid.

Returns

boolean|string —

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

_generate()

_generate() 

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

_addItem()

_addItem(integer  $rule, \Ingo_Script_Item  $item, string  $name = null) 

Adds an item to the recipe list.

Parameters

integer $rule

One of the Ingo::RULE_* constants.

\Ingo_Script_Item $item

An item to add to the recipe list.

string $name

A script name.

_insertItem()

_insertItem(integer  $rule, \Ingo_Script_Item  $item, string  $name = null,   $position) 

Inserts an item into the recipe list.

Parameters

integer $rule

One of the Ingo::RULE_* constants.

\Ingo_Script_Item $item

An item to add to the recipe list.

string $name

A script name.

$position

_perform()

_perform(  $change) 

Parameters

$change

_validRule()

_validRule(\Ingo_Rule  $rule) : boolean

Is this a valid rule?

Parameters

\Ingo_Rule $rule

The rule object.

Returns

boolean —

Whether the rule is valid for this driver.

_addForwardBlocks()

_addForwardBlocks(\Ingo_Rule  $rule) 

Adds all blocks necessary for the forward rule.

Parameters

\Ingo_Rule $rule

Rule object.

_addBlacklistBlocks()

_addBlacklistBlocks(\Ingo_Rule  $rule) 

Adds all blocks necessary for the blacklist rule.

Parameters

\Ingo_Rule $rule

Rule object.

_addWhitelistBlocks()

_addWhitelistBlocks(\Ingo_Rule  $rule) 

Adds all blocks necessary for the whitelist rule.

Parameters

\Ingo_Rule $rule

Rule object.

_addVacationBlocks()

_addVacationBlocks(\Ingo_Rule  $rule) 

Adds all blocks necessary for the vacation rule.

Parameters

\Ingo_Rule $rule

Rule object.

_addSpamBlocks()

_addSpamBlocks(\Ingo_Rule  $rule) 

Adds all blocks necessary for the spam rule.

Parameters

\Ingo_Rule $rule

Rule object.