From 3d99ce9dadca82765832ab669dabc22c554fd78e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Mon, 19 Jan 2015 13:37:32 +0100 Subject: travis configuration --- .../libraries/MOBIClass/MultipleFileHandler.php | 136 --------------------- 1 file changed, 136 deletions(-) delete mode 100644 inc/3rdparty/libraries/MOBIClass/MultipleFileHandler.php (limited to 'inc/3rdparty/libraries/MOBIClass/MultipleFileHandler.php') diff --git a/inc/3rdparty/libraries/MOBIClass/MultipleFileHandler.php b/inc/3rdparty/libraries/MOBIClass/MultipleFileHandler.php deleted file mode 100644 index e9792816..00000000 --- a/inc/3rdparty/libraries/MOBIClass/MultipleFileHandler.php +++ /dev/null @@ -1,136 +0,0 @@ -".$title."".$contents.""; - } - $pos = 0; - - if(sizeof($this->toc) > 0){ - $lastToc = $this->toc[sizeof($this->toc)-1]; - $lastFile = $this->files[sizeof($this->files)-1]; - $pos = $lastToc["pos"] + strlen($lastFile) + 1; - } - - $this->files[] = $contents; - $this->toc[] = array("title"=>$title, "pos"=>$pos); - } - - /** - * Add an image to the file - * @param string $imageContents Data string containing the binary data of the image - * @return int The reference of the image - */ - public function addImage($imageContents){ - $this->images[] = $imageContents; - return sizeof($this->images)-1; - } - - /** - * Add an image to the file - * @param string $url Url to the image - * @return int The reference of the image, false if the image couldn't be downloaded - */ - public function addImageFromUrl($url){ - $image = ImageHandler::DownloadImage($url); - - if($image === false) return false; - return $this->addImage($image); - } - - /** - * Set the metadata - * @param string $key Key - * @param string $value Value - */ - public function setMetadata($key, $value){ - $this->metadata[$key] = $value; - } - - /** - * Get the text data to be integrated in the MOBI file - * @return string - */ - public function getTextData(){ - $data = implode("\n", $this->files); - $begin = ""; - $beforeTOC = $begin.$data; - - $tocPos = strlen($beforeTOC); - - $toc = $this->generateTOC(strlen($begin)); - - $customBegin = ""; - $data = $customBegin.$data.$toc.""; - return $data; - } - - public function forceLength($n, $l){ - $str = $n.""; - $cur = strlen($str); - while($cur < $l){ - $str = "0".$str; - $cur++; - } - return $str; - } - - public function generateTOC($base = 0){ - $toc = "

Contents

"; - $toc .= "
"; - for($i = 0, $len = sizeof($this->toc); $i < $len; $i++){ - $entry = $this->toc[$i]; - $position = $entry["pos"]+$base; - $toc .= ""; - } - $toc .= "
".($i+1).".".$entry["title"]."
"; - - return $toc; - } - /** - * Get the images (an array containing the jpeg data). Array entry 0 will - * correspond to image record 0. - * @return array - */ - public function getImages(){ - return $this->images; - } - - /** - * Get the metadata in the form of a hashtable (for example, title or author). - * @return array - */ - public function getMetaData(){ - return $this->metadata; - } - -} -?> -- cgit v1.2.3