Questions answered by this recipe
This section is optional; use it to indicate the types of questions (if any) this recipe is intended to answer.
How to enable adding object oriented extensions to PmWiki
This recipe defines an __autoload($classname) function (in WikiObjects.php), which does a cascading search for the class declaration in a php file of the same name as the parameter in:
- customclasses/ (from local launch directory)
$FarmD/customclasses/ (farm directory, if different from local launch directory)
$FarmD/pluginclasses/ (farmdirectory, same as local directory in a single site installation, intended for PmWiki plugins)
$FarmD/coreclasses/ (farmdirectory, same as local directory in a single site installation, intended for PmWiki core OOP wrappers and core extensions)
These directories are searched in the order listed.
The recipe (through WikiObjectsSetHandlers.php) also hijacks the selected action handler from the global $HandleActions array (then chains back to it).
This allows the main object environment to be initialized after configuration activity, and before action handlers proceed.
- Install WikiObjects.zipΔ in cookbook/ directory unzipped of course).
- add the line
to config.php or farmconfig.php at the very beginning of the config file.
- add the line
to config.php or farmconfig.php at the very end of the config file. If this is a farmconfig.php file, make sure that local/config.php is called from within farmconfig.php before the set handlers call. In other words all configuration should be complete by the time this cookbook script is called.
- prior to the above include statement, add the lines
SDV($CurrentTimeISO, strftime($TimeISOFmt, $Now));
calling stdconfig before the ObjectWiki initialization allows the upload $ActionHandler to be set first.
- Create the above search directories.
- unzip the wrappers and extensions below to the coreclasses directory.
- extend classes from the core classes, and place them in the pluginclasses or customclasses directories. Place class definitions in the appropriate directory, file names same as class names with ".php" extension (eg. MyClass.php)
These components are generic, and are intended to be placed in the "coreclasses" directory. Custom classes would be placed in a "customclasses" directory. Plugins (analogue to "recipes") would be placed in the "pluginclasses" directory. These versions are extremely early, sketchy, and experimental.
PmWiki wrappers are Classes wrapped around PmWiki native core scripts. The goal is to have a wrapper for each native script, to be referenced in the short run by core extensions classes. This mitigates against future changes to the organization and implementation of the PmWiki Core. To isolate wrapper classes from other classes, we use the "PMW_" prefix. PmWiki wrappers are all singleton classes (PMW_Wrapper::instance())
PmWiki extensions are intended to take advantage of availability of object modeling and general experience with PmWiki to extend (carefully) the core PmWiki model. Another intention is to shield custom extensions from native wrappers (left column) as much as possible. These are generic extensions. Custom extensions would be based on inheritance of these extensions.
Current core extensions:
If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".
- February 2, 2008: establish __autoload() function (WikiObjects.php cookbook script):
- February 2, 2008: establish PMW_Skins class.
- February 2, 2008: establish PageFrameworks, PageFramework, and PageComponent classes.
- February 3, 2008: change class script directory organization: classes changed to customclasses; pluginclasses added
- February 8, 2008: added WikiObjectsSetHandlers.php cookbook script
- February 8, 2008: - PageComponent class renamed to PageAddin class - Wrappers added: PMW_PmWiki, PMW_Uploads - classes added: Repository, ObjectWiki
- February 9, 2008: Added 'upload' to list of hijacked action handlers; removed 'parent_repository' from Repository class
- February 11, 2009: Added diff to list of actions hijacked by WikiObjects
- February 13, 2009: Generalized WikiObjectsSetHandlers.php to generically hijack any selected action handler