Class Hook
Adds Hooks and Filters
You can create modules to hooks by adding php files into the \app\modules\enabled directory.
Usage
// add a hook point $content = Hook::addFilter('update_content', $_POST['content']); // Add a module to the hook point--in /modules/<moduleName.php> function clean_html ($html) { $c = htmlentities(trim($html), ENT_NOQUOTES, "UTF-8", false); return $c; } Hook::applyFilter("update_content", "clean_html");
Changelog
Version 1.2
- Updated privacy prefix (_) for consistency
- Fixed Hook::_load method for teamsite bug
Version 1.1
- Added the date section to the documentation
Version 1.0
- static class pattern fixes
- multiple module directories
- crawls subdirectories of module directories
Namespace: Sleepy
License: http://opensource.org/licenses/MIT
Author: Jaime A. Rodriguez hi.i.am.jaime@gmail.com
Version: 1.2
Todo:
Date: July 18, 2016
Located at class.hooks.php
License: http://opensource.org/licenses/MIT
Author: Jaime A. Rodriguez hi.i.am.jaime@gmail.com
Version: 1.2
Todo:
devise a better way of passing multiple parameters to hooks, perhaps use objects instead of arrays
Date: July 18, 2016
Located at class.hooks.php
private
|
|
private
|
|
private static
object
|
|
private static
|
|
public static
|
#
applyFilter( string $name, string $function, integer $args,… )
Adds a new filter to a filter-type hook point |
public static
|
|
public static
|
|
public static
|
private static
boolean
|
$_initialized
Has this been initialized? |
#
false
|
private static
_Filter[]
|
$_filters
An array of filters |
#
array()
|
public static
string
|
$directories
The directories where the modules are stored |
#
array()
|