Overview

Packages

  • None
  • Sam

Classes

  • Sam
  • Sam_Driver_Amavisd_Sql
  • Sam_Driver_Base
  • Sam_Driver_Spamd_Base
  • Sam_Driver_Spamd_Ftp
  • Sam_Driver_Spamd_Ldap
  • Sam_Driver_Spamd_Sql
  • Sam_Exception
  • Sam_Factory_Driver
  • Sam_Form_Blacklist
  • Sam_Form_List
  • Sam_Form_Options
  • Sam_Form_Whitelist
  • Overview
  • Package
  • Class
  • Tree

Class Sam_Driver_Base

Sam_Driver_Base defines an API for implementing storage backends for Sam.

Direct known subclasses

Sam_Driver_Amavisd_Sql, Sam_Driver_Spamd_Base

Indirect known subclasses

Sam_Driver_Spamd_Ftp, Sam_Driver_Spamd_Ldap, Sam_Driver_Spamd_Sql
Abstract
Package: Sam
Author: Chris Bowlby excalibur@hub.org
Author: Max Kalika max@gentoo.org
Author: Jan Schneider jan@horde.org
Located at Driver/Base.php
Methods summary
public
# __construct( string $user, array $params = array() )

Constructor.

Constructor.

Parameters

$user
A user name.
$params
Backend specific class parameters.
abstract public
# retrieve( )

Retrieves user preferences and optionally default values from the backend.

Retrieves user preferences and optionally default values from the backend.

Throws

Sam_Exception
abstract public
# store( boolean $defaults = false )

Stores user preferences and optionally default values in the backend.

Stores user preferences and optionally default values in the backend.

Parameters

$defaults
<p>Whether to store the global defaults instead of user options.</p>

Throws

Sam_Exception
public boolean
# hasCapability( string $capability )

Check to see if the backend supports a particular capability.

Check to see if the backend supports a particular capability.

Parameters

$capability
The name of the capability to check.

Returns

boolean
True if the backend is capable, false otherwise.
public mixed
# booleanToOption( boolean $boolean )

Converts a boolean option to a backend specific value.

Converts a boolean option to a backend specific value.

Parameters

$boolean
The value to convert.

Returns

mixed
1 if true and 0 if false.
public boolean
# optionToBoolean( mixed $option )

Convert a backend specific boolean value to a PHP boolean.

Convert a backend specific boolean value to a PHP boolean.

Parameters

$option
The value to convert.

Returns

boolean

True if the backend-specific value is true, false otherwise.

public mixed
# getOption( string $option )

Returns a preference from user settings or global defaults.

Returns a preference from user settings or global defaults.

Parameters

$option
The option to retrieve.

Returns

mixed
The requested option value.
public
# setOption( string $option, string $value, boolean $defaults = false )

Sets a preference value for the user or as global defaults, depending on the parameters.

Sets a preference value for the user or as global defaults, depending on the parameters.

Does not automatically store options to the backend.

Parameters

$option
The option to set.
$value
The new value.
$defaults
<p>Whether to set the global defaults instead of user options.</p>
public string
# getListOption( string $option )

Returns an internal address array as a new-line separated string.

Returns an internal address array as a new-line separated string.

Useful for retrieving whitelists and blacklists.

Parameters

$option
The option to retrieve.

Returns

string
New-line separated list value.
public
# setListOption( string $option, string $value, boolean $defaults = false )

Sets an internal address array.

Sets an internal address array.

Useful for whitelists and blacklists. The passed data is split at whitespace. Does not automatically store options to the backend.

Parameters

$option
The option to set.
$value
<p>A string of data that will be converted to an array and stored for later storage to the backend.</p>
$defaults
<p>Whether to set the global defaults instead of user options.</p>
public
# setStackedOption( string $option, string $value, boolean $defaults = false )

Sets an internal array of options which have multiple elements of data stored in their value.

Sets an internal array of options which have multiple elements of data stored in their value.

E.g. rewrite_header takes two elements, a header and a string, as in 'rewrite_header' => 'Subject SPAM'.

There can be multiple entries for these options, so they cannot be treated independently.

Does not automatically store options to the backend.

Parameters

$option
<p>The base option to set. Should only be 'rewrite_header' ATM.</p>
$value
<p>A string of data that will be converted to an array and stored for later storage to the backend.</p>
$defaults
<p>Whether to set the global defaults instead of user options.</p>
API documentation generated by ApiGen