[Pmwiki-users] Request for method to let plugins execute code after stdconfig.php

Christian Ridderström chr
Fri Jul 16 03:48:54 CDT 2004


Hi Patrick

I'm helping John with his work on page drafts, and he's got some
difficulties in making the plugin do all that he wants. Basically I think
he needs to let the code modify some variables after stdconfig.php, or
possibly after other plugins, have done their job.

I've also at times felt that this would be useful for some of the
configurations that I've done. What do you think of adding a method to
pmwiki that lets plugins add a function to a list of functions, and these
functions are then executed after stdconfig.php has been run.

One solution could be to use a 'hook'-class I wrote a while back. From the
point of view of the plugin designer, he would use it like this:

	function my_plugin_hook() {
		...
	}

	$after_stdconfig_hook->append('my_plugin_hook');

and once pmwiki has included stdconfig.php (or perhaps at the end of
stdconfig.php) then the function

	my_plugin_hook()

is executed.


>From pmwiki's point of view, 'hook.php' needs to be included and the hook 
variable needs to be initialized:

	include_once('scripts/hook.php');
	$after_stdconfig_hook = new Hook();

and then after stdconfig.php has been included, this code would be added:

	$after_stdconfig_hook->run();


What do you think?

/Christian

PS. You'll find the hook class here:

	http://wiki.lyx.org/pub/config/hook.php.txt

-- 
Christian Ridderstr?m                           http://www.md.kth.se/~chr






More information about the pmwiki-users mailing list