X-Git-Url: http://git.dj3c1t.com/?a=blobdiff_plain;f=app%2Fdata%2Fmodules%2Fshare%2Fsml_data_sources_xml_format.php;h=e9d280435e4dfb7bad8fa49fe58d2fea4d5f61cd;hb=HEAD;hp=ae67cab2f9c0de4126ab12dc0e87265aede2f76b;hpb=dfb63819f6edd72089b4d3a4c8cce3d7cba7c015;p=mw_sourceml diff --git a/app/data/modules/share/sml_data_sources_xml_format.php b/app/data/modules/share/sml_data_sources_xml_format.php index ae67cab..e9d2804 100644 --- a/app/data/modules/share/sml_data_sources_xml_format.php +++ b/app/data/modules/share/sml_data_sources_xml_format.php @@ -2,24 +2,27 @@ class sml_data_sources_xml_format extends mw_data{ - var $status; // classes de sources - table sml_classes - var $source; - var $groupes; - var $licence; - var $sources; - var $xml_content; + public $status; // classes de sources - table sml_classes + public $source; + public $groupes; + public $licence; + public $sources; + public $xml_content; # ---------------------------------------------------------------------------------------- # data vers XML # - function source_xml_content($id, $params = array()){ + public function source_xml_content($id, $params = array()){ $env = $this->env(); $content = false; $this->status = isset($this->status) ? $this->status : $this->source_status(); if($this->status !== false){ $this->source = isset($params["source"]) ? $params["source"] : $this->source($id, true); if($this->source !== false){ + if($this->source["reference"]){ + return $this->source["reference"]["xml"]["content"]; + } if($this->source["groupes"]) $this->groupes = $this->source["groupes"]; if(isset($params["groupes"])) $this->groupes = $params["groupes"]; if(!isset($this->groupes)) $this->groupes = $this->source_groupes($id); @@ -93,13 +96,13 @@ # XML vers data # - function parse_source_xml($xml_content){ + public function parse_source_xml($xml_content){ if(!isset($this->sxml)) $this->sxml = new sxml(); $this->sxml->parse($xml_content); return isset($this->sxml->data["source"][0]); } - function empty_source($params = array()){ + public function empty_source($params = array()){ $source = array( "groupes" => array(), "titre" => "", @@ -122,7 +125,7 @@ return $source; } - function source_xml_read($url, $xml_content = null){ + public function source_xml_read($url, $xml_content = null){ $source = $this->empty_source(); if($this->xml_content = (isset($xml_content) ? $xml_content : $this->get_source_xml_from_url($url))){ if($this->xml_content === -1) $this->xml_content = $this->get_source_xml_from_url($url, true); @@ -144,14 +147,14 @@ return $source; } - function parse_source_buffer($source_xml_version, $default_source = null){ + public function parse_source_buffer($source_xml_version, $default_source = null){ if(method_exists($this, $method_name = "parse_source_buffer_".$source_xml_version)){ return $this->$method_name($default_source); } return false; } - function get_source_buffer_xml_version(){ + public function get_source_buffer_xml_version(){ if(!isset($this->buffer["subs"])) return false; foreach($this->buffer["subs"] as $key => $value){ if($key == "titre" || $key == "auteur"){ @@ -165,7 +168,7 @@ // -------------------------------------- source XML v2 - function parse_source_buffer_v2($default_source = null){ + public function parse_source_buffer_v2($default_source = null){ if(isset($default_source)) $source = $default_source; else $source = $this->empty_source(); if(!isset($this->buffer["subs"])) return $source; @@ -234,7 +237,7 @@ // -------------------------------------- source XML v1 - function parse_source_buffer_v1($default_source = null){ + public function parse_source_buffer_v1($default_source = null){ if(isset($default_source)) $source = $default_source; else $source = $this->empty_source(); if(!isset($this->buffer["subs"])) return $source; @@ -286,5 +289,3 @@ } } - -?> \ No newline at end of file