Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (9 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-hook.php

    r42200 r42343  
    7272         */
    7373        public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
    74                 $idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
     74                $idx              = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
    7575                $priority_existed = isset( $this->callbacks[ $priority ] );
    7676
    7777                $this->callbacks[ $priority ][ $idx ] = array(
    78                         'function' => $function_to_add,
    79                         'accepted_args' => $accepted_args
     78                        'function'      => $function_to_add,
     79                        'accepted_args' => $accepted_args,
    8080                );
    8181
     
    244244                if ( false === $priority ) {
    245245                        $this->callbacks = array();
    246                 } else if ( isset( $this->callbacks[ $priority ] ) ) {
     246                } elseif ( isset( $this->callbacks[ $priority ] ) ) {
    247247                        unset( $this->callbacks[ $priority ] );
    248248                }
     
    270270
    271271                $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
    272                 $num_args = count( $args );
     272                $num_args                           = count( $args );
    273273
    274274                do {
     
    276276
    277277                        foreach ( $this->callbacks[ $priority ] as $the_ ) {
    278                                 if( ! $this->doing_action ) {
    279                                         $args[ 0 ] = $value;
     278                                if ( ! $this->doing_action ) {
     279                                        $args[0] = $value;
    280280                                }
    281281
     
    286286                                        $value = call_user_func_array( $the_['function'], $args );
    287287                                } else {
    288                                         $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
     288                                        $value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
    289289                                }
    290290                        }
     
    324324         */
    325325        public function do_all_hook( &$args ) {
    326                 $nesting_level = $this->nesting_level++;
     326                $nesting_level                      = $this->nesting_level++;
    327327                $this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
    328328
Note: See TracChangeset for help on using the changeset viewer.