コード例 #1
0
ファイル: class-service.php プロジェクト: nvillapiano/Xina
 /**
  * Save the settings for this service
  *
  * @return null|array returns null on success, array of errors on failure
  */
 public function save()
 {
     $classname = $this->get_slug();
     $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 = $this->get_slug() . '[' . $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();
 }