You are here

function _biblio_author_links in Bibliography Module 5

6 calls to _biblio_author_links()
biblio_show_node in ./biblio.module
biblio_style_apa in ./biblio_style_apa.inc
Apply a bibliographic style to the node
biblio_style_classic in ./biblio_style_classic.inc
Apply a bibliographic style to the node
biblio_style_cse in ./biblio_style_cse.inc
Apply a bibliographic style to the node
biblio_style_ieee in ./biblio_style_ieee.inc
Apply a bibliographic style to the node

... See full list

File

./biblio.module, line 3045

Code

function _biblio_author_links($author, $base = 'biblio', $inline = false) {
  $query = null;
  $inline = $inline ? "/inline" : "";

  //$attrib = (variable_get('biblio_links_target_new_window',null)) ? array('target'=>'_blank') : null;
  $attrib = null;
  if (isset($_GET['sort'])) {
    $query .= "sort=" . $_GET['sort'];
  }
  if (isset($_GET['order'])) {
    $query .= $query ? "&" : "";
    $query .= "order=" . $_GET['order'];
  }
  $html = "";
  $etal = '';
  if (strpos($author, 'et al.')) {
    $author = str_replace('et al.', "", $author);
    $etal = 'et al.';
  }
  $author_array = explode(";", $author);
  foreach ($author_array as $auth) {
    $html .= empty($html) ? "" : "; ";
    if (strstr($auth, ",")) {
      $parts = split(",", $auth);
      $lastname = $parts[0];
    }
    else {
      $parts = split(" ", $auth);
      $lastname = end($parts);
    }

    // list($lastname, $init) = split(",", $auth);
    $html .= l(trim($auth), "{$base}/author/" . trim($lastname) . $inline, $attrib, $query);
  }
  return $html . " {$etal}";
}