Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Nemanja Avramovic  >  Simple Hooks Plugin  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example of usage
Class: Simple Hooks Plugin
Setup and call application plug-in scripts
Author: By
Last change: updated with new example (arguments)
Date: 6 years ago
Size: 811 bytes
 

Contents

Class file image Download
<?php

//init plugins system
include "init.php";

//place this where you want to execute hooks for "test"
$SHP->execute_hooks('test');

//your application code
echo "<p>some hardcoded stuff</p>";


//execute hooks for "test1" only if there are hooks to execute
if ($SHP->hooks_exist('test1')) {
    
$SHP->execute_hooks('test1');
}
else {
    echo(
'<p>no hooks for test1!!!</p>');
}

//execute hooks for "test2" only if there are hooks to execute
if ($SHP->hooks_exist('test2')) {
    
$SHP->execute_hooks('test2');
}
else {
    echo(
'<p>no hooks for test2!!!</p>');
}

//execute hooks for "test2" only if there are hooks to execute
if ($SHP->hooks_exist('with_args')) {
    echo 
$SHP->execute_hooks'with_args'date('H:i'time()) );
}
else {
    echo(
'<p>no hooks for test2!!!</p>');
}


?>