hooks.php
changeset 8 0acb8d9a3194
equal deleted inserted replaced
7:1d6e762433fe 8:0acb8d9a3194
       
     1 <?php
       
     2 
       
     3 global $eb_hooks;
       
     4 $eb_hooks = array();
       
     5 
       
     6 function eb_hook($hook_name, $code)
       
     7 {
       
     8   global $eb_hooks;
       
     9   if ( !isset($eb_hooks[$hook_name]) )
       
    10     $eb_hooks[$hook_name] = array();
       
    11   
       
    12   $eb_hooks[$hook_name][] = $code;
       
    13 }
       
    14 
       
    15 function eb_fetch_hook($hook_name)
       
    16 {
       
    17   global $eb_hooks;
       
    18   return ( isset($eb_hooks[$hook_name]) ) ? implode("\n", $eb_hooks[$hook_name]) : 'eb_void();';
       
    19 }
       
    20 
       
    21 // null function for filling empty hooks
       
    22 function eb_void()
       
    23 {
       
    24 }
       
    25