Over the last two days, I've installed and configured MediaWiki, WordPress, Status.net and Drupal on one of our training systems, and looked (in each case) at how to configure them and install extra plugins / modules - both standardly available ones, and also how to start writing your own.
In two days we've only been able to scratch the surface of these huge topic, but the question arose "How do the standard packages see / register call the add ons". Details vary, but much of it is done through the use of callbacks. So - how do callbacks work?
The base code of each of these open source applications includes arrays which contain the names of all the functions that might be called - as strings. And other strings can be dynamically added to the list too.
When the code if run, these extra routines will be called at predetermined places in the source, thus running that extra code; a check with function_exists ensures that the application doesn't fall over by trying to run code that's not available. There's a demonstration
[here] which shows you the mechanism.
I was very impressed by the extensive documentation in MediaWiki for its extension hooks - see
[here] - perhaps this is the open source application that I'm most familiar with tailoring, although we also use the SMF forum in many guises ;-)
(written 2010-03-17, updated 2010-03-25)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
H401 - Some extra PHP modules [732] Where is a web site visitor browsing from - (2006-05-24)
[2343] World Flags in your PHP pages - (2009-08-10)
[3453] Reading and using emails including enclosures on your web server. - (2011-09-23)
[3454] Your PHP website - how to factor and refactor to reduce growing pains - (2011-09-24)
H400 - Open Source Applications in PHPH105 - PHP - Functions [96] Variable Scope - (2004-10-22)
[223] There is a function in PHP to do that - (2005-02-21)
[308] Call by name v call by value - (2005-05-11)
[339] Passing information into and out of PHP functions - (2005-06-07)
[340] Code and code maintainance efficiency - (2005-06-08)
[409] Functions and commands with dangerous names - (2005-08-11)
[421] Don't repeat code - use loops or functions - (2005-08-21)
[775] Do not duplicate your code - (2006-06-23)
[866] A lazy programmer is a good programmer - (2006-09-15)
[936] Global, Superglobal, Session variables - scope and persistance in PHP - (2006-11-21)
[1021] PHP - static declaration - (2007-01-04)
[1163] A better alternative to cutting and pasting code - (2007-04-26)
[1202] Returning multiple values from a function (Perl, PHP, Python) - (2007-05-24)
[1267] is there a lookup function in php? - (2007-07-15)
[1357] Clean my plate, but keep my wine bottle. (PHP; Static) - (2007-09-18)
[1380] Static variables in PHP - (2007-10-05)
[1784] Global - Tcl, PHP, Python - (2008-09-03)
[2488] A variable number of arguments in a PHP function - (2009-11-02)
[2630] Static variables and ampersands in PHP - (2010-02-10)
[2737] Improving your function calls (APIs) - General and PHP - (2010-04-24)
[2929] Passing a variable number of parameters in to a function / method - (2010-08-20)
[3026] Coding efficiency - do not repeat yourself! - (2010-11-02)
Some other Articles
Freedom of Information - consideration for web site designersStairsException handling in PHPCar Parking in MelkshamAdding extensions to PHP Open Source applications - callbacksTcl - a great engineering languageStatic class members in PHP - a documented exampleHow to build a test harness into your PHPReaching out to the community - a good case for supportBlowing out the winter cobwebs