public function doLicense( $metadata, $post_id = 0, $title = '' ) {
		if ( ! empty( $title ) ) {
			_doing_it_wrong( __METHOD__, __( '$title is deprecated. Method will automatically determine title from licenses', 'pressbooks' ), 'Pressbooks 5.7.0' );
		}

		$book_license = isset( $metadata['pb_book_license'] ) ? $metadata['pb_book_license'] : '';
		if ( empty( $post_id ) ) {
			// if no post $id given, set empty strings
			$section_license = '';
			$section_author = '';
		} else {
			$section_license = get_post_meta( $post_id, 'pb_section_license', true );
			$section_author = ( new Contributors() )->get( $post_id, 'pb_authors' );
		}

		// Copyright license, set in order of precedence
		if ( ! empty( $section_license ) ) {
			// section copyright higher priority than book
			$license = $section_license;
		} elseif ( ! empty( $book_license ) ) {
			// book is the fallback, default
			$license = $book_license;
		} else {
			$license = 'all-rights-reserved';
		}
		if ( ! $this->isSupportedType( $license ) ) {
			// License not supported, bail
			return '';
		}

		// Unless section is licensed differently, it should display the book license statement
		if ( $section_license === $book_license || empty( $section_license ) ) {
			$title = get_bloginfo( 'name' );
			$link = get_bloginfo( 'url' );
		} else {
			$post = get_post( $post_id );
			$title = $post ? $post->post_title : get_bloginfo( 'name' );
			$link = get_permalink( $post_id );
		}

		// Copyright holder, set in order of precedence
		if ( ! empty( $section_author ) ) {
			// section author higher priority than book author, copyrightholder
			$copyright_holder = $section_author;
		} elseif ( isset( $metadata['pb_copyright_holder'] ) ) {
			// book copyright holder higher priority than book author
			$copyright_holder = $metadata['pb_copyright_holder'];
		} elseif ( isset( $metadata['pb_authors'] ) ) {
			// book author is the fallback, default
			$copyright_holder = $metadata['pb_authors'];
		} else {
			$copyright_holder = '';
		}

		if ( ! empty( $metadata['pb_copyright_year'] ) ) {
			$copyright_year = $metadata['pb_copyright_year'];
		} elseif ( ! empty( $metadata['pb_publication_date'] ) ) {
			$copyright_year = strftime( '%Y', absint( $metadata['pb_publication_date'] ) );
		} else {
			$copyright_year = 0;
		}

		$html = $this->getLicense( $license, $copyright_holder, $link, $title, $copyright_year );

		return $html;
	}
public function doLicense( $metadata, $post_id = 0, $title = '' ) {
		if ( ! empty( $title ) ) {
			_doing_it_wrong( __METHOD__, __( '$title is deprecated. Method will automatically determine title from licenses', 'pressbooks' ), 'Pressbooks 5.7.0' );
		}

		$book_license = isset( $metadata['pb_book_license'] ) ? $metadata['pb_book_license'] : '';
		if ( empty( $post_id ) ) {
			// if no post $id given, set empty strings
			$section_license = '';
			$section_author = '';
		} else {
			$section_license = get_post_meta( $post_id, 'pb_section_license', true );
			$section_author = ( new Contributors() )->get( $post_id, 'pb_authors' );
		}

		// Copyright license, set in order of precedence
		if ( ! empty( $section_license ) ) {
			// section copyright higher priority than book
			$license = $section_license;
		} elseif ( ! empty( $book_license ) ) {
			// book is the fallback, default
			$license = $book_license;
		} else {
			$license = 'all-rights-reserved';
		}
		if ( ! $this->isSupportedType( $license ) ) {
			// License not supported, bail
			return '';
		}

		// Unless section is licensed differently, it should display the book license statement
		if ( $section_license === $book_license || empty( $section_license ) ) {
			$title = get_bloginfo( 'name' );
			$link = get_bloginfo( 'url' );
		} else {
			$post = get_post( $post_id );
			$title = $post ? $post->post_title : get_bloginfo( 'name' );
			$link = get_permalink( $post_id );
		}

		// Copyright holder, set in order of precedence
		if ( ! empty( $section_author ) ) {
			// section author higher priority than book author, copyrightholder
			$copyright_holder = $section_author;
		} elseif ( isset( $metadata['pb_copyright_holder'] ) ) {
			// book copyright holder higher priority than book author
			$copyright_holder = $metadata['pb_copyright_holder'];
		} elseif ( isset( $metadata['pb_authors'] ) ) {
			// book author is the fallback, default
			$copyright_holder = $metadata['pb_authors'];
		} else {
			$copyright_holder = '';
		}

		if ( ! empty( $metadata['pb_copyright_year'] ) ) {
			$copyright_year = $metadata['pb_copyright_year'];
		} elseif ( ! empty( $metadata['pb_publication_date'] ) ) {
			$copyright_year = strftime( '%Y', absint( $metadata['pb_publication_date'] ) );
		} else {
			$copyright_year = 0;
		}

		$html = $this->getLicense( $license, $copyright_holder, $link, $title, $copyright_year );

		return $html;
	}
