Make WordPress Core

Ticket #34141: 34141.3.diff

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

     
    62346234                                'X-Pingback-Forwarded-For' => $remote_ip,
    62356235                        ),
    62366236                );
     6237
    62376238                $request = wp_safe_remote_get( $pagelinkedfrom, $http_api_args );
    6238                 $linea = wp_remote_retrieve_body( $request );
     6239                $remote_source = wp_remote_retrieve_body( $request );
    62396240
    6240                 if ( !$linea )
     6241                if ( ! $remote_source ) {
    62416242                        return $this->pingback_error( 16, __( 'The source URL does not exist.' ) );
     6243                }
    62426244
    62436245                /**
    62446246                 * Filter the pingback remote source.
     
    62456247                 *
    62466248                 * @since 2.5.0
    62476249                 *
    6248                  * @param string $linea        Response object for the page linked from.
    6249                  * @param string $pagelinkedto URL of the page linked to.
     6250                 * @param string $remote_source Response source for the page linked from.
     6251                 * @param string $pagelinkedto  URL of the page linked to.
    62506252                 */
    6251                 $linea = apply_filters( 'pre_remote_source', $linea, $pagelinkedto );
     6253                $remote_source = apply_filters( 'pre_remote_source', $remote_source, $pagelinkedto );
    62526254
    62536255                // Work around bug in strip_tags():
    6254                 $linea = str_replace('<!DOC', '<DOC', $linea);
    6255                 $linea = preg_replace( '/[\r\n\t ]+/', ' ', $linea ); // normalize spaces
    6256                 $linea = preg_replace( "/<\/*(h1|h2|h3|h4|h5|h6|p|th|td|li|dt|dd|pre|caption|input|textarea|button|body)[^>]*>/", "\n\n", $linea );
     6256                $remote_source = str_replace( '<!DOC', '<DOC', $remote_source );
     6257                $remote_source = preg_replace( '/[\r\n\t ]+/', ' ', $remote_source ); // normalize spaces
     6258                $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 );
    62576259
    6258                 preg_match('|<title>([^<]*?)</title>|is', $linea, $matchtitle);
     6260                preg_match( '|<title>([^<]*?)</title>|is', $remote_source, $matchtitle );
    62596261                $title = $matchtitle[1];
    62606262                if ( empty( $title ) )
    62616263                        return $this->pingback_error( 32, __('We cannot find a title on that page.' ) );
    62626264
    6263                 $linea = strip_tags( $linea, '<a>' ); // just keep the tag we need
     6265                $remote_source = strip_tags( $remote_source, '<a>' ); // just keep the tag we need
    62646266
    6265                 $p = explode( "\n\n", $linea );
     6267                $p = explode( "\n\n", $remote_source );
    62666268
    62676269                $preg_target = preg_quote($pagelinkedto, '|');
    62686270
     
    63106312                $this->escape($comment_content);
    63116313                $comment_type = 'pingback';
    63126314
    6313                 $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type');
     6315                $commentdata = compact( 'comment_post_ID', 'comment_author', 'comment_author_url', 'comment_author_email', 'comment_content', 'comment_type', 'remote_source' );
    63146316
    63156317                $comment_ID = wp_new_comment($commentdata);
    63166318
  • src/wp-includes/comment-functions.php

     
    17401740         *
    17411741         * @param int        $comment_ID       The comment ID.
    17421742         * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
     1743         * @param array      $commentdata      Comment data.
    17431744         */
    1744         do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );
     1745        do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
    17451746
    17461747        return $comment_ID;
    17471748}