Hooks allow you to interfere with the dynamic page creation. If you define a function with the following name, it will be used by SofaWiki.
At this time, these hook are installed:
- swInternalLinkHook(val, label): When an internal link is identified, this hooks allows you to create a custom URL. Return the string with the URL. The link will open a new page. If you return false, the internal link will be normally be handled. Normally you would use the hook with a namespace prefix. If you do not want to display the prefix, use the pipe trick.
- swVirtualLinkHook(url, fields, query): These links may also be used for queries with FROM VIRTUAL and IMPORT. Note, that fields and query are given only for information. The internal filter will still project the columns and select the rows.
- swInternalCategoryHook(names,wikiname) overrides Category listing. You get an array of names and rating. The found list can be reordered, you can change the text for each entry and you can define a global prefix, a separator, a global postfix and a limit per page (default 50). You must return an array
- names: where each entry is name-content
- swInternalSearchHook(names,q) works the same way.
- swInternalNoAccessHook(name) lets you handle yourself when a user tries to access a page he cannot view.
- swInternalHasRightHook(user,action,name) allows you to add a custom complex access logic
- swInternalCronHook() allows you to make your own CronJob housekeeping. See inc/cron.php for details
- swGeneratePasswordHook() allows you to create your own default random passwords (instead of random 1111111 to 999999
- swLogHook($user,$name,$action,$query,$lang,$referer,$time,$error,$label,$message,$receiver) allows you to log data your own way.
swActionHookFile works different. It is not a function, but a path to a PHP file. You can include that code, if you want to implement custom actions not covered by the index action select loop.