\pluginManager

Handles all plugin related tasks.

The plugin manager handles loading of a plugin and its localization files at startup, display of the plugin entry in backend menus. It also supplies plugin tables management functions from the install tool.

Summary

Methods
Properties
Constants
__construct()
prepareData()
render()
loadAllPlugins()
loadModule()
isModuleLoaded()
getModuleInstance()
addPluginInstance()
addBackendMenu()
backendMenuExists()
addEntryToBackendMenu()
getBackendMenusHTML()
addRecord()
createTables()
createTable()
importTable()
deleteTable()
$plugins
$modulesByMode
$modulesByName
$records
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$backendMenus
$backendButtons
N/A

Properties

$plugins

$plugins : 

Type

$modulesByMode

$modulesByMode : 

Type

$modulesByName

$modulesByName : 

Type

$records

$records : 

Type

$backendMenus

$backendMenus : 

Type

$backendButtons

$backendButtons : 

Type

Methods

__construct()

__construct() 

prepareData()

prepareData() 

render()

render(  $mainTemplate) 

Parameters

$mainTemplate

loadAllPlugins()

loadAllPlugins() 

loadModule()

loadModule(  $pluginRelativePath,   $moduleSubDirName,   $moduleClassName, boolean  $autoRendering = true) 

Loads a plugin' module in memory and make it available for access from other classes. Make sure parameter autoRendering is set to true if the module should be added to the render list in frontend or backend.

Parameters

$pluginRelativePath

string Plugin folder path relative to website document root. ex : $config['website_pluginsdir']."/my_videos"

$moduleSubDirName

string Subfolder where the module php file will be found. ex : modules

$moduleClassName

string module class name. ex : editVideos.php

boolean $autoRendering

States if the plugin should be added to render list or not. Some plugins do not need to be shown in frontend or backend and have autorendering set to false.

isModuleLoaded()

isModuleLoaded(  $moduleClassName) : boolean

Checks if a module has been loaded by MindFlow

Parameters

$moduleClassName

string the class name of the requested module

Returns

boolean —

true if the module correctly loaded. false otherwise.

getModuleInstance()

getModuleInstance(  $moduleClassName) : mixed

Returns the current running instance of the requested module.

Parameters

$moduleClassName

string the class name of the requested module

Returns

mixed —

object returns the instanciated class of the module

addPluginInstance()

addPluginInstance(  $plugin) 

Adds a plugin to MindFlow and executes its init() method

Parameters

$plugin

an instance of a class extending the plugin interface

addBackendMenu()

addBackendMenu(string  $menuKey, integer  $menuPriority = MEDIUM_PRIORITY, string  $type = "menu") 

Adds a menu to the backend navigation

Parameters

string $menuKey

must match a key from backend_l10n so the menu label can be written translated. You can extend it and add your own values this way :

             include DOC_ROOT.SUB_DIR.'/mf/plugins/my_plugin/languages/backendMenus_l10n.php';
             $GLOBALS['l10n_text']['backend'] = array_merge_recursive_distinct ($GLOBALS['l10n_text']['backend'],$l10nText);
integer $menuPriority

indicates if this entry should be shown with higher or lower priority (before or after other items). Look at the priority constants at the top of pluginManager.php for values.

string $type

either "menu" or "button"

backendMenuExists()

backendMenuExists(  $menuKey) : boolean

Checks if a menu key is already defined or not.

Parameters

$menuKey

the menu key, for example 'datas'

Returns

boolean —

true if the key already exists

addEntryToBackendMenu()

addEntryToBackendMenu(  $entryHTML,   $menuKey, integer  $itemPriority = MEDIUM_PRIORITY) 

Parameters

$entryHTML
$menuKey
integer $itemPriority

indicates if this entry should be shown with higher or lower priority (before or after other items). Look at the priority constants at the top of pluginManager.php for values.

getBackendMenusHTML()

getBackendMenusHTML() 

addRecord()

addRecord(string  $pluginKey, string  $recordClassName, string  $recordClassRelativePath, boolean  $enableSQLTableCreation = true) 

Registers a dbRecord class with the plugin manager.

Use it in the index.php file of you plugin to inform MindFlow of the new dbRecord classes supplied by your plugin. This will enable your dbRecord class to appear in the install tool.

Parameters

string $pluginKey

Plugin key (should match plugin directory name) of the plugin featuring this record

string $recordClassName

Class name of the record

string $recordClassRelativePath

Path below the web hosting root where the class can be found

boolean $enableSQLTableCreation

Sometimes, when a record subclasses another (for example when you have a record class for frontend view and another for backend view), you may not want the installer to attempt to create the SQL table twice. Set this parameter to false for that purpose.

createTables()

createTables(  $pluginKey = '',   $html) 

Parameters

$pluginKey
$html

createTable()

createTable(string  $pluginKey, string  $recordClassName,   $locale = null, array  $html) 

Used by the install tool to create a single table required by dbRecord classes in use.

Parameters

string $pluginKey

Plugin key (should match plugin directory name) of the plugin featuring this record

string $recordClassName

Class name of the record

$locale
array $html

Array where the HTML code giving feedback from the function will be put

importTable()

importTable(string  $pluginKey, string  $recordClassName, array  $html) 

Used by the install tool to import the initialization data associated to a dbRecord table.

Parameters

string $pluginKey

Plugin key (should match plugin directory name) of the plugin featuring this record

string $recordClassName

Class name of the record

array $html

Array where the HTML code giving feedback from the function will be put

deleteTable()

deleteTable(string  $pluginKey, string  $recordClassName, array  $html) 

Used by the install tool to delete a single dbRecord table.

Parameters

string $pluginKey

Plugin key (should match plugin directory name) of the plugin featuring this record

string $recordClassName

Class name of the record

array $html

Array where the HTML code giving feedback from the function will be put