本文整理汇总了PHP中ezcInputForm::validateDefinition方法的典型用法代码示例。如果您正苦于以下问题:PHP ezcInputForm::validateDefinition方法的具体用法?PHP ezcInputForm::validateDefinition怎么用?PHP ezcInputForm::validateDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ezcInputForm
的用法示例。
在下文中一共展示了ezcInputForm::validateDefinition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($inputSource, $definition, $characterEncoding = null, $inputData = null, $useOverride = false)
{
if (($returnValue = ezcInputForm::validateDefinition($definition)) !== true) {
throw new ezcInputFormInvalidDefinitionException($returnValue[1]);
}
$this->definition = $definition;
$this->inputSource = $inputSource;
$this->inputData = $inputData;
if ($inputData === null || count($inputData) == 0) {
$this->parseInput();
} else {
$this->parseInputFromData($useOverride);
}
}
示例2: __construct
/**
* Constructs a new ezcInputForm for $inputSource with $definition.
*
* This method constructs a new ezcInputForm with three parameters. The
* $inputSource parameter selects the input source and should be one of the
* constants INPUT_GET, INPUT_POST or INPUT_COOKIE. The $definition
* parameter is an array of ezcInputFormDefinitionElement items and
* determines which input variables make up this form (see the example at
* the top of this class). The last parameter, $characterEncoding is the
* character encoding to use while retrieving input variable data. This
* parameter has currently no function as it will depend on PHP 6
* functionality which does not exist yet in the input filter extension.
*
* @throws ezcInputFormVariableMissingException when one of the required
* input variables is missing.
* @throws ezcInputFormInvalidDefinitionException when the definition array
* is invalid or when the input source was invalid.
*
* @param int $inputSource
* @param array(ezcInputFormDefinitionElement) $definition
* @param string $characterEncoding
*/
public function __construct($inputSource, $definition, $characterEncoding = null)
{
if (($returnValue = ezcInputForm::validateDefinition($definition)) !== true) {
throw new ezcInputFormInvalidDefinitionException($returnValue[1]);
}
$this->definition = $definition;
$this->inputSource = $inputSource;
$this->parseInput();
}
示例3: testValidateDefinitionFieldName
public function testValidateDefinitionFieldName()
{
// The input field name should have a sane format
$def = array('test' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'int'));
self::assertEquals(true, ezcInputForm::validateDefinition($def));
$def = array('' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'int'));
self::assertEquals(array(ezcInputForm::DEF_FIELD_NAME_BROKEN, "The element name '' has an unsupported format. It should start with an a-z and followed by a-z0-9_"), ezcInputForm::validateDefinition($def));
$def = array('^*(68769' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'int'));
self::assertEquals(array(ezcInputForm::DEF_FIELD_NAME_BROKEN, "The element name '^*(68769' has an unsupported format. It should start with an a-z and followed by a-z0-9_"), ezcInputForm::validateDefinition($def));
$def = array('foobar_42' => new ezcInputFormDefinitionElement(ezcInputFormDefinitionElement::REQUIRED, 'int'));
self::assertEquals(true, ezcInputForm::validateDefinition($def));
}