当前位置: 首页>>代码示例>>PHP>>正文


PHP Widget::validator方法代码示例

本文整理汇总了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));
 }
开发者ID:zonky2,项目名称:core,代码行数:10,代码来源:TagsWidget.php

示例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);
 }
开发者ID:contao,项目名称:core-bundle,代码行数:14,代码来源:SectionWizard.php

示例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;
 }
开发者ID:rikaix,项目名称:core,代码行数:12,代码来源:ImageSize.php

示例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);
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:31,代码来源:FileTree.php

示例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));
 }
开发者ID:iCodr8,项目名称:core,代码行数:13,代码来源:TextStore.php

示例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);
 }
开发者ID:designs2,项目名称:contao-conditionalforms_jquery,代码行数:14,代码来源:FormCondition.php

示例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);
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:13,代码来源:PageTree.php

示例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);
 }
开发者ID:craffft,项目名称:contao-imagesortwizard,代码行数:14,代码来源:ImageSortWizard.php

示例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;
 }
开发者ID:bytehead,项目名称:contao-core,代码行数:16,代码来源:TimePeriod.php

示例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;
 }
开发者ID:contao,项目名称:core-bundle,代码行数:20,代码来源:ImageSize.php

示例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 '';
 }
开发者ID:heimrichhannot,项目名称:contao-confirmed_email,代码行数:22,代码来源:FormConfirmedEmail.php

示例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);
 }
开发者ID:Mozan,项目名称:core-bundle,代码行数:20,代码来源:FormTextField.php

示例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 '';
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:26,代码来源:FormPassword.php

示例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));
 }
开发者ID:metamodels,项目名称:core,代码行数:18,代码来源:MultiTextWidget.php

示例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);
 }
开发者ID:rburch,项目名称:core-1,代码行数:25,代码来源:ProductTree.php


注:本文中的Widget::validator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。