示例#1
0
 /** Creates a web site citation */
 function website()
 {
     //Add the contributors
     $ret = $this->formatAuthors($work->contributors);
     //Add the article title (if provided)
     if ($work->articleTitle) {
         //Uppercase all words in article title, lowercase all art., prep., & conj., append a period, and encapsulate in double quotes
         $articleTitle = ucwords($work->articleTitle);
         $articleTitle = Utility::lowerArticles($articleTitle);
         $articleTitle = Utility::addPeriod($articleTitle);
         $ret .= '"' . $articleTitle . '" ';
     }
     //Add the web site title (if provided)
     if ($work->webTitle) {
         $ret .= '<i>' . ucwords($work->webTitle) . '</i>' . '. ';
     }
     //Add the web site publisher/sponsor (if provided)
     if ($work->publisherSponsor) {
         $ret .= ucwords($work->publisherSponsor) . ', ';
     } else {
         $ret .= 'N.p., ';
     }
     //Add the electronically published date (if provided)
     $ret .= $this->formatPublishDate($work->electronicPublishDay, $work->electronicPublishMonth, $work->electronicPublishYear);
     //Add a period
     $ret .= '. ';
     //Add the medium
     $ret .= 'Web. ';
     //Add the access date (if provided)
     if ($work->webAccessDay || $work->webAccessMonth || $work->webAccessYear) {
         $ret .= $this->formatAccessDate($work->webAccessDay, $work->webAccessMonth, $work->webAccessYear) . '. ';
     }
     //Add the URL (if provided)
     if ($work->webUrl) {
         $ret .= '&#60;';
         $ret .= Utility::checkUrlPrepend($work->webUrl);
         $ret .= '&#62;';
         $ret .= '. ';
     }
     return $ret;
 }
示例#2
0
 /**
  * Creates a scholarly journal article citation
  *
  * @param Work $work
  *
  * @return string
  */
 function journal(Work $work)
 {
     //Add the contributors
     $ret = $this->formatAuthors($work->authors);
     //Add the publishing date (if provided)
     if ($work->yearPublished) {
         $ret .= ' (' . $work->yearPublished . '). ';
     }
     //Add the article title (if provided)
     if ($work->articleTitle) {
         $ret .= $this->formatTitle($work->articleTitle) . ' ';
     }
     //Add the journal title (if provided)
     if ($work->journalTitle) {
         $journalTitleholder = ucwords($work->journalTitle);
         $ret .= '<i>' . Utility::lowerArticles($journalTitleholder) . '</i>';
     }
     //Add the volume and issue numbers (if provided)
     if ($work->volume || $work->issue) {
         //Add a comma after the journal title (if provided)
         if ($work->journalTitle) {
             $ret .= ', ';
         }
         $ret .= '<i>' . $work->volume . '</i>';
         if ($work->issue) {
             //Add the issue number (if provided)
             $ret .= '(' . $work->issue . ')';
         }
     }
     //Add the page numbers (if provided)
     $pageholder = $this->formatJournalPageNumbers($work->startPage, $work->endPage, $work->hasNonConsecutivePages, $work->nonConsecutivePageNums);
     if ($pageholder) {
         //There are page numbers
         if ($work->volume || $work->issue) {
             //There is a volume & issue number preceeding
             $ret .= ', ' . $pageholder;
         } else {
             //There is no volume & issue number preceeding
             if ($work->journalTitle) {
                 //There is a magazine title preceeding
                 $ret .= ', ' . $pageholder;
             } else {
                 //There is no journal title preceeding
                 $ret .= $pageholder;
             }
         }
     }
     //Add a period
     $ret .= '. ';
     //on a website
     if ($work->medium == "website") {
         //Add the URL (if provided)
         if ($work->webUrl) {
             $ret .= 'Retrieved from ' . Utility::checkUrlPrepend($work->webUrl);
         } elseif ($work->webDoi) {
             //Add the DOI (if provided)
             $ret .= 'doi:' . $work->webDoi;
         }
     }
     //in a database
     if ($work->medium == "db") {
         //Add the URL (if provided)
         if ($work->dbUrl) {
             $ret .= 'Retrieved from ' . Utility::checkUrlPrepend($work->dbUrl);
         } elseif ($work->dbDoi) {
             //Add the DOI (if provided)
             $ret .= 'doi:' . $work->dbDoi;
         }
     }
     return $ret;
 }