Skip to content

Commit

Permalink
The custom notice should override the auto all rights reserved on web…
Browse files Browse the repository at this point in the history
…book as it does on export formats. (#38)
  • Loading branch information
dac514 authored and Ned Zimmerman committed Sep 6, 2017
1 parent 0d47d9d commit 8acd554
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,29 @@ function pressbooks_comment( $comment, $args, $depth ) {
*/
function pressbooks_copyright_license() {
$metadata = \Pressbooks\Book::getBookInformation();
$html = _do_license( $metadata );

if ( empty( $metadata['pb_book_license'] ) ) {
$all_rights_reserved = true;
} elseif ( $metadata['pb_book_license'] === 'all-rights-reserved' ) {
$all_rights_reserved = true;
} else {
$all_rights_reserved = false;
}
if ( ! empty( $metadata['pb_custom_copyright'] ) ) {
$has_custom_copyright = true;
} else {
$has_custom_copyright = false;
}

// Custom Copyright must override All Rights Reserved
$html = '';
if ( ! $has_custom_copyright || ( $has_custom_copyright && ! $all_rights_reserved ) ) {
$html .= _do_license( $metadata );
}
if ( $has_custom_copyright ) {
$html .= '<div class="license-attribution">' . $metadata['pb_custom_copyright'] . '</div>';
}

return $html;
}

Expand Down

0 comments on commit 8acd554

Please sign in to comment.