Ejemplo n.º 1
0
 /**
  * 	method:	finalisePlugin
  *
  * 	todo: write documentation
  */
 protected function finalisePlugin()
 {
     //	Load the required router library and execute it to setup everything it needs
     $this->executeRouter();
     //	Load all the javascripts and stylesheets automatically set to load into the current url
     $this->autoloadResources();
     //	Call the getLanguage method for both default translators, this is just a precautionary step.  What
     //	will happen is, if no language is set, it'll default and store the first language in the approved list
     //	meaning that both will have a correct code, we don't care about the return code here, cause it's not used
     self::getLanguage("website");
     self::getLanguage("content");
     $this->setLanguageKey();
     //	Setup all the translators in other plugins with the correct languages
     foreach (Amslib_Plugin_Manager::listPlugin() as $plugin) {
         $api = Amslib_Plugin_Manager::getAPI($plugin);
         if ($api) {
             $translators = $api->listTranslators(false);
             foreach (Amslib_Array::valid($translators) as $name => $object) {
                 //	Obtain the language the system should use when printing text
                 $object->setLanguage(Amslib_Plugin_Application::getLanguage($name));
                 $object->load();
             }
             //	Now inform all the plugins the application has loaded
             $callback = array($api, "finaliseApplication");
             if (method_exists($callback[0], $callback[1])) {
                 call_user_func($callback);
             }
         } else {
             Amslib_Debug::log("plugin list", Amslib_Plugin_Manager::listPlugin());
             Amslib_Debug::log("plugin for translator not found?", $plugin);
         }
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * 	method:	finalisePlugin
  *
  * 	todo: write documentation
  */
 protected function finalisePlugin()
 {
     $api = $this->getAPI();
     if ($api) {
         $translators = $api->listTranslators(false);
         foreach (Amslib_Array::valid($translators) as $name => $object) {
             if (!$object) {
                 Amslib_Debug::log("we found a translator which was not valid", $name, $object);
                 continue;
             }
             //	Obtain the language the system should use when printing text
             $object->setLanguage(Amslib_Plugin_Application::getLanguage($name));
             $object->load();
         }
         $api->finalise();
     } else {
         Amslib_Debug::log("plugin not found?", $api);
     }
 }