Content / Extending core functionality / Example of using addon handler from core

Example of using addon handler from core

just examples how this is used in core

comments: 0
usersettings.php:
$arr = e107::getAddonConfig('e_user', '', 'delete', USERID);

unsubscribe.php
$ml = e107::getAddon($plugin, 'e_mailout');

upload.php:
$configs = e107::getAddonConfig('e_upload','','config');
$optArray = e107::getAddonConfig('e_upload','','category');

admin upload.php
$this->categories = e107::getAddonConfig('e_upload','','category');
$obj = e107::getAddon($owner,'e_upload');
$uploadObj = e107::getAddon($owner,'e_upload');

gsitemap plugin:
$addons = e107::getAddonConfig('e_gsitemap', null, 'import');

search.php:
$obj = e107::getAddon($id,'e_search')

admin search:
$searchConfigs = e107::getAddonConfig('e_search');

page navigation shortcode:
$links = e107::getAddon('page', 'e_sitelink');

menu manager:
$obj = e107::getAddon($plug,'e_menu');
$form = e107::getAddon($plug,'e_menu',$plug."_menu_form")

email manager:
$cls = e107::getAddon($plug,'e_mailout')

library manager:
$class = e107::getAddon($library['plugin'], 'e_library');

form handler:
$hookObj = e107::getAddon($plugin, 'e_parse');   // method 'toWYSIWYG'  
$obj = e107::getAddon($plug,'e_related')

event handler:
$temp = e107::getAddonConfig('e_event');

parsing handler:
$hookObj = e107::getAddon($plugin, 'e_parse');  // method 'toDB'

comment handler:
$obj = e107::getAddon($plugin,'e_comment');
// method: list($plugin,$method) = explode("::", $this->engine);

comment admin:
$addons = e107::getAddonConfig('e_comment'); //$id = $plugin."::".$val['function'];

Admin UI:
$tmp = e107::getAddonConfig('e_admin', null, 'config', $this);

e107::getAddonConfig('e_admin',null,'process', $this, $id);

$cls = e107::getAddon($plugin,'e_admin',true);
e107::callMethod($cls,'process',$this,array('cmd'=>$command,'ids'=>$selected));

user shortcodes:
$data 		= e107::getAddonConfig('e_user',null,'profile',$this->var);

admin shortcodes:
$configs = e107::getAddonConfig('e_dashboard',null, 'latest');
$configs = e107::getAddonConfig('e_dashboard',null, 'status');

admin newspost:
$this->addons = e107::getAddonConfig('e_admin',null, 'config', $this);

sitelinks:
$tmp = e107::getAddonConfig('e_sitelink','sitelink');

cron:
$this->cronImport(e107::getAddonConfig('e_cron'));	// Import plugin Crons

Not core plugins:
e_user plugin:
$data 		= e107::getAddonConfig('e_user',null,'profile',$this->var);

getAddon() method:
getAddon($pluginName, $addonName, $className = true)
/**
* Retrieves class Object for specific plugin's addon such as e_url.php, e_cron.php, e_sitelink.php
* FIXME override from e.g. core/override/addons/
* 
* @param string $pluginName e.g. faq, page
* @param string $addonName eg. e_cron, e_url, e_module
 * @param mixed $className [optional] true - use default name, false - no object is returned (include only), any string will be used as class name
 * @return object
 */

getAddonConfig method:


getAddonConfig($addonName, $className = '', $methodName='config', $param=null,$param2=null )
/**
* Retrieves config() from all plugins for addons such as e_url.php, e_cron.php, e_sitelink.php
 * @param string $addonName eg. e_cron, e_url
* @param string $className [optional] (if different from addonName)
 * @param string $methodName [optional] (if different from 'config')
 * @return array
 */