hooks.php
author Dan
Sun, 14 Dec 2008 00:35:52 -0500
changeset 34 a8daa2016cf1
parent 8 0acb8d9a3194
permissions -rw-r--r--
Added support for last month and last 2 weeks graphs; adjusted web interface accordingly
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