FileIndexing
in package
Does indexing for various file formats
Table of Contents
Methods
- getExt() : mixed
- Returns the extension of the specified file.
- getPlaintext() : string|null
- Returns the plaintext version of a formatted file.
- isExtSupported() : bool
- Returns true if the specified extension is supported, false if it is not
- getDoc() : string
- Uses 'antiword' to get the contents of a doc
- getDocx() : string
- Uses a perl script to get the contents of a docx
- getOdt() : string
- Uses a 'odt2txt' to get the contents of a odt
- getPdf() : string
- Uses 'pdftotext' to get the contents of a pdf
- getXls() : string
- Uses a 'xls2csv' to get the contents of a xls
Methods
getExt()
Returns the extension of the specified file.
public
static getExt(string $filename) : mixed
By the way, this value is always lowercased, because the other helpers expect that.
Parameters
- $filename : string
-
The filename to get the ext of.
getPlaintext()
Returns the plaintext version of a formatted file.
public
static getPlaintext(string $filename[, string $ext = null ]) : string|null
Returns null on error.
Parameters
- $filename : string
-
The file to process.
- $ext : string = null
-
Allows the file type to be forced.
Return values
string|null —The plain text, or null if there was an error.
isExtSupported()
Returns true if the specified extension is supported, false if it is not
public
static isExtSupported(string $ext) : bool
Parameters
- $ext : string
-
The extension to check
Return values
bool —True if supported, false otherwise
getDoc()
Uses 'antiword' to get the contents of a doc
private
static getDoc(mixed $filename) : string
Parameters
- $filename : mixed
-
The filename to process.
Return values
string —The plaintext version of the file, or null if there was an error.
getDocx()
Uses a perl script to get the contents of a docx
private
static getDocx(mixed $filename) : string
Parameters
- $filename : mixed
-
The filename to process.
Return values
string —The plaintext version of the file, or null if there was an error.
getOdt()
Uses a 'odt2txt' to get the contents of a odt
private
static getOdt(mixed $filename) : string
Parameters
- $filename : mixed
-
The filename to process.
Return values
string —The plaintext version of the file, or null if there was an error.
getPdf()
Uses 'pdftotext' to get the contents of a pdf
private
static getPdf(mixed $filename) : string
Parameters
- $filename : mixed
-
The filename to process.
Return values
string —The plaintext version of the file, or null if there was an error.
getXls()
Uses a 'xls2csv' to get the contents of a xls
private
static getXls(mixed $filename) : string
Parameters
- $filename : mixed
-
The filename to process.
Return values
string —The plaintext version of the file, or null if there was an error.