/** * method: getRouteParam * * todo: write documentation */ public static function getRouteParam($name = NULL, $default = "") { return Amslib_Router::getRouteParam($name, $default); }
/** * method: autoloadResources * * todo: write documentation */ protected function autoloadResources() { // STEP 1: Autoload all resources from each plugin as they are requested foreach (Amslib_Plugin_Manager::listPlugin() as $name) { $p = Amslib_Plugin_Manager::getAPI($name); if ($p) { $p->autoloadResources(); } else { Amslib_Debug::log("plugin not found?", $p); } } $default = Amslib_Router::getRouteParam("plugin"); $route = Amslib_Router::getRoute(); // STEP 2: Autoload all resources which are bound the current route. // hack into place the adding or removing of all the stylesheets and javascripts foreach (Amslib_Array::valid(Amslib_Router::getJavascript()) as $j) { // datatables does't load because it's trying with the wrong plugin $name = isset($j["plugin"]) ? str_replace("__CURRENT_PLUGIN__", $route["group"], $j["plugin"]) : $default; $plugin = Amslib_Plugin_Manager::getAPI($name); if ($plugin) { if (isset($j["remove"])) { Amslib_Resource::removeJavascript($j["value"]); } else { $plugin->addJavascript($j["value"]); } } } foreach (Amslib_Array::valid(Amslib_Router::getStylesheet()) as $c) { $name = isset($c["plugin"]) ? str_replace("__CURRENT_PLUGIN__", $route["group"], $c["plugin"]) : $default; $plugin = Amslib_Plugin_Manager::getAPI($name); if ($plugin) { if (isset($c["remove"])) { Amslib_Resource::removeStylesheet($c["value"]); } else { $plugin->addStylesheet($c["value"]); } } } }