PKPUsageStatsPlugin::register PHP Method

register() public method

See also: LazyLoadPlugin::register()
public register ( $category, $path )
    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);
            }
            if ($this->getSetting(CONTEXT_ID_NONE, 'displayStatistics')) {
                $this->displayReaderStatistics();
            }
        }
        return $success;
    }