Ejemplo n.º 1
0
 /**
  * Loads book infos from an epub file
  *
  * @param string Epub full file name
  * @throws Exception if error
  *
  * @return void
  */
 public function LoadFromEpub($inFileName)
 {
     // Load the epub file
     $ePub = new EPub($inFileName, 'ZipFile');
     // Get the epub infos
     $this->mFormat = 'epub';
     $this->mPath = pathinfo($inFileName, PATHINFO_DIRNAME);
     $this->mName = pathinfo($inFileName, PATHINFO_FILENAME);
     $this->mUuid = $ePub->Uuid();
     $this->mUri = $ePub->Uri();
     $this->mTitle = $ePub->Title();
     $this->mAuthors = $ePub->Authors();
     $this->mLanguage = $ePub->Language();
     $this->mDescription = $ePub->Description();
     $this->mSubjects = $ePub->Subjects();
     $cover = $ePub->Cover();
     $this->mCover = $cover['found'] !== false ? $cover['found'] : '';
     $this->mIsbn = $ePub->ISBN();
     $this->mRights = $ePub->Copyright();
     $this->mPublisher = $ePub->Publisher();
     $this->mSerie = $ePub->Serie();
     $this->mSerieIndex = $ePub->SerieIndex();
     $this->mCreationDate = $ePub->CreationDate();
     $this->mModificationDate = $ePub->ModificationDate();
 }
Ejemplo n.º 2
0
Archivo: book.php Proyecto: 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();
     }
 }
Ejemplo n.º 3
0
        $epub = new EPub($bookdir . $book . '.epub');
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}
// return image data
if (isset($_REQUEST['img']) && isset($epub)) {
    $img = $epub->Cover();
    header('Content-Type: ' . $img['mime']);
    echo $img['data'];
    exit;
}
// save epub data
if ($_REQUEST['save'] && isset($epub)) {
    $epub->Title($_POST['title']);
    $epub->Description($_POST['description']);
    $epub->Language($_POST['language']);
    $epub->Publisher($_POST['publisher']);
    $epub->Copyright($_POST['copyright']);
    $epub->ISBN($_POST['isbn']);
    $epub->Subjects($_POST['subjects']);
    $authors = array();
    foreach ((array) $_POST['authorname'] as $num => $name) {
        if ($name) {
            $as = $_POST['authoras'][$num];
            if (!$as) {
                $as = $name;
            }
            $authors[$as] = $name;
        }
    }