[pmwiki-devel] Hooks to edit and save?
Petko Yotov
5ko at 5ko.fr
Thu Jun 18 03:40:25 CDT 2009
On Wednesday 17 June 2009 11:59:49 Fredrik Ernander wrote:
> * Catch a page before it is opened with action=edit and update it
> (doesn't need to be saved)
>
> * Catch a page that is saved so I can read data from it
>
> Could someone help me with what functions I should look at or some
> basic steps to get me going?
Hello.
When a page is saved, it is send through a number of functions which are
listed in the $EditFunctions variable.
You can insert your own functions in the $EditFunctions array, before and
after the 'PostPage' value. You may need array_search(), array_slice(),
array_splice(), array_unshift() or other core PHP functions
( http://php.net/manual/en/ref.array.php ).
These functions look like :
function MyFunction($pagename, &$page, &$new) { /*my code*/ }
where $page is an array containing the existing (old) page, $new is the new
content that the user has posted, and $new['text'] is the page text without
any additional metadata. Your functions can also modify the arrays. They
return nothing.
Thanks,
Petko
More information about the pmwiki-devel
mailing list