/** * Register the extractor types. * * @param boolean $clear. Optional. Defaults to false. */ public function registerTypes($clear = false) { if ($clear) { $this->clearExtractors(); } $dir = opendir(SearchHelper::correctPath($this->extractorPath)); while (($file = readdir($dir)) !== false) { if (substr($file, -17) == 'Extractor.inc.php') { require_once $this->extractorPath . '/' . $file; $class = substr($file, 0, -8); if (!class_exists($class)) { // if the class does not exist, we can't do anything. continue; } $extractor = new $class(); if ($extractor instanceof DocumentExtractor) { $extractor->registerMimeTypes(); } } } closedir($dir); }
/** * Load all fields into the registry * */ public function registerFields() { $this->fields = array(); $dir = opendir(SearchHelper::correctPath($this->path)); while (($file = readdir($dir)) !== false) { if (substr($file, -13) == 'Field.inc.php') { require_once $this->path . '/' . $file; $class = substr($file, 0, -8); if (!class_exists($class)) { continue; } $field = new $class(); if (is_null($field) || !$field instanceof FieldExpr) { continue; } $this->registerField($field); } } closedir($dir); $this->registerMetdataFields(); }