hooks.php
author Dan
Sat, 10 Jan 2009 14:12:36 -0500
changeset 50 45164bc2567a
parent 8 0acb8d9a3194
permissions -rw-r--r--
Whoops, debug message.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     1
<?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     2
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     3
global $eb_hooks;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     4
$eb_hooks = array();
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     5
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     6
function eb_hook($hook_name, $code)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     7
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     8
  global $eb_hooks;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     9
  if ( !isset($eb_hooks[$hook_name]) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    10
    $eb_hooks[$hook_name] = array();
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    11
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    12
  $eb_hooks[$hook_name][] = $code;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    13
}
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    14
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    15
function eb_fetch_hook($hook_name)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    16
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    17
  global $eb_hooks;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    18
  return ( isset($eb_hooks[$hook_name]) ) ? implode("\n", $eb_hooks[$hook_name]) : 'eb_void();';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    19
}
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    20
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    21
// null function for filling empty hooks
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    22
function eb_void()
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    23
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    24
}
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    25