$d =
dir('plugins');
$somevar =
"yaay, it works!";
while (($entry =
$d->
read()) !=
false) {
// make sure the file isn't the current dir or the parent dir
if ($entry !=
"." &&
$entry !=
"..") {
// get the class name from the file name
$class =
str_replace(".php",
"",
$entry);
// include the plugin
include 'plugins/' .
$entry;
$instance =
new $class();
// now we can call anything in that class if it exists!
$instance->
invokeSomething($somevar);
}
}