read("plugins", 0) === FALSE)
{
if (!file_exists(FIEME_ROOT . "cache//" . "plugins"))
{
$core->update_plugins();
}
else
{
$core->run_background(FIEME_ROOT . "cache\cache_files\\refresh_plugins.php");
}
}
require_once FIEME_ROOT . 'cache/plugins';
if(@is_array($p_c['active'])) //p_c = plugin_cache - Defined in the plugin!
{
foreach($p_c['active'] as $p=>$v)
{
if($p != "" && file_exists(FIEME_ROOT."includes/plugins/".$p.".php"))
{
require_once FIEME_ROOT."includes/plugins/".$p.".php";
if (FIEME_DEV == 1)
{
global $dev_content;
$dev_content .= "included plugin: $v!
";
}
}
}
}
}
//Run by the plugins, telling us what plugins will be run, and when.
function add_hook($where, $function, $priority=50)
{
// Stops the defining, if the hook is already installed.
if(@$this->hooks[$where][$priority][$function] == 1)
{
return true;
}
// Add the hook
$this->hooks[$where][$priority][$function] = $function;
if (FIEME_DEV == 1)
{
global $dev_content;
$dev_content .= "defined $function@$where
";
}
return true;
}
//Let's run all my hooks.
function run_hooks($where, $arguments="")
{
if(!is_array(@$this->hooks[$where]))
{
return $arguments;
}
$this->current_hook = $where;
ksort($this->hooks[$where]);
foreach($this->hooks[$where] as $priority => $function)
{
if(is_array($function))
{
foreach($function as $functions)
{
$returnargs = call_user_func_array($functions, array(&$arguments));
if($returnargs)
{
$arguments = $returnargs;
}
}
}
}
$this->current_hook = '';
return $arguments;
}
//Remove the hook
function remove_hook($where, $function, $priority=10)
{
// Check to see if we don't already have this hook running at this priority
if(!isset($this->hooks[$where][$priority][$function]))
{
return true;
}
unset($this->hooks[$where][$priority][$function]);
}
}
?>