PHP Classes

File: plugins/withargs.plugin.php

Recommend this page to a friend!
  Classes of Nemanja Avramovic   Simple Hooks Plugin   plugins/withargs.plugin.php   Download  
File: plugins/withargs.plugin.php
Role: Application script
Content type: text/plain
Description: Plugin file with function which accepts arguments
Class: Simple Hooks Plugin
Setup and call application plug-in scripts
Author: By
Last change: fix: was echo instead of return for user function
Date: 15 years ago
Size: 564 bytes
 

Contents

Class file image Download
<?php

//set plugin id as file name of plugin
$plugin_id = basename(__FILE__);

//some plugin data
$data['name'] = "With args";
$data['author'] = "Nemanja";
$data['url'] = "http://www.instant-update.com/";

//register plugin to SHP
register_plugin($plugin_id, $data);

//plugin function with argument(s) which are sent from application
function args($time) {
    return
"Clock: $time h<br />";
}

//add hook, where to execute a function
add_hook('with_args','args');

//code to execute when loading plugin
echo "<p>Clock plugin LOADED!</p>";
?>