register() public method

public register ( $category, $path )
Exemplo n.º 1
0
 /**
  * @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;
 }
Exemplo n.º 2
0
 /**
  * @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;
 }
 /**
  * @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')) {
         $templateManager = TemplateManager::getManager($request);
         HookRegistry::register('PageHandler::displayCss', array($this, '_displayCssCallback'));
         // Add the stylesheet.
         $dispatcher = $request->getDispatcher();
         $templateManager->addStyleSheet($dispatcher->url($request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css', null, array('name' => $this->getName())), STYLE_SEQUENCE_LATE);
         // If this theme uses templates, ensure they're given priority.
         array_unshift($templateManager->template_dir, $path = Core::getBaseDir() . DIRECTORY_SEPARATOR . $this->getPluginPath() . '/templates');
     }
     return $result;
 }
 /**
  * @copydoc Plugin::register()
  */
 function register($category, $path)
 {
     if (!parent::register($category, $path)) {
         return false;
     }
     if ($this->getEnabled()) {
         // Enable storage of additional fields.
         foreach ($this->getDAOs() as $publicObjectType => $dao) {
             HookRegistry::register(strtolower_codesafe(get_class($dao)) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
             if (strtolower_codesafe(get_class($dao)) == 'submissionfiledao') {
                 // if it is a file, consider all file delegates
                 $fileDAOdelegates = $this->getFileDAODelegates();
                 foreach ($fileDAOdelegates as $fileDAOdelegate) {
                     HookRegistry::register(strtolower_codesafe($fileDAOdelegate) . '::getAdditionalFieldNames', array($this, 'getAdditionalFieldNames'));
                 }
             }
         }
     }
     $this->addLocaleData();
     return true;
 }
Exemplo n.º 5
0
 /**
  * @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;
 }
Exemplo n.º 6
0
 /**
  * @copydoc Plugin::register
  */
 function register($category, $path)
 {
     if (!parent::register($category, $path)) {
         return false;
     }
     $request = $this->getRequest();
     if ($this->getEnabled() && !defined('SESSION_DISABLE_INIT')) {
         $templateManager = TemplateManager::getManager($request);
         HookRegistry::register('PageHandler::displayCss', array($this, '_displayCssCallback'));
         $context = $request->getContext();
         $site = $request->getSite();
         $contextOrSite = $context ? $context : $site;
         // Add the stylesheet.
         if ($contextOrSite->getSetting('themePluginPath') == basename($path)) {
             $dispatcher = $request->getDispatcher();
             $templateManager->addStyleSheet($dispatcher->url($request, ROUTE_COMPONENT, null, 'page.PageHandler', 'css', null, array('name' => $this->getName())), STYLE_SEQUENCE_LATE);
             // If this theme uses templates, ensure they're given priority.
             array_unshift($templateManager->template_dir, $path = Core::getBaseDir() . DIRECTORY_SEPARATOR . $this->getPluginPath() . '/templates');
         }
     }
     return true;
 }