本文整理汇总了PHP中PluginRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP PluginRegistry类的具体用法?PHP PluginRegistry怎么用?PHP PluginRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginRegistry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
function index()
{
$this->validate();
PluginRegistry::loadCategory('oaiMetadataFormats', true);
$oai = new JournalOAI(new OAIConfig(Request::getRequestUrl(), Config::getVar('oai', 'repository_id')));
$oai->execute();
}
示例2: CustomLocaleHandler
/**
* Constructor
**/
function CustomLocaleHandler($parentPluginName)
{
parent::Handler();
$this->addCheck(new HandlerValidatorJournal($this));
$this->addCheck(new HandlerValidatorRoles($this, true, null, null, array(ROLE_ID_SITE_ADMIN, ROLE_ID_MANAGER)));
$this->plugin = PluginRegistry::getPlugin('generic', $parentPluginName);
}
示例3: MedraSettingsForm
/**
* 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));
}
示例4: setMetadata
/**
* Register the article's metadata with the SWORD deposit.
*/
function setMetadata()
{
$this->package->setCustodian($this->journal->getSetting('contactName'));
$this->package->setTitle(html_entity_decode($this->article->getTitle($this->journal->getPrimaryLocale()), ENT_QUOTES, 'UTF-8'));
$this->package->setAbstract(html_entity_decode(strip_tags($this->article->getAbstract($this->journal->getPrimaryLocale())), ENT_QUOTES, 'UTF-8'));
$this->package->setType($this->section->getIdentifyType($this->journal->getPrimaryLocale()));
// The article can be published or not. Support either.
if (is_a($this->article, 'PublishedArticle')) {
$doi = $this->article->getPubId('doi');
if ($doi !== null) {
$this->package->setIdentifier($doi);
}
}
foreach ($this->article->getAuthors() as $author) {
$creator = $author->getFullName(true);
$affiliation = $author->getAffiliation($this->journal->getPrimaryLocale());
if (!empty($affiliation)) {
$creator .= "; {$affiliation}";
}
$this->package->addCreator($creator);
}
// The article can be published or not. Support either.
if (is_a($this->article, 'PublishedArticle')) {
$plugin =& PluginRegistry::loadPlugin('citationFormats', 'bibtex');
$this->package->setCitation(html_entity_decode(strip_tags($plugin->fetchCitation($this->article, $this->issue, $this->journal)), ENT_QUOTES, 'UTF-8'));
}
}
示例5: OAIDAO
/**
* Constructor.
*/
function OAIDAO()
{
parent::DAO();
$this->archiveDao =& DAORegistry::getDAO('ArchiveDAO');
$this->recordDao =& DAORegistry::getDAO('RecordDAO');
PluginRegistry::loadCategory('schemas');
}
示例6: fetch
/**
* @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);
}
示例7: getPubId
/**
* 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;
}
示例8: plugin
/**
* 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));
}
}
示例9: fetch
/**
* 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);
}
示例10: index
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();
}
示例11: addPluginVersions
/**
* 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);
}
}
}
}
示例12: execute
/**
* 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);
}
}
}
示例13: harvest
/**
* 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!';
}
示例14: login
/**
* Logs in to the system
*
* @param $username string The username
* @param $password strint The password
* @return string
*/
public function login($username, $password)
{
@session_destroy();
@session_start();
$password = md5($password);
$msg = "";
$pru = PluginRegistry::getInstance();
$login = $pru->getPlugin("Login Plugin");
$result = $login->SOAPLogin($username, $password);
return session_id();
switch ($result) {
case 200:
$msg = "Logged in successfully";
break;
case 402:
$msg = "There was an error while trying to login; your username is blocked";
break;
case 403:
$msg = "Incorrect username/password combination";
break;
case 500:
$msg = "There was an error on the server, please try later";
break;
default:
$msg = "Incorrect username/password combination";
break;
}
return $msg;
}
示例15: index
function index()
{
$this->validate();
PluginRegistry::loadCategory('schemas');
$oai = new ArchiveOAI(new OAIConfig(Request::getRequestUrl(), Config::getVar('oai', 'repository_id')));
$oai->execute();
}