Parser für Plugins
title : Parser für Plugins version : 1.1 author : Andre "Guandalug" Meiske licence : GPL description : Ermögliche einem Plugin, Einstellungen aus einer Content-Datei zu lesen phpCMS version: 1.2.x
GPL (licence content will be added later)
 Short Description
You're a plugin author, and you need to pass a couple of parameters to your plugin? Parameters that neet to be defined by the context, not for the whole project? In that case, the Parser for Plugins can help you.
Note: This plugin is not menat for end-users, but for plugin-developers. As such, the following documentation will be heavy on the technical side.
Public functions of the class phpCMS_Parser:
The constructor of the class. Requires the content of the current page ($PageContent) as argument, because it's not available globally.
$myConfig = new phpCMS_Parser($PageContent);
Additionally, the function takes three optional arguments:
- The name of the config-section (defaults to 'CONFIG')
- An associative array with config options as keys and their default setting as respective values.
- Format array that controls the interpretion of parsed values and should be an associative array that maps config options to format descriptors. The supported format descriptors are:
- 'string' - the value is interpreted as a string (default)
- 'bool' - the value gets cast into a boolean. The values 'true', '1', 'ja', 'yes', 'an' and 'on' are mapped to TRUE, all others to FALSE
- 'int' - The value gets converted into an integer
- 'float' - The value is interpreted as a floating point number.
- 'string-array' - The value is interpreted as a list of strings that are separated by a semikolon (;) - all substrings are 'trim'ed and stored
- 'int-array' - The value is interpreted as a list of integers divided by a semikolon - all subsections are cast to integer
- 'float-array' - The value is interpreted as a list of floating point numbers, divided by a semikolon - all subsections are cast to floating point numbers
Query the class for a configuration option's setting. If a key (the config option in question) is given, the config array is checked for the value to this key. In case the key doesn't exist, NULL is returned, else the value of the key. When no key has been given, the whole config array gets returned.
The subdirectory 'example/' contains an example-plugin that makes use of the parser, together with a content-file with a parseable section.
 Development Status / known bugs
The plugin is to be considered 'stable', and there are no known bugs right now. If you found any, report them over at the phpCMS support forum.
 Version History
- 2004-04-18 - Release of Version 1.1