code optimization idea
| ez |  | 
|---|---|
| To activate the code from a hook, we always do something like this: 
/* === Hook === */
$extp = sed_getextplugins('input');
if (is_array($extp))
{
	foreach($extp as $k => $pl)
	{
		include_once($cfg['plugins_dir'].'/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php');
	}
}
/* ======================== */
 The function sed_getextplugins itself gets off course the hooks 
function sed_getextplugins($hook, $cond='R')
{
	global $sed_plugins, $usr;
	if (is_array($sed_plugins))
	{
		foreach($sed_plugins as $i => $k)
		{
			if($k['pl_hook']==$hook && sed_auth('plug', $k['pl_code'], $cond))
			{
				$extplugins[$i] = $k;
			}
		}
	}
	return $extplugins;
}
 
	THE IDEA to speed things up (and this is a just a quick idea i got) to integrate these two parts together in a 
function sed_getextplugins_hook_includecode($hook, $cond='R')
{
	global $sed_plugins, $usr, $cfg;
	if (is_array($sed_plugins))
	{
		foreach($sed_plugins as $i => $k)
		{
			if($k['pl_hook']==$hook && sed_auth('plug', $k['pl_code'], $cond))
			{
				$extplugins[$i] = $k;
				// the above line CAN be optional if the return data is needed ????
				include_once($cfg['plugins_dir'].'/'.$k['pl_code'].'/'.$k['pl_file'].'.php');
			}
		}
	}
	return $extplugins;
}
 Result: And the call to activate hook includes is just: 
/* === Hook === */
$extp = sed_getextplugins_hook_includecode('input');
/* ======================== */
	This could save a couple off calls and possible foreach loops. Also the new code looks better :) 
	greetings, ==- I say: Keep it EZ -== | 
| esclkm |  | 
|---|---|
| include in funtion is very bad Idea - We try in in cotonti 0.7 - but it need to use $_GLOBAL for using variables So in siena this code optimized littledev.ru - мой маленький зарождающийся блог о котонти. снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты | 
| ez |  | 
|---|---|
| 
	@esclkm: ==- I say: Keep it EZ -== | 
| esclkm |  | 
|---|---|
| try to use vaiables in your code))) no way? littledev.ru - мой маленький зарождающийся блог о котонти. снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты | 
| ez |  | 
|---|---|
| Ow.. ok i get it.... forget this post.. it does not work due to wrong variable scope ==- I say: Keep it EZ -== | 
| esclkm |  | 
|---|---|
| you want to rewrite all genoa pluugs? littledev.ru - мой маленький зарождающийся блог о котонти. снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты | 
| Twiebie |  | 
|---|---|
| #31905 esclkm: I wouldn't mind it if you did :) | 
| ez |  | 
|---|---|
| I still work a lot in Genoa.... so I am always looking for improvements there.... 
	Sienna ( I am not sure about that yet )... I see a lot off good things, but i doubt some off them... (Not all changes... I think are real improvements) 
	But hey.... its just my thoughts.. 
	 ==- I say: Keep it EZ -== |