Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.6/wp-includes/functions.php

    r25345 r24918  
    243243 *
    244244 * @param mixed $data Value to check to see if was serialized.
    245  * @param bool $strict Optional. Whether to be strict about the end of the string. Defaults true.
    246245 * @return bool False if not serialized and true if it was.
    247246 */
    248 function is_serialized( $data, $strict = true ) {
     247function is_serialized( $data ) {
    249248    // if it isn't a string, it isn't serialized
    250249    if ( ! is_string( $data ) )
     
    258257    if ( ':' !== $data[1] )
    259258        return false;
    260     if ( $strict ) {
    261         $lastc = $data[ $length - 1 ];
    262         if ( ';' !== $lastc && '}' !== $lastc )
    263             return false;
    264     } else {
    265         $semicolon = strpos( $data, ';' );
    266         $brace     = strpos( $data, '}' );
    267         // Either ; or } must exist.
    268         if ( false === $semicolon && false === $brace )
    269             return false;
    270         // But neither must be in the first X characters.
    271         if ( false !== $semicolon && $semicolon < 3 )
    272             return false;
    273         if ( false !== $brace && $brace < 4 )
    274             return false;
    275     }
     259    $lastc = $data[$length-1];
     260    if ( ';' !== $lastc && '}' !== $lastc )
     261        return false;
    276262    $token = $data[0];
    277263    switch ( $token ) {
    278264        case 's' :
    279             if ( $strict ) {
    280                 if ( '"' !== $data[ $length - 2 ] )
    281                     return false;
    282             } elseif ( false === strpos( $data, '"' ) ) {
     265            if ( '"' !== $data[$length-2] )
    283266                return false;
    284             }
    285267        case 'a' :
    286268        case 'O' :
     
    289271        case 'i' :
    290272        case 'd' :
    291             $end = $strict ? '$' : '';
    292             return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
     273            return (bool) preg_match( "/^{$token}:[0-9.E-]+;\$/", $data );
    293274    }
    294275    return false;
     
    337318    // Double serialization is required for backward compatibility.
    338319    // See http://core.trac.wordpress.org/ticket/12930
    339     if ( is_serialized( $data, false ) )
     320    if ( is_serialized( $data ) )
    340321        return serialize( $data );
    341322
     
    13031284
    13041285    if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) )
    1305         return wp_validate_redirect( $ref, false );
     1286        return wp_unslash( $ref );
    13061287    return false;
    13071288}
     
    13181299function wp_get_original_referer() {
    13191300    if ( !empty( $_REQUEST['_wp_original_http_referer'] ) )
    1320         return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
     1301        return wp_unslash( $_REQUEST['_wp_original_http_referer'] );
    13211302    return false;
    13221303}
     
    20262007 * @uses wp_get_upload_mime_types() to fetch the list of mime types
    20272008 *
    2028  * @param int|WP_User $user Optional. User to check. Defaults to current user.
    20292009 * @return array Array of mime types keyed by the file extension regex corresponding to those types.
    20302010 */
    2031 function get_allowed_mime_types( $user = null ) {
    2032     $t = wp_get_mime_types();
    2033 
    2034     unset( $t['swf'], $t['exe'] );
    2035     if ( function_exists( 'current_user_can' ) )
    2036         $unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
    2037 
    2038     if ( empty( $unfiltered ) )
    2039         unset( $t['htm|html'] );
    2040 
    2041     return apply_filters( 'upload_mimes', $t, $user );
     2011function get_allowed_mime_types() {
     2012    return apply_filters( 'upload_mimes', wp_get_mime_types() );
    20422013}
    20432014
Note: See TracChangeset for help on using the changeset viewer.