Changeset 37928
- Timestamp:
- 06/30/2016 04:38:45 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/meta.php
r37924 r37928 1033 1033 $passed_args = array_slice( func_get_args(), 2 ); 1034 1034 1035 // There used to be individual args for sanitize and auth callbacks 1036 $has_old_sanitize_cb = $has_old_auth_cb =false;1035 // There used to be individual args for sanitize and auth callbacks 1036 $has_old_sanitize_cb = false; 1037 1037 1038 1038 if ( is_callable( $passed_args[0] ) ) { … … 1045 1045 if ( isset( $passed_args[1] ) && is_callable( $passed_args[1] ) ) { 1046 1046 $args['auth_callback'] = $passed_args[1]; 1047 $has_old_auth_cb = true;1048 1047 } 1049 1048 … … 1067 1066 } 1068 1067 1069 // Back-compat: old sanitize and auth callbacks applied to all of an object type1070 if ( $has_old_sanitize_cb ) {1071 add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 );1072 } elseif ( is_callable( $args['sanitize_callback'] ) && ! empty( $object_subtype ) ) {1073 add_filter( "sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 );1074 }1075 1076 1068 // If `auth_callback` is not provided, fall back to `is_protected_meta()`. 1077 1069 if ( empty( $args['auth_callback'] ) ) { … … 1083 1075 } 1084 1076 1085 if ( $has_old_auth_cb ) { 1077 // Back-compat: old sanitize and auth callbacks applied to all of an object type 1078 if ( $has_old_sanitize_cb ) { 1079 add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1086 1080 add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); 1087 } elseif ( is_callable( $args['auth_callback'] ) && ! empty( $object_subtype ) ) { 1088 add_filter( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); 1089 } 1090 1091 $object_subtype = $args['object_subtype']; 1081 } else { 1082 if ( is_callable( $args['sanitize_callback'] ) ) { 1083 add_filter( "sanitize_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['sanitize_callback'], 10, 4 ); 1084 } 1085 1086 if ( is_callable( $args['auth_callback'] ) ) { 1087 add_filter( "auth_{$object_type}_{$object_subtype}_meta_{$meta_key}", $args['auth_callback'], 10, 6 ); 1088 } 1089 } 1092 1090 1093 1091 // Global registry only contains meta keys registered in the new way with a subtype. 1094 if ( ! empty( $object_subtype ) ) { 1092 if ( ! empty( $args['object_subtype'] ) ) { 1093 $object_subtype = $args['object_subtype']; 1095 1094 $wp_meta_keys[ $object_type ][ $object_subtype ][ $meta_key ] = $args; 1096 1095
Note: See TracChangeset
for help on using the changeset viewer.