Exemple #1
0
 /**
  * Constructor.
  */
 function OAIDAO()
 {
     parent::DAO();
     $this->archiveDao =& DAORegistry::getDAO('ArchiveDAO');
     $this->recordDao =& DAORegistry::getDAO('RecordDAO');
     PluginRegistry::loadCategory('schemas');
 }
 /**
  * @copydoc Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $this->getContextId());
     $templateMgr->assign(array('pubIdPlugins' => $pubIdPlugins, 'pubObject' => $this->getPubObject(), 'approval' => $this->getApproval(), 'confirmationText' => $this->getConfirmationText()));
     return parent::fetch($request);
 }
Exemple #3
0
 /**
  * Constructor.
  * @param $archiveId omit for a new archive
  */
 function ArchiveForm($archiveId = null, $allowManagement = false)
 {
     parent::Form('admin/archiveForm.tpl');
     $this->archiveId = isset($archiveId) ? (int) $archiveId : null;
     $this->allowManagement = $allowManagement;
     // Validation checks for this form
     $this->addCheck(new FormValidator($this, 'title', 'required', 'admin.archives.form.titleRequired'));
     $this->addCheck(new FormValidator($this, 'url', 'required', 'admin.archives.form.urlRequired'));
     $this->addCheck(new FormValidatorPost($this));
     $this->captchaEnabled = Config::getVar('captcha', 'captcha_on_submit') && Config::getVar('captcha', 'recaptcha');
     if ($this->captchaEnabled && !Validation::isSiteAdmin()) {
         $this->addCheck(new FormValidatorReCaptcha($this, 'recaptcha_challenge_field', 'recaptcha_response_field', Request::getRemoteAddr(), 'common.captchaField.badCaptcha'));
     }
     $this->harvesterPluginName = Request::getUserVar('harvesterPluginName');
     if ($archiveId) {
         $archiveDao = DAORegistry::getDAO('ArchiveDAO');
         $this->archive =& $archiveDao->getArchive($this->archiveId, false);
         if (empty($this->harvesterPluginName) && $this->archive) {
             $this->harvesterPluginName = $this->archive->getHarvesterPluginName();
         }
     }
     if (empty($this->harvesterPluginName)) {
         $site =& Request::getSite();
         $this->harvesterPluginName = $site->getSetting('defaultHarvesterPlugin');
     }
     $this->harvesters =& PluginRegistry::loadCategory('harvesters');
     HookRegistry::call('ArchiveForm::ArchiveForm', array(&$this, $this->harvesterPluginName));
 }
Exemple #4
0
 /**
  * Get a public ID for this galley.
  * @param $pubIdType string One of the NLM pub-id-type values or
  * 'other::something' if not part of the official NLM list
  * (see <http://dtd.nlm.nih.gov/publishing/tag-library/n-4zh0.html>).
  * @param $preview boolean If true, generate a non-persisted preview only.
  */
 function getPubId($pubIdType, $preview = false)
 {
     // FIXME: Move publisher-id to PID plug-in.
     if ($pubIdType === 'publisher-id') {
         $pubId = $this->getStoredPubId($pubIdType);
         return $pubId ? $pubId : null;
     }
     // Retrieve the article.
     $articleDao = DAORegistry::getDAO('ArticleDAO');
     /* @var $articleDao ArticleDAO */
     $article = $articleDao->getById($this->getArticleId(), null, true);
     if (!$article) {
         return null;
     }
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true, $article->getJournalId());
     foreach ($pubIdPlugins as $pubIdPlugin) {
         if ($pubIdPlugin->getPubIdType() == $pubIdType) {
             // If we already have an assigned ID, use it.
             $storedId = $this->getStoredPubId($pubIdType);
             if (!empty($storedId)) {
                 return $storedId;
             }
             return $pubIdPlugin->getPubId($this, $preview);
         }
     }
     return null;
 }
