wp/wp-includes/class-wp-hook.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
--- a/wp/wp-includes/class-wp-hook.php	Mon Oct 14 18:06:33 2019 +0200
+++ b/wp/wp-includes/class-wp-hook.php	Mon Oct 14 18:28:13 2019 +0200
@@ -71,12 +71,12 @@
 	 * @param int      $accepted_args   The number of arguments the function accepts.
 	 */
 	public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
-		$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
+		$idx              = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
 		$priority_existed = isset( $this->callbacks[ $priority ] );
 
 		$this->callbacks[ $priority ][ $idx ] = array(
-			'function' => $function_to_add,
-			'accepted_args' => $accepted_args
+			'function'      => $function_to_add,
+			'accepted_args' => $accepted_args,
 		);
 
 		// if we're adding a new priority to the list, put them back in sorted order
@@ -243,7 +243,7 @@
 
 		if ( false === $priority ) {
 			$this->callbacks = array();
-		} else if ( isset( $this->callbacks[ $priority ] ) ) {
+		} elseif ( isset( $this->callbacks[ $priority ] ) ) {
 			unset( $this->callbacks[ $priority ] );
 		}
 
@@ -269,14 +269,14 @@
 		$nesting_level = $this->nesting_level++;
 
 		$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
-		$num_args = count( $args );
+		$num_args                           = count( $args );
 
 		do {
 			$this->current_priority[ $nesting_level ] = $priority = current( $this->iterations[ $nesting_level ] );
 
 			foreach ( $this->callbacks[ $priority ] as $the_ ) {
-				if( ! $this->doing_action ) {
-					$args[ 0 ] = $value;
+				if ( ! $this->doing_action ) {
+					$args[0] = $value;
 				}
 
 				// Avoid the array_slice if possible.
@@ -285,7 +285,7 @@
 				} elseif ( $the_['accepted_args'] >= $num_args ) {
 					$value = call_user_func_array( $the_['function'], $args );
 				} else {
-					$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
+					$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
 				}
 			}
 		} while ( false !== next( $this->iterations[ $nesting_level ] ) );
@@ -323,7 +323,7 @@
 	 * @param array $args Arguments to pass to the hook callbacks. Passed by reference.
 	 */
 	public function do_all_hook( &$args ) {
-		$nesting_level = $this->nesting_level++;
+		$nesting_level                      = $this->nesting_level++;
 		$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
 
 		do {
@@ -356,7 +356,6 @@
 	 * Normalizes filters set up before WordPress has initialized to WP_Hook objects.
 	 *
 	 * @since 4.7.0
-	 * @static
 	 *
 	 * @param array $filters Filters to normalize.
 	 * @return WP_Hook[] Array of normalized filters.