PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of David Bittencourt   phpPlugin   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: phpPlugin
Dynamically extend a PHP class using plug-ins
Author: By
Last change: Uptaded with "Force Reload"
Date: 18 years ago
Size: 1,084 bytes


Class file image Download

// Example file for phpPlugin

require "plugin.class.php";

// Class that will be extended with new plugins
class foo
$this->good = $str;


// Plugin object that will manage all the plugin requests in this script
// The path to the plugins is set 'plugins/'
$plugin = new phpPlugin('plugins/');

// Class that will be extended with new plugins
$foo = new foo();

// Sets the filename format for the plugins 'foo'
// The plugin name will replace the character '?'
// The filename will be modified with the function 'strtolower' passed as parameter
$plugin->set_filename("?.func.php", "foo", "strtolower");

// Loads the plugin
// The filename must be 'plugins/'
$class = $plugin->load("bar", $foo, "foo");

// Try to load again
$newclass = $plugin->load("bar", $foo, "foo");

"Already loaded."; // this will show up

// But you can force the script to reload the plugin and replace it
$newclass = $plugin->load("bar", $foo, "foo", true);