Exemple #1
0
 public function write_setting($data)
 {
     // your custom validation logic here
     if ($data == '') {
         $data = random_string(60);
     }
     return parent::write_setting($data);
 }
 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);
 }
Exemple #3
0
 /**
  * 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;
 }
Exemple #4
0
 /**
  * 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);
 }
 /**
  * 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;
 }
Exemple #6
0
 function write_setting($data)
 {
     $return = parent::write_setting($data);
     get_list_of_languages(true);
     //refresh the list
     return $return;
 }
 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;
 }