1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71:
<?php
class icms_plugins_Handler {
public $pluginPatterns = false;
public function getPlugin($path, $dirname) {
$pluginName = ICMS_PLUGINS_PATH . '/' . $path . '/' . $dirname . '.php';
if (file_exists($pluginName)) {
include_once $pluginName ;
$function = 'icms_plugin_' . $dirname;
if (function_exists($function)) {
$array = $function();
$ret = new icms_plugins_Object($array);
return $ret;
}
}
return FALSE;
}
public function getPluginsArray($path) {
$module_handler = icms::handler('icms_module');
$criteria = new icms_db_criteria_Compo();
$criteria->add(new icms_db_criteria_Item('isactive', 1));
$tempModulesObj = $module_handler->getObjects($criteria);
$modulesObj = array();
foreach ($tempModulesObj as $moduleObj) {
$modulesObj[$moduleObj->getVar('dirname')] = $moduleObj;
}
$aFiles = str_replace('.php', '', icms_core_Filesystem::getFileList(ICMS_PLUGINS_PATH . '/' . $path . '/', '', array('php')));
$ret = array();
foreach($aFiles as $pluginName) {
$module_xoops_version_file = ICMS_MODULES_PATH . "/$pluginName/xoops_version.php";
$module_icms_version_file = ICMS_MODULES_PATH . "/$pluginName/icms_version.php";
if ((file_exists($module_xoops_version_file) || file_exists($module_icms_version_file)) && isset($modulesObj[$pluginName])) {
$ret[$pluginName] = $modulesObj[$pluginName]->getVar('name');
}
}
return $ret;
}
}