root/trunk/patForms/Filter/Implode.php

Revision 388, 1.2 kB (checked in by schst, 2 years ago)

Added new imploder filter

  • Property svn:executable set to *
Line 
1 <?php
2 /**
3  * patForms implode filter
4  *
5  * Converts array values in a comma-separated string.
6  *
7  * @package        patForms
8  * @subpackage    Filter
9  */
10
11 /**
12  * patForms implode filter
13  *
14  * Converts array values in a comma-separated string.
15  *
16  * @package        patForms
17  * @subpackage    Filter
18  * @author        Stephan Schmidt <schst@php-tools.net>
19  * @license        LGPL, see license.txt for details
20  * @link        http://www.php-tools.net
21  * @version        1.0
22  */
23 class patForms_Filter_Implode extends patForms_Filter {
24
25    /**
26     * type of the filter
27     *
28     * @access    private
29     */
30     var $_type = PATFORMS_FILTER_TYPE_PHP;
31
32    /**
33     * Filter value that is returned by patForms
34     *
35     * This method is applied when patForms_Element::getValue()
36     * or patForms::getValues() is called.
37     *
38     * @abstract
39     * @access    public
40     * @param    string    value
41     * @return    float    filtered value
42     */
43     function out($value) {
44         if (is_array($value)) {
45             $value = implode(', ', $value);
46         }
47         return $value;
48     }
49
50    /**
51     * Filter value that is passed to patForms
52     *
53     * This method is applied when patForms_Element::setValue()
54     * or patForms::setValues() is called.
55     *
56     * @abstract
57     * @access    public
58     * @param    mixed    value
59     * @return    mixed    filtered value
60     */
61     function in($value) {
62         return $value;
63     }
64 }
65 ?>
Note: See TracBrowser for help on using the browser.