You are here

function epub_get_opf in Epub 8

Same name and namespace in other branches
  1. 7 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 142

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')[0];
    return $dir . '/' . (string) $rootfile[0];
  }
  return false;
}