From fb9df0c269f36703909b8b259abbdbed29881ecd Mon Sep 17 00:00:00 2001 From: tcit Date: Thu, 24 Jul 2014 21:56:04 +0200 Subject: use directly MOBIClass --- inc/3rdparty/libraries/MOBIClass/Record.php | 96 +++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 inc/3rdparty/libraries/MOBIClass/Record.php (limited to 'inc/3rdparty/libraries/MOBIClass/Record.php') diff --git a/inc/3rdparty/libraries/MOBIClass/Record.php b/inc/3rdparty/libraries/MOBIClass/Record.php new file mode 100644 index 00000000..3cb39582 --- /dev/null +++ b/inc/3rdparty/libraries/MOBIClass/Record.php @@ -0,0 +1,96 @@ +data = $data; + if($length >= 0){ + $this->length = $length; + }else{ + $this->length = strlen($data); + } + } + + public function compress($compression_method){ + switch($compression_method){ + case NO_COMPRESSION: + //Finished! + break; + case PALMDOC_COMPRESSION: + throw new Exception("Not implemented yet"); + break; + case HUFF: + throw new Exception("Not implemented yet"); + break; + default: + throw new Exception("Invalid argument"); + } + } + + public function getByteLength(){ + return $this->getLength(); + } + + /** + * Get the length of the record + * @return int Length of the data + */ + public function getLength(){ + return $this->length; + } + + /** + * Get the data contained in the record + * @return string Data contained in the record + */ + public function get(){ + return $this->data; + } + + /** + * Set the data contained in the record + * @param string $value Data contained in the record + */ + public function set($value){ + $this->data = $value; + } + + public function serialize(){ + return $this->data; + } + public function unserialize($data){ + __construct($data); + } + + public function __toString() { + $toShow = $this->data; + if(strlen($this->data) > 103){ + $toShow = substr($this->data, 0, 100)."..."; + } + $out = "Record: {\n"; + $out .= "\t".htmlspecialchars($toShow)."\n"; + $out .= "}"; + return $out; + } +} +?> -- cgit v1.2.3