Removes a registered observer that correspond to the given criteria
public removeObserver ( $callback, $nName = EVENT_DISPATCHER_GLOBAL, $class = null ) : boolean | ||
Результат | boolean | True if an observer was removed, false otherwise |
/** * @param Piwik_Plugin $plugin * @return void */ public function unloadPlugin($plugin) { if (!$plugin instanceof Piwik_Plugin) { $plugin = $this->loadPlugin($plugin); } $hooks = $plugin->getListHooksRegistered(); foreach ($hooks as $hookName => $methodToCall) { $success = $this->dispatcher->removeObserver(array($plugin, $methodToCall), $hookName); if ($success !== true) { throw new Exception("Error unloading plugin = " . $plugin->getClassName() . ", method = {$methodToCall}, hook = {$hookName} "); } } unset($this->loadedPlugins[$plugin->getClassName()]); }
/** * @param Core_Module $module */ public function unloadModule($module) { if (!$module instanceof Core_Module) { $module = $this->loadModule($module); } $hooks = $module->getListHooksRegistered(); foreach ($hooks as $hookName => $methodToCall) { $success = $this->dispatcher->removeObserver(array($module, $methodToCall), $hookName); if ($success !== true) { throw new Exception("Error unloading module = " . $module->getClassName() . ", method = {$methodToCall}, hook = {$hookName} "); } } unset($this->loadedModules[$module->getClassName()]); }