Make WordPress Core

Ticket #34141: 34141.4.diff

File 34141.4.diff, 3.5 KB (added by SergeyBiryukov, 8 years ago)
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    62776277                                'X-Pingback-Forwarded-For' => $remote_ip,
    62786278                        ),
    62796279                );
     6280
    62806281                $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
    6281                 $linea = wp_remote_retrieve_body( $request );
     6282                $remote_source = $remote_source_original = wp_remote_retrieve_body( $request );
    62826283
    6283                 if ( !$linea )
     6284                if ( ! $remote_source ) {
    62846285                        return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
     6286                }
    62856287
    62866288                /**
    62876289                 * Filter the pingback remote source.
     
    62886290                 *
    62896291                 * @since 2.5.0
    62906292                 *
    6291                  * @param string $linea        Response object for the page linked from.
    6292                  * @param string $pagelinkedto URL of the page linked to.
     6293                 * @param string $remote_source Response source for the page linked from.
     6294                 * @param string $pagelinkedto  URL of the page linked to.
    62936295                 */
    6294                 $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
     6296                $remote_source = apply_filters( 'pre_remote_source', $remote_source, $pagelinkedto );
    62956297
    62966298                // Work around bug in strip_tags():
    6297                 $linea = str_replace('<!DOC', '<DOC', $linea);
    6298                 $linea = preg_replace( '/[\r\n\t ]+/', ' ', $linea ); // normalize spaces
    6299                 $linea = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea );
     6299                $remote_source = str_replace( '<!DOC', '<DOC', $remote_source );
     6300                $remote_source = preg_replace( '/[\r\n\t ]+/', ' ', $remote_source ); // normalize spaces
     6301                $remote_source = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $remote_source );
    63006302
    6301                 preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
     6303                preg_match( '|<title>([^<]*?)</title>|is', $remote_source, $matchtitle );
    63026304                $title = $matchtitle[1];
    63036305                if ( empty( $title ) )
    63046306                        return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
    63056307
    6306                 $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
     6308                $remote_source = strip_tags( $remote_source, '<a>' ); // just keep the tag we need
    63076309
    6308                 $p = explode( "\n\n", $linea );
     6310                $p = explode( "\n\n", $remote_source );
    63096311
    63106312                $preg_target = preg_quote($pagelinkedto, '|');
    63116313
     
    63536355                $this->escape($comment_content);
    63546356                $comment_type = 'pingback';
    63556357
    6356                 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
     6358                $commentdata = compact(
     6359                        'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email',
     6360                        'comment_content', 'comment_type', 'remote_source', 'remote_source_original'
     6361                );
    63576362
    63586363                $comment_ID = wp_new_comment($commentdata);
    63596364
  • src/wp-includes/comment.php

     
    18151815         *
    18161816         * @param int        $comment_ID       The comment ID.
    18171817         * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
     1818         * @param array      $commentdata      Comment data.
    18181819         */
    1819         do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );
     1820        do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
    18201821
    18211822        return $comment_ID;
    18221823}