MkFramework
 All Data Structures Functions
plugin_check.php
1 <?php
2 /*
3 This file is part of Mkframework.
4 
5 Mkframework is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License.
8 
9 Mkframework is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with Mkframework. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
24 
25  private $sErrorMsg;
26 
30  public function getLastErrorMsg(){
31  return $this->sErrorMsg;
32  }
33 
42  public function isEqual($uValueA,$uValueB,$sErrorMsg='KO isEqual'){
43  if($uValueA==$uValueB){
44  return true;
45  }
46  $this->sErrorMsg=$sErrorMsg;
47  return false;
48  }
57  public function isStrictlyEqual($uValueA,$uValueB,$sErrorMsg='KO isStrictlyEqual'){
58  if($uValueA === $uValueB){
59  return true;
60  }
61  $this->sErrorMsg=$sErrorMsg;
62  return false;
63  }
72  public function isNotEqual($uValueA,$uValueB,$sErrorMsg='KO isNotEqual'){
73  if($uValueA!=$uValueB){
74  return true;
75  }
76  $this->sErrorMsg=$sErrorMsg;
77  return false;
78  }
87  public function isUpperThan($uValueA,$uValueB,$sErrorMsg='KO isUpperThan'){
88  if($uValueA > $uValueB){
89  return true;
90  }
91  $this->sErrorMsg=$sErrorMsg;
92  return false;
93  }
102  public function isUpperOrEqualThan($uValueA,$uValueB,$sErrorMsg='KO isUpperOrEqualThan'){
103  if($uValueA >= $uValueB){
104  return true;
105  }
106  $this->sErrorMsg=$sErrorMsg;
107  return false;
108  }
117  public function isLowerThan($uValueA,$uValueB,$sErrorMsg='KO isLowerThan'){
118  if($uValueA < $uValueB){
119  return true;
120  }
121  $this->sErrorMsg=$sErrorMsg;
122  return false;
123  }
132  public function isLowerOrEqualThan($uValueA,$uValueB,$sErrorMsg='KO isLowerOrEqualThan'){
133  if($uValueA <= $uValueB){
134  return true;
135  }
136  $this->sErrorMsg=$sErrorMsg;
137  return false;
138  }
146  public function isEmpty($uValueA,$sErrorMsg='KO isEmpty'){
147  if(trim($uValueA)==''){
148  return true;
149  }
150  $this->sErrorMsg=$sErrorMsg;
151  return false;
152  }
160  public function isNotEmpty($uValueA,$sErrorMsg='KO isNotEmpty'){
161  if(trim($uValueA)!=''){
162  return true;
163  }
164  $this->sErrorMsg=$sErrorMsg;
165  return false;
166  }
174  public function isEmailValid($uValueA,$sErrorMsg='KO isEmailValid'){
175  if(preg_match('/^[\w.\-_]+@[\w.\-_]+\.[a-zA-Z]{2,6}$/',$uValueA)){
176  return true;
177  }
178  $this->sErrorMsg=$sErrorMsg;
179  return false;
180  }
188  public function matchExpression($uValueA,$sExpression,$sErrorMsg='KO matchExpression'){
189  if(preg_match($sExpression,$uValueA)){
190  return true;
191  }
192  $this->sErrorMsg=$sErrorMsg;
193  return false;
194  }
202  public function notMatchExpression($uValueA,$sExpression,$sErrorMsg='KO notMatchExpression'){
203  if(!preg_match($sExpression,$uValueA)){
204  return true;
205  }
206  $this->sErrorMsg=$sErrorMsg;
207  return false;
208  }
209 }
matchExpression($uValueA, $sExpression, $sErrorMsg='KO matchExpression')
isLowerOrEqualThan($uValueA, $uValueB, $sErrorMsg='KO isLowerOrEqualThan')
isNotEqual($uValueA, $uValueB, $sErrorMsg='KO isNotEqual')
isEqual($uValueA, $uValueB, $sErrorMsg='KO isEqual')
isNotEmpty($uValueA, $sErrorMsg='KO isNotEmpty')
notMatchExpression($uValueA, $sExpression, $sErrorMsg='KO notMatchExpression')
isUpperOrEqualThan($uValueA, $uValueB, $sErrorMsg='KO isUpperOrEqualThan')
isUpperThan($uValueA, $uValueB, $sErrorMsg='KO isUpperThan')
isLowerThan($uValueA, $uValueB, $sErrorMsg='KO isLowerThan')
isEmpty($uValueA, $sErrorMsg='KO isEmpty')
isEmailValid($uValueA, $sErrorMsg='KO isEmailValid')
isStrictlyEqual($uValueA, $uValueB, $sErrorMsg='KO isStrictlyEqual')