From fe9ac278c737dbcd2e4ca723d8f8117b235ebc80 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 26 Feb 2016 09:22:06 +0100 Subject: [PATCH] list all registered hooks --- out/out.Hooks.php | 37 +++++++++++++++ views/bootstrap/class.Hooks.php | 81 +++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 out/out.Hooks.php create mode 100644 views/bootstrap/class.Hooks.php diff --git a/out/out.Hooks.php b/out/out.Hooks.php new file mode 100644 index 000000000..63870eb9e --- /dev/null +++ b/out/out.Hooks.php @@ -0,0 +1,37 @@ +isAdmin()) { + UI::exitError(getMLText("admin_tools"),getMLText("access_denied")); +} + +$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'settings'=>$settings)); +if($view) { + $view($_GET); + exit; +} + diff --git a/views/bootstrap/class.Hooks.php b/views/bootstrap/class.Hooks.php new file mode 100644 index 000000000..daff0577f --- /dev/null +++ b/views/bootstrap/class.Hooks.php @@ -0,0 +1,81 @@ + + * @copyright Copyright (C) 2002-2005 Markus Westphal, + * 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli, + * 2010-2012 Uwe Steinmann + * @version Release: @package_version@ + */ + +/** + * Include parent class + */ +require_once("class.Bootstrap.php"); + +/** + * Class which outputs the html page for Hooks view + * + * @category DMS + * @package SeedDMS + * @author Uwe Steinmann + * @copyright Copyright (C) 2016 Uwe Steinmann + * @version Release: @package_version@ + */ +class SeedDMS_View_Hooks extends SeedDMS_Bootstrap_Style { + + /** + * List all registered hooks + * + */ + function list_hooks() { /* {{{ */ + if(!isset($GLOBALS['SEEDDMS_HOOKS'])) + return; + + echo "\n"; + echo ""; + echo "\n"; + echo ""; + echo ""; + foreach(array('controller', 'view') as $type) { + if(isset($GLOBALS['SEEDDMS_HOOKS'][$type])) { + foreach($GLOBALS['SEEDDMS_HOOKS'][$type] as $name=>$objects) { + $first = true; + foreach($objects as $object) { + $reflector = new ReflectionClass(get_class($object)); + $methods = $reflector->getMethods(); + array_walk($methods, function (&$v) { $v = $v->getName()."();"; }); + if($first) + echo ""; + else + echo ""; + $first = false; + } + } + } + } + echo ""; + echo "
TypeName of hookName of classFile
".$type."".$name."".get_class($object)."

Methods: ".implode(" ", $methods)."

".$reflector->getFilename()."
".get_class($object)."

Methods: ".implode("; ", $methods)."

".$reflector->getFilename()."
\n"; + } /* }}} */ + + function show() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + + $this->htmlStartPage(getMLText("admin_tools")); + $this->globalNavigation(); + $this->contentStart(); + $this->pageNavigation(getMLText("admin_tools"), "admin_tools"); + $this->contentHeading("Hooks"); + + self::list_hooks(); + + $this->htmlEndPage(); + } /* }}} */ +} +