Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Plugin Hooks for a PHP application
ZiNgA BuRgA Offline
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #10
RE: Plugin Hooks for a PHP application
blueparukia Wrote:Are arrays the only way to do this?
No, but it's the most logical solution.

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
function add_a_hook($hook, $function)
{
 global $plugin_hooks;
 $plugin_hooks[$hook][] = $function;
}

function run_a_hook($hook)
{
 global $plugin_hooks;
 foreach($plugin_hooks[$hook] as $function)
 {
  $function();
 }
}

If you're really determined to do PHP scripting, you should really understand the above concept.


My Blog
(This post was last modified: 02-16-2008 11:36 PM by ZiNgA BuRgA.)
02-16-2008 11:35 PM
Find all posts by this user

« Next Oldest | Next Newest »

Messages In This Thread
RE: Plugin Hooks for a PHP application - ZiNgA BuRgA - 02-16-2008 11:35 PM

 Standard Tools
Forum Jump: