ThemePlate / Hook

Advanced wrapper for filters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ThemePlate Hook

Usage

use ThemePlate\Hook;

// Hook::<ACTION>( <TAG>, <VALUE> )
Hook::append( 'sample_filter', 'ing' );
Hook::prepend( 'sample_filter', 're-' );
Hook::return( 'sample_filter', 'this!' );
Hook::pluck( 'sample_filter', 'i' );
Hook::replace( 'sample_filter', '!', '...' );
Hook::insert( 'sample_filter', 'u', 2 );
Hook::once( 'sample_filter', array( 'pluck', 'th' ) );

^Line by line output with initial value test

ACTION VALUE RESULT #1 RESULT #2
append ing testing testing
prepend re- re-testing re-testing
return this! this! this!
pluck i ths! ths!
replace ["!","..."] ths... ths...
insert ["u",2] thus... thus...
once ["pluck","th"] us... thus...
// apply_filters( <TAG>, <INITIAL> );
apply_filters( 'sample_filter', 'test' ); // <RESULT #1>
apply_filters( 'sample_filter', 'test' ); // <RESULT #2>

About

Advanced wrapper for filters

License:GNU General Public License v3.0


Languages

Language:PHP 100.0%