Esempio n. 1
0
 public function configPlugin($name, $array, $object)
 {
     if ($this->getName() == $array["value"]) {
         return;
     }
     $a = $array["attr"];
     $alias = isset($a["alias"]) ? $a["alias"] : NULL;
     if ($alias) {
         Amslib_Plugin_Manager::setPluginAlias($array["value"], $alias);
     }
     $replace = isset($a["replace"]) ? $a["replace"] : NULL;
     if ($replace) {
         Amslib_Plugin_Manager::setPluginReplace($replace, $array["value"]);
     }
     //	NOTE: we should deprecate "prevent" in favour of "block" in the future
     $prevent = isset($a["prevent"]) ? $a["prevent"] : NULL;
     $block = isset($a["block"]) ? $a["block"] : NULL;
     if ($prevent || $block) {
         Amslib_Plugin_Manager::setPluginBlock($array["value"]);
     }
     //	Only process plugins which have no replace or prevent instructions,
     //	these are instructions about loading, not instructions to ACTUALLY load
     if ($prevent || $block || $replace) {
         return;
     }
     //	If the plugin is already created, don't attempt to configure or load it again
     $plugin = Amslib_Plugin_Manager::getPlugin($array["value"]);
     if ($plugin) {
         return;
     }
     try {
         //	Since this plugin is not replaced, nor prevented from loading, lets load it!!
         $location = $this->getLocation();
         $plugin = Amslib_Plugin_Manager::config($array["value"], $location);
     } catch (Exception $e) {
         Amslib_Debug::log("Exception occured whilst configuring plugin, message = ", $e->getMessage());
     }
     if ($plugin) {
         $this->data["requires"][$array["value"]] = $plugin;
     } else {
         Amslib_Debug::log("PLUGIN LOAD FAILURE: " . $array["value"], $location);
     }
 }
Esempio n. 2
0
 /**
  * 	method:	getPlugin
  *
  * 	todo: write documentation
  */
 public function getPlugin($name = NULL)
 {
     return $name ? Amslib_Plugin_Manager::getPlugin($name) : $this->plugin;
 }