本文整理汇总了PHP中GUMP::rules方法的典型用法代码示例。如果您正苦于以下问题:PHP GUMP::rules方法的具体用法?PHP GUMP::rules怎么用?PHP GUMP::rules使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GUMP
的用法示例。
在下文中一共展示了GUMP::rules方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: gradeInputPreprocess
/**
* Checks, sanitizes and Escapes the Userinput
*
* Dies if User submitted incorrect data
*/
protected function gradeInputPreprocess()
{
require_once PATH_INCLUDE . '/gump.php';
$gump = new GUMP();
$rules = array('gradelabel' => array('required|min_len,1|max_len,255', 'sql_escape', _g('Gradelabel')), 'gradelevel' => array('required|numeric|min_len,1|max_len,3', 'sql_escape', _g('Gradelevel')), 'schooltype' => array('numeric|min_len,1|max_len,11', 'sql_escape', _g('Schooltype')));
$gump->rules($rules);
if (!$gump->run($_POST)) {
$this->_interface->dieError($gump->get_readable_string_errors(true));
}
}
示例2: gump
protected function gump()
{
require_once PATH_INCLUDE . '/gump.php';
try {
$gump = new GUMP($_POST);
$gump->rules(array('userInput' => array($_POST['regex'], '', $_POST['elementName'])));
if (!$gump->run($_POST)) {
die('wrongInput');
} else {
die('correctInput');
}
} catch (Exception $e) {
die('somethingWentWrong' . $e->getMessage());
}
}
示例3: inputCheck
/**
* Validates the input of the admin
*/
protected function inputCheck()
{
require_once PATH_INCLUDE . '/gump.php';
$gump = new \GUMP();
try {
$gump->rules($this->_changeRules);
//Set none-filled-out formelements to be at least a void string,
//for easier processing
// $_POST = $gump->voidVarsToStringByRuleset(
// $_POST, self::$registerRules);
//validate the elements
if (!$gump->run($_POST)) {
die(json_encode(array('value' => 'error', 'message' => $gump->get_readable_string_errors(false))));
}
} catch (\Exception $e) {
$this->_logger->log('error checking input', 'error', Null, json_encode(array('message' => $e->getMessage())));
die(json_encode(array('value' => 'error', 'message' => array('Konnte die Eingaben nicht überprüfen!'))));
}
if (!empty($_POST['cardnumber'])) {
$this->cardnumberDuplicatedCheck($_POST['cardnumber']);
}
}
示例4: registerCheck
/**
* Checks the Inputdata of the registerform for correct Format and stuff
*/
protected function registerCheck()
{
require_once PATH_INCLUDE . '/gump.php';
$gump = new GUMP();
$_POST['isSoli'] = isset($_POST['isSoli']) && $_POST['isSoli'] == 'true';
try {
$gump->rules(self::$registerRules);
// $_POST = $gump->input_preprocess_by_ruleset($_POST,
// self::$registerRules);
//Set none-filled-out formelements to be at least a void string,
//for easier processing
$gump->voidVarsToStringByRuleset($_POST, self::$registerRules);
//validate and MySQL-Escape the elements
if ($gump->run($_POST)) {
} else {
die(json_encode(array('value' => 'inputError', 'message' => $gump->get_readable_string_errors(false))));
}
} catch (Exception $e) {
die(json_encode(array('value' => 'inputError', 'message' => array('Konnte die Eingaben nicht überprüfen!'))));
}
if (!empty($_POST['cardnumber'])) {
$this->cardnumberDuplicatedCheck($_POST['cardnumber']);
}
}
示例5: classteacherInputCheck
/**
* Checks the Input of the AddClassteacher-Form and ChangeClassteacher-Form
*
* Dies displaying a Message on wrong Input
*/
protected function classteacherInputCheck()
{
$gump = new GUMP();
$gump->rules(array('forename' => array('min_len,2|max_len,64', '', _g('Forename')), 'name' => array('required|min_len,2|max_len,64', '', _g('Surname')), 'address' => array('min_len,2|max_len,255', '', _g('Address')), 'telephone' => array('min_len,2|max_len,64', '', _g('Telephone Number'))));
if (!($_POST = $gump->run($_POST))) {
$this->_interface->dieError($gump->get_readable_string_errors(true));
}
if (count($_POST['classes'])) {
$this->classteacherAddInputInClassesCheck();
}
}
示例6: gumpCheck
protected function gumpCheck()
{
$gump = new GUMP();
try {
$gump->rules($this->_gumpRules);
foreach ($this->_contentArray as $con) {
if (!$gump->run($con)) {
$this->errorAdd(array('type' => 'inputError', 'message' => $gump->get_readable_string_errors(true)));
}
}
} catch (Exception $e) {
$this->errorDie(_g('Could not check the Inputdata'));
}
}
示例7: classDeletionInputCheck
/**
* Checks the given ID before starting the Deletion-process of the Class
*
* Dies displaying a message when Input not correct
*/
protected function classDeletionInputCheck()
{
$gump = new GUMP();
$gump->rules(array('ID' => array('required|min_len,1|max_len,11|numeric', '', _g('Class-ID'))));
if (!($_GET = $gump->run($_GET))) {
$this->_interface->dieError($gump->get_readable_string_errors(true));
}
}