/** */ protected function _set($key, $val, $opts) { try { $this->_vfs->writeData($this->_params['vfspath'], $key, $val, true); } catch (Horde_Vfs_Exception $e) { return false; } return true; }
/** * Stores user preferences in the backend. * * @param boolean $defaults Whether to store the global defaults instead * of user options. Unused. * * @throws Sam_Exception */ public function store($defaults = false) { /* Generate preference file. */ $output = '# ' . _("SpamAssassin preference file generated by Sam") . ' (' . date('F j, Y, g:i a') . ")\n"; foreach ($this->_options as $attribute => $value) { if (is_array($value)) { $output .= $this->_mapAttributeToOption($attribute) . ' ' . trim(implode(' ', $value)) . "\n"; } else { $output .= $this->_mapAttributeToOption($attribute) . ' ' . trim($value) . "\n"; } } /* Write preference file. */ try { $this->_vfs->writeData(dirname($this->_params['user_prefs']), basename($this->_params['user_prefs']), $output, true); } catch (Horde_Vfs_Exception $e) { throw new Sam_Exception($e); } }