public function getFileContent($file)
    {
        // we can continue only when given file is really file and not a directory
        if ($this->fileInfo->getIsFile()) {
            $className = 'TeaminmediasPluswerk\KeSearch\Indexer\Filetypes\\' . ucfirst($this->fileInfo->getExtension());

            // check if class exists
            if (class_exists($className)) {
                // make instance
                $fileObj = GeneralUtility::makeInstance($className, $this->pObj);

                // check if new object has interface implemented
                if ($fileObj instanceof FileIndexerInterface) {
                    // Do the check if a file has already been indexed at this early point in order
                    // to skip the time expensive "get content" process which includes calls to external tools
                    // fetch the file content directly from the index
                    $fileContent = $this->getFileContentFromIndex($this->getUniqueHashForFile());

                    // if there's no matching index entry, we execute the  "get file content" method of our new object
                    if (!$fileContent) {
                        $fileContent = $fileObj->getContent($file);
                        $this->addError($fileObj->getErrors());
                    }

                    // remove line breaks from content in order to identify
                    // additional content (which will have trailing linebreaks)
                    $fileContent = str_replace("\n", ' ', $fileContent);

                    return $fileContent;
                } else {
                    return false;
                }
            } else {
                // if no indexer for this type of file exists, we do a fallback:
                // we return an empty content. Doing this at least the FAL metadata
                // can be indexed. So this makes only sense when using FAL.
                if ($this->pObj->indexerConfig['fal_storage'] > 0) {
                    return '';
                } else {
                    $errorMessage = 'No indexer for this type of file. (class ' . $className . ' does not exist).';
                    $this->pObj->logger->error($errorMessage);
                    $this->addError($errorMessage);
                    return false;
                }
            }
        } else {
            $errorMessage = $file . ' is not a file.';
            $this->pObj->logger->error($errorMessage);
            $this->addError($errorMessage);
            return false;
        }
    }
public function getFileContent($file)
    {
        // we can continue only when given file is really file and not a directory
        if ($this->fileInfo->getIsFile()) {
            $className = 'TeaminmediasPluswerk\KeSearch\Indexer\Filetypes\\' . ucfirst($this->fileInfo->getExtension());

            // check if class exists
            if (class_exists($className)) {
                // make instance
                $fileObj = GeneralUtility::makeInstance($className, $this->pObj);

                // check if new object has interface implemented
                if ($fileObj instanceof FileIndexerInterface) {
                    // Do the check if a file has already been indexed at this early point in order
                    // to skip the time expensive "get content" process which includes calls to external tools
                    // fetch the file content directly from the index
                    $fileContent = $this->getFileContentFromIndex($this->getUniqueHashForFile());

                    // if there's no matching index entry, we execute the  "get file content" method of our new object
                    if (!$fileContent) {
                        $fileContent = $fileObj->getContent($file);
                        $this->addError($fileObj->getErrors());
                    }

                    // remove line breaks from content in order to identify
                    // additional content (which will have trailing linebreaks)
                    $fileContent = str_replace("\n", ' ', $fileContent);

                    return $fileContent;
                } else {
                    return false;
                }
            } else {
                // if no indexer for this type of file exists, we do a fallback:
                // we return an empty content. Doing this at least the FAL metadata
                // can be indexed. So this makes only sense when using FAL.
                if ($this->pObj->indexerConfig['fal_storage'] > 0) {
                    return '';
                } else {
                    $errorMessage = 'No indexer for this type of file. (class ' . $className . ' does not exist).';
                    $this->pObj->logger->error($errorMessage);
                    $this->addError($errorMessage);
                    return false;
                }
            }
        } else {
            $errorMessage = $file . ' is not a file.';
            $this->pObj->logger->error($errorMessage);
            $this->addError($errorMessage);
            return false;
        }
    }
public function getFileContent ( $ file ) { // we can continue only when given file is really file and not a directory if ( $ this -> fileInfo -> getIsFile ( ) ) { $ className = 'TeaminmediasPluswerk\KeSearch\Indexer\Filetypes\\' . ucfirst ( $ this -> fileInfo -> getExtension ( ) ) ; // check if class exists if ( class_exists ( $ className ) ) { // make instance $ fileObj = GeneralUtility :: makeInstance ( $ className , $ this -> pObj ) ; // check if new object has interface implemented if ( $ fileObj instanceof FileIndexerInterface ) { // Do the check if a file has already been indexed at this early point in order // to skip the time expensive "get content" process which includes calls to external tools // fetch the file content directly from the index $ fileContent = $ this -> getFileContentFromIndex ( $ this -> getUniqueHashForFile ( ) ) ; // if there's no matching index entry, we execute the  "get file content" method of our new object if ( ! $ fileContent ) { $ fileContent = $ fileObj -> getContent ( $ file ) ; $ this -> addError ( $ fileObj -> getErrors ( ) ) ; } // remove line breaks from content in order to identify // additional content (which will have trailing linebreaks) $ fileContent = str_replace ( "\n" , ' ' , $ fileContent ) ; return $ fileContent ; } else { return false ; } } else { // if no indexer for this type of file exists, we do a fallback: // we return an empty content. Doing this at least the FAL metadata // can be indexed. So this makes only sense when using FAL. if ( $ this -> pObj -> indexerConfig [ 'fal_storage' ] > 0 ) { return '' ; } else { $ errorMessage = 'No indexer for this type of file. (class ' . $ className . ' does not exist).' ; $ this -> pObj -> logger -> error ( $ errorMessage ) ; $ this -> addError ( $ errorMessage ) ; return false ; } } } else { $ errorMessage = $ file . ' is not a file.' ; $ this -> pObj -> logger -> error ( $ errorMessage ) ; $ this -> addError ( $ errorMessage ) ; return false ; } }
get filecontent of allowed extensions
@param string $file
@return mixed false or fileinformations as array
get filecontent of allowed extensions