WikiObjects
Questions answered by this recipe
How to enable adding object oriented extensions to PmWiki
Description
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.
Notes
- Install WikiObjects.zipΔ in cookbook/ directory unzipped of course).
- add the line
include_once("$FarmD/cookbook/WikiObjects.php");
to config.php or farmconfig.php at the very beginning of the config file. - add the line
include_once("$FarmD/cookbook/WikiObjectsSetHandlers.php");
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($CurrentTime
, strftime($TimeFmt
, $Now));
SDV($CurrentTimeISO, strftime($TimeISOFmt, $Now));
if (IsEnabled($EnableStdConfig
,1))
include_once("$FarmD
/scripts/stdconfig.php");
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)
Additional Components
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 WrappersPmWiki 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()) wikiobjects-pmwikiwrappers.zipΔ Version: February 8, 2009 Current wrappers:
|
Core ExtensionsPmWiki 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. wikiobjects-core_extensions.zipΔ Version: February 8, 2009 Current core extensions:
|
Key Definitions
|
Release Notes
- 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
See Also
Contributors
Comments
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.