Source for file glmodule.php
Documentation is available at glmodule.php
* GloryLands Extendions System
* Module information system
* GloryLands, a Web-Based, Massive Multiplayer Online RPG/Strategy Game
* Copyright (C) 2008-09 John Haralampidis <jïhnys2[at]gmail.cïm>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* For any help/suggestions or troubleshooting you can see the
* project community website at <http://www.glorylands.gr>
* @license GNU/GPLv3 GNU General Public License version 3
* @author John Haralampidis <jïhnys2[at]gmail.cïm>
* @copyright Copyright (C) 2007-2009, John Haralampidis
* GloryLands Extension Module
* This class provides access to the module information
$this->url = 'modules/'. $name;
if (!is_dir($this->root)) return false;
// Cannot load optimizer?
GLError::log('extensions', 'Cannot load an XMLConfig optimizer! Un-onptimized config parsing will be used. This will might decrease performance', GLError::WARNING);
$this->config = include($config);
// Prepare the array that will hold the names of
// all of our PHP classes (used by GLModule::of()
// in order to find out the parent GLModule)
// Include all the external files
if (isset ($this->config['provide'])) {
// Make sure provide units is an array, even if it's only one
if (!isset ($this->config['provide'][0]['unit'][0])) $this->config['provide'][0]['unit']= array($this->config['provide'][0]['unit']);
foreach ($this->config['provide'][0]['unit'] as $unit) {
// Check for server file to include
if (isset ($unit['server'])) {
include_once($this->root. '/'. $unit['server'][0]['file']);
$classes[] = $unit['server'][0]['class'];
// Check for client file to include
if (isset ($unit['client'])) {
GL::$stream->headers['js'][] = $this->url. '/'. $unit['client'][0]['file'];
// Store the configuration of this unit (For quick fetching from $this->get_config_for()
// Register this instance on the static store
if (!GLModules::$cache) GLModules::$cache= array();
GLModules::$cache[$this->name] = array(
$name = get_class($object);
if (!isset ($this->unitconfig[$name])) return false;
public function call($call, $vars) {
|