PHP 클래스 FileTextSearch

Usage: It is very easy to use, just look at the example below. To only search for a pattern into the text file, do not define any replacement key. Example: $path = '/path/to/search'; create a class instance $obj = new FileTextSearch(); set the extensions to search files within $obj = setExtensions(array('xml','xsl'); add an extension whenever you need $obj = addExtension('css'); set the pattern to search for $obj = setSearchKey('pattern'); set the replace key if you want to replace matches with it $obj = setReplacementKey('replace'); finally run the search $obj = findReplace($path);
파일 보기 프로젝트 열기: sourcefabric/newscoop 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$m_caseSensitive
$m_fileExtensions
$m_findAllExtensions
$m_isReplaceEnabled
$m_replacementKey
$m_searchKey
$m_totalFound

공개 메소드들

메소드 설명
addExtension ( string $p_extension ) Add a valid search extension.
filePutContents ( string $p_file, mixed $p_data ) : mixed Puts data (after replacement) to given file.
findExtension ( string $p_file ) : mixed Finds the extension for the given file.
findReplace ( string $p_path ) searchDirFiles() wrapper function.
matchedExtension ( string $p_file ) : boolean Checks if a file extension is one the extensions we are going to search.
searchDirFiles ( string $p_path ) : array Runs recursively all into the path.
searchFileData ( string $p_file ) Searches file data and replaces with given pattern.
setExtensions ( array $p_extensions = [] ) Sets extensions to search for.
setReplacementKey ( string $p_replacementKey ) Sets the replacement to replace pattern with.
setSearchKey ( string $p_searchKey, integer $p_caseSensitive ) Sets the pattern and case sensitivity.

메소드 상세

addExtension() 공개 메소드

Add a valid search extension.
public addExtension ( string $p_extension )
$p_extension string

filePutContents() 공개 메소드

Puts data (after replacement) to given file.
public filePutContents ( string $p_file, mixed $p_data ) : mixed
$p_file string
$p_data mixed
리턴 mixed

findExtension() 공개 메소드

Finds the extension for the given file.
public findExtension ( string $p_file ) : mixed
$p_file string
리턴 mixed the extension on success or NULL on failure

findReplace() 공개 메소드

searchDirFiles() wrapper function.
public findReplace ( string $p_path )
$p_path string

matchedExtension() 공개 메소드

Checks if a file extension is one the extensions we are going to search.
public matchedExtension ( string $p_file ) : boolean
$p_file string
리턴 boolean true on success or false on failure

searchDirFiles() 공개 메소드

Runs recursively all into the path.
public searchDirFiles ( string $p_path ) : array
$p_path string
리턴 array

searchFileData() 공개 메소드

Searches file data and replaces with given pattern.
public searchFileData ( string $p_file )
$p_file string

setExtensions() 공개 메소드

Sets extensions to search for.
public setExtensions ( array $p_extensions = [] )
$p_extensions array

setReplacementKey() 공개 메소드

Sets the replacement to replace pattern with.
public setReplacementKey ( string $p_replacementKey )
$p_replacementKey string

setSearchKey() 공개 메소드

Sets the pattern and case sensitivity.
public setSearchKey ( string $p_searchKey, integer $p_caseSensitive )
$p_searchKey string
$p_caseSensitive integer

프로퍼티 상세

$m_caseSensitive 공개적으로 프로퍼티

public $m_caseSensitive

$m_fileExtensions 공개적으로 프로퍼티

public $m_fileExtensions

$m_findAllExtensions 공개적으로 프로퍼티

public $m_findAllExtensions

$m_isReplaceEnabled 공개적으로 프로퍼티

public $m_isReplaceEnabled

$m_replacementKey 공개적으로 프로퍼티

public $m_replacementKey

$m_searchKey 공개적으로 프로퍼티

public $m_searchKey

$m_totalFound 공개적으로 프로퍼티

public $m_totalFound