Changeset 275 in t29-www for lib/menu.php
- Timestamp:
- Jul 7, 2012, 6:25:45 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/menu.php
r262 r275 19 19 function __construct($conf_array) { 20 20 $this->conf = $conf_array; 21 22 // libxml: don't raise errors while parsing. 23 // will fetch them with libxml_get_errors later. 24 //libxml_use_internal_errors(true); 21 25 22 26 // load xml file 23 27 $this->xml = simplexml_load_file($this->conf['webroot'].$this->conf['lang_path'] . '/' . self::navigation_file); 24 } 25 28 if($this->xml_is_defective()) { 29 trigger_error("Kann Navigationsdatei nicht verwenden, da das XML nicht sauber ist. Bitte reparieren!"); 30 } 31 } 32 33 function xml_is_defective() { 34 // check if return value of simplexml_load_file was false, 35 // which means parse error. 36 return $this->xml === FALSE; 37 } 38 26 39 ///////////////////// NEWS EXTRACTION 27 40 function load_news_data() { … … 59 72 ///////////////////// RETURN INFOS ABOUT SEITEN_ID LINK 60 73 function get_link_infos($seiten_id=false) { 74 if($this->xml_is_defective()) { 75 return null; 76 } 61 77 if(!$seiten_id) $seiten_id = $this->conf['seiten_id']; 62 78 … … 108 124 **/ 109 125 function print_menu($xpath_menu_selection) { 126 if($this->xml_is_defective()) { 127 print "The Menu file is broken."; 128 return false; 129 } 110 130 $seiten_id = $this->conf['seiten_id']; 111 131 … … 158 178 **/ 159 179 function get_page_relations($seiten_id=false) { 180 if($this->xml_is_defective()) 181 return array(); // cannot construct relations due to bad XML file 160 182 if(!$seiten_id) $seiten_id = $this->conf['seiten_id']; 161 183
Note: See TracChangeset
for help on using the changeset viewer.