Link.FYI

Pastebin

Create New My Pastes

Code (PHP) pasted on 2019-07-17, 22:24 Raw Source

  1.     $content = $filesystem->read($object['path']);
  2.             $xmp_data_start = strpos($content, '<x:xmpmeta');
  3.             $xmp_data_end = strpos($content, '</x:xmpmeta>');
  4.             $xmp_length = $xmp_data_end - $xmp_data_start;
  5.             $xmp_data = substr($content, $xmp_data_start, $xmp_length + 12);
  6.  
  7.             $document = new DOMDocument();
  8.             $document->loadXml($xmp_data);
  9.             $xpath = new DOMXpath($document);
  10.  
  11.             /**
  12.              * most likely a bit hackish.. thats how I do get all namespaces...
  13.              */
  14.             $results = preg_match_all('_xmlns:([A-Za-z]+)="(.*)"_U', $xmp_data, $matches);
  15.             foreach($matches[1] as $key => $alias){
  16. //                echo "registering $alias for ".$matches[2][$key]."\n";
  17.                 $xpath->registerNamespace($alias, $matches[2][$key]);
  18.             }
  19.