You are here

public function ISBNtest::valid_isbn10 in Biblio Advanced Import 7

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

File

lib/isbntest.class.php, line 173

Class

ISBNtest

Code

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

    // If we've been given a new ISBN then use it.
    $this
      ->set_isbn10($isbn);
  }
  if (FALSE === $this->isbn10 && FALSE !== $this->isbn13) {
    if (TRUE === $this
      ->valid_isbn13()) {
      $this
        ->get_isbn10();
    }
  }
  if (FALSE === $this->isbn10 || strlen($this->isbn10) != 10) {
    $this->error = "ISBN-10 is not set";
    return FALSE;
  }
  if ((string) substr($this->isbn10, 9, 1) === (string) $this
    ->get_isbn10_checkdigit()) {
    return TRUE;
  }
  else {
    $this->error = "Checkdigit failure";
    return FALSE;
  }
}