1: <?php
2: /**
3: * The Ingo_Script_Procmail_Comment:: class represents a Procmail comment.
4: * This is a simple class, but it makes the code in Ingo_Script_Procmail::
5: * cleaner as it provides a generate() function and can be added to the
6: * recipe list the same way as a recipe can be.
7: *
8: * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
9: *
10: * See the enclosed file LICENSE for license information (ASL). If you
11: * did not receive this file, see http://www.horde.org/licenses/apache.
12: *
13: * @author Ben Chavet <ben@horde.org>
14: * @package Ingo
15: */
16: class Ingo_Script_Procmail_Comment
17: {
18: /**
19: * The comment text.
20: *
21: * @var string
22: */
23: protected $_comment = '';
24:
25: /**
26: * Constructs a new procmail comment.
27: *
28: * @param string $comment Comment to be generated.
29: * @param boolean $disable Output 'DISABLED' comment?
30: * @param boolean $header Output a 'header' comment?
31: */
32: public function __construct($comment, $disable = false, $header = false)
33: {
34: if ($disable) {
35: $comment = _("DISABLED: ") . $comment;
36: }
37:
38: $this->_comment = $header
39: ? '##### ' . $comment . ' #####'
40: : '# ' . $comment;
41: }
42:
43: /**
44: * Returns the comment stored by this object.
45: *
46: * @return string The comment stored by this object.
47: */
48: public function generate()
49: {
50: return $this->_comment;
51: }
52:
53: }
54: