Example #1
0
 public function getBibtex()
 {
     $bibtex = '@incollection{';
     if (is_object($this->category) && isset($this->category->category)) {
         if ($this->category->category == 'In Conference') {
             $bibtex = '@incollection{';
         } else {
             if ($this->category->category == 'In Journal') {
                 $bibtex = '@article{';
             } else {
                 if ($this->category->category == 'In Book') {
                     $bibtex = '@inbook{';
                 } else {
                     if ($this->category->category == 'Book') {
                         $bibtex = '@book{';
                     } else {
                         if ($this->category->category == 'MSc Thesis') {
                             $bibtex = '@mastersthesis{';
                         } else {
                             if ($this->category->category == 'PhD Thesis') {
                                 $bibtex = '@phdthesis{';
                             } else {
                                 if ($this->category->category == 'Technical Report') {
                                     $bibtex = '@manual{';
                                 } else {
                                     $bibtex = '@misc{';
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $pub_date = explode('-', $this->published);
     $venue_short = '';
     if (is_object($this->venue)) {
         if (isset($this->venue->title)) {
             $venue_short = preg_replace("/['-]\\d+/", '', $this->venue->title);
         }
         $venue_name = $this->venue->nameGet();
         if (!empty($this->venue->data) && $this->venue->categoryGet() == 'Workshop') {
             $venue_name .= ' (within ' . $this->venue->data . ')';
         }
     }
     if (isset($this->authors) && count($this->authors) > 0) {
         $auth_count = count($this->authors);
         if ($auth_count > 0) {
             $bibtex .= $this->authors[0]->lastname;
             if ($auth_count == 2) {
                 $bibtex .= '+' . $this->authors[1]->lastname;
             } else {
                 if ($auth_count > 2) {
                     $bibtex .= '+al';
                 }
             }
             if (isset($venue_short)) {
                 $bibtex .= ':' . $venue_short;
             }
             $bibtex = preg_replace("/\\s/", '', $bibtex);
             $bibtex .= substr($pub_date[0], 2) . ",\n" . '  author = {';
             $arr = array();
             foreach ($this->authors as $auth) {
                 $arr[] = $auth->firstname . ' ' . $auth->lastname;
             }
             $bibtex .= implode(' and ', $arr) . "},\n";
         }
     } else {
         $bibtex .= $this->pub_id . ",\n";
     }
     $bibtex .= '  title = {' . $this->title . "},\n";
     // show info
     if (count($this->info) > 0) {
         foreach ($this->info as $key => $value) {
             if ($value != '') {
                 $bibtex .= '  ' . $key . ' = ';
                 if ($key == 'Pages' || strpos($value, ' ')) {
                     $bibtex .= '{' . $value . "},\n";
                 } else {
                     $bibtex .= '"' . $value . "\",\n";
                 }
             }
         }
     }
     if (isset($venue_name)) {
         if (is_object($this->category)) {
             if ($this->category->category == 'In Conference' || $this->category->category == 'In Workshop') {
                 $bibtex .= '  booktitle = {' . $venue_name . "},\n";
             } else {
                 if ($this->category->category == 'In Journal') {
                     $bibtex .= '  journal = {' . $venue_name . "},\n";
                 }
             }
         } else {
             $bibtex .= '  booktitle = {' . $venue_name . "},\n";
         }
     }
     $bibtex .= '  year = ' . $pub_date[0] . ",\n";
     $bibtex .= '}';
     return format80($bibtex);
 }
Example #2
0
 private static function wfDebug($text, $logonly = false)
 {
     if (!self::$_debug) {
         return;
     }
     if (PHP_SAPI != "cli") {
         echo '<pre>';
     }
     echo htmlentities(format80($text));
     if (PHP_SAPI != "cli") {
         echo '</pre>';
     } else {
         echo "\n";
     }
 }