/**
  * static method that returns a single instance of this class. 
  *
  * @static
  * @param path If the object is being created for the first time, this will be passed to the constructor
  * of the class as the first parameter. If a class instance already exists, this path will be added to the
  * list of already existing paths to scan.
  * @return a ResourceClassLoader object
  */
 function &getLoader($path = null)
 {
     static $instance;
     if ($instance == null) {
         // create an instance if it does not exist yet...
         $instance = new ResourceClassLoader();
     }
     // if a path is given and the object already exists, then
     // we can also automatically add it to the list of searched folders...
     if ($path != null) {
         $instance->addSearchFolder($path);
     }
     return $instance;
 }
 /**
  * Loads all the plugins from disk
  *
  * @private
  */
 function loadPlugins()
 {
     $classLoader =& ResourceClassLoader::getLoader();
     foreach ($this->_pluginList as $plugin) {
         $pluginFile = "./plugins/{$plugin}";
         if (File::isDir($pluginFile)) {
             // build up the name of the file
             $pluginFileName = "plugin{$plugin}.class.php";
             $pluginFullPath = PLOG_CLASS_PATH . "{$pluginFile}/{$pluginFileName}";
             // and try to include it
             if (File::isReadable($pluginFile . "/" . $pluginFileName)) {
                 $className = "Plugin" . $plugin;
                 include_once $pluginFullPath;
                 $classInstance = new $className();
                 $name = $classInstance->getId();
                 $classInstance->setPluginFolder(PLOG_CLASS_PATH . $pluginFile . "/");
                 // tell the resource loader that it should try to load actions from this folder
                 $classLoader->addSearchFolder(PLOG_CLASS_PATH . "{$pluginFile}/class/action/");
                 if ($name == "") {
                     throw new Exception("Plugin file {$pluginFile} has no identifier defined!");
                     die;
                 }
                 $this->_pluginInstances["{$plugin}"] = $classInstance;
             }
         }
     }
     return true;
 }
 /**
  * $ActionsMap is an associative array of the form:
  *
  * ( $actionName, $actionClassName )
  *
  * Where for every different possible value of the 'action' parameter in the request,
  * there is an object inheriting form the Action class that will take care of
  * that requested action.
  *
  * @param actionMap is the associative array with the mappings
  * @param actionParam is the name of the parameter in the request that will be used
  * @param loadActionClasses By default set to 'true', enables dynamic loading of the
  * action classes from disk. Set it to false if the action classes that are going
  * to be needed by the controller have already been loaded and there is no need to
  * do it again.
  * to identify the action to be taken
  */
 function Controller($actionMap, $actionParam = DEFAULT_ACTION_PARAM)
 {
     $this->Object();
     global $_plogController_actionMap;
     if (!is_array($_plogController_actionMap)) {
         $_plogController_actionMap = array();
     }
     $_plogController_actionMap = $actionMap;
     $this->_actionParam = $actionParam;
     $this->_forwardAction = null;
     // default folder where actions are located
     $this->actionFolderPath = PLOG_CLASS_PATH . 'class/action/';
     // get a resource loader so that we can dynamically load classes if they
     // have not been loaded yet!
     $this->_loader =& ResourceClassLoader::getLoader($this->actionFolderPath);
 }