You are here

function epub_get_opf in Epub 7

Same name and namespace in other branches
  1. 8 epub.module \epub_get_opf()
3 calls to epub_get_opf()
epub_get_item in ./epub.module
epub_get_nav in ./epub.module
epub_get_ncx in ./epub.module

File

./epub.module, line 223

Code

function epub_get_opf($dir) {
  if (file_exists($dir . '/META-INF/container.xml')) {
    $ocfXML = simplexml_load_file($dir . '/META-INF/container.xml');
    $ocfXML
      ->registerXPathNamespace('ocf', 'urn:oasis:names:tc:opendocument:xmlns:container');
    $rootfile = $ocfXML
      ->xpath('//ocf:rootfile/@full-path');
    if ($rootfile) {
      return $dir . '/' . (string) $rootfile[0];
    }
  }
  return false;
}