Example #1
0
File: book.php Project: ha-y/cops
 public function getUpdatedEpub($idData)
 {
     global $config;
     $data = $this->getDataById($idData);
     try {
         $epub = new EPub($data->getLocalPath());
         $epub->Title($this->title);
         $authorArray = array();
         foreach ($this->getAuthors() as $author) {
             $authorArray[$author->sort] = $author->name;
         }
         $epub->Authors($authorArray);
         $epub->Language($this->getLanguages());
         $epub->Description($this->getComment(false));
         $epub->Subjects($this->getTagsName());
         $epub->Cover2($this->getFilePath("jpg"), "image/jpeg");
         $epub->Calibre($this->uuid);
         $se = $this->getSerie();
         if (!is_null($se)) {
             $epub->Serie($se->name);
             $epub->SerieIndex($this->seriesIndex);
         }
         if ($config['cops_provide_kepub'] == "1" && preg_match("/Kobo/", $_SERVER['HTTP_USER_AGENT'])) {
             $epub->updateForKepub();
         }
         $epub->download($data->getUpdatedFilenameEpub());
     } catch (Exception $e) {
         echo "Exception : " . $e->getMessage();
     }
 }