Php-hooks

The PHP Hooks Class is a fork of the WordPress filters hook system rolled in to a class to be ported into any php based system .

Download .zip Download .tar.gz View on GitHub

What Is PHP HOOKS?

The PHP Hooks Class is a fork of the WordPress filters hook system rolled in to a class to be ported into any php based system * This class is heavily based on the WordPress plugin API and most (if not all) of the code comes from there. This class is heavily based on the WordPress plugin API and most (if not all) of the code comes from there.

How to Use?

Simple, Include the class file in your application bootstrap (setup/load/configuration or whatever you call it) and start hooking your filter and action hooks using the global `$hooks`. Ex:

  
<?php
include_once('php-hooks.php');
global $hooks;
$hooks->add_action('header_action','echo_this_in_header');
function echo_this_in_header(){
   echo 'this came from a hooked function';
}

then all that is left for you is to call the hooked function when you want anywhere in your aplication, EX:

  
echo '<div id="extra_header">';
global $hooks;
$hooks->do_action('header_action');
echo '</div>';

and you output will be:

  
<div id="extra_header">this came from a hooked function</div>

Authors and Contributors

Php-hooks is maintained by Ohad Raz (@Bainternet).

Support or Contact

Having trouble with Php-hooks? Check out the documentation at https://github.com/bainternet/PHP-Hooks/wiki.