Code

Updated to smarty 2.6.19
[gosa.git] / gosa-core / include / utils / class_msgPool.inc
1 <?php
3 class msgPool
4 {
6   public static function reserved($name)
7   {
8     return (sprintf(_("The field '%s' contains a reserved keyword!"), $name));
9   }
12   public static function cmdnotfound($type, $plugin)
13   {
14     return (sprintf(_("Command specified as %s hook for plugin '%s' does not exist!"), $type, $plugin));
15   }
18   public static function toobig($name, $min= "")
19   {
20     if ($min == ""){
21       return (sprintf(_("Value for '%s' is too big!"), $name));
22     } else {
23       return (sprintf(_("'%s' must be smaller than %d!"), $name, $min));
24     }
25   }
28   public static function toosmall($name, $min= "")
29   {
30     if ($min == ""){
31       return (sprintf(_("Value for '%s' is too small!"), $name));
32     } else {
33       return (sprintf(_("'%s' must be %d or above!"), $name, $min));
34     }
35   }
38   public static function bigger($name1, $name2)
39   {
40     return (sprintf(_("'%s' should be bigger than '%s'!"), $name1, $name2));
41   }
44   public static function smaller($name1, $name2)
45   {
46     return (sprintf(_("'%s' should be smaller than '%s'!"), $name1, $name2));
47   }
50   public static function depends($name1, $name2)
51   {
52     return (sprintf(_("'%s' depends on '%s' - please provide both values!"), $name1, $name2));
53   }
56   public static function duplicated($name)
57   {
58     return (sprintf(_("There is already an entry with this '%s' attribute in the system!"), $name));
59   }
62   public static function required($name)
63   {
64     return (sprintf(_("The required field '%s' is empty!"), $name));
65   }
68   public static function invalid($name, $data= "", $regex= "", $example= "")
69   {
70     /* Stylize example */
71     if ($example != ""){
72       $example= "<br><br>"._("Example:")." ".$example;
73     }
75     /* If validChars are posted, take data and paint all invalid
76        characters... */
77     if ($regex) {
78       $result= "";
79       $mismatch= "";
80       foreach (str_split($data) as $currentChar){
81         if (preg_match("$regex", $currentChar)){
82           $result.= $currentChar;
83         } else {
84           $result.= "<font style='color:red;text-decoration:underline;'>".htmlentities($currentChar)."</font>";
85           $mismatch.= $currentChar;
86         }
87       }
89       return sprintf(_("The Field '%s' contains invalid characters"), $name).". ".
90              (strlen($mismatch)==1?sprintf(_("'%s' is not allowed:"), htmlentities($mismatch)):sprintf(_("'%s' are not allowed."), htmlentities($mismatch))).
91              "<br><br> \"$result\"$example";
92     } else {
93       return sprintf(_("The Field '%s' contains invalid characters"), $name)."!$example";
94     }
95   }
98   public static function missingext($name)
99   {
100     return sprintf(_("Missing %s PHP extension!"), $name);
101   }