Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.5/wp-includes/comment.php

    r22229 r23332  
    291291            );
    292292            if ( ! empty( $this->query_vars['meta_key'] ) ) {
    293                 $allowed_keys[] = $q['meta_key'];
     293                $allowed_keys[] = $this->query_vars['meta_key'];
    294294                $allowed_keys[] = 'meta_value';
    295295                $allowed_keys[] = 'meta_value_num';
     
    297297            $ordersby = array_intersect( $ordersby, $allowed_keys );
    298298            foreach ( $ordersby as $key => $value ) {
    299                 if ( $value == $q['meta_key'] || $value == 'meta_value' ) {
     299                if ( $value == $this->query_vars['meta_key'] || $value == 'meta_value' ) {
    300300                    $ordersby[ $key ] = "$wpdb->commentmeta.meta_value";
    301301                } elseif ( $value == 'meta_value_num' ) {
     
    19521952}
    19531953
     1954/**
     1955 * Default filter attached to pingback_ping_source_uri to validate the pingback's Source URI
     1956 *
     1957 * @since 3.5.1
     1958 *
     1959 * @param string $source_uri
     1960 * @return string
     1961 */
     1962function pingback_ping_source_uri( $source_uri ) {
     1963    $uri = esc_url_raw( $source_uri, array( 'http', 'https' ) );
     1964    if ( ! $uri )
     1965        return '';
     1966
     1967    $parsed_url = @parse_url( $uri );
     1968    if ( ! $parsed_url )
     1969        return '';
     1970
     1971    if ( isset( $parsed_url['user'] ) || isset( $parsed_url['pass'] ) )
     1972        return '';
     1973
     1974    if ( false !== strpos( $parsed_url['host'], ':' ) )
     1975        return '';
     1976
     1977    $parsed_home = @parse_url( get_option( 'home' ) );
     1978
     1979    $same_host = strtolower( $parsed_home['host'] ) === strtolower( $parsed_url['host'] );
     1980
     1981    if ( ! $same_host ) {
     1982        $host = trim( $parsed_url['host'], '.' );
     1983        if ( preg_match( '#^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$#', $host ) ) {
     1984            $ip = $host;
     1985        } else {
     1986            $ip = gethostbyname( $host );
     1987            if ( $ip === $host ) // Error condition for gethostbyname()
     1988                $ip = false;
     1989        }
     1990        if ( $ip ) {
     1991            if ( '127.0.0.1' === $ip )
     1992                return '';
     1993            $parts = array_map( 'intval', explode( '.', $ip ) );
     1994            if ( 10 === $parts[0] )
     1995                return '';
     1996            if ( 172 === $parts[0] && 16 <= $parts[1] && 31 >= $parts[1] )
     1997                return '';
     1998            if ( 192 === $parts[0] && 168 === $parts[1] )
     1999                return '';
     2000        }
     2001    }
     2002
     2003    if ( empty( $parsed_url['port'] ) )
     2004        return $uri;
     2005
     2006    $port = $parsed_url['port'];
     2007    if ( 80 === $port || 443 === $port || 8080 === $port )
     2008        return $uri;
     2009
     2010    if ( $parsed_home && $same_host && $parsed_home['port'] === $port )
     2011        return $uri;
     2012
     2013    return '';
     2014}
     2015
     2016/**
     2017 * Default filter attached to xmlrpc_pingback_error.
     2018 *
     2019 * Returns a generic pingback error code unless the error code is 48,
     2020 * which reports that the pingback is already registered.
     2021 *
     2022 * @since 3.5.1
     2023 * @link http://www.hixie.ch/specs/pingback/pingback#TOC3
     2024 *
     2025 * @param IXR_Error $ixr_error
     2026 * @return IXR_Error
     2027 */
     2028function xmlrpc_pingback_error( $ixr_error ) {
     2029    if ( $ixr_error->code === 48 )
     2030        return $ixr_error;
     2031    return new IXR_Error( 0, '' );
     2032}
     2033
    19542034//
    19552035// Cache
Note: See TracChangeset for help on using the changeset viewer.