array ( 'target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt' ), 'write' => array ( 'target' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'format' => 'docx', 'extension' => 'docx' ) ); array( 'read' => array ( 'target' => 'application/vnd.oasis.opendocument.text', 'format' => 'odt:writer8', 'extension' => 'odt' ), 'write' => array ( 'target' => 'application/msword', 'format' => 'doc', 'extension' => 'doc' ) ); */ public function __construct($mimeSpec){ $this->readSpec = $mimeSpec['read']; $this->writeSpec = $mimeSpec['write']; \OCA\Richdocuments\Filter::add($mimeSpec['write']['target'], $this); } public function read($data){ return array( 'mimetype' => $this->readSpec['target'], 'content' => \OCA\Richdocuments\Converter::convert( $data['content'], $this->readSpec['format'], $this->readSpec['extension'] ) ); } public function write($data){ return array( 'mimetype' => $this->writeSpec['target'], 'content' => \OCA\Richdocuments\Converter::convert( $data['content'], $this->writeSpec['format'], $this->writeSpec['extension'] ) ); } }