function xml2ArrayFile($dir, $file) { $fileWithPath = $dir . DIRECTORY_SEPARATOR . $file; echo $fileWithPath . "\n"; $xmlArr = Resource::getXmlArray($fileWithPath); $baseFile = substr($file, 0, strlen($file) - 4); $phpFile = $baseFile . '.conf.php'; $phpFileWithPath = $dir . DIRECTORY_SEPARATOR . $phpFile; $text = "<?php \n"; $text .= 'return '; $text .= var_export($xmlArr, true); $text .= ';'; //file_puts_contents('/home/k6/public_html/synfac/myfile.php', $text); $fh = fopen($phpFileWithPath, "w") or die("Could not open log file."); fwrite($fh, $text) or die("Could not write file!"); fclose($fh); }
/** * Get Xml Array. * If xml file has been compiled (has .cmp), load the cmp file as array; * otherwise, compile the .xml to .cmp first new 2.2.3, .cmp files * will be created in app/cache/metadata_cmp directory. replace '/' with '_' * for example, /module/demo/BOEvent.xml has cmp file as _module_demo_BOEvent.xml * * @param string $xmlFile * @return array **/ public static function &getXmlArray($xmlFile) { return Resource::getXmlArray($xmlFile); }