Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Plugin Hooks for a PHP application
blueparukia Offline
Junior Member
**
Posts: 35
Joined: Jan 2008
Post: #13
RE: Plugin Hooks for a PHP application
You get an error when the hook has not been added, I fixed this with:

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
class plugins{
function add_hook($hook, $function)
{
 global $hooks;
 $hooks[$hook][] = $function;
}

function run_hooks($hook)
{
	global $hooks;
if(!is_array($hooks[$hook])){}
else{
foreach($hooks[$hook] as $function) 
{
$function();
}
}
}
}
?>

(This post was last modified: 02-17-2008 02:14 PM by blueparukia.)
02-17-2008 02:14 PM
Find all posts by this user

« Next Oldest | Next Newest »

Messages In This Thread
RE: Plugin Hooks for a PHP application - blueparukia - 02-17-2008 02:14 PM

 Standard Tools
Forum Jump: