public function save($values)
{
$this->initDbIfNeeded();
$table = $this->getTableName();
$this->delete();
foreach ($values as $name => $value) {
if (!is_array($value)) {
$value = array($value);
}
foreach ($value as $val) {
if (!isset($val)) {
continue;
}
if (is_bool($val)) {
$val = (int) $val;
}
$sql = "INSERT INTO {$table} (`plugin_name`, `user_login`, `setting_name`, `setting_value`) VALUES (?, ?, ?, ?)";
$bind = array($this->pluginName, $this->userLogin, $name, $val);
$this->db->query($sql, $bind);
}
}
}