\TextSearch
Class : TextSearch
- Author: : MA Razzaque Rupom <rupom_315@yahoo.com>, <rupom.bd@gmail.com> Moderator, phpResource Group(http://groups.yahoo.com/group/phpresource/) URL: http://rupom.wordpress.com HEAVILY MODIFIED BY SUNNY SIDE UP
Synopsis
class TextSearch
{
- // members
- private string $basePath = '.';
- private string $logFileLocation = '';
- private array $defaultIgnoreFolderArray = ;
- private array $ignoreFolderArray = ;
- private array $extensions = ;
- private integer $findAllExts = 0;
- private string $searchKey = '';
- private string $replacementKey = '';
- private string $futureReplacementKey = '';
- private integer $isReplacingEnabled = 0;
- private string $replacementType = "";
- private integer $caseSensitive = 0;
- private string $logString = '';
- private string $errorText = '';
- private integer $totalFound = 0;
- private string $output = '';
- private static array $search_key_totals = ;
- private static array $folder_totals = ;
- private static integer $total_total = 0;
- private static array $file_array = ;
- private static Array $flat_file_array = ;
- // methods
- public void __construct()
- public void setIgnoreFolderArray()
- public void addIgnoreFolderArray()
- public void unsetIgnoreFolderArray()
- public void setBasePath()
- public void setLogFileLocation()
- public void setExtensions()
- public void setSearchKey()
- public void setReplacementKey()
- public void setFutureReplacementKey()
- public string getOutput()
- public void getTotalTotalSearches()
- public void showFormattedSearchTotals()
- public none startSearching()
- private void resetFileCache()
- private void getFileArray()
- private void getFlatFileArray()
- private file findExtension()
- private Boolean matchedExtension()
- private void searchFileData()
- private none writeToFile()
- private none appendToLog()
- private void addToOutput()
Members
private
- $basePath
- $caseSensitive
- $defaultIgnoreFolderArray
- $errorText
- $extensions
- $file_array
—
array
array of all the files we are searching - $findAllExts
- $flat_file_array
—
Array
Flattened array of files. - $folder_totals
- $futureReplacementKey
- $ignoreFolderArray
- $isReplacingEnabled
- $logFileLocation
- $logString
- $output
- $replacementKey
- $replacementType
- $searchKey
- $search_key_totals
- $totalFound
- $total_total
Methods
private
- addToOutput()
- appendToLog() — Appends log data to previous log data
- findExtension() — Finds extension of a file
- getFileArray() — loads all the applicable files
- getFlatFileArray()
- matchedExtension() — Checks if a file extension is one of the extensions we are going to search
- resetFileCache()
- searchFileData() — THE KEY METHOD! Searches data, replaces (if enabled) with given key, prepares log
- writeToFile() — Writes new data (after the replacement) to file
public
- __construct()
- addIgnoreFolderArray() — Sets folders to ignore @param Array ignoreFolderArray @return none
- getOutput() — returns full output and clears it.
- getTotalTotalSearches() — returns the TOTAL TOTAL number of found replacements
- setBasePath() — Sets folders to ignore @param Array ignoreFolderArray @return none
- setExtensions() — Sets extensions to look @param Array extensions
- setFutureReplacementKey() — Sets key to replace searchKey with BUT only hypothetical (no replacement takes place!) @param String $replacementKey
- setIgnoreFolderArray() — Sets folders to ignore @param Array ignoreFolderArray @return none
- setLogFileLocation() — Sets location for the log file logs are only written for real replacements @param String @return none
- setReplacementKey() — Sets key to replace searchKey with @param String $replacementKey
- setSearchKey() — Sets search key and case sensitivity
- showFormattedSearchTotals() — should be run at the end of an extension.
- startSearching() — Searches all the files and creates the logs
- unsetIgnoreFolderArray() — remove a root folder that is avoided by default