本文整理汇总了PHP中admin_setting_configtext::write_setting方法的典型用法代码示例。如果您正苦于以下问题:PHP admin_setting_configtext::write_setting方法的具体用法?PHP admin_setting_configtext::write_setting怎么用?PHP admin_setting_configtext::write_setting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类admin_setting_configtext
的用法示例。
在下文中一共展示了admin_setting_configtext::write_setting方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write_setting
public function write_setting($data)
{
// your custom validation logic here
if ($data == '') {
$data = random_string(60);
}
return parent::write_setting($data);
}
示例2: write_setting
public function write_setting($data)
{
// Trim any spaces to avoid spaces typo.
$data = trim($data);
if ($data === '') {
// Override parent behaviour and set to default if empty string.
$data = $this->get_defaultsetting();
}
return parent::write_setting($data);
}
示例3: write_setting
/**
* Saves the new settings passed in $data
*
* @todo Add vartype handling to ensure $data is an array
* @param array $data
* @return mixed string or Array
*/
public function write_setting($data)
{
$error = parent::write_setting($data['value']);
if (!$error) {
$value = empty($data['adv']) ? 0 : 1;
$this->config_write($this->name . '_adv', $value);
}
return $error;
}
示例4: write_setting
/**
* Save the selected setting
*
* @param string $data The selected site
* @return string empty string or error message
*/
public function write_setting($data)
{
if ($data === '') {
$data = (int) $this->defaultsetting;
} else {
$data = $data;
}
return parent::write_setting($data);
}
示例5: write_setting
/**
* Save the new setting
*
* @param string $data The new setting
* @return bool
*/
public function write_setting($data)
{
$return = parent::write_setting($data);
get_string_manager()->reset_caches();
return $return;
}
示例6: write_setting
public function write_setting($data)
{
$error = parent::write_setting($data['value']);
if (!$error) {
if (empty($data['fix'])) {
$ok = $this->config_write('fix_' . $this->name, 0);
} else {
$ok = $this->config_write('fix_' . $this->name, 1);
}
if (!$ok) {
$error = get_string('errorsetting', 'admin');
}
}
return $error;
}