function epub_get_ncx in Epub 7
Same name and namespace in other branches
- 8 epub.module \epub_get_ncx()
1 call to epub_get_ncx()
- epub_get_toc in ./
epub.module
File
- ./
epub.module, line 236
Code
function epub_get_ncx($dir) {
$file = epub_get_opf($dir);
if ($file == FALSE) {
return false;
}
$opfXML = simplexml_load_file($file);
$opfXML
->registerXPathNamespace('opf', 'http://www.idpf.org/2007/opf');
$ncx = $opfXML
->xpath('//opf:item[@media-type="application/x-dtbncx+xml"]');
if ($ncx) {
$attributes = $ncx[0]
->attributes();
return dirname($file) . '/' . (string) $attributes['href'];
}
else {
return FALSE;
}
}