<?php
class Setting
{
/****************************************************************
* <p>gets settings</p>
*
* @access private
* @author heidtc < hide@address.com >
* @param $id the identification value of the setting
* @return config value
****************************************************************/
public function get_setting_node($id)
{
$dom = new DOMDocument;
$dom->preserveWhiteSpace = true;
$dom->load( CONFIGS . '/settings.xml');
$xpath = new DOMXPath($dom);
$nodes = $xpath->query('//setting[@id="'.$id.'"]');
return $nodes->item(0);
}
public function get_setting_value($node)
{
return $node->nodeValue;
}
public function set_setting($node, $value)
{
$node->nodeValue = $value;
return $node;
}
public function save($node)
{
return $node->ownerDocument->save( CONFIGS . '/settings.xml');
}
public function get_settings()
{
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->load(CONFIGS . '/settings.xml');
$xpath = new DOMXPath($dom);
return $xpath->query('//settings/*[@label]');
}
public function get_setting_options($setting_id)
{
$dom = new DOMDocument;
$dom->preserveWhiteSpace = false;
$dom->load(CONFIGS . '/settings.xml');
$xpath = new DOMXPath($dom);
return $xpath->query('//setting[@id="' . $setting_id . '_option"]');
}
}
?>