/** * method: getFullURL * * todo: write documentation */ public static function getFullURL() { return Amslib_Website::relative(Amslib_Router::getPath()); }
/** * method: expandPath * * todo: write documentation */ public static function expandPath($path) { // NOTE: this doesn't happen anymore, I think I got rid of this idea because it was never used // Loop through all the paths given in the htaccess file and attempt to replace them foreach (Amslib_Router::listPaths() as $key) { $path = str_replace($key, Amslib_Router::getPath($key), $path); } return Amslib_Website::expandPath($path); }
public static function processExport() { foreach (self::$export as $key => $list) { foreach ($list as $name => $value) { $src = is_string($value["src"]) ? self::getPlugin($value["src"]) : $value["src"]; $dst = is_string($value["dst"]) ? self::getPlugin($value["dst"]) : $value["dst"]; $data = false; if (!$src || !$dst) { $sname = is_object($src) ? $src->getName() : "searched: {$value["src"]}"; $dname = is_object($dst) ? $dst->getName() : "searched: {$value["dst"]}"; Amslib_Debug::log("plugin list", Amslib_Plugin_Manager::listPlugin()); Amslib_Debug::log("plugin invalid", intval(is_object($src)) . ", " . intval(is_object($dst)), $sname, $dname, Amslib_Router::getPath()); continue; } switch ($value["key"]) { case "stylesheet": case "javascript": case "font": die("[DIE]EXPORT[{$key}] => " . Amslib_Debug::pdump(true, array($src->getName(), $dst->getName(), $value["key"], $value["val"]))); break; case "view": case "value": // NOTE: if I could change getValue to this, I could refactor all of these branches // together maybe into something very generic // NOTE: the new import/export system works slightly differently from the old one, // we push directly into the import/export queues the information that we // want to pass and it doesn't enter the host plugin, this way, we can skip // a lot of bullshit with regard to internal data and data which is destined // for other plugins, the getValue method should in this case, circumstantially // create objects or just parse the data out of the structure, but it's not // about "getting" the value from the pluing, the $value variable already has // it and in many cases we don't need to do anything except return a particular // key depending on the stucture or type of that data, but in the case of // translators, objects or models, we need to ask the host plugin to create // the object on our behalf and then return and use it, because it might be // that the host plugin is the only plugin which has the correct functionality // necessary to create that object, in these cases getValue will do more than // just return a particular key, but will actually process the input data into // an "output data" to use //$data = $src->getValue($value); $dst->setValue($value["key"], $value["val"]); break; case "service": //Amslib_FirePHP::output("export",$item); // Hmmm, I need a test case cause otherwise I won't know if this works break; case "image": $dst->setValue($value["key"], $value["val"]); break; // We do nothing special with these entries, we simply pass them // We do nothing special with these entries, we simply pass them case "model": case "translator": default: // NOTE: I should change $value["key"] here to $value and make "key" something getValue uses internally $data = $src->getValue($value["key"]); $dst->setValue($value["key"], $data); break; } } } self::$export = NULL; }