Moved internal modules to the new module namespace.
Most of them have an alias starting with techfuze/ for backwards compatibility until #74 has been resolved. Resolves #68
This commit is contained in:
parent
064adfe1c2
commit
d2ec5b0c2a
|
@ -9,10 +9,11 @@ return array(
|
|||
'dependencies' => array(),
|
||||
'events' => array(),
|
||||
'sections' => array(),
|
||||
'aliases' => array(),
|
||||
|
||||
'name' => 'FuzeWorks Api Module',
|
||||
'description' => 'A Controller server for multiple types of API\'s like REST and SOAP',
|
||||
'author' => 'TechFuze',
|
||||
'author' => 'core',
|
||||
'version' => '1.0.0',
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
||||
|
|
|
@ -38,10 +38,11 @@ return array(
|
|||
'dependencies' => array(),
|
||||
'events' => array(),
|
||||
'sections' => array(),
|
||||
'aliases' => array('techfuze/database'),
|
||||
|
||||
'name' => 'FuzeWorks Database Module',
|
||||
'description' => 'PDO Wrapper class for FuzeWorks',
|
||||
'author' => 'TechFuze',
|
||||
'author' => 'core',
|
||||
'version' => '1.0.0',
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
||||
|
|
|
@ -6,13 +6,14 @@ return array(
|
|||
'module_name' => 'DatabaseUtils',
|
||||
|
||||
'abstract' => false,
|
||||
'dependencies' => array('techfuze/database'),
|
||||
'dependencies' => array('core/database'),
|
||||
'events' => array(),
|
||||
'sections' => array(),
|
||||
'aliases' => array('techfuze/databaseutils'),
|
||||
|
||||
'name' => 'FuzeWorks Database Utilities',
|
||||
'description' => 'Automatically build SQL queries using methods in this class',
|
||||
'author' => 'TechFuze',
|
||||
'author' => 'core',
|
||||
'version' => '1.0.0',
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
namespace Module\Example;
|
||||
use \FuzeWorks\Module;
|
||||
use \FuzeWorks\Event;
|
||||
use \FuzeWorks\EventPriority;
|
||||
|
||||
/**
|
||||
* Example module.
|
||||
|
@ -43,10 +45,13 @@ class Main extends Module {
|
|||
|
||||
/**
|
||||
* Loads the module and registers the events
|
||||
*
|
||||
* Every main moduleclass needs an onLoad method. This method is called first before anything else and cam be used to do some global actions.
|
||||
* @access public
|
||||
*/
|
||||
public function onLoad() {
|
||||
// Do Something
|
||||
// Here we register an eventListener for the ExampleEvent. See ExampleListener for more info
|
||||
$this->events->addListener(array($this, 'exampleListener'), 'ExampleEvent', EventPriority::NORMAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,6 +62,58 @@ class Main extends Module {
|
|||
return "It works!";
|
||||
}
|
||||
|
||||
/**
|
||||
* An example listener that introduces you to the basics of event handling
|
||||
* @param ExampleEvent $event The event to listen for
|
||||
* @return ExampleEvent The event after it has been handled
|
||||
*/
|
||||
public function exampleListener($event) {
|
||||
$this->logger->log("Called the eventListener. This listener can now handle the event and change some data");
|
||||
// For this listener, we only change one variable
|
||||
$event->setVariable("New Value");
|
||||
|
||||
// And then we return it
|
||||
return $event;
|
||||
}
|
||||
|
||||
/**
|
||||
* In this example we create a simple event. This event will be created, passed around and then received in the example listener.
|
||||
*/
|
||||
public function createEvent() {
|
||||
// First we log some data
|
||||
$this->logger->log("Now creating a test event.");
|
||||
|
||||
// First we create the event object and some variables to assign to it
|
||||
$eventObject = new ExampleEvent();
|
||||
$variable = "Test Variable";
|
||||
|
||||
// Then we fire the event by parsing the event object and the variables into the fireEvent function.
|
||||
$event = $this->events->fireEvent($eventObject, $variable);
|
||||
|
||||
// Here we can read some variables from the event
|
||||
$result = $event->getVariable();
|
||||
|
||||
// And now we can do things with the data. For now we just return it
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class ExampleEvent extends Event {
|
||||
|
||||
private $var1;
|
||||
|
||||
public function init($variable) {
|
||||
$this->var1 = $variable;
|
||||
}
|
||||
|
||||
public function getVariable() {
|
||||
return $this->var1;
|
||||
}
|
||||
|
||||
public function setVariable($var) {
|
||||
$this->var1 = $var;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -30,24 +30,48 @@
|
|||
|
||||
return array(
|
||||
|
||||
// The class name of the module. This class will be loaded upon requesting the module
|
||||
'module_class' => 'Module\Example\Main',
|
||||
|
||||
// The file that will be loaded upon requesting the module
|
||||
'module_file' => 'class.main.php',
|
||||
|
||||
// The name of the module. When the module is loaded it can be called throughout the framework with $this->mods->example;
|
||||
'module_name' => 'Example',
|
||||
|
||||
// Wether this module is an abstract. Making this abstract will only load the file, but not the class.
|
||||
'abstract' => false,
|
||||
'aliases' => array('techfuze/example'),
|
||||
'dependencies' => array(),
|
||||
'events' => array(),
|
||||
'sections' => array(),
|
||||
|
||||
// Other names for this module. Setting an alias will allow you to load the module with a different name.
|
||||
'aliases' => array('techfuze/example'),
|
||||
|
||||
// Array of modules that should be loaded before this module
|
||||
'dependencies' => array(),
|
||||
|
||||
// Events that this module listens for. When the exampleEvent is fired, this module will be loaded so the module can handle the event
|
||||
'events' => array('exampleEvent'),
|
||||
|
||||
// The name of the module as it will be logged. This does not affect usage of the module in any way
|
||||
'name' => 'FuzeWorks Example Module',
|
||||
|
||||
// A description of the module.
|
||||
'description' => 'A descriptive module that functions as an example',
|
||||
|
||||
// The author of the module. The author is the first part of the module name used for requesting. eg mycorp/example
|
||||
'author' => 'MyCorp',
|
||||
|
||||
// The current version of the module. Will be used for looking for updates
|
||||
'version' => '1.0.0',
|
||||
|
||||
// The website to look at for the module update
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
||||
// The initial creation of the module.
|
||||
'date_created' => '29-04-2015',
|
||||
|
||||
// The last update of this module
|
||||
'date_updated' => '29-04-2015',
|
||||
|
||||
// Wether the module is enabled or not. If it is disabled, it can not be loaded.
|
||||
'enabled' => true
|
||||
);
|
||||
|
|
|
@ -35,10 +35,11 @@ return array(
|
|||
'module_name' => 'Mailer',
|
||||
|
||||
'dependencies' => array(),
|
||||
'aliases' => array('techfuze/mailer'),
|
||||
|
||||
'name' => 'Mailer',
|
||||
'description' => 'PHPMailer wrapper for FuzeWorks',
|
||||
'author' => 'TechFuze',
|
||||
'author' => 'core',
|
||||
'version' => '1.0.0',
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
||||
|
|
Loading…
Reference in New Issue