Changeset 36100 for trunk/src/wp-includes/formatting.php
- Timestamp:
- 12/26/2015 05:21:14 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r36097 r36100 3885 3885 */ 3886 3886 function map_deep( $value, $callback ) { 3887 if ( is_array( $value ) || is_object( $value ) ) { 3888 foreach ( $value as &$item ) { 3889 $item = map_deep( $item, $callback ); 3890 } 3891 return $value; 3887 if ( is_array( $value ) ) { 3888 foreach ( $value as $index => $item ) { 3889 $value[ $index ] = map_deep( $item, $callback ); 3890 } 3891 } elseif ( is_object( $value ) ) { 3892 $object_vars = get_object_vars( $value ); 3893 foreach ( $object_vars as $property_name => $property_value ) { 3894 $value->$property_name = map_deep( $property_value, $callback ); 3895 } 3892 3896 } else { 3893 return call_user_func( $callback, $value ); 3894 } 3897 $value = call_user_func( $callback, $value ); 3898 } 3899 3900 return $value; 3895 3901 } 3896 3902
Note: See TracChangeset
for help on using the changeset viewer.