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
 1: <?php
 2: /**
 3:  * Base class for all SpamAssassin drivers.
 4:  *
 5:  * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
 6:  *
 7:  * See the enclosed file COPYING for license information (GPL). If you
 8:  * did not receive this file, see http://www.horde.org/licenses/gpl.
 9:  *
10:  * @author  Chris Bowlby <cbowlby@tenthpowertech.com>
11:  * @author  Max Kalika <max@horde.org>
12:  * @author  Jan Schneider <jan@horde.org>
13:  * @package Sam
14:  */
15: abstract class Sam_Driver_Spamd_Base extends Sam_Driver_Base
16: {
17:     /**
18:      * Capabilities supported by the driver.
19:      *
20:      * @var array
21:      */
22:     protected $_capabilities = array('hit_level',
23:                                      'score_level',
24:                                      'report_safe',
25:                                      'rewrite_sub',
26:                                      'subject_tag',
27:                                      'skip_rbl',
28:                                      'whitelist_to',
29:                                      'whitelist_from',
30:                                      'blacklist_to',
31:                                      'blacklist_from',
32:                                      'rewrite_header_sub',
33:                                      'rewrite_header_to',
34:                                      'rewrite_header_from');
35: 
36:     /**
37:      * Sam to SpamAssassin options mappings.
38:      *
39:      * @var array
40:      */
41:     protected $_option_map = array('hit_level' => 'required_hits',
42:                                    'rewrite_sub' => 'rewrite_subject',
43:                                    'skip_rbl' => 'skip_rbl_checks',
44:                                    'score_level' => 'required_score');
45: 
46:     /**
47:      * Converts a Sam attribute to a SpamAssassin option.
48:      *
49:      * @param string $attribute  The Sam attribute to convert.
50:      *
51:      * @return string  The converted SpamAssassin option or the original
52:      *                 attribute if no match is found.
53:      */
54:     protected function _mapAttributeToOption($attribute)
55:     {
56:         return isset($this->_option_map[$attribute])
57:             ? $this->_option_map[$attribute]
58:             : $attribute;
59:     }
60: 
61:     /**
62:      * Converts a SpamAssassin option to a Sam attribute.
63:      *
64:      * @param string $option  The SpamAssassin option to convert.
65:      *
66:      * @return string  The converted Sam attribute or the original option if
67:      *                 no match is found.
68:      */
69:     protected function _mapOptionToAttribute($option)
70:     {
71:         $attribute_map = array_flip($this->_option_map);
72:         return isset($attribute_map[$option])
73:             ? $attribute_map[$option]
74:             : $option;
75:     }
76: }
77: 
API documentation generated by ApiGen