Making WordPress.org

Changeset 598


Ignore:
Timestamp:
05/05/2014 04:41:05 PM (10 years ago)
Author:
coffee2code
Message:

Add hook type functions do_action_ref_array and apply_filters_ref_array to signature. Fixes some actions being shown as filters. props keesiemeijer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r591 r598  
    344344                $hook_args[] = ' <nobr><span class="arg-type">' . esc_html( $type ) . '</span> <span class="arg-name">' . esc_html( $arg ) . '</span></nobr>';
    345345            }
     346
    346347            $hook_type = get_post_meta( $post_id, '_wp-parser_hook_type', true );
     348            if ( false !== strpos( $hook_type, 'action' ) ) {
     349                $hook_type = ( 'action_reference' === $hook_type ) ? 'do_action_ref_array' : 'do_action';
     350            } else {
     351                $hook_type = ( 'filter_reference' === $hook_type ) ? 'apply_filters_ref_array' : 'apply_filters';
     352            }
     353
    347354            $delimiter = false !== strpos( $signature, '$' ) ? '"' : "'";
    348355            $signature = $delimiter . $signature . $delimiter;
    349             $signature = '<span class="hook-func">' . ( $hook_type === 'action' ? 'do_action' : 'apply_filters' ) . '</span> ( ' . $signature;
     356            $signature = '<span class="hook-func">' . $hook_type . '</span> ( ' . $signature;
    350357            if ( $hook_args ) {
    351358                $signature .= ', ';
Note: See TracChangeset for help on using the changeset viewer.