本文整理匯總了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));
}