3 && strpos($author,',') !== false && strpos($author,';') === false) $asep = ','; $a = explode($asep, $author); if (sizeof($a) == 2) $author = "{$a[0]} and {$a[1]}"; else if (sizeof($a) > 2) $author = "{$a[0]} et.al."; if (empty($title) && !empty($url)) $title = "$url"; if (!empty($title)) { $t = "\"$title\""; if (!empty($author) && !empty($year)) return "$t ($author, $year)"; else if (!empty($author)) return "$t ($author)"; else if (!empty($year)) return "$t ($year)"; else return "$t"; } else { if (!empty($author) && !empty($year)) return "($author, $year)"; else if (!empty($author)) return "($author)"; else return "($year)"; } } public function getCitationFormat($args) { extract($args); $_out = ''; $date = strlen($year)>0 ? (strlen($month)>0 ? (strlen($day)>0 ? "$year, $month $day" : "$year, $month") : $year) : 'n.d.'; $date = " ($date)"; $asep = ';'; if (str_word_count($author) > 3 && strpos($author,',') !== false && strpos($author,';') === false) $asep = ','; $a = explode($asep, $author); if (sizeof($a) == 2) $author = "{$a[0]} and {$a[1]}"; else if (sizeof($a) > 2) $author = "{$a[0]} et.al."; if (!empty($title)) $title = ", $title"; if (!empty($title_periodical)) $title_periodical = ", ($title_periodical)"; if (!empty($issue)) $issue = "($issue)"; if (!empty($publisher_place)) $publisher_place = ". $publisher_place"; if (!empty($publisher) && !empty($publisher_place)) $publisher = ": $publisher"; else if (!empty($publisher)) $publisher = ". $publisher"; if (!empty($doi)) $doi = "$doi"; switch($media){ case 'journal': case 'periodical': case 'magazine': if (!empty($pages)) $pages = ", $pages"; if (!empty($volume)) $volume = "$volume"; $_out = "$author$date$title$title_periodical, $volume$issue$pages."; break; case 'newspaper': if (!empty($pages)) $pages = ", $pages"; $_out = "$author$date$title$title_periodical$pages."; break; case 'book': case 'paper': if(!empty($author)) $_out = "$author$date$title$publisher_place$publisher."; else $_out = "{$args['title']}$date$publisher_place$publisher."; break; case 'booksection': $_out = "$author$date$title. ". vsprintf( _x('In %s','citebooksection','academicpress'), $book_author) .", $book_title ($pages)$publisher_place$publisher."; break; case 'encyclopedia': $_out = "$author$date$title. ". vsprintf( _x('In %s','citebooksection','academicpress'), $book_author) .", $book_title ($volume, $pages)$publisher_place$publisher."; break; case 'eric': $_out = "$author$date$title. ".__('Retrieved from ERIC database.','academicpress')." ($doi)"; $doi=''; break; case 'website': case 'web': case 'post': if(!empty($author)) $_out = "{$args['title']}, $author$date."; elseif ( $author != $publisher && !empty($publisher) ) $_out = "$author$date$title$publisher."; else $_out = "$author$date$title."; break; case 'wiki': $_out = "{$args['title']}$date. "._x('In Wikipedia','cite','academicpress')."."; break; case 'blog': $_out = "$author$date$title."; break; case 'blog': $_out = "$author$date$title. ["._x('Weblog message','academicpress')."]."; break; case 'video': $_out = "$author$date$title. ["._x('Video file','academicpress')."]."; break; case 'powerpoint': case 'ppt': $_out = "$author$date$title. ["._('PowerPoint slides','academicpress')."]."; break; default: if(!empty($author)) { $_out = "$author$date$title$publisher_place$publisher."; } else $_out = "{$args['title']}$date$publisher_place$publisher."; } if (!empty($_out)) { if (!empty($url)) { $date = !empty($year_access) ? (!empty($month_access) ? (!empty($day_access) ? "$month_access $day_access, $year_access" : "$month_access $year_access") : $year_access) : ''; if (!empty($publisher)) $publisher = " {$args['publisher']}:"; $_out .= " "._x('Retrieved','url','academicpress')." $date "._x('from','url','academicpress')."$publisher $url."; } if (!empty($doi)) $_out .= " DOI: $doi."; } return $_out; } public function getTable($collection, $args) { if (!isset($args['level']) || empty($args['level'])) $args['level'] = '2'; $t = "". $args['title'] .""; $t .= '
    '; $collection->sortBy(array('year'=>SORT_DESC, 'author'=>SORT_ASC)); foreach ($collection as $c) $t .= '
  1. '. $this->getCitationFormat($c) .'
  2. '; $t .= '
'; return $t; } }