Piwik\Settings\Storage\Backend\PluginSettingsTable::save PHP Method

save() public method

Saves (persists) the current setting values in the database.
public save ( $values )
    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);
            }
        }
    }