Login   Register  
PHP Classes
elePHPant
Icontem

File: e.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Jean-Georges Estiot  >  Folder bot  >  e.php  >  Download  
File: e.php
Role: ???
Content type: text/plain
Description: The example for folderbot, including a derived class.
Class: Folder bot
Scans through a folder with option to recurse
Author: By
Last change:
Date: 12 years ago
Size: 1,154 bytes
 

Contents

Class file image Download
<?
// change this to your include path
require_once("$DOCUMENT_ROOT/include/class.folderbot.php");

// The three methods in this extended class override the base class methods which don't do much.
// That's basically how you use folderbot. You get the stuff which doesn't do much in the base class to work for you

class listfolder extends folderbot
{

// uncomment below to filter
/*
function is_match()
{
return strstr($this->curfile,".txt");
	
}
*/
// Triggered by the parent class, it is called every time a file matching the filter has been found
// in this example, it prints the file which is stored in a class variable called curfile.

function file_event()
	{
	print("File event-->$this->curfile<BR>\n");
	}

// Called every time a folder is found. It just prints its name
function	folder_event()
	{
		
	print("Folder event-->$this->curfile<BR>\n");
	}
}

//here we go

$bot=new listfolder();
$bot->set_recurse(true); // set to false to only list the folder without subfolder.
$bot->scan("./"); // will scan wherever you have placed the example. make sure you have access permission there and below :)

?>