Plugin
Version: 1.0
Author: Daniel van Hoesel
E-Mail: webdev@danielvanhoesel.nl
Comment: Thanx for downloading my class, pleaze if you find any bugs or you have some
tips for me email me at: webdev@danielvanhoesel.nl. (And sorry if my english is
not so good :) ). Have fun.
Licence: Freeware
Demo: test.class.plugin.php (small example)
plugins/plugin.foo.php (plugin example 1)
plugins/plugin.bar.php (plugin example 2)
Avaible functions in class:
Public functions:
*****************************************************************************************
- constructor: plugin($strPluginPath = "", $strPrefix = "?.plugin.php")
-- input: $strPluginPath - string
---- default: nothing
-- input: $strPrefix - string
---- default: 'plugin.?.php'
-- output: nothing
-- result: Constructor, will be executed when plugin class is called. If $strPluginPath
and $strPrefix is set the function will automaticly execute:
$this->loadAllPlugins. $strPrefix: Prefix that will be used for searching
the directory, i.e.:
> prefix: plugin.?.php, will find all files with plugin.ANY_CHAR.php
> prefix: ?.plugin.php, will find all files with ANY_CHAR.plugin.php
If $strPluginPath is set the class will look into that directory for available
plugins. $strPluginPath can be an array of directorys.
*****************************************************************************************
Error handling functions:
*****************************************************************************************
- setHideValidateDirWarning($booHideValidateDirWarning)
-- input: boolean (true|false)
---- default: false
-- output: nothing
-- result: Will hide all error messages if the plugin directory is empty or invalid if
set to true
*****************************************************************************************
*****************************************************************************************
- setHideAllErrors($booHideAllErrors)
-- input: boolean (true|false)
---- default: false
-- output: nothing
-- result: Will hide all error messages if set to true
*****************************************************************************************
*****************************************************************************************
- setDieOnErrors($booDieOnErrors)
-- input: boolean (true|false)
---- default: false
-- output: nothing
-- result: If set to true plugin processing will be stopped when an error occured
*****************************************************************************************
*****************************************************************************************
- setErrorHandler($mixErrorHandler)
-- input: function (mix)
---- default: nothing
-- output: nothing
-- result: When set the class will pass true all errors to your own custimized error
handler (two argument: $strErrorMsg, $strErrorType)
*****************************************************************************************
Config functions
*****************************************************************************************
- setDisablePrefix($booDisablePrefix)
-- input: boolean (true|false)
---- default: false
-- output: nothing
-- result: When set to true all files with the extenstion *.php will be found as valid
plugins for loading
*****************************************************************************************
*****************************************************************************************
- setGetPluginInfo($setGetPluginInfo)
-- input: boolean (true|false)
---- default: true
-- output: nothing
-- result: Retrieve some information from the plugins header, its buggy so i think you
set it to false
*****************************************************************************************
*****************************************************************************************
- setArgumentDelimeter($strDelimeter)
-- input: string
---- default: ','
-- output: nothing
-- result: When a function wil be called the arguments that are given in a string format
will be cut at this delimeter so the class has an array with argument to pass
true to the funtion
*****************************************************************************************
*****************************************************************************************
- setPluginPath($strPluginPath)
-- input: string|array
---- default: nothing
-- output: nothing
-- result: Search this directory for valid plugins
*****************************************************************************************
*****************************************************************************************
- setFilenamePrefix($strPrefix)
-- input: string
---- default: 'plugin.?.php'
-- output: nothing
-- result: Prefix that will be used for searching the directory, i.e.:
prefix: plugin.?.php, will find all files with plugin.ANY_CHAR.php
prefix: ?.plugin.php, will find all files with ANY_CHAR.plugin.php
*****************************************************************************************
Plugin functions
*****************************************************************************************
- loadAllPlugins
-- input: nothing
---- default: nothing
-- output: nothing
-- result: All available plugin that can be used for loading is set in an array:
$this->arrAvailablePlugins, a count of all plugin is set in:
$this->intAvailablePlugins
*****************************************************************************************
*****************************************************************************************
- execPlugin($strPlugin, $mixArguments = "")
-- input: strPlugin - string
---- default: nothing
-- input: mixArguments - string|array
---- default: nothing
-- output: boolean (true|false) - true if plugin has been executed, false if there was
any error
-- result: Will execute a plugin. So the functions in that plugin will be available for
executing.
*****************************************************************************************
*****************************************************************************************
- execFunction($strPlugin, $strFunction, $mixArguments = "")
-- input: strPlugin - string
---- default: nothing
-- input: strFunction - string
---- default: nothing
-- input: mixArguments - string|Array
---- default: nothing
-- output: result of plugin function
-- result: Will execute a plugin function ($strFunction) with $mixArguments from the
plugin $strPlugin, arguments could be a string (arguments sepearted with the
argument delimeter) or an array with arguments.
*****************************************************************************************
*****************************************************************************************
- getPluginObject($strPlugin)
-- input: strPlugin - string
---- default: nothing
-- output: object
-- result: If the plugin has a class this function will return the object.
*****************************************************************************************
Private functions
*****************************************************************************************
- _setConfigVar($strKey, $strValue)
-- input: strKey - string
---- default: nothing
-- input: strValue - string
---- default: nothing
-- output: nothing
-- result: Will put a variable into the config array ($this->_arrConfig)
*****************************************************************************************
*****************************************************************************************
- _loadPlugin($strPluginFile, $strPluginPath = "")
-- input: strPluginFile - string
---- default: nothing
-- input: strPluginPath - string
---- default: nothing
-- output: nothing
-- result: Will match the $strPluginFile with the prefix when there is a match the plugin
will be loaded into the $this->_arrAvailablePlugins array.
*****************************************************************************************
*****************************************************************************************
- _echoError($strErrorMsg = '', $strErrorType = '')
-- input: strErrorMsg - string
---- default: nothing
-- input: strErrorType - string
---- default: nothing
-- output: Error message
-- result: Build-in error handler, will display $strErrorMsg
***************************************************************************************** |