Exemple #5
0
 /**
  * Constructor
  * @param $plugin MedraExportPlugin
  * @param $contextId integer
  */
 function MedraSettingsForm($plugin, $contextId)
 {
     $this->_contextId = $contextId;
     $this->_plugin = $plugin;
     parent::Form($plugin->getTemplatePath() . 'settingsForm.tpl');
     // DOI plugin settings action link
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
     if (isset($pubIdPlugins['doipubidplugin'])) {
         $application = PKPApplication::getApplication();
         $request = $application->getRequest();
         $dispatcher = $application->getDispatcher();
         import('lib.pkp.classes.linkAction.request.AjaxModal');
         $doiPluginSettingsLinkAction = new LinkAction('settings', new AjaxModal($dispatcher->url($request, ROUTE_COMPONENT, null, 'grid.settings.plugins.SettingsPluginGridHandler', 'manage', null, array('plugin' => 'doipubidplugin', 'category' => 'pubIds')), __('plugins.importexport.common.settings.DOIPluginSettings')), __('plugins.importexport.common.settings.DOIPluginSettings'), null);
         $this->setData('doiPluginSettingsLinkAction', $doiPluginSettingsLinkAction);
     }
     // Add form validation checks.
     $this->addCheck(new FormValidator($this, 'registrantName', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.registrantNameRequired'));
     $this->addCheck(new FormValidator($this, 'fromCompany', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.fromCompanyRequired'));
     $this->addCheck(new FormValidator($this, 'fromName', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.fromNameRequired'));
     $this->addCheck(new FormValidatorEmail($this, 'fromEmail', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.fromEmailRequired'));
     $this->addCheck(new FormValidatorInSet($this, 'exportIssuesAs', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.exportIssuesAs', array(O4DOI_ISSUE_AS_WORK, O4DOI_ISSUE_AS_MANIFESTATION)));
     $this->addCheck(new FormValidatorInSet($this, 'publicationCountry', FORM_VALIDATOR_REQUIRED_VALUE, 'plugins.importexport.medra.settings.form.publicationCountry', array_keys($this->_getCountries())));
     // The username is used in HTTP basic authentication and according to RFC2617 it therefore may not contain a colon.
     $this->addCheck(new FormValidatorRegExp($this, 'username', FORM_VALIDATOR_OPTIONAL_VALUE, 'plugins.importexport.medra.settings.form.usernameRequired', '/^[^:]+$/'));
     $this->addCheck(new FormValidatorPost($this));
 }
 /**
  * @see MetadataDataObjectAdapter::extractMetadataFromDataObject()
  * @param $monograph Monograph
  * @return MetadataDescription
  */
 function extractMetadataFromDataObject($monograph)
 {
     assert(is_a($monograph, 'Monograph'));
     AppLocale::requireComponents(LOCALE_COMPONENT_APP_COMMON);
     // Retrieve data that belongs to the publication format.
     $oaiDao = DAORegistry::getDAO('OAIDAO');
     /* @var $oaiDao OAIDAO */
     $publishedMonographDao = DAORegistry::getDAO('PublishedMonographDAO');
     $chapterDao = DAORegistry::getDAO('ChapterDAO');
     $monograph = $publishedMonographDao->getById($monograph->getId());
     $press = $oaiDao->getPress($monograph->getPressId());
     $description = $this->instantiateMetadataDescription();
     // Update status
     // Is communicated via an attribute, so property value is empty
     $description->addStatement('administrative_data/delivery/update_status[@type="urn_new"]', "");
     $urn = "";
     $scheme = "";
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds');
     if (isset($pubIdPlugins) && array_key_exists('URNDNBPubIdPlugin', $pubIdPlugins) && $pubIdPlugins['URNDNBPubIdPlugin']->getEnabled() == true) {
         $urn = $pubIdPlugins['URNDNBPubIdPlugin']->getPubId($monograph);
         $namespaces = explode(':', $urn);
         $numberOfNamespaces = min(sizeof($namespaces), 3);
         $scheme = implode(":", array_slice($namespaces, 0, $numberOfNamespaces));
     }
     // URN
     $description->addStatement('record/identifier', $urn . ' [@scheme="' . $scheme . '"]');
     // URL
     $url = Request::url($press->getPath(), 'catalog', 'book', array($monograph->getId()));
     $description->addStatement('record/resource/identifier[@scheme="url", @type="frontpage", @role="primary"]', $url);
     // URL Mime type
     $description->addStatement('record/resource/format[@scheme="imt"]', "text/html");
     return $description;
 }
Exemple #7
0
 /**
  * Test locales.
  */
 function execute()
 {
     // Flush the file cache just to be certain we're using
     // the most recent stuff
     import('cache.CacheManager');
     $cacheManager =& CacheManager::getManager();
     $cacheManager->flush('locale');
     // Load plugins so that their locale data is included too
     $plugins = array();
     foreach (PluginRegistry::getCategories() as $category) {
         echo "Loading plugin category \"{$category}\"...\n";
         $morePlugins = PluginRegistry::loadCategory($category);
         if (is_array($morePlugins)) {
             $plugins += $morePlugins;
         }
     }
     foreach (Locale::getAllLocales() as $locale => $name) {
         if (!empty($this->locales) && !in_array($locale, $this->locales)) {
             continue;
         }
         if ($locale != MASTER_LOCALE) {
             echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n";
             $this->testLocale($locale, MASTER_LOCALE, $plugins);
             $this->testEmails($locale, MASTER_LOCALE);
         }
     }
 }
 /**
  * Harvest archives.
  *
  * NB: This handler method is meant to be called by the parallel
  * processing framework (see ProcessDAO::spawnProcesses()). Executing
  * this handler in parallel will significantly improve harvesting
  * performance.
  *
  * The 'harvesting_checking_max_processes' config parameter limits
  * the number of parallel processes that can be started in parallel.
  *
  * @param $args array
  * @param $request PKPRequest
  */
 function harvest($args, $request)
 {
     // This is potentially a long running request. So
     // give us unlimited execution time.
     ini_set('max_execution_time', 0);
     // Get the process id.
     $processId = $args['authToken'];
     // Run until all archives have been harvested.
     $processDao = DAORegistry::getDAO('ProcessDAO');
     $archiveDao = DAORegistry::getDAO('ArchiveDAO');
     $plugins = PluginRegistry::loadCategory('harvesters');
     do {
         // Check that the process lease has not expired.
         $continue = $processDao->canContinue($processId);
         if ($continue) {
             $process = $processDao->getObjectById($processId);
             $archive = $archiveDao->getNextFlaggedArchive($request, $processId);
             if (!$archive) {
                 $continue = false;
             } else {
                 $plugin = $plugins[$archive->getHarvesterPluginName()];
                 $plugin->updateIndex($archive, $process->getAdditionalData());
             }
         }
     } while ($continue);
     // Free the process slot.
     $processDao->deleteObjectById($processId);
     // This request returns just a (private) status message.
     return 'Done!';
 }
Exemple #9
0
 function index()
 {
     $this->validate();
     PluginRegistry::loadCategory('schemas');
     $oai = new ArchiveOAI(new OAIConfig(Request::getRequestUrl(), Config::getVar('oai', 'repository_id')));
     $oai->execute();
 }
 /**
  * Fetch the HTML contents of the form.
  * @param $request PKPRequest
  * return string
  */
 function fetch($request)
 {
     $monograph = $this->getMonograph();
     $press = $request->getPress();
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign('submissionId', $monograph->getId());
     $templateMgr->assign('representationId', (int) $this->getPublicationFormatId());
     $templateMgr->assign('isPhysicalFormat', (bool) $this->getPhysicalFormat());
     // included to load format-specific template
     $templateMgr->assign('stageId', $this->getStageId());
     $templateMgr->assign('formParams', $this->getFormParams());
     $templateMgr->assign('submissionApproved', $monograph->getDatePublished());
     $onixCodelistItemDao = DAORegistry::getDAO('ONIXCodelistItemDAO');
     // Check if e-commerce is available
     import('classes.payment.omp.OMPPaymentManager');
     $ompPaymentManager = new OMPPaymentManager($request);
     if ($ompPaymentManager->isConfigured()) {
         $templateMgr->assign('paymentConfigured', true);
         $templateMgr->assign('currency', $press->getSetting('currency'));
     }
     // get the lists associated with the select elements on these publication format forms.
     $codes = array('productCompositionCodes' => 'List2', 'measurementUnitCodes' => 'List50', 'weightUnitCodes' => 'List95', 'measurementTypeCodes' => 'List48', 'productFormDetailCodes' => 'List175', 'productAvailabilityCodes' => 'List65', 'technicalProtectionCodes' => 'List144', 'returnableIndicatorCodes' => 'List66', 'countriesIncludedCodes' => 'List91');
     foreach ($codes as $templateVarName => $list) {
         $templateMgr->assign_by_ref($templateVarName, $onixCodelistItemDao->getCodes($list));
     }
     // consider public identifiers
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
     $templateMgr->assign('pubIdPlugins', $pubIdPlugins);
     // Notification options.
     $notificationRequestOptions = array(NOTIFICATION_LEVEL_NORMAL => array(NOTIFICATION_TYPE_CONFIGURE_PAYMENT_METHOD => array(ASSOC_TYPE_PRESS, $press->getId()), NOTIFICATION_TYPE_FORMAT_NEEDS_APPROVED_SUBMISSION => array(ASSOC_TYPE_MONOGRAPH, $monograph->getId())), NOTIFICATION_LEVEL_TRIVIAL => array());
     $templateMgr->assign('notificationRequestOptions', $notificationRequestOptions);
     return parent::fetch($request);
 }
 /**
  * Perform plugin-specific management functions.
  * @param $args array
  * @param $request object
  */
 function plugin($args, &$request)
 {
     $category = array_shift($args);
     $plugin = array_shift($args);
     $verb = array_shift($args);
     $this->validate();
     $this->setupTemplate(true);
     $plugins =& PluginRegistry::loadCategory($category);
     $message = $messageParams = null;
     $pluginObject = null;
     if (isset($plugins[$plugin])) {
         $pluginObject = $plugins[$plugin];
     }
     if (is_null($pluginObject)) {
         $request->redirect(null, null, 'plugins', array($category));
     }
     if (!$pluginObject->manage($verb, $args, $message, $messageParams, $request)) {
         HookRegistry::call('PluginHandler::plugin', array($verb, $args, $message, $messageParams, $pluginObject));
         if ($message) {
             $user =& $request->getUser();
             import('classes.notification.NotificationManager');
             $notificationManager = new NotificationManager();
             $notificationManager->createTrivialNotification($user->getId(), $message, $messageParams);
         }
         $request->redirect(null, null, 'plugins', array($category));
     }
 }
Exemple #12
0
 /**
  * For 2.3 upgrade:  Add initial plugin data to versions table
  * @return boolean
  */
 function addPluginVersions()
 {
     $versionDao =& DAORegistry::getDAO('VersionDAO');
     import('site.VersionCheck');
     $categories = PluginRegistry::getCategories();
     foreach ($categories as $category) {
         PluginRegistry::loadCategory($category, true);
         $plugins = PluginRegistry::getPlugins($category);
         foreach ($plugins as $plugin) {
             $versionFile = $plugin->getPluginPath() . '/version.xml';
             if (FileManager::fileExists($versionFile)) {
                 $versionInfo =& VersionCheck::parseVersionXML($versionFile);
                 $pluginVersion = $versionInfo['version'];
                 $pluginVersion->setCurrent(1);
                 $versionDao->insertVersion($pluginVersion);
             } else {
                 $pluginVersion = new Version();
                 $pluginVersion->setMajor(1);
                 $pluginVersion->setMinor(0);
                 $pluginVersion->setRevision(0);
                 $pluginVersion->setBuild(0);
                 $pluginVersion->setDateInstalled(Core::getCurrentDate());
                 $pluginVersion->setCurrent(1);
                 $pluginVersion->setProductType('plugins.' . $category);
                 $pluginVersion->setProduct(basename($plugin->getPluginPath()));
                 $versionDao->insertVersion($pluginVersion);
             }
         }
     }
 }
 /**
  * Constructor.
  * @param $archiveId omit for a new archive
  */
 function ArchiveForm($archiveId = null, $allowManagement = false)
 {
     parent::Form('admin/archiveForm.tpl');
     $this->archiveId = isset($archiveId) ? (int) $archiveId : null;
     $this->allowManagement = $allowManagement;
     // Validation checks for this form
     $this->addCheck(new FormValidator($this, 'title', 'required', 'admin.archives.form.titleRequired'));
     $this->addCheck(new FormValidator($this, 'url', 'required', 'admin.archives.form.urlRequired'));
     $this->addCheck(new FormValidatorPost($this));
     import('lib.pkp.classes.captcha.CaptchaManager');
     $captchaManager = new CaptchaManager();
     $this->captchaEnabled = $captchaManager->isEnabled();
     if ($this->captchaEnabled && !Validation::isSiteAdmin()) {
         $this->addCheck(new FormValidatorCaptcha($this, 'captcha', 'captchaId', 'common.captchaField.badCaptcha'));
     }
     $this->harvesterPluginName = Request::getUserVar('harvesterPluginName');
     if ($archiveId) {
         $archiveDao =& DAORegistry::getDAO('ArchiveDAO');
         $this->archive =& $archiveDao->getArchive($this->archiveId, false);
         if (empty($this->harvesterPluginName) && $this->archive) {
             $this->harvesterPluginName = $this->archive->getHarvesterPluginName();
         }
     }
     if (empty($this->harvesterPluginName)) {
         $site =& Request::getSite();
         $this->harvesterPluginName = $site->getSetting('defaultHarvesterPlugin');
     }
     $this->harvesters =& PluginRegistry::loadCategory('harvesters');
     HookRegistry::call('ArchiveForm::ArchiveForm', array(&$this, $this->harvesterPluginName));
 }
 /**
  * @copydoc MultipleListsListbuilderHandler::setListsData()
  */
 function setListsData($request, $filter)
 {
     $leftBlockPlugins = $disabledBlockPlugins = $rightBlockPlugins = array();
     $plugins =& PluginRegistry::loadCategory('blocks');
     foreach ($plugins as $key => $junk) {
         if (!$plugins[$key]->getEnabled() || $plugins[$key]->getBlockContext() == '') {
             if (count(array_intersect($plugins[$key]->getSupportedContexts(), array(BLOCK_CONTEXT_LEFT_SIDEBAR, BLOCK_CONTEXT_RIGHT_SIDEBAR))) > 0) {
                 $disabledBlockPlugins[$key] =& $plugins[$key];
             }
         } else {
             switch ($plugins[$key]->getBlockContext()) {
                 case BLOCK_CONTEXT_LEFT_SIDEBAR:
                     $leftBlockPlugins[$key] =& $plugins[$key];
                     break;
                 case BLOCK_CONTEXT_RIGHT_SIDEBAR:
                     $rightBlockPlugins[$key] =& $plugins[$key];
                     break;
             }
         }
     }
     $lists =& $this->getLists();
     $lists['leftContext']->setData($leftBlockPlugins);
     $lists['rightContext']->setData($rightBlockPlugins);
     $lists['unselected']->setData($disabledBlockPlugins);
 }
Exemple #15
0
 function index()
 {
     $this->validate();
     PluginRegistry::loadCategory('oaiMetadataFormats', true);
     $oai = new JournalOAI(new OAIConfig(Request::getRequestUrl(), Config::getVar('oai', 'repository_id')));
     $oai->execute();
 }
 function index($args, $request)
 {
     $this->validate();
     PluginRegistry::loadCategory('oaiMetadataFormats', true);
     $oai = new JournalOAI(new OAIConfig($request->url(null, 'oai'), Config::getVar('oai', 'repository_id')));
     $oai->execute();
 }
 /**
  * Constructor
  */
 function PayMethodSettingsForm()
 {
     parent::Form('payments/payMethodSettingsForm.tpl');
     // Load the plugins.
     $this->plugins =& PluginRegistry::loadCategory('paymethod');
     // Add form checks
     $this->addCheck(new FormValidatorInSet($this, 'paymentMethodPluginName', 'optional', 'manager.payment.paymentPluginInvalid', array_keys($this->plugins)));
 }
Exemple #18
0
 /**
  * @see PKPTestCase::setUp()
  */
 protected function setUp()
 {
     parent::setUp();
     // Instantiate the plug-in for testing.
     $this->mockRequest();
     PluginRegistry::loadCategory('generic', true, 0);
     $this->lucenePlugin = PluginRegistry::getPlugin('generic', 'luceneplugin');
 }
Exemple #19
0
 /**
  * Authenticate user credentials and mark the user as logged in in the current session.
  * @param $username string
  * @param $password string unencrypted password
  * @param $reason string reference to string to receive the reason an account was disabled; null otherwise
  * @param $remember boolean remember a user's session past the current browser session
  * @return User the User associated with the login credentials, or false if the credentials are invalid
  */
 static function login($username, $password, &$reason, $remember = false)
 {
     $implicitAuth = Config::getVar('security', 'implicit_auth');
     $reason = null;
     if ($implicitAuth) {
         // Implicit auth
         if (!Validation::isLoggedIn()) {
             PluginRegistry::loadCategory('implicitAuth');
             // Call the implicitAuth hook. It will set $user.
             HookRegistry::call('ImplicitAuthPlugin::implicitAuth', array(&$user));
             $valid = true;
         } else {
             $valid = false;
         }
     } else {
         // Regular Auth
         $userDao = DAORegistry::getDAO('UserDAO');
         $user = $userDao->getByUsername($username, true);
         if (!isset($user)) {
             // User does not exist
             return false;
         }
         if ($user->getAuthId()) {
             $authDao = DAORegistry::getDAO('AuthSourceDAO');
             $auth = $authDao->getPlugin($user->getAuthId());
         } else {
             $auth = null;
         }
         if ($auth) {
             // Validate against remote authentication source
             $valid = $auth->authenticate($username, $password);
             if ($valid) {
                 $oldEmail = $user->getEmail();
                 $auth->doGetUserInfo($user);
                 if ($user->getEmail() != $oldEmail) {
                     // FIXME requires email addresses to be unique; if changed email already exists, ignore
                     if ($userDao->userExistsByEmail($user->getEmail())) {
                         $user->setEmail($oldEmail);
                     }
                 }
             }
         } else {
             // Validate against user database
             $rehash = null;
             $valid = Validation::verifyPassword($username, $password, $user->getPassword(), $rehash);
             if ($valid && !empty($rehash)) {
                 // update to new hashing algorithm
                 $user->setPassword($rehash);
             }
         }
     }
     if (!$valid) {
         // Login credentials are invalid
         return false;
     } else {
         return self::registerUserSession($user, $reason, $remember);
     }
 }
 /**
  * @copydoc Form::fetch()
  */
 function fetch($request)
 {
     $templateMgr = TemplateManager::getManager($request);
     $templateMgr->assign(array('pubIdPlugins' => PluginRegistry::loadCategory('pubIds', true, $this->getContextId()), 'pubObject' => $this->getPubObject(), 'stageId' => $this->getStageId(), 'formParams' => $this->getFormParams()));
     // consider JavaScripts
     $pubIdPluginHelper = new PKPPubIdPluginHelper();
     $pubIdPluginHelper->addJavaScripts($this->getContextId(), $request, $templateMgr);
     return parent::fetch($request);
 }
Exemple #21
0
 function &getPlugin()
 {
     $plugins =& PluginRegistry::loadCategory('schemas');
     $returner = null;
     if (isset($plugins[$this->getPluginName()])) {
         $returner =& $plugins[$this->getPluginName()];
     }
     return $returner;
 }
 /**
  * Register this plugin for all the appropriate hooks.
  */
 function register($category, $path)
 {
     $success = parent::register($category, $path);
     if ($success) {
         // Make sure postprocessors are loaded.
         PluginRegistry::loadCategory('postprocessors');
         HookRegistry::register('OAI::metadataFormats', array(&$this, 'callback_formatRequest'));
     }
     return $success;
 }
Exemple #23
0
 /**
  * Perform plugin-specific management functions.
  */
 function plugin($args)
 {
     $category = array_shift($args);
     $plugin = array_shift($args);
     $verb = array_shift($args);
     parent::validate();
     $plugins =& PluginRegistry::loadCategory($category);
     if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args)) {
         Request::redirect(null, null, 'plugins');
     }
 }
Exemple #24
0
 /**
  * @param $args array
  * @param $request PKPRequest
  */
 function index($args, $request)
 {
     $this->validate();
     PluginRegistry::loadCategory('oaiMetadataFormats', true);
     $oai = new JournalOAI(new OAIConfig($request->url(null, 'oai'), Config::getVar('oai', 'repository_id')));
     if (!$request->getJournal() && $request->getRequestedJournalPath() != 'index') {
         $dispatcher = $request->getDispatcher();
         return $dispatcher->handle404();
     }
     $oai->execute();
 }
Exemple #25
0
 /**
  * Clear issue objects pub ids.
  * @param $pubIdPlugInClassName string
  */
 function clearIssueObjectsPubIds($pubIdPlugInClassName)
 {
     $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
     if (is_array($pubIdPlugins)) {
         foreach ($pubIdPlugins as $pubIdPlugin) {
             if (get_class($pubIdPlugin) == $pubIdPlugInClassName) {
                 $pubIdPlugin->clearIssueObjectsPubIds($this->getPubObject());
             }
         }
     }
 }
 /**
  * @see PKPTestCase::setUp()
  */
 protected function setUp()
 {
     $this->markTestSkipped('Needs fixing.');
     parent::setUp();
     // Instantiate the plug-in for testing.
     $this->mockRequest();
     PluginRegistry::loadCategory('generic', true, 0);
     $this->lucenePlugin = PluginRegistry::getPlugin('generic', 'luceneplugin');
     if (!$this->lucenePlugin) {
         $this->markTestSkipped('Could not fetch Lucene plugin!');
     }
 }
 /**
  * Get the payment plugin.
  * @param $press Press
  * @return PaymentPlugin
  */
 function &getPaymentPlugin()
 {
     $paymentMethodPluginName = $this->press->getSetting('paymentPluginName');
     $paymentMethodPlugin = null;
     if (!empty($paymentMethodPluginName)) {
         $plugins =& PluginRegistry::loadCategory('paymethod');
         if (isset($plugins[$paymentMethodPluginName])) {
             $paymentMethodPlugin =& $plugins[$paymentMethodPluginName];
         }
     }
     return $paymentMethodPlugin;
 }
 function &getPaymentPlugin()
 {
     $schedConf =& Request::getSchedConf();
     $paymentMethodPluginName = $schedConf->getSetting('paymentMethodPluginName');
     $paymentMethodPlugin = null;
     if (!empty($paymentMethodPluginName)) {
         $plugins =& PluginRegistry::loadCategory('paymethod');
         if (isset($plugins[$paymentMethodPluginName])) {
             $paymentMethodPlugin =& $plugins[$paymentMethodPluginName];
         }
     }
     return $paymentMethodPlugin;
 }
Exemple #29
0
 /**
  * Pass request to plugin.
  * @param $args array
  * @param $request PKPRequest
  */
 function plugin($args, &$request)
 {
     $paymentMethodPlugins =& PluginRegistry::loadCategory('paymethod');
     $paymentMethodPluginName = array_shift($args);
     if (empty($paymentMethodPluginName) || !isset($paymentMethodPlugins[$paymentMethodPluginName])) {
         $request->redirect(null, null, 'index');
     }
     $paymentMethodPlugin =& $paymentMethodPlugins[$paymentMethodPluginName];
     if (!$paymentMethodPlugin->isConfigured()) {
         $request->redirect(null, null, 'index');
     }
     $paymentMethodPlugin->handle($args, $request);
 }
Exemple #30
0
 /**
  * Display the form.
  */
 function display()
 {
     $templateMgr =& TemplateManager::getManager();
     $journal =& Request::getJournal();
     // set up the accessibility options pulldown
     $templateMgr->assign('enableDelayedOpenAccess', $journal->getSetting('enableDelayedOpenAccess'));
     $templateMgr->assign('accessOptions', array(ISSUE_ACCESS_OPEN => AppLocale::Translate('editor.issues.openAccess'), ISSUE_ACCESS_SUBSCRIPTION => AppLocale::Translate('editor.issues.subscription')));
     $templateMgr->assign('enablePublicIssueId', $journal->getSetting('enablePublicIssueId'));
     // consider public identifiers
     $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true);
     $templateMgr->assign('pubIdPlugins', $pubIdPlugins);
     parent::display();
 }