A general pluginterface

The main PHP script of ErfurtWiki contains everything necessary to run a wiki site (except the html around which make up your sites` layout). However at some point of its development the extensions got too large to be included into the core without hurting speed. So from now non-essential but powerful extensions can be added (using just PHPs include() statement) into the engine through the new pluginterface, which is surprisingly just a simple array structure listing the extension functions.Diapering

Please see the README for more informations about it.

List of plugin calls(ListOfPlugins also available):

The readme suggests greping the source code to get a current list of all plugins, this perl/shell utils snippet does the job:

cat $(find -type f) | perl -n -e 'if ($_ =~ 
     /\$ewiki_plugins\["(.*?)"\]\["?(.*?)"?\]/ )
     {print "Plugin Group:$1 Item:$2\n";}'  | 
     sort -u

Originally extracted from the CVS(Aug 18, 2003):

Group Item Comment
action_links info
action_links view
action $action Action plugins are of the signature $pf($id, $data, $action). If ewiki_plugins ["page"] [$action] exists it will be run. Action plugins are subject to the effects of page plugins and running one will bypass all other actions/plugins.
action *EWIKI_ACTION_ATTACHMENTS
action *EWIKI_ACTION_CALENDAR
action binary
action diff
action edit
action fetchback
action imageappend
action info
action like
action links
action mpi
action view
action_always $action Action always plugins are of the signature $pf($id, $data, $action). If ewiki_plugins ["action_always"] [$action] exists it will be run. action_always plugins are subject to the effects of handlers and running one will bypass all other actions/plugins.
alias $id
auth_perm 0
auth_query 0
auth_user
binary_get
binary_store
database 0
database
dl action
dl page
edit_hook
edit_patch 0
edit_patch
edit_preview 0
edit_preview
format_final
format_line
format_source
format_table 0
format_table
handler Handlers can alter or replace the text on a page. Their signature is $pf($id, $data, $action). If they return any value that will replace the page bypassing itself any plugin or action before page_final, but they can also return nothing and execution will continue. All handlers are always run even if one returns data, handlers later in the handlers array may recieve data altered by the the earlier handlers if they accepted parameters by reference. Handlers are subject to everything view_init is and also to authentication calls. [http://astore.amazon.com/bissellcleaner-20?_encoding=UTF8&node=138 shop-vac filters]
idf img
idf obj
idf url
image_resize 0
image_resize
init -1
init -5
interwiki $p1
link_final
link_url
list_dict 0
list_pages 0
list_pages
mime_magic 0
mpi $mpi_name
mpi allauthors
mpi allpages
mpi allusers
mpi calendar
mpi insert
mpi listplugins
mpi multimedia
page $page Page plugins are of the signature $pf($id, $data, $action). If ewiki_plugins ["page"] [$page] exists it will be run. Page plugins are subject to the effects of action_always and running one will bypass all other actions/plugins.
page $href
page $id
page AboutPlugins
page *DanglingSymlinks In page_wantedpages, apparently off.
page *EWIKI_PAGE_INDEX the FrontPage in ErfurtWiki
page *EWIKI_PAGE_CALENDAR Calendar
page *EWIKI_PAGE_DOWNLOAD FileDownload
page *EWIKI_PAGE_EMAIL ProtectedEMail - usually empty page
page *EWIKI_PAGE_HITS MostVisitedPages
page *EWIKI_PAGE_IMAGEGALLERY
page *EWIKI_PAGE_NEWEST NewestPages
page *EWIKI_PAGE_ORPHANEDPAGES OrphanedPages also know as *DanglingSymlinks
page *EWIKI_PAGE_PAGEINDEX list of all pages: PageIndex
page *EWIKI_PAGE_POWERSEARCH PowerSearch
page *EWIKI_PAGE_RANDOMPAGE *RandomPage
page *EWIKI_PAGE_SEARCH
page *EWIKI_PAGE_SINCEUPDATES
page *EWIKI_PAGE_UPDATES
page *EWIKI_PAGE_UPLOAD *FileUpload
page *EWIKI_PAGE_VERSIONS MostOftenChangedPages
page *EWIKI_PAGE_WORDINDEX WordIndex
page *EWIKI_PAGE_YEAR_CALENDAR site-wide *YearCalendar
page Fortune
page *InterWikiMap
page PhpInfo
page README.de handled by dedicated pre-rendering plugin
page README handled by dedicated pre-rendering plugin
page *ScanDisk page/db diagnostics and senseless infos
page *WantedPages In page_wantedpages, on.
page *WikiUserLogin in page_wikiuserlogin
render 0
render
task
view_append -1 Reserved? for the control links plugin.
view_append
view_final -1 Reserved? for the title plugin.
view_final
view_init View init_plugins are of the signature $pf($id, $data, $action) and are called once before any other plugin code and are unset after they are called. view_init plugins are subject to disabled flags, non-existant page checks, database initialization, version fetchbacks, and auto-edit changing the action to edit.

Looking at some of the code this morning it seems that [view_append][-1], [view_final][-1], and a few other numeric positions are apparently reserved for special functions, should we codify this with constants i.e. [view_append][EWIKI_APPEND_CONTROLSLINKS] and [view_append][EWIKI_ADD_TITLE]? I ask because I'm adding code to the calender plugin to display titles of calender pages as a date. -- Andy Cookware & Baking

No. The numbers have no very special meaning, but often the numeric indicies are not just array sugar but are used to order the entries of our plugin registry. So the numbers in this case are also only used to get the _control_links called earlier than other registered functions. (The entries must be ksorted() before the numeric indicies actually count as ordered.) I think there was also somewhere a -5 index, but this was much the same.

Right, the -5 is in init FWIW. The concern I have is what if the title moves from -1 to -3? Can I still plugin replace it? With a constant(EWIKI_ADD_TITLE_POSITION?) I could follow the change without any special effort. -- Andy

mi: You should of course not rely on these numbers, but instead try to traverse the plugin hook array and to strip the offending plugin on string match: if(strstr($ew_pl[][], "_control_li") or so. If you definitely want to insert your own control line, then the favoured way was to set *EWIKI_CONTROL_LINE accordingly, so the old _control_line could wouldn't get registered at all.

Btw, for the PostProject I for example wrote a "nn_rm_plugin()" function call to do exactly what you suggested :-)
But I don't think this function should be part of the ewiki core, as there are only two or three cases, where one would want to use it. It is probably better to include a $ewiki_plugins[] array scanning loop to replace the old core "_control_links" entry with your replacement function (but additionally unsetting the config constant, just to be safe ;)bissell lift off revolution turbo

Ok, here's how I'm trying to use the plugin architecture, I want to replace whatever title print routine they are using with my own, which calls the original one for titles of no interest to it. Thus I have within my plugin:

$ewiki_plugins["print_title"]=$ewiki_plugins["view_final"][-1];
$ewiki_plugins["view_final"][-1]="ewiki_calendar_print_title";

-- Andy

mi: As there cannot be two different ewiki_print_title replacment plugins active at the same time, it is probably sufficient to exchange the function hook by searching for it (foreach + strstr). This would reduce the need for a constant holding a -1. And after all the title handling will get overhauled in one of the next releases (maybe with ["print_title"][0]).

DevelopmentPlans

The mpi plugins

Another extension are the mpi plugins which themselves utilize the general pluginterface to chain into the page transformation process to extend it with wiki markup that allows dynamic content.

Cookware & Baking

The host application provides services which the plug-in can use, including a way for plug-ins to register themselves with the host application and a protocol for the exchange of data with plug-ins. Plug-ins depend on the services provided by the host application and do not usually work by themselves. Conversely, the host application operates independently of the plug-ins, making it possible for end-users to add and update plug-ins dynamically without needing to make changes to the host application. Shoes Air Compressors

Sponsor Link write my essay

bottom corner