You are here

public function ISBNtest::set_isbn in Biblio Advanced Import 7

Same name and namespace in other branches
  1. 6 lib/isbntest.class.php \ISBNtest::set_isbn()
1 call to ISBNtest::set_isbn()
ISBNtest::valid_isbn in lib/isbntest.class.php

File

lib/isbntest.class.php, line 145

Class

ISBNtest

Code

public function set_isbn($isbn) {
  $isbn = preg_replace("@[^0-9X]@", "", strtoupper($isbn));

  // strip to the basic ISBN
  if (strlen($isbn) == 14) {
    $this
      ->set_gtin14($isbn);
    return TRUE;
  }
  if (strlen($isbn) == 13) {
    $this
      ->set_isbn13($isbn);
    return TRUE;
  }
  elseif (strlen($isbn) == 10) {
    $this->isbn10 = $isbn;
    return TRUE;
  }
  else {
    $this->error = "ISBN given is not 10, 13, or 14 digits ({$isbn})";
    return FALSE;
  }
}