PHP Classes
elePHPant
Icontem

YAPPM: Manage functionality loaded from external plug-ins

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2004-06-30 (12 years ago) RSS 2.0 feedNot enough user ratingsTotal: 621 All time: 4,836 This week: 1,090Up
Version License Categories
yappm 1.0FreewareLanguage
Description Author

YAPPM stands for Yet Another PHP Plug-in Manager. This is a class that can load functionality from one of more extension plug-ins.

With this class you can execute functions defined in external plug-ins defined as classes or as a set of functions.

This class loads the functionality automatically so you do not have to include your functions. Just execute the calls to the plugged functions.

All the loaded plugins are stored in an array so you can execute functions from multiple plug-ins in the same script.

Picture of Daniel van Hoesel
Name: Daniel van Hoesel <contact>
Classes: 1 package by
Country: The Netherlands The Netherlands

Details
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
*****************************************************************************************
  Files folder image Files  
File Role Description
Files folder imageplugins (2 files)
Plain text file class.plugin.php Class Class file
Accessible without login Plain text file README Doc. Readme file
Accessible without login Plain text file test.class.plugin.php Example Test file

  Files folder image Files  /  plugins  
File Role Description
  Plain text file plugin.bar.php Class Plugin class
  Plain text file plugin.foo.php Class Plugin class

 Version Control Unique User Downloads Download Rankings  
 0%
Total:621
This week:0
All time:4,836
This week:1,090Up