Esempio n. 1
0
 function do_main()
 {
     //registerTypes registers the mime types and populates the needed tables.
     $indexer = Indexer::get();
     $indexer->registerTypes();
     $oTemplating =& KTTemplating::getSingleton();
     $oTemplating->addLocation('Extractor Information', '/plugins/search2/reporting/templates');
     $oTemplate =& $oTemplating->loadTemplate('extractorinfo');
     $aExtractorInfo = KTMime::getMimeExtractorInformation();
     if (empty($aExtractorInfo)) {
         $oTemplate->setData(array('context' => $this, 'extractor_info' => $aExtractorInfo));
         return $oTemplate;
     }
     foreach ($aExtractorInfo as $key => $info) {
         $extractorClass = $info['name'];
         $extractor = $indexer->getExtractor($extractorClass);
         $info['mimeTypes'] = array();
         $aMimeTypes = $this->getSupportedMimeTypesDB($extractorClass);
         //$extractor->getSupportedMimeTypes();
         foreach ($aMimeTypes as $mimeType) {
             $sMimeInfo = KTMime::getFriendlyNameAndExtension($mimeType);
             $info['mimeTypes'][$mimeType] = array('description' => $sMimeInfo[0]['friendly_name'], 'extensions' => array($sMimeInfo[0]['filetypes']));
             $extensions = array();
             foreach ($sMimeInfo as $item) {
                 $extensions[] = $item['filetypes'];
             }
             $info['mimeTypes'][$mimeType]['extensions'] = implode(', ', $extensions);
         }
         $aExtractorInfo[$key] = $info;
     }
     $oTemplate->setData(array('context' => $this, 'extractor_info' => $aExtractorInfo));
     return $oTemplate;
 }