Exemplo n.º 1
0
function synved_option_include_addon_list($path, $filter = null)
{
    $addon_list = synved_plugout_module_addon_scan_path($path, $filter);
    if ($addon_list != null) {
        foreach ($addon_list as $addon_name => $addon_file) {
            if (file_exists($addon_file)) {
                include_once $addon_file;
            }
        }
    }
}
Exemplo n.º 2
0
function synved_plugout_module_addon_list($module_id, $filter = null)
{
    $addon_list = array();
    $path_list = synved_plugout_module_path_list_get($module_id, 'addon');
    if ($path_list != null) {
        foreach ($path_list as $path_item) {
            $path = $path_item['path'];
            $extra_list = synved_plugout_module_addon_scan_path($path, $filter);
            if ($extra_list != null) {
                $addon_list = array_merge($addon_list, $extra_list);
            }
        }
    }
    #
    #	$path_list = synved_plugout_module_path_list_get($module_id, 'addon-plugin');
    #
    #	if ($path_list != null)
    #	{
    #		foreach ($path_list as $path_item)
    #		{
    #			$path = $path_item['path'];
    #			$addon_plugin = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'addon-plugin.php';
    #			$extra_list = null;
    #
    #			if (file_exists($addon_plugin))
    #			{
    #				$content = file_get_contents($addon_plugin);
    #				$match = null;
    #
    #  			if (preg_match('/\\/(?:\\*)+\\s*(?:synved-)?addon-plugin\\s*\\{\\s*Name\\s*:\\s*(?P<name>[\\w_-]+)(?:\\s*,\\s*\\w+\\s*:\\s*(?:[\\w_-]+))*\\s*\\}/m', $content, $match) > 0)
    #  			{
    #					$addon_name = $match['name'];
    #					$extra_list = array($addon_name => $addon_plugin);
    #  			}
    #			}
    #
    #			if ($extra_list != null)
    #			{
    #				$addon_list = array_merge($addon_list, $extra_list);
    #			}
    #		}
    #	}
    #
    $path_list = synved_plugout_module_path_list_get($module_id, 'addon-file');
    if ($path_list != null) {
        foreach ($path_list as $path_item) {
            $path = $path_item['path'];
            $extra_list = null;
            if (file_exists($path) && strtolower(substr($path, -4)) == '.php') {
                $addon_name = isset($path_item['path']['meta']['addon-name']) ? $path_item['path']['meta']['addon-name'] : basename($path, '.php');
                $extra_list = array($addon_name => $path);
            }
            if ($extra_list != null) {
                $addon_list = array_merge($addon_list, $extra_list);
            }
        }
    }
    return $addon_list;
}