You are here

public function PARSEPAGE::type1 in Bibliography Module 7

Same name and namespace in other branches
  1. 5 bibtexParse/PARSEPAGE.php \PARSEPAGE::type1()
  2. 6.2 modules/bibtexParse/PARSEPAGE.php \PARSEPAGE::type1()
  3. 6 bibtexParse/PARSEPAGE.php \PARSEPAGE::type1()
  4. 7.3 plugins/biblio_style/bibtex/PARSEPAGE.php \PARSEPAGE::type1()
  5. 7.2 modules/bibtexParse/PARSEPAGE.php \PARSEPAGE::type1()

"77--99" or '-'type?

1 call to PARSEPAGE::type1()
PARSEPAGE::init in modules/bibtexParse/PARSEPAGE.php
The first valid number it finds from the left as page_start setting page_end to NULL.

File

modules/bibtexParse/PARSEPAGE.php, line 48

Class

PARSEPAGE
PARSEPAGE: BibTeX PAGES import class.

Code

public function type1($item) {
  $start = $end = FALSE;
  $array = preg_split("/--|-/", $item);
  if (count($array) > 1) {
    if (is_numeric(trim($array[0]))) {
      $start = trim($array[0]);
    }
    else {
      $start = strtolower(trim($array[0]));
    }
    if (is_numeric(trim($array[1]))) {
      $end = trim($array[1]);
    }
    else {
      $end = strtolower(trim($array[1]));
    }
    if ($end && !$start) {
      $this->return = array(
        $end,
        $start,
      );
    }
    else {
      $this->return = array(
        $start,
        $end,
      );
    }
    return TRUE;
  }
  return FALSE;
}