You are here

public function ISBNtest::valid_isbn13 in Biblio Advanced Import 7

Same name and namespace in other branches
  1. 6 lib/isbntest.class.php \ISBNtest::valid_isbn13()
3 calls to ISBNtest::valid_isbn13()
ISBNtest::get_isbn10 in lib/isbntest.class.php
ISBNtest::valid_isbn in lib/isbntest.class.php
ISBNtest::valid_isbn10 in lib/isbntest.class.php

File

lib/isbntest.class.php, line 204

Class

ISBNtest

Code

public function valid_isbn13($isbn = "") {
  if ($isbn != "") {

    // if we've been given an isbn here, use it
    $this
      ->set_isbn13($isbn);
  }
  if (FALSE === $this->isbn13 && FALSE !== $this->isbn10) {
    if (TRUE === $this
      ->valid_isbn10()) {
      $this
        ->get_isbn13();
    }
  }
  if (FALSE === $this->isbn13 || strlen($this->isbn13) != 13) {
    $this->error = "ISBN-13 is not set";
    return FALSE;
  }
  if ((string) substr($this->isbn13, 12, 1) === (string) $this
    ->get_isbn13_checkdigit()) {
    return TRUE;
  }
  else {
    $this->error = "Checkdigit failure";
    return FALSE;
  }
}