/** * Register the plugin, if enabled * @param $category string * @param $path string * @return boolean */ function register($category, $path) { if (parent::register($category, $path)) { // HookRegistry::register('Installer::postInstall',array(&$this, 'postInstallCallback')); if ($this->getEnabled()) { $this->addHelpData(); // Add DAOs $this->import('CrosswalkDAO'); $this->import('Crosswalk'); $this->import('Search'); $this->import('SearchIndex'); $this->import('SearchDAO'); $crosswalkDao = new CrosswalkDAO(); DAORegistry::registerDAO('CrosswalkDAO', $crosswalkDao); $searchDao = new SearchDAO(); DAORegistry::registerDAO('SearchDAO', $searchDao); /** * Set hooks */ // Record handling & harvesting HookRegistry::register('Harvester::insertRecord', array(&$this, 'insertRecordCallback')); HookRegistry::register('Harvester::updateRecord', array(&$this, 'updateRecordCallback')); HookRegistry::register('Harvester::deleteRecord', array(&$this, 'deleteRecordCallback')); // User interface HookRegistry::register('Templates::Common::Header::Navbar', array(&$this, 'navBarCallback')); HookRegistry::register('Template::Admin::Index::SiteManagement', array(&$this, 'siteManagementCallback')); HookRegistry::register('LoadHandler', array(&$this, 'loadHandlerCallback')); HookRegistry::register('PluginRegistry::loadCategory', array(&$this, 'callbackLoadCategory')); // Rebuild index HookRegistry::register('rebuildSearchIndex::flush', array(&$this, 'callbackFlush')); } return true; } return false; }
/** * Constructor */ function __construct() { parent::__construct(); if ($this->getEnabled()) { HookRegistry::register('TemplateManager::display', array($this, 'loadJavaScript')); } }
/** * Handle a new request. */ function handleRequest() { if (!Config::getVar('general', 'installed') && pageRequiresInstall()) { // Redirect to installer if application has not been installed Request::redirect(null, 'install'); } // Determine the handler for this request $page = Request::getRequestedPage(); $op = Request::getRequestedOp(); $sourceFile = sprintf('pages/%s/index.php', $page); // If a hook has been registered to handle this page, give it the // opportunity to load required resources and set HANDLER_CLASS. if (!HookRegistry::call('LoadHandler', array(&$page, &$op, &$sourceFile))) { if (file_exists($sourceFile)) { require $sourceFile; } else { require 'pages/index/index.php'; } } if (!defined('SESSION_DISABLE_INIT')) { // Initialize session $sessionManager =& SessionManager::getManager(); $session =& $sessionManager->getUserSession(); } $methods = array_map('strtolower', get_class_methods(HANDLER_CLASS)); if (in_array(strtolower($op), $methods)) { // Call a specific operation call_user_func(array(HANDLER_CLASS, $op), Request::getRequestedArgs()); } else { // Call the selected handler's index operation call_user_func(array(HANDLER_CLASS, 'index'), Request::getRequestedArgs()); } }
/** * Construct the contents for the notification based on its type and associated object * @param $request PKPRequest * @param $notification Notification * @return string */ function getNotificationContents(&$request, &$notification) { $type = $notification->getType(); assert(isset($type)); $message = null; HookRegistry::call('NotificationManager::getNotificationContents', array(&$notification, &$message)); if ($message) { return $message; } switch ($type) { case NOTIFICATION_TYPE_PAPER_SUBMITTED: return __('notification.type.paperSubmitted', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_SUPP_FILE_MODIFIED: return __('notification.type.suppFileModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_METADATA_MODIFIED: return __('notification.type.metadataModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_GALLEY_MODIFIED: return __('notification.type.galleyModified', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_SUBMISSION_COMMENT: return __('notification.type.submissionComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_REVIEWER_COMMENT: return __('notification.type.reviewerComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_REVIEWER_FORM_COMMENT: return __('notification.type.reviewerFormComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_DIRECTOR_DECISION_COMMENT: return __('notification.type.directorDecisionComment', array('title' => $this->_getPaperTitle($notification))); case NOTIFICATION_TYPE_USER_COMMENT: return __('notification.type.userComment', array('title' => $this->_getPaperTitle($notification))); default: return parent::getNotificationContents($request, $notification); } }
/** * @see LazyLoadPlugin::register() */ function register($category, $path) { $success = parent::register($category, $path); HookRegistry::register('AcronPlugin::parseCronTab', array($this, 'callbackParseCronTab')); if ($this->getEnabled() && $success) { // Register callbacks. HookRegistry::register('PluginRegistry::loadCategory', array($this, 'callbackLoadCategory')); HookRegistry::register('LoadHandler', array($this, 'callbackLoadHandler')); // If the plugin will provide the access logs, // register to the usage event hook provider. if ($this->getSetting(CONTEXT_ID_NONE, 'createLogFiles')) { HookRegistry::register('UsageEventPlugin::getUsageEvent', array(&$this, 'logUsageEvent')); } $this->_dataPrivacyOn = $this->getSetting(CONTEXT_ID_NONE, 'dataPrivacyOption'); $this->_saltpath = $this->getSetting(CONTEXT_ID_NONE, 'saltFilepath'); // Check config for backward compatibility. if (!$this->_saltpath) { $this->_saltpath = Config::getVar('usageStats', 'salt_filepath'); } $application = Application::getApplication(); $request = $application->getRequest(); $this->_optedOut = $request->getCookieVar('usageStats-opt-out'); if ($this->_optedOut) { // Renew the Opt-Out cookie if present. $request->setCookieVar('usageStats-opt-out', true, time() + 60 * 60 * 24 * 365); } } return $success; }
/** * Return an HTML-formatted citation. Default implementation displays * an HTML-based citation using the citation.tpl template in the plugin * path. * @param $article object * @param $issue object */ function cite(&$article, &$issue) { HookRegistry::register('Template::RT::CaptureCite', array(&$this, 'displayCitation')); $templateMgr =& TemplateManager::getManager(); $templateMgr->assign_by_ref('citationPlugin', $this); $templateMgr->display('rt/captureCite.tpl'); }
/** * Called as a plugin is registered to the registry * @param $category String Name of category plugin was registered to * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $success = parent::register($category, $path); if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) { return true; } if ($success && $this->getEnabled()) { // Insert field into author submission page and metadata form HookRegistry::register('Templates::Author::Submit::Authors', array($this, 'metadataField')); HookRegistry::register('Templates::Submission::MetadataEdit::Authors', array($this, 'metadataField')); // Hook for initData in two forms HookRegistry::register('metadataform::initdata', array($this, 'metadataInitData')); HookRegistry::register('authorsubmitstep3form::initdata', array($this, 'metadataInitData')); // Hook for execute in two forms HookRegistry::register('authorsubmitstep3form::execute', array($this, 'metadataExecute')); HookRegistry::register('metadataform::execute', array($this, 'metadataExecute')); // Add element for AuthorDAO for storage HookRegistry::register('pkpauthordao::getAdditionalFieldNames', array($this, 'authorSubmitGetFieldNames')); // Insert Google Analytics page tag to common footer HookRegistry::register('Templates::Common::Footer::PageFooter', array($this, 'insertFooter')); // Insert Google Analytics page tag to article footer HookRegistry::register('Templates::Article::Footer::PageFooter', array($this, 'insertFooter')); // Insert Google Analytics page tag to article interstitial footer HookRegistry::register('Templates::Article::Interstitial::PageFooter', array($this, 'insertFooter')); // Insert Google Analytics page tag to article pdf interstitial footer HookRegistry::register('Templates::Article::PdfInterstitial::PageFooter', array($this, 'insertFooter')); // Insert Google Analytics page tag to reading tools footer HookRegistry::register('Templates::Rt::Footer::PageFooter', array($this, 'insertFooter')); // Insert Google Analytics page tag to help footer HookRegistry::register('Templates::Help::Footer::PageFooter', array($this, 'insertFooter')); } return $success; }
/** * Insert a tombstone for the passed publication format. * @param $publicationFormat PublicationFormat * @param $press Press */ function insertTombstoneByPublicationFormat($publicationFormat, $press) { $monographDao = DAORegistry::getDAO('MonographDAO'); $monograph = $monographDao->getById($publicationFormat->getMonographId()); $seriesDao = DAORegistry::getDAO('SeriesDAO'); $series = $seriesDao->getById($monograph->getSeriesId()); $dataObjectTombstoneDao = DAORegistry::getDAO('DataObjectTombstoneDAO'); // delete publication format tombstone to ensure that there aren't // more than one tombstone for this publication format $dataObjectTombstoneDao->deleteByDataObjectId($publicationFormat->getId()); // insert publication format tombstone if (is_a($series, 'Series')) { $setSpec = urlencode($press->getPath()) . ':' . urlencode($series->getPath()); $setName = $series->getLocalizedTitle(); } else { $setSpec = urlencode($press->getPath()); $setName = $press->getLocalizedName(); } $oaiIdentifier = 'oai:' . Config::getVar('oai', 'repository_id') . ':' . 'publicationFormat/' . $publicationFormat->getId(); $OAISetObjectsIds = array(ASSOC_TYPE_PRESS => $monograph->getPressId(), ASSOC_TYPE_SERIES => $monograph->getSeriesId()); $publicationFormatTombstone = $dataObjectTombstoneDao->newDataObject(); /* @var $publicationFormatTombstone DataObjectTombstone */ $publicationFormatTombstone->setDataObjectId($publicationFormat->getId()); $publicationFormatTombstone->stampDateDeleted(); $publicationFormatTombstone->setSetSpec($setSpec); $publicationFormatTombstone->setSetName($setName); $publicationFormatTombstone->setOAIIdentifier($oaiIdentifier); $publicationFormatTombstone->setOAISetObjectsIds($OAISetObjectsIds); $dataObjectTombstoneDao->insertObject($publicationFormatTombstone); if (HookRegistry::call('PublicationFormatTombstoneManager::insertPublicationFormatTombstone', array(&$publicationFormatTombstone, &$publicationFormat, &$press))) { return; } }
function register($category, $path) { if (parent::register($category, $path)) { if ($this->getEnabled()) { // Add custom locale data for already registered locale files. $locale = AppLocale::getLocale(); $localeFiles = AppLocale::getLocaleFiles($locale); $journal = Request::getJournal(); $journalId = $journal->getId(); $publicFilesDir = Config::getVar('files', 'public_files_dir'); $customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'journals' . DIRECTORY_SEPARATOR . $journalId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR; import('lib.pkp.classes.file.FileManager'); $fileManager = new FileManager(); foreach ($localeFiles as $localeFile) { $customLocalePath = $customLocalePathBase . $localeFile->getFilename(); if ($fileManager->fileExists($customLocalePath)) { AppLocale::registerLocaleFile($locale, $customLocalePath, true); } } // Add custom locale data for all locale files registered after this plugin HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale')); } return true; } return false; }
function register($category, $path) { if (parent::register($category, $path)) { $this->addLocaleData(); if ($this->getEnabled()) { // Add custom locale data for already registered locale files. $locale = Locale::getLocale(); $localeFiles = Locale::getLocaleFiles($locale); $conference = Request::getConference(); $conferenceId = $conference->getId(); $publicFilesDir = Config::getVar('files', 'public_files_dir'); $customLocalePathBase = $publicFilesDir . DIRECTORY_SEPARATOR . 'conferences' . DIRECTORY_SEPARATOR . $conferenceId . DIRECTORY_SEPARATOR . CUSTOM_LOCALE_DIR . DIRECTORY_SEPARATOR . $locale . DIRECTORY_SEPARATOR; import('file.FileManager'); foreach ($localeFiles as $localeFile) { $customLocalePath = $customLocalePathBase . $localeFile->getFilename(); if (FileManager::fileExists($customLocalePath)) { Locale::registerLocaleFile($locale, $customLocalePath, true); } } // Add custom locale data for all locale files registered after this plugin HookRegistry::register('PKPLocale::registerLocaleFile', array(&$this, 'addCustomLocale')); } return true; } return false; }
function insertArticleTombstone(&$article, &$journal) { $sectionDao =& DAORegistry::getDAO('SectionDAO'); $section =& $sectionDao->getSection($article->getSectionId()); $tombstoneDao =& DAORegistry::getDAO('DataObjectTombstoneDAO'); /* @var $tombstoneDao DataObjectTombstoneDAO */ // delete article tombstone -- to ensure that there aren't more than one tombstone for this article $tombstoneDao->deleteByDataObjectId($article->getId()); // insert article tombstone $section =& $sectionDao->getSection($article->getSectionId()); $setSpec = urlencode($journal->getPath()) . ':' . urlencode($section->getLocalizedAbbrev()); $oaiIdentifier = 'oai:' . Config::getVar('oai', 'repository_id') . ':' . 'article/' . $article->getId(); $OAISetObjectsIds = array(ASSOC_TYPE_JOURNAL => $journal->getId(), ASSOC_TYPE_SECTION => $section->getId()); $articleTombstone = $tombstoneDao->newDataObject(); $articleTombstone->setDataObjectId($article->getId()); $articleTombstone->stampDateDeleted(); $articleTombstone->setSetSpec($setSpec); $articleTombstone->setSetName($section->getLocalizedTitle()); $articleTombstone->setOAIIdentifier($oaiIdentifier); $articleTombstone->setOAISetObjectsIds($OAISetObjectsIds); $tombstoneId = $tombstoneDao->insertObject($articleTombstone); if (HookRegistry::call('ArticleTombstoneManager::insertArticleTombstone', array(&$articleTombstone, &$article, &$journal))) { return; } }
/** * Constructor */ function CitationPlugin() { parent::Plugin(); if ($this->getEnabled()) { HookRegistry::register('TemplateManager::display', array($this, 'loadJavaScript')); } }
/** * Given a $page and $op, return a list of field names for which * the plugin should be used. * @param $templateMgr object * @param $page string The requested page * @param $op string The requested operation * @return array */ function getEnableFields(&$templateMgr, $page, $op) { $formLocale = $templateMgr->get_template_vars('formLocale'); $fields = array(); switch ("{$page}/{$op}") { case 'admin/settings': case 'admin/saveSettings': $fields[] = 'intro'; $fields[] = 'aboutField'; break; case 'admin/createArchive': case 'admin/editArchive': case 'admin/updateArchive': $fields[] = 'description'; break; case 'user/profile': case 'user/saveProfile': case 'user/register': case 'admin/createUser': case 'admin/updateUser': $fields[] = 'mailingAddress'; $fields[] = 'biography'; break; } HookRegistry::call('TinyMCEPlugin::getEnableFields', array(&$this, &$fields)); return $fields; }
/** * Called as a plugin is registered to the registry * @param $category String Name of category plugin was registered to * @return boolean True if plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $success = parent::register($category, $path); $this->addLocaleData(); $this->import('pidResourceDAO'); $this->import('pidHandler'); $pidResourceDao = new pidResourceDao(); DAORegistry::registerDAO('pidResourceDAO', $pidResourceDao); $this->journal =& Request::getJournal(); $isEnabled = $this->getEnabled(); if ($success) { if ($isEnabled === true) { HookRegistry::register('Template::Author::Submission::Status', array(&$this, 'submissionStatus')); HookRegistry::register('Template::sectionEditor::Submission::Status', array(&$this, 'submissionStatus')); HookRegistry::register('Template::Article::PID', array(&$this, 'articleTemplate')); HookRegistry::register('ArticleDAO::_updateArticle', array(&$this, 'publishedArticlePidHandler')); //Older OJS Versions HookRegistry::register('articledao::_updatearticle', array(&$this, 'publishedArticlePidHandler')); //Newer OJS Versions } HookRegistry::register('OAIDAOinc::_getRecord', array(&$this, 'OAIRecordsHandler')); HookRegistry::register('OAIDAOinc::_listRecords', array(&$this, 'OAIRecordsHandler')); } return $success; }
/** * Called as a plugin is registered to the registry. Subclasses over- * riding this method should call the parent method first. * @param $category String Name of category plugin was registered to * @param $path String The path the plugin was found in * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $success = parent::register($category, $path); if ($success) { HookRegistry::register('Template::Manager::Payment::displayPaymentSettingsForm', array(&$this, '_smartyDisplayPaymentSettingsForm')); } return $success; }
function register($category, $path) { if (parent::register($category, $path)) { HookRegistry::register('TemplateManager::display', array(&$this, 'addmeta')); return true; } return false; }
/** * Called as a plugin is registered to the registry. Subclasses over- * riding this method should call the parent method first. * @param $category String Name of category plugin was registered to * @param $path String The path the plugin was found in * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { if (!parent::register($category, $path)) { return false; } HookRegistry::register('Template::Manager::Payment::displayPaymentSettingsForm', array($this, '_smartyDisplayPaymentSettingsForm')); return true; }
/** * Return the section decision * Internal function to return an meeting object from a row. Simplified * not to include object settings. * @param $row array * @return section_decision_id */ function &_returnMeetingSectionDecisionFromRow(&$row) { $meetingSectionDecision = new MeetingSectionDecision(); $meetingSectionDecision->setMeetingId($row['meeting_id']); $meetingSectionDecision->setSectionDecisionId($row['section_decision_id']); HookRegistry::call('MeetingSectionDecsisionDAO::_returnMeetingSectionDecisionFromRow', array(&$meetingSectionDecision, &$row)); return $meetingSectionDecision; }
/** * Internal function to return a Journal object from a row. * @param $row array * @return Journal */ function _fromRow($row) { $journal = parent::_fromRow($row); $journal->setPrimaryLocale($row['primary_locale']); $journal->setEnabled($row['enabled']); HookRegistry::call('JournalDAO::_returnJournalFromRow', array(&$journal, &$row)); return $journal; }
/** * Called as a plugin is registered to the registry * @param $category String Name of category plugin was registered to * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $success = parent::register($category, $path); if ($success && $this->getEnabled()) { HookRegistry::register('OAIDAO::_getRecords', array($this, 'filterEruditOAI')); } return $success; }
/** * Called as a plugin is registered to the registry * @param $category String Name of category plugin was registered to * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $success = parent::register($category, $path); if ($success && $this->getEnabled()) { HookRegistry::register('metadataform::validate', array($this, 'callbackSaveMetadata')); } return $success; }
/** * @copydoc Plugin::register() */ function register($category, $path) { $success = parent::register($category, $path); if ($success) { HookRegistry::register('AcronPlugin::parseCronTab', array($this, 'callbackParseCronTab')); } return $success; }
/** * Internal function to return a Press object from a row. * @param $row array * @return Press */ function _fromRow($row) { $press = parent::_fromRow($row); $press->setPrimaryLocale($row['primary_locale']); $press->setEnabled($row['enabled']); HookRegistry::call('PressDAO::_fromRow', array(&$press, &$row)); return $press; }
function register($category, $path) { $result = parent::register($category, $path); if ($result) { HookRegistry::register('Harvester::insertEntry', array(&$this, '_preprocessEntry')); } return $result; }
/** * Called as a plugin is registered to the registry. Subclasses over- * riding this method should call the parent method first. * @param $category String Name of category plugin was registered to * @param $path String The path the plugin was found in * @return boolean True iff plugin initialized successfully; if false, * the plugin will not be registered. */ function register($category, $path) { $returner = parent::register($category, $path); if ($this->getNewConferencePluginSettingsFile()) { HookRegistry::register('ConferenceSiteSettingsForm::execute', array(&$this, 'installConferenceSettings')); } return $returner; }
/** * Internal function to return a Role object from a row. * @param $row array * @return Role */ function &_returnRoleFromRow(&$row) { $role = new Role(); $role->setUserId($row['user_id']); $role->setRoleId($row['role_id']); HookRegistry::call('RoleDAO::_returnRoleFromRow', array(&$role, &$row)); return $role; }
/** * Register this plugin for all the appropriate hooks. */ function register($category, $path) { $success = parent::register($category, $path); if ($success) { HookRegistry::register('OAI::metadataFormats', array(&$this, 'callback_formatRequest')); } return $success; }
/** * Register the plugin. * @see Plugin::register */ function register($category, $path) { $result = parent::register($category, $path); if ($result && $this->isEnabled()) { HookRegistry::register('Harvester::preprocessRecord', array(&$this, '_preprocessRecord')); } return $result; }
function register($category, $path) { $result = parent::register($category, $path); if ($result) { HookRegistry::register('SchemaPlugin::indexRecord', array(&$this, '_postprocessEntry')); } return $result; }
function register($category, $path) { if (parent::register($category, $path)) { error_log('OJS - UHBP: der Haken wird registriert.'); Registry::set('UserHomeBlockPlugin', $this); HookRegistry::register('Templates::User::Index::MyAccount', array(&$this, 'callback')); } }