Public Method Details |
File_SearchReplace |
public void File_SearchReplace( string $find, string $replace, array $files, [ string $directories, integer $include_subdir, array $ignore_lines ] )
|
|
Sets up the object
|
Parameter |
|
string |
$find |
|
|
The string/regex to find. |
|
|
string |
$replace |
|
|
The string/regex to replace $find with. |
|
|
array |
$files |
|
|
The file(s) to perform this operation on. |
|
|
string |
$directories |
= >>''<< |
|
(optional) The directories to perform this operation on. |
|
|
integer |
$include_subdir |
= >>1<< |
|
If performing on directories, whether to traverse subdirectories. |
|
|
array |
$ignore_lines |
= >>array()<< |
|
Ignore lines beginning with any of the strings in this array. This
feature only works with the "normal" search. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
getNumOccurences |
public int getNumOccurences( )
|
|
Accessor to return the number of occurences found.
|
Returns |
int Number of occurences found. |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
getLastError |
public string getLastError( )
|
|
Accessor for retrieving last error.
|
Returns |
string The last error that occurred, if any. |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setFind |
public void setFind( string $find )
|
|
Accessor for setting find variable.
|
Parameter |
|
string |
$find |
|
|
The string/regex to find. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setReplace |
public void setReplace( string $replace )
|
|
Accessor for setting replace variable.
|
Parameter |
|
string |
$replace |
|
|
The string/regex to replace the find string/regex with. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setFiles |
public void setFiles( array $files )
|
|
Accessor for setting files variable.
|
Parameter |
|
array |
$files |
|
|
The file(s) to perform this operation on. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setDirectories |
public void setDirectories( array $directories )
|
|
Accessor for setting directories variable.
|
Parameter |
|
array |
$directories |
|
|
The directories to perform this operation on. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setIncludeSubdir |
public void setIncludeSubdir( int $include_subdir )
|
|
Accessor for setting include_subdir variable.
|
Parameter |
|
int |
$include_subdir |
|
|
Whether to traverse subdirectories or not. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setIgnoreLines |
public void setIgnoreLines( array $ignore_lines )
|
|
Accessor for setting ignore_lines variable.
|
Parameter |
|
array |
$ignore_lines |
|
|
Ignore lines beginning with any of the strings in this array. This
feature only works with the "normal" search. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
setSearchFunction |
public void setSearchFunction( string $search_function )
|
|
Function to determine which search function is used.
|
Parameter |
|
string |
$search_function |
|
|
search function that should be used. Can be any one of:
normal - Default search. Goes line by line. Ignore lines feature only works with this type.
quick - Uses str_replace for straight replacement throughout file. Quickest of the lot.
preg - Uses preg_replace(), so any regex valid with this function is valid here.
ereg - Uses ereg_replace(), so any regex valid with this function is valid here. |
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|
doSearch |
public void doSearch( )
|
|
This starts the search/replace off. Call this to do the search.
First do whatever files are specified, and/or if directories are specified,do those too.
|
Returns |
void |
Author(s) |
Richard Heyes <richard.heyes@heyes-computing.net> |
|