/** * Get an extension by Id. If the extension is not yet loaded, it will be * loaded using common_ext_Extension::load. * * @access public * @author Joel Bout, <*****@*****.**> * @param string id The id of the extension. * @return common_ext_Extension A common_ext_Extension instance or null if it does not exist. * @throws common_ext_ExtensionException If the provided id is empty. */ public function getExtensionById($id) { if (!is_string($id) || strlen($id) == 0) { throw new common_ext_ExtensionException('No id specified for getExtensionById()'); } if (!isset($this->extensions[$id])) { $ext = new common_ext_Extension($id, false); // loads the extension if it hasn't been loaded yet $ext->load(); // if successfully loaded add to list $this->extensions[$id] = $ext; } return $this->extensions[$id]; }