class mw_xml_data_handler{
- var $xml_data;
- var $data_path;
- var $data_path_handler;
- var $last_index;
+ public $xml_data;
+ public $data_path;
+ public $data_path_handler;
+ public $last_index;
- function mw_xml_data_handler($xml_data, $data_path){
+ public function mw_xml_data_handler($xml_data, $data_path){
$this->xml_data = $xml_data;
$this->data_path = $data_path.(substr($data_path, -1) != "/" ? "/" : "");
}
- function get_data($data_id){
+ public function get_data($data_id){
if(file_exists($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_id.".xml")){
return $this->xml_data->get_data($this->data_path, $data_id);
}
return false;
}
- function open_data($FETCH = true){
+ public function open_data($FETCH = true){
clearstatcache();
$INDEX_OK = false;
if($this->xml_data->host() && $this->xml_data->base() && $this->data_path){
}
}
- function fetch_assoc(){
+ public function fetch_assoc(){
if($this->data_path_handler){
$FORMAT_OK = false;
while(!$FORMAT_OK && ($data_file = @readdir($this->data_path_handler)) !== false){
return false;
}
- function add_data($data, $index = null){
+ public function add_data($data, $index = null){
if(!isset($index)) $index = $this->inc_index();
if(isset($index)){
if(is_array($data)) return $this->xml_data->add_data($this->data_path, $index, $data);
return null;
}
- function inc_index(){
+ public function inc_index(){
clearstatcache();
if(isset($this->last_index)){
$index = $this->last_index + 1;
return null;
}
- function set_data($data_file, $data){
+ public function set_data($data_file, $data){
if(preg_match("/^[0-9]+\.xml$/", $data_file)){
if(is_writable($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_file)){
if(is_array($data)){
return null;
}
- function del_data($data_file){
+ public function del_data($data_file){
if(preg_match("/^[0-9]+\.xml$/", $data_file)){
if(is_file($this->xml_data->host().$this->xml_data->base().$this->data_path.$data_file)){
return $this->xml_data->del_data($this->data_path, substr($data_file, 0, -4));
return null;
}
- function close_data(){
+ public function close_data(){
$this->data_path= null;
if($this->data_path_handler) @closedir($this->data_path_handler);
$this->last_index = null;
}
}
-
-?>
\ No newline at end of file