Pressbooks\Modules\Export\Epub\Epub3::createOPF PHP Метод

createOPF() защищенный Метод

Create OPF File.
protected createOPF ( array $book_contents, array $metadata )
$book_contents array
$metadata array
    protected function createOPF($book_contents, $metadata)
    {
        if (empty($this->manifest)) {
            throw new \Exception('$this->manifest cannot be empty. Did you forget to call $this->createOEPBS() ?');
        }
        $vars = array('meta' => $metadata, 'manifest' => $this->manifest, 'stylesheet' => $this->stylesheet, 'lang' => $this->lang);
        $vars['manifest_assets'] = $this->buildManifestAssetsHtml();
        $vars['do_copyright_license'] = strip_tags($this->doCopyrightLicense($metadata));
        // Loop through the html files for the manifest and assemble them. Assign properties based on their content.
        //
        $html = '';
        foreach ($this->manifest as $k => $v) {
            $properties = $this->getProperties($this->tmpDir . '/OEBPS/' . $v['filename']);
            array_key_exists('mathml', $properties) ? $mathml = 'properties="mathml" ' : ($mathml = '');
            array_key_exists('scripted', $properties) ? $scripted = 'properties="scripted" ' : ($scripted = '');
            $html .= sprintf('<item id="%s" href="OEBPS/%s" %s%smedia-type="application/xhtml+xml" />', $k, $v['filename'], $mathml, $scripted) . "\n\t\t";
        }
        $vars['manifest_filelist'] = $html;
        // Put contents
        file_put_contents($this->tmpDir . '/book.opf', $this->loadTemplate($this->dir . '/templates/epub3/opf.php', $vars));
    }