/** * @copydoc Plugin::register */ function register($category, $path) { $this->pluginPath = $path; $result = parent::register($category, $path); $request = $this->getRequest(); if ($result && $this->getEnabled() && !defined('SESSION_DISABLE_INIT')) { HookRegistry::register('PageHandler::displayCss', array($this, '_displayCssCallback')); $templateManager = TemplateManager::getManager($request); $dispatcher = $request->getDispatcher(); $templateManager->addStyleSheet($dispatcher->url($request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css', null, array('name' => $this->getName())), STYLE_SEQUENCE_LATE); } return $result; }
/** * @see Plugin::register() */ function register($category, $path) { $success = parent::register($category, $path); if ($success && $this->getEnabled()) { $contextMap = $this->getContextMap(); $blockContext = $this->getBlockContext(); if (isset($contextMap[$blockContext])) { $hookName = $contextMap[$blockContext]; HookRegistry::register($hookName, array($this, 'callback')); } } return $success; }
/** * Generic plug-ins implement the enabled/disabled logic * by default. This is necessary so that we can make sure * that disabled plug-ins will not have to be instantiated. * * Call this method with a list of management verbs (if any) * generated by the custom plug-in. * * @see Plugin::getManagementVerbs() */ function getManagementVerbs() { // Site plug-ins can only be administered by site admins if ($this->isSitePlugin() && !Validation::isSiteAdmin()) { return array(); } $verbs = parent::getManagementVerbs(); if ($this->getEnabled()) { $verbs[] = array('disable', __('common.disable')); } else { $verbs[] = array('enable', __('common.enable')); } return $verbs; }
/** * @copydoc Plugin::register */ function register($category, $path) { if (!parent::register($category, $path)) { return false; } // Don't perform any futher operations if theme is not currently active if (!$this->isActive()) { return true; } // Themes must initialize their functionality after all theme plugins // have been loaded in order to make use of parent/child theme // relationships HookRegistry::register('PluginRegistry::categoryLoaded::themes', array($this, 'themeRegistered')); HookRegistry::register('PluginRegistry::categoryLoaded::themes', array($this, 'initAfter')); // Save any theme options displayed on the appearance and site settings // forms HookRegistry::register('appearanceform::execute', array($this, 'saveOptionsForm')); HookRegistry::register('appearanceform::readuservars', array($this, 'readOptionsFormUserVars')); HookRegistry::register('sitesetupform::execute', array($this, 'saveOptionsForm')); HookRegistry::register('sitesetupform::readuservars', array($this, 'readOptionsFormUserVars')); return true; }
/** * Constructor */ function GenericPlugin() { parent::LazyLoadPlugin(); }
/** * @copydoc Plugin::manage() */ function manage($args, $request) { $user = $request->getUser(); $router = $request->getRouter(); $context = $router->getContext($request); $form = $this->instantiateSettingsForm($context->getId()); $notificationManager = new NotificationManager(); switch ($request->getUserVar('verb')) { case 'save': $form->readInputData(); if ($form->validate()) { $form->execute(); $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS); return new JSONMessage(true); } return new JSONMessage(true, $form->fetch($request)); case 'clearPubIds': if (!$request->checkCSRF()) { return new JSONMessage(false); } $contextDao = Application::getContextDAO(); $contextDao->deleteAllPubIds($context->getId(), $this->getPubIdType()); $notificationManager->createTrivialNotification($user->getId(), NOTIFICATION_TYPE_SUCCESS); return new JSONMessage(true); default: $form->initData(); return new JSONMessage(true, $form->fetch($request)); } return parent::manage($args, $request); }
/** * Get template directory * @return string */ function getTemplatePath() { return parent::getTemplatePath() . 'templates/'; }
/** * @copydoc PKPPlugin::getTemplatePath() */ function getTemplatePath($inCore = false) { return parent::getTemplatePath($inCore) . 'templates/'; }
/** * Constructor */ function __construct() { parent::__construct(); }