Location: PHPKode > scripts > Simple Hooks Plugin > simple-hooks-plugin/init.php
<?php

//include Simple Hooks Plugin Class
include "SHP.class.php";

//create instance of class
$SHP = new SHP();

//set hook to which plugin developers can assign functions
$SHP->developer_set_hook('test');

//set multiple hooks to which plugin developers can assign functions
$SHP->developer_set_hooks(array('test1','test2', 'with_args'));

//load plugins from folder, if no argument is supplied, a './plugins/' constant will be used
//trailing slash at the end is REQUIRED!
//this method will load all *.plugin.php files from given directory, INCLUDING subdirectories
$SHP->load_plugins();

//now, this is a workaround because plugins, when included, can't access $SHP variable, so we
//as developers have to basically redefine functions which can be called from plugin files
function add_hook($where, $function) {
	global $SHP;
	$SHP->add_hook($where, $function);
}

//same as above
function register_plugin($plugin_id, $data) {
	global $SHP;
	$SHP->register_plugin($plugin_id, $data);
}

?>
Return current item: Simple Hooks Plugin