WordPress.org

Make WordPress Core

Ticket #21330: 21330_opt1.patch

File 21330_opt1.patch, 882 bytes (added by wpsmith, 21 months ago)

Option 1: Reworked, removed extract()

  • wp-includes/option.php

     
    10211021function set_site_transient( $transient, $value, $expiration = 0 ) { 
    10221022        global $_wp_using_ext_object_cache; 
    10231023 
    1024         $value = apply_filters( 'pre_set_site_transient_' . $transient, $value ); 
     1024        $options = apply_filters( 'pre_set_site_transient_' . $transient, $value, $expiration ); 
     1025        if ( is_string( $options ) ) { //backwards compatibility 
     1026                $value = $options; 
     1027   } 
     1028        else { 
     1029       if ( isset( $options['value'] ) 
     1030                    $value = $options['value']; 
     1031       if ( isset( $options['expiration'] ) 
     1032                    $expiration = $options['expiration']; 
     1033   } 
    10251034 
    10261035        if ( $_wp_using_ext_object_cache ) { 
    10271036                $result = wp_cache_set( $transient, $value, 'site-transient', $expiration );