/**
  * Loads given XML $inputFile
  * @param string $inputFile
  */
 public function __construct($inputFile)
 {
     $inputFile = WURFL_FileUtils::cleanFilename($inputFile);
     if (!file_exists($inputFile)) {
         throw new InvalidArgumentException("cannot locate [{$inputFile}] file!");
     }
     $this->inputFile = WURFL_Xml_Utils::getXMLFile($inputFile);
 }
Beispiel #2
0
 /**
  * Returns a XML Resource filename for the uncompressed contents of the provided zipped $filename
  * @param string $filename of zipped XML data
  * @throws WURFL_WURFLException ZipArchive extension is not loaded or the ZIP file is corrupt
  * @return string Full filename and path of extracted XML file
  */
 private static function getZippedFile($filename)
 {
     if (!self::zipModuleLoaded()) {
         throw new WURFL_WURFLException("The ZipArchive extension is not loaded. Load the extension or use the flat wurfl.xml file");
     }
     $tmpDir = WURFL_FileUtils::getTempDir();
     $zip = new ZipArchive();
     if ($zip->open($filename) !== true) {
         throw new WURFL_WURFLException("The Zip file <{$filename}> could not be opened");
     }
     $zippedFile = $zip->statIndex(0);
     $wurflFile = $zippedFile['name'];
     //$wurflFile = md5(uniqid(rand(), true));
     //$zip->extractTo($tmpDir, $wurflFile);
     $zip->extractTo($tmpDir);
     $zip->close();
     return WURFL_FileUtils::cleanFilename($tmpDir . DIRECTORY_SEPARATOR . $wurflFile);
 }