public static function initialiseSelectors() { // NOTE: I use ArrayObject here because it's iterators allow // me to dynamically add selectors whilst iterating and // obtain a new iterator at the start of the array when // processing nested plugin trees, which is very important!! self::$selectors = array("scan" => new ArrayObject(), "load" => new ArrayObject()); // If you do not load the router first, the routes will come out in reverse order :( // So you need to do this first, before processing all the child plugins which can override them self::addScanSelector("package path", "configPath"); self::addScanSelector("package router", "configRouter"); self::addScanSelector("package object", "setComponentConfig"); self::addScanSelector("package controller", "setComponentConfig"); self::addScanSelector("package model", "setComponentConfig"); self::addScanSelector("package view", "setComponentConfig"); // Create the API object first, then load the selector extensions and then all the child plugins to build the tree self::addScanSelector("package object api", "configAPI"); self::addScanSelector("package requires extension", "configExtension"); self::addScanSelector("package extension", "configExtension"); self::addScanSelector("package requires plugin", "configPlugin"); // Now add all the load selectors, now that the tree scanning has completed self::addLoadSelector("package object name", "configObject"); self::addLoadSelector("package controller name", "configController"); self::addLoadSelector("package model connection", "configModelConnection"); self::addLoadSelector("package model name", "configModel"); self::addLoadSelector("package view name", "configView"); self::addLoadSelector("package service import", "configService"); self::addLoadSelector("package service export", "configService"); self::addLoadSelector("package javascript file", "configJavascript"); self::addLoadSelector("package stylesheet file", "configStylesheet"); self::addLoadSelector("package image file", "configImage"); self::addLoadSelector("package font", "configFont"); self::addLoadSelector("package translator", "configTranslator"); self::addLoadSelector("package value", "configValue"); self::addLoadSelector("package", "configCustom"); }
public function setConfigSource($config = NULL) { // If you don't provide a configuration object, provide a default one with everything default if (!$config) { $config = new Amslib_Plugin_Config_XML(); } if ($config) { $config->setValue("location", $this->getLocation()); if ($config->getStatus()) { $this->source = $config; } else { // The configuration source was setup, however it failed to return that it was ok // This could be that the actual data source is missing? // TODO: This needs to be better than "OMG WE ARE ALL GONNA DIE!!!" $filename = $config->getValue("filename"); print __METHOD__ . ": PACKAGE FAILED TO OPEN: plugin[" . $this->getName() . "], file[{$filename}]<br/>"; } } else { // There is no valid configuration object created or requested die("NO CONFIGURATION OBJECT DETECTED"); } }