本文整理汇总了PHP中HookRegistry::call方法的典型用法代码示例。如果您正苦于以下问题:PHP HookRegistry::call方法的具体用法?PHP HookRegistry::call怎么用?PHP HookRegistry::call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HookRegistry
的用法示例。
在下文中一共展示了HookRegistry::call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: 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());
}
}
示例3: 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);
}
}
示例4: 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;
}
示例5: 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;
}
}
示例6: Role
/**
* 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;
}
示例7: _fromRow
/**
* Internal function to return a Conference object from a row.
* @param $row array
* @return Conference
*/
function _fromRow($row)
{
$conference = parent::_fromRow($row);
$conference->setPrimaryLocale($row['primary_locale']);
$conference->setEnabled($row['enabled']);
HookRegistry::call('ConferenceDAO::_returnConferenceFromRow', array(&$conference, &$row));
return $conference;
}
示例8: _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;
}
示例9: 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;
}
示例10: _fromRow
/**
* 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;
}
示例11: login
/**
* 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);
}
}
示例12: _fromRow
/**
* Internal function to return a scheduled conference object from a row.
* @param $row array
* @return SchedConf
*/
function _fromRow($row)
{
$schedConf = parent::_fromRow($row);
$schedConf->setConferenceId($row['conference_id']);
$schedConf->setStartDate($this->datetimeFromDB($row['start_date']));
$schedConf->setEndDate($this->datetimeFromDB($row['end_date']));
HookRegistry::call('SchedConfDAO::_returnSchedConfFromRow', array(&$schedConf, &$row));
return $schedConf;
}
示例13: array
/**
* Internal function to return an ObjectForReviewEditorAssignment object from a row.
* @param $row array
* @return ObjectForReviewEditorAssignment
*/
function &_fromRow($row)
{
$assignment = $this->newDataObject();
$assignment->setId($row['enroll_id']);
$assignment->setPublisherId($row['publisher_id']);
$assignment->setUserId($row['user_id']);
HookRegistry::call('ObjectForReviewEditorAssignmentDAO::_fromRow', array(&$assignment, &$row));
return $assignment;
}
开发者ID:justinshaffner,项目名称:AAAObjectsForReview,代码行数:14,代码来源:ObjectForReviewEditorAssignmentDAO.inc.php
示例14: EditorSubmission
/**
* Internal function to return an EditorSubmission object from a row.
* @param $row array
* @return EditorSubmission
*/
function &_returnEditorSubmissionFromRow(&$row)
{
$editorSubmission = new EditorSubmission();
// Article attributes
$this->articleDao->_articleFromRow($editorSubmission, $row);
$editorSubmission->setDecisions($this->sectionDecisionDao->getSectionDecisionsByArticleId($row['article_id']));
HookRegistry::call('EditorSubmissionDAO::_returnEditorSubmissionFromRow', array(&$editorSubmission, &$row));
return $editorSubmission;
}
示例15: _fromRow
/**
* Internal function to return an Division object from a row.
* @param $row array
* @return Division
*/
function _fromRow(&$row)
{
$division = $this->newDataObject();
$division->setId($row['division_id']);
$division->setPressId($row['press_id']);
$this->getDataObjectSettings('divisions_settings', 'division_id', $row['division_id'], $division);
HookRegistry::call('DivisionDAO::_fromRow', array(&$division, &$row));
return $division;
}