Pressbooks\Modules\Export\Epub\Epub201::createCopyright PHP Method

createCopyright() protected method

protected createCopyright ( array $book_contents, array $metadata )
$book_contents array
$metadata array
    protected function createCopyright($book_contents, $metadata)
    {
        $options = get_option('pressbooks_theme_options_global');
        foreach (array('copyright_license') as $requiredGlobalOption) {
            if (!isset($options[$requiredGlobalOption])) {
                $options[$requiredGlobalOption] = 0;
            }
        }
        // HTML
        $html = '<div id="copyright-page"><div class="ugc">';
        if (!empty($metadata['pb_custom_copyright'])) {
            $html .= $this->kneadHtml($this->tidy($metadata['pb_custom_copyright']), 'custom');
        }
        if (1 == $options['copyright_license']) {
            $html .= $this->kneadHtml($this->tidy($this->doCopyrightLicense($metadata)), 'custom');
        }
        // default, so something is displayed
        if (empty($metadata['pb_custom_copyright']) && 0 == $options['copyright_license']) {
            $html .= '<p>';
            $html .= get_bloginfo('name') . ' ' . __('Copyright', 'pressbooks') . ' &#169; ';
            $html .= !empty($metadata['pb_copyright_year']) ? $metadata['pb_copyright_year'] : date('Y');
            if (!empty($metadata['pb_copyright_holder'])) {
                $html .= ' ' . __('by', 'pressbooks') . ' ' . $metadata['pb_copyright_holder'] . '. ';
            }
            $html .= '</p>';
        }
        // Copyright
        // Please be kind, help Pressbooks grow by leaving this on!
        if (empty($GLOBALS['PB_SECRET_SAUCE']['TURN_OFF_FREEBIE_NOTICES_EPUB'])) {
            $freebie_notice = 'This book was produced using <a href="http://pressbooks.com/">Pressbooks.com</a>.';
            $html .= "<p>{$freebie_notice}</p>";
        }
        $html .= "</div></div>\n";
        // Create file, insert into manifest
        $vars = array('post_title' => __('Copyright', 'pressbooks'), 'stylesheet' => $this->stylesheet, 'post_content' => $html, 'isbn' => @$metadata['pb_ebook_isbn'], 'lang' => $this->lang);
        $file_id = 'copyright';
        $filename = "{$file_id}.{$this->filext}";
        file_put_contents($this->tmpDir . "/OEBPS/{$filename}", $this->loadTemplate($this->dir . '/templates/epub201/html.php', $vars));
        $this->manifest[$file_id] = array('ID' => -1, 'post_title' => $vars['post_title'], 'filename' => $filename);
    }