PHP Classes

File: usage.php

Recommend this page to a friend!
  Classes of Rupom Razzaque   Text Search Replace   usage.php   Download  
File: usage.php
Role: Example script
Content type: text/plain
Description: Example Usage
Class: Text Search Replace
Search files and replace their content
Author: By
Last change: Need to change my blog URL
Date: 16 years ago
Size: 1,040 bytes
 

Contents

Class file image Download
<?php
/**
* 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
*
* @version : 1.0
* Date : 06/25/2006
* Purpose : Searching and replacing text within files of specified path
*/

require_once('TextSearch.class.php');

$path = "/projects/rupom/Recent_FDD/Very_Imps"; //setting search path
$logFile = "/projects/rupom/test_search/searchResult.txt"; //setting log file
 
$obj = new TextSearch();
$obj->setExtensions(array('html','txt')); //setting extensions to search files within
$obj->addExtension('php');//adding an extension to search within
$obj->setSearchKey('PHP');
$obj->setReplacementKey('phpResource');//setting replacement text if you want to replace matches with that
$obj->startSearching($path);//starting search
$obj->showLog();//showing log
$obj->writeLogToFile($logFile); //writting result to log file

?>