addLocaleData(); if ($this->getEnabled()) { Hook::add('OAI::metadataFormats', [$this, 'callback_formatRequest']); } return true; } /** * Get the metadata prefix for this plugin's format. */ public static function getMetadataPrefix() { assert(false); // Should always be overridden } public static function getSchema() { return ''; } public static function getNamespace() { return ''; } /** * Get a hold of the class that does the formatting. */ abstract public function getFormatClass(); public function callback_formatRequest($hookName, $args) { $namesOnly = $args[0]; $identifier = $args[1]; $formats = & $args[2]; if ($namesOnly) { $formats = array_merge($formats, [$this->getMetadataPrefix()]); } else { $formatClass = $this->getFormatClass(); $formats = array_merge( $formats, [$this->getMetadataPrefix() => new $formatClass($this->getMetadataPrefix(), $this->getSchema(), $this->getNamespace())] ); } return false; } } if (!PKP_STRICT_MODE) { class_alias('\PKP\plugins\OAIMetadataFormatPlugin', '\OAIMetadataFormatPlugin'); }