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


PHP admin_setting_configtext::validate方法代码示例

本文整理汇总了PHP中admin_setting_configtext::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP admin_setting_configtext::validate方法的具体用法?PHP admin_setting_configtext::validate怎么用?PHP admin_setting_configtext::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在admin_setting_configtext的用法示例。


在下文中一共展示了admin_setting_configtext::validate方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 public function validate($data)
 {
     global $PAGE;
     // Don't force the plugin to be fully set up when installing.
     if ($PAGE->pagelayout === 'maintenance' && strlen($data) === 0) {
         return true;
     }
     return parent::validate($data);
 }
开发者ID:Dextirpe,项目名称:moodle-mod_turnitintooltwo,代码行数:9,代码来源:settingslib.php

示例2: validate

 /**
  * Validate data.
  *
  * @param string $data
  * @return mixed True on success, else error message
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     if ((int) $data < 1) {
         return get_string('awaittimeerror', 'realtimequiz');
     }
     return true;
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:17,代码来源:adminlib.php

示例3: validate

 /**
  * Validate data.
  *
  * This ensures that key ID is specified if URL is provided
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     $url = get_config('filter_cloudfront_signurl', 'distributionurl');
     if ($url != '' && empty($data)) {
         return get_string('errornokeyid', 'filter_cloudfront_signurl');
     }
     return true;
 }
开发者ID:altrome,项目名称:moodle-filter_cloudfront_signurl,代码行数:20,代码来源:adminlib.php

示例4: validate

 /**
  * Validate data before storage
  * @param string data
  * @return mixed true if ok string if error found
  */
 public function validate($data)
 {
     $validated = parent::validate($data);
     // Pass parent validation first.
     if ($validated == true) {
         $matches = preg_match($this->regex, $data);
         if ($matches === false) {
             $validated = 'preg_match() error.';
         } else {
             if ($matches == 0) {
                 $validated = '\'' . $data . '\'' . $this->error;
             }
         }
     }
     return $validated;
 }
开发者ID:lucisgit,项目名称:moodle-theme_essential,代码行数:21,代码来源:essential_admin_setting_configtext.php

示例5: validate

 /**
  * Validate data before storage
  * @param string data
  * @return mixed true if ok string if error found
  */
 public function validate($data)
 {
     $validated = parent::validate($data);
     // Pass parent validation first.
     if ($validated == true) {
         if ($data < $this->lower) {
             $validated = get_string('asconfigintlower', 'theme_essential', array('value' => $data, 'lower' => $this->lower));
         } else {
             if ($data > $this->upper) {
                 $validated = get_string('asconfigintupper', 'theme_essential', array('value' => $data, 'upper' => $this->upper));
             } else {
                 $validated = true;
             }
         }
     }
     return $validated;
 }
开发者ID:jpahullo,项目名称:moodle-theme_essential,代码行数:22,代码来源:essential_admin_setting_configinteger.php

示例6: validate

 /**
  * Validate data.
  *
  * This ensures that unix socket setting is correct and ClamAV is running.
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     $runningmethod = get_config('antivirus_clamav', 'runningmethod');
     if ($runningmethod === 'unixsocket') {
         $socket = stream_socket_client('unix://' . $data, $errno, $errstr, ANTIVIRUS_CLAMAV_SOCKET_TIMEOUT);
         if (!$socket) {
             return get_string('errorcantopensocket', 'antivirus_clamav', "{$errstr} ({$errno})");
         } else {
             // Send PING query to ClamAV socket to check its running state.
             fwrite($socket, "nPING\n");
             $response = stream_get_line($socket, 4);
             fclose($socket);
             if ($response !== 'PONG') {
                 return get_string('errorclamavnoresponse', 'antivirus_clamav');
             }
         }
     }
     return true;
 }
开发者ID:dg711,项目名称:moodle,代码行数:31,代码来源:adminlib.php

示例7: validate

 /**
  * Validate data before storage
  *
  * @param string $data data
  * @return mixed true if ok string if error found
  */
 public function validate($data)
 {
     $parentvalidation = parent::validate($data);
     if ($parentvalidation === true) {
         if ($this->maxlength > 0) {
             // Max length check.
             $length = core_text::strlen($data);
             if ($length > $this->maxlength) {
                 return get_string('maximumchars', 'moodle', $this->maxlength);
             }
             return true;
         } else {
             return true;
             // No max length check needed.
         }
     } else {
         return $parentvalidation;
     }
 }
开发者ID:mongo0se,项目名称:moodle,代码行数:25,代码来源:adminlib.php

示例8: validate

 /**
  * Validate data.
  *
  * This ensures that license key is specified for any hosting mode.
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     if (empty($data)) {
         return get_string('errornolicensekey', 'filter_jwplayer');
     }
     return true;
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:19,代码来源:adminlib.php

示例9: validate

 /**
  * Validate data.
  *
  * This ensures that account token is specified if cloud-hosted player is
  * selected.
  *
  * @param string $data
  * @return mixed True on success, else error message.
  */
 public function validate($data)
 {
     $result = parent::validate($data);
     if ($result !== true) {
         return $result;
     }
     $hostingmethod = get_config('filter_jwplayer', 'hostingmethod');
     if ($hostingmethod === 'cloud' && empty($data)) {
         return get_string('errornoaccounttoken', 'filter_jwplayer');
     }
     return true;
 }
开发者ID:rlowry,项目名称:moodle-filter_jwplayer,代码行数:21,代码来源:adminlib.php


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