/** * Save the settings for this service * * @return null|array returns null on success, array of errors on failure */ public function save() { $classname = get_class($this); $old_data = $this->schedule->get_service_options($classname); $new_data = isset($_POST[$classname]) ? $_POST[$classname] : array(); $errors = $this->update($new_data, $old_data); if ($errors && ($errors = array_flip($errors))) { foreach ($errors as $error => &$field) { $field = get_class($this) . '[' . $field . ']'; } return array_flip($errors); } // Only overwrite settings if they changed if (!empty($new_data)) { $this->schedule->set_service_options($classname, $new_data); } return array(); }