<?xml version='1.0' encoding='UTF-8'?>
<rss version='2.0'>
	<channel>
		<title>cotonti.com : idea: Optimize plugin hook includes</title>
		<link>https://www.cotonti.com</link>
		<description>Laatste forum onderwerpen</description>
		<generator>Cotonti</generator>
		<language>en</language>
		<pubDate>Fri, 01 May 2026 02:31:32 -0000</pubDate>

		<item>
			<title>ez</title>
			<description><![CDATA[<p>
	I still work a lot in Genoa.... so I am always looking for improvements there....</p>
<p>
	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)<br />
	So I am really wondering where Sienna is going.<br /><br />
	What I really would have liked is more good plugins rather then a core rewrite... I would have loved a more gradual core change.</p>
<p>
	But hey.... its just my thoughts..<br />
	 </p>
<p>
	<br />
	 </p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 18:15:45 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31911]]></link>
		</item>
		<item>
			<title>Twiebie</title>
			<description><![CDATA[<blockquote>
	<a href="https://www.cotonti.com/forums?m=posts&amp;p=31905%2331905">#31905</a> <strong>esclkm: </strong><br /><p>
		you want to rewrite all genoa pluugs?</p>
</blockquote>
<p>
	I wouldn't mind it if you did :)</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 18:04:27 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31910]]></link>
		</item>
		<item>
			<title>esclkm</title>
			<description><![CDATA[<p>
	you want to rewrite all genoa pluugs?</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 16:18:34 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31905]]></link>
		</item>
		<item>
			<title>ez</title>
			<description><![CDATA[<p>
	Ow.. ok i get it.... forget this post.. it does not work due to wrong variable scope</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 16:13:01 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31904]]></link>
		</item>
		<item>
			<title>esclkm</title>
			<description><![CDATA[<p>
	try to use vaiables in your code))) no way?</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 13:44:43 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31902]]></link>
		</item>
		<item>
			<title>ez</title>
			<description><![CDATA[<p>
	@esclkm:<br />
	Could you explain more about why this is a bad idea.... ???<br />
	 </p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 13:07:58 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31901]]></link>
		</item>
		<item>
			<title>esclkm</title>
			<description><![CDATA[<p>
	include in funtion is very bad Idea - We try in in cotonti 0.7 - but it need to use $_GLOBAL for using variables</p>
<p>
	So in siena this code optimized</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 13:00:51 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31900]]></link>
		</item>
		<item>
			<title>ez</title>
			<description><![CDATA[<p>
	To activate the code from a hook, we always do something like this:</p>
<pre class="brush:php;">
/* === Hook === */
$extp = sed_getextplugins('input');
if (is_array($extp))
{
	foreach($extp as $k =&gt; $pl)
	{
		include_once($cfg['plugins_dir'].'/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php');
	}
}
/* ======================== */
</pre>
<p>
	 </p>
<p>
	The function <span style="color:#ff0000;">sed_getextplugins</span> itself gets off course the hooks</p>
<pre class="brush:php;">
function sed_getextplugins($hook, $cond='R')
{
	global $sed_plugins, $usr;

	if (is_array($sed_plugins))
	{
		foreach($sed_plugins as $i =&gt; $k)
		{
			if($k['pl_hook']==$hook &amp;&amp; sed_auth('plug', $k['pl_code'], $cond))
			{
				$extplugins[$i] = $k;
			}
		}
	}
	return $extplugins;
}
</pre>
<p>
	 </p>
<p>
	THE IDEA to speed things up (and this is a just a quick idea i got) to integrate these two parts together in a<br />
	new function in functions.php.</p>
<pre class="brush:php;">
function sed_getextplugins_hook_includecode($hook, $cond='R')
{
	global $sed_plugins, $usr, $cfg;

	if (is_array($sed_plugins))
	{
		foreach($sed_plugins as $i =&gt; $k)
		{
			if($k['pl_hook']==$hook &amp;&amp; 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;
}
</pre>
<p>
	 </p>
<p>
	<span style="color:#ff0000;"><u><strong>Result:</strong></u></span></p>
<p>
	And the call to activate hook includes is just:</p>
<pre class="brush:php;">
/* === Hook === */
$extp = sed_getextplugins_hook_includecode('input');
/* ======================== */

</pre>
<p>
	This could save a couple off calls and possible foreach loops. Also the new code looks better :)<br />
	I am an optimizing freak... so i always look different @ the code</p>
<p>
	greetings,<br />
	EZ</p>
]]></description>
			<pubDate>Ma, 05 Dec 2011 12:56:53 -0000</pubDate>
			<link><![CDATA[https://www.cotonti.com/nl/forums?m=posts&q=6654&d=0#post31899]]></link>
		</item>
	</channel>
</rss>