readZippedXML

The Gravity PDF readZippedXML function.

Description

readZippedXML( $archiveFile, $dataFile ); 

Parameters (2)

0. $archivefile
The archivefile.
1. $datafile
The datafile.

Usage

  1. if ( !function_exists( 'readZippedXML' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'gravity-pdf/vendor/querypath/querypath/examples/docx.php'; 
  3.  
  4. // The archivefile. 
  5. $archivefile = null; 
  6.  
  7. // The datafile. 
  8. $datafile = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = readZippedXML($archivefile, $datafile); 
  12.  

Defined (1)

The function is defined in the following location(s).

/vendor/querypath/querypath/examples/docx.php  
  1. function readZippedXML($archiveFile, $dataFile) { 
  2. if (!class_exists('ZipArchive', false)) { 
  3. return "ZipArchive Class Doesn't Exist."; 
  4. // Create new ZIP archive 
  5. $zip = new ZipArchive(); 
  6. // Open received archive file 
  7. if (true === $zip->open($archiveFile)) { 
  8. // If done, search for the data file in the archive 
  9. if (($index = $zip->locateName($dataFile)) !== false) { 
  10. // If found, read it to the string 
  11. $data = $zip->getFromIndex($index); 
  12. // Close archive file 
  13. $zip->close(); 
  14. // Load XML from a string 
  15. // Skip errors and warnings 
  16. return $data; 
  17. // $xml = DOMDocument::loadXML($data, LIBXML_NOENT | LIBXML_XINCLUDE | LIBXML_NOERROR | LIBXML_NOWARNING); 
  18. // // Return data without XML formatting tags 
  19. // return strip_tags($xml->saveXML()); 
  20. $zip->close(); 
  21.  
  22. // In case of failure return empty string 
  23. return $zip->getStatusString();