Esempio n. 1
0
 /**
  * @param $originalWork
  *
  * @return string
  *
  * @throws UnknownWorkTypeException
  */
 protected static function checkValid($originalWork)
 {
     if (is_array($originalWork)) {
         $type = Utility::array_get($originalWork, 'type', null);
     } else {
         $type = $originalWork->type;
     }
     $className = __NAMESPACE__ . '\\' . ucfirst(strtolower($type));
     if (!class_exists($className)) {
         throw new UnknownWorkTypeException("Unknown type {$type}.");
     }
     return $className;
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 /**
  * Creates a web site citation
  *
  * @param Work $work
  *
  * @return string
  */
 function website(Work $work)
 {
     //Add the contributors
     $ret = $this->formatAuthors($work->authors);
     //Add the publishing date
     $ret .= $this->formatPublishDate($work->electronicPublishDay, $work->electronicPublishMonth, $work->electronicPublishYear) . '. ';
     //Add the article title (if provided)
     if ($work->articleTitle) {
         $ret .= $this->formatTitle($work->articleTitle) . ' ';
     }
     //Add the website title (if provided)
     if ($work->webTitle) {
         $ret .= 'Retrieved from ' . $work->webTitle . ' ';
     }
     //Add the URL (if provided)
     if ($work->webUrl) {
         $ret .= 'website: ' . Utility::checkUrlPrepend($work->webUrl);
     }
     return $ret;
 }