*/ /** * Debug Module * * This module provides some debug information on Gallery * * @package Debug */ class DebugModule extends GalleryModule { function DebugModule() { global $gallery; $this->setId('debug'); $this->setName('Debugging'); $this->setDescription($gallery->i18n('Debugging and Developer Tools')); $this->setVersion('0.8.7'); $this->setGroup('gallery', $this->translate('Gallery')); $this->setCallbacks('getItemLinks'); $this->setRequiredCoreApi(array(4, 0)); $this->setRequiredModuleApi(array(0, 9)); } /** * @see GalleryModule::autoConfigure() */ function autoConfigure() { /* We don't require any special configuration */ return array(GalleryStatus::success(), true); } /** * @see GalleryModule::performFactoryRegistrations() */ function performFactoryRegistrations() { $ret = GalleryCoreApi::registerFactoryImplementation('GalleryStatusFormatter', 'DebugStatusFormatter', 'DebugStatusFormatter', 'modules/debug/classes/DebugStatusFormatter.class', 'debug', array('text/html')); if ($ret->isError()) { return $ret->wrap(__FILE__, __LINE__); } return GalleryStatus::success(); } /** * @see GalleryModule::getItemLinks */ function getItemLinks($items) { list ($ret, $isAdmin) = GalleryCoreApi::isUserInSiteAdminGroup(); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null); } $links = array(); if ($isAdmin) { foreach ($items as $item) { $links[$item->getId()][] = array('text' => $this->translate('show debug tree'), 'params' => array('view' => 'debug:ShowTree', 'itemId' => $item->getId())); } } return array(GalleryStatus::success(), $links); } } ?>