/ */ class P4Cms_Filter_PptxToText implements Zend_Filter_Interface { /** * Extract text contents from a PowerPoint format. * * @param string $pptx the Powerpoint contents to be filtered. * @return string the plain text output. */ public function filter($pptx) { // shortcut if we have an empty string if (!$pptx) { return; } // write contents to a tmp file $tempFile = tempnam(sys_get_temp_dir(), 'powerpoint'); file_put_contents($tempFile, $pptx); $document = Zend_Search_Lucene_Document_Pptx::loadPptxFile($tempFile); // remove the temp file unlink($tempFile); return $document->getFieldValue('body'); } }