コード例 #1
0
 /**
  * Register the plugin.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     $this->addLocaleData();
     return $success;
 }
コード例 #2
0
 function manage($verb, $args)
 {
     switch ($verb) {
         case 'fetchArchiveInfo':
             // The user has requested that the archive form be filled out given
             // the OAI URL.
             $harvesterUrl = Request::getUserVar('harvesterUrl');
             $archiveId = (int) array_shift($args);
             $archiveDao =& DAORegistry::getDAO('ArchiveDAO');
             $archive =& $archiveDao->getArchive($archiveId);
             $this->import('OAIHarvester');
             $oaiHarvester = new OAIHarvester($archive);
             $metadata = $oaiHarvester->getMetadata($harvesterUrl, Request::getUserVar('isStatic'));
             import('admin.form.ArchiveForm');
             $archiveForm = new ArchiveForm($archiveId);
             $archiveForm->initData();
             $archiveForm->readInputData();
             $metadataMap = array('repositoryName' => 'title', 'adminEmail' => 'adminEmail', 'description' => 'description');
             if ($metadata === false) {
                 foreach ($oaiHarvester->getErrors() as $error) {
                     $archiveForm->addError('harvesterUrl', $error);
                 }
             } else {
                 foreach ($metadata as $name => $value) {
                     $archiveForm->setData($name, $value);
                 }
             }
             $archiveForm->display();
             return true;
     }
     return HarvesterPlugin::manage($verb, $args);
 }