本文整理汇总了PHP中GenericPlugin类的典型用法代码示例。如果您正苦于以下问题:PHP GenericPlugin类的具体用法?PHP GenericPlugin怎么用?PHP GenericPlugin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GenericPlugin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: manage
/**
* @see GenericPlugin::manage()
*/
function manage($verb, $args, &$message, &$messageParams)
{
if (!parent::manage($verb, $args, $message, $messageParams)) {
return false;
}
switch ($verb) {
case 'settings':
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();
$templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
$this->import('SettingsForm');
$form = new SettingsForm($this, $journal->getId());
if (Request::getUserVar('save')) {
$form->readInputData();
if ($form->validate()) {
$form->execute();
$message = NOTIFICATION_TYPE_SUCCESS;
$messageParams = array('contents' => __('plugins.generic.alm.settings.saved'));
return false;
} else {
$form->display();
}
} else {
$form->initData();
$form->display();
}
return true;
default:
// Unknown management verb
assert(false);
return false;
}
}
示例2: 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')) {
return false;
}
$this->addLocaleData();
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('authordao::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;
}
示例3: manage
function manage($verb, $args, &$message)
{
if (!parent::manage($verb, $args, $message)) {
return false;
}
switch ($verb) {
case 'settings':
$templateMgr =& TemplateManager::getManager();
$templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
$journal =& Request::getJournal();
$this->import('ReferralPluginSettingsForm');
$form = new ReferralPluginSettingsForm($this, $journal->getId());
if (Request::getUserVar('save')) {
$form->readInputData();
if ($form->validate()) {
$form->execute();
Request::redirect(null, 'manager', 'plugin');
return false;
} else {
$this->setBreadCrumbs(true);
$form->display();
}
} else {
$this->setBreadCrumbs(true);
$form->initData();
$form->display();
}
return true;
default:
// Unknown management verb
assert(false);
}
}
示例4: 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);
$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('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;
}
示例5: 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;
}
示例6: manage
function manage($verb, $args)
{
if (!parent::manage($verb, $args, $message)) {
return false;
}
$this->import('CustomLocaleHandler');
$customLocaleHandler = new CustomLocaleHandler();
switch ($verb) {
case 'edit':
$customLocaleHandler->edit($args);
return true;
case 'saveLocaleChanges':
$customLocaleHandler->saveLocaleChanges($args);
return true;
case 'editLocaleFile':
$customLocaleHandler->editLocaleFile($args);
return true;
case 'saveLocaleFile':
$customLocaleHandler->saveLocaleFile($args);
return true;
default:
$customLocaleHandler->index();
return true;
}
}
示例7: register
/**
* Register the plugin, if enabled; note that this plugin
* runs under both Journal and Site contexts.
* @param $category string
* @param $path string
* @return boolean
*/
function register($category, $path)
{
if (parent::register($category, $path)) {
HookRegistry::register('ArticleHandler::download', array(&$this, 'callback'));
return true;
}
return false;
}
示例8: 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('TemplateManager::display', array($this, 'redirectRequest'));
}
return $success;
}
示例9: 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('metadataform::validate', array($this, 'callbackSaveMetadata'));
}
return $success;
}
示例10: register
function register($category, $path)
{
if (parent::register($category, $path)) {
HookRegistry::register('TemplateManager::display', array(&$this, 'addmeta'));
return true;
}
return false;
}
示例11: register
function register($category, $path)
{
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
HookRegistry::register('TemplateManager::include', array(&$this, '_callback'));
}
return true;
}
return false;
}
示例12: register
/**
* @see PKPPlugin::register()
*/
function register($category, $path)
{
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
HookRegistry::register('Templates::Galley::displayGalley', array($this, 'callback'));
}
return true;
}
return false;
}
示例13: register
/**
* @see Plugin::register()
*/
function register($category, $path)
{
if (parent::register($category, $path)) {
if ($this->getEnabled()) {
HookRegistry::register('ArticleHandler::view::galley', array($this, 'articleCallback'));
}
return true;
}
return false;
}
示例14: register
function register($category, $path)
{
if (parent::register($category, $path)) {
$journal =& Request::getJournal();
$journalId = $journal ? $journal->getId() : 0;
HookRegistry::register('TemplateManager::display', array(&$this, 'displayTemplateCallback'));
return true;
}
return false;
}
示例15: register
/**
* @see PKPPlugin::register()
*/
function register($category, $path)
{
if (!Config::getVar('general', 'installed')) {
return false;
}
$success = parent::register($category, $path);
if ($success) {
HookRegistry::register('LoadHandler', array(&$this, '_loadHandlerCallback'));
}
return $success;
}