public function doLicense ( $ metadata , $ post_id = 0 , $ title = '' ) { if ( ! empty ( $ title ) ) { _doing_it_wrong ( __METHOD__ , __ ( '$title is deprecated. Method will automatically determine title from licenses' , 'pressbooks' ) , 'Pressbooks 5.7.0' ) ; } $ book_license = isset ( $ metadata [ 'pb_book_license' ] ) ? $ metadata [ 'pb_book_license' ] : '' ; if ( empty ( $ post_id ) ) { // if no post $id given, set empty strings $ section_license = '' ; $ section_author = '' ; } else { $ section_license = get_post_meta ( $ post_id , 'pb_section_license' , true ) ; $ section_author = ( new Contributors ( ) ) -> get ( $ post_id , 'pb_authors' ) ; } // Copyright license, set in order of precedence if ( ! empty ( $ section_license ) ) { // section copyright higher priority than book $ license = $ section_license ; } elseif ( ! empty ( $ book_license ) ) { // book is the fallback, default $ license = $ book_license ; } else { $ license = 'all-rights-reserved' ; } if ( ! $ this -> isSupportedType ( $ license ) ) { // License not supported, bail return '' ; } // Unless section is licensed differently, it should display the book license statement if ( $ section_license === $ book_license || empty ( $ section_license ) ) { $ title = get_bloginfo ( 'name' ) ; $ link = get_bloginfo ( 'url' ) ; } else { $ post = get_post ( $ post_id ) ; $ title = $ post ? $ post -> post_title : get_bloginfo ( 'name' ) ; $ link = get_permalink ( $ post_id ) ; } // Copyright holder, set in order of precedence if ( ! empty ( $ section_author ) ) { // section author higher priority than book author, copyrightholder $ copyright_holder = $ section_author ; } elseif ( isset ( $ metadata [ 'pb_copyright_holder' ] ) ) { // book copyright holder higher priority than book author $ copyright_holder = $ metadata [ 'pb_copyright_holder' ] ; } elseif ( isset ( $ metadata [ 'pb_authors' ] ) ) { // book author is the fallback, default $ copyright_holder = $ metadata [ 'pb_authors' ] ; } else { $ copyright_holder = '' ; } if ( ! empty ( $ metadata [ 'pb_copyright_year' ] ) ) { $ copyright_year = $ metadata [ 'pb_copyright_year' ] ; } elseif ( ! empty ( $ metadata [ 'pb_publication_date' ] ) ) { $ copyright_year = strftime ( '%Y' , absint ( $ metadata [ 'pb_publication_date' ] ) ) ; } else { $ copyright_year = 0 ; } $ html = $ this -> getLicense ( $ license , $ copyright_holder , $ link , $ title , $ copyright_year ) ; return $ html ; }
Will create an html blob of copyright information, returns empty string
if license not supported

@param array $metadata \Pressbooks\Book::getBookInformation
@param int $post_id (optional)
@param string $title (@deprecated)

@return string
Will create an html blob of copyright information returns empty string if license not supported