本文整理汇总了PHP中Widget::validator方法的典型用法代码示例。如果您正苦于以下问题:PHP Widget::validator方法的具体用法?PHP Widget::validator怎么用?PHP Widget::validator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Widget
的用法示例。
在下文中一共展示了Widget::validator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validator
/**
* {@inheritDoc}
*/
protected function validator($varInput)
{
if (is_array($varInput)) {
return parent::validator($varInput);
}
return parent::validator(trim($varInput));
}
示例2: validator
/**
* Standardize the ID
*
* @param mixed $varInput
*
* @return mixed
*/
protected function validator($varInput)
{
if (isset($varInput['id'])) {
$varInput['id'] = \StringUtil::standardize($varInput['id']);
}
return parent::validator($varInput);
}
示例3: validator
/**
* Trim values
* @param mixed
* @return mixed
*/
protected function validator($varInput)
{
$varInput[0] = parent::validator($varInput[0]);
$varInput[1] = parent::validator($varInput[1]);
$varInput[2] = preg_replace('/[^a-z0-9_]+/', '', $varInput[2]);
return $varInput;
}
示例4: validator
/**
* Skip the field if "change selection" is not checked
* @param mixed
* @return mixed
*/
protected function validator($varInput)
{
$this->import('BackendUser', 'User');
if (!$this->Input->post($this->strName . '_save')) {
$this->mandatory = false;
$this->blnSubmitInput = false;
} elseif ($varInput == '') {
return parent::validator($varInput);
} elseif (strlen($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path'])) {
$rgxp = '/^' . preg_quote($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField]['eval']['path'], '/') . '\\//i';
foreach ((array) $varInput as $strFile) {
if (!preg_match($rgxp, $strFile)) {
$this->addError('File or folder "' . $strFile . '" is not mounted!');
$this->log('File or folder "' . $strFile . '" is not mounted (hacking attempt)', 'FileTree validator()', TL_ERROR);
}
}
} elseif (!$this->User->isAdmin) {
foreach ((array) $varInput as $strFile) {
if (!$this->User->hasAccess($strFile, 'filemounts')) {
$this->addError('File or folder "' . $strFile . '" is not mounted!');
$this->log('File or folder "' . $strFile . '" is not mounted (hacking attempt)', 'FileTree validator()', TL_ERROR);
}
}
}
return parent::validator($varInput);
}
示例5: validator
/**
* Ignore the field if nothing has been entered
* @param mixed
* @return mixed
*/
protected function validator($varInput)
{
if ($varInput == '*****') {
$this->blnSubmitInput = false;
return true;
}
return parent::validator(trim($varInput));
}
示例6: validator
/**
* Do not check stop fields.
*
* @param mixed $varInput
* @return mixed
*/
protected function validator($varInput)
{
if ($this->conditionType == 'stop') {
$this->mandatory = false;
$this->blnSubmitInput = false;
}
return parent::validator($varInput);
}
示例7: validator
/**
* Skip the field if "change selection" is not checked
* @param mixed
* @return mixed
*/
protected function validator($varInput)
{
if (!$this->Input->post($this->strName . '_save')) {
$this->mandatory = false;
$this->blnSubmitInput = false;
}
return parent::validator($varInput);
}
示例8: validator
/**
* Trim values
* @param mixed
* @return mixed
*/
public function validator($varInput)
{
if (is_array($varInput)) {
return parent::validator($varInput);
}
$varInput = $this->fixUuidToBinary($varInput);
$varInput = trim($varInput);
return parent::validator($varInput);
}
示例9: validator
/**
* Do not validate unit fields
*
* @param mixed $varInput
*
* @return mixed
*/
protected function validator($varInput)
{
foreach ($varInput as $k => $v) {
if ($k != 'unit') {
$varInput[$k] = parent::validator($v);
}
}
return $varInput;
}
示例10: validator
/**
* Trim values
*
* @param mixed $varInput
*
* @return mixed
*/
protected function validator($varInput)
{
$this->import('BackendUser', 'User');
$varInput[0] = parent::validator($varInput[0]);
$varInput[1] = parent::validator($varInput[1]);
$varInput[2] = preg_replace('/[^a-z0-9_]+/', '', $varInput[2]);
$imageSizes = \System::getContainer()->get('contao.image.image_sizes');
$this->arrAvailableOptions = $this->User->isAdmin ? $imageSizes->getAllOptions() : $imageSizes->getOptionsForUser($this->User);
if (!$this->isValidOption($varInput[2])) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['invalid'], $varInput[2]));
}
return $varInput;
}
示例11: validator
/**
* Validate input and set value
* @param mixed
* @return string
*/
protected function validator($varInput)
{
$this->blnSubmitInput = false;
if (!strlen($varInput) && (strlen($this->varValue) || !$this->mandatory)) {
return '';
}
if ($varInput != $this->getPost($this->strName . '_confirm')) {
$this->addError($GLOBALS['TL_LANG']['ERR']['confirmedEmailMismatch']);
}
$varInput = $this->idnaEncodeEmail($varInput);
$varInput = parent::validator($varInput);
if (!$this->hasErrors()) {
$this->blnSubmitInput = true;
return $varInput;
}
return '';
}
示例12: validator
/**
* Trim the values
*
* @param mixed $varInput The user input
*
* @return mixed The validated user input
*/
protected function validator($varInput)
{
if (is_array($varInput)) {
return parent::validator($varInput);
}
// Convert to Punycode format (see #5571)
if ($this->rgxp == 'url') {
$varInput = \Idna::encodeUrl($varInput);
} elseif ($this->rgxp == 'email' || $this->rgxp == 'friendly') {
$varInput = \Idna::encodeEmail($varInput);
}
return parent::validator($varInput);
}
示例13: validator
/**
* Validate input and set value
* @param mixed
* @return string
*/
protected function validator($varInput)
{
$this->blnSubmitInput = false;
if (!strlen($varInput) && (strlen($this->varValue) || !$this->mandatory)) {
return '';
}
if (utf8_strlen($varInput) < $GLOBALS['TL_CONFIG']['minPasswordLength']) {
$this->addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], $GLOBALS['TL_CONFIG']['minPasswordLength']));
}
if ($varInput != $this->getPost($this->strName . '_confirm')) {
$this->addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']);
}
$varInput = parent::validator($varInput);
if (!$this->hasErrors()) {
$this->blnSubmitInput = true;
$_SESSION['TL_CONFIRM'][] = $GLOBALS['TL_LANG']['MSC']['pw_changed'];
$strSalt = substr(md5(uniqid(mt_rand(), true)), 0, 23);
return sha1($strSalt . $varInput) . ':' . $strSalt;
}
return '';
}
示例14: validator
/**
* Trim the values and validate them.
*
* @param mixed $varInput The value to process.
*
* @return mixed The processed value
*/
protected function validator($varInput)
{
if (is_array($varInput)) {
$value = array();
foreach ($varInput as $key => $input) {
$value[$key] = parent::validator($input);
}
return $value;
}
return parent::validator(trim($varInput));
}
示例15: validator
/**
* Skip the field if "change selection" is not checked
* @param mixed
* @return mixed
*/
protected function validator($varInput)
{
if (!$this->Input->post($this->strName . '_save')) {
$this->mandatory = false;
$this->blnSubmitInput = false;
}
// Check if there is at least one value
if ($this->fieldType == 'text') {
if (is_array($varInput)) {
foreach ($varInput as $k => $option) {
if ($this->mandatory && $option != '') {
$this->mandatory = false;
} elseif ($option == '') {
unset($varInput[$k]);
}
}
}
}
return parent::validator($varInput);
}