integer.php 2.43 KB
Newer Older
1
2
<?php
/**
3
4
 * Pieforms: Advanced web forms made easy
 * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
5
 *
6
7
8
9
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
10
 *
11
12
13
14
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
15
 *
16
17
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 *
19
20
 * @package    pieform
 * @subpackage rule
21
22
 * @author     Penny Leach <penny@catalyst.net.nz>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
23
 * @copyright  (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
24
25
26
27
28
29
 *
 */

/**
 * Returns whether the given field is an integer
 *
30
 * @param Pieform $form      The form the rule is being applied to
Nigel McNie's avatar
Nigel McNie committed
31
32
 * @param string  $value     The value to check
 * @param array   $element   The element to check
33
34
 * @return string            The error message, if there is something wrong with
 *                           the address.
35
 */
36
function pieform_rule_integer(Pieform $form, $value, $element) {/*{{{*/
37
    if (!is_numeric($value) || floor($value) != $value) {
Nigel McNie's avatar
Nigel McNie committed
38
        return $form->i18n('rule', 'integer', 'integer', $element);
39
    }
40
}/*}}}*/
41

42
function pieform_rule_integer_i18n() {/*{{{*/
Nigel McNie's avatar
Nigel McNie committed
43
44
45
    return array(
        'en.utf8' => array(
            'integer'   => 'The field must be an integer'
46
        ),
47
        'de.utf8' => array(
48
49
            'integer'   => 'Das Feld muss eine Zahl sein'
        ),
50
        'fr.utf8' => array(
51
52
            'integer'   => 'Ce champ doit être un nombre entier'
        ),
53
54
55
        'ja.utf8' => array(
            'integer'   => 'フィールドは整数にしてください'
        ),
56
57
58
        'es.utf8' => array(
            'integer'   => 'Este campo debe ser un número entero'
        ),
59
60
61
        'sl.utf8' => array(
            'integer'   => 'Vrednost polja mora biti število'
        ),
62
63
64
        'nl.utf8' => array(
            'integer'   => 'Dit veld moet een geheel getal (integer) zijn'
        ),
65
66
67
        'cs.utf8' => array(
            'integer'   => 'Musíte zadat celé číslo'
        ),
68

Nigel McNie's avatar
Nigel McNie committed
69
    );
70
}/*}}}*/
Nigel McNie's avatar
Nigel McNie committed
71

72
?>