parent
fc3474f255
commit
bd7072a8dc
|
@ -122,6 +122,45 @@ class WC_HookFinder {
|
|||
case 'filter' :
|
||||
case 'action' :
|
||||
$hook = trim( $token[1], "'" );
|
||||
$loop = 0;
|
||||
|
||||
if ( '_' === substr( $hook, '-1', 1 ) ) {
|
||||
$hook .= '{';
|
||||
$open = true;
|
||||
// Keep adding to hook until we find a comma or colon
|
||||
while ( 1 ) {
|
||||
$loop ++;
|
||||
$next_hook = trim( trim( is_string( $tokens[ $index + $loop ] ) ? $tokens[ $index + $loop ] : $tokens[ $index + $loop ][1], '"' ), "'" );
|
||||
|
||||
if ( in_array( $next_hook, array( '.', '{', '}', '"', "'", ' ' ) ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$hook_first = substr( $next_hook, 0, 1 );
|
||||
$hook_last = substr( $next_hook, -1, 1 );
|
||||
|
||||
if ( in_array( $next_hook, array( ',', ';' ) ) ) {
|
||||
if ( $open ) {
|
||||
$hook .= '}';
|
||||
$open = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( '_' === $hook_first ) {
|
||||
$next_hook = '}' . $next_hook;
|
||||
$open = false;
|
||||
}
|
||||
|
||||
if ( '_' === $hook_last ) {
|
||||
$next_hook .= '{';
|
||||
$open = true;
|
||||
}
|
||||
|
||||
$hook .= $next_hook;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( self::$custom_hooks_found[ $hook ] ) ) {
|
||||
self::$custom_hooks_found[ $hook ]['file'][] = self::$current_file;
|
||||
} else {
|
||||
|
|
|
@ -906,7 +906,7 @@ if ( ! function_exists( 'woocommerce_template_single_add_to_cart' ) ) {
|
|||
*/
|
||||
function woocommerce_template_single_add_to_cart() {
|
||||
global $product;
|
||||
do_action( 'woocommerce_' . $product->product_type . '_add_to_cart' );
|
||||
do_action( 'woocommerce_' . $product->product_type . '_add_to_cart' );
|
||||
}
|
||||
}
|
||||
if ( ! function_exists( 'woocommerce_simple_add_to_cart' ) ) {
|
||||
|
|
Loading…
Reference in New Issue