hooks.php
author Dan
Sun, 07 Dec 2008 17:45:50 -0500
changeset 32 236fd4f65752
parent 8 0acb8d9a3194
permissions -rw-r--r--
Added support for bold, /me, and of course, colors.
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