Esempio n. 1
0
 public static function processImport()
 {
     foreach (self::$import as $key => $list) {
         foreach ($list as $value) {
             $src = self::getPlugin($value["src"]);
             $dst = is_string($value["dst"]) ? self::getPlugin($value["dst"]) : $value["dst"];
             $data = false;
             if (!$src || !$dst) {
                 $sname = ($ts = is_object($src)) ? $src->getName() : "searched: {$value["src"]}";
                 $dname = ($td = is_object($dst)) ? $dst->getName() : "searched: {$value["dst"]}";
                 Amslib_Debug::log(self::PLUGIN_INVALID, intval($ts), intval($ts), $sname, $dname);
                 continue;
             }
             switch ($value["key"]) {
                 //	The new package format has upgraded a lot of things, these are the non-so-used
                 //	upgrades which havent needed upgrading yet, so I've left them until I have more time.
                 case "view":
                 case "stylesheet":
                 case "javascript":
                 case "font":
                     $message = "[DIE]IMPORT[{$key}] => " . Amslib_Debug::pdump(true, array($src->getName(), $dst->getName(), $value["key"], $value["val"]));
                     Amslib_Debug::log($message);
                     die($message);
                     break;
                 case "translator":
                     $data = $src->getValue($value["key"], $value["val"]["name"]);
                     $dst->setValue($value["key"], $data);
                     break;
                 case "service":
                     /*
                      //	TODO	we are processing an xml block named "service" but allowing the service to be a route????
                     //	FIXME:	this is obviously f*****g stupid....perhaps the block should be called "router" or done
                     //			a different way, because this is obviously not the right way
                     $r = $item["service"] == "true"
                     ? Amslib_Router::getService($item["name"],$item["plugin"])
                     : Amslib_Router::getRoute($item["name"],$item["plugin"]);
                     
                     Amslib_Router::setRoute($item["rename"],$this->getName(),NULL,$r,false);
                     
                     //	the following parameters are available
                     //
                     //	plugin, name, service, rename
                     //		plugin => src plugin to obtain service from
                     //		name => the service to obtain
                     //		service => whether it's a service or path route
                     //		rename => the local name to store the copy in
                     */
                     break;
                     //	We do nothing special with these entries, we simply pass them
                 //	We do nothing special with these entries, we simply pass them
                 case "value":
                 case "image":
                     //case "model":
                 //case "model":
                 default:
                     //	NOTE: why do I not use $value["val"]["name"] here? like I do with translators?
                     $data = $src->getValue($value["key"]);
                     $dst->setValue($value["key"], $data);
                     break;
                 case "model":
                     //	NOTE: why do I not use $value["val"]["name"] here? like I do with translators?
                     $data = $src->getValue($value["key"]);
                     $dst->setValue($value["key"], $data);
                     break;
             }
         }
     }
     self::$import = NULL;
 }