本文整理汇总了PHP中HookRegistry类的典型用法代码示例。如果您正苦于以下问题:PHP HookRegistry类的具体用法?PHP HookRegistry怎么用?PHP HookRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HookRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: register
/**
* 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;
}
开发者ID:ramonsodoma,项目名称:harvester,代码行数:41,代码来源:MysqlIndexPlugin.inc.php
示例2: __construct
/**
* Constructor
*/
function __construct()
{
parent::__construct();
if ($this->getEnabled()) {
HookRegistry::register('TemplateManager::display', array($this, 'loadJavaScript'));
}
}
开发者ID:pkp,项目名称:ojs,代码行数:10,代码来源:CitationPlugin.inc.php
示例3: handleRequest
/**
* 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());
}
}
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:36,代码来源:index.php
示例4: getNotificationContents
/**
* 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);
}
}
开发者ID:artkuo,项目名称:ocs,代码行数:38,代码来源:NotificationManager.inc.php
示例5: register
/**
* @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;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:32,代码来源:PKPUsageStatsPlugin.inc.php
示例6: cite
/**
* 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');
}
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:14,代码来源:CitationPlugin.inc.php
示例7: register
/**
* 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;
}
开发者ID:ramonsodoma,项目名称:ojs,代码行数:39,代码来源:GoogleAnalyticsPlugin.inc.php
示例8: insertTombstoneByPublicationFormat
/**
* 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;
}
}
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:38,代码来源:PublicationFormatTombstoneManager.inc.php
示例9: register
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;
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:26,代码来源:CustomLocalePlugin.inc.php
示例10: register
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;
}
开发者ID:jalperin,项目名称:ocs,代码行数:26,代码来源:CustomLocalePlugin.inc.php
示例11: insertArticleTombstone
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;
}
}
开发者ID:EreminDm,项目名称:water-cao,代码行数:25,代码来源:ArticleTombstoneManager.inc.php
示例12: CitationPlugin
/**
* Constructor
*/
function CitationPlugin()
{
parent::Plugin();
if ($this->getEnabled()) {
HookRegistry::register('TemplateManager::display', array($this, 'loadJavaScript'));
}
}
开发者ID:bkroll,项目名称:ojs,代码行数:10,代码来源:CitationPlugin.inc.php
示例13: getEnableFields
/**
* 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;
}
开发者ID:ramonsodoma,项目名称:harvester,代码行数:35,代码来源:TinyMCEPlugin.inc.php
示例14: register
/**
* 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;
}
开发者ID:EdwardDavid,项目名称:handle,代码行数:31,代码来源:pidPlugin.inc.php
示例15: register
/**
* 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;
}
开发者ID:yuricampos,项目名称:ojs,代码行数:16,代码来源:PaymethodPlugin.inc.php
示例16: register
function register($category, $path)
{
if (parent::register($category, $path)) {
HookRegistry::register('TemplateManager::display', array(&$this, 'addmeta'));
return true;
}
return false;
}
开发者ID:ajnyga,项目名称:addRobotMeta,代码行数:8,代码来源:AddRobotMetaPlugin.inc.php
示例17: register
/**
* 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;
}
开发者ID:mczirfusz,项目名称:pkp-lib,代码行数:16,代码来源:PKPPaymethodPlugin.inc.php
示例18: MeetingSectionDecision
/**
* 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;
}
开发者ID:JovanyJeff,项目名称:hrp,代码行数:15,代码来源:MeetingSectionDecisionDAO.inc.php
示例19: _fromRow
/**
* 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;
}
开发者ID:mariojp,项目名称:ojs,代码行数:13,代码来源:JournalDAO.inc.php
示例20: register
/**
* 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;
}
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:14,代码来源:CRKNPlugin.inc.php
注:本文中的HookRegistry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论