Hook system :Hook_xh

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Hook system :Hook_xh

Postby utaka » Tue Dec 29, 2015 10:10 am

Image
I wish. That CMSimple_xh is, with a more flexible HookSystem
The wordpress is great, is equipped with a Hook system, I think flexibility is that plug-ins can be added.
Hook_xh: HookSystem for CMSimple_xh.very simple.However, it is very powerful.
Download : https://github.com/bbfriend/hook_xh

Code: Select all

global $hooks

add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 )
has_filter($tag, $function_to_check = false)
apply_filters( $tag, $value )
apply_filters_ref_array($tag, $args)
remove_filter( $tag, $function_to_remove, $priority = 10 )
remove_all_filters( $tag, $priority = false )
current_filter()
current_action()
doing_filter( $filter = null )
doing_action( $action = null )

add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
do_action($tag, $arg = '')
did_action($tag)
do_action_ref_array($tag, $args)
has_action($tag, $function_to_check = false)
remove_action( $tag, $function_to_remove, $priority = 10 )
remove_all_actions($tag, $priority = false)
_call_all_hook($args)
_filter_build_unique_id($tag, $function, $priority)



The PHP Hooks Class is a fork of the WordPress filters hook system rolled in to a class to be ported into any php based system
This class is heavily based on the WordPress plugin API and most (if not all) of the code comes from there

Original : https://github.com/bainternet/PHP-Hooks
Last edited by utaka on Tue Mar 01, 2016 8:48 am, edited 3 times in total.
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----

utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Re: Hook system

Postby utaka » Thu Jan 28, 2016 3:25 pm

V1.0.2
 Change in easy-to-use function
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----

utaka
Posts: 52
Joined: Fri Sep 18, 2015 6:00 am
Location: japanese
Contact:

Example Code

Postby utaka » Mon Aug 22, 2016 10:19 am

Code: Select all

function xh_func($i, $x....)
{
  ..................
  $val01 = ....
  $val02 = ....

   return $return_val;
}


Change to

Code: Select all

function xh_func($i, $x....)
{
   ..................
  $val01 = ....
  $val02 = ....

   return apply_filters('hook_name', $return_val, $val01,$val02);
}


Example in Plugin

Code: Select all

function my_func($atr1, $atr2){
   //$atr1 == $val01
   //$atr2 == $val02
   ......
   $new_return_val = ...........

   // Further expansion(ex. my_func's Advance Plugin)
   return apply_filters('my_func_hook', $new_return_val, $atr1,$atr2);
}
add_filter('hook_name', 'my_func', 10, 2);
******************************************************
Japan Site http://cmsimple-jp.org
Twitter Googe+ github
*I English is not a good . I'm sorry...
*Ich habe nicht eine gut Deutsch. Es tut mir leid ...
*Jeg kender ikke dansk
--Powered by Google Translate-----


Return to “Open Development”

Who is online

Users browsing this forum: No registered users and 2 